text stringlengths 2 1.04M | meta dict |
|---|---|
=====
setix
=====
At its core setix provides a "set intersection index", an inverted index data structure designed for storing sets
of symbols and fast querying of sets intersecting the given set, with sorting based on the number of intersections
or a similarity measure.
Additionally, a wrapper for indexing strings is provided in setix.trgm, which implements a trigram index compatible
with the PostgreSQL extension pg_trgm.
Examples
========
Using a set index:
.. code-block:: python
import setix
ix = setix.SetIntersectionIndex ()
ix.add ((1, 2, 3))
ix.add ((1, 2, 4))
ix.add ((2, 3, 4))
ix.find ((1, 2), 1).get_list()
# returns [(2, [(1, 2, 3)]),
# (2, [(1, 2, 4)]),
# (1, [(2, 3, 4)])]
# (the order of the first two results can change as they have equal scores)
Using a trigram index:
.. code-block:: python
import setix.trgm
ix = setix.trgm.TrigramIndex ()
ix.add ("strength")
ix.add ("strenght")
ix.add ("strength and honor")
ix.find ("stremgth", threshold=1).get_list()
# returns [(6, ["strength and honor"])
# (6, ["strength"]),
# (4, ["strenght"])]
ix.find_similar ("stremgth", threshold=0.1).get_list()
# returns [(0.5, ["strength"]), # 6 intersections / (9 total + 9 total - 6)
# (0.29, ["strenght"]), # 4 intersections / (9 total + 9 total - 4)
# (0.27, ["strength and honor"])] # 6 intersections / (9 total + 19 total - 6)
In general, to search for phrases containing a misspelt word, a threshold of -3*N can be given where N is the number
of misspellings.
.. code-block:: python
ix.find ("stremgth", threshold=-3).get_list()
# returns [(6, ["strength and honor"]),
# (6, ["strength"])]
Benchmarks
==========
A benchmark is included in tests/dvd_db_test.py
Results from an Athlon II running at 2.6GHz:
Python 2.7
----------------------
.. code-block:: none
In [1]: import tests.dvd_db_test
Loading database...
Extracted 240577 titles
Memory used by data: 107.8MB
Building index...
CPU time used: 43.1s
Unique trigrams indexed: 11352
Unique phrases indexed: 228620
Memory used by index: 80.9MB
In [2]: %timeit list (tests.dvd_db_test.titles.find("daft punk", 8))
10 loops, best of 3: 27.8 ms per loop
In [3]: %timeit list (tests.dvd_db_test.titles.find("daft punk", 1))
10 loops, best of 3: 86.4 ms per loop
Python 3.2
----------------------
.. code-block:: none
In [1]: import tests.dvd_db_test
Loading database...
Extracted 240577 titles
Memory used by data: 108.8MB
Building index...
CPU time used: 45.8s
Unique trigrams indexed: 11352
Unique phrases indexed: 228620
Memory used by index: 86.2MB
In [2]: %timeit list (tests.dvd_db_test.titles.find("daft punk", 8))
10 loops, best of 3: 27.9 ms per loop
In [3]: %timeit list (tests.dvd_db_test.titles.find("daft punk", 1))
10 loops, best of 3: 86.3 ms per loop
DVD title list used in the benchmark was obtained from http://www.hometheaterinfo.com/dvdlist.htm
Thanks for making it available.
| {
"content_hash": "ae753fa965f088f1938cda14c846386c",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 116,
"avg_line_length": 28.785714285714285,
"alnum_prop": 0.608560794044665,
"repo_name": "zygfryd/python-setix",
"id": "73f8c7f5e6f340e07435e621ea87873b03736195",
"size": "3224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "27768"
}
],
"symlink_target": ""
} |
.well {
background-color: #ffffff;
}
.form-control-custom:focus {
border:1px solid #1b307b;
}
.btn-custom,
.btn-custom:hover {
background-color: #1b307b;
}
a {
color: #1b307b;
}
.forgot-password {
padding-top: 8px;
}
.form-registration {
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-registration .form-registration-heading,
.form-registration .checkbox {
margin-bottom: 10px;
}
.form-registration .checkbox {
font-weight: normal;
}
.form-registration .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-registration .form-control:focus {
z-index: 2;
}
.form-registration input {
margin-bottom: 20px;
}
| {
"content_hash": "34c32db253f8d311855bcad47be449b4",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 46,
"avg_line_length": 15.20754716981132,
"alnum_prop": 0.6637717121588089,
"repo_name": "xyb994/housing",
"id": "55a5b50b88bb7dd9f6485df7bee48e4ecd6e83fe",
"size": "806",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ssu_housing/static/registration/css/registration.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7846"
},
{
"name": "HTML",
"bytes": "41286"
},
{
"name": "JavaScript",
"bytes": "1721"
},
{
"name": "Python",
"bytes": "65415"
},
{
"name": "Shell",
"bytes": "8041"
}
],
"symlink_target": ""
} |
import threading
from typing import TYPE_CHECKING, cast, Any, Dict, Iterator, Optional, Union
from elementpath import ElementPathError, XPath2Parser, XPathContext, XPathToken, \
LazyElementNode, SchemaElementNode, build_schema_node_tree
from ..names import XSD_ASSERT
from ..aliases import ElementType, SchemaType, SchemaElementType, NamespacesType
from ..translation import gettext as _
from ..xpath import XsdSchemaProtocol, XsdElementProtocol, ElementPathMixin, XMLSchemaProxy
from .exceptions import XMLSchemaNotBuiltError, XMLSchemaValidationError
from .xsdbase import XsdComponent
from .groups import XsdGroup
if TYPE_CHECKING:
from ..resources import XMLResource
from .attributes import XsdAttributeGroup
from .complex_types import XsdComplexType
from .elements import XsdElement
from .wildcards import XsdAnyElement
class XsdAssert(XsdComponent, ElementPathMixin[Union['XsdAssert', SchemaElementType]]):
"""
Class for XSD *assert* constraint definitions.
.. <assert
id = ID
test = an XPath expression
xpathDefaultNamespace = (anyURI | (##defaultNamespace | ##targetNamespace | ##local))
{any attributes with non-schema namespace . . .}>
Content: (annotation?)
</assert>
"""
parent: 'XsdComplexType'
_ADMITTED_TAGS = {XSD_ASSERT}
token: Optional[XPathToken] = None
parser: Optional[XPath2Parser] = None
path = 'true()'
def __init__(self, elem: ElementType,
schema: SchemaType,
parent: 'XsdComplexType',
base_type: 'XsdComplexType') -> None:
self._xpath_lock = threading.Lock()
self.base_type = base_type
super(XsdAssert, self).__init__(elem, schema, parent)
def __repr__(self) -> str:
if len(self.path) < 40:
return '%s(test=%r)' % (self.__class__.__name__, self.path)
else:
return '%s(test=%r)' % (self.__class__.__name__, self.path[:37] + '...')
def __getstate__(self) -> Dict[str, Any]:
state = self.__dict__.copy()
state.pop('_xpath_lock', None)
return state
def __setstate__(self, state: Any) -> None:
self.__dict__.update(state)
self._xpath_lock = threading.Lock()
def _parse(self) -> None:
if self.base_type.is_simple():
msg = _("base_type={!r} is not a complexType definition")
self.parse_error(msg.format(self.base_type))
else:
try:
self.path = self.elem.attrib['test'].strip()
except KeyError as err:
self.parse_error(err)
if 'xpathDefaultNamespace' in self.elem.attrib:
self.xpath_default_namespace = self._parse_xpath_default_namespace(self.elem)
else:
self.xpath_default_namespace = self.schema.xpath_default_namespace
@property
def built(self) -> bool:
return self.parser is not None and self.token is not None
def build(self) -> None:
# Assert requires a schema bound parser because select
# is on XML elements and with XSD type decoded values
self.parser = XPath2Parser(
namespaces=self.namespaces,
variable_types={'value': self.base_type.sequence_type},
strict=False,
default_namespace=self.xpath_default_namespace,
schema=self.xpath_proxy,
)
try:
self.token = self.parser.parse(self.path)
except ElementPathError as err:
self.parse_error(err)
self.token = self.parser.parse('true()')
finally:
if self.parser.variable_types:
self.parser.variable_types.clear()
def __call__(self, elem: ElementType,
value: Any = None,
namespaces: Optional[NamespacesType] = None,
source: Optional['XMLResource'] = None,
**kwargs: Any) -> Iterator[XMLSchemaValidationError]:
if self.parser is None or self.token is None:
raise XMLSchemaNotBuiltError(self, 'schema bound parser not set')
with self._xpath_lock:
if not self.parser.is_schema_bound() and self.parser.schema:
self.parser.schema.bind_parser(self.parser)
if namespaces is None or isinstance(namespaces, dict):
_namespaces = namespaces
else:
_namespaces = dict(namespaces)
variables = {'value': None if value is None else self.base_type.text_decode(value)}
if source is not None:
context = XPathContext(
root=source.get_xpath_node(elem),
namespaces=_namespaces,
variables=variables
)
else:
# If validated from a component (could not work with rooted XPath expressions)
context = XPathContext(LazyElementNode(elem), variables=variables)
try:
if not self.token.evaluate(context):
yield XMLSchemaValidationError(self, obj=elem, reason="assertion test if false")
except ElementPathError as err:
yield XMLSchemaValidationError(self, obj=elem, reason=str(err))
# For implementing ElementPathMixin
def __iter__(self) -> Iterator[Union['XsdElement', 'XsdAnyElement']]:
if isinstance(self.parent.content, XsdGroup):
yield from self.parent.content.iter_elements()
@property
def attrib(self) -> 'XsdAttributeGroup':
return self.parent.attributes
@property
def type(self) -> 'XsdComplexType':
return self.parent
@property
def xpath_proxy(self) -> 'XMLSchemaProxy':
return XMLSchemaProxy(
schema=cast(XsdSchemaProtocol, self.schema),
base_element=cast(XsdElementProtocol, self)
)
@property
def xpath_node(self) -> SchemaElementNode:
schema_node = self.schema.xpath_node
node = schema_node.get_element_node(cast(XsdElementProtocol, self))
if isinstance(node, SchemaElementNode):
return node
return build_schema_node_tree(
root=cast(XsdElementProtocol, self),
elements=schema_node.elements,
global_elements=schema_node.children,
)
| {
"content_hash": "370ff7ea446e0d489f9c0e784056cd90",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 96,
"avg_line_length": 36.76608187134503,
"alnum_prop": 0.6200095435024654,
"repo_name": "sissaschool/xmlschema",
"id": "3dc86d4cbb64b65b356680f41833227052d0eee2",
"size": "6619",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "xmlschema/validators/assertions.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Jinja",
"bytes": "2547"
},
{
"name": "Python",
"bytes": "1776721"
}
],
"symlink_target": ""
} |
module OvirtMetrics
class DatacenterSamplesHistory < OvirtHistory
end
end | {
"content_hash": "77935cd682f031acd035a3ccf78934ad",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 47,
"avg_line_length": 19.25,
"alnum_prop": 0.8441558441558441,
"repo_name": "jvlcek/ovirt_metrics",
"id": "dd042ef15b88b04dbad9658971e9afc02b8126ca",
"size": "77",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/models/datacenter_samples_history.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "122333"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebApiToTypeScript")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebApiToTypeScript")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9e94a78b-6ada-4eb8-8477-bd2947227e58")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "ef96d9693a04152ed87289346899c92f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.138888888888886,
"alnum_prop": 0.7473385379701917,
"repo_name": "greymind/WebApiToTypeScript",
"id": "603a9cb80210cfc73375136a349043015df58701",
"size": "1412",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/WebApiToTypeScript/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "109"
},
{
"name": "C#",
"bytes": "131594"
},
{
"name": "HTML",
"bytes": "1718"
},
{
"name": "PowerShell",
"bytes": "1327"
},
{
"name": "TypeScript",
"bytes": "41411"
}
],
"symlink_target": ""
} |
package org.apache.shardingsphere.sql.parser.integrate.asserts.statement;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.sql.parser.integrate.asserts.segment.parameter.ParameterMarkerAssert;
import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dal.DALStatementAssert;
import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dcl.DCLStatementAssert;
import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.ddl.DDLStatementAssert;
import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dml.DMLStatementAssert;
import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.tcl.TCLStatementAssert;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.domain.statement.SQLParserTestCase;
import org.apache.shardingsphere.sql.parser.sql.statement.SQLStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dal.DALStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dcl.DCLStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.ddl.DDLStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.DMLStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.tcl.TCLStatement;
/**
* SQL statement assert.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SQLStatementAssert {
/**
* Assert SQL statement is correct with expected parser result.
*
* @param assertContext assert context
* @param actual actual SQL statement
* @param expected expected parser result
*/
public static void assertIs(final SQLCaseAssertContext assertContext, final SQLStatement actual, final SQLParserTestCase expected) {
ParameterMarkerAssert.assertCount(assertContext, actual.getParameterCount(), expected.getParameters().size());
if (actual instanceof DMLStatement) {
DMLStatementAssert.assertIs(assertContext, (DMLStatement) actual, expected);
} else if (actual instanceof DDLStatement) {
DDLStatementAssert.assertIs(assertContext, (DDLStatement) actual, expected);
} else if (actual instanceof TCLStatement) {
TCLStatementAssert.assertIs(assertContext, (TCLStatement) actual, expected);
} else if (actual instanceof DCLStatement) {
DCLStatementAssert.assertIs(assertContext, (DCLStatement) actual, expected);
} else if (actual instanceof DALStatement) {
DALStatementAssert.assertIs(assertContext, (DALStatement) actual, expected);
}
}
}
| {
"content_hash": "2b1b9e35dda79ce53a3e4e2069d8afe4",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 136,
"avg_line_length": 54.673469387755105,
"alnum_prop": 0.7864874953340799,
"repo_name": "shardingjdbc/sharding-jdbc",
"id": "ebe48817ae6566939f52003e584156db20e2feb8",
"size": "3480",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/asserts/statement/SQLStatementAssert.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
$servidor = "localhost";
$usuario = "root";
$senha = "";
$dbname = "sad";
//Criar a conexao
$conn = mysqli_connect($servidor, $usuario, $senha, $dbname);
session_start();
$item = utf8_decode($_POST['item']);
$id = $_SESSION['usuarioId'];
echo $item;
$sql = "INSERT INTO carrinho VALUES(null,'$item',$id)";
$result = mysqli_query($conn,$sql);
header("Location: carrinho.php");
?>
| {
"content_hash": "009477642bfb0980237b4a76811a47d7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 61,
"avg_line_length": 18.217391304347824,
"alnum_prop": 0.5894988066825776,
"repo_name": "YuriBecker/SAD",
"id": "a7dfe9b9736180caf010a7264480351da4ad49e7",
"size": "419",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pages/login/grava2.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "629360"
},
{
"name": "HTML",
"bytes": "3670656"
},
{
"name": "JavaScript",
"bytes": "2718246"
},
{
"name": "PHP",
"bytes": "506956"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="lv_LV" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Geertcoin</source>
<translation>Par Geertcoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>Geertcoin</b> version</source>
<translation><b>Geertcoin</b> versija</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The Geertcoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adrešu grāmata</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Adresi vai nosaukumu rediģē ar dubultklikšķi</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Izveidot jaunu adresi</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopēt iezīmēto adresi uz starpliktuvi</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Jauna adrese</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Geertcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Kopēt adresi</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Parādīt &QR kodu</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Geertcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Geertcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Dzēst</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Geertcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Kopēt &Nosaukumu</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Rediģēt</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Eksportēt adreses</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Fails ar komatu kā atdalītāju (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Kļūda eksportējot</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Nevar ierakstīt failā %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Nosaukums</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adrese</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(bez nosaukuma)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Paroles dialogs</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Ierakstiet paroli</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Jauna parole</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Jaunā parole vēlreiz</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Ierakstiet maciņa jauno paroli.<br/>Lūdzu izmantojiet <b>10 vai vairāk nejauši izvēlētas zīmes</b>, vai <b>astoņus un vairāk vārdus</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Šifrēt maciņu</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Lai veikto šo darbību, maciņš jāatslēdz ar paroli.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Atslēgt maciņu</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Šai darbībai maciņš jāatšifrē ar maciņa paroli.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Atšifrēt maciņu</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Mainīt paroli</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Ierakstiet maciņa veco un jauno paroli.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Apstiprināt maciņa šifrēšanu</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR GEERTCOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Maciņš nošifrēts</translation>
</message>
<message>
<location line="-56"/>
<source>Geertcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your geertcoins from being stolen by malware infecting your computer.</source>
<translation>Geertcoin aizvērsies, lai pabeigtu šifrēšanu. Atcerieties, ka maciņa šifrēšana nevar pilnībā novērst bitkoinu zādzību, ko veic datorā ieviesušās kaitīgas programmas.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Maciņa šifrēšana neizdevās</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Maciņa šifrēšana neizdevās programmas kļūdas dēļ. Jūsu maciņš netika šifrēts.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Ievadītās paroles nav vienādas.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Maciņu atšifrēt neizdevās</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Maciņa atšifrēšanai ievadītā parole nav pareiza.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Maciņu neizdevās atšifrēt</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Parakstīt &ziņojumu...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Sinhronizācija ar tīklu...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Pārskats</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Rādīt vispārēju maciņa pārskatu</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Transakcijas</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Skatīt transakciju vēsturi</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Rediģēt saglabātās adreses un nosaukumus</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Rādīt maksājumu saņemšanas adreses</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Iziet</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Aizvērt programmu</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Geertcoin</source>
<translation>Parādīt informāciju par Geertcoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Par &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Parādīt informāciju par Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Iespējas</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>Š&ifrēt maciņu...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Izveidot maciņa rezerves kopiju</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Mainīt paroli</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Geertcoin address</source>
<translation>Nosūtīt bitkoinus uz Geertcoin adresi</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Geertcoin</source>
<translation>Mainīt Geertcoin konfigurācijas uzstādījumus</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Izveidot maciņa rezerves kopiju citur</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Mainīt maciņa šifrēšanas paroli</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Debug logs</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Atvērt atkļūdošanas un diagnostikas konsoli</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>&Pārbaudīt ziņojumu...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Geertcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Maciņš</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About Geertcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Geertcoin addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Geertcoin addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Fails</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Uzstādījumi</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Palīdzība</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Ciļņu rīkjosla</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Geertcoin client</source>
<translation>Geertcoin klients</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Geertcoin network</source>
<translation><numerusform>%n aktīvu savienojumu ar Geertcoin tīklu</numerusform><numerusform>%n aktīvs savienojums ar Geertcoin tīklu</numerusform><numerusform>%n aktīvu savienojumu as Geertcoin tīklu</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Kļūda</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Brīdinājums</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Sinhronizēts</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Sinhronizējos...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Apstiprināt transakcijas maksu</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Transakcija nosūtīta</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Ienākoša transakcija</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Datums: %1
Daudzums: %2
Tips: %3
Adrese: %4
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Geertcoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Maciņš ir <b>šifrēts</b> un pašlaik <b>atslēgts</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Maciņš ir <b>šifrēts</b> un pašlaik <b>slēgts</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Geertcoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Tīkla brīdinājums</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Mainīt adrese</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Nosaukums</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Adrešu grāmatas ieraksta nosaukums</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adrese</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Adrese adrešu grāmatas ierakstā. To var mainīt tikai nosūtīšanas adresēm.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Jauna saņemšanas adrese</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Jauna nosūtīšanas adrese</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Mainīt saņemšanas adresi</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Mainīt nosūtīšanas adresi</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Nupat ierakstītā adrese "%1" jau atrodas adrešu grāmatā.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Geertcoin address.</source>
<translation>Ierakstītā adrese "%1" nav derīga Geertcoin adrese.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Nav iespējams atslēgt maciņu.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Neizdevās ģenerēt jaunu atslēgu.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Geertcoin-Qt</source>
<translation>Geertcoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versija</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Lietojums:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>komandrindas izvēles</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Lietotāja interfeisa izvēlnes</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Uzstādiet valodu, piemēram "de_DE" (pēc noklusēšanas: sistēmas lokāle)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Sākt minimizētu</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Uzsākot, parādīt programmas informācijas logu (pēc noklusēšanas: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Iespējas</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Galvenais</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>&Maksāt par transakciju</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Geertcoin after logging in to the system.</source>
<translation>Automātiski sākt Geertcoin pēc pieteikšanās sistēmā.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Geertcoin on system login</source>
<translation>&Sākt Geertcoin reizē ar sistēmu</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Tīkls</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Geertcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Uz rūtera automātiski atvērt Geertcoin klienta portu. Tas strādā tikai tad, ja rūteris atbalsta UPnP un tas ir ieslēgts.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Kartēt portu, izmantojot &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Geertcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Savienoties caur SOCKS proxy:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Proxy &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>proxy IP adrese (piem. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Ports:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Proxy ports (piem. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &Versija:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>proxy SOCKS versija (piem. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Logs</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Pēc loga minimizācijas rādīt tikai ikonu sistēmas teknē.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimizēt uz sistēmas tekni, nevis rīkjoslu</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Logu aizverot, minimizēt, nevis beigt darbu. Kad šī izvēlne iespējota, programma aizvērsies tikai pēc Beigt komandas izvēlnē.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimizēt aizverot</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Izskats</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Lietotāja interfeiss un &valoda:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Geertcoin.</source>
<translation>Šeit var iestatīt lietotāja valodu. Iestatījums aktivizēsies pēc Geertcoin pārstartēšanas.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Vienības, kurās attēlot daudzumus:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Izvēlēties dalījuma vienību pēc noklusēšanas, ko izmantot interfeisā un nosūtot bitkoinus.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Geertcoin addresses in the transaction list or not.</source>
<translation>Rādīt vai nē Geertcoin adreses transakciju sarakstā.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Attēlot adreses transakciju sarakstā</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Atcelt</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Pielietot</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>pēc noklusēšanas</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Brīdinājums</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Geertcoin.</source>
<translation>Iestatījums aktivizēsies pēc Bitkoin pārstartēšanas.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Norādītā proxy adrese nav derīga.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Forma</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Geertcoin network after a connection is established, but this process has not completed yet.</source>
<translation>Attēlotā informācija var būt novecojusi. Jūsu maciņš pēc savienojuma izveides automātiski sinhronizējas ar Geertcoin tīklu, taču šis process vēl nav beidzies.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Bilance:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Neapstiprinātas:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Maciņš</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Pēdējās transakcijas</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Jūsu tekošā bilance</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Kopējā apstiprināmo transakciju vērtība, vēl nav ieskaitīta kopējā bilancē</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>nav sinhronizēts</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start geertcoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR koda dialogs</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Pieprasīt maksājumu</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Daudzums:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Nosaukums:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Ziņojums:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Saglabāt kā...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Kļūda kodējot URI QR kodā.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Rezultāta URI pārāk garš, mēģiniet saīsināt nosaukumu vai ziņojumu. </translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Saglabāt QR kodu</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG attēli (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Klienta vārds</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Klienta versija</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informācija</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Sākuma laiks</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Tīkls</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Savienojumu skaits</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Testa tīklā</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Bloku virkne</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Pašreizējais bloku skaits</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Bloku skaita novērtējums</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Pēdējā bloka laiks</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Atvērt</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the Geertcoin-Qt help message to get a list with possible Geertcoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsole</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Kompilācijas datums</translation>
</message>
<message>
<location line="-104"/>
<source>Geertcoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Geertcoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the Geertcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Notīrīt konsoli</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Geertcoin RPC console.</source>
<translation>Laipni lūgti Geertcoin RPC konsolē.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Izmantojiet bultiņas uz augšu un leju, lai pārvietotos pa vēsturi, un <b>Ctrl-L</b> ekrāna notīrīšanai.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Ierakstiet <b>help</b> lai iegūtu pieejamo komandu sarakstu.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Sūtīt bitkoinus</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Sūtīt vairākiem saņēmējiem uzreiz</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Dzēst visus transakcijas laukus</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>&Notīrīt visu</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Bilance:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123,456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Apstiprināt nosūtīšanu</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> līdz %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Apstiprināt bitkoinu sūtīšanu</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Vai tiešām vēlaties nosūtīt %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>un</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Nosūtāmajai summai jābūt lielākai par 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Daudzums pārsniedz pieejamo.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Kopsumma pārsniedz pieejamo, ja pieskaitīta %1 transakcijas maksa.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Atrastas divas vienādas adreses, vienā nosūtīšanas reizē uz katru adresi var sūtīt tikai vienreiz.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Kļūda: transakcija tika atteikta. Tā var gadīties, ja kāds no maciņā esošiem bitkoiniem jau iztērēts, piemēram, izmantojot wallet.dat kopiju, kurā nav atzīmēti iztērētie bitkoini.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Forma</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Apjo&ms</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>&Saņēmējs:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Lai pievienotu adresi adrešu grāmatai, tai jādod nosaukums</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Nosaukums:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Izvēlēties adresi no adrešu grāmatas</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>ielīmēt adresi no starpliktuves</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Dzēst šo saņēmēju</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Geertcoin address (e.g. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</source>
<translation>Ierakstiet Geertcoin adresi (piem. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>ielīmēt adresi no starpliktuves</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Geertcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>&Notīrīt visu</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Geertcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Geertcoin address (e.g. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</source>
<translation>Ierakstiet Geertcoin adresi (piem. GXddbvTh7zn1niNVwhYY6RVyDoS9VBCJLk)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter Geertcoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Geertcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Atvērts līdz %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/neapstiprinātas</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 apstiprinājumu</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Datums</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Daudzums</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, vēl nav veiksmīgi izziņots</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>nav zināms</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transakcijas detaļas</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Šis panelis parāda transakcijas detaļas</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Datums</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tips</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adrese</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Daudzums</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Atvērts līdz %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Nav pieslēgts (%1 apstiprinājumu)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Nav apstiprināts (%1 no %2 apstiprinājumu)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Apstiprināts (%1 apstiprinājumu)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Neviens cits mezgls šo bloku nav saņēmis un droši vien netiks akceptēts!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Ģenerēts, taču nav akceptēts</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Saņemts ar</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Saņemts no</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Nosūtīts</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Maksājums sev</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Atrasts</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(nav pieejams)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transakcijas statuss. Turiet peli virs šī lauka, lai redzētu apstiprinājumu skaitu.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Transakcijas saņemšanas datums un laiks.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Transakcijas tips.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Transakcijas mērķa adrese.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Bilancei pievienotais vai atņemtais daudzums.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Visi</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Šodien</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Šonedēļ</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Šomēnes</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Pēdējais mēnesis</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Šogad</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Diapazons...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Saņemts ar</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Nosūtīts</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Sev</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Atrasts</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Cits</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Ierakstiet meklējamo nosaukumu vai adresi</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimālais daudzums</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopēt adresi</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopēt nosaukumu</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopēt daudzumu</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Mainīt nosaukumu</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Rādīt transakcijas detaļas</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Eksportēt transakcijas datus</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Fails ar komatu kā atdalītāju (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Apstiprināts</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Datums</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tips</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Nosaukums</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adrese</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Daudzums</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Eksportēšanas kļūda</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Nevar ierakstīt failā %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Diapazons:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Izveidot maciņa rezerves kopiju</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Maciņa dati (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Rezerves kopēšana neizdevās</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Kļūda, saglabājot maciņu jaunajā vietā.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Geertcoin version</source>
<translation>Geertcoin versija</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Lietojums:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or geertcoind</source>
<translation>Nosūtīt komantu uz -server vai geertcoind</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Komandu saraksts</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Palīdzība par komandu</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Iespējas:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: geertcoin.conf)</source>
<translation>Norādiet konfigurācijas failu (pēc noklusēšanas: geertcoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: geertcoind.pid)</source>
<translation>Norādiet pid failu (pēc noklusēšanas: geertcoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Norādiet datu direktoriju</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Uzstādiet datu bāzes bufera izmēru megabaitos (pēc noklusēšanas: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 64333 or testnet: 65333)</source>
<translation>Gaidīt savienojumus portā <port> (pēc noklusēšanas: 64333 vai testnet: 65333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Uzturēt līdz <n> savienojumiem ar citiem mezgliem(pēc noklusēšanas: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Pievienoties mezglam, lai iegūtu citu mezglu adreses, un atvienoties</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Norādiet savu publisko adresi</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Slieksnis pārkāpējmezglu atvienošanai (pēc noklusēšanas: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Sekundes, cik ilgi atturēt pārkāpējmezglus no atkārtotas pievienošanās (pēc noklusēšanas: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 64332 or testnet: 65332)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Pieņemt komandrindas un JSON-RPC komandas</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Darbināt fonā kā servisu un pieņemt komandas</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Izmantot testa tīklu</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=geertcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Geertcoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Geertcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Geertcoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Debug izvadei sākumā pievienot laika zīmogu</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Geertcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Debug/trace informāciju izvadīt konsolē, nevis debug.log failā</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Debug/trace informāciju izvadīt debug programmai</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>JSON-RPC savienojumu lietotājvārds</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Brīdinājums</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>JSON-RPC savienojumu parole</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Atļaut JSON-RPC savienojumus no norādītās IP adreses</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Nosūtīt komandas mezglam, kas darbojas adresē <ip> (pēc noklusēšanas: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Izpildīt komandu, kad labāk atbilstošais bloks izmainās (%s cmd aizvieto ar bloka hešu)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Atjaunot maciņa formātu uz jaunāko</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Uzstādīt atslēgu bufera izmēru uz <n> (pēc noklusēšanas: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Atkārtoti skanēt bloku virkni, meklējot trūkstošās maciņa transakcijas</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>JSON-RPC savienojumiem izmantot OpenSSL (https)</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Servera sertifikāta fails (pēc noklusēšanas: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Servera privātā atslēga (pēc noklusēšanas: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Pieņemamie šifri (pēc noklusēšanas: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Šis palīdzības paziņojums</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Nevar pievienoties pie %s šajā datorā (pievienošanās atgrieza kļūdu %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Savienoties caurs socks proxy</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Atļaut DNS uzmeklēšanu priekš -addnode, -seednode un -connect</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Ielādē adreses...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Nevar ielādēt wallet.dat: maciņš bojāts</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Geertcoin</source>
<translation>Nevar ielādēt wallet.dat: maciņa atvēršanai nepieciešama jaunāka Geertcoin versija</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Geertcoin to complete</source>
<translation>Bija nepieciešams pārstartēt maciņu: pabeigšanai pārstartējiet Geertcoin</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Kļūda ielādējot wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Nederīga -proxy adrese: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>-onlynet komandā norādīts nepazīstams tīkls: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Pieprasīta nezināma -socks proxy versija: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Nevar uzmeklēt -bind adresi: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Nevar atrisināt -externalip adresi: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Nederīgs daudzums priekš -paytxfree=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Nederīgs daudzums</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Nepietiek bitkoinu</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Ielādē bloku indeksu...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Pievienot mezglu, kam pievienoties un turēt savienojumu atvērtu</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Geertcoin is probably already running.</source>
<translation>Nevar pievienoties %s uz šī datora. Geertcoin droši vien jau darbojas.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Maksa par KB, ko pievienot nosūtāmajām transakcijām</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Ielādē maciņu...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Nevar maciņa formātu padarīt vecāku</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Nevar ierakstīt adresi pēc noklusēšanas</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Skanēju no jauna...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Ielāde pabeigta</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>Izmantot opciju %s</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Kļūda</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Konfigurācijas failā jāuzstāda rpcpassword=<password>:
%s
Ja fails neeksistē, izveidojiet to ar atļauju lasīšanai tikai īpašniekam.</translation>
</message>
</context>
</TS> | {
"content_hash": "de8abb54705313bac31ccb78206718fd",
"timestamp": "",
"source": "github",
"line_count": 2923,
"max_line_length": 395,
"avg_line_length": 36.116318850496064,
"alnum_prop": 0.6119752197635647,
"repo_name": "GeertAltCoin/Geertcoin",
"id": "671465600abd3216501423a4d06f8bf79e40c8cd",
"size": "106378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_lv_LV.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "32394"
},
{
"name": "C++",
"bytes": "2613382"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "13391"
},
{
"name": "NSIS",
"bytes": "5970"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69726"
},
{
"name": "QMake",
"bytes": "15196"
},
{
"name": "Roff",
"bytes": "18289"
},
{
"name": "Shell",
"bytes": "16339"
}
],
"symlink_target": ""
} |
class SUColorPane : public LPane, public LBroadcaster
{
public:
enum { class_ID = 'PTCL' };
SUColorPane( LStream * );
virtual ~SUColorPane();
virtual void FinishCreateSelf();
static SUColorPane * CreateFromStream( LStream * );
// get/set color
virtual Color32 GetColor();
virtual void SetColor( Color32, ERedrawOptions = redraw_Later );
// get/set color table
virtual CTabHandle GetColorTable();
virtual void SetColorTable( CTabHandle, Boolean inChangeColorToo = true, ERedrawOptions = redraw_Later );
virtual void AllowPickerOption( Boolean inOption );
virtual void DrawSelf();
virtual void ClickSelf( const SMouseDownEvent & );
virtual Boolean PointIsInFrame( SInt32 inHoriz, SInt32 inVert ) const;
virtual void DrawSwatch();
protected:
Color32 mCurrentColor;
CTabHandle mColorTable;
RgnHandle mClippedRgn;
Boolean mClipsToSibblings;
Boolean mUsePickerOption;
virtual void CalcClipRegionForOverlap();
virtual void DrawPopup( Boolean inHilited, Boolean inEnabled );
virtual void DrawSwatchSelf( const Rect &swatchR );
virtual SInt32 GetColorIndex( Color32 );
virtual Boolean DoAppleColorPicker( Color32 *outColor );
virtual void DisposeCurrentTable();
};
| {
"content_hash": "69f1f8968aa1de41213e57afb30362f8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 109,
"avg_line_length": 31.609756097560975,
"alnum_prop": 0.7106481481481481,
"repo_name": "mbert/mulberry-main",
"id": "e6434e4a1c61f0f67104852be3840e1c34cdb596",
"size": "1523",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Libraries/open-powerplant/constructor/Constructor_Pro/Constructor/Source files/H1- MacOS/Editors/Bitmaps/PT Popups/SUColorPane.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "569106"
},
{
"name": "Batchfile",
"bytes": "80126"
},
{
"name": "C",
"bytes": "13996926"
},
{
"name": "C++",
"bytes": "36795816"
},
{
"name": "Component Pascal",
"bytes": "63931"
},
{
"name": "DIGITAL Command Language",
"bytes": "273849"
},
{
"name": "Emacs Lisp",
"bytes": "1639"
},
{
"name": "Groff",
"bytes": "5"
},
{
"name": "HTML",
"bytes": "219178"
},
{
"name": "Logos",
"bytes": "108920"
},
{
"name": "Makefile",
"bytes": "11884"
},
{
"name": "Objective-C",
"bytes": "129690"
},
{
"name": "Perl",
"bytes": "1749015"
},
{
"name": "Perl6",
"bytes": "27602"
},
{
"name": "Prolog",
"bytes": "29177"
},
{
"name": "Python",
"bytes": "8651"
},
{
"name": "R",
"bytes": "741731"
},
{
"name": "Rebol",
"bytes": "179366"
},
{
"name": "Scheme",
"bytes": "4249"
},
{
"name": "Shell",
"bytes": "172439"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "4568"
}
],
"symlink_target": ""
} |
import { Predicate } from '../types'
import { curry3 } from '@typed/functions'
/**
* Applies `&&` between two predicate functions.
* @name and<A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean
*/
export const and: And = curry3(__and)
export type And = {
<A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean
<A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A>
<A>(predicate1: Predicate<A>): {
(predicate2: Predicate<A>, value: A): boolean
(predicate2: Predicate<A>): Predicate<A>
}
}
function __and<A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean {
return predicate1(value) && predicate2(value)
}
| {
"content_hash": "c8c16284a19b9a3b9e23999a600db4e5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 90,
"avg_line_length": 33.80952380952381,
"alnum_prop": 0.6746478873239437,
"repo_name": "TylorS/typed",
"id": "9deb052268bbc3165df460ad2360a3ae25286d7e",
"size": "710",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/logic/src/and/index.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "7604"
},
{
"name": "TypeScript",
"bytes": "191014"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Taxonomical Study of Erysiphaceae of Japan (Tokyo) 106 (1997)
#### Original name
Sawadaea zhengii Y. Nomura
### Remarks
null | {
"content_hash": "d0043d560835652c7e63446030c97a70",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 14.461538461538462,
"alnum_prop": 0.7287234042553191,
"repo_name": "mdoering/backbone",
"id": "da6c2c7a669c06092408088ba3cdaa0f23a79a8e",
"size": "238",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Leotiomycetes/Erysiphales/Erysiphaceae/Sawadaea/Sawadaea zhengii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Nextras Datagrid DEMO
=====================
Demo of [Nextras Datagrid](https://github.com/nextras/datagrid).
| {
"content_hash": "d2679803b9d9d451b2b04ac32ad2d929",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 64,
"avg_line_length": 27.5,
"alnum_prop": 0.6272727272727273,
"repo_name": "nextras/datagrid-demo",
"id": "ee382f88a929b03bccaaf965fbc25354415892a4",
"size": "110",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "readme.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2027"
},
{
"name": "JavaScript",
"bytes": "14897"
},
{
"name": "PHP",
"bytes": "6221"
}
],
"symlink_target": ""
} |
// RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.
// Test pull request
package org.usfirst.frc1073.robot16.subsystems;
import org.usfirst.frc1073.robot16.RobotMap;
import org.usfirst.frc1073.robot16.commands.*;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.VictorSP;
import edu.wpi.first.wpilibj.command.Subsystem;
/**
*
*/
public class Climber extends Subsystem {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
private final SpeedController climberMotor = RobotMap.climberclimberMotor;
private final Solenoid extensionPiston = RobotMap.climberextensionPiston;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
// Put methods for controlling this subsystem
// here. Call these from Commands.
public void initDefaultCommand() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}
}
| {
"content_hash": "2dbecef687a815df31804df44859916a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 78,
"avg_line_length": 33.132075471698116,
"alnum_prop": 0.7374715261958997,
"repo_name": "FRCTeam1073-TheForceTeam/robot16",
"id": "900d37ebee985f61db444d9cf6b9b20156a1cfe8",
"size": "1756",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/usfirst/frc1073/robot16/subsystems/Climber.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "6224"
},
{
"name": "Java",
"bytes": "138689"
},
{
"name": "Shell",
"bytes": "229"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#E8E8E8"/>
<stroke android:width="1dp" android:color="#C2C2C2"/>
<corners android:radius="6dp"/>
</shape>
| {
"content_hash": "1bab9d31f87b954e75c9d28a57a6725f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 67,
"avg_line_length": 40.166666666666664,
"alnum_prop": 0.6846473029045643,
"repo_name": "RichardFrankios/BrainJD",
"id": "396cb818fd6a704440601708faabc58590ca2c2b",
"size": "241",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/drawable/alipay_pop_bg.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "127615"
}
],
"symlink_target": ""
} |
package org.jenkinsci.plugins.runselector.selectors;
import hudson.model.Cause;
import hudson.model.FreeStyleProject;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersAction;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.Run;
import hudson.model.StringParameterDefinition;
import hudson.model.StringParameterValue;
import hudson.model.TaskListener;
import org.jenkinsci.plugins.runselector.RunSelector;
import org.jenkinsci.plugins.runselector.context.RunSelectorContext;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.junit.ClassRule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import java.io.IOException;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link ParameterizedRunSelector}
*/
public class ParameterizedRunSelectorTest {
@ClassRule
public static JenkinsRule j = new JenkinsRule();
/**
* Also applicable for workflow jobs.
*/
@Issue("JENKINS-30357")
@Test
public void testWorkflow() throws Exception {
FreeStyleProject jobToSelect = j.createFreeStyleProject();
Run runToSelect = j.assertBuildStatusSuccess(jobToSelect.scheduleBuild2(0));
WorkflowJob selecter = createWorkflowJob();
ParameterDefinition paramDef = new StringParameterDefinition(
"SELECTOR", "<StatusRunSelector><buildStatus>STABLE</buildStatus></StatusRunSelector>"
);
selecter.addProperty(new ParametersDefinitionProperty(paramDef));
selecter.setDefinition(new CpsFlowDefinition(String.format("" +
"def runWrapper = selectRun job: '%s', " +
" selector: [$class: 'ParameterizedRunSelector', parameterName: '${SELECTOR}'] \n" +
"assert(runWrapper.id == '%s')", jobToSelect.getFullName(), runToSelect.getId())));
j.assertBuildStatusSuccess(selecter.scheduleBuild2(0));
}
/**
* Should not cause a fatal error even for a broken selectors.
*/
@Test
public void testBrokenParameter() throws Exception {
FreeStyleProject jobToSelect = j.createFreeStyleProject();
FreeStyleProject selecter = j.createFreeStyleProject();
RunSelector selector = new ParameterizedRunSelector("${SELECTOR}");
Run run = (Run) selecter.scheduleBuild2(
0,
new ParametersAction(
new StringParameterValue("SELECTOR", "<SomeBrokenSelector")
)
).get();
j.assertBuildStatusSuccess(run);
Run selectedRun = selector.select(jobToSelect, new RunSelectorContext(j.jenkins, run, TaskListener.NULL));
assertThat(selectedRun, nullValue());
}
/**
* Should not cause a fatal error even for an unavailable selectors.
*/
@Test
public void testUnavailableSelector() throws Exception {
FreeStyleProject jobToSelect = j.createFreeStyleProject();
FreeStyleProject selecter = j.createFreeStyleProject();
RunSelector selector = new ParameterizedRunSelector("${SELECTOR}");
Run run = (Run) selecter.scheduleBuild2(
0,
new ParametersAction(
new StringParameterValue("SELECTOR", "<NoSuchSelector />")
)
).get();
j.assertBuildStatusSuccess(run);
Run selectedRun = selector.select(jobToSelect, new RunSelectorContext(j.jenkins, run, TaskListener.NULL));
assertThat(selectedRun, nullValue());
}
/**
* Should not cause a fatal error even for an empty selectors.
*/
@Test
public void testEmptySelector() throws Exception {
FreeStyleProject jobToSelect = j.createFreeStyleProject();
FreeStyleProject selecter = j.createFreeStyleProject();
RunSelector selector = new ParameterizedRunSelector("${SELECTOR}");
Run run = (Run) selecter.scheduleBuild2(
0,
new ParametersAction(
new StringParameterValue("SELECTOR", "")
)
).get();
j.assertBuildStatusSuccess(run);
Run selectedRun = selector.select(jobToSelect, new RunSelectorContext(j.jenkins, run, TaskListener.NULL));
assertThat(selectedRun, nullValue());
}
/**
* Also accepts immediate value.
*/
@Test
public void testImmediateValue() throws Exception {
// Prepare a job to be selected.
FreeStyleProject jobToSelect = j.createFreeStyleProject();
Run runToSelect = j.assertBuildStatusSuccess(jobToSelect.scheduleBuild2(0));
WorkflowJob selecter = createWorkflowJob();
selecter.addProperty(new ParametersDefinitionProperty(
new StringParameterDefinition("SELECTOR", "")
));
selecter.setDefinition(new CpsFlowDefinition(String.format("" +
"def runWrapper = selectRun job: '%s', " +
" selector: [$class: 'ParameterizedRunSelector', parameterName: '${SELECTOR}'] \n" +
"assert(runWrapper.id == '%s')", jobToSelect.getFullName(), runToSelect.getId())));
j.assertBuildStatusSuccess(selecter.scheduleBuild2(
0,
null,
new ParametersAction(new StringParameterValue(
"SELECTOR", "<StatusRunSelector><buildStatus>STABLE</buildStatus></StatusRunSelector>"
))
));
}
/**
* Also accepts variable expression.
*/
@Test
public void testVariableExpression() throws Exception {
FreeStyleProject jobToSelect = j.createFreeStyleProject();
Run runToSelect = j.assertBuildStatusSuccess(jobToSelect.scheduleBuild2(0));
FreeStyleProject selecter = j.createFreeStyleProject();
selecter.addProperty(new ParametersDefinitionProperty(
new StringParameterDefinition("SELECTOR", "")
));
RunSelector selector = new ParameterizedRunSelector("${SELECTOR}");
Run run = j.assertBuildStatusSuccess(selecter.scheduleBuild2(
0,
(Cause) null,
new ParametersAction(new StringParameterValue(
"SELECTOR",
"<StatusRunSelector><buildStatus>STABLE</buildStatus></StatusRunSelector>"
))
));
Run selectedRun = selector.select(jobToSelect, new RunSelectorContext(j.jenkins, run, TaskListener.NULL));
assertThat(selectedRun, is(runToSelect));
}
private static WorkflowJob createWorkflowJob() throws IOException {
return j.jenkins.createProject(WorkflowJob.class, "test" + j.jenkins.getItems().size());
}
}
| {
"content_hash": "562508eb6cd67c7a618e7d0760370938",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 114,
"avg_line_length": 38.22222222222222,
"alnum_prop": 0.6597383720930232,
"repo_name": "alexsomai/run-selector-plugin",
"id": "f5320a5cbdb5e1b9afbd8ef470ed0c713aa41af9",
"size": "8024",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/org/jenkinsci/plugins/runselector/selectors/ParameterizedRunSelectorTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "9219"
},
{
"name": "Java",
"bytes": "384705"
}
],
"symlink_target": ""
} |
package org.onelab.filter;
import org.apache.hadoop.hbase.util.Hash;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RotatingBloomFilter extends Filter {
private static final Logger LOG = LoggerFactory.getLogger(RotatingBloomFilter.class);
private static final UnsupportedOperationException UNSUPPORTED = new UnsupportedOperationException("Not implemented.");
protected static final String LINE_SEPARATOR = new String(new byte[]{Character.LINE_SEPARATOR});
protected BloomFilter[] filters;
protected int currentNumberOfKeys;
protected int maximumNumberOfKeysPerFilter;
protected int maximumNumberOfBloomFilters;
/**
* Constructor.
* <p>
* Builds an empty Rotating Bloom filter.
*
* @param vectorSize The number of bits in the vector.
* @param nbHash The number of hash function to consider.
* @param hashType type of the hashing function (see {@link Hash}).
* @param maximumNumberOfKeysPerFilter The threshold for the maximum number of keys to record in a rotating Bloom filter row.
* @param maximumNumberOfBloomFilters The threshold for the maximum number of rows.
*/
public RotatingBloomFilter(int vectorSize, int nbHash, int hashType,
int maximumNumberOfKeysPerFilter, int maximumNumberOfBloomFilters) {
super(vectorSize, nbHash, hashType);
this.maximumNumberOfKeysPerFilter = maximumNumberOfKeysPerFilter;
this.maximumNumberOfBloomFilters = maximumNumberOfBloomFilters;
this.currentNumberOfKeys = 0;
filters = new BloomFilter[1];
filters[0] = new BloomFilter(this.vectorSize, this.nbHash, this.hashType);
}
@Override
public void add(Key key) {
if (key == null) {
throw new IllegalArgumentException("Key can not be null");
}
BloomFilter bf = getActiveStandardBF();
if (bf == null) {
addRow();
bf = filters[filters.length - 1];
currentNumberOfKeys = 0;
}
bf.add(key);
currentNumberOfKeys++;
LOG.debug("Added key \"{}\" to BloomFilter in position {}, current number of keys incremented at {}", new Object[] { new String(key.getBytes()), (filters.length - 1), currentNumberOfKeys } );
}
@Override
public boolean membershipTest(Key key) {
if (key == null) {
return false;
}
for (int i = 0; i < filters.length; i++) {
if (filters[i].membershipTest(key)) {
LOG.debug("Found a match for keyword \"{}\" in the BloomFilter in position {}", new String(key.getBytes()), i);
return true;
}
}
return false;
}
/**
* Adds a new row to <i>this</i> rotating Bloom filter.
*/
private void addRow() {
BloomFilter[] tmp;
if ( filters.length < maximumNumberOfBloomFilters ) { // add new rows
tmp = new BloomFilter[filters.length + 1];
for (int i = 0; i < filters.length; i++) {
tmp[i] = (BloomFilter) filters[i].clone();
}
LOG.debug("Increased the size of array of Bloom filters to {}", tmp.length);
} else { // rotate, drop the oldest row (i.e. i=0)
tmp = new BloomFilter[filters.length];
for (int i = 0; i < filters.length - 1; i++) {
tmp[i] = (BloomFilter) filters[i + 1].clone();
}
LOG.debug("Rotating array of Bloom filters, size kept at {}", tmp.length);
}
tmp[tmp.length - 1] = new BloomFilter(vectorSize, nbHash, hashType);
filters = tmp;
}
/**
* Returns the active standard Bloom filter in <i>this</i> dynamic Bloom filter.
*
* @return BloomFilter The active standard Bloom filter. <code>Null</code> otherwise.
*/
private BloomFilter getActiveStandardBF() {
if (currentNumberOfKeys >= maximumNumberOfKeysPerFilter) {
return null;
}
LOG.debug("Active Bloom filter is now the BloomFilter in position {}", filters.length - 1);
return filters[filters.length - 1];
}
@Override
public String toString() {
StringBuilder res = new StringBuilder();
for (int i = 0; i < filters.length; i++) {
res.append(filters[i]);
res.append(LINE_SEPARATOR);
}
return res.toString();
}
// We decided not to implement (and not to test!) things we do not need/use -- PC
@Override
public void and(Filter filter) {
LOG.error("Unsupported method called.");
throw UNSUPPORTED;
}
@Override
public void not() {
LOG.error("Unsupported method called.");
throw UNSUPPORTED;
}
@Override
public void or(Filter filter) {
LOG.error("Unsupported method called.");
throw UNSUPPORTED;
}
@Override
public void xor(Filter filter) {
LOG.error("Unsupported method called.");
throw UNSUPPORTED;
}
@Override
public Object clone() {
LOG.error("Unsupported method called.");
throw UNSUPPORTED;
}
}
| {
"content_hash": "a7c85f0495961f812204e614e5659af4",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 193,
"avg_line_length": 27.993827160493826,
"alnum_prop": 0.7003307607497243,
"repo_name": "strategist922/bloomfilters",
"id": "fe1fc723e2d2df95de7d8b23560bbbd1cdfa4694",
"size": "4799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/onelab/filter/RotatingBloomFilter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#import <AppKit/NSBox.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSGraphics.h>
#import <AppKit/NSFont.h>
#import <AppKit/NSAttributedString.h>
#import <AppKit/NSColor.h>
#import <AppKit/NSStringDrawing.h>
#import <AppKit/NSParagraphStyle.h>
#import <AppKit/NSStringDrawer.h>
#import <AppKit/NSCell.h>
#import <Foundation/NSKeyedArchiver.h>
#import <AppKit/NSGraphicsStyle.h>
#import <AppKit/NSRaise.h>
@implementation NSBox
-(void)encodeWithCoder:(NSCoder *)coder {
[super encodeWithCoder:coder];
[coder encodeInt:_borderType forKey:@"NSBox borderType"];
[coder encodeInt:_titlePosition forKey:@"NSBox titlePosition"];
[coder encodeSize:_contentViewMargins forKey:@"NSBox contentViewMargins"];
[coder encodeObject:_titleCell forKey:@"NSBox titleCell"];
}
-initWithCoder:(NSCoder *)coder {
[super initWithCoder:coder];
if([coder allowsKeyedCoding]){
NSKeyedUnarchiver *keyed=(NSKeyedUnarchiver *)coder;
_borderType=[keyed decodeIntForKey:@"NSBorderType"];
_titlePosition=[keyed decodeIntForKey:@"NSTitlePosition"];
_contentViewMargins=[keyed decodeSizeForKey:@"NSOffsets"];
_titleCell=[[keyed decodeObjectForKey:@"NSTitleCell"] retain];
[[_subviews lastObject] setAutoresizingMask: NSViewWidthSizable| NSViewHeightSizable];
[[_subviews lastObject] setAutoresizesSubviews:YES];
}
else {
[NSException raise:NSInvalidArgumentException format:@"%@ can not initWithCoder:%@",isa,[coder class]];
}
return self;
}
-(void)dealloc {
[_titleCell release];
[super dealloc];
}
-(NSBoxType)boxType {
return _boxType;
}
-(NSBorderType)borderType {
return _borderType;
}
-(NSString *)title {
return [_titleCell stringValue];
}
-(NSFont *)titleFont {
return [_titleCell font];
}
-contentView {
return [[self subviews] lastObject];
}
-(NSSize)contentViewMargins {
return _contentViewMargins;
}
-(NSTitlePosition)titlePosition {
return _titlePosition;
}
-(void)setBoxType:(NSBoxType)value {
_boxType=value;
[self setNeedsDisplay:YES];
}
-(void)setBorderType:(NSBorderType)value {
_borderType=value;
[self setNeedsDisplay:YES];
}
-(void)setTitle:(NSString *)title {
[_titleCell setStringValue:title];
[self setNeedsDisplay:YES];
}
-(void)setTitleFont:(NSFont *)font {
[_titleCell setFont:font];
}
-(void)setContentView:(NSView *)view {
if(![[self subviews] containsObject:view]){
[[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
// FIX, adjust size
[self addSubview:view];
}
}
-(void)setContentViewMargins:(NSSize)value {
_contentViewMargins=value;
[self setNeedsDisplay:YES];
}
-(void)setTitlePosition:(NSTitlePosition)value {
_titlePosition=value;
[self setNeedsDisplay:YES];
}
-(void)setTitleWithMnemonic:(NSString *)value {
NSUnimplementedMethod();
}
-(NSAttributedString *)_attributedTitle {
NSMutableDictionary *attributes=[NSMutableDictionary dictionary];
NSMutableParagraphStyle *paraStyle=[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
NSFont *font=[_titleCell font];
if(font!=nil)
[attributes setObject:font forKey:NSFontAttributeName];
[paraStyle setLineBreakMode:NSLineBreakByClipping];
[paraStyle setAlignment:NSLeftTextAlignment];
[attributes setObject:paraStyle forKey:NSParagraphStyleAttributeName];
[attributes setObject:[NSColor controlTextColor]
forKey: NSForegroundColorAttributeName];
[attributes setObject:[NSColor windowBackgroundColor]
forKey:NSBackgroundColorAttributeName];
return [[[NSAttributedString alloc] initWithString:[_titleCell stringValue] attributes:attributes] autorelease];
}
#define TEXTGAP 4
-(NSRect)titleRect {
// Obtain the size the title cell prefers
NSSize size = [_titleCell cellSize];
NSRect bounds=[self bounds];
NSRect result=NSZeroRect;
result.origin.x=10+TEXTGAP;
result.size.height=ceil(size.height);
result.size.width=ceil(size.width);
switch(_titlePosition){
case NSNoTitle:
break;
case NSAboveTop:
result.origin.y=bounds.size.height-result.size.height;
break;
case NSAtTop:
result.origin.y=bounds.size.height-result.size.height;
break;
case NSBelowTop:
result.origin.y=bounds.size.height-(result.size.height+TEXTGAP);
break;
case NSAboveBottom:
result.origin.y=TEXTGAP;
break;
case NSAtBottom:
break;
case NSBelowBottom:
result.origin.y=0;
break;
}
return result;
}
-(NSRect)borderRect {
NSUnimplementedMethod();
return NSMakeRect(0,0,0,0);
}
-titleCell {
return _titleCell;
}
-(void)setFrameFromContentFrame:(NSRect)content {
// FIX, adjust content frame size to accomodate border/title
[self setFrame:content];
}
-(void)sizeToFit {
NSUnimplementedMethod();
}
-(BOOL)isOpaque {
return YES;
}
-(void)drawRect:(NSRect)rect {
NSRect grooveRect=_bounds;
NSRect titleRect=[self titleRect];
BOOL drawTitle=YES;
switch(_titlePosition){
case NSNoTitle:
drawTitle=NO;
break;
case NSAboveTop:
grooveRect.size.height-=titleRect.size.height+TEXTGAP;
break;
case NSAtTop:
grooveRect.size.height-=floor(titleRect.size.height/2);
break;
case NSBelowTop:
break;
case NSAboveBottom:
break;
case NSAtBottom:
grooveRect.origin.y+=floor(titleRect.size.height/2);
grooveRect.size.height-=floor(titleRect.size.height/2);
break;
case NSBelowBottom:
grooveRect.origin.y+=titleRect.size.height+TEXTGAP;
grooveRect.size.height-=titleRect.size.height+TEXTGAP;
break;
}
[[NSColor controlColor] setFill];
NSRectFill(rect);
switch(_borderType){
case NSNoBorder:
break;
case NSLineBorder:
[[self graphicsStyle] drawBoxWithLineInRect:grooveRect];
break;
case NSBezelBorder:
[[self graphicsStyle] drawBoxWithBezelInRect:grooveRect clipRect:rect];
break;
case NSGrooveBorder:
[[self graphicsStyle] drawBoxWithGrooveInRect:grooveRect clipRect:rect];
break;
}
if(drawTitle){
[[NSColor windowBackgroundColor] setFill];
titleRect.origin.x-=TEXTGAP;
titleRect.size.width+=TEXTGAP*2;
NSRectFill(titleRect);
titleRect.origin.x+=TEXTGAP;
titleRect.size.width-=TEXTGAP*2;
// Ask the cell to draw itself now
// TODO: Should we be doing some sort of clipping setup here?
[_titleCell drawWithFrame: titleRect inView: self];
}
}
@end
| {
"content_hash": "47e7363b26410e1907d953c493f2c389",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 115,
"avg_line_length": 23.64388489208633,
"alnum_prop": 0.7042446371519854,
"repo_name": "wenq1/cocotron",
"id": "9d322cbba3d25b289c5a85c604e24b14bd86b6b9",
"size": "7666",
"binary": false,
"copies": "1",
"ref": "refs/heads/upstream",
"path": "AppKit/NSBox.m",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "4525390"
},
{
"name": "Shell",
"bytes": "301"
}
],
"symlink_target": ""
} |
My lightning talk at the joint meet-up of JSZurich and Webtuesday on 14.01.2014
## Notes
- Building large systems quote
- Piece == component
- What's a component; what it's not
- Architecture sample
- Benefits
- Drawbacks
- JSON schema to the rescue
- Examples
- Exposing over HTTP
- Automatic verification
## Links
- Main JSON Schema [web site](http://json-schema.org/)
- [Schema validator](https://github.com/geraintluff/tv4) in JavaScript
| {
"content_hash": "8310d0bcdab69cce145b3462865968dc",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 16.25,
"alnum_prop": 0.7296703296703296,
"repo_name": "ikr/json-schema-for-http-apis",
"id": "7074db8c19d95965e6050c02e81c018aaec9780e",
"size": "485",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
var mongoose = require('mongoose')
const _ = require('lodash')
const Config = require('../../../config')
const PERMISSION_STATES = Config.get('/constants/PERMISSION_STATES')
module.exports = function() {
var Types = mongoose.Schema.Types
var Model = {
Schema: {
state: {
type: Types.String,
enum: _.values(PERMISSION_STATES),
required: true,
default: PERMISSION_STATES.INCLUDED
}
},
modelName: 'role_permission'
}
return Model
}
| {
"content_hash": "8c1b7bd6218607d0716c4ae550d1a60c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 20.75,
"alnum_prop": 0.6184738955823293,
"repo_name": "JKHeadley/appy",
"id": "ff395d1ce17dc4548668b79a308a1d0a419162de",
"size": "498",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/server/models/linking-models/role_permission.model.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5143"
},
{
"name": "Dockerfile",
"bytes": "576"
},
{
"name": "HTML",
"bytes": "258635"
},
{
"name": "JavaScript",
"bytes": "103453"
},
{
"name": "Shell",
"bytes": "241"
},
{
"name": "Vue",
"bytes": "377277"
}
],
"symlink_target": ""
} |
NAN_MODULE_INIT(init) {
DtlsSocket::Initialize(target);
}
NODE_MODULE(node_mbed_dtls_client, init);
| {
"content_hash": "1e2a614376088e8b9cbf9cfa9e8bd726",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 41,
"avg_line_length": 20.4,
"alnum_prop": 0.7352941176470589,
"repo_name": "spark/node-mbed-dtls-client",
"id": "6363893440fe7561c90850c2ce399e44086553ef",
"size": "128",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/init.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2681"
},
{
"name": "C++",
"bytes": "11371"
},
{
"name": "JavaScript",
"bytes": "3551"
},
{
"name": "Python",
"bytes": "3817"
}
],
"symlink_target": ""
} |
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/params.php')
);
return [
'id' => 'smile-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [
'dropzone' => [
'class' => 'backend\smile\modules\dropzone\SmileDropZoneModule',
],
'redactor' => [
'class'=>'backend\smile\modules\redactor\SmileRedactorModule',
'uploadDir' => '@img_root/uploads',
'uploadUrl' => '/uploads',
'imageAllowExtensions'=>['jpg','png','jpeg']
],
'language' => [
'class' => 'backend\modules\language\Language',
],
'poll' => [
'class' => 'backend\modules\poll\Poll',
],
'advice' => [
'class' => 'backend\modules\advice\Advice',
],
'newscategory' => [
'class' => 'backend\modules\newscategory\Newscategory',
],
'dictionary' => [
'class' => 'backend\modules\dictionary\Dictionary',
],
'tag' => [
'class' => 'backend\modules\tag\Tag',
],
'source' => [
'class' => 'backend\modules\source\Source',
],
'leader' => [
'class' => 'backend\modules\leader\Leader',
],
'news' => [
'class' => 'backend\modules\news\News',
],
'page' => [
'class' => 'backend\modules\page\Page',
],
],
'components' => [
'request'=>[
/* @var \backend\smile\components\SmileBackendRequest */
'class' => 'backend\smile\components\SmileBackendRequest',
'backendWebUrl'=> '/backend/web',
'backendUrl' => '/backend'
],
'user' => [
/* @var \common\models\User */
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
/* @var \yii\log\FileTarget */
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
/* @var \backend\smile\components\SmileBackendUrlManager */
'class'=>'backend\smile\components\SmileBackendUrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
]
],
'assetManager' => [
'bundles' => [
/* @var \yii\web\JqueryAsset */
'yii\web\JqueryAsset' => [
'jsOptions'=>[
'position'=>\yii\web\View::POS_HEAD,
]
],
],
],
],
'params' => $params,
];
| {
"content_hash": "f3c96b08838970789254c6676b986f24",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 97,
"avg_line_length": 32.3,
"alnum_prop": 0.43312693498452015,
"repo_name": "MaN4thes3t/smile-cms",
"id": "0f1639a9ab84cbb31e818ea339724f25f3cd9ec0",
"size": "3230",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/config/main.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "1952"
},
{
"name": "Batchfile",
"bytes": "1026"
},
{
"name": "CSS",
"bytes": "1285898"
},
{
"name": "JavaScript",
"bytes": "3041683"
},
{
"name": "PHP",
"bytes": "430382"
}
],
"symlink_target": ""
} |
var p_array = new Array();
var done_array = new Array(true)
var done_array2 = new Array();
var qscore=0;
var qmaxscore=14;
var currItem=0;
function updateScore(inc){
qscore += Number(inc);
$('#qscore').text("Your score: " + qscore + " out of " + qmaxscore);
}
function nextItem(inc){
currItem+=inc;
showItem(currItem);
}
function showQ(pnum){
p_array.push(pnum);
$('.conversation ol li').not('.conversation ol li ol li').each(function(ind){
if( ind == pnum){
$(this).css('display','block');
if(!done_array[pnum]){//only add the back link once
$(this).children('ol').children('li:last').after('<li class="toggle" onclick="backup()">go back</li>');
done_array[pnum]=true;
}
}else{
$(this).css('display','none');
}
});
$('.conversation ol li ol li ol li').css('display','none');
}
function showItem(pnum){
$('.quiz ol li').not('.quiz ol li ol li').each(function(ind){
if( ind == pnum){
var nextI = pnum+1;
$(this).css('display','list-item');
var str = String(nextI);
$(this).parent().attr('start',str);
if(!done_array2[pnum]){//only add the back link oncea
var nstr = '<span class="toggle" onclick="nextItem(1)">Next</span>';
var pstr = '<span class="toggle" onclick="nextItem(-1)">Previous </span>';
var linktext = '';
var last = $('.quiz ol li').not('.quiz ol li ol li').length;
if(pnum==0){
linktext = nstr;
}else if(nextI < last){
linktext = pstr + ' | ' + nstr;
}else{
linktext = pstr;
}
$(this).children('ol').after('<div align="right">' + linktext + '</div>');
done_array2[pnum]=true;
}
}else{
$(this).css('display','none');
}
});
$('.quiz ol li ol li ol li').css('display','none');
}
function startOver(){
p_array = new Array();
showQ(0);
}
function backup(){
p_array.pop();
showQ(p_array.pop());
}
function showFeedback(li,t){
var status = $(li).parent().attr('class');
var maxscore = $(li).parent().parent().attr('maxscore');
if(!maxscore ){
var numOptions = $(li).parent().parent().children('li').length;
if(status=="correct"){
$(li).parent().parent().attr('maxscore',str);
updateScore(numOptions);
}else{
numOptions--;
updateScore(-1);
}
var str = String(numOptions);
$(li).parent().parent().attr('maxscore',numOptions);
}else{
var oldMax = Number(maxscore);
if(status=="correct"){
updateScore(maxscore);
}else{
oldMax--;
updateScore(-1);
}
var str = String(oldMax);
$(li).parent().parent().attr('maxscore',oldMax);
}
$(li).text(t);
$(li).parent().children('ol').children('li').toggle(100);
}
function findQ(h){
$('.conversation ol li').not('.conversation ol li ol li').each(function(j){
var n = h.substr(1);
var name = $(this).find('a:first').attr("name");
if(name == n){
showQ(j);
}
});
}
$(document).ready(function() {
//------------- glossary -------------
jQuery.fn.sort = function() {
return this.pushStack( [].sort.apply( this, arguments ), []);
};
function sortAlpha(a,b){
return a.innerHTML.toLowerCase() > b.innerHTML.toLowerCase() ? 1 : -1;
};
$('ul.glossary li').not('ul li ul li').sort(sortAlpha).appendTo('ul.glossary');
$('ul.glossary').delegate("li","click",function(){
var def = $(this).html();
//$(this).children('ul').children('li').text();
//var cleaned =def.replace('display:none;','');alert(cleaned);
$('#defdisplay').html(def);
$('#defdisplay a[rel=conversation]').click(function(i){
var h = $(this).attr('href');
findQ(h);
});
});
//$('#glist ul.glossary li ul li').attr('class','definition');
$("#glist").css('height','250px');
//------------branching----------------
$('.conversation ol li ol li').each(function(i){
var debug = $(this).children('ol').length;//.children('ol:first').children('li').length;
//alert(debug);
var old = $(this).html();
if($(this).children('ol').length){
var a = '<a class="toggle">+ </a> ';
$(this).html(a + old);
}
});
$('a[class=toggle]').toggle(function(){showFeedback(this,'-')},function(){showFeedback(this,'+')});
$('.conversation a[href^=#]').click(function(i){
var h = $(this).attr('href');
findQ(h);
});
showQ(0);
//-----------quiz---------
qmaxscore = $('.quiz ol li ol li').not('ol li ol li ol li').length;
updateScore(0);
$('.quiz ol li ol li').each(function(i){
var debug = $(this).children('ol').length;//.children('ol:first').children('li').length;
//alert(debug);
var old = $(this).html();
if($(this).children('ol').length){
var a = '<a class="toggleQ">[open]</a> ';
$(this).html(a + old);
}
});
$('a[class=toggleQ]').toggle(function(){showFeedback(this,'[close]')},function(){showFeedback(this,'[open]')});
$('.quiz a[href^=#]').click(function(i){
var h = $(this).attr('href');
findQ(h);
});
showItem(0);//show just one quiz question at a time
});// end ready
function locateTerm(){
var str = $('#searchfield').val();
var len = str.length;
$('#glist ul li').not('ul li ul li').each(function(){
var mystart = $(this).text().substr(0,len);
if(mystart == str){
var display = "block";
}else{
var display = "none";
}
$(this).css('display',display);
});
}
function clearSearch(){
$('#searchfield').val('');
$('#glist ul li').not('ul li ul li').css('display','block');
}
| {
"content_hash": "81b4c5c0abdef91434d997751e02e701",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 112,
"avg_line_length": 26.265700483091788,
"alnum_prop": 0.5668567224572374,
"repo_name": "bkinney/infrastructure",
"id": "60c5488e9952b9d1c4af14f8ed1f2534a3d84f53",
"size": "5513",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "editorBtns/editor_files/listtricks.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1983"
},
{
"name": "HTML",
"bytes": "67432"
},
{
"name": "JavaScript",
"bytes": "19237"
},
{
"name": "PHP",
"bytes": "359187"
}
],
"symlink_target": ""
} |
package com.baosight.sts.st.xs.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ee.service.CascadeSelect;
import com.baosight.sts.st.xs.domain.STXS2101;
import com.baosight.sts.util.BizConstants;
public class ServiceSTXS2501 extends CascadeSelect {
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo);
HashMap switchValue = (HashMap) UserSession.getInSessionProperty(BizConstants.SWITCH_VALUE);
outInfo.set("switchValue", switchValue);
return outInfo;
}
public EiInfo query(EiInfo inInfo) {
inInfo.setCell("inqu_status", 0, "segNo", String.valueOf(UserSession.getInSessionProperty(BizConstants.ORG_ID)));
inInfo.setCell("inqu_status", 0, "approveType","1");
return super.query(inInfo, "STXS2101.query", new STXS2101());
}
public EiInfo approve(EiInfo inInfo) {
String userId = String.valueOf(UserSession.getInSessionProperty(BizConstants.USER_ID));
String segNo = String.valueOf(UserSession.getInSessionProperty(BizConstants.ORG_ID));
List rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < rows.size(); i++) {
Map mapM = (Map) rows.get(i);
mapM.put("segNo", segNo);
mapM.put("modiPerson", userId);
mapM.put("contractStatus", "02");
dao.update("STXS2101.updateContractStatus", mapM);
}
inInfo.setMsg("审批成功");
return inInfo;
}
public EiInfo disApprove(EiInfo inInfo) {
String userId = String.valueOf(UserSession.getInSessionProperty(BizConstants.USER_ID));
String segNo = String.valueOf(UserSession.getInSessionProperty(BizConstants.ORG_ID));
List rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < rows.size(); i++) {
Map mapM = (Map) rows.get(i);
mapM.put("segNo", segNo);
mapM.put("modiPerson", userId);
mapM.put("contractStatus", "03");
dao.update("STXS2101.updateContractStatus", mapM);
}
inInfo.setMsg("拒绝成功");
return inInfo;
}
} | {
"content_hash": "bef3383a77d6666202a4d7b8a5b35983",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 115,
"avg_line_length": 38.714285714285715,
"alnum_prop": 0.7204797047970479,
"repo_name": "stserp/erp1",
"id": "2ab7d8738be486d06e5c7d5fd88d70c63eb58269",
"size": "2184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/src/com/baosight/sts/st/xs/service/ServiceSTXS2501.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "44086"
},
{
"name": "CSS",
"bytes": "305836"
},
{
"name": "ColdFusion",
"bytes": "126937"
},
{
"name": "HTML",
"bytes": "490616"
},
{
"name": "Java",
"bytes": "21647120"
},
{
"name": "JavaScript",
"bytes": "6599859"
},
{
"name": "Lasso",
"bytes": "18060"
},
{
"name": "PHP",
"bytes": "41541"
},
{
"name": "Perl",
"bytes": "20182"
},
{
"name": "Perl 6",
"bytes": "21700"
},
{
"name": "Python",
"bytes": "39177"
},
{
"name": "SourcePawn",
"bytes": "111"
},
{
"name": "XSLT",
"bytes": "3404"
}
],
"symlink_target": ""
} |
package org.avantssar.aslan;
import org.avantssar.commons.ErrorGatherer;
import org.avantssar.commons.LocationInfo;
public class PrimitiveType extends AbstractNamed implements IType {
private PrimitiveType superType;
private final boolean prelude;
protected PrimitiveType(LocationInfo location, ErrorGatherer err, String name, boolean prelude) {
this(location, err, name, null, prelude);
}
protected PrimitiveType(LocationInfo location, ErrorGatherer err, String name, PrimitiveType superType, boolean prelude) {
super(location, err, name, new LowerNameValidator("simple type"));
this.superType = superType;
this.prelude = prelude;
}
public PrimitiveType getSuperType() {
return superType;
}
public void setSuperType(PrimitiveType superType) {
this.superType = superType;
}
public boolean isPrelude() {
return prelude;
}
public void accept(IASLanVisitor visitor) {
visitor.visit(this);
}
@Override
public boolean isAssignableFrom(IType subType, IASLanSpec spec) {
if (subType instanceof PrimitiveType) {
PrimitiveType ss = (PrimitiveType) subType;
return equals(ss) || isAssignableFrom(ss.getSuperType(), spec);
}
else if (subType instanceof SetType) {
return equals(IASLanSpec.MESSAGE);
}
else if (subType instanceof PairType) {
return equals(IASLanSpec.MESSAGE);
}
else if (subType instanceof CompoundType) {
String fname = ((CompoundType) subType).getName();
Function fnc = spec.findFunction(fname);
return fnc != null && isAssignableFrom(fnc.getType(), spec);
}
else {
return false;
}
}
public String toString() {
return getName();
}
}
| {
"content_hash": "1610e801c50282e7e924cabecae36862",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 123,
"avg_line_length": 26.873015873015873,
"alnum_prop": 0.7152982870643827,
"repo_name": "siemens/ASLanPPConnector",
"id": "cd3dcfe720573dbb931dee96c4ec5af73680df31",
"size": "2327",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/aslan-core/src/main/java/org/avantssar/aslan/PrimitiveType.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GAP",
"bytes": "73255"
},
{
"name": "HTML",
"bytes": "55778"
},
{
"name": "Java",
"bytes": "1628076"
},
{
"name": "Ruby",
"bytes": "462"
},
{
"name": "Shell",
"bytes": "25815"
}
],
"symlink_target": ""
} |
class JSONTokenizer;
// A custom Exception class that represents errors related to processing
// the json document (e.g. parsing errors)
class JSONException: public std::runtime_error {
public:
JSONException(const std::string& msg = "") : std::runtime_error(msg) {}
};
// An enumeration that contains all different types of JSON values
typedef enum {
kJSONNull,
kJSONBoolean,
kJSONNumber,
kJSONString,
kJSONArray,
kJSONObject
} JSONType;
// An abstract base class representing a JSON Value
class JSONValue {
public:
// Constructor
JSONValue(){};
// Returns the type of this JSON Value
virtual JSONType type() = 0;
};
// A JSON null value
class JSONNull : public JSONValue {
public:
// Constructs a new JSON null value
JSONNull(){};
// Constructs a new JSON null value from the given JSON tokenizer
JSONNull(JSONTokenizer &tokenizer);
// Constructs a new JSON null value from the given input string
JSONNull(const std::string &source);
// Returns the type of this JSON null value
JSONType type() {return kJSONNull;}
};
// A JSON boolean value
class JSONBoolean : public JSONValue {
public:
// Constructs a new JSON boolean value from the given JSON tokenizer
JSONBoolean(JSONTokenizer &tokenizer);
// Constructs a new JSON boolean value from the given input string
JSONBoolean(const std::string &source);
// Sets the boolean value
void value(bool value) {value_=value;}
// Gets the boolean value
bool value() const {return value_;}
// Returns the type of this JSON boolean
JSONType type(){return kJSONBoolean;}
private:
// The value of this boolean JSON value
bool value_;
};
// A JSON number (double)
class JSONNumber : public JSONValue {
public:
// Constructs a new JSON number from the given JSON tokenizer
JSONNumber(JSONTokenizer &tokenizer);
// Sets the JSON number value
void value(double value){value_=value;}
// Returns the JSON number value
double value() const {return value_;}
// Returns the type of this JSON number
JSONType type(){return kJSONNumber;}
private:
// Whether the given number contains any decimal places
bool is_double;
// The value of this number
double value_;
};
// JSON String
class JSONString : public JSONValue{
public:
// Constructs a new JSON string with the given value
JSONString(std::string value):value_(value){}
// Constructs a new JSON string from the given JSON tokenizer
JSONString(JSONTokenizer &tokenizer);
// Sets the value of this string
void value(const std::string &value){value_=value;}
// Gets the value of this string
std::string value() const {return value_;}
// Returns the type of this JSON string
JSONType type(){return kJSONString;}
private:
// The value of this string
std::string value_;
};
// JSON Object
//
// Note:
// JSON objects are interpreted as a map (i.e. duplicates are not supported)
class JSONObject : public JSONValue {
public:
// Constructs an empty JSON Object
JSONObject(){};
// Constructs an JSON Object from a JSON source string
JSONObject(std::string source);
// Constructs an JSON Object from a JSON tokenizer
JSONObject(JSONTokenizer &tokenizer);
// Adds a new key/value pair to the object
void Put(std::string key, JSONValue* value);
void Put(std::string key, std::string value);
// Returns the JSON value stored under the given key
JSONValue* Get(const std::string key) const{
std::map<std::string, JSONValue*>::const_iterator it = values.find(key);
if(it == values.end())
return NULL;
return it->second;
};
// Returns whether the JSON object contains a key/value pair
// with the given key
bool Contains(const std::string key){
return !(values.find(key) == values.end());
}
// Returns the type of this JSON object
JSONType type() {return kJSONObject;}
// TODO: Add an iterator to allow iteration over JSON objects
private:
// The key/value pairs stored inside this JSONobject
std::map<std::string,JSONValue*> values;
// Initializes the JSONobject form the given Tokenizer
void Init(JSONTokenizer &tokenizer);
};
// JSON Array
class JSONArray : public JSONValue {
public:
// Constructs an empty JSON Array
JSONArray(){};
// Constructs an JSON Array from a given JSON tokenizer
JSONArray(JSONTokenizer &tokenizer);
// Returns the number of elements inside the array
size_t size(){return values.size();}
// Returns the JSONValue stored at the given index
JSONValue *Get(unsigned int index){return values[index];}
// Returns the type of this array
JSONType type() {return kJSONArray;}
// TODO: Add an iterator to allow iteration over JSON arrays
private:
// The array's content
std::vector<JSONValue*> values;
};
// A tokenizer that takes a input stream and extracts characters and tokens
// from it.
//
// JSONTokenizer objects are used to share a single input stream between
// multiple JSONValue objects.
class JSONTokenizer {
public:
// Constructs a new JSON tokenizer
JSONTokenizer(std::istream &stream);
// Gets the next character
char next();
// Gets the next character while skipping characters and comments
char next_clean();
// Backs up one character
void back();
// Extracts characters and discards them until the delimiter is found
void SkipTo(char delimiter);
// Returns the next character without extracting it
char peek() const {return stream_.peek();}
// Extracts the next JSONValue
JSONValue *NextValue();
// Returns true if the End Of File has been reached
bool eof() const {return stream_.eof();}
private:
// The input stream used to extract the tokens
std::istream &stream_;
};
#endif // BENCHMARK_CORE_IMPORTER_JSON_IMPORTER_H_
| {
"content_hash": "79323faa96f26a07d90a69815ac76e42",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 78,
"avg_line_length": 26.008928571428573,
"alnum_prop": 0.7023686920700309,
"repo_name": "lmaas/sigmod2012contest",
"id": "facd96bbe724848a1fbea2f6e5c87979eb6e7503",
"size": "7312",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "benchmark/core/importers/json_importer.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "17039"
},
{
"name": "C++",
"bytes": "317586"
},
{
"name": "Objective-C",
"bytes": "20660"
}
],
"symlink_target": ""
} |
<?php
if (!defined('ABSPATH'))
exit; // Exit if accessed directly
/**
* Template Accordion
*
* Access original fields: $mod_settings
* @author Themify
*/
if (TFCache::start_cache('accordion', self::$post_id, array('ID' => $module_ID))):
$fields_default = array(
'mod_title_accordion' => '',
'layout_accordion' => 'plus-icon-button',
'expand_collapse_accordion' => 'toggle',
'color_accordion' => '',
'accordion_appearance_accordion' => '',
'content_accordion' => array(),
'animation_effect' => '',
'icon_accordion' => '',
'icon_color_accordion' => '',
'icon_active_accordion' => '',
'icon_active_accordion' => '',
'icon_active_color_accordion' => '',
'css_accordion' => ''
);
if (isset($mod_settings['accordion_appearance_accordion'])) {
$mod_settings['accordion_appearance_accordion'] = $this->get_checkbox_data($mod_settings['accordion_appearance_accordion']);
}
$fields_args = wp_parse_args($mod_settings, $fields_default);
extract($fields_args, EXTR_SKIP);
$animation_effect = $this->parse_animation_effect($animation_effect, $fields_args);
$container_class = implode(' ', apply_filters('themify_builder_module_classes', array(
'module', 'module-' . $mod_name, $module_ID, $css_accordion, $animation_effect
), $mod_name, $module_ID, $fields_args)
);
$container_props = apply_filters( 'themify_builder_module_container_props', array(
'id' => $module_ID,
'class' => $container_class,
'data-behavior' => $expand_collapse_accordion
), $fields_args, $mod_name, $module_ID );
$ui_class = implode(' ', array('ui', 'module-' . $mod_name, $layout_accordion, $accordion_appearance_accordion, $color_accordion));
?>
<!-- module accordion -->
<div<?php echo $this->get_element_attributes( $container_props ); ?>>
<?php if ($mod_title_accordion != ''): ?>
<?php echo $mod_settings['before_title'] . wp_kses_post(apply_filters('themify_builder_module_title', $mod_title_accordion, $fields_args)) . $mod_settings['after_title']; ?>
<?php endif; ?>
<?php do_action('themify_builder_before_template_content_render'); ?>
<ul class="<?php echo esc_attr($ui_class); ?>">
<?php
foreach (array_filter($content_accordion) as $content):
$content = wp_parse_args($content, array(
'title_accordion' => '',
'default_accordion' => '',
'text_accordion' => '',
));
?>
<li <?php if ($content['default_accordion'] == 'open') echo 'class="builder-accordion-active"'; ?>>
<div class="accordion-title">
<a href="#">
<?php if( $icon_accordion ) : ?><i class="accordion-icon <?php echo themify_get_icon( $icon_accordion ); ?>"></i><?php endif; ?>
<?php if( $icon_active_accordion ) : ?><i class="accordion-active-icon fa <?php echo $icon_active_accordion; ?>"></i><?php endif; ?>
<?php echo wp_kses_post($content['title_accordion']); ?>
</a>
</div>
<div class="accordion-content <?php if ($content['default_accordion'] != 'open') echo 'default-closed'; ?> clearfix">
<?php
if (!empty($content['text_accordion'])) {
echo apply_filters('themify_builder_module_content', $content['text_accordion']);
}
?>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php do_action('themify_builder_after_template_content_render'); ?>
</div>
<!-- /module accordion -->
<?php endif; ?>
<?php TFCache::end_cache(); ?> | {
"content_hash": "706af88ceb2a812bd5ec7d2d26f9580f",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 176,
"avg_line_length": 37.477777777777774,
"alnum_prop": 0.6243699970352802,
"repo_name": "PatrickJamesHoban/patrickjameshoban",
"id": "04225f543264a6da842adbf4a6556c5ac8bc421a",
"size": "3373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wp-content/themes/themify-ultra/themify/themify-builder/templates/template-accordion.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "287"
},
{
"name": "CSS",
"bytes": "3108288"
},
{
"name": "HTML",
"bytes": "524"
},
{
"name": "JavaScript",
"bytes": "3847139"
},
{
"name": "PHP",
"bytes": "16288774"
}
],
"symlink_target": ""
} |
from hermes.core.attributes import set_encoder
from hermes.language import Language
from hermes.tag.pos import PartOfSpeech
import hermes.types as htypes
"""
Copyright 2017 David B. Bracewell
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
__author__ = 'David B. Bracewell'
set_encoder(htypes.PART_OF_SPEECH, lambda x: PartOfSpeech.of(x))
set_encoder(htypes.LANGUAGE, lambda x: Language.of(x))
| {
"content_hash": "c63fa72d3935310dbf7b6c2fd018cb11",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 75,
"avg_line_length": 37.791666666666664,
"alnum_prop": 0.7585446527012127,
"repo_name": "dbracewell/pyHermes",
"id": "e961ce4b497fe732083b355efb19647733703efc",
"size": "907",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hermes/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "96939"
}
],
"symlink_target": ""
} |
package org.jboss.wise.gui.treeElement;
import java.util.concurrent.atomic.AtomicInteger;
/**
* An ID generator returning short values (unique on the same VM).
* This backed by an atomic integer.
*
* @author alessio.soldano@jboss.com
*
*/
public class IDGenerator {
private static AtomicInteger idCounter = new AtomicInteger();
public static final String nextVal() {
return String.valueOf(idCounter.getAndIncrement());
}
}
| {
"content_hash": "1b427d715526b57412b6152e2e516a4f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 22.8,
"alnum_prop": 0.7171052631578947,
"repo_name": "chtiJBUG/wise-webui",
"id": "ba2fb1c256ced9870b90afc07eaa818bda9d0dbf",
"size": "1256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/jboss/wise/gui/treeElement/IDGenerator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "40"
},
{
"name": "Java",
"bytes": "85058"
}
],
"symlink_target": ""
} |
#ifndef __CCRENDERCOMMAND_H_
#define __CCRENDERCOMMAND_H_
#include <stdint.h>
#include "platform/CCPlatformMacros.h"
#include "base/ccTypes.h"
/**
* @addtogroup support
* @{
*/
NS_CC_BEGIN
/** Base class of the `RenderCommand` hierarchy.
*
The `Renderer` knows how to render `RenderCommands` objects.
*/
class CC_DLL RenderCommand
{
public:
/**Enum the type of render command. */
enum class Type
{
/** Reserved type.*/
UNKNOWN_COMMAND,
/** Quad command, used for draw quad.*/
QUAD_COMMAND,
/**Custom command, used for calling callback for rendering.*/
CUSTOM_COMMAND,
/**Batch command, used for draw batches in texture atlas.*/
BATCH_COMMAND,
/**Group command, which can group command in a tree hierarchy.*/
GROUP_COMMAND,
/**Mesh command, used to draw 3D meshes.*/
MESH_COMMAND,
/**Primitive command, used to draw primitives such as lines, points and triangles.*/
PRIMITIVE_COMMAND,
/**Triangles command, used to draw triangles.*/
TRIANGLES_COMMAND
};
/**
Init function, will be called by all the render commands.
@param globalZOrder The global order of command, used for rendercommand sorting.
@param modelViewTransform Modelview matrix when submitting the render command.
@param flags Flag used to indicate whether the command should be draw at 3D mode or not.
*/
void init(float globalZOrder, const Mat4& modelViewTransform, uint32_t flags);
/** Get global Z order. */
inline float getGlobalOrder() const { return _globalOrder; }
/** Returns the Command type. */
inline Type getType() const { return _type; }
/** Retruns whether is transparent. */
inline bool isTransparent() const { return _isTransparent; }
/** Set transparent flag. */
inline void setTransparent(bool isTransparent) { _isTransparent = isTransparent; }
/**
Get skip batching status, if a rendering is skip batching, it will be forced to be rendering separately.
*/
inline bool isSkipBatching() const { return _skipBatching; }
/**Set skip batching.*/
inline void setSkipBatching(bool value) { _skipBatching = value; }
/**Whether the command should be rendered at 3D mode.*/
inline bool is3D() const { return _is3D; }
/**Set the command rendered in 3D mode or not.*/
inline void set3D(bool value) { _is3D = value; }
/**Get the depth by current model view matrix.*/
inline float getDepth() const { return _depth; }
protected:
/**Constructor.*/
RenderCommand();
/**Desctructor.*/
virtual ~RenderCommand();
//used for debug but it is not implemented.
void printID();
/**Type used in order to avoid dynamic cast, faster. */
Type _type;
/** Commands are sort by global Z order. */
float _globalOrder;
/** Transparent flag. */
bool _isTransparent;
/**
QuadCommand and TrianglesCommand could be auto batched if there material ID is the same, however, if
a command is skip batching, it would be forced to draw in a separate function call, and break the batch.
*/
bool _skipBatching;
/** Is the command been rendered on 3D pass. */
bool _is3D;
/** Depth from the model view matrix.*/
float _depth;
};
NS_CC_END
/**
end of support group
@}
*/
#endif //__CCRENDERCOMMAND_H_
| {
"content_hash": "178aa7b290e3a70d2f63a409d1956053",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 109,
"avg_line_length": 30.18421052631579,
"alnum_prop": 0.6469049694856146,
"repo_name": "lache/RacingKingLee",
"id": "6d8454622286088c3f37ff7d43e530ddd8faafe5",
"size": "4714",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "crazyclient/frameworks/cocos2d-x/cocos/renderer/CCRenderCommand.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "3573"
},
{
"name": "C",
"bytes": "2624079"
},
{
"name": "C#",
"bytes": "1569747"
},
{
"name": "C++",
"bytes": "20460232"
},
{
"name": "CMake",
"bytes": "217514"
},
{
"name": "CSS",
"bytes": "25468"
},
{
"name": "GLSL",
"bytes": "56733"
},
{
"name": "HTML",
"bytes": "105579"
},
{
"name": "Java",
"bytes": "639770"
},
{
"name": "JavaScript",
"bytes": "204318"
},
{
"name": "Lua",
"bytes": "2175521"
},
{
"name": "Makefile",
"bytes": "52315"
},
{
"name": "Objective-C",
"bytes": "2903053"
},
{
"name": "Objective-C++",
"bytes": "454568"
},
{
"name": "PowerShell",
"bytes": "1372"
},
{
"name": "Python",
"bytes": "12760082"
},
{
"name": "Shell",
"bytes": "31245"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>EXAUDIO, COMPERIO, CONLOQUOR</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="EXAUDIO, COMPERIO, CONLOQUOR">
<meta name="twitter:description" content="">
<meta property="og:type" content="article">
<meta property="og:title" content="EXAUDIO, COMPERIO, CONLOQUOR">
<meta property="og:description" content="">
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon">
<link rel="stylesheet" type="text/css" href="//bigkahuna1uk.github.io/themes/uno/assets/css/uno.css?v=1.0.0" />
<link rel="canonical" href="https://bigkahuna1uk.github.io" />
<meta name="generator" content="Ghost ?" />
<link rel="alternate" type="application/rss+xml" title="EXAUDIO, COMPERIO, CONLOQUOR" href="https://bigkahuna1uk.github.io/rss" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">
</head>
<body class="tag-template tag-Aneamic-objects home-template no-js">
<span class="mobile btn-mobile-menu">
<i class="icon icon-list btn-mobile-menu__icon"></i>
<i class="icon icon-x-circle btn-mobile-close__icon hidden"></i>
</span>
<header class="panel-cover " >
<div class="panel-main">
<div class="panel-main__inner panel-inverted">
<div class="panel-main__content">
<h1 class="panel-cover__title panel-title"><a href="https://bigkahuna1uk.github.io" title="link to homepage for EXAUDIO, COMPERIO, CONLOQUOR">EXAUDIO, COMPERIO, CONLOQUOR</a></h1>
<hr class="panel-cover__divider" />
<p class="panel-cover__description"></p>
<hr class="panel-cover__divider panel-cover__divider--secondary" />
<div class="navigation-wrapper">
<nav class="cover-navigation cover-navigation--primary">
<ul class="navigation">
<li class="navigation__item"><a href="https://bigkahuna1uk.github.io/#blog" title="link to EXAUDIO, COMPERIO, CONLOQUOR blog" class="blog-button">Blog</a></li>
</ul>
</nav>
<nav class="cover-navigation navigation--social">
<ul class="navigation">
<!-- Twitter -->
<li class="navigation__item">
<a href="https://twitter.com/chrisjasonkelly" title="Twitter account">
<i class='icon icon-social-twitter'></i>
<span class="label">Twitter</span>
</a>
</li>
<!-- Github -->
<li class="navigation__item">
<a href="https://github.com/bigkahuna1uk" title="Github account">
<i class='icon icon-social-github'></i>
<span class="label">Github</span>
</a>
</li>
</li>
<!-- Email -->
<li class="navigation__item">
<a href="mailto:bigkahuna1uk@gmail.com" title="Email bigkahuna1uk@gmail.com">
<i class='icon icon-mail'></i>
<span class="label">Email</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="panel-cover--overlay"></div>
</div>
</header>
<div class="content-wrapper">
<div class="content-wrapper__inner">
<h1 class="archive-title">Tag: Aneamic-objects</h1>
<hr class="section-title__divider" />
<div class="main-post-list">
<ol class="post-list">
<li>
<h2 class="post-list__post-title post-title"><a href="https://bigkahuna1uk.github.io/2016/01/28/Immutability.html" title="link to Immutability">Immutability</a></h2>
<p class="excerpt">Complex anaemic object Long constructor Construct objects with long constructor or setters which are error prone. How do I know object is actually fit for purpose. TODO: Long constructor example TODO: Setter example Mutable objects are inherently not thread safe An immutable object is one that cannot be modified after…</p>
<div class="post-list__meta">
<time datetime="28 Jan 2016" class="post-list__meta--date date">28 Jan 2016</time> •
<span class="post-list__meta--tags tags"><a href="#blog" title="Functional Programming">Functional Programming</a>, <a href="#blog" title=" Immutability"> Immutability</a>, <a href="#blog" title=" Fluent APIs"> Fluent APIs</a>, <a href="#blog" title=" Builders"> Builders</a>, <a href="#blog" title=" Aneamic objects"> Aneamic objects</a>, <a href="#blog" title=" Factories"> Factories</a>, <a href="#blog" title=" Guava"> Guava</a>, <a href="#blog" title=" Functions"> Functions</a></span>
</div>
<hr class="post-list__divider" />
</li>
</ol>
<hr class="post-list__divider " />
<nav class="pagination" role="navigation">
<span class="pagination__page-number">Page 1 of 1</span>
</nav>
</div>
<footer class="footer">
<span class="footer__copyright">© 2016. All rights reserved.</span>
<span class="footer__copyright"><a href="http://uno.daleanthony.com" title="link to page for Uno Ghost theme">Uno theme</a> by <a href="http://daleanthony.com" title="link to website for Dale-Anthony">Dale-Anthony</a></span>
<span class="footer__copyright">Proudly published with <a href="http://hubpress.io" title="link to Hubpress website">Hubpress</a></span>
</footer>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js?v="></script>
<script type="text/javascript">
jQuery( document ).ready(function() {
// change date with ago
jQuery('ago.ago').each(function(){
var element = jQuery(this).parent();
element.html( moment(element.text()).fromNow());
});
});
hljs.initHighlightingOnLoad();
</script>
<script type="text/javascript" src="//bigkahuna1uk.github.io/themes/uno/assets/js/main.js?v=1.0.0"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-74241702-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| {
"content_hash": "2601c98d93cd5b603f899e80ebee51b5",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 502,
"avg_line_length": 43.28651685393258,
"alnum_prop": 0.5766385463984426,
"repo_name": "bigkahuna1uk/bigkahuna1uk.github.io",
"id": "fb836dc96d324093e50cf2f7d455197da1da2003",
"size": "7705",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tag/Aneamic-objects/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "420033"
},
{
"name": "CoffeeScript",
"bytes": "6630"
},
{
"name": "HTML",
"bytes": "394906"
},
{
"name": "JavaScript",
"bytes": "23969"
},
{
"name": "Ruby",
"bytes": "806"
},
{
"name": "Shell",
"bytes": "2265"
}
],
"symlink_target": ""
} |
package org.apache.solr.analysis;
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterFilterFactory;
import org.apache.lucene.tests.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.util.ResourceLoader;
import org.apache.lucene.util.Version;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.core.SolrResourceLoader;
import org.junit.BeforeClass;
import org.junit.Test;
/** New WordDelimiterFilter tests... most of the tests are in ConvertedLegacyTest */
// TODO: add a low-level test for this factory
public class TestWordDelimiterFilterFactory extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig.xml", "schema.xml");
}
public void posTst(String v1, String v2, String s1, String s2) {
assertU(
adoc(
"id", "42",
"subword", v1,
"subword", v2));
assertU(commit());
// there is a positionIncrementGap of 100 between field values, so
// we test if that was maintained.
assertQ(
"position increment lost",
req("+id:42 +subword:\"" + s1 + ' ' + s2 + "\"~90"),
"//result[@numFound=0]");
assertQ(
"position increment lost",
req("+id:42 +subword:\"" + s1 + ' ' + s2 + "\"~110"),
"//result[@numFound=1]");
clearIndex();
}
@Test
public void testRetainPositionIncrement() {
posTst("foo", "bar", "foo", "bar");
posTst("-foo-", "-bar-", "foo", "bar");
posTst("foo", "bar", "-foo-", "-bar-");
posTst("123", "456", "123", "456");
posTst("/123/", "/456/", "123", "456");
posTst("/123/abc", "qwe/456/", "abc", "qwe");
posTst("zoo-foo", "bar-baz", "foo", "bar");
posTst("zoo-foo-123", "456-bar-baz", "foo", "bar");
}
@Test
public void testNoGenerationEdgeCase() {
assertU(adoc("id", "222", "numberpartfail", "123.123.123.123"));
clearIndex();
}
@Test
public void testIgnoreCaseChange() {
assertU(
adoc(
"id", "43",
"wdf_nocase", "HellO WilliAM",
"subword", "GoodBye JonEs"));
assertU(commit());
assertQ("no case change", req("wdf_nocase:(hell o am)"), "//result[@numFound=0]");
assertQ("case change", req("subword:(good jon)"), "//result[@numFound=1]");
clearIndex();
}
@Test
public void testPreserveOrignalTrue() {
assertU(
adoc(
"id", "144",
"wdf_preserve", "404-123"));
assertU(commit());
assertQ("preserving original word", req("wdf_preserve:404"), "//result[@numFound=1]");
assertQ("preserving original word", req("wdf_preserve:123"), "//result[@numFound=1]");
assertQ("preserving original word", req("wdf_preserve:404-123*"), "//result[@numFound=1]");
clearIndex();
}
/*
public void testPerformance() throws IOException {
String s = "now is the time-for all good men to come to-the aid of their country.";
Token tok = new Token();
long start = System.currentTimeMillis();
int ret=0;
for (int i=0; i<1000000; i++) {
StringReader r = new StringReader(s);
TokenStream ts = new WhitespaceTokenizer(r);
ts = new WordDelimiterFilter(ts, 1,1,1,1,0);
while (ts.next(tok) != null) ret++;
}
System.out.println("ret="+ret+" time="+(System.currentTimeMillis()-start));
}
***/
@Test
public void testAlphaNumericWords() {
assertU(adoc("id", "68", "numericsubword", "Java/J2SE"));
assertU(commit());
assertQ("j2se found", req("numericsubword:(J2SE)"), "//result[@numFound=1]");
assertQ("no j2 or se", req("numericsubword:(J2 OR SE)"), "//result[@numFound=0]");
clearIndex();
}
@Test
public void testProtectedWords() {
assertU(adoc("id", "70", "protectedsubword", "c# c++ .net Java/J2SE"));
assertU(commit());
assertQ("java found", req("protectedsubword:(java)"), "//result[@numFound=1]");
assertQ(".net found", req("protectedsubword:(.net)"), "//result[@numFound=1]");
assertQ("c# found", req("protectedsubword:(c#)"), "//result[@numFound=1]");
assertQ("c++ found", req("protectedsubword:(c++)"), "//result[@numFound=1]");
assertQ("c found?", req("protectedsubword:c"), "//result[@numFound=0]");
assertQ("net found?", req("protectedsubword:net"), "//result[@numFound=0]");
clearIndex();
}
@Test
public void testCustomTypes() throws Exception {
String testText = "I borrowed $5,400.00 at 25% interest-rate";
ResourceLoader loader = new SolrResourceLoader(TEST_PATH().resolve("collection1"));
Map<String, String> args = new HashMap<>();
args.put("luceneMatchVersion", Version.LATEST.toString());
args.put("generateWordParts", "1");
args.put("generateNumberParts", "1");
args.put("catenateWords", "1");
args.put("catenateNumbers", "1");
args.put("catenateAll", "0");
args.put("splitOnCaseChange", "1");
/* default behavior */
WordDelimiterFilterFactory factoryDefault = new WordDelimiterFilterFactory(args);
factoryDefault.inform(loader);
TokenStream ts = factoryDefault.create(whitespaceMockTokenizer(testText));
BaseTokenStreamTestCase.assertTokenStreamContents(
ts,
new String[] {
"I",
"borrowed",
"5",
"540000",
"400",
"00",
"at",
"25",
"interest",
"interestrate",
"rate"
});
ts = factoryDefault.create(whitespaceMockTokenizer("foo\u200Dbar"));
BaseTokenStreamTestCase.assertTokenStreamContents(ts, new String[] {"foo", "foobar", "bar"});
/* custom behavior */
args = new HashMap<>();
// use a custom type mapping
args.put("luceneMatchVersion", Version.LATEST.toString());
args.put("generateWordParts", "1");
args.put("generateNumberParts", "1");
args.put("catenateWords", "1");
args.put("catenateNumbers", "1");
args.put("catenateAll", "0");
args.put("splitOnCaseChange", "1");
args.put("types", "wdftypes.txt");
WordDelimiterFilterFactory factoryCustom = new WordDelimiterFilterFactory(args);
factoryCustom.inform(loader);
ts = factoryCustom.create(whitespaceMockTokenizer(testText));
BaseTokenStreamTestCase.assertTokenStreamContents(
ts,
new String[] {
"I", "borrowed", "$5,400.00", "at", "25%", "interest", "interestrate", "rate"
});
/* test custom behavior with a char > 0x7F, because we had to make a larger byte[] */
ts = factoryCustom.create(whitespaceMockTokenizer("foo\u200Dbar"));
BaseTokenStreamTestCase.assertTokenStreamContents(ts, new String[] {"foo\u200Dbar"});
}
}
| {
"content_hash": "2404bdc9d849bf7cdcadeb07e24b61ed",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 97,
"avg_line_length": 32.55072463768116,
"alnum_prop": 0.6215494211932324,
"repo_name": "apache/solr",
"id": "62c5f65a1a35302570a6a8bbfdf0e13e8fe7738b",
"size": "7539",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "solr/core/src/test/org/apache/solr/analysis/TestWordDelimiterFilterFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "509"
},
{
"name": "Batchfile",
"bytes": "91853"
},
{
"name": "CSS",
"bytes": "234034"
},
{
"name": "Emacs Lisp",
"bytes": "73"
},
{
"name": "HTML",
"bytes": "326277"
},
{
"name": "Handlebars",
"bytes": "7549"
},
{
"name": "Java",
"bytes": "35849436"
},
{
"name": "JavaScript",
"bytes": "17639"
},
{
"name": "Python",
"bytes": "219385"
},
{
"name": "Shell",
"bytes": "279599"
},
{
"name": "XSLT",
"bytes": "35107"
}
],
"symlink_target": ""
} |
const char databaseHost[] = "hostname.local.etc";
const char databaseUser[] = "username";
const char databasePassword[] = "a password";
const char databaseName[] = "dbname";
const char databaseLogTable[] = "table";
const unsigned int databasePort = 0;
| {
"content_hash": "b67339628faca449c5b749bd8daa2c07",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 53,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.7018867924528301,
"repo_name": "UCL/logging_modulecmd",
"id": "36dbae9c4a589694fd672b6442e946cdbd1d4a51",
"size": "266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mysql_injector/dbDetails.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "10285"
},
{
"name": "C++",
"bytes": "319"
},
{
"name": "Shell",
"bytes": "5810"
}
],
"symlink_target": ""
} |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.08.07 at 06:17:52 PM CEST
//
package org.w3._1998.math.mathml;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* <p>Java class for msubsup.type complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="msubsup.type">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <group ref="{http://www.w3.org/1998/Math/MathML}Presentation-expr.class" maxOccurs="3" minOccurs="3"/>
* <attGroup ref="{http://www.w3.org/1998/Math/MathML}msubsup.attlist"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "msubsup.type", propOrder = {
"misAndMosAndMns"
})
@XmlRootElement(name = "msubsup")
public class Msubsup {
@XmlElementRefs({
@XmlElementRef(name = "menclose", namespace = "http://www.w3.org/1998/Math/MathML", type = Menclose.class, required = false),
@XmlElementRef(name = "interval", namespace = "http://www.w3.org/1998/Math/MathML", type = Interval.class, required = false),
@XmlElementRef(name = "tan", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "piecewise", namespace = "http://www.w3.org/1998/Math/MathML", type = Piecewise.class, required = false),
@XmlElementRef(name = "ceiling", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "factorof", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "arcsin", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mover", namespace = "http://www.w3.org/1998/Math/MathML", type = Mover.class, required = false),
@XmlElementRef(name = "variance", namespace = "http://www.w3.org/1998/Math/MathML", type = Variance.class, required = false),
@XmlElementRef(name = "msubsup", namespace = "http://www.w3.org/1998/Math/MathML", type = Msubsup.class, required = false),
@XmlElementRef(name = "product", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mode", namespace = "http://www.w3.org/1998/Math/MathML", type = Mode.class, required = false),
@XmlElementRef(name = "mtext", namespace = "http://www.w3.org/1998/Math/MathML", type = Mtext.class, required = false),
@XmlElementRef(name = "power", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "divergence", namespace = "http://www.w3.org/1998/Math/MathML", type = Divergence.class, required = false),
@XmlElementRef(name = "matrix", namespace = "http://www.w3.org/1998/Math/MathML", type = Matrix.class, required = false),
@XmlElementRef(name = "logbase", namespace = "http://www.w3.org/1998/Math/MathML", type = Logbase.class, required = false),
@XmlElementRef(name = "degree", namespace = "http://www.w3.org/1998/Math/MathML", type = Degree.class, required = false),
@XmlElementRef(name = "outerproduct", namespace = "http://www.w3.org/1998/Math/MathML", type = Outerproduct.class, required = false),
@XmlElementRef(name = "mfenced", namespace = "http://www.w3.org/1998/Math/MathML", type = Mfenced.class, required = false),
@XmlElementRef(name = "prsubset", namespace = "http://www.w3.org/1998/Math/MathML", type = Prsubset.class, required = false),
@XmlElementRef(name = "grad", namespace = "http://www.w3.org/1998/Math/MathML", type = Grad.class, required = false),
@XmlElementRef(name = "vectorproduct", namespace = "http://www.w3.org/1998/Math/MathML", type = Vectorproduct.class, required = false),
@XmlElementRef(name = "plus", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mphantom", namespace = "http://www.w3.org/1998/Math/MathML", type = Mphantom.class, required = false),
@XmlElementRef(name = "msup", namespace = "http://www.w3.org/1998/Math/MathML", type = Msup.class, required = false),
@XmlElementRef(name = "emptyset", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "notprsubset", namespace = "http://www.w3.org/1998/Math/MathML", type = Notprsubset.class, required = false),
@XmlElementRef(name = "card", namespace = "http://www.w3.org/1998/Math/MathML", type = Card.class, required = false),
@XmlElementRef(name = "mstyle", namespace = "http://www.w3.org/1998/Math/MathML", type = Mstyle.class, required = false),
@XmlElementRef(name = "bvar", namespace = "http://www.w3.org/1998/Math/MathML", type = Bvar.class, required = false),
@XmlElementRef(name = "cos", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "min", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "partialdiff", namespace = "http://www.w3.org/1998/Math/MathML", type = Partialdiff.class, required = false),
@XmlElementRef(name = "real", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "msub", namespace = "http://www.w3.org/1998/Math/MathML", type = Msub.class, required = false),
@XmlElementRef(name = "lcm", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mroot", namespace = "http://www.w3.org/1998/Math/MathML", type = Mroot.class, required = false),
@XmlElementRef(name = "domainofapplication", namespace = "http://www.w3.org/1998/Math/MathML", type = Domainofapplication.class, required = false),
@XmlElementRef(name = "laplacian", namespace = "http://www.w3.org/1998/Math/MathML", type = Laplacian.class, required = false),
@XmlElementRef(name = "or", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "declare", namespace = "http://www.w3.org/1998/Math/MathML", type = Declare.class, required = false),
@XmlElementRef(name = "leq", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "cot", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "cartesianproduct", namespace = "http://www.w3.org/1998/Math/MathML", type = Cartesianproduct.class, required = false),
@XmlElementRef(name = "arcsec", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "csc", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "approx", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "gt", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "exponentiale", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "union", namespace = "http://www.w3.org/1998/Math/MathML", type = Union.class, required = false),
@XmlElementRef(name = "image", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "exp", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "arcsinh", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "rationals", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "in", namespace = "http://www.w3.org/1998/Math/MathML", type = In.class, required = false),
@XmlElementRef(name = "tanh", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "divide", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "condition", namespace = "http://www.w3.org/1998/Math/MathML", type = Condition.class, required = false),
@XmlElementRef(name = "arccsch", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mn", namespace = "http://www.w3.org/1998/Math/MathML", type = Mn.class, required = false),
@XmlElementRef(name = "arctanh", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "uplimit", namespace = "http://www.w3.org/1998/Math/MathML", type = Uplimit.class, required = false),
@XmlElementRef(name = "naturalnumbers", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "notsubset", namespace = "http://www.w3.org/1998/Math/MathML", type = Notsubset.class, required = false),
@XmlElementRef(name = "intersect", namespace = "http://www.w3.org/1998/Math/MathML", type = Intersect.class, required = false),
@XmlElementRef(name = "imaginaryi", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "eq", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "cn", namespace = "http://www.w3.org/1998/Math/MathML", type = Cn.class, required = false),
@XmlElementRef(name = "minus", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "true", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "ci", namespace = "http://www.w3.org/1998/Math/MathML", type = Ci.class, required = false),
@XmlElementRef(name = "arg", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "lowlimit", namespace = "http://www.w3.org/1998/Math/MathML", type = Lowlimit.class, required = false),
@XmlElementRef(name = "pi", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "ident", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mtable", namespace = "http://www.w3.org/1998/Math/MathML", type = Mtable.class, required = false),
@XmlElementRef(name = "domain", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "malignmark", namespace = "http://www.w3.org/1998/Math/MathML", type = Malignmark.class, required = false),
@XmlElementRef(name = "sum", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "apply", namespace = "http://www.w3.org/1998/Math/MathML", type = Apply.class, required = false),
@XmlElementRef(name = "mpadded", namespace = "http://www.w3.org/1998/Math/MathML", type = Mpadded.class, required = false),
@XmlElementRef(name = "sec", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mo", namespace = "http://www.w3.org/1998/Math/MathML", type = Mo.class, required = false),
@XmlElementRef(name = "momentabout", namespace = "http://www.w3.org/1998/Math/MathML", type = Momentabout.class, required = false),
@XmlElementRef(name = "arctan", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "and", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "root", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "subset", namespace = "http://www.w3.org/1998/Math/MathML", type = Subset.class, required = false),
@XmlElementRef(name = "notin", namespace = "http://www.w3.org/1998/Math/MathML", type = Notin.class, required = false),
@XmlElementRef(name = "coth", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "csch", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "maction", namespace = "http://www.w3.org/1998/Math/MathML", type = Maction.class, required = false),
@XmlElementRef(name = "tendsto", namespace = "http://www.w3.org/1998/Math/MathML", type = Tendsto.class, required = false),
@XmlElementRef(name = "reals", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "false", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "scalarproduct", namespace = "http://www.w3.org/1998/Math/MathML", type = Scalarproduct.class, required = false),
@XmlElementRef(name = "inverse", namespace = "http://www.w3.org/1998/Math/MathML", type = Inverse.class, required = false),
@XmlElementRef(name = "integers", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "neq", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "infinity", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "lt", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "eulergamma", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "times", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "notanumber", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "arccosh", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "arccos", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "munder", namespace = "http://www.w3.org/1998/Math/MathML", type = Munder.class, required = false),
@XmlElementRef(name = "forall", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "int", namespace = "http://www.w3.org/1998/Math/MathML", type = Int.class, required = false),
@XmlElementRef(name = "sinh", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "codomain", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "setdiff", namespace = "http://www.w3.org/1998/Math/MathML", type = Setdiff.class, required = false),
@XmlElementRef(name = "transpose", namespace = "http://www.w3.org/1998/Math/MathML", type = Transpose.class, required = false),
@XmlElementRef(name = "semantics", namespace = "http://www.w3.org/1998/Math/MathML", type = Semantics.class, required = false),
@XmlElementRef(name = "selector", namespace = "http://www.w3.org/1998/Math/MathML", type = Selector.class, required = false),
@XmlElementRef(name = "sdev", namespace = "http://www.w3.org/1998/Math/MathML", type = Sdev.class, required = false),
@XmlElementRef(name = "arccot", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mi", namespace = "http://www.w3.org/1998/Math/MathML", type = Mi.class, required = false),
@XmlElementRef(name = "implies", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "rem", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "csymbol", namespace = "http://www.w3.org/1998/Math/MathML", type = Csymbol.class, required = false),
@XmlElementRef(name = "complexes", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "ln", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "limit", namespace = "http://www.w3.org/1998/Math/MathML", type = Limit.class, required = false),
@XmlElementRef(name = "sech", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "equivalent", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "arccoth", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "maligngroup", namespace = "http://www.w3.org/1998/Math/MathML", type = Maligngroup.class, required = false),
@XmlElementRef(name = "xor", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "lambda", namespace = "http://www.w3.org/1998/Math/MathML", type = Lambda.class, required = false),
@XmlElementRef(name = "exists", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "vector", namespace = "http://www.w3.org/1998/Math/MathML", type = Vector.class, required = false),
@XmlElementRef(name = "cosh", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "list", namespace = "http://www.w3.org/1998/Math/MathML", type = org.w3._1998.math.mathml.List.class, required = false),
@XmlElementRef(name = "curl", namespace = "http://www.w3.org/1998/Math/MathML", type = Curl.class, required = false),
@XmlElementRef(name = "abs", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "msqrt", namespace = "http://www.w3.org/1998/Math/MathML", type = Msqrt.class, required = false),
@XmlElementRef(name = "sin", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "geq", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mfrac", namespace = "http://www.w3.org/1998/Math/MathML", type = Mfrac.class, required = false),
@XmlElementRef(name = "moment", namespace = "http://www.w3.org/1998/Math/MathML", type = Moment.class, required = false),
@XmlElementRef(name = "max", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "mmultiscripts", namespace = "http://www.w3.org/1998/Math/MathML", type = Mmultiscripts.class, required = false),
@XmlElementRef(name = "quotient", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "gcd", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "ms", namespace = "http://www.w3.org/1998/Math/MathML", type = Ms.class, required = false),
@XmlElementRef(name = "imaginary", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "munderover", namespace = "http://www.w3.org/1998/Math/MathML", type = Munderover.class, required = false),
@XmlElementRef(name = "mean", namespace = "http://www.w3.org/1998/Math/MathML", type = Mean.class, required = false),
@XmlElementRef(name = "compose", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "set", namespace = "http://www.w3.org/1998/Math/MathML", type = Set.class, required = false),
@XmlElementRef(name = "mspace", namespace = "http://www.w3.org/1998/Math/MathML", type = Mspace.class, required = false),
@XmlElementRef(name = "mrow", namespace = "http://www.w3.org/1998/Math/MathML", type = Mrow.class, required = false),
@XmlElementRef(name = "median", namespace = "http://www.w3.org/1998/Math/MathML", type = Median.class, required = false),
@XmlElementRef(name = "primes", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "log", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "floor", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "arccsc", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "determinant", namespace = "http://www.w3.org/1998/Math/MathML", type = Determinant.class, required = false),
@XmlElementRef(name = "not", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "diff", namespace = "http://www.w3.org/1998/Math/MathML", type = Diff.class, required = false),
@XmlElementRef(name = "arcsech", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "conjugate", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false),
@XmlElementRef(name = "merror", namespace = "http://www.w3.org/1998/Math/MathML", type = Merror.class, required = false),
@XmlElementRef(name = "factorial", namespace = "http://www.w3.org/1998/Math/MathML", type = JAXBElement.class, required = false)
})
protected java.util.List<Object> misAndMosAndMns;
@XmlAttribute(name = "subscriptshift")
protected String subscriptshift;
@XmlAttribute(name = "superscriptshift")
protected String superscriptshift;
@XmlAttribute(name = "class")
@XmlSchemaType(name = "NMTOKENS")
protected java.util.List<String> clazzs;
@XmlAttribute(name = "style")
protected String style;
@XmlAttribute(name = "xref")
@XmlIDREF
@XmlSchemaType(name = "IDREF")
protected Object xref;
@XmlAttribute(name = "id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAttribute(name = "href", namespace = "http://www.w3.org/1999/xlink")
@XmlSchemaType(name = "anyURI")
protected String href;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<>();
/**
* Gets the value of the misAndMosAndMns property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the misAndMosAndMns property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMisAndMosAndMns().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Menclose }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Interval }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Piecewise }
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link Mover }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Msubsup }
* {@link Variance }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Mtext }
* {@link Mode }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Matrix }
* {@link Divergence }
* {@link Logbase }
* {@link Outerproduct }
* {@link Degree }
* {@link Mfenced }
* {@link Prsubset }
* {@link Msup }
* {@link Mphantom }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Vectorproduct }
* {@link Grad }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Card }
* {@link Notprsubset }
* {@link Mstyle }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Bvar }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Partialdiff }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Msub }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Domainofapplication }
* {@link Mroot }
* {@link Laplacian }
* {@link JAXBElement }{@code <}{@link LogicType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link Declare }
* {@link Cartesianproduct }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Union }
* {@link JAXBElement }{@code <}{@link FunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link In }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Condition }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Mn }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Uplimit }
* {@link Notsubset }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Intersect }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link Cn }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Ci }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Lowlimit }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link JAXBElement }{@code <}{@link FunctionsType }{@code >}
* {@link Mtable }
* {@link JAXBElement }{@code <}{@link FunctionsType }{@code >}
* {@link Malignmark }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Apply }
* {@link Mpadded }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Mo }
* {@link Momentabout }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Subset }
* {@link Notin }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Maction }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Tendsto }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Scalarproduct }
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Inverse }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Munder }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link LogicType }{@code >}
* {@link Int }
* {@link Setdiff }
* {@link JAXBElement }{@code <}{@link FunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Transpose }
* {@link Semantics }
* {@link Selector }
* {@link Sdev }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link LogicType }{@code >}
* {@link Mi }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Csymbol }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Limit }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link JAXBElement }{@code <}{@link LogicType }{@code >}
* {@link Maligngroup }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link LogicType }{@code >}
* {@link Lambda }
* {@link org.w3._1998.math.mathml.List }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Vector }
* {@link Curl }
* {@link Msqrt }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link RelationsType }{@code >}
* {@link Mfrac }
* {@link Moment }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Mmultiscripts }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Ms }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link Munderover }
* {@link JAXBElement }{@code <}{@link FunctionsType }{@code >}
* {@link Mean }
* {@link Set }
* {@link Mspace }
* {@link Mrow }
* {@link JAXBElement }{@code <}{@link ConstantType }{@code >}
* {@link Median }
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Determinant }
* {@link JAXBElement }{@code <}{@link LogicType }{@code >}
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
* {@link JAXBElement }{@code <}{@link ElementaryFunctionsType }{@code >}
* {@link Diff }
* {@link Merror }
* {@link JAXBElement }{@code <}{@link ArithType }{@code >}
*
*
*/
public java.util.List<Object> getMisAndMosAndMns() {
if (misAndMosAndMns == null) {
misAndMosAndMns = new ArrayList<>();
}
return this.misAndMosAndMns;
}
/**
* Gets the value of the subscriptshift property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSubscriptshift() {
return subscriptshift;
}
/**
* Sets the value of the subscriptshift property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSubscriptshift(String value) {
this.subscriptshift = value;
}
/**
* Gets the value of the superscriptshift property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSuperscriptshift() {
return superscriptshift;
}
/**
* Sets the value of the superscriptshift property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSuperscriptshift(String value) {
this.superscriptshift = value;
}
/**
* Gets the value of the clazzs property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the clazzs property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getClazzs().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public java.util.List<String> getClazzs() {
if (clazzs == null) {
clazzs = new ArrayList<>();
}
return this.clazzs;
}
/**
* Gets the value of the style property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStyle() {
return style;
}
/**
* Sets the value of the style property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStyle(String value) {
this.style = value;
}
/**
* Gets the value of the xref property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getXref() {
return xref;
}
/**
* Sets the value of the xref property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setXref(Object value) {
this.xref = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
| {
"content_hash": "ffc66334252e6b14a1d3efbf34c6612c",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 155,
"avg_line_length": 59.81410256410256,
"alnum_prop": 0.6285499946415175,
"repo_name": "digitalheir/java-legislation-gov-uk-library",
"id": "d6740c7b84fe42753775850cca8e408e17f7f086",
"size": "37324",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/w3/_1998/math/mathml/Msubsup.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "4501081"
},
{
"name": "Ruby",
"bytes": "1226"
}
],
"symlink_target": ""
} |
FROM openshift/origin-base
MAINTAINER Federico Simoncelli <fsimonce@redhat.com>
RUN yum install -y golang openscap-scanner && yum clean all
ENV PKGPATH=/go/src/github.com/openshift/image-inspector
WORKDIR $PKGPATH
ADD . $PKGPATH
ENV GOBIN /usr/bin
ENV GOPATH /go:$PKGPATH/Godeps/_workspace
RUN go install $PKGPATH/cmd/image-inspector.go && \
mkdir -p /var/lib/image-inspector
EXPOSE 8080
WORKDIR /var/lib/image-inspector
ENTRYPOINT ["/usr/bin/image-inspector"]
| {
"content_hash": "4b2bc3a7d18270acbae6f7e50a6a93ed",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 59,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7626050420168067,
"repo_name": "enoodle/image-inspector",
"id": "cdc623dc794b728ad6f93058296b76e9dd493810",
"size": "476",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "47054"
},
{
"name": "Makefile",
"bytes": "1159"
},
{
"name": "Shell",
"bytes": "47862"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
(function($){$.fn.easyTabs=function(option){var param=jQuery.extend({fadeSpeed:"fast",defaultContent:1,activeClass:'active'},option);$(this).each(function(){var thisId="#"+this.id;if(param.defaultContent==''){param.defaultContent=1;}
if(typeof param.defaultContent=="number")
{var defaultTab=$(thisId+" .tabs li:eq("+(param.defaultContent-1)+") a").attr('href').substr(1);}else{var defaultTab=param.defaultContent;}
$(thisId+" .tabs li a").each(function(){var tabToHide=$(this).attr('href').substr(1);$("#"+tabToHide).addClass('easytabs-tab-content');});hideAll();changeContent(defaultTab);function hideAll(){$(thisId+" .easytabs-tab-content").hide();}
function changeContent(tabId){hideAll();$(thisId+" .tabs li").removeClass(param.activeClass);$(thisId+" .tabs li a[href=#"+tabId+"]").closest('li').addClass(param.activeClass);if(param.fadeSpeed!="none")
{$(thisId+" #"+tabId).fadeIn(param.fadeSpeed);}else{$(thisId+" #"+tabId).show();}}
$(thisId+" .tabs li").click(function(){var tabId=$(this).find('a').attr('href').substr(1);changeContent(tabId);return false;});});}})(jQuery);
</script>
<link rel="stylesheet" href="specimen_files/specimen_stylesheet.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />
<style type="text/css">
body{ font-family: 'Distant Galaxy'; }
</style>
<title>Distant Galaxy Regular Specimen</title>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#container').easyTabs({defaultContent:1});
});
</script>
</head>
<body>
<div id="container">
<div id="header">
Distant Galaxy Regular </div>
<ul class="tabs">
<li><a href="#specimen">Specimen</a></li>
<li><a href="#layout">Sample Layout</a></li>
<li><a href="#installing">Installing Webfonts</a></li>
</ul>
<div id="main_content">
<div id="specimen">
<div class="section">
<div class="grid12 firstcol">
<div class="huge">AaBb</div>
</div>
</div>
<div class="section">
<div class="glyph_range">A​B​C​D​E​F​G​H​I​J​K​L​M​N​O​P​Q​R​S​T​U​V​W​X​Y​Z​a​b​c​d​e​f​g​h​i​j​k​l​m​n​o​p​q​r​s​t​u​v​w​x​y​z​1​2​3​4​5​6​7​8​9​0​&​.​,​?​!​@​(​)​#​$​%​*​+​-​=​:​;</div>
</div>
<div class="section">
<div class="grid12 firstcol">
<table class="sample_table">
<tr><td>10</td><td class="size10">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>11</td><td class="size11">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>12</td><td class="size12">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>13</td><td class="size13">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>14</td><td class="size14">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>16</td><td class="size16">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>18</td><td class="size18">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>20</td><td class="size20">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>24</td><td class="size24">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>30</td><td class="size30">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>36</td><td class="size36">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>48</td><td class="size48">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>60</td><td class="size60">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>72</td><td class="size72">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
<tr><td>90</td><td class="size90">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr>
</table>
</div>
</div>
<div class="section" id="bodycomparison">
<div id="xheight">
<div class="fontbody">◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼body</div><div class="arialbody">body</div><div class="verdanabody">body</div><div class="georgiabody">body</div></div>
<div class="fontbody" style="z-index:1">
body<span>Distant Galaxy Regular</span>
</div>
<div class="arialbody" style="z-index:1">
body<span>Arial</span>
</div>
<div class="verdanabody" style="z-index:1">
body<span>Verdana</span>
</div>
<div class="georgiabody" style="z-index:1">
body<span>Georgia</span>
</div>
</div>
<div class="section psample psample_row1" id="">
<div class="grid2 firstcol">
<p class="size10"><span>10.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size11"><span>11.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size12"><span>12.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size13"><span>13.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row2" id="">
<div class="grid3 firstcol">
<p class="size14"><span>14.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size16"><span>16.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid5">
<p class="size18"><span>18.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row3" id="">
<div class="grid5 firstcol">
<p class="size20"><span>20.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid7">
<p class="size24"><span>24.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row4" id="">
<div class="grid12 firstcol">
<p class="size30"><span>30.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="white_blend"></div>
</div>
<div class="section psample psample_row1 fullreverse">
<div class="grid2 firstcol">
<p class="size10"><span>10.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size11"><span>11.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid3">
<p class="size12"><span>12.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size13"><span>13.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
<div class="section psample psample_row2 fullreverse">
<div class="grid3 firstcol">
<p class="size14"><span>14.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid4">
<p class="size16"><span>16.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid5">
<p class="size18"><span>18.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
<div class="section psample fullreverse psample_row3" id="">
<div class="grid5 firstcol">
<p class="size20"><span>20.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="grid7">
<p class="size24"><span>24.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
<div class="section psample fullreverse psample_row4" id="" style="border-bottom: 20px #000 solid;">
<div class="grid12 firstcol">
<p class="size30"><span>30.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p>
</div>
<div class="black_blend"></div>
</div>
</div>
<div id="layout">
<div class="section">
<div class="grid12 firstcol">
<h1>Lorem Ipsum Dolor</h1>
<h2>Etiam porta sem malesuada magna mollis euismod</h2>
<p class="byline">By <a href="#link">Aenean Lacinia</a></p>
</div>
</div>
<div class="section">
<div class="grid8 firstcol">
<p class="large">Donec sed odio dui. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p>
<h3>Pellentesque ornare sem</h3>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit. </p>
<p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. </p>
<p>Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Aenean lacinia bibendum nulla sed consectetur. </p>
<p>Nullam quis risus eget urna mollis ornare vel eu leo. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. </p>
<h3>Cras mattis consectetur</h3>
<p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Aenean lacinia bibendum nulla sed consectetur. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras mattis consectetur purus sit amet fermentum. </p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Cras mattis consectetur purus sit amet fermentum.</p>
</div>
<div class="grid4 sidebar">
<div class="box reverse">
<p class="last">Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auctor fringilla. Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
</div>
<p class="caption">Maecenas sed diam eget risus varius.</p>
<p>Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Vestibulum id ligula porta felis euismod semper. Sed posuere consectetur est at lobortis. Maecenas sed diam eget risus varius blandit sit amet non magna. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Nullam quis risus eget urna mollis ornare vel eu leo. </p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec ullamcorper nulla non metus auctor fringilla. Maecenas faucibus mollis interdum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p>
</div>
</div>
</div>
<div id="specs">
</div>
<div id="installing">
<div class="section">
<div class="grid7 firstcol">
<h1>Installing Webfonts</h1>
<p>Webfonts are supported by all major browser platforms but not all in the same way. There are currently four different font formats that must be included in order to target all browsers. This includes TTF, WOFF, EOT and SVG.</p>
<h2>1. Upload your webfonts</h2>
<p>You must upload your webfont kit to your website. They should be in or near the same directory as your CSS files.</p>
<h2>2. Include the webfont stylesheet</h2>
<p>A special CSS @font-face declaration helps the various browsers select the appropriate font it needs without causing you a bunch of headaches. Learn more about this syntax by reading the <a href="https://www.fontspring.com/blog/further-hardening-of-the-bulletproof-syntax">Fontspring blog post</a> about it. The code for it is as follows:</p>
<code>
@font-face{
font-family: 'MyWebFont';
src: url('WebFont.eot');
src: url('WebFont.eot?iefix') format('eot'),
url('WebFont.woff') format('woff'),
url('WebFont.ttf') format('truetype'),
url('WebFont.svg#webfont') format('svg');
}
</code>
<p>We've already gone ahead and generated the code for you. All you have to do is link to the stylesheet in your HTML, like this:</p>
<code><link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" /></code>
<h2>3. Modify your own stylesheet</h2>
<p>To take advantage of your new fonts, you must tell your stylesheet to use them. Look at the original @font-face declaration above and find the property called "font-family." The name linked there will be what you use to reference the font. Prepend that webfont name to the font stack in the "font-family" property, inside the selector you want to change. For example:</p>
<code>p { font-family: 'MyWebFont', Arial, sans-serif; }</code>
<h2>4. Test</h2>
<p>Getting webfonts to work cross-browser <em>can</em> be tricky. Use the information in the sidebar to help you if you find that fonts aren't loading in a particular browser.</p>
</div>
<div class="grid5 sidebar">
<div class="box">
<h2>Troubleshooting<br />Font-Face Problems</h2>
<p>Having trouble getting your webfonts to load in your new website? Here are some tips to sort out what might be the problem.</p>
<h3>Fonts not showing in any browser</h3>
<p>This sounds like you need to work on the plumbing. You either did not upload the fonts to the correct directory, or you did not link the fonts properly in the CSS. If you've confirmed that all this is correct and you still have a problem, take a look at your .htaccess file and see if requests are getting intercepted.</p>
<h3>Fonts not loading in iPhone or iPad</h3>
<p>The most common problem here is that you are serving the fonts from an IIS server. IIS refuses to serve files that have unknown MIME types. If that is the case, you must set the MIME type for SVG to "image/svg+xml" in the server settings. Follow these instructions from Microsoft if you need help.</p>
<h3>Fonts not loading in Firefox</h3>
<p>The primary reason for this failure? You are still using a version Firefox older than 3.5. So upgrade already! If that isn't it, then you are very likely serving fonts from a different domain. Firefox requires that all font assets be served from the same domain. Lastly it is possible that you need to add WOFF to your list of MIME types (if you are serving via IIS.)</p>
<h3>Fonts not loading in IE</h3>
<p>Are you looking at Internet Explorer on an actual Windows machine or are you cheating by using a service like Adobe BrowserLab? Many of these screenshot services do not render @font-face for IE. Best to test it on a real machine.</p>
<h3>Fonts not loading in IE9</h3>
<p>IE9, like Firefox, requires that fonts be served from the same domain as the website. Make sure that is the case.</p>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<p>©2010-2011 Fontspring. All rights reserved.</p>
</div>
</div>
</body>
</html>
| {
"content_hash": "88a79f4a4fadfab47edc6c4ad248e5da",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 937,
"avg_line_length": 67.21891891891892,
"alnum_prop": 0.7282779140364279,
"repo_name": "blacksonic/slides",
"id": "e05e015b6e6b5849c981748ccceb07841b18c154",
"size": "24871",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/font/distant-galaxy/DISTGRG_-demo.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "206548"
},
{
"name": "HTML",
"bytes": "141093"
},
{
"name": "JavaScript",
"bytes": "254224"
}
],
"symlink_target": ""
} |
import { Observable, interval as staticInterval } from 'rxjs';
Observable.interval = staticInterval;
//# sourceMappingURL=interval.js.map | {
"content_hash": "85b109fcf5ff706a2948a082485e8985",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 62,
"avg_line_length": 45.666666666666664,
"alnum_prop": 0.7956204379562044,
"repo_name": "friendsofagape/mt2414ui",
"id": "edbf006782babc468ebb401497a0a7e0969f6ff9",
"size": "137",
"binary": false,
"copies": "2",
"ref": "refs/heads/AMTv2",
"path": "node_modules/rxjs-compat/_esm2015/add/observable/interval.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10242"
},
{
"name": "HTML",
"bytes": "142509"
},
{
"name": "JavaScript",
"bytes": "2159"
},
{
"name": "TypeScript",
"bytes": "331761"
}
],
"symlink_target": ""
} |
coffee-pre-commit-hooks
=======================
Pre-commit hooks for cleaner coffee script.
| {
"content_hash": "8c0cf2facc76185390d20a5e7fd3b004",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 44,
"avg_line_length": 23.5,
"alnum_prop": 0.5957446808510638,
"repo_name": "zheller/coffee-pre-commit-hooks",
"id": "2f710daa9b91072514ddf2448eb0867e18102ea6",
"size": "94",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
"use strict";
if (typeof Promise === "undefined") {
// Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior.
require("promise/lib/rejection-tracking").enable();
window.Promise = require("promise/lib/es6-extensions.js");
}
// fetch() polyfill for making API calls.
require("whatwg-fetch");
// For jest env
if (typeof requestAnimationFrame === 'undefined') {
global.requestAnimationFrame = function(callback) {
setTimeout(callback, 0);
};
}
// For development and jest env
if (process.env.NODE_ENV !== 'production') {
require('babel-polyfill');
}
| {
"content_hash": "0a0f277023cb0666ce3cb0b8fd93c81f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 30.458333333333332,
"alnum_prop": 0.7099863201094391,
"repo_name": "devrsi0n/React-2048-game",
"id": "28a1075e04b115415a34390e81d10ce479781362",
"size": "731",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/polyfills.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "3057"
},
{
"name": "JavaScript",
"bytes": "126728"
},
{
"name": "SCSS",
"bytes": "40193"
},
{
"name": "Shell",
"bytes": "113"
}
],
"symlink_target": ""
} |
id: 1473
title: Mapas conceptuales | Secuencia para empezar
date: 2012-03-26T21:00:43+00:00
author: Alvar
layout: post
guid: http://www.acercadelaeducacion.com.ar/?p=1473
permalink: /2012/03/mapas-conceptuales-secuencia-para-empezar/
status_net:
- 'yes'
dsq_thread_id:
- "1807969054"
bitly_url:
- http://bit.ly/1ZuiGFW
bitly_hash:
- 1ZuiGFW
bitly_long_url:
- http://www.acercadelaeducacion.com.ar/2012/03/mapas-conceptuales-secuencia-para-empezar/
image: /wp-content/uploads/2012/03/Souto.jpg
categories:
- Destacados
- Educación
tags:
- aprendizaje visual
- Educación
- Recursos
---
<a href="http://www.acercadelaeducacion.com.ar/wp-content/uploads/2012/03/Souto.jpg"><img class="alignleft size-medium wp-image-1482" style="border: 3px solid black; margin: 3px;" title="Souto" src="http://www.acercadelaeducacion.com.ar/wp-content/uploads/2012/03/Souto-300x200.jpg" alt="" width="300" height="200" /></a>Hace años que vengo trabajando con mapas conceptuales, haciendo mapas para aprender y enseñando a hacerlos para estudiar. Una muy buena fuente de recursos para empezar a meterse en en el campo del aprendizaje visual es el módulo de Eduteka:
<a href="http://www.eduteka.org/modulos.php?catx=4&idSubX=86">Eduteka - Aprendizaje Visual > Aprendizaje Visual > Organizadores Gráficos</a>.
En él encontrarán diversidad de propuestas y herramientas para hacer mapas y redes conceptuales con recursos digitales.
A partir de ese módulo es que utilizo para empezar la siguiente secuencia.
<a href="http://www.acercadelaeducacion.com.ar/wp-content/uploads/2012/03/secuencia_mapa1.pdf">secuencia_mapa</a>
<p style="text-align: center;"></p> | {
"content_hash": "e7255878c8c64e20bb0d8196e6fbb778",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 561,
"avg_line_length": 46.52777777777778,
"alnum_prop": 0.7588059701492538,
"repo_name": "acercadelaeducacion/acercadelaeducacion.github.io",
"id": "d2754ed53d3515d314907b35d37ccc23051b7da0",
"size": "1688",
"binary": false,
"copies": "1",
"ref": "refs/heads/source",
"path": "_posts/2012-03-26-mapas-conceptuales-secuencia-para-empezar.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "174603"
},
{
"name": "HTML",
"bytes": "358322"
},
{
"name": "JavaScript",
"bytes": "312584"
},
{
"name": "Python",
"bytes": "727"
},
{
"name": "Ruby",
"bytes": "11704"
},
{
"name": "TeX",
"bytes": "2252"
}
],
"symlink_target": ""
} |
namespace VLDDexporter{
// forward declaration for friend access //
class CommandProcessor;
struct CallstackFunction;
// file that is mentioned in the report //
struct CallstackFileEntry{
// sets initial blame count to zero, so that adding functions will have right blame count //
CallstackFileEntry(const string &filename);
void AddFunctionToFile(CallstackFunction* func);
string PathOrName;
// how many leaks are in this file //
int BlameCount;
vector<int> LeakLines;
// references to CallStackFunctions that are from this file //
vector<CallstackFunction*> FunctionsInfile;
};
// function that has appeared in 1 or more callstack in the leaks //
struct CallstackFunction{
CallstackFunction(const string &functionname, const int &line);
string Name;
// how many leaks does this function cause //
int BlameCount;
int Line;
// owning file //
CallstackFileEntry* ContainedInFile;
};
// block of leaked memory loaded from the file //
struct ProcessedBlock{
ProcessedBlock(const UINT &number, const int &bytecount);
UINT AllocationNumber;
int LeakedBytes;
// functions that are responsible for this leak //
vector<CallstackFunction*> FunctionsInBlock;
};
class InputProcessor{
friend CommandProcessor;
public:
InputProcessor(const wstring &file);
~InputProcessor();
bool ProcessFile();
void FileAndFunctionFound(shared_ptr<ProcessedBlock> block, const int &line, const string &file, const string &function);
// finding functions //
shared_ptr<CallstackFunction> FindFunctionEntry(const string &function);
shared_ptr<CallstackFileEntry> FindFileEntry(const string &file);
void DeleteEntirely(ProcessedBlock* block);
void DeleteEntirely(CallstackFileEntry* file);
void DeleteEntirely(CallstackFunction* func);
protected:
bool _ProcessBlockStartLine(const string &line, shared_ptr<ProcessedBlock>* blockptr);
bool _ProcessCallstackFunctionLine(const string &line, shared_ptr<ProcessedBlock>* blockptr);
void _FinalizeDataImport();
// ------------------------------------ //
// file reader //
ifstream Reader;
// list of all the data blocks that are in the file (these vectors are responsible for cleaning everything up) //
vector<shared_ptr<ProcessedBlock>> LoadedBlocks;
vector<shared_ptr<CallstackFileEntry>> LeakingFiles;
vector<shared_ptr<CallstackFunction>> LeakingFunctions;
};
}
#endif | {
"content_hash": "43baea34d98932bbb441d13ee9c77880",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 123,
"avg_line_length": 28.058139534883722,
"alnum_prop": 0.7414007459593867,
"repo_name": "hhyyrylainen/VLD-Data-Exporter",
"id": "b660ba95e11b2de48863553efaaa5c9e1135594b",
"size": "2628",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "VLD data exporter/InputProcessor.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "311657"
}
],
"symlink_target": ""
} |
public class Solution {
public bool IsScramble(string s1, string s2) {
if (s1 == s2)
{
return true;
}
if (s1.Length != s2.Length)
{
return false;
}
// chararray cannot compare, so convert to string and compare
if (new string(s1.OrderBy(c => c).ToArray()) != new string(s2.OrderBy(c => c).ToArray()))
{
return false;
}
for (int leftLength = 1; leftLength < s1.Length; leftLength++)
{
if (IsScramble(s1.Substring(leftLength), s2.Substring(leftLength)) &&
IsScramble(s1.Substring(0, leftLength), s2.Substring(0, leftLength)))
{
return true;
}
if (IsScramble(s1.Substring(0, leftLength), s2.Substring(s2.Length - leftLength)) &&
IsScramble(s1.Substring(leftLength), s2.Substring(0, s2.Length - leftLength)))
{
return true;
}
}
return false;
}
}
| {
"content_hash": "373785b4e9e682186f7fd8da6d8ea8ed",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 97,
"avg_line_length": 33.3125,
"alnum_prop": 0.4915572232645403,
"repo_name": "txchen/csharp-leet",
"id": "7b2281efba2ee7ca8f6cfe183735fb1faaf004ab",
"size": "1066",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "solutions/Q087.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "241043"
},
{
"name": "SQLPL",
"bytes": "191"
},
{
"name": "Shell",
"bytes": "709"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
Integrated Taxonomic Information System
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "15a6088fac4fab5b5cb041ce277dd4f3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.7218045112781954,
"repo_name": "mdoering/backbone",
"id": "05f9ba84dbcd43ab9e68ba741919a152801a0d33",
"size": "194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Chenopodiaceae/Bassia/Bassia scoparia/ Syn. Bassia sieversiana/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#ifndef LCFG_TOKEN_H
#define LCFG_TOKEN_H
#include "lcfg/lcfg_string.h"
enum lcfg_token_type
{
lcfg_null_token = 0,
lcfg_identifier,
lcfg_equals,
lcfg_string,
lcfg_sbracket_open,
lcfg_sbracket_close,
lcfg_comma,
lcfg_brace_open,
lcfg_brace_close
};
extern const char *lcfg_token_map[];
struct lcfg_token
{
enum lcfg_token_type type;
struct lcfg_string *string;
short line;
short col;
};
#endif
| {
"content_hash": "082d01751433fb40ab23a9ea07e16f76",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 36,
"avg_line_length": 13.35483870967742,
"alnum_prop": 0.7125603864734299,
"repo_name": "dericpr/temp_driver",
"id": "be2b62b31193c023ec28d0194fc79bef6f3efb57",
"size": "1968",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/lcfg/lcfg_token.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "188284"
},
{
"name": "C++",
"bytes": "2043"
},
{
"name": "CMake",
"bytes": "7454"
},
{
"name": "JavaScript",
"bytes": "1640"
},
{
"name": "Makefile",
"bytes": "38056"
}
],
"symlink_target": ""
} |
Symfony2 Bundle for the breakfast-serializer
| {
"content_hash": "5d788c368e38610b64900fd51b8ed3bb",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 45,
"alnum_prop": 0.8666666666666667,
"repo_name": "BDB-Studios/breakfast-serializer-bundle",
"id": "8694c75fc50566a80ce1850f4a40973baac3b956",
"size": "75",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: New LAptop
* Date: 04/05/2017
* Time: 08:55
*/
$success_msg= "";
$error_msg= "";
if(!empty($_POST['submit'])) {
if (isset($_POST['username']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['confirm'])) {
if ($_POST['password'] == $_POST['confirm']) {
$user = new \Hudutech\Entity\User();
$user->setUsername($_POST['username']);
$user->setEmail($_POST['email']);
$user->setPassword($_POST['password']);
$user->setRole(null);
$userController = new \Hudutech\Controller\UserController();
if ($userController->create($user)) {
$success_msg .= "User saved successfully";
} else {
$error_msg .= 'error saving user, please try again ';
}
} else {
$error_msg .= "password does not match";
}
} else {
$error_msg .= 'All fields required';
}
} | {
"content_hash": "4dc06a1a4c60347cb8a1bb1ab6fe038a",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 119,
"avg_line_length": 25.82051282051282,
"alnum_prop": 0.4985104270109235,
"repo_name": "samgithae/jua",
"id": "5e08c4c99218949f6515c84d29e12a8b755c6a1d",
"size": "1007",
"binary": false,
"copies": "1",
"ref": "refs/heads/ui",
"path": "en/includes/register_user.inc.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20854"
},
{
"name": "HTML",
"bytes": "448355"
},
{
"name": "JavaScript",
"bytes": "63174"
},
{
"name": "PHP",
"bytes": "544967"
}
],
"symlink_target": ""
} |
// The following environment variables, if set, will be used:
//
// * SQLX_SQLITE_DSN
// * SQLX_POSTGRES_DSN
// * SQLX_MYSQL_DSN
//
// Set any of these variables to 'skip' to skip them. Note that for MySQL,
// the string '?parseTime=True' will be appended to the DSN if it's not there
// already.
//
package sqlx
import (
"database/sql"
"database/sql/driver"
"encoding/json"
"fmt"
"log"
"os"
"reflect"
"strings"
"testing"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx/reflectx"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
)
/* compile time checks that Db, Tx, Stmt (qStmt) implement expected interfaces */
var _, _ Ext = &DB{}, &Tx{}
var _, _ ColScanner = &Row{}, &Rows{}
var _ Queryer = &qStmt{}
var _ Execer = &qStmt{}
var TestPostgres = true
var TestSqlite = true
var TestMysql = true
var sldb *DB
var pgdb *DB
var mysqldb *DB
var active = []*DB{}
func init() {
ConnectAll()
}
func ConnectAll() {
var err error
pgdsn := os.Getenv("SQLX_POSTGRES_DSN")
mydsn := os.Getenv("SQLX_MYSQL_DSN")
sqdsn := os.Getenv("SQLX_SQLITE_DSN")
TestPostgres = pgdsn != "skip"
TestMysql = mydsn != "skip"
TestSqlite = sqdsn != "skip"
if !strings.Contains(mydsn, "parseTime=true") {
mydsn += "?parseTime=true"
}
if TestPostgres {
pgdb, err = Connect("postgres", pgdsn)
if err != nil {
fmt.Printf("Disabling PG tests:\n %v\n", err)
TestPostgres = false
}
} else {
fmt.Println("Disabling Postgres tests.")
}
if TestMysql {
mysqldb, err = Connect("mysql", mydsn)
if err != nil {
fmt.Printf("Disabling MySQL tests:\n %v", err)
TestMysql = false
}
} else {
fmt.Println("Disabling MySQL tests.")
}
if TestSqlite {
sldb, err = Connect("sqlite3", sqdsn)
if err != nil {
fmt.Printf("Disabling SQLite:\n %v", err)
TestSqlite = false
}
} else {
fmt.Println("Disabling SQLite tests.")
}
}
type Schema struct {
create string
drop string
}
func (s Schema) Postgres() (string, string) {
return s.create, s.drop
}
func (s Schema) MySQL() (string, string) {
return strings.Replace(s.create, `"`, "`", -1), s.drop
}
func (s Schema) Sqlite3() (string, string) {
return strings.Replace(s.create, `now()`, `CURRENT_TIMESTAMP`, -1), s.drop
}
var defaultSchema = Schema{
create: `
CREATE TABLE person (
first_name text,
last_name text,
email text,
added_at timestamp default now()
);
CREATE TABLE place (
country text,
city text NULL,
telcode integer
);
CREATE TABLE capplace (
"COUNTRY" text,
"CITY" text NULL,
"TELCODE" integer
);
CREATE TABLE nullperson (
first_name text NULL,
last_name text NULL,
email text NULL
);
CREATE TABLE employees (
name text,
id integer,
boss_id integer
);
`,
drop: `
drop table person;
drop table place;
drop table capplace;
drop table nullperson;
drop table employees;
`,
}
type Person struct {
FirstName string `db:"first_name"`
LastName string `db:"last_name"`
Email string
AddedAt time.Time `db:"added_at"`
}
type Person2 struct {
FirstName sql.NullString `db:"first_name"`
LastName sql.NullString `db:"last_name"`
Email sql.NullString
}
type Place struct {
Country string
City sql.NullString
TelCode int
}
type PlacePtr struct {
Country string
City *string
TelCode int
}
type PersonPlace struct {
Person
Place
}
type PersonPlacePtr struct {
*Person
*Place
}
type EmbedConflict struct {
FirstName string `db:"first_name"`
Person
}
type SliceMember struct {
Country string
City sql.NullString
TelCode int
People []Person `db:"-"`
Addresses []Place `db:"-"`
}
// Note that because of field map caching, we need a new type here
// if we've used Place already soemwhere in sqlx
type CPlace Place
func MultiExec(e Execer, query string) {
stmts := strings.Split(query, ";\n")
if len(strings.Trim(stmts[len(stmts)-1], " \n\t\r")) == 0 {
stmts = stmts[:len(stmts)-1]
}
for _, s := range stmts {
_, err := e.Exec(s)
if err != nil {
fmt.Println(err, s)
}
}
}
func RunWithSchema(schema Schema, t *testing.T, test func(db *DB, t *testing.T)) {
runner := func(db *DB, t *testing.T, create, drop string) {
defer func() {
MultiExec(db, drop)
}()
MultiExec(db, create)
test(db, t)
}
if TestPostgres {
create, drop := schema.Postgres()
runner(pgdb, t, create, drop)
}
if TestSqlite {
create, drop := schema.Sqlite3()
runner(sldb, t, create, drop)
}
if TestMysql {
create, drop := schema.MySQL()
runner(mysqldb, t, create, drop)
}
}
func loadDefaultFixture(db *DB, t *testing.T) {
tx := db.MustBegin()
tx.MustExec(tx.Rebind("INSERT INTO person (first_name, last_name, email) VALUES (?, ?, ?)"), "Jason", "Moiron", "jmoiron@jmoiron.net")
tx.MustExec(tx.Rebind("INSERT INTO person (first_name, last_name, email) VALUES (?, ?, ?)"), "John", "Doe", "johndoeDNE@gmail.net")
tx.MustExec(tx.Rebind("INSERT INTO place (country, city, telcode) VALUES (?, ?, ?)"), "United States", "New York", "1")
tx.MustExec(tx.Rebind("INSERT INTO place (country, telcode) VALUES (?, ?)"), "Hong Kong", "852")
tx.MustExec(tx.Rebind("INSERT INTO place (country, telcode) VALUES (?, ?)"), "Singapore", "65")
if db.DriverName() == "mysql" {
tx.MustExec(tx.Rebind("INSERT INTO capplace (`COUNTRY`, `TELCODE`) VALUES (?, ?)"), "Sarf Efrica", "27")
} else {
tx.MustExec(tx.Rebind("INSERT INTO capplace (\"COUNTRY\", \"TELCODE\") VALUES (?, ?)"), "Sarf Efrica", "27")
}
tx.MustExec(tx.Rebind("INSERT INTO employees (name, id) VALUES (?, ?)"), "Peter", "4444")
tx.MustExec(tx.Rebind("INSERT INTO employees (name, id, boss_id) VALUES (?, ?, ?)"), "Joe", "1", "4444")
tx.MustExec(tx.Rebind("INSERT INTO employees (name, id, boss_id) VALUES (?, ?, ?)"), "Martin", "2", "4444")
tx.Commit()
}
// Test a new backwards compatible feature, that missing scan destinations
// will silently scan into sql.RawText rather than failing/panicing
func TestMissingNames(t *testing.T) {
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
type PersonPlus struct {
FirstName string `db:"first_name"`
LastName string `db:"last_name"`
Email string
//AddedAt time.Time `db:"added_at"`
}
// test Select first
pps := []PersonPlus{}
// pps lacks added_at destination
err := db.Select(&pps, "SELECT * FROM person")
if err == nil {
t.Error("Expected missing name from Select to fail, but it did not.")
}
// test Get
pp := PersonPlus{}
err = db.Get(&pp, "SELECT * FROM person LIMIT 1")
if err == nil {
t.Error("Expected missing name Get to fail, but it did not.")
}
// test naked StructScan
pps = []PersonPlus{}
rows, err := db.Query("SELECT * FROM person LIMIT 1")
if err != nil {
t.Fatal(err)
}
rows.Next()
err = StructScan(rows, &pps)
if err == nil {
t.Error("Expected missing name in StructScan to fail, but it did not.")
}
rows.Close()
// now try various things with unsafe set.
db = db.Unsafe()
pps = []PersonPlus{}
err = db.Select(&pps, "SELECT * FROM person")
if err != nil {
t.Error(err)
}
// test Get
pp = PersonPlus{}
err = db.Get(&pp, "SELECT * FROM person LIMIT 1")
if err != nil {
t.Error(err)
}
// test naked StructScan
pps = []PersonPlus{}
rowsx, err := db.Queryx("SELECT * FROM person LIMIT 1")
if err != nil {
t.Fatal(err)
}
rowsx.Next()
err = StructScan(rowsx, &pps)
if err != nil {
t.Error(err)
}
rowsx.Close()
})
}
func TestEmbeddedStructs(t *testing.T) {
type Loop1 struct{ Person }
type Loop2 struct{ Loop1 }
type Loop3 struct{ Loop2 }
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
peopleAndPlaces := []PersonPlace{}
err := db.Select(
&peopleAndPlaces,
`SELECT person.*, place.* FROM
person natural join place`)
if err != nil {
t.Fatal(err)
}
for _, pp := range peopleAndPlaces {
if len(pp.Person.FirstName) == 0 {
t.Errorf("Expected non zero lengthed first name.")
}
if len(pp.Place.Country) == 0 {
t.Errorf("Expected non zero lengthed country.")
}
}
// test embedded structs with StructScan
rows, err := db.Queryx(
`SELECT person.*, place.* FROM
person natural join place`)
if err != nil {
t.Error(err)
}
perp := PersonPlace{}
rows.Next()
err = rows.StructScan(&perp)
if err != nil {
t.Error(err)
}
if len(perp.Person.FirstName) == 0 {
t.Errorf("Expected non zero lengthed first name.")
}
if len(perp.Place.Country) == 0 {
t.Errorf("Expected non zero lengthed country.")
}
rows.Close()
// test the same for embedded pointer structs
peopleAndPlacesPtrs := []PersonPlacePtr{}
err = db.Select(
&peopleAndPlacesPtrs,
`SELECT person.*, place.* FROM
person natural join place`)
if err != nil {
t.Fatal(err)
}
for _, pp := range peopleAndPlacesPtrs {
if len(pp.Person.FirstName) == 0 {
t.Errorf("Expected non zero lengthed first name.")
}
if len(pp.Place.Country) == 0 {
t.Errorf("Expected non zero lengthed country.")
}
}
// test "deep nesting"
l3s := []Loop3{}
err = db.Select(&l3s, `select * from person`)
if err != nil {
t.Fatal(err)
}
for _, l3 := range l3s {
if len(l3.Loop2.Loop1.Person.FirstName) == 0 {
t.Errorf("Expected non zero lengthed first name.")
}
}
// test "embed conflicts"
ec := []EmbedConflict{}
err = db.Select(&ec, `select * from person`)
// I'm torn between erroring here or having some kind of working behavior
// in order to allow for more flexibility in destination structs
if err != nil {
t.Errorf("Was not expecting an error on embed conflicts.")
}
})
}
func TestJoinQuery(t *testing.T) {
type Employee struct {
Name string
Id int64
// BossId is an id into the employee table
BossId sql.NullInt64 `db:"boss_id"`
}
type Boss Employee
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
var employees []struct {
Employee
Boss `db:"boss"`
}
err := db.Select(
&employees,
`SELECT employees.*, boss.id "boss.id", boss.name "boss.name" FROM employees
JOIN employees AS boss ON employees.boss_id = boss.id`)
if err != nil {
t.Fatal(err)
}
for _, em := range employees {
if len(em.Employee.Name) == 0 {
t.Errorf("Expected non zero lengthed name.")
}
if em.Employee.BossId.Int64 != em.Boss.Id {
t.Errorf("Expected boss ids to match")
}
}
})
}
func TestJoinQueryNamedPointerStructs(t *testing.T) {
type Employee struct {
Name string
Id int64
// BossId is an id into the employee table
BossId sql.NullInt64 `db:"boss_id"`
}
type Boss Employee
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
var employees []struct {
Emp1 *Employee `db:"emp1"`
Emp2 *Employee `db:"emp2"`
*Boss `db:"boss"`
}
err := db.Select(
&employees,
`SELECT emp.name "emp1.name", emp.id "emp1.id", emp.boss_id "emp1.boss_id",
emp.name "emp2.name", emp.id "emp2.id", emp.boss_id "emp2.boss_id",
boss.id "boss.id", boss.name "boss.name" FROM employees AS emp
JOIN employees AS boss ON emp.boss_id = boss.id
`)
if err != nil {
t.Fatal(err)
}
for _, em := range employees {
if len(em.Emp1.Name) == 0 || len(em.Emp2.Name) == 0 {
t.Errorf("Expected non zero lengthed name.")
}
if em.Emp1.BossId.Int64 != em.Boss.Id || em.Emp2.BossId.Int64 != em.Boss.Id {
t.Errorf("Expected boss ids to match")
}
}
})
}
func TestSelectSliceMapTime(t *testing.T) {
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
rows, err := db.Queryx("SELECT * FROM person")
if err != nil {
t.Fatal(err)
}
for rows.Next() {
_, err := rows.SliceScan()
if err != nil {
t.Error(err)
}
}
rows, err = db.Queryx("SELECT * FROM person")
if err != nil {
t.Fatal(err)
}
for rows.Next() {
m := map[string]interface{}{}
err := rows.MapScan(m)
if err != nil {
t.Error(err)
}
}
})
}
func TestNilReceiver(t *testing.T) {
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
var p *Person
err := db.Get(p, "SELECT * FROM person LIMIT 1")
if err == nil {
t.Error("Expected error when getting into nil struct ptr.")
}
var pp *[]Person
err = db.Select(pp, "SELECT * FROM person")
if err == nil {
t.Error("Expected an error when selecting into nil slice ptr.")
}
})
}
func TestNamedQuery(t *testing.T) {
var schema = Schema{
create: `
CREATE TABLE person (
first_name text NULL,
last_name text NULL,
email text NULL
);
CREATE TABLE jsperson (
"FIRST" text NULL,
last_name text NULL,
"EMAIL" text NULL
);`,
drop: `
drop table person;
drop table jsperson;
`,
}
RunWithSchema(schema, t, func(db *DB, t *testing.T) {
type Person struct {
FirstName sql.NullString `db:"first_name"`
LastName sql.NullString `db:"last_name"`
Email sql.NullString
}
p := Person{
FirstName: sql.NullString{String: "ben", Valid: true},
LastName: sql.NullString{String: "doe", Valid: true},
Email: sql.NullString{String: "ben@doe.com", Valid: true},
}
q1 := `INSERT INTO person (first_name, last_name, email) VALUES (:first_name, :last_name, :email)`
_, err := db.NamedExec(q1, p)
if err != nil {
log.Fatal(err)
}
p2 := &Person{}
rows, err := db.NamedQuery("SELECT * FROM person WHERE first_name=:first_name", p)
if err != nil {
log.Fatal(err)
}
for rows.Next() {
err = rows.StructScan(p2)
if err != nil {
t.Error(err)
}
if p2.FirstName.String != "ben" {
t.Error("Expected first name of `ben`, got " + p2.FirstName.String)
}
if p2.LastName.String != "doe" {
t.Error("Expected first name of `doe`, got " + p2.LastName.String)
}
}
// these are tests for #73; they verify that named queries work if you've
// changed the db mapper. This code checks both NamedQuery "ad-hoc" style
// queries and NamedStmt queries, which use different code paths internally.
old := *db.Mapper
type JSONPerson struct {
FirstName sql.NullString `json:"FIRST"`
LastName sql.NullString `json:"last_name"`
Email sql.NullString
}
jp := JSONPerson{
FirstName: sql.NullString{String: "ben", Valid: true},
LastName: sql.NullString{String: "smith", Valid: true},
Email: sql.NullString{String: "ben@smith.com", Valid: true},
}
db.Mapper = reflectx.NewMapperFunc("json", strings.ToUpper)
// prepare queries for case sensitivity to test our ToUpper function.
// postgres and sqlite accept "", but mysql uses ``; since Go's multi-line
// strings are `` we use "" by default and swap out for MySQL
pdb := func(s string, db *DB) string {
if db.DriverName() == "mysql" {
return strings.Replace(s, `"`, "`", -1)
}
return s
}
q1 = `INSERT INTO jsperson ("FIRST", last_name, "EMAIL") VALUES (:FIRST, :last_name, :EMAIL)`
_, err = db.NamedExec(pdb(q1, db), jp)
if err != nil {
t.Fatal(err, db.DriverName())
}
// Checks that a person pulled out of the db matches the one we put in
check := func(t *testing.T, rows *Rows) {
jp = JSONPerson{}
for rows.Next() {
err = rows.StructScan(&jp)
if err != nil {
t.Error(err)
}
if jp.FirstName.String != "ben" {
t.Errorf("Expected first name of `ben`, got `%s` (%s) ", jp.FirstName.String, db.DriverName())
}
if jp.LastName.String != "smith" {
t.Errorf("Expected LastName of `smith`, got `%s` (%s)", jp.LastName.String, db.DriverName())
}
if jp.Email.String != "ben@smith.com" {
t.Errorf("Expected first name of `doe`, got `%s` (%s)", jp.Email.String, db.DriverName())
}
}
}
ns, err := db.PrepareNamed(pdb(`
SELECT * FROM jsperson
WHERE
"FIRST"=:FIRST AND
last_name=:last_name AND
"EMAIL"=:EMAIL
`, db))
if err != nil {
t.Fatal(err)
}
rows, err = ns.Queryx(jp)
if err != nil {
t.Fatal(err)
}
check(t, rows)
// Check exactly the same thing, but with db.NamedQuery, which does not go
// through the PrepareNamed/NamedStmt path.
rows, err = db.NamedQuery(pdb(`
SELECT * FROM jsperson
WHERE
"FIRST"=:FIRST AND
last_name=:last_name AND
"EMAIL"=:EMAIL
`, db), jp)
if err != nil {
t.Fatal(err)
}
check(t, rows)
row := db.NamedQueryRow(pdb(`
SELECT * FROM jsperson
WHERE
"FIRST"=:FIRST AND
last_name=:last_name AND
"EMAIL"=:EMAIL
`, db), jp)
jp2 := JSONPerson{}
err = row.StructScan(&jp2)
if err != nil {
t.Error(err)
}
if jp2.Email != jp.Email {
t.Errorf("Email Mismatch %s", db.DriverName())
}
if jp2.FirstName != jp.FirstName {
t.Errorf("FirstName Mismatch %s", db.DriverName())
}
if jp2.LastName != jp.LastName {
t.Errorf("LastName Mismatch %s", db.DriverName())
}
db.Mapper = &old
})
}
func TestNilInserts(t *testing.T) {
var schema = Schema{
create: `
CREATE TABLE tt (
id integer,
value text NULL DEFAULT NULL
);`,
drop: "drop table tt;",
}
RunWithSchema(schema, t, func(db *DB, t *testing.T) {
type TT struct {
ID int
Value *string
}
var v, v2 TT
r := db.Rebind
db.MustExec(r(`INSERT INTO tt (id) VALUES (1)`))
db.Get(&v, r(`SELECT * FROM tt`))
if v.ID != 1 {
t.Errorf("Expecting id of 1, got %v", v.ID)
}
if v.Value != nil {
t.Errorf("Expecting NULL to map to nil, got %s", *v.Value)
}
v.ID = 2
// NOTE: this incidentally uncovered a bug which was that named queries with
// pointer destinations would not work if the passed value here was not addressable,
// as reflectx.FieldByIndexes attempts to allocate nil pointer receivers for
// writing. This was fixed by creating & using the reflectx.FieldByIndexesReadOnly
// function. This next line is important as it provides the only coverage for this.
db.NamedExec(`INSERT INTO tt (id, value) VALUES (:id, :value)`, v)
db.Get(&v2, r(`SELECT * FROM tt WHERE id=2`))
if v.ID != v2.ID {
t.Errorf("%v != %v", v.ID, v2.ID)
}
if v2.Value != nil {
t.Errorf("Expecting NULL to map to nil, got %s", *v.Value)
}
})
}
func TestScanError(t *testing.T) {
var schema = Schema{
create: `
CREATE TABLE kv (
k text,
v integer
);`,
drop: `drop table kv;`,
}
RunWithSchema(schema, t, func(db *DB, t *testing.T) {
type WrongTypes struct {
K int
V string
}
_, err := db.Exec(db.Rebind("INSERT INTO kv (k, v) VALUES (?, ?)"), "hi", 1)
if err != nil {
t.Error(err)
}
rows, err := db.Queryx("SELECT * FROM kv")
if err != nil {
t.Error(err)
}
for rows.Next() {
var wt WrongTypes
err := rows.StructScan(&wt)
if err == nil {
t.Errorf("%s: Scanning wrong types into keys should have errored.", db.DriverName())
}
}
})
}
// FIXME: this function is kinda big but it slows things down to be constantly
// loading and reloading the schema..
func TestUsage(t *testing.T) {
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
slicemembers := []SliceMember{}
err := db.Select(&slicemembers, "SELECT * FROM place ORDER BY telcode ASC")
if err != nil {
t.Fatal(err)
}
people := []Person{}
err = db.Select(&people, "SELECT * FROM person ORDER BY first_name ASC")
if err != nil {
t.Fatal(err)
}
jason, john := people[0], people[1]
if jason.FirstName != "Jason" {
t.Errorf("Expecting FirstName of Jason, got %s", jason.FirstName)
}
if jason.LastName != "Moiron" {
t.Errorf("Expecting LastName of Moiron, got %s", jason.LastName)
}
if jason.Email != "jmoiron@jmoiron.net" {
t.Errorf("Expecting Email of jmoiron@jmoiron.net, got %s", jason.Email)
}
if john.FirstName != "John" || john.LastName != "Doe" || john.Email != "johndoeDNE@gmail.net" {
t.Errorf("John Doe's person record not what expected: Got %v\n", john)
}
jason = Person{}
err = db.Get(&jason, db.Rebind("SELECT * FROM person WHERE first_name=?"), "Jason")
if err != nil {
t.Fatal(err)
}
if jason.FirstName != "Jason" {
t.Errorf("Expecting to get back Jason, but got %v\n", jason.FirstName)
}
err = db.Get(&jason, db.Rebind("SELECT * FROM person WHERE first_name=?"), "Foobar")
if err == nil {
t.Errorf("Expecting an error, got nil\n")
}
if err != sql.ErrNoRows {
t.Errorf("Expected sql.ErrNoRows, got %v\n", err)
}
// The following tests check statement reuse, which was actually a problem
// due to copying being done when creating Stmt's which was eventually removed
stmt1, err := db.Preparex(db.Rebind("SELECT * FROM person WHERE first_name=?"))
if err != nil {
t.Fatal(err)
}
jason = Person{}
row := stmt1.QueryRowx("DoesNotExist")
row.Scan(&jason)
row = stmt1.QueryRowx("DoesNotExist")
row.Scan(&jason)
err = stmt1.Get(&jason, "DoesNotExist User")
if err == nil {
t.Error("Expected an error")
}
err = stmt1.Get(&jason, "DoesNotExist User 2")
stmt2, err := db.Preparex(db.Rebind("SELECT * FROM person WHERE first_name=?"))
if err != nil {
t.Fatal(err)
}
jason = Person{}
tx, err := db.Beginx()
if err != nil {
t.Fatal(err)
}
tstmt2 := tx.Stmtx(stmt2)
row2 := tstmt2.QueryRowx("Jason")
err = row2.StructScan(&jason)
if err != nil {
t.Error(err)
}
tx.Commit()
places := []*Place{}
err = db.Select(&places, "SELECT telcode FROM place ORDER BY telcode ASC")
usa, singsing, honkers := places[0], places[1], places[2]
if usa.TelCode != 1 || honkers.TelCode != 852 || singsing.TelCode != 65 {
t.Errorf("Expected integer telcodes to work, got %#v", places)
}
placesptr := []PlacePtr{}
err = db.Select(&placesptr, "SELECT * FROM place ORDER BY telcode ASC")
if err != nil {
t.Error(err)
}
//fmt.Printf("%#v\n%#v\n%#v\n", placesptr[0], placesptr[1], placesptr[2])
// if you have null fields and use SELECT *, you must use sql.Null* in your struct
// this test also verifies that you can use either a []Struct{} or a []*Struct{}
places2 := []Place{}
err = db.Select(&places2, "SELECT * FROM place ORDER BY telcode ASC")
usa, singsing, honkers = &places2[0], &places2[1], &places2[2]
// this should return a type error that &p is not a pointer to a struct slice
p := Place{}
err = db.Select(&p, "SELECT * FROM place ORDER BY telcode ASC")
if err == nil {
t.Errorf("Expected an error, argument to select should be a pointer to a struct slice")
}
// this should be an error
pl := []Place{}
err = db.Select(pl, "SELECT * FROM place ORDER BY telcode ASC")
if err == nil {
t.Errorf("Expected an error, argument to select should be a pointer to a struct slice, not a slice.")
}
if usa.TelCode != 1 || honkers.TelCode != 852 || singsing.TelCode != 65 {
t.Errorf("Expected integer telcodes to work, got %#v", places)
}
stmt, err := db.Preparex(db.Rebind("SELECT country, telcode FROM place WHERE telcode > ? ORDER BY telcode ASC"))
if err != nil {
t.Error(err)
}
places = []*Place{}
err = stmt.Select(&places, 10)
if len(places) != 2 {
t.Error("Expected 2 places, got 0.")
}
if err != nil {
t.Fatal(err)
}
singsing, honkers = places[0], places[1]
if singsing.TelCode != 65 || honkers.TelCode != 852 {
t.Errorf("Expected the right telcodes, got %#v", places)
}
rows, err := db.Queryx("SELECT * FROM place")
if err != nil {
t.Fatal(err)
}
place := Place{}
for rows.Next() {
err = rows.StructScan(&place)
if err != nil {
t.Fatal(err)
}
}
rows, err = db.Queryx("SELECT * FROM place")
if err != nil {
t.Fatal(err)
}
m := map[string]interface{}{}
for rows.Next() {
err = rows.MapScan(m)
if err != nil {
t.Fatal(err)
}
_, ok := m["country"]
if !ok {
t.Errorf("Expected key `country` in map but could not find it (%#v)\n", m)
}
}
rows, err = db.Queryx("SELECT * FROM place")
if err != nil {
t.Fatal(err)
}
for rows.Next() {
s, err := rows.SliceScan()
if err != nil {
t.Error(err)
}
if len(s) != 3 {
t.Errorf("Expected 3 columns in result, got %d\n", len(s))
}
}
// test advanced querying
// test that NamedExec works with a map as well as a struct
_, err = db.NamedExec("INSERT INTO person (first_name, last_name, email) VALUES (:first, :last, :email)", map[string]interface{}{
"first": "Bin",
"last": "Smuth",
"email": "bensmith@allblacks.nz",
})
if err != nil {
t.Fatal(err)
}
// ensure that if the named param happens right at the end it still works
// ensure that NamedQuery works with a map[string]interface{}
rows, err = db.NamedQuery("SELECT * FROM person WHERE first_name=:first", map[string]interface{}{"first": "Bin"})
if err != nil {
t.Fatal(err)
}
ben := &Person{}
for rows.Next() {
err = rows.StructScan(ben)
if err != nil {
t.Fatal(err)
}
if ben.FirstName != "Bin" {
t.Fatal("Expected first name of `Bin`, got " + ben.FirstName)
}
if ben.LastName != "Smuth" {
t.Fatal("Expected first name of `Smuth`, got " + ben.LastName)
}
}
ben.FirstName = "Ben"
ben.LastName = "Smith"
ben.Email = "binsmuth@allblacks.nz"
// Insert via a named query using the struct
_, err = db.NamedExec("INSERT INTO person (first_name, last_name, email) VALUES (:first_name, :last_name, :email)", ben)
if err != nil {
t.Fatal(err)
}
rows, err = db.NamedQuery("SELECT * FROM person WHERE first_name=:first_name", ben)
if err != nil {
t.Fatal(err)
}
for rows.Next() {
err = rows.StructScan(ben)
if err != nil {
t.Fatal(err)
}
if ben.FirstName != "Ben" {
t.Fatal("Expected first name of `Ben`, got " + ben.FirstName)
}
if ben.LastName != "Smith" {
t.Fatal("Expected first name of `Smith`, got " + ben.LastName)
}
}
// ensure that Get does not panic on emppty result set
person := &Person{}
err = db.Get(person, "SELECT * FROM person WHERE first_name=$1", "does-not-exist")
if err == nil {
t.Fatal("Should have got an error for Get on non-existant row.")
}
// lets test prepared statements some more
stmt, err = db.Preparex(db.Rebind("SELECT * FROM person WHERE first_name=?"))
if err != nil {
t.Fatal(err)
}
rows, err = stmt.Queryx("Ben")
if err != nil {
t.Fatal(err)
}
for rows.Next() {
err = rows.StructScan(ben)
if err != nil {
t.Fatal(err)
}
if ben.FirstName != "Ben" {
t.Fatal("Expected first name of `Ben`, got " + ben.FirstName)
}
if ben.LastName != "Smith" {
t.Fatal("Expected first name of `Smith`, got " + ben.LastName)
}
}
john = Person{}
stmt, err = db.Preparex(db.Rebind("SELECT * FROM person WHERE first_name=?"))
if err != nil {
t.Error(err)
}
err = stmt.Get(&john, "John")
if err != nil {
t.Error(err)
}
// test name mapping
// THIS USED TO WORK BUT WILL NO LONGER WORK.
db.MapperFunc(strings.ToUpper)
rsa := CPlace{}
err = db.Get(&rsa, "SELECT * FROM capplace;")
if err != nil {
t.Error(err, "in db:", db.DriverName())
}
db.MapperFunc(strings.ToLower)
// create a copy and change the mapper, then verify the copy behaves
// differently from the original.
dbCopy := NewDb(db.DB, db.DriverName())
dbCopy.MapperFunc(strings.ToUpper)
err = dbCopy.Get(&rsa, "SELECT * FROM capplace;")
if err != nil {
fmt.Println(db.DriverName())
t.Error(err)
}
err = db.Get(&rsa, "SELECT * FROM cappplace;")
if err == nil {
t.Error("Expected no error, got ", err)
}
// test base type slices
var sdest []string
rows, err = db.Queryx("SELECT email FROM person ORDER BY email ASC;")
if err != nil {
t.Error(err)
}
err = scanAll(rows, &sdest, false)
if err != nil {
t.Error(err)
}
// test Get with base types
var count int
err = db.Get(&count, "SELECT count(*) FROM person;")
if err != nil {
t.Error(err)
}
if count != len(sdest) {
t.Errorf("Expected %d == %d (count(*) vs len(SELECT ..)", count, len(sdest))
}
// test Get and Select with time.Time, #84
var addedAt time.Time
err = db.Get(&addedAt, "SELECT added_at FROM person LIMIT 1;")
if err != nil {
t.Error(err)
}
var addedAts []time.Time
err = db.Select(&addedAts, "SELECT added_at FROM person;")
if err != nil {
t.Error(err)
}
// test it on a double pointer
var pcount *int
err = db.Get(&pcount, "SELECT count(*) FROM person;")
if err != nil {
t.Error(err)
}
if *pcount != count {
t.Errorf("expected %d = %d", *pcount, count)
}
// test Select...
sdest = []string{}
err = db.Select(&sdest, "SELECT first_name FROM person ORDER BY first_name ASC;")
if err != nil {
t.Error(err)
}
expected := []string{"Ben", "Bin", "Jason", "John"}
for i, got := range sdest {
if got != expected[i] {
t.Errorf("Expected %d result to be %s, but got %s", i, expected[i], got)
}
}
var nsdest []sql.NullString
err = db.Select(&nsdest, "SELECT city FROM place ORDER BY city ASC")
if err != nil {
t.Error(err)
}
for _, val := range nsdest {
if val.Valid && val.String != "New York" {
t.Errorf("expected single valid result to be `New York`, but got %s", val.String)
}
}
})
}
type Product struct {
ProductID int
}
// tests that sqlx will not panic when the wrong driver is passed because
// of an automatic nil dereference in sqlx.Open(), which was fixed.
func TestDoNotPanicOnConnect(t *testing.T) {
_, err := Connect("bogus", "hehe")
if err == nil {
t.Errorf("Should return error when using bogus driverName")
}
}
func TestRebind(t *testing.T) {
q1 := `INSERT INTO foo (a, b, c, d, e, f, g, h, i) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
q2 := `INSERT INTO foo (a, b, c) VALUES (?, ?, "foo"), ("Hi", ?, ?)`
s1 := Rebind(DOLLAR, q1)
s2 := Rebind(DOLLAR, q2)
if s1 != `INSERT INTO foo (a, b, c, d, e, f, g, h, i) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)` {
t.Errorf("q1 failed")
}
if s2 != `INSERT INTO foo (a, b, c) VALUES ($1, $2, "foo"), ("Hi", $3, $4)` {
t.Errorf("q2 failed")
}
s1 = Rebind(NAMED, q1)
s2 = Rebind(NAMED, q2)
ex1 := `INSERT INTO foo (a, b, c, d, e, f, g, h, i) VALUES ` +
`(:arg1, :arg2, :arg3, :arg4, :arg5, :arg6, :arg7, :arg8, :arg9, :arg10)`
if s1 != ex1 {
t.Error("q1 failed on Named params")
}
ex2 := `INSERT INTO foo (a, b, c) VALUES (:arg1, :arg2, "foo"), ("Hi", :arg3, :arg4)`
if s2 != ex2 {
t.Error("q2 failed on Named params")
}
}
func TestBindMap(t *testing.T) {
// Test that it works..
q1 := `INSERT INTO foo (a, b, c, d) VALUES (:name, :age, :first, :last)`
am := map[string]interface{}{
"name": "Jason Moiron",
"age": 30,
"first": "Jason",
"last": "Moiron",
}
bq, args, _ := bindMap(QUESTION, q1, am)
expect := `INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?)`
if bq != expect {
t.Errorf("Interpolation of query failed: got `%v`, expected `%v`\n", bq, expect)
}
if args[0].(string) != "Jason Moiron" {
t.Errorf("Expected `Jason Moiron`, got %v\n", args[0])
}
if args[1].(int) != 30 {
t.Errorf("Expected 30, got %v\n", args[1])
}
if args[2].(string) != "Jason" {
t.Errorf("Expected Jason, got %v\n", args[2])
}
if args[3].(string) != "Moiron" {
t.Errorf("Expected Moiron, got %v\n", args[3])
}
}
// Test for #117, embedded nil maps
type Message struct {
Text string `db:"string"`
Properties PropertyMap // Stored as JSON in the database
}
type PropertyMap map[string]string
// Implement driver.Valuer and sql.Scanner interfaces on PropertyMap
func (p PropertyMap) Value() (driver.Value, error) {
if len(p) == 0 {
return nil, nil
}
return json.Marshal(p)
}
func (p PropertyMap) Scan(src interface{}) error {
v := reflect.ValueOf(src)
if !v.IsValid() || v.IsNil() {
return nil
}
if data, ok := src.([]byte); ok {
return json.Unmarshal(data, &p)
}
return fmt.Errorf("Could not not decode type %T -> %T", src, p)
}
func TestEmbeddedMaps(t *testing.T) {
var schema = Schema{
create: `
CREATE TABLE message (
string text,
properties text
);`,
drop: `drop table message;`,
}
RunWithSchema(schema, t, func(db *DB, t *testing.T) {
messages := []Message{
{"Hello, World", PropertyMap{"one": "1", "two": "2"}},
{"Thanks, Joy", PropertyMap{"pull": "request"}},
}
q1 := `INSERT INTO message (string, properties) VALUES (:string, :properties)`
for _, m := range messages {
_, err := db.NamedExec(q1, m)
if err != nil {
t.Error(err)
}
}
var count int
err := db.Get(&count, "SELECT count(*) FROM message")
if err != nil {
t.Error(err)
}
if count != len(messages) {
t.Errorf("Expected %d messages in DB, found %d", len(messages), count)
}
var m Message
err = db.Get(&m, "SELECT * FROM message LIMIT 1")
if err != nil {
t.Error(err)
}
if m.Properties == nil {
t.Error("Expected m.Properties to not be nil, but it was.")
}
})
}
func TestIn(t *testing.T) {
// some quite normal situations
type tr struct {
q string
args []interface{}
c int
}
tests := []tr{
{"SELECT * FROM foo WHERE x = ? AND v in (?) AND y = ?",
[]interface{}{"foo", []int{0, 5, 7, 2, 9}, "bar"},
7},
{"SELECT * FROM foo WHERE x in (?)",
[]interface{}{[]int{1, 2, 3, 4, 5, 6, 7, 8}},
8},
}
for _, test := range tests {
q, a, err := In(test.q, test.args...)
if err != nil {
t.Error(err)
}
if len(a) != test.c {
t.Errorf("Expected %d args, but got %d (%+v)", test.c, len(a), a)
}
if strings.Count(q, "?") != test.c {
t.Errorf("Expected %d bindVars, got %d", test.c, strings.Count(q, "?"))
}
}
// too many bindVars, but no slices, so short circuits parsing
// i'm not sure if this is the right behavior; this query/arg combo
// might not work, but we shouldn't parse if we don't need to
{
orig := "SELECT * FROM foo WHERE x = ? AND y = ?"
q, a, err := In(orig, "foo", "bar", "baz")
if err != nil {
t.Error(err)
}
if len(a) != 3 {
t.Errorf("Expected 3 args, but got %d (%+v)", len(a), a)
}
if q != orig {
t.Error("Expected unchanged query.")
}
}
tests = []tr{
// too many bindvars; slice present so should return error during parse
{"SELECT * FROM foo WHERE x = ? and y = ?",
[]interface{}{"foo", []int{1, 2, 3}, "bar"},
0},
// empty slice, should return error before parse
{"SELECT * FROM foo WHERE x = ?",
[]interface{}{[]int{}},
0},
// too *few* bindvars, should return an error
{"SELECT * FROM foo WHERE x = ? AND y in (?)",
[]interface{}{[]int{1, 2, 3}},
0},
}
for _, test := range tests {
_, _, err := In(test.q, test.args...)
if err == nil {
t.Error("Expected an error, but got nil.")
}
}
RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T) {
loadDefaultFixture(db, t)
//tx.MustExec(tx.Rebind("INSERT INTO place (country, city, telcode) VALUES (?, ?, ?)"), "United States", "New York", "1")
//tx.MustExec(tx.Rebind("INSERT INTO place (country, telcode) VALUES (?, ?)"), "Hong Kong", "852")
//tx.MustExec(tx.Rebind("INSERT INTO place (country, telcode) VALUES (?, ?)"), "Singapore", "65")
telcodes := []int{852, 65}
q := "SELECT * FROM place WHERE telcode IN(?) ORDER BY telcode"
query, args, err := In(q, telcodes)
if err != nil {
t.Error(err)
}
query = db.Rebind(query)
places := []Place{}
err = db.Select(&places, query, args...)
if err != nil {
t.Error(err)
}
if len(places) != 2 {
t.Fatalf("Expecting 2 results, got %d", len(places))
}
if places[0].TelCode != 65 {
t.Errorf("Expecting singapore first, but got %#v", places[0])
}
if places[1].TelCode != 852 {
t.Errorf("Expecting hong kong second, but got %#v", places[1])
}
})
}
func TestBindStruct(t *testing.T) {
var err error
q1 := `INSERT INTO foo (a, b, c, d) VALUES (:name, :age, :first, :last)`
type tt struct {
Name string
Age int
First string
Last string
}
type tt2 struct {
Field1 string `db:"field_1"`
Field2 string `db:"field_2"`
}
type tt3 struct {
tt2
Name string
}
am := tt{"Jason Moiron", 30, "Jason", "Moiron"}
bq, args, _ := bindStruct(QUESTION, q1, am, mapper())
expect := `INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?)`
if bq != expect {
t.Errorf("Interpolation of query failed: got `%v`, expected `%v`\n", bq, expect)
}
if args[0].(string) != "Jason Moiron" {
t.Errorf("Expected `Jason Moiron`, got %v\n", args[0])
}
if args[1].(int) != 30 {
t.Errorf("Expected 30, got %v\n", args[1])
}
if args[2].(string) != "Jason" {
t.Errorf("Expected Jason, got %v\n", args[2])
}
if args[3].(string) != "Moiron" {
t.Errorf("Expected Moiron, got %v\n", args[3])
}
am2 := tt2{"Hello", "World"}
bq, args, _ = bindStruct(QUESTION, "INSERT INTO foo (a, b) VALUES (:field_2, :field_1)", am2, mapper())
expect = `INSERT INTO foo (a, b) VALUES (?, ?)`
if bq != expect {
t.Errorf("Interpolation of query failed: got `%v`, expected `%v`\n", bq, expect)
}
if args[0].(string) != "World" {
t.Errorf("Expected 'World', got %s\n", args[0].(string))
}
if args[1].(string) != "Hello" {
t.Errorf("Expected 'Hello', got %s\n", args[1].(string))
}
am3 := tt3{Name: "Hello!"}
am3.Field1 = "Hello"
am3.Field2 = "World"
bq, args, err = bindStruct(QUESTION, "INSERT INTO foo (a, b, c) VALUES (:name, :field_1, :field_2)", am3, mapper())
if err != nil {
t.Fatal(err)
}
expect = `INSERT INTO foo (a, b, c) VALUES (?, ?, ?)`
if bq != expect {
t.Errorf("Interpolation of query failed: got `%v`, expected `%v`\n", bq, expect)
}
if args[0].(string) != "Hello!" {
t.Errorf("Expected 'Hello!', got %s\n", args[0].(string))
}
if args[1].(string) != "Hello" {
t.Errorf("Expected 'Hello', got %s\n", args[1].(string))
}
if args[2].(string) != "World" {
t.Errorf("Expected 'World', got %s\n", args[0].(string))
}
}
func TestEmbeddedLiterals(t *testing.T) {
var schema = Schema{
create: `
CREATE TABLE x (
k text
);`,
drop: `drop table x;`,
}
RunWithSchema(schema, t, func(db *DB, t *testing.T) {
type t1 struct {
K *string
}
type t2 struct {
Inline struct {
F string
}
K *string
}
db.MustExec(db.Rebind("INSERT INTO x (k) VALUES (?), (?), (?);"), "one", "two", "three")
target := t1{}
err := db.Get(&target, db.Rebind("SELECT * FROM x WHERE k=?"), "one")
if err != nil {
t.Error(err)
}
if *target.K != "one" {
t.Error("Expected target.K to be `one`, got ", target.K)
}
target2 := t2{}
err = db.Get(&target2, db.Rebind("SELECT * FROM x WHERE k=?"), "one")
if err != nil {
t.Error(err)
}
if *target2.K != "one" {
t.Errorf("Expected target2.K to be `one`, got `%v`", target2.K)
}
})
}
func BenchmarkBindStruct(b *testing.B) {
b.StopTimer()
q1 := `INSERT INTO foo (a, b, c, d) VALUES (:name, :age, :first, :last)`
type t struct {
Name string
Age int
First string
Last string
}
am := t{"Jason Moiron", 30, "Jason", "Moiron"}
b.StartTimer()
for i := 0; i < b.N; i++ {
bindStruct(DOLLAR, q1, am, mapper())
}
}
func BenchmarkBindMap(b *testing.B) {
b.StopTimer()
q1 := `INSERT INTO foo (a, b, c, d) VALUES (:name, :age, :first, :last)`
am := map[string]interface{}{
"name": "Jason Moiron",
"age": 30,
"first": "Jason",
"last": "Moiron",
}
b.StartTimer()
for i := 0; i < b.N; i++ {
bindMap(DOLLAR, q1, am)
}
}
func BenchmarkIn(b *testing.B) {
q := `SELECT * FROM foo WHERE x = ? AND v in (?) AND y = ?`
for i := 0; i < b.N; i++ {
_, _, _ = In(q, []interface{}{"foo", []int{0, 5, 7, 2, 9}, "bar"}...)
}
}
func BenchmarkRebind(b *testing.B) {
b.StopTimer()
q1 := `INSERT INTO foo (a, b, c, d, e, f, g, h, i) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
q2 := `INSERT INTO foo (a, b, c) VALUES (?, ?, "foo"), ("Hi", ?, ?)`
b.StartTimer()
for i := 0; i < b.N; i++ {
Rebind(DOLLAR, q1)
Rebind(DOLLAR, q2)
}
}
func BenchmarkRebindBuffer(b *testing.B) {
b.StopTimer()
q1 := `INSERT INTO foo (a, b, c, d, e, f, g, h, i) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
q2 := `INSERT INTO foo (a, b, c) VALUES (?, ?, "foo"), ("Hi", ?, ?)`
b.StartTimer()
for i := 0; i < b.N; i++ {
rebindBuff(DOLLAR, q1)
rebindBuff(DOLLAR, q2)
}
}
| {
"content_hash": "12b5c5fb64d28eee4962f47531b45217",
"timestamp": "",
"source": "github",
"line_count": 1606,
"max_line_length": 135,
"avg_line_length": 24.982565379825655,
"alnum_prop": 0.6086436369074323,
"repo_name": "proteneer/sqlx",
"id": "2d3ef08208f321ea2d92d798d3a024bc3198f566",
"size": "40122",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sqlx_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "126982"
}
],
"symlink_target": ""
} |
#pragma once
#include <string>
#include "envoy/api/api.h"
#include "source/common/stats/isolated_store_impl.h"
#include "test/test_common/utility.h"
namespace Envoy {
/**
* Class for Schemas supported by validation tool.
*/
class Schema {
public:
/**
* List of supported schemas to validate.
*/
enum Type { DiscoveryResponse, Route };
/**
* Get a string representation of the schema type.
* @param type to convert.
* @return string representation of type.
*/
static const std::string& toString(Type type);
private:
static const std::string DISCOVERY_RESPONSE;
static const std::string ROUTE;
};
/**
* Parses command line arguments for Schema Validator Tool.
*/
class Options {
public:
Options(int argc, char** argv);
/**
* @return the schema type.
*/
Schema::Type schemaType() const { return schema_type_; }
/**
* @return the path to configuration file.
*/
const std::string& configPath() const { return config_path_; }
private:
Schema::Type schema_type_;
std::string config_path_;
};
/**
* Validates the schema of a configuration.
*/
class Validator {
public:
Validator() : api_(Api::createApiForTest(stats_)) {}
/**
* Validates the configuration at config_path against schema_type.
* An EnvoyException is thrown in several cases:
* - Cannot load the configuration from config_path(invalid path or malformed data).
* - A schema error from validating the configuration.
* @param config_path specifies the path to the configuration file.
* @param schema_type specifies the schema to validate the configuration against.
*/
void validate(const std::string& config_path, Schema::Type schema_type);
private:
Stats::IsolatedStoreImpl stats_;
Api::ApiPtr api_;
};
} // namespace Envoy
| {
"content_hash": "1caf1c19500f8498ae0eaa31dc86e439",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 87,
"avg_line_length": 22.923076923076923,
"alnum_prop": 0.6912751677852349,
"repo_name": "lyft/envoy",
"id": "1e92cce035cb8fbbfbe113b98369b9815ce117ac",
"size": "1788",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "test/tools/schema_validator/validator.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "439"
},
{
"name": "C",
"bytes": "9840"
},
{
"name": "C++",
"bytes": "30180292"
},
{
"name": "Dockerfile",
"bytes": "891"
},
{
"name": "Emacs Lisp",
"bytes": "966"
},
{
"name": "Go",
"bytes": "558"
},
{
"name": "Jinja",
"bytes": "46306"
},
{
"name": "Makefile",
"bytes": "303"
},
{
"name": "PureBasic",
"bytes": "472"
},
{
"name": "Python",
"bytes": "659418"
},
{
"name": "Rust",
"bytes": "38417"
},
{
"name": "Shell",
"bytes": "177423"
},
{
"name": "Starlark",
"bytes": "1743784"
},
{
"name": "Thrift",
"bytes": "748"
}
],
"symlink_target": ""
} |
/** @file
@brief RPL data handler
This is not to be included by the application.
*/
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __RPL_H
#define __RPL_H
#include <kernel.h>
#include <stdbool.h>
#include <net/net_ip.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "route.h"
#define NET_ICMPV6_RPL 155 /* RPL Control Message */
#define NET_RPL_DODAG_SOLICIT 0x00
#define NET_RPL_DODAG_INFO_OBJ 0x01
#define NET_RPL_DEST_ADV_OBJ 0x02
#define NET_RPL_DEST_ADV_OBJ_ACK 0x03
#define NET_RPL_SEC_DODAG_SOLICIT 0x80
#define NET_RPL_SEC_DODAG_INFO_OBJ 0x81
#define NET_RPL_SEC_DEST_ADV_OBJ 0x82
#define NET_RPL_SEC_DEST_ADV_OBJ_ACK 0x83
#define NET_RPL_CONSISTENCY_CHECK 0x8A
/* Routing Metric/Constraint Type, RFC 6551 ch 6.1 */
#define NET_RPL_MC_NONE 0 /* Local identifier for empty MC */
#define NET_RPL_MC_NSA 1 /* Node State and Attributes */
#define NET_RPL_MC_ENERGY 2 /* Node Energy */
#define NET_RPL_MC_HOPCOUNT 3 /* Hop Count */
#define NET_RPL_MC_THROUGHPUT 4 /* Throughput */
#define NET_RPL_MC_LATENCY 5 /* Latency */
#define NET_RPL_MC_LQL 6 /* Link Quality Level */
#define NET_RPL_MC_ETX 7 /* Expected Transmission Count */
#define NET_RPL_MC_LC 8 /* Link Color */
/* Routing Metric/Constraint Common Header Flag Field, RFC 6551, ch 6.3 */
#define NET_RPL_MC_FLAG_P BIT(5)
#define NET_RPL_MC_FLAG_C BIT(6)
#define NET_RPL_MC_FLAG_O BIT(7)
#define NET_RPL_MC_FLAG_R BIT(8)
/* Routing Metric/Constraint Common Header A Field, RFC 6551, ch 6.4 */
#define NET_RPL_MC_A_ADDITIVE 0
#define NET_RPL_MC_A_MAXIMUM 1
#define NET_RPL_MC_A_MINIMUM 2
#define NET_RPL_MC_A_MULTIPLICATIVE 3
/* Node type field, RFC 6551, ch 6.7 */
#define NET_RPL_MC_NODE_TYPE_MAINS 0
#define NET_RPL_MC_NODE_TYPE_BATTERY 1
#define NET_RPL_MC_NODE_TYPE_SCAVENGING 2
/* The bit index within the flags field of the RPL metric object energy
* structure.
*/
#define NET_RPL_MC_ENERGY_INCLUDED 3
#define NET_RPL_MC_ENERGY_TYPE 1
#define NET_RPL_MC_ENERGY_ESTIMATION 0
/* RPL control message options. */
#define NET_RPL_OPTION_PAD1 0
#define NET_RPL_OPTION_PADN 1
#define NET_RPL_OPTION_DAG_METRIC_CONTAINER 2
#define NET_RPL_OPTION_ROUTE_INFO 3
#define NET_RPL_OPTION_DAG_CONF 4
#define NET_RPL_OPTION_TARGET 5
#define NET_RPL_OPTION_TRANSIT 6
#define NET_RPL_OPTION_SOLICITED_INFO 7
#define NET_RPL_OPTION_PREFIX_INFO 8
#define NET_RPL_OPTION_TARGET_DESC 9
#define NET_RPL_MAX_RANK_INC (7 * CONFIG_NET_RPL_MIN_HOP_RANK_INC)
#define NET_RPL_INFINITE_RANK 0xffff
/* Rank of a root node. */
#define NET_RPL_ROOT_RANK(instance) ((instance)->min_hop_rank_inc)
#define NET_RPL_DAG_RANK(rank, instance) ((rank) / \
(instance)->min_hop_rank_inc)
/*
* The ETX in the metric container is expressed as a fixed-point value
* whose integer part can be obtained by dividing the value by
* NET_RPL_MC_ETX_DIVISOR.
*/
#define NET_RPL_MC_ETX_DIVISOR 256
/* DAG Mode of Operation */
#define NET_RPL_MOP_NO_DOWNWARD_ROUTES 0
#define NET_RPL_MOP_NON_STORING 1
#define NET_RPL_MOP_STORING_NO_MULTICAST 2
#define NET_RPL_MOP_STORING_MULTICAST 3
#if defined(CONFIG_NET_RPL_DEFAULT_INSTANCE)
#define NET_RPL_DEFAULT_INSTANCE CONFIG_NET_RPL_DEFAULT_INSTANCE
#else
#define NET_RPL_DEFAULT_INSTANCE 0x1e
#endif
#define NET_RPL_PARENT_FLAG_UPDATED 0x1
#define NET_RPL_PARENT_FLAG_LINK_METRIC_VALID 0x2
/* RPL IPv6 extension header option. */
#define NET_RPL_HDR_OPT_LEN 4
#define NET_RPL_HOP_BY_HOP_LEN (NET_RPL_HDR_OPT_LEN + 2 + 2)
#define NET_RPL_HDR_OPT_DOWN 0x80
#define NET_RPL_HDR_OPT_DOWN_SHIFT 7
#define NET_RPL_HDR_OPT_RANK_ERR 0x40
#define NET_RPL_HDR_OPT_RANK_ERR_SHIFT 6
#define NET_RPL_HDR_OPT_FWD_ERR 0x20
#define NET_RPL_HDR_OPT_FWD_ERR_SHIFT 5
/**
* RPL modes
*
* The RPL module can be in either of three modes: mesh mode
* (NET_RPL_MODE_MESH), feather mode (NET_RPL_MODE_FEATHER), and leaf mode
* (NET_RPL_MODE_LEAF). In mesh mode, nodes forward data for other nodes,
* and are reachable by others. In feather mode, nodes can forward
* data for other nodes, but are not reachable themselves. In leaf
* mode, nodes do not forward data for others, but are reachable by
* others.
*/
enum net_rpl_mode {
NET_RPL_MODE_MESH,
NET_RPL_MODE_FEATHER,
NET_RPL_MODE_LEAF,
};
/**
* Flag values in DAO message.
*/
#define NET_RPL_DAO_K_FLAG 0x80 /* DAO ACK requested */
#define NET_RPL_DAO_D_FLAG 0x40 /* DODAG ID present */
#define NET_RPL_LOLLIPOP_MAX_VALUE 255
#define NET_RPL_LOLLIPOP_CIRCULAR_REGION 127
#define NET_RPL_LOLLIPOP_SEQUENCE_WINDOWS 16
#if defined(CONFIG_NET_RPL)
static inline u8_t net_rpl_lollipop_init(void)
{
return NET_RPL_LOLLIPOP_MAX_VALUE -
NET_RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1;
}
static inline void net_rpl_lollipop_increment(u8_t *counter)
{
if (*counter > NET_RPL_LOLLIPOP_CIRCULAR_REGION) {
*counter = (*counter + 1) & NET_RPL_LOLLIPOP_MAX_VALUE;
} else {
*counter = (*counter + 1) & NET_RPL_LOLLIPOP_CIRCULAR_REGION;
}
}
static inline bool net_rpl_lollipop_is_init(u8_t counter)
{
return counter > NET_RPL_LOLLIPOP_CIRCULAR_REGION;
}
struct net_rpl_instance;
struct net_rpl_dag;
/**
* @brief DIO prefix suboption.
*/
struct net_rpl_prefix {
/** IPv6 address prefix */
struct in6_addr prefix;
/** Lifetime of the prefix */
u32_t lifetime;
/** Length of the prefix */
u8_t length;
/** Prefix flags */
u8_t flags;
};
/**
* @brief Node energy object, RFC 6551, ch 3.2
*/
struct net_rpl_node_energy_object {
/** Energy node flags */
u8_t flags;
/** Energy estimation */
u8_t estimation;
};
/**
* @brief DAG Metric Container. RFC 6551, ch 2.1
*/
struct net_rpl_metric_container {
/** Metric container information */
union metric_object {
struct net_rpl_node_energy_object energy;
u16_t etx;
} obj;
/** Type of the container */
u8_t type;
/** Container flags */
u8_t flags;
/** Aggregated value (A field) */
u8_t aggregated;
/**
* Precedence of this Routing Metric/Constraint object relative
* to other objects in the container.
*/
u8_t precedence;
/** Length of the object body */
u8_t length;
};
/**
* @brief Parent information.
*/
struct net_rpl_parent {
/** Used DAG */
struct net_rpl_dag *dag;
/** Used metric container */
struct net_rpl_metric_container mc;
/** When last transmit happened */
u32_t last_tx_time;
/** Rank of the parent */
u16_t rank;
/** Destination Advertisement Trigger Sequence Number */
u8_t dtsn;
/** Parent flags */
u8_t flags;
};
/**
* @brief Directed Acyclic Graph (DAG)
*/
struct net_rpl_dag {
/** DAG id */
struct in6_addr dag_id;
/** What is the preferred parent. */
struct net_rpl_parent *preferred_parent;
/** IPv6 prefix information */
struct net_rpl_prefix prefix_info;
/** Used RPL instance */
struct net_rpl_instance *instance;
/** Minimum rank */
u16_t min_rank;
/** DAG rank */
u16_t rank;
/** DAG version. */
u8_t version;
/** DODAG preference. */
u8_t preference : 3;
/** Is this DAG used or not. */
u8_t is_used : 1;
/** Is DAG grounded or floating. */
u8_t is_grounded : 1;
/** Is DAG joined or not. */
u8_t is_joined : 1;
u8_t _unused : 2;
};
/**
* @brief Get related neighbor information from parent pointer.
*
* @param data Pointer to parent.
*
* @return Neighbor pointer if found, NULL if neighbor is not found.
*/
struct net_nbr *net_rpl_get_nbr(struct net_rpl_parent *data);
/**
* @brief Get related neighbor data from parent pointer.
*
* @param data Pointer to parent.
*
* @return Neighbor data pointer if found, NULL if neighbor is not found.
*/
struct net_ipv6_nbr_data *
net_rpl_get_ipv6_nbr_data(struct net_rpl_parent *parent);
/**
* @brief RPL object function (OF) reset.
*
* @details Reset the OF state for a specific DAG. This function is called when
* doing a global repair on the DAG.
*
* @param dag Pointer to DAG object
*/
extern void net_rpl_of_reset(struct net_rpl_dag *dag);
/**
* @brief RPL object function (OF) neighbor link callback.
*
* @details Receives link-layer neighbor information. The etx parameter
* specifies the current ETX(estimated transmissions) for the neighbor.
*
* @param iface Network interface
* @param parent Parent of the neighbor
* @param status Transmission status
* @param ext Estimated transmissions value
*
* @return 0 if ok, < 0 if error
*/
extern int net_rpl_of_neighbor_link_cb(struct net_if *iface,
struct net_rpl_parent *parent,
int status, int etx);
/**
* @brief RPL object function (OF) get best parent.
*
* @details Compares two parents and returns the best one.
*
* @param iface Network interface.
* @param parentA First parent.
* @param parentB Second parent.
*
* @return Best parent is returned.
*/
extern struct net_rpl_parent *
net_rpl_of_best_parent(struct net_if *iface,
struct net_rpl_parent *parentA,
struct net_rpl_parent *parentB);
/**
* @brief RPL object function (OF) get best DAG.
*
* @details Compares two DAGs and returns the best one.
*
* @param dagA First DAG.
* @param dagB Second DAG.
*
* @return Best DAG.
*/
extern struct net_rpl_dag *net_rpl_of_best_dag(struct net_rpl_dag *dagA,
struct net_rpl_dag *dagB);
/**
* @brief RPL object function (OF) calculate rank.
*
* @details Calculates a rank value using the parent rank and a base rank.
* If parent is not set, the OF selects a default increment that is
* added to the base rank. Otherwise, the OF uses information known
* about parent to select an increment to the base rank.
*/
extern u16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
u16_t rank);
/**
* @brief RPL object function (OF) update metric container.
*
* @details Updates the metric container for outgoing DIOs in a certain DAG.
* If the OF of the DAG does not use metric containers, the function
* should set the object type to NET_RPL_MC_NONE.
*
* @param instance Pointer to RPL instance.
*/
extern int net_rpl_of_update_mc(struct net_rpl_instance *instance);
/**
* @brief RPL object function (OF) objective code point used.
*
* @details Check if we support desired objective function.
*
* @param ocp Objective Code Point value
*
* @return true if OF is supported, false otherwise.
*/
extern bool net_rpl_of_find(u16_t ocp);
/**
* @brief Return RPL object function (OF) objective code point used.
*
* @return OCP (Objective Code Point) value used.
*/
extern u16_t net_rpl_of_get(void);
/**
* @brief RPL instance structure
*
* Describe RPL instance.
*/
struct net_rpl_instance {
/** Routing metric information */
struct net_rpl_metric_container mc;
/** All the DAGs for this RPL instance */
struct net_rpl_dag dags[CONFIG_NET_RPL_MAX_DAG_PER_INSTANCE];
#if defined(CONFIG_NET_RPL_PROBING)
/** When next probe message will be sent. */
struct k_delayed_work probing_timer;
#endif /* CONFIG_NET_RPL_PROBING */
/** DODAG Information Object timer. */
struct k_delayed_work dio_timer;
/** Destination Advertisement Object timer. */
struct k_delayed_work dao_timer;
/** DAO lifetime timer. */
struct k_delayed_work dao_lifetime_timer;
/** Network interface to send DAO */
struct net_if *iface;
/** Current DAG in use */
struct net_rpl_dag *current_dag;
/** Current default router information */
struct net_if_router *default_route;
/** Amount of time for completion of dio interval */
u32_t dio_next_delay;
/** Objective Code Point (Used objective function) */
u16_t ocp;
/** MaxRankIncrease, RFC 6550, ch 6.7.6 */
u16_t max_rank_inc;
/** MinHopRankIncrease, RFC 6550, ch 6.7.6 */
u16_t min_hop_rank_inc;
/**
* Provides the unit in seconds that is used to express route
* lifetimes in RPL. For very stable networks, it can be hours
* to days. RFC 6550, ch 6.7.6
*/
u16_t lifetime_unit;
#if defined(CONFIG_NET_STATISTICS_RPL)
/** Number of DIO intervals for this RPL instance. */
u16_t dio_intervals;
/** Number of DIOs sent for this RPL instance. */
u16_t dio_send_pkt;
/** Number of DIOs received for this RPL instance. */
u16_t dio_recv_pkt;
#endif /* CONFIG_NET_STATISTICS_RPL */
/**
* This is the lifetime that is used as default for all RPL routes.
* It is expressed in units of Lifetime Units, e.g., the default
* lifetime in seconds is (Default Lifetime) * (Lifetime Unit)
* RFC 6550, ch 6.7.6
*/
u8_t default_lifetime;
/** Instance ID of this RPL instance */
u8_t instance_id;
/** Destination Advertisement Trigger Sequence Number */
u8_t dtsn;
/** Mode of operation */
u8_t mop;
/** DIOIntervalDoublings, RFC 6550, ch 6.7.6 */
u8_t dio_interval_doublings;
/** DIOIntervalMin, RFC 6550, ch 6.7.6 */
u8_t dio_interval_min;
/** Current DIO interval */
u8_t dio_interval_current;
/** DIORedundancyConstant, ch 6.7.6 */
u8_t dio_redundancy;
/** Current number of DIOs received (temp var) */
u8_t dio_counter;
/** Keep track of whether we can send DIOs or not (true if we can send)
*/
bool dio_send;
/** Is this RPL instance used or not */
bool is_used;
/** Is DAO timer active or not. */
bool dao_timer_active;
/** Is DAO lifetime timer active or not. */
bool dao_lifetime_timer_active;
#if defined(CONFIG_NET_RPL_DAO_ACK)
/** DAO number of retransmissions */
u8_t dao_transmissions;
/** DAO retransmit timer */
struct k_delayed_work dao_retransmit_timer;
#endif
};
/**
* @brief RPL DIO structure
*
* Describe RPL DAG Information Object.
*/
struct net_rpl_dio {
/** Routing metric information */
struct net_rpl_metric_container mc;
/** DAG id */
struct in6_addr dag_id;
/** IPv6 prefix information */
struct net_rpl_prefix prefix_info;
/** IPv6 destination prefix */
struct net_rpl_prefix destination_prefix;
/** Objective Code Point (OF being used) */
u16_t ocp;
/** Current rank */
u16_t rank;
/** MaxRankIncrease, RFC 6550, ch 6.7.6 */
u16_t max_rank_inc;
/** MinHopRankIncrease, RFC 6550, ch 6.7.6 */
u16_t min_hop_rank_inc;
/**
* Provides the unit in seconds that is used to express route
* lifetimes in RPL. For very stable networks, it can be hours
* to days. RFC 6550, ch 6.7.6
*/
u16_t lifetime_unit;
/**
* This is the lifetime that is used as default for all RPL routes.
* It is expressed in units of Lifetime Units, e.g., the default
* lifetime in seconds is (Default Lifetime) * (Lifetime Unit)
* RFC 6550, ch 6.7.6
*/
u8_t default_lifetime;
/** Instance ID of this RPL instance */
u8_t instance_id;
/** Destination Advertisement Trigger Sequence Number */
u8_t dtsn;
/** Mode of operation */
u8_t mop;
/** DAG interval doublings */
u8_t dag_interval_doublings;
/** DAG interval min */
u8_t dag_interval_min;
/** DAG interval */
u8_t dag_interval_current;
/** DAG redundancy constant */
u8_t dag_redundancy;
/** Is this DAG grounded or floating */
u8_t grounded;
/** DODAG preference */
u8_t preference;
/** DODAG version number */
u8_t version;
};
/**
* @brief RPL route information source
*/
enum net_rpl_route_source {
NET_RPL_ROUTE_INTERNAL,
NET_RPL_ROUTE_UNICAST_DAO,
NET_RPL_ROUTE_MULTICAST_DAO,
NET_RPL_ROUTE_DIO,
};
/**
* @brief RPL route entry
*
* Stores extra information for RPL route.
*/
struct net_rpl_route_entry {
/** Dag info for this route */
struct net_rpl_dag *dag;
/** Lifetime for this route entry (in seconds) */
u32_t lifetime;
/** Where this route came from */
enum net_rpl_route_source route_source;
/** No-Path target option with lifetime 0 received (true) or (false) */
bool no_path_received;
};
/**
* The extra data size is used in route.h to determine how much extra
* space to allocate for RPL specific data.
*/
#define NET_ROUTE_EXTRA_DATA_SIZE sizeof(struct net_rpl_route_entry)
/**
* @brief Check if the IPv6 address is a RPL multicast address.
*
* @param addr IPv6 address
*
* @return True if address is RPL multicast address, False otherwise.
*/
static inline bool net_rpl_is_ipv6_addr_mcast(const struct in6_addr *addr)
{
return UNALIGNED_GET(&addr->s6_addr32[0]) == htonl(0xff020000) &&
UNALIGNED_GET(&addr->s6_addr32[1]) == 0x00000000 &&
UNALIGNED_GET(&addr->s6_addr32[2]) == 0x00000000 &&
UNALIGNED_GET(&addr->s6_addr32[3]) == htonl(0x0000001a);
}
/**
* @brief Create RPL IPv6 multicast address FF02::1a
*
* @param addr IPv6 address.
*
* @return Pointer to given IPv6 address.
*/
static inline
struct in6_addr *net_rpl_create_mcast_address(struct in6_addr *addr)
{
addr->s6_addr[0] = 0xFF;
addr->s6_addr[1] = 0x02;
UNALIGNED_PUT(0, &addr->s6_addr16[1]);
UNALIGNED_PUT(0, &addr->s6_addr16[2]);
UNALIGNED_PUT(0, &addr->s6_addr16[3]);
UNALIGNED_PUT(0, &addr->s6_addr16[4]);
UNALIGNED_PUT(0, &addr->s6_addr16[5]);
UNALIGNED_PUT(0, &addr->s6_addr16[6]);
addr->s6_addr[14] = 0;
addr->s6_addr[15] = 0x1a;
return addr;
}
/**
* @brief Return information whether the DAG is in use right now.
*
* @param dag Pointer to DAG.
*
* @return true if in use, false otherwise
*/
static inline bool net_rpl_dag_is_used(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
return !!dag->is_used;
}
/**
* @brief Set the DAG as not in use.
*
* @param dag Pointer to DAG.
*/
static inline void net_rpl_dag_set_not_used(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
dag->is_used = 0;
}
/**
* @brief Set the DAG as in use.
*
* @param dag Pointer to DAG.
*/
static inline void net_rpl_dag_set_used(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
dag->is_used = 1;
}
/**
* @brief Return information whether the DAG is grounded or floating.
*
* @param dag Pointer to DAG.
*
* @return true if grounded, false if floating
*/
static inline bool net_rpl_dag_is_grounded(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
return !!dag->is_grounded;
}
/**
* @brief Set DAG information whether it is grounded or floating.
*
* @param dag Pointer to DAG.
*/
static inline void net_rpl_dag_set_grounded_status(struct net_rpl_dag *dag,
bool grounded)
{
NET_ASSERT(dag);
dag->is_grounded = grounded;
}
/**
* @brief Return information whether the DAG is joined or not.
*
* @param dag Pointer to DAG.
*
* @return true if joined, false otherwise
*/
static inline bool net_rpl_dag_is_joined(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
return !!dag->is_joined;
}
/**
* @brief Mark DAG as joined.
*
* @param dag Pointer to DAG.
*/
static inline void net_rpl_dag_join(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
dag->is_joined = 1;
}
/**
* @brief Mark DAG as joined.
*
* @param dag Pointer to DAG.
*/
static inline void net_rpl_dag_unjoin(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
dag->is_joined = 0;
}
/**
* @brief Get preference for this DAG.
*
* @details This function returns the preference of the dag.
*
* @param dag Pointer to DAG.
*
* @return preference value
*/
static inline
u8_t net_rpl_dag_get_preference(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
return dag->preference;
}
/**
* @brief Set preference for this DAG.
*
* @details This function sets the preference of the dag.
*
* @param dag Pointer to DAG.
* @param preference New preference value.
*/
static inline
void net_rpl_dag_set_preference(struct net_rpl_dag *dag,
u8_t preference)
{
NET_ASSERT(dag && preference <= 8);
dag->preference = preference;
}
/**
* @typedef net_rpl_join_callback_t
* @brief Callback for evaluating if this is a network to join or not.
* @param dio Pointer to DIO.
* @return True if the network is to be joined, false otherwise.
*/
typedef bool (*net_rpl_join_callback_t)(struct net_rpl_dio *dio);
/**
* @brief Register a callback that determines if the network is to be
* joined or not.
*
* @param cb Callback function
*/
void net_rpl_set_join_callback(net_rpl_join_callback_t cb);
/**
* @brief Send a DODAG Information Solicitation message.
*
* @param dst Destination IPv6 address.
* @param iface Interface to send the message to.
*
* @return 0 message was sent ok, <0 otherwise
*/
int net_rpl_dis_send(struct in6_addr *dst, struct net_if *iface);
/**
* @brief Send a Destination Advertisement Object message.
*
* @param iface Network interface to use, this can be set to NULL in which
* case the function can try to figure it out itself.
* @param parent Pointer to parent information.
* @param prefix IPv6 address
* @param lifetime Lifetime of the advertisement.
*
* @return 0 message was sent ok, <0 otherwise
*/
int net_rpl_dao_send(struct net_if *iface,
struct net_rpl_parent *parent,
struct in6_addr *prefix,
u8_t lifetime);
/**
* @brief Send a DODAG Information Object message.
*
* @param iface Network interface to use, this can be set to NULL in which
* case the function can try to figure it out itself.
* @param instance Pointer to instance object.
* @param src IPv6 source address.
* @param dst IPv6 destination address.
*
* @return 0 message was sent ok, <0 otherwise
*/
int net_rpl_dio_send(struct net_if *iface,
struct net_rpl_instance *instance,
struct in6_addr *src,
struct in6_addr *dst);
/**
* @brief Set the root DAG.
*
* @param iface Network interface to use.
* @param instance Pointer to instance object.
* @param dag_id IPv6 address of the DAG.
*
* @return DAG object or NULL if creation failed.
*/
struct net_rpl_dag *net_rpl_set_root(struct net_if *iface,
u8_t instance_id,
struct in6_addr *dag_id);
/**
* @brief Set the root DAG with version.
*
* @param iface Network interface to use.
* @param instance Pointer to instance object.
* @param dag_id IPv6 address of the DAG.
* @param version Version number to use.
*
* @return DAG object or NULL if creation failed.
*/
struct net_rpl_dag *net_rpl_set_root_with_version(struct net_if *iface,
u8_t instance_id,
struct in6_addr *dag_id,
u8_t version);
/**
* @brief Get first available DAG.
*
* @return First available DAG or NULL if none found.
*/
struct net_rpl_dag *net_rpl_get_any_dag(void);
/**
* @brief Set IPv6 prefix we are using.
*
* @param iface Network interface in use.
* @param dag DAG in use.
* @param prefix IPv6 prefix we are using.
* @param prefix_len IPv6 prefix length.
*
* @return True if prefix could be set, false otherwise.
*/
bool net_rpl_set_prefix(struct net_if *iface,
struct net_rpl_dag *dag,
struct in6_addr *prefix,
u8_t prefix_len);
/**
* @brief Do global repair for this route.
*
* @param route IPv6 route entry.
*/
void net_rpl_global_repair(struct net_route_entry *route);
/**
* @brief Do global repair for this instance.
*
* @param instance RPL instance id.
*/
bool net_rpl_repair_root(u8_t instance_id);
/**
* @brief Get the default RPL interface.
*
*/
struct net_if *net_rpl_get_interface(void);
/**
* @brief Update RPL headers in IPv6 packet.
*
* @param pkt Network packet.
* @param addr IPv6 address of next hop host.
*
* @return 0 if ok, < 0 if error
*/
int net_rpl_update_header(struct net_pkt *pkt, struct in6_addr *addr);
/**
* @brief Verify RPL header in IPv6 packet.
*
* @param pkt Network packet fragment list.
* @param frag Current network buffer fragment.
* @param offset Where the RPL header starts in the packet
* @param pos How long the RPL header was, this is returned to the caller.
* @param out result True if ok, false if error
*
* @return frag Returns the fragment where this call finished reading.
*/
struct net_buf *net_rpl_verify_header(struct net_pkt *pkt, struct net_buf *frag,
u16_t offset, u16_t *pos,
bool *result);
/**
* @brief Insert RPL extension header to IPv6 packet.
*
* @param pkt Network packet.
*
* @return 0 if ok, <0 if error.
*/
int net_rpl_insert_header(struct net_pkt *pkt);
/**
* @brief Revert RPL extension header to IPv6 packet.
* Revert flags, instance ID and sender rank in the packet.
*
* @param pkt Network packet.
* @param offset Where the HBH header starts in the packet
* @param pos How long the RPL header was, this is returned to the caller.
*
* @return 0 if ok, <0 if error.
*/
int net_rpl_revert_header(struct net_pkt *pkt, u16_t offset, u16_t *pos);
/**
* @brief Get parent IPv6 address.
*
* @param iface Network interface
* @param parent Parent pointer
*
* @return Parent IPv6 address, or NULL if no such parent.
*/
struct in6_addr *net_rpl_get_parent_addr(struct net_if *iface,
struct net_rpl_parent *parent);
typedef void (*net_rpl_parent_cb_t)(struct net_rpl_parent *parent,
void *user_data);
/**
* @brief Go through all the parents entries and call callback
* for each entry that is in use.
*
* @param cb User supplied callback function to call.
* @param user_data User specified data.
*
* @return Total number of parents found.
*/
int net_rpl_foreach_parent(net_rpl_parent_cb_t cb, void *user_data);
/**
* @brief Set the RPL mode (mesh or leaf) of this node.
*
* @param new_mode New RPL mode. Value is either NET_RPL_MODE_MESH,
* NET_RPL_MODE_FEATHER or NET_RPL_MODE_LEAF. The NET_RPL_MODE_MESH is
* the default mode.
*/
void net_rpl_set_mode(enum net_rpl_mode new_mode);
/**
* @brief Get the RPL mode (mesh or leaf) of this node.
*
* @return Current RPL mode.
*/
enum net_rpl_mode net_rpl_get_mode(void);
/**
* @brief Get the default RPL instance.
*
* @return Current default RPL instance.
*/
struct net_rpl_instance *net_rpl_get_default_instance(void);
void net_rpl_init(void);
#else
#define net_rpl_init(...)
#define net_rpl_global_repair(...)
#define net_rpl_update_header(...) 0
static inline struct net_if *net_rpl_get_interface(void)
{
return NULL;
}
#endif /* CONFIG_NET_RPL */
#ifdef __cplusplus
}
#endif
#endif /* __RPL_H */
| {
"content_hash": "2ab51d3f63937cfc107df0df189be544",
"timestamp": "",
"source": "github",
"line_count": 1056,
"max_line_length": 80,
"avg_line_length": 24.676136363636363,
"alnum_prop": 0.6720392969529511,
"repo_name": "kraj/zephyr",
"id": "ef6f6dbd08e0d0196974a0834f407c94e9d88940",
"size": "26058",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "subsys/net/ip/rpl.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "1195132"
},
{
"name": "Batchfile",
"bytes": "209"
},
{
"name": "C",
"bytes": "300593976"
},
{
"name": "C++",
"bytes": "3020664"
},
{
"name": "CMake",
"bytes": "441343"
},
{
"name": "EmberScript",
"bytes": "796"
},
{
"name": "Makefile",
"bytes": "3113"
},
{
"name": "Objective-C",
"bytes": "33545"
},
{
"name": "Perl",
"bytes": "202119"
},
{
"name": "Python",
"bytes": "815624"
},
{
"name": "Shell",
"bytes": "22752"
},
{
"name": "Verilog",
"bytes": "6394"
}
],
"symlink_target": ""
} |
set -e
rootdir=/data
datadir=/data/redis
confdir=/data/conf
# after release 0.9.5, sys.conf is not created any more.
syscfgfile=$confdir/sys.conf
servicecfgfile=$confdir/service.conf
membercfgfile=$confdir/member.conf
rediscfgfile=$confdir/redis.conf
REDIS_USER=redis
redisetcdir=/etc/redis
# sanity check to make sure the volume is mounted to /data.
if [ ! -d "$rootdir" ]; then
echo "error: $rootdir not exist. Please make sure the volume is mounted to $rootdir." >&2
exit 1
fi
if [ ! -d "$datadir" ]; then
mkdir "$datadir"
fi
if [ ! -d "$confdir" ]; then
echo "error: $confdir not exist." >&2
exit 1
fi
if [ ! -d "$redisetcdir" ]; then
mkdir "$redisetcdir"
fi
# allow the container to be started with `--user`
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
# copy redis.conf to /etc/redis
cp $rediscfgfile $redisetcdir
chown -R $REDIS_USER $redisetcdir
rootdiruser=$(stat -c "%U" $rootdir)
if [ "$rootdiruser" != "$REDIS_USER" ]; then
echo "chown -R $REDIS_USER $rootdir"
chown -R "$REDIS_USER" "$rootdir"
fi
diruser=$(stat -c "%U" $datadir)
if [ "$diruser" != "$REDIS_USER" ]; then
chown -R "$REDIS_USER" "$datadir"
fi
chown -R "$REDIS_USER" "$confdir"
exec gosu "$REDIS_USER" "$BASH_SOURCE" "$@"
fi
if [ -f $servicecfgfile ]; then
# after release 0.9.5
# load service, member and staticip configs
. $servicecfgfile
. $membercfgfile
# update redis.conf
sed -i 's/bind 0.0.0.0/bind '$BIND_IP'/g' $redisetcdir/redis.conf
maxMem=`expr $MEMORY_CACHE_MB \* 1024 \* 1024`
sed -i 's/maxmemory 268435456/maxmemory '$maxMem'/g' $redisetcdir/redis.conf
sed -i 's/maxmemory-policy allkeys-lru/maxmemory-policy '$MAX_MEMORY_POLICY'/g' $redisetcdir/redis.conf
if [ $REPL_TIMEOUT_SECS -gt 0 ]; then
sed -i 's/repl-timeout 60/repl-timeout '$REPL_TIMEOUT_SECS'/g' $redisetcdir/redis.conf
fi
sed -i 's/rename-command CONFIG \"\"/rename-command CONFIG \"'$CONFIG_CMD_NAME'\"/g' $redisetcdir/redis.conf
if [ "$ENABLE_AUTH" = "true" -a -n "$AUTH_PASS" ]; then
# enable auth
echo "requirepass $AUTH_PASS" >> $redisetcdir/redis.conf
echo "masterauth $AUTH_PASS" >> $redisetcdir/redis.conf
fi
if [ "$DISABLE_AOF" = "false" ]; then
# enable AOF
echo "appendonly yes" >> $redisetcdir/redis.conf
fi
if [ $SHARDS -eq 2 ]; then
echo "the number of shards could not be 2" >&2
exit 1
fi
if [ $SHARDS -eq 1 ]; then
# master-slave mode or single instance
if [ $REPLICAS_PERSHARD -gt 1 -a $MEMBER_INDEX_INSHARD -gt 0 ]; then
# master-slave mode, set the master dnsname for the slave
echo "slaveof $MASTER_MEMBER 6379" >> $redisetcdir/redis.conf
fi
else
# cluster mode
echo "cluster-enabled yes" >> $redisetcdir/redis.conf
echo "cluster-config-file /data/redis-node.conf" >> $redisetcdir/redis.conf
echo "cluster-announce-ip $MEMBER_STATIC_IP" >> $redisetcdir/redis.conf
echo "cluster-node-timeout 15000" >> $redisetcdir/redis.conf
echo "cluster-slave-validity-factor 10" >> $redisetcdir/redis.conf
echo "cluster-migration-barrier 1" >> $redisetcdir/redis.conf
echo "cluster-require-full-coverage yes" >> $redisetcdir/redis.conf
fi
else
# load the sys config file
. $syscfgfile
fi
echo $SERVICE_MEMBER
echo "$@"
exec "$@"
| {
"content_hash": "6ffc6a0a2486267a53060a6a1784cc19",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 110,
"avg_line_length": 29.455357142857142,
"alnum_prop": 0.6644437708396483,
"repo_name": "cloudstax/openmanage",
"id": "6aef088cee6a94984b684266985140e1d8fa0c27",
"size": "3311",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "catalog/redis/4.0/dockerfile/docker-entrypoint.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "882164"
},
{
"name": "Makefile",
"bytes": "829"
},
{
"name": "Protocol Buffer",
"bytes": "4235"
},
{
"name": "Ruby",
"bytes": "60843"
},
{
"name": "Shell",
"bytes": "39677"
}
],
"symlink_target": ""
} |
<configuration scan="info" scanPeriod="60 seconds" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss:SSSS} | %level | %-4thread | %-21logger | %m%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
<logger name="krasa" level="debug"/>
<logger name="org.springframework" level="info"/>
<logger name="org.apache.http" level="debug"/>
<logger name="org.mortbay.jetty" level="warn"/>
<logger name="org.mortbay.jetty.log" level="warn"/>
<logger name="org.mortbay.log" level="info"/>
<logger name="org.apache.cxf" level="info"/>
</configuration> | {
"content_hash": "11c7e8747e2fc07af3608abd3c24d4ab",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 70,
"avg_line_length": 25.96153846153846,
"alnum_prop": 0.6681481481481482,
"repo_name": "krasa/Laboratory",
"id": "75e80a6372265cf865703b7b36276086a26ae145",
"size": "675",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/src/main/resources/logback.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "53556"
},
{
"name": "HTML",
"bytes": "2498"
},
{
"name": "Java",
"bytes": "135871"
}
],
"symlink_target": ""
} |
<<<<<<< HEAD
<header>Maks. obci±¿enie systemu przy odbieraniu</header>
Okre¶la warto¶æ progow± ¶redniego obci±¿enia systemu, po przekroczeniu
której sendmail przestanie przyjmowaæ wiadomo¶ci przychodz±ce przez SMTP,
zmuszaj±c inne serwery pocztowe do kolejkowania ich w celu dorêczenia
pó¼niej. Ta opcja ma na celu zapobie¿enie przed przeci±¿eniem twojego
systemu przez du¿y ruch pocztowy.
=======
<header>Maks. obciążenie systemu przy odbieraniu</header>
Określa wartość progową średniego obciążenia systemu, po przekroczeniu
której sendmail przestanie przyjmować wiadomości przychodzące przez SMTP,
zmuszając inne serwery pocztowe do kolejkowania ich w celu doręczenia
później. Ta opcja ma na celu zapobieżenie przed przeciążeniem twojego
systemu przez duży ruch pocztowy.
>>>>>>> upstream/master
<hr>
| {
"content_hash": "4bec38f341c2de248cbbe8e69dfebcc2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 45.333333333333336,
"alnum_prop": 0.8026960784313726,
"repo_name": "nawawi/webmin",
"id": "661eaee5f9ce54acda8d161c14d32e840b73431d",
"size": "858",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sendmail/help/opt_RefuseLA.pl.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "3160"
},
{
"name": "C",
"bytes": "15136"
},
{
"name": "C#",
"bytes": "15069"
},
{
"name": "CSS",
"bytes": "110895"
},
{
"name": "Emacs Lisp",
"bytes": "17723"
},
{
"name": "Erlang",
"bytes": "41"
},
{
"name": "HTML",
"bytes": "27269076"
},
{
"name": "Java",
"bytes": "257445"
},
{
"name": "JavaScript",
"bytes": "373859"
},
{
"name": "MAXScript",
"bytes": "29130"
},
{
"name": "Makefile",
"bytes": "22074"
},
{
"name": "NewLisp",
"bytes": "82942"
},
{
"name": "PHP",
"bytes": "18899"
},
{
"name": "Perl",
"bytes": "11057755"
},
{
"name": "Prolog",
"bytes": "69637"
},
{
"name": "Python",
"bytes": "76600"
},
{
"name": "Raku",
"bytes": "1067573"
},
{
"name": "Roff",
"bytes": "30578"
},
{
"name": "Ruby",
"bytes": "56964"
},
{
"name": "Shell",
"bytes": "53390"
},
{
"name": "Smalltalk",
"bytes": "40772"
},
{
"name": "SystemVerilog",
"bytes": "23230"
}
],
"symlink_target": ""
} |
.textLayer {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
opacity: 0.2;
line-height: 1.0;
}
.textLayer > div {
color: transparent;
position: absolute;
white-space: pre;
cursor: text;
-webkit-transform-origin: 0% 0%;
-moz-transform-origin: 0% 0%;
-o-transform-origin: 0% 0%;
-ms-transform-origin: 0% 0%;
transform-origin: 0% 0%;
}
.textLayer .highlight {
margin: -1px;
padding: 1px;
background-color: rgb(180, 0, 170);
border-radius: 4px;
}
.textLayer .highlight.begin {
border-radius: 4px 0px 0px 4px;
}
.textLayer .highlight.end {
border-radius: 0px 4px 4px 0px;
}
.textLayer .highlight.middle {
border-radius: 0px;
}
.textLayer .highlight.selected {
background-color: rgb(0, 100, 0);
}
.textLayer ::selection { background: rgb(0,0,255); }
.textLayer ::-moz-selection { background: rgb(0,0,255); }
.textLayer .endOfContent {
display: block;
position: absolute;
left: 0px;
top: 100%;
right: 0px;
bottom: 0px;
z-index: -1;
cursor: default;
-webkit-user-select: none;
-ms-user-select: none;
-moz-user-select: none;
}
.textLayer .endOfContent.active {
top: 0px;
}
.annotationLayer section {
position: absolute;
}
.annotationLayer .annotLink > a:hover {
opacity: 0.2;
background: #ff0;
box-shadow: 0px 2px 10px #ff0;
}
.annotationLayer .annotText > img {
position: absolute;
cursor: pointer;
}
.annotationLayer .annotTextContentWrapper {
position: absolute;
width: 20em;
}
.annotationLayer .annotTextContent {
z-index: 200;
float: left;
max-width: 20em;
background-color: #FFFF99;
box-shadow: 0px 2px 5px #333;
border-radius: 2px;
padding: 0.6em;
cursor: pointer;
}
.annotationLayer .annotTextContent > h1 {
font-size: 1em;
border-bottom: 1px solid #000000;
padding-bottom: 0.2em;
}
.annotationLayer .annotTextContent > p {
padding-top: 0.2em;
}
.annotationLayer .annotLink > a {
position: absolute;
font-size: 1em;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.annotationLayer .annotLink > a /* -ms-a */ {
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 repeat;
}
.pdfViewer .canvasWrapper {
overflow: hidden;
}
.pdfViewer .page {
direction: ltr;
width: 816px;
height: 1056px;
margin: 1px auto -8px auto;
position: relative;
overflow: visible;
border: 9px solid transparent;
background-clip: content-box;
border-image: url(../images/shadow.png) 9 9 repeat;
background-color: white;
}
.pdfViewer.removePageBorders .page {
margin: 0px auto 10px auto;
border: none;
}
.pdfViewer .page canvas {
margin: 0;
display: block;
}
.pdfViewer .page .loadingIcon {
position: absolute;
display: block;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: url('images/loading-icon.gif') center no-repeat;
}
.pdfPresentationMode:-webkit-full-screen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}
.pdfPresentationMode:-moz-full-screen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}
.pdfPresentationMode:-ms-fullscreen .pdfViewer .page {
margin-bottom: 100% !important;
border: 0;
}
.pdfPresentationMode:fullscreen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}
* {
padding: 0;
margin: 0;
}
/*html {*/
/*height: 100%;*/
/*/!* Font size is needed to make the activity bar the correct size. *!/*/
/*font-size: 10px;*/
/*}*/
/*body {*/
/*height: 100%;*/
/*background-color: #404040;*/
/*background-image: url(../images/texture.png);*/
/*}*/
/*body,*/
/*input,*/
/*button,*/
/*select {*/
/*font: message-box;*/
/*outline: none;*/
/*}*/
.hidden {
display: none !important;
}
[hidden] {
display: none !important;
}
#viewerContainer.pdfPresentationMode:-webkit-full-screen {
top: 0px;
border-top: 2px solid transparent;
background-color: #000;
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-webkit-user-select: none;
}
#viewerContainer.pdfPresentationMode:-moz-full-screen {
top: 0px;
border-top: 2px solid transparent;
background-color: #000;
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-moz-user-select: none;
}
#viewerContainer.pdfPresentationMode:-ms-fullscreen {
top: 0px !important;
border-top: 2px solid transparent;
width: 100%;
height: 100%;
overflow: hidden !important;
cursor: none;
-ms-user-select: none;
}
#viewerContainer.pdfPresentationMode:-ms-fullscreen::-ms-backdrop {
background-color: #000;
}
#viewerContainer.pdfPresentationMode:fullscreen {
top: 0px;
border-top: 2px solid transparent;
background-color: #000;
width: 100%;
height: 100%;
overflow: hidden;
cursor: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.pdfPresentationMode:-webkit-full-screen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:-moz-full-screen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:-ms-fullscreen a:not(.internalLink) {
display: none !important;
}
.pdfPresentationMode:fullscreen a:not(.internalLink) {
display: none;
}
.pdfPresentationMode:-webkit-full-screen .textLayer > div {
cursor: none;
}
.pdfPresentationMode:-moz-full-screen .textLayer > div {
cursor: none;
}
.pdfPresentationMode:-ms-fullscreen .textLayer > div {
cursor: none;
}
.pdfPresentationMode:fullscreen .textLayer > div {
cursor: none;
}
.pdfPresentationMode.pdfPresentationModeControls > *,
.pdfPresentationMode.pdfPresentationModeControls .textLayer > div {
cursor: default;
}
/* outer/inner center provides horizontal center */
.outerCenter {
pointer-events: none;
position: relative;
}
html[dir='ltr'] .outerCenter {
float: right;
right: 50%;
}
html[dir='rtl'] .outerCenter {
float: left;
left: 50%;
}
.innerCenter {
pointer-events: auto;
position: relative;
}
html[dir='ltr'] .innerCenter {
float: right;
right: -50%;
}
html[dir='rtl'] .innerCenter {
float: left;
left: -50%;
}
#outerContainer {
width: 100%;
height: 100%;
position: relative;
}
#sidebarContainer {
position: absolute;
top: 0;
bottom: 0;
width: 200px;
visibility: hidden;
-webkit-transition-duration: 200ms;
-webkit-transition-timing-function: ease;
transition-duration: 200ms;
transition-timing-function: ease;
}
html[dir='ltr'] #sidebarContainer {
-webkit-transition-property: left;
transition-property: left;
left: -200px;
}
html[dir='rtl'] #sidebarContainer {
-webkit-transition-property: right;
transition-property: right;
right: -200px;
}
#outerContainer.sidebarMoving > #sidebarContainer,
#outerContainer.sidebarOpen > #sidebarContainer {
visibility: visible;
}
html[dir='ltr'] #outerContainer.sidebarOpen > #sidebarContainer {
left: 0px;
}
html[dir='rtl'] #outerContainer.sidebarOpen > #sidebarContainer {
right: 0px;
}
#mainContainer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
min-width: 320px;
-webkit-transition-duration: 200ms;
-webkit-transition-timing-function: ease;
transition-duration: 200ms;
transition-timing-function: ease;
}
html[dir='ltr'] #outerContainer.sidebarOpen > #mainContainer {
-webkit-transition-property: left;
transition-property: left;
left: 200px;
}
html[dir='rtl'] #outerContainer.sidebarOpen > #mainContainer {
-webkit-transition-property: right;
transition-property: right;
right: 200px;
}
#sidebarContent {
top: 32px;
bottom: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
width: 200px;
background-color: hsla(0,0%,0%,.1);
}
html[dir='ltr'] #sidebarContent {
left: 0;
box-shadow: inset -1px 0 0 hsla(0,0%,0%,.25);
}
html[dir='rtl'] #sidebarContent {
right: 0;
box-shadow: inset 1px 0 0 hsla(0,0%,0%,.25);
}
#viewerContainer {
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
top: 32px;
right: 0;
bottom: 0;
left: 0;
outline: none;
}
html[dir='ltr'] #viewerContainer {
box-shadow: inset 1px 0 0 hsla(0,0%,100%,.05);
}
html[dir='rtl'] #viewerContainer {
box-shadow: inset -1px 0 0 hsla(0,0%,100%,.05);
}
.toolbar {
position: relative;
left: 0;
right: 0;
z-index: 9999;
cursor: default;
}
#toolbarContainer {
width: 100%;
}
#toolbarSidebar {
width: 200px;
height: 32px;
background-color: #424242; /* fallback */
background-image: url(../images/texture.png),
linear-gradient(hsla(0,0%,30%,.99), hsla(0,0%,25%,.95));
}
html[dir='ltr'] #toolbarSidebar {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25),
inset 0 -1px 0 hsla(0,0%,100%,.05),
0 1px 0 hsla(0,0%,0%,.15),
0 0 1px hsla(0,0%,0%,.1);
}
html[dir='rtl'] #toolbarSidebar {
box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25),
inset 0 1px 0 hsla(0,0%,100%,.05),
0 1px 0 hsla(0,0%,0%,.15),
0 0 1px hsla(0,0%,0%,.1);
}
#toolbarContainer, .findbar, .secondaryToolbar {
position: relative;
height: 32px;
background-color: #474747; /* fallback */
background-image: url(../images/texture.png),
linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
}
html[dir='ltr'] #toolbarContainer, .findbar, .secondaryToolbar {
box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08),
inset 0 1px 1px hsla(0,0%,0%,.15),
inset 0 -1px 0 hsla(0,0%,100%,.05),
0 1px 0 hsla(0,0%,0%,.15),
0 1px 1px hsla(0,0%,0%,.1);
}
html[dir='rtl'] #toolbarContainer, .findbar, .secondaryToolbar {
box-shadow: inset -1px 0 0 hsla(0,0%,100%,.08),
inset 0 1px 1px hsla(0,0%,0%,.15),
inset 0 -1px 0 hsla(0,0%,100%,.05),
0 1px 0 hsla(0,0%,0%,.15),
0 1px 1px hsla(0,0%,0%,.1);
}
#toolbarViewer {
height: 32px;
}
#loadingBar {
position: relative;
width: 100%;
height: 4px;
background-color: #333;
border-bottom: 1px solid #333;
}
#loadingBar .progress {
position: absolute;
top: 0;
left: 0;
width: 0%;
height: 100%;
background-color: #ddd;
overflow: hidden;
-webkit-transition: width 200ms;
transition: width 200ms;
}
@-webkit-keyframes progressIndeterminate {
0% { left: -142px; }
100% { left: 0; }
}
@keyframes progressIndeterminate {
0% { left: -142px; }
100% { left: 0; }
}
#loadingBar .progress.indeterminate {
background-color: #999;
-webkit-transition: none;
transition: none;
}
#loadingBar .progress.indeterminate .glimmer {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: calc(100% + 150px);
background: repeating-linear-gradient(135deg,
#bbb 0, #999 5px,
#999 45px, #ddd 55px,
#ddd 95px, #bbb 100px);
-webkit-animation: progressIndeterminate 950ms linear infinite;
animation: progressIndeterminate 950ms linear infinite;
}
.findbar, .secondaryToolbar {
top: 32px;
position: absolute;
z-index: 10000;
height: 32px;
min-width: 16px;
padding: 0px 6px 0px 6px;
margin: 4px 2px 4px 2px;
color: hsl(0,0%,85%);
font-size: 12px;
line-height: 14px;
text-align: left;
cursor: default;
}
html[dir='ltr'] .findbar {
left: 0;
}
html[dir='rtl'] .findbar {
right: 68px;
}
.findbar label {
-webkit-user-select: none;
-moz-user-select: none;
}
#findInput[data-status="pending"] {
background-image: url(../images/loading-small.png);
background-repeat: no-repeat;
background-position: right;
}
html[dir='rtl'] #findInput[data-status="pending"] {
background-position: left;
}
.secondaryToolbar {
padding: 6px;
height: auto;
z-index: 30000;
}
html[dir='ltr'] .secondaryToolbar {
right: 4px;
}
html[dir='rtl'] .secondaryToolbar {
left: 4px;
}
#secondaryToolbarButtonContainer {
max-width: 200px;
max-height: 400px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
margin-bottom: -4px;
}
.doorHanger,
.doorHangerRight {
border: 1px solid hsla(0,0%,0%,.5);
border-radius: 2px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.doorHanger:after, .doorHanger:before,
.doorHangerRight:after, .doorHangerRight:before {
bottom: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.doorHanger:after,
.doorHangerRight:after {
border-bottom-color: hsla(0,0%,32%,.99);
border-width: 8px;
}
.doorHanger:before,
.doorHangerRight:before {
border-bottom-color: hsla(0,0%,0%,.5);
border-width: 9px;
}
html[dir='ltr'] .doorHanger:after,
html[dir='rtl'] .doorHangerRight:after {
left: 13px;
margin-left: -8px;
}
html[dir='ltr'] .doorHanger:before,
html[dir='rtl'] .doorHangerRight:before {
left: 13px;
margin-left: -9px;
}
html[dir='rtl'] .doorHanger:after,
html[dir='ltr'] .doorHangerRight:after {
right: 13px;
margin-right: -8px;
}
html[dir='rtl'] .doorHanger:before,
html[dir='ltr'] .doorHangerRight:before {
right: 13px;
margin-right: -9px;
}
#findResultsCount {
background-color: hsl(0, 0%, 85%);
color: hsl(0, 0%, 32%);
text-align: center;
padding: 3px 4px;
}
#findMsg {
font-style: italic;
color: #A6B7D0;
}
#findInput.notFound {
background-color: rgb(255, 102, 102);
}
html[dir='ltr'] #toolbarViewerLeft {
margin-left: -1px;
}
html[dir='rtl'] #toolbarViewerRight {
margin-right: -1px;
}
html[dir='ltr'] #toolbarViewerLeft,
html[dir='rtl'] #toolbarViewerRight {
position: absolute;
top: 0;
left: 0;
}
html[dir='ltr'] #toolbarViewerRight,
html[dir='rtl'] #toolbarViewerLeft {
position: absolute;
top: 0;
right: 0;
}
html[dir='ltr'] #toolbarViewerLeft > *,
html[dir='ltr'] #toolbarViewerMiddle > *,
html[dir='ltr'] #toolbarViewerRight > *,
html[dir='ltr'] .findbar > * {
position: relative;
float: left;
}
html[dir='rtl'] #toolbarViewerLeft > *,
html[dir='rtl'] #toolbarViewerMiddle > *,
html[dir='rtl'] #toolbarViewerRight > *,
html[dir='rtl'] .findbar > * {
position: relative;
float: right;
}
html[dir='ltr'] .splitToolbarButton {
margin: 3px 2px 4px 0;
display: inline-block;
}
html[dir='rtl'] .splitToolbarButton {
margin: 3px 0 4px 2px;
display: inline-block;
}
html[dir='ltr'] .splitToolbarButton > .toolbarButton {
border-radius: 0;
float: left;
}
html[dir='rtl'] .splitToolbarButton > .toolbarButton {
border-radius: 0;
float: right;
}
.toolbarButton,
.secondaryToolbarButton,
.overlayButton {
border: 0 none;
background: none;
width: 32px;
height: 25px;
}
.toolbarButton > span {
display: inline-block;
width: 0;
height: 0;
overflow: hidden;
}
.toolbarButton[disabled],
.secondaryToolbarButton[disabled],
.overlayButton[disabled] {
opacity: .5;
}
.toolbarButton.group {
margin-right: 0;
}
.splitToolbarButton.toggled .toolbarButton {
margin: 0;
}
.splitToolbarButton:hover > .toolbarButton,
.splitToolbarButton:focus > .toolbarButton,
.splitToolbarButton.toggled > .toolbarButton,
.toolbarButton.textButton {
background-color: hsla(0,0%,0%,.12);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
border: 1px solid hsla(0,0%,0%,.35);
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.15) inset,
0 1px 0 hsla(0,0%,100%,.05);
-webkit-transition-property: background-color, border-color, box-shadow;
-webkit-transition-duration: 150ms;
-webkit-transition-timing-function: ease;
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
transition-timing-function: ease;
}
.splitToolbarButton > .toolbarButton:hover,
.splitToolbarButton > .toolbarButton:focus,
.dropdownToolbarButton:hover,
.overlayButton:hover,
.overlayButton:focus,
.toolbarButton.textButton:hover,
.toolbarButton.textButton:focus {
background-color: hsla(0,0%,0%,.2);
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.15) inset,
0 0 1px hsla(0,0%,0%,.05);
z-index: 199;
}
.splitToolbarButton > .toolbarButton {
position: relative;
}
html[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child,
html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child {
position: relative;
margin: 0;
margin-right: -1px;
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
border-right-color: transparent;
}
html[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child,
html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child {
position: relative;
margin: 0;
margin-left: -1px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
border-left-color: transparent;
}
.splitToolbarButtonSeparator {
padding: 8px 0;
width: 1px;
background-color: hsla(0,0%,0%,.5);
z-index: 99;
box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
display: inline-block;
margin: 5px 0;
}
html[dir='ltr'] .splitToolbarButtonSeparator {
float: left;
}
html[dir='rtl'] .splitToolbarButtonSeparator {
float: right;
}
.splitToolbarButton:hover > .splitToolbarButtonSeparator,
.splitToolbarButton.toggled > .splitToolbarButtonSeparator {
padding: 12px 0;
margin: 1px 0;
box-shadow: 0 0 0 1px hsla(0,0%,100%,.03);
-webkit-transition-property: padding;
-webkit-transition-duration: 10ms;
-webkit-transition-timing-function: ease;
transition-property: padding;
transition-duration: 10ms;
transition-timing-function: ease;
}
.toolbarButton,
.dropdownToolbarButton,
.secondaryToolbarButton,
.overlayButton {
min-width: 16px;
padding: 2px 6px 0;
border: 1px solid transparent;
border-radius: 2px;
color: hsla(0,0%,100%,.8);
font-size: 12px;
line-height: 14px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
/* Opera does not support user-select, use <... unselectable="on"> instead */
cursor: default;
-webkit-transition-property: background-color, border-color, box-shadow;
-webkit-transition-duration: 150ms;
-webkit-transition-timing-function: ease;
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
transition-timing-function: ease;
}
html[dir='ltr'] .toolbarButton,
html[dir='ltr'] .overlayButton,
html[dir='ltr'] .dropdownToolbarButton {
margin: 3px 2px 4px 0;
}
html[dir='rtl'] .toolbarButton,
html[dir='rtl'] .overlayButton,
html[dir='rtl'] .dropdownToolbarButton {
margin: 3px 0 4px 2px;
}
.toolbarButton:hover,
.toolbarButton:focus,
.dropdownToolbarButton,
.overlayButton,
.secondaryToolbarButton:hover,
.secondaryToolbarButton:focus {
background-color: hsla(0,0%,0%,.12);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
border: 1px solid hsla(0,0%,0%,.35);
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.15) inset,
0 1px 0 hsla(0,0%,100%,.05);
}
.toolbarButton:hover:active,
.overlayButton:hover:active,
.dropdownToolbarButton:hover:active,
.secondaryToolbarButton:hover:active {
background-color: hsla(0,0%,0%,.2);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
border-color: hsla(0,0%,0%,.35) hsla(0,0%,0%,.4) hsla(0,0%,0%,.45);
box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset,
0 0 1px hsla(0,0%,0%,.2) inset,
0 1px 0 hsla(0,0%,100%,.05);
-webkit-transition-property: background-color, border-color, box-shadow;
-webkit-transition-duration: 10ms;
-webkit-transition-timing-function: linear;
transition-property: background-color, border-color, box-shadow;
transition-duration: 10ms;
transition-timing-function: linear;
}
.toolbarButton.toggled,
.splitToolbarButton.toggled > .toolbarButton.toggled,
.secondaryToolbarButton.toggled {
background-color: hsla(0,0%,0%,.3);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.45) hsla(0,0%,0%,.5);
box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset,
0 0 1px hsla(0,0%,0%,.2) inset,
0 1px 0 hsla(0,0%,100%,.05);
-webkit-transition-property: background-color, border-color, box-shadow;
-webkit-transition-duration: 10ms;
-webkit-transition-timing-function: linear;
transition-property: background-color, border-color, box-shadow;
transition-duration: 10ms;
transition-timing-function: linear;
}
.toolbarButton.toggled:hover:active,
.splitToolbarButton.toggled > .toolbarButton.toggled:hover:active,
.secondaryToolbarButton.toggled:hover:active {
background-color: hsla(0,0%,0%,.4);
border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.5) hsla(0,0%,0%,.55);
box-shadow: 0 1px 1px hsla(0,0%,0%,.2) inset,
0 0 1px hsla(0,0%,0%,.3) inset,
0 1px 0 hsla(0,0%,100%,.05);
}
.dropdownToolbarButton {
width: 120px;
max-width: 120px;
padding: 0;
overflow: hidden;
background: url(../images/toolbarButton-menuArrows.png) no-repeat;
}
html[dir='ltr'] .dropdownToolbarButton {
background-position: 95%;
}
html[dir='rtl'] .dropdownToolbarButton {
background-position: 5%;
}
.dropdownToolbarButton > select {
min-width: 140px;
font-size: 12px;
color: hsl(0,0%,95%);
margin: 0;
padding: 3px 2px 2px;
border: none;
background: rgba(0,0,0,0); /* Opera does not support 'transparent' <select> background */
}
.dropdownToolbarButton > select > option {
background: hsl(0,0%,24%);
}
#customScaleOption {
display: none;
}
#pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, .5) solid;
}
html[dir='ltr'] .splitToolbarButton:first-child,
html[dir='ltr'] .toolbarButton:first-child,
html[dir='rtl'] .splitToolbarButton:last-child,
html[dir='rtl'] .toolbarButton:last-child {
margin-left: 4px;
}
html[dir='ltr'] .splitToolbarButton:last-child,
html[dir='ltr'] .toolbarButton:last-child,
html[dir='rtl'] .splitToolbarButton:first-child,
html[dir='rtl'] .toolbarButton:first-child {
margin-right: 4px;
}
.toolbarButtonSpacer {
width: 30px;
display: inline-block;
height: 1px;
}
.toolbarButtonFlexibleSpacer {
-webkit-box-flex: 1;
-moz-box-flex: 1;
min-width: 30px;
}
html[dir='ltr'] #findPrevious {
margin-left: 3px;
}
html[dir='ltr'] #findNext {
margin-right: 3px;
}
html[dir='rtl'] #findPrevious {
margin-right: 3px;
}
html[dir='rtl'] #findNext {
margin-left: 3px;
}
.toolbarButton::before,
.secondaryToolbarButton::before {
/* All matching images have a size of 16x16
* All relevant containers have a size of 32x25 */
position: absolute;
display: inline-block;
top: 4px;
left: 7px;
}
html[dir="ltr"] .secondaryToolbarButton::before {
left: 4px;
}
html[dir="rtl"] .secondaryToolbarButton::before {
right: 4px;
}
html[dir='ltr'] .toolbarButton#sidebarToggle::before {
content: url(../images/toolbarButton-sidebarToggle.png);
}
html[dir='rtl'] .toolbarButton#sidebarToggle::before {
content: url(../images/toolbarButton-sidebarToggle-rtl.png);
}
html[dir='ltr'] .toolbarButton#secondaryToolbarToggle::before {
content: url(../images/toolbarButton-secondaryToolbarToggle.png);
}
html[dir='rtl'] .toolbarButton#secondaryToolbarToggle::before {
content: url(../images/toolbarButton-secondaryToolbarToggle-rtl.png);
}
html[dir='ltr'] .toolbarButton.findPrevious::before {
content: url(../images/findbarButton-previous.png);
}
html[dir='rtl'] .toolbarButton.findPrevious::before {
content: url(../images/findbarButton-previous-rtl.png);
}
html[dir='ltr'] .toolbarButton.findNext::before {
content: url(../images/findbarButton-next.png);
}
html[dir='rtl'] .toolbarButton.findNext::before {
content: url(../images/findbarButton-next-rtl.png);
}
html[dir='ltr'] .toolbarButton.pageUp::before {
content: url(../images/toolbarButton-pageUp.png);
}
html[dir='rtl'] .toolbarButton.pageUp::before {
content: url(../images/toolbarButton-pageUp-rtl.png);
}
html[dir='ltr'] .toolbarButton.pageDown::before {
content: url(../images/toolbarButton-pageDown.png);
}
html[dir='rtl'] .toolbarButton.pageDown::before {
content: url(../images/toolbarButton-pageDown-rtl.png);
}
.toolbarButton.zoomOut::before {
content: url(../images/toolbarButton-zoomOut.png);
}
.toolbarButton.zoomIn::before {
content: url(../images/toolbarButton-zoomIn.png);
}
.toolbarButton.presentationMode::before,
.secondaryToolbarButton.presentationMode::before {
content: url(../images/toolbarButton-presentationMode.png);
}
.toolbarButton.print::before,
.secondaryToolbarButton.print::before {
content: url(../images/toolbarButton-print.png);
}
.toolbarButton.openFile::before,
.secondaryToolbarButton.openFile::before {
content: url(../images/toolbarButton-openFile.png);
}
.toolbarButton.download::before,
.secondaryToolbarButton.download::before {
content: url(../images/toolbarButton-download.png);
}
.toolbarButton.bookmark,
.secondaryToolbarButton.bookmark {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
outline: none;
padding-top: 4px;
text-decoration: none;
}
.secondaryToolbarButton.bookmark {
padding-top: 5px;
}
.bookmark[href='#'] {
opacity: .5;
pointer-events: none;
}
.toolbarButton.bookmark::before,
.secondaryToolbarButton.bookmark::before {
content: url(../images/toolbarButton-bookmark.png);
}
#viewThumbnail.toolbarButton::before {
content: url(../images/toolbarButton-viewThumbnail.png);
}
html[dir="ltr"] #viewOutline.toolbarButton::before {
content: url(../images/toolbarButton-viewOutline.png);
}
html[dir="rtl"] #viewOutline.toolbarButton::before {
content: url(../images/toolbarButton-viewOutline-rtl.png);
}
#viewAttachments.toolbarButton::before {
content: url(../images/toolbarButton-viewAttachments.png);
}
#viewFind.toolbarButton::before {
content: url(../images/toolbarButton-search.png);
}
.secondaryToolbarButton {
position: relative;
margin: 0 0 4px 0;
padding: 3px 0 1px 0;
height: auto;
min-height: 25px;
width: auto;
min-width: 100%;
white-space: normal;
}
html[dir="ltr"] .secondaryToolbarButton {
padding-left: 24px;
text-align: left;
}
html[dir="rtl"] .secondaryToolbarButton {
padding-right: 24px;
text-align: right;
}
html[dir="ltr"] .secondaryToolbarButton.bookmark {
padding-left: 27px;
}
html[dir="rtl"] .secondaryToolbarButton.bookmark {
padding-right: 27px;
}
html[dir="ltr"] .secondaryToolbarButton > span {
padding-right: 4px;
}
html[dir="rtl"] .secondaryToolbarButton > span {
padding-left: 4px;
}
.secondaryToolbarButton.firstPage::before {
content: url(../images/secondaryToolbarButton-firstPage.png);
}
.secondaryToolbarButton.lastPage::before {
content: url(../images/secondaryToolbarButton-lastPage.png);
}
.secondaryToolbarButton.rotateCcw::before {
content: url(../images/secondaryToolbarButton-rotateCcw.png);
}
.secondaryToolbarButton.rotateCw::before {
content: url(../images/secondaryToolbarButton-rotateCw.png);
}
.secondaryToolbarButton.handTool::before {
content: url(../images/secondaryToolbarButton-handTool.png);
}
.secondaryToolbarButton.documentProperties::before {
content: url(../images/secondaryToolbarButton-documentProperties.png);
}
.verticalToolbarSeparator {
display: block;
padding: 8px 0;
margin: 8px 4px;
width: 1px;
background-color: hsla(0,0%,0%,.5);
box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
}
html[dir='ltr'] .verticalToolbarSeparator {
margin-left: 2px;
}
html[dir='rtl'] .verticalToolbarSeparator {
margin-right: 2px;
}
.horizontalToolbarSeparator {
display: block;
margin: 0 0 4px 0;
height: 1px;
width: 100%;
background-color: hsla(0,0%,0%,.5);
box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
}
.toolbarField {
padding: 3px 6px;
margin: 4px 0 4px 0;
border: 1px solid transparent;
border-radius: 2px;
background-color: hsla(0,0%,100%,.09);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
border: 1px solid hsla(0,0%,0%,.35);
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset,
0 1px 0 hsla(0,0%,100%,.05);
color: hsl(0,0%,95%);
font-size: 12px;
line-height: 14px;
outline-style: none;
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
transition-timing-function: ease;
}
.toolbarField[type=checkbox] {
display: inline-block;
margin: 8px 0px;
}
.toolbarField.pageNumber {
-moz-appearance: textfield; /* hides the spinner in moz */
min-width: 16px;
text-align: right;
width: 40px;
}
.toolbarField.pageNumber.visiblePageIsLoading {
background-image: url(../images/loading-small.png);
background-repeat: no-repeat;
background-position: 1px;
}
.toolbarField.pageNumber::-webkit-inner-spin-button,
.toolbarField.pageNumber::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.toolbarField:hover {
background-color: hsla(0,0%,100%,.11);
border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.43) hsla(0,0%,0%,.45);
}
.toolbarField:focus {
background-color: hsla(0,0%,100%,.15);
border-color: hsla(204,100%,65%,.8) hsla(204,100%,65%,.85) hsla(204,100%,65%,.9);
}
.toolbarLabel {
min-width: 16px;
padding: 3px 6px 3px 2px;
margin: 4px 2px 4px 0;
border: 1px solid transparent;
border-radius: 2px;
color: hsl(0,0%,85%);
font-size: 12px;
line-height: 14px;
text-align: left;
-webkit-user-select: none;
-moz-user-select: none;
cursor: default;
}
#thumbnailView {
position: absolute;
width: 120px;
top: 0;
bottom: 0;
padding: 10px 40px 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.thumbnail {
float: left;
margin-bottom: 5px;
}
#thumbnailView > a:last-of-type > .thumbnail {
margin-bottom: 10px;
}
#thumbnailView > a:last-of-type > .thumbnail:not([data-loaded]) {
margin-bottom: 9px;
}
.thumbnail:not([data-loaded]) {
border: 1px dashed rgba(255, 255, 255, 0.5);
margin: -1px -1px 4px -1px;
}
.thumbnailImage {
border: 1px solid transparent;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
opacity: 0.8;
z-index: 99;
background-color: white;
background-clip: content-box;
}
.thumbnailSelectionRing {
border-radius: 2px;
padding: 7px;
}
a:focus > .thumbnail > .thumbnailSelectionRing > .thumbnailImage,
.thumbnail:hover > .thumbnailSelectionRing > .thumbnailImage {
opacity: .9;
}
a:focus > .thumbnail > .thumbnailSelectionRing,
.thumbnail:hover > .thumbnailSelectionRing {
background-color: hsla(0,0%,100%,.15);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.2) inset,
0 0 1px hsla(0,0%,0%,.2);
color: hsla(0,0%,100%,.9);
}
.thumbnail.selected > .thumbnailSelectionRing > .thumbnailImage {
box-shadow: 0 0 0 1px hsla(0,0%,0%,.5);
opacity: 1;
}
.thumbnail.selected > .thumbnailSelectionRing {
background-color: hsla(0,0%,100%,.3);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.1) inset,
0 0 1px hsla(0,0%,0%,.2);
color: hsla(0,0%,100%,1);
}
#outlineView,
#attachmentsView {
position: absolute;
width: 192px;
top: 0;
bottom: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
-webkit-user-select: none;
-moz-user-select: none;
}
#outlineView {
padding: 4px 4px 0;
}
#attachmentsView {
padding: 3px 4px 0;
}
html[dir='ltr'] .outlineWithDeepNesting > .outlineItem,
html[dir='ltr'] .outlineItem > .outlineItems {
margin-left: 20px;
}
html[dir='rtl'] .outlineWithDeepNesting > .outlineItem,
html[dir='rtl'] .outlineItem > .outlineItems {
margin-right: 20px;
}
.outlineItem > a,
.attachmentsItem > button {
text-decoration: none;
display: inline-block;
min-width: 95%;
min-width: calc(100% - 4px); /* Subtract the right padding (left, in RTL mode)
of the container. */
height: auto;
margin-bottom: 1px;
border-radius: 2px;
color: hsla(0,0%,100%,.8);
font-size: 13px;
line-height: 15px;
-moz-user-select: none;
white-space: normal;
}
.attachmentsItem > button {
border: 0 none;
background: none;
cursor: pointer;
width: 100%;
}
html[dir='ltr'] .outlineItem > a {
padding: 2px 0 5px 4px;
}
html[dir='ltr'] .attachmentsItem > button {
padding: 2px 0 3px 7px;
text-align: left;
}
html[dir='rtl'] .outlineItem > a {
padding: 2px 4px 5px 0;
}
html[dir='rtl'] .attachmentsItem > button {
padding: 2px 7px 3px 0;
text-align: right;
}
.outlineItemToggler {
position: relative;
height: 0;
width: 0;
color: hsla(0,0%,100%,.5);
}
.outlineItemToggler::before {
content: url(../images/treeitem-expanded.png);
display: inline-block;
position: absolute;
}
html[dir='ltr'] .outlineItemToggler.outlineItemsHidden::before {
content: url(../images/treeitem-collapsed.png);
}
html[dir='rtl'] .outlineItemToggler.outlineItemsHidden::before {
content: url(../images/treeitem-collapsed-rtl.png);
}
.outlineItemToggler.outlineItemsHidden ~ .outlineItems {
display: none;
}
html[dir='ltr'] .outlineItemToggler {
float: left;
}
html[dir='rtl'] .outlineItemToggler {
float: right;
}
html[dir='ltr'] .outlineItemToggler::before {
right: 4px;
}
html[dir='rtl'] .outlineItemToggler::before {
left: 4px;
}
.outlineItemToggler:hover,
.outlineItemToggler:hover + a,
.outlineItemToggler:hover ~ .outlineItems,
.outlineItem > a:hover,
.attachmentsItem > button:hover {
background-color: hsla(0,0%,100%,.02);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.2) inset,
0 0 1px hsla(0,0%,0%,.2);
border-radius: 2px;
color: hsla(0,0%,100%,.9);
}
.outlineItem.selected {
background-color: hsla(0,0%,100%,.08);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
0 0 1px hsla(0,0%,100%,.1) inset,
0 0 1px hsla(0,0%,0%,.2);
color: hsla(0,0%,100%,1);
}
.noResults {
font-size: 12px;
color: hsla(0,0%,100%,.8);
font-style: italic;
cursor: default;
}
/* TODO: file FF bug to support ::-moz-selection:window-inactive
so we can override the opaque grey background when the window is inactive;
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
::selection { background: rgba(0,0,255,0.3); }
::-moz-selection { background: rgba(0,0,255,0.3); }
#errorWrapper {
background: none repeat scroll 0 0 #FF5555;
color: white;
left: 0;
position: absolute;
right: 0;
z-index: 1000;
padding: 3px;
font-size: 0.8em;
}
.loadingInProgress #errorWrapper {
top: 37px;
}
#errorMessageLeft {
float: left;
}
#errorMessageRight {
float: right;
}
#errorMoreInfo {
background-color: #FFFFFF;
color: black;
padding: 3px;
margin: 3px;
width: 98%;
}
.overlayButton {
width: auto;
margin: 3px 4px 2px 4px !important;
padding: 2px 6px 3px 6px;
}
#overlayContainer {
display: table;
position: absolute;
width: 100%;
height: 100%;
background-color: hsla(0,0%,0%,.2);
z-index: 40000;
}
#overlayContainer > * {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
#overlayContainer > .container {
display: table-cell;
vertical-align: middle;
text-align: center;
}
#overlayContainer > .container > .dialog {
display: inline-block;
padding: 15px;
border-spacing: 4px;
color: hsl(0,0%,85%);
font-size: 12px;
line-height: 14px;
background-color: #474747; /* fallback */
background-image: url(../images/texture.png),
linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08),
inset 0 1px 1px hsla(0,0%,0%,.15),
inset 0 -1px 0 hsla(0,0%,100%,.05),
0 1px 0 hsla(0,0%,0%,.15),
0 1px 1px hsla(0,0%,0%,.1);
border: 1px solid hsla(0,0%,0%,.5);
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.dialog > .row {
display: table-row;
}
.dialog > .row > * {
display: table-cell;
}
.dialog .toolbarField {
margin: 5px 0;
}
.dialog .separator {
display: block;
margin: 4px 0 4px 0;
height: 1px;
width: 100%;
background-color: hsla(0,0%,0%,.5);
box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
}
.dialog .buttonRow {
text-align: center;
vertical-align: middle;
}
.dialog :link {
color: white;
}
#passwordOverlay > .dialog {
text-align: center;
}
#passwordOverlay .toolbarField {
width: 200px;
}
#documentPropertiesOverlay > .dialog {
text-align: left;
}
#documentPropertiesOverlay .row > * {
min-width: 100px;
}
html[dir='ltr'] #documentPropertiesOverlay .row > * {
text-align: left;
}
html[dir='rtl'] #documentPropertiesOverlay .row > * {
text-align: right;
}
#documentPropertiesOverlay .row > span {
width: 125px;
word-wrap: break-word;
}
#documentPropertiesOverlay .row > p {
max-width: 225px;
word-wrap: break-word;
}
#documentPropertiesOverlay .buttonRow {
margin-top: 10px;
}
.clearBoth {
clear: both;
}
.fileInput {
background: white;
color: black;
margin-top: 5px;
visibility: hidden;
position: fixed;
right: 0;
top: 0;
}
#PDFBug {
background: none repeat scroll 0 0 white;
border: 1px solid #666666;
position: fixed;
top: 32px;
right: 0;
bottom: 0;
font-size: 10px;
padding: 0;
width: 300px;
}
#PDFBug .controls {
background:#EEEEEE;
border-bottom: 1px solid #666666;
padding: 3px;
}
#PDFBug .panels {
bottom: 0;
left: 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
position: absolute;
right: 0;
top: 27px;
}
#PDFBug button.active {
font-weight: bold;
}
.debuggerShowText {
background: none repeat scroll 0 0 yellow;
color: blue;
}
.debuggerHideText:hover {
background: none repeat scroll 0 0 yellow;
}
#PDFBug .stats {
font-family: courier;
font-size: 10px;
white-space: pre;
}
#PDFBug .stats .title {
font-weight: bold;
}
#PDFBug table {
font-size: 10px;
}
#viewer.textLayer-visible .textLayer {
opacity: 1.0;
}
#viewer.textLayer-visible .canvasWrapper {
background-color: rgb(128,255,128);
}
#viewer.textLayer-visible .canvasWrapper canvas {
mix-blend-mode: screen;
}
#viewer.textLayer-visible .textLayer > div {
background-color: rgba(255, 255, 0, 0.1);
color: black;
border: solid 1px rgba(255, 0, 0, 0.5);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#viewer.textLayer-hover .textLayer > div:hover {
background-color: white;
color: black;
}
#viewer.textLayer-shadow .textLayer > div {
background-color: rgba(255,255,255, .6);
color: black;
}
.grab-to-pan-grab {
cursor: url("images/grab.cur"), move !important;
cursor: -webkit-grab !important;
cursor: -moz-grab !important;
cursor: grab !important;
}
.grab-to-pan-grab *:not(input):not(textarea):not(button):not(select):not(:link) {
cursor: inherit !important;
}
.grab-to-pan-grab:active,
.grab-to-pan-grabbing {
cursor: url("images/grabbing.cur"), move !important;
cursor: -webkit-grabbing !important;
cursor: -moz-grabbing !important;
cursor: grabbing !important;
position: fixed;
background: transparent;
display: block;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 50000; /* should be higher than anything else in PDF.js! */
}
@page {
margin: 0;
}
#printContainer {
display: none;
}
@media screen and (min-resolution: 2dppx) {
/* Rules for Retina screens */
.toolbarButton::before {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -5px;
}
.secondaryToolbarButton::before {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -4px;
}
html[dir='ltr'] .toolbarButton::before,
html[dir='rtl'] .toolbarButton::before {
left: -1px;
}
html[dir='ltr'] .secondaryToolbarButton::before {
left: -2px;
}
html[dir='rtl'] .secondaryToolbarButton::before {
left: 186px;
}
.toolbarField.pageNumber.visiblePageIsLoading,
#findInput[data-status="pending"] {
background-image: url(../images/loading-small@2x.png);
background-size: 16px 17px;
}
.dropdownToolbarButton {
background: url(../images/toolbarButton-menuArrows@2x.png) no-repeat;
background-size: 7px 16px;
}
html[dir='ltr'] .toolbarButton#sidebarToggle::before {
content: url(../images/toolbarButton-sidebarToggle@2x.png);
}
html[dir='rtl'] .toolbarButton#sidebarToggle::before {
content: url(../images/toolbarButton-sidebarToggle-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton#secondaryToolbarToggle::before {
content: url(../images/toolbarButton-secondaryToolbarToggle@2x.png);
}
html[dir='rtl'] .toolbarButton#secondaryToolbarToggle::before {
content: url(../images/toolbarButton-secondaryToolbarToggle-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.findPrevious::before {
content: url(../images/findbarButton-previous@2x.png);
}
html[dir='rtl'] .toolbarButton.findPrevious::before {
content: url(../images/findbarButton-previous-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.findNext::before {
content: url(../images/findbarButton-next@2x.png);
}
html[dir='rtl'] .toolbarButton.findNext::before {
content: url(../images/findbarButton-next-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.pageUp::before {
content: url(../images/toolbarButton-pageUp@2x.png);
}
html[dir='rtl'] .toolbarButton.pageUp::before {
content: url(../images/toolbarButton-pageUp-rtl@2x.png);
}
html[dir='ltr'] .toolbarButton.pageDown::before {
content: url(../images/toolbarButton-pageDown@2x.png);
}
html[dir='rtl'] .toolbarButton.pageDown::before {
content: url(../images/toolbarButton-pageDown-rtl@2x.png);
}
.toolbarButton.zoomIn::before {
content: url(../images/toolbarButton-zoomIn@2x.png);
}
.toolbarButton.zoomOut::before {
content: url(../images/toolbarButton-zoomOut@2x.png);
}
.toolbarButton.presentationMode::before,
.secondaryToolbarButton.presentationMode::before {
content: url(../images/toolbarButton-presentationMode@2x.png);
}
.toolbarButton.print::before,
.secondaryToolbarButton.print::before {
content: url(../images/toolbarButton-print@2x.png);
}
.toolbarButton.openFile::before,
.secondaryToolbarButton.openFile::before {
content: url(../images/toolbarButton-openFile@2x.png);
}
.toolbarButton.download::before,
.secondaryToolbarButton.download::before {
content: url(../images/toolbarButton-download@2x.png);
}
.toolbarButton.bookmark::before,
.secondaryToolbarButton.bookmark::before {
content: url(../images/toolbarButton-bookmark@2x.png);
}
#viewThumbnail.toolbarButton::before {
content: url(../images/toolbarButton-viewThumbnail@2x.png);
}
html[dir="ltr"] #viewOutline.toolbarButton::before {
content: url(../images/toolbarButton-viewOutline@2x.png);
}
html[dir="rtl"] #viewOutline.toolbarButton::before {
content: url(../images/toolbarButton-viewOutline-rtl@2x.png);
}
#viewAttachments.toolbarButton::before {
content: url(../images/toolbarButton-viewAttachments@2x.png);
}
#viewFind.toolbarButton::before {
content: url(../images/toolbarButton-search@2x.png);
}
.secondaryToolbarButton.firstPage::before {
content: url(../images/secondaryToolbarButton-firstPage@2x.png);
}
.secondaryToolbarButton.lastPage::before {
content: url(../images/secondaryToolbarButton-lastPage@2x.png);
}
.secondaryToolbarButton.rotateCcw::before {
content: url(../images/secondaryToolbarButton-rotateCcw@2x.png);
}
.secondaryToolbarButton.rotateCw::before {
content: url(../images/secondaryToolbarButton-rotateCw@2x.png);
}
.secondaryToolbarButton.handTool::before {
content: url(../images/secondaryToolbarButton-handTool@2x.png);
}
.secondaryToolbarButton.documentProperties::before {
content: url(../images/secondaryToolbarButton-documentProperties@2x.png);
}
.outlineItemToggler::before {
-webkit-transform: scale(0.5);
transform: scale(0.5);
top: -1px;
content: url(../images/treeitem-expanded@2x.png);
}
html[dir='ltr'] .outlineItemToggler.outlineItemsHidden::before {
content: url(../images/treeitem-collapsed@2x.png);
}
html[dir='rtl'] .outlineItemToggler.outlineItemsHidden::before {
content: url(../images/treeitem-collapsed-rtl@2x.png);
}
html[dir='ltr'] .outlineItemToggler::before {
right: 0;
}
html[dir='rtl'] .outlineItemToggler::before {
left: 0;
}
}
@media print {
/* General rules for printing. */
body {
background: transparent none;
}
/* Rules for browsers that don't support mozPrintCallback. */
#sidebarContainer, #secondaryToolbar, .toolbar, #loadingBox, #errorWrapper, .textLayer {
display: none;
}
#viewerContainer {
overflow: visible;
}
#mainContainer, #viewerContainer, .page, .page canvas {
position: static;
padding: 0;
margin: 0;
}
.page {
float: left;
display: none;
border: none;
box-shadow: none;
background-clip: content-box;
background-color: white;
}
.page[data-loaded] {
display: block;
}
.fileInput {
display: none;
}
/* Rules for browsers that support mozPrintCallback */
body[data-mozPrintCallback] #outerContainer {
display: none;
}
body[data-mozPrintCallback] #printContainer {
display: block;
}
/* wrapper around (scaled) print canvas elements */
#printContainer > div {
position: relative;
top: 0;
left: 0;
overflow: hidden;
}
#printContainer canvas {
display: block;
}
}
.visibleLargeView,
.visibleMediumView,
.visibleSmallView {
display: none;
}
@media all and (max-width: 960px) {
html[dir='ltr'] #outerContainer.sidebarMoving .outerCenter,
html[dir='ltr'] #outerContainer.sidebarOpen .outerCenter {
float: left;
left: 205px;
}
html[dir='rtl'] #outerContainer.sidebarMoving .outerCenter,
html[dir='rtl'] #outerContainer.sidebarOpen .outerCenter {
float: right;
right: 205px;
}
}
@media all and (max-width: 900px) {
.sidebarOpen .hiddenLargeView {
display: none;
}
.sidebarOpen .visibleLargeView {
display: inherit;
}
}
@media all and (max-width: 860px) {
.sidebarOpen .hiddenMediumView {
display: none;
}
.sidebarOpen .visibleMediumView {
display: inherit;
}
}
@media all and (max-width: 770px) {
#sidebarContainer {
top: 32px;
z-index: 100;
}
.loadingInProgress #sidebarContainer {
top: 37px;
}
#sidebarContent {
top: 32px;
background-color: hsla(0,0%,0%,.7);
}
html[dir='ltr'] #outerContainer.sidebarOpen > #mainContainer {
left: 0px;
}
html[dir='rtl'] #outerContainer.sidebarOpen > #mainContainer {
right: 0px;
}
html[dir='ltr'] .outerCenter {
float: left;
left: 205px;
}
html[dir='rtl'] .outerCenter {
float: right;
right: 205px;
}
#outerContainer .hiddenLargeView,
#outerContainer .hiddenMediumView {
display: inherit;
}
#outerContainer .visibleLargeView,
#outerContainer .visibleMediumView {
display: none;
}
}
@media all and (max-width: 700px) {
#outerContainer .hiddenLargeView {
display: none;
}
#outerContainer .visibleLargeView {
display: inherit;
}
}
@media all and (max-width: 660px) {
#outerContainer .hiddenMediumView {
display: none;
}
#outerContainer .visibleMediumView {
display: inherit;
}
}
@media all and (max-width: 600px) {
.hiddenSmallView {
display: none;
}
.visibleSmallView {
display: inherit;
}
html[dir='ltr'] #outerContainer.sidebarMoving .outerCenter,
html[dir='ltr'] #outerContainer.sidebarOpen .outerCenter,
html[dir='ltr'] .outerCenter {
left: 156px;
}
html[dir='rtl'] #outerContainer.sidebarMoving .outerCenter,
html[dir='rtl'] #outerContainer.sidebarOpen .outerCenter,
html[dir='rtl'] .outerCenter {
right: 156px;
}
.toolbarButtonSpacer {
width: 0;
}
}
@media all and (max-width: 510px) {
#scaleSelectContainer, #pageNumberLabel {
display: none;
}
}
| {
"content_hash": "70ad85ab16940d772248f1310c63c3dd",
"timestamp": "",
"source": "github",
"line_count": 2100,
"max_line_length": 111,
"avg_line_length": 23.05952380952381,
"alnum_prop": 0.6731233866804337,
"repo_name": "quangvule/yii2-pdfjs",
"id": "600406a16116bf25b8f3a4df572f911fe47e69cd",
"size": "49023",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/assets/css/viewer.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "48953"
},
{
"name": "JavaScript",
"bytes": "1931029"
},
{
"name": "PHP",
"bytes": "22293"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<title>Samuel 1 (WEB)</title>
<link href="../../../build/mobile.css" rel="stylesheet" />
<script src="../../../build/mobile.js"></script>
</head>
<body dir="ltr" class="section-document">
<div class="header"><div class="nav">
<a class="name" href="S2.html">World English Bible</a><a class="location" href="S2.html">Samuel 1</a><a class="prev" href=".html"><</a>
<a class="home" href="index.html">=</a>
<a class="next" href="S22.html">></a>
</div></div>
<div class="section chapter S2 S21 eng_web eng " dir="ltr" lang="en" data-id="S21" data-nextid="S22" data-previd="">
<div class="mt">The Second Book of Samuel</div>
<div class="c">1</div>
<div class="p">
<span class="v-num v-1">1 </span><span class="v S21_1" data-id="S21_1">After the death of Saul, when David had returned from the slaughter of the Amalekites, and David had stayed two days in Ziklag; </span>
<span class="v-num v-2">2 </span><span class="v S21_2" data-id="S21_2">on the third day, behold,<span class="note" id="note-2"><a class="key" href="#footnote-2">+</a></span> a man came out of the camp from Saul, with his clothes torn, and earth on his head. When he came to David, he fell to the earth, and showed respect. </span>
</div>
<div class="p">
<span class="v-num v-3">3 </span><span class="v S21_3" data-id="S21_3">David said to him, “Where do you come from?”</span>
</div>
<div class="p">
<span class="v S21_3" data-id="S21_3">He said to him, “I have escaped out of the camp of Israel.”</span>
</div>
<div class="p">
<span class="v-num v-4">4 </span><span class="v S21_4" data-id="S21_4">David said to him, “How did it go? Please tell me.”</span>
</div>
<div class="p">
<span class="v S21_4" data-id="S21_4">He answered, “The people have fled from the battle, and many of the people also have fallen and are dead. Saul and Jonathan his son are dead also.” </span>
</div>
<div class="p">
<span class="v-num v-5">5 </span><span class="v S21_5" data-id="S21_5">David said to the young man who told him, “How do you know that Saul and Jonathan his son are dead?”</span>
</div>
<div class="p">
<span class="v-num v-6">6 </span><span class="v S21_6" data-id="S21_6">The young man who told him said, “As I happened by chance on Mount Gilboa, behold, Saul was leaning on his spear; and behold, the chariots and the horsemen followed close behind him.</span>
<span class="v-num v-7">7 </span><span class="v S21_7" data-id="S21_7">When he looked behind him, he saw me, and called to me. I answered, ‘Here I am.’</span>
<span class="v-num v-8">8 </span><span class="v S21_8" data-id="S21_8">He said to me, ‘Who are you?’ I answered him, ‘I am an Amalekite.’</span>
<span class="v-num v-9">9 </span><span class="v S21_9" data-id="S21_9">He said to me, ‘Please stand beside me, and kill me; for anguish has taken hold of me, because my life lingers in me.’</span>
<span class="v-num v-10">10 </span><span class="v S21_10" data-id="S21_10">So I stood beside him and killed him, because I was sure that he could not live after that he had fallen. I took the crown that was on his head and the bracelet that was on his arm, and have brought them here to my lord.”</span>
</div>
<div class="p">
<span class="v-num v-11">11 </span><span class="v S21_11" data-id="S21_11">Then David took hold on his clothes, and tore them; and all the men who were with him did likewise.</span>
<span class="v-num v-12">12 </span><span class="v S21_12" data-id="S21_12">They mourned, wept, and fasted until evening, for Saul, and for Jonathan his son, and for the people of Yahweh,<span class="note" id="note-2"><a class="key" href="#footnote-2">+</a></span> and for the house of Israel; because they had fallen by the sword.</span>
<span class="v-num v-13">13 </span><span class="v S21_13" data-id="S21_13">David said to the young man who told him, “Where are you from?”</span>
</div>
<div class="p">
<span class="v S21_13" data-id="S21_13">He answered, “I am the son of a foreigner, an Amalekite.”</span>
</div>
<div class="p">
<span class="v-num v-14">14 </span><span class="v S21_14" data-id="S21_14">David said to him, “Why were you not afraid to stretch out your hand to destroy Yahweh’s anointed?”</span>
<span class="v-num v-15">15 </span><span class="v S21_15" data-id="S21_15">David called one of the young men, and said, “Go near, and cut him down!” He struck him so that he died.</span>
<span class="v-num v-16">16 </span><span class="v S21_16" data-id="S21_16">David said to him, “Your blood be on your head; for your mouth has testified against you, saying, ‘I have slain Yahweh’s anointed.’” </span>
</div>
<div class="p">
<span class="v-num v-17">17 </span><span class="v S21_17" data-id="S21_17">David lamented with this lamentation over Saul and over Jonathan his son</span>
<span class="v-num v-18">18 </span><span class="v S21_18" data-id="S21_18">(and he commanded them to teach the children of Judah the song of the bow; behold, it is written in the book of Jashar):</span>
</div>
<div class="q">
<span class="v-num v-19">19 </span><span class="v S21_19" data-id="S21_19">“Your glory, Israel, was slain on your high places!</span>
</div>
<div class="q2">
<span class="v S21_19" data-id="S21_19">How the mighty have fallen!</span>
</div>
<div class="q">
<span class="v-num v-20">20 </span><span class="v S21_20" data-id="S21_20">Don’t tell it in Gath.</span>
</div>
<div class="q2">
<span class="v S21_20" data-id="S21_20">Don’t publish it in the streets of Ashkelon,</span>
</div>
<div class="q">
<span class="v S21_20" data-id="S21_20">lest the daughters of the Philistines rejoice,</span>
</div>
<div class="q2">
<span class="v S21_20" data-id="S21_20">lest the daughters of the uncircumcised triumph.</span>
</div>
<div class="q">
<span class="v-num v-21">21 </span><span class="v S21_21" data-id="S21_21">You mountains of Gilboa,</span>
</div>
<div class="q2">
<span class="v S21_21" data-id="S21_21">let there be no dew or rain on you, and no fields of offerings;</span>
</div>
<div class="q2">
<span class="v S21_21" data-id="S21_21">For there the shield of the mighty was defiled and cast away,</span>
</div>
<div class="q2">
<span class="v S21_21" data-id="S21_21">The shield of Saul was not anointed with oil.</span>
</div>
<div class="q">
<span class="v-num v-22">22 </span><span class="v S21_22" data-id="S21_22">From the blood of the slain,</span>
</div>
<div class="q2">
<span class="v S21_22" data-id="S21_22">from the fat of the mighty,</span>
</div>
<div class="q2">
<span class="v S21_22" data-id="S21_22">Jonathan’s bow didn’t turn back.</span>
</div>
<div class="q2">
<span class="v S21_22" data-id="S21_22">Saul’s sword didn’t return empty.</span>
</div>
<div class="q">
<span class="v-num v-23">23 </span><span class="v S21_23" data-id="S21_23">Saul and Jonathan were lovely and pleasant in their lives.</span>
</div>
<div class="q2">
<span class="v S21_23" data-id="S21_23">In their death, they were not divided.</span>
</div>
<div class="q">
<span class="v S21_23" data-id="S21_23">They were swifter than eagles.</span>
</div>
<div class="q2">
<span class="v S21_23" data-id="S21_23">They were stronger than lions.</span>
</div>
<div class="q">
<span class="v-num v-24">24 </span><span class="v S21_24" data-id="S21_24">You daughters of Israel, weep over Saul,</span>
</div>
<div class="q2">
<span class="v S21_24" data-id="S21_24">who clothed you delicately in scarlet,</span>
</div>
<div class="q2">
<span class="v S21_24" data-id="S21_24">who put ornaments of gold on your clothing.</span>
</div>
<div class="q">
<span class="v-num v-25">25 </span><span class="v S21_25" data-id="S21_25">How the mighty have fallen in the middle of the battle!</span>
</div>
<div class="q2">
<span class="v S21_25" data-id="S21_25">Jonathan was slain on your high places.</span>
</div>
<div class="q">
<span class="v-num v-26">26 </span><span class="v S21_26" data-id="S21_26">I am distressed for you, my brother Jonathan.</span>
</div>
<div class="q2">
<span class="v S21_26" data-id="S21_26">You have been very pleasant to me.</span>
</div>
<div class="q2">
<span class="v S21_26" data-id="S21_26">Your love to me was wonderful,</span>
</div>
<div class="q2">
<span class="v S21_26" data-id="S21_26">passing the love of women.</span>
</div>
<div class="q">
<span class="v-num v-27">27 </span><span class="v S21_27" data-id="S21_27">How the mighty have fallen,</span>
</div>
<div class="q2">
<span class="v S21_27" data-id="S21_27">and the weapons of war have perished!”</span>
</div>
</div>
<div class="footnotes">
<span class="footnote" id="footnote-1"><span class="key">+</span><a class="backref" href="#note-1">1:2</a><span class="text">“Behold”, from “הִנֵּה”, means look at, take notice, observe, see, or gaze at. It is often used as an interjection.</span></span><span class="footnote" id="footnote-1"><span class="key">+</span><a class="backref" href="#note-1">1:12</a><span class="text">“Yahweh” is God’s proper Name, sometimes rendered “LORD” (all caps) in other translations.</span></span>
</div>
<div class="footer"><div class="nav">
<a class="prev" href=".html"><</a>
<a class="home" href="index.html">=</a>
<a class="next" href="S22.html">></a>
</div></div>
</body>
</html> | {
"content_hash": "67f5dbde940c4ff48e30b2dff3e4ce4a",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 484,
"avg_line_length": 58.72049689440994,
"alnum_prop": 0.6748466257668712,
"repo_name": "khangpng/VietnameseBible",
"id": "5f51711eab1202d66578b4e1d64562c599793876",
"size": "9562",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/content/texts/eng_web/S21.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "5625"
},
{
"name": "CSS",
"bytes": "77416"
},
{
"name": "HTML",
"bytes": "175720807"
},
{
"name": "JavaScript",
"bytes": "853195"
},
{
"name": "PHP",
"bytes": "25275"
}
],
"symlink_target": ""
} |
AsyncRedisClient cli("127.0.0.1", 6379);
struct Get : public RedisCmdCallBack
{
std::string key;
Get(const std::string& varname, const std::string& keyname)
{
context_varname = varname;
key = keyname;
}
void request()
{
cli.command(this, "GET %s", key.c_str());
}
void called()
{
context->set(context_varname, reply.getStr());
std::cout << reply.debugString() << std::endl;
AsyncCallBack::called();
}
};
void test_serials()
{
Context* context = new Context;
context->set("caller", 1);
//AsyncCallBack::call(new Get("myname", "name"), context);
struct Done : public AsyncRedisCallBack
{
void called()
{
std::cout << context->debugString() << std::endl;
std::cout << context->get<std::string>("getname") << std::endl;
std::cout << context->get<std::string>("getkey") << std::endl;
std::cout << context->get<std::string>("getfoo") << std::endl;
std::cout << context->get<int>("caller") << std::endl;
}
};
AsyncCallBack::parallel(new Done,
//AsyncCallBack::serials(new Done,
ACBS(
new Get("getname", "name"),
new Get("getkey", "key"),
new Get("getfoo", "foo"),
NULL
),
context);
}
#define DO(CB) \
struct CB : public AsyncRedisCallBack { \
void called() \
#define WHEN(CB, CMD) \
}; \
cli.command(new CB, CMD);
ev_timer mytimer;
void test_1()
{
Context context;
context["caller"] = std::string("on_timer");
context["redis"] = &cli;
struct GetCB : public AsyncRedisCallBack
{
GetCB(Context c) : context(c) {}
Context context;
void called()
{
context["name"] = reply.getStr();
//std::cout << reply.debugString() << std::endl;
struct Keys : public AsyncRedisCallBack
{
Keys(Context c) : context(c) {}
Context context;
void called()
{
context["keys"] = reply.getArray();
//std::cout << reply.debugString() << std::endl;
std::cout << "---------" << std::endl;
std::cout << "name:" << context.get<std::string>("name") << std::endl;
std::cout << "keys:" << context.get<std::vector<std::string> >("keys").size() << std::endl;
context.get<AsyncRedisClient*>("redis")->close();
}
};
cli.command(new Keys(context), "KEYS *");
}
};
cli.command(new GetCB(context), "GET %s", "name");
}
void test_2()
{
}
void on_timer()
{
std::cout << "timer ..." << std::endl;
//test_1();
//test_2();
test_serials();
#if 0
cli.cmd<Get>("GET %s", "name");
DO(GetName)
{
std::cout << "name:" << reply.getStr() << std::endl;
DO(Keys)
{
std::cout << "Keys:" << reply.debugString() << std::endl;
} WHEN(Keys, "KEYS *");
} WHEN(GetName, "GET name");
#endif
}
static void one_minute_cb (struct ev_loop *loop, ev_timer *w, int revents)
{
on_timer();
ev_timer_init (&mytimer, one_minute_cb, 1., 0.);
ev_timer_start (cli.eventLoop(), &mytimer);
}
void reg_timer()
{
ev_timer_init (&mytimer, one_minute_cb, 1., 0.);
ev_timer_start (cli.eventLoop(), &mytimer);
}
void test_sub()
{
DO(Subscribe)
{
std::cout << "sub:" << reply.debugString() << std::endl;
} WHEN(Subscribe, "SUBSCRIBE mychannel");
}
int main(int argc, const char* argv[])
{
//cli.connect();
reg_timer();
cli.eventRun();
} | {
"content_hash": "7e2c5a022e36b5d573455494d13c891a",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 96,
"avg_line_length": 18.676470588235293,
"alnum_prop": 0.5943307086614174,
"repo_name": "david-pp/tinyworld",
"id": "a366c636aa566ec290f824c326077a1c6e411a5e",
"size": "3281",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/redisasync.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "37375"
},
{
"name": "C++",
"bytes": "1124023"
},
{
"name": "CMake",
"bytes": "6950"
},
{
"name": "Makefile",
"bytes": "14636"
},
{
"name": "Python",
"bytes": "18379"
},
{
"name": "Shell",
"bytes": "669"
}
],
"symlink_target": ""
} |
module Communard
class Context
attr_reader :configuration
def initialize(configuration)
@configuration = configuration
end
def connect(opts = options)
::Sequel.connect(opts).tap do |connection|
connection.loggers = loggers
connection.sql_log_level = configuration.sql_log_level
connection.log_warn_duration = configuration.log_warn_duration
end
end
def generate_migration(name: nil)
fail ArgumentError, "Name is required" if name.to_s == ""
require "fileutils"
underscore = name.
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
tr("-", "_").
downcase
filename = root.join("db/migrate/#{Time.now.strftime("%Y%m%d%H%M%S")}_#{underscore}.rb")
FileUtils.mkdir_p(File.dirname(filename))
File.open(filename, "w") { |f| f << "Sequel.migration do\n change do\n end\nend" }
puts "#{filename} created"
end
def create_database(env: environment)
unless adapter(env: env) == "sqlite"
run_without_database("CREATE DATABASE %{database_name}", env: env)
end
rescue Sequel::DatabaseError => error
if /database (.*) already exists/ === error.message
loggers.each { |logger| logger.info "Database #{$1} already exists, which is fine." }
else
raise
end
end
def drop_database(env: environment)
fail ArgumentError, "Don't drop the production database, you monkey!" if env.to_s == "production"
if adapter(env: env) == "sqlite"
file = options(env: env).fetch("database")
if File.exist?(file)
File.rm(file)
end
else
run_without_database("DROP DATABASE IF EXISTS %{database_name}", env: env)
end
end
def migrate(target: nil, env: environment)
maintenance(env: env).migrate(target: target, dump_same_db: configuration.dump_same_db)
end
def seed(env: environment)
maintenance(env: env).seed
end
def rollback(step: 1, env: environment)
maintenance(env: env).rollback(step: step, dump_same_db: configuration.dump_same_db)
end
def load_schema(env: environment)
maintenance(env: env).load_schema
end
def dump_schema(env: environment)
maintenance(env: env).dump_schema(dump_same_db: configuration.dump_same_db)
end
def status(env: environment)
maintenance(env: env).status
end
def run_without_database(cmd, env: environment)
opts = options(env: env).dup
database_name = opts.delete("database")
if opts.fetch("adapter") == "postgres"
opts["database"] = "postgres"
opts["schema_search_path"] = "public"
end
connection = connect(opts)
connection.run(cmd % { database_name: database_name })
end
def options(env: environment)
YAML.load_file(root.join("config/database.yml")).fetch(env.to_s)
end
private
def maintenance(env: environment)
Maintenance.new(connection: connect(options(env: env)), root: root)
end
def environment
configuration.environment
end
def root
configuration.root
end
def loggers
configuration.loggers
end
def adapter(env: environment)
options(env: env).fetch("adapter").to_s
end
end
end
| {
"content_hash": "2a7b829ba3ffadc3363460e742be64d4",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 103,
"avg_line_length": 28.35593220338983,
"alnum_prop": 0.6210400478182905,
"repo_name": "yourkarma/communard",
"id": "4f9ece67a1ae1b478aa094b48008090f339f55bd",
"size": "3346",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/communard/context.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "14503"
}
],
"symlink_target": ""
} |
/** MobX - (c) Michel Weststrate 2015 - 2018 - MIT Licensed */
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
var OBFUSCATED_ERROR$$1 = "An invariant failed, however the error is obfuscated because this is an production build.";
var EMPTY_ARRAY$$1 = [];
Object.freeze(EMPTY_ARRAY$$1);
var EMPTY_OBJECT$$1 = {};
Object.freeze(EMPTY_OBJECT$$1);
function getNextId$$1() {
return ++globalState$$1.mobxGuid;
}
function fail$$1(message) {
invariant$$1(false, message);
throw "X"; // unreachable
}
function invariant$$1(check, message) {
if (!check)
throw new Error("[mobx] " + (message || OBFUSCATED_ERROR$$1));
}
/**
* Prints a deprecation message, but only one time.
* Returns false if the deprecated message was already printed before
*/
var deprecatedMessages = [];
function deprecated$$1(msg, thing) {
if (process.env.NODE_ENV === "production")
return false;
if (thing) {
return deprecated$$1("'" + msg + "', use '" + thing + "' instead.");
}
if (deprecatedMessages.indexOf(msg) !== -1)
return false;
deprecatedMessages.push(msg);
console.error("[mobx] Deprecated: " + msg);
return true;
}
/**
* Makes sure that the provided function is invoked at most once.
*/
function once$$1(func) {
var invoked = false;
return function () {
if (invoked)
return;
invoked = true;
return func.apply(this, arguments);
};
}
var noop$$1 = function () { };
function unique$$1(list) {
var res = [];
list.forEach(function (item) {
if (res.indexOf(item) === -1)
res.push(item);
});
return res;
}
function isObject$$1(value) {
return value !== null && typeof value === "object";
}
function isPlainObject$$1(value) {
if (value === null || typeof value !== "object")
return false;
var proto = Object.getPrototypeOf(value);
return proto === Object.prototype || proto === null;
}
function addHiddenProp$$1(object, propName, value) {
Object.defineProperty(object, propName, {
enumerable: false,
writable: true,
configurable: true,
value: value
});
}
function addHiddenFinalProp$$1(object, propName, value) {
Object.defineProperty(object, propName, {
enumerable: false,
writable: false,
configurable: true,
value: value
});
}
function isPropertyConfigurable$$1(object, prop) {
var descriptor = Object.getOwnPropertyDescriptor(object, prop);
return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false);
}
function assertPropertyConfigurable$$1(object, prop) {
if (process.env.NODE_ENV !== "production" && !isPropertyConfigurable$$1(object, prop))
fail$$1("Cannot make property '" + prop.toString() + "' observable, it is not configurable and writable in the target object");
}
function createInstanceofPredicate$$1(name, clazz) {
var propName = "isMobX" + name;
clazz.prototype[propName] = true;
return function (x) {
return isObject$$1(x) && x[propName] === true;
};
}
/**
* Returns whether the argument is an array, disregarding observability.
*/
function isArrayLike$$1(x) {
return Array.isArray(x) || isObservableArray$$1(x);
}
function isES6Map$$1(thing) {
return thing instanceof Map;
}
function getMapLikeKeys$$1(map) {
if (isPlainObject$$1(map))
return Object.keys(map);
if (Array.isArray(map))
return map.map(function (_a) {
var _b = __read(_a, 1), key = _b[0];
return key;
});
if (isES6Map$$1(map) || isObservableMap$$1(map))
return Array.from(map.keys());
return fail$$1("Cannot get keys from '" + map + "'");
}
function toPrimitive$$1(value) {
return value === null ? null : typeof value === "object" ? "" + value : value;
}
var $mobx$$1 = Symbol("mobx administration");
var Atom$$1 = /** @class */ (function () {
/**
* Create a new atom. For debugging purposes it is recommended to give it a name.
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
*/
function Atom$$1(name) {
if (name === void 0) { name = "Atom@" + getNextId$$1(); }
this.name = name;
this.isPendingUnobservation = false; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
this.isBeingObserved = false;
this.observers = new Set();
this.diffValue = 0;
this.lastAccessedBy = 0;
this.lowestObserverState = exports.IDerivationState.NOT_TRACKING;
}
Atom$$1.prototype.onBecomeObserved = function () {
if (this.onBecomeObservedListeners) {
this.onBecomeObservedListeners.forEach(function (listener) { return listener(); });
}
};
Atom$$1.prototype.onBecomeUnobserved = function () {
if (this.onBecomeUnobservedListeners) {
this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); });
}
};
/**
* Invoke this method to notify mobx that your atom has been used somehow.
* Returns true if there is currently a reactive context.
*/
Atom$$1.prototype.reportObserved = function () {
return reportObserved$$1(this);
};
/**
* Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
*/
Atom$$1.prototype.reportChanged = function () {
startBatch$$1();
propagateChanged$$1(this);
endBatch$$1();
};
Atom$$1.prototype.toString = function () {
return this.name;
};
return Atom$$1;
}());
var isAtom$$1 = createInstanceofPredicate$$1("Atom", Atom$$1);
function createAtom$$1(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop$$1; }
if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop$$1; }
var atom = new Atom$$1(name);
// default `noop` listener will not initialize the hook Set
if (onBecomeObservedHandler !== noop$$1) {
onBecomeObserved$$1(atom, onBecomeObservedHandler);
}
if (onBecomeUnobservedHandler !== noop$$1) {
onBecomeUnobserved$$1(atom, onBecomeUnobservedHandler);
}
return atom;
}
function identityComparer(a, b) {
return a === b;
}
function structuralComparer(a, b) {
return deepEqual$$1(a, b);
}
function defaultComparer(a, b) {
return Object.is(a, b);
}
var comparer$$1 = {
identity: identityComparer,
structural: structuralComparer,
default: defaultComparer
};
var mobxDidRunLazyInitializersSymbol$$1 = Symbol("mobx did run lazy initializers");
var mobxPendingDecorators$$1 = Symbol("mobx pending decorators");
var enumerableDescriptorCache = {};
var nonEnumerableDescriptorCache = {};
function createPropertyInitializerDescriptor(prop, enumerable) {
var cache = enumerable ? enumerableDescriptorCache : nonEnumerableDescriptorCache;
return (cache[prop] ||
(cache[prop] = {
configurable: true,
enumerable: enumerable,
get: function () {
initializeInstance$$1(this);
return this[prop];
},
set: function (value) {
initializeInstance$$1(this);
this[prop] = value;
}
}));
}
function initializeInstance$$1(target) {
if (target[mobxDidRunLazyInitializersSymbol$$1] === true)
return;
var decorators = target[mobxPendingDecorators$$1];
if (decorators) {
addHiddenProp$$1(target, mobxDidRunLazyInitializersSymbol$$1, true);
for (var key in decorators) {
var d = decorators[key];
d.propertyCreator(target, d.prop, d.descriptor, d.decoratorTarget, d.decoratorArguments);
}
}
}
function createPropDecorator$$1(propertyInitiallyEnumerable, propertyCreator) {
return function decoratorFactory() {
var decoratorArguments;
var decorator = function decorate$$1(target, prop, descriptor, applyImmediately
// This is a special parameter to signal the direct application of a decorator, allow extendObservable to skip the entire type decoration part,
// as the instance to apply the decorator to equals the target
) {
if (applyImmediately === true) {
propertyCreator(target, prop, descriptor, target, decoratorArguments);
return null;
}
if (process.env.NODE_ENV !== "production" && !quacksLikeADecorator$$1(arguments))
fail$$1("This function is a decorator, but it wasn't invoked like a decorator");
if (!Object.prototype.hasOwnProperty.call(target, mobxPendingDecorators$$1)) {
var inheritedDecorators = target[mobxPendingDecorators$$1];
addHiddenProp$$1(target, mobxPendingDecorators$$1, __assign({}, inheritedDecorators));
}
target[mobxPendingDecorators$$1][prop] = {
prop: prop,
propertyCreator: propertyCreator,
descriptor: descriptor,
decoratorTarget: target,
decoratorArguments: decoratorArguments
};
return createPropertyInitializerDescriptor(prop, propertyInitiallyEnumerable);
};
if (quacksLikeADecorator$$1(arguments)) {
// @decorator
decoratorArguments = EMPTY_ARRAY$$1;
return decorator.apply(null, arguments);
}
else {
// @decorator(args)
decoratorArguments = Array.prototype.slice.call(arguments);
return decorator;
}
};
}
function quacksLikeADecorator$$1(args) {
return (((args.length === 2 || args.length === 3) && typeof args[1] === "string") ||
(args.length === 4 && args[3] === true));
}
function deepEnhancer$$1(v, _, name) {
// it is an observable already, done
if (isObservable$$1(v))
return v;
// something that can be converted and mutated?
if (Array.isArray(v))
return observable$$1.array(v, { name: name });
if (isPlainObject$$1(v))
return observable$$1.object(v, undefined, { name: name });
if (isES6Map$$1(v))
return observable$$1.map(v, { name: name });
return v;
}
function shallowEnhancer$$1(v, _, name) {
if (v === undefined || v === null)
return v;
if (isObservableObject$$1(v) || isObservableArray$$1(v) || isObservableMap$$1(v))
return v;
if (Array.isArray(v))
return observable$$1.array(v, { name: name, deep: false });
if (isPlainObject$$1(v))
return observable$$1.object(v, undefined, { name: name, deep: false });
if (isES6Map$$1(v))
return observable$$1.map(v, { name: name, deep: false });
return fail$$1(process.env.NODE_ENV !== "production" &&
"The shallow modifier / decorator can only used in combination with arrays, objects and maps");
}
function referenceEnhancer$$1(newValue) {
// never turn into an observable
return newValue;
}
function refStructEnhancer$$1(v, oldValue, name) {
if (process.env.NODE_ENV !== "production" && isObservable$$1(v))
throw "observable.struct should not be used with observable values";
if (deepEqual$$1(v, oldValue))
return oldValue;
return v;
}
function createDecoratorForEnhancer$$1(enhancer) {
invariant$$1(enhancer);
var decorator = createPropDecorator$$1(true, function (target, propertyName, descriptor, _decoratorTarget, decoratorArgs) {
if (process.env.NODE_ENV !== "production") {
invariant$$1(!descriptor || !descriptor.get, "@observable cannot be used on getter (property \"" + propertyName + "\"), use @computed instead.");
}
var initialValue = descriptor
? descriptor.initializer
? descriptor.initializer.call(target)
: descriptor.value
: undefined;
asObservableObject$$1(target).addObservableProp(propertyName, initialValue, enhancer);
});
var res =
// Extra process checks, as this happens during module initialization
typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production"
? function observableDecorator() {
// This wrapper function is just to detect illegal decorator invocations, deprecate in a next version
// and simply return the created prop decorator
if (arguments.length < 2)
return fail$$1("Incorrect decorator invocation. @observable decorator doesn't expect any arguments");
return decorator.apply(null, arguments);
}
: decorator;
res.enhancer = enhancer;
return res;
}
// Predefined bags of create observable options, to avoid allocating temporarily option objects
// in the majority of cases
var defaultCreateObservableOptions$$1 = {
deep: true,
name: undefined,
defaultDecorator: undefined,
proxy: true
};
Object.freeze(defaultCreateObservableOptions$$1);
function assertValidOption(key) {
if (!/^(deep|name|defaultDecorator|proxy)$/.test(key))
fail$$1("invalid option for (extend)observable: " + key);
}
function asCreateObservableOptions$$1(thing) {
if (thing === null || thing === undefined)
return defaultCreateObservableOptions$$1;
if (typeof thing === "string")
return { name: thing, deep: true, proxy: true };
if (process.env.NODE_ENV !== "production") {
if (typeof thing !== "object")
return fail$$1("expected options object");
Object.keys(thing).forEach(assertValidOption);
}
return thing;
}
var deepDecorator$$1 = createDecoratorForEnhancer$$1(deepEnhancer$$1);
var shallowDecorator = createDecoratorForEnhancer$$1(shallowEnhancer$$1);
var refDecorator$$1 = createDecoratorForEnhancer$$1(referenceEnhancer$$1);
var refStructDecorator = createDecoratorForEnhancer$$1(refStructEnhancer$$1);
function getEnhancerFromOptions(options) {
return options.defaultDecorator
? options.defaultDecorator.enhancer
: options.deep === false
? referenceEnhancer$$1
: deepEnhancer$$1;
}
/**
* Turns an object, array or function into a reactive structure.
* @param v the value which should become observable.
*/
function createObservable(v, arg2, arg3) {
// @observable someProp;
if (typeof arguments[1] === "string") {
return deepDecorator$$1.apply(null, arguments);
}
// it is an observable already, done
if (isObservable$$1(v))
return v;
// something that can be converted and mutated?
var res = isPlainObject$$1(v)
? observable$$1.object(v, arg2, arg3)
: Array.isArray(v)
? observable$$1.array(v, arg2)
: isES6Map$$1(v)
? observable$$1.map(v, arg2)
: v;
// this value could be converted to a new observable data structure, return it
if (res !== v)
return res;
// otherwise, just box it
fail$$1(process.env.NODE_ENV !== "production" &&
"The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'");
}
var observableFactories = {
box: function (value, options) {
if (arguments.length > 2)
incorrectlyUsedAsDecorator("box");
var o = asCreateObservableOptions$$1(options);
return new ObservableValue$$1(value, getEnhancerFromOptions(o), o.name);
},
array: function (initialValues, options) {
if (arguments.length > 2)
incorrectlyUsedAsDecorator("array");
var o = asCreateObservableOptions$$1(options);
return createObservableArray$$1(initialValues, getEnhancerFromOptions(o), o.name);
},
map: function (initialValues, options) {
if (arguments.length > 2)
incorrectlyUsedAsDecorator("map");
var o = asCreateObservableOptions$$1(options);
return new ObservableMap$$1(initialValues, getEnhancerFromOptions(o), o.name);
},
object: function (props, decorators, options) {
if (typeof arguments[1] === "string")
incorrectlyUsedAsDecorator("object");
var o = asCreateObservableOptions$$1(options);
if (o.proxy === false) {
return extendObservable$$1({}, props, decorators, o);
}
else {
var defaultDecorator = getDefaultDecoratorFromObjectOptions$$1(o);
var base = extendObservable$$1({}, undefined, undefined, o);
var proxy = createDynamicObservableObject$$1(base);
extendObservableObjectWithProperties$$1(proxy, props, decorators, defaultDecorator);
return proxy;
}
},
ref: refDecorator$$1,
shallow: shallowDecorator,
deep: deepDecorator$$1,
struct: refStructDecorator
};
var observable$$1 = createObservable;
// weird trick to keep our typings nicely with our funcs, and still extend the observable function
Object.keys(observableFactories).forEach(function (name) { return (observable$$1[name] = observableFactories[name]); });
function incorrectlyUsedAsDecorator(methodName) {
fail$$1(
// process.env.NODE_ENV !== "production" &&
"Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?");
}
var computedDecorator$$1 = createPropDecorator$$1(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) {
var get$$1 = descriptor.get, set$$1 = descriptor.set; // initialValue is the descriptor for get / set props
// Optimization: faster on decorator target or instance? Assuming target
// Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage..
// Forcing instance now, fixes hot reloadig issues on React Native:
var options = decoratorArgs[0] || {};
asObservableObject$$1(instance).addComputedProp(instance, propertyName, __assign({ get: get$$1,
set: set$$1, context: instance }, options));
});
var computedStructDecorator = computedDecorator$$1({ equals: comparer$$1.structural });
/**
* Decorator for class properties: @computed get value() { return expr; }.
* For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
*/
var computed$$1 = function computed$$1(arg1, arg2, arg3) {
if (typeof arg2 === "string") {
// @computed
return computedDecorator$$1.apply(null, arguments);
}
if (arg1 !== null && typeof arg1 === "object" && arguments.length === 1) {
// @computed({ options })
return computedDecorator$$1.apply(null, arguments);
}
// computed(expr, options?)
if (process.env.NODE_ENV !== "production") {
invariant$$1(typeof arg1 === "function", "First argument to `computed` should be an expression.");
invariant$$1(arguments.length < 3, "Computed takes one or two arguments if used as function");
}
var opts = typeof arg2 === "object" ? arg2 : {};
opts.get = arg1;
opts.set = typeof arg2 === "function" ? arg2 : opts.set;
opts.name = opts.name || arg1.name || ""; /* for generated name */
return new ComputedValue$$1(opts);
};
computed$$1.struct = computedStructDecorator;
function createAction$$1(actionName, fn) {
if (process.env.NODE_ENV !== "production") {
invariant$$1(typeof fn === "function", "`action` can only be invoked on functions");
if (typeof actionName !== "string" || !actionName)
fail$$1("actions should have valid names, got: '" + actionName + "'");
}
var res = function () {
return executeAction$$1(actionName, fn, this, arguments);
};
res.isMobxAction = true;
return res;
}
function executeAction$$1(actionName, fn, scope, args) {
var runInfo = startAction(actionName, fn, scope, args);
try {
return fn.apply(scope, args);
}
finally {
endAction(runInfo);
}
}
function startAction(actionName, fn, scope, args) {
var notifySpy = isSpyEnabled$$1() && !!actionName;
var startTime = 0;
if (notifySpy && process.env.NODE_ENV !== "production") {
startTime = Date.now();
var l = (args && args.length) || 0;
var flattendArgs = new Array(l);
if (l > 0)
for (var i = 0; i < l; i++)
flattendArgs[i] = args[i];
spyReportStart$$1({
type: "action",
name: actionName,
object: scope,
arguments: flattendArgs
});
}
var prevDerivation = untrackedStart$$1();
startBatch$$1();
var prevAllowStateChanges = allowStateChangesStart$$1(true);
return {
prevDerivation: prevDerivation,
prevAllowStateChanges: prevAllowStateChanges,
notifySpy: notifySpy,
startTime: startTime
};
}
function endAction(runInfo) {
allowStateChangesEnd$$1(runInfo.prevAllowStateChanges);
endBatch$$1();
untrackedEnd$$1(runInfo.prevDerivation);
if (runInfo.notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1({ time: Date.now() - runInfo.startTime });
}
function allowStateChanges$$1(allowStateChanges$$1, func) {
var prev = allowStateChangesStart$$1(allowStateChanges$$1);
var res;
try {
res = func();
}
finally {
allowStateChangesEnd$$1(prev);
}
return res;
}
function allowStateChangesStart$$1(allowStateChanges$$1) {
var prev = globalState$$1.allowStateChanges;
globalState$$1.allowStateChanges = allowStateChanges$$1;
return prev;
}
function allowStateChangesEnd$$1(prev) {
globalState$$1.allowStateChanges = prev;
}
function allowStateChangesInsideComputed$$1(func) {
var prev = globalState$$1.computationDepth;
globalState$$1.computationDepth = 0;
var res;
try {
res = func();
}
finally {
globalState$$1.computationDepth = prev;
}
return res;
}
var ObservableValue$$1 = /** @class */ (function (_super) {
__extends(ObservableValue$$1, _super);
function ObservableValue$$1(value, enhancer, name, notifySpy) {
if (name === void 0) { name = "ObservableValue@" + getNextId$$1(); }
if (notifySpy === void 0) { notifySpy = true; }
var _this = _super.call(this, name) || this;
_this.enhancer = enhancer;
_this.hasUnreportedChange = false;
_this.value = enhancer(value, undefined, name);
if (notifySpy && isSpyEnabled$$1() && process.env.NODE_ENV !== "production") {
// only notify spy if this is a stand-alone observable
spyReport$$1({ type: "create", name: _this.name, newValue: "" + _this.value });
}
return _this;
}
ObservableValue$$1.prototype.dehanceValue = function (value) {
if (this.dehancer !== undefined)
return this.dehancer(value);
return value;
};
ObservableValue$$1.prototype.set = function (newValue) {
var oldValue = this.value;
newValue = this.prepareNewValue(newValue);
if (newValue !== globalState$$1.UNCHANGED) {
var notifySpy = isSpyEnabled$$1();
if (notifySpy && process.env.NODE_ENV !== "production") {
spyReportStart$$1({
type: "update",
name: this.name,
newValue: newValue,
oldValue: oldValue
});
}
this.setNewValue(newValue);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
}
};
ObservableValue$$1.prototype.prepareNewValue = function (newValue) {
checkIfStateModificationsAreAllowed$$1(this);
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
object: this,
type: "update",
newValue: newValue
});
if (!change)
return globalState$$1.UNCHANGED;
newValue = change.newValue;
}
// apply modifier
newValue = this.enhancer(newValue, this.value, this.name);
return this.value !== newValue ? newValue : globalState$$1.UNCHANGED;
};
ObservableValue$$1.prototype.setNewValue = function (newValue) {
var oldValue = this.value;
this.value = newValue;
this.reportChanged();
if (hasListeners$$1(this)) {
notifyListeners$$1(this, {
type: "update",
object: this,
newValue: newValue,
oldValue: oldValue
});
}
};
ObservableValue$$1.prototype.get = function () {
this.reportObserved();
return this.dehanceValue(this.value);
};
ObservableValue$$1.prototype.intercept = function (handler) {
return registerInterceptor$$1(this, handler);
};
ObservableValue$$1.prototype.observe = function (listener, fireImmediately) {
if (fireImmediately)
listener({
object: this,
type: "update",
newValue: this.value,
oldValue: undefined
});
return registerListener$$1(this, listener);
};
ObservableValue$$1.prototype.toJSON = function () {
return this.get();
};
ObservableValue$$1.prototype.toString = function () {
return this.name + "[" + this.value + "]";
};
ObservableValue$$1.prototype.valueOf = function () {
return toPrimitive$$1(this.get());
};
ObservableValue$$1.prototype[Symbol.toPrimitive] = function () {
return this.valueOf();
};
return ObservableValue$$1;
}(Atom$$1));
var isObservableValue$$1 = createInstanceofPredicate$$1("ObservableValue", ObservableValue$$1);
/**
* A node in the state dependency root that observes other nodes, and can be observed itself.
*
* ComputedValue will remember the result of the computation for the duration of the batch, or
* while being observed.
*
* During this time it will recompute only when one of its direct dependencies changed,
* but only when it is being accessed with `ComputedValue.get()`.
*
* Implementation description:
* 1. First time it's being accessed it will compute and remember result
* give back remembered result until 2. happens
* 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
* 3. When it's being accessed, recompute if any shallow dependency changed.
* if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
* go to step 2. either way
*
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
*/
var ComputedValue$$1 = /** @class */ (function () {
/**
* Create a new computed value based on a function expression.
*
* The `name` property is for debug purposes only.
*
* The `equals` property specifies the comparer function to use to determine if a newly produced
* value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
* compares based on identity comparison (===), and `structualComparer` deeply compares the structure.
* Structural comparison can be convenient if you always produce a new aggregated object and
* don't want to notify observers if it is structurally the same.
* This is useful for working with vectors, mouse coordinates etc.
*/
function ComputedValue$$1(options) {
this.dependenciesState = exports.IDerivationState.NOT_TRACKING;
this.observing = []; // nodes we are looking at. Our value depends on these nodes
this.newObserving = null; // during tracking it's an array with new observed observers
this.isBeingObserved = false;
this.isPendingUnobservation = false;
this.observers = new Set();
this.diffValue = 0;
this.runId = 0;
this.lastAccessedBy = 0;
this.lowestObserverState = exports.IDerivationState.UP_TO_DATE;
this.unboundDepsCount = 0;
this.__mapid = "#" + getNextId$$1();
this.value = new CaughtException$$1(null);
this.isComputing = false; // to check for cycles
this.isRunningSetter = false;
this.isTracing = TraceMode$$1.NONE;
if (process.env.NODE_ENV !== "production" && !options.get)
throw "[mobx] missing option for computed: get";
this.derivation = options.get;
this.name = options.name || "ComputedValue@" + getNextId$$1();
if (options.set)
this.setter = createAction$$1(this.name + "-setter", options.set);
this.equals =
options.equals ||
(options.compareStructural || options.struct
? comparer$$1.structural
: comparer$$1.default);
this.scope = options.context;
this.requiresReaction = !!options.requiresReaction;
this.keepAlive = !!options.keepAlive;
}
ComputedValue$$1.prototype.onBecomeStale = function () {
propagateMaybeChanged$$1(this);
};
ComputedValue$$1.prototype.onBecomeObserved = function () {
if (this.onBecomeObservedListeners) {
this.onBecomeObservedListeners.forEach(function (listener) { return listener(); });
}
};
ComputedValue$$1.prototype.onBecomeUnobserved = function () {
if (this.onBecomeUnobservedListeners) {
this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); });
}
};
/**
* Returns the current value of this computed value.
* Will evaluate its computation first if needed.
*/
ComputedValue$$1.prototype.get = function () {
if (this.isComputing)
fail$$1("Cycle detected in computation " + this.name + ": " + this.derivation);
if (globalState$$1.inBatch === 0 && this.observers.size === 0 && !this.keepAlive) {
if (shouldCompute$$1(this)) {
this.warnAboutUntrackedRead();
startBatch$$1(); // See perf test 'computed memoization'
this.value = this.computeValue(false);
endBatch$$1();
}
}
else {
reportObserved$$1(this);
if (shouldCompute$$1(this))
if (this.trackAndCompute())
propagateChangeConfirmed$$1(this);
}
var result = this.value;
if (isCaughtException$$1(result))
throw result.cause;
return result;
};
ComputedValue$$1.prototype.peek = function () {
var res = this.computeValue(false);
if (isCaughtException$$1(res))
throw res.cause;
return res;
};
ComputedValue$$1.prototype.set = function (value) {
if (this.setter) {
invariant$$1(!this.isRunningSetter, "The setter of computed value '" + this.name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?");
this.isRunningSetter = true;
try {
this.setter.call(this.scope, value);
}
finally {
this.isRunningSetter = false;
}
}
else
invariant$$1(false, process.env.NODE_ENV !== "production" &&
"[ComputedValue '" + this.name + "'] It is not possible to assign a new value to a computed value.");
};
ComputedValue$$1.prototype.trackAndCompute = function () {
if (isSpyEnabled$$1() && process.env.NODE_ENV !== "production") {
spyReport$$1({
object: this.scope,
type: "compute",
name: this.name
});
}
var oldValue = this.value;
var wasSuspended =
/* see #1208 */ this.dependenciesState === exports.IDerivationState.NOT_TRACKING;
var newValue = this.computeValue(true);
var changed = wasSuspended ||
isCaughtException$$1(oldValue) ||
isCaughtException$$1(newValue) ||
!this.equals(oldValue, newValue);
if (changed) {
this.value = newValue;
}
return changed;
};
ComputedValue$$1.prototype.computeValue = function (track) {
this.isComputing = true;
globalState$$1.computationDepth++;
var res;
if (track) {
res = trackDerivedFunction$$1(this, this.derivation, this.scope);
}
else {
if (globalState$$1.disableErrorBoundaries === true) {
res = this.derivation.call(this.scope);
}
else {
try {
res = this.derivation.call(this.scope);
}
catch (e) {
res = new CaughtException$$1(e);
}
}
}
globalState$$1.computationDepth--;
this.isComputing = false;
return res;
};
ComputedValue$$1.prototype.suspend = function () {
if (!this.keepAlive) {
clearObserving$$1(this);
this.value = undefined; // don't hold on to computed value!
}
};
ComputedValue$$1.prototype.observe = function (listener, fireImmediately) {
var _this = this;
var firstTime = true;
var prevValue = undefined;
return autorun$$1(function () {
var newValue = _this.get();
if (!firstTime || fireImmediately) {
var prevU = untrackedStart$$1();
listener({
type: "update",
object: _this,
newValue: newValue,
oldValue: prevValue
});
untrackedEnd$$1(prevU);
}
firstTime = false;
prevValue = newValue;
});
};
ComputedValue$$1.prototype.warnAboutUntrackedRead = function () {
if (process.env.NODE_ENV === "production")
return;
if (this.requiresReaction === true) {
fail$$1("[mobx] Computed value " + this.name + " is read outside a reactive context");
}
if (this.isTracing !== TraceMode$$1.NONE) {
console.log("[mobx.trace] '" + this.name + "' is being read outside a reactive context. Doing a full recompute");
}
if (globalState$$1.computedRequiresReaction) {
console.warn("[mobx] Computed value " + this.name + " is being read outside a reactive context. Doing a full recompute");
}
};
ComputedValue$$1.prototype.toJSON = function () {
return this.get();
};
ComputedValue$$1.prototype.toString = function () {
return this.name + "[" + this.derivation.toString() + "]";
};
ComputedValue$$1.prototype.valueOf = function () {
return toPrimitive$$1(this.get());
};
ComputedValue$$1.prototype[Symbol.toPrimitive] = function () {
return this.valueOf();
};
return ComputedValue$$1;
}());
var isComputedValue$$1 = createInstanceofPredicate$$1("ComputedValue", ComputedValue$$1);
(function (IDerivationState$$1) {
// before being run or (outside batch and not being observed)
// at this point derivation is not holding any data about dependency tree
IDerivationState$$1[IDerivationState$$1["NOT_TRACKING"] = -1] = "NOT_TRACKING";
// no shallow dependency changed since last computation
// won't recalculate derivation
// this is what makes mobx fast
IDerivationState$$1[IDerivationState$$1["UP_TO_DATE"] = 0] = "UP_TO_DATE";
// some deep dependency changed, but don't know if shallow dependency changed
// will require to check first if UP_TO_DATE or POSSIBLY_STALE
// currently only ComputedValue will propagate POSSIBLY_STALE
//
// having this state is second big optimization:
// don't have to recompute on every dependency change, but only when it's needed
IDerivationState$$1[IDerivationState$$1["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE";
// A shallow dependency has changed since last computation and the derivation
// will need to recompute when it's needed next.
IDerivationState$$1[IDerivationState$$1["STALE"] = 2] = "STALE";
})(exports.IDerivationState || (exports.IDerivationState = {}));
var TraceMode$$1;
(function (TraceMode$$1) {
TraceMode$$1[TraceMode$$1["NONE"] = 0] = "NONE";
TraceMode$$1[TraceMode$$1["LOG"] = 1] = "LOG";
TraceMode$$1[TraceMode$$1["BREAK"] = 2] = "BREAK";
})(TraceMode$$1 || (TraceMode$$1 = {}));
var CaughtException$$1 = /** @class */ (function () {
function CaughtException$$1(cause) {
this.cause = cause;
// Empty
}
return CaughtException$$1;
}());
function isCaughtException$$1(e) {
return e instanceof CaughtException$$1;
}
/**
* Finds out whether any dependency of the derivation has actually changed.
* If dependenciesState is 1 then it will recalculate dependencies,
* if any dependency changed it will propagate it by changing dependenciesState to 2.
*
* By iterating over the dependencies in the same order that they were reported and
* stopping on the first change, all the recalculations are only called for ComputedValues
* that will be tracked by derivation. That is because we assume that if the first x
* dependencies of the derivation doesn't change then the derivation should run the same way
* up until accessing x-th dependency.
*/
function shouldCompute$$1(derivation) {
switch (derivation.dependenciesState) {
case exports.IDerivationState.UP_TO_DATE:
return false;
case exports.IDerivationState.NOT_TRACKING:
case exports.IDerivationState.STALE:
return true;
case exports.IDerivationState.POSSIBLY_STALE: {
var prevUntracked = untrackedStart$$1(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.
var obs = derivation.observing, l = obs.length;
for (var i = 0; i < l; i++) {
var obj = obs[i];
if (isComputedValue$$1(obj)) {
if (globalState$$1.disableErrorBoundaries) {
obj.get();
}
else {
try {
obj.get();
}
catch (e) {
// we are not interested in the value *or* exception at this moment, but if there is one, notify all
untrackedEnd$$1(prevUntracked);
return true;
}
}
// if ComputedValue `obj` actually changed it will be computed and propagated to its observers.
// and `derivation` is an observer of `obj`
// invariantShouldCompute(derivation)
if (derivation.dependenciesState === exports.IDerivationState.STALE) {
untrackedEnd$$1(prevUntracked);
return true;
}
}
}
changeDependenciesStateTo0$$1(derivation);
untrackedEnd$$1(prevUntracked);
return false;
}
}
}
// function invariantShouldCompute(derivation: IDerivation) {
// const newDepState = (derivation as any).dependenciesState
// if (
// process.env.NODE_ENV === "production" &&
// (newDepState === IDerivationState.POSSIBLY_STALE ||
// newDepState === IDerivationState.NOT_TRACKING)
// )
// fail("Illegal dependency state")
// }
function isComputingDerivation$$1() {
return globalState$$1.trackingDerivation !== null; // filter out actions inside computations
}
function checkIfStateModificationsAreAllowed$$1(atom) {
var hasObservers$$1 = atom.observers.size > 0;
// Should never be possible to change an observed observable from inside computed, see #798
if (globalState$$1.computationDepth > 0 && hasObservers$$1)
fail$$1(process.env.NODE_ENV !== "production" &&
"Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: " + atom.name);
// Should not be possible to change observed state outside strict mode, except during initialization, see #563
if (!globalState$$1.allowStateChanges && (hasObservers$$1 || globalState$$1.enforceActions === "strict"))
fail$$1(process.env.NODE_ENV !== "production" &&
(globalState$$1.enforceActions
? "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: "
: "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ") +
atom.name);
}
/**
* Executes the provided function `f` and tracks which observables are being accessed.
* The tracking information is stored on the `derivation` object and the derivation is registered
* as observer of any of the accessed observables.
*/
function trackDerivedFunction$$1(derivation, f, context) {
// pre allocate array allocation + room for variation in deps
// array will be trimmed by bindDependencies
changeDependenciesStateTo0$$1(derivation);
derivation.newObserving = new Array(derivation.observing.length + 100);
derivation.unboundDepsCount = 0;
derivation.runId = ++globalState$$1.runId;
var prevTracking = globalState$$1.trackingDerivation;
globalState$$1.trackingDerivation = derivation;
var result;
if (globalState$$1.disableErrorBoundaries === true) {
result = f.call(context);
}
else {
try {
result = f.call(context);
}
catch (e) {
result = new CaughtException$$1(e);
}
}
globalState$$1.trackingDerivation = prevTracking;
bindDependencies(derivation);
return result;
}
/**
* diffs newObserving with observing.
* update observing to be newObserving with unique observables
* notify observers that become observed/unobserved
*/
function bindDependencies(derivation) {
// invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1");
var prevObserving = derivation.observing;
var observing = (derivation.observing = derivation.newObserving);
var lowestNewObservingDerivationState = exports.IDerivationState.UP_TO_DATE;
// Go through all new observables and check diffValue: (this list can contain duplicates):
// 0: first occurrence, change to 1 and keep it
// 1: extra occurrence, drop it
var i0 = 0, l = derivation.unboundDepsCount;
for (var i = 0; i < l; i++) {
var dep = observing[i];
if (dep.diffValue === 0) {
dep.diffValue = 1;
if (i0 !== i)
observing[i0] = dep;
i0++;
}
// Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
// not hitting the condition
if (dep.dependenciesState > lowestNewObservingDerivationState) {
lowestNewObservingDerivationState = dep.dependenciesState;
}
}
observing.length = i0;
derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)
// Go through all old observables and check diffValue: (it is unique after last bindDependencies)
// 0: it's not in new observables, unobserve it
// 1: it keeps being observed, don't want to notify it. change to 0
l = prevObserving.length;
while (l--) {
var dep = prevObserving[l];
if (dep.diffValue === 0) {
removeObserver$$1(dep, derivation);
}
dep.diffValue = 0;
}
// Go through all new observables and check diffValue: (now it should be unique)
// 0: it was set to 0 in last loop. don't need to do anything.
// 1: it wasn't observed, let's observe it. set back to 0
while (i0--) {
var dep = observing[i0];
if (dep.diffValue === 1) {
dep.diffValue = 0;
addObserver$$1(dep, derivation);
}
}
// Some new observed derivations may become stale during this derivation computation
// so they have had no chance to propagate staleness (#916)
if (lowestNewObservingDerivationState !== exports.IDerivationState.UP_TO_DATE) {
derivation.dependenciesState = lowestNewObservingDerivationState;
derivation.onBecomeStale();
}
}
function clearObserving$$1(derivation) {
// invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch");
var obs = derivation.observing;
derivation.observing = [];
var i = obs.length;
while (i--)
removeObserver$$1(obs[i], derivation);
derivation.dependenciesState = exports.IDerivationState.NOT_TRACKING;
}
function untracked$$1(action$$1) {
var prev = untrackedStart$$1();
try {
return action$$1();
}
finally {
untrackedEnd$$1(prev);
}
}
function untrackedStart$$1() {
var prev = globalState$$1.trackingDerivation;
globalState$$1.trackingDerivation = null;
return prev;
}
function untrackedEnd$$1(prev) {
globalState$$1.trackingDerivation = prev;
}
/**
* needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
*
*/
function changeDependenciesStateTo0$$1(derivation) {
if (derivation.dependenciesState === exports.IDerivationState.UP_TO_DATE)
return;
derivation.dependenciesState = exports.IDerivationState.UP_TO_DATE;
var obs = derivation.observing;
var i = obs.length;
while (i--)
obs[i].lowestObserverState = exports.IDerivationState.UP_TO_DATE;
}
/**
* These values will persist if global state is reset
*/
var persistentKeys = [
"mobxGuid",
"spyListeners",
"enforceActions",
"computedRequiresReaction",
"disableErrorBoundaries",
"runId",
"UNCHANGED"
];
var MobXGlobals$$1 = /** @class */ (function () {
function MobXGlobals$$1() {
/**
* MobXGlobals version.
* MobX compatiblity with other versions loaded in memory as long as this version matches.
* It indicates that the global state still stores similar information
*
* N.B: this version is unrelated to the package version of MobX, and is only the version of the
* internal state storage of MobX, and can be the same across many different package versions
*/
this.version = 5;
/**
* globally unique token to signal unchanged
*/
this.UNCHANGED = {};
/**
* Currently running derivation
*/
this.trackingDerivation = null;
/**
* Are we running a computation currently? (not a reaction)
*/
this.computationDepth = 0;
/**
* Each time a derivation is tracked, it is assigned a unique run-id
*/
this.runId = 0;
/**
* 'guid' for general purpose. Will be persisted amongst resets.
*/
this.mobxGuid = 0;
/**
* Are we in a batch block? (and how many of them)
*/
this.inBatch = 0;
/**
* Observables that don't have observers anymore, and are about to be
* suspended, unless somebody else accesses it in the same batch
*
* @type {IObservable[]}
*/
this.pendingUnobservations = [];
/**
* List of scheduled, not yet executed, reactions.
*/
this.pendingReactions = [];
/**
* Are we currently processing reactions?
*/
this.isRunningReactions = false;
/**
* Is it allowed to change observables at this point?
* In general, MobX doesn't allow that when running computations and React.render.
* To ensure that those functions stay pure.
*/
this.allowStateChanges = true;
/**
* If strict mode is enabled, state changes are by default not allowed
*/
this.enforceActions = false;
/**
* Spy callbacks
*/
this.spyListeners = [];
/**
* Globally attached error handlers that react specifically to errors in reactions
*/
this.globalReactionErrorHandlers = [];
/**
* Warn if computed values are accessed outside a reactive context
*/
this.computedRequiresReaction = false;
/*
* Don't catch and rethrow exceptions. This is useful for inspecting the state of
* the stack when an exception occurs while debugging.
*/
this.disableErrorBoundaries = false;
}
return MobXGlobals$$1;
}());
var canMergeGlobalState = true;
var isolateCalled = false;
var globalState$$1 = (function () {
var global = getGlobal$$1();
if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals)
canMergeGlobalState = false;
if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals$$1().version)
canMergeGlobalState = false;
if (!canMergeGlobalState) {
setTimeout(function () {
if (!isolateCalled) {
fail$$1("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`");
}
}, 1);
return new MobXGlobals$$1();
}
else if (global.__mobxGlobals) {
global.__mobxInstanceCount += 1;
if (!global.__mobxGlobals.UNCHANGED)
global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
return global.__mobxGlobals;
}
else {
global.__mobxInstanceCount = 1;
return (global.__mobxGlobals = new MobXGlobals$$1());
}
})();
function isolateGlobalState$$1() {
if (globalState$$1.pendingReactions.length ||
globalState$$1.inBatch ||
globalState$$1.isRunningReactions)
fail$$1("isolateGlobalState should be called before MobX is running any reactions");
isolateCalled = true;
if (canMergeGlobalState) {
if (--getGlobal$$1().__mobxInstanceCount === 0)
getGlobal$$1().__mobxGlobals = undefined;
globalState$$1 = new MobXGlobals$$1();
}
}
function getGlobalState$$1() {
return globalState$$1;
}
/**
* For testing purposes only; this will break the internal state of existing observables,
* but can be used to get back at a stable state after throwing errors
*/
function resetGlobalState$$1() {
var defaultGlobals = new MobXGlobals$$1();
for (var key in defaultGlobals)
if (persistentKeys.indexOf(key) === -1)
globalState$$1[key] = defaultGlobals[key];
globalState$$1.allowStateChanges = !globalState$$1.enforceActions;
}
function getGlobal$$1() {
return typeof window !== "undefined" ? window : global;
}
function hasObservers$$1(observable$$1) {
return observable$$1.observers && observable$$1.observers.size > 0;
}
function getObservers$$1(observable$$1) {
return observable$$1.observers;
}
// function invariantObservers(observable: IObservable) {
// const list = observable.observers
// const map = observable.observersIndexes
// const l = list.length
// for (let i = 0; i < l; i++) {
// const id = list[i].__mapid
// if (i) {
// invariant(map[id] === i, "INTERNAL ERROR maps derivation.__mapid to index in list") // for performance
// } else {
// invariant(!(id in map), "INTERNAL ERROR observer on index 0 shouldn't be held in map.") // for performance
// }
// }
// invariant(
// list.length === 0 || Object.keys(map).length === list.length - 1,
// "INTERNAL ERROR there is no junk in map"
// )
// }
function addObserver$$1(observable$$1, node) {
// invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1");
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
// invariantObservers(observable);
observable$$1.observers.add(node);
if (observable$$1.lowestObserverState > node.dependenciesState)
observable$$1.lowestObserverState = node.dependenciesState;
// invariantObservers(observable);
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
}
function removeObserver$$1(observable$$1, node) {
// invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
// invariantObservers(observable);
observable$$1.observers.delete(node);
if (observable$$1.observers.size === 0) {
// deleting last observer
queueForUnobservation$$1(observable$$1);
}
// invariantObservers(observable);
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
}
function queueForUnobservation$$1(observable$$1) {
if (observable$$1.isPendingUnobservation === false) {
// invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
observable$$1.isPendingUnobservation = true;
globalState$$1.pendingUnobservations.push(observable$$1);
}
}
/**
* Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
* During a batch `onBecomeUnobserved` will be called at most once per observable.
* Avoids unnecessary recalculations.
*/
function startBatch$$1() {
globalState$$1.inBatch++;
}
function endBatch$$1() {
if (--globalState$$1.inBatch === 0) {
runReactions$$1();
// the batch is actually about to finish, all unobserving should happen here.
var list = globalState$$1.pendingUnobservations;
for (var i = 0; i < list.length; i++) {
var observable$$1 = list[i];
observable$$1.isPendingUnobservation = false;
if (observable$$1.observers.size === 0) {
if (observable$$1.isBeingObserved) {
// if this observable had reactive observers, trigger the hooks
observable$$1.isBeingObserved = false;
observable$$1.onBecomeUnobserved();
}
if (observable$$1 instanceof ComputedValue$$1) {
// computed values are automatically teared down when the last observer leaves
// this process happens recursively, this computed might be the last observabe of another, etc..
observable$$1.suspend();
}
}
}
globalState$$1.pendingUnobservations = [];
}
}
function reportObserved$$1(observable$$1) {
var derivation = globalState$$1.trackingDerivation;
if (derivation !== null) {
/**
* Simple optimization, give each derivation run an unique id (runId)
* Check if last time this observable was accessed the same runId is used
* if this is the case, the relation is already known
*/
if (derivation.runId !== observable$$1.lastAccessedBy) {
observable$$1.lastAccessedBy = derivation.runId;
// Tried storing newObserving, or observing, or both as Set, but performance didn't come close...
derivation.newObserving[derivation.unboundDepsCount++] = observable$$1;
if (!observable$$1.isBeingObserved) {
observable$$1.isBeingObserved = true;
observable$$1.onBecomeObserved();
}
}
return true;
}
else if (observable$$1.observers.size === 0 && globalState$$1.inBatch > 0) {
queueForUnobservation$$1(observable$$1);
}
return false;
}
// function invariantLOS(observable: IObservable, msg: string) {
// // it's expensive so better not run it in produciton. but temporarily helpful for testing
// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)
// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`
// throw new Error(
// "lowestObserverState is wrong for " +
// msg +
// " because " +
// min +
// " < " +
// observable.lowestObserverState
// )
// }
/**
* NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
* It will propagate changes to observers from previous run
* It's hard or maybe impossible (with reasonable perf) to get it right with current approach
* Hopefully self reruning autoruns aren't a feature people should depend on
* Also most basic use cases should be ok
*/
// Called by Atom when its value changes
function propagateChanged$$1(observable$$1) {
// invariantLOS(observable, "changed start");
if (observable$$1.lowestObserverState === exports.IDerivationState.STALE)
return;
observable$$1.lowestObserverState = exports.IDerivationState.STALE;
// Ideally we use for..of here, but the downcompiled version is really slow...
observable$$1.observers.forEach(function (d) {
if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE) {
if (d.isTracing !== TraceMode$$1.NONE) {
logTraceInfo(d, observable$$1);
}
d.onBecomeStale();
}
d.dependenciesState = exports.IDerivationState.STALE;
});
// invariantLOS(observable, "changed end");
}
// Called by ComputedValue when it recalculate and its value changed
function propagateChangeConfirmed$$1(observable$$1) {
// invariantLOS(observable, "confirmed start");
if (observable$$1.lowestObserverState === exports.IDerivationState.STALE)
return;
observable$$1.lowestObserverState = exports.IDerivationState.STALE;
observable$$1.observers.forEach(function (d) {
if (d.dependenciesState === exports.IDerivationState.POSSIBLY_STALE)
d.dependenciesState = exports.IDerivationState.STALE;
else if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date.
)
observable$$1.lowestObserverState = exports.IDerivationState.UP_TO_DATE;
});
// invariantLOS(observable, "confirmed end");
}
// Used by computed when its dependency changed, but we don't wan't to immediately recompute.
function propagateMaybeChanged$$1(observable$$1) {
// invariantLOS(observable, "maybe start");
if (observable$$1.lowestObserverState !== exports.IDerivationState.UP_TO_DATE)
return;
observable$$1.lowestObserverState = exports.IDerivationState.POSSIBLY_STALE;
observable$$1.observers.forEach(function (d) {
if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE) {
d.dependenciesState = exports.IDerivationState.POSSIBLY_STALE;
if (d.isTracing !== TraceMode$$1.NONE) {
logTraceInfo(d, observable$$1);
}
d.onBecomeStale();
}
});
// invariantLOS(observable, "maybe end");
}
function logTraceInfo(derivation, observable$$1) {
console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable$$1.name + "'");
if (derivation.isTracing === TraceMode$$1.BREAK) {
var lines = [];
printDepTree(getDependencyTree$$1(derivation), lines, 1);
// prettier-ignore
new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable$$1.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue$$1 ? derivation.derivation.toString() : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")();
}
}
function printDepTree(tree, lines, depth) {
if (lines.length >= 1000) {
lines.push("(and many more)");
return;
}
lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :)
if (tree.dependencies)
tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); });
}
var Reaction$$1 = /** @class */ (function () {
function Reaction$$1(name, onInvalidate, errorHandler) {
if (name === void 0) { name = "Reaction@" + getNextId$$1(); }
this.name = name;
this.onInvalidate = onInvalidate;
this.errorHandler = errorHandler;
this.observing = []; // nodes we are looking at. Our value depends on these nodes
this.newObserving = [];
this.dependenciesState = exports.IDerivationState.NOT_TRACKING;
this.diffValue = 0;
this.runId = 0;
this.unboundDepsCount = 0;
this.__mapid = "#" + getNextId$$1();
this.isDisposed = false;
this._isScheduled = false;
this._isTrackPending = false;
this._isRunning = false;
this.isTracing = TraceMode$$1.NONE;
}
Reaction$$1.prototype.onBecomeStale = function () {
this.schedule();
};
Reaction$$1.prototype.schedule = function () {
if (!this._isScheduled) {
this._isScheduled = true;
globalState$$1.pendingReactions.push(this);
runReactions$$1();
}
};
Reaction$$1.prototype.isScheduled = function () {
return this._isScheduled;
};
/**
* internal, use schedule() if you intend to kick off a reaction
*/
Reaction$$1.prototype.runReaction = function () {
if (!this.isDisposed) {
startBatch$$1();
this._isScheduled = false;
if (shouldCompute$$1(this)) {
this._isTrackPending = true;
try {
this.onInvalidate();
if (this._isTrackPending &&
isSpyEnabled$$1() &&
process.env.NODE_ENV !== "production") {
// onInvalidate didn't trigger track right away..
spyReport$$1({
name: this.name,
type: "scheduled-reaction"
});
}
}
catch (e) {
this.reportExceptionInDerivation(e);
}
}
endBatch$$1();
}
};
Reaction$$1.prototype.track = function (fn) {
startBatch$$1();
var notify = isSpyEnabled$$1();
var startTime;
if (notify && process.env.NODE_ENV !== "production") {
startTime = Date.now();
spyReportStart$$1({
name: this.name,
type: "reaction"
});
}
this._isRunning = true;
var result = trackDerivedFunction$$1(this, fn, undefined);
this._isRunning = false;
this._isTrackPending = false;
if (this.isDisposed) {
// disposed during last run. Clean up everything that was bound after the dispose call.
clearObserving$$1(this);
}
if (isCaughtException$$1(result))
this.reportExceptionInDerivation(result.cause);
if (notify && process.env.NODE_ENV !== "production") {
spyReportEnd$$1({
time: Date.now() - startTime
});
}
endBatch$$1();
};
Reaction$$1.prototype.reportExceptionInDerivation = function (error) {
var _this = this;
if (this.errorHandler) {
this.errorHandler(error, this);
return;
}
if (globalState$$1.disableErrorBoundaries)
throw error;
var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this;
console.error(message, error);
/** If debugging brought you here, please, read the above message :-). Tnx! */
if (isSpyEnabled$$1()) {
spyReport$$1({
type: "error",
name: this.name,
message: message,
error: "" + error
});
}
globalState$$1.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); });
};
Reaction$$1.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
if (!this._isRunning) {
// if disposed while running, clean up later. Maybe not optimal, but rare case
startBatch$$1();
clearObserving$$1(this);
endBatch$$1();
}
}
};
Reaction$$1.prototype.getDisposer = function () {
var r = this.dispose.bind(this);
r[$mobx$$1] = this;
return r;
};
Reaction$$1.prototype.toString = function () {
return "Reaction[" + this.name + "]";
};
Reaction$$1.prototype.trace = function (enterBreakPoint) {
if (enterBreakPoint === void 0) { enterBreakPoint = false; }
trace$$1(this, enterBreakPoint);
};
return Reaction$$1;
}());
function onReactionError$$1(handler) {
globalState$$1.globalReactionErrorHandlers.push(handler);
return function () {
var idx = globalState$$1.globalReactionErrorHandlers.indexOf(handler);
if (idx >= 0)
globalState$$1.globalReactionErrorHandlers.splice(idx, 1);
};
}
/**
* Magic number alert!
* Defines within how many times a reaction is allowed to re-trigger itself
* until it is assumed that this is gonna be a never ending loop...
*/
var MAX_REACTION_ITERATIONS = 100;
var reactionScheduler = function (f) { return f(); };
function runReactions$$1() {
// Trampolining, if runReactions are already running, new reactions will be picked up
if (globalState$$1.inBatch > 0 || globalState$$1.isRunningReactions)
return;
reactionScheduler(runReactionsHelper);
}
function runReactionsHelper() {
globalState$$1.isRunningReactions = true;
var allReactions = globalState$$1.pendingReactions;
var iterations = 0;
// While running reactions, new reactions might be triggered.
// Hence we work with two variables and check whether
// we converge to no remaining reactions after a while.
while (allReactions.length > 0) {
if (++iterations === MAX_REACTION_ITERATIONS) {
console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." +
(" Probably there is a cycle in the reactive function: " + allReactions[0]));
allReactions.splice(0); // clear reactions
}
var remainingReactions = allReactions.splice(0);
for (var i = 0, l = remainingReactions.length; i < l; i++)
remainingReactions[i].runReaction();
}
globalState$$1.isRunningReactions = false;
}
var isReaction$$1 = createInstanceofPredicate$$1("Reaction", Reaction$$1);
function setReactionScheduler$$1(fn) {
var baseScheduler = reactionScheduler;
reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); };
}
function isSpyEnabled$$1() {
return process.env.NODE_ENV !== "production" && !!globalState$$1.spyListeners.length;
}
function spyReport$$1(event) {
if (process.env.NODE_ENV === "production")
return; // dead code elimination can do the rest
if (!globalState$$1.spyListeners.length)
return;
var listeners = globalState$$1.spyListeners;
for (var i = 0, l = listeners.length; i < l; i++)
listeners[i](event);
}
function spyReportStart$$1(event) {
if (process.env.NODE_ENV === "production")
return;
var change = __assign({}, event, { spyReportStart: true });
spyReport$$1(change);
}
var END_EVENT = { spyReportEnd: true };
function spyReportEnd$$1(change) {
if (process.env.NODE_ENV === "production")
return;
if (change)
spyReport$$1(__assign({}, change, { spyReportEnd: true }));
else
spyReport$$1(END_EVENT);
}
function spy$$1(listener) {
if (process.env.NODE_ENV === "production") {
console.warn("[mobx.spy] Is a no-op in production builds");
return function () { };
}
else {
globalState$$1.spyListeners.push(listener);
return once$$1(function () {
globalState$$1.spyListeners = globalState$$1.spyListeners.filter(function (l) { return l !== listener; });
});
}
}
function dontReassignFields() {
fail$$1(process.env.NODE_ENV !== "production" && "@action fields are not reassignable");
}
function namedActionDecorator$$1(name) {
return function (target, prop, descriptor) {
if (descriptor) {
if (process.env.NODE_ENV !== "production" && descriptor.get !== undefined) {
return fail$$1("@action cannot be used with getters");
}
// babel / typescript
// @action method() { }
if (descriptor.value) {
// typescript
return {
value: createAction$$1(name, descriptor.value),
enumerable: false,
configurable: true,
writable: true // for typescript, this must be writable, otherwise it cannot inherit :/ (see inheritable actions test)
};
}
// babel only: @action method = () => {}
var initializer_1 = descriptor.initializer;
return {
enumerable: false,
configurable: true,
writable: true,
initializer: function () {
// N.B: we can't immediately invoke initializer; this would be wrong
return createAction$$1(name, initializer_1.call(this));
}
};
}
// bound instance methods
return actionFieldDecorator$$1(name).apply(this, arguments);
};
}
function actionFieldDecorator$$1(name) {
// Simple property that writes on first invocation to the current instance
return function (target, prop, descriptor) {
Object.defineProperty(target, prop, {
configurable: true,
enumerable: false,
get: function () {
return undefined;
},
set: function (value) {
addHiddenProp$$1(this, prop, action$$1(name, value));
}
});
};
}
function boundActionDecorator$$1(target, propertyName, descriptor, applyToInstance) {
if (applyToInstance === true) {
defineBoundAction$$1(target, propertyName, descriptor.value);
return null;
}
if (descriptor) {
// if (descriptor.value)
// Typescript / Babel: @action.bound method() { }
// also: babel @action.bound method = () => {}
return {
configurable: true,
enumerable: false,
get: function () {
defineBoundAction$$1(this, propertyName, descriptor.value || descriptor.initializer.call(this));
return this[propertyName];
},
set: dontReassignFields
};
}
// field decorator Typescript @action.bound method = () => {}
return {
enumerable: false,
configurable: true,
set: function (v) {
defineBoundAction$$1(this, propertyName, v);
},
get: function () {
return undefined;
}
};
}
var action$$1 = function action$$1(arg1, arg2, arg3, arg4) {
// action(fn() {})
if (arguments.length === 1 && typeof arg1 === "function")
return createAction$$1(arg1.name || "<unnamed action>", arg1);
// action("name", fn() {})
if (arguments.length === 2 && typeof arg2 === "function")
return createAction$$1(arg1, arg2);
// @action("name") fn() {}
if (arguments.length === 1 && typeof arg1 === "string")
return namedActionDecorator$$1(arg1);
// @action fn() {}
if (arg4 === true) {
// apply to instance immediately
addHiddenProp$$1(arg1, arg2, createAction$$1(arg1.name || arg2, arg3.value));
}
else {
return namedActionDecorator$$1(arg2).apply(null, arguments);
}
};
action$$1.bound = boundActionDecorator$$1;
function runInAction$$1(arg1, arg2) {
var actionName = typeof arg1 === "string" ? arg1 : arg1.name || "<unnamed action>";
var fn = typeof arg1 === "function" ? arg1 : arg2;
if (process.env.NODE_ENV !== "production") {
invariant$$1(typeof fn === "function" && fn.length === 0, "`runInAction` expects a function without arguments");
if (typeof actionName !== "string" || !actionName)
fail$$1("actions should have valid names, got: '" + actionName + "'");
}
return executeAction$$1(actionName, fn, this, undefined);
}
function isAction$$1(thing) {
return typeof thing === "function" && thing.isMobxAction === true;
}
function defineBoundAction$$1(target, propertyName, fn) {
addHiddenProp$$1(target, propertyName, createAction$$1(propertyName, fn.bind(target)));
}
/**
* Creates a named reactive view and keeps it alive, so that the view is always
* updated if one of the dependencies changes, even when the view is not further used by something else.
* @param view The reactive view
* @returns disposer function, which can be used to stop the view from being updated in the future.
*/
function autorun$$1(view, opts) {
if (opts === void 0) { opts = EMPTY_OBJECT$$1; }
if (process.env.NODE_ENV !== "production") {
invariant$$1(typeof view === "function", "Autorun expects a function as first argument");
invariant$$1(isAction$$1(view) === false, "Autorun does not accept actions since actions are untrackable");
}
var name = (opts && opts.name) || view.name || "Autorun@" + getNextId$$1();
var runSync = !opts.scheduler && !opts.delay;
var reaction$$1;
if (runSync) {
// normal autorun
reaction$$1 = new Reaction$$1(name, function () {
this.track(reactionRunner);
}, opts.onError);
}
else {
var scheduler_1 = createSchedulerFromOptions(opts);
// debounced autorun
var isScheduled_1 = false;
reaction$$1 = new Reaction$$1(name, function () {
if (!isScheduled_1) {
isScheduled_1 = true;
scheduler_1(function () {
isScheduled_1 = false;
if (!reaction$$1.isDisposed)
reaction$$1.track(reactionRunner);
});
}
}, opts.onError);
}
function reactionRunner() {
view(reaction$$1);
}
reaction$$1.schedule();
return reaction$$1.getDisposer();
}
var run = function (f) { return f(); };
function createSchedulerFromOptions(opts) {
return opts.scheduler
? opts.scheduler
: opts.delay
? function (f) { return setTimeout(f, opts.delay); }
: run;
}
function reaction$$1(expression, effect, opts) {
if (opts === void 0) { opts = EMPTY_OBJECT$$1; }
if (process.env.NODE_ENV !== "production") {
invariant$$1(typeof expression === "function", "First argument to reaction should be a function");
invariant$$1(typeof opts === "object", "Third argument of reactions should be an object");
}
var name = opts.name || "Reaction@" + getNextId$$1();
var effectAction = action$$1(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);
var runSync = !opts.scheduler && !opts.delay;
var scheduler = createSchedulerFromOptions(opts);
var firstTime = true;
var isScheduled = false;
var value;
var equals = opts.compareStructural
? comparer$$1.structural
: opts.equals || comparer$$1.default;
var r = new Reaction$$1(name, function () {
if (firstTime || runSync) {
reactionRunner();
}
else if (!isScheduled) {
isScheduled = true;
scheduler(reactionRunner);
}
}, opts.onError);
function reactionRunner() {
isScheduled = false; // Q: move into reaction runner?
if (r.isDisposed)
return;
var changed = false;
r.track(function () {
var nextValue = expression(r);
changed = firstTime || !equals(value, nextValue);
value = nextValue;
});
if (firstTime && opts.fireImmediately)
effectAction(value, r);
if (!firstTime && changed === true)
effectAction(value, r);
if (firstTime)
firstTime = false;
}
r.schedule();
return r.getDisposer();
}
function wrapErrorHandler(errorHandler, baseFn) {
return function () {
try {
return baseFn.apply(this, arguments);
}
catch (e) {
errorHandler.call(this, e);
}
};
}
function onBecomeObserved$$1(thing, arg2, arg3) {
return interceptHook("onBecomeObserved", thing, arg2, arg3);
}
function onBecomeUnobserved$$1(thing, arg2, arg3) {
return interceptHook("onBecomeUnobserved", thing, arg2, arg3);
}
function interceptHook(hook, thing, arg2, arg3) {
var atom = typeof arg2 === "string" ? getAtom$$1(thing, arg2) : getAtom$$1(thing);
var cb = typeof arg2 === "string" ? arg3 : arg2;
var listenersKey = hook + "Listeners";
if (atom[listenersKey]) {
atom[listenersKey].add(cb);
}
else {
atom[listenersKey] = new Set([cb]);
}
var orig = atom[hook];
if (typeof orig !== "function")
return fail$$1(process.env.NODE_ENV !== "production" && "Not an atom that can be (un)observed");
return function () {
var hookListeners = atom[listenersKey];
if (hookListeners) {
hookListeners.delete(cb);
if (hookListeners.size === 0) {
delete atom[listenersKey];
}
}
};
}
function configure$$1(options) {
var enforceActions = options.enforceActions, computedRequiresReaction = options.computedRequiresReaction, disableErrorBoundaries = options.disableErrorBoundaries, reactionScheduler = options.reactionScheduler;
if (enforceActions !== undefined) {
if (typeof enforceActions === "boolean" || enforceActions === "strict")
deprecated$$1("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead");
var ea = void 0;
switch (enforceActions) {
case true:
case "observed":
ea = true;
break;
case false:
case "never":
ea = false;
break;
case "strict":
case "always":
ea = "strict";
break;
default:
fail$$1("Invalid value for 'enforceActions': '" + enforceActions + "', expected 'never', 'always' or 'observed'");
}
globalState$$1.enforceActions = ea;
globalState$$1.allowStateChanges = ea === true || ea === "strict" ? false : true;
}
if (computedRequiresReaction !== undefined) {
globalState$$1.computedRequiresReaction = !!computedRequiresReaction;
}
if (options.isolateGlobalState === true) {
isolateGlobalState$$1();
}
if (disableErrorBoundaries !== undefined) {
if (disableErrorBoundaries === true)
console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.");
globalState$$1.disableErrorBoundaries = !!disableErrorBoundaries;
}
if (reactionScheduler) {
setReactionScheduler$$1(reactionScheduler);
}
}
function decorate$$1(thing, decorators) {
process.env.NODE_ENV !== "production" &&
invariant$$1(isPlainObject$$1(decorators), "Decorators should be a key value map");
var target = typeof thing === "function" ? thing.prototype : thing;
var _loop_1 = function (prop) {
var propertyDecorators = decorators[prop];
if (!Array.isArray(propertyDecorators)) {
propertyDecorators = [propertyDecorators];
}
process.env.NODE_ENV !== "production" &&
invariant$$1(propertyDecorators.every(function (decorator) { return typeof decorator === "function"; }), "Decorate: expected a decorator function or array of decorator functions for '" + prop + "'");
var descriptor = Object.getOwnPropertyDescriptor(target, prop);
var newDescriptor = propertyDecorators.reduce(function (accDescriptor, decorator) { return decorator(target, prop, accDescriptor); }, descriptor);
if (newDescriptor)
Object.defineProperty(target, prop, newDescriptor);
};
for (var prop in decorators) {
_loop_1(prop);
}
return thing;
}
function extendObservable$$1(target, properties, decorators, options) {
if (process.env.NODE_ENV !== "production") {
invariant$$1(arguments.length >= 2 && arguments.length <= 4, "'extendObservable' expected 2-4 arguments");
invariant$$1(typeof target === "object", "'extendObservable' expects an object as first argument");
invariant$$1(!isObservableMap$$1(target), "'extendObservable' should not be used on maps, use map.merge instead");
}
options = asCreateObservableOptions$$1(options);
var defaultDecorator = getDefaultDecoratorFromObjectOptions$$1(options);
initializeInstance$$1(target); // Fixes #1740
asObservableObject$$1(target, options.name, defaultDecorator.enhancer); // make sure object is observable, even without initial props
if (properties)
extendObservableObjectWithProperties$$1(target, properties, decorators, defaultDecorator);
return target;
}
function getDefaultDecoratorFromObjectOptions$$1(options) {
return options.defaultDecorator || (options.deep === false ? refDecorator$$1 : deepDecorator$$1);
}
function extendObservableObjectWithProperties$$1(target, properties, decorators, defaultDecorator) {
if (process.env.NODE_ENV !== "production") {
invariant$$1(!isObservable$$1(properties), "Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540");
if (decorators)
for (var key in decorators)
if (!(key in properties))
fail$$1("Trying to declare a decorator for unspecified property '" + key + "'");
}
startBatch$$1();
try {
for (var key in properties) {
var descriptor = Object.getOwnPropertyDescriptor(properties, key);
if (process.env.NODE_ENV !== "production") {
if (Object.getOwnPropertyDescriptor(target, key))
fail$$1("'extendObservable' can only be used to introduce new properties. Use 'set' or 'decorate' instead. The property '" + key + "' already exists on '" + target + "'");
if (isComputed$$1(descriptor.value))
fail$$1("Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead");
}
var decorator = decorators && key in decorators
? decorators[key]
: descriptor.get
? computedDecorator$$1
: defaultDecorator;
if (process.env.NODE_ENV !== "production" && typeof decorator !== "function")
fail$$1("Not a valid decorator for '" + key + "', got: " + decorator);
var resultDescriptor = decorator(target, key, descriptor, true);
if (resultDescriptor // otherwise, assume already applied, due to `applyToInstance`
)
Object.defineProperty(target, key, resultDescriptor);
}
}
finally {
endBatch$$1();
}
}
function getDependencyTree$$1(thing, property) {
return nodeToDependencyTree(getAtom$$1(thing, property));
}
function nodeToDependencyTree(node) {
var result = {
name: node.name
};
if (node.observing && node.observing.length > 0)
result.dependencies = unique$$1(node.observing).map(nodeToDependencyTree);
return result;
}
function getObserverTree$$1(thing, property) {
return nodeToObserverTree(getAtom$$1(thing, property));
}
function nodeToObserverTree(node) {
var result = {
name: node.name
};
if (hasObservers$$1(node))
result.observers = Array.from(getObservers$$1(node)).map(nodeToObserverTree);
return result;
}
var generatorId = 0;
function flow$$1(generator) {
if (arguments.length !== 1)
fail$$1(process.env.NODE_ENV && "Flow expects one 1 argument and cannot be used as decorator");
var name = generator.name || "<unnamed flow>";
// Implementation based on https://github.com/tj/co/blob/master/index.js
return function () {
var ctx = this;
var args = arguments;
var runId = ++generatorId;
var gen = action$$1(name + " - runid: " + runId + " - init", generator).apply(ctx, args);
var rejector;
var pendingPromise = undefined;
var res = new Promise(function (resolve, reject) {
var stepId = 0;
rejector = reject;
function onFulfilled(res) {
pendingPromise = undefined;
var ret;
try {
ret = action$$1(name + " - runid: " + runId + " - yield " + stepId++, gen.next).call(gen, res);
}
catch (e) {
return reject(e);
}
next(ret);
}
function onRejected(err) {
pendingPromise = undefined;
var ret;
try {
ret = action$$1(name + " - runid: " + runId + " - yield " + stepId++, gen.throw).call(gen, err);
}
catch (e) {
return reject(e);
}
next(ret);
}
function next(ret) {
if (ret && typeof ret.then === "function") {
// an async iterator
ret.then(next, reject);
return;
}
if (ret.done)
return resolve(ret.value);
pendingPromise = Promise.resolve(ret.value);
return pendingPromise.then(onFulfilled, onRejected);
}
onFulfilled(undefined); // kick off the process
});
res.cancel = action$$1(name + " - runid: " + runId + " - cancel", function () {
try {
if (pendingPromise)
cancelPromise(pendingPromise);
// Finally block can return (or yield) stuff..
var res_1 = gen.return();
// eat anything that promise would do, it's cancelled!
var yieldedPromise = Promise.resolve(res_1.value);
yieldedPromise.then(noop$$1, noop$$1);
cancelPromise(yieldedPromise); // maybe it can be cancelled :)
// reject our original promise
rejector(new Error("FLOW_CANCELLED"));
}
catch (e) {
rejector(e); // there could be a throwing finally block
}
});
return res;
};
}
function cancelPromise(promise) {
if (typeof promise.cancel === "function")
promise.cancel();
}
function interceptReads$$1(thing, propOrHandler, handler) {
var target;
if (isObservableMap$$1(thing) || isObservableArray$$1(thing) || isObservableValue$$1(thing)) {
target = getAdministration$$1(thing);
}
else if (isObservableObject$$1(thing)) {
if (typeof propOrHandler !== "string")
return fail$$1(process.env.NODE_ENV !== "production" &&
"InterceptReads can only be used with a specific property, not with an object in general");
target = getAdministration$$1(thing, propOrHandler);
}
else {
return fail$$1(process.env.NODE_ENV !== "production" &&
"Expected observable map, object or array as first array");
}
if (target.dehancer !== undefined)
return fail$$1(process.env.NODE_ENV !== "production" && "An intercept reader was already established");
target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
return function () {
target.dehancer = undefined;
};
}
function intercept$$1(thing, propOrHandler, handler) {
if (typeof handler === "function")
return interceptProperty(thing, propOrHandler, handler);
else
return interceptInterceptable(thing, propOrHandler);
}
function interceptInterceptable(thing, handler) {
return getAdministration$$1(thing).intercept(handler);
}
function interceptProperty(thing, property, handler) {
return getAdministration$$1(thing, property).intercept(handler);
}
function _isComputed$$1(value, property) {
if (value === null || value === undefined)
return false;
if (property !== undefined) {
if (isObservableObject$$1(value) === false)
return false;
if (!value[$mobx$$1].values.has(property))
return false;
var atom = getAtom$$1(value, property);
return isComputedValue$$1(atom);
}
return isComputedValue$$1(value);
}
function isComputed$$1(value) {
if (arguments.length > 1)
return fail$$1(process.env.NODE_ENV !== "production" &&
"isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property");
return _isComputed$$1(value);
}
function isComputedProp$$1(value, propName) {
if (typeof propName !== "string")
return fail$$1(process.env.NODE_ENV !== "production" &&
"isComputed expected a property name as second argument");
return _isComputed$$1(value, propName);
}
function _isObservable(value, property) {
if (value === null || value === undefined)
return false;
if (property !== undefined) {
if (process.env.NODE_ENV !== "production" &&
(isObservableMap$$1(value) || isObservableArray$$1(value)))
return fail$$1("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
if (isObservableObject$$1(value)) {
return value[$mobx$$1].values.has(property);
}
return false;
}
// For first check, see #701
return (isObservableObject$$1(value) ||
!!value[$mobx$$1] ||
isAtom$$1(value) ||
isReaction$$1(value) ||
isComputedValue$$1(value));
}
function isObservable$$1(value) {
if (arguments.length !== 1)
fail$$1(process.env.NODE_ENV !== "production" &&
"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
return _isObservable(value);
}
function isObservableProp$$1(value, propName) {
if (typeof propName !== "string")
return fail$$1(process.env.NODE_ENV !== "production" && "expected a property name as second argument");
return _isObservable(value, propName);
}
function keys$$1(obj) {
if (isObservableObject$$1(obj)) {
return obj[$mobx$$1].getKeys();
}
if (isObservableMap$$1(obj)) {
return Array.from(obj.keys());
}
if (isObservableArray$$1(obj)) {
return obj.map(function (_, index) { return index; });
}
return fail$$1(process.env.NODE_ENV !== "production" &&
"'keys()' can only be used on observable objects, arrays and maps");
}
function values$$1(obj) {
if (isObservableObject$$1(obj)) {
return keys$$1(obj).map(function (key) { return obj[key]; });
}
if (isObservableMap$$1(obj)) {
return keys$$1(obj).map(function (key) { return obj.get(key); });
}
if (isObservableArray$$1(obj)) {
return obj.slice();
}
return fail$$1(process.env.NODE_ENV !== "production" &&
"'values()' can only be used on observable objects, arrays and maps");
}
function entries$$1(obj) {
if (isObservableObject$$1(obj)) {
return keys$$1(obj).map(function (key) { return [key, obj[key]]; });
}
if (isObservableMap$$1(obj)) {
return keys$$1(obj).map(function (key) { return [key, obj.get(key)]; });
}
if (isObservableArray$$1(obj)) {
return obj.map(function (key, index) { return [index, key]; });
}
return fail$$1(process.env.NODE_ENV !== "production" &&
"'entries()' can only be used on observable objects, arrays and maps");
}
function set$$1(obj, key, value) {
if (arguments.length === 2) {
startBatch$$1();
var values_1 = key;
try {
for (var key_1 in values_1)
set$$1(obj, key_1, values_1[key_1]);
}
finally {
endBatch$$1();
}
return;
}
if (isObservableObject$$1(obj)) {
var adm = obj[$mobx$$1];
var existingObservable = adm.values.get(key);
if (existingObservable) {
adm.write(key, value);
}
else {
adm.addObservableProp(key, value, adm.defaultEnhancer);
}
}
else if (isObservableMap$$1(obj)) {
obj.set(key, value);
}
else if (isObservableArray$$1(obj)) {
if (typeof key !== "number")
key = parseInt(key, 10);
invariant$$1(key >= 0, "Not a valid index: '" + key + "'");
startBatch$$1();
if (key >= obj.length)
obj.length = key + 1;
obj[key] = value;
endBatch$$1();
}
else {
return fail$$1(process.env.NODE_ENV !== "production" &&
"'set()' can only be used on observable objects, arrays and maps");
}
}
function remove$$1(obj, key) {
if (isObservableObject$$1(obj)) {
obj[$mobx$$1].remove(key);
}
else if (isObservableMap$$1(obj)) {
obj.delete(key);
}
else if (isObservableArray$$1(obj)) {
if (typeof key !== "number")
key = parseInt(key, 10);
invariant$$1(key >= 0, "Not a valid index: '" + key + "'");
obj.splice(key, 1);
}
else {
return fail$$1(process.env.NODE_ENV !== "production" &&
"'remove()' can only be used on observable objects, arrays and maps");
}
}
function has$$1(obj, key) {
if (isObservableObject$$1(obj)) {
// return keys(obj).indexOf(key) >= 0
var adm = getAdministration$$1(obj);
return adm.has(key);
}
else if (isObservableMap$$1(obj)) {
return obj.has(key);
}
else if (isObservableArray$$1(obj)) {
return key >= 0 && key < obj.length;
}
else {
return fail$$1(process.env.NODE_ENV !== "production" &&
"'has()' can only be used on observable objects, arrays and maps");
}
}
function get$$1(obj, key) {
if (!has$$1(obj, key))
return undefined;
if (isObservableObject$$1(obj)) {
return obj[key];
}
else if (isObservableMap$$1(obj)) {
return obj.get(key);
}
else if (isObservableArray$$1(obj)) {
return obj[key];
}
else {
return fail$$1(process.env.NODE_ENV !== "production" &&
"'get()' can only be used on observable objects, arrays and maps");
}
}
function observe$$1(thing, propOrCb, cbOrFire, fireImmediately) {
if (typeof cbOrFire === "function")
return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
else
return observeObservable(thing, propOrCb, cbOrFire);
}
function observeObservable(thing, listener, fireImmediately) {
return getAdministration$$1(thing).observe(listener, fireImmediately);
}
function observeObservableProperty(thing, property, listener, fireImmediately) {
return getAdministration$$1(thing, property).observe(listener, fireImmediately);
}
var defaultOptions = {
detectCycles: true,
exportMapsAsObjects: true,
recurseEverything: false
};
function cache(map, key, value, options) {
if (options.detectCycles)
map.set(key, value);
return value;
}
function toJSHelper(source, options, __alreadySeen) {
if (!options.recurseEverything && !isObservable$$1(source))
return source;
if (typeof source !== "object")
return source;
// Directly return null if source is null
if (source === null)
return null;
// Directly return the Date object itself if contained in the observable
if (source instanceof Date)
return source;
if (isObservableValue$$1(source))
return toJSHelper(source.get(), options, __alreadySeen);
// make sure we track the keys of the object
if (isObservable$$1(source))
keys$$1(source);
var detectCycles = options.detectCycles === true;
if (detectCycles && source !== null && __alreadySeen.has(source)) {
return __alreadySeen.get(source);
}
if (isObservableArray$$1(source) || Array.isArray(source)) {
var res_1 = cache(__alreadySeen, source, [], options);
var toAdd = source.map(function (value) { return toJSHelper(value, options, __alreadySeen); });
res_1.length = toAdd.length;
for (var i = 0, l = toAdd.length; i < l; i++)
res_1[i] = toAdd[i];
return res_1;
}
if (isObservableMap$$1(source) || Object.getPrototypeOf(source) === Map.prototype) {
if (options.exportMapsAsObjects === false) {
var res_2 = cache(__alreadySeen, source, new Map(), options);
source.forEach(function (value, key) {
res_2.set(key, toJSHelper(value, options, __alreadySeen));
});
return res_2;
}
else {
var res_3 = cache(__alreadySeen, source, {}, options);
source.forEach(function (value, key) {
res_3[key] = toJSHelper(value, options, __alreadySeen);
});
return res_3;
}
}
// Fallback to the situation that source is an ObservableObject or a plain object
var res = cache(__alreadySeen, source, {}, options);
for (var key in source) {
res[key] = toJSHelper(source[key], options, __alreadySeen);
}
return res;
}
function toJS$$1(source, options) {
// backward compatibility
if (typeof options === "boolean")
options = { detectCycles: options };
if (!options)
options = defaultOptions;
options.detectCycles =
options.detectCycles === undefined
? options.recurseEverything === true
: options.detectCycles === true;
var __alreadySeen;
if (options.detectCycles)
__alreadySeen = new Map();
return toJSHelper(source, options, __alreadySeen);
}
function trace$$1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var enterBreakPoint = false;
if (typeof args[args.length - 1] === "boolean")
enterBreakPoint = args.pop();
var derivation = getAtomFromArgs(args);
if (!derivation) {
return fail$$1(process.env.NODE_ENV !== "production" &&
"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");
}
if (derivation.isTracing === TraceMode$$1.NONE) {
console.log("[mobx.trace] '" + derivation.name + "' tracing enabled");
}
derivation.isTracing = enterBreakPoint ? TraceMode$$1.BREAK : TraceMode$$1.LOG;
}
function getAtomFromArgs(args) {
switch (args.length) {
case 0:
return globalState$$1.trackingDerivation;
case 1:
return getAtom$$1(args[0]);
case 2:
return getAtom$$1(args[0], args[1]);
}
}
/**
* During a transaction no views are updated until the end of the transaction.
* The transaction will be run synchronously nonetheless.
*
* @param action a function that updates some reactive state
* @returns any value that was returned by the 'action' parameter.
*/
function transaction$$1(action$$1, thisArg) {
if (thisArg === void 0) { thisArg = undefined; }
startBatch$$1();
try {
return action$$1.apply(thisArg);
}
finally {
endBatch$$1();
}
}
function when$$1(predicate, arg1, arg2) {
if (arguments.length === 1 || (arg1 && typeof arg1 === "object"))
return whenPromise(predicate, arg1);
return _when(predicate, arg1, arg2 || {});
}
function _when(predicate, effect, opts) {
var timeoutHandle;
if (typeof opts.timeout === "number") {
timeoutHandle = setTimeout(function () {
if (!disposer[$mobx$$1].isDisposed) {
disposer();
var error = new Error("WHEN_TIMEOUT");
if (opts.onError)
opts.onError(error);
else
throw error;
}
}, opts.timeout);
}
opts.name = opts.name || "When@" + getNextId$$1();
var effectAction = createAction$$1(opts.name + "-effect", effect);
var disposer = autorun$$1(function (r) {
if (predicate()) {
r.dispose();
if (timeoutHandle)
clearTimeout(timeoutHandle);
effectAction();
}
}, opts);
return disposer;
}
function whenPromise(predicate, opts) {
if (process.env.NODE_ENV !== "production" && opts && opts.onError)
return fail$$1("the options 'onError' and 'promise' cannot be combined");
var cancel;
var res = new Promise(function (resolve, reject) {
var disposer = _when(predicate, resolve, __assign({}, opts, { onError: reject }));
cancel = function () {
disposer();
reject("WHEN_CANCELLED");
};
});
res.cancel = cancel;
return res;
}
function getAdm(target) {
return target[$mobx$$1];
}
// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,
// and skip either the internal values map, or the base object with its property descriptors!
var objectProxyTraps = {
has: function (target, name) {
if (name === $mobx$$1 || name === "constructor" || name === mobxDidRunLazyInitializersSymbol$$1)
return true;
var adm = getAdm(target);
// MWE: should `in` operator be reactive? If not, below code path will be faster / more memory efficient
// TODO: check performance stats!
// if (adm.values.get(name as string)) return true
if (typeof name === "string")
return adm.has(name);
return name in target;
},
get: function (target, name) {
if (name === $mobx$$1 || name === "constructor" || name === mobxDidRunLazyInitializersSymbol$$1)
return target[name];
var adm = getAdm(target);
var observable$$1 = adm.values.get(name);
if (observable$$1 instanceof Atom$$1) {
var result = observable$$1.get();
if (result === undefined) {
// This fixes #1796, because deleting a prop that has an
// undefined value won't retrigger a observer (no visible effect),
// the autorun wouldn't subscribe to future key changes (see also next comment)
adm.has(name);
}
return result;
}
// make sure we start listening to future keys
// note that we only do this here for optimization
if (typeof name === "string")
adm.has(name);
return target[name];
},
set: function (target, name, value) {
if (typeof name !== "string")
return false;
set$$1(target, name, value);
return true;
},
deleteProperty: function (target, name) {
if (typeof name !== "string")
return false;
var adm = getAdm(target);
adm.remove(name);
return true;
},
ownKeys: function (target) {
var adm = getAdm(target);
adm.keysAtom.reportObserved();
return Reflect.ownKeys(target);
},
preventExtensions: function (target) {
fail$$1("Dynamic observable objects cannot be frozen");
return false;
}
};
function createDynamicObservableObject$$1(base) {
var proxy = new Proxy(base, objectProxyTraps);
base[$mobx$$1].proxy = proxy;
return proxy;
}
function hasInterceptors$$1(interceptable) {
return interceptable.interceptors !== undefined && interceptable.interceptors.length > 0;
}
function registerInterceptor$$1(interceptable, handler) {
var interceptors = interceptable.interceptors || (interceptable.interceptors = []);
interceptors.push(handler);
return once$$1(function () {
var idx = interceptors.indexOf(handler);
if (idx !== -1)
interceptors.splice(idx, 1);
});
}
function interceptChange$$1(interceptable, change) {
var prevU = untrackedStart$$1();
try {
var interceptors = interceptable.interceptors;
if (interceptors)
for (var i = 0, l = interceptors.length; i < l; i++) {
change = interceptors[i](change);
invariant$$1(!change || change.type, "Intercept handlers should return nothing or a change object");
if (!change)
break;
}
return change;
}
finally {
untrackedEnd$$1(prevU);
}
}
function hasListeners$$1(listenable) {
return listenable.changeListeners !== undefined && listenable.changeListeners.length > 0;
}
function registerListener$$1(listenable, handler) {
var listeners = listenable.changeListeners || (listenable.changeListeners = []);
listeners.push(handler);
return once$$1(function () {
var idx = listeners.indexOf(handler);
if (idx !== -1)
listeners.splice(idx, 1);
});
}
function notifyListeners$$1(listenable, change) {
var prevU = untrackedStart$$1();
var listeners = listenable.changeListeners;
if (!listeners)
return;
listeners = listeners.slice();
for (var i = 0, l = listeners.length; i < l; i++) {
listeners[i](change);
}
untrackedEnd$$1(prevU);
}
var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859
var arrayTraps = {
get: function (target, name) {
if (name === $mobx$$1)
return target[$mobx$$1];
if (name === "length")
return target[$mobx$$1].getArrayLength();
if (typeof name === "number") {
return arrayExtensions.get.call(target, name);
}
if (typeof name === "string" && !isNaN(name)) {
return arrayExtensions.get.call(target, parseInt(name));
}
if (arrayExtensions.hasOwnProperty(name)) {
return arrayExtensions[name];
}
return target[name];
},
set: function (target, name, value) {
if (name === "length") {
target[$mobx$$1].setArrayLength(value);
return true;
}
if (typeof name === "number") {
arrayExtensions.set.call(target, name, value);
return true;
}
if (!isNaN(name)) {
arrayExtensions.set.call(target, parseInt(name), value);
return true;
}
return false;
},
preventExtensions: function (target) {
fail$$1("Observable arrays cannot be frozen");
return false;
}
};
function createObservableArray$$1(initialValues, enhancer, name, owned) {
if (name === void 0) { name = "ObservableArray@" + getNextId$$1(); }
if (owned === void 0) { owned = false; }
var adm = new ObservableArrayAdministration(name, enhancer, owned);
addHiddenFinalProp$$1(adm.values, $mobx$$1, adm);
var proxy = new Proxy(adm.values, arrayTraps);
adm.proxy = proxy;
if (initialValues && initialValues.length) {
var prev = allowStateChangesStart$$1(true);
adm.spliceWithArray(0, 0, initialValues);
allowStateChangesEnd$$1(prev);
}
return proxy;
}
var ObservableArrayAdministration = /** @class */ (function () {
function ObservableArrayAdministration(name, enhancer, owned) {
this.owned = owned;
this.values = [];
this.proxy = undefined;
this.lastKnownLength = 0;
this.atom = new Atom$$1(name || "ObservableArray@" + getNextId$$1());
this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); };
}
ObservableArrayAdministration.prototype.dehanceValue = function (value) {
if (this.dehancer !== undefined)
return this.dehancer(value);
return value;
};
ObservableArrayAdministration.prototype.dehanceValues = function (values$$1) {
if (this.dehancer !== undefined && values$$1.length > 0)
return values$$1.map(this.dehancer);
return values$$1;
};
ObservableArrayAdministration.prototype.intercept = function (handler) {
return registerInterceptor$$1(this, handler);
};
ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) {
if (fireImmediately === void 0) { fireImmediately = false; }
if (fireImmediately) {
listener({
object: this.proxy,
type: "splice",
index: 0,
added: this.values.slice(),
addedCount: this.values.length,
removed: [],
removedCount: 0
});
}
return registerListener$$1(this, listener);
};
ObservableArrayAdministration.prototype.getArrayLength = function () {
this.atom.reportObserved();
return this.values.length;
};
ObservableArrayAdministration.prototype.setArrayLength = function (newLength) {
if (typeof newLength !== "number" || newLength < 0)
throw new Error("[mobx.array] Out of range: " + newLength);
var currentLength = this.values.length;
if (newLength === currentLength)
return;
else if (newLength > currentLength) {
var newItems = new Array(newLength - currentLength);
for (var i = 0; i < newLength - currentLength; i++)
newItems[i] = undefined; // No Array.fill everywhere...
this.spliceWithArray(currentLength, 0, newItems);
}
else
this.spliceWithArray(newLength, currentLength - newLength);
};
ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) {
if (oldLength !== this.lastKnownLength)
throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");
this.lastKnownLength += delta;
};
ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) {
var _this = this;
checkIfStateModificationsAreAllowed$$1(this.atom);
var length = this.values.length;
if (index === undefined)
index = 0;
else if (index > length)
index = length;
else if (index < 0)
index = Math.max(0, length + index);
if (arguments.length === 1)
deleteCount = length - index;
else if (deleteCount === undefined || deleteCount === null)
deleteCount = 0;
else
deleteCount = Math.max(0, Math.min(deleteCount, length - index));
if (newItems === undefined)
newItems = EMPTY_ARRAY$$1;
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
object: this.proxy,
type: "splice",
index: index,
removedCount: deleteCount,
added: newItems
});
if (!change)
return EMPTY_ARRAY$$1;
deleteCount = change.removedCount;
newItems = change.added;
}
newItems = newItems.length === 0 ? newItems : newItems.map(function (v) { return _this.enhancer(v, undefined); });
if (process.env.NODE_ENV !== "production") {
var lengthDelta = newItems.length - deleteCount;
this.updateArrayLength(length, lengthDelta); // checks if internal array wasn't modified
}
var res = this.spliceItemsIntoValues(index, deleteCount, newItems);
if (deleteCount !== 0 || newItems.length !== 0)
this.notifyArraySplice(index, newItems, res);
return this.dehanceValues(res);
};
ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) {
var _a;
if (newItems.length < MAX_SPLICE_SIZE) {
return (_a = this.values).splice.apply(_a, __spread([index, deleteCount], newItems));
}
else {
var res = this.values.slice(index, index + deleteCount);
this.values = this.values
.slice(0, index)
.concat(newItems, this.values.slice(index + deleteCount));
return res;
}
};
ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) {
var notifySpy = !this.owned && isSpyEnabled$$1();
var notify = hasListeners$$1(this);
var change = notify || notifySpy
? {
object: this.proxy,
type: "update",
index: index,
newValue: newValue,
oldValue: oldValue
}
: null;
// The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't
// cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.atom.name }));
this.atom.reportChanged();
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
};
ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) {
var notifySpy = !this.owned && isSpyEnabled$$1();
var notify = hasListeners$$1(this);
var change = notify || notifySpy
? {
object: this.proxy,
type: "splice",
index: index,
removed: removed,
added: added,
removedCount: removed.length,
addedCount: added.length
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.atom.name }));
this.atom.reportChanged();
// conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
};
return ObservableArrayAdministration;
}());
var arrayExtensions = {
intercept: function (handler) {
return this[$mobx$$1].intercept(handler);
},
observe: function (listener, fireImmediately) {
if (fireImmediately === void 0) { fireImmediately = false; }
var adm = this[$mobx$$1];
return adm.observe(listener, fireImmediately);
},
clear: function () {
return this.splice(0);
},
replace: function (newItems) {
var adm = this[$mobx$$1];
return adm.spliceWithArray(0, adm.values.length, newItems);
},
/**
* Converts this array back to a (shallow) javascript structure.
* For a deep clone use mobx.toJS
*/
toJS: function () {
return this.slice();
},
toJSON: function () {
// Used by JSON.stringify
return this.toJS();
},
/*
* functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
* since these functions alter the inner structure of the array, the have side effects.
* Because the have side effects, they should not be used in computed function,
* and for that reason the do not call dependencyState.notifyObserved
*/
splice: function (index, deleteCount) {
var newItems = [];
for (var _i = 2; _i < arguments.length; _i++) {
newItems[_i - 2] = arguments[_i];
}
var adm = this[$mobx$$1];
switch (arguments.length) {
case 0:
return [];
case 1:
return adm.spliceWithArray(index);
case 2:
return adm.spliceWithArray(index, deleteCount);
}
return adm.spliceWithArray(index, deleteCount, newItems);
},
spliceWithArray: function (index, deleteCount, newItems) {
var adm = this[$mobx$$1];
return adm.spliceWithArray(index, deleteCount, newItems);
},
push: function () {
var items = [];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i] = arguments[_i];
}
var adm = this[$mobx$$1];
adm.spliceWithArray(adm.values.length, 0, items);
return adm.values.length;
},
pop: function () {
return this.splice(Math.max(this[$mobx$$1].values.length - 1, 0), 1)[0];
},
shift: function () {
return this.splice(0, 1)[0];
},
unshift: function () {
var items = [];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i] = arguments[_i];
}
var adm = this[$mobx$$1];
adm.spliceWithArray(0, 0, items);
return adm.values.length;
},
reverse: function () {
// reverse by default mutates in place before returning the result
// which makes it both a 'derivation' and a 'mutation'.
// so we deviate from the default and just make it an dervitation
if (process.env.NODE_ENV !== "production") {
console.warn("[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place");
}
var clone = this.slice();
return clone.reverse.apply(clone, arguments);
},
sort: function (compareFn) {
// sort by default mutates in place before returning the result
// which goes against all good practices. Let's not change the array in place!
if (process.env.NODE_ENV !== "production") {
console.warn("[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place");
}
var clone = this.slice();
return clone.sort.apply(clone, arguments);
},
remove: function (value) {
var adm = this[$mobx$$1];
var idx = adm.dehanceValues(adm.values).indexOf(value);
if (idx > -1) {
this.splice(idx, 1);
return true;
}
return false;
},
get: function (index) {
var adm = this[$mobx$$1];
if (adm) {
if (index < adm.values.length) {
adm.atom.reportObserved();
return adm.dehanceValue(adm.values[index]);
}
console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + adm.values.length + "). Please check length first. Out of bound indices will not be tracked by MobX");
}
return undefined;
},
set: function (index, newValue) {
var adm = this[$mobx$$1];
var values$$1 = adm.values;
if (index < values$$1.length) {
// update at index in range
checkIfStateModificationsAreAllowed$$1(adm.atom);
var oldValue = values$$1[index];
if (hasInterceptors$$1(adm)) {
var change = interceptChange$$1(adm, {
type: "update",
object: this,
index: index,
newValue: newValue
});
if (!change)
return;
newValue = change.newValue;
}
newValue = adm.enhancer(newValue, oldValue);
var changed = newValue !== oldValue;
if (changed) {
values$$1[index] = newValue;
adm.notifyArrayChildUpdate(index, newValue, oldValue);
}
}
else if (index === values$$1.length) {
// add a new item
adm.spliceWithArray(index, 0, [newValue]);
}
else {
// out of bounds
throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values$$1.length);
}
}
};
[
"concat",
"every",
"filter",
"forEach",
"indexOf",
"join",
"lastIndexOf",
"map",
"reduce",
"reduceRight",
"slice",
"some",
"toString",
"toLocaleString"
].forEach(function (funcName) {
arrayExtensions[funcName] = function () {
var adm = this[$mobx$$1];
adm.atom.reportObserved();
var res = adm.dehanceValues(adm.values);
return res[funcName].apply(res, arguments);
};
});
var isObservableArrayAdministration = createInstanceofPredicate$$1("ObservableArrayAdministration", ObservableArrayAdministration);
function isObservableArray$$1(thing) {
return isObject$$1(thing) && isObservableArrayAdministration(thing[$mobx$$1]);
}
var _a;
var ObservableMapMarker = {};
// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
// But: https://github.com/mobxjs/mobx/issues/1556
var ObservableMap$$1 = /** @class */ (function () {
function ObservableMap$$1(initialData, enhancer, name) {
if (enhancer === void 0) { enhancer = deepEnhancer$$1; }
if (name === void 0) { name = "ObservableMap@" + getNextId$$1(); }
this.enhancer = enhancer;
this.name = name;
this[_a] = ObservableMapMarker;
this._keysAtom = createAtom$$1(this.name + ".keys()");
this[Symbol.toStringTag] = "Map";
if (typeof Map !== "function") {
throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");
}
this._data = new Map();
this._hasMap = new Map();
this.merge(initialData);
}
ObservableMap$$1.prototype._has = function (key) {
return this._data.has(key);
};
ObservableMap$$1.prototype.has = function (key) {
if (this._hasMap.has(key))
return this._hasMap.get(key).get();
return this._updateHasMapEntry(key, false).get();
};
ObservableMap$$1.prototype.set = function (key, value) {
var hasKey = this._has(key);
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
type: hasKey ? "update" : "add",
object: this,
newValue: value,
name: key
});
if (!change)
return this;
value = change.newValue;
}
if (hasKey) {
this._updateValue(key, value);
}
else {
this._addValue(key, value);
}
return this;
};
ObservableMap$$1.prototype.delete = function (key) {
var _this = this;
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
type: "delete",
object: this,
name: key
});
if (!change)
return false;
}
if (this._has(key)) {
var notifySpy = isSpyEnabled$$1();
var notify = hasListeners$$1(this);
var change = notify || notifySpy
? {
type: "delete",
object: this,
oldValue: this._data.get(key).value,
name: key
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
transaction$$1(function () {
_this._keysAtom.reportChanged();
_this._updateHasMapEntry(key, false);
var observable$$1 = _this._data.get(key);
observable$$1.setNewValue(undefined);
_this._data.delete(key);
});
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
return true;
}
return false;
};
ObservableMap$$1.prototype._updateHasMapEntry = function (key, value) {
// optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore
var entry = this._hasMap.get(key);
if (entry) {
entry.setNewValue(value);
}
else {
entry = new ObservableValue$$1(value, referenceEnhancer$$1, this.name + "." + key + "?", false);
this._hasMap.set(key, entry);
}
return entry;
};
ObservableMap$$1.prototype._updateValue = function (key, newValue) {
var observable$$1 = this._data.get(key);
newValue = observable$$1.prepareNewValue(newValue);
if (newValue !== globalState$$1.UNCHANGED) {
var notifySpy = isSpyEnabled$$1();
var notify = hasListeners$$1(this);
var change = notify || notifySpy
? {
type: "update",
object: this,
oldValue: observable$$1.value,
name: key,
newValue: newValue
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
observable$$1.setNewValue(newValue);
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
}
};
ObservableMap$$1.prototype._addValue = function (key, newValue) {
var _this = this;
checkIfStateModificationsAreAllowed$$1(this._keysAtom);
transaction$$1(function () {
var observable$$1 = new ObservableValue$$1(newValue, _this.enhancer, _this.name + "." + key, false);
_this._data.set(key, observable$$1);
newValue = observable$$1.value; // value might have been changed
_this._updateHasMapEntry(key, true);
_this._keysAtom.reportChanged();
});
var notifySpy = isSpyEnabled$$1();
var notify = hasListeners$$1(this);
var change = notify || notifySpy
? {
type: "add",
object: this,
name: key,
newValue: newValue
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
};
ObservableMap$$1.prototype.get = function (key) {
if (this.has(key))
return this.dehanceValue(this._data.get(key).get());
return this.dehanceValue(undefined);
};
ObservableMap$$1.prototype.dehanceValue = function (value) {
if (this.dehancer !== undefined) {
return this.dehancer(value);
}
return value;
};
ObservableMap$$1.prototype.keys = function () {
this._keysAtom.reportObserved();
return this._data.keys();
};
ObservableMap$$1.prototype.values = function () {
var self = this;
var nextIndex = 0;
var keys$$1 = Array.from(this.keys());
return makeIterable({
next: function () {
return nextIndex < keys$$1.length
? { value: self.get(keys$$1[nextIndex++]), done: false }
: { done: true };
}
});
};
ObservableMap$$1.prototype.entries = function () {
var self = this;
var nextIndex = 0;
var keys$$1 = Array.from(this.keys());
return makeIterable({
next: function () {
if (nextIndex < keys$$1.length) {
var key = keys$$1[nextIndex++];
return {
value: [key, self.get(key)],
done: false
};
}
return { done: true };
}
});
};
ObservableMap$$1.prototype[(_a = $mobx$$1, Symbol.iterator)] = function () {
return this.entries();
};
ObservableMap$$1.prototype.forEach = function (callback, thisArg) {
var e_1, _a;
try {
for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
callback.call(thisArg, value, key, this);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
/** Merge another object into this object, returns this. */
ObservableMap$$1.prototype.merge = function (other) {
var _this = this;
if (isObservableMap$$1(other)) {
other = other.toJS();
}
transaction$$1(function () {
if (isPlainObject$$1(other))
Object.keys(other).forEach(function (key) { return _this.set(key, other[key]); });
else if (Array.isArray(other))
other.forEach(function (_a) {
var _b = __read(_a, 2), key = _b[0], value = _b[1];
return _this.set(key, value);
});
else if (isES6Map$$1(other))
other.forEach(function (value, key) { return _this.set(key, value); });
else if (other !== null && other !== undefined)
fail$$1("Cannot initialize map from " + other);
});
return this;
};
ObservableMap$$1.prototype.clear = function () {
var _this = this;
transaction$$1(function () {
untracked$$1(function () {
var e_2, _a;
try {
for (var _b = __values(_this.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_this.delete(key);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
});
});
};
ObservableMap$$1.prototype.replace = function (values$$1) {
var _this = this;
transaction$$1(function () {
// grab all the keys that are present in the new map but not present in the current map
// and delete them from the map, then merge the new map
// this will cause reactions only on changed values
var newKeys = getMapLikeKeys$$1(values$$1);
var oldKeys = Array.from(_this.keys());
var missingKeys = oldKeys.filter(function (k) { return newKeys.indexOf(k) === -1; });
missingKeys.forEach(function (k) { return _this.delete(k); });
_this.merge(values$$1);
});
return this;
};
Object.defineProperty(ObservableMap$$1.prototype, "size", {
get: function () {
this._keysAtom.reportObserved();
return this._data.size;
},
enumerable: true,
configurable: true
});
/**
* Returns a plain object that represents this map.
* Note that all the keys being stringified.
* If there are duplicating keys after converting them to strings, behaviour is undetermined.
*/
ObservableMap$$1.prototype.toPOJO = function () {
var e_3, _a;
var res = {};
try {
for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
res["" + key] = value;
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
return res;
};
/**
* Returns a shallow non observable object clone of this map.
* Note that the values migth still be observable. For a deep clone use mobx.toJS.
*/
ObservableMap$$1.prototype.toJS = function () {
return new Map(this);
};
ObservableMap$$1.prototype.toJSON = function () {
// Used by JSON.stringify
return this.toPOJO();
};
ObservableMap$$1.prototype.toString = function () {
var _this = this;
return (this.name +
"[{ " +
Array.from(this.keys())
.map(function (key) { return key + ": " + ("" + _this.get(key)); })
.join(", ") +
" }]");
};
/**
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
* for callback details
*/
ObservableMap$$1.prototype.observe = function (listener, fireImmediately) {
process.env.NODE_ENV !== "production" &&
invariant$$1(fireImmediately !== true, "`observe` doesn't support fireImmediately=true in combination with maps.");
return registerListener$$1(this, listener);
};
ObservableMap$$1.prototype.intercept = function (handler) {
return registerInterceptor$$1(this, handler);
};
return ObservableMap$$1;
}());
/* 'var' fixes small-build issue */
var isObservableMap$$1 = createInstanceofPredicate$$1("ObservableMap", ObservableMap$$1);
var ObservableObjectAdministration$$1 = /** @class */ (function () {
function ObservableObjectAdministration$$1(target, values$$1, name, defaultEnhancer) {
if (values$$1 === void 0) { values$$1 = new Map(); }
this.target = target;
this.values = values$$1;
this.name = name;
this.defaultEnhancer = defaultEnhancer;
this.keysAtom = new Atom$$1(name + ".keys");
}
ObservableObjectAdministration$$1.prototype.read = function (key) {
return this.values.get(key).get();
};
ObservableObjectAdministration$$1.prototype.write = function (key, newValue) {
var instance = this.target;
var observable$$1 = this.values.get(key);
if (observable$$1 instanceof ComputedValue$$1) {
observable$$1.set(newValue);
return;
}
// intercept
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
type: "update",
object: this.proxy || instance,
name: key,
newValue: newValue
});
if (!change)
return;
newValue = change.newValue;
}
newValue = observable$$1.prepareNewValue(newValue);
// notify spy & observers
if (newValue !== globalState$$1.UNCHANGED) {
var notify = hasListeners$$1(this);
var notifySpy = isSpyEnabled$$1();
var change = notify || notifySpy
? {
type: "update",
object: this.proxy || instance,
oldValue: observable$$1.value,
name: key,
newValue: newValue
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
observable$$1.setNewValue(newValue);
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
}
};
ObservableObjectAdministration$$1.prototype.has = function (key) {
var map = this.pendingKeys || (this.pendingKeys = new Map());
var entry = map.get(key);
if (entry)
return entry.get();
else {
var exists = !!this.values.get(key);
// Possible optimization: Don't have a separate map for non existing keys,
// but store them in the values map instead, using a special symbol to denote "not existing"
entry = new ObservableValue$$1(exists, referenceEnhancer$$1, this.name + "." + key.toString() + "?", false);
map.set(key, entry);
return entry.get(); // read to subscribe
}
};
ObservableObjectAdministration$$1.prototype.addObservableProp = function (propName, newValue, enhancer) {
if (enhancer === void 0) { enhancer = this.defaultEnhancer; }
var target = this.target;
assertPropertyConfigurable$$1(target, propName);
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
object: this.proxy || target,
name: propName,
type: "add",
newValue: newValue
});
if (!change)
return;
newValue = change.newValue;
}
var observable$$1 = new ObservableValue$$1(newValue, enhancer, this.name + "." + propName, false);
this.values.set(propName, observable$$1);
newValue = observable$$1.value; // observableValue might have changed it
Object.defineProperty(target, propName, generateObservablePropConfig$$1(propName));
this.notifyPropertyAddition(propName, newValue);
};
ObservableObjectAdministration$$1.prototype.addComputedProp = function (propertyOwner, // where is the property declared?
propName, options) {
var target = this.target;
options.name = options.name || this.name + "." + propName;
this.values.set(propName, new ComputedValue$$1(options));
if (propertyOwner === target || isPropertyConfigurable$$1(propertyOwner, propName))
Object.defineProperty(propertyOwner, propName, generateComputedPropConfig$$1(propName));
};
ObservableObjectAdministration$$1.prototype.remove = function (key) {
if (!this.values.has(key))
return;
var target = this.target;
if (hasInterceptors$$1(this)) {
var change = interceptChange$$1(this, {
object: this.proxy || target,
name: key,
type: "remove"
});
if (!change)
return;
}
try {
startBatch$$1();
var notify = hasListeners$$1(this);
var notifySpy = isSpyEnabled$$1();
var oldObservable = this.values.get(key);
var oldValue = oldObservable && oldObservable.get();
oldObservable && oldObservable.set(undefined);
// notify key and keyset listeners
this.keysAtom.reportChanged();
this.values.delete(key);
if (this.pendingKeys) {
var entry = this.pendingKeys.get(key);
if (entry)
entry.set(false);
}
// delete the prop
delete this.target[key];
var change = notify || notifySpy
? {
type: "remove",
object: this.proxy || target,
oldValue: oldValue,
name: key
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
}
finally {
endBatch$$1();
}
};
ObservableObjectAdministration$$1.prototype.illegalAccess = function (owner, propName) {
/**
* This happens if a property is accessed through the prototype chain, but the property was
* declared directly as own property on the prototype.
*
* E.g.:
* class A {
* }
* extendObservable(A.prototype, { x: 1 })
*
* classB extens A {
* }
* console.log(new B().x)
*
* It is unclear whether the property should be considered 'static' or inherited.
* Either use `console.log(A.x)`
* or: decorate(A, { x: observable })
*
* When using decorate, the property will always be redeclared as own property on the actual instance
*/
console.warn("Property '" + propName + "' of '" + owner + "' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner");
};
/**
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
* for callback details
*/
ObservableObjectAdministration$$1.prototype.observe = function (callback, fireImmediately) {
process.env.NODE_ENV !== "production" &&
invariant$$1(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects.");
return registerListener$$1(this, callback);
};
ObservableObjectAdministration$$1.prototype.intercept = function (handler) {
return registerInterceptor$$1(this, handler);
};
ObservableObjectAdministration$$1.prototype.notifyPropertyAddition = function (key, newValue) {
var notify = hasListeners$$1(this);
var notifySpy = isSpyEnabled$$1();
var change = notify || notifySpy
? {
type: "add",
object: this.proxy || this.target,
name: key,
newValue: newValue
}
: null;
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportStart$$1(__assign({}, change, { name: this.name, key: key }));
if (notify)
notifyListeners$$1(this, change);
if (notifySpy && process.env.NODE_ENV !== "production")
spyReportEnd$$1();
if (this.pendingKeys) {
var entry = this.pendingKeys.get(key);
if (entry)
entry.set(true);
}
this.keysAtom.reportChanged();
};
ObservableObjectAdministration$$1.prototype.getKeys = function () {
var e_1, _a;
this.keysAtom.reportObserved();
// return Reflect.ownKeys(this.values) as any
var res = [];
try {
for (var _b = __values(this.values), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
if (value instanceof ObservableValue$$1)
res.push(key);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return res;
};
return ObservableObjectAdministration$$1;
}());
function asObservableObject$$1(target, name, defaultEnhancer) {
if (name === void 0) { name = ""; }
if (defaultEnhancer === void 0) { defaultEnhancer = deepEnhancer$$1; }
if (Object.prototype.hasOwnProperty.call(target, $mobx$$1))
return target[$mobx$$1];
process.env.NODE_ENV !== "production" &&
invariant$$1(Object.isExtensible(target), "Cannot make the designated object observable; it is not extensible");
if (!isPlainObject$$1(target))
name = (target.constructor.name || "ObservableObject") + "@" + getNextId$$1();
if (!name)
name = "ObservableObject@" + getNextId$$1();
var adm = new ObservableObjectAdministration$$1(target, new Map(), name, defaultEnhancer);
addHiddenProp$$1(target, $mobx$$1, adm);
return adm;
}
var observablePropertyConfigs = Object.create(null);
var computedPropertyConfigs = Object.create(null);
function generateObservablePropConfig$$1(propName) {
return (observablePropertyConfigs[propName] ||
(observablePropertyConfigs[propName] = {
configurable: true,
enumerable: true,
get: function () {
return this[$mobx$$1].read(propName);
},
set: function (v) {
this[$mobx$$1].write(propName, v);
}
}));
}
function getAdministrationForComputedPropOwner(owner) {
var adm = owner[$mobx$$1];
if (!adm) {
// because computed props are declared on proty,
// the current instance might not have been initialized yet
initializeInstance$$1(owner);
return owner[$mobx$$1];
}
return adm;
}
function generateComputedPropConfig$$1(propName) {
return (computedPropertyConfigs[propName] ||
(computedPropertyConfigs[propName] = {
configurable: true,
enumerable: false,
get: function () {
return getAdministrationForComputedPropOwner(this).read(propName);
},
set: function (v) {
getAdministrationForComputedPropOwner(this).write(propName, v);
}
}));
}
var isObservableObjectAdministration = createInstanceofPredicate$$1("ObservableObjectAdministration", ObservableObjectAdministration$$1);
function isObservableObject$$1(thing) {
if (isObject$$1(thing)) {
// Initializers run lazily when transpiling to babel, so make sure they are run...
initializeInstance$$1(thing);
return isObservableObjectAdministration(thing[$mobx$$1]);
}
return false;
}
function getAtom$$1(thing, property) {
if (typeof thing === "object" && thing !== null) {
if (isObservableArray$$1(thing)) {
if (property !== undefined)
fail$$1(process.env.NODE_ENV !== "production" &&
"It is not possible to get index atoms from arrays");
return thing[$mobx$$1].atom;
}
if (isObservableMap$$1(thing)) {
var anyThing = thing;
if (property === undefined)
return anyThing._keysAtom;
var observable$$1 = anyThing._data.get(property) || anyThing._hasMap.get(property);
if (!observable$$1)
fail$$1(process.env.NODE_ENV !== "production" &&
"the entry '" + property + "' does not exist in the observable map '" + getDebugName$$1(thing) + "'");
return observable$$1;
}
// Initializers run lazily when transpiling to babel, so make sure they are run...
initializeInstance$$1(thing);
if (property && !thing[$mobx$$1])
thing[property]; // See #1072
if (isObservableObject$$1(thing)) {
if (!property)
return fail$$1(process.env.NODE_ENV !== "production" && "please specify a property");
var observable$$1 = thing[$mobx$$1].values.get(property);
if (!observable$$1)
fail$$1(process.env.NODE_ENV !== "production" &&
"no observable property '" + property + "' found on the observable object '" + getDebugName$$1(thing) + "'");
return observable$$1;
}
if (isAtom$$1(thing) || isComputedValue$$1(thing) || isReaction$$1(thing)) {
return thing;
}
}
else if (typeof thing === "function") {
if (isReaction$$1(thing[$mobx$$1])) {
// disposer function
return thing[$mobx$$1];
}
}
return fail$$1(process.env.NODE_ENV !== "production" && "Cannot obtain atom from " + thing);
}
function getAdministration$$1(thing, property) {
if (!thing)
fail$$1("Expecting some object");
if (property !== undefined)
return getAdministration$$1(getAtom$$1(thing, property));
if (isAtom$$1(thing) || isComputedValue$$1(thing) || isReaction$$1(thing))
return thing;
if (isObservableMap$$1(thing))
return thing;
// Initializers run lazily when transpiling to babel, so make sure they are run...
initializeInstance$$1(thing);
if (thing[$mobx$$1])
return thing[$mobx$$1];
fail$$1(process.env.NODE_ENV !== "production" && "Cannot obtain administration from " + thing);
}
function getDebugName$$1(thing, property) {
var named;
if (property !== undefined)
named = getAtom$$1(thing, property);
else if (isObservableObject$$1(thing) || isObservableMap$$1(thing))
named = getAdministration$$1(thing);
else
named = getAtom$$1(thing); // valid for arrays as well
return named.name;
}
var toString = Object.prototype.toString;
function deepEqual$$1(a, b) {
return eq(a, b);
}
// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
// Internal recursive comparison function for `isEqual`.
function eq(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b)
return a !== 0 || 1 / a === 1 / b;
// `null` or `undefined` only equal to itself (strict comparison).
if (a == null || b == null)
return false;
// `NaN`s are equivalent, but non-reflexive.
if (a !== a)
return b !== b;
// Exhaust primitive checks
var type = typeof a;
if (type !== "function" && type !== "object" && typeof b != "object")
return false;
return deepEq(a, b, aStack, bStack);
}
// Internal recursive comparison function for `isEqual`.
function deepEq(a, b, aStack, bStack) {
// Unwrap any wrapped objects.
a = unwrap(a);
b = unwrap(b);
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className !== toString.call(b))
return false;
switch (className) {
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
case "[object RegExp]":
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
case "[object String]":
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return "" + a === "" + b;
case "[object Number]":
// `NaN`s are equivalent, but non-reflexive.
// Object(NaN) is equivalent to NaN.
if (+a !== +a)
return +b !== +b;
// An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case "[object Date]":
case "[object Boolean]":
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a === +b;
case "[object Symbol]":
return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b));
}
var areArrays = className === "[object Array]";
if (!areArrays) {
if (typeof a != "object" || typeof b != "object")
return false;
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor &&
!(typeof aCtor === "function" &&
aCtor instanceof aCtor &&
typeof bCtor === "function" &&
bCtor instanceof bCtor) &&
("constructor" in a && "constructor" in b)) {
return false;
}
}
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
// Initializing stack of traversed objects.
// It's done here since we only need them for objects and arrays comparison.
aStack = aStack || [];
bStack = bStack || [];
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] === a)
return bStack[length] === b;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
// Recursively compare objects and arrays.
if (areArrays) {
// Compare array lengths to determine if a deep comparison is necessary.
length = a.length;
if (length !== b.length)
return false;
// Deep compare the contents, ignoring non-numeric properties.
while (length--) {
if (!eq(a[length], b[length], aStack, bStack))
return false;
}
}
else {
// Deep compare objects.
var keys$$1 = Object.keys(a), key;
length = keys$$1.length;
// Ensure that both objects contain the same number of properties before comparing deep equality.
if (Object.keys(b).length !== length)
return false;
while (length--) {
// Deep compare each member
key = keys$$1[length];
if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack)))
return false;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return true;
}
function unwrap(a) {
if (isObservableArray$$1(a))
return a.slice();
if (isES6Map$$1(a) || isObservableMap$$1(a))
return Array.from(a.entries());
return a;
}
function has$1(a, key) {
return Object.prototype.hasOwnProperty.call(a, key);
}
function makeIterable(iterator) {
iterator[Symbol.iterator] = self;
return iterator;
}
function self() {
return this;
}
/*
The only reason for this file to exist is pure horror:
Without it rollup can make the bundling fail at any point in time; when it rolls up the files in the wrong order
it will cause undefined errors (for example because super classes or local variables not being hosted).
With this file that will still happen,
but at least in this file we can magically reorder the imports with trial and error until the build succeeds again.
*/
/**
* (c) Michel Weststrate 2015 - 2018
* MIT Licensed
*
* Welcome to the mobx sources! To get an global overview of how MobX internally works,
* this is a good place to start:
* https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
*
* Source folders:
* ===============
*
* - api/ Most of the public static methods exposed by the module can be found here.
* - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
* - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
* - utils/ Utility stuff.
*
*/
if (typeof Proxy === "undefined" || typeof Symbol === "undefined") {
throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");
}
try {
// define process.env if needed
// if this is not a production build in the first place
// (in which case the expression below would be substituted with 'production')
process.env.NODE_ENV;
}
catch (e) {
var g = typeof window !== "undefined" ? window : global;
if (typeof process === "undefined")
g.process = {};
g.process.env = {};
}
(function () {
function testCodeMinification() { }
if (testCodeMinification.name !== "testCodeMinification" &&
process.env.NODE_ENV !== "production" &&
process.env.IGNORE_MOBX_MINIFY_WARNING !== "true") {
console.warn(
// Template literal(backtick) is used for fix issue with rollup-plugin-commonjs https://github.com/rollup/rollup-plugin-commonjs/issues/344
"[mobx] you are running a minified build, but 'process.env.NODE_ENV' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle");
}
})();
// Devtools support
if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
// See: https://github.com/andykog/mobx-devtools/
__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({
spy: spy$$1,
extras: {
getDebugName: getDebugName$$1
},
$mobx: $mobx$$1
});
}
exports.Reaction = Reaction$$1;
exports.untracked = untracked$$1;
exports.createAtom = createAtom$$1;
exports.spy = spy$$1;
exports.comparer = comparer$$1;
exports.isObservableObject = isObservableObject$$1;
exports.isBoxedObservable = isObservableValue$$1;
exports.isObservableArray = isObservableArray$$1;
exports.ObservableMap = ObservableMap$$1;
exports.isObservableMap = isObservableMap$$1;
exports.transaction = transaction$$1;
exports.observable = observable$$1;
exports.computed = computed$$1;
exports.isObservable = isObservable$$1;
exports.isObservableProp = isObservableProp$$1;
exports.isComputed = isComputed$$1;
exports.isComputedProp = isComputedProp$$1;
exports.extendObservable = extendObservable$$1;
exports.observe = observe$$1;
exports.intercept = intercept$$1;
exports.autorun = autorun$$1;
exports.reaction = reaction$$1;
exports.when = when$$1;
exports.action = action$$1;
exports.isAction = isAction$$1;
exports.runInAction = runInAction$$1;
exports.keys = keys$$1;
exports.values = values$$1;
exports.entries = entries$$1;
exports.set = set$$1;
exports.remove = remove$$1;
exports.has = has$$1;
exports.get = get$$1;
exports.decorate = decorate$$1;
exports.configure = configure$$1;
exports.onBecomeObserved = onBecomeObserved$$1;
exports.onBecomeUnobserved = onBecomeUnobserved$$1;
exports.flow = flow$$1;
exports.toJS = toJS$$1;
exports.trace = trace$$1;
exports.getDependencyTree = getDependencyTree$$1;
exports.getObserverTree = getObserverTree$$1;
exports._resetGlobalState = resetGlobalState$$1;
exports._getGlobalState = getGlobalState$$1;
exports.getDebugName = getDebugName$$1;
exports.getAtom = getAtom$$1;
exports._getAdministration = getAdministration$$1;
exports._allowStateChanges = allowStateChanges$$1;
exports._allowStateChangesInsideComputed = allowStateChangesInsideComputed$$1;
exports.isArrayLike = isArrayLike$$1;
exports.$mobx = $mobx$$1;
exports._isComputingDerivation = isComputingDerivation$$1;
exports.onReactionError = onReactionError$$1;
exports._interceptReads = interceptReads$$1;
| {
"content_hash": "a5a794f0f217d4bf1c6ed9c9cbcdbd15",
"timestamp": "",
"source": "github",
"line_count": 4139,
"max_line_length": 607,
"avg_line_length": 39.71104131432713,
"alnum_prop": 0.5912304397556642,
"repo_name": "sufuf3/cdnjs",
"id": "a76b0b75f918f1bfa835cccd273f78c212304b6f",
"size": "164364",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "ajax/libs/mobx/5.8.0/mobx.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
.. _developer:
Developer Notes
===============
Adding a spectral model
-----------------------
One of the most common changes to the underlying fermitools code is to add
a new spectral model. To be able to use that model in fermipy will
require a few changes, depending on how exactly you would like you
use the model.
1. At a minimum, the model, and default values and bounds for the parameters need to
be added to ``fermipy/data/models.yaml``
2. If you want to be able to use functions that free the source-shape
parameters, fit the SED, you will want to modify the
``norm_parameters`` and ``shape_parameters`` blocks at the top of
the ``fermipy/gtanalysis.py`` file to include the new spectral
model.
3. If you want to be able to include the spectral model in an xml
'catalog' of sources that you use to define an ROI, you will have
to update the ``spectral_pars_from_catalog`` and ``get_catalog_dict``
functions in ``fermipy/roi_model.py`` to include the spectral
model.
4. If the spectral model is included in a new source catalog, and you
want to support that catalog, see the section below on supporting new
catalogs.
5. If you want to use the spectral to do more complicated things, like
vectorizing call to evalute the spectrum because you are using it
in sensitivity studies, then you will have to add it the the
``fermipy/spectrum.py`` file. That is pretty much expert territory.
Supporting a new catalog
-------------------------
To support a new catalog will require some changes in the
``fermipy/catalog.py`` file. In short
1. Define a class to manage the catalog. This will have to handle
converting the parameters in the FITS file to the format that
fermipy expects. It should inherit from the ``Catalog`` class.
2. Update the ``Catalog.create`` function to have a hook to create a
class of the correct type.
3. For now we are also maintaining the catalog files in the
``fermipy/data/catalogs`` area, so the catalog files should be
added to that area.
Installing development versions of fermitools
---------------------------------------------
To test fermipy against future versions of fermitools, use the ``rc`` (release candidate) or ``dev`` (development) versions in the respective conda channels, e.g. ``mamba install -c fermi/label/rc fermitools=2.1.36``.
Creating a New Release
----------------------
The following are steps for creating a new release:
1. Update the Changelog page (in ``docs/changelog.rst``) with notes
for the release and commit those changes.
2. Update documentation tables by running ``make_tables.py`` inside
the ``docs`` subdirectory and commit any resulting changes to the
configuration table files under ``docs/config``.
3. Checkout ``master`` and ensure that you have pulled all commits from origin.
4. Create the release tag and push it to GitHub.
.. code-block:: bash
$ git tag -a XX.YY.ZZ -m ""
$ git push --tags
5. Upload the release to pypi.
.. code-block:: bash
$ python setup.py sdist upload -r pypi
6. Create a new release on conda-forge by opening a PR on the
`fermipy-feedstock
<https://github.com/conda-forge/fermipy-feedstock>`_ repo. There
is a fork of ``fermipy-feedstock`` in the fermipy organization that
you can use for this purpose. Edit ``recipe/meta.yaml`` by
entering the new package version and updating the sha256 hash to
the value copied from the `pypi download
<https://pypi.org/project/fermipy/#files>`_ page. Update the
package dependencies as necessary in the ``run`` section of
``requirements``. Verify that ``entry_points`` contains the
desired set of command-line scripts. Generally this section should
match the contents ``entry_points`` in ``setup.py``. Before
merging the PR confirm that all tests have successfully passed.
| {
"content_hash": "0426a4e17f8913335787c0664f212f11",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 217,
"avg_line_length": 41.505376344086024,
"alnum_prop": 0.7119170984455958,
"repo_name": "fermiPy/fermipy",
"id": "ec4c073539d0c39a12c7069c668e7f9720de65d9",
"size": "3860",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/developer.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "1974073"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimpleToolbarsForms.iOS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimpleToolbarsForms.iOS")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "2fe2c40484b5ce4b39b60a3e956361b4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.416666666666664,
"alnum_prop": 0.7477096546863988,
"repo_name": "tkowalczyk/SimpleToolbarsForms",
"id": "dd181c049d7b57df2119ac2b4d899ce5a563c431",
"size": "1422",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SimpleToolbarsForms/SimpleToolbarsForms/SimpleToolbarsForms.iOS/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "8192"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "38000599335be8c3be01224b613b0abe",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "a06ad3bdb9bcf4960bf5d77650139937b1da8993",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Orobanchaceae/Pedicularis/Pedicularis mathoneti/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
namespace OceanChip.Queue.Protocols.Brokers
{
[Serializable]
public class BrokerProducerListInfo
{
public BrokerInfo BrokerInfo { get; set; }
public IList<string> ProducerList { get; set; }
public BrokerProducerListInfo()
{
ProducerList = new List<string>();
}
}
}
| {
"content_hash": "7f84d6796d40c2d08e22d8e3c2c13b3f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 55,
"avg_line_length": 23.9375,
"alnum_prop": 0.6370757180156658,
"repo_name": "OceanChip/OQueue",
"id": "0c770ee3f3ac17b3ad78d2cfc4aff78ef45b66ae",
"size": "385",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "OQueue/Protocols/NameServers/BrokerProducerListInfo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "106"
},
{
"name": "C#",
"bytes": "567323"
},
{
"name": "CSS",
"bytes": "243"
},
{
"name": "JavaScript",
"bytes": "36278"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.path.fill.winding.subtract.1</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.path.fill.winding.subtract.1</h1>
<p class="desc"></p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("");
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#f00';
ctx.moveTo(-10, -10);
ctx.lineTo(110, -10);
ctx.lineTo(110, 60);
ctx.lineTo(-10, 60);
ctx.lineTo(-10, -10);
ctx.lineTo(0, 0);
ctx.lineTo(0, 50);
ctx.lineTo(100, 50);
ctx.lineTo(100, 0);
ctx.fill();
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>
| {
"content_hash": "8307f948fe068052a5655d41301d1815",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 131,
"avg_line_length": 27.952380952380953,
"alnum_prop": 0.6712095400340715,
"repo_name": "youtube/cobalt_sandbox",
"id": "50a2a1dbb769d5385379a454995a4f9cb7ff91d7",
"size": "1174",
"binary": false,
"copies": "244",
"ref": "refs/heads/main",
"path": "third_party/web_platform_tests/2dcontext/path-objects/2d.path.fill.winding.subtract.1.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
coShaderProgram::~coShaderProgram()
{
glDeleteProgram(id);
coCHECK(glGetError() == GL_NO_ERROR, "glDeleteProgram()");
for (coShader* shader : shaders)
delete shader;
}
coResult coShaderProgram::Init(const coConstString& path)
{
//coTRY(coExists(path), "Missing: "<<path);
coDynamicString filePath;
filePath = path;
filePath << ".vert.spv";
if (coExists(filePath))
{
coUniquePtr<coShader> shader(new coShader());
coTRY(shader->Init(coShader::Type::VERTEX, path), nullptr);
coPushBack(shaders, shader.Release());
}
filePath = path;
filePath << ".geom.spv";
if (coExists(filePath))
{
coUniquePtr<coShader> shader(new coShader());
coTRY(shader->Init(coShader::Type::GEOMETRY, path), nullptr);
coPushBack(shaders, shader.Release());
}
filePath = path;
filePath << ".frag.spv";
if (coExists(filePath))
{
coUniquePtr<coShader> shader(new coShader());
coTRY(shader->Init(coShader::Type::FRAGMENT, path), nullptr);
coPushBack(shaders, shader.Release());
}
filePath = path;
filePath << ".comp.spv";
if (coExists(filePath))
{
coUniquePtr<coShader> shader(new coShader());
coTRY(shader->Init(coShader::Type::COMPUTE, path), nullptr);
coPushBack(shaders, shader.Release());
}
coTRY(Init(shaders), nullptr);
return true;
}
coResult coShaderProgram::Init(const coArray<coShader*>& shaders_)
{
id = glCreateProgram();
coTRY(id, "glCreateProgram()");
for (const coShader* shader : shaders_)
{
glAttachShader(id, shader->_GetGLId());
coTRY(glGetError() == GL_NO_ERROR, "glAttachShader()");
}
glLinkProgram(id);
GLint state = FALSE;
glGetProgramiv(id, GL_LINK_STATUS, &state);
if (state == FALSE)
{
GLint maxLength = 0;
glGetProgramiv(id, GL_INFO_LOG_LENGTH, &maxLength);
coDynamicArray<coChar> msg;
coResize(msg, maxLength);
glGetProgramInfoLog(id, maxLength, &maxLength, msg.data);
coERROR(msg.data);
return false;
}
coTRY(glGetError() == GL_NO_ERROR, "glLinkProgram()");
return true;
}
void coShaderProgram::Bind()
{
glUseProgram(id);
}
void coShaderProgram::Unbind()
{
glUseProgram(0);
}
coInt coShaderProgram::GetUniformLocation(const coChar* name) const
{
return glGetUniformLocation(id, name);
}
void coShaderProgram::SetUniform(coInt location, coBool value)
{
glUniform1i(location, value);
}
void coShaderProgram::SetUniform(coInt location, const coVec2& value)
{
glUniform2fv(location, 1, &value.x);
}
void coShaderProgram::SetUniform(coInt location, const coVec3& value)
{
glUniform3fv(location, 1, &value.x);
}
void coShaderProgram::SetUniform(coInt location, const coVec4& value)
{
glUniform4fv(location, 1, &value.x);
}
void coShaderProgram::SetUniform(coInt location, coUint32 value)
{
glUniform1ui(location, value);
}
void coShaderProgram::SetUniform(coInt location, const coUint32x2& value)
{
glUniform2uiv(location, 1, &value.x);
}
void coShaderProgram::SetUniform(coInt location, const coUint32x4& value)
{
glUniform4uiv(location, 1, &value.x);
}
void coShaderProgram::SetUniform(coInt location, const coMat4& value)
{
glUniformMatrix4fv(location, 1, GL_FALSE, &value.c0.x);
}
| {
"content_hash": "fd631882d37ae6ff0e972de49bb11159",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 73,
"avg_line_length": 22.12142857142857,
"alnum_prop": 0.7164998385534388,
"repo_name": "smogpill/core",
"id": "633f75bd1f67c103431137c8ff55889af312b4cd",
"size": "3670",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/render/shader/coShaderProgram.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1950195"
},
{
"name": "C++",
"bytes": "3500164"
},
{
"name": "GLSL",
"bytes": "1451"
},
{
"name": "Lua",
"bytes": "9569"
}
],
"symlink_target": ""
} |
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <winpr/crt.h>
#include <freerdp/log.h>
#include <freerdp/update.h>
#include <freerdp/freerdp.h>
#include <winpr/stream.h>
#include <freerdp/cache/brush.h>
#define TAG FREERDP_TAG("cache.brush")
static BOOL update_gdi_patblt(rdpContext* context,
PATBLT_ORDER* patblt)
{
BYTE style;
BOOL ret = TRUE;
rdpBrush* brush = &patblt->brush;
const rdpCache* cache = context->cache;
style = brush->style;
if (brush->style & CACHED_BRUSH)
{
brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
brush->style = 0x03;
}
IFCALLRET(cache->brush->PatBlt, ret, context, patblt);
brush->style = style;
return ret;
}
static BOOL update_gdi_polygon_sc(rdpContext* context,
const POLYGON_SC_ORDER* polygon_sc)
{
rdpCache* cache = context->cache;
return IFCALLRESULT(TRUE, cache->brush->PolygonSC, context, polygon_sc);
}
static BOOL update_gdi_polygon_cb(rdpContext* context,
POLYGON_CB_ORDER* polygon_cb)
{
BYTE style;
rdpBrush* brush = &polygon_cb->brush;
rdpCache* cache = context->cache;
BOOL ret = TRUE;
style = brush->style;
if (brush->style & CACHED_BRUSH)
{
brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
brush->style = 0x03;
}
IFCALLRET(cache->brush->PolygonCB, ret, context, polygon_cb);
brush->style = style;
return ret;
}
static BOOL update_gdi_cache_brush(rdpContext* context,
const CACHE_BRUSH_ORDER* cacheBrush)
{
UINT32 length;
void* data = NULL;
rdpCache* cache = context->cache;
length = cacheBrush->bpp * 64 / 8;
data = malloc(length);
if (!data)
return FALSE;
CopyMemory(data, cacheBrush->data, length);
brush_cache_put(cache->brush, cacheBrush->index, data, cacheBrush->bpp);
return TRUE;
}
void* brush_cache_get(rdpBrushCache* brushCache, UINT32 index, UINT32* bpp)
{
void* entry;
if (!brushCache)
return NULL;
if (!bpp)
return NULL;
if (*bpp == 1)
{
if (index >= brushCache->maxMonoEntries)
{
WLog_ERR(TAG, "invalid brush (%d bpp) index: 0x%04X", *bpp, index);
return NULL;
}
*bpp = brushCache->monoEntries[index].bpp;
entry = brushCache->monoEntries[index].entry;
}
else
{
if (index >= brushCache->maxEntries)
{
WLog_ERR(TAG, "invalid brush (%d bpp) index: 0x%04X", *bpp, index);
return NULL;
}
*bpp = brushCache->entries[index].bpp;
entry = brushCache->entries[index].entry;
}
if (entry == NULL)
{
WLog_ERR(TAG, "invalid brush (%d bpp) at index: 0x%04X", *bpp, index);
return NULL;
}
return entry;
}
void brush_cache_put(rdpBrushCache* brushCache, UINT32 index, void* entry, UINT32 bpp)
{
if (bpp == 1)
{
if (index >= brushCache->maxMonoEntries)
{
WLog_ERR(TAG, "invalid brush (%d bpp) index: 0x%04X", bpp, index);
free(entry);
return;
}
free(brushCache->monoEntries[index].entry);
brushCache->monoEntries[index].bpp = bpp;
brushCache->monoEntries[index].entry = entry;
}
else
{
if (index >= brushCache->maxEntries)
{
WLog_ERR(TAG, "invalid brush (%d bpp) index: 0x%04X", bpp, index);
free(entry);
return;
}
free(brushCache->entries[index].entry);
brushCache->entries[index].bpp = bpp;
brushCache->entries[index].entry = entry;
}
}
void brush_cache_register_callbacks(rdpUpdate* update)
{
rdpCache* cache = update->context->cache;
cache->brush->PatBlt = update->primary->PatBlt;
cache->brush->PolygonSC = update->primary->PolygonSC;
cache->brush->PolygonCB = update->primary->PolygonCB;
update->primary->PatBlt = update_gdi_patblt;
update->primary->PolygonSC = update_gdi_polygon_sc;
update->primary->PolygonCB = update_gdi_polygon_cb;
update->secondary->CacheBrush = update_gdi_cache_brush;
}
rdpBrushCache* brush_cache_new(rdpSettings* settings)
{
rdpBrushCache* brushCache;
brushCache = (rdpBrushCache*) calloc(1, sizeof(rdpBrushCache));
if (!brushCache)
return NULL;
brushCache->settings = settings;
brushCache->maxEntries = 64;
brushCache->maxMonoEntries = 64;
brushCache->entries = (BRUSH_ENTRY*)calloc(brushCache->maxEntries, sizeof(BRUSH_ENTRY));
if (!brushCache->entries)
goto error_entries;
brushCache->monoEntries = (BRUSH_ENTRY*) calloc(brushCache->maxMonoEntries, sizeof(BRUSH_ENTRY));
if (!brushCache->monoEntries)
goto error_mono;
return brushCache;
error_mono:
free(brushCache->entries);
error_entries:
free(brushCache);
return NULL;
}
void brush_cache_free(rdpBrushCache* brushCache)
{
int i;
if (brushCache)
{
if (brushCache->entries)
{
for (i = 0; i < (int) brushCache->maxEntries; i++)
free(brushCache->entries[i].entry);
free(brushCache->entries);
}
if (brushCache->monoEntries)
{
for (i = 0; i < (int) brushCache->maxMonoEntries; i++)
free(brushCache->monoEntries[i].entry);
free(brushCache->monoEntries);
}
free(brushCache);
}
}
| {
"content_hash": "c85e5ce0125d769c6462532edf9a8779",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 98,
"avg_line_length": 21.064935064935064,
"alnum_prop": 0.6837237977805178,
"repo_name": "realjiangms/FreeRDP",
"id": "a5f3741d674781418af3567e3c6fee078d0b75c0",
"size": "5567",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "libfreerdp/cache/brush.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "10949298"
},
{
"name": "C#",
"bytes": "11392"
},
{
"name": "C++",
"bytes": "194608"
},
{
"name": "CMake",
"bytes": "665195"
},
{
"name": "Groff",
"bytes": "3716"
},
{
"name": "HTML",
"bytes": "95883"
},
{
"name": "Java",
"bytes": "349393"
},
{
"name": "Makefile",
"bytes": "1423"
},
{
"name": "Objective-C",
"bytes": "1115794"
},
{
"name": "Perl",
"bytes": "8044"
},
{
"name": "Python",
"bytes": "1430"
},
{
"name": "Shell",
"bytes": "22679"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>graph-theory: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.1 / graph-theory - 0.9.1</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
graph-theory
<small>
0.9.1
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-06 06:03:53 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-06 06:03:53 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.07.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.1 Official release 4.07.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "christian.doczkal@mpi-sp.org"
homepage: "https://github.com/coq-community/graph-theory"
dev-repo: "git+https://github.com/coq-community/graph-theory.git"
bug-reports: "https://github.com/coq-community/graph-theory/issues"
license: "CECILL-B"
synopsis: "Graph theory results in Coq and MathComp"
description: """
A library of formalized graph theory results, including various
standard results from the literature (e.g., Menger’s Theorem, Hall’s
Marriage Theorem, and the excluded minor characterization of
treewidth-two graphs) as well as some more recent results arising
from the study of relation algebra within the ERC CoVeCe project
(e.g., soundness and completeness of an axiomatization of graph
isomorphism)."""
build: [
["sh" "-exc" "cat _CoqProject.wagner >>_CoqProject"] {coq-fourcolor:installed}
[make "-j%{jobs}%" ]
]
install: [make "install"]
depends: [
"coq" {>= "8.14" & < "8.16~"}
"coq-mathcomp-algebra" {>= "1.13" & < "1.15~"}
"coq-mathcomp-finmap"
"coq-hierarchy-builder" {>= "1.1.0"}
]
depopts: ["coq-fourcolor"]
tags: [
"category:Computer Science/Graph Theory"
"keyword:graph theory"
"keyword:minors"
"keyword:treewidth"
"keyword:algebra"
"logpath:GraphTheory"
"date:2022-05-24"
]
authors: [
"Christian Doczkal"
"Damien Pous"
]
url {
src: "https://github.com/coq-community/graph-theory/archive/v0.9.1.tar.gz"
checksum: "sha512=cca43caf68fa0c6d039004c741f1f1e2e967aaae8e278998f917438f4d85afeb30e8ad4ff4d388d24a9d9bdf8730261e8290e40fd0f384c716e474162ea7ec10"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-graph-theory.0.9.1 coq.8.7.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1).
The following dependencies couldn't be met:
- coq-graph-theory -> coq >= 8.14 -> ocaml >= 4.09.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-graph-theory.0.9.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "58b25739df9b3daba1b26f428c472409",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 159,
"avg_line_length": 41.483870967741936,
"alnum_prop": 0.5648004147226542,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "67e5ef9b4ca6c8c347c2a292e3cb5cdb6609d21c",
"size": "7745",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.07.1-2.0.6/released/8.7.1/graph-theory/0.9.1.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
import { Component, ChangeDetectionStrategy, OnInit, provide } from '@angular/core';
import { Route, RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated';
import { Store, StoreController } from '../shuttle-store';
import { STORE_SECOND, STORE_FORM, Identifiers } from './app.service';
import { Page1Component } from '../page1/page1.component';
import { Page2Component } from '../page2/page2.component';
import { Page3Component } from '../page3/page3.component';
import { Page4Component } from '../page4/page4.component';
import { Page5Component } from '../page5/page5.component';
import { Page6Component } from '../page6/page6.component';
import { Page7Component } from '../page7/page7.component';
///////////////////////////////////////////////////////////////////////////////////
// Top Component
@Component({
selector: 'sg-app',
template: `
<nav>
<ul>
<li><a [routerLink]="['/Page1']">Page1</a></li>
<li><a [routerLink]="['/Page2']">Page2</a></li>
<li><a [routerLink]="['/Page3']">Page3</a></li>
<li><a [routerLink]="['/Page4']">Page4</a></li>
<li><a [routerLink]="['/Page5']">Page5</a></li>
<li><a [routerLink]="['/Page6']">Page6</a></li>
<li><a [routerLink]="['/Page7']">Page7</a></li>
</ul>
</nav>
<router-outlet></router-outlet>
`,
directives: [ROUTER_DIRECTIVES],
providers: [
provide(Store, { useFactory: () => new Store(null /* main */, { autoRefresh: true, devMode: true, useToastr: true }), multi: true }),
provide(Store, { useFactory: () => new Store(STORE_SECOND, { autoRefresh: true, devMode: true, useToastr: true }), multi: true }),
provide(Store, { useFactory: () => new Store(STORE_FORM, { autoRefresh: false, devMode: true, useToastr: true }), multi: true }),
provide(StoreController, { useFactory: (store) => new StoreController(store), deps: [Store] }),
Identifiers,
],
changeDetection: ChangeDetectionStrategy.Default
})
@RouteConfig([
new Route({ path: 'p1', component: Page1Component, name: 'Page1', useAsDefault: true }),
new Route({ path: 'p2', component: Page2Component, name: 'Page2' }),
new Route({ path: 'p3', component: Page3Component, name: 'Page3' }),
new Route({ path: 'p4', component: Page4Component, name: 'Page4' }),
new Route({ path: 'p5', component: Page5Component, name: 'Page5' }),
new Route({ path: 'p6', component: Page6Component, name: 'Page6' }),
new Route({ path: 'p7', component: Page7Component, name: 'Page7' }),
])
export class AppComponent { } | {
"content_hash": "a61f92414e0133db016c9b9795899bcc",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 137,
"avg_line_length": 48.82692307692308,
"alnum_prop": 0.6215045293422607,
"repo_name": "ovrmrw/shuttle-store-sample",
"id": "b23c02a86cde373655646d5e14afb63d89509a6b",
"size": "2539",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src-front/app/app.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "520"
},
{
"name": "JavaScript",
"bytes": "11948"
},
{
"name": "TypeScript",
"bytes": "118213"
}
],
"symlink_target": ""
} |
@interface DCWebImageManager : NSObject
//只需要设置这2个就行了
//下载失败重复下载次数,默认不重复,
@property NSUInteger DownloadImageRepeatCount;
//图片下载失败会调用该block(如果设置了重复下载次数,则会在重复下载完后,假如还没下载成功,就会调用该block)
//error错误信息
//url下载失败的imageurl
@property (nonatomic,copy) void(^downLoadImageError)(NSError *error,NSString *imageUrl);
@property (nonatomic,copy) void(^downLoadImageComplish)(UIImage *image,NSString *imageUrl);
+ (instancetype)shareManager;
- (void)downloadImageWithUrlString:(NSString *)urlSting;
@end
| {
"content_hash": "888e47cd5dfef887d042484f4734920f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 91,
"avg_line_length": 22.545454545454547,
"alnum_prop": 0.8024193548387096,
"repo_name": "NSDengChen/DCPicScrollView",
"id": "563e926f6ed968e86189a19178bc4c0646506f7d",
"size": "820",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DCWebPicScrollView/DCPicscrollView/DCWebImageManager.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "37410"
}
],
"symlink_target": ""
} |
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig');
module.exports = {
globalSetup: 'jest-preset-angular/global-setup',
preset: 'jest-preset-angular',
roots: ['<rootDir>/src'],
modulePaths: ['<rootDir>'],
moduleDirectories: ['node_modules', 'src'],
testMatch: ['**/+(*.)+(spec).+(ts)'],
setupFilesAfterEnv: ['<rootDir>/src/test.ts'],
collectCoverage: true,
coverageReporters: ['text'],
// coverageReporters: ['html', 'text'],
coverageDirectory: 'coverage/taskana-web',
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || {}, {
prefix: `<rootDir>/${compilerOptions.baseUrl}/`
})
};
| {
"content_hash": "83955b20720dd839af836b622e3e728b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 35.89473684210526,
"alnum_prop": 0.6715542521994134,
"repo_name": "Taskana/taskana",
"id": "5bb76f5ec22029b2ef3d89e247be555ffbbad93c",
"size": "682",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/jest.config.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1735"
},
{
"name": "CSS",
"bytes": "445"
},
{
"name": "Dockerfile",
"bytes": "2824"
},
{
"name": "HTML",
"bytes": "142386"
},
{
"name": "Java",
"bytes": "4485414"
},
{
"name": "JavaScript",
"bytes": "22343"
},
{
"name": "SCSS",
"bytes": "55390"
},
{
"name": "SQLPL",
"bytes": "11432"
},
{
"name": "Shell",
"bytes": "13819"
},
{
"name": "TypeScript",
"bytes": "592063"
},
{
"name": "Vim Snippet",
"bytes": "1358"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "2188d3a3707fdb8aeb8d6e7899399c2f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "0f110e9ff409fa39ad187e6b961490818b4956a4",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Olearia/Olearia stellulata/ Syn. Diplostephium lyratum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#import <iWorkImport/TSDDropShadow.h>
// Not exported
@interface TSDMutableDropShadow : TSDDropShadow
{
}
- (void)setTSUColor:(id)arg1;
@property(nonatomic, getter=isEnabled) _Bool enabled; // @dynamic enabled;
@property(nonatomic) struct CGColor *color; // @dynamic color;
@property(nonatomic) double opacity; // @dynamic opacity;
@property(nonatomic) double radius; // @dynamic radius;
@property(nonatomic) double offset; // @dynamic offset;
@property(nonatomic) double angle; // @dynamic angle;
- (id)copyWithZone:(struct _NSZone *)arg1;
@end
| {
"content_hash": "9e7a9d8f82cae5af66cf84daf875a2ae",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 27.6,
"alnum_prop": 0.7427536231884058,
"repo_name": "matthewsot/CocoaSharp",
"id": "7ee7e7c0ac4a2319b05dd1e2be4456ac589594c9",
"size": "692",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Headers/PrivateFrameworks/iWorkImport/TSDMutableDropShadow.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "259784"
},
{
"name": "C#",
"bytes": "2789005"
},
{
"name": "C++",
"bytes": "252504"
},
{
"name": "Objective-C",
"bytes": "24301417"
},
{
"name": "Smalltalk",
"bytes": "167909"
}
],
"symlink_target": ""
} |
/* ==========================================================================
$BASE-TIME-PICKER
========================================================================== */
/**
* The list of times.
*/
.picker__list {
list-style: none;
padding: 0.75em 0 4.2em;
margin: 0;
}
/**
* The times on the clock.
*/
.picker__list-item {
border-bottom: 1px solid #dddddd;
border-top: 1px solid #dddddd;
margin-bottom: -1px;
position: relative;
background: #ffffff;
padding: .75em 1.25em;
}
@media (min-height: 46.75em) {
.picker__list-item {
padding: .5em 1em;
}
}
/* Hovered time */
.picker__list-item:hover {
cursor: pointer;
color: #000000;
background: #b1dcfb;
border-color: #0089ec;
z-index: 10;
}
/* Selected time */
.picker__list-item--selected,
.picker__list-item--selected:hover {
border-color: #0089ec;
z-index: 10;
}
/* Highlighted time */
.picker__list-item--highlighted {
background: #b1dcfb;
}
/* Highlighted and hovered/focused time */
.picker__list-item--highlighted:hover,
.picker--focused .picker__list-item--highlighted {
background: #0089ec;
color: #ffffff;
}
/* Disabled time */
.picker__list-item--disabled,
.picker__list-item--disabled:hover,
.picker--focused .picker__list-item--disabled {
background: #f5f5f5;
border-color: #f5f5f5;
color: #dddddd;
cursor: default;
border-color: #dddddd;
z-index: auto;
}
/**
* The clear button
*/
.picker--time .picker__button--clear {
display: block;
width: 80%;
margin: 1em auto 0;
padding: 1em 1.25em;
background: none;
border: 0;
font-weight: 500;
font-size: .67em;
text-align: center;
text-transform: uppercase;
color: #666;
}
.picker--time .picker__button--clear:hover,
.picker--time .picker__button--clear:focus {
color: #000000;
background: #b1dcfb;
background: #ee2200;
border-color: #ee2200;
cursor: pointer;
color: #ffffff;
outline: none;
}
.picker--time .picker__button--clear:before {
top: -0.25em;
color: #666;
font-size: 1.25em;
font-weight: bold;
}
.picker--time .picker__button--clear:hover:before,
.picker--time .picker__button--clear:focus:before {
color: #ffffff;
}
/* ==========================================================================
$CLASSIC-TIME-PICKER
========================================================================== */
/**
* Note: the root picker element should __NOT__ be styled
* more than what’s here. Style the `.picker__holder` instead.
*/
.picker--time {
min-width: 256px;
max-width: 320px;
}
/**
* The holder is the base of the picker.
*/
.picker--time .picker__holder {
background: #f2f2f2;
}
@media (min-height: 40.125em) {
.picker--time .picker__holder {
font-size: .875em;
}
}
/**
* The box contains the list of times.
*/
.picker--time .picker__box {
padding: 0;
}
| {
"content_hash": "0ac82c49aece3fca25cdc2b2e7a7df76",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 80,
"avg_line_length": 22.173228346456693,
"alnum_prop": 0.578125,
"repo_name": "yashb/generator",
"id": "eb85646e6f2c9146625e10e2ec36e5b7f8ea3f69",
"size": "2818",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/vendor/codesleeve/sprockets/tests/fixtures/provider/assets/stylesheets/pickadate/classic.time.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "126840"
}
],
"symlink_target": ""
} |
'use strict';
/**
* @description allow model to define its custom validation scenarios.
*
* @param {Object} sails a sails application instance
*/
var path = require('path');
var libPath = path.join(__dirname, 'lib');
//patches
var create = require(path.join(libPath, 'create'));
var createEach = require(path.join(libPath, 'createEach'));
var findOrCreate = require(path.join(libPath, 'findOrCreate'));
var findOrCreateEach = require(path.join(libPath, 'findOrCreateEach'));
var update = require(path.join(libPath, 'update'));
var validate = require(path.join(libPath, 'validate'));
module.exports = function(sails) {
function patch() {
sails
.util
._(sails.models)
.forEach(function(model) {
model._scenario = {
setDefaults: false,
autoClear: true,
defaults: {
validations: false,
cast: false,
}
}
model.setScenario = function(name, autoClear) {
autoClear = typeof autoClear !== 'undefined' ? autoClear : true;
model._scenario.autoClear = autoClear;
if(!model._scenario.setDefaults) {
model._scenario.setDefaults = true;
model._scenario.defaults.validations = _.cloneDeep(model._validator.validations);
model._scenario.defaults.cast = _.cloneDeep(model._cast._types);
}
if(model.scenarios && model.scenarios[name]) {
if(model.scenarios[name].ignoreDefaults) {
for(var i in model._validator.validations) {
for(var j in model._validator.validations[i]) {
if(j != 'type') {
delete model._validator.validations[i][j];
}
}
}
}
for(var key in model.scenarios[name]) {
if(key != 'ignoreDefaults') {
for(var v in model.scenarios[name][key]) {
if(v == 'type') {
model._cast._types.name = model.scenarios[name][key][v];
}
if(model._validator.validations[key]) {
model._validator.validations[key][v] = model.scenarios[name][key][v];
}
}
}
}
}
}
model.clearScenarios = function() {
model._validator.validations = _.cloneDeep(model._scenario.defaults.validations);
model._cast._types = _.cloneDeep(model._scenario.defaults.cast);
console.log(model._validator.validations);
}
if (model.globalId) {
create(model);
createEach(model);
findOrCreate(model);
findOrCreateEach(model);
update(model);
validate(model);
}
});
}
return {
initialize: function(done) {
var eventsToWaitFor = [];
if (sails.hooks.orm) {
eventsToWaitFor.push('hook:orm:loaded');
}
if (sails.hooks.pubsub) {
eventsToWaitFor.push('hook:pubsub:loaded');
}
sails.after(eventsToWaitFor, function() {
patch();
done();
});
}
};
};
| {
"content_hash": "caa6dc71aa8b1f0f6a76db459551caac",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 91,
"avg_line_length": 29.847619047619048,
"alnum_prop": 0.5462667517549458,
"repo_name": "rhpwn/sails-hook-scenario",
"id": "ccbdcde90fcf2f4a1c076aaea56f7a3c1c2d30da",
"size": "3134",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "7268"
}
],
"symlink_target": ""
} |
using mc::Vector3d;
namespace util {
s64 GetTime() {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
Vector3d OrientationToVector(double orientation) {
double pitch = 0.0;
return Vector3d(
-std::cos(pitch) * std::sin(orientation),
-std::sin(pitch),
std::cos(pitch) * std::cos(orientation)
);
}
} // ns util
| {
"content_hash": "cfdae749cdbeb5231f511dd2c8e18f2b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 126,
"avg_line_length": 22.57894736842105,
"alnum_prop": 0.634032634032634,
"repo_name": "plushmonkey/mcbot",
"id": "e2d06c535fe19f8de394aae695c2293631326dae",
"size": "470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mcbot/Utility.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "92719"
},
{
"name": "Makefile",
"bytes": "439"
}
],
"symlink_target": ""
} |
using System.Web.Mvc;
using Calibrus.SparkPortal.Web.CustomAttributes;
namespace Calibrus.SparkPortal.Web
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
//filters.Add(new HandleErrorAttribute());
filters.Add(new CustomHandleErrorAttribute());
}
}
} | {
"content_hash": "6eed643025785b003ef245c3323128f4",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 80,
"avg_line_length": 26.285714285714285,
"alnum_prop": 0.6847826086956522,
"repo_name": "tazmanrising/IntiotgAngular",
"id": "5305afc6957fa5e66aeab29e79e9e8cfa2740129",
"size": "370",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Companies/Calibrus/sparkportal/Web/Content/App_Start/FilterConfig.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "7793151"
},
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "Batchfile",
"bytes": "776"
},
{
"name": "C#",
"bytes": "1654702"
},
{
"name": "CSS",
"bytes": "5288713"
},
{
"name": "Elixir",
"bytes": "1728"
},
{
"name": "HTML",
"bytes": "16729931"
},
{
"name": "JavaScript",
"bytes": "22627347"
},
{
"name": "Makefile",
"bytes": "302"
},
{
"name": "PowerShell",
"bytes": "2080"
},
{
"name": "Python",
"bytes": "3523"
},
{
"name": "Ruby",
"bytes": "2060"
},
{
"name": "Shell",
"bytes": "1104"
},
{
"name": "TypeScript",
"bytes": "41985"
}
],
"symlink_target": ""
} |
@interface Utils : NSObject
+(void) setCGContextColor:(CGContextRef) context hexColor:(int) hexCode;
+(UIColor *)colorFromHex:(int)hexCode;
+(BOOL) isNull:(id)obj;
@end
| {
"content_hash": "7262425b4e443a2f034bb2b58f43e7e9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 72,
"avg_line_length": 33.8,
"alnum_prop": 0.7514792899408284,
"repo_name": "vinhphu458/Chess",
"id": "829f14067a0c59609358bbc14175da606f523fce",
"size": "345",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MyChess/MyChess/common/Utils.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "63262"
}
],
"symlink_target": ""
} |
require 'strscan'
require 'haml/shared'
module Haml
module Precompiler
include Haml::Util
# Designates an XHTML/XML element.
ELEMENT = ?%
# Designates a <tt><div></tt> element with the given class.
DIV_CLASS = ?.
# Designates a <tt><div></tt> element with the given id.
DIV_ID = ?#
# Designates an XHTML/XML comment.
COMMENT = ?/
# Designates an XHTML doctype or script that is never HTML-escaped.
DOCTYPE = ?!
# Designates script, the result of which is output.
SCRIPT = ?=
# Designates script that is always HTML-escaped.
SANITIZE = ?&
# Designates script, the result of which is flattened and output.
FLAT_SCRIPT = ?~
# Designates script which is run but not output.
SILENT_SCRIPT = ?-
# When following SILENT_SCRIPT, designates a comment that is not output.
SILENT_COMMENT = ?#
# Designates a non-parsed line.
ESCAPE = ?\\
# Designates a block of filtered text.
FILTER = ?:
# Designates a non-parsed line. Not actually a character.
PLAIN_TEXT = -1
# Keeps track of the ASCII values of the characters that begin a
# specially-interpreted line.
SPECIAL_CHARACTERS = [
ELEMENT,
DIV_CLASS,
DIV_ID,
COMMENT,
DOCTYPE,
SCRIPT,
SANITIZE,
FLAT_SCRIPT,
SILENT_SCRIPT,
ESCAPE,
FILTER
]
# The value of the character that designates that a line is part
# of a multiline string.
MULTILINE_CHAR_VALUE = ?|
# Regex to match keywords that appear in the middle of a Ruby block
# with lowered indentation.
# If a block has been started using indentation,
# lowering the indentation with one of these won't end the block.
# For example:
#
# - if foo
# %p yes!
# - else
# %p no!
#
# The block is ended after <tt>%p no!</tt>, because <tt>else</tt>
# is a member of this array.
MID_BLOCK_KEYWORD_REGEX = /-\s*(#{%w[else elsif rescue ensure when end].join('|')})\b/
# The Regex that matches a Doctype command.
DOCTYPE_REGEX = /(\d\.\d)?[\s]*([a-z]*)/i
# The Regex that matches a literal string or symbol value
LITERAL_VALUE_REGEX = /^\s*(:(\w*)|(('|")([^\\\#'"]*?)\4))\s*$/
private
# Returns the precompiled string with the preamble and postamble
def precompiled_with_ambles(local_names)
preamble = <<END.gsub("\n", ";")
extend Haml::Helpers
_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})
_erbout = _hamlout.buffer
__in_erb_template = true
END
postamble = <<END.gsub("\n", ";")
@haml_buffer = @haml_buffer.upper
_erbout
END
preamble + locals_code(local_names) + @precompiled + postamble
end
def locals_code(names)
names = names.keys if Hash == names
names.map do |name|
# Can't use || because someone might explicitly pass in false with a symbol
sym_local = "_haml_locals[#{name.to_sym.inspect}]"
str_local = "_haml_locals[#{name.to_s.inspect}]"
"#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local}"
end.join(';') + ';'
end
class Line < Struct.new(:text, :unstripped, :full, :index, :precompiler, :eod)
alias_method :eod?, :eod
def tabs
line = self
@tabs ||= precompiler.instance_eval do
break 0 if line.text.empty? || !(whitespace = line.full[/^\s+/])
if @indentation.nil?
@indentation = whitespace
if @indentation.include?(?\s) && @indentation.include?(?\t)
raise SyntaxError.new("Indentation can't use both tabs and spaces.", line.index)
end
@flat_spaces = @indentation * @template_tabs if flat?
break 1
end
tabs = whitespace.length / @indentation.length
break tabs if whitespace == @indentation * tabs
break @template_tabs if flat? && whitespace =~ /^#{@indentation * @template_tabs}/
raise SyntaxError.new(<<END.strip.gsub("\n", ' '), line.index)
Inconsistent indentation: #{Haml::Shared.human_indentation whitespace, true} used for indentation,
but the rest of the document was indented using #{Haml::Shared.human_indentation @indentation}.
END
end
end
end
def precompile
@haml_comment = @dont_indent_next_line = @dont_tab_up_next_text = false
@indentation = nil
@line = next_line
resolve_newlines
newline
raise SyntaxError.new("Indenting at the beginning of the document is illegal.", @line.index) if @line.tabs != 0
while next_line
process_indent(@line) unless @line.text.empty?
if flat?
push_flat(@line)
@line = @next_line
newline
next
end
process_line(@line.text, @line.index) unless @line.text.empty? || @haml_comment
if !flat? && @next_line.tabs - @line.tabs > 1
raise SyntaxError.new("The line was indented #{@next_line.tabs - @line.tabs} levels deeper than the previous line.", @next_line.index)
end
resolve_newlines unless @next_line.eod?
@line = @next_line
newline unless @next_line.eod?
end
# Close all the open tags
close until @to_close_stack.empty?
flush_merged_text
end
# Processes and deals with lowering indentation.
def process_indent(line)
return unless line.tabs <= @template_tabs && @template_tabs > 0
to_close = @template_tabs - line.tabs
to_close.times { |i| close unless to_close - 1 - i == 0 && mid_block_keyword?(line.text) }
end
# Processes a single line of Haml.
#
# This method doesn't return anything; it simply processes the line and
# adds the appropriate code to <tt>@precompiled</tt>.
def process_line(text, index)
@index = index + 1
case text[0]
when DIV_CLASS; render_div(text)
when DIV_ID
return push_plain(text) if text[1] == ?{
render_div(text)
when ELEMENT; render_tag(text)
when COMMENT; render_comment(text[1..-1].strip)
when SANITIZE
return push_script(unescape_interpolation(text[3..-1].strip), :escape_html => true) if text[1..2] == "=="
return push_script(text[2..-1].strip, :escape_html => true) if text[1] == SCRIPT
return push_script(unescape_interpolation(text[1..-1].strip), :escape_html => true) if text[1] == ?\s
push_plain text
when SCRIPT
return push_script(unescape_interpolation(text[2..-1].strip)) if text[1] == SCRIPT
return push_script(text[1..-1], :escape_html => true) if options[:escape_html]
push_script(text[1..-1])
when FLAT_SCRIPT; push_flat_script(text[1..-1])
when SILENT_SCRIPT
return start_haml_comment if text[1] == SILENT_COMMENT
raise SyntaxError.new(<<END.rstrip, index) if text[1..-1].strip == "end"
You don't need to use "- end" in Haml. Use indentation instead:
- if foo?
%strong Foo!
- else
Not foo.
END
push_silent(text[1..-1], true)
newline_now
# Handle stuff like - end.join("|")
@to_close_stack.first << false if text =~ /-\s*end\b/ && !block_opened?
case_stmt = text =~ /-\s*case\b/
block = block_opened? && !mid_block_keyword?(text)
push_and_tabulate([:script]) if block || case_stmt
push_and_tabulate(:nil) if block && case_stmt
when FILTER; start_filtered(text[1..-1].downcase)
when DOCTYPE
return render_doctype(text) if text[0...3] == '!!!'
return push_script(unescape_interpolation(text[3..-1].strip)) if text[1..2] == "=="
return push_script(text[2..-1].strip) if text[1] == SCRIPT
return push_script(unescape_interpolation(text[1..-1].strip)) if text[1] == ?\s
push_plain text
when ESCAPE; push_plain text[1..-1]
else push_plain text
end
end
# Returns whether or not the text is a silent script text with one
# of Ruby's mid-block keywords.
def mid_block_keyword?(text)
MID_BLOCK_KEYWORD_REGEX =~ text
end
# Evaluates <tt>text</tt> in the context of the scope object, but
# does not output the result.
def push_silent(text, can_suppress = false)
flush_merged_text
return if can_suppress && options[:suppress_eval]
@precompiled << "#{text};"
end
# Adds <tt>text</tt> to <tt>@buffer</tt> with appropriate tabulation
# without parsing it.
def push_merged_text(text, tab_change = 0, indent = true)
text = !indent || @dont_indent_next_line || @options[:ugly] ? text : "#{' ' * @output_tabs}#{text}"
@to_merge << [:text, text, tab_change]
@dont_indent_next_line = false
end
# Concatenate <tt>text</tt> to <tt>@buffer</tt> without tabulation.
def concat_merged_text(text)
@to_merge << [:text, text, 0]
end
def push_text(text, tab_change = 0)
push_merged_text("#{text}\n", tab_change)
end
def flush_merged_text
return if @to_merge.empty?
text, tab_change = @to_merge.inject(["", 0]) do |(str, mtabs), (type, val, tabs)|
case type
when :text
[str << val.gsub('#{', "\\\#{").inspect[1...-1], mtabs + tabs]
when :script
if mtabs != 0 && !@options[:ugly]
val = "_hamlout.adjust_tabs(#{mtabs}); " + val
end
[str << "\#{#{val}}", 0]
else
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Precompiler@to_merge.")
end
end
@precompiled <<
if @options[:ugly]
"_erbout << \"#{text}\";"
else
"_hamlout.push_text(\"#{text}\", #{tab_change}, #{@dont_tab_up_next_text.inspect});"
end
@to_merge = []
@dont_tab_up_next_text = false
end
# Renders a block of text as plain text.
# Also checks for an illegally opened block.
def push_plain(text)
if block_opened?
raise SyntaxError.new("Illegal nesting: nesting within plain text is illegal.", @next_line.index)
end
if contains_interpolation?(text)
push_script unescape_interpolation(text)
else
push_text text
end
end
# Adds +text+ to <tt>@buffer</tt> while flattening text.
def push_flat(line)
text = line.full.dup
text = "" unless text.gsub!(/^#{@flat_spaces}/, '')
@filter_buffer << "#{text}\n"
end
# Causes <tt>text</tt> to be evaluated in the context of
# the scope object and the result to be added to <tt>@buffer</tt>.
#
# If <tt>opts[:preserve_script]</tt> is true, Haml::Helpers#find_and_flatten is run on
# the result before it is added to <tt>@buffer</tt>
def push_script(text, opts = {})
raise SyntaxError.new("There's no Ruby code for = to evaluate.") if text.empty?
return if options[:suppress_eval]
args = %w[preserve_script in_tag preserve_tag escape_html nuke_inner_whitespace]
args.map! {|name| opts[name.to_sym]}
args << !block_opened? << @options[:ugly]
no_format = @options[:ugly] &&
!(opts[:preserve_script] || opts[:preserve_tag] || opts[:escape_html])
output_temp = "(haml_very_temp = haml_temp; haml_temp = nil; haml_very_temp)"
out = "_hamlout.#{static_method_name(:format_script, *args)}(#{output_temp});"
# Prerender tabulation unless we're in a tag
push_merged_text '' unless opts[:in_tag]
unless block_opened?
@to_merge << [:script, no_format ? "#{text}\n" : "haml_temp = #{text}\n#{out}"]
concat_merged_text("\n") unless opts[:in_tag] || opts[:nuke_inner_whitespace]
@newlines -= 1
return
end
flush_merged_text
push_silent "haml_temp = #{text}"
newline_now
push_and_tabulate([:loud, "_erbout << #{no_format ? "#{output_temp}.to_s;" : out}",
!(opts[:in_tag] || opts[:nuke_inner_whitespace] || @options[:ugly])])
end
# Causes <tt>text</tt> to be evaluated, and Haml::Helpers#find_and_flatten
# to be run on it afterwards.
def push_flat_script(text)
flush_merged_text
raise SyntaxError.new("There's no Ruby code for ~ to evaluate.") if text.empty?
push_script(text, :preserve_script => true)
end
def start_haml_comment
return unless block_opened?
@haml_comment = true
push_and_tabulate([:haml_comment])
end
# Closes the most recent item in <tt>@to_close_stack</tt>.
def close
tag, *rest = @to_close_stack.pop
send("close_#{tag}", *rest)
end
# Puts a line in <tt>@precompiled</tt> that will add the closing tag of
# the most recently opened tag.
def close_element(value)
tag, nuke_outer_whitespace, nuke_inner_whitespace = value
@output_tabs -= 1 unless nuke_inner_whitespace
@template_tabs -= 1
rstrip_buffer! if nuke_inner_whitespace
push_merged_text("</#{tag}>" + (nuke_outer_whitespace ? "" : "\n"),
nuke_inner_whitespace ? 0 : -1, !nuke_inner_whitespace)
@dont_indent_next_line = nuke_outer_whitespace
end
# Closes a Ruby block.
def close_script
push_silent "end", true
@template_tabs -= 1
end
# Closes a comment.
def close_comment(has_conditional)
@output_tabs -= 1
@template_tabs -= 1
close_tag = has_conditional ? "<![endif]-->" : "-->"
push_text(close_tag, -1)
end
# Closes a loud Ruby block.
def close_loud(command, add_newline, push_end = true)
push_silent('end', true) if push_end
@precompiled << command
@template_tabs -= 1
concat_merged_text("\n") if add_newline
end
# Closes a filtered block.
def close_filtered(filter)
filter.internal_compile(self, @filter_buffer)
@flat = false
@flat_spaces = nil
@filter_buffer = nil
@template_tabs -= 1
end
def close_haml_comment
@haml_comment = false
@template_tabs -= 1
end
def close_nil
@template_tabs -= 1
end
# Iterates through the classes and ids supplied through <tt>.</tt>
# and <tt>#</tt> syntax, and returns a hash with them as attributes,
# that can then be merged with another attributes hash.
def parse_class_and_id(list)
attributes = {}
list.scan(/([#.])([-_a-zA-Z0-9]+)/) do |type, property|
case type
when '.'
if attributes['class']
attributes['class'] += " "
else
attributes['class'] = ""
end
attributes['class'] += property
when '#'; attributes['id'] = property
end
end
attributes
end
def parse_literal_value(text)
return nil unless text
text.match(LITERAL_VALUE_REGEX)
# $2 holds the value matched by a symbol, but is nil for a string match
# $5 holds the value matched by a string
$2 || $5
end
def parse_static_hash(text)
return {} unless text
attributes = {}
text.split(',').each do |attrib|
key, value, more = attrib.split('=>')
# Make sure the key and value and only the key and value exist
# Otherwise, it's too complicated or dynamic and we'll defer it to the actual Ruby parser
key = parse_literal_value key
value = parse_literal_value value
return nil if more || key.nil? || value.nil?
attributes[key] = value
end
text.count("\n").times { newline }
attributes
end
# This is a class method so it can be accessed from Buffer.
def self.build_attributes(is_html, attr_wrapper, attributes = {})
quote_escape = attr_wrapper == '"' ? """ : "'"
other_quote_char = attr_wrapper == '"' ? "'" : '"'
result = attributes.collect do |attr, value|
next if value.nil?
if value == true
next " #{attr}" if is_html
next " #{attr}=#{attr_wrapper}#{attr}#{attr_wrapper}"
elsif value == false
next
end
value = Haml::Helpers.preserve(Haml::Helpers.escape_once(value.to_s))
# We want to decide whether or not to escape quotes
value.gsub!('"', '"')
this_attr_wrapper = attr_wrapper
if value.include? attr_wrapper
if value.include? other_quote_char
value = value.gsub(attr_wrapper, quote_escape)
else
this_attr_wrapper = other_quote_char
end
end
" #{attr}=#{this_attr_wrapper}#{value}#{this_attr_wrapper}"
end
result.compact.sort.join
end
def prerender_tag(name, self_close, attributes)
attributes_string = Precompiler.build_attributes(html?, @options[:attr_wrapper], attributes)
"<#{name}#{attributes_string}#{self_close && xhtml? ? ' /' : ''}>"
end
# Parses a line into tag_name, attributes, attributes_hash, object_ref, action, value
def parse_tag(line)
raise SyntaxError.new("Invalid tag: \"#{line}\".") unless match = line.scan(/%([-:\w]+)([-\w\.\#]*)(.*)/)[0]
tag_name, attributes, rest = match
attributes_hash, rest, last_line = parse_attributes(rest) if rest[0] == ?{
if rest
object_ref, rest = balance(rest, ?[, ?]) if rest[0] == ?[
attributes_hash, rest, last_line = parse_attributes(rest) if rest[0] == ?{ && attributes_hash.nil?
nuke_whitespace, action, value = rest.scan(/(<>|><|[><])?([=\/\~&!])?(.*)?/)[0]
nuke_whitespace ||= ''
nuke_outer_whitespace = nuke_whitespace.include? '>'
nuke_inner_whitespace = nuke_whitespace.include? '<'
end
value = value.to_s.strip
[tag_name, attributes, attributes_hash, object_ref, nuke_outer_whitespace,
nuke_inner_whitespace, action, value, last_line || @index]
end
def parse_attributes(line)
line = line.dup
last_line = @index
begin
attributes_hash, rest = balance(line, ?{, ?})
rescue SyntaxError => e
if line.strip[-1] == ?, && e.message == "Unbalanced brackets."
line << "\n" << @next_line.text
last_line += 1
next_line
retry
end
raise e
end
attributes_hash = attributes_hash[1...-1] if attributes_hash
return attributes_hash, rest, last_line
end
# Parses a line that will render as an XHTML tag, and adds the code that will
# render that tag to <tt>@precompiled</tt>.
def render_tag(line)
tag_name, attributes, attributes_hash, object_ref, nuke_outer_whitespace,
nuke_inner_whitespace, action, value, last_line = parse_tag(line)
raise SyntaxError.new("Illegal element: classes and ids must have values.") if attributes =~ /[\.#](\.|#|\z)/
# Get rid of whitespace outside of the tag if we need to
rstrip_buffer! if nuke_outer_whitespace
preserve_tag = options[:preserve].include?(tag_name)
nuke_inner_whitespace ||= preserve_tag
preserve_tag &&= !options[:ugly]
case action
when '/'; self_closing = true
when '~'; parse = preserve_script = true
when '='
parse = true
value = unescape_interpolation(value[1..-1].strip) if value[0] == ?=
when '&', '!'
if value[0] == ?=
parse = true
value =
if value[1] == ?=
unescape_interpolation(value[2..-1].strip)
else
value[1..-1].strip
end
elsif contains_interpolation?(value)
parse = true
value = unescape_interpolation(value)
end
else
if contains_interpolation?(value)
parse = true
value = unescape_interpolation(value)
end
end
if parse && @options[:suppress_eval]
parse = false
value = ''
end
escape_html = (action == '&' || (action != '!' && @options[:escape_html]))
object_ref = "nil" if object_ref.nil? || @options[:suppress_eval]
static_attributes = parse_static_hash(attributes_hash) # Try pre-compiling a static attributes hash
attributes_hash = nil if static_attributes || @options[:suppress_eval]
attributes = parse_class_and_id(attributes)
Buffer.merge_attrs(attributes, static_attributes) if static_attributes
raise SyntaxError.new("Illegal nesting: nesting within a self-closing tag is illegal.", @next_line.index) if block_opened? && self_closing
raise SyntaxError.new("Illegal nesting: content can't be both given on the same line as %#{tag_name} and nested within it.", @next_line.index) if block_opened? && !value.empty?
raise SyntaxError.new("There's no Ruby code for #{action} to evaluate.", last_line - 1) if parse && value.empty?
raise SyntaxError.new("Self-closing tags can't have content.", last_line - 1) if self_closing && !value.empty?
self_closing ||= !!( !block_opened? && value.empty? && @options[:autoclose].include?(tag_name) )
dont_indent_next_line =
(nuke_outer_whitespace && !block_opened?) ||
(nuke_inner_whitespace && block_opened?)
# Check if we can render the tag directly to text and not process it in the buffer
if object_ref == "nil" && attributes_hash.nil? && !preserve_script
tag_closed = !block_opened? && !self_closing && !parse
open_tag = prerender_tag(tag_name, self_closing, attributes)
if tag_closed
open_tag << "#{value}</#{tag_name}>"
open_tag << "\n" unless nuke_outer_whitespace
else
open_tag << "\n" unless parse || nuke_inner_whitespace || (self_closing && nuke_outer_whitespace)
end
push_merged_text(open_tag, tag_closed || self_closing || nuke_inner_whitespace ? 0 : 1,
!nuke_outer_whitespace)
@dont_indent_next_line = dont_indent_next_line
return if tag_closed
else
flush_merged_text
content = value.empty? || parse ? 'nil' : value.dump
attributes_hash = ', ' + attributes_hash if attributes_hash
args = [tag_name, self_closing, !block_opened?, preserve_tag, escape_html,
attributes, nuke_outer_whitespace, nuke_inner_whitespace
].map { |v| v.inspect }.join(', ')
push_silent "_hamlout.open_tag(#{args}, #{object_ref}, #{content}#{attributes_hash})"
@dont_tab_up_next_text = @dont_indent_next_line = dont_indent_next_line
end
return if self_closing
if value.empty?
push_and_tabulate([:element, [tag_name, nuke_outer_whitespace, nuke_inner_whitespace]])
@output_tabs += 1 unless nuke_inner_whitespace
return
end
if parse
push_script(value, :preserve_script => preserve_script, :in_tag => true,
:preserve_tag => preserve_tag, :escape_html => escape_html,
:nuke_inner_whitespace => nuke_inner_whitespace)
concat_merged_text("</#{tag_name}>" + (nuke_outer_whitespace ? "" : "\n"))
end
end
# Renders a line that creates an XHTML tag and has an implicit div because of
# <tt>.</tt> or <tt>#</tt>.
def render_div(line)
render_tag('%div' + line)
end
# Renders an XHTML comment.
def render_comment(line)
conditional, line = balance(line, ?[, ?]) if line[0] == ?[
line.strip!
conditional << ">" if conditional
if block_opened? && !line.empty?
raise SyntaxError.new('Illegal nesting: nesting within a tag that already has content is illegal.', @next_line.index)
end
open = "<!--#{conditional} "
# Render it statically if possible
unless line.empty?
return push_text("#{open}#{line} #{conditional ? "<![endif]-->" : "-->"}")
end
push_text(open, 1)
@output_tabs += 1
push_and_tabulate([:comment, !conditional.nil?])
unless line.empty?
push_text(line)
close
end
end
# Renders an XHTML doctype or XML shebang.
def render_doctype(line)
raise SyntaxError.new("Illegal nesting: nesting within a header command is illegal.", @next_line.index) if block_opened?
doctype = text_for_doctype(line)
push_text doctype if doctype
end
def text_for_doctype(text)
text = text[3..-1].lstrip.downcase
if text.index("xml") == 0
return nil if html?
wrapper = @options[:attr_wrapper]
return "<?xml version=#{wrapper}1.0#{wrapper} encoding=#{wrapper}#{text.split(' ')[1] || "utf-8"}#{wrapper} ?>"
end
if html5?
'<!DOCTYPE html>'
else
version, type = text.scan(DOCTYPE_REGEX)[0]
if xhtml?
if version == "1.1"
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
else
case type
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
when "mobile"; '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
when "basic"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
else '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
end
end
elsif html4?
case type
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
else '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
end
end
end
end
# Starts a filtered block.
def start_filtered(name)
raise Error.new("Invalid filter name \":#{name}\".") unless name =~ /^\w+$/
raise Error.new("Filter \"#{name}\" is not defined.") unless filter = Filters.defined[name]
push_and_tabulate([:filtered, filter])
@flat = true
@filter_buffer = String.new
# If we don't know the indentation by now, it'll be set in Line#tabs
@flat_spaces = @indentation * @template_tabs if @indentation
end
def raw_next_line
text = @template.shift
return unless text
index = @template_index
@template_index += 1
return text, index
end
def next_line
text, index = raw_next_line
return unless text
# :eod is a special end-of-document marker
line =
if text == :eod
Line.new '-#', '-#', '-#', index, self, true
else
Line.new text.strip, text.lstrip.chomp, text, index, self, false
end
# `flat?' here is a little outdated,
# so we have to manually check if either the previous or current line
# closes the flat block,
# as well as whether a new block is opened
@line.tabs if @line
unless (flat? && !closes_flat?(line) && !closes_flat?(@line)) ||
(@line && @line.text[0] == ?: && line.full =~ %r[^#{@line.full[/^\s+/]}\s])
if line.text.empty?
newline
return next_line
end
handle_multiline(line)
end
@next_line = line
end
def closes_flat?(line)
line && !line.text.empty? && line.full !~ /^#{@flat_spaces}/
end
def un_next_line(line)
@template.unshift line
@template_index -= 1
end
def handle_multiline(line)
if is_multiline?(line.text)
line.text.slice!(-1)
while new_line = raw_next_line.first
break if new_line == :eod
newline and next if new_line.strip.empty?
break unless is_multiline?(new_line.strip)
line.text << new_line.strip[0...-1]
newline
end
un_next_line new_line
resolve_newlines
end
end
# Checks whether or not +line+ is in a multiline sequence.
def is_multiline?(text)
text && text.length > 1 && text[-1] == MULTILINE_CHAR_VALUE && text[-2] == ?\s
end
def contains_interpolation?(str)
str.include?('#{')
end
def unescape_interpolation(str)
res = ''
rest = Haml::Shared.handle_interpolation str.dump do |scan|
escapes = (scan[2].size - 1) / 2
res << scan.matched[0...-3 - escapes]
if escapes % 2 == 1
res << '#{'
else
res << '#{' + eval('"' + balance(scan, ?{, ?}, 1)[0][0...-1] + '"') + "}"# Use eval to get rid of string escapes
end
end
res + rest
end
def balance(*args)
res = Haml::Shared.balance(*args)
return res if res
raise SyntaxError.new("Unbalanced brackets.")
end
def block_opened?
!flat? && @next_line.tabs > @line.tabs
end
# Pushes value onto <tt>@to_close_stack</tt> and increases
# <tt>@template_tabs</tt>.
def push_and_tabulate(value)
@to_close_stack.push(value)
@template_tabs += 1
end
def flat?
@flat
end
def newline
@newlines += 1
end
def newline_now
@precompiled << "\n"
@newlines -= 1
end
def resolve_newlines
return unless @newlines > 0
@precompiled << "\n" * @newlines
@newlines = 0
end
# Get rid of and whitespace at the end of the buffer
# or the merged text
def rstrip_buffer!
if @to_merge.empty?
push_silent("_erbout.rstrip!", false)
@dont_tab_up_next_text = true
return
end
last = @to_merge.last
case last.first
when :text
last[1].rstrip!
if last[1].empty?
@to_merge.pop
rstrip_buffer!
end
when :script
last[1].gsub!(/\(haml_temp, (.*?)\);$/, '(haml_temp.rstrip, \1);')
else
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Precompiler@to_merge.")
end
end
end
end
| {
"content_hash": "2284e81cdaf2fb7cbedeb32cca6a1998",
"timestamp": "",
"source": "github",
"line_count": 904,
"max_line_length": 182,
"avg_line_length": 33.55420353982301,
"alnum_prop": 0.5850393960373191,
"repo_name": "alphabetum/saasy",
"id": "102436574b192683aa9a878f386fb904acc35716",
"size": "30333",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/gems/haml-2.1.0/lib/haml/precompiler.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1864"
},
{
"name": "Ruby",
"bytes": "67089"
}
],
"symlink_target": ""
} |
class MovementDetailsHistoryController < ApplicationController
# GET /movement_details_history
def show
@history = present History.find(params[:id]), MovementHistoryDetailsPresenter
end
end
| {
"content_hash": "27ce32c00f936bbd3cf3a0969baab0b1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 81,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.7960199004975125,
"repo_name": "GeorgioWan/bonsaiERP",
"id": "33fd3833bbb5bf1fd63713fc19c05517456eda48",
"size": "201",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/controllers/movement_details_history_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "45532"
},
{
"name": "CoffeeScript",
"bytes": "111578"
},
{
"name": "HTML",
"bytes": "416232"
},
{
"name": "JavaScript",
"bytes": "1672"
},
{
"name": "Ruby",
"bytes": "876731"
},
{
"name": "SQLPL",
"bytes": "54972"
},
{
"name": "Shell",
"bytes": "949"
}
],
"symlink_target": ""
} |
/**
* Post
*
* @module :: Model
* @description :: A short summary of how this model works and what it represents.
*
*/
module.exports = {
schema: true,
attributes: {
title: {
type: 'string',
required: true
},
body: {
type: 'string'
},
authorId: {
type: 'string',
required: true
},
online: {
type: 'boolean',
defaultsTo: false
}
}
};
| {
"content_hash": "f75487d59ffa62018e581df221f3bf56",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 82,
"avg_line_length": 12.676470588235293,
"alnum_prop": 0.494199535962877,
"repo_name": "jbrousseau/supernovajs",
"id": "116ea95d4217d86a8b2433c59e5a290740d3c901",
"size": "431",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/api/models/Post.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "148034"
}
],
"symlink_target": ""
} |
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.1'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
style_prefix = 'app/assets/stylesheets/'
image_prefix = 'app/assets/images/'
#css = Dir["#{style_prefix}**/*.css"].map { |x| x.gsub(style_prefix, '') }
image = Dir["#{image_prefix}**/*"].map { |x| x.gsub(image_prefix, '') }
scss = Dir["#{style_prefix}**/*.scss"].map { |x| x.gsub(style_prefix, '') }
Rails.application.config.assets.precompile = (scss + image)
Rails.application.config.assets.precompile << Proc.new { |path|
if path =~ /\.(eot|svg|ttf|woff|woff2)\z/
true
end
}
| {
"content_hash": "7cb7548bbb39a9a443f29f142d574f8f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 93,
"avg_line_length": 40.65217391304348,
"alnum_prop": 0.6759358288770053,
"repo_name": "sleepinglion/anti-kb",
"id": "b6b8a5440eb1ce1a9b5e4226e3547ca23bc57587",
"size": "935",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/initializers/assets.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "159674"
},
{
"name": "JavaScript",
"bytes": "20882"
},
{
"name": "Ruby",
"bytes": "200965"
},
{
"name": "SCSS",
"bytes": "32483"
}
],
"symlink_target": ""
} |
'use strict';
var path = require('path');
var _ = require('lodash');
function requiredProcessEnv(name) {
if(!process.env[name]) {
throw new Error('You must set the ' + name + ' environment variable');
}
return process.env[name];
}
// All configurations will extend these options
// ============================================
var all = {
env: process.env.NODE_ENV,
// Root path of server
root: path.normalize(__dirname + '/../../..'),
// Server port
port: process.env.PORT || 9000,
// Server IP
ip: process.env.IP || '0.0.0.0',
// Should we populate the DB with sample data?
seedDB: false,
// Secret for session, you will want to change this and make it an environment variable
secrets: {
session: 'portfolio-secret'
},
// List of user roles
userRoles: ['guest', 'user', 'admin'],
// MongoDB connection options
mongo: {
options: {
db: {
safe: true
}
}
},
};
// Export the config object based on the NODE_ENV
// ==============================================
module.exports = _.merge(
all,
require('./' + process.env.NODE_ENV + '.js') || {});
| {
"content_hash": "56f39ef24837322e6b21ddce53e80ceb",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 89,
"avg_line_length": 21.41509433962264,
"alnum_prop": 0.5585903083700441,
"repo_name": "tal1234l/d3-examples",
"id": "d283e7d7ab1c8c98e108a096d42166ae869265d8",
"size": "1135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/config/environment/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "1602"
},
{
"name": "HTML",
"bytes": "11035"
},
{
"name": "JavaScript",
"bytes": "48245"
}
],
"symlink_target": ""
} |
package com.linkedin.parseq;
/**
* An object that can be cancelled with a reason.
*
* @author Chris Pettitt (cpettitt@linkedin.com)
*/
public interface Cancellable
{
/**
* Attempts to cancel the object with the given reason. Check the return
* value to determine if cancellation was successful. Subsequent calls to
* cancel will always return {@code false}.
*
* @param reason an Exception indicating why this object was cancelled
* @return {@code true} iff the object was successfully cancelled as a result
* of this invocation.
*/
boolean cancel(Exception reason);
}
| {
"content_hash": "adac4853688340290f786d6cd90e04b3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 27.772727272727273,
"alnum_prop": 0.707037643207856,
"repo_name": "jodzga/parseq",
"id": "64501049dc24e2f254190290c5f9de0776d3065a",
"size": "1203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/linkedin/parseq/Cancellable.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "409924"
},
{
"name": "Shell",
"bytes": "1416"
},
{
"name": "XML",
"bytes": "2063"
}
],
"symlink_target": ""
} |
---
id: getting-started
title: Getting started
---
# Getting started
<div style='color:white; background:#B12F5C; padding: 1.5rem; border-radius: 5px; text-align:center'>
<div style='font-size:1.3rem; margin-bottom: 0.5rem'>
Migration to <a href='https://github.com/shnam7/gulp-tron' target='_blank' style='color:#FFE21f'>gulp-tron</a>
</div>
<div>gulp-build-manager is no longer maintained. Please use <a href='https://github.com/shnam7/gulp-tron' target='_blank' style='color:#FFE21f'>gulp-tron</a> instead.</div>
</div>
## Installation
Gulp Build Manager can be installed with NPM.
```bash
npm i gulp-build-manager --save-dev
npm i gulp --save-dev
```
Note that gulp 4.0 or higher version is also required. It's not installed automatically with gulp-build-manager. So, you have to install it manually.
## Node module dependency
gbm uses various node module, but most of them are not installed with gbm automatically becuase only parts of them could be used depending on user's project requirements. To minimize the overhead on module dependency, gbm tries to keepit as small as possible. So, when you first try to use gbm, you would see warnings like this:
```sh
[01:14:22] Using gulpfile D:\dev\pub\gulp-build-manager\gulpfile.js
[01:14:22] Starting '01-watcher:scss'...
[01:14:22] '01-watcher:scss' errored after 48 ms
[01:14:23] Error: Cannot find module 'gulp-sass'
Require stack:
- D:\dev\pub\gulp-build-manager\lib\plugins\CSSPlugin.js
...
```
If you see error messages like this, then you have to install all the missing modules required - 'gulp-sass' in this case.
To reduce this inconvenience, gbm provides automatic module installation options.
## Automatic module installation
gbm provides two ways of installing dependency modules automatically.
### Using command line option: --npm-auto-install (--npm-auto for short)
```sh
# npx gulp <taskName> --npm-auto
# npx gulp <taskName> --npm-auto='npm install options>'
npx gulp task1 --npm-auto # default npm install option is '--save-dev'
npx gulp task2 --npm-auto='--no-save' # default npm install option is '--save-dev'
```
When executing gulp task, --npm-auto=<npm install options> can be used. if <npm install option> is not given, '--save-dev' is used as default.
### Using API: gbm.setNpmOptions(options)
```js
const gbm = require('gulp-build-manager');
// default option valeu: {autoInstall: false, installOptions: '--save-dev'}
gbm.setNpmOptions({autoInstall: true, installOptions: '--no-save'});
```
Automatic module installation feature is initially turned off by default because it would degrade overall build task execution performance. Once build tasks are executed with this turned on, then package.json file will be updated as per the given installation options (default: '--save-dev'). Once all the required modules are installed, it is recommended to turn this feature off for better performance. If the moduels already installed, installation action is skipped. However, all the modules requiring using automatic installation API will run in sequence, not in parallel, because each npm installation command should update package.json sequencially.
### Using automatic installation API
For user build actiosn, gbm provides two utility functions.
- gbm.utils.npmInstall(modules)
- gbm.utils.requireSafe(module)
```js
const gbm = require('gulp-build-manager');
// gbm.utils.npmInstall(moduleNames, options);
// gbm.utils.requireSafe(moduleName);
// examples
gbm.utils.npmInstall('react'); // single module installation
gbm.utils.npmInstall(['react', 'react-dom', ...]); // multiple module installation
// Ensure the module is installed and returns it
const pcss = gbm.utils.requireSafe('gulp-postcss');
```
Typically, it is recommended to use these API in build functions such as conf.preBuild, so that the installation to be done only when the build task is executed. See [examples][1] in gbm source for actual usage cases.
## Quick Start
### Create gbm instance
```js
const gbm = require('gulp-build-manager');
const upath = require('upath');
const basePath = upath.relative(process.cwd(), __dirname);
const srcRoot = upath.join(basePath, 'assets');
const destRoot = upath.join(basePath, 'www');
```
It is recommended to use upath which is automatically installed with gbm as dependency. upath replaces the windows \ with the unix / in all string params & results, making everything simple and consistent.
In addition, it is a good idea to set up basic root directories:
- basePath: project root directory
- srcRoot: source root directory for input files
- destRoot: destination root directory for output files
### Prepare BuildConfig (conf)
```js
const scss = {
buildName: 'scss',
builder: (rtb) => rtb.src().pipe(sass().on('error', sass.logError)).dest(),
src: upath.join(srcRoot, 'scss/**/*.scss'),
dest: upath.join(destRoot, 'css'),
clean: upath.join(destRoot, 'css'),
}
```
'builder' property is for main build function. rtb, runtime builder, is available in the build function as first argument. it provides rich API for build process and its conf property(rtb.conf) has all the information given in ths BuildConfig object. conf.clean will be added to internal cleaner task, which will clean up all the registered clean targets when executed.
Refer to [Build Config][0] for detailed information on BuildConfig type.
### Create build project
```js
gbm.createProject(scss)
.addWatcher()
.addCleaner()
```
gbm.createproject() will actually analyze BuildConfig(scss) and create gulp task to execute scss.builder function. addWatch will create gulp watch task which will monitor files described in scss.src. addCleaner() creates cleaner task to erase all the clean targets found in conf.clean properties.
### Consolidation: gulpfile.js
Combining all the steps above will result in the codes below:
```js
const gbm = require('gulp-build-manager');
const upath = require('upath');
const basePath = upath.relative(process.cwd(), __dirname);
const srcRoot = upath.join(basePath, 'assets');
const destRoot = upath.join(basePath, 'www');
const scss = {
buildName: 'scss',
builder: (rtb) => rtb.src().pipe(sass().on('error', sass.logError)).dest(),
src: upath.join(srcRoot, 'scss/**/*.scss'),
dest: upath.join(destRoot, 'css'),
clean: upath.join(destRoot, 'css'),
};
gbm.createProject(scss)
.addWatcher()
.addCleaner();
```
This gulpfile.js will create 3 gulp tasks:
- scss: scss transpiles (task name is from scss.buildName)
- @watch: watch task monitoring files described in scss.src (default task name is @watch)
- @clean: clean task to delete files described in scss.clean (default task name is @clean)
## Built-in builders
gbm provides predefined built-in builders that can be used immediately with no cost. For example, above 'scss BuildConfig can be written GCSSBuilder like this:
```js
const scss = {
buildName: 'scss',
builder: 'GCSSBuilder',
src: upath.join(srcRoot, 'scss/**/*.scss'),
dest: upath.join(destRoot, 'css'),
clean: upath.join(destRoot, 'css'),
};
```
Currently, following built-in builders are available:
- [GBuilder]({{site.baseurl}}/contents/builtin-builders/GBuilder)
- [GCoffeeScriptBuilder]({{site.baseurl}}/contents/builtin-builders/GCoffeeScriptBuilder)
- [GConcatBuilder]({{site.baseurl}}/contents/builtin-builders/GConcatBuilder)
- [GCSSBuilder]({{site.baseurl}}/contents/builtin-builders/GCSSBuilder)
- [GImagesBuilder]({{site.baseurl}}/contents/builtin-builders/GImagesBuilder)
- [GJavaScriptBuilder]({{site.baseurl}}/contents/builtin-builders/GJavaScriptBuilder)
- [GJekyllBuilder]({{site.baseurl}}/contents/builtin-builders/GJekyllBuilder)
- [GMarkdownBuilder]({{site.baseurl}}/contents/builtin-builders/GMarkdownBuilder)
- [GPaniniBuilder]({{site.baseurl}}/contents/builtin-builders/GPaniniBuilder)
- [GRTLCSSBuilder]({{site.baseurl}}/contents/builtin-builders/GRTLCSSBuilder)
- [GTwigBuilder]({{site.baseurl}}/contents/builtin-builders/GTwigBuilder)
- [GTypeScriptBuilder]({{site.baseurl}}/contents/builtin-builders/GTypeScriptBuilder)
- [GWebpackBuilder]({{site.baseurl}}/contents/builtin-builders/GWebpackBuilder)
- [GZipBuilder]({{site.baseurl}}/contents/builtin-builders/GZipBuilder)
## Examples
gbm source comes with various [examples][1], which can be helpful in understanding gbm usage. It is highly recommended to check it.
## Migration from v3
Version 4 has substantial changes from v3, and it's not compatible with v3 or earlier versions. You can refer to [Migration guide][2], but it's recommended to see the [examples][1] and create your project configuration file again, which can be easier than migration.
[0]: {{site.baseurl}}/contents/02-build-config
[1]: https://github.com/shnam7/gulp-build-manager/tree/master/examples
[2]: {{site.baseurl}}/contents/09-migration-from-v3
| {
"content_hash": "0236fbc83704b8d3b8c5dd50479b6eda",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 656,
"avg_line_length": 42.49038461538461,
"alnum_prop": 0.7463226974428604,
"repo_name": "shnam7/gulp-build-manager",
"id": "fe7a8c8106a4650bf401740865cd71b09937db2a",
"size": "8838",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/contents/01-getting-started.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "5151"
},
{
"name": "TypeScript",
"bytes": "63730"
}
],
"symlink_target": ""
} |
from unittest import TestCase
from chatterbot.corpus import Corpus
import os
class CorpusUtilsTestCase(TestCase):
def setUp(self):
self.corpus = Corpus()
def test_get_file_path(self):
"""
Test that a dotted path is properly converted to a file address.
"""
path = self.corpus.get_file_path("chatterbot.corpus.english")
self.assertIn(
os.path.join("chatterbot", "corpus", "data", "english"),
path
)
def test_read_corpus(self):
corpus_path = os.path.join(
self.corpus.data_directory,
"english", "conversations.json"
)
data = self.corpus.read_corpus(corpus_path)
self.assertIn("conversations", data)
def test_load_corpus(self):
corpus = self.corpus.load_corpus("chatterbot.corpus.english.greetings")
self.assertEqual(len(corpus), 1)
self.assertIn(["Hi", "Hello"], corpus[0])
def test_load_corpus_general(self):
corpus = self.corpus.load_corpus("chatterbot.corpus.english")
self.assertEqual(len(corpus), 3)
self.assertIn(["Hi", "Hello"], corpus[1])
| {
"content_hash": "b566b228bcaac5266f86a77b5257fe63",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 28.975,
"alnum_prop": 0.6125970664365833,
"repo_name": "DarkmatterVale/ChatterBot",
"id": "1245a7342f844207912760623616c92477e4b609",
"size": "1159",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/corpus_tests/test_corpus.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "113984"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "c6d15b4697e4469639dc2262cce9ccc1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "aba50598b5fc4c8157a60a5721361ac0f523c50b",
"size": "200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Phanerostylis pedunculosa/ Syn. Brickellia pedunculosa/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.firstPathElementIsArtifactName = void 0;
const firstPathElementIsArtifactName = false;exports.firstPathElementIsArtifactName = firstPathElementIsArtifactName;
//# sourceMappingURL=artifactSettings.js.map | {
"content_hash": "97d48a4b0ee99984cc803c8ab1e25eb2",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 123,
"avg_line_length": 71.75,
"alnum_prop": 0.8327526132404182,
"repo_name": "codefoundries/UniversalRelayBoilerplate",
"id": "421dee8c54bff75b470af31acf6da3d29d217dbd",
"size": "287",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "deployment/units/_configuration/rb-base-server/artifactSettings.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "242803"
},
{
"name": "HTML",
"bytes": "1496"
},
{
"name": "JavaScript",
"bytes": "276224"
}
],
"symlink_target": ""
} |
package org.apache.geode.distributed.internal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.SystemFailure;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.gms.messages.ViewAckMessage;
import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.monitoring.ThreadsMonitoring;
import org.apache.geode.internal.monitoring.ThreadsMonitoringImpl;
import org.apache.geode.internal.monitoring.ThreadsMonitoringImplDummy;
import org.apache.geode.internal.tcp.ConnectionTable;
import org.apache.geode.logging.internal.log4j.api.LogService;
public class ClusterOperationExecutors implements OperationExecutors {
private static final Logger logger = LogService.getLogger();
/**
* maximum time, in milliseconds, to wait for all threads to exit
*/
static final int MAX_STOP_TIME = 20000;
/**
* Time to sleep, in milliseconds, while polling to see if threads have finished
*/
static final int STOP_PAUSE_TIME = 1000;
/**
* Flag indicating whether to use single Serial-Executor thread or Multiple Serial-executor
* thread,
*/
private static final boolean MULTI_SERIAL_EXECUTORS =
!Boolean.getBoolean("DistributionManager.singleSerialExecutor");
private static final int MAX_WAITING_THREADS =
Integer.getInteger("DistributionManager.MAX_WAITING_THREADS", Integer.MAX_VALUE);
private static final int MAX_PR_META_DATA_CLEANUP_THREADS =
Integer.getInteger("DistributionManager.MAX_PR_META_DATA_CLEANUP_THREADS", 1);
private static final int MAX_PR_THREADS = Integer.getInteger("DistributionManager.MAX_PR_THREADS",
Math.max(Runtime.getRuntime().availableProcessors() * 4, 16));
private static final int INCOMING_QUEUE_LIMIT =
Integer.getInteger("DistributionManager.INCOMING_QUEUE_LIMIT", 80000);
/** Throttling based on the Queue byte size */
private static final double THROTTLE_PERCENT = (double) (Integer
.getInteger("DistributionManager.SERIAL_QUEUE_THROTTLE_PERCENT", 75)) / 100;
private static final int SERIAL_QUEUE_BYTE_LIMIT = Integer
.getInteger("DistributionManager.SERIAL_QUEUE_BYTE_LIMIT", (40 * (1024 * 1024)));
private static final int SERIAL_QUEUE_THROTTLE =
Integer.getInteger("DistributionManager.SERIAL_QUEUE_THROTTLE",
(int) (SERIAL_QUEUE_BYTE_LIMIT * THROTTLE_PERCENT));
private static final int TOTAL_SERIAL_QUEUE_BYTE_LIMIT =
Integer.getInteger("DistributionManager.TOTAL_SERIAL_QUEUE_BYTE_LIMIT", (80 * (1024 * 1024)));
private static final int TOTAL_SERIAL_QUEUE_THROTTLE =
Integer.getInteger("DistributionManager.TOTAL_SERIAL_QUEUE_THROTTLE",
(int) (SERIAL_QUEUE_BYTE_LIMIT * THROTTLE_PERCENT));
/** Throttling based on the Queue item size */
private static final int SERIAL_QUEUE_SIZE_LIMIT =
Integer.getInteger("DistributionManager.SERIAL_QUEUE_SIZE_LIMIT", 20000);
private static final int SERIAL_QUEUE_SIZE_THROTTLE =
Integer.getInteger("DistributionManager.SERIAL_QUEUE_SIZE_THROTTLE",
(int) (SERIAL_QUEUE_SIZE_LIMIT * THROTTLE_PERCENT));
/** Max number of serial Queue executors, in case of multi-serial-queue executor */
private static final int MAX_SERIAL_QUEUE_THREAD =
Integer.getInteger("DistributionManager.MAX_SERIAL_QUEUE_THREAD", 20);
// 76 not in use
/**
* Executor for view related messages
*
* @see ViewAckMessage
*/
public static final int VIEW_EXECUTOR = 79;
private InternalDistributedSystem system;
private DistributionStats stats;
/** Message processing thread pool */
private ExecutorService threadPool;
/**
* High Priority processing thread pool, used for initializing messages such as UpdateAttributes
* and CreateRegion messages
*/
private ExecutorService highPriorityPool;
/**
* Waiting Pool, used for messages that may have to wait on something. Use this separate pool with
* an unbounded queue so that waiting runnables don't get in the way of other processing threads.
* Used for threads that will most likely have to wait for a region to be finished initializing
* before it can proceed
*/
private ExecutorService waitingPool;
private ExecutorService prMetaDataCleanupThreadPool;
/**
* Thread used to decouple {@link org.apache.geode.internal.cache.partitioned.PartitionMessage}s
* from {@link org.apache.geode.internal.cache.DistributedCacheOperation}s </b>
*
* @see #SERIAL_EXECUTOR
*/
private ExecutorService partitionedRegionThread;
private ExecutorService partitionedRegionPool;
/** Function Execution executors */
private ExecutorService functionExecutionThread;
private ExecutorService functionExecutionPool;
/** Message processing executor for serial, ordered, messages. */
private ExecutorService serialThread;
/**
* If using a throttling queue for the serialThread, we cache the queue here so we can see if
* delivery would block
*/
private ThrottlingMemLinkedQueueWithDMStats<Runnable> serialQueue;
/**
* Thread Monitor mechanism to monitor system threads
*
* @see org.apache.geode.internal.monitoring.ThreadsMonitoring
*/
private ThreadsMonitoring threadMonitor;
private SerialQueuedExecutorPool serialQueuedExecutorPool;
ClusterOperationExecutors(DistributionStats stats,
InternalDistributedSystem system) {
this.stats = stats;
this.system = system;
DistributionConfig config = system.getConfig();
threadMonitor = config.getThreadMonitorEnabled() ? new ThreadsMonitoringImpl(system)
: new ThreadsMonitoringImplDummy();
if (MULTI_SERIAL_EXECUTORS) {
if (logger.isInfoEnabled(LogMarker.DM_MARKER)) {
logger.info(LogMarker.DM_MARKER,
"Serial Queue info :" + " THROTTLE_PERCENT: " + THROTTLE_PERCENT
+ " SERIAL_QUEUE_BYTE_LIMIT :" + SERIAL_QUEUE_BYTE_LIMIT
+ " SERIAL_QUEUE_THROTTLE :" + SERIAL_QUEUE_THROTTLE
+ " TOTAL_SERIAL_QUEUE_BYTE_LIMIT :" + TOTAL_SERIAL_QUEUE_BYTE_LIMIT
+ " TOTAL_SERIAL_QUEUE_THROTTLE :" + TOTAL_SERIAL_QUEUE_THROTTLE
+ " SERIAL_QUEUE_SIZE_LIMIT :" + SERIAL_QUEUE_SIZE_LIMIT
+ " SERIAL_QUEUE_SIZE_THROTTLE :" + SERIAL_QUEUE_SIZE_THROTTLE);
}
// when TCP/IP is disabled we can't throttle the serial queue or we run the risk of
// distributed deadlock when we block the UDP reader thread
boolean throttlingDisabled = system.getConfig().getDisableTcp();
serialQueuedExecutorPool =
new SerialQueuedExecutorPool(stats, throttlingDisabled, threadMonitor);
}
{
BlockingQueue<Runnable> poolQueue;
if (SERIAL_QUEUE_BYTE_LIMIT == 0) {
poolQueue = new OverflowQueueWithDMStats<>(stats.getSerialQueueHelper());
} else {
serialQueue =
new ThrottlingMemLinkedQueueWithDMStats<>(TOTAL_SERIAL_QUEUE_BYTE_LIMIT,
TOTAL_SERIAL_QUEUE_THROTTLE, SERIAL_QUEUE_SIZE_LIMIT, SERIAL_QUEUE_SIZE_THROTTLE,
stats.getSerialQueueHelper());
poolQueue = serialQueue;
}
serialThread = CoreLoggingExecutors.newSerialThreadPool("Serial Message Processor",
thread -> stats.incSerialThreadStarts(),
this::doSerialThread, stats.getSerialProcessorHelper(),
threadMonitor, poolQueue);
}
threadPool =
CoreLoggingExecutors.newThreadPoolWithFeedStatistics("Pooled Message Processor ",
thread -> stats.incProcessingThreadStarts(), this::doProcessingThread,
MAX_THREADS, stats.getNormalPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getOverflowQueueHelper());
highPriorityPool = CoreLoggingExecutors.newThreadPoolWithFeedStatistics(
"Pooled High Priority Message Processor ",
thread -> stats.incHighPriorityThreadStarts(), this::doHighPriorityThread,
MAX_THREADS, stats.getHighPriorityPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getHighPriorityQueueHelper());
{
BlockingQueue<Runnable> poolQueue;
if (MAX_WAITING_THREADS == Integer.MAX_VALUE) {
// no need for a queue since we have infinite threads
poolQueue = new SynchronousQueue<>();
} else {
poolQueue = new OverflowQueueWithDMStats<>(stats.getWaitingQueueHelper());
}
waitingPool = CoreLoggingExecutors.newThreadPool("Pooled Waiting Message Processor ",
thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
MAX_WAITING_THREADS, stats.getWaitingPoolHelper(), threadMonitor, poolQueue);
}
// should this pool using the waiting pool stats?
prMetaDataCleanupThreadPool =
CoreLoggingExecutors.newThreadPoolWithFeedStatistics(
"PrMetaData cleanup Message Processor ",
thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
MAX_PR_META_DATA_CLEANUP_THREADS, stats.getWaitingPoolHelper(), threadMonitor,
0, stats.getWaitingQueueHelper());
if (MAX_PR_THREADS > 1) {
partitionedRegionPool =
CoreLoggingExecutors.newThreadPoolWithFeedStatistics(
"PartitionedRegion Message Processor",
thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
MAX_PR_THREADS, stats.getPartitionedRegionPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
} else {
partitionedRegionThread = CoreLoggingExecutors.newSerialThreadPoolWithFeedStatistics(
"PartitionedRegion Message Processor",
thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
stats.getPartitionedRegionPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
}
if (MAX_FE_THREADS > 1) {
functionExecutionPool =
CoreLoggingExecutors.newFunctionThreadPoolWithFeedStatistics(
FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
MAX_FE_THREADS, stats.getFunctionExecutionPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
} else {
functionExecutionThread =
CoreLoggingExecutors.newSerialThreadPoolWithFeedStatistics(
FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
stats.getFunctionExecutionPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
}
}
/**
* Returns the executor for the given type of processor.
*/
@Override
public Executor getExecutor(int processorType, InternalDistributedMember sender) {
switch (processorType) {
case STANDARD_EXECUTOR:
return getThreadPool();
case SERIAL_EXECUTOR:
return getSerialExecutor(sender);
case HIGH_PRIORITY_EXECUTOR:
return getHighPriorityThreadPool();
case WAITING_POOL_EXECUTOR:
return getWaitingThreadPool();
case PARTITIONED_REGION_EXECUTOR:
return getPartitionedRegionExcecutor();
case REGION_FUNCTION_EXECUTION_EXECUTOR:
return getFunctionExecutor();
default:
throw new InternalGemFireError(String.format("unknown processor type %s",
processorType));
}
}
@Override
public ExecutorService getThreadPool() {
return threadPool;
}
@Override
public ExecutorService getHighPriorityThreadPool() {
return highPriorityPool;
}
@Override
public ExecutorService getWaitingThreadPool() {
return waitingPool;
}
@Override
public ExecutorService getPrMetaDataCleanupThreadPool() {
return prMetaDataCleanupThreadPool;
}
private Executor getPartitionedRegionExcecutor() {
if (partitionedRegionThread != null) {
return partitionedRegionThread;
} else {
return partitionedRegionPool;
}
}
@Override
public Executor getFunctionExecutor() {
if (functionExecutionThread != null) {
return functionExecutionThread;
} else {
return functionExecutionPool;
}
}
private Executor getSerialExecutor(InternalDistributedMember sender) {
if (MULTI_SERIAL_EXECUTORS) {
return serialQueuedExecutorPool.getThrottledSerialExecutor(sender);
} else {
return serialThread;
}
}
/** returns the serialThread's queue if throttling is being used, null if not */
@Override
public OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
if (MULTI_SERIAL_EXECUTORS) {
return serialQueuedExecutorPool.getSerialQueue(sender);
} else {
return serialQueue;
}
}
public ThreadsMonitoring getThreadMonitoring() {
return threadMonitor;
}
private void doFunctionExecutionThread(Runnable command) {
stats.incFunctionExecutionThreads(1);
FunctionExecutionPooledExecutor.setIsFunctionExecutionThread(Boolean.TRUE);
try {
ConnectionTable.threadWantsSharedResources();
runUntilShutdown(command);
} finally {
ConnectionTable.releaseThreadsSockets();
stats.incFunctionExecutionThreads(-1);
FunctionExecutionPooledExecutor.setIsFunctionExecutionThread(Boolean.FALSE);
}
}
private void doProcessingThread(Runnable command) {
stats.incNumProcessingThreads(1);
try {
ConnectionTable.threadWantsSharedResources();
runUntilShutdown(command);
} finally {
ConnectionTable.releaseThreadsSockets();
stats.incNumProcessingThreads(-1);
}
}
private void doHighPriorityThread(Runnable command) {
stats.incHighPriorityThreads(1);
try {
ConnectionTable.threadWantsSharedResources();
runUntilShutdown(command);
} finally {
ConnectionTable.releaseThreadsSockets();
stats.incHighPriorityThreads(-1);
}
}
private void doWaitingThread(Runnable command) {
stats.incWaitingThreads(1);
try {
ConnectionTable.threadWantsSharedResources();
runUntilShutdown(command);
} finally {
ConnectionTable.releaseThreadsSockets();
stats.incWaitingThreads(-1);
}
}
private void doPartitionRegionThread(Runnable command) {
stats.incPartitionedRegionThreads(1);
try {
ConnectionTable.threadWantsSharedResources();
runUntilShutdown(command);
} finally {
ConnectionTable.releaseThreadsSockets();
stats.incPartitionedRegionThreads(-1);
}
}
private void doSerialThread(Runnable command) {
stats.incNumSerialThreads(1);
try {
ConnectionTable.threadWantsSharedResources();
runUntilShutdown(command);
} finally {
ConnectionTable.releaseThreadsSockets();
stats.incNumSerialThreads(-1);
}
}
private void runUntilShutdown(Runnable r) {
try {
r.run();
} catch (CancelException e) {
if (logger.isTraceEnabled()) {
logger.trace("Caught shutdown exception", e);
}
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
} catch (Throwable t) {
SystemFailure.checkFailure();
if (!system.isDisconnecting()) {
logger.debug("Caught unusual exception during shutdown: {}", t.getMessage(), t);
} else {
logger.warn("Task failed with exception", t);
}
}
}
void askThreadsToStop() {
// Stop executors after they have finished
ExecutorService es;
threadMonitor.close();
es = serialThread;
if (es != null) {
es.shutdown();
}
if (serialQueuedExecutorPool != null) {
serialQueuedExecutorPool.shutdown();
}
es = functionExecutionThread;
if (es != null) {
es.shutdown();
}
es = functionExecutionPool;
if (es != null) {
es.shutdown();
}
es = partitionedRegionThread;
if (es != null) {
es.shutdown();
}
es = partitionedRegionPool;
if (es != null) {
es.shutdown();
}
es = highPriorityPool;
if (es != null) {
es.shutdown();
}
es = waitingPool;
if (es != null) {
es.shutdown();
}
es = prMetaDataCleanupThreadPool;
if (es != null) {
es.shutdown();
}
es = threadPool;
if (es != null) {
es.shutdown();
}
}
void waitForThreadsToStop(long timeInMillis) throws InterruptedException {
long start = System.currentTimeMillis();
long remaining = timeInMillis;
ExecutorService[] allExecutors = new ExecutorService[] {serialThread,
functionExecutionThread, functionExecutionPool, partitionedRegionThread,
partitionedRegionPool, highPriorityPool, waitingPool,
prMetaDataCleanupThreadPool, threadPool};
for (ExecutorService es : allExecutors) {
if (es != null) {
es.awaitTermination(remaining, TimeUnit.MILLISECONDS);
}
remaining = timeInMillis - (System.currentTimeMillis() - start);
if (remaining <= 0) {
return;
}
}
serialQueuedExecutorPool.awaitTermination(remaining, TimeUnit.MILLISECONDS);
}
private boolean executorAlive(ExecutorService tpe, String name) {
if (tpe == null) {
return false;
} else {
int ac = ((ThreadPoolExecutor) tpe).getActiveCount();
// boolean result = tpe.getActiveCount() > 0;
if (ac > 0) {
if (logger.isDebugEnabled()) {
logger.debug("Still waiting for {} threads in '{}' pool to exit", ac, name);
}
return true;
} else {
return false;
}
}
}
/**
* Wait for the ancillary queues to exit. Kills them if they are still around.
*
*/
void forceThreadsToStop() {
long endTime = System.currentTimeMillis() + MAX_STOP_TIME;
StringBuilder culprits;
for (;;) {
boolean stillAlive = false;
culprits = new StringBuilder();
if (executorAlive(serialThread, "serial thread")) {
stillAlive = true;
culprits.append(" serial thread;");
}
if (executorAlive(partitionedRegionThread, "partitioned region thread")) {
stillAlive = true;
culprits.append(" partitioned region thread;");
}
if (executorAlive(partitionedRegionPool, "partitioned region pool")) {
stillAlive = true;
culprits.append(" partitioned region pool;");
}
if (executorAlive(highPriorityPool, "high priority pool")) {
stillAlive = true;
culprits.append(" high priority pool;");
}
if (executorAlive(waitingPool, "waiting pool")) {
stillAlive = true;
culprits.append(" waiting pool;");
}
if (executorAlive(prMetaDataCleanupThreadPool, "prMetaDataCleanupThreadPool")) {
stillAlive = true;
culprits.append(" special waiting pool;");
}
if (executorAlive(threadPool, "thread pool")) {
stillAlive = true;
culprits.append(" thread pool;");
}
if (!stillAlive)
return;
long now = System.currentTimeMillis();
if (now >= endTime)
break;
try {
Thread.sleep(STOP_PAUSE_TIME);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
// Desperation, the shutdown thread is being killed. Don't
// consult a CancelCriterion.
logger.warn("Interrupted during shutdown", e);
break;
}
} // for
logger.warn("Daemon threads are slow to stop; culprits include: {}",
culprits);
// Kill with no mercy
if (serialThread != null) {
serialThread.shutdownNow();
}
if (functionExecutionThread != null) {
functionExecutionThread.shutdownNow();
}
if (functionExecutionPool != null) {
functionExecutionPool.shutdownNow();
}
if (partitionedRegionThread != null) {
partitionedRegionThread.shutdownNow();
}
if (partitionedRegionPool != null) {
partitionedRegionPool.shutdownNow();
}
if (highPriorityPool != null) {
highPriorityPool.shutdownNow();
}
if (waitingPool != null) {
waitingPool.shutdownNow();
}
if (prMetaDataCleanupThreadPool != null) {
prMetaDataCleanupThreadPool.shutdownNow();
}
if (threadPool != null) {
threadPool.shutdownNow();
}
}
public void handleManagerDeparture(InternalDistributedMember theId) {
if (serialQueuedExecutorPool != null) {
serialQueuedExecutorPool.handleMemberDeparture(theId);
}
}
/**
* This class is used for DM's multi serial executor. The serial messages are managed/executed by
* multiple serial thread. This class takes care of executing messages related to a sender using
* the same thread.
*/
private static class SerialQueuedExecutorPool {
/** To store the serial threads */
final ConcurrentMap<Integer, ExecutorService> serialQueuedExecutorMap =
new ConcurrentHashMap<>(MAX_SERIAL_QUEUE_THREAD);
/** To store the queue associated with thread */
final Map<Integer, OverflowQueueWithDMStats<Runnable>> serialQueuedMap =
new HashMap<>(MAX_SERIAL_QUEUE_THREAD);
/** Holds mapping between sender to the serial thread-id */
final Map<InternalDistributedMember, Integer> senderToSerialQueueIdMap = new HashMap<>();
/**
* Holds info about unused thread, a thread is marked unused when the member associated with it
* has left distribution system.
*/
final ArrayList<Integer> threadMarkedForUse = new ArrayList<>();
final DistributionStats stats;
final boolean throttlingDisabled;
final ThreadsMonitoring threadMonitoring;
SerialQueuedExecutorPool(DistributionStats stats,
boolean throttlingDisabled, ThreadsMonitoring tMonitoring) {
this.stats = stats;
this.throttlingDisabled = throttlingDisabled;
threadMonitoring = tMonitoring;
}
/*
* Returns an id of the thread in serialQueuedExecutorMap, thats mapped to the given seder.
*
*
* @param createNew boolean flag to indicate whether to create a new id, if id doesnot exists.
*/
private Integer getQueueId(InternalDistributedMember sender, boolean createNew) {
// Create a new Id.
Integer queueId;
synchronized (senderToSerialQueueIdMap) {
// Check if there is a executor associated with this sender.
queueId = senderToSerialQueueIdMap.get(sender);
if (!createNew || queueId != null) {
return queueId;
}
// Create new.
// Check if any threads are availabe that is marked for Use.
if (!threadMarkedForUse.isEmpty()) {
queueId = threadMarkedForUse.remove(0);
}
// If Map is full, use the threads in round-robin fashion.
if (queueId == null) {
queueId = (serialQueuedExecutorMap.size() + 1) % MAX_SERIAL_QUEUE_THREAD;
}
senderToSerialQueueIdMap.put(sender, queueId);
}
return queueId;
}
/*
* Returns the queue associated with this sender. Used in FlowControl for throttling (based on
* queue size).
*/
OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
Integer queueId = getQueueId(sender, false);
if (queueId == null) {
return null;
}
return serialQueuedMap.get(queueId);
}
/*
* Returns the serial queue executor, before returning the thread this applies throttling, based
* on the total serial queue size (total - sum of all the serial queue size). The throttling is
* applied during put event, this doesnt block the extract operation on the queue.
*
*/
ExecutorService getThrottledSerialExecutor(
InternalDistributedMember sender) {
ExecutorService executor = getSerialExecutor(sender);
// Get the total serial queue size.
long totalSerialQueueMemSize = stats.getInternalSerialQueueBytes();
// for tcp socket reader threads, this code throttles the thread
// to keep the sender-side from overwhelming the receiver.
// UDP readers are throttled in the FC protocol, which queries
// the queue to see if it should throttle
if (stats.getInternalSerialQueueBytes() > TOTAL_SERIAL_QUEUE_THROTTLE
&& !DistributionMessage.isMembershipMessengerThread()) {
do {
boolean interrupted = Thread.interrupted();
try {
float throttlePercent = (float) (totalSerialQueueMemSize - TOTAL_SERIAL_QUEUE_THROTTLE)
/ (float) (TOTAL_SERIAL_QUEUE_BYTE_LIMIT - TOTAL_SERIAL_QUEUE_THROTTLE);
int sleep = (int) (100.0 * throttlePercent);
sleep = Math.max(sleep, 1);
Thread.sleep(sleep);
} catch (InterruptedException ex) {
interrupted = true;
// FIXME-InterruptedException
// Perhaps we should return null here?
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
stats.getSerialQueueHelper().incThrottleCount();
} while (stats.getInternalSerialQueueBytes() >= TOTAL_SERIAL_QUEUE_BYTE_LIMIT);
}
return executor;
}
/*
* Returns the serial queue executor for the given sender.
*/
ExecutorService getSerialExecutor(InternalDistributedMember sender) {
ExecutorService executor;
Integer queueId = getQueueId(sender, true);
if ((executor =
serialQueuedExecutorMap.get(queueId)) != null) {
return executor;
}
// If executor doesn't exists for this sender, create one.
executor = createSerialExecutor(queueId);
serialQueuedExecutorMap.put(queueId, executor);
if (logger.isDebugEnabled()) {
logger.debug(
"Created Serial Queued Executor With queueId {}. Total number of live Serial Threads :{}",
queueId, serialQueuedExecutorMap.size());
}
stats.incSerialPooledThread();
return executor;
}
/*
* Creates a serial queue executor.
*/
private ExecutorService createSerialExecutor(final Integer id) {
OverflowQueueWithDMStats<Runnable> poolQueue;
if (SERIAL_QUEUE_BYTE_LIMIT == 0 || throttlingDisabled) {
poolQueue = new OverflowQueueWithDMStats<>(stats.getSerialQueueHelper());
} else {
poolQueue = new ThrottlingMemLinkedQueueWithDMStats<>(SERIAL_QUEUE_BYTE_LIMIT,
SERIAL_QUEUE_THROTTLE, SERIAL_QUEUE_SIZE_LIMIT, SERIAL_QUEUE_SIZE_THROTTLE,
stats.getSerialQueueHelper());
}
serialQueuedMap.put(id, poolQueue);
return CoreLoggingExecutors.newSerialThreadPool("Pooled Serial Message Processor" + id + "-",
thread -> stats.incSerialPooledThreadStarts(), this::doSerialPooledThread,
stats.getSerialPooledProcessorHelper(), threadMonitoring, poolQueue);
}
private void doSerialPooledThread(Runnable command) {
ConnectionTable.threadWantsSharedResources();
try {
command.run();
} finally {
ConnectionTable.releaseThreadsSockets();
}
}
/*
* Does cleanup relating to this member. And marks the serial executor associated with this
* member for re-use.
*/
private void handleMemberDeparture(InternalDistributedMember member) {
Integer queueId = getQueueId(member, false);
if (queueId == null) {
return;
}
boolean isUsed = false;
synchronized (senderToSerialQueueIdMap) {
senderToSerialQueueIdMap.remove(member);
// Check if any other members are using the same executor.
for (Integer value : senderToSerialQueueIdMap.values()) {
if (value.equals(queueId)) {
isUsed = true;
break;
}
}
// If not used mark this as unused.
if (!isUsed) {
if (logger.isInfoEnabled(LogMarker.DM_MARKER))
logger.info(LogMarker.DM_MARKER,
"Marking the SerialQueuedExecutor with id : {} used by the member {} to be unused.",
new Object[] {queueId, member});
threadMarkedForUse.add(queueId);
}
}
}
private void awaitTermination(long time, TimeUnit unit) throws InterruptedException {
long remainingNanos = unit.toNanos(time);
long start = System.nanoTime();
for (ExecutorService executor : serialQueuedExecutorMap.values()) {
executor.awaitTermination(remainingNanos, TimeUnit.NANOSECONDS);
remainingNanos = (System.nanoTime() - start);
if (remainingNanos <= 0) {
return;
}
}
}
private void shutdown() {
for (ExecutorService executor : serialQueuedExecutorMap
.values()) {
executor.shutdown();
}
}
}
}
| {
"content_hash": "a6736ab084d1887c4d94b8c08cf2a968",
"timestamp": "",
"source": "github",
"line_count": 861,
"max_line_length": 102,
"avg_line_length": 34.5191637630662,
"alnum_prop": 0.6804616264594058,
"repo_name": "davinash/geode",
"id": "7ea6532d7976f5af9bc0791012fe5b998917eb91",
"size": "30510",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "106707"
},
{
"name": "Go",
"bytes": "1205"
},
{
"name": "Groovy",
"bytes": "2783"
},
{
"name": "HTML",
"bytes": "3917327"
},
{
"name": "Java",
"bytes": "28126965"
},
{
"name": "JavaScript",
"bytes": "1781013"
},
{
"name": "Python",
"bytes": "5014"
},
{
"name": "Ruby",
"bytes": "6686"
},
{
"name": "Shell",
"bytes": "46841"
}
],
"symlink_target": ""
} |
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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.12"/>
<title>OpenCV: cvflann::KDTreeIndex< Distance > Class Template Reference</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
TeX: {
Macros: {
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
hdotsfor: ["\\dots", 1],
mathbbm: ["\\mathbb{#1}", 1],
bordermatrix: ["\\matrix{#1}", 1]
}
}
}
);
//]]>
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">OpenCV
 <span id="projectnumber">3.2.0</span>
</div>
<div id="projectbrief">Open Source Computer Vision</div>
</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
//<![CDATA[
function getLabelName(innerHTML) {
var str = innerHTML.toLowerCase();
// Replace all '+' with 'p'
str = str.split('+').join('p');
// Replace all ' ' with '_'
str = str.split(' ').join('_');
// Replace all '#' with 'sharp'
str = str.split('#').join('sharp');
// Replace other special characters with 'ascii' + code
for (var i = 0; i < str.length; i++) {
var charCode = str.charCodeAt(i);
if (!(charCode == 95 || (charCode > 96 && charCode < 123) || (charCode > 47 && charCode < 58)))
str = str.substr(0, i) + 'ascii' + charCode + str.substr(i + 1);
}
return str;
}
function addToggle() {
var $getDiv = $('div.newInnerHTML').last();
var buttonName = $getDiv.html();
var label = getLabelName(buttonName.trim());
$getDiv.attr("title", label);
$getDiv.hide();
$getDiv = $getDiv.next();
$getDiv.attr("class", "toggleable_div label_" + label);
$getDiv.hide();
}
//]]>
</script>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="../../dc/d8c/namespacecvflann.html">cvflann</a></li><li class="navelem"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="../../df/d3d/classcvflann_1_1KDTreeIndex-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">cvflann::KDTreeIndex< Distance > Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include "kdtree_index.h"</code></p>
<div class="dynheader">
Inheritance diagram for cvflann::KDTreeIndex< Distance >:</div>
<div class="dyncontent">
<div class="center">
<img src="../../df/d36/classcvflann_1_1KDTreeIndex.png" usemap="#cvflann::KDTreeIndex_3C_20Distance_20_3E_map" alt=""/>
<map id="cvflann::KDTreeIndex_3C_20Distance_20_3E_map" name="cvflann::KDTreeIndex< Distance >_map">
<area href="../../d9/d10/classcvflann_1_1NNIndex.html" alt="cvflann::NNIndex< Distance >" shape="rect" coords="0,0,206,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a10ed3a3afa91fed415ab7c2d1b7c4014"><td class="memItemLeft" align="right" valign="top">typedef Distance::ResultType </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a10ed3a3afa91fed415ab7c2d1b7c4014">DistanceType</a></td></tr>
<tr class="separator:a10ed3a3afa91fed415ab7c2d1b7c4014"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a200ee43145794ee028f415f205934d24"><td class="memItemLeft" align="right" valign="top">typedef Distance::ElementType </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a200ee43145794ee028f415f205934d24">ElementType</a></td></tr>
<tr class="separator:a200ee43145794ee028f415f205934d24"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab34211371a9b8731626dafeab2a3d4b8"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#ab34211371a9b8731626dafeab2a3d4b8">KDTreeIndex</a> (const <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a200ee43145794ee028f415f205934d24">ElementType</a> > &inputData, const <a class="el" href="../../dc/d8c/namespacecvflann.html#ad55c74ae3144004b728d68382edbca45">IndexParams</a> &params=<a class="el" href="../../d7/d99/structcvflann_1_1KDTreeIndexParams.html">KDTreeIndexParams</a>(), Distance d=Distance())</td></tr>
<tr class="separator:ab34211371a9b8731626dafeab2a3d4b8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae67afef23555988e9650c0f11740df0a"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#ae67afef23555988e9650c0f11740df0a">KDTreeIndex</a> (const <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a> &)</td></tr>
<tr class="separator:ae67afef23555988e9650c0f11740df0a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4008c75a6da374a57fb6830d65dbc44a"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a4008c75a6da374a57fb6830d65dbc44a">~KDTreeIndex</a> ()</td></tr>
<tr class="separator:a4008c75a6da374a57fb6830d65dbc44a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa5e5a2618d59b26870fea3cc5091d91f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#aa5e5a2618d59b26870fea3cc5091d91f">buildIndex</a> ()</td></tr>
<tr class="separator:aa5e5a2618d59b26870fea3cc5091d91f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ada91fb72025dec63ac669cfe36a1b66f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#ada91fb72025dec63ac669cfe36a1b66f">findNeighbors</a> (<a class="el" href="../../d8/d42/classcvflann_1_1ResultSet.html">ResultSet</a>< <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a10ed3a3afa91fed415ab7c2d1b7c4014">DistanceType</a> > &result, const <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a200ee43145794ee028f415f205934d24">ElementType</a> *vec, const <a class="el" href="../../d6/d59/structcvflann_1_1SearchParams.html">SearchParams</a> &searchParams)</td></tr>
<tr class="separator:ada91fb72025dec63ac669cfe36a1b66f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab399af05af34e72e4341f38d9b05c46f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../dc/d8c/namespacecvflann.html#ad55c74ae3144004b728d68382edbca45">IndexParams</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#ab399af05af34e72e4341f38d9b05c46f">getParameters</a> () const</td></tr>
<tr class="separator:ab399af05af34e72e4341f38d9b05c46f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9aaf2b67e63d7020a8c50d920c5658f4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../dc/d8c/namespacecvflann.html#a4e3e6c98d774ea77fd7f0045c9bc7817">flann_algorithm_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a9aaf2b67e63d7020a8c50d920c5658f4">getType</a> () const</td></tr>
<tr class="separator:a9aaf2b67e63d7020a8c50d920c5658f4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2076c89754589df49d24b5d0fa886afc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a2076c89754589df49d24b5d0fa886afc">loadIndex</a> (FILE *stream)</td></tr>
<tr class="memdesc:a2076c89754589df49d24b5d0fa886afc"><td class="mdescLeft"> </td><td class="mdescRight">Loads the index from a stream. <a href="#a2076c89754589df49d24b5d0fa886afc">More...</a><br /></td></tr>
<tr class="separator:a2076c89754589df49d24b5d0fa886afc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab8fcfe6f0b0fbb2251d5ec220692b77f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#ab8fcfe6f0b0fbb2251d5ec220692b77f">operator=</a> (const <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a> &)</td></tr>
<tr class="separator:ab8fcfe6f0b0fbb2251d5ec220692b77f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a623752bde2c481c8c7bc2c88a702c481"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a623752bde2c481c8c7bc2c88a702c481">saveIndex</a> (FILE *stream)</td></tr>
<tr class="memdesc:a623752bde2c481c8c7bc2c88a702c481"><td class="mdescLeft"> </td><td class="mdescRight">Saves the index to a stream. <a href="#a623752bde2c481c8c7bc2c88a702c481">More...</a><br /></td></tr>
<tr class="separator:a623752bde2c481c8c7bc2c88a702c481"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a98df18be8841e0ae5c509de0002fcfd1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../da/d06/autogenerated_2opencl__core_8hpp.html#a6ff403ead16f7faa1f7228274eb6b01d">size_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a98df18be8841e0ae5c509de0002fcfd1">size</a> () const</td></tr>
<tr class="separator:a98df18be8841e0ae5c509de0002fcfd1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7cb936d0391694cee6291470fbf11bd2"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a7cb936d0391694cee6291470fbf11bd2">usedMemory</a> () const</td></tr>
<tr class="separator:a7cb936d0391694cee6291470fbf11bd2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1af7f1d52a25dff817d8e6af64ea8798"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../da/d06/autogenerated_2opencl__core_8hpp.html#a6ff403ead16f7faa1f7228274eb6b01d">size_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a1af7f1d52a25dff817d8e6af64ea8798">veclen</a> () const</td></tr>
<tr class="separator:a1af7f1d52a25dff817d8e6af64ea8798"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_methods_classcvflann_1_1NNIndex"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcvflann_1_1NNIndex')"><img src="../../closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html">cvflann::NNIndex< Distance ></a></td></tr>
<tr class="memitem:af391eb1a19b60e7d8e08c26c54c46baa inherit pub_methods_classcvflann_1_1NNIndex"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#af391eb1a19b60e7d8e08c26c54c46baa">~NNIndex</a> ()</td></tr>
<tr class="separator:af391eb1a19b60e7d8e08c26c54c46baa inherit pub_methods_classcvflann_1_1NNIndex"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8cf5c942430421358bf67d93565942db inherit pub_methods_classcvflann_1_1NNIndex"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#a8cf5c942430421358bf67d93565942db">knnSearch</a> (const <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< ElementType > &queries, <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< int > &indices, <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< DistanceType > &dists, int knn, const <a class="el" href="../../d6/d59/structcvflann_1_1SearchParams.html">SearchParams</a> &params)</td></tr>
<tr class="memdesc:a8cf5c942430421358bf67d93565942db inherit pub_methods_classcvflann_1_1NNIndex"><td class="mdescLeft"> </td><td class="mdescRight">Perform k-nearest neighbor search. <a href="../../d9/d10/classcvflann_1_1NNIndex.html#a8cf5c942430421358bf67d93565942db">More...</a><br /></td></tr>
<tr class="separator:a8cf5c942430421358bf67d93565942db inherit pub_methods_classcvflann_1_1NNIndex"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a142da9423596dd59766d1dcbcac433e9 inherit pub_methods_classcvflann_1_1NNIndex"><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#a142da9423596dd59766d1dcbcac433e9">radiusSearch</a> (const <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< ElementType > &query, <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< int > &indices, <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< DistanceType > &dists, float radius, const <a class="el" href="../../d6/d59/structcvflann_1_1SearchParams.html">SearchParams</a> &params)</td></tr>
<tr class="memdesc:a142da9423596dd59766d1dcbcac433e9 inherit pub_methods_classcvflann_1_1NNIndex"><td class="mdescLeft"> </td><td class="mdescRight">Perform radius search. <a href="../../d9/d10/classcvflann_1_1NNIndex.html#a142da9423596dd59766d1dcbcac433e9">More...</a><br /></td></tr>
<tr class="separator:a142da9423596dd59766d1dcbcac433e9 inherit pub_methods_classcvflann_1_1NNIndex"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template<typename Distance><br />
class cvflann::KDTreeIndex< Distance ></h3>
<p>Randomized kd-tree index</p>
<p>Contains the k-d trees and other information for indexing a set of points for nearest-neighbor matching. </p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a10ed3a3afa91fed415ab7c2d1b7c4014"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a10ed3a3afa91fed415ab7c2d1b7c4014">§ </a></span>DistanceType</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="memname">
<tr>
<td class="memname">typedef Distance::ResultType <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::<a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a10ed3a3afa91fed415ab7c2d1b7c4014">DistanceType</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a200ee43145794ee028f415f205934d24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a200ee43145794ee028f415f205934d24">§ </a></span>ElementType</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="memname">
<tr>
<td class="memname">typedef Distance::ElementType <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::<a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a200ee43145794ee028f415f205934d24">ElementType</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="ab34211371a9b8731626dafeab2a3d4b8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab34211371a9b8731626dafeab2a3d4b8">§ </a></span>KDTreeIndex() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::<a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="../../d3/db9/classcvflann_1_1Matrix.html">Matrix</a>< <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a200ee43145794ee028f415f205934d24">ElementType</a> > & </td>
<td class="paramname"><em>inputData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="../../dc/d8c/namespacecvflann.html#ad55c74ae3144004b728d68382edbca45">IndexParams</a> & </td>
<td class="paramname"><em>params</em> = <code><a class="el" href="../../d7/d99/structcvflann_1_1KDTreeIndexParams.html">KDTreeIndexParams</a>()</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Distance </td>
<td class="paramname"><em>d</em> = <code>Distance()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>KDTree constructor</p>
<p>Params: inputData = dataset with the input features params = parameters passed to the kdtree algorithm </p>
</div>
</div>
<a id="ae67afef23555988e9650c0f11740df0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae67afef23555988e9650c0f11740df0a">§ </a></span>KDTreeIndex() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::<a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a>< Distance > & </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a4008c75a6da374a57fb6830d65dbc44a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4008c75a6da374a57fb6830d65dbc44a">§ </a></span>~KDTreeIndex()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::~<a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Standard destructor </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="aa5e5a2618d59b26870fea3cc5091d91f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5e5a2618d59b26870fea3cc5091d91f">§ </a></span>buildIndex()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::buildIndex </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Builds the index </p>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#aaa8811509bb2f30e91570cefe4dc71e2">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="ada91fb72025dec63ac669cfe36a1b66f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ada91fb72025dec63ac669cfe36a1b66f">§ </a></span>findNeighbors()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::findNeighbors </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d8/d42/classcvflann_1_1ResultSet.html">ResultSet</a>< <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a10ed3a3afa91fed415ab7c2d1b7c4014">DistanceType</a> > & </td>
<td class="paramname"><em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html#a200ee43145794ee028f415f205934d24">ElementType</a> * </td>
<td class="paramname"><em>vec</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="../../d6/d59/structcvflann_1_1SearchParams.html">SearchParams</a> & </td>
<td class="paramname"><em>searchParams</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Find set of nearest neighbors to vec. Their indices are stored inside the result object.</p>
<p>Params: result = the result object in which the indices of the nearest-neighbors are stored vec = the vector for which to search the nearest neighbors maxCheck = the maximum number of restarts (in a best-bin-first manner) </p>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#ac038c51dc941c7c1a55b08c17e213e41">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="ab399af05af34e72e4341f38d9b05c46f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab399af05af34e72e4341f38d9b05c46f">§ </a></span>getParameters()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../dc/d8c/namespacecvflann.html#ad55c74ae3144004b728d68382edbca45">IndexParams</a> <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::getParameters </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>The index parameters </dd></dl>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#afbc22ebf77f4f376d9e7922727d0abfe">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="a9aaf2b67e63d7020a8c50d920c5658f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9aaf2b67e63d7020a8c50d920c5658f4">§ </a></span>getType()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../dc/d8c/namespacecvflann.html#a4e3e6c98d774ea77fd7f0045c9bc7817">flann_algorithm_t</a> <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::getType </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>The index type (kdtree, kmeans,...) </dd></dl>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#ac40469dbc16bcb0fb4b0c9912c5f8acb">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="a2076c89754589df49d24b5d0fa886afc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2076c89754589df49d24b5d0fa886afc">§ </a></span>loadIndex()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::loadIndex </td>
<td>(</td>
<td class="paramtype">FILE * </td>
<td class="paramname"><em>stream</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Loads the index from a stream. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>The stream from which the index is loaded </td></tr>
</table>
</dd>
</dl>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#a4bcaf48ee2ac65a1b3cebea99d021611">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="ab8fcfe6f0b0fbb2251d5ec220692b77f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab8fcfe6f0b0fbb2251d5ec220692b77f">§ </a></span>operator=()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a>& <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">KDTreeIndex</a>< Distance > & </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a623752bde2c481c8c7bc2c88a702c481"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a623752bde2c481c8c7bc2c88a702c481">§ </a></span>saveIndex()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::saveIndex </td>
<td>(</td>
<td class="paramtype">FILE * </td>
<td class="paramname"><em>stream</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Saves the index to a stream. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>The stream to save the index to </td></tr>
</table>
</dd>
</dl>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#aad5c63116e3dbeccc96de7c70f0a8db7">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="a98df18be8841e0ae5c509de0002fcfd1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a98df18be8841e0ae5c509de0002fcfd1">§ </a></span>size()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../da/d06/autogenerated_2opencl__core_8hpp.html#a6ff403ead16f7faa1f7228274eb6b01d">size_t</a> <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns size of index. </p>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#ae75fd979d25a239b4aba751114493fe0">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="a7cb936d0391694cee6291470fbf11bd2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7cb936d0391694cee6291470fbf11bd2">§ </a></span>usedMemory()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::usedMemory </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the inde memory usage Returns: memory used by the index </p>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#ac172cb3774f8ae39ff1107bee4fadbf9">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<a id="a1af7f1d52a25dff817d8e6af64ea8798"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1af7f1d52a25dff817d8e6af64ea8798">§ </a></span>veclen()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Distance> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../da/d06/autogenerated_2opencl__core_8hpp.html#a6ff403ead16f7faa1f7228274eb6b01d">size_t</a> <a class="el" href="../../df/d36/classcvflann_1_1KDTreeIndex.html">cvflann::KDTreeIndex</a>< Distance >::veclen </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the length of an index feature. </p>
<p>Implements <a class="el" href="../../d9/d10/classcvflann_1_1NNIndex.html#acdcc255d1b67d5636a0f76b68809e6be">cvflann::NNIndex< Distance ></a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>flann/include/opencv2/flann/<a class="el" href="../../de/d79/kdtree__index_8h.html">kdtree_index.h</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Dec 23 2016 13:00:30 for OpenCV by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
<script type="text/javascript">
//<![CDATA[
function addButton(label, buttonName) {
var b = document.createElement("BUTTON");
b.innerHTML = buttonName;
b.setAttribute('class', 'toggleable_button label_' + label);
b.onclick = function() {
$('.toggleable_button').css({
border: '2px outset',
'border-radius': '4px'
});
$('.toggleable_button.label_' + label).css({
border: '2px inset',
'border-radius': '4px'
});
$('.toggleable_div').css('display', 'none');
$('.toggleable_div.label_' + label).css('display', 'block');
};
b.style.border = '2px outset';
b.style.borderRadius = '4px';
b.style.margin = '2px';
return b;
}
function buttonsToAdd($elements, $heading, $type) {
if ($elements.length === 0) {
$elements = $("" + $type + ":contains(" + $heading.html() + ")").parent().prev("div.newInnerHTML");
}
var arr = jQuery.makeArray($elements);
var seen = {};
arr.forEach(function(e) {
var txt = e.innerHTML;
if (!seen[txt]) {
$button = addButton(e.title, txt);
if (Object.keys(seen).length == 0) {
var linebreak1 = document.createElement("br");
var linebreak2 = document.createElement("br");
($heading).append(linebreak1);
($heading).append(linebreak2);
}
($heading).append($button);
seen[txt] = true;
}
});
return;
}
$("h2").each(function() {
$heading = $(this);
$smallerHeadings = $(this).nextUntil("h2").filter("h3").add($(this).nextUntil("h2").find("h3"));
if ($smallerHeadings.length) {
$smallerHeadings.each(function() {
var $elements = $(this).nextUntil("h3").filter("div.newInnerHTML");
buttonsToAdd($elements, $(this), "h3");
});
} else {
var $elements = $(this).nextUntil("h2").filter("div.newInnerHTML");
buttonsToAdd($elements, $heading, "h2");
}
});
$(".toggleable_button").first().click();
var $clickDefault = $('.toggleable_button.label_python').first();
if ($clickDefault.length) {
$clickDefault.click();
}
$clickDefault = $('.toggleable_button.label_cpp').first();
if ($clickDefault.length) {
$clickDefault.click();
}
//]]>
</script>
</body>
</html>
| {
"content_hash": "02c94600f6514c5f728f5cc1fca2343e",
"timestamp": "",
"source": "github",
"line_count": 717,
"max_line_length": 774,
"avg_line_length": 53.82566248256625,
"alnum_prop": 0.6593423677869044,
"repo_name": "lucasbrsa/OpenCV-3.2",
"id": "bae7b5239ad463ba8abff1302882b09785c1ec13",
"size": "38593",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/3.2/df/d36/classcvflann_1_1KDTreeIndex.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "320592"
},
{
"name": "C#",
"bytes": "12756"
},
{
"name": "C++",
"bytes": "499322"
},
{
"name": "CMake",
"bytes": "244871"
},
{
"name": "Makefile",
"bytes": "344335"
},
{
"name": "Python",
"bytes": "7735"
},
{
"name": "Visual Basic",
"bytes": "13139"
}
],
"symlink_target": ""
} |
using namespace ouro;
oTEST(oBase_fourcc)
{
fourcc_t fcc('TEST');
char str[16];
oCHECK(to_string(str, fcc) < countof(str), "to_string on fourcc failed 1");
oCHECK(!strcmp("TEST", str), "to_string on fourcc failed 2");
const char* fccStr = "RGBA";
oCHECK(from_string(&fcc, fccStr), "from_string on fourcc failed 1");
oCHECK(fourcc_t('RGBA') == fcc, "from_string on fourcc failed 2");
}
| {
"content_hash": "2101ce00c4131280ca41cad292cd618c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 26.4,
"alnum_prop": 0.6717171717171717,
"repo_name": "igHunterKiller/ouroboros",
"id": "6e88705fa795501728accac449e2e7de6b1eebf9",
"size": "553",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Ouroboros/Source/oBase/tests/TESTfourcc.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "814797"
},
{
"name": "Batchfile",
"bytes": "4677"
},
{
"name": "C",
"bytes": "3892024"
},
{
"name": "C#",
"bytes": "5288"
},
{
"name": "C++",
"bytes": "5630821"
},
{
"name": "CMake",
"bytes": "41999"
},
{
"name": "CSS",
"bytes": "18843"
},
{
"name": "Groff",
"bytes": "39381"
},
{
"name": "HTML",
"bytes": "493325"
},
{
"name": "Java",
"bytes": "118141"
},
{
"name": "JavaScript",
"bytes": "20502"
},
{
"name": "Makefile",
"bytes": "250647"
},
{
"name": "Objective-C",
"bytes": "31599"
},
{
"name": "Perl",
"bytes": "2517"
},
{
"name": "Shell",
"bytes": "538065"
},
{
"name": "Visual Basic",
"bytes": "7725"
}
],
"symlink_target": ""
} |
"""Tests for running legacy optimizer code with DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import reduce_util
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.distribute.single_loss_example import batchnorm_example
from tensorflow.python.distribute.single_loss_example import minimize_loss_example
from tensorflow.python.eager import context
from tensorflow.python.eager import test
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import ops
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
from tensorflow.python.layers import core
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import variable_scope
from tensorflow.python.ops import variables as variables_lib
from tensorflow.python.ops.losses import losses_impl
VAR_MAP_V1 = {
"GradientDescent": ("dense/kernel", "dense/bias"),
"Adagrad": ("dense/kernel/Adagrad", "dense/kernel", "dense/bias/Adagrad",
"dense/bias")
}
VAR_MAP_V2 = {
"SGD": ("dense/bias", "learning_rate", "decay", "iter", "dense/kernel",
"momentum"),
"Adagrad": ("iter", "epsilon", "dense/bias", "dense/kernel",
"learning_rate", "decay", "dense/kernel/accumulator",
"dense/bias/accumulator")
}
class MinimizeLossStepTest(test.TestCase, parameterized.TestCase):
def _get_iterator(self, strategy, input_fn):
iterator = strategy.make_input_fn_iterator(lambda _: input_fn())
self.evaluate(iterator.initialize())
return iterator
@combinations.generate(
combinations.times(
strategy_combinations.distributions_and_v1_optimizers(),
combinations.combine(mode=["graph"], use_callable_loss=[True, False])
+ combinations.combine(mode=["eager"], use_callable_loss=[True])) +
combinations.times(
strategy_combinations.distributions_and_v2_optimizers(),
combinations.combine(
mode=["graph", "eager"], use_callable_loss=[True])) +
combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations.optimizers_v2,
mode=["graph"],
use_callable_loss=[True]) + combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations.optimizers_v1,
mode=["graph"],
use_callable_loss=[True, False]))
def testTrainNetwork(self, distribution, optimizer_fn, use_callable_loss):
with distribution.scope():
model_fn, dataset_fn, layer = minimize_loss_example(
optimizer_fn, use_bias=True, use_callable_loss=use_callable_loss)
def step_fn(ctx, inputs):
del ctx # Unused
return distribution.group(
distribution.extended.call_for_each_replica(
model_fn, args=(inputs,)))
iterator = self._get_iterator(distribution, dataset_fn)
def run_step():
return distribution.extended.experimental_run_steps_on_iterator(
step_fn, iterator, iterations=2).run_op
if not context.executing_eagerly():
with self.cached_session() as sess:
run_step = sess.make_callable(run_step())
self.evaluate(variables_lib.global_variables_initializer())
weights, biases = [], []
for _ in range(5):
run_step()
weights.append(self.evaluate(layer.kernel))
biases.append(self.evaluate(layer.bias))
error = abs(numpy.add(numpy.squeeze(weights), numpy.squeeze(biases)) - 1)
is_not_increasing = all(y <= x for x, y in zip(error, error[1:]))
self.assertTrue(is_not_increasing)
@combinations.generate(
combinations.times(
strategy_combinations.distributions_and_v1_optimizers(),
combinations.combine(mode=["graph"], use_callable_loss=[True, False])
+ combinations.combine(mode=["eager"], use_callable_loss=[True])) +
combinations.times(
strategy_combinations.distributions_and_v2_optimizers(),
combinations.combine(
mode=["graph", "eager"], use_callable_loss=[True])))
def testTrainNetworkByCallForEachReplica(self, distribution, optimizer_fn,
use_callable_loss):
with distribution.scope():
model_fn, dataset_fn, layer = minimize_loss_example(
optimizer_fn, use_bias=True, use_callable_loss=use_callable_loss)
iterator = self._get_iterator(distribution, dataset_fn)
def run_step():
return distribution.group(
distribution.extended.call_for_each_replica(
model_fn, args=(iterator.get_next(),)))
if not context.executing_eagerly():
with self.cached_session() as sess:
run_step = sess.make_callable(run_step())
self.evaluate(variables_lib.global_variables_initializer())
weights, biases = [], []
for _ in range(10):
run_step()
weights.append(self.evaluate(layer.kernel))
biases.append(self.evaluate(layer.bias))
error = abs(numpy.add(numpy.squeeze(weights), numpy.squeeze(biases)) - 1)
is_not_increasing = all(y <= x for x, y in zip(error, error[1:]))
self.assertTrue(is_not_increasing)
@combinations.generate(
combinations.times(
strategy_combinations.distributions_and_v1_and_v2_optimizers(),
combinations.combine(mode=["graph", "eager"])) + combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations.optimizers_v1_and_v2,
mode=["graph"]))
def testOptimizerInsideModelFn(self, distribution, optimizer_fn):
created_variables = []
trainable_variables = []
def appending_creator(next_creator, *args, **kwargs):
v = next_creator(*args, **kwargs)
created_variables.append(v.name)
if "trainable" in kwargs and kwargs["trainable"]:
trainable_variables.append(v.name)
return v
# Creator scope needs to be set before it's used inside
# `distribution.scope`.
with variable_scope.variable_creator_scope(
appending_creator), distribution.scope():
model_fn, dataset_fn, _ = minimize_loss_example(
optimizer_fn,
use_bias=True,
use_callable_loss=True,
create_optimizer_inside_model_fn=True)
def step_fn(ctx, inputs):
del ctx # Unused
return distribution.group(
distribution.extended.call_for_each_replica(
model_fn, args=(inputs,)))
iterator = self._get_iterator(distribution, dataset_fn)
def run_step():
return distribution.extended.experimental_run_steps_on_iterator(
step_fn, iterator, iterations=1).run_op
if not context.executing_eagerly():
with self.cached_session() as sess:
run_step = sess.make_callable(run_step())
self.evaluate(variables_lib.global_variables_initializer())
run_step()
def get_expected_variables(optimizer_fn, num_parameter_devices):
optimizer = optimizer_fn()
name = optimizer._name
if isinstance(optimizer, optimizer_v2.OptimizerV2):
variables = VAR_MAP_V2[name]
else:
variables = VAR_MAP_V1[name]
extended_variables = [
v + "/replica_{}".format(replica)
for v in variables
for replica in range(1, num_parameter_devices)
]
variables = list(variables) + extended_variables
return set([v + ":0" for v in variables])
self.assertEqual(
get_expected_variables(optimizer_fn,
len(distribution.extended.parameter_devices)),
set(created_variables))
@combinations.generate(
combinations.times(
combinations.combine(momentum=[0.8, 0.9, 0.99], renorm=[False, True]),
combinations.times(
strategy_combinations.distributions_and_v1_and_v2_optimizers(),
combinations.combine(
mode=["graph", "eager"],
# TODO(isaprykin): Allow False here. Currently subsequent
# replicas will re-execute UPDATE_OPS of previous replicas.
update_ops_in_cross_replica_mode=[True])) +
combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations.optimizers_v1_and_v2,
mode=["graph"],
update_ops_in_cross_replica_mode=[False])))
def testTrainNetworkWithBatchNorm(self, distribution, optimizer_fn, momentum,
renorm, update_ops_in_cross_replica_mode):
"""Verifies that moving mean updates are reduced across replicas."""
with distribution.scope():
num_replicas = distribution.num_replicas_in_sync
model_fn, dataset_fn, batchnorm = batchnorm_example(
optimizer_fn,
batch_per_epoch=num_replicas,
momentum=momentum,
renorm=renorm,
update_ops_in_replica_mode=not update_ops_in_cross_replica_mode)
def step_fn(ctx, inputs):
del ctx # Unused
fetches = distribution.experimental_local_results(
distribution.extended.call_for_each_replica(
model_fn, args=(inputs,)))
if update_ops_in_cross_replica_mode:
fetches += tuple(ops.get_collection(ops.GraphKeys.UPDATE_OPS))
return control_flow_ops.group(fetches)
iterator = self._get_iterator(distribution, dataset_fn)
def run_step():
return distribution.extended.experimental_run_steps_on_iterator(
step_fn, iterator, iterations=1).run_op
if not context.executing_eagerly():
with self.cached_session() as sess:
run_step = sess.make_callable(run_step())
self.evaluate(variables_lib.global_variables_initializer())
expected_moving_means = [0.] * 8
def averaged_batch_mean(i):
# Each batch has shape [16, 8] where the ith element in jth list is
# (8 * j + i + replica_id * 100). So the batch mean in each replica is
# (60 + i + replica_id * 100). So here comes its batch mean over all
# replicas:
return 60. + i + (num_replicas - 1.) / 2. * 100.
for _ in range(10):
run_step()
moving_means = self.evaluate(batchnorm.moving_mean)
# We make sure that the moving_mean is updated as if the sample mean is
# calculated over all replicas.
for i, expected_moving_mean in enumerate(expected_moving_means):
expected_moving_means[i] -= ((
expected_moving_mean - averaged_batch_mean(i)) * (1.0 - momentum))
self.assertNear(expected_moving_means[i], moving_means[i], 0.0001)
@combinations.generate(
combinations.times(
combinations.combine(loss_reduction=[
losses_impl.Reduction.SUM, losses_impl.Reduction.MEAN,
losses_impl.Reduction.SUM_OVER_BATCH_SIZE,
losses_impl.Reduction.SUM_OVER_NONZERO_WEIGHTS
]),
combinations.times(
combinations.combine(distribution=[
strategy_combinations.one_device_strategy,
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus
]),
combinations.times(
combinations.combine(optimizer_fn=strategy_combinations
.gradient_descent_optimizer_v1_fn),
combinations.combine(
mode=["graph"], use_callable_loss=[True, False]) +
combinations.combine(
mode=["eager"], use_callable_loss=[True])) +
combinations.times(
combinations.combine(optimizer_fn=strategy_combinations
.gradient_descent_optimizer_keras_v2_fn),
combinations.combine(
mode=["graph", "eager"], use_callable_loss=[True]))) +
combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations
.gradient_descent_optimizer_v1_fn,
mode=["graph"],
use_callable_loss=[True, False]) + combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations
.gradient_descent_optimizer_keras_v2_fn,
mode=["graph"],
use_callable_loss=[True])))
def testMeanVsSum(self, distribution, optimizer_fn, loss_reduction,
use_callable_loss):
with distribution.scope():
all_vars = []
def model_fn(inputs):
x, y = inputs
w = variable_scope.get_variable("w", initializer=[[2.]])
all_vars.append(w)
def loss_fn():
# Use fixed initialization to make the steps deterministic.
predict = math_ops.matmul(x, w)
return losses_impl.mean_squared_error(
y, predict, reduction=loss_reduction)
optimizer = optimizer_fn() # GradientDescent with 0.2 learning rate
if isinstance(optimizer, optimizer_v2.OptimizerV2):
return optimizer.minimize(loss_fn, [w])
else:
if use_callable_loss:
return optimizer.minimize(loss_fn)
else:
return optimizer.minimize(loss_fn())
def dataset_fn():
features = dataset_ops.Dataset.from_tensors([[2.], [7.]])
labels = dataset_ops.Dataset.from_tensors([[6.], [21.]])
return dataset_ops.Dataset.zip((features, labels)).repeat()
def step_fn(ctx, inputs):
del ctx # Unused
return distribution.group(
distribution.extended.call_for_each_replica(
model_fn, args=(inputs,)))
iterator = self._get_iterator(distribution, dataset_fn)
def run_step():
return distribution.extended.experimental_run_steps_on_iterator(
step_fn, iterator, iterations=1).run_op
if not context.executing_eagerly():
with self.cached_session() as sess:
run_step = sess.make_callable(run_step())
self.evaluate(variables_lib.global_variables_initializer())
run_step()
v = all_vars[0]
self.assertTrue(all(v is vi for vi in all_vars[1:]))
weight = numpy.squeeze(self.evaluate(v))
# Our model is:
# predict = x * w
# loss = (predict - y)^2
# dloss/dpredict = 2*(predict - y)
# dloss/dw = 2 * x^T @ (predict - y)
# For our batch size of 2, assuming sum loss reduction:
# x = [2, 7]
# y = [6, 21]
# w_initial = 2
# predict = [4, 14]
# predict - y = [-2, -7]
# dloss/dw = 2 <[2, 7], [-2, -7]> = - 2(4 + 49) = -106
# So unreplicated the update to w with lr=0.2 is -0.2 * -106 = 21.2
# with sum loss reduction, or 10.6 with mean.
if loss_reduction == losses_impl.Reduction.SUM:
# Note that the "distribution.num_replicas_in_sync" factor will go away
# once we split the input across replicas, instead of pulling a complete
# batch of input per replica.
self.assertNear(weight, 2 + 21.2 * distribution.num_replicas_in_sync,
0.0001)
else:
# One of the mean loss reductions.
self.assertNear(weight, 2 + 10.6, 0.0001)
@combinations.generate(
combinations.times(
strategy_combinations.distributions_and_v1_and_v2_optimizers(),
combinations.combine(mode=["graph", "eager"]),
combinations.combine(is_tpu=[False])) + combinations.combine(
distribution=[strategy_combinations.tpu_strategy],
optimizer_fn=strategy_combinations.optimizers_v1_and_v2,
mode=["graph"],
is_tpu=[True]))
def testRunStepsWithOutputContext(self, distribution, optimizer_fn, is_tpu):
with distribution.scope():
def dataset_fn():
dataset = dataset_ops.Dataset.from_tensors([[1.]]).repeat()
# TODO(priyag): batch with drop_remainder=True causes shapes to be
# fully defined for TPU. Remove this when XLA supports dynamic shapes.
return dataset.batch(batch_size=1, drop_remainder=True)
optimizer = optimizer_fn()
layer = core.Dense(1, use_bias=True)
key1 = "foo"
value1 = "bar"
def model_fn(output_context, x):
"""A very simple model written by the user."""
def loss_fn():
y = array_ops.reshape(layer(x), []) - constant_op.constant(1.)
return y * y
if isinstance(optimizer, optimizer_v2.OptimizerV2):
train_op = optimizer.minimize(
loss_fn, lambda: layer.trainable_variables)
else:
train_op = optimizer.minimize(loss_fn)
loss = loss_fn()
output_context.set_last_step_output(
name="replica_loss_reduced",
output=loss,
reduce_op=reduce_util.ReduceOp.MEAN)
output_context.set_non_tensor_output(key1, value1)
return (train_op, loss)
def step_fn(output_context, inputs):
(train_op, loss) = distribution.extended.call_for_each_replica(
model_fn, args=(output_context, inputs))
output_context.set_last_step_output(
name="cross_replica_loss_reduced",
output=loss,
reduce_op=reduce_util.ReduceOp.MEAN)
output_context.set_last_step_output(
name="cross_replica_loss_not_reduced",
output=loss)
return distribution.group(train_op)
iterator = self._get_iterator(distribution, dataset_fn)
def run_step():
initial_loss = lambda: constant_op.constant(1e7)
# Initial values corresponding to reduced losses are just single
# tensors. But for non reduced losses, we need to have initial
# values that are of the same structure as non reduced losses. In
# MirroredStrategy, this will be a list of losses, in TPUStrategy
# it will be single tensor. Using `call_for_each_replica` followed
# by `experimental_local_results` gives us the desired initial
# value structure.
not_reduced = distribution.experimental_local_results(
distribution.extended.call_for_each_replica(initial_loss))
initial_loop_values = {
"replica_loss_reduced": initial_loss(),
"cross_replica_loss_reduced": initial_loss(),
"cross_replica_loss_not_reduced": not_reduced,
}
ctx = distribution.extended.experimental_run_steps_on_iterator(
step_fn, iterator, iterations=2,
initial_loop_values=initial_loop_values)
self.assertEqual({key1: (value1,)}, ctx.non_tensor_outputs)
self._verify_loss_output(
initial_loss(),
loss_output=ctx.last_step_outputs["replica_loss_reduced"],
reduced=True, distribution=distribution)
self._verify_loss_output(
initial_loss(),
loss_output=ctx.last_step_outputs["cross_replica_loss_reduced"],
reduced=True, distribution=distribution)
self._verify_loss_output(
initial_loss(),
loss_output=ctx.last_step_outputs["cross_replica_loss_not_reduced"],
reduced=False, distribution=distribution)
return (ctx.run_op, ctx.last_step_outputs["replica_loss_reduced"])
if not context.executing_eagerly():
with self.cached_session() as sess:
run_step = sess.make_callable(run_step())
self.evaluate(variables_lib.global_variables_initializer())
weights, biases, losses = [], [], []
for _ in range(5):
_, loss = run_step()
losses.append(loss)
weights.append(self.evaluate(layer.kernel))
biases.append(self.evaluate(layer.bias))
loss_is_not_increasing = all(y <= x for x, y in zip(losses, losses[1:]))
self.assertTrue(loss_is_not_increasing)
error = abs(
numpy.add(numpy.squeeze(weights), numpy.squeeze(biases)) - 1)
error_is_not_increasing = all(y <= x for x, y in zip(error, error[1:]))
self.assertTrue(error_is_not_increasing)
def _verify_loss_output(self, initial_loss, loss_output, reduced,
distribution):
if not reduced:
self.assertLen(distribution.experimental_local_results(loss_output),
distribution.num_replicas_in_sync)
loss_tensor = distribution.reduce(reduce_util.ReduceOp.MEAN, loss_output)
else:
unwrapped_output = distribution.experimental_local_results(loss_output)
self.assertLen(unwrapped_output, 1)
loss_tensor = unwrapped_output[0]
self.assertEqual(initial_loss.dtype, loss_tensor.dtype)
self.assertEqual(initial_loss.shape, loss_tensor.shape)
if __name__ == "__main__":
test.main()
| {
"content_hash": "0fac7d9051605cd1e4f492f6cedc201d",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 82,
"avg_line_length": 41.935546875,
"alnum_prop": 0.6233990033067859,
"repo_name": "kevin-coder/tensorflow-fork",
"id": "ee514d6ee6d5ea3db27c5cd57c1febb93372d43c",
"size": "22160",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/python/distribute/minimize_loss_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9117"
},
{
"name": "C",
"bytes": "340300"
},
{
"name": "C++",
"bytes": "39383425"
},
{
"name": "CMake",
"bytes": "194940"
},
{
"name": "Go",
"bytes": "1046987"
},
{
"name": "HTML",
"bytes": "4680032"
},
{
"name": "Java",
"bytes": "567239"
},
{
"name": "Jupyter Notebook",
"bytes": "1940883"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Makefile",
"bytes": "48231"
},
{
"name": "Objective-C",
"bytes": "12456"
},
{
"name": "Objective-C++",
"bytes": "94385"
},
{
"name": "PHP",
"bytes": "2140"
},
{
"name": "Perl",
"bytes": "6179"
},
{
"name": "Perl 6",
"bytes": "1357"
},
{
"name": "PureBasic",
"bytes": "25356"
},
{
"name": "Python",
"bytes": "33617202"
},
{
"name": "Ruby",
"bytes": "533"
},
{
"name": "Shell",
"bytes": "425910"
}
],
"symlink_target": ""
} |
package me.justramon.ircbot.raqbotx.features;
import me.justramon.ircbot.raqbotx.config.ConfigHandler;
import me.justramon.ircbot.raqbotx.core.ICommand;
import org.pircbotx.hooks.events.MessageEvent;
public class XtraFunc {
public static boolean hasXtraFuncEnabled(String channelName) {
for (String channel : ConfigHandler.config.xtrafunc) {
if (channelName.equals(channel)) {
return true;
}
}
return false;
}
public static boolean isExtraFuncCommand(ICommand<MessageEvent> command) {
return command.xtraFunc();
}
}
| {
"content_hash": "16a505d857b74e57bfe86772aea726b5",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 30.35,
"alnum_prop": 0.6886326194398682,
"repo_name": "JustRamon/JustABotX",
"id": "b5d4dd079b2357bd6e176e2203794b6f35a085ee",
"size": "607",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/me/justramon/ircbot/raqbotx/features/XtraFunc.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "62708"
}
],
"symlink_target": ""
} |
"""
List out defined Login Modules
"""
import os
from flask import request, render_template
import web.util.tools as tools
import lib.es as es
def get(p):
# get list authentication plugins
p['login_modules'] = get_login_modules(p)
p['login_module_types'] = get_login_module_types(p)
return render_template("admin/login/default.html", p=p)
def get_login_modules(p):
query = "*"
option = 'size=1000&sort=priority:desc'
return es.list(p['host'], 'core_nav', 'login_module', query, option)
def get_login_module_types(p):
# get list of auth services
path = os.path.join(p['base_dir'], 'web', 'modules', 'auth', 'services')
module_types = []
for (dirpath, dirname, filenames) in os.walk(path):
module_types = [f.replace('.py', '') for f in filenames if f.endswith('.py') and f != '__init__.py']
return module_types
| {
"content_hash": "d81a6a7da6cfabca4e498e74d0bc9e6e",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 108,
"avg_line_length": 29.066666666666666,
"alnum_prop": 0.6502293577981652,
"repo_name": "unkyulee/elastic-cms",
"id": "47da92b93467306690733fd23155f566faa396ed",
"size": "872",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/web/modules/admin/controllers/login/default.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "249117"
},
{
"name": "JavaScript",
"bytes": "140"
},
{
"name": "Python",
"bytes": "235762"
}
],
"symlink_target": ""
} |
package be.kdg.todo.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class ToDoDbHelper extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_NAME = "ToDo.db";
private static final String SQL_CREATE_ENTRIES =
"CREATE TABLE ..."; // TODO: gebruik Contract om SQL te vervolledigen
private static final String SQL_DELETE_ENTRIES =
"DROP TABLE IF EXISTS ..."; // TODO: gebruik Contract om SQL te vervolledigen
public ToDoDbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_CREATE_ENTRIES);
///////////////
// TEST DATA //
///////////////
// TODO: uit commentaar zetten
//ContentValues values = new ContentValues();
//values.put(ToDoContract.ToDoEntry.COLUMN_NAME_DESC, "Verjaardagscadeau oma kopen");
//db.insert(ToDoContract.ToDoEntry.TABLE_NAME, null, values);
//values.put(ToDoContract.ToDoEntry.COLUMN_NAME_DESC, "Oefening UI2 maken");
//db.insert(ToDoContract.ToDoEntry.TABLE_NAME, null, values);
//values.put(ToDoContract.ToDoEntry.COLUMN_NAME_DESC, "Batterij smartphone vervangen");
//db.insert(ToDoContract.ToDoEntry.TABLE_NAME, null, values);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(SQL_DELETE_ENTRIES);
onCreate(db);
}
}
| {
"content_hash": "0eddc3a1e2806f8ad385b94bf608db52",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 37.90909090909091,
"alnum_prop": 0.6756594724220624,
"repo_name": "LarsWillemsens/userinterfaces2",
"id": "a25266e67accbd60b2db0e4347767dded0c03696",
"size": "1668",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ToDo/app/src/main/java/be/kdg/todo/db/ToDoDbHelper.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "91"
},
{
"name": "Java",
"bytes": "19870"
},
{
"name": "JavaScript",
"bytes": "3005"
}
],
"symlink_target": ""
} |
essidcsv
========
Creates a csv of ESSID,BSSID pairs from a Kismet XML file
| {
"content_hash": "37875897134e42d6e7a687a8c51dbd02",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 57,
"avg_line_length": 19.25,
"alnum_prop": 0.7012987012987013,
"repo_name": "tomsteele/essidcsv",
"id": "76d6dd70bef09d90dc2dbd35966b984429d3ac18",
"size": "77",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1387"
}
],
"symlink_target": ""
} |
<html>
<head>
<script src="../../../resources/ahem.js"></script>
<script src="../../../resources/run-after-layout-and-paint.js"></script>
<style>
.container {
font: 50px/1 Ahem, sans-serif;
color: green;
}
.shape-outside {
width: 100px;
height: 100px;
float: left;
shape-outside: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100px' height='100px'><rect x='0' y='50' width='50' height='50' fill='blue'/></svg>");
}
</style>
<script>
window.onload = function() {
runAfterLayoutAndPaint(function() {
var container = document.querySelector('.container');
var shape = document.createElement('div');
shape.className = 'shape-outside';
container.insertBefore(shape, container.firstChild);
}, true);
}
</script>
</head>
<body>
<div class='container'>
<p>X<br>X<br>X</p>
</div>
</body>
</html>
| {
"content_hash": "16b049f36299e1ecb86a5fb9219c5675",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 181,
"avg_line_length": 25.323529411764707,
"alnum_prop": 0.6411149825783972,
"repo_name": "google-ar/WebARonARCore",
"id": "00c6c0a091b46d8d782148ca817c3b719532ae17",
"size": "861",
"binary": false,
"copies": "14",
"ref": "refs/heads/webarcore_57.0.2987.5",
"path": "third_party/WebKit/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-insert-svg-shape.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using Csla;
namespace SelfLoadROSoftDelete.DataAccess.ERLevel
{
/// <summary>
/// DAL Interface for G03_SubContinentColl type
/// </summary>
public partial interface IG03_SubContinentCollDal
{
/// <summary>
/// Loads a G03_SubContinentColl collection from the database.
/// </summary>
/// <param name="parent_Continent_ID">The fetch criteria.</param>
/// <returns>A list of <see cref="G04_SubContinentDto"/>.</returns>
List<G04_SubContinentDto> Fetch(int parent_Continent_ID);
}
}
| {
"content_hash": "71a927cc82cd575e3387903c280de047",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 32.68421052631579,
"alnum_prop": 0.6376811594202898,
"repo_name": "CslaGenFork/CslaGenFork",
"id": "0876d1f3ed69a2fda9ef456bcbd2cbf5251de546",
"size": "621",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trunk/Samples/DeepLoad/DAL-DTO/SelfLoadROSoftDelete.DataAccess/ERLevel/IG03_SubContinentCollDal.Designer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "4816094"
},
{
"name": "Assembly",
"bytes": "73066"
},
{
"name": "C#",
"bytes": "12314305"
},
{
"name": "C++",
"bytes": "313681"
},
{
"name": "HTML",
"bytes": "30950"
},
{
"name": "PHP",
"bytes": "35716"
},
{
"name": "PLpgSQL",
"bytes": "2164471"
},
{
"name": "Pascal",
"bytes": "1244"
},
{
"name": "PowerShell",
"bytes": "1687"
},
{
"name": "SourcePawn",
"bytes": "500196"
},
{
"name": "Visual Basic",
"bytes": "3027224"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Counter</title>
</head>
<body>
<div id="app"></div>
</body>
<script src="app.js"></script>
</html>
| {
"content_hash": "b68bc081575e8e5fa513095a0fa16df9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 114,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.6263157894736842,
"repo_name": "briancavalier/arrow",
"id": "71ad697c605c730bc2733d21af03d334b911dce6",
"size": "380",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/counter/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "17959"
}
],
"symlink_target": ""
} |
package rx.internal.operators;
import rx.Observable.Operator;
import rx.Subscriber;
import rx.functions.Function;
import rx.functions.BiFunction;
/**
* Returns an Observable that emits items emitted by the source Observable as long as a specified
* condition is true.
* <p>
* <img width="640" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/takeWhile.png" alt="">
*/
public final class OperatorTakeWhile<T> implements Operator<T, T> {
private final BiFunction<? super T, ? super Integer, Boolean> predicate;
public OperatorTakeWhile(final Function<? super T, Boolean> underlying) {
this(new BiFunction<T, Integer, Boolean>() {
@Override
public Boolean call(T input, Integer index) {
return underlying.call(input);
}
});
}
public OperatorTakeWhile(BiFunction<? super T, ? super Integer, Boolean> predicate) {
this.predicate = predicate;
}
@Override
public Subscriber<? super T> call(final Subscriber<? super T> subscriber) {
Subscriber<T> s = new Subscriber<T>(subscriber, false) {
private int counter = 0;
private boolean done = false;
@Override
public void onNext(T args) {
boolean isSelected;
try {
isSelected = predicate.call(args, counter++);
} catch (Throwable e) {
done = true;
subscriber.onError(e);
unsubscribe();
return;
}
if (isSelected) {
subscriber.onNext(args);
} else {
done = true;
subscriber.onComplete();
unsubscribe();
}
}
@Override
public void onComplete() {
if (!done) {
subscriber.onComplete();
}
}
@Override
public void onError(Throwable e) {
if (!done) {
subscriber.onError(e);
}
}
};
subscriber.add(s);
return s;
}
}
| {
"content_hash": "383f8f04e749f40c5dd72069a8bb3ca1",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 108,
"avg_line_length": 28.430379746835442,
"alnum_prop": 0.51246660730187,
"repo_name": "akarnokd/RxJavaFlow",
"id": "2f36b3f28e3b0a71995593da71721dd734b7d4f7",
"size": "2842",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/rx/internal/operators/OperatorTakeWhile.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2171"
},
{
"name": "Java",
"bytes": "3032861"
}
],
"symlink_target": ""
} |
package com.opensymphony.xwork2.config.impl;
import com.opensymphony.xwork2.XWorkTestCase;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
import com.opensymphony.xwork2.config.entities.InterceptorMapping;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.util.WildcardHelper;
import java.util.HashMap;
import java.util.Map;
public class ActionConfigMatcherTest extends XWorkTestCase {
// ----------------------------------------------------- Instance Variables
private Map<String,ActionConfig> configMap;
private ActionConfigMatcher matcher;
// ----------------------------------------------------- Setup and Teardown
@Override public void setUp() throws Exception {
super.setUp();
configMap = buildActionConfigMap();
matcher = new ActionConfigMatcher(new WildcardHelper(), configMap, false);
}
@Override public void tearDown() throws Exception {
super.tearDown();
}
// ------------------------------------------------------- Individual Tests
// ---------------------------------------------------------- match()
public void testNoMatch() {
assertNull("ActionConfig shouldn't be matched", matcher.match("test"));
}
public void testNoWildcardMatch() {
assertNull("ActionConfig shouldn't be matched", matcher.match("noWildcard"));
}
public void testShouldMatch() {
ActionConfig matched = matcher.match("foo/class/method");
assertNotNull("ActionConfig should be matched", matched);
assertTrue("ActionConfig should have properties, had " +
matched.getParams().size(), matched.getParams().size() == 2);
assertTrue("ActionConfig should have interceptors",
matched.getInterceptors().size() == 1);
assertTrue("ActionConfig should have ex mappings",
matched.getExceptionMappings().size() == 1);
assertTrue("ActionConfig should have external refs",
matched.getExceptionMappings().size() == 1);
assertTrue("ActionConfig should have results",
matched.getResults().size() == 1);
}
public void testCheckSubstitutionsMatch() {
ActionConfig m = matcher.match("foo/class/method");
assertTrue("Class hasn't been replaced", "foo.bar.classAction".equals(m.getClassName()));
assertTrue("Method hasn't been replaced", "domethod".equals(m.getMethodName()));
assertTrue("Package isn't correct", "package-class".equals(m.getPackageName()));
assertTrue("First param isn't correct", "class".equals(m.getParams().get("first")));
assertTrue("Second param isn't correct", "method".equals(m.getParams().get("second")));
ExceptionMappingConfig ex = m.getExceptionMappings().get(0);
assertTrue("Wrong name, was "+ex.getName(), "fooclass".equals(ex.getName()));
assertTrue("Wrong result", "successclass".equals(ex.getResult()));
assertTrue("Wrong exception",
"java.lang.methodException".equals(ex.getExceptionClassName()));
assertTrue("First param isn't correct", "class".equals(ex.getParams().get("first")));
assertTrue("Second param isn't correct", "method".equals(ex.getParams().get("second")));
ResultConfig result = m.getResults().get("successclass");
assertTrue("Wrong name, was "+result.getName(), "successclass".equals(result.getName()));
assertTrue("Wrong classname", "foo.method".equals(result.getClassName()));
assertTrue("First param isn't correct", "class".equals(result.getParams().get("first")));
assertTrue("Second param isn't correct", "method".equals(result.getParams().get("second")));
}
public void testCheckMultipleSubstitutions() {
ActionConfig m = matcher.match("bar/class/method/more");
assertTrue("Method hasn't been replaced correctly: " + m.getMethodName(),
"doclass_class".equals(m.getMethodName()));
}
public void testAllowedMethods() {
ActionConfig m = matcher.match("addEvent!start");
assertTrue(m.getAllowedMethods().contains("start"));
m = matcher.match("addEvent!cancel");
assertTrue(m.getAllowedMethods().contains("cancel"));
}
public void testLooseMatch() {
configMap.put("*!*", configMap.get("bar/*/**"));
ActionConfigMatcher matcher = new ActionConfigMatcher(new WildcardHelper(), configMap, true);
// exact match
ActionConfig m = matcher.match("foo/class/method");
assertNotNull("ActionConfig should be matched", m);
assertTrue("Class hasn't been replaced "+m.getClassName(), "foo.bar.classAction".equals(m.getClassName()));
assertTrue("Method hasn't been replaced", "domethod".equals(m.getMethodName()));
// Missing last wildcard
m = matcher.match("foo/class");
assertNotNull("ActionConfig should be matched", m);
assertTrue("Class hasn't been replaced", "foo.bar.classAction".equals(m.getClassName()));
assertTrue("Method hasn't been replaced, "+m.getMethodName(), "do".equals(m.getMethodName()));
// Simple mapping
m = matcher.match("class!method");
assertNotNull("ActionConfig should be matched", m);
assertTrue("Class hasn't been replaced, "+m.getPackageName(), "package-class".equals(m.getPackageName()));
assertTrue("Method hasn't been replaced", "method".equals(m.getParams().get("first")));
// Simple mapping
m = matcher.match("class");
assertNotNull("ActionConfig should be matched", m);
assertTrue("Class hasn't been replaced", "package-class".equals(m.getPackageName()));
assertTrue("Method hasn't been replaced", "".equals(m.getParams().get("first")));
}
private Map<String,ActionConfig> buildActionConfigMap() {
Map<String, ActionConfig> map = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("first", "{1}");
params.put("second", "{2}");
ActionConfig config = new ActionConfig.Builder("package-{1}", "foo/*/*", "foo.bar.{1}Action")
.methodName("do{2}")
.addParams(params)
.addExceptionMapping(new ExceptionMappingConfig.Builder("foo{1}", "java.lang.{2}Exception", "success{1}")
.addParams(new HashMap<>(params))
.build())
.addInterceptor(new InterceptorMapping(null, null))
.addResultConfig(new ResultConfig.Builder("success{1}", "foo.{2}").addParams(params).build())
.setStrictMethodInvocation(false)
.build();
map.put("foo/*/*", config);
config = new ActionConfig.Builder("package-{1}", "bar/*/**", "bar")
.methodName("do{1}_{1}")
.addParam("first", "{2}")
.setStrictMethodInvocation(false)
.build();
map.put("bar/*/**", config);
config = new ActionConfig.Builder("package", "eventAdd!*", "bar")
.methodName("{1}")
.setStrictMethodInvocation(false)
.build();
map.put("addEvent!*", config);
map.put("noWildcard", new ActionConfig.Builder("", "", "").build());
return map;
}
}
| {
"content_hash": "6ebfc7b3c91d9625bd998d84012a4725",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 121,
"avg_line_length": 45.28915662650602,
"alnum_prop": 0.6104017025804735,
"repo_name": "Ile2/struts2-showcase-demo",
"id": "7957cf906c49413331058ef24ddbb2c26de33d2d",
"size": "8149",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "26665"
},
{
"name": "FreeMarker",
"bytes": "254694"
},
{
"name": "HTML",
"bytes": "913364"
},
{
"name": "Java",
"bytes": "9755409"
},
{
"name": "JavaScript",
"bytes": "35286"
},
{
"name": "XSLT",
"bytes": "10909"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Profile Settings</title>
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- bootstrap theme -->
<link href="css/bootstrap-theme.css" rel="stylesheet">
<!--external css-->
<!-- font icon -->
<link href="css/elegant-icons-style.css" rel="stylesheet" />
<link href="css/font-awesome.min.css" rel="stylesheet" />
<!-- full calendar css-->
<link href="assets/fullcalendar/fullcalendar/bootstrap-fullcalendar.css" rel="stylesheet" />
<link href="assets/fullcalendar/fullcalendar/fullcalendar.css" rel="stylesheet" />
<!-- easy pie chart-->
<link href="assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen"/>
<!-- owl carousel -->
<link rel="stylesheet" href="css/owl.carousel.css" type="text/css">
<link href="css/jquery-jvectormap-1.2.2.css" rel="stylesheet">
<!-- Custom styles -->
<link rel="stylesheet" href="css/fullcalendar.css">
<link href="css/widgets.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet" />
<link href="css/xcharts.min.css" rel=" stylesheet">
<link href="css/jquery-ui-1.10.4.min.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet" type="text/css" media="screen">
<link rel="stylesheet" href="static/stylesheets/app.css">
<script src="static/scripts/library.js"></script>
<script src="static/scripts/base.js"></script>
<script src="static/scripts/chart.js"></script>
<script src="static/scripts/initialize.js"></script>
<link href="custom.css" rel="stylesheet" type="text/css" media="screen">
<!-- Custom CSS -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="header">
<ul class="con">
<div id="header2">
<li>
<a href="profile_leads.html"><img src="img/profile-widget-avatar.jpg" height=30px width=30px> Jennifer Alba </a>
</li>
<li id="settings">
<a href="profile_settings_leads.html"><img src="settings.png" class="img-responsive"></a>
</li>
<li id="exit">
<a href="log-in/login_1.html"><img src="exit.png" class="img-responsive"></a>
</li>
</ul>
</div>
<!-- NAVIGATION BAR -->
<div id="stream">
<div class="con">
<div class="tile" id="hello">
<div class="col-sm-12">
<h2><span>Hi,</span> Jennifer</h2>
<p>You last visited <strong>two hours</strong> ago</p>
</div>
</div>
<div>
</div>
<div class="row">
<div class="container">
<ul id="nav" class="nav">
<li>
<a class="tile" href="index_leads.html">
<span class="vector"><img src="home.png" class="img-responsive"></span>
<span class="title"><strong>Home</strong></span>
</a>
</li>
<li>
<a class="tile" href="roster_leads.html">
<span class="vector"><img src="group.png" class="img-responsive"></span>
<span class="title"><strong>Roster</strong></span>
</a>
</li>
<li>
<a class="tile" href="dept_leads.html">
<span class="vector"><img src="edit.png" class="img-responsive"></span>
<span class="title"><strong>Requirements</strong></span>
</a>
</li>
<li>
<a class="tile" href="shifts_leads.html">
<span class="vector"><img src="calendar.png" class="img-responsive"></span>
<span class="title"><strong>Shifts</strong></span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div id="dashboard">
<div class="scroll con">
<div class="section current" title="Our First Section" id="first_section">
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Profile Information</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Email</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Phone</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Address</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Emergency Contact</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="textarea">Allergies/Physical Limitations?</label>
<div class="col-md-4">
<textarea class="form-control" id="textarea" name="textarea"></textarea>
</div>
</div>
<!-- Multiple Checkboxes -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Have you been rabies vaccinated within the past two years?</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="1">-Select-</option>
<option value="2">Yes</option>
<option value="3">No</option>
</select>
</div>
</div>
<!-- File Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="filebutton"></label>
<div class="col-md-4">
<input id="filebutton" name="filebutton" class="input-file" type="file">
</div>
</div>
<!-- Multiple Radios -->
<div class="form-group">
<label class="col-md-4 control-label" for="radios">Do you hold a valid permit to rehabilitate wildlife in the state of Virginia?</label>
<div class="col-md-4">
<div class="radio">
<label for="radios-0">
<input type="radio" name="radios" id="radios-0" value="1" checked="checked">
Yes
</label>
</div>
<div class="radio">
<label for="radios-1">
<input type="radio" name="radios" id="radios-1" value="2">
No
</label>
</div>
</div>
</div>
<!-- File Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="filebutton"></label>
<div class="col-md-4">
<input id="filebutton" name="filebutton" class="input-file" type="file">
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="form-group">
<label class="col-md-4 control-label" for="radios">What Team(s) are you apart of?</label>
<div class="col-md-4">
<label class="radio-inline" for="radios-0">
<input type="radio" name="radios" id="radios-0" value="Outreach" checked="checked">
Outreach
</label>
<label class="radio-inline" for="radios-1">
<input type="radio" name="radios" id="radios-1" value="Treatment Team">
Treatment Team
</label>
<label class="radio-inline" for="radios-2">
<input type="radio" name="radios" id="radios-2" value="Animal Care">
Animal Care
</label>
<label class="radio-inline" for="radios-3">
<input type="radio" name="radios" id="radios-3" value="Transporter">
Transporter
</label>
<label class="radio-inline" for="radios-4">
<input type="radio" name="radios" id="radios-4" value="Other">
Other
</label>
</div>
</div>
<div id="submitbutton" class="col-sm-10 col-sm-offset-4">
<a class="btn btn-large btn-info" href="profile_leads.html">Update Profile</a>
</div>
<form class="form-horizontal">
<fieldset>
</div>
</div>
</div>
<div id="footer">
<div class="con">
</div>
</div>
</body>
</html>
</div>
<!-- jQuery Version 1.11.1 -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "8a9d7293c1ff5454f03ab0c202bf80bd",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 138,
"avg_line_length": 28.196319018404907,
"alnum_prop": 0.5949738903394256,
"repo_name": "SenorTaylor/SenorTaylor.github.io",
"id": "2e74627cd17f04aba2f2543130d18076a518fcc2",
"size": "9192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "leads/profile_settings_leads.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "742312"
},
{
"name": "HTML",
"bytes": "324337"
},
{
"name": "JavaScript",
"bytes": "82486"
},
{
"name": "PHP",
"bytes": "30980"
}
],
"symlink_target": ""
} |
using smart_cover::animation_planner;
using smart_cover::target_provider;
using smart_cover::target_idle;
using smart_cover::target_fire;
using smart_cover::target_fire_no_lookout;
target_provider::target_provider(animation_planner* object, LPCSTR name,
StalkerDecisionSpace::EWorldProperties const& world_property,
u32 const& loophole_value)
: inherited(object, name), m_world_property(world_property), m_loophole_value(loophole_value) {}
void target_provider::setup(animation_planner* object, CPropertyStorage* storage) {
inherited::setup(object, storage);
}
void target_provider::initialize() {
inherited::initialize();
m_object->target(m_world_property);
m_storage->set_property(m_world_property, true);
m_object->decrease_loophole_value(m_loophole_value);
}
void target_provider::finalize() { inherited::finalize(); }
////////////////////////////////////////////////////////////////////////////
// class target_idle
////////////////////////////////////////////////////////////////////////////
target_idle::target_idle(animation_planner* object, LPCSTR name,
StalkerDecisionSpace::EWorldProperties const& world_property,
u32 const& loophole_value)
: inherited(object, name, world_property, loophole_value) {}
void target_idle::execute() {
inherited::execute();
if (!completed())
return;
m_storage->set_property(StalkerDecisionSpace::eWorldPropertyLoopholeTooMuchTimeFiring, false);
}
////////////////////////////////////////////////////////////////////////////
// class target_fire
////////////////////////////////////////////////////////////////////////////
target_fire::target_fire(animation_planner* object, LPCSTR name,
StalkerDecisionSpace::EWorldProperties const& world_property,
u32 const& loophole_value)
: inherited(object, name, world_property, loophole_value) {}
void target_fire::initialize() {
if (this->m_object->m_object->agent_manager().enemy().enemies().size() > 1)
set_inertia_time(6000 + ::Random.randI(3000));
else
set_inertia_time(0);
inherited::initialize();
}
void target_fire::execute() {
inherited::execute();
if (!m_inertia_time)
return;
if (!completed())
return;
if (this->m_object->m_object->ready_to_kill()) {
CWeapon* weapon = smart_cast<CWeapon*>(this->m_object->m_object->m_best_item_to_kill);
if (weapon) {
if (weapon->GetAmmoElapsed() <= weapon->GetAmmoMagSize() / 6)
return;
}
}
m_storage->set_property(StalkerDecisionSpace::eWorldPropertyLoopholeTooMuchTimeFiring, true);
}
////////////////////////////////////////////////////////////////////////////
// class target_fire_no_lookout
////////////////////////////////////////////////////////////////////////////
target_fire_no_lookout::target_fire_no_lookout(
animation_planner* object, LPCSTR name,
StalkerDecisionSpace::EWorldProperties const& world_property, u32 const& loophole_value)
: inherited(object, name, world_property, loophole_value) {}
void target_fire_no_lookout::initialize() {
m_storage->set_property(StalkerDecisionSpace::eWorldPropertyLookedOut, false);
inherited::initialize();
} | {
"content_hash": "52b13aba9b5b968767084941608bfd18",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 100,
"avg_line_length": 36.193548387096776,
"alnum_prop": 0.5754604872251932,
"repo_name": "Im-dex/xray-162",
"id": "ac027ac44247215fee3f9cb516747fd97d2dc5b0",
"size": "3946",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "code/engine/xrGame/smart_cover_planner_target_provider.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1642482"
},
{
"name": "C++",
"bytes": "22541957"
},
{
"name": "CMake",
"bytes": "636522"
},
{
"name": "Objective-C",
"bytes": "40174"
},
{
"name": "Pascal",
"bytes": "19058"
},
{
"name": "xBase",
"bytes": "151706"
}
],
"symlink_target": ""
} |
TypeName(const TypeName&) = delete; \
void operator=(const TypeName&) = delete
#endif
#define ARROW_UNUSED(x) (void)x
#define ARROW_ARG_UNUSED(x)
//
// GCC can be told that a certain branch is not likely to be taken (for
// instance, a CHECK failure), and use that information in static analysis.
// Giving it this information can help it optimize for the common case in
// the absence of better information (ie. -fprofile-arcs).
//
#if defined(__GNUC__)
#define ARROW_PREDICT_FALSE(x) (__builtin_expect(x, 0))
#define ARROW_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#define ARROW_NORETURN __attribute__((noreturn))
#define ARROW_PREFETCH(addr) __builtin_prefetch(addr)
#elif defined(_MSC_VER)
#define ARROW_NORETURN __declspec(noreturn)
#define ARROW_PREDICT_FALSE(x) x
#define ARROW_PREDICT_TRUE(x) x
#define ARROW_PREFETCH(addr)
#else
#define ARROW_NORETURN
#define ARROW_PREDICT_FALSE(x) x
#define ARROW_PREDICT_TRUE(x) x
#define ARROW_PREFETCH(addr)
#endif
#if (defined(__GNUC__) || defined(__APPLE__))
#define ARROW_MUST_USE_RESULT __attribute__((warn_unused_result))
#elif defined(_MSC_VER)
#define ARROW_MUST_USE_RESULT
#else
#define ARROW_MUST_USE_RESULT
#endif
// ----------------------------------------------------------------------
// C++/CLI support macros (see ARROW-1134)
#ifndef NULLPTR
#ifdef __cplusplus_cli
#define NULLPTR __nullptr
#else
#define NULLPTR nullptr
#endif
#endif // ifndef NULLPTR
// ----------------------------------------------------------------------
// clang-format off
// [[deprecated]] is only available in C++14, use this for the time being
// This macro takes an optional deprecation message
#if __cplusplus <= 201103L
# ifdef __GNUC__
# define ARROW_DEPRECATED(...) __attribute__((deprecated(__VA_ARGS__)))
# elif defined(_MSC_VER)
# define ARROW_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__))
# else
# define ARROW_DEPRECATED(...)
# endif
#else
# define ARROW_DEPRECATED(...) [[deprecated(__VA_ARGS__)]]
#endif
// ----------------------------------------------------------------------
// macros to disable padding
// these macros are portable across different compilers and platforms
//[https://github.com/google/flatbuffers/blob/master/include/flatbuffers/flatbuffers.h#L1355]
#if !defined(MANUALLY_ALIGNED_STRUCT)
#if defined(_MSC_VER)
#define MANUALLY_ALIGNED_STRUCT(alignment) \
__pragma(pack(1)); \
struct __declspec(align(alignment))
#define STRUCT_END(name, size) \
__pragma(pack()); \
static_assert(sizeof(name) == size, "compiler breaks packing rules")
#elif defined(__GNUC__) || defined(__clang__)
#define MANUALLY_ALIGNED_STRUCT(alignment) \
_Pragma("pack(1)") struct __attribute__((aligned(alignment)))
#define STRUCT_END(name, size) \
_Pragma("pack()") static_assert(sizeof(name) == size, "compiler breaks packing rules")
#else
#error Unknown compiler, please define structure alignment macros
#endif
#endif // !defined(MANUALLY_ALIGNED_STRUCT)
// ----------------------------------------------------------------------
// Convenience macro disabling a particular UBSan check in a function
#if defined(__clang__)
#define ARROW_DISABLE_UBSAN(feature) __attribute__((no_sanitize(feature)))
#else
#define ARROW_DISABLE_UBSAN(feature)
#endif
// ----------------------------------------------------------------------
// Machine information
#if INTPTR_MAX == INT64_MAX
#define ARROW_BITNESS 64
#elif INTPTR_MAX == INT32_MAX
#define ARROW_BITNESS 32
#else
#error Unexpected INTPTR_MAX
#endif
// ----------------------------------------------------------------------
// From googletest
// (also in parquet-cpp)
// When you need to test the private or protected members of a class,
// use the FRIEND_TEST macro to declare your tests as friends of the
// class. For example:
//
// class MyClass {
// private:
// void MyMethod();
// FRIEND_TEST(MyClassTest, MyMethod);
// };
//
// class MyClassTest : public testing::Test {
// // ...
// };
//
// TEST_F(MyClassTest, MyMethod) {
// // Can call MyClass::MyMethod() here.
// }
#define FRIEND_TEST(test_case_name, test_name) \
friend class test_case_name##_##test_name##_Test
#endif // ARROW_UTIL_MACROS_H
| {
"content_hash": "d7529c30d001ff3bc7aebf932b52f223",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 93,
"avg_line_length": 30.904411764705884,
"alnum_prop": 0.6271710682845586,
"repo_name": "itaiin/arrow",
"id": "4516985e30077de81ded58713379f93fca7d0f46",
"size": "5256",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cpp/src/arrow/util/macros.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "73655"
},
{
"name": "Awk",
"bytes": "3683"
},
{
"name": "Batchfile",
"bytes": "31917"
},
{
"name": "C",
"bytes": "328104"
},
{
"name": "C#",
"bytes": "399342"
},
{
"name": "C++",
"bytes": "7227843"
},
{
"name": "CMake",
"bytes": "401580"
},
{
"name": "CSS",
"bytes": "3946"
},
{
"name": "Dockerfile",
"bytes": "42193"
},
{
"name": "FreeMarker",
"bytes": "2274"
},
{
"name": "Go",
"bytes": "364102"
},
{
"name": "HTML",
"bytes": "23047"
},
{
"name": "Java",
"bytes": "2296962"
},
{
"name": "JavaScript",
"bytes": "84850"
},
{
"name": "Lua",
"bytes": "8741"
},
{
"name": "M4",
"bytes": "8713"
},
{
"name": "MATLAB",
"bytes": "9068"
},
{
"name": "Makefile",
"bytes": "44853"
},
{
"name": "Meson",
"bytes": "36931"
},
{
"name": "Objective-C",
"bytes": "7559"
},
{
"name": "PLpgSQL",
"bytes": "56995"
},
{
"name": "Perl",
"bytes": "3799"
},
{
"name": "Python",
"bytes": "1548321"
},
{
"name": "R",
"bytes": "155922"
},
{
"name": "Ruby",
"bytes": "679269"
},
{
"name": "Rust",
"bytes": "1592353"
},
{
"name": "Shell",
"bytes": "251833"
},
{
"name": "Thrift",
"bytes": "137291"
},
{
"name": "TypeScript",
"bytes": "932690"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.