Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 701
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 700)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 701
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
<a href="mailto:{{ site.email }}">
<span class="icon icon--email">
{% include icon-email.svg %}
</span>
Email
</a>
|
{
"content_hash": "41ef1f8e2760e61523b70afd43574e7a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 34,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.568,
"repo_name": "PwzXxm/local-site",
"id": "024540b6409d68a36b67ea0f570ba3e2c3cdf707",
"size": "125",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_includes/icon-email.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "26372"
},
{
"name": "HTML",
"bytes": "814496"
},
{
"name": "Ruby",
"bytes": "11591"
}
]
}
|
namespace peloton {
namespace planner {
class HashPlan;
} // namespace planner
namespace codegen {
//===----------------------------------------------------------------------===//
// The translator for a hash-based distinct operator.
//===----------------------------------------------------------------------===//
class HashTranslator : public OperatorTranslator {
public:
// Constructor
HashTranslator(const planner::HashPlan &hash_plan,
CompilationContext &context, Pipeline &pipeline);
// Codegen any initialization work for this operator
void InitializeQueryState() override;
// Define any helper functions this translator needs
void DefineAuxiliaryFunctions() override {}
// The method that produces new tuples
void Produce() const override;
// The method that consumes tuples from child operators
void Consume(ConsumerContext &context, RowBatch::Row &row) const override;
// Codegen any cleanup work for this translator
void TearDownQueryState() override;
private:
void CollectHashKeys(RowBatch::Row &row,
std::vector<codegen::Value> &key) const;
const planner::HashPlan &GetHashPlan() const;
private:
//===--------------------------------------------------------------------===//
// The callback used when we probe the hash table and the key already exists.
// It's a dummy class that just drops the row and does nothing.
//===--------------------------------------------------------------------===//
class ConsumerProbe : public HashTable::ProbeCallback {
public:
// The callback
void ProcessEntry(CodeGen &codegen, llvm::Value *data_area) const override;
};
//===--------------------------------------------------------------------===//
// The callback used when we probe the hash table when aggregating, but do
// not find an existing entry. It passes the row on to the parent.
//===--------------------------------------------------------------------===//
class ConsumerInsert : public HashTable::InsertCallback {
public:
// Constructor
explicit ConsumerInsert(ConsumerContext &context, RowBatch::Row &row);
// StoreValue the initial values of the aggregates into the provided storage
void StoreValue(CodeGen &codegen, llvm::Value *data_space) const override;
llvm::Value *GetValueSize(CodeGen &codegen) const override;
private:
// ConsumerContext on which the consume will be called
ConsumerContext &context_;
// The row that will be given to the parent
RowBatch::Row &row_;
};
// The ID of the hash-table in the runtime state
QueryState::Id hash_table_id_;
// The hash table
OAHashTable hash_table_;
};
} // namespace codegen
} // namespace peloton
|
{
"content_hash": "5e012081bcb7af6fa4b775d69ab2155d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 80,
"avg_line_length": 34.25,
"alnum_prop": 0.5937956204379562,
"repo_name": "apavlo/peloton",
"id": "43b21a4f22fbd677c96dfd2cc62ba8c76b25ccdc",
"size": "3362",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/include/codegen/operator/hash_translator.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "47425"
},
{
"name": "C++",
"bytes": "7112442"
},
{
"name": "CMake",
"bytes": "136686"
},
{
"name": "Cap'n Proto",
"bytes": "362"
},
{
"name": "Java",
"bytes": "76998"
},
{
"name": "PLpgSQL",
"bytes": "5855"
},
{
"name": "Python",
"bytes": "108672"
},
{
"name": "Ruby",
"bytes": "1278"
},
{
"name": "Shell",
"bytes": "25157"
}
]
}
|
import Entity from './Entity'
import Resource from '../resource/Resource'
import Scope from '../scope/Scope'
import isString from 'lodash-es/isString'
const path = '/domains'
/**
* Represents a Domain entity.
*
* @extends Entity
*/
export default class Domain extends Entity {
/**
* Return simple resource factory for Domains.
*
* @static
* @return {{domain: Function}}
*/
static resourceFactory () {
return {
domain () {
// Domains don't have single resource endpoint (e.g.: /domains/:id)
if (isString(arguments[0])) {
throw new TypeError('There is no single resource for Domains')
}
// Only allowed on Entities and Resources.
if (this instanceof Scope) {
throw new Error('Domain is not a top-level resource.')
}
return Resource.factoryFor(Domain, path).call(this)
}
}
}
}
|
{
"content_hash": "8cf044c9ee540caad5add9da2ffc7484",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 75,
"avg_line_length": 24.2972972972973,
"alnum_prop": 0.6173526140155728,
"repo_name": "evrythng/evrythng.js",
"id": "8502f91eec3853720baf5e0c381c0ba00f1e08e5",
"size": "899",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/entity/Domain.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "334"
},
{
"name": "HTML",
"bytes": "406"
},
{
"name": "JavaScript",
"bytes": "313737"
},
{
"name": "Shell",
"bytes": "689"
}
]
}
|
{% extends "../theme/base_edit.html" %}
{% block edit %}
<ol class="breadcrumb">
<li>Current location: <a href="{% module site_url() %}">Home</a></li>
<li>{% module the_category(postinfo.uid) %}</li>
<li class="active">{{ postinfo.title }}</li>
</ol>
<div class="panel panel-default">
<div class="panel-heading">
<h2>{{ postinfo.title }}</h2>
<span>{{ str(postinfo.date)[:10] }}</span>
<span>Author: <a href="http://www.osgeo.cn/">OSGeo中国中心</a></span>
<span>Browse: {{ postinfo.view_count }} 次</span>
<span class="cmts"><a class="btn btn-xm btn-primary" href="/wiki/{{ postinfo.title }}">View</a></span>
</div>
<div class="panel-body">
<form action="/wiki_man/edit/{{postinfo.uid}}" method="post" class="form-horizontal" role="form" id="form_post">
<fieldset>
<div class="form-group">
<div class="col-sm-10">
<textarea rows=26 id="cnt_md" name="cnt_md" cols="80" class="form-control">
{% raw unescape(postinfo.cnt_md) %}
</textarea>
</div>
</div>
<div class="form-group">
<label for="sub1" class="col-sm-1 control-label"></label>
<div class="col-sm-3">
<input id="sub1" type="submit" class="btn btn-warning" value="更新"/>
</div>
</div>
</fieldset>
</form>
<div class="bg-warning">文本编辑使用MarkDown语法。
<a href="http://www.maplet.org/page/markdown.html">MarkDown语法说明</a></div>
</div>
</div>
{% end %}
|
{
"content_hash": "f4ed540727d7817b9cf1ee246bf11128",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 122,
"avg_line_length": 33.95918367346939,
"alnum_prop": 0.5060096153846154,
"repo_name": "bukun/maplet",
"id": "a2ee043c0738ab6eb1c406702b56e9a64545346f",
"size": "1704",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "templates/wiki_man/wiki_man_edit.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "195655"
},
{
"name": "CoffeeScript",
"bytes": "26506"
},
{
"name": "HTML",
"bytes": "531878"
},
{
"name": "JavaScript",
"bytes": "5170877"
},
{
"name": "Makefile",
"bytes": "409"
},
{
"name": "Python",
"bytes": "6202"
},
{
"name": "Ruby",
"bytes": "905"
},
{
"name": "Shell",
"bytes": "253"
}
]
}
|
import Transmit from 'react-transmit'
export default class Utils {
/**
* Find a parent element by traversing up.
* @param {Object} child - DOM element.
* @param {string} selector - Selector to find parent. e.g. '#id123' or '.content' or 'div'.
* @returns {Object} - Return parent dom element (return itself if it satisfies the selector).
*/
static findParentByChild (child, selector) {
let el = child
const isClassName = (selector[0] === '.' ? true : false)
const isId = (selector[0] === '#' ? true : false)
if (isId || isClassName) {
selector = selector.slice(1)
}
while (el) {
const classes = el.getAttribute('class')
if ((isId && el.getAttribute('id') === selector) ||
(isClassName && classes && classes.split(' ').indexOf(selector) >= 0) ||
(el.tagName === selector.toUpperCase())) {
break
}
el = el.parentElement
}
return el
}
/**
* Toggle element by setting display style to 'block' or 'none'.
* @example - toggle({ overlayEl: el, show: false }).
* @param {Object} param - Object parameter { name: domEl, show: boolean }.
*/
static toggle (param) {
const el = param[ Object.keys(param)[0] ] // first param object.
el.style.display = (param.show ? 'block' : 'none')
}
/**
* Helper function to get Transmit Fragments object from the array of fragments.
* @param {Object} fragmentObj - Object of fragments which declares functions to fetch data.
* @returns {Object} - Transmit's fragment object.
*/
static getTransmitFragments (fragmentObj) {
const fragments = {}
for (const key in fragmentObj) {
const fn = fragmentObj[ key ][ 0 ]
const fnParams = fragmentObj[ key ].slice(1)
fragments[ key ] = () => ( __CLIENT__ ? Promise.resolve() : fn.apply(this, fnParams) )
}
return fragments
}
/**
* Client-side helper to invoke functions in 'fragmentArr' to fetch data to the state.
* @param {Object} fragmentObj - Object of fragments which declares functions to fetch data.
* @param {Object} ctx - Context (e.g. this).
* @param {callbackFn} [callbackFn] - Callback function to handle each fragment.
* @callback callbackFn
* @param {string} callbackFn.key - Fragment key.
* @param {Object} callbackFn.data - Fragment data.
* @param {allDoneFn} [allDoneFn] - Callback function when all requests completed.
*/
static fetchFragmentsToState (fragmentObj, ctx, callbackFn, allDoneFn) {
let counter = 0
const allData = {}
const keys = fragmentObj ? Object.keys(fragmentObj) : []
if (__CLIENT__ && keys.length > 0 && !ctx.props[ keys[0] ]) {
// if client-side & data was not injected in props by server-rendering (Transmit) => fetch data
for (const key in fragmentObj) {
const fn = fragmentObj[ key ][ 0 ]
const fnParams = fragmentObj[ key ].slice(1)
fn( fnParams ).then(data => {
const state = {}
state[ key ] = data
allData[ key ] = data
ctx.setState(state)
if (callbackFn) {
callbackFn(key, data) // invoke the callback function when each request is done.
}
counter++
if (counter === keys.length) {
if (allDoneFn) {
allDoneFn(allData)
}
}
})
}
} else {
ctx.setState(ctx.props)
}
}
/**
* Helper function to wrap Component with Transmit Container to fetch fragments for server rendering.
* @param {Class} Component - Component to wrap.
* @param {Array} fragmentObj - Object of fragments which declare functions to fetch data.
* @returns {Object} - Transmit Container.
*/
static createTransmitContainer (Component, fragmentObj) {
const fragments = this.getTransmitFragments(fragmentObj)
return Transmit.createContainer(Component, { initialVariables: {}, fragments })
}
}
|
{
"content_hash": "9cd821ef2b44a753ca2bde5f49eac663",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 103,
"avg_line_length": 37.523809523809526,
"alnum_prop": 0.6192893401015228,
"repo_name": "ngduc/react-setup",
"id": "9415e4b14b1cdd77414ef43ebb3959e73a373c53",
"size": "3940",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/utils/Utils.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "750"
},
{
"name": "HTML",
"bytes": "947"
},
{
"name": "JavaScript",
"bytes": "36800"
}
]
}
|
package FileLocatorFactory;
# ************************************************************
# Description : Create FileLocator objects.
# Author : Chad Elliott
# Create Date : 11/29/2005
# $Id: FileLocatorFactory.pm 94999 2011-11-09 23:31:08Z hillj $
# ************************************************************
# ************************************************************
# Pragmas
# ************************************************************
use strict;
use Cwd;
use CVSFileLocator;
use SVNFileLocator;
# ************************************************************
# Subroutine Section
# ************************************************************
sub create {
## Check for Subversion first. It is unlikely that the .svn directory
## will exist when Subversion isn't the rcs being used. However, that
## is not the case for CVS directories.
switch: {
((defined $ENV{SVN_ASP_DOT_NET_HACK} && -d '_svn') || searchParentDirectory('.svn'))
&& do { return new SVNFileLocator(); };
-d 'CVS' && do { return new CVSFileLocator(); };
print STDERR "WARNING: Unsupported revision control protocol\n";
}
return new FileLocator();
}
sub searchParentDirectory {
my($hidden) = shift;
my($path) = cwd();
my($index) = -1;
# Search all parent directories for the specified hidden
# directory. We stop when we either found the hidden directory
# of there are no more parent directories let to search.
do {
if (-d $path . '/' . $hidden) {
return 1;
}
$index = rindex($path, '/');
if ($index != -1) {
$path = substr ($path, 0, $index);
}
} while ($index != -1);
return 0;
}
1;
|
{
"content_hash": "ff36065ddf4411b1d1569a8a44e0fbbd",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 88,
"avg_line_length": 27.080645161290324,
"alnum_prop": 0.4919594997022037,
"repo_name": "batmancn/TinySDNController",
"id": "aac631226345e73727211a7f1a2a8a9887d8d385",
"size": "1679",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ACE_wrappers/bin/ChangeLogEditor/FileLocatorFactory.pm",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4318"
},
{
"name": "C",
"bytes": "579143"
},
{
"name": "C++",
"bytes": "18861139"
},
{
"name": "CMake",
"bytes": "10969"
},
{
"name": "CSS",
"bytes": "40195"
},
{
"name": "Emacs Lisp",
"bytes": "7179"
},
{
"name": "Gnuplot",
"bytes": "48098"
},
{
"name": "Groff",
"bytes": "740"
},
{
"name": "HTML",
"bytes": "2567378"
},
{
"name": "LLVM",
"bytes": "4067"
},
{
"name": "Logos",
"bytes": "204"
},
{
"name": "Makefile",
"bytes": "4724573"
},
{
"name": "Max",
"bytes": "84490"
},
{
"name": "Objective-C",
"bytes": "420"
},
{
"name": "Perl",
"bytes": "1936593"
},
{
"name": "Perl6",
"bytes": "776"
},
{
"name": "PostScript",
"bytes": "152076"
},
{
"name": "Python",
"bytes": "138897"
},
{
"name": "Shell",
"bytes": "154140"
},
{
"name": "Tcl",
"bytes": "397"
},
{
"name": "Yacc",
"bytes": "14880"
}
]
}
|
package com.gemstone.gemfire.management.internal.configuration.utils;
import static com.gemstone.gemfire.management.internal.configuration.utils.XmlConstants.*;
import static javax.xml.XMLConstants.*;
import static org.junit.Assert.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.XMLConstants;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
import com.gemstone.gemfire.management.internal.configuration.utils.XmlUtils.XPathContext;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
/**
* Unit tests for {@link XmlUtils}. See Also {@link XmlUtilsAddNewNodeJUnitTest}
* for tests related to {@link XmlUtils#addNewNode(Document, XmlEntity)}
*
* @author jbarrett@pivotal.io
*
* @since 8.1
*/
@Category(UnitTest.class)
public class XmlUtilsJUnitTest {
/**
* Test method for {@link XmlUtils#buildSchemaLocationMap(Attribute)}.
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
@Test
public void testBuildSchemaLocationMapAttribute() throws SAXException, ParserConfigurationException, IOException {
final Document doc = XmlUtils.createDocumentFromReader(new InputStreamReader(this.getClass().getResourceAsStream(
"XmlUtilsJUnitTest.testBuildSchemaLocationMapAttribute.xml")));
final String schemaLocationAttribute = XmlUtils.getAttribute(doc.getDocumentElement(), W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION,
W3C_XML_SCHEMA_INSTANCE_NS_URI);
final Map<String, List<String>> schemaLocationMap = XmlUtils.buildSchemaLocationMap(schemaLocationAttribute);
assertNotNull(schemaLocationMap);
assertEquals(2, schemaLocationMap.size());
final List<String> locations1 = schemaLocationMap.get("http://schema.pivotal.io/gemfire/cache");
assertNotNull(locations1);
assertEquals(1, locations1.size());
assertEquals("http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd", locations1.get(0));
final List<String> locations2 = schemaLocationMap.get("urn:java:com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsJUnitTest");
assertNotNull(locations2);
assertEquals(2, locations2.size());
assertEquals("classpath:/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsJUnitTest.xsd", locations2.get(0));
assertEquals("XmlUtilsJUnitTest.xsd", locations2.get(1));
final List<String> locations3 = schemaLocationMap.get("urn:__does_not_exist__");
assertNull(locations3);
}
/**
* Test method for {@link XmlUtils#buildSchemaLocationMap(Map, Attribute)}.
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
@Test
public void testBuildSchemaLocationMapMapOfStringListOfStringAttribute() throws SAXException, ParserConfigurationException, IOException {
Map<String, List<String>> schemaLocationMap = new HashMap<>();
final Document doc1 = XmlUtils.createDocumentFromReader(new InputStreamReader(this.getClass().getResourceAsStream(
"XmlUtilsJUnitTest.testBuildSchemaLocationMapAttribute.xml")));
final String schemaLocationAttribute1 = XmlUtils.getAttribute(doc1.getDocumentElement(), W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION,
W3C_XML_SCHEMA_INSTANCE_NS_URI);
schemaLocationMap = XmlUtils.buildSchemaLocationMap(schemaLocationMap, schemaLocationAttribute1);
final Document doc2 = XmlUtils.createDocumentFromReader(new InputStreamReader(this.getClass().getResourceAsStream(
"XmlUtilsJUnitTest.testBuildSchemaLocationMapMapOfStringListOfStringAttribute.xml")));
final String schemaLocationAttribute2 = XmlUtils.getAttribute(doc2.getDocumentElement(), W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION,
W3C_XML_SCHEMA_INSTANCE_NS_URI);
schemaLocationMap = XmlUtils.buildSchemaLocationMap(schemaLocationMap, schemaLocationAttribute2);
assertNotNull(schemaLocationMap);
assertEquals(3, schemaLocationMap.size());
final List<String> locations1 = schemaLocationMap.get("http://schema.pivotal.io/gemfire/cache");
assertNotNull(locations1);
assertEquals(2, locations1.size());
assertEquals("http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd", locations1.get(0));
assertEquals("cache-8.1.xsd", locations1.get(1));
final List<String> locations2 = schemaLocationMap.get("urn:java:com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsJUnitTest");
assertNotNull(locations2);
assertEquals(2, locations2.size());
assertEquals("classpath:/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsJUnitTest.xsd", locations2.get(0));
assertEquals("XmlUtilsJUnitTest.xsd", locations2.get(1));
final List<String> locations3 = schemaLocationMap.get("urn:__does_not_exist__");
assertNull(locations3);
final List<String> locations4 = schemaLocationMap.get("urn:java:com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsJUnitTest2");
assertNotNull(locations4);
assertEquals(1, locations4.size());
assertEquals("XmlUtilsJUnitTest2.xsd", locations4.get(0));
}
/**
* Test method for {@link XmlUtils#buildSchemaLocationMap(Map, Attribute)}.
* Asserts map is empty if schemaLocation attribute is <code>null</code>.
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
@Test
public void testBuildSchemaLocationMapNullAttribute() throws SAXException, ParserConfigurationException, IOException {
final Document doc = XmlUtils.createDocumentFromReader(new InputStreamReader(this.getClass().getResourceAsStream(
"XmlUtilsJUnitTest.testBuildSchemaLocationMapNullAttribute.xml")));
final String schemaLocationAttribute = XmlUtils.getAttribute(doc.getDocumentElement(), W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION,
W3C_XML_SCHEMA_INSTANCE_NS_URI);
assertNull(schemaLocationAttribute);
final Map<String, List<String>> schemaLocationMap = XmlUtils.buildSchemaLocationMap(schemaLocationAttribute);
assertEquals(0, schemaLocationMap.size());
}
/**
* Test method for {@link XmlUtils#buildSchemaLocationMap(Map, Attribute)}.
* Asserts map is empty if schemaLocation attribute is empty.
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
@Test
public void testBuildSchemaLocationMapEmptyAttribute() throws SAXException, ParserConfigurationException, IOException {
final Document doc = XmlUtils.createDocumentFromReader(new InputStreamReader(this.getClass().getResourceAsStream(
"XmlUtilsJUnitTest.testBuildSchemaLocationMapEmptyAttribute.xml")));
final String schemaLocationAttribute = XmlUtils.getAttribute(doc.getDocumentElement(), W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION,
W3C_XML_SCHEMA_INSTANCE_NS_URI);
assertNotNull(schemaLocationAttribute);
final Map<String, List<String>> schemaLocationMap = XmlUtils.buildSchemaLocationMap(schemaLocationAttribute);
assertEquals(0, schemaLocationMap.size());
}
/**
* Test method for
* {@link XmlUtils#querySingleElement(Node, String, XPathContext)}.
* @throws XPathExpressionException
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
@Test
public void testQuerySingleElement() throws XPathExpressionException, SAXException, ParserConfigurationException, IOException {
final Document doc = XmlUtils.createDocumentFromReader(new InputStreamReader(this.getClass().getResourceAsStream(
"XmlUtilsJUnitTest.testQuerySingleElement.xml")));
final Element root = doc.getDocumentElement();
final String cacheNamespace = "http://schema.pivotal.io/gemfire/cache";
final XPathContext cacheXPathContext = new XPathContext("cache", cacheNamespace);
// There are mulitple region elements, this should get the first one.
final NodeList n1 = XmlUtils.query(root, "//cache:region[1]", cacheXPathContext);
final Node e1 = XmlUtils.querySingleElement(root, "//cache:region", cacheXPathContext);
assertNotNull(e1);
assertSame(root.getElementsByTagNameNS(cacheNamespace, "region").item(0), e1);
assertSame(n1.item(0), e1);
// This should get the second region with name "r2".
final NodeList n2 = XmlUtils.query(root, "//cache:region[2]", cacheXPathContext);
final Node e2 = XmlUtils.querySingleElement(root, "//cache:region[@name='r2']", cacheXPathContext);
assertNotNull(e2);
assertSame(root.getElementsByTagNameNS(cacheNamespace, "region").item(1), e2);
assertSame(n2.item(0), e2);
// This should get none since there is no r3.
final Node e3 = XmlUtils.querySingleElement(root, "//cache:region[@name='r3']", cacheXPathContext);
assertNull(e3);
// Query attributes (not Elements)
final String q4 = "//cache:region/@name";
final NodeList n4 =XmlUtils.query(root, q4, cacheXPathContext);
assertEquals(2, n4.getLength());
assertEquals(Node.ATTRIBUTE_NODE, n4.item(0).getNodeType());
// This should get none since path is to an attribute.
try {
XmlUtils.querySingleElement(root, q4, cacheXPathContext);
fail("Expected XPathExpressionException");
} catch (XPathExpressionException e) {
// ignore
}
}
/**
* Test method for {@link XmlUtils#changeNamespace(Node, String, String)}.
* @throws XPathExpressionException
* @throws ParserConfigurationException
*/
@Test
public void testChangeNamespace() throws XPathExpressionException, ParserConfigurationException {
Document doc = XmlUtils.getDocumentBuilder().newDocument();
Element root = doc.createElement("root");
root = (Element) doc.appendChild(root);
final Element child = doc.createElement("child");
root.appendChild(child);
final String ns2 = "urn:namespace2";
final Element childWithNamespace = doc.createElementNS(ns2, "childWithNamespace");
root.appendChild(childWithNamespace);
root.appendChild(doc.createTextNode("some text"));
assertEquals(null, root.getNamespaceURI());
assertEquals(null, child.getNamespaceURI());
assertEquals(ns2, childWithNamespace.getNamespaceURI());
final String ns1 = "urn:namespace1";
root = (Element) XmlUtils.changeNamespace(root, XMLConstants.NULL_NS_URI, ns1);
assertEquals(ns1, root.getNamespaceURI());
assertEquals(ns1, root.getElementsByTagName("child").item(0).getNamespaceURI());
assertEquals(ns2, root.getElementsByTagName("childWithNamespace").item(0).getNamespaceURI());
}
}
|
{
"content_hash": "1cf68a73e233a69843241572b13d0867",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 150,
"avg_line_length": 47.03862660944206,
"alnum_prop": 0.7612226277372263,
"repo_name": "ysung-pivotal/incubator-geode",
"id": "46c44af9f3f54eedacd3c3f501f106448c65e5c7",
"size": "11375",
"binary": false,
"copies": "7",
"ref": "refs/heads/develop",
"path": "gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsJUnitTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1776"
},
{
"name": "CSS",
"bytes": "54202"
},
{
"name": "Groovy",
"bytes": "4066"
},
{
"name": "HTML",
"bytes": "124114"
},
{
"name": "Java",
"bytes": "25740015"
},
{
"name": "JavaScript",
"bytes": "315581"
},
{
"name": "Scala",
"bytes": "192735"
},
{
"name": "Shell",
"bytes": "7239"
}
]
}
|
import Ember from 'ember';
export default Ember.Component.extend({
isExpanded: false,
actions: {
nestedAction: function() {
this.sendAction('nestedAction');
}
}
});
|
{
"content_hash": "a317307b8a84e8a20b19ac902efb02e0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 39,
"avg_line_length": 17,
"alnum_prop": 0.6470588235294118,
"repo_name": "mitchlloyd/ember-islands",
"id": "327c0652f738a23777dcf43f74ce9dcaa04721c3",
"size": "187",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/dummy/app/components/nested-component.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2749"
},
{
"name": "JavaScript",
"bytes": "26876"
}
]
}
|
#include "pool.h"
#ifndef GIT_WIN32
#include <unistd.h>
#endif
struct git_pool_page {
git_pool_page *next;
uint32_t size;
uint32_t avail;
char data[GIT_FLEX_ARRAY];
};
struct pool_freelist {
struct pool_freelist *next;
};
#define GIT_POOL_MIN_USABLE 4
#define GIT_POOL_MIN_PAGESZ 2 * sizeof(void*)
static void *pool_alloc_page(git_pool *pool, uint32_t size);
static void pool_insert_page(git_pool *pool, git_pool_page *page);
int git_pool_init(
git_pool *pool, uint32_t item_size, uint32_t items_per_page)
{
assert(pool);
if (!item_size)
item_size = 1;
/* round up item_size for decent object alignment */
if (item_size > 4)
item_size = (item_size + 7) & ~7;
else if (item_size == 3)
item_size = 4;
if (!items_per_page)
items_per_page = git_pool__suggest_items_per_page(item_size);
if (item_size * items_per_page < GIT_POOL_MIN_PAGESZ)
items_per_page = (GIT_POOL_MIN_PAGESZ + item_size - 1) / item_size;
memset(pool, 0, sizeof(git_pool));
pool->item_size = item_size;
pool->page_size = item_size * items_per_page;
return 0;
}
void git_pool_clear(git_pool *pool)
{
git_pool_page *scan, *next;
for (scan = pool->open; scan != NULL; scan = next) {
next = scan->next;
git__free(scan);
}
pool->open = NULL;
for (scan = pool->full; scan != NULL; scan = next) {
next = scan->next;
git__free(scan);
}
pool->full = NULL;
pool->free_list = NULL;
pool->items = 0;
pool->has_string_alloc = 0;
pool->has_multi_item_alloc = 0;
pool->has_large_page_alloc = 0;
}
void git_pool_swap(git_pool *a, git_pool *b)
{
git_pool temp;
if (a == b)
return;
memcpy(&temp, a, sizeof(temp));
memcpy(a, b, sizeof(temp));
memcpy(b, &temp, sizeof(temp));
}
static void pool_insert_page(git_pool *pool, git_pool_page *page)
{
git_pool_page *scan;
/* If there are no open pages or this page has the most open space,
* insert it at the beginning of the list. This is the common case.
*/
if (pool->open == NULL || pool->open->avail < page->avail) {
page->next = pool->open;
pool->open = page;
return;
}
/* Otherwise insert into sorted position. */
for (scan = pool->open;
scan->next && scan->next->avail > page->avail;
scan = scan->next);
page->next = scan->next;
scan->next = page;
}
static void *pool_alloc_page(git_pool *pool, uint32_t size)
{
git_pool_page *page;
uint32_t alloc_size;
if (size <= pool->page_size)
alloc_size = pool->page_size;
else {
alloc_size = size;
pool->has_large_page_alloc = 1;
}
page = git__calloc(1, alloc_size + sizeof(git_pool_page));
if (!page)
return NULL;
page->size = alloc_size;
page->avail = alloc_size - size;
if (page->avail > 0)
pool_insert_page(pool, page);
else {
page->next = pool->full;
pool->full = page;
}
pool->items++;
return page->data;
}
GIT_INLINE(void) pool_remove_page(
git_pool *pool, git_pool_page *page, git_pool_page *prev)
{
if (prev == NULL)
pool->open = page->next;
else
prev->next = page->next;
}
void *git_pool_malloc(git_pool *pool, uint32_t items)
{
git_pool_page *scan = pool->open, *prev;
uint32_t size = items * pool->item_size;
void *ptr = NULL;
pool->has_string_alloc = 0;
if (items > 1)
pool->has_multi_item_alloc = 1;
else if (pool->free_list != NULL) {
ptr = pool->free_list;
pool->free_list = ((struct pool_freelist *)pool->free_list)->next;
return ptr;
}
/* just add a block if there is no open one to accomodate this */
if (size >= pool->page_size || !scan || scan->avail < size)
return pool_alloc_page(pool, size);
pool->items++;
/* find smallest block in free list with space */
for (scan = pool->open, prev = NULL;
scan->next && scan->next->avail >= size;
prev = scan, scan = scan->next);
/* allocate space from the block */
ptr = &scan->data[scan->size - scan->avail];
scan->avail -= size;
/* move to full list if there is almost no space left */
if (scan->avail < pool->item_size || scan->avail < GIT_POOL_MIN_USABLE) {
pool_remove_page(pool, scan, prev);
scan->next = pool->full;
pool->full = scan;
}
/* reorder list if block is now smaller than the one after it */
else if (scan->next != NULL && scan->next->avail > scan->avail) {
pool_remove_page(pool, scan, prev);
pool_insert_page(pool, scan);
}
return ptr;
}
char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
{
char *ptr = NULL;
assert(pool && str && pool->item_size == sizeof(char));
if ((uint32_t)(n + 1) < n)
return NULL;
if ((ptr = git_pool_malloc(pool, (uint32_t)(n + 1))) != NULL) {
memcpy(ptr, str, n);
ptr[n] = '\0';
}
pool->has_string_alloc = 1;
return ptr;
}
char *git_pool_strdup(git_pool *pool, const char *str)
{
assert(pool && str && pool->item_size == sizeof(char));
return git_pool_strndup(pool, str, strlen(str));
}
char *git_pool_strdup_safe(git_pool *pool, const char *str)
{
return str ? git_pool_strdup(pool, str) : NULL;
}
char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
{
void *ptr;
size_t len_a, len_b;
assert(pool && a && b && pool->item_size == sizeof(char));
len_a = a ? strlen(a) : 0;
len_b = b ? strlen(b) : 0;
if ((ptr = git_pool_malloc(pool, (uint32_t)(len_a + len_b + 1))) != NULL) {
if (len_a)
memcpy(ptr, a, len_a);
if (len_b)
memcpy(((char *)ptr) + len_a, b, len_b);
*(((char *)ptr) + len_a + len_b) = '\0';
}
pool->has_string_alloc = 1;
return ptr;
}
void git_pool_free(git_pool *pool, void *ptr)
{
struct pool_freelist *item = ptr;
assert(pool && pool->item_size >= sizeof(void*));
if (item) {
item->next = pool->free_list;
pool->free_list = item;
}
}
void git_pool_free_array(git_pool *pool, size_t count, void **ptrs)
{
struct pool_freelist **items = (struct pool_freelist **)ptrs;
size_t i;
assert(pool && ptrs && pool->item_size >= sizeof(void*));
if (!count)
return;
for (i = count - 1; i > 0; --i)
items[i]->next = items[i - 1];
items[i]->next = pool->free_list;
pool->free_list = items[count - 1];
}
uint32_t git_pool__open_pages(git_pool *pool)
{
uint32_t ct = 0;
git_pool_page *scan;
for (scan = pool->open; scan != NULL; scan = scan->next) ct++;
return ct;
}
uint32_t git_pool__full_pages(git_pool *pool)
{
uint32_t ct = 0;
git_pool_page *scan;
for (scan = pool->full; scan != NULL; scan = scan->next) ct++;
return ct;
}
bool git_pool__ptr_in_pool(git_pool *pool, void *ptr)
{
git_pool_page *scan;
for (scan = pool->open; scan != NULL; scan = scan->next)
if ((void *)scan->data <= ptr &&
(void *)(((char *)scan->data) + scan->size) > ptr)
return true;
for (scan = pool->full; scan != NULL; scan = scan->next)
if ((void *)scan->data <= ptr &&
(void *)(((char *)scan->data) + scan->size) > ptr)
return true;
return false;
}
uint32_t git_pool__system_page_size(void)
{
static uint32_t size = 0;
if (!size) {
#ifdef GIT_WIN32
SYSTEM_INFO info;
GetSystemInfo(&info);
size = (uint32_t)info.dwPageSize;
#elif defined(__amigaos4__)
size = (uint32_t)4096; /* 4K as there is no global value we can query */
#else
size = (uint32_t)sysconf(_SC_PAGE_SIZE);
#endif
size -= 2 * sizeof(void *); /* allow space for malloc overhead */
}
return size;
}
uint32_t git_pool__suggest_items_per_page(uint32_t item_size)
{
uint32_t page_bytes =
git_pool__system_page_size() - sizeof(git_pool_page);
return page_bytes / item_size;
}
|
{
"content_hash": "4d3d38f1843db9e5343f94808f38c49a",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 76,
"avg_line_length": 22.20909090909091,
"alnum_prop": 0.6250511665984445,
"repo_name": "jweather/sonic-pi",
"id": "146f118b4ccdc889979004326ca6af4015231308",
"size": "7329",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "app/server/vendor/rugged/vendor/libgit2/src/pool.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2077"
},
{
"name": "C++",
"bytes": "108362"
},
{
"name": "CSS",
"bytes": "566"
},
{
"name": "Clojure",
"bytes": "133719"
},
{
"name": "JavaScript",
"bytes": "673"
},
{
"name": "Prolog",
"bytes": "1710"
},
{
"name": "Ruby",
"bytes": "421758"
},
{
"name": "Shell",
"bytes": "3259"
}
]
}
|
package org.apache.hadoop.hbase.backup;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.util.ToolRunner;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
@Category(LargeTests.class)
public class TestBackupStatusProgress extends TestBackupBase {
private static final Log LOG = LogFactory.getLog(TestBackupStatusProgress.class);
/**
* Verify that full backup is created on a single table with data correctly.
* @throws Exception
*/
@Test
public void testBackupStatusProgress() throws Exception {
LOG.info("test backup status/progress on a single table with data");
List<TableName> tableList = Lists.newArrayList(table1);
String backupId = fullTableBackup(tableList);
LOG.info("backup complete");
assertTrue(checkSucceeded(backupId));
BackupInfo info = getBackupAdmin().getBackupInfo(backupId);
assertTrue(info.getState() == BackupState.COMPLETE);
LOG.debug(info.getShortDescription());
assertTrue(info.getProgress() > 0);
}
@Test
public void testBackupStatusProgressCommand() throws Exception {
LOG.info("test backup status/progress on a single table with data: command-line");
List<TableName> tableList = Lists.newArrayList(table1);
String backupId = fullTableBackup(tableList);
LOG.info("backup complete");
assertTrue(checkSucceeded(backupId));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos));
String[] args = new String[] { "describe", backupId };
int ret = ToolRunner.run(conf1, new BackupDriver(), args);
assertTrue(ret == 0);
String responce = baos.toString();
assertTrue(responce.indexOf(backupId) > 0);
assertTrue(responce.indexOf("COMPLETE") > 0);
baos = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos));
args = new String[] { "progress", backupId };
ret = ToolRunner.run(conf1, new BackupDriver(), args);
assertTrue(ret == 0);
responce = baos.toString();
assertTrue(responce.indexOf(backupId) >= 0);
assertTrue(responce.indexOf("progress") > 0);
assertTrue(responce.indexOf("100") > 0);
}
}
|
{
"content_hash": "9a121cb9928ae41814fb9728ccf98111",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 86,
"avg_line_length": 32.3625,
"alnum_prop": 0.7365778292777134,
"repo_name": "JingchengDu/hbase",
"id": "73d8d9fd300ba4593a410736faa9dd40c6457931",
"size": "3388",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "351"
},
{
"name": "Batchfile",
"bytes": "25288"
},
{
"name": "C",
"bytes": "28534"
},
{
"name": "C++",
"bytes": "56085"
},
{
"name": "CMake",
"bytes": "13186"
},
{
"name": "CSS",
"bytes": "35785"
},
{
"name": "Groovy",
"bytes": "12548"
},
{
"name": "HTML",
"bytes": "17275"
},
{
"name": "Java",
"bytes": "31868492"
},
{
"name": "JavaScript",
"bytes": "2694"
},
{
"name": "Makefile",
"bytes": "1359"
},
{
"name": "PHP",
"bytes": "8385"
},
{
"name": "Perl",
"bytes": "383739"
},
{
"name": "Protocol Buffer",
"bytes": "278993"
},
{
"name": "Python",
"bytes": "109656"
},
{
"name": "Ruby",
"bytes": "547382"
},
{
"name": "Scala",
"bytes": "442815"
},
{
"name": "Shell",
"bytes": "181569"
},
{
"name": "Thrift",
"bytes": "41524"
},
{
"name": "XSLT",
"bytes": "6764"
}
]
}
|
id: jsx-gotchas
title: JSX 的误区
permalink: jsx-gotchas.html
prev: jsx-in-depth.html
next: interactivity-and-dynamic-uis.html
---
JSX looks like HTML but there are some important differences you may run into.
> Note:
>
> For DOM differences, such as the inline `style` attribute, check [here](/react/docs/dom-differences.html).
## HTML Entities
You can insert HTML entities within literal text in JSX:
```javascript
<div>First · Second</div>
```
If you want to display an HTML entity within dynamic content, you will run into double escaping issues as React escapes all the strings you are displaying in order to prevent a wide range of XSS attacks by default.
```javascript
// Bad: It displays "First · Second"
<div>{'First · Second'}</div>
```
There are various ways to work-around this issue. The easiest one is to write unicode character directly in Javascript. You need to make sure that the file is saved as UTF-8 and that the proper UTF-8 directives are set so the browser will display it correctly.
```javascript
<div>{'First · Second'}</div>
```
A safer alternative is to find the [unicode number corresponding to the entity](http://www.fileformat.info/info/unicode/char/b7/index.htm) and use it inside of a JavaScript string.
```javascript
<div>{'First \u00b7 Second'}</div>
<div>{'First ' + String.fromCharCode(183) + ' Second'}</div>
```
You can use mixed arrays with strings and JSX elements.
```javascript
<div>{['First ', <span>·</span>, ' Second']}</div>
```
As a last resort, you always have the ability to insert raw HTML.
```javascript
<div dangerouslySetInnerHTML={{'{{'}}__html: 'First · Second'}} />
```
## Custom HTML Attributes
If you pass properties to native HTML elements that do not exist in the HTML specification, React will not render them. If you want to use a custom attribute, you should prefix it with `data-`.
```javascript
<div data-custom-attribute="foo" />
```
[Web Accessibility](http://www.w3.org/WAI/intro/aria) attributes starting with `aria-` will be rendered properly.
```javascript
<div aria-hidden={true} />
```
|
{
"content_hash": "fe20cce325e9a37da08ac36d1e84f3cf",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 260,
"avg_line_length": 31.53731343283582,
"alnum_prop": 0.7297681022243256,
"repo_name": "react-china/react-docs",
"id": "3c4a2153b8464e57eb65225ecd723dfab57abca4",
"size": "2124",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/docs/02.2-jsx-gotchas.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "32341"
},
{
"name": "JavaScript",
"bytes": "1567209"
},
{
"name": "PHP",
"bytes": "1628"
},
{
"name": "Ruby",
"bytes": "6141"
},
{
"name": "Shell",
"bytes": "284"
}
]
}
|
<?php
namespace App\Repositories;
use App\Models\Album;
use App\Models\Artist;
use App\Models\Playlist;
use App\Models\Song;
use App\Models\User;
use App\Repositories\Traits\Searchable;
use Illuminate\Contracts\Database\Query\Builder;
use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Support\Collection;
use Webmozart\Assert\Assert;
class SongRepository extends Repository
{
use Searchable;
public const SORT_COLUMNS_NORMALIZE_MAP = [
'title' => 'songs.title',
'track' => 'songs.track',
'length' => 'songs.length',
'disc' => 'songs.disc',
'artist_name' => 'artists.name',
'album_name' => 'albums.name',
];
private const VALID_SORT_COLUMNS = ['songs.title', 'songs.track', 'songs.length', 'artists.name', 'albums.name'];
private const DEFAULT_QUEUE_LIMIT = 500;
public function getOneByPath(string $path): ?Song
{
return Song::query()->where('path', $path)->first();
}
/** @return Collection|array<Song> */
public function getAllHostedOnS3(): Collection
{
return Song::query()->hostedOnS3()->get();
}
/** @return Collection|array<array-key, Song> */
public function getRecentlyAdded(int $count = 10, ?User $scopedUser = null): Collection
{
return Song::query()->withMeta($scopedUser ?? $this->auth->user())->latest()->limit($count)->get();
}
/** @return Collection|array<array-key, Song> */
public function getMostPlayed(int $count = 7, ?User $scopedUser = null): Collection
{
return Song::query()
->withMeta($scopedUser ?? $this->auth->user())
->where('interactions.play_count', '>', 0)
->orderByDesc('interactions.play_count')
->limit($count)
->get();
}
/** @return Collection|array<array-key, Song> */
public function getRecentlyPlayed(int $count = 7, ?User $scopedUser = null): Collection
{
return Song::query()
->withMeta($scopedUser ?? $this->auth->user())
->where('interactions.play_count', '>', 0)
->orderByDesc('interactions.updated_at')
->limit($count)
->get();
}
public function getForListing(
string $sortColumn,
string $sortDirection,
?User $scopedUser = null,
int $perPage = 50
): Paginator {
return self::applySort(
Song::query()->withMeta($scopedUser ?? $this->auth->user()),
$sortColumn,
$sortDirection
)
->simplePaginate($perPage);
}
/** @return Collection|array<array-key, Song> */
public function getForQueue(
string $sortColumn,
string $sortDirection,
int $limit = self::DEFAULT_QUEUE_LIMIT,
?User $scopedUser = null,
): Collection {
return self::applySort(
Song::query()->withMeta($scopedUser ?? $this->auth->user()),
$sortColumn,
$sortDirection
)
->limit($limit)
->get();
}
/** @return Collection|array<array-key, Song> */
public function getFavorites(?User $scopedUser = null): Collection
{
return Song::query()->withMeta($scopedUser ?? $this->auth->user())->where('interactions.liked', true)->get();
}
/** @return Collection|array<array-key, Song> */
public function getByAlbum(Album $album, ?User $scopedUser = null): Collection
{
return Song::query()
->withMeta($scopedUser ?? $this->auth->user())
->where('album_id', $album->id)
->orderBy('songs.track')
->orderBy('songs.disc')
->orderBy('songs.title')
->get();
}
/** @return Collection|array<array-key, Song> */
public function getByArtist(Artist $artist, ?User $scopedUser = null): Collection
{
return Song::query()
->withMeta($scopedUser ?? $this->auth->user())
->where('songs.artist_id', $artist->id)
->orderBy('albums.name')
->orderBy('songs.track')
->orderBy('songs.disc')
->orderBy('songs.title')
->get();
}
/** @return Collection|array<array-key, Song> */
public function getByStandardPlaylist(Playlist $playlist, ?User $scopedUser = null): Collection
{
return Song::query()
->withMeta($scopedUser ?? $this->auth->user())
->leftJoin('playlist_song', 'songs.id', '=', 'playlist_song.song_id')
->leftJoin('playlists', 'playlists.id', '=', 'playlist_song.playlist_id')
->where('playlists.id', $playlist->id)
->orderBy('songs.title')
->get();
}
/** @return Collection|array<array-key, Song> */
public function getRandom(int $limit, ?User $scopedUser = null): Collection
{
return Song::query()->withMeta($scopedUser ?? $this->auth->user())->inRandomOrder()->limit($limit)->get();
}
/** @return Collection|array<array-key, Song> */
public function getByIds(array $ids, ?User $scopedUser = null): Collection
{
return Song::query()->withMeta($scopedUser ?? $this->auth->user())->whereIn('songs.id', $ids)->get();
}
public function getOne($id, ?User $scopedUser = null): Song
{
return Song::query()->withMeta($scopedUser ?? $this->auth->user())->findOrFail($id);
}
public function count(): int
{
return Song::query()->count();
}
public function getTotalLength(): float
{
return Song::query()->sum('length');
}
private static function normalizeSortColumn(string $column): string
{
return key_exists($column, self::SORT_COLUMNS_NORMALIZE_MAP)
? self::SORT_COLUMNS_NORMALIZE_MAP[$column]
: $column;
}
private static function applySort(Builder $query, string $column, string $direction): Builder
{
$column = self::normalizeSortColumn($column);
Assert::oneOf($column, self::VALID_SORT_COLUMNS);
Assert::oneOf(strtolower($direction), ['asc', 'desc']);
$query->orderBy($column, $direction);
if ($column === 'artists.name') {
$query->orderBy('albums.name')
->orderBy('songs.track')
->orderBy('songs.disc')
->orderBy('songs.title');
} elseif ($column === 'albums.name') {
$query->orderBy('artists.name')
->orderBy('songs.track')
->orderBy('songs.disc')
->orderBy('songs.title');
} elseif ($column === 'track') {
$query->orderBy('songs.track')
->orderBy('song.disc');
}
return $query;
}
}
|
{
"content_hash": "d3e1c6e55ff87cfd24b8ab8103eaa1e1",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 117,
"avg_line_length": 33.03431372549019,
"alnum_prop": 0.5678884107434338,
"repo_name": "phanan/koel",
"id": "48ab7e33877783959bb32996ca1177d4927b70e3",
"size": "6739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Repositories/SongRepository.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "34018"
},
{
"name": "Dockerfile",
"bytes": "66"
},
{
"name": "HTML",
"bytes": "138693"
},
{
"name": "JavaScript",
"bytes": "223728"
},
{
"name": "PHP",
"bytes": "409269"
}
]
}
|
<div class="manage groups">
<div class="row hero-unit blurb">
<h2>What are groups?</h2>
<p>
Groups allow you to explicitly share private photos with others.
<br>
For example, say you have a photo marked as private but want <em>joe@example.com</em> see it.
<ol>
<li>Make sure <em>joe@example.com</em> belongs to a group</li>
<li>Mark the photo as private</li>
<li>Add the photo to a group <em>joe@example.com</em> is a member of</li>
</ol>
When Joe signs in he will be able to see the photo but others won't.
</p>
</div>
<?php echo $groupAddForm; ?>
<?php foreach($groups as $group) { ?>
<a name="group-<?php $this->utility->safe($group['id']); ?>"></a>
<form class="well group-post-submit" action="/group/<?php $this->utility->safe($group['id']); ?>/update">
<h3>Edit <?php $this->utility->safe($group['name']); ?></h3>
<label>Name</label>
<input type="text" name="name" value="<?php $this->utility->safe($group['name']); ?>">
<label>Add an email address</label>
<input type="text" class="group-email-input"> <a href="#" class="group-email-add-click">Add</a>
<ul class="group-emails-add-list unstyled">
<?php foreach($group['members'] as $member) { ?>
<li><span class="group-email-queue"><?php $this->utility->safe($member); ?></span> <a href="#" class="group-email-remove-click"><i class="group-email-remove-click icon-minus-sign"></i></a></li>
<?php } ?>
</ul>
<button class="btn"><i class="icon-save icon-large"></i> Save</button> <a class="group-delete-click" href="/group/<?php $this->utility->safe($group['id']); ?>/delete">Or delete</a>
</form>
<?php } ?>
</div>
|
{
"content_hash": "5f7fa8277dd335d01a44b5426562bdcc",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 203,
"avg_line_length": 48,
"alnum_prop": 0.5968468468468469,
"repo_name": "meatcar/frontend",
"id": "5dd11002e7f1daa5923be6534783ee652acbb269",
"size": "1776",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/templates/manage-groups.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "323052"
},
{
"name": "HTML",
"bytes": "3"
},
{
"name": "JavaScript",
"bytes": "1175371"
},
{
"name": "PHP",
"bytes": "955581"
},
{
"name": "Shell",
"bytes": "1249"
}
]
}
|
using UnityEngine;
/// @cond
namespace Gvr.Internal {
/// Factory that provides a concrete implementation of IHeadsetProvider for the
/// current platform.
static class HeadsetProviderFactory {
/// Provides a concrete implementation of IHeadsetProvider appropriate for the current
/// platform. This method never returns null. In the worst case, it might return a dummy
/// provider if the platform is not supported. For demo purposes the emulator controller
/// is returned in the editor and in Unity Standalone (desktop) builds, for use inside the
/// desktop player.
static internal IHeadsetProvider CreateProvider() {
// Use emualtor in editor, GVR SDK support on Android standalone headsets, and a
// dummy implementation otherwise..
#if UNITY_EDITOR
return new EditorHeadsetProvider();
#elif UNITY_ANDROID
// Use the GVR C API.
return new AndroidNativeHeadsetProvider();
#else
// Platform not supported.
Debug.LogWarning("No Google VR standalone headset / 6DOF support on " +
Application.platform + " platform.");
return new DummyHeadsetProvider();
#endif // UNITY_EDITOR || UNITY_STANDALONE
}
}
}
/// @endcond
|
{
"content_hash": "c33bce9cfe39f5af62c2244a585a5b22",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 94,
"avg_line_length": 38.774193548387096,
"alnum_prop": 0.718801996672213,
"repo_name": "swooby/fleet-viewer",
"id": "73e4d77ca45ebc28c2fba0382f00e9a02004a0e0",
"size": "1814",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Unity/Assets/GoogleVR/Scripts/Headset/Internal/HeadsetProviderFactory.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2141127"
},
{
"name": "GLSL",
"bytes": "3377"
},
{
"name": "HLSL",
"bytes": "8768"
},
{
"name": "HTML",
"bytes": "2740"
},
{
"name": "Objective-C",
"bytes": "3112"
},
{
"name": "Objective-C++",
"bytes": "16391"
},
{
"name": "Python",
"bytes": "28336"
},
{
"name": "ShaderLab",
"bytes": "232854"
},
{
"name": "Shell",
"bytes": "1485"
}
]
}
|
<?php
namespace Magento\Catalog\Model\Product\Option;
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface;
use Magento\Catalog\Model\Product\OptionFactory;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
/**
* Class ReadHandler
*/
class ReadHandler implements ExtensionInterface
{
/**
* @var ProductCustomOptionRepositoryInterface
*/
protected $optionRepository;
/**
* @param ProductCustomOptionRepositoryInterface $optionRepository
*/
public function __construct(
ProductCustomOptionRepositoryInterface $optionRepository
) {
$this->optionRepository = $optionRepository;
}
/**
* @param object $entity
* @param array $arguments
* @return \Magento\Catalog\Api\Data\ProductInterface|object
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function execute($entity, $arguments = [])
{
$options = [];
/** @var $entity \Magento\Catalog\Api\Data\ProductInterface */
foreach ($this->optionRepository->getProductOptions($entity) as $option) {
$option->setProduct($entity);
$options[] = $option;
}
$entity->setOptions($options);
return $entity;
}
}
|
{
"content_hash": "144a1df3aaf1f79000af5cce407e01fe",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 82,
"avg_line_length": 27.851063829787233,
"alnum_prop": 0.679144385026738,
"repo_name": "j-froehlich/magento2_wk",
"id": "b0c90484a1bee17ba89a6c2a659b12ae9eeb1b5e",
"size": "1417",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/magento/module-catalog/Model/Product/Option/ReadHandler.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "13636"
},
{
"name": "CSS",
"bytes": "2076720"
},
{
"name": "HTML",
"bytes": "6151072"
},
{
"name": "JavaScript",
"bytes": "2488727"
},
{
"name": "PHP",
"bytes": "12466046"
},
{
"name": "Shell",
"bytes": "6088"
},
{
"name": "XSLT",
"bytes": "19979"
}
]
}
|
package edu.psu.chemxseer.structure.util;
/**
* The major contribution of this class is to calculate the memory consuption
* difference
*
* @author dayuyuan
*
*/
public class MemoryConsumptionCal {
public static final long mega = 1024L * 1024L;
/**
* Memory measure method
*
* @throws Exception
*/
public static void runGC() {
// It helps to call Runtime.gc()
// using several method calls:
for (int r = 0; r < 10; ++r)
try {
_runGC();
} catch (Exception e) {
e.printStackTrace();
}
}
private static void _runGC() throws Exception {
long usedMem1 = usedMemory(), usedMem2 = Long.MAX_VALUE;
for (int i = 0; (usedMem1 < usedMem2) && (i < 500); ++i) {
s_runtime.runFinalization();
s_runtime.gc();
Thread.yield();
usedMem2 = usedMem1;
usedMem1 = usedMemory();
}
}
private static long usedMemory() {
return s_runtime.totalMemory() - s_runtime.freeMemory();
}
public static double usedMemoryinMB() {
return ((double) (s_runtime.totalMemory() - s_runtime.freeMemory()))
/ mega;
}
private static final Runtime s_runtime = Runtime.getRuntime();
/**
* Test results: Integer 4 byte, boolean 1 byte, char 2 byte An empty object
* 20; An array 20 byte, each entry 8 byte pointer The memory is located 8
* bytes per time For others still need test
*
* @param args
*/
public static void main(String[] args) {
MemoryConsumptionCal.runGC();
long before = MemoryConsumptionCal.usedMemory();
// long[] santa = new long[100];
MemoryConsumptionCal.runGC();
long after = MemoryConsumptionCal.usedMemory();
System.out.print(before + " " + after + " " + (after - before));
}
}
|
{
"content_hash": "23fbb5c0c702d446ca19d1c8f81f6638",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 77,
"avg_line_length": 24.558823529411764,
"alnum_prop": 0.6580838323353293,
"repo_name": "Santa827/Lindex",
"id": "407ba3dc261c0bb46f822d0efeb0148912b954c8",
"size": "1670",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/edu/psu/chemxseer/structure/util/MemoryConsumptionCal.java",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
import * as util from './a/b/util';
export var exportSingleVar = 'aa';
var b = util;
export { b };
function SomeDefault() {}
export default SomeDefault;
|
{
"content_hash": "8b1de8a173073f5e567463d10d65bdd1",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 35,
"avg_line_length": 19.25,
"alnum_prop": 0.6883116883116883,
"repo_name": "ka215/WP-Gentelella",
"id": "341a4e336fc4e053c37cc17ce0508509f2d595ed",
"size": "154",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendors/echarts/test/build/esm2cjs/expect/forbiden-export.expect.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "508597"
},
{
"name": "HTML",
"bytes": "1488478"
},
{
"name": "JavaScript",
"bytes": "230090"
},
{
"name": "PHP",
"bytes": "249609"
}
]
}
|
title: Living in a Diverse World
number: WMNST 105
academic-home: other
course-type: [Supporting, General Education]
pre-req:
description: Critical perspectives on the relationship between social difference and power, emphasizing gender, race, sexuality, class, and disability.
bulletin-link: http://bulletins.psu.edu/undergrad/courses/W/WMNST/105
pathway-list: [Media for Civic Engagement]
---
|
{
"content_hash": "963c6af81f67d5324a9d73e2cc61a204",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 151,
"avg_line_length": 43.77777777777778,
"alnum_prop": 0.8020304568527918,
"repo_name": "mmilutinovic1313/program-hub",
"id": "f7c6ed85f4fcd8f1f0239acca0f39728935707c4",
"size": "398",
"binary": false,
"copies": "2",
"ref": "refs/heads/gh-pages",
"path": "_courses/wmnst105.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "312103"
},
{
"name": "HTML",
"bytes": "85251"
},
{
"name": "JavaScript",
"bytes": "5318"
},
{
"name": "Ruby",
"bytes": "3093"
}
]
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "15022a6ba3dd5195ef69a01b2be828b8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "00148209f5d6f4c1d22c26d10418273b5b6aec09",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Cyperaceae/Kobresia/Kobresia royleana/Kobresia royleana himalaica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
var Lab = require('lab');
var lab = exports.lab = Lab.script();
var describe = lab.describe;
var it = lab.it;
var expect = Lab.expect;
var isString = require('../is-string');
var not = require('../not');
describe('not', function() {
it('should inverse a function (and work with array functions)', function (done) {
expect([true, 1, 'hey'].map(not(isString)))
.to.eql([true, true, false]);
done();
});
});
|
{
"content_hash": "820ff17436a2b34a0d7e7b38c38c8a7c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 83,
"avg_line_length": 25,
"alnum_prop": 0.6188235294117647,
"repo_name": "emilkje/101",
"id": "c0ff6b609e5c1e9f0f65828892b04365fea22fcc",
"size": "425",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/test-not.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "54063"
}
]
}
|
<?php
namespace Wlalele\PetShopBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
|
{
"content_hash": "f63f6469d53c96e2b553a52b9ea0836c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 90,
"avg_line_length": 23.764705882352942,
"alnum_prop": 0.6782178217821783,
"repo_name": "wlalele/formation_petshop",
"id": "4bd1e00ee8f2b447ba33f7c3da4148a7f83dd771",
"size": "404",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Wlalele/PetShopBundle/Tests/Controller/DefaultControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "45328"
}
]
}
|
.class synthetic Landroid/net/wifi/SupplicantStateTracker$1;
.super Ljava/lang/Object;
.source "SupplicantStateTracker.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroid/net/wifi/SupplicantStateTracker;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1008
name = null
.end annotation
# static fields
.field static final synthetic $SwitchMap$android$net$wifi$SupplicantState:[I
# direct methods
.method static constructor <clinit>()V
.locals 3
.prologue
.line 112
invoke-static {}, Landroid/net/wifi/SupplicantState;->values()[Landroid/net/wifi/SupplicantState;
move-result-object v0
array-length v0, v0
new-array v0, v0, [I
sput-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
:try_start_0
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->DISCONNECTED:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x1
aput v2, v0, v1
:try_end_0
.catch Ljava/lang/NoSuchFieldError; {:try_start_0 .. :try_end_0} :catch_c
:goto_0
:try_start_1
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->INTERFACE_DISABLED:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x2
aput v2, v0, v1
:try_end_1
.catch Ljava/lang/NoSuchFieldError; {:try_start_1 .. :try_end_1} :catch_b
:goto_1
:try_start_2
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->SCANNING:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x3
aput v2, v0, v1
:try_end_2
.catch Ljava/lang/NoSuchFieldError; {:try_start_2 .. :try_end_2} :catch_a
:goto_2
:try_start_3
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->AUTHENTICATING:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x4
aput v2, v0, v1
:try_end_3
.catch Ljava/lang/NoSuchFieldError; {:try_start_3 .. :try_end_3} :catch_9
:goto_3
:try_start_4
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->ASSOCIATING:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x5
aput v2, v0, v1
:try_end_4
.catch Ljava/lang/NoSuchFieldError; {:try_start_4 .. :try_end_4} :catch_8
:goto_4
:try_start_5
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->ASSOCIATED:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x6
aput v2, v0, v1
:try_end_5
.catch Ljava/lang/NoSuchFieldError; {:try_start_5 .. :try_end_5} :catch_7
:goto_5
:try_start_6
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->FOUR_WAY_HANDSHAKE:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/4 v2, 0x7
aput v2, v0, v1
:try_end_6
.catch Ljava/lang/NoSuchFieldError; {:try_start_6 .. :try_end_6} :catch_6
:goto_6
:try_start_7
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->GROUP_HANDSHAKE:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/16 v2, 0x8
aput v2, v0, v1
:try_end_7
.catch Ljava/lang/NoSuchFieldError; {:try_start_7 .. :try_end_7} :catch_5
:goto_7
:try_start_8
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->COMPLETED:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/16 v2, 0x9
aput v2, v0, v1
:try_end_8
.catch Ljava/lang/NoSuchFieldError; {:try_start_8 .. :try_end_8} :catch_4
:goto_8
:try_start_9
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->DORMANT:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/16 v2, 0xa
aput v2, v0, v1
:try_end_9
.catch Ljava/lang/NoSuchFieldError; {:try_start_9 .. :try_end_9} :catch_3
:goto_9
:try_start_a
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->INACTIVE:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/16 v2, 0xb
aput v2, v0, v1
:try_end_a
.catch Ljava/lang/NoSuchFieldError; {:try_start_a .. :try_end_a} :catch_2
:goto_a
:try_start_b
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->UNINITIALIZED:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/16 v2, 0xc
aput v2, v0, v1
:try_end_b
.catch Ljava/lang/NoSuchFieldError; {:try_start_b .. :try_end_b} :catch_1
:goto_b
:try_start_c
sget-object v0, Landroid/net/wifi/SupplicantStateTracker$1;->$SwitchMap$android$net$wifi$SupplicantState:[I
sget-object v1, Landroid/net/wifi/SupplicantState;->INVALID:Landroid/net/wifi/SupplicantState;
invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I
move-result v1
const/16 v2, 0xd
aput v2, v0, v1
:try_end_c
.catch Ljava/lang/NoSuchFieldError; {:try_start_c .. :try_end_c} :catch_0
:goto_c
return-void
:catch_0
move-exception v0
goto :goto_c
:catch_1
move-exception v0
goto :goto_b
:catch_2
move-exception v0
goto :goto_a
:catch_3
move-exception v0
goto :goto_9
:catch_4
move-exception v0
goto :goto_8
:catch_5
move-exception v0
goto :goto_7
:catch_6
move-exception v0
goto :goto_6
:catch_7
move-exception v0
goto :goto_5
:catch_8
move-exception v0
goto :goto_4
:catch_9
move-exception v0
goto :goto_3
:catch_a
move-exception v0
goto/16 :goto_2
:catch_b
move-exception v0
goto/16 :goto_1
:catch_c
move-exception v0
goto/16 :goto_0
.end method
|
{
"content_hash": "54b7f8b2edcf62c60411986b313c3254",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 111,
"avg_line_length": 24.2540192926045,
"alnum_prop": 0.683812806575633,
"repo_name": "baidurom/devices-g520",
"id": "d8f642fad66003c94899ae1511a465315873ba18",
"size": "7543",
"binary": false,
"copies": "2",
"ref": "refs/heads/coron-4.1",
"path": "vendor/aosp/framework.jar.out/smali/android/net/wifi/SupplicantStateTracker$1.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "12575"
},
{
"name": "Python",
"bytes": "1261"
},
{
"name": "Shell",
"bytes": "2159"
}
]
}
|
package org.jboss.shrinkwrap.resolver.api;
/**
* Represents a single coordinate; an address in a repository-based system which may point to an artifact. Systems may
* each have their own syntax for parsing the canonical {@link String} form of a {@link Coordinate}, or supply their own
* builders for programmatic creation.
*
* @author <a href="mailto:alr@jboss.org">Andrew Lee Rubinger</a>
*/
public interface Coordinate {
/**
* Returns the canonical form of this {@link Coordinate}
*
* @return the canonical form of this {@link Coordinate}
*/
String toCanonicalForm();
}
|
{
"content_hash": "b94bc7772e00edb4d0246d6e694916bf",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 120,
"avg_line_length": 30.5,
"alnum_prop": 0.7049180327868853,
"repo_name": "ALRubinger/resolver",
"id": "a997fdf7aa4da72c2906960337b8209895fa565e",
"size": "1394",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "api/src/main/java/org/jboss/shrinkwrap/resolver/api/Coordinate.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5271"
},
{
"name": "Java",
"bytes": "1339479"
},
{
"name": "Shell",
"bytes": "7272"
}
]
}
|
package org.apache.guacamole.auth.sqlserver.conf;
import org.apache.guacamole.properties.BooleanGuacamoleProperty;
import org.apache.guacamole.properties.EnumGuacamoleProperty;
import org.apache.guacamole.properties.IntegerGuacamoleProperty;
import org.apache.guacamole.properties.StringGuacamoleProperty;
/**
* Properties used by the SQLServer Authentication plugin.
*/
public class SQLServerGuacamoleProperties {
/**
* This class should not be instantiated.
*/
private SQLServerGuacamoleProperties() {}
/**
* The URL of the SQLServer server hosting the Guacamole authentication tables.
*/
public static final StringGuacamoleProperty SQLSERVER_HOSTNAME =
new StringGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-hostname"; }
};
/**
* The instance name of the SQL Server where the Guacamole database is running.
*/
public static final StringGuacamoleProperty SQLSERVER_INSTANCE =
new StringGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-instance"; }
};
/**
* The port of the SQLServer server hosting the Guacamole authentication
* tables.
*/
public static final IntegerGuacamoleProperty SQLSERVER_PORT =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-port"; }
};
/**
* The name of the SQLServer database containing the Guacamole
* authentication tables.
*/
public static final StringGuacamoleProperty SQLSERVER_DATABASE =
new StringGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-database"; }
};
/**
* The username used to authenticate to the SQLServer database containing
* the Guacamole authentication tables.
*/
public static final StringGuacamoleProperty SQLSERVER_USERNAME =
new StringGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-username"; }
};
/**
* The password used to authenticate to the SQLServer database containing
* the Guacamole authentication tables.
*/
public static final StringGuacamoleProperty SQLSERVER_PASSWORD =
new StringGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-password"; }
};
/**
* Whether a user account within the database is required for authentication
* to succeed, even if the user has been authenticated via another
* authentication provider.
*/
public static final BooleanGuacamoleProperty
SQLSERVER_USER_REQUIRED = new BooleanGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-user-required"; }
};
/**
* The maximum number of concurrent connections to allow overall. Zero
* denotes unlimited.
*/
public static final IntegerGuacamoleProperty
SQLSERVER_ABSOLUTE_MAX_CONNECTIONS =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-absolute-max-connections"; }
};
/**
* The maximum number of concurrent connections to allow to any one
* connection. Zero denotes unlimited.
*/
public static final IntegerGuacamoleProperty
SQLSERVER_DEFAULT_MAX_CONNECTIONS =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-default-max-connections"; }
};
/**
* The maximum number of concurrent connections to allow to any one
* connection group. Zero denotes unlimited.
*/
public static final IntegerGuacamoleProperty
SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-default-max-group-connections"; }
};
/**
* The maximum number of concurrent connections to allow to any one
* connection by an individual user. Zero denotes unlimited.
*/
public static final IntegerGuacamoleProperty
SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-default-max-connections-per-user"; }
};
/**
* The maximum number of concurrent connections to allow to any one
* connection group by an individual user. Zero denotes
* unlimited.
*/
public static final IntegerGuacamoleProperty
SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-default-max-group-connections-per-user"; }
};
/**
* Which TDS-compatible JDBC driver should be used for the connection.
*/
public static final EnumGuacamoleProperty<SQLServerDriver>
SQLSERVER_DRIVER = new EnumGuacamoleProperty<SQLServerDriver>(SQLServerDriver.class) {
@Override
public String getName() { return "sqlserver-driver"; }
};
/**
* Whether or not to automatically create accounts in the SQL Server
* database for users who successfully authenticate through another
* extension. By default users will not be automatically created.
*/
public static final BooleanGuacamoleProperty SQLSERVER_AUTO_CREATE_ACCOUNTS =
new BooleanGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-auto-create-accounts"; }
};
}
|
{
"content_hash": "9fe769ccce4090bdca822b5cdc47b687",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 98,
"avg_line_length": 29.746113989637305,
"alnum_prop": 0.6631248911339488,
"repo_name": "mike-jumper/incubator-guacamole-client",
"id": "df63c53e959488da3cb955125147090afc1f6b8b",
"size": "6548",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/conf/SQLServerGuacamoleProperties.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "112209"
},
{
"name": "HTML",
"bytes": "64819"
},
{
"name": "Java",
"bytes": "2156652"
},
{
"name": "JavaScript",
"bytes": "1352512"
},
{
"name": "PLSQL",
"bytes": "2094"
},
{
"name": "Roff",
"bytes": "2434"
},
{
"name": "SQLPL",
"bytes": "2374"
},
{
"name": "Shell",
"bytes": "20170"
}
]
}
|
<?php
class Kwc_Advanced_YoutubeWithPreviewImage_Image_Component extends Kwc_Abstract_Image_Component
{
public static function getSettings($param = null)
{
$ret = parent::getSettings($param);
$ret['dimensions'] = array(
'fullwidth'=>array(
'text' => trlKwfStatic('full width'),
'width' => self::CONTENT_WIDTH,
'height' => 0,
'cover' => true
),
);
return $ret;
}
}
|
{
"content_hash": "ba73bcf4bf49e54341015c81e8e4dfc2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 95,
"avg_line_length": 29.176470588235293,
"alnum_prop": 0.5161290322580645,
"repo_name": "koala-framework/koala-framework",
"id": "148d54b265bcb5852b5f8e3c737d1881fdfe4380",
"size": "496",
"binary": false,
"copies": "1",
"ref": "refs/heads/5.4",
"path": "Kwc/Advanced/YoutubeWithPreviewImage/Image/Component.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "49755"
},
{
"name": "JavaScript",
"bytes": "1120596"
},
{
"name": "PHP",
"bytes": "7076782"
},
{
"name": "SCSS",
"bytes": "92667"
},
{
"name": "Smarty",
"bytes": "229096"
},
{
"name": "Twig",
"bytes": "33150"
}
]
}
|
extern crate petgraph;
extern crate regex;
extern crate serde_json;
#[macro_use]
extern crate lazy_static;
extern crate bit_set;
extern crate either;
extern crate fixedbitset;
extern crate linear_map;
extern crate num;
extern crate typed_arena;
extern crate vec_map;
#[cfg(test)]
extern crate quickcheck;
#[cfg(feature = "trace_log")]
#[macro_use]
extern crate log;
#[cfg(feature = "trace_log")]
extern crate env_logger;
extern crate r2api;
extern crate r2pipe;
extern crate esil;
// extern crate capstone_rust;
extern crate rayon;
#[cfg(feature = "profile")]
extern crate cpuprofiler;
extern crate lalrpop_util;
#[macro_use]
pub mod utils;
#[macro_use]
pub mod middle;
#[macro_use]
pub mod analysis;
pub mod backend;
pub mod frontend;
|
{
"content_hash": "6768d2f6b793102ab22385e321e395fc",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 30,
"avg_line_length": 17.302325581395348,
"alnum_prop": 0.7446236559139785,
"repo_name": "some-username/radeco-lib",
"id": "df5484410ec279f554c4f7d3bfd79bde321e0d89",
"size": "2667",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib.rs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "73"
},
{
"name": "C",
"bytes": "2439"
},
{
"name": "Rust",
"bytes": "1116024"
},
{
"name": "Shell",
"bytes": "967"
}
]
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CSC.Common.Infrastructure.Utilities;
using CSC.CSClassroom.Model.Classrooms;
namespace CSC.CSClassroom.Service.Classrooms
{
/// <summary>
/// Ensures that a section is valid.
/// </summary>
public interface ISectionValidator
{
/// <summary>
/// Returns whether or not a section is valid.
/// </summary>
Task<bool> ValidateSectionAsync(
Section section,
IModelErrorCollection errors);
}
}
|
{
"content_hash": "26012b91d6f95a2f1e046025a65a27ae",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 48,
"avg_line_length": 23.318181818181817,
"alnum_prop": 0.7407407407407407,
"repo_name": "CSClassroom/CSClassroom",
"id": "a519e6935ddc751a2685f8d263d29c6eb5a01c83",
"size": "515",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Services/src/CSClassroom/CSClassroom.Service/Classrooms/ISectionValidator.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2197353"
},
{
"name": "CSS",
"bytes": "10480"
},
{
"name": "Dockerfile",
"bytes": "1181"
},
{
"name": "HCL",
"bytes": "753"
},
{
"name": "HTML",
"bytes": "266696"
},
{
"name": "Java",
"bytes": "66868"
},
{
"name": "JavaScript",
"bytes": "151533"
},
{
"name": "PowerShell",
"bytes": "8918"
},
{
"name": "Python",
"bytes": "26671"
},
{
"name": "Shell",
"bytes": "11432"
},
{
"name": "Smarty",
"bytes": "4599"
}
]
}
|
import numpy as np
import random
# First implement a gradient checker by filling in the following functions
def gradcheck_naive(f, x):
"""
Gradient check for a function f
- f should be a function that takes a single argument and outputs the cost and its gradients
- x is the point (numpy array) to check the gradient at
"""
rndstate = random.getstate()
random.setstate(rndstate)
fx, grad = f(x) # Evaluate function value at original point
h = 1e-4
# Iterate over all indexes in x
it = np.nditer(x, flags=['multi_index'], op_flags=['readwrite'])
while not it.finished:
ix = it.multi_index
### try modifying x[ix] with h defined above to compute numerical gradients
### make sure you call random.setstate(rndstate) before calling f(x) each time, this will make it
### possible to test cost functions with built in randomness later
### YOUR CODE HERE:
raise NotImplementedError
### END YOUR CODE
# Compare gradients
reldiff = abs(numgrad - grad[ix]) / max(1, abs(numgrad), abs(grad[ix]))
if reldiff > 1e-5:
print "Gradient check failed."
print "First gradient error found at index %s" % str(ix)
print "Your gradient: %f \t Numerical gradient: %f" % (grad[ix], numgrad)
return
it.iternext() # Step to next dimension
print "Gradient check passed!"
def sanity_check():
"""
Some basic sanity checks.
"""
quad = lambda x: (np.sum(x ** 2), x * 2)
print "Running sanity checks..."
gradcheck_naive(quad, np.array(123.456)) # scalar test
gradcheck_naive(quad, np.random.randn(3,)) # 1-D test
gradcheck_naive(quad, np.random.randn(4,5)) # 2-D test
print ""
def your_sanity_checks():
"""
Use this space add any additional sanity checks by running:
python q2_gradcheck.py
This function will not be called by the autograder, nor will
your additional tests be graded.
"""
print "Running your sanity checks..."
### YOUR CODE HERE
raise NotImplementedError
### END YOUR CODE
if __name__ == "__main__":
sanity_check()
your_sanity_checks()
|
{
"content_hash": "81d8497d88ff46ed4dd459b3a82a3f61",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 106,
"avg_line_length": 33.25373134328358,
"alnum_prop": 0.6270197486535009,
"repo_name": "jatinshah/stanford-cs224d",
"id": "d0c83d452c646508f2dfa952883101b18ce22467",
"size": "2228",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "assignment1/q2_gradcheck.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "108637"
},
{
"name": "Shell",
"bytes": "464"
}
]
}
|
package com.google.api.ads.dfp.jaxws.v201405;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
*
* A rate customization applied to geography targeting.
*
*
* <p>Java class for GeographyRateCardFeature complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="GeographyRateCardFeature">
* <complexContent>
* <extension base="{https://www.google.com/apis/ads/publisher/v201405}RateCardFeature">
* <sequence>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GeographyRateCardFeature")
public class GeographyRateCardFeature
extends RateCardFeature
{
}
|
{
"content_hash": "fa81ba3c32106392d7a4c6c8f86d6638",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 95,
"avg_line_length": 24.289473684210527,
"alnum_prop": 0.6988082340195017,
"repo_name": "nafae/developer",
"id": "fc8f197b2e6b21c18260e8d54698306ee552d2a8",
"size": "923",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201405/GeographyRateCardFeature.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "127846798"
},
{
"name": "Perl",
"bytes": "28418"
}
]
}
|
<?php
/**
* This file is part of the Loops framework.
*
* @author Lukas <lukas@loopsframework.com>
* @license https://raw.githubusercontent.com/loopsframework/base/master/LICENSE
* @link https://github.com/loopsframework/base
* @link https://loopsframework.com/
* @version 0.1
*/
namespace Loops\Annotations\Navigation;
/**
* @Annotation
* @Target({"CLASS"})
*/
class PageEntry {
/**
* @var string
*/
public $title;
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $filter;
/**
* @var string
*/
public $link;
/**
* @var string
*/
public $highlight;
/**
* @var integer
*/
public $order = 0;
}
|
{
"content_hash": "3e34c52552052d26041652046bfe8f45",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 80,
"avg_line_length": 15.25,
"alnum_prop": 0.5478142076502732,
"repo_name": "loopsframework/base",
"id": "f19d1fb0b3247775ca61ed634c3d95f49f80bd0e",
"size": "732",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Loops/Annotations/Navigation/PageEntry.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Nginx",
"bytes": "635"
},
{
"name": "PHP",
"bytes": "506860"
},
{
"name": "Shell",
"bytes": "178"
}
]
}
|
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#pragma once
#include <vector>
#include <map>
#include <sstream>
#include <string>
#include "ifcpp/model/GlobalDefines.h"
#include "ifcpp/model/BasicTypes.h"
#include "ifcpp/model/BuildingObject.h"
#include "IfcConstructionResourceType.h"
class IFCQUERY_EXPORT IfcConstructionMaterialResourceTypeEnum;
//ENTITY
class IFCQUERY_EXPORT IfcConstructionMaterialResourceType : public IfcConstructionResourceType
{
public:
IfcConstructionMaterialResourceType() = default;
IfcConstructionMaterialResourceType( int id );
~IfcConstructionMaterialResourceType() = default;
virtual shared_ptr<BuildingObject> getDeepCopy( BuildingCopyOptions& options );
virtual void getStepLine( std::stringstream& stream ) const;
virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const;
virtual void readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map );
virtual void setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self );
virtual size_t getNumAttributes() { return 12; }
virtual void getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const;
virtual void getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const;
virtual void unlinkFromInverseCounterparts();
virtual const char* className() const { return "IfcConstructionMaterialResourceType"; }
virtual const std::wstring toString() const;
// IfcRoot -----------------------------------------------------------
// attributes:
// shared_ptr<IfcGloballyUniqueId> m_GlobalId;
// shared_ptr<IfcOwnerHistory> m_OwnerHistory; //optional
// shared_ptr<IfcLabel> m_Name; //optional
// shared_ptr<IfcText> m_Description; //optional
// IfcObjectDefinition -----------------------------------------------------------
// inverse attributes:
// std::vector<weak_ptr<IfcRelAssigns> > m_HasAssignments_inverse;
// std::vector<weak_ptr<IfcRelNests> > m_Nests_inverse;
// std::vector<weak_ptr<IfcRelNests> > m_IsNestedBy_inverse;
// std::vector<weak_ptr<IfcRelDeclares> > m_HasContext_inverse;
// std::vector<weak_ptr<IfcRelAggregates> > m_IsDecomposedBy_inverse;
// std::vector<weak_ptr<IfcRelAggregates> > m_Decomposes_inverse;
// std::vector<weak_ptr<IfcRelAssociates> > m_HasAssociations_inverse;
// IfcTypeObject -----------------------------------------------------------
// attributes:
// shared_ptr<IfcIdentifier> m_ApplicableOccurrence; //optional
// std::vector<shared_ptr<IfcPropertySetDefinition> > m_HasPropertySets; //optional
// inverse attributes:
// std::vector<weak_ptr<IfcRelDefinesByType> > m_Types_inverse;
// IfcTypeResource -----------------------------------------------------------
// attributes:
// shared_ptr<IfcIdentifier> m_Identification; //optional
// shared_ptr<IfcText> m_LongDescription; //optional
// shared_ptr<IfcLabel> m_ResourceType; //optional
// inverse attributes:
// std::vector<weak_ptr<IfcRelAssignsToResource> > m_ResourceOf_inverse;
// IfcConstructionResourceType -----------------------------------------------------------
// attributes:
// std::vector<shared_ptr<IfcAppliedValue> > m_BaseCosts; //optional
// shared_ptr<IfcPhysicalQuantity> m_BaseQuantity; //optional
// IfcConstructionMaterialResourceType -----------------------------------------------------------
// attributes:
shared_ptr<IfcConstructionMaterialResourceTypeEnum> m_PredefinedType;
};
|
{
"content_hash": "e0e07f9860397c7a7ba97452b331838a",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 127,
"avg_line_length": 51.38356164383562,
"alnum_prop": 0.6539589442815249,
"repo_name": "berndhahnebach/IfcPlusPlus",
"id": "0227d297b1f4231dc20954fd0c93c3c2cbd4cc68",
"size": "3751",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "IfcPlusPlus/src/ifcpp/IFC4/include/IfcConstructionMaterialResourceType.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1370"
},
{
"name": "C",
"bytes": "4453"
},
{
"name": "C++",
"bytes": "11543025"
},
{
"name": "CMake",
"bytes": "12189"
},
{
"name": "CSS",
"bytes": "4880"
},
{
"name": "Makefile",
"bytes": "2305"
},
{
"name": "Objective-C",
"bytes": "92"
}
]
}
|
define(function(require, exports, module) {
var Validator = require('bootstrap.validator');
require('common/validator-rules').inject(Validator);
require('jquery.sortable');
var Notify = require('common/bootstrap-notify');
var WebUploader = require('edusoho.webuploader');
exports.run = function() {
$(".buy-userinfo-list").sortable({
'distance': 20
});
if ($("[name=buy_fill_userinfo]:checked").val() == 1) $("#buy-userinfo-list").hide();
if ($("[name=buy_fill_userinfo]:checked").val() == 0) {
$("#buy-userinfo-list").hide();
$("#show-list").hide();
}
$("[name=buy_fill_userinfo]").on("click", function() {
if ($("[name=buy_fill_userinfo]:checked").val() == 1) {
$("#show_course_chapter_name").show()
}else{
$("#show_course_chapter_name").hide();
}
});
$("#hide-list-btn").on("click", function() {
$("#buy-userinfo-list").hide();
$("#show-list").show();
});
$("#show-list-btn").on("click", function() {
$("#buy-userinfo-list").show();
$("#show-list").hide();
});
var initChapterStatus = function(use_chapter_name){
if(use_chapter_name ==1){
$("#show_course_chapter_name").show();
}else{
$("#show_course_chapter_name").hide();
}
}
var $form = $("#course-form");
if($('#live-course-logo-upload').length>0) {
var uploader = new WebUploader({
element: '#live-course-logo-upload'
});
uploader.on('uploadSuccess', function(file, response ) {
var url = $("#live-course-logo-upload").data("gotoUrl");
$("#live-course-logo-container").html('<img src="' + response.url + '">');
$form.find('[name=live_logo]').val(response.url);
$("#live-course-logo-remove").show();
Notify.success(Translator.trans('上传直播课程的LOGO成功!'));
});
$("#live-course-logo-remove").on('click', function(){
if (!confirm(Translator.trans('确认要删除吗?'))) return false;
var $btn = $(this);
$.post($btn.data('url'), function(){
$("#live-course-logo-container").html('');
$form.find('[name=live_logo]').val('');
$btn.hide();
Notify.success(Translator.trans('删除直播课程LOGO成功!'));
}).error(function(){
Notify.danger(Translator.trans('删除直播课程LOGO失败!'));
});
});
}
};
});
|
{
"content_hash": "469e2cf1cac186a743202ca664d97c32",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 93,
"avg_line_length": 35.12658227848101,
"alnum_prop": 0.46846846846846846,
"repo_name": "richtermark/SMEAGOnline",
"id": "49ae220eca0218a6c4173c9c319283136f9e761d",
"size": "2845",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "web/bundles/topxiaadmin/js/controller/setting/course.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "2648"
},
{
"name": "CSS",
"bytes": "23380163"
},
{
"name": "CoffeeScript",
"bytes": "83631"
},
{
"name": "HTML",
"bytes": "4844559"
},
{
"name": "JavaScript",
"bytes": "31547974"
},
{
"name": "PHP",
"bytes": "22662089"
},
{
"name": "PLSQL",
"bytes": "7483"
},
{
"name": "Shell",
"bytes": "8793"
},
{
"name": "Smarty",
"bytes": "12"
}
]
}
|
package example_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
tubclient "github.com/cppforlife/turbulence/client"
tubinc "github.com/cppforlife/turbulence/incident"
tubsel "github.com/cppforlife/turbulence/incident/selector"
tubtasks "github.com/cppforlife/turbulence/tasks"
)
var _ = Describe("Kill", func() {
var (
client tubclient.Turbulence
)
BeforeEach(func() {
logger := boshlog.NewLogger(boshlog.LevelNone)
config := tubclient.NewConfigFromEnv()
client = tubclient.NewFactory(logger).New(config)
})
It("kills dummy deployment's z1", func() {
req := tubinc.Request{
Tasks: tubtasks.OptionsSlice{
tubtasks.KillOptions{},
},
Selector: tubsel.Request{
Deployment: &tubsel.NameRequest{Name: "dummy"},
AZ: &tubsel.NameRequest{
Name: "z1",
},
},
}
{ // Check that kill kills all z1 instances
inc := client.CreateIncident(req)
inc.Wait()
Expect(inc.HasTaskErrors()).To(BeFalse())
tasks := inc.TasksOfType(tubtasks.KillOptions{})
Expect(tasks).To(HaveLen(4))
for _, t := range tasks {
Expect(t.Instance().AZ).To(Equal("z1"))
}
}
})
})
|
{
"content_hash": "b77197e8badbca40fa9cd265f79f0589",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 60,
"avg_line_length": 22.314814814814813,
"alnum_prop": 0.6813278008298755,
"repo_name": "cppforlife/turbulence-release",
"id": "8728ef643b3de5f99daef4587748fee422e3ee53",
"size": "1205",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/github.com/cppforlife/turbulence-example-test/kill_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1724"
},
{
"name": "Go",
"bytes": "5639970"
},
{
"name": "HTML",
"bytes": "1647"
},
{
"name": "Makefile",
"bytes": "21733"
},
{
"name": "PowerShell",
"bytes": "843"
},
{
"name": "Protocol Buffer",
"bytes": "89576"
},
{
"name": "Ruby",
"bytes": "2810"
},
{
"name": "Shell",
"bytes": "29336"
}
]
}
|
#pragma once
#include <aws/waf/WAF_EXPORTS.h>
#include <aws/waf/WAFRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace WAF
{
namespace Model
{
/**
*/
class AWS_WAF_API ListRuleGroupsRequest : public WAFRequest
{
public:
ListRuleGroupsRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "ListRuleGroups"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline const Aws::String& GetNextMarker() const{ return m_nextMarker; }
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline bool NextMarkerHasBeenSet() const { return m_nextMarkerHasBeenSet; }
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline void SetNextMarker(const Aws::String& value) { m_nextMarkerHasBeenSet = true; m_nextMarker = value; }
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline void SetNextMarker(Aws::String&& value) { m_nextMarkerHasBeenSet = true; m_nextMarker = std::move(value); }
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline void SetNextMarker(const char* value) { m_nextMarkerHasBeenSet = true; m_nextMarker.assign(value); }
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline ListRuleGroupsRequest& WithNextMarker(const Aws::String& value) { SetNextMarker(value); return *this;}
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline ListRuleGroupsRequest& WithNextMarker(Aws::String&& value) { SetNextMarker(std::move(value)); return *this;}
/**
* <p>If you specify a value for <code>Limit</code> and you have more
* <code>RuleGroups</code> than the value of <code>Limit</code>, AWS WAF returns a
* <code>NextMarker</code> value in the response that allows you to list another
* group of <code>RuleGroups</code>. For the second and subsequent
* <code>ListRuleGroups</code> requests, specify the value of
* <code>NextMarker</code> from the previous response to get information about
* another batch of <code>RuleGroups</code>.</p>
*/
inline ListRuleGroupsRequest& WithNextMarker(const char* value) { SetNextMarker(value); return *this;}
/**
* <p>Specifies the number of <code>RuleGroups</code> that you want AWS WAF to
* return for this request. If you have more <code>RuleGroups</code> than the
* number that you specify for <code>Limit</code>, the response includes a
* <code>NextMarker</code> value that you can use to get another batch of
* <code>RuleGroups</code>.</p>
*/
inline int GetLimit() const{ return m_limit; }
/**
* <p>Specifies the number of <code>RuleGroups</code> that you want AWS WAF to
* return for this request. If you have more <code>RuleGroups</code> than the
* number that you specify for <code>Limit</code>, the response includes a
* <code>NextMarker</code> value that you can use to get another batch of
* <code>RuleGroups</code>.</p>
*/
inline bool LimitHasBeenSet() const { return m_limitHasBeenSet; }
/**
* <p>Specifies the number of <code>RuleGroups</code> that you want AWS WAF to
* return for this request. If you have more <code>RuleGroups</code> than the
* number that you specify for <code>Limit</code>, the response includes a
* <code>NextMarker</code> value that you can use to get another batch of
* <code>RuleGroups</code>.</p>
*/
inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; }
/**
* <p>Specifies the number of <code>RuleGroups</code> that you want AWS WAF to
* return for this request. If you have more <code>RuleGroups</code> than the
* number that you specify for <code>Limit</code>, the response includes a
* <code>NextMarker</code> value that you can use to get another batch of
* <code>RuleGroups</code>.</p>
*/
inline ListRuleGroupsRequest& WithLimit(int value) { SetLimit(value); return *this;}
private:
Aws::String m_nextMarker;
bool m_nextMarkerHasBeenSet;
int m_limit;
bool m_limitHasBeenSet;
};
} // namespace Model
} // namespace WAF
} // namespace Aws
|
{
"content_hash": "9c77663556a253be52248bd003492007",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 119,
"avg_line_length": 47.11764705882353,
"alnum_prop": 0.6867665418227216,
"repo_name": "jt70471/aws-sdk-cpp",
"id": "4c7c3b190d68e4d1d84d0397cd1fb69653f2aa5e",
"size": "8129",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-waf/include/aws/waf/model/ListRuleGroupsRequest.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13452"
},
{
"name": "C++",
"bytes": "278594037"
},
{
"name": "CMake",
"bytes": "653931"
},
{
"name": "Dockerfile",
"bytes": "5555"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "302182"
},
{
"name": "Python",
"bytes": "110380"
},
{
"name": "Shell",
"bytes": "4674"
}
]
}
|
//
// ========================================================================
// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.policy.entry;
import java.lang.reflect.Constructor;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.Permission;
import java.security.cert.Certificate;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import org.eclipse.jetty.policy.PolicyContext;
import org.eclipse.jetty.policy.PolicyException;
public class PermissionEntry extends AbstractEntry
{
/**
* The classname part of permission clause.
*/
private String klass;
/**
* The name part of permission clause.
*/
private String name;
/**
* The actions part of permission clause.
*/
private String actions;
/**
* The signers part of permission clause. This is a comma-separated list of certificate aliases.
*/
private String signers;
private Certificate[] signerArray;
public Permission toPermission() throws PolicyException
{
try
{
Class<?> clazz = Class.forName(klass);
if ( signerArray != null && !validate( signerArray, (Certificate[])clazz.getSigners() ) )
{
throw new PolicyException( "Unvalidated Permissions: " + klass + "/" + name );
}
Permission permission = null;
if ( name == null && actions == null )
{
permission = (Permission) clazz.newInstance();
}
else if ( name != null && actions == null )
{
Constructor<?> c = clazz.getConstructor(new Class[]
{ String.class });
permission = (Permission) c.newInstance( name );
}
else if ( name != null && actions != null )
{
Constructor<?> c = clazz.getConstructor(new Class[]
{ String.class, String.class });
permission = (Permission) c.newInstance( name, actions );
}
return permission;
}
catch ( Exception e )
{
throw new PolicyException( e );
}
}
@Override
public void expand( PolicyContext context ) throws PolicyException
{
if ( name != null )
{
name = context.evaluate( name ).trim();
}
if ( actions != null )
{
actions = context.evaluate( actions ).trim();
}
if ( signers != null )
{
signerArray = resolveCertificates( context.getKeystore(), signers );
}
setExpanded( true );
}
/**
* validate that all permission certs are present in the class certs
*
* @param permCerts
* @param classCerts
* @return true if the permissions match up
*/
private static boolean validate( Certificate[] permCerts, Certificate[] classCerts )
{
if ( classCerts == null )
{
return false;
}
for ( int i = 0; i < permCerts.length; ++i )
{
boolean found = false;
for ( int j = 0; j < classCerts.length; ++j )
{
if ( permCerts[i].equals( classCerts[j] ) )
{
found = true;
break;
}
}
// if we didn't find the permCert in the classCerts then we don't match up
if ( found == false )
{
return false;
}
}
// we found all the permCerts in classCerts so return true
return true;
}
private static Certificate[] resolveCertificates( KeyStore keyStore, String signers ) throws PolicyException
{
if ( keyStore == null )
{
Certificate[] certs = null;
return certs;
}
Set<Certificate> certificateSet = new HashSet<Certificate>();
StringTokenizer strTok = new StringTokenizer( signers, ",");
for ( int i = 0; strTok.hasMoreTokens(); ++i )
{
try
{
Certificate certificate = keyStore.getCertificate( strTok.nextToken().trim() );
if ( certificate != null )
{
certificateSet.add( certificate );
}
}
catch ( KeyStoreException kse )
{
throw new PolicyException( kse );
}
}
return certificateSet.toArray( new Certificate[certificateSet.size()]);
}
public String getKlass()
{
return klass;
}
public void setKlass( String klass )
{
this.klass = klass;
}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public String getActions()
{
return actions;
}
public void setActions( String actions )
{
this.actions = actions;
}
public String getSigners()
{
return signers;
}
public void setSigners( String signers )
{
this.signers = signers;
}
}
|
{
"content_hash": "5757a93e8dd554af95d68a8aa7790d69",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 112,
"avg_line_length": 27.261061946902654,
"alnum_prop": 0.5059243629280961,
"repo_name": "xmpace/jetty-read",
"id": "5fefe9dbb3eea0b8f71fc94a8cd44844233e4df9",
"size": "6161",
"binary": false,
"copies": "1",
"ref": "refs/heads/xiaomi-read",
"path": "jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PermissionEntry.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "398"
},
{
"name": "HTML",
"bytes": "47647"
},
{
"name": "Java",
"bytes": "10544935"
},
{
"name": "JavaScript",
"bytes": "77396"
},
{
"name": "Shell",
"bytes": "33886"
}
]
}
|
package com.tinkerpop.gremlin.process.computer;
import org.javatuples.Pair;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* The Memory of a {@link GraphComputer} is a global data structure where by vertices can communicate information with one another.
* Moreover, it also contains global information about the state of the computation such as runtime and the current iteration.
* The Memory data is logically updated in parallel using associative/commutative methods which have embarrassingly parallel implementations.
*
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public interface Memory {
/**
* Whether the key exists in the memory.
*
* @param key key to search the memory for.
* @return whether the key exists
*/
public default boolean exists(final String key) {
return this.keys().contains(key);
}
/**
* The set of keys currently associated with this memory.
*
* @return the memory's key set.
*/
public Set<String> keys();
/**
* Get the value associated with the provided key.
*
* @param key the key of the value
* @param <R> the type of the value
* @return the value
* @throws IllegalArgumentException is thrown if the key does not exist
*/
public <R> R get(final String key) throws IllegalArgumentException;
/**
* Set the value of the provided key. This is typically called in setup() and/or terminate() of the {@link VertexProgram}.
* If this is called during execute(), there is no guarantee as to the ultimately stored value as call order is indeterminate.
*
* @param key they key to set a value for
* @param value the value to set for the key
*/
public void set(final String key, Object value);
/**
* A helper method that generates a {@link Map} of the memory key/values.
*
* @return the map representation of the memory key/values
*/
public default Map<String, Object> asMap() {
final Map<String, Object> map = keys().stream()
.filter(this::exists)
.map(key -> Pair.with(key, get(key)))
.collect(Collectors.toMap(kv -> kv.getValue0(), Pair::getValue1));
return Collections.unmodifiableMap(map);
}
/**
* Get the current iteration number.
*
* @return the current iteration
*/
public int getIteration();
/**
* Get the amount of milliseconds the {@link GraphComputer} has been executing thus far.
*
* @return the total time in milliseconds
*/
public long getRuntime();
/**
* Add the provided delta value to the long value currently stored at the key.
*
* @param key the key of the long value
* @param delta the adjusting amount (can be negative for decrement)
* @return the adjusted value (according to the previous iterations current value + delta)
*/
public long incr(final String key, final long delta);
/**
* Logically AND the provided boolean value with the boolean value currently stored at the key.
*
* @param key the key of the boolean value
* @param bool the boolean to AND
* @return the adjusted value (according to the previous iterations current value && bool)
*/
public boolean and(final String key, final boolean bool);
/**
* Logically OR the provided boolean value with the boolean value currently stored at the key.
*
* @param key the key of the boolean value
* @param bool the boolean to OR
* @return the adjusted value (according to the previous iterations current value || bool)
*/
public boolean or(final String key, final boolean bool);
/**
* A helper method that states whether the current iteration is 0.
*
* @return whether this is the first iteration
*/
public default boolean isInitialIteration() {
return this.getIteration() == 0;
}
/**
* The Admin interface is used by the {@link GraphComputer} to update the Memory.
* The developer should never need to type-cast the provided Memory to Memory.Admin.
*/
public interface Admin extends Memory {
public void incrIteration();
public void setRuntime(final long runtime);
}
public static class Exceptions {
public static IllegalArgumentException memoryKeyCanNotBeEmpty() {
return new IllegalArgumentException("Graph computer memory key can not be the empty string");
}
public static IllegalArgumentException memoryKeyCanNotBeNull() {
return new IllegalArgumentException("Graph computer memory key can not be null");
}
public static IllegalArgumentException memoryValueCanNotBeNull() {
return new IllegalArgumentException("Graph computer memory value can not be null");
}
public static IllegalStateException memoryCompleteAndImmutable() {
return new IllegalStateException("Graph computer memory is complete and immutable");
}
public static IllegalArgumentException memoryDoesNotExist(final String key) {
return new IllegalArgumentException("The memory does not have a value for provided key: " + key);
}
public static UnsupportedOperationException dataTypeOfMemoryValueNotSupported(final Object val) {
return new UnsupportedOperationException(String.format("Graph computer memory value [%s] is of type %s is not supported", val, val.getClass()));
}
}
}
|
{
"content_hash": "dbdd92cd4ecf01357045decb890323a8",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 156,
"avg_line_length": 35.88535031847134,
"alnum_prop": 0.6696840610578629,
"repo_name": "mpollmeier/tinkerpop3",
"id": "c3206910987b3a5e34c656d6dce0adc3d713ec74",
"size": "5634",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/Memory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "478951"
},
{
"name": "Groovy",
"bytes": "184634"
},
{
"name": "Java",
"bytes": "3206838"
},
{
"name": "Scala",
"bytes": "2470"
},
{
"name": "Shell",
"bytes": "6846"
}
]
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace System.Configuration
{
/// <summary>
/// Indicates the SpecialSetting for a group of/individual settings.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
public sealed class SpecialSettingAttribute : Attribute
{
private readonly SpecialSetting _specialSetting;
public SpecialSettingAttribute(SpecialSetting specialSetting)
{
_specialSetting = specialSetting;
}
/// <summary>
/// SpecialSetting value to use
/// </summary>
public SpecialSetting SpecialSetting
{
get
{
return _specialSetting;
}
}
}
}
|
{
"content_hash": "1997ef5442578d9d0788cc4c22cc05d9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 28.454545454545453,
"alnum_prop": 0.6336528221512248,
"repo_name": "ptoonen/corefx",
"id": "97f3bb84e2bcc97bfe519347651d8be23d9ebb2f",
"size": "941",
"binary": false,
"copies": "87",
"ref": "refs/heads/master",
"path": "src/System.Configuration.ConfigurationManager/src/System/Configuration/SpecialSettingAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "903"
},
{
"name": "ASP",
"bytes": "1687"
},
{
"name": "Batchfile",
"bytes": "23817"
},
{
"name": "C",
"bytes": "1113487"
},
{
"name": "C#",
"bytes": "132263251"
},
{
"name": "C++",
"bytes": "710534"
},
{
"name": "CMake",
"bytes": "62807"
},
{
"name": "DIGITAL Command Language",
"bytes": "26402"
},
{
"name": "Groovy",
"bytes": "34573"
},
{
"name": "HTML",
"bytes": "653"
},
{
"name": "Makefile",
"bytes": "9085"
},
{
"name": "Objective-C",
"bytes": "9948"
},
{
"name": "OpenEdge ABL",
"bytes": "139178"
},
{
"name": "Perl",
"bytes": "3895"
},
{
"name": "PowerShell",
"bytes": "42677"
},
{
"name": "Python",
"bytes": "1535"
},
{
"name": "Roff",
"bytes": "4236"
},
{
"name": "Shell",
"bytes": "71283"
},
{
"name": "Visual Basic",
"bytes": "827869"
},
{
"name": "XSLT",
"bytes": "462336"
}
]
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_55) on Fri Jun 20 06:34:21 EDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.solr.update.DocumentBuilder (Solr 4.9.0 API)</title>
<meta name="date" content="2014-06-20">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.solr.update.DocumentBuilder (Solr 4.9.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/solr/update/DocumentBuilder.html" title="class in org.apache.solr.update">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/solr/update/class-use/DocumentBuilder.html" target="_top">Frames</a></li>
<li><a href="DocumentBuilder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.solr.update.DocumentBuilder" class="title">Uses of Class<br>org.apache.solr.update.DocumentBuilder</h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.update.DocumentBuilder</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/solr/update/DocumentBuilder.html" title="class in org.apache.solr.update">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/solr/update/class-use/DocumentBuilder.html" target="_top">Frames</a></li>
<li><a href="DocumentBuilder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
|
{
"content_hash": "69f4322845305cedfe0d62a773b4c551",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 139,
"avg_line_length": 37.404580152671755,
"alnum_prop": 0.58,
"repo_name": "knittledan/Location_Search_Prediction",
"id": "13212433ba34210f26197c9de371adcff0ed3fb2",
"size": "4900",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "thirdParty/solrSrc/docs/solr-core/org/apache/solr/update/class-use/DocumentBuilder.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "116630"
},
{
"name": "CSS",
"bytes": "549642"
},
{
"name": "JavaScript",
"bytes": "2980664"
},
{
"name": "Perl",
"bytes": "3024"
},
{
"name": "Python",
"bytes": "2551419"
},
{
"name": "Shell",
"bytes": "20806"
},
{
"name": "XSLT",
"bytes": "739855"
}
]
}
|
using namespace sinxml;
int main()
{
Document document("1.0");
Element* root = new Element("map", "schmap");
document.Set_root(root);
Element* platform = new Element("platform", "boom");
root->Add_child(platform);
Element* x = new Element("x", "10");
platform->Add_child(x);
x->Set_attribute("foo", "baha");
x->Set_attribute("att", "23");
std::cout<<x->Get_attribute("att")<<std::endl;
document.Save_file("test.xml");
document.Load_file("test.xml");
document.Save_file("test_copy.xml");
Element* parent = document.Get_root();
Children& children = parent->Get_children();
for(Children::iterator i = children.begin(); i != children.end(); ++i)
{
std::cout<<(*i)->Get_name()<<" = "<<(*i)->Get_value()<<std::endl;
std::cout<<(*i)->Get_child("x")->Get_value()<<std::endl;
std::cout<<(*i)->Get_child("x")->Get_attribute("att")<<std::endl;
}
parent->Get_child("x");
return 0;
}
|
{
"content_hash": "3471528ca1fc1db8f3caebe15c5a9ad1",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 71,
"avg_line_length": 26.705882352941178,
"alnum_prop": 0.6178414096916299,
"repo_name": "trezker/sinxml",
"id": "30235062b22edf195dde5a4523f2b2d02a5442ef",
"size": "956",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/test.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1716"
},
{
"name": "C++",
"bytes": "5039"
},
{
"name": "Lua",
"bytes": "1435"
}
]
}
|
<ruleset
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PHP.Skeleton rule set</description>
<!--codesize-->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
<rule ref="rulesets/codesize.xml/NPathComplexity" />
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
<rule ref="rulesets/codesize.xml/ExcessivePublicCount" />
<rule ref="rulesets/codesize.xml/TooManyFields" />
<rule ref="rulesets/codesize.xml/TooManyMethods" />
<!--design-->
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/NumberOfChildren" />
<rule ref="rulesets/design.xml/DepthOfInheritance" />
<rule ref="rulesets/design.xml/CouplingBetweenObjects" />
<!--naming-->
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
<rule ref="rulesets/naming.xml/BooleanGetMethodName" />
<!--unusedcode-->
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
<!--controversial-->
<rule ref="rulesets/controversial.xml/Superglobals" />
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />
<!--cleancode-->
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
<rule ref="rulesets/cleancode.xml/ElseExpression" />
</ruleset>
|
{
"content_hash": "7f7c4c3c50a0e850c2ba63296a438ff0",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 102,
"avg_line_length": 54.07142857142857,
"alnum_prop": 0.7111404667547336,
"repo_name": "koriym/Ray.AuraSqlModule",
"id": "bd342f1e30a2bc55631bd15c62062cfc5cf6a630",
"size": "2271",
"binary": false,
"copies": "3",
"ref": "refs/heads/1.x",
"path": "phpmd.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "103992"
}
]
}
|
var jsconsole = (function (window) {
// Key-code library
var keylib={left:37,up:38,right:39,down:40,space:32,
alt:18,ctrl:17,shift:16,tab:9,enter:13,webkitEnter:10,
escape:27,backspace:8,
zero:48,one:49, two:50,three:51,four:52,
five:53,six:57,seven:58,eight:59,nine:60,
a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,
l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,
w:87,x:88,y:89,z:90};
function cleanse(s) {
return (s||'').replace(/[<&]/g, function (m) { return {'&':'&','<':'<'}[m];});
}
var historyPosition = -1;
/**
* Run a console command.
*/
var run = function (cmd, cb) {
var internalCmd = internalCommand(cmd);
if (internalCmd) {
return cb(['info', internalCmd]);
}
$document.trigger('console:run', cmd);
};
/**
* Run and show response to a command fired from the console
*/
var post = function (cmd, blind, response) {
var toecho = '';
if (typeof cmd !== 'string') {
toecho = cmd.echo;
blind = cmd.blind;
response = cmd.response;
cmd = cmd.cmd;
} else {
toecho = cmd;
}
cmd = trim(cmd);
// Add the command to the user's history – unless this was blind
if (!blind) {
history.push(cmd.trim());
setHistory(history);
}
// Show the user what they typed
echo(toecho.trim());
// If we were handed a response, show the response straight away – otherwise
// runs it
if (response) return showResponse(response);
run(cmd, showResponse);
setCursorTo('');
};
/**
* Display the result of a command to the user
*/
var showResponse = function (response) {
// order so it appears at the top
var el = document.createElement('div'),
li = document.createElement('li'),
span = document.createElement('span'),
parent = output.parentNode;
historyPosition = history.length;
if (typeof response === 'undefined') return;
el.className = 'response';
span.innerHTML = response[1];
if (response[0] != 'info') prettyPrint([span]);
el.appendChild(span);
li.className = response[0];
li.innerHTML = '<span class="gutter"></span>';
li.appendChild(el);
appendLog(li);
exec.value = '';
if (enableCC) {
try {
if (jsbin.panels && jsbin.panels.focused.id === 'console') {
if (!jsbin.embed) {
getCursor().focus();
}
document.execCommand('selectAll', false, null);
document.execCommand('delete', false, null);
}
} catch (e) {}
}
};
function log(msg, className) {
var li = document.createElement('li'),
div = document.createElement('div');
div.innerHTML = msg;
prettyPrint([div]);
li.className = className || 'log';
li.innerHTML = '<span class="gutter"></span>';
li.appendChild(div);
appendLog(li);
}
function echo(cmd) {
var li = document.createElement('li');
li.className = 'echo';
li.innerHTML = '<span class="gutter"></span><div>' + cleanse(cmd) + '</div>';
logAfter = null;
// logAfter = $(output).find('li.echo:first')[0] || null;
// logAfter = output.querySelector('li.echo') || null;
appendLog(li, true);
}
window.info = function(cmd) {
var li = document.createElement('li');
li.className = 'info';
li.innerHTML = '<span class="gutter"></span><div>' + cleanse(cmd) + '</div>';
// logAfter = output.querySelector('li.echo') || null;
// appendLog(li, true);
appendLog(li);
};
function appendLog(el, echo) {
output.appendChild(el);
output.parentNode.scrollTop = output.parentNode.scrollHeight + 1000;
return;
if (echo) {
if (!output.firstChild) {
output.appendChild(el);
} else {
output.insertBefore(el, output.firstChild);
}
} else {
if (!output.lastChild) {
output.appendChild(el);
} else {
// console.log(output.lastChild.nextSibling);
output.insertBefore(el, logAfter ? logAfter : output.lastChild.nextSibling); // ? output.lastChild.nextSibling : output.firstChild
}
}
}
function internalCommand(cmd) {
var parts = [], c;
if (cmd.substr(0, 1) == ':') {
parts = cmd.substr(1).split(' ');
c = parts.shift();
return (commands[c] || noop).apply(this, parts);
}
}
function noop() {}
function showhelp() {
var commands = [
':reset - destroy state and start afresh',
':history - list current session history',
':load <url> - to inject new DOM',
':load <script_url> - to inject external library',
' load also supports following shortcuts: <br /> jquery, underscore, prototype, mootools, dojo, rightjs, coffeescript, yui.<br /> eg. :load jquery',
':clear - to clear contents of the console',
':about jsconsole'
];
return commands.join('\n');
}
/**
* Handle loading scripts and DOM into dynamic iframe with event listeners
*/
var load = (function () {
$document.on('console:load:script:error', function (event, err) {
showResponse(['error', err]);
});
$document.on('console:load:script:success', function (event, url) {
showResponse(['response', 'Loaded "' + url + '"']);
});
$document.on('console:load:dom:error', function (event, err) {
showResponse(['error', err]);
});
$document.on('console:load:dom:success', function (event, url) {
showResponse(['response', 'Loaded DOM.']);
});
return function (url) {
if (navigator.onLine) {
if (arguments.length > 1 || libraries[url] || url.indexOf('.js') !== -1) {
return loadScript.apply(this, arguments);
} else {
return loadDOM(url);
}
} else {
return "You need to be online to use :load";
}
}
}());
function loadScript() {
for (var i = 0; i < arguments.length; i++) {
(function (url) {
$document.trigger('console:load:script', url);
})(libraries[arguments[i]] || arguments[i]);
}
return "Loading script...";
}
function loadDOM(url) {
var script = document.createElement('script'),
cb = 'loadDOM' + +new Date;
script.src = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22' + encodeURIComponent(url) + '%22&format=xml&callback=' + cb;
window[cb] = function (yql) {
if (yql.results.length) {
var html = yql.results[0].replace(/type="text\/javascript"/ig,'type="x"').replace(/<body.*?>/, '').replace(/<\/body>/, '');
$document.trigger('console:load:dom', html);
} else {
log('Failed to load DOM', 'error');
}
try {
window[cb] = null;
delete window[cb];
} catch (e) {}
};
document.body.appendChild(script);
return "Loading URL into DOM...";
}
function trim(s) {
return (s||"").replace(/^\s+|\s+$/g,"");
}
var ccCache = {};
var ccPosition = false;
window._console = {
clear: function () {
output.innerHTML = '';
},
assert: function() {
if (arguments.length === 0 || !eval(arguments[0])) {
var msg = [];
for(var p in arguments) {
if (p === "0") continue;
msg.push(arguments[p]);
}
var assertionMsg = msg.join(' ') || 'console.assert'
log('Assertion failed: '+assertionMsg, 'error');
}
},
log: function () {
var l = arguments.length, i = 0;
for (; i < l; i++) {
log(''+arguments[i], true);
}
},
dir: function () {
var l = arguments.length, i = 0;
for (; i < l; i++) {
log(arguments[i]);
}
},
props: function (obj) {
var props = [], realObj;
try {
for (var p in obj) props.push(p);
} catch (e) {}
return props;
},
error: function (err) {
log(err.message || err, 'error');
}
};
// give info support too
window._console.info = window._console.log;
function about() {
return 'Ported to JS Bin from <a target="_new" href="http://jsconsole.com">jsconsole.com</a>';
}
function setHistory(history) {
historyPosition = history.length;
if (typeof JSON == 'undefined') return;
try {
// because FF with cookies disabled goes nuts, and because sometimes WebKit goes nuts too...
sessionStorage.setItem('history', JSON.stringify(history));
} catch (e) {}
}
function getHistory() {
var history = [''];
if (typeof JSON == 'undefined') return history;
try {
// because FF with cookies disabled goes nuts, and because sometimes WebKit goes nuts too...
history = JSON.parse(sessionStorage.getItem('history') || '[""]');
} catch (e) {}
return history;
}
function showHistory() {
var h = getHistory();
h.shift();
return h.join("\n");
}
var exec = document.getElementById('exec'),
form = exec.form || {},
output = null,
history = getHistory(),
fakeConsole = 'window.parent._console',
libraries = {
jquery: 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',
prototype: 'http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js',
dojo: 'http://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js',
mootools: 'http://ajax.googleapis.com/ajax/libs/mootools/1/mootools-yui-compressed.js',
underscore: 'http://jashkenas.github.io/underscore/underscore-min.js',
rightjs: 'http://rightjs.org/hotlink/right.js',
coffeescript: 'http://jashkenas.github.io/coffee-script/extras/coffee-script.js',
yui: 'http://yui.yahooapis.com/3.9.1/build/yui/yui-min.js'
},
body = document.getElementsByTagName('body')[0],
logAfter = null,
lastCmd = null,
wait = false,
commandPresent = /:((?:help|about|load|clear|reset|wait|history)(?:.*))\n/gi,
commands = {
history: showHistory,
help: showhelp,
about: about,
load: load,
wait: function () {
wait = true;
return '';
},
clear: function () {
setTimeout(function () { output.innerHTML = ''; }, 10);
return 'clearing...';
},
reset: function () {
output.innerHTML = '';
jsconsole.init(output, true);
return 'Context reset';
}
},
fakeInput = null,
getCursor = (function () {
var cursor;
return function () {
if (cursor) return cursor;
return document.getElementById('cursor') || { focus: function () {} };
};
}()),
// I hate that I'm browser sniffing, but there's issues with Firefox and execCommand so code completion won't work
iOSMobile = navigator.userAgent.indexOf('AppleWebKit') !== -1 && navigator.userAgent.indexOf('Mobile') !== -1,
// FIXME Remy, seriously, don't sniff the agent like this, it'll bite you in the arse.
enableCC = navigator.userAgent.indexOf('AppleWebKit') !== -1 && navigator.userAgent.indexOf('Mobile') === -1 || navigator.userAgent.indexOf('OS 5_') !== -1;
if (enableCC) {
var autofocus = jsbin.embed ? '' : 'autofocus';
exec.parentNode.innerHTML = '<div ' + autofocus + ' id="exec" autocapitalize="off" spellcheck="false"><span id="cursor" spellcheck="false" autocapitalize="off" autocorrect="off"' + (iOSMobile ? '' : ' contenteditable') + '></span></div>';
exec = document.getElementById('exec');
} else {
$('#console').addClass('plain');
}
if (enableCC && iOSMobile) {
fakeInput = document.createElement('input');
fakeInput.className = 'fakeInput';
fakeInput.setAttribute('spellcheck', 'false');
fakeInput.setAttribute('autocorrect', 'off');
fakeInput.setAttribute('autocapitalize', 'off');
exec.parentNode.appendChild(fakeInput);
}
function whichKey(event) {
var keys = {38:1, 40:1, Up:38, Down:40, Enter:10, 'U+0009':9, 'U+0008':8, 'U+0190':190, 'Right':39,
// these two are ignored
'U+0028': 57, 'U+0026': 55 };
return keys[event.keyIdentifier] || event.which || event.keyCode;
}
function setCursorTo(str, append) {
str = enableCC ? cleanse(str) : str;
var old = exec.value;
if (append) {
exec.value = old + str;
} else {
exec.value = str;
}
if (enableCC) {
if (exec.textContent.length) {
document.execCommand('selectAll', false, null);
document.execCommand('delete', false, null);
}
document.execCommand('insertHTML', false, str);
getCursor().focus();
} else {
var rows = str.match(/\n/g);
exec.setAttribute('rows', rows !== null ? rows.length + 1 : 1);
}
}
function findNode(list, node) {
var pos = 0;
for (var i = 0; i < list.length; i++) {
if (list[i] == node) {
return pos;
}
pos += list[i].nodeValue.length;
}
return -1;
};
/**
* Handle keydown events in the console - the money shot.
*/
exec.onkeydown = function (event) {
event = event || window.event;
var keys = {38:1, 40:1},
wide = body.className == 'large',
which = whichKey(event),
enterDown = (which == keylib.enter || which == keylib.webkitEnter);
if (typeof which == 'string') which = which.replace(/\/U\+/, '\\u');
// Is this a special key?
if (keys[which]) {
if (event.shiftKey) return;
// History cycle
// Up
if (which == keylib.up) {
historyPosition--;
// Don't go past the start
if (historyPosition < 0) historyPosition = 0; //history.length - 1;
}
// Down
if (which == keylib.down) {
historyPosition++;
// Don't go past the end
if (historyPosition >= history.length) historyPosition = history.length; //0;
}
if (history[historyPosition] != undefined && history[historyPosition] !== '') {
setCursorTo(history[historyPosition]);
return false;
} else if (historyPosition == history.length) {
setCursorTo('');
return false;
}
}
// Execute the code
else if (enterDown && event.shiftKey == false) { // enter (what about the other one)
var command = exec.textContent || exec.value;
// ======================================================================
if (command.length) post(command);
// ======================================================================
return false;
}
// Expand the textarea
else if (enterDown && event.shiftKey == true) {
var rows = exec.value.match(/\n/g);
rows = rows != null ? rows.length + 2 : 2;
exec.setAttribute('rows', rows);
}
// Clear the console.
// Ctrl+L or Meta+Shift+Backspace
else if ((event.shiftKey && event.metaKey && which == keylib.backspace) ||
(event.ctrlKey && which == keylib.l)) {
output.innerHTML = '';
}
};
if (enableCC && iOSMobile) {
fakeInput.onkeydown = function (event) {
var which = whichKey(event),
enterDown = (which == keylib.enter || which == keylib.webkitEnter)
if (enterDown) {
post(this.value);
this.value = '';
getCursor().innerHTML = '';
return false;
}
};
}
form.onsubmit = function (event) {
event = event || window.event;
event.preventDefault && event.preventDefault();
post(exec.textContent || exec.value);
return false;
};
document.onkeydown = function (event) {
event = event || window.event;
var which = event.which || event.keyCode;
if (event.shiftKey && event.metaKey && which == 8) {
output.innerHTML = '';
getCursor().focus();
} else if (event.target == output.parentNode && which == 32) { // space
output.parentNode.scrollTop += 5 + output.parentNode.offsetHeight * (event.shiftKey ? -1 : 1);
}
};
exec.onclick = function () {
getCursor().focus();
};
var jsconsole = {
run: post,
clear: commands.clear,
reset: function () {
this.run(':reset');
},
focus: function () {
if (enableCC) {
getCursor().focus();
} else {
$(exec).focus();
}
},
echo: echo,
_onloadQueue: [],
onload: function (fn) {
var i = 0, length = this._onloadQueue.length;
if (this.ready === false && fn) { // if not ready and callback passed - cache it
this._onloadQueue.push(fn);
} else if (this.ready === true && !fn) { // if ready and not callback - flush cache
for (; i < length; i++) {
this._onloadQueue[i].call(this);
}
this._onloadQueue = [];
} else if (fn) { // if callback and ready - run callback
fn.call(this);
}
},
init: function (outputElement, nohelp) {
output = outputElement;
jsconsole.ready = true;
jsconsole.onload();
if (nohelp === undefined) post(':help', true);
},
rawMessage: function (data) {
if (data.type && data.type == 'error') {
post(data.cmd, true, ['error', data.response]);
} else if (data.type && data.type == 'info') {
window.top.info(data.response);
} else {
if (data.cmd.indexOf('console.log') === -1) data.response = data.response.substr(1, data.response.length - 2); // fiddle to remove the [] around the repsonse
echo(data.cmd);
log(data.response, 'response');
}
},
setCursorTo: setCursorTo,
};
return jsconsole;
})(this);
var msgType = '';
jsconsole.init(document.getElementById('output'));
function upgradeConsolePanel(console) {
console.setCursorTo = jsconsole.setCursorTo;
console.$el.click(function (event) {
if (!$(event.target).closest('#output').length) {
jsconsole.focus();
}
});
console.reset = function () {
jsconsole.reset();
};
console.settings.render = function (withAlerts) {
var html = editors.html.getCode().trim();
if (html === "") {
editors.javascript.render().then(function (echo) {
echo = echo.trim();
return getPreparedCode().then(function (code) {
code = code.replace(/<pre>/, '').replace(/<\/pre>/, '');
setTimeout(function() {
jsconsole.run({
echo: echo,
cmd: code
});
}, 0);
});
}, function (error) {
console.warn('Failed to render JavaScript');
console.warn(error);
});
// Tell the iframe to reload
renderer.postMessage('render', {
source: '<html>'
});
} else {
renderLivePreview(withAlerts || false);
}
};
console.settings.show = function () {
jsconsole.clear();
// renderLivePreview(true);
// setTimeout because the renderLivePreview creates the iframe after a timeout
setTimeout(function () {
if (editors.console.ready && !jsbin.embed) jsconsole.focus();
}, 0);
};
console.settings.hide = function () {
// Removal code is commented out so that the
// output iframe is never removed
if (!editors.live.visible) {
// $live.find('iframe').remove();
}
};
$document.one('jsbinReady', function () {
var hidebutton = function () {
$('#runconsole')[this.visible ? 'hide' : 'show']();
};
jsbin.panels.panels.live.on('show', hidebutton).on('hide', hidebutton);
if (jsbin.panels.panels.live.visible) {
$('#runconsole').hide();
}
});
}
|
{
"content_hash": "5db5d0089841adeffedca0856115ba9c",
"timestamp": "",
"source": "github",
"line_count": 671,
"max_line_length": 240,
"avg_line_length": 27.78837555886736,
"alnum_prop": 0.593049447602703,
"repo_name": "jsbin/jsbin",
"id": "35b2f16e64f9cf901cb7ad701179eb046db3a204",
"size": "18650",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "public/js/render/console.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "322994"
},
{
"name": "HTML",
"bytes": "163743"
},
{
"name": "Handlebars",
"bytes": "441"
},
{
"name": "JavaScript",
"bytes": "985476"
}
]
}
|
package io.hawt.web;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import org.json.JSONObject;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class ServletHelpersTest {
@Test
public void readObject() throws Exception {
String data = "{ string: 'text', number: 2, boolean: true }";
JSONObject json = ServletHelpers.readObject(
new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data.getBytes()))));
assertThat(json.get("string"), equalTo("text"));
assertThat(json.get("number"), equalTo(2));
assertThat(json.get("boolean"), equalTo(true));
}
}
|
{
"content_hash": "8052c9b06fc4a8ac65edda5c434d92b1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 98,
"avg_line_length": 29.23076923076923,
"alnum_prop": 0.7078947368421052,
"repo_name": "tadayosi/hawtio",
"id": "bcda7e4076b26d3f26cd4378089fb36c09e2a90a",
"size": "760",
"binary": false,
"copies": "1",
"ref": "refs/heads/2.x",
"path": "hawtio-system/src/test/java/io/hawt/web/ServletHelpersTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "332525"
},
{
"name": "HTML",
"bytes": "24947"
},
{
"name": "Java",
"bytes": "657553"
},
{
"name": "JavaScript",
"bytes": "10276"
},
{
"name": "Scala",
"bytes": "5228"
},
{
"name": "Shell",
"bytes": "1238"
},
{
"name": "TypeScript",
"bytes": "6494"
}
]
}
|
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
import pyrpca
|
{
"content_hash": "b2a7bc1e687b84df22cf503f8041544a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 41,
"avg_line_length": 15.4,
"alnum_prop": 0.7272727272727273,
"repo_name": "RPGOne/Skynet",
"id": "b3b1f2cb50af12d7ca13b0aa4eca160cdda88e09",
"size": "102",
"binary": false,
"copies": "2",
"ref": "refs/heads/Miho",
"path": "context.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "1C Enterprise",
"bytes": "36"
},
{
"name": "Ada",
"bytes": "89079"
},
{
"name": "Assembly",
"bytes": "11425802"
},
{
"name": "Batchfile",
"bytes": "123467"
},
{
"name": "C",
"bytes": "34703955"
},
{
"name": "C#",
"bytes": "55955"
},
{
"name": "C++",
"bytes": "84647314"
},
{
"name": "CMake",
"bytes": "220849"
},
{
"name": "CSS",
"bytes": "39257"
},
{
"name": "Cuda",
"bytes": "1344541"
},
{
"name": "DIGITAL Command Language",
"bytes": "349320"
},
{
"name": "DTrace",
"bytes": "37428"
},
{
"name": "Emacs Lisp",
"bytes": "19654"
},
{
"name": "Erlang",
"bytes": "39438"
},
{
"name": "Fortran",
"bytes": "16914"
},
{
"name": "HTML",
"bytes": "929759"
},
{
"name": "Java",
"bytes": "112658"
},
{
"name": "JavaScript",
"bytes": "32806873"
},
{
"name": "Jupyter Notebook",
"bytes": "1616334"
},
{
"name": "Lua",
"bytes": "22549"
},
{
"name": "M4",
"bytes": "64967"
},
{
"name": "Makefile",
"bytes": "1046428"
},
{
"name": "Matlab",
"bytes": "888"
},
{
"name": "Module Management System",
"bytes": "1545"
},
{
"name": "NSIS",
"bytes": "2860"
},
{
"name": "Objective-C",
"bytes": "131433"
},
{
"name": "PHP",
"bytes": "750783"
},
{
"name": "Pascal",
"bytes": "75208"
},
{
"name": "Perl",
"bytes": "626627"
},
{
"name": "Perl 6",
"bytes": "2495926"
},
{
"name": "PowerShell",
"bytes": "38374"
},
{
"name": "Prolog",
"bytes": "300018"
},
{
"name": "Python",
"bytes": "26363074"
},
{
"name": "R",
"bytes": "236175"
},
{
"name": "Rebol",
"bytes": "217"
},
{
"name": "Roff",
"bytes": "328366"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Scala",
"bytes": "248902"
},
{
"name": "Scheme",
"bytes": "14853"
},
{
"name": "Shell",
"bytes": "360815"
},
{
"name": "TeX",
"bytes": "105346"
},
{
"name": "Vim script",
"bytes": "6101"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "5158"
}
]
}
|
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "98ef7fa26e05bfe71212be6a548b9bc8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "effbc2a0f77c6c1945a700190e8edadb4700b813",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Pteridophyta/Polypodiopsida/Polypodiales/Polypodiaceae/Lepisorus/Lepisorus kolesnikovii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
namespace impl
{
///@name This functions take input range NOT like STL does: [first, last].
//@{
template <typename DistanceFn, typename Iter>
std::pair<double, Iter> MaxDistance(Iter first, Iter last, DistanceFn & distFn)
{
std::pair<double, Iter> res(0.0, last);
if (std::distance(first, last) <= 1)
return res;
for (Iter i = first + 1; i != last; ++i)
{
double const d = distFn(m2::PointD(*first), m2::PointD(*last), m2::PointD(*i));
if (res.first < d)
{
res.first = d;
res.second = i;
}
}
return res;
}
// Actual SimplifyDP implementation.
template <typename DistanceFn, typename Iter, typename Out>
void SimplifyDP(Iter first, Iter last, double epsilon, DistanceFn & distFn, Out & out)
{
std::pair<double, Iter> maxDist = impl::MaxDistance(first, last, distFn);
if (maxDist.second == last || maxDist.first < epsilon)
{
out(*last);
}
else
{
impl::SimplifyDP(first, maxDist.second, epsilon, distFn, out);
impl::SimplifyDP(maxDist.second, last, epsilon, distFn, out);
}
}
//@}
struct SimplifyOptimalRes
{
SimplifyOptimalRes() : m_PointCount(-1U) {}
SimplifyOptimalRes(int32_t nextPoint, uint32_t pointCount)
: m_NextPoint(nextPoint), m_PointCount(pointCount) {}
int32_t m_NextPoint;
uint32_t m_PointCount;
};
} // namespace impl
// Douglas-Peucker algorithm for STL-like range [beg, end).
// Iteratively includes the point with max distance from the current simplification.
// Average O(n log n), worst case O(n^2).
template <typename DistanceFn, typename Iter, typename Out>
void SimplifyDP(Iter beg, Iter end, double epsilon, DistanceFn distFn, Out out)
{
if (beg != end)
{
out(*beg);
impl::SimplifyDP(beg, end - 1, epsilon, distFn, out);
}
}
// Dynamic programming near-optimal simplification.
// Uses O(n) additional memory.
// Worst case O(n^3) performance, average O(n*k^2), where k is maxFalseLookAhead - parameter,
// which limits the number of points to try, that produce error > epsilon.
// Essentially, it's a trade-off between optimality and performance.
// Values around 20 - 200 are reasonable.
template <typename DistanceFn, typename Iter, typename Out>
void SimplifyNearOptimal(int maxFalseLookAhead, Iter beg, Iter end, double epsilon,
DistanceFn distFn, Out out)
{
int32_t const n = static_cast<int32_t>(end - beg);
if (n <= 2)
{
for (Iter it = beg; it != end; ++it)
out(*it);
return;
}
std::vector<impl::SimplifyOptimalRes> F(n);
F[n - 1] = impl::SimplifyOptimalRes(n, 1);
for (int32_t i = n - 2; i >= 0; --i)
{
for (int32_t falseCount = 0, j = i + 1; j < n && falseCount < maxFalseLookAhead; ++j)
{
uint32_t const newPointCount = F[j].m_PointCount + 1;
if (newPointCount < F[i].m_PointCount)
{
if (impl::MaxDistance(beg + i, beg + j, distFn).first < epsilon)
{
F[i].m_NextPoint = j;
F[i].m_PointCount = newPointCount;
}
else
{
++falseCount;
}
}
}
}
for (int32_t i = 0; i < n; i = F[i].m_NextPoint)
out(*(beg + i));
}
// Additional points filter to use in simplification.
// SimplifyDP can produce points that define degenerate triangle.
template <typename DistanceFn, typename Point>
class AccumulateSkipSmallTrg
{
public:
AccumulateSkipSmallTrg(DistanceFn & distFn, std::vector<Point> & vec, double eps)
: m_distFn(distFn), m_vec(vec), m_eps(eps)
{
}
void operator()(Point const & p) const
{
// remove points while they make linear triangle with p
size_t count;
while ((count = m_vec.size()) >= 2)
{
auto const a = m2::PointD(m_vec[count - 2]);
auto const b = m2::PointD(p);
auto const c = m2::PointD(m_vec[count - 1]);
if (m_distFn(a, b, c) < m_eps)
m_vec.pop_back();
else
break;
}
m_vec.push_back(p);
}
private:
DistanceFn & m_distFn;
std::vector<Point> & m_vec;
double m_eps;
};
|
{
"content_hash": "38979ec8159a52b264d3e5d5affe406a",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 93,
"avg_line_length": 27.86013986013986,
"alnum_prop": 0.6312751004016064,
"repo_name": "VladiMihaylenko/omim",
"id": "58f18cb30c3b4f9e5d179bf32a53684a5d7b2e27",
"size": "4428",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "geometry/simplification.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "3962"
},
{
"name": "Batchfile",
"bytes": "5543"
},
{
"name": "C",
"bytes": "13989575"
},
{
"name": "C++",
"bytes": "146396502"
},
{
"name": "CMake",
"bytes": "223149"
},
{
"name": "CSS",
"bytes": "26798"
},
{
"name": "Common Lisp",
"bytes": "17521"
},
{
"name": "DIGITAL Command Language",
"bytes": "36710"
},
{
"name": "GLSL",
"bytes": "50620"
},
{
"name": "Gherkin",
"bytes": "305230"
},
{
"name": "Go",
"bytes": "12771"
},
{
"name": "HTML",
"bytes": "9459269"
},
{
"name": "Inno Setup",
"bytes": "4337"
},
{
"name": "Java",
"bytes": "1928650"
},
{
"name": "JavaScript",
"bytes": "29076"
},
{
"name": "Lua",
"bytes": "57672"
},
{
"name": "M4",
"bytes": "53992"
},
{
"name": "Makefile",
"bytes": "429637"
},
{
"name": "Module Management System",
"bytes": "2080"
},
{
"name": "Objective-C",
"bytes": "1990354"
},
{
"name": "Objective-C++",
"bytes": "1177287"
},
{
"name": "PHP",
"bytes": "2841"
},
{
"name": "Perl",
"bytes": "57807"
},
{
"name": "PowerShell",
"bytes": "1885"
},
{
"name": "Prolog",
"bytes": "282"
},
{
"name": "Python",
"bytes": "536642"
},
{
"name": "QMake",
"bytes": "4371"
},
{
"name": "Roff",
"bytes": "13545"
},
{
"name": "Ruby",
"bytes": "62015"
},
{
"name": "Shell",
"bytes": "1315138"
},
{
"name": "Swift",
"bytes": "338051"
},
{
"name": "sed",
"bytes": "236"
}
]
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace iQQ.Net.WebQQCore.Util
{
public static class RetryHelper
{
public static T Retry<T>(Func<T> func, int retryTimes, TimeSpan ts)
{
var exceptions = new List<Exception>();
for (var i = 0; i < retryTimes; i++)
{
try
{
return func();
}
catch (Exception ex)
{
Thread.Sleep(ts);
exceptions.Add(ex);
}
}
throw new AggregateException(exceptions);
}
}
}
|
{
"content_hash": "dd58c543227a9b9e4ce63dbd0293797f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 25.137931034482758,
"alnum_prop": 0.4787379972565158,
"repo_name": "huoshan12345/iQQ.Net",
"id": "a53196a25038b75ddbb01e519b9474adc5c47bb7",
"size": "731",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/WebQQCore/Util/RetryHelper.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "675200"
},
{
"name": "JavaScript",
"bytes": "1441"
}
]
}
|
package in.twizmwaz.cardinal.module.modules.regions.type;
import in.twizmwaz.cardinal.module.modules.regions.RegionModule;
import in.twizmwaz.cardinal.module.modules.regions.parsers.CylinderParser;
import in.twizmwaz.cardinal.util.NumUtils;
import org.bukkit.block.Block;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.List;
public class CylinderRegion extends RegionModule {
private final Vector base;
private final double radius, height;
public CylinderRegion(String name, Vector base, double radius, double height) {
super(name);
this.base = base;
this.radius = radius;
this.height = height;
}
public CylinderRegion(CylinderParser parser) {
this(parser.getName(), parser.getBase(), parser.getRadius(), parser.getHeight());
}
public double getBaseX() {
return base.getX();
}
public double getBaseY() {
return base.getY();
}
public double getBaseZ() {
return base.getZ();
}
public double getRadius() {
return radius;
}
public double getHeight() {
return height;
}
@Override
public boolean contains(Vector vector) {
return (Math.hypot(Math.abs(vector.getX() - getBaseX()), Math.abs(vector.getZ() - getBaseZ())) <= getRadius()) && NumUtils.checkInterval(vector.getY(), getBaseY(), getBaseY() + getHeight());
}
@Override
public PointRegion getRandomPoint() {
double a = NumUtils.getRandom(0, radius);
double b = NumUtils.getRandom(0, 360);
double c = NumUtils.getRandom(0, height);
return new PointRegion(null, getBaseX() + a * Math.cos(b), getBaseY() + c, getBaseZ() + a * Math.sin(b));
}
@Override
public BlockRegion getCenterBlock() {
return (new BlockRegion(null, new Vector(getBaseX(), getBaseY() + .5 * height, getBaseZ())));
}
@Override
public List<Block> getBlocks() {
List<Block> results = new ArrayList<>();
CuboidRegion bound = new CuboidRegion(null, getBaseX() - radius, getBaseY(), getBaseZ() - radius, getBaseX() + radius, getBaseY() + height, getBaseZ() + radius);
for (Block block : bound.getBlocks()) {
if (contains(new BlockRegion(null, block.getX(), block.getY(), block.getZ()))) results.add(block);
}
return results;
}
}
|
{
"content_hash": "90d15b71b08e8655dffda2f561206d7a",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 198,
"avg_line_length": 31.31578947368421,
"alnum_prop": 0.6436974789915967,
"repo_name": "dentmaged/CardinalPGM",
"id": "19eb698df4a01c72df6c430fed7ca60a54baf137",
"size": "2380",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/in/twizmwaz/cardinal/module/modules/regions/type/CylinderRegion.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2089"
},
{
"name": "Java",
"bytes": "920784"
}
]
}
|
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { Module43CompComponent } from './components/module-43-comp/module-43-comp.component';
const routes: Routes = [
{
path: '',
component: Module43CompComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class Module43RoutingModule { }
|
{
"content_hash": "30a0640513fa87856c9c2ed5c595efc7",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 93,
"avg_line_length": 20.45,
"alnum_prop": 0.7017114914425427,
"repo_name": "angular/angular-cli-stress-test",
"id": "21e90d6a23d38dbba2a7d7bcf2a3f8cf48f0ad15",
"size": "611",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/modules/module-43/module-43-routing.module.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1040888"
},
{
"name": "HTML",
"bytes": "300322"
},
{
"name": "JavaScript",
"bytes": "2404"
},
{
"name": "TypeScript",
"bytes": "8535506"
}
]
}
|
var tape = require('tape');
var mjAPI = require('../lib/main.js');
tape('Options "extension": multiple extensions', function(t) {
t.plan(1);
mjAPI.config({
extensions: 'TeX/autoload-all.js, TeX/color.js'
});
mjAPI.typeset(
{
math: 'E = mc^2',
format: 'TeX',
mml: true
},
function(data) {
t.notOk(
data.errors,
'Config block with multiple extensions throws no error'
);
}
);
});
|
{
"content_hash": "9f6ca051a329c8b452a2f4d8d78dc647",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 63,
"avg_line_length": 20.681818181818183,
"alnum_prop": 0.5538461538461539,
"repo_name": "mathjax/MathJax-node",
"id": "8d07733cad195d4846118c5bf53fd629e2b29069",
"size": "455",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/base-config-extensions.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "59765"
}
]
}
|
require 'sass'
module Ti
module Compiler
class SASSScripts
class << self
include ::Ti::Utils
# def compile(contents, compile_to_location)
def compile
system "sass --compass -C -t expand app/#{underscore(get_app_name)}/stylesheets/app.sass > Resources/app.jss"
log "Your SASS have been compiled to: Resources/app.jss"
end
end
end
end
end
|
{
"content_hash": "5b16df7028ccc784cc9d60f636cb12ed",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 119,
"avg_line_length": 25.875,
"alnum_prop": 0.6207729468599034,
"repo_name": "revans/Ti",
"id": "e3dda12d3c405d9ec51af1d7ea90266d145b35a9",
"size": "414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/ti/compiler/sass_scripts.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "1212"
},
{
"name": "Ruby",
"bytes": "40423"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 5