text stringlengths 2 1.04M | meta dict |
|---|---|
<?php
namespace Oro\Bundle\ActionBundle\Tests\Unit\Model;
use Oro\Bundle\ActionBundle\Model\OperationDefinition;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
class OperationDefinitionTest extends \PHPUnit_Framework_TestCase
{
use EntityTestCaseTrait;
/** @var OperationDefinition */
protected $definition;
protected function setUp()
{
$this->definition = new OperationDefinition();
}
protected function tearDown()
{
unset($this->definition);
}
public function testSetAndGetActions()
{
$this->definition->setActions('name1', ['func1', 'func2']);
$this->assertEquals(['func1', 'func2'], $this->definition->getActions('name1'));
$this->assertEquals(['name1' => ['func1', 'func2']], $this->definition->getActions());
}
public function testSetAndGetConditions()
{
$this->definition->setConditions('name1', ['cond1', 'cond2']);
$this->assertEquals(['cond1', 'cond2'], $this->definition->getConditions('name1'));
$this->assertEquals(['name1' => ['cond1', 'cond2']], $this->definition->getConditions());
}
public function testGetAllowedActions()
{
$this->assertEquals(
[OperationDefinition::PREACTIONS, OperationDefinition::FORM_INIT, OperationDefinition::ACTIONS],
OperationDefinition::getAllowedActions()
);
}
public function testGetAllowedConditions()
{
$this->assertEquals(
[OperationDefinition::PRECONDITIONS, OperationDefinition::CONDITIONS],
OperationDefinition::getAllowedConditions()
);
}
public function testGettersAndSetters()
{
static::assertPropertyAccessors(
$this->definition,
[
['name', 'test'],
['label', 'test'],
['substituteOperation', 'test_operation_name_to_substitute'],
['enabled', false, true],
['forAllEntities', false, true],
['entities', ['entity1', 'entity2'], []],
['excludeEntities', ['entity3', 'entity4'], []],
['routes', ['route1', 'route2'], []],
['datagrids', ['datagrid1', 'datagrid2'], []],
['groups', ['group1', 'group2']],
['applications', ['application1', 'application2'], []],
['order', 77, 0],
['frontendOptions', ['config1', 'config2'], []],
['buttonOptions', ['config1', 'config2'], []],
['datagridOptions', ['datagridConfig1', 'datagridConfig2'], []],
['formOptions', ['config1', 'config2'], []],
['formType', 'test_form_type'],
['attributes', ['config1', 'config2'], []],
['actionGroups', ['action_group1', 'action_group2'], []]
]
);
}
}
| {
"content_hash": "2a30187ba095070568b32fb448b4e7f1",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 108,
"avg_line_length": 34.082352941176474,
"alnum_prop": 0.5560925094925785,
"repo_name": "trustify/oroplatform",
"id": "636c4f952d4637d8abd900e8a363b67ed825256d",
"size": "2897",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Oro/Bundle/ActionBundle/Tests/Unit/Model/OperationDefinitionTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "723257"
},
{
"name": "Cucumber",
"bytes": "8610"
},
{
"name": "HTML",
"bytes": "1597517"
},
{
"name": "JavaScript",
"bytes": "5554468"
},
{
"name": "PHP",
"bytes": "29776857"
}
],
"symlink_target": ""
} |
import datetime
import os
SCHEDULER_TASKS = [
{
"path": "tests.tasks.general.MongoInsert",
"params": {
"monthday": i + 1
},
"monthday": i + 1,
"dailytime": datetime.datetime.fromtimestamp(float(os.environ.get("MRQ_TEST_SCHEDULER_TIME"))).time()
} for i in range(31)
]
SCHEDULER_INTERVAL = 1
| {
"content_hash": "117d6b56e59276458621cd4e93698ae3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 109,
"avg_line_length": 23.533333333333335,
"alnum_prop": 0.5779036827195467,
"repo_name": "pricingassistant/mrq",
"id": "6210d974af02c23388855f1f59f018a135ecf62a",
"size": "353",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/fixtures/config-scheduler6.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5514"
},
{
"name": "Dockerfile",
"bytes": "2722"
},
{
"name": "HTML",
"bytes": "60608"
},
{
"name": "JavaScript",
"bytes": "78540"
},
{
"name": "Makefile",
"bytes": "2765"
},
{
"name": "Perl",
"bytes": "1374"
},
{
"name": "Python",
"bytes": "931744"
}
],
"symlink_target": ""
} |
<?php
namespace Modules\Contact\Mappers;
use Modules\Contact\Models\Contact;
use Modules\Contact\Models\ContactNullObject;
use Modules\LibraryModule\Entity\EntityMapper;
class ContactMapper extends EntityMapper
{
const URL = 'contacts';
public function __construct(){
parent::__construct(self::URL);
}
/**
* @param array $objectData
* @return Contact|ContactNullObject
*/
public function buildObject(array $objectData)
{
if(!count($objectData)){
return new \Modules\Contact\Models\ContactNullObject();
}
return new \Modules\Contact\Models\Contact(
$objectData[\Modules\Contact\Models\Contact::ID],
$objectData[\Modules\Contact\Models\Contact::FIRST_NAME],
$objectData[\Modules\Contact\Models\Contact::LAST_NAME],
$objectData[\Modules\Contact\Models\Contact::PHONE_NUMBER],
$objectData[\Modules\Contact\Models\Contact::EMAIL]
);
}
} | {
"content_hash": "0eb98f2f2beca78689ca303267de3512",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 71,
"avg_line_length": 28.34285714285714,
"alnum_prop": 0.65625,
"repo_name": "filchakov/soap_wrapper",
"id": "76090ee58045ca363a2f42ffd6f5d0d5a11f1d3a",
"size": "992",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/Contact/Mappers/ContactMapper.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "516"
},
{
"name": "PHP",
"bytes": "555467"
}
],
"symlink_target": ""
} |
int
main(int argc, char **argv)
{
unsigned char sk[crypto_box_SECRETKEYBYTES];
unsigned char pk[crypto_box_PUBLICKEYBYTES];
char sk_hex [(crypto_box_SECRETKEYBYTES * 2) + 1];
char pk_hex [(crypto_box_PUBLICKEYBYTES * 2) + 1];
if (sodium_init() == -1) {
printf("failed to initialize crypto library.\n");
return EXIT_FAILURE;;
}
crypto_box_keypair(pk, sk);
sodium_bin2hex(sk_hex, sizeof(sk_hex), sk, sizeof(sk));
sodium_bin2hex(pk_hex, sizeof(pk_hex), pk, sizeof(pk));
printf("# Secret key for local vpnd.conf : %s\n", sk_hex);
printf("# Public key for peer vpnd.conf : %s\n", pk_hex);
return EXIT_SUCCESS;
}
| {
"content_hash": "9fa156b9bebe8054288f1825e3cbf7e2",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 59,
"avg_line_length": 31.7,
"alnum_prop": 0.6656151419558359,
"repo_name": "cmusser/vpnd",
"id": "a7244bccad77db9ca8f57b6c295ebf2f1e9786a2",
"size": "694",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vpnd-keygen.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "173793"
},
{
"name": "Makefile",
"bytes": "1222"
},
{
"name": "Roff",
"bytes": "9311"
}
],
"symlink_target": ""
} |
import {Routes} from '@angular/router';
import {RequestCalcComponent} from "./request-calc";
import {simpleAppRoutes} from "./simple-app/simple-app.routes";
import {LandingComponent} from "./landing/landing.component";
import {extendAppRoutes} from "./extend-app/extend-app.routes";
export const routes: Routes = [
{path: 'landing', component: LandingComponent},
{path: '', redirectTo: '/landing', pathMatch: 'full'},
{path: 'requestcalc', component: RequestCalcComponent},
{path: 'simpleapp', children: simpleAppRoutes},
{path: 'extendapp', children: extendAppRoutes},
];
| {
"content_hash": "48bd58e31c78c05417a34fc4c22b1e52",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 63,
"avg_line_length": 39.06666666666667,
"alnum_prop": 0.726962457337884,
"repo_name": "2muchcoffeecom/ng2-restangular",
"id": "01e5da11176b107225a426ec28c3634d16355799",
"size": "586",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "demo/app.routes.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "3336242"
},
{
"name": "TypeScript",
"bytes": "103395"
}
],
"symlink_target": ""
} |
package org.cloudfoundry.uaa.authorizations;
import org.junit.Test;
public final class GetOpenIdProviderConfigurationRequestTest {
@Test
public void valid() {
GetOpenIdProviderConfigurationRequest.builder()
.build();
}
}
| {
"content_hash": "00586d84ec6187259ee2e9ef70e50d54",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 62,
"avg_line_length": 17.266666666666666,
"alnum_prop": 0.7027027027027027,
"repo_name": "alexander071/cf-java-client",
"id": "497d2df6016b634a06a58ba5d8a334d3cc0ff4f5",
"size": "879",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cloudfoundry-client/src/test/java/org/cloudfoundry/uaa/authorizations/GetOpenIdProviderConfigurationRequestTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5043"
},
{
"name": "Java",
"bytes": "4410753"
},
{
"name": "Shell",
"bytes": "8834"
}
],
"symlink_target": ""
} |
<?php
final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
/**
* Verify that any user can view an object with POLICY_PUBLIC.
*/
public function testPublicPolicyEnabled() {
$env = PhabricatorEnv::beginScopedEnv();
$env->overrideEnvConfig('policy.allow-public', true);
$this->expectVisibility(
$this->buildObject(PhabricatorPolicies::POLICY_PUBLIC),
array(
'public' => true,
'user' => true,
'admin' => true,
),
'Public Policy (Enabled in Config)');
}
/**
* Verify that POLICY_PUBLIC is interpreted as POLICY_USER when public
* policies are disallowed.
*/
public function testPublicPolicyDisabled() {
$env = PhabricatorEnv::beginScopedEnv();
$env->overrideEnvConfig('policy.allow-public', false);
$this->expectVisibility(
$this->buildObject(PhabricatorPolicies::POLICY_PUBLIC),
array(
'public' => false,
'user' => true,
'admin' => true,
),
'Public Policy (Disabled in Config)');
}
/**
* Verify that any logged-in user can view an object with POLICY_USER, but
* logged-out users can not.
*/
public function testUsersPolicy() {
$this->expectVisibility(
$this->buildObject(PhabricatorPolicies::POLICY_USER),
array(
'public' => false,
'user' => true,
'admin' => true,
),
'User Policy');
}
/**
* Verify that only administrators can view an object with POLICY_ADMIN.
*/
public function testAdminPolicy() {
$this->expectVisibility(
$this->buildObject(PhabricatorPolicies::POLICY_ADMIN),
array(
'public' => false,
'user' => false,
'admin' => true,
),
'Admin Policy');
}
/**
* Verify that no one can view an object with POLICY_NOONE.
*/
public function testNoOnePolicy() {
$this->expectVisibility(
$this->buildObject(PhabricatorPolicies::POLICY_NOONE),
array(
'public' => false,
'user' => false,
'admin' => false,
),
'No One Policy');
}
/**
* Test offset-based filtering.
*/
public function testOffsets() {
$results = array(
$this->buildObject(PhabricatorPolicies::POLICY_NOONE),
$this->buildObject(PhabricatorPolicies::POLICY_NOONE),
$this->buildObject(PhabricatorPolicies::POLICY_NOONE),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
);
$query = new PhabricatorPolicyAwareTestQuery();
$query->setResults($results);
$query->setViewer($this->buildUser('user'));
$this->assertEqual(
3,
count($query->setLimit(3)->setOffset(0)->execute()),
'Invisible objects are ignored.');
$this->assertEqual(
0,
count($query->setLimit(3)->setOffset(3)->execute()),
'Offset pages through visible objects only.');
$this->assertEqual(
2,
count($query->setLimit(3)->setOffset(1)->execute()),
'Offsets work correctly.');
$this->assertEqual(
2,
count($query->setLimit(0)->setOffset(1)->execute()),
'Offset with no limit works.');
}
/**
* Test limits.
*/
public function testLimits() {
$results = array(
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
$this->buildObject(PhabricatorPolicies::POLICY_USER),
);
$query = new PhabricatorPolicyAwareTestQuery();
$query->setResults($results);
$query->setViewer($this->buildUser('user'));
$this->assertEqual(
3,
count($query->setLimit(3)->setOffset(0)->execute()),
'Limits work.');
$this->assertEqual(
2,
count($query->setLimit(3)->setOffset(4)->execute()),
'Limit + offset work.');
}
/**
* Test that omnipotent users bypass policies.
*/
public function testOmnipotence() {
$results = array(
$this->buildObject(PhabricatorPolicies::POLICY_NOONE),
);
$query = new PhabricatorPolicyAwareTestQuery();
$query->setResults($results);
$query->setViewer(PhabricatorUser::getOmnipotentUser());
$this->assertEqual(
1,
count($query->execute()));
}
/**
* Test that invalid policies reject viewers of all types.
*/
public function testRejectInvalidPolicy() {
$invalid_policy = "the duck goes quack";
$object = $this->buildObject($invalid_policy);
$this->expectVisibility(
$object = $this->buildObject($invalid_policy),
array(
'public' => false,
'user' => false,
'admin' => false,
),
'Invalid Policy');
}
/**
* An omnipotent user should be able to see even objects with invalid
* policies.
*/
public function testInvalidPolicyVisibleByOmnipotentUser() {
$invalid_policy = "the cow goes moo";
$object = $this->buildObject($invalid_policy);
$results = array(
$object,
);
$query = new PhabricatorPolicyAwareTestQuery();
$query->setResults($results);
$query->setViewer(PhabricatorUser::getOmnipotentUser());
$this->assertEqual(
1,
count($query->execute()));
}
public function testAllQueriesBelongToActualApplications() {
$queries = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorPolicyAwareQuery')
->loadObjects();
foreach ($queries as $qclass => $query) {
$class = $query->getQueryApplicationClass();
if (!$class) {
continue;
}
$this->assertTrue(
(bool)PhabricatorApplication::getByClass($class),
"Application class '{$class}' for query '{$qclass}'");
}
}
public function testMultipleCapabilities() {
$object = new PhabricatorPolicyTestObject();
$object->setCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
));
$object->setPolicies(
array(
PhabricatorPolicyCapability::CAN_VIEW
=> PhabricatorPolicies::POLICY_USER,
PhabricatorPolicyCapability::CAN_EDIT
=> PhabricatorPolicies::POLICY_NOONE,
));
$filter = new PhabricatorPolicyFilter();
$filter->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
));
$filter->setViewer($this->buildUser('user'));
$result = $filter->apply(array($object));
$this->assertEqual(array(), $result);
}
/**
* Test an object for visibility across multiple user specifications.
*/
private function expectVisibility(
PhabricatorPolicyTestObject $object,
array $map,
$description) {
foreach ($map as $spec => $expect) {
$viewer = $this->buildUser($spec);
$query = new PhabricatorPolicyAwareTestQuery();
$query->setResults(array($object));
$query->setViewer($viewer);
$caught = null;
try {
$result = $query->executeOne();
} catch (PhabricatorPolicyException $ex) {
$caught = $ex;
}
if ($expect) {
$this->assertEqual(
$object,
$result,
"{$description} with user {$spec} should succeed.");
} else {
$this->assertTrue(
$caught instanceof PhabricatorPolicyException,
"{$description} with user {$spec} should fail.");
}
}
}
/**
* Build a test object to spec.
*/
private function buildObject($policy) {
$object = new PhabricatorPolicyTestObject();
$object->setCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
));
$object->setPolicies(
array(
PhabricatorPolicyCapability::CAN_VIEW => $policy,
));
return $object;
}
/**
* Build a test user to spec.
*/
private function buildUser($spec) {
$user = new PhabricatorUser();
switch ($spec) {
case 'public':
break;
case 'user':
$user->setPHID(1);
break;
case 'admin':
$user->setPHID(1);
$user->setIsAdmin(true);
break;
default:
throw new Exception("Unknown user spec '{$spec}'.");
}
return $user;
}
}
| {
"content_hash": "ba5dcfac8530d8848eb2359f83913e7e",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 76,
"avg_line_length": 25.355223880597016,
"alnum_prop": 0.6066635271956675,
"repo_name": "Automattic/phabricator",
"id": "d54ca7365140baeadc2cb61b451dc3f2061e8932",
"size": "8494",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/applications/policy/__tests__/PhabricatorPolicyTestCase.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "39828"
},
{
"name": "CSS",
"bytes": "359456"
},
{
"name": "JavaScript",
"bytes": "650315"
},
{
"name": "PHP",
"bytes": "9338280"
},
{
"name": "Shell",
"bytes": "8644"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Workbooster.ObjectDbMapper.Attributes;
namespace Workbooster.ObjectDbMapper.Reflection
{
public static class ReflectionHelper
{
#region PUBLIC METHODS
/// <summary>
/// Reflects an entity and its field (properties and fields) from the given entity data class.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="listOfIgnoredFieldNames"></param>
/// <returns></returns>
public static EntityDefinition GetEntityDefinitionFromType<T>(IEnumerable<string> listOfIgnoredFieldNames = null)
{
EntityDefinition entity = new EntityDefinition();
entity.EntityType = typeof(T);
entity.DbTableName = GetDbTableName<T>();
entity.FieldDefinitions = GetFields<T>(entity, listOfIgnoredFieldNames);
return entity;
}
/// <summary>
/// Sets the given value on the specified field on the given item.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="fieldToSet"></param>
/// <param name="item"></param>
/// <param name="value"></param>
public static void SetValue<T>(this FieldDefinition fieldToSet, T item, object value)
{
PropertyInfo property = fieldToSet.MemberInfo as PropertyInfo;
if (property != null)
{
// it's a property
property.SetValue(item, value, null);
}
else
{
FieldInfo field = fieldToSet.MemberInfo as FieldInfo;
if (field != null)
{
// it's a field
field.SetValue(item, value);
}
}
}
#endregion
#region INTERNAL METHODS
private static string GetDbTableName<T>()
{
// check whether the class is marked with a [Table] attribute
TableAttribute tblAttribute = typeof(T).GetCustomAttributes(typeof(TableAttribute), true).FirstOrDefault() as TableAttribute;
if (tblAttribute != null && !String.IsNullOrEmpty(tblAttribute.Name))
{
// get the tablename from the attribute
return tblAttribute.Name;
}
return null;
}
private static List<FieldDefinition> GetFields<T>(EntityDefinition entity, IEnumerable<string> listOfIgnoredFieldNames = null)
{
List<FieldDefinition> listOfFoundFields = new List<FieldDefinition>();
// load all properties and fields
const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance;
List<MemberInfo> listOfPropertiesAndFields = new List<MemberInfo>();
listOfPropertiesAndFields.AddRange(typeof(T).GetFields(bindingFlags));
listOfPropertiesAndFields.AddRange(typeof(T).GetProperties(bindingFlags));
foreach (var member in listOfPropertiesAndFields)
{
// check whether an ignore attribite is set
if (member.GetCustomAttributes(typeof(IgnoreAttribute), true).Count() == 0)
{
// check whether the field is on the ignore-list
if (listOfIgnoredFieldNames == null || listOfIgnoredFieldNames.Contains(member.Name) == false)
{
FieldDefinition field = new FieldDefinition();
field.MemberInfo = member;
field.MemberName = member.Name;
field.DbColumnName = member.Name;
field.Entity = entity;
if (member is PropertyInfo)
{
field.IsProperty = true;
field.MemberType = ((PropertyInfo)member).PropertyType;
}
else
{
field.IsProperty = false;
field.MemberType = ((FieldInfo)member).FieldType;
}
// check whether the column is marked with a [Column] attribute
ColumnAttribute colAttribute = member.GetCustomAttributes(typeof(ColumnAttribute), true).FirstOrDefault() as ColumnAttribute;
if (colAttribute != null && !String.IsNullOrEmpty(colAttribute.Name))
{
// set the column name from the attribute
field.DbColumnName = colAttribute.Name;
field.DbType = colAttribute.DbType;
}
listOfFoundFields.Add(field);
}
}
}
return listOfFoundFields;
}
#endregion
}
}
| {
"content_hash": "b13c7da3e803ff1aaf93f8c891e9903c",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 149,
"avg_line_length": 37.46666666666667,
"alnum_prop": 0.5405298536971135,
"repo_name": "Workbooster/ObjectDbMapper",
"id": "c1f4931e1b991fc3a4cc7c4003e87733442230d4",
"size": "5060",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Workbooster.ObjectDbMapper/Reflection/ReflectionHelper.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "125892"
}
],
"symlink_target": ""
} |
var Api, DefaultImplementation, DocumentationGenerator, Path, Resource,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
Resource = require("./resource");
DefaultImplementation = require("./impl/default_implementation");
Path = require("path");
DocumentationGenerator = require("./documentation_generator");
Api = (function() {
function Api(options) {
if (options == null) {
options = {};
}
this.title = options.title;
this.description = options.description;
this.version = options.version || "0.0.0";
this._resources = {};
this._impl = new DefaultImplementation();
this._mountedOn = null;
}
Api.prototype.resource = function(model, options) {
return this._resources[model.modelName] = new Resource(model, options);
};
Api.prototype.resources = function(models, options) {
var actions, definition, name, skip, _results;
if (options == null) {
options = {};
}
skip = options.skip || [];
actions = options.actions;
_results = [];
for (name in models) {
definition = models[name];
if (__indexOf.call(skip, name) < 0) {
_results.push(this.resource(definition, {
actions: actions
}));
} else {
_results.push(void 0);
}
}
return _results;
};
Api.prototype.mount = function(app, mountPoint) {
var name, resource, _ref;
if (mountPoint == null) {
mountPoint = "/";
}
_ref = this._resources;
for (name in _ref) {
resource = _ref[name];
this._impl.mount(resource, app, mountPoint);
}
this._mountedOn = mountPoint;
return void 0;
};
Api.prototype.mountDocumentation = function(app, mountPoint) {
var docs, generator, mountPath;
if (mountPoint == null) {
mountPoint = "/";
}
mountPath = mountPoint.indexOf("/") === 0 ? mountPoint : Path.join(this._mountedOn, mountPoint);
generator = new DocumentationGenerator(this, app.routes);
docs = generator.generate();
app.get(mountPath, function(req, res) {
res.setHeader("Content-Type", "text/html");
return res.send(docs);
});
return void 0;
};
Api.prototype.getImplementation = function() {
return this._impl;
};
Api.prototype.setImplementation = function(impl) {
return this._impl = impl;
};
Api.prototype.getResources = function() {
return this._resources;
};
Api.prototype.getTitle = function() {
return this.title;
};
Api.prototype.getDescription = function() {
return this.description;
};
Api.prototype.getVersion = function() {
return this.version;
};
return Api;
})();
module.exports = Api;
| {
"content_hash": "5f9524dd077857359bee962ee67e380f",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 152,
"avg_line_length": 25.85981308411215,
"alnum_prop": 0.6140224069389231,
"repo_name": "koshdnb/mongoose-express-api",
"id": "81110b309046c3b6738e0e59fb9aa89265823e6e",
"size": "2767",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dist/api.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
@interface BSCollectionViewController ()
@end
@implementation BSCollectionViewController {
NSInteger _beforeChangeIndex;
NSInteger _itemsPerPage;
}
- (id)initWithCollectionViewLayout:(UICollectionViewLayout *)layout {
self = [super init];
if (self) {
_collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
[self.view addSubview:_collectionView];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_currentPage = 0;
[self.collectionView setBackgroundColor:[UIColor whiteColor]];
[self.collectionView setScrollEnabled:NO];
}
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
[_collectionView setFrame:self.view.bounds];
}
- (NSArray *)visibleItems {
NSArray *array = [self.scollDataSource itemsForPage:_currentPage];
return array;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)/[collectionView numberOfItemsInSection:0]);
}
- (BOOL)parentViewControllerWantsItemsForward:(BOOL)forward {
_beforeChangeIndex = _currentPage;
switch (forward) {
case YES:
if ([self.scollDataSource numberOfItemsForPageAtIndex:_currentPage + 1] > 0) {
_currentPage++;
[self.collectionView reloadData];
break;
} else {
return NO;
}
case NO:
if (_currentPage - 1 >= 0) {
_currentPage--;
break;
} else {
return NO;
}
}
return YES;
}
- (void)parentViewControllerWantsRollBack {
_currentPage = _beforeChangeIndex;
[self.collectionView reloadData];
}
- (void)parentViewControllerDidFinishAnimatingForward:(BOOL)forward {
if (forward == NO) {
[self.collectionView reloadData];
}
}
- (void)parentViewControllerDidEndPullToRefresh {
[self.collectionView reloadData];
}
- (void)setItems:(NSArray *)items {
_items = items;
[self.collectionView reloadData];
}
@end
| {
"content_hash": "3cd19dd08407a7945e9a3a7cafae3cd5",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 162,
"avg_line_length": 26.080459770114942,
"alnum_prop": 0.6557955046275893,
"repo_name": "piotrbernad/BScrollController",
"id": "66bcf43e96bef45288cef82b53abd99e5461672b",
"size": "2510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BScrollController/Classes/BSCollectionViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "54231"
},
{
"name": "Ruby",
"bytes": "625"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../../style.css');
@import url('../../../../../tree.css');
</style>
<script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../../clover.js" type="text/javascript"></script>
<script src="../../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../../cloud.js" type="text/javascript"></script>
<title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title>
</head>
<body>
<div id="page">
<header id="header" role="banner">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo aui-header-logo-clover">
<a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a>
</h1>
</div>
<div class="aui-header-secondary">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online documentation" target="_blank"
href="http://openclover.org/documentation">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="aui-page-panel-inner">
<div class="aui-page-panel-nav aui-page-panel-nav-clover">
<div class="aui-page-header-inner" style="margin-bottom: 20px;">
<div class="aui-page-header-image">
<a href="http://cardatechnologies.com" target="_top">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</a>
</div>
<div class="aui-page-header-main" >
<h1>
<a href="http://cardatechnologies.com" target="_top">
ABA Route Transit Number Validator 1.0.1-SNAPSHOT
</a>
</h1>
</div>
</div>
<nav class="aui-navgroup aui-navgroup-vertical">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading packages-nav-heading">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui package-filter-container">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="package-filter-no-results-message hidden">
<small>No results found.</small>
</p>
<div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator">
<div class="packages-tree-container"></div>
<div class="clover-packages-lozenges"></div>
</div>
</div>
</div>
</nav> </div>
<section class="aui-page-panel-content">
<div class="aui-page-panel-content-clover">
<div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li>
<li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li>
<li><a href="test-Test_AbaRouteValidator_10.html">Class Test_AbaRouteValidator_10</a></li>
</ol></div>
<h1 class="aui-h2-clover">
Test testAbaNumberCheck_21117_good
</h1>
<table class="aui">
<thead>
<tr>
<th>Test</th>
<th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th>
<th><label title="When the test execution was started">Start time</label></th>
<th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th>
<th><label title="A failure or error message if the test is not successful.">Message</label></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_10.html?line=26873#src-26873" >testAbaNumberCheck_21117_good</a>
</td>
<td>
<span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span>
</td>
<td>
7 Aug 12:39:39
</td>
<td>
0.0 </td>
<td>
<div></div>
<div class="errorMessage"></div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<table class="aui aui-table-sortable">
<thead>
<tr>
<th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th>
<th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_21117_good</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=6934#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a>
</td>
<td>
<span class="sortValue">0.7352941</span>73.5%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td>
</tr>
</tbody>
</table>
</div> <!-- class="aui-page-panel-content-clover" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1
on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT.
</li>
</ul>
<ul>
<li>OpenClover is free and open-source software. </li>
</ul>
</section>
</footer> </section> <!-- class="aui-page-panel-content" -->
</div> <!-- class="aui-page-panel-inner" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html> | {
"content_hash": "4092e6f5e422f90a02e933d94ae92eeb",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 296,
"avg_line_length": 43.92344497607655,
"alnum_prop": 0.5096949891067538,
"repo_name": "dcarda/aba.route.validator",
"id": "e1e3492ccb9f8a4df81e2958bb794695e531451d",
"size": "9180",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_10_testAbaNumberCheck_21117_good_5cm.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "18715254"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/iot/IoT_EXPORTS.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace IoT
{
namespace Model
{
/**
* <p>The output for the DeleteThingType operation.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/DeleteThingTypeResponse">AWS
* API Reference</a></p>
*/
class AWS_IOT_API DeleteThingTypeResult
{
public:
DeleteThingTypeResult();
DeleteThingTypeResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DeleteThingTypeResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
};
} // namespace Model
} // namespace IoT
} // namespace Aws
| {
"content_hash": "c6eec0ceff0ae4b059ec2c71ef37b1fc",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 109,
"avg_line_length": 21.94736842105263,
"alnum_prop": 0.7146282973621103,
"repo_name": "JoyIfBam5/aws-sdk-cpp",
"id": "222398c6da9f57b58f4cfe7cf885d749e37b44b4",
"size": "1407",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-iot/include/aws/iot/model/DeleteThingTypeResult.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "11868"
},
{
"name": "C++",
"bytes": "167818064"
},
{
"name": "CMake",
"bytes": "591577"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "271801"
},
{
"name": "Python",
"bytes": "85650"
},
{
"name": "Shell",
"bytes": "5277"
}
],
"symlink_target": ""
} |
title: Error Installing Module(s) on DNN 4.5.5 at WebHost4Life
date: '2007-08-23T00:27:00.000-04:00'
author: John
tags:
- DotNetNuke
- OSS
modified_time: '2010-09-05T15:52:41.309-04:00'
blogger_id: tag:blogger.com,1999:blog-2811308028656623966.post-7504244834968718211
blogger_orig_url: http://pragmatic-software.blogspot.com/2007/08/error-installing-modules-on-dnn-455-at.html
---
<p>I was setting up a new DNN installation at WH4L and received this error while running the installation wizard. I first tried manually cleaning things out and doing it again only to receive the same error. Turns out the trick is the file permissions on the newly installed modules under \DesktopModules aren't correct. When you receive the errors, simply open a new browser window, login to WH4L control panel, go to Security | File Permission and reset permissions for NETWORK SERVICE with the box check for subfolders. When that's finished, switch back to the installer wizard with the errors still showing and you can now click Next to continue and finish the installation.</p> | {
"content_hash": "48241fad5893c4cd6e556d55ee6868c4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 684,
"avg_line_length": 88.91666666666667,
"alnum_prop": 0.7947516401124649,
"repo_name": "jwatson3d/jwatson3d.github.io",
"id": "d077bfae805eceb80cffd89f91a9e6785da8811f",
"size": "1072",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2007-08-23-error-installing-modules-on-dnn-455-at.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "97033"
},
{
"name": "HTML",
"bytes": "788901"
},
{
"name": "Java",
"bytes": "976"
},
{
"name": "JavaScript",
"bytes": "220271"
},
{
"name": "Ruby",
"bytes": "3039"
}
],
"symlink_target": ""
} |
Archlinux mkinitcpio hook to enable the tinyssh daemon in early userspace
| {
"content_hash": "9b1f5fc3e030520548729e840d42b3e4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 73,
"avg_line_length": 74,
"alnum_prop": 0.8513513513513513,
"repo_name": "grazzolini/mkinitcpio-tinyssh",
"id": "8ddf3c58e11d10605121474e2218a1f040f7459f",
"size": "95",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Shell",
"bytes": "3028"
}
],
"symlink_target": ""
} |
package org.apache.jmeter.protocol.ldap.config.gui;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.config.gui.AbstractConfigGui;
import org.apache.jmeter.config.gui.ArgumentsPanel;
import org.apache.jmeter.gui.util.VerticalPanel;
import org.apache.jmeter.protocol.ldap.sampler.LDAPSampler;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.property.BooleanProperty;
import org.apache.jmeter.testelement.property.StringProperty;
import org.apache.jmeter.testelement.property.TestElementProperty;
import org.apache.jmeter.util.JMeterUtils;
/**
* This class LdapConfigGui is user interface gui for getting all the
* configuration values from the user.
*
* Created Apr 29 2003 11:45 AM
*
*/
public class LdapConfigGui extends AbstractConfigGui implements ItemListener {
private static final long serialVersionUID = 241L;
private JTextField rootdn = new JTextField(20);
private JTextField searchbase = new JTextField(20);
private JTextField searchfilter = new JTextField(20);
private JTextField delete = new JTextField(20);
private JTextField add = new JTextField(20);
private JTextField modify = new JTextField(20);
private JTextField servername = new JTextField(20);
private JTextField port = new JTextField(20);
private JCheckBox userDefined = new JCheckBox(JMeterUtils.getResString("user_defined_test")); // $NON-NLS-1$
private JRadioButton addTest = new JRadioButton(JMeterUtils.getResString("add_test")); // $NON-NLS-1$
private JRadioButton modifyTest = new JRadioButton(JMeterUtils.getResString("modify_test")); // $NON-NLS-1$
private JRadioButton deleteTest = new JRadioButton(JMeterUtils.getResString("delete_test")); // $NON-NLS-1$
private JRadioButton searchTest = new JRadioButton(JMeterUtils.getResString("search_test")); // $NON-NLS-1$
private ButtonGroup bGroup = new ButtonGroup();
private boolean displayName = true;
private ArgumentsPanel tableAddPanel = new ArgumentsPanel(JMeterUtils.getResString("add_test")); // $NON-NLS-1$
private ArgumentsPanel tableModifyPanel = new ArgumentsPanel(JMeterUtils.getResString("modify_test")); // $NON-NLS-1$
private JPanel cards;
/**
* Default constructor for LdapConfigGui.
*/
public LdapConfigGui() {
this(true);
}
/**
* Constructor which sets the displayName.
*
* @param displayName flag, whether to display the name of the component
*/
public LdapConfigGui(boolean displayName) {
this.displayName = displayName;
init();
}
@Override
public String getLabelResource() {
return "ldap_sample_title"; // $NON-NLS-1$
}
/**
* A newly created component can be initialized with the contents of a Test
* Element object by calling this method. The component is responsible for
* querying the Test Element object for the relevant information to display
* in its GUI.
*
* @param element
* the TestElement to configure
*/
@Override
public void configure(TestElement element) {
super.configure(element);
servername.setText(element.getPropertyAsString(LDAPSampler.SERVERNAME));
port.setText(element.getPropertyAsString(LDAPSampler.PORT));
rootdn.setText(element.getPropertyAsString(LDAPSampler.ROOTDN));
CardLayout cl = (CardLayout) (cards.getLayout());
final String testType = element.getPropertyAsString(LDAPSampler.TEST);
if (testType.equals(LDAPSampler.ADD)) {
addTest.setSelected(true);
add.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN));
tableAddPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue());
cl.show(cards, "Add");
} else if (testType.equals(LDAPSampler.MODIFY)) {
modifyTest.setSelected(true);
modify.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN));
tableModifyPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue());
cl.show(cards, "Modify");
} else if (testType.equals(LDAPSampler.DELETE)) {
deleteTest.setSelected(true);
delete.setText(element.getPropertyAsString(LDAPSampler.DELETE));
cl.show(cards, "Delete");
} else if (testType.equals(LDAPSampler.SEARCHBASE)) {
searchTest.setSelected(true);
searchbase.setText(element.getPropertyAsString(LDAPSampler.SEARCHBASE));
searchfilter.setText(element.getPropertyAsString(LDAPSampler.SEARCHFILTER));
cl.show(cards, "Search");
}
if (element.getPropertyAsBoolean(LDAPSampler.USER_DEFINED)) {
userDefined.setSelected(true);
} else {
userDefined.setSelected(false);
cl.show(cards, ""); // $NON-NLS-1$
}
}
/* Implements JMeterGUIComponent.createTestElement() */
@Override
public TestElement createTestElement() {
ConfigTestElement element = new ConfigTestElement();
modifyTestElement(element);
return element;
}
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
@Override
public void modifyTestElement(TestElement element) {
element.clear();
configureTestElement(element);
element.setProperty(LDAPSampler.SERVERNAME, servername.getText());
element.setProperty(LDAPSampler.PORT, port.getText());
element.setProperty(LDAPSampler.ROOTDN, rootdn.getText());
element.setProperty(new BooleanProperty(LDAPSampler.USER_DEFINED, userDefined.isSelected()));
if (addTest.isSelected()) {
element.setProperty(new StringProperty(LDAPSampler.TEST, LDAPSampler.ADD));
element.setProperty(new StringProperty(LDAPSampler.BASE_ENTRY_DN, add.getText()));
element.setProperty(new TestElementProperty(LDAPSampler.ARGUMENTS, tableAddPanel.createTestElement()));
}
if (modifyTest.isSelected()) {
element.setProperty(new StringProperty(LDAPSampler.TEST, LDAPSampler.MODIFY));
element.setProperty(new StringProperty(LDAPSampler.BASE_ENTRY_DN, modify.getText()));
element.setProperty(new TestElementProperty(LDAPSampler.ARGUMENTS, tableModifyPanel.createTestElement()));
}
if (deleteTest.isSelected()) {
element.setProperty(new StringProperty(LDAPSampler.TEST, LDAPSampler.DELETE));
element.setProperty(new StringProperty(LDAPSampler.DELETE, delete.getText()));
}
if (searchTest.isSelected()) {
element.setProperty(new StringProperty(LDAPSampler.TEST, LDAPSampler.SEARCHBASE));
element.setProperty(new StringProperty(LDAPSampler.SEARCHBASE, searchbase.getText()));
element.setProperty(new StringProperty(LDAPSampler.SEARCHFILTER, searchfilter.getText()));
}
}
/**
* Implements JMeterGUIComponent.clearGui
*/
@Override
public void clearGui() {
super.clearGui();
rootdn.setText(""); //$NON-NLS-1$
searchbase.setText(""); //$NON-NLS-1$
searchfilter.setText(""); //$NON-NLS-1$
delete.setText(""); //$NON-NLS-1$
add.setText(""); //$NON-NLS-1$
modify.setText(""); //$NON-NLS-1$
servername.setText(""); //$NON-NLS-1$
port.setText(""); //$NON-NLS-1$
userDefined.setSelected(false);
addTest.setSelected(true);
modifyTest.setSelected(false);
deleteTest.setSelected(false);
searchTest.setSelected(false);
}
/**
* This itemStateChanged listener for changing the card layout for based on
* the test selected in the User defined test case.
*/
@Override
public void itemStateChanged(ItemEvent ie) {
CardLayout cl = (CardLayout) (cards.getLayout());
if (userDefined.isSelected()) {
if (addTest.isSelected()) {
cl.show(cards, "Add");
tableModifyPanel.clear();
modify.setText(""); // $NON-NLS-1$
searchbase.setText(""); // $NON-NLS-1$
searchfilter.setText(""); // $NON-NLS-1$
delete.setText("");
} else if (deleteTest.isSelected()) {
cl.show(cards, "Delete");
tableModifyPanel.clear();
modify.setText(""); // $NON-NLS-1$
tableAddPanel.clear();
add.setText(""); // $NON-NLS-1$
searchbase.setText(""); // $NON-NLS-1$
searchfilter.setText(""); // $NON-NLS-1$
} else if (searchTest.isSelected()) {
cl.show(cards, "Search");
delete.setText(""); // $NON-NLS-1$
tableModifyPanel.clear();
modify.setText(""); // $NON-NLS-1$
tableAddPanel.clear();
add.setText(""); // $NON-NLS-1$
} else if (modifyTest.isSelected()) {
cl.show(cards, "Modify");
tableAddPanel.clear();
add.setText(""); // $NON-NLS-1$
searchbase.setText(""); // $NON-NLS-1$
searchfilter.setText(""); // $NON-NLS-1$
delete.setText("");
} else {
resetCardLayout(cl);
}
} else {
resetCardLayout(cl);
}
}
private void resetCardLayout(CardLayout cl) {
cl.show(cards, ""); // $NON-NLS-1$
tableAddPanel.clear();
add.setText(""); // $NON-NLS-1$
tableModifyPanel.clear();
modify.setText(""); // $NON-NLS-1$
searchbase.setText(""); // $NON-NLS-1$
searchfilter.setText(""); // $NON-NLS-1$
delete.setText(""); // $NON-NLS-1$
}
/**
* This will create the servername panel in the LdapConfigGui.
*/
private JPanel createServernamePanel() {
return createLabelPanel("servername", servername);
}
/**
* This will create the port panel in the LdapConfigGui.
*/
private JPanel createPortPanel() {
return createLabelPanel("port", port);
}
/**
* This will create the Root distinguised name panel in the LdapConfigGui.
*/
private JPanel createRootdnPanel() {
return createLabelPanel("dn", rootdn);
}
/**
* This will create the Search panel in the LdapConfigGui.
*/
private JPanel createSearchPanel() {
VerticalPanel searchPanel = new VerticalPanel();
searchPanel.add(createLabelPanel("search_base", searchbase));
searchPanel.add(createLabelPanel("search_filter", searchfilter));
return searchPanel;
}
/**
* This will create the Delete panel in the LdapConfigGui.
*/
private JPanel createDeletePanel() {
VerticalPanel panel = new VerticalPanel();
panel.add(createLabelPanel("delete", delete));
return panel;
}
/**
* This will create the Add test panel in the LdapConfigGui.
*/
private JPanel createAddPanel() {
JPanel addPanel = new JPanel(new BorderLayout(5, 0));
addPanel.add(createLabelPanel("entry_dn", add), BorderLayout.NORTH);
addPanel.add(tableAddPanel, BorderLayout.CENTER);
return addPanel;
}
/**
* Create a panel with the text field and a label
*
* @param key
* to look up the label by using
* {@link JMeterUtils#getResString(String)}
* @param field
* text field to display
* @return newly created panel
*/
private JPanel createLabelPanel(String key, JTextField field) {
JPanel addInnerPanel = new JPanel(new BorderLayout(5, 0));
JLabel label = new JLabel(JMeterUtils.getResString(key)); // $NON-NLS-1$
label.setLabelFor(field);
addInnerPanel.add(label, BorderLayout.WEST);
addInnerPanel.add(field, BorderLayout.CENTER);
return addInnerPanel;
}
/**
* This will create the Modify panel in the LdapConfigGui.
*/
private JPanel createModifyPanel() {
JPanel modifyPanel = new JPanel(new BorderLayout(5, 0));
modifyPanel.add(createLabelPanel("entry_dn", modify), BorderLayout.NORTH);
modifyPanel.add(tableModifyPanel, BorderLayout.CENTER);
return modifyPanel;
}
/**
* This will create the user defined test panel for create or modify or
* delete or search based on the panel selected in the itemevent in the
* LdapConfigGui.
*/
private JPanel testPanel() {
cards = new JPanel(new CardLayout());
cards.add(new JPanel(), "");
cards.add(createAddPanel(), "Add");
cards.add(createModifyPanel(), "Modify");
cards.add(createDeletePanel(), "Delete");
cards.add(createSearchPanel(), "Search");
return cards;
}
/**
* This will create the test panel in the LdapConfigGui.
*/
private JPanel createTestPanel() {
JPanel testPanel = new JPanel(new BorderLayout());
testPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("test_configuration"))); // $NON-NLS-1$
testPanel.add(new JLabel(JMeterUtils.getResString("test"))); // $NON-NLS-1$
JPanel rowPanel = new JPanel();
rowPanel.add(addTest);
bGroup.add(addTest);
rowPanel.add(deleteTest);
bGroup.add(deleteTest);
rowPanel.add(searchTest);
bGroup.add(searchTest);
rowPanel.add(modifyTest);
bGroup.add(modifyTest);
testPanel.add(rowPanel, BorderLayout.NORTH);
testPanel.add(userDefined, BorderLayout.CENTER);
return testPanel;
}
/**
* This will initialise all the panel in the LdapConfigGui.
*/
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
setLayout(new BorderLayout(0, 5));
if (displayName) {
setBorder(makeBorder());
add(makeTitlePanel(), BorderLayout.NORTH);
}
VerticalPanel mainPanel = new VerticalPanel();
mainPanel.add(createServernamePanel());
mainPanel.add(createPortPanel());
mainPanel.add(createRootdnPanel());
mainPanel.add(createTestPanel());
mainPanel.add(testPanel());
add(mainPanel, BorderLayout.CENTER);
userDefined.addItemListener(this);
addTest.addItemListener(this);
modifyTest.addItemListener(this);
deleteTest.addItemListener(this);
searchTest.addItemListener(this);
}
}
| {
"content_hash": "9da8040724188bc132d4b88e06fe161f",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 125,
"avg_line_length": 37.11491442542787,
"alnum_prop": 0.6407114624505929,
"repo_name": "d0k1/jmeter",
"id": "b19425df25ea2e34b85acb25759da12b75afd035",
"size": "15982",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LdapConfigGui.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "21218"
},
{
"name": "CSS",
"bytes": "36983"
},
{
"name": "HTML",
"bytes": "93491"
},
{
"name": "Java",
"bytes": "7498610"
},
{
"name": "JavaScript",
"bytes": "58096"
},
{
"name": "Shell",
"bytes": "17485"
},
{
"name": "XSLT",
"bytes": "57215"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>hoare-tut: 22 s 🏆</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.12.2 / hoare-tut - 8.11.1</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
hoare-tut
<small>
8.11.1
<span class="label label-success">22 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-18 00:27:54 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-18 00:27:54 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.12.2 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.11.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.11.2 Official release 4.11.2
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
authors: [
"Sylvain Boulmé"
]
maintainer: "kartiksinghal@gmail.com"
homepage: "https://github.com/coq-community/hoare-tut"
dev-repo: "git+https://github.com/coq-community/hoare-tut.git"
bug-reports: "https://github.com/coq-community/hoare-tut/issues"
license: "LGPL-3.0-or-later"
synopsis: "A Tutorial on Reflecting in Coq the generation of Hoare proof obligations"
description: """
Hoare logics are "program logics" suitable for reasoning about
imperative programs.
This work is both an introduction to Hoare logic and a demo
illustrating Coq nice features. It formalizes the generation of PO
(proof obligations) in a Hoare logic for a very basic imperative
programming language. It proves the soundness and the completeness of
the PO generation both in partial and total correctness. At last, it
examplifies on a very simple example (a GCD computation) how the PO
generation can simplify concrete proofs. Coq is indeed able to compute
PO on concrete programs: we say here that the generation of proof
obligations is reflected in Coq. Technically, the PO generation is
here performed through Dijkstra's weakest-precondition calculus.
"""
build: [make "-j%{jobs}%" ]
install: [make "install"]
depends: [
"coq" {>= "8.8" & < "8.13~"}
]
tags: [
"category:Mathematics/Logic"
"category:Computer Science/Semantics and Compilation/Semantics"
"keyword:Hoare logic"
"keyword:imperative program"
"keyword:weakest precondition"
"keyword:reflection"
"logpath:HoareTut"
]
url {
src: "https://github.com/coq-community/hoare-tut/archive/v8.11.1.tar.gz"
checksum: [
"md5=a7d240c73b36b91d4e703dfa75de7aaf"
"sha512=146bf09aea7bb98b430148113426c6c85e9b69c9d5b8c9c509bb56a1e85392f7511568b37a091b1384ced9f866b75bd7e2b49dc6cfac2309fab5383e0443698f"
]
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-hoare-tut.8.11.1 coq.8.12.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-hoare-tut.8.11.1 coq.8.12.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>11 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-hoare-tut.8.11.1 coq.8.12.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>22 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 445 K</p>
<ul>
<li>100 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/exgcd.vo</code></li>
<li>82 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/totalhoarelogic.vo</code></li>
<li>62 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/hoarelogicsemantics.vo</code></li>
<li>43 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/hoarelogic.vo</code></li>
<li>35 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/partialhoarelogic.vo</code></li>
<li>29 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/totalhoarelogic.glob</code></li>
<li>23 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/exgcd.glob</code></li>
<li>18 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/hoarelogicsemantics.glob</code></li>
<li>13 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/hoarelogic.glob</code></li>
<li>11 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/totalhoarelogic.v</code></li>
<li>9 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/partialhoarelogic.glob</code></li>
<li>7 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/hoarelogicsemantics.v</code></li>
<li>7 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/exgcd.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/partialhoarelogic.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.11.2/lib/coq/user-contrib/HoareTut/hoarelogic.v</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-hoare-tut.8.11.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "d557c04ff25345b23d3dfa51a3c2a56b",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 159,
"avg_line_length": 47.689119170984455,
"alnum_prop": 0.5846371142981313,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "6248c69b3b37c40130f5ff82d7c321b4e750d2d8",
"size": "9230",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.11.2-2.0.7/released/8.12.2/hoare-tut/8.11.1.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
mirrors-site
============
Welcome to takeseem.com Open Source Mirror Site
| {
"content_hash": "c26108b356226f83d4cbc174f962bf4d",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 47,
"avg_line_length": 18.75,
"alnum_prop": 0.68,
"repo_name": "takeseem-com/mirrors-site",
"id": "a510b01df732205989dd4b0e0fdc223cb4458dbe",
"size": "75",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
try:
import pyflakes
pyflakes # avoid unused warning when validating self!
except ImportError:
print("Validate requires pyflakes. Please install " "with: pip install pyflakes")
exit()
import argparse
import os
from subprocess import call
import re
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname + "/..")
path_in_hidden_folders = re.compile(r"^(.*/)?\.[^/]+/.+$")
# Options
parser = argparse.ArgumentParser(
description="Recursively validates all "
"python files with pyflakes that were modified since the last "
"validation,and provides basic stats. Ignores hidden directories."
)
parser.add_argument(
"--all",
dest="all",
action="store_true",
default=False,
help="check all files, regardless of last modification " "and validation dates",
)
parser.add_argument(
"--stats",
dest="stats",
action="store_true",
default=False,
help="return statistics on Python " "files (line count, etc)",
)
args = parser.parse_args()
# Setup
skip_paths = []
# Stats
file_count = 0
validated_count = 0
validated_issue_count = 0
line_count = 0
print("\n---- Validating all files ----")
for dirname, dirnames, filenames in os.walk("."):
for filename in filenames:
if filename.endswith(".py"):
# File details
path = os.path.join(dirname, filename)
# print("PATH: " + path)
# Skip
if "/venv/" in path:
continue
if path in skip_paths:
continue
if path_in_hidden_folders.match(path):
continue
# Validate
file_count += 1
mtime = int(os.stat(path).st_mtime)
if call(["pyflakes", path]):
validated_issue_count += 1
if call(["pep8", path]):
validated_issue_count += 1
validated_count += 1
# Stats
if args.stats:
line_count += sum(1 for line in open(path))
if validated_issue_count == 0:
print("ALL OKAY")
print("\n---- Validation summary ----")
print("Files with validation issues: %i" % validated_issue_count)
print("Validated files: %i" % validated_count)
print("Total python files: %i" % file_count)
# Print stats
if args.stats:
print("\n---- Stats ----")
print("Total python line count: %i" % line_count)
# Finish
print("")
| {
"content_hash": "f35141598876deb5e6f981effa02a022",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 85,
"avg_line_length": 25.48421052631579,
"alnum_prop": 0.5968608013217679,
"repo_name": "autolab/Tango",
"id": "546db78b8d076cd9b5db5394346ece46ed3f03ad",
"size": "2585",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/validate.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "16426"
},
{
"name": "Dockerfile",
"bytes": "2480"
},
{
"name": "Makefile",
"bytes": "604"
},
{
"name": "Python",
"bytes": "181372"
},
{
"name": "Shell",
"bytes": "4806"
}
],
"symlink_target": ""
} |
<?php
include_once 'header.php';
include_once 'includes/alternatif.inc.php';
$pro = new Alternatif($db);
$stmt = $pro->readAll();
$count = $pro->countAll();
if(isset($_POST['hapus-contengan'])){
$imp = "('".implode("','",array_values($_POST['checkbox']))."')";
$result = $pro->hapusell($imp);
if($result){
?>
<script type="text/javascript">
window.onload=function(){
showSuccessToast();
setTimeout(function(){
window.location.reload(1);
history.go(0)
location.href = location.href
}, 5000);
};
</script>
<?php
} else{
?>
<script type="text/javascript">
window.onload=function(){
showErrorToast();
setTimeout(function(){
window.location.reload(1);
history.go(0)
location.href = location.href
}, 5000);
};
</script>
<?php
}
}
?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-2">
<?php
include_once 'sidebar.php';
?>
</div>
<div class="col-xs-12 col-sm-12 col-md-10">
<ol class="breadcrumb">
<li><a href="index.php"><span class="fa fa-home"></span> Beranda</a></li>
<li class="active"><span class="fa fa-book"></span> Data Alternatif</li>
</ol>
<form method="post">
<div class="row">
<div class="col-md-6 text-left">
<strong style="font-size:18pt;"><span class="fa fa-book"></span> Data Alternatif</strong>
</div>
<div class="col-md-6 text-right">
<button type="button" onclick="location.href='data-alternatif-baru.php'" class="btn btn-primary"><span class="fa fa-clone"></span> Tambah Data</button>
</div>
</div>
<br/>
<table width="100%" class="table table-striped table-bordered" id="tabeldata">
<thead>
<tr>
<th width="10px"><input type="checkbox" name="select-all" id="select-all" /></th>
<th>ID Alternatif</th>
<th>Nama Alternatif</th>
<th>Hasil Akhir</th>
<th width="100px">Aksi</th>
</tr>
</thead>
<tfoot>
<tr>
<th><input type="checkbox" name="select-all2" id="select-all2" /></th>
<th>ID Alternatif</th>
<th>Nama Alternatif</th>
<th>Hasil Akhir</th>
<th>Aksi</th>
</tr>
</tfoot>
<tbody>
<?php
$no=1;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
?>
<tr>
<td style="vertical-align:middle;"><input type="checkbox" value="<?php echo $row['id_alternatif'] ?>" name="checkbox[]" /></td>
<td style="vertical-align:middle;"><?php echo $row['id_alternatif'] ?></td>
<td style="vertical-align:middle;"><?php echo $row['nama_alternatif'] ?></td>
<td style="vertical-align:middle;"><?php echo $row['hasil_akhir'] ?></td>
<td class="text-center" style="vertical-align:middle;">
<a href="data-alternatif-ubah.php?id=<?php echo $row['id_alternatif'] ?>" class="btn btn-warning"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
<a href="data-alternatif-hapus.php?id=<?php echo $row['id_alternatif'] ?>" onclick="return confirm('Yakin ingin menghapus data')" class="btn btn-danger"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</form>
</div>
</div>
<?php
include_once 'footer.php';
?> | {
"content_hash": "dc293bcab9a57355a19963ab22035879",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 228,
"avg_line_length": 33.88990825688074,
"alnum_prop": 0.5178668110449377,
"repo_name": "aldhi253/Aplikasi_SPK_Dengan_PHP",
"id": "0ef712f5f4a0744fa589299ff516dd7a665ab4e2",
"size": "3694",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data-alternatif.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3559"
},
{
"name": "HTML",
"bytes": "148926"
},
{
"name": "JavaScript",
"bytes": "133291"
},
{
"name": "PHP",
"bytes": "249468"
}
],
"symlink_target": ""
} |
package io.github.factoryfx.factory.storage.migration.datamigration;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import io.github.factoryfx.factory.FactoryBase;
import io.github.factoryfx.factory.jackson.SimpleObjectMapper;
import io.github.factoryfx.factory.storage.migration.metadata.DataStorageMetadataDictionary;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class DataJsonNode {
private final ObjectNode jsonNode;
public DataJsonNode(ObjectNode jsonNode) {
this.jsonNode = jsonNode;
}
public void removeAttribute(String name){
jsonNode.remove(name);
}
public String getDataClassName(){
return jsonNode.get("@class").textValue();
}
public boolean match(String dataClassNameFullQualified){
return getDataClassName().equals(dataClassNameFullQualified);
}
public void renameAttribute(String previousAttributeName, String newAttributeName) {
jsonNode.set(newAttributeName, jsonNode.get(previousAttributeName));
jsonNode.remove(previousAttributeName);
}
public void renameClass(Class<? extends FactoryBase<?,?>> newDataClass) {
jsonNode.set("@class",new TextNode(newDataClass.getName()));
}
public DataJsonNode getChild(String attributeName) {
JsonNode attribute = jsonNode.get(attributeName);
if (attribute==null){
return null;
}
return new DataJsonNode((ObjectNode)attribute.get("v"));
}
public DataJsonNode getChild(String attributeName, int index) {
if (!jsonNode.get(attributeName).isArray()){
throw new IllegalArgumentException("is not a reflist attribute: "+attributeName);
}
return new DataJsonNode((ObjectNode)jsonNode.get(attributeName).get(index));
}
public JsonNode getAttributeValue(String attribute) {
if (jsonNode.get(attribute)==null){
return null;
}
if (jsonNode.get(attribute).isArray()){
return jsonNode.get(attribute);
}
return jsonNode.get(attribute).get("v");
}
public void setAttributeValue(String attribute, JsonNode jsonNode) {
try {
if (jsonNode==null) {
((ObjectNode)this.jsonNode.get(attribute)).remove("v");
}
ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
this.jsonNode.set(attribute, objectNode);
objectNode.set("v",jsonNode);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public <V> V getAttributeValue(String attributeName, Class<V> valueClass, SimpleObjectMapper simpleObjectMapper) {
JsonNode attributeValue = getAttributeValue(attributeName);
if (attributeValue==null){
return null;
}
return simpleObjectMapper.treeToValue(attributeValue, valueClass);
}
public <V> V getArrayAttributeValue(String attributeName, Class<V> valueClass, SimpleObjectMapper simpleObjectMapper, int index) {
ArrayNode attributeValue = (ArrayNode) getAttributeValue(attributeName);
return simpleObjectMapper.treeToValue(attributeValue.get(index), valueClass);
}
public String getAttributeIdValue(String attributeName) {
return jsonNode.get(attributeName).get("v").asText();
}
private boolean isData(JsonNode jsonNode){
if (jsonNode==null){
return false;
}
if (jsonNode.fieldNames().hasNext()){
String fieldName = jsonNode.fieldNames().next();
return "@class".equals(fieldName);
}
return false;
}
public boolean isData(){
return isData(this.jsonNode);
}
private void collectChildrenDeep(List<DataJsonNode> dataJsonNodes){
for (JsonNode element : jsonNode) {
if (element.isArray()) {
for (JsonNode arrayElement : element) {
if (isData(arrayElement)) {
DataJsonNode child = new DataJsonNode((ObjectNode) arrayElement);
dataJsonNodes.add(child);
child.collectChildrenDeep(dataJsonNodes);
}
}
} else {
if (isData(element.get("v"))) {
DataJsonNode child = new DataJsonNode((ObjectNode) element.get("v"));
dataJsonNodes.add(child);
child.collectChildrenDeep(dataJsonNodes);
}
}
}
}
/**
* get children including himself
* @return children
*/
public List<DataJsonNode> collectChildrenFromRoot(){
List<DataJsonNode> dataJsonNode = new ArrayList<>();
dataJsonNode.add(this);
this.collectChildrenDeep(dataJsonNode);
return dataJsonNode;
}
/**
* reset the ids, (first occurrence is the object following are id references)
* @param collected for recursion
*/
private void replaceDuplicateFactoriesWidthIdDeep(HashSet<String> collected){
this.visitAttributes((value, jsonNodeConsumer) -> {
if (isData(value)) {
DataJsonNode child = new DataJsonNode((ObjectNode) value);
if (collected.add(child.getId())) {
child.replaceDuplicateFactoriesWidthIdDeep(collected);
} else {
jsonNodeConsumer.accept(new TextNode(child.getId()));
}
}
});
}
/**
* replace all id refs with object
* result is json without ids
* @param idToDataJsonNode to resolve id
*/
private void replaceIdRefsWidthFactoriesDeep(Map<String,DataJsonNode> idToDataJsonNode){
this.visitAttributes((value, jsonNodeConsumer) -> {
if (value.isTextual() && idToDataJsonNode.containsKey(value.asText())){
jsonNodeConsumer.accept(idToDataJsonNode.get(value.asText()).jsonNode);
}
if (isData(value)){
new DataJsonNode((ObjectNode) value).replaceIdRefsWidthFactoriesDeep(idToDataJsonNode);
}
});
}
//TODO return UUID
public String getId() {
return jsonNode.get("id").asText();
}
public <D> D asData(Class<D> valueClass, SimpleObjectMapper simpleObjectMapper) {
return simpleObjectMapper.treeToValue(jsonNode, valueClass);
}
public List<String> getAttributes(){
ArrayList<String> result = new ArrayList<>();
Iterator<Map.Entry<String, JsonNode>> field = jsonNode.fields();
while (field.hasNext()) {
Map.Entry<String, JsonNode> element = field.next();
if (element.getValue().isObject()){
result.add(element.getKey());
}
if (element.getValue().isArray()){
result.add(element.getKey());
}
}
return result;
}
public Map<String,DataJsonNode> collectChildrenMapFromRoot() {
HashMap<String, DataJsonNode> result = new HashMap<>();
for (DataJsonNode dataJsonNode : collectChildrenFromRoot()) {
result.put(dataJsonNode.getId(),dataJsonNode);
}
return result;
}
Map<String, DataJsonNode> cache;
public Map<String,DataJsonNode> collectChildrenMapFromRootCached() {
if (cache==null){
cache=collectChildrenMapFromRoot();
}
return cache;
}
public void applyRemovedAttribute(DataStorageMetadataDictionary dataStorageMetadataDictionary){
for (String attributeVariableName : this.getAttributes()) {
if (dataStorageMetadataDictionary.isRemovedAttribute(getDataClassName(),attributeVariableName)){
this.jsonNode.remove(attributeVariableName);
}
}
}
public void applyRetypedAttribute(DataStorageMetadataDictionary dataStorageMetadataDictionary){
for (String attributeVariableName : this.getAttributes()) {
if (dataStorageMetadataDictionary.isRetypedAttribute(getDataClassName(),attributeVariableName)){
this.setAttributeValue(attributeVariableName,null);
}
}
}
public void applyRemovedClasses(DataStorageMetadataDictionary dataStorageMetadataDictionary) {
this.visitAttributes((jsonNode, jsonNodeConsumer) -> {
if (isData(jsonNode)) {
if (dataStorageMetadataDictionary.getDataStorageMetadata(new DataJsonNode((ObjectNode) jsonNode).getDataClassName()).isRemovedClass()){
jsonNodeConsumer.accept(null);
}
}
});
}
/**
* fix objects in removed attributes.
*
* References are serialized using JsonIdentityInfo
* That means first occurrence is the object and following are just the ids
* If the first occurrence is a removed attribute Jackson can't read the reference.
*
* @param idToChild idToChild
*/
public void fixIdsDeepFromRoot(Map<String, DataJsonNode> idToChild){
replaceIdRefsWidthFactoriesDeep(idToChild);
//reset the ids, (first occurrence is the object following are id references)
this.replaceDuplicateFactoriesWidthIdDeep(new HashSet<>());
}
private void visitAttributes(BiConsumer<JsonNode,Consumer<JsonNode>> attributeConsumer) {
for (String attributeVariableName : this.getAttributes()) {
JsonNode attributeValue = this.getAttributeValue(attributeVariableName);
if (attributeValue != null) {
if (attributeValue.isArray()) {
List<Integer> removed = new ArrayList<>();
for (int i=0;i<(attributeValue).size();i++) {
final int setIndex=i;
attributeConsumer.accept(attributeValue.get(i), (value) -> {
if (value==null) {
removed.add(setIndex);
} else {
((ArrayNode) attributeValue).set(setIndex, value);
}
});
for (Integer removedIndex : removed) {
((ArrayNode) attributeValue).remove(removedIndex);
}
}
} else {
attributeConsumer.accept(attributeValue, (value) -> this.setAttributeValue(attributeVariableName, value));
}
}
}
}
public JsonNode getJsonNode(){
return this.jsonNode;
}
}
| {
"content_hash": "38f38df27fe19d1d75396c2e3f030b5a",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 151,
"avg_line_length": 36.325581395348834,
"alnum_prop": 0.6168831168831169,
"repo_name": "factoryfx/factoryfx",
"id": "b2f868a227216cc25a7785d2962e737dab479c79",
"size": "10934",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "factory/src/main/java/io/github/factoryfx/factory/storage/migration/datamigration/DataJsonNode.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2175"
},
{
"name": "HTML",
"bytes": "3322"
},
{
"name": "Java",
"bytes": "2095814"
},
{
"name": "JavaScript",
"bytes": "105762"
},
{
"name": "TypeScript",
"bytes": "145605"
}
],
"symlink_target": ""
} |
//go:generate stringer -output types_industry_string.go -type=ActivityType
package evego
import "fmt"
// ActivityType is an industrial activity performed on or resulting in
// a blueprint.
type ActivityType int
// The ActivityType values.
const (
None ActivityType = iota
Manufacturing
ResearchingTechnology
ResearchingTE
ResearchingME
Copying
Duplicating
ReverseEngineering
Invention
)
// IndustryActivity is an action (e.g. invention) taken on an input item
// (e.g. Vexor Blueprint) producing a result (e.g. Ishtar Blueprint).
type IndustryActivity struct {
InputItem *Item
ActivityType ActivityType
OutputItem *Item
OutputQuantity int
}
func (i IndustryActivity) String() string {
return fmt.Sprintf("Activity %v: %v -> %d x %v", i.ActivityType, i.InputItem,
i.OutputQuantity, i.OutputItem)
}
| {
"content_hash": "c9ed55964b3aac4194ec4283cc34aa8d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 22.45945945945946,
"alnum_prop": 0.7569193742478941,
"repo_name": "backerman/evego",
"id": "0ea0a76f150e3f4c34b80570611cffc1458fb178",
"size": "1395",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "types_industry.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "202710"
},
{
"name": "PLpgSQL",
"bytes": "4563"
},
{
"name": "Python",
"bytes": "2387"
},
{
"name": "Shell",
"bytes": "11840"
}
],
"symlink_target": ""
} |
Rails.application.routes.draw do
devise_for :users, controllers: {registrations: 'auth/registrations',
confirmations: 'auth/confirmations',
passwords: 'auth/passwords',
sessions: 'auth/sessions'}
concern :paginatable do
get '(page/:page)', action: :index, on: :collection, as: ''
end
root 'pages#home'
resources :articles, only: [:index, :show]
end
| {
"content_hash": "9a591c52185b2a0a97f85020eedc5d11",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 71,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.5416666666666666,
"repo_name": "pineapplethief/rubyvoodoo",
"id": "9ee3d688893aea67c9dac4128d30b8cbb2f47460",
"size": "480",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/routes.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "48"
},
{
"name": "HTML",
"bytes": "6349"
},
{
"name": "JavaScript",
"bytes": "110"
},
{
"name": "Nginx",
"bytes": "3755"
},
{
"name": "Ruby",
"bytes": "85917"
}
],
"symlink_target": ""
} |
<?php
namespace Lv\ShopBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('lv_shop');
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
}
}
| {
"content_hash": "9235419abfce7cc2995a3b3c24053255",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 131,
"avg_line_length": 29.96551724137931,
"alnum_prop": 0.713463751438435,
"repo_name": "jonnobi/symfony2",
"id": "915933c870a71edf3fb6a53470374ed3a6a36423",
"size": "869",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Lv/ShopBundle/DependencyInjection/Configuration.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "155939"
}
],
"symlink_target": ""
} |
@interface HMPhotoBrowserAnimator() <UIViewControllerAnimatedTransitioning>
@end
@implementation HMPhotoBrowserAnimator {
BOOL _isPresenting;
HMPhotoBrowserPhotos *_photos;
}
#pragma mark - 构造函数
+ (instancetype)animatorWithPhotos:(HMPhotoBrowserPhotos *)photos {
return [[self alloc] initWithPhotos:photos];
}
- (instancetype)initWithPhotos:(HMPhotoBrowserPhotos *)photos {
self = [super init];
if (self) {
_photos = photos;
}
return self;
}
#pragma mark - UIViewControllerTransitioningDelegate
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
_isPresenting = YES;
return self;
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
_isPresenting = NO;
return self;
}
#pragma mark - UIViewControllerAnimatedTransitioning
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext {
return 0.5;
}
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
_isPresenting ? [self presentTransition:transitionContext] : [self dismissTransition:transitionContext];
}
#pragma mark - 展现转场动画方法
- (void)presentTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
UIView *containerView = [transitionContext containerView];
UIImageView *dummyIV = [self dummyImageView];
UIImageView *parentIV = [self parentImageView];
dummyIV.frame = [containerView convertRect:parentIV.frame fromView:parentIV.superview];
[containerView addSubview:dummyIV];
UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey];
[containerView addSubview:toView];
toView.alpha = 0.0;
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
dummyIV.frame = [self presentRectWithImageView:dummyIV];
} completion:^(BOOL finished) {
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
toView.alpha = 1.0;
} completion:^(BOOL finished) {
[dummyIV removeFromSuperview];
[transitionContext completeTransition:YES];
}];
}];
}
/// 根据图像计算展现目标尺寸
- (CGRect)presentRectWithImageView:(UIImageView *)imageView {
UIImage *image = imageView.image;
if (image == nil) {
return imageView.frame;
}
CGSize screenSize = [UIScreen mainScreen].bounds.size;
CGSize imageSize = screenSize;
imageSize.height = image.size.height * imageSize.width / image.size.width;
CGRect rect = CGRectMake(0, 0, imageSize.width, imageSize.height);
if (imageSize.height < screenSize.height) {
rect.origin.y = (screenSize.height - imageSize.height) * 0.5;
}
return rect;
}
/// 生成 dummy 图像视图
- (UIImageView *)dummyImageView {
UIImageView *iv = [[UIImageView alloc] initWithImage:[self dummyImage]];
iv.contentMode = UIViewContentModeScaleAspectFill;
iv.clipsToBounds = YES;
return iv;
}
/// 生成 dummy 图像
- (UIImage *)dummyImage {
NSString *key = _photos.urls[_photos.selectedIndex];
UIImage *image = [[YYWebImageManager sharedManager].cache getImageForKey:key];
if (image == nil) {
image = _photos.parentImageViews[_photos.selectedIndex].image;
}
return image;
}
/// 父视图参考图像视图
- (UIImageView *)parentImageView {
return _photos.parentImageViews[_photos.selectedIndex];
}
#pragma mark - 解除转场动画方法
- (void)dismissTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
UIView *containerView = [transitionContext containerView];
UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
UIImageView *dummyIV = [self dummyImageView];
dummyIV.frame = [containerView convertRect:_fromImageView.frame fromView:_fromImageView.superview];
dummyIV.alpha = fromView.alpha;
[containerView addSubview:dummyIV];
[fromView removeFromSuperview];
UIImageView *parentIV = [self parentImageView];
CGRect targetRect = [containerView convertRect:parentIV.frame fromView:parentIV.superview];
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
dummyIV.frame = targetRect;
dummyIV.alpha = 1.0;
} completion:^(BOOL finished) {
[dummyIV removeFromSuperview];
[transitionContext completeTransition:YES];
}];
}
@end
| {
"content_hash": "62ea6181fd07a0d301d1100bef63927f",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 214,
"avg_line_length": 31.449664429530202,
"alnum_prop": 0.7148954332052924,
"repo_name": "itheima-developer/HMPhotoBrowser",
"id": "c6c9c600a386b2a1bff624d3983dc864b56c58e9",
"size": "5037",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "HMPhotoBrowser/PhotoBrowser/HMPhotoBrowserAnimator.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "40976"
},
{
"name": "Ruby",
"bytes": "757"
}
],
"symlink_target": ""
} |
package mesosphere.marathon.tasks
import mesosphere.marathon.core.task.Task
import org.apache.mesos.Protos.TaskID
import org.scalatest.{ Matchers, FunSuite }
import mesosphere.marathon.state.PathId._
class TaskIdTest extends FunSuite with Matchers {
test("AppIds can be converted to TaskIds and back to AppIds") {
val appId = "/test/foo/bla/rest".toPath
val taskId = Task.Id.forApp(appId)
taskId.appId should equal(appId)
}
test("Old TaskIds can be converted") {
val taskId = Task.Id(TaskID.newBuilder().setValue("app_682ebe64-0771-11e4-b05d-e0f84720c54e").build)
taskId.appId should equal("app".toRootPath)
}
test("Old TaskIds can be converted even if they have dots in them") {
val taskId = Task.Id(TaskID.newBuilder().setValue("app.foo.bar_682ebe64-0771-11e4-b05d-e0f84720c54e").build)
taskId.appId should equal("app.foo.bar".toRootPath)
}
test("Old TaskIds can be converted even if they have underscores in them") {
val taskId = Task.Id(TaskID.newBuilder().setValue("app_foo_bar_0-12345678").build)
taskId.appId should equal("/app/foo/bar".toRootPath)
}
}
| {
"content_hash": "0312cab5c5a814790a032a590808cede",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 112,
"avg_line_length": 37.266666666666666,
"alnum_prop": 0.7334525939177102,
"repo_name": "titosand/marathon",
"id": "8cca7d6b09901187557dffe4a5f4b864812853e4",
"size": "1118",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/test/scala/mesosphere/marathon/tasks/TaskIdTest.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "10767"
},
{
"name": "Protocol Buffer",
"bytes": "66732"
},
{
"name": "Scala",
"bytes": "2334520"
},
{
"name": "Shell",
"bytes": "15742"
}
],
"symlink_target": ""
} |
namespace cc {
namespace {
scoped_ptr<LayerImpl> layerImplForScrollAreaAndScrollbar(
FakeLayerTreeHostImpl* host_impl,
scoped_ptr<WebKit::WebScrollbar> scrollbar,
bool reverse_order)
{
scoped_refptr<Layer> layerTreeRoot = Layer::create();
scoped_refptr<Layer> child1 = Layer::create();
scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(true), child1->id());
layerTreeRoot->addChild(child1);
layerTreeRoot->insertChild(child2, reverse_order ? 0 : 1);
scoped_ptr<LayerImpl> layerImpl = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), host_impl->activeTree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImpl.get());
return layerImpl.Pass();
}
TEST(ScrollbarLayerTest, resolveScrollLayerPointer)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
{
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
scoped_ptr<LayerImpl> layerImplTreeRoot = layerImplForScrollAreaAndScrollbar(&hostImpl, scrollbar.Pass(), false);
LayerImpl* ccChild1 = layerImplTreeRoot->children()[0];
ScrollbarLayerImpl* ccChild2 = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]);
EXPECT_EQ(ccChild1->horizontalScrollbarLayer(), ccChild2);
}
{ // another traverse order
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
scoped_ptr<LayerImpl> layerImplTreeRoot = layerImplForScrollAreaAndScrollbar(&hostImpl, scrollbar.Pass(), true);
ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[0]);
LayerImpl* ccChild2 = layerImplTreeRoot->children()[1];
EXPECT_EQ(ccChild2->horizontalScrollbarLayer(), ccChild1);
}
}
TEST(ScrollbarLayerTest, shouldScrollNonOverlayOnMainThread)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
// Create and attach a non-overlay scrollbar.
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
static_cast<FakeWebScrollbar*>(scrollbar.get())->setOverlay(false);
scoped_ptr<LayerImpl> layerImplTreeRoot = layerImplForScrollAreaAndScrollbar(&hostImpl, scrollbar.Pass(), false);
ScrollbarLayerImpl* scrollbarLayerImpl = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]);
// When the scrollbar is not an overlay scrollbar, the scroll should be
// responded to on the main thread as the compositor does not yet implement
// scrollbar scrolling.
EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, scrollbarLayerImpl->tryScroll(gfx::Point(0, 0), InputHandlerClient::Gesture));
// Create and attach an overlay scrollbar.
scrollbar = FakeWebScrollbar::create();
static_cast<FakeWebScrollbar*>(scrollbar.get())->setOverlay(true);
layerImplTreeRoot = layerImplForScrollAreaAndScrollbar(&hostImpl, scrollbar.Pass(), false);
scrollbarLayerImpl = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]);
// The user shouldn't be able to drag an overlay scrollbar and the scroll
// may be handled in the compositor.
EXPECT_EQ(InputHandlerClient::ScrollIgnored, scrollbarLayerImpl->tryScroll(gfx::Point(0, 0), InputHandlerClient::Gesture));
}
TEST(ScrollbarLayerTest, scrollOffsetSynchronization)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
scoped_refptr<Layer> layerTreeRoot = Layer::create();
scoped_refptr<Layer> contentLayer = Layer::create();
scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(true), layerTreeRoot->id());
layerTreeRoot->addChild(contentLayer);
layerTreeRoot->addChild(scrollbarLayer);
layerTreeRoot->setScrollOffset(gfx::Vector2d(10, 20));
layerTreeRoot->setMaxScrollOffset(gfx::Vector2d(30, 50));
layerTreeRoot->setBounds(gfx::Size(100, 200));
contentLayer->setBounds(gfx::Size(100, 200));
scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.activeTree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
ScrollbarLayerImpl* ccScrollbarLayer = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]);
EXPECT_EQ(10, ccScrollbarLayer->currentPos());
EXPECT_EQ(100, ccScrollbarLayer->totalSize());
EXPECT_EQ(30, ccScrollbarLayer->maximum());
layerTreeRoot->setScrollOffset(gfx::Vector2d(100, 200));
layerTreeRoot->setMaxScrollOffset(gfx::Vector2d(300, 500));
layerTreeRoot->setBounds(gfx::Size(1000, 2000));
contentLayer->setBounds(gfx::Size(1000, 2000));
ScrollbarAnimationController* scrollbarController = layerImplTreeRoot->scrollbarAnimationController();
layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.activeTree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
EXPECT_EQ(scrollbarController, layerImplTreeRoot->scrollbarAnimationController());
EXPECT_EQ(100, ccScrollbarLayer->currentPos());
EXPECT_EQ(1000, ccScrollbarLayer->totalSize());
EXPECT_EQ(300, ccScrollbarLayer->maximum());
layerImplTreeRoot->scrollBy(gfx::Vector2d(12, 34));
EXPECT_EQ(112, ccScrollbarLayer->currentPos());
EXPECT_EQ(1000, ccScrollbarLayer->totalSize());
EXPECT_EQ(300, ccScrollbarLayer->maximum());
}
class ScrollbarLayerTestMaxTextureSize : public ThreadedTest {
public:
ScrollbarLayerTestMaxTextureSize() {}
void setScrollbarBounds(gfx::Size bounds) {
m_bounds = bounds;
}
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->initializeRendererIfNeeded();
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
m_scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(true), 1);
m_scrollbarLayer->setLayerTreeHost(m_layerTreeHost.get());
m_scrollbarLayer->setBounds(m_bounds);
m_layerTreeHost->rootLayer()->addChild(m_scrollbarLayer);
m_scrollLayer = Layer::create();
m_scrollbarLayer->setScrollLayerId(m_scrollLayer->id());
m_layerTreeHost->rootLayer()->addChild(m_scrollLayer);
postSetNeedsCommitToMainThread();
}
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
const int kMaxTextureSize = impl->rendererCapabilities().maxTextureSize;
// Check first that we're actually testing something.
EXPECT_GT(m_scrollbarLayer->bounds().width(), kMaxTextureSize);
EXPECT_EQ(m_scrollbarLayer->contentBounds().width(), kMaxTextureSize - 1);
EXPECT_EQ(m_scrollbarLayer->contentBounds().height(), kMaxTextureSize - 1);
endTest();
}
virtual void afterTest() OVERRIDE
{
}
private:
scoped_refptr<ScrollbarLayer> m_scrollbarLayer;
scoped_refptr<Layer> m_scrollLayer;
gfx::Size m_bounds;
};
TEST_F(ScrollbarLayerTestMaxTextureSize, runTest) {
scoped_ptr<FakeWebGraphicsContext3D> context = FakeWebGraphicsContext3D::Create();
int max_size = 0;
context->getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);
setScrollbarBounds(gfx::Size(max_size + 100, max_size + 100));
runTest(true);
}
} // namespace
} // namespace cc
| {
"content_hash": "d8943c83f7c44632fe81308baeee13fe",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 223,
"avg_line_length": 43.80790960451977,
"alnum_prop": 0.7363941191643023,
"repo_name": "nacl-webkit/chrome_deps",
"id": "e6a7bff0b3067757693a358b602684fbf7b6c92b",
"size": "8645",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cc/scrollbar_layer_unittest.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "1173441"
},
{
"name": "Awk",
"bytes": "9519"
},
{
"name": "C",
"bytes": "74568368"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "156174457"
},
{
"name": "DOT",
"bytes": "1559"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Java",
"bytes": "3088381"
},
{
"name": "JavaScript",
"bytes": "18179048"
},
{
"name": "Logos",
"bytes": "4517"
},
{
"name": "M",
"bytes": "2190"
},
{
"name": "Matlab",
"bytes": "3044"
},
{
"name": "Objective-C",
"bytes": "6965520"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "932725"
},
{
"name": "Python",
"bytes": "8458718"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3621"
},
{
"name": "Shell",
"bytes": "1526176"
},
{
"name": "Tcl",
"bytes": "277077"
},
{
"name": "XSLT",
"bytes": "13493"
}
],
"symlink_target": ""
} |
using NUnit.Framework;
namespace I18NPortable.UnitTests
{
[TestFixture]
public class BindingTests : BaseTest
{
[Test]
public void Indexer_Is_Bindable()
{
I18N.Current.Locale = "es";
var translation = I18N.Current.Translate("one");
I18N.Current.PropertyChanged += (sender, args) =>
{
if (args.PropertyName.Equals("Item[]"))
translation = I18N.Current.Translate("one");
};
I18N.Current.Locale = "en";
Assert.AreEqual("one", translation);
I18N.Current.Locale = "es";
Assert.AreEqual("uno", translation);
}
[Test]
public void LanguageProperty_Is_Bindable()
{
I18N.Current.Locale = "es";
var language = I18N.Current.Language;
I18N.Current.PropertyChanged += (sender, args) =>
{
if (args.PropertyName.Equals("Language"))
language = ((II18N)sender).Language;
};
I18N.Current.Locale = "en";
Assert.AreEqual("en", language.Locale);
I18N.Current.Locale = "es";
Assert.AreEqual("es", language.Locale);
}
[Test]
public void LocaleProperty_Is_Bindable()
{
I18N.Current.Locale = "es";
var locale = I18N.Current.Locale;
I18N.Current.PropertyChanged += (sender, args) =>
{
if (args.PropertyName.Equals("Locale"))
locale = ((II18N)sender).Locale;
};
I18N.Current.Locale = "en";
Assert.AreEqual("en", locale);
I18N.Current.Locale = "es";
Assert.AreEqual("es", locale);
}
}
}
| {
"content_hash": "16745cad8af35718faa74d7cd3bc0752",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 64,
"avg_line_length": 25.633802816901408,
"alnum_prop": 0.4978021978021978,
"repo_name": "xleon/I18N-Portable",
"id": "a89262eb8b73796e7afb0f5de4df9c2796512b02",
"size": "1822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "I18NPortable.UnitTests/BindingTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "54182"
}
],
"symlink_target": ""
} |
#region license
// Copyright (c) 2009 Mauricio Scheffer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.IO;
using System.Reflection;
using System.Web;
namespace MiniMVC {
public static class Setup {
public static readonly DateTime AssemblyDate = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
}
} | {
"content_hash": "ce9007b1a513bfd5f27ebd7a3517f4fa",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 124,
"avg_line_length": 34,
"alnum_prop": 0.724400871459695,
"repo_name": "mausch/MiniMVC",
"id": "2a3ab6c51a193dba807b4a8aaa074befc1884797",
"size": "920",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MiniMVC/Setup.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Boo",
"bytes": "2837"
},
{
"name": "C#",
"bytes": "30643"
},
{
"name": "Shell",
"bytes": "66"
},
{
"name": "Visual Basic",
"bytes": "1220"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<Document>
<sentence>
<value> Ronald John Garan, Jr. (born October 30, 1961) is a NASA astronaut. </value>
<annotated-sentence> [[Ronald John Garan|Ronald_J._Garan,_Jr.]], Jr. (born October 30, 1961) is a [[NASA|NASA]] [[astronaut|Astronaut]]. </annotated-sentence>
<pattern_crowdsource> [[Ronald John Garan|Ronald_J._Garan,_Jr.]], Jr. (born October 30, 1961) is a [[NASA|NASA]] [[astronaut|Astronaut]]. </pattern_crowdsource>
<tree>
nn(Garan/NNP-3,Ronald/NNP-1)
nn(Garan/NNP-3,John/NNP-2)
nsubj(astronaut/NN-16,Garan/NNP-3)
appos(Garan/NNP-3,Jr./NNP-5)
dep(Garan/NNP-3,born/VBN-7)
tmod(born/VBN-7,October/NNP-8)
num(October/NNP-8,30/CD-9)
num(October/NNP-8,1961/CD-11)
cop(astronaut/NN-16,is/VBZ-13)
det(astronaut/NN-16,a/DT-14)
nn(astronaut/NN-16,NASA/NNP-15)
</tree>
<annotations>
<annotation>
<surface-form>Ronald John Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Ronald_J._Garan,_Jr.</RDF-ID>
</annotation>
<annotation>
<surface-form>NASA</surface-form>
<RDF-ID>http://dbpedia.org/resource/NASA</RDF-ID>
</annotation>
<annotation>
<surface-form>astronaut</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Astronaut</RDF-ID>
</annotation>
</annotations>
<triples>
<triple>
http://dbpedia.org/resource/Ronald_J._Garan,_Jr. http://dbpedia.org/ontology/type http://dbpedia.org/resource/NASA
</triple>
<triple>
http://dbpedia.org/resource/Ronald_J._Garan,_Jr. http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Astronaut
</triple>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> After graduating from State University of New York College at Oneonta in 1982, he joined the Air Force, becoming a Second Lieutenant in 1984. </value>
<annotated-sentence> After graduating from State University of New York College at [[Oneonta|Otsego_County,_New_York]] in [[1982|1982]], he joined [[the Air Force|Air_force]], becoming a Second Lieutenant in [[1984|1984]]. </annotated-sentence>
<pattern_crowdsource> After graduating from State University of New York College at Oneonta in 1982, he joined the Air Force, becoming a Second Lieutenant in 1984. </pattern_crowdsource>
<tree>
prepc_after(joined/VBD-16,graduating/VBG-2)
nn(University/NNP-5,State/NNP-4)
prep_from(graduating/VBG-2,University/NNP-5)
nn(College/NNP-9,New/NNP-7)
nn(College/NNP-9,York/NNP-8)
prep_of(University/NNP-5,College/NNP-9)
prep_at(College/NNP-9,Oneonta/NNP-11)
prep_in(graduating/VBG-2,1982/CD-13)
nsubj(joined/VBD-16,he/PRP-15)
det(Force/NNP-19,the/DT-17)
nn(Force/NNP-19,Air/NNP-18)
dobj(joined/VBD-16,Force/NNP-19)
partmod(joined/VBD-16,becoming/VBG-21)
det(Lieutenant/NN-24,a/DT-22)
amod(Lieutenant/NN-24,Second/JJ-23)
xcomp(becoming/VBG-21,Lieutenant/NN-24)
prep_in(becoming/VBG-21,1984/CD-26)
</tree>
<annotations>
<annotation>
<surface-form>Oneonta</surface-form>
<RDF-ID>http://dbpedia.org/resource/Otsego_County,_New_York</RDF-ID>
</annotation>
<annotation>
<surface-form>1982</surface-form>
<RDF-ID>http://dbpedia.org/resource/1982</RDF-ID>
</annotation>
<annotation>
<surface-form>the Air Force</surface-form>
<RDF-ID>http://dbpedia.org/resource/Air_force</RDF-ID>
</annotation>
<annotation>
<surface-form>1984</surface-form>
<RDF-ID>http://dbpedia.org/resource/1984</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He became an F-16 pilot, and flew combat missions in Desert Shield and Desert Storm. </value>
<annotated-sentence> He became an [[F-16|General_Dynamics_F-16_VISTA]] pilot, and flew [[combat missions|Combat_Missions]] in [[Desert Shield and Desert Storm|Gulf_War]]. </annotated-sentence>
<pattern_crowdsource> He became an F-16 pilot, and flew combat missions in Desert Shield and Desert Storm. </pattern_crowdsource>
<tree>
nsubj(pilot/NN-5,He/PRP-1)
nsubj(flew/VBD-8,He/PRP-1)
cop(pilot/NN-5,became/VBD-2)
det(pilot/NN-5,an/DT-3)
nn(pilot/NN-5,F-16/NN-4)
conj_and(pilot/NN-5,flew/VBD-8)
nn(missions/NNS-10,combat/NN-9)
dobj(flew/VBD-8,missions/NNS-10)
nn(Shield/NNP-13,Desert/NNP-12)
prep_in(flew/VBD-8,Shield/NNP-13)
nn(Storm/NN-16,Desert/NNP-15)
prep_in(flew/VBD-8,Storm/NN-16)
conj_and(Shield/NNP-13,Storm/NN-16)
</tree>
<annotations>
<annotation>
<surface-form>F-16</surface-form>
<RDF-ID>http://dbpedia.org/resource/General_Dynamics_F-16_VISTA</RDF-ID>
</annotation>
<annotation>
<surface-form>combat missions</surface-form>
<RDF-ID>http://dbpedia.org/resource/Combat_Missions</RDF-ID>
</annotation>
<annotation>
<surface-form>Desert Shield and Desert Storm</surface-form>
<RDF-ID>http://dbpedia.org/resource/Gulf_War</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Before becoming an astronaut he was the Operations Officer of the 40th Flight Test Squadron (FTS). </value>
<annotated-sentence> Before becoming [[an astronaut|Astronaut]] he was [[the Operations Officer|Operations_(military_staff)]] of [[the 40th Flight Test Squadron|40th_Flight_Test_Squadron]] (FTS). </annotated-sentence>
<pattern_crowdsource> Before becoming an astronaut he was the Operations Officer of the 40th Flight Test Squadron (FTS). </pattern_crowdsource>
<tree>
prepc_before(Officer/NNP-9,becoming/VBG-2)
det(astronaut/NN-4,an/DT-3)
xcomp(becoming/VBG-2,astronaut/NN-4)
nsubj(Officer/NNP-9,he/PRP-5)
cop(Officer/NNP-9,was/VBD-6)
det(Officer/NNP-9,the/DT-7)
nn(Officer/NNP-9,Operations/NNP-8)
det(Squadron/NN-15,the/DT-11)
amod(Squadron/NN-15,40th/JJ-12)
nn(Squadron/NN-15,Flight/NN-13)
nn(Squadron/NN-15,Test/NN-14)
prep_of(Officer/NNP-9,Squadron/NN-15)
appos(Squadron/NN-15,FTS/NN-17)
</tree>
<annotations>
<annotation>
<surface-form>an astronaut</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Astronaut</RDF-ID>
</annotation>
<annotation>
<surface-form>the Operations Officer</surface-form>
<RDF-ID>http://dbpedia.org/resource/Operations_(military_staff)</RDF-ID>
</annotation>
<annotation>
<surface-form>the 40th Flight Test Squadron</surface-form>
<RDF-ID>http://dbpedia.org/resource/40th_Flight_Test_Squadron</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He first flew in space as a Mission Specialist on the STS-124 mission to the International Space Station (ISS). </value>
<annotated-sentence> He first flew in [[space|Space]] as [[a Mission Specialist|Mission_Specialist]] on the [[STS-124|STS-124]] [[mission|Mission_Specialist]] to [[the International Space Station|International_Space_Station]] ([[ISS|International_Space_Station]]). </annotated-sentence>
<pattern_crowdsource> He first flew in space as a Mission Specialist on the STS-124 mission to the International Space Station (ISS). </pattern_crowdsource>
<tree>
nsubj(flew/VBD-3,He/PRP-1)
advmod(flew/VBD-3,first/RB-2)
prep_in(flew/VBD-3,space/NN-5)
det(Specialist/NN-9,a/DT-7)
nn(Specialist/NN-9,Mission/NNP-8)
prep_as(space/NN-5,Specialist/NN-9)
det(mission/NN-13,the/DT-11)
nn(mission/NN-13,STS-124/NN-12)
prep_on(flew/VBD-3,mission/NN-13)
det(Station/NNP-18,the/DT-15)
nn(Station/NNP-18,International/NNP-16)
nn(Station/NNP-18,Space/NNP-17)
prep_to(flew/VBD-3,Station/NNP-18)
appos(Station/NNP-18,ISS/NNP-20)
</tree>
<annotations>
<annotation>
<surface-form>space</surface-form>
<RDF-ID>http://dbpedia.org/resource/Space</RDF-ID>
</annotation>
<annotation>
<surface-form>a Mission Specialist</surface-form>
<RDF-ID>http://dbpedia.org/resource/Mission_Specialist</RDF-ID>
</annotation>
<annotation>
<surface-form>STS-124</surface-form>
<RDF-ID>http://dbpedia.org/resource/STS-124</RDF-ID>
</annotation>
<annotation>
<surface-form>mission</surface-form>
<RDF-ID>http://dbpedia.org/resource/Mission_Specialist</RDF-ID>
</annotation>
<annotation>
<surface-form>the International Space Station</surface-form>
<RDF-ID>http://dbpedia.org/resource/International_Space_Station</RDF-ID>
</annotation>
<annotation>
<surface-form>ISS</surface-form>
<RDF-ID>http://dbpedia.org/resource/International_Space_Station</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He returned to ISS on 4 April 2011 for a six-month stay as a member of Expedition 27. </value>
<annotated-sentence> He returned to [[ISS|S]] on 4 [[April 2011|April_2011]] for a six-month stay as a member of [[Expedition 27|Expedition_27]]. </annotated-sentence>
<pattern_crowdsource> He returned to ISS on 4 April 2011 for a six-month stay as a member of Expedition 27. </pattern_crowdsource>
<tree>
nsubj(returned/VBD-2,He/PRP-1)
prep_to(returned/VBD-2,ISS/NN-4)
prep_on(ISS/NN-4,4/CD-6)
tmod(returned/VBD-2,April/NNP-7)
num(April/NNP-7,2011/CD-8)
det(stay/NN-12,a/DT-10)
amod(stay/NN-12,six-month/JJ-11)
prep_for(returned/VBD-2,stay/NN-12)
det(member/NN-15,a/DT-14)
prep_as(stay/NN-12,member/NN-15)
prep_of(member/NN-15,Expedition/NN-17)
num(Expedition/NN-17,27/CD-18)
</tree>
<annotations>
<annotation>
<surface-form>ISS</surface-form>
<RDF-ID>http://dbpedia.org/resource/ISS_A/S</RDF-ID>
</annotation>
<annotation>
<surface-form>April 2011</surface-form>
<RDF-ID>http://dbpedia.org/resource/April_2011</RDF-ID>
</annotation>
<annotation>
<surface-form>Expedition 27</surface-form>
<RDF-ID>http://dbpedia.org/resource/Expedition_27</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Born on October 30, 1961 in Yonkers, NY, Ron Garan is of Ukrainian descent. </value>
<annotated-sentence> Born on October 30, 1961 in [[Yonkers , NY|N.Y.,_N.Y._(film)]] [[Ron Garan|Ronald_J._Garan,_Jr.]] is of [[Ukrainian descent|Ukrainians]]. </annotated-sentence>
<pattern_crowdsource> Born on October 30, 1961 in Yonkers, NY, Ron Garan is of Ukrainian descent. </pattern_crowdsource>
<tree>
partmod(is/VBZ-14,Born/VBN-1)
prep_on(Born/VBN-1,October/NNP-3)
num(October/NNP-3,30/CD-4)
num(October/NNP-3,1961/CD-6)
nn(NY/NNP-10,Yonkers/NNP-8)
prep_in(Born/VBN-1,NY/NNP-10)
nn(Garan/NNP-13,Ron/NNP-12)
nsubj(is/VBZ-14,Garan/NNP-13)
amod(descent/NN-17,Ukrainian/JJ-16)
prep_of(is/VBZ-14,descent/NN-17)
</tree>
<annotations>
<annotation>
<surface-form>Yonkers , NY</surface-form>
<RDF-ID>http://dbpedia.org/resource/N.Y.,_N.Y._(film)</RDF-ID>
</annotation>
<annotation>
<surface-form>Ron Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Ronald_J._Garan,_Jr.</RDF-ID>
</annotation>
<annotation>
<surface-form>Ukrainian descent</surface-form>
<RDF-ID>http://dbpedia.org/resource/Ukrainians</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He is married to the former Carmel Courtney of Brooklyn, NY, and Scranton, PA. </value>
<annotated-sentence> He is married to the former Carmel Courtney of Brooklyn, NY, and Scranton, [[PA.|Pennsylvania]] </annotated-sentence>
<pattern_crowdsource> He is married to the former Carmel Courtney of Brooklyn, NY, and Scranton, PA. </pattern_crowdsource>
<tree>
nsubjpass(married/VBN-3,He/PRP-1)
auxpass(married/VBN-3,is/VBZ-2)
det(Courtney/NNP-8,the/DT-5)
amod(Courtney/NNP-8,former/JJ-6)
nn(Courtney/NNP-8,Carmel/NNP-7)
prep_to(married/VBN-3,Courtney/NNP-8)
prep_of(Courtney/NNP-8,Brooklyn/NNP-10)
prep_of(Courtney/NNP-8,NY/NNP-12)
conj_and(Brooklyn/NNP-10,NY/NNP-12)
prep_of(Courtney/NNP-8,Scranton/NNP-15)
conj_and(Brooklyn/NNP-10,Scranton/NNP-15)
appos(Courtney/NNP-8,PA./NNP-17)
</tree>
<annotations>
<annotation>
<surface-form>PA.</surface-form>
<RDF-ID>http://dbpedia.org/resource/Pennsylvania</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> They have three sons. </value>
<annotated-sentence> [[They|They]] have three sons. </annotated-sentence>
<pattern_crowdsource> They have three sons. </pattern_crowdsource>
<tree>
nsubj(have/VBP-2,They/PRP-1)
num(sons/NNS-4,three/CD-3)
dobj(have/VBP-2,sons/NNS-4)
</tree>
<annotations>
<annotation>
<surface-form>They</surface-form>
<RDF-ID>http://dbpedia.org/resource/They</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> His father, Ronald Garan Sr., resides in Yonkers, NY. </value>
<annotated-sentence> His [[father|Father]], [[Ronald Garan|Ronald_J._Garan,_Jr.]] Sr., resides in [[Yonkers , NY|N.Y.,_N.Y._(film)]] </annotated-sentence>
<pattern_crowdsource> His father, Ronald Garan Sr., resides in Yonkers, NY. </pattern_crowdsource>
<tree>
poss(father/NN-2,His/PRP$-1)
nsubj(resides/VBZ-8,father/NN-2)
nn(Sr./NNP-6,Ronald/NNP-4)
nn(Sr./NNP-6,Garan/NNP-5)
appos(father/NN-2,Sr./NNP-6)
nn(NY/NNP-12,Yonkers/NNP-10)
prep_in(resides/VBZ-8,NY/NNP-12)
</tree>
<annotations>
<annotation>
<surface-form>father</surface-form>
<RDF-ID>http://dbpedia.org/resource/Father</RDF-ID>
</annotation>
<annotation>
<surface-form>Ronald Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Ronald_J._Garan,_Jr.</RDF-ID>
</annotation>
<annotation>
<surface-form>Yonkers , NY</surface-form>
<RDF-ID>http://dbpedia.org/resource/N.Y.,_N.Y._(film)</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> His mother, Linda Lichtblau, resides in Port St. Lucie, FL with her husband, Peter Lichtblau. </value>
<annotated-sentence> His [[mother|Mother_Teresa]], Linda Lichtblau, resides in [[Port St. Lucie|Port_St._Lucie,_Florida]], [[FL|Florida]] with [[her husband|Husband]], [[Peter|St._Peter's_Basilica]] Lichtblau. </annotated-sentence>
<pattern_crowdsource> His [[mother|Mother_Teresa]], Linda Lichtblau, resides in [[Port St. Lucie|Port_St._Lucie,_Florida]], [[FL|Florida]] with her husband, [[Peter|St._Peter's_Basilica]] Lichtblau. </pattern_crowdsource>
<tree>
poss(mother/NN-2,His/PRP$-1)
nsubj(resides/VBZ-7,mother/NN-2)
nn(Lichtblau/NNP-5,Linda/NNP-4)
appos(mother/NN-2,Lichtblau/NNP-5)
nn(Lucie/NNP-11,Port/NNP-9)
nn(Lucie/NNP-11,St./NNP-10)
prep_in(resides/VBZ-7,Lucie/NNP-11)
appos(Lucie/NNP-11,FL/NN-13)
poss(husband/NN-16,her/PRP$-15)
prep_with(resides/VBZ-7,husband/NN-16)
nn(Lichtblau/NNP-19,Peter/NNP-18)
appos(husband/NN-16,Lichtblau/NNP-19)
</tree>
<annotations>
<annotation>
<surface-form>mother</surface-form>
<RDF-ID>http://dbpedia.org/resource/Mother_Teresa</RDF-ID>
</annotation>
<annotation>
<surface-form>Port St. Lucie</surface-form>
<RDF-ID>http://dbpedia.org/resource/Port_St._Lucie,_Florida</RDF-ID>
</annotation>
<annotation>
<surface-form>FL</surface-form>
<RDF-ID>http://dbpedia.org/resource/Florida</RDF-ID>
</annotation>
<annotation>
<surface-form>her husband</surface-form>
<RDF-ID>http://dbpedia.org/resource/Husband</RDF-ID>
</annotation>
<annotation>
<surface-form>Peter</surface-form>
<RDF-ID>http://dbpedia.org/resource/St._Peter's_Basilica</RDF-ID>
</annotation>
</annotations>
<triples>
<triple>
http://dbpedia.org/resource/Mother_Teresa http://dbpedia.org/property/beatifiedPlace http://dbpedia.org/resource/St._Peter's_Basilica
</triple>
<triple>
http://dbpedia.org/resource/Port_St._Lucie,_Florida http://dbpedia.org/ontology/isPartOf http://dbpedia.org/resource/Florida
</triple>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> His recreational interests include running, football, coaching and teaching Sunday School classes to children. </value>
<annotated-sentence> His recreational [[interests|Interest]] include running, football, coaching and teaching [[Sunday School|Sunday_school]] classes to [[children|Child]]. </annotated-sentence>
<pattern_crowdsource> His recreational interests include running, football, coaching and teaching Sunday School classes to children. </pattern_crowdsource>
<tree>
poss(interests/NNS-3,His/PRP$-1)
amod(interests/NNS-3,recreational/JJ-2)
nsubj(include/VBP-4,interests/NNS-3)
xcomp(include/VBP-4,running/VBG-5)
dep(classes/NNS-14,football/NN-7)
conj_and(football/NN-7,coaching/NN-9)
dep(classes/NNS-14,coaching/NN-9)
conj_and(football/NN-7,teaching/NN-11)
dep(classes/NNS-14,teaching/NN-11)
nn(classes/NNS-14,Sunday/NNP-12)
nn(classes/NNS-14,School/NNP-13)
ccomp(include/VBP-4,classes/NNS-14)
prep_to(classes/NNS-14,children/NNS-16)
</tree>
<annotations>
<annotation>
<surface-form>interests</surface-form>
<RDF-ID>http://dbpedia.org/resource/Interest</RDF-ID>
</annotation>
<annotation>
<surface-form>Sunday School</surface-form>
<RDF-ID>http://dbpedia.org/resource/Sunday_school</RDF-ID>
</annotation>
<annotation>
<surface-form>children</surface-form>
<RDF-ID>http://dbpedia.org/resource/Child</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Garan is a Roman Catholic. </value>
<annotated-sentence> [[Garan|Shichid%C5%8D_garan]] is a Roman Catholic. </annotated-sentence>
<pattern_crowdsource> Garan is a Roman Catholic. </pattern_crowdsource>
<tree>
nsubj(Catholic/NNP-5,Garan/NNP-1)
cop(Catholic/NNP-5,is/VBZ-2)
det(Catholic/NNP-5,a/DT-3)
amod(Catholic/NNP-5,Roman/JJ-4)
</tree>
<annotations>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> His description of coming back to earth in a Soyuz capsule was "like going over Niagara Falls in a barrel (that's on fire) followed by a high speed crash". </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
poss(description/NN-2,His/PRP$-1)
nsubj(was/VBD-12,description/NN-2)
prepc_of(description/NN-2,coming/VBG-4)
advmod(coming/VBG-4,back/RB-5)
prep_to(back/RB-5,earth/NN-7)
det(capsule/NN-11,a/DT-9)
nn(capsule/NN-11,Soyuz/NNP-10)
prep_in(coming/VBG-4,capsule/NN-11)
prepc_like(was/VBD-12,going/VBG-15)
nn(Falls/NNP-18,Niagara/NNP-17)
prep_over(going/VBG-15,Falls/NNP-18)
det(barrel/NN-21,a/DT-20)
prep_in(Falls/NNP-18,barrel/NN-21)
nsubj('s/VBZ-24,that/DT-23)
dep(Falls/NNP-18,'s/VBZ-24)
prep_on('s/VBZ-24,fire/NN-26)
partmod(Falls/NNP-18,followed/VBN-28)
det(crash/NN-33,a/DT-30)
amod(crash/NN-33,high/JJ-31)
nn(crash/NN-33,speed/NN-32)
agent(followed/VBN-28,crash/NN-33)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Garan graduated from Roosevelt High School, Yonkers, NY in 1979. </value>
<annotated-sentence> [[Garan|Shichid%C5%8D_garan]] graduated from Roosevelt High School, Yonkers, NY in [[1979|1979]]. </annotated-sentence>
<pattern_crowdsource> Garan graduated from Roosevelt High School, Yonkers, NY in 1979. </pattern_crowdsource>
<tree>
nsubj(graduated/VBD-2,Garan/NNP-1)
nn(School/NNP-6,Roosevelt/NNP-4)
nn(School/NNP-6,High/NNP-5)
prep_from(graduated/VBD-2,School/NNP-6)
nn(NY/NNP-10,Yonkers/NNP-8)
appos(School/NNP-6,NY/NNP-10)
prep_in(graduated/VBD-2,1979/CD-12)
</tree>
<annotations>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
<annotation>
<surface-form>1979</surface-form>
<RDF-ID>http://dbpedia.org/resource/1979</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He earned a Bachelor of Science degree in Business Economics from the SUNY College at Oneonta in 1982; a Masters of Aeronautical Science degree from Embry-Riddle Aeronautical University, 1994; and a Master of Science degree in Aerospace Engineering from the University of Florida, 1996. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nsubj(earned/VBD-2,He/PRP-1)
det(Bachelor/NN-4,a/DT-3)
dobj(earned/VBD-2,Bachelor/NN-4)
nn(degree/NN-7,Science/NNP-6)
prep_of(Bachelor/NN-4,degree/NN-7)
nn(Economics/NNP-10,Business/NNP-9)
prep_in(earned/VBD-2,Economics/NNP-10)
det(College/NNP-14,the/DT-12)
nn(College/NNP-14,SUNY/NNP-13)
prep_from(Economics/NNP-10,College/NNP-14)
prep_at(earned/VBD-2,Oneonta/NNP-16)
prep_in(Oneonta/NNP-16,1982/CD-18)
det(Masters/NN-21,a/DT-20)
prep_at(earned/VBD-2,Masters/NN-21)
conj_and(Oneonta/NNP-16,Masters/NN-21)
nn(degree/NN-25,Aeronautical/NNP-23)
nn(degree/NN-25,Science/NNP-24)
prep_of(Masters/NN-21,degree/NN-25)
nn(University/NNP-29,Embry-Riddle/NNP-27)
nn(University/NNP-29,Aeronautical/NNP-28)
prep_from(degree/NN-25,University/NNP-29)
amod(University/NNP-29,1994/CD-31)
det(Master/NN-35,a/DT-34)
prep_at(earned/VBD-2,Master/NN-35)
conj_and(Oneonta/NNP-16,Master/NN-35)
nn(degree/NN-38,Science/NNP-37)
prep_of(Master/NN-35,degree/NN-38)
nn(Engineering/NNP-41,Aerospace/NNP-40)
prep_in(earned/VBD-2,Engineering/NNP-41)
det(University/NNP-44,the/DT-43)
prep_from(Engineering/NNP-41,University/NNP-44)
prep_of(University/NNP-44,Florida/NNP-46)
amod(Florida/NNP-46,1996/CD-48)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Ron is also founder of the Fragile Oasis project, aimed at further integrating space and planetary sciences and the promotion of user projects "connecting space and Earth". </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nsubj(founder/NN-4,Ron/NNP-1)
cop(founder/NN-4,is/VBZ-2)
advmod(founder/NN-4,also/RB-3)
det(project/NN-9,the/DT-6)
amod(project/NN-9,Fragile/JJ-7)
nn(project/NN-9,Oasis/NNP-8)
prep_of(founder/NN-4,project/NN-9)
partmod(project/NN-9,aimed/VBN-11)
prep_at(aimed/VBN-11,further/JJ-13)
partmod(further/JJ-13,integrating/VBG-14)
dobj(integrating/VBG-14,space/NN-15)
amod(sciences/NNS-18,planetary/JJ-17)
dobj(integrating/VBG-14,sciences/NNS-18)
conj_and(space/NN-15,sciences/NNS-18)
det(promotion/NN-21,the/DT-20)
dobj(integrating/VBG-14,promotion/NN-21)
conj_and(space/NN-15,promotion/NN-21)
nn(projects/NNS-24,user/NN-23)
prep_of(promotion/NN-21,projects/NNS-24)
partmod(project/NN-9,connecting/VBG-26)
dobj(connecting/VBG-26,space/NN-27)
dobj(connecting/VBG-26,Earth/NNP-29)
conj_and(space/NN-27,Earth/NNP-29)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> [1] Garan's military decorations include the Distinguished Flying Cross for Combat Valor, Meritorious Service Medal, Air Medal, Aerial Achievement Medal, Air Force Outstanding Unit Award with Valor, National Defense Service Medal, Humanitarian Service Award, Kuwait Liberation Medal, NASA Superior Accomplishment Award, NASA Exceptional Achievement Medal, and various other service awards. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
dep(include/VBP-8,1/LS-2)
punct(include/VBP-8,-RSB-/-RRB--3)
poss(decorations/NNS-7,Garan/NNP-4)
amod(decorations/NNS-7,military/JJ-6)
nsubj(include/VBP-8,decorations/NNS-7)
dep(-LSB-/-LRB--1,include/VBP-8)
det(Cross/NNP-12,the/DT-9)
nn(Cross/NNP-12,Distinguished/NNP-10)
nn(Cross/NNP-12,Flying/NNP-11)
dobj(include/VBP-8,Cross/NNP-12)
nn(Valor/NNP-15,Combat/NNP-14)
prep_for(Cross/NNP-12,Valor/NNP-15)
nn(Medal/NN-19,Meritorious/NNP-17)
nn(Medal/NN-19,Service/NNP-18)
prep_for(Cross/NNP-12,Medal/NN-19)
conj_and(Valor/NNP-15,Medal/NN-19)
nn(Medal/NN-22,Air/NNP-21)
prep_for(Cross/NNP-12,Medal/NN-22)
conj_and(Valor/NNP-15,Medal/NN-22)
amod(Medal/NN-26,Aerial/JJ-24)
nn(Medal/NN-26,Achievement/NNP-25)
prep_for(Cross/NNP-12,Medal/NN-26)
conj_and(Valor/NNP-15,Medal/NN-26)
nn(Award/NN-32,Air/NNP-28)
nn(Award/NN-32,Force/NNP-29)
amod(Award/NN-32,Outstanding/JJ-30)
nn(Award/NN-32,Unit/NN-31)
prep_for(Cross/NNP-12,Award/NN-32)
conj_and(Valor/NNP-15,Award/NN-32)
prep_with(Award/NN-32,Valor/NN-34)
nn(Medal/NN-39,National/NNP-36)
nn(Medal/NN-39,Defense/NNP-37)
nn(Medal/NN-39,Service/NNP-38)
prep_for(Cross/NNP-12,Medal/NN-39)
conj_and(Valor/NNP-15,Medal/NN-39)
nn(Award/NN-43,Humanitarian/NNP-41)
nn(Award/NN-43,Service/NNP-42)
prep_for(Cross/NNP-12,Award/NN-43)
conj_and(Valor/NNP-15,Award/NN-43)
nn(Medal/NN-47,Kuwait/NNP-45)
nn(Medal/NN-47,Liberation/NNP-46)
prep_for(Cross/NNP-12,Medal/NN-47)
conj_and(Valor/NNP-15,Medal/NN-47)
nn(Award/NN-52,NASA/NNP-49)
nn(Award/NN-52,Superior/NNP-50)
nn(Award/NN-52,Accomplishment/NNP-51)
prep_for(Cross/NNP-12,Award/NN-52)
conj_and(Valor/NNP-15,Award/NN-52)
nn(Medal/NN-57,NASA/NNP-54)
nn(Medal/NN-57,Exceptional/NNP-55)
nn(Medal/NN-57,Achievement/NNP-56)
prep_for(Cross/NNP-12,Medal/NN-57)
conj_and(Valor/NNP-15,Medal/NN-57)
amod(awards/NNS-63,various/JJ-60)
amod(awards/NNS-63,other/JJ-61)
nn(awards/NNS-63,service/NN-62)
prep_for(Cross/NNP-12,awards/NNS-63)
conj_and(Valor/NNP-15,awards/NNS-63)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He received the Distinguished Graduate and Top Academic Award USAF Fighter Weapons School; was twice selected as Top Academic Instructor Pilot: USAF Weapons School; USAF Weapons School and USAF Weapons and Tactics Center: Lt. Gen. Claire Lee Chennault Award; Distinguished Graduate Squadron Officers School; Top Academic Award F-16 Replacement Training Unit (RTU). </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nsubj(received/VBD-2,He/PRP-1)
dobj(received/VBD-2,the/DT-3)
dep(the/DT-3,Distinguished/VBN-4)
dobj(Distinguished/VBN-4,Graduate/NN-5)
amod(School/NNP-13,Top/JJ-7)
nn(School/NNP-13,Academic/NNP-8)
nn(School/NNP-13,Award/NN-9)
nn(School/NNP-13,USAF/NNP-10)
nn(School/NNP-13,Fighter/NNP-11)
nn(School/NNP-13,Weapons/NNP-12)
dobj(Distinguished/VBN-4,School/NNP-13)
conj_and(Graduate/NN-5,School/NNP-13)
auxpass(selected/VBN-17,was/VBD-15)
advmod(selected/VBN-17,twice/RB-16)
parataxis(Distinguished/VBN-4,selected/VBN-17)
amod(Pilot/NN-22,Top/JJ-19)
nn(Pilot/NN-22,Academic/NNP-20)
nn(Pilot/NN-22,Instructor/NNP-21)
prep_as(selected/VBN-17,Pilot/NN-22)
nn(School/NNP-26,USAF/NNP-24)
nn(School/NNP-26,Weapons/NNP-25)
dep(Pilot/NN-22,School/NNP-26)
nn(School/NNP-30,USAF/NNP-28)
nn(School/NNP-30,Weapons/NNP-29)
dep(Pilot/NN-22,School/NNP-30)
nn(Weapons/NNP-33,USAF/NNP-32)
dep(Pilot/NN-22,Weapons/NNP-33)
conj_and(School/NNP-30,Weapons/NNP-33)
nn(Center/NNP-36,Tactics/NNP-35)
dep(Pilot/NN-22,Center/NNP-36)
conj_and(School/NNP-30,Center/NNP-36)
nn(Award/NN-43,Lt./NNP-38)
nn(Award/NN-43,Gen./NNP-39)
nn(Award/NN-43,Claire/NNP-40)
nn(Award/NN-43,Lee/NNP-41)
nn(Award/NN-43,Chennault/NNP-42)
dep(Pilot/NN-22,Award/NN-43)
nn(School/NNP-49,Distinguished/NNP-45)
nn(School/NNP-49,Graduate/NNP-46)
nn(School/NNP-49,Squadron/NNP-47)
nn(School/NNP-49,Officers/NNP-48)
dep(Pilot/NN-22,School/NNP-49)
nn(Replacement/NNP-55,Top/NNP-51)
nn(Replacement/NNP-55,Academic/NNP-52)
nn(Replacement/NNP-55,Award/NN-53)
nn(Replacement/NNP-55,F-16/NNP-54)
dep(Pilot/NN-22,Replacement/NNP-55)
xcomp(selected/VBN-17,Training/VBG-56)
dobj(Training/VBG-56,Unit/NN-57)
appos(Unit/NN-57,RTU/NN-59)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He received an honorary Doctor of Science degree from the State University of New York. </value>
<annotated-sentence> He received [[an honorary Doctor|Honorary_degree]] of [[Science|Science]] [[degree|Honorary_degree]] from [[the State University of New York|State_University_of_New_York]]. </annotated-sentence>
<pattern_crowdsource> He received an honorary Doctor of Science degree from the State University of New York. </pattern_crowdsource>
<tree>
nsubj(received/VBD-2,He/PRP-1)
det(Doctor/NN-5,an/DT-3)
amod(Doctor/NN-5,honorary/JJ-4)
dobj(received/VBD-2,Doctor/NN-5)
nn(degree/NN-8,Science/NNP-7)
prep_of(Doctor/NN-5,degree/NN-8)
det(University/NNP-12,the/DT-10)
nn(University/NNP-12,State/NNP-11)
prep_from(received/VBD-2,University/NNP-12)
nn(York/NNP-15,New/NNP-14)
prep_of(University/NNP-12,York/NNP-15)
</tree>
<annotations>
<annotation>
<surface-form>an honorary Doctor</surface-form>
<RDF-ID>http://dbpedia.org/resource/Honorary_degree</RDF-ID>
</annotation>
<annotation>
<surface-form>Science</surface-form>
<RDF-ID>http://dbpedia.org/resource/Science</RDF-ID>
</annotation>
<annotation>
<surface-form>degree</surface-form>
<RDF-ID>http://dbpedia.org/resource/Honorary_degree</RDF-ID>
</annotation>
<annotation>
<surface-form>the State University of New York</surface-form>
<RDF-ID>http://dbpedia.org/resource/State_University_of_New_York</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Garan received his commission as a Second Lieutenant in the United States Air Force from the Air Force Officer Training School at Lackland Air Force Base, TX, in 1984. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nsubj(received/VBD-2,Garan/NNP-1)
poss(commission/NN-4,his/PRP$-3)
dobj(received/VBD-2,commission/NN-4)
det(Lieutenant/NN-8,a/DT-6)
amod(Lieutenant/NN-8,Second/JJ-7)
prep_as(received/VBD-2,Lieutenant/NN-8)
det(Force/NNP-14,the/DT-10)
nn(Force/NNP-14,United/NNP-11)
nn(Force/NNP-14,States/NNP-12)
nn(Force/NNP-14,Air/NNP-13)
prep_in(Lieutenant/NN-8,Force/NNP-14)
det(School/NNP-21,the/DT-16)
nn(School/NNP-21,Air/NNP-17)
nn(School/NNP-21,Force/NNP-18)
nn(School/NNP-21,Officer/NNP-19)
nn(School/NNP-21,Training/NNP-20)
prep_from(received/VBD-2,School/NNP-21)
nn(Base/NNP-26,Lackland/NNP-23)
nn(Base/NNP-26,Air/NNP-24)
nn(Base/NNP-26,Force/NNP-25)
prep_at(received/VBD-2,Base/NNP-26)
appos(Base/NNP-26,TX/NNP-28)
prep_in(Base/NNP-26,1984/CD-31)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Upon completion, he attended Undergraduate Pilot Training (UPT) at Vance AFB, OK and earned his wings in 1985. </value>
<annotated-sentence> Upon completion, he attended [[Undergraduate Pilot Training|Air_Education_and_Training_Command]] (UPT) at [[Vance AFB|Vance_Air_Force_Base]], OK and earned his wings in [[1985|1985]]. </annotated-sentence>
<pattern_crowdsource> Upon completion, he attended [[Undergraduate Pilot Training|Air_Education_and_Training_Command]] (UPT) at [[Vance AFB|Vance_Air_Force_Base]], OK and earned his wings in 1985. </pattern_crowdsource>
<tree>
prep_upon(attended/VBD-5,completion/NN-2)
nsubj(attended/VBD-5,he/PRP-4)
nsubj(earned/VBD-18,he/PRP-4)
nn(Training/NN-8,Undergraduate/NNP-6)
nn(Training/NN-8,Pilot/NN-7)
dobj(attended/VBD-5,Training/NN-8)
appos(Training/NN-8,UPT/NN-10)
nn(AFB/NNP-14,Vance/NNP-13)
prep_at(attended/VBD-5,AFB/NNP-14)
dep(attended/VBD-5,OK/JJ-16)
conj_and(attended/VBD-5,earned/VBD-18)
poss(wings/NNS-20,his/PRP$-19)
dobj(earned/VBD-18,wings/NNS-20)
prep_in(earned/VBD-18,1985/CD-22)
</tree>
<annotations>
<annotation>
<surface-form>Undergraduate Pilot Training</surface-form>
<RDF-ID>http://dbpedia.org/resource/Air_Education_and_Training_Command</RDF-ID>
</annotation>
<annotation>
<surface-form>Vance AFB</surface-form>
<RDF-ID>http://dbpedia.org/resource/Vance_Air_Force_Base</RDF-ID>
</annotation>
<annotation>
<surface-form>1985</surface-form>
<RDF-ID>http://dbpedia.org/resource/1985</RDF-ID>
</annotation>
</annotations>
<triples>
<triple>
http://dbpedia.org/resource/Vance_Air_Force_Base http://dbpedia.org/property/partof http://dbpedia.org/resource/Air_Education_and_Training_Command
</triple>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He then completed F-16 training at Luke AFB, AZ and reported to Hahn Air Base in former West Germany where he served as a combat ready F-16 pilot in the 496th Tactical Fighter Squadron (TFS), from 1986-88. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nsubj(completed/VBD-3,He/PRP-1)
nsubj(reported/VBD-12,He/PRP-1)
advmod(completed/VBD-3,then/RB-2)
nn(training/NN-5,F-16/NN-4)
dobj(completed/VBD-3,training/NN-5)
nn(AFB/NNP-8,Luke/NNP-7)
prep_at(completed/VBD-3,AFB/NNP-8)
appos(AFB/NNP-8,AZ/NNP-10)
conj_and(completed/VBD-3,reported/VBD-12)
nn(Base/NNP-16,Hahn/NNP-14)
nn(Base/NNP-16,Air/NNP-15)
prep_to(reported/VBD-12,Base/NNP-16)
amod(Germany/NNP-20,former/JJ-18)
nn(Germany/NNP-20,West/NNP-19)
prep_in(Base/NNP-16,Germany/NNP-20)
advmod(served/VBD-23,where/WRB-21)
nsubj(served/VBD-23,he/PRP-22)
advcl(reported/VBD-12,served/VBD-23)
det(pilot/NN-29,a/DT-25)
nn(pilot/NN-29,combat/NN-26)
amod(pilot/NN-29,ready/JJ-27)
nn(pilot/NN-29,F-16/NN-28)
prep_as(served/VBD-23,pilot/NN-29)
det(Squadron/NNP-35,the/DT-31)
amod(Squadron/NNP-35,496th/JJ-32)
nn(Squadron/NNP-35,Tactical/NNP-33)
nn(Squadron/NNP-35,Fighter/NNP-34)
prep_in(served/VBD-23,Squadron/NNP-35)
appos(Squadron/NNP-35,TFS/NNP-37)
prep_from(served/VBD-23,1986-88/CD-41)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> In March 1988, he was reassigned to the 17th TFS, Shaw AFB, SC, where he served as an instructor pilot, evaluator pilot, and combat ready F-16 pilot. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
prep_in(reassigned/VBN-7,March/NNP-2)
num(March/NNP-2,1988/CD-3)
nsubjpass(reassigned/VBN-7,he/PRP-5)
auxpass(reassigned/VBN-7,was/VBD-6)
det(TFS/NN-11,the/DT-9)
amod(TFS/NN-11,17th/JJ-10)
prep_to(reassigned/VBN-7,TFS/NN-11)
nn(AFB/NNP-14,Shaw/NNP-13)
appos(TFS/NN-11,AFB/NNP-14)
appos(TFS/NN-11,SC/NNP-16)
advmod(served/VBD-20,where/WRB-18)
nsubj(served/VBD-20,he/PRP-19)
rcmod(TFS/NN-11,served/VBD-20)
det(pilot/NN-24,an/DT-22)
nn(pilot/NN-24,instructor/NN-23)
prep_as(served/VBD-20,pilot/NN-24)
nn(pilot/NN-27,evaluator/NN-26)
prep_as(served/VBD-20,pilot/NN-27)
conj_and(pilot/NN-24,pilot/NN-27)
prep_as(served/VBD-20,combat/NN-30)
conj_and(pilot/NN-24,combat/NN-30)
amod(pilot/NN-33,ready/JJ-31)
nn(pilot/NN-33,F-16/NN-32)
dep(combat/NN-30,pilot/NN-33)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> While stationed at Shaw he attended the USAF Fighter Weapons School, graduating in 1989, and then returned to the 17th TFS to assume the position of Squadron Weapons Officer. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
mark(stationed/VBN-2,While/IN-1)
advcl(attended/VBD-6,stationed/VBN-2)
prep_at(stationed/VBN-2,Shaw/NNP-4)
nsubj(attended/VBD-6,he/PRP-5)
det(School/NNP-11,the/DT-7)
nn(School/NNP-11,USAF/NNP-8)
nn(School/NNP-11,Fighter/NNP-9)
nn(School/NNP-11,Weapons/NNP-10)
dobj(attended/VBD-6,School/NNP-11)
partmod(attended/VBD-6,graduating/VBG-13)
prep_in(graduating/VBG-13,1989/CD-15)
nsubj(returned/VBD-19,then/RB-18)
conj_and(attended/VBD-6,returned/VBD-19)
det(TFS/NN-23,the/DT-21)
amod(TFS/NN-23,17th/JJ-22)
prep_to(returned/VBD-19,TFS/NN-23)
aux(assume/VB-25,to/TO-24)
xcomp(returned/VBD-19,assume/VB-25)
det(position/NN-27,the/DT-26)
dobj(assume/VB-25,position/NN-27)
nn(Officer/NNP-31,Squadron/NNP-29)
nn(Officer/NNP-31,Weapons/NNP-30)
prep_of(position/NN-27,Officer/NNP-31)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> From August 1990 through March 1991, he deployed to Southwest Asia in support of Operations Desert Shield/Desert Storm where he flew combat missions in the F-16. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
prep_from(deployed/VBD-9,August/NNP-2)
num(August/NNP-2,1990/CD-3)
prep_through(August/NNP-2,March/NNP-5)
num(March/NNP-5,1991/CD-6)
nsubj(deployed/VBD-9,he/PRP-8)
nn(Asia/NNP-12,Southwest/NNP-11)
prep_to(deployed/VBD-9,Asia/NNP-12)
prep_in(Asia/NNP-12,support/NN-14)
nn(Storm/NN-19,Operations/NNP-16)
nn(Storm/NN-19,Desert/NNP-17)
nn(Storm/NN-19,Shield/Desert/NNP-18)
prep_of(support/NN-14,Storm/NN-19)
advmod(flew/VBD-22,where/WRB-20)
nsubj(flew/VBD-22,he/PRP-21)
advcl(deployed/VBD-9,flew/VBD-22)
nn(missions/NNS-24,combat/NN-23)
dobj(flew/VBD-22,missions/NNS-24)
det(F-16/NNP-27,the/DT-26)
prep_in(flew/VBD-22,F-16/NNP-27)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> In 1991, Garan was reassigned to the USAF Weapons School where he served as an F-16 Weapons School Instructor Pilot, Flight Commander and Assistant Operations Officer. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
prep_in(reassigned/VBN-6,1991/CD-2)
nsubjpass(reassigned/VBN-6,Garan/NNP-4)
auxpass(reassigned/VBN-6,was/VBD-5)
det(School/NNP-11,the/DT-8)
nn(School/NNP-11,USAF/NNP-9)
nn(School/NNP-11,Weapons/NNP-10)
prep_to(reassigned/VBN-6,School/NNP-11)
advmod(served/VBD-14,where/WRB-12)
nsubj(served/VBD-14,he/PRP-13)
advcl(reassigned/VBN-6,served/VBD-14)
det(Pilot/NN-21,an/DT-16)
nn(Pilot/NN-21,F-16/NN-17)
nn(Pilot/NN-21,Weapons/NNP-18)
nn(Pilot/NN-21,School/NNP-19)
nn(Pilot/NN-21,Instructor/NNP-20)
prep_as(served/VBD-14,Pilot/NN-21)
nn(Commander/NNP-24,Flight/NNP-23)
prep_as(served/VBD-14,Commander/NNP-24)
conj_and(Pilot/NN-21,Commander/NNP-24)
nn(Officer/NNP-28,Assistant/NNP-26)
nn(Officer/NNP-28,Operations/NNP-27)
prep_as(served/VBD-14,Officer/NNP-28)
conj_and(Pilot/NN-21,Officer/NNP-28)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> In 1994, he was reassigned to the 39th Flight Test Squadron (39th FTS), Eglin AFB, FL where he served as a developmental test pilot and chief F-16 pilot. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
prep_in(reassigned/VBN-6,1994/CD-2)
nsubjpass(reassigned/VBN-6,he/PRP-4)
auxpass(reassigned/VBN-6,was/VBD-5)
det(Squadron/NN-12,the/DT-8)
amod(Squadron/NN-12,39th/JJ-9)
nn(Squadron/NN-12,Flight/NN-10)
nn(Squadron/NN-12,Test/NN-11)
prep_to(reassigned/VBN-6,Squadron/NN-12)
amod(FTS/NN-15,39th/JJ-14)
appos(Squadron/NN-12,FTS/NN-15)
nn(AFB/NNP-19,Eglin/NNP-18)
appos(Squadron/NN-12,AFB/NNP-19)
appos(Squadron/NN-12,FL/NN-21)
advmod(served/VBD-24,where/WRB-22)
nsubj(served/VBD-24,he/PRP-23)
rcmod(FL/NN-21,served/VBD-24)
det(pilot/NN-29,a/DT-26)
amod(pilot/NN-29,developmental/JJ-27)
nn(pilot/NN-29,test/NN-28)
prep_as(served/VBD-24,pilot/NN-29)
nn(pilot/NN-33,chief/NN-31)
nn(pilot/NN-33,F-16/NN-32)
prep_as(served/VBD-24,pilot/NN-33)
conj_and(pilot/NN-29,pilot/NN-33)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Garan attended the US Naval Test Pilot School at the Patuxent River Naval Air Station, MD from JanuaryDecember 1997, after which he was reassigned to the 39th FTS, Eglin AFB, FL where he served as the Director of the Joint Air to Surface Standoff Missile Combined Test Force. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nsubj(attended/VBD-2,Garan/NNP-1)
det(School/NNP-8,the/DT-3)
nn(School/NNP-8,US/NNP-4)
nn(School/NNP-8,Naval/NNP-5)
nn(School/NNP-8,Test/NNP-6)
nn(School/NNP-8,Pilot/NN-7)
dobj(attended/VBD-2,School/NNP-8)
det(Station/NNP-15,the/DT-10)
nn(Station/NNP-15,Patuxent/NNP-11)
nn(Station/NNP-15,River/NNP-12)
nn(Station/NNP-15,Naval/NNP-13)
nn(Station/NNP-15,Air/NNP-14)
prep_at(School/NNP-8,Station/NNP-15)
appos(School/NNP-8,MD/NN-17)
prep_from(MD/NN-17,January/NNP-19)
dep(MD/NN-17,December/NNP-21)
num(December/NNP-21,1997/CD-22)
prep_after(reassigned/VBN-28,which/WDT-25)
nsubjpass(reassigned/VBN-28,he/PRP-26)
auxpass(reassigned/VBN-28,was/VBD-27)
rcmod(December/NNP-21,reassigned/VBN-28)
det(FTS/NN-32,the/DT-30)
amod(FTS/NN-32,39th/JJ-31)
prep_to(reassigned/VBN-28,FTS/NN-32)
nn(AFB/NNP-35,Eglin/NNP-34)
appos(FTS/NN-32,AFB/NNP-35)
appos(School/NNP-8,FL/NN-37)
advmod(served/VBD-40,where/WRB-38)
nsubj(served/VBD-40,he/PRP-39)
rcmod(FL/NN-37,served/VBD-40)
det(Director/NN-43,the/DT-42)
prep_as(served/VBD-40,Director/NN-43)
det(Air/NNP-47,the/DT-45)
nn(Air/NNP-47,Joint/NNP-46)
prep_of(Director/NN-43,Air/NNP-47)
nn(Force/NNP-54,Surface/NN-49)
nn(Force/NNP-54,Standoff/NN-50)
nn(Force/NNP-54,Missile/NNP-51)
nn(Force/NNP-54,Combined/NNP-52)
nn(Force/NNP-54,Test/NNP-53)
prep_to(served/VBD-40,Force/NNP-54)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Garan was the Operations Officer of the 40th FTS when he was selected as an astronaut for NASA. </value>
<annotated-sentence> [[Garan|Shichid%C5%8D_garan]] was [[the Operations Officer|Operations_(military_staff)]] of the 40th FTS when he was selected as [[an astronaut|Astronaut]] for [[NASA|NASA]]. </annotated-sentence>
<pattern_crowdsource> Garan was the Operations Officer of the 40th FTS when he was selected as an astronaut for NASA. </pattern_crowdsource>
<tree>
nsubj(Officer/NNP-5,Garan/NNP-1)
cop(Officer/NNP-5,was/VBD-2)
det(Officer/NNP-5,the/DT-3)
nn(Officer/NNP-5,Operations/NNP-4)
det(FTS/NN-9,the/DT-7)
amod(FTS/NN-9,40th/JJ-8)
prep_of(Officer/NNP-5,FTS/NN-9)
advmod(selected/VBN-13,when/WRB-10)
nsubjpass(selected/VBN-13,he/PRP-11)
auxpass(selected/VBN-13,was/VBD-12)
rcmod(FTS/NN-9,selected/VBN-13)
det(astronaut/NN-16,an/DT-15)
prep_as(selected/VBN-13,astronaut/NN-16)
prep_for(astronaut/NN-16,NASA/NNP-18)
</tree>
<annotations>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
<annotation>
<surface-form>the Operations Officer</surface-form>
<RDF-ID>http://dbpedia.org/resource/Operations_(military_staff)</RDF-ID>
</annotation>
<annotation>
<surface-form>an astronaut</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Astronaut</RDF-ID>
</annotation>
<annotation>
<surface-form>NASA</surface-form>
<RDF-ID>http://dbpedia.org/resource/NASA</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He has logged over 5,000 hours in more than thirty different aircraft. </value>
<annotated-sentence> He has logged over [[5,000|5,000,000]] [[hours|Hour]] in more than [[thirty|Armstrong_Siddeley__Thirty__1]] different [[aircraft|Aircraft]]. </annotated-sentence>
<pattern_crowdsource> He has logged over 5,000 hours in more than thirty different aircraft. </pattern_crowdsource>
<tree>
nsubj(logged/VBN-3,He/PRP-1)
aux(logged/VBN-3,has/VBZ-2)
num(hours/NNS-6,5,000/CD-5)
prep_over(logged/VBN-3,hours/NNS-6)
mwe(than/IN-9,more/JJR-8)
quantmod(thirty/CD-10,than/IN-9)
num(aircraft/NN-12,thirty/CD-10)
amod(aircraft/NN-12,different/JJ-11)
prep_in(hours/NNS-6,aircraft/NN-12)
</tree>
<annotations>
<annotation>
<surface-form>5,000</surface-form>
<RDF-ID>http://dbpedia.org/resource/5,000,000</RDF-ID>
</annotation>
<annotation>
<surface-form>hours</surface-form>
<RDF-ID>http://dbpedia.org/resource/Hour</RDF-ID>
</annotation>
<annotation>
<surface-form>thirty</surface-form>
<RDF-ID>http://dbpedia.org/resource/Armstrong_Siddeley__Thirty__1</RDF-ID>
</annotation>
<annotation>
<surface-form>aircraft</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Aircraft</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> On June 1, 2009, Garan retired from the Air Force. </value>
<annotated-sentence> On June 1, 2009, [[Garan|Shichid%C5%8D_garan]] retired from [[the Air Force|Air_force]]. </annotated-sentence>
<pattern_crowdsource> On June 1, 2009, Garan retired from the Air Force. </pattern_crowdsource>
<tree>
prep_on(retired/VBD-8,June/NNP-2)
num(June/NNP-2,1/CD-3)
num(June/NNP-2,2009/CD-5)
nsubj(retired/VBD-8,Garan/NNP-7)
det(Force/NNP-12,the/DT-10)
nn(Force/NNP-12,Air/NNP-11)
prep_from(retired/VBD-8,Force/NNP-12)
</tree>
<annotations>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
<annotation>
<surface-form>the Air Force</surface-form>
<RDF-ID>http://dbpedia.org/resource/Air_force</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Selected as a pilot by NASA in July 2000, Colonel Garan reported for training in August 2000. </value>
<annotated-sentence> Selected as a pilot by [[NASA|NASA]] in [[July 2000|July_2000]], [[Colonel|Colonel]] [[Garan|Shichid%C5%8D_garan]] reported for [[training|Training]] in [[August 2000|August_2000]]. </annotated-sentence>
<pattern_crowdsource> Selected as a pilot by NASA in July 2000, Colonel Garan reported for training in August 2000. </pattern_crowdsource>
<tree>
partmod(reported/VBD-13,Selected/VBN-1)
det(pilot/NN-4,a/DT-3)
prep_as(Selected/VBN-1,pilot/NN-4)
agent(Selected/VBN-1,NASA/NNP-6)
prep_in(Selected/VBN-1,July/NNP-8)
num(July/NNP-8,2000/CD-9)
nn(Garan/NNP-12,Colonel/NNP-11)
nsubj(reported/VBD-13,Garan/NNP-12)
prep_for(reported/VBD-13,training/NN-15)
prep_in(reported/VBD-13,August/NNP-17)
num(August/NNP-17,2000/CD-18)
</tree>
<annotations>
<annotation>
<surface-form>NASA</surface-form>
<RDF-ID>http://dbpedia.org/resource/NASA</RDF-ID>
</annotation>
<annotation>
<surface-form>July 2000</surface-form>
<RDF-ID>http://dbpedia.org/resource/July_2000</RDF-ID>
</annotation>
<annotation>
<surface-form>Colonel</surface-form>
<RDF-ID>http://dbpedia.org/resource/Colonel</RDF-ID>
</annotation>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
<annotation>
<surface-form>training</surface-form>
<RDF-ID>http://dbpedia.org/resource/Training</RDF-ID>
</annotation>
<annotation>
<surface-form>August 2000</surface-form>
<RDF-ID>http://dbpedia.org/resource/August_2000</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Following the completion of two years of training and evaluation, he was assigned technical duties in the Astronaut Office Station and Shuttle Operations Branches. </value>
<annotated-sentence> Following the completion of [[two years|Year]] of [[training and evaluation|Course_evaluation]], he was assigned technical [[duties|Duty]] in the [[Astronaut Office|NASA_Astronaut_Corps]] [[Station|Station]] and Shuttle Operations Branches. </annotated-sentence>
<pattern_crowdsource> Following the completion of two years of training and evaluation, he was assigned technical duties in the Astronaut Office Station and Shuttle Operations Branches. </pattern_crowdsource>
<tree>
det(completion/NN-3,the/DT-2)
prep_following(assigned/VBN-14,completion/NN-3)
num(years/NNS-6,two/CD-5)
prep_of(completion/NN-3,years/NNS-6)
prep_of(years/NNS-6,training/NN-8)
prep_of(years/NNS-6,evaluation/NN-10)
conj_and(training/NN-8,evaluation/NN-10)
nsubjpass(assigned/VBN-14,he/PRP-12)
auxpass(assigned/VBN-14,was/VBD-13)
amod(duties/NNS-16,technical/JJ-15)
dobj(assigned/VBN-14,duties/NNS-16)
det(Station/NNP-21,the/DT-18)
nn(Station/NNP-21,Astronaut/NNP-19)
nn(Station/NNP-21,Office/NNP-20)
prep_in(assigned/VBN-14,Station/NNP-21)
nn(Branches/NNPS-25,Shuttle/NNP-23)
nn(Branches/NNPS-25,Operations/NNP-24)
prep_in(assigned/VBN-14,Branches/NNPS-25)
conj_and(Station/NNP-21,Branches/NNPS-25)
</tree>
<annotations>
<annotation>
<surface-form>two years</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Year</RDF-ID>
</annotation>
<annotation>
<surface-form>training and evaluation</surface-form>
<RDF-ID>http://dbpedia.org/resource/Course_evaluation</RDF-ID>
</annotation>
<annotation>
<surface-form>duties</surface-form>
<RDF-ID>http://dbpedia.org/resource/Duty</RDF-ID>
</annotation>
<annotation>
<surface-form>Astronaut Office</surface-form>
<RDF-ID>http://dbpedia.org/resource/NASA_Astronaut_Corps</RDF-ID>
</annotation>
<annotation>
<surface-form>Station</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Station</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> In April 2006, Garan became an aquanaut through his participation in the joint NASA-NOAA, NEEMO 9 (NASA Extreme Environment Mission Operations) project, an exploration research mission held in Aquarius, the world's only undersea research laboratory. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
prep_in(aquanaut/NN-8,April/NNP-2)
num(April/NNP-2,2006/CD-3)
nsubj(aquanaut/NN-8,Garan/NNP-5)
cop(aquanaut/NN-8,became/VBD-6)
det(aquanaut/NN-8,an/DT-7)
poss(participation/NN-11,his/PRP$-10)
prep_through(aquanaut/NN-8,participation/NN-11)
det(NASA-NOAA/NN-15,the/DT-13)
amod(NASA-NOAA/NN-15,joint/JJ-14)
prep_in(participation/NN-11,NASA-NOAA/NN-15)
appos(NASA-NOAA/NN-15,NEEMO/NNP-17)
num(NEEMO/NNP-17,9/CD-18)
nn(Operations/NNP-24,NASA/NNP-20)
nn(Operations/NNP-24,Extreme/NNP-21)
nn(Operations/NNP-24,Environment/NNP-22)
nn(Operations/NNP-24,Mission/NNP-23)
appos(NASA-NOAA/NN-15,Operations/NNP-24)
dep(NASA-NOAA/NN-15,project/NN-26)
det(mission/NN-31,an/DT-28)
nn(mission/NN-31,exploration/NN-29)
nn(mission/NN-31,research/NN-30)
appos(participation/NN-11,mission/NN-31)
partmod(mission/NN-31,held/VBN-32)
prep_in(held/VBN-32,Aquarius/NNP-34)
det(world/NN-37,the/DT-36)
poss(laboratory/NN-42,world/NN-37)
amod(laboratory/NN-42,only/JJ-39)
nn(laboratory/NN-42,undersea/NN-40)
nn(laboratory/NN-42,research/NN-41)
appos(Aquarius/NNP-34,laboratory/NN-42)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> During this eighteen-day mission, the six-person crew of NEEMO 9 developed lunar surface exploration procedures and telemedical technology applications in support of the United States' Vision for Space Exploration. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
det(mission/NN-4,this/DT-2)
amod(mission/NN-4,eighteen-day/JJ-3)
prep_during(developed/VBD-12,mission/NN-4)
det(crew/NN-8,the/DT-6)
amod(crew/NN-8,six-person/JJ-7)
nsubj(developed/VBD-12,crew/NN-8)
prep_of(crew/NN-8,NEEMO/NNP-10)
num(NEEMO/NNP-10,9/CD-11)
amod(procedures/NNS-16,lunar/JJ-13)
nn(procedures/NNS-16,surface/NN-14)
nn(procedures/NNS-16,exploration/NN-15)
dobj(developed/VBD-12,procedures/NNS-16)
amod(applications/NNS-20,telemedical/JJ-18)
nn(applications/NNS-20,technology/NN-19)
dobj(developed/VBD-12,applications/NNS-20)
conj_and(procedures/NNS-16,applications/NNS-20)
prep_in(developed/VBD-12,support/NN-22)
det(States/NNPS-26,the/DT-24)
nn(States/NNPS-26,United/NNP-25)
poss(Vision/NNP-28,States/NNPS-26)
prep_of(support/NN-22,Vision/NNP-28)
nn(Exploration/NNP-31,Space/NNP-30)
prep_for(developed/VBD-12,Exploration/NNP-31)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Ron Garan completed his first space flight in 2008 on STS-124 as Mission Specialist 2 for ascent and entry, and has logged over 13 days in space and 27 hours and 3 minutes of EVA in four spacewalks. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
nn(Garan/NNP-2,Ron/NNP-1)
nsubj(completed/VBD-3,Garan/NNP-2)
nsubj(logged/VBN-23,Garan/NNP-2)
poss(flight/NN-7,his/PRP$-4)
amod(flight/NN-7,first/JJ-5)
nn(flight/NN-7,space/NN-6)
dobj(completed/VBD-3,flight/NN-7)
prep_in(flight/NN-7,2008/CD-9)
prep_on(completed/VBD-3,STS-124/NN-11)
nn(Specialist/NN-14,Mission/NNP-13)
prep_as(STS-124/NN-11,Specialist/NN-14)
tmod(completed/VBD-3,2/CD-15)
prep_for(completed/VBD-3,ascent/NN-17)
prep_for(completed/VBD-3,entry/NN-19)
conj_and(ascent/NN-17,entry/NN-19)
aux(logged/VBN-23,has/VBZ-22)
conj_and(completed/VBD-3,logged/VBN-23)
num(days/NNS-26,13/CD-25)
prep_over(logged/VBN-23,days/NNS-26)
prep_in(days/NNS-26,space/NN-28)
num(hours/NNS-31,27/CD-30)
prep_in(days/NNS-26,hours/NNS-31)
conj_and(space/NN-28,hours/NNS-31)
num(minutes/NNS-34,3/CD-33)
prep_over(logged/VBN-23,minutes/NNS-34)
conj_and(days/NNS-26,minutes/NNS-34)
prep_of(minutes/NNS-34,EVA/NNP-36)
num(spacewalks/NNS-39,four/CD-38)
prep_in(logged/VBN-23,spacewalks/NNS-39)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> STS-124 also delivered a new station crew member, Expedition 17 Flight Engineer Greg Chamitoff. </value>
<annotated-sentence> [[STS-124|STS-124]] also delivered [[a new station|Station]] [[crew member|Crewman]], [[Expedition 17|Expedition_17]] [[Flight Engineer|Flight_engineer]] [[Greg Chamitoff|Gregory_Chamitoff]]. </annotated-sentence>
<pattern_crowdsource> [[STS-124|STS-124]] also delivered a new station crew member, [[Expedition 17|Expedition_17]] Flight Engineer [[Greg Chamitoff|Gregory_Chamitoff]]. </pattern_crowdsource>
<tree>
nsubj(delivered/VBD-3,STS-124/NN-1)
advmod(delivered/VBD-3,also/RB-2)
det(station/NN-6,a/DT-4)
amod(station/NN-6,new/JJ-5)
iobj(delivered/VBD-3,station/NN-6)
nn(member/NN-8,crew/NN-7)
dobj(delivered/VBD-3,member/NN-8)
appos(member/NN-8,Expedition/NN-10)
num(Expedition/NN-10,17/CD-11)
nn(Chamitoff/NNP-15,Flight/NNP-12)
nn(Chamitoff/NNP-15,Engineer/NNP-13)
nn(Chamitoff/NNP-15,Greg/NNP-14)
dep(Expedition/NN-10,Chamitoff/NNP-15)
</tree>
<annotations>
<annotation>
<surface-form>STS-124</surface-form>
<RDF-ID>http://dbpedia.org/resource/STS-124</RDF-ID>
</annotation>
<annotation>
<surface-form>a new station</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Station</RDF-ID>
</annotation>
<annotation>
<surface-form>crew member</surface-form>
<RDF-ID>http://dbpedia.org/resource/Crewman</RDF-ID>
</annotation>
<annotation>
<surface-form>Expedition 17</surface-form>
<RDF-ID>http://dbpedia.org/resource/Expedition_17</RDF-ID>
</annotation>
<annotation>
<surface-form>Flight Engineer</surface-form>
<RDF-ID>http://dbpedia.org/resource/Flight_engineer</RDF-ID>
</annotation>
<annotation>
<surface-form>Greg Chamitoff</surface-form>
<RDF-ID>http://dbpedia.org/resource/Gregory_Chamitoff</RDF-ID>
</annotation>
</annotations>
<triples>
<triple>
http://dbpedia.org/resource/STS-124 http://dbpedia.org/property/expedition7Down http://dbpedia.org/resource/Expedition_17
</triple>
<triple>
http://dbpedia.org/resource/STS-124 http://dbpedia.org/property/expedition7Up http://dbpedia.org/resource/Expedition_17
</triple>
<triple>
http://dbpedia.org/resource/STS-124 http://dbpedia.org/property/crewLaunching http://dbpedia.org/resource/Gregory_Chamitoff
</triple>
<triple>
http://dbpedia.org/resource/STS-124 http://dbpedia.org/property/crew7Up http://dbpedia.org/resource/Gregory_Chamitoff
</triple>
<triple>
http://dbpedia.org/resource/Gregory_Chamitoff http://dbpedia.org/ontology/mission http://dbpedia.org/resource/STS-124
</triple>
<triple>
http://dbpedia.org/resource/Expedition_17 http://dbpedia.org/property/crewMembers http://dbpedia.org/resource/Gregory_Chamitoff
</triple>
<triple>
http://dbpedia.org/resource/Gregory_Chamitoff http://dbpedia.org/ontology/mission http://dbpedia.org/resource/Expedition_17
</triple>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> He replaced Expedition 16 Flight Engineer Garrett Reisman, who returned to Earth with the STS-124 crew. </value>
<annotated-sentence> He replaced [[Expedition 16|Expedition_16]] [[Flight Engineer|Flight_engineer]] [[Garrett Reisman|Garrett_Reisman]], who returned to [[Earth|Earth]] with the [[STS-124|STS-124]] crew. </annotated-sentence>
<pattern_crowdsource> He replaced [[Expedition 16|Expedition_16]] Flight Engineer [[Garrett Reisman|Garrett_Reisman]], who returned to Earth with the [[STS-124|STS-124]] crew. </pattern_crowdsource>
<tree>
nsubj(replaced/VBD-2,He/PRP-1)
dobj(replaced/VBD-2,Expedition/NNP-3)
num(Expedition/NNP-3,16/CD-4)
nn(Reisman/NNP-8,Flight/NNP-5)
nn(Reisman/NNP-8,Engineer/NNP-6)
nn(Reisman/NNP-8,Garrett/NNP-7)
tmod(replaced/VBD-2,Reisman/NNP-8)
nsubj(returned/VBD-11,who/WP-10)
rcmod(Reisman/NNP-8,returned/VBD-11)
prep_to(returned/VBD-11,Earth/NNP-13)
det(crew/NN-17,the/DT-15)
nn(crew/NN-17,STS-124/NN-16)
prep_with(returned/VBD-11,crew/NN-17)
</tree>
<annotations>
<annotation>
<surface-form>Expedition 16</surface-form>
<RDF-ID>http://dbpedia.org/resource/Expedition_16</RDF-ID>
</annotation>
<annotation>
<surface-form>Flight Engineer</surface-form>
<RDF-ID>http://dbpedia.org/resource/Flight_engineer</RDF-ID>
</annotation>
<annotation>
<surface-form>Garrett Reisman</surface-form>
<RDF-ID>http://dbpedia.org/resource/Garrett_Reisman</RDF-ID>
</annotation>
<annotation>
<surface-form>Earth</surface-form>
<RDF-ID>http://dbpedia.org/resource/Earth</RDF-ID>
</annotation>
<annotation>
<surface-form>STS-124</surface-form>
<RDF-ID>http://dbpedia.org/resource/STS-124</RDF-ID>
</annotation>
</annotations>
<triples>
<triple>
http://dbpedia.org/resource/Expedition_16 http://dbpedia.org/property/crewMembers http://dbpedia.org/resource/Garrett_Reisman
</triple>
<triple>
http://dbpedia.org/resource/Garrett_Reisman http://dbpedia.org/ontology/mission http://dbpedia.org/resource/Expedition_16
</triple>
<triple>
http://dbpedia.org/resource/Garrett_Reisman http://dbpedia.org/ontology/mission http://dbpedia.org/resource/STS-124
</triple>
<triple>
http://dbpedia.org/resource/STS-124 http://dbpedia.org/property/crew7Down http://dbpedia.org/resource/Garrett_Reisman
</triple>
<triple>
http://dbpedia.org/resource/STS-124 http://dbpedia.org/property/crewLanding http://dbpedia.org/resource/Garrett_Reisman
</triple>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> The STS-124 mission was completed in 218 orbits, traveling 5,735,643 miles in 13 days, 18 hours, 13 minutes and 7 seconds. </value>
<annotated-sentence> The [[STS-124|STS-124]] mission was completed in 218 orbits, traveling 5,735,643 [[miles|Mile]] in 13 days, 18 [[hours|Hour]], 13 [[minutes|Minute]] and 7 seconds. </annotated-sentence>
<pattern_crowdsource> The STS-124 mission was completed in 218 orbits, traveling 5,735,643 miles in 13 days, 18 hours, 13 minutes and 7 seconds. </pattern_crowdsource>
<tree>
det(mission/NN-3,The/DT-1)
nn(mission/NN-3,STS-124/NN-2)
nsubjpass(completed/VBN-5,mission/NN-3)
auxpass(completed/VBN-5,was/VBD-4)
num(orbits/NNS-8,218/CD-7)
prep_in(completed/VBN-5,orbits/NNS-8)
xcomp(completed/VBN-5,traveling/VBG-10)
num(miles/NNS-12,5,735,643/CD-11)
dobj(traveling/VBG-10,miles/NNS-12)
num(days/NNS-15,13/CD-14)
prep_in(traveling/VBG-10,days/NNS-15)
num(hours/NNS-18,18/CD-17)
prep_in(traveling/VBG-10,hours/NNS-18)
conj_and(days/NNS-15,hours/NNS-18)
num(minutes/NNS-21,13/CD-20)
prep_in(traveling/VBG-10,minutes/NNS-21)
conj_and(days/NNS-15,minutes/NNS-21)
num(seconds/NNS-24,7/CD-23)
prep_in(traveling/VBG-10,seconds/NNS-24)
conj_and(days/NNS-15,seconds/NNS-24)
</tree>
<annotations>
<annotation>
<surface-form>STS-124</surface-form>
<RDF-ID>http://dbpedia.org/resource/STS-124</RDF-ID>
</annotation>
<annotation>
<surface-form>miles</surface-form>
<RDF-ID>http://dbpedia.org/resource/Mile</RDF-ID>
</annotation>
<annotation>
<surface-form>hours</surface-form>
<RDF-ID>http://dbpedia.org/resource/Hour</RDF-ID>
</annotation>
<annotation>
<surface-form>minutes</surface-form>
<RDF-ID>http://dbpedia.org/resource/Minute</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Before his flight aboard Discovery in 2008, Garan asked the women religious of a Carmelite community in New Caney, Texas for their prayers and told them he could take an item into space for them. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
poss(flight/NN-3,his/PRP$-2)
prep_before(asked/VBD-10,flight/NN-3)
prep_aboard(flight/NN-3,Discovery/NNP-5)
prep_in(Discovery/NNP-5,2008/CD-7)
nsubj(asked/VBD-10,Garan/NNP-9)
nsubj(told/VBD-27,Garan/NNP-9)
det(women/NNS-12,the/DT-11)
dobj(asked/VBD-10,women/NNS-12)
amod(women/NNS-12,religious/JJ-13)
det(community/NN-17,a/DT-15)
amod(community/NN-17,Carmelite/JJ-16)
prep_of(women/NNS-12,community/NN-17)
nn(Caney/NNP-20,New/NNP-19)
prep_in(asked/VBD-10,Caney/NNP-20)
appos(Caney/NNP-20,Texas/NNP-22)
poss(prayers/NNS-25,their/PRP$-24)
prep_for(Texas/NNP-22,prayers/NNS-25)
conj_and(asked/VBD-10,told/VBD-27)
dobj(told/VBD-27,them/PRP-28)
nsubj(take/VB-31,he/PRP-29)
aux(take/VB-31,could/MD-30)
dep(told/VBD-27,take/VB-31)
det(item/NN-33,an/DT-32)
dobj(take/VB-31,item/NN-33)
prep_into(take/VB-31,space/NN-35)
prep_for(space/NN-35,them/PRP-37)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> The sisters gave him relics of St. Thérèse of Lisieux, and quoted her words: I have the vocation of an apostle. </value>
<annotated-sentence> The sisters gave him [[relics|Relic]] of [[St. Thérèse of Lisieux|Th%C3%A9r%C3%A8se_of_Lisieux]], and quoted her words: I have [[the vocation|Vocation]] of [[an apostle|Apostle]]. </annotated-sentence>
<pattern_crowdsource> The sisters gave him relics of St. Thérèse of Lisieux, and quoted her words: I have the vocation of an apostle. </pattern_crowdsource>
<tree>
det(sisters/NNS-2,The/DT-1)
nsubj(gave/VBD-3,sisters/NNS-2)
nsubj(quoted/VBD-13,sisters/NNS-2)
iobj(gave/VBD-3,him/PRP-4)
dobj(gave/VBD-3,relics/NNS-5)
nn(Thérèse/NNP-8,St./NNP-7)
prep_of(relics/NNS-5,Thérèse/NNP-8)
prep_of(Thérèse/NNP-8,Lisieux/NNP-10)
conj_and(gave/VBD-3,quoted/VBD-13)
poss(words/NNS-15,her/PRP$-14)
dobj(quoted/VBD-13,words/NNS-15)
nsubj(have/VBP-18,I/PRP-17)
parataxis(gave/VBD-3,have/VBP-18)
det(vocation/NN-20,the/DT-19)
dobj(have/VBP-18,vocation/NN-20)
det(apostle/NN-23,an/DT-22)
prep_of(vocation/NN-20,apostle/NN-23)
</tree>
<annotations>
<annotation>
<surface-form>relics</surface-form>
<RDF-ID>http://dbpedia.org/resource/Relic</RDF-ID>
</annotation>
<annotation>
<surface-form>St. Thérèse of Lisieux</surface-form>
<RDF-ID>http://dbpedia.org/resource/Th%C3%A9r%C3%A8se_of_Lisieux</RDF-ID>
</annotation>
<annotation>
<surface-form>the vocation</surface-form>
<RDF-ID>http://dbpedia.org/resource/Vocation</RDF-ID>
</annotation>
<annotation>
<surface-form>an apostle</surface-form>
<RDF-ID>http://dbpedia.org/resource/Apostle</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> I would like to travel over the whole earth to preach your name and to plant your glorious cross on infidel soil. </value>
<annotated-sentence> I would like to travel over [[the whole earth|Soil]] to preach your name and to plant your glorious cross on [[infidel|Infidel]] [[soil|Soil]]. </annotated-sentence>
<pattern_crowdsource> I would like to travel over the whole earth to preach your name and to plant your glorious cross on infidel soil. </pattern_crowdsource>
<tree>
nsubj(like/VB-3,I/PRP-1)
aux(like/VB-3,would/MD-2)
aux(travel/VB-5,to/TO-4)
xcomp(like/VB-3,travel/VB-5)
det(earth/NN-9,the/DT-7)
amod(earth/NN-9,whole/JJ-8)
prep_over(travel/VB-5,earth/NN-9)
aux(preach/VB-11,to/TO-10)
ccomp(travel/VB-5,preach/VB-11)
poss(name/NN-13,your/PRP$-12)
dobj(preach/VB-11,name/NN-13)
aux(plant/VB-16,to/TO-15)
ccomp(travel/VB-5,plant/VB-16)
conj_and(preach/VB-11,plant/VB-16)
poss(cross/NN-19,your/PRP$-17)
amod(cross/NN-19,glorious/JJ-18)
dobj(plant/VB-16,cross/NN-19)
nn(soil/NN-22,infidel/NN-21)
prep_on(plant/VB-16,soil/NN-22)
</tree>
<annotations>
<annotation>
<surface-form>the whole earth</surface-form>
<RDF-ID>http://dbpedia.org/resource/Soil</RDF-ID>
</annotation>
<annotation>
<surface-form>infidel</surface-form>
<RDF-ID>http://dbpedia.org/resource/Infidel</RDF-ID>
</annotation>
<annotation>
<surface-form>soil</surface-form>
<RDF-ID>http://dbpedia.org/resource/Soil</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> But oh, my beloved, one mission would not be enough for me, I would want to preach the Gospel on all five continents simultaneously and even to the most remote isles. </value>
<annotated-sentence> null </annotated-sentence>
<pattern_crowdsource> null </pattern_crowdsource>
<tree>
cc(enough/RB-12,But/CC-1)
discourse(enough/RB-12,oh/UH-2)
poss(beloved/JJ-5,my/PRP$-4)
nsubj(enough/RB-12,beloved/JJ-5)
num(mission/NN-8,one/CD-7)
appos(beloved/JJ-5,mission/NN-8)
aux(enough/RB-12,would/MD-9)
neg(enough/RB-12,not/RB-10)
cop(enough/RB-12,be/VB-11)
prep_for(enough/RB-12,me/PRP-14)
nsubj(want/VB-18,I/PRP-16)
aux(want/VB-18,would/MD-17)
dep(enough/RB-12,want/VB-18)
aux(preach/VB-20,to/TO-19)
xcomp(want/VB-18,preach/VB-20)
det(Gospel/NN-22,the/DT-21)
dobj(preach/VB-20,Gospel/NN-22)
det(continents/NNS-26,all/DT-24)
num(continents/NNS-26,five/CD-25)
prep_on(Gospel/NN-22,continents/NNS-26)
advmod(preach/VB-20,simultaneously/RB-27)
cc(enough/RB-12,and/CC-28)
advmod(enough/RB-12,even/RB-29)
det(isles/NNS-34,the/DT-31)
advmod(isles/NNS-34,most/RBS-32)
amod(isles/NNS-34,remote/JJ-33)
prep_to(even/RB-29,isles/NNS-34)
</tree>
<annotations>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> I would be a missionary, not for a few years but from the beginning of creation until the consummation of the ages. </value>
<annotated-sentence> I would be a missionary, not for [[a few years|Year]] but from the beginning of creation until [[the consummation|Consummation_(album)]] of the ages. </annotated-sentence>
<pattern_crowdsource> I would be a missionary, not for a few years but from the beginning of creation until the consummation of the ages. </pattern_crowdsource>
<tree>
nsubj(missionary/JJ-5,I/PRP-1)
nsubj(missionary/JJ-5,I/PRP-1)
aux(missionary/JJ-5,would/MD-2)
cop(missionary/JJ-5,be/VB-3)
det(missionary/JJ-5,a/DT-4)
conj_but(missionary/JJ-5,missionary/JJ-5)
neg(missionary/JJ-5,not/RB-7)
det(years/NNS-11,a/DT-9)
amod(years/NNS-11,few/JJ-10)
prep_for(missionary/JJ-5,years/NNS-11)
det(beginning/NN-15,the/DT-14)
prep_from(missionary/JJ-5,beginning/NN-15)
prep_of(beginning/NN-15,creation/NN-17)
det(consummation/NN-20,the/DT-19)
prep_until(missionary/JJ-5,consummation/NN-20)
det(ages/NNS-23,the/DT-22)
prep_of(consummation/NN-20,ages/NNS-23)
</tree>
<annotations>
<annotation>
<surface-form>a few years</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Year</RDF-ID>
</annotation>
<annotation>
<surface-form>the consummation</surface-form>
<RDF-ID>http://dbpedia.org/resource/Consummation_(album)</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> Garan is the founder of the Manna Energy Foundation, which is assisting the villages of Rwanda to make potable water. </value>
<annotated-sentence> [[Garan|Shichid%C5%8D_garan]] is the founder of the [[Manna|Manna]] [[Energy|Energy]] Foundation, which is assisting [[the villages|Village]] of [[Rwanda|Rwanda]] to make [[potable water|Drinking_water]]. </annotated-sentence>
<pattern_crowdsource> Garan is the founder of the Manna Energy Foundation, which is assisting the villages of Rwanda to make potable water. </pattern_crowdsource>
<tree>
nsubj(founder/NN-4,Garan/NNP-1)
cop(founder/NN-4,is/VBZ-2)
det(founder/NN-4,the/DT-3)
det(Foundation/NNP-9,the/DT-6)
nn(Foundation/NNP-9,Manna/NNP-7)
nn(Foundation/NNP-9,Energy/NNP-8)
prep_of(founder/NN-4,Foundation/NNP-9)
nsubj(assisting/VBG-13,which/WDT-11)
aux(assisting/VBG-13,is/VBZ-12)
rcmod(Foundation/NNP-9,assisting/VBG-13)
det(villages/NNS-15,the/DT-14)
dobj(assisting/VBG-13,villages/NNS-15)
prep_of(villages/NNS-15,Rwanda/NNP-17)
aux(make/VB-19,to/TO-18)
xcomp(assisting/VBG-13,make/VB-19)
amod(water/NN-21,potable/JJ-20)
dobj(make/VB-19,water/NN-21)
</tree>
<annotations>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
<annotation>
<surface-form>Manna</surface-form>
<RDF-ID>http://dbpedia.org/resource/Manna</RDF-ID>
</annotation>
<annotation>
<surface-form>Energy</surface-form>
<RDF-ID>http://dbpedia.org/resource/Energy</RDF-ID>
</annotation>
<annotation>
<surface-form>the villages</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Village</RDF-ID>
</annotation>
<annotation>
<surface-form>Rwanda</surface-form>
<RDF-ID>http://dbpedia.org/resource/Rwanda</RDF-ID>
</annotation>
<annotation>
<surface-form>potable water</surface-form>
<RDF-ID>http://dbpedia.org/resource/Drinking_water</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> On June 24, 2009, Garan met Pope Benedict XVI at his general audience. </value>
<annotated-sentence> On June 24, 2009, [[Garan|Shichid%C5%8D_garan]] met [[Pope Benedict XVI|Pope_Benedict_XVI]] at [[his general audience|Audience_(meeting)]]. </annotated-sentence>
<pattern_crowdsource> On June 24, 2009, Garan met Pope Benedict XVI at his general audience. </pattern_crowdsource>
<tree>
prep_on(met/VBD-8,June/NNP-2)
num(June/NNP-2,24/CD-3)
num(June/NNP-2,2009/CD-5)
nsubj(met/VBD-8,Garan/NNP-7)
nn(XVI/NNP-11,Pope/NNP-9)
nn(XVI/NNP-11,Benedict/NNP-10)
dobj(met/VBD-8,XVI/NNP-11)
poss(audience/NN-15,his/PRP$-13)
amod(audience/NN-15,general/JJ-14)
prep_at(XVI/NNP-11,audience/NN-15)
</tree>
<annotations>
<annotation>
<surface-form>Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Shichid%C5%8D_garan</RDF-ID>
</annotation>
<annotation>
<surface-form>Pope Benedict XVI</surface-form>
<RDF-ID>http://dbpedia.org/resource/Pope_Benedict_XVI</RDF-ID>
</annotation>
<annotation>
<surface-form>his general audience</surface-form>
<RDF-ID>http://dbpedia.org/resource/Audience_(meeting)</RDF-ID>
</annotation>
</annotations>
<triples>
</triples>
<pattern>
null
</pattern>
</sentence>
<sentence>
<value> This article incorporates public domain material from the National Aeronautics and Space Administration document "Astronaut Bio: Ronald J. Garan (1/2011)" (retrieved on 2011-07-28). </value>
<annotated-sentence> This article incorporates [[public domain|Public_domain]] [[material|Material]] from the [[National|United_States]] [[Aeronautics|Aeronautics]] and [[Space|NASA]] Administration [[document|Document_(album)]] "[[Astronaut|Astronaut]] Bio: [[Ronald J. Garan|Ronald_J._Garan,_Jr.]] (1/2011)" (retrieved on 2011-07-28). </annotated-sentence>
<pattern_crowdsource> This article incorporates public domain material from the [[National|United_States]] Aeronautics and [[Space|NASA]] Administration [[document|Document_(album)]] "[[Astronaut|Astronaut]] Bio: [[Ronald J. Garan|Ronald_J._Garan,_Jr.]] (1/2011)" (retrieved on 2011-07-28). </pattern_crowdsource>
<tree>
det(article/NN-2,This/DT-1)
nsubj(incorporates/VBZ-3,article/NN-2)
amod(material/NN-6,public/JJ-4)
nn(material/NN-6,domain/NN-5)
dobj(incorporates/VBZ-3,material/NN-6)
det(Aeronautics/NNP-10,the/DT-8)
nn(Aeronautics/NNP-10,National/NNP-9)
prep_from(incorporates/VBZ-3,Aeronautics/NNP-10)
nn(document/NN-14,Space/NNP-12)
nn(document/NN-14,Administration/NNP-13)
prep_from(incorporates/VBZ-3,document/NN-14)
conj_and(Aeronautics/NNP-10,document/NN-14)
nn(Bio/NNP-17,Astronaut/NNP-16)
dep(Aeronautics/NNP-10,Bio/NNP-17)
nn(Garan/NNP-21,Ronald/NNP-19)
nn(Garan/NNP-21,J./NNP-20)
dep(Bio/NNP-17,Garan/NNP-21)
appos(Garan/NNP-21,1/2011/CD-23)
dep(Aeronautics/NNP-10,retrieved/VBN-27)
prep_on(retrieved/VBN-27,2011-07-28/CD-29)
</tree>
<annotations>
<annotation>
<surface-form>public domain</surface-form>
<RDF-ID>http://dbpedia.org/resource/Public_domain</RDF-ID>
</annotation>
<annotation>
<surface-form>material</surface-form>
<RDF-ID>http://dbpedia.org/resource/Material</RDF-ID>
</annotation>
<annotation>
<surface-form>National</surface-form>
<RDF-ID>http://dbpedia.org/resource/United_States</RDF-ID>
</annotation>
<annotation>
<surface-form>Aeronautics</surface-form>
<RDF-ID>http://dbpedia.org/resource/Aeronautics</RDF-ID>
</annotation>
<annotation>
<surface-form>Space</surface-form>
<RDF-ID>http://dbpedia.org/resource/NASA</RDF-ID>
</annotation>
<annotation>
<surface-form>document</surface-form>
<RDF-ID>http://dbpedia.org/resource/Document_(album)</RDF-ID>
</annotation>
<annotation>
<surface-form>Astronaut</surface-form>
<RDF-ID>http://dbpedia.org/ontology/Astronaut</RDF-ID>
</annotation>
<annotation>
<surface-form>Ronald J. Garan</surface-form>
<RDF-ID>http://dbpedia.org/resource/Ronald_J._Garan,_Jr.</RDF-ID>
</annotation>
</annotations>
<triples>
<triple>
http://dbpedia.org/resource/Document_(album) http://dbpedia.org/ontology/recordedIn http://dbpedia.org/resource/United_States
</triple>
<triple>
http://dbpedia.org/resource/Ronald_J._Garan,_Jr. http://dbpedia.org/ontology/nationality http://dbpedia.org/resource/United_States
</triple>
<triple>
http://dbpedia.org/resource/Ronald_J._Garan,_Jr. http://dbpedia.org/ontology/type http://dbpedia.org/resource/NASA
</triple>
<triple>
http://dbpedia.org/resource/Ronald_J._Garan,_Jr. http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Astronaut
</triple>
</triples>
<pattern>
null
</pattern>
</sentence>
</Document>
| {
"content_hash": "cae1d9279b923fb40477014c73a6f0c8",
"timestamp": "",
"source": "github",
"line_count": 2984,
"max_line_length": 408,
"avg_line_length": 26.744302949061662,
"alnum_prop": 0.6800576404987156,
"repo_name": "pvougiou/KB-Text-Alignment",
"id": "78fdc1ee5d55d7673403631212bda553f62f5f2b",
"size": "79805",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Data/WikiAstronauts/XML/Ronald_J._Garan,_Jr.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "OpenEdge ABL",
"bytes": "611292"
},
{
"name": "Python",
"bytes": "72310"
}
],
"symlink_target": ""
} |
package com.wii.vmail.pojo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import android.util.Log;
import com.wii.vmail.pojo.CircleId;
import com.wii.vmail.pojo.MailAddress;
public class Profile implements Serializable {
static final long serialVersionUID = 1L;
static final Class<?> CLAZZ = Profile.class;
static final String TAG = CLAZZ.getCanonicalName();
CircleId mCircleId;
String mRealName;
String mUserIconUrl;
long mUserId;
boolean mIsBlacklist;
List<MailAddress> mMailAddrs;
List<Long> mCircleList;
public Profile(long pUserId,
CircleId pCircleId,
String pRealName,
String pUserIconUrl,
boolean pIsBlacklist,
List<MailAddress> pMailAddrList,
List<Long> pCircleList) {
this.mCircleId = pCircleId;
this.mRealName = pRealName;
this.mUserIconUrl = pUserIconUrl;
this.mUserId = pUserId;
this.mIsBlacklist = pIsBlacklist;
this.mMailAddrs = pMailAddrList;
this.mCircleList = pCircleList;
}
public Profile(long pUserId,
CircleId pCircleId,
String pRealName,
String pUserIconUrl,
List<MailAddress> pList) {
this(pUserId,
pCircleId,
pRealName,
pUserIconUrl,
false, pList, null);
}
public Profile(long pUserId,
CircleId pCircleId,
String pRealName,
String pUserIconUrl) {
this(pUserId,
pCircleId,
pRealName,
pUserIconUrl,
false, null, null);
}
public void addToCircle(long circleId) {
if (mCircleList == null) {
mCircleList = new ArrayList<Long>();
}
if (!mCircleList.contains(circleId)) {
mCircleList.add(circleId);
} else {
Log.d(TAG, "Circle Id is added.");
}
}
public Profile(CircleId pCircleId) {
this(-1, pCircleId, null, null);
}
public void setBlacklist(boolean blackit) {
this.mIsBlacklist = blackit;
}
public boolean isBlacklist() {
return this.mIsBlacklist;
}
public String getUserIConUrl() {
return this.mUserIconUrl;
}
public CircleId getCircleId() {
return this.mCircleId;
}
public List<Long> getCircleList() {
return this.mCircleList;
}
public String getRealName() {
return this.mRealName;
}
public long getUserId() {
return this.mUserId;
}
public boolean isCircle() {
return (mRealName == null && mUserId == -1) && mCircleId != null;
}
@Override
public String toString() {
if (!isCircle()) {
return "Real Name:" + mRealName + ",UserId:" + mUserId + ",UserIconUrl:" + mUserIconUrl;
} else {
return mCircleId.toString();
}
}
}
| {
"content_hash": "8769ffc285de61eb18f556484bcff9f3",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 100,
"avg_line_length": 26.958333333333332,
"alnum_prop": 0.5381761978361669,
"repo_name": "moreus/vMail",
"id": "ff3bca8818c1480ff193fdc9847a9b6354d5d6a1",
"size": "3235",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/wii/vmail/pojo/Profile.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "819183"
},
{
"name": "PHP",
"bytes": "44483"
}
],
"symlink_target": ""
} |
angular.module("myApp.services", [])
.factory("regionService", ["$http", "$q", function ($http, $q) {
return {
getUserRegion: function () {
var deferred = $q.defer();
navigator.geolocation.getCurrentPosition(function(position) {
$http({
method: "GET",
url: "http://ws.geonames.org/countryCode",
params: {
lat: position.coords.latitude,
lng: position.coords.longitude,
username:'saqo9662',
type: "JSON"
}
}).success(function (response) {
deferred.resolve(response);
}).error(function (resopnse) {
console.log(resopnse);
});
}, function () {
deferred.reject();
});
return deferred.promise;
}
};
}])
.factory("youtubeService", ["$http", function ($http) {
return {
getYoutubeVideo: function (searchText) {
return $http({
method: "GET",
url: "https://www.googleapis.com/youtube/v3/search",
params:{
key: "AIzaSyBkpL3CRjmIO8WEY_uH0CFvZv2kBnkfgI0",
part: "snippet",
type: "video",
q: encodeURIComponent(searchText).replace(/%20/g, "+"),
maxResults: 1
}
})
}
}
}])
.factory("musicService", ["$http", "musicGraphApi", "echonestApi", "artistSearchUrl", function ($http, musicGraphApi, echonestApi, artistSearchUrl) {
return {
getArtistBiography: function (artistName) {
return $http({
method: "GET",
url: "http://developer.echonest.com/api/v4/artist/biographies",
params: {
api_key: echonestApi,
name: artistName,
format: "json"
}
});
},
getArtistImage:function (artistName) {
return $http({
method: "GET",
url: "http://developer.echonest.com/api/v4/artist/images",
params: {
api_key: echonestApi,
name: artistName,
format: "json",
results: 1
}
})
},
getArtistByCountry: function (country) {
return $http({
method: "GET",
url: artistSearchUrl,
params: {
api_key: musicGraphApi,
limit: 5,
country: country
}
});
},
suggestMusic: function (suggestText) {
var params = {
api_key: musicGraphApi,
prefix: suggestText,
limit: 10
};
return [
$http({
method: "GET",
url: "http://api.musicgraph.com/api/v2/artist/suggest",
params: params
}),
$http({
method: "GET",
url: "http://api.musicgraph.com/api/v2/track/suggest",
params: params
})
];
},
getArtistNews: function (artistName) {
return $http({
method: "GET",
url: "http://developer.echonest.com/api/v4/artist/news",
params: {
api_key: echonestApi,
name: artistName,
format: "json",
high_relevance: true
}
});
},
getArtistsByGenre: function (genre) {
return $http({
method: "GET",
url: artistSearchUrl,
params: {
api_key: musicGraphApi,
limit: 5,
genre: genre
}
});
},
getArtistsByDecade: function (decade) {
return $http({
method: "GET",
url: artistSearchUrl,
params: {
api_key: musicGraphApi,
limit: 5,
decade: decade
}
});
},
getSimilarArtist: function (artistName) {
return $http({
method: "GET",
url: artistSearchUrl,
params: {
api_key: musicGraphApi,
limit: 1,
similar_to: artistName
}
});
},
getSong:function (songName) {
return $http({
method: "GET",
url: "http://api.musicgraph.com/api/v2/track/search",
params: {
api_key: musicGraphApi,
limit: 1,
title: songName
}
});
},
getDailyArtist: function () {
var dailyArtistProperties = JSON.parse(localStorage.getItem("dailyArtist")),
decades,
genres;
if(!dailyArtistProperties || dailyArtistProperties.date != new Date().toJSON().slice(0,10)) {
dailyArtistProperties = {};
decades = [1890, 1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010];
genres = [
"Alternative/Indie",
"Blues",
"Children's",
"Classical/Opera",
"Country",
"Electronica/Dance",
"Folk",
"Instrumental",
"Jazz",
"Latin",
"New Age",
"Pop",
"Rap/Hip Hop",
"Reggae/Ska",
"Rock",
"Seasonal",
"Soul/R&B",
"Vocals"
];
dailyArtistProperties.date = new Date().toJSON().slice(0,10);
dailyArtistProperties.gender = Math.random() > Math.random() ? "Male" : "Female";
dailyArtistProperties.decade = decades[Math.floor(Math.random() * decades.length)] + "s";
dailyArtistProperties.genre = genres[Math.floor(Math.random() * genres.length)];
localStorage.setItem("dailyArtist", JSON.stringify(dailyArtistProperties));
}
return $http({
method: "GET",
url: artistSearchUrl,
params: {
api_key: musicGraphApi,
limit: 1,
genre: dailyArtistProperties.genre,
decade: dailyArtistProperties.decade,
gender: dailyArtistProperties.gender
}
});
}
}
}])
.factory("localStorageService", function () {
return {
getStorageItem: function (key) {
return JSON.parse(localStorage.getItem(key));
},
setStorageItem: function (key, value) {
return localStorage.setItem(key, JSON.stringify(value));
}
}
}); | {
"content_hash": "fdd71b542e6487a150d94b6057feef4c",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 153,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.37150096525096526,
"repo_name": "sargisshahinyan/Music",
"id": "6915a6c7adb014ecf6512191b158db45a51779e3",
"size": "8288",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/js/services.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4155"
},
{
"name": "HTML",
"bytes": "7401"
},
{
"name": "JavaScript",
"bytes": "22081"
}
],
"symlink_target": ""
} |
namespace hackerrank {
namespace bmgandre {
namespace algorithms {
namespace implementation {
class counting_valleys
{
public:
static int solve(int n, std::string s);
};
} // namespace algorithms
} // namespace implementation
} // namespace bmgandre
} // namespace hackerrank
| {
"content_hash": "e985c23f2690731b1883c968229a193c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 40,
"avg_line_length": 18.6,
"alnum_prop": 0.7526881720430108,
"repo_name": "bmgandre/hackerrank-cpp",
"id": "365a4e01e1debc434dccc1c05eac58911aa5453b",
"size": "312",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/algorithms/implementation/counting_valleys/counting_valleys.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "47406"
},
{
"name": "CMake",
"bytes": "7424"
},
{
"name": "Shell",
"bytes": "4125"
}
],
"symlink_target": ""
} |
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
//
// What makes a good checkpoint block?
// + Is surrounded by blocks with reasonable timestamps
// (no blocks before with a timestamp after, none after with
// timestamp before)
// + Contains no strange transactions
//
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, hashGenesisBlock )
;
// TestNet has no checkpoints
static MapCheckpoints mapCheckpointsTestnet =
boost::assign::map_list_of
( 0, hashGenesisBlockTestNet )
;
bool CheckHardened(int nHeight, const uint256& hash)
{
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
if (i == checkpoints.end()) return true;
return hash == i->second;
}
int GetTotalBlocksEstimate()
{
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
return checkpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
{
const uint256& hash = i.second;
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
if (t != mapBlockIndex.end())
return t->second;
}
return NULL;
}
// lightspeed: synchronized checkpoint (centrally broadcasted)
uint256 hashSyncCheckpoint = 0;
uint256 hashPendingCheckpoint = 0;
CSyncCheckpoint checkpointMessage;
CSyncCheckpoint checkpointMessagePending;
uint256 hashInvalidCheckpoint = 0;
CCriticalSection cs_hashSyncCheckpoint;
// lightspeed: get last synchronized checkpoint
CBlockIndex* GetLastSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
if (!mapBlockIndex.count(hashSyncCheckpoint))
error("GetSyncCheckpoint: block index missing for current sync-checkpoint %s", hashSyncCheckpoint.ToString().c_str());
else
return mapBlockIndex[hashSyncCheckpoint];
return NULL;
}
// lightspeed: only descendant of current sync-checkpoint is allowed
bool ValidateSyncCheckpoint(uint256 hashCheckpoint)
{
if (!mapBlockIndex.count(hashSyncCheckpoint))
return error("ValidateSyncCheckpoint: block index missing for current sync-checkpoint %s", hashSyncCheckpoint.ToString().c_str());
if (!mapBlockIndex.count(hashCheckpoint))
return error("ValidateSyncCheckpoint: block index missing for received sync-checkpoint %s", hashCheckpoint.ToString().c_str());
CBlockIndex* pindexSyncCheckpoint = mapBlockIndex[hashSyncCheckpoint];
CBlockIndex* pindexCheckpointRecv = mapBlockIndex[hashCheckpoint];
if (pindexCheckpointRecv->nHeight <= pindexSyncCheckpoint->nHeight)
{
// Received an older checkpoint, trace back from current checkpoint
// to the same height of the received checkpoint to verify
// that current checkpoint should be a descendant block
CBlockIndex* pindex = pindexSyncCheckpoint;
while (pindex->nHeight > pindexCheckpointRecv->nHeight)
if (!(pindex = pindex->pprev))
return error("ValidateSyncCheckpoint: pprev null - block index structure failure");
if (pindex->GetBlockHash() != hashCheckpoint)
{
hashInvalidCheckpoint = hashCheckpoint;
return error("ValidateSyncCheckpoint: new sync-checkpoint %s is conflicting with current sync-checkpoint %s", hashCheckpoint.ToString().c_str(), hashSyncCheckpoint.ToString().c_str());
}
return false; // ignore older checkpoint
}
// Received checkpoint should be a descendant block of the current
// checkpoint. Trace back to the same height of current checkpoint
// to verify.
CBlockIndex* pindex = pindexCheckpointRecv;
while (pindex->nHeight > pindexSyncCheckpoint->nHeight)
if (!(pindex = pindex->pprev))
return error("ValidateSyncCheckpoint: pprev2 null - block index structure failure");
if (pindex->GetBlockHash() != hashSyncCheckpoint)
{
hashInvalidCheckpoint = hashCheckpoint;
return error("ValidateSyncCheckpoint: new sync-checkpoint %s is not a descendant of current sync-checkpoint %s", hashCheckpoint.ToString().c_str(), hashSyncCheckpoint.ToString().c_str());
}
return true;
}
bool WriteSyncCheckpoint(const uint256& hashCheckpoint)
{
CTxDB txdb;
txdb.TxnBegin();
if (!txdb.WriteSyncCheckpoint(hashCheckpoint))
{
txdb.TxnAbort();
return error("WriteSyncCheckpoint(): failed to write to db sync checkpoint %s", hashCheckpoint.ToString().c_str());
}
if (!txdb.TxnCommit())
return error("WriteSyncCheckpoint(): failed to commit to db sync checkpoint %s", hashCheckpoint.ToString().c_str());
Checkpoints::hashSyncCheckpoint = hashCheckpoint;
return true;
}
bool AcceptPendingSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
if (hashPendingCheckpoint != 0 && mapBlockIndex.count(hashPendingCheckpoint))
{
if (!ValidateSyncCheckpoint(hashPendingCheckpoint))
{
hashPendingCheckpoint = 0;
checkpointMessagePending.SetNull();
return false;
}
CTxDB txdb;
CBlockIndex* pindexCheckpoint = mapBlockIndex[hashPendingCheckpoint];
if (!pindexCheckpoint->IsInMainChain())
{
CBlock block;
if (!block.ReadFromDisk(pindexCheckpoint))
return error("AcceptPendingSyncCheckpoint: ReadFromDisk failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str());
if (!block.SetBestChain(txdb, pindexCheckpoint))
{
hashInvalidCheckpoint = hashPendingCheckpoint;
return error("AcceptPendingSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str());
}
}
if (!WriteSyncCheckpoint(hashPendingCheckpoint))
return error("AcceptPendingSyncCheckpoint(): failed to write sync checkpoint %s", hashPendingCheckpoint.ToString().c_str());
hashPendingCheckpoint = 0;
checkpointMessage = checkpointMessagePending;
checkpointMessagePending.SetNull();
printf("AcceptPendingSyncCheckpoint : sync-checkpoint at %s\n", hashSyncCheckpoint.ToString().c_str());
// relay the checkpoint
if (!checkpointMessage.IsNull())
{
BOOST_FOREACH(CNode* pnode, vNodes)
checkpointMessage.RelayTo(pnode);
}
return true;
}
return false;
}
// Automatically select a suitable sync-checkpoint
uint256 AutoSelectSyncCheckpoint()
{
const CBlockIndex *pindex = pindexBest;
// Search backward for a block within max span and maturity window
while (pindex->pprev && (pindex->GetBlockTime() + CHECKPOINT_MAX_SPAN > pindexBest->GetBlockTime() || pindex->nHeight + 8 > pindexBest->nHeight))
pindex = pindex->pprev;
return pindex->GetBlockHash();
}
// Check against synchronized checkpoint
bool CheckSync(const uint256& hashBlock, const CBlockIndex* pindexPrev)
{
if (fTestNet) return true; // Testnet has no checkpoints
int nHeight = pindexPrev->nHeight + 1;
LOCK(cs_hashSyncCheckpoint);
// sync-checkpoint should always be accepted block
assert(mapBlockIndex.count(hashSyncCheckpoint));
const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint];
if (nHeight > pindexSync->nHeight)
{
// trace back to same height as sync-checkpoint
const CBlockIndex* pindex = pindexPrev;
while (pindex->nHeight > pindexSync->nHeight)
if (!(pindex = pindex->pprev))
return error("CheckSync: pprev null - block index structure failure");
if (pindex->nHeight < pindexSync->nHeight || pindex->GetBlockHash() != hashSyncCheckpoint)
return false; // only descendant of sync-checkpoint can pass check
}
if (nHeight == pindexSync->nHeight && hashBlock != hashSyncCheckpoint)
return false; // same height with sync-checkpoint
if (nHeight < pindexSync->nHeight && !mapBlockIndex.count(hashBlock))
return false; // lower height than sync-checkpoint
return true;
}
bool WantedByPendingSyncCheckpoint(uint256 hashBlock)
{
LOCK(cs_hashSyncCheckpoint);
if (hashPendingCheckpoint == 0)
return false;
if (hashBlock == hashPendingCheckpoint)
return true;
if (mapOrphanBlocks.count(hashPendingCheckpoint)
&& hashBlock == WantedByOrphan(mapOrphanBlocks[hashPendingCheckpoint]))
return true;
return false;
}
// lightspeed: reset synchronized checkpoint to last hardened checkpoint
bool ResetSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
const uint256& hash = mapCheckpoints.rbegin()->second;
if (mapBlockIndex.count(hash) && !mapBlockIndex[hash]->IsInMainChain())
{
// checkpoint block accepted but not yet in main chain
printf("ResetSyncCheckpoint: SetBestChain to hardened checkpoint %s\n", hash.ToString().c_str());
CTxDB txdb;
CBlock block;
if (!block.ReadFromDisk(mapBlockIndex[hash]))
return error("ResetSyncCheckpoint: ReadFromDisk failed for hardened checkpoint %s", hash.ToString().c_str());
if (!block.SetBestChain(txdb, mapBlockIndex[hash]))
{
return error("ResetSyncCheckpoint: SetBestChain failed for hardened checkpoint %s", hash.ToString().c_str());
}
}
else if(!mapBlockIndex.count(hash))
{
// checkpoint block not yet accepted
hashPendingCheckpoint = hash;
checkpointMessagePending.SetNull();
printf("ResetSyncCheckpoint: pending for sync-checkpoint %s\n", hashPendingCheckpoint.ToString().c_str());
}
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
{
const uint256& hash = i.second;
if (mapBlockIndex.count(hash) && mapBlockIndex[hash]->IsInMainChain())
{
if (!WriteSyncCheckpoint(hash))
return error("ResetSyncCheckpoint: failed to write sync checkpoint %s", hash.ToString().c_str());
printf("ResetSyncCheckpoint: sync-checkpoint reset to %s\n", hashSyncCheckpoint.ToString().c_str());
return true;
}
}
return false;
}
void AskForPendingSyncCheckpoint(CNode* pfrom)
{
LOCK(cs_hashSyncCheckpoint);
if (pfrom && hashPendingCheckpoint != 0 && (!mapBlockIndex.count(hashPendingCheckpoint)) && (!mapOrphanBlocks.count(hashPendingCheckpoint)))
pfrom->AskFor(CInv(MSG_BLOCK, hashPendingCheckpoint));
}
bool SetCheckpointPrivKey(std::string strPrivKey)
{
// Test signing a sync-checkpoint with genesis block
CSyncCheckpoint checkpoint;
checkpoint.hashCheckpoint = !fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet;
CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION);
sMsg << (CUnsignedSyncCheckpoint)checkpoint;
checkpoint.vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end());
std::vector<unsigned char> vchPrivKey = ParseHex(strPrivKey);
CKey key;
key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash
if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig))
return false;
// Test signing successful, proceed
CSyncCheckpoint::strMasterPrivKey = strPrivKey;
return true;
}
bool SendSyncCheckpoint(uint256 hashCheckpoint)
{
CSyncCheckpoint checkpoint;
checkpoint.hashCheckpoint = hashCheckpoint;
CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION);
sMsg << (CUnsignedSyncCheckpoint)checkpoint;
checkpoint.vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end());
if (CSyncCheckpoint::strMasterPrivKey.empty())
return error("SendSyncCheckpoint: Checkpoint master key unavailable.");
std::vector<unsigned char> vchPrivKey = ParseHex(CSyncCheckpoint::strMasterPrivKey);
CKey key;
key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash
if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig))
return error("SendSyncCheckpoint: Unable to sign checkpoint, check private key?");
if(!checkpoint.ProcessSyncCheckpoint(NULL))
{
printf("WARNING: SendSyncCheckpoint: Failed to process checkpoint.\n");
return false;
}
// Relay checkpoint
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
checkpoint.RelayTo(pnode);
}
return true;
}
// Is the sync-checkpoint outside maturity window?
bool IsMatureSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
// sync-checkpoint should always be accepted block
assert(mapBlockIndex.count(hashSyncCheckpoint));
const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint];
return (nBestHeight >= pindexSync->nHeight + nCoinbaseMaturity ||
pindexSync->GetBlockTime() + nStakeMinAge < GetAdjustedTime());
}
}
// lightspeed: sync-checkpoint master key
const std::string CSyncCheckpoint::strMasterPubKey = "049F2C10997604217E7238A4C5CF2843570ADA001D1A247B228A7C5583ACD0F762A3130D0C4331EB262E3D0EB516AE6F7B0B1ADA43275013F8552A83A7C621B1D9";
std::string CSyncCheckpoint::strMasterPrivKey = "";
// lightspeed: verify signature of sync-checkpoint message
bool CSyncCheckpoint::CheckSignature()
{
CKey key;
if (!key.SetPubKey(ParseHex(CSyncCheckpoint::strMasterPubKey)))
return error("CSyncCheckpoint::CheckSignature() : SetPubKey failed");
if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
return error("CSyncCheckpoint::CheckSignature() : verify signature failed");
// Now unserialize the data
CDataStream sMsg(vchMsg, SER_NETWORK, PROTOCOL_VERSION);
sMsg >> *(CUnsignedSyncCheckpoint*)this;
return true;
}
// lightspeed: process synchronized checkpoint
bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom)
{
if (!CheckSignature())
return false;
LOCK(Checkpoints::cs_hashSyncCheckpoint);
if (!mapBlockIndex.count(hashCheckpoint))
{
// We haven't received the checkpoint chain, keep the checkpoint as pending
Checkpoints::hashPendingCheckpoint = hashCheckpoint;
Checkpoints::checkpointMessagePending = *this;
printf("ProcessSyncCheckpoint: pending for sync-checkpoint %s\n", hashCheckpoint.ToString().c_str());
// Ask this guy to fill in what we're missing
if (pfrom)
{
pfrom->PushGetBlocks(pindexBest, hashCheckpoint);
// ask directly as well in case rejected earlier by duplicate
// proof-of-stake because getblocks may not get it this time
pfrom->AskFor(CInv(MSG_BLOCK, mapOrphanBlocks.count(hashCheckpoint)? WantedByOrphan(mapOrphanBlocks[hashCheckpoint]) : hashCheckpoint));
}
return false;
}
if (!Checkpoints::ValidateSyncCheckpoint(hashCheckpoint))
return false;
CTxDB txdb;
CBlockIndex* pindexCheckpoint = mapBlockIndex[hashCheckpoint];
if (!pindexCheckpoint->IsInMainChain())
{
// checkpoint chain received but not yet main chain
CBlock block;
if (!block.ReadFromDisk(pindexCheckpoint))
return error("ProcessSyncCheckpoint: ReadFromDisk failed for sync checkpoint %s", hashCheckpoint.ToString().c_str());
if (!block.SetBestChain(txdb, pindexCheckpoint))
{
Checkpoints::hashInvalidCheckpoint = hashCheckpoint;
return error("ProcessSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashCheckpoint.ToString().c_str());
}
}
if (!Checkpoints::WriteSyncCheckpoint(hashCheckpoint))
return error("ProcessSyncCheckpoint(): failed to write sync checkpoint %s", hashCheckpoint.ToString().c_str());
Checkpoints::checkpointMessage = *this;
Checkpoints::hashPendingCheckpoint = 0;
Checkpoints::checkpointMessagePending.SetNull();
printf("ProcessSyncCheckpoint: sync-checkpoint at %s\n", hashCheckpoint.ToString().c_str());
return true;
}
| {
"content_hash": "723528276a2cd93d9cb67b942f7030d0",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 200,
"avg_line_length": 43.14074074074074,
"alnum_prop": 0.6521291208791209,
"repo_name": "lightspeedcrypto/lightspeed",
"id": "509ca77a5864cc722a876232f12cabaeba916116",
"size": "17839",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/checkpoints.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "51312"
},
{
"name": "C",
"bytes": "500920"
},
{
"name": "C++",
"bytes": "2609573"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Objective-C++",
"bytes": "3536"
},
{
"name": "Python",
"bytes": "2831"
},
{
"name": "Shell",
"bytes": "1038"
},
{
"name": "TypeScript",
"bytes": "7766545"
}
],
"symlink_target": ""
} |
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
</objects>
| {
"content_hash": "80989c447864b0ba7efea64c18d2be14",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 107,
"avg_line_length": 56,
"alnum_prop": 0.7633928571428571,
"repo_name": "MaferYangPointJun/Spring.net",
"id": "8b6cbe22ad29e43fa49ac9285b308df2a48f362b",
"size": "224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Spring/Spring.Services.Tests/Data/Xml/watcher-0.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "129158"
},
{
"name": "C#",
"bytes": "13842509"
},
{
"name": "CSS",
"bytes": "181570"
},
{
"name": "GAP",
"bytes": "11250"
},
{
"name": "Groff",
"bytes": "2302"
},
{
"name": "HTML",
"bytes": "119116"
},
{
"name": "JavaScript",
"bytes": "609624"
},
{
"name": "Shell",
"bytes": "944"
},
{
"name": "Visual Basic",
"bytes": "1975"
},
{
"name": "XSLT",
"bytes": "39412"
}
],
"symlink_target": ""
} |
/**
* File : popwayback.ph
* Author : Valentin Clement (clementval)
* Description : Implementation of the POPWayback object
* Creation date : 2010/10/07
*
* Modifications :
* Authors Date Comment
* clementval 2010/10/07 First implementation of this object
* clementval 2010/10/22 Add doxygen comment
* clementval 2010/10/28 Optimize the method insertNode()
*/
#include "../include/popwayback.h"
using namespace std;
/**
* ViSaG : clementval
* Constructor of the POPWayback class
*/
POPWayback::POPWayback(){}
/**
* ViSaG : clementval
* Destructor of the POPWayback class
*/
POPWayback::~POPWayback(){}
/**
* ViSaG : clementval
* Redefined the = operator for the object POPWayback
* @param rhs Right hand-side parameter
* @return The new POPWayback copied from the rhs
*/
const POPWayback & POPWayback::operator =(const POPWayback &rhs)
{
if(!rhs._lst_wb.empty()){
_lst_wb.clear();
_lst_wb = rhs._lst_wb;
}
return (*this);
}
/**
* ViSaG : clementval
* Return the POPWayback object as a fromatted string
* @return The formatted string corresponding to this object
*/
paroc_string POPWayback::getAsString() const{
list<paroc_string> tmp = _lst_wb;
std::string wb;
while(!tmp.empty()){
paroc_string e = tmp.front();
tmp.pop_front();
wb.append(e.GetString());
wb.append("//");
}
paroc_string wbstr = wb.c_str();
return wbstr;
}
/**
* ViSaG : clementval
* Insert a node at the end of the way back. Do not insert it if the last node in the list is the same as the node given in
* parameter.
* @param nodeId The node ID to insert in the POPWayback
*/
void POPWayback::insertNode(paroc_string nodeId){
if(_lst_wb.empty())
_lst_wb.push_back(nodeId);
else{
paroc_string tmp = getNextNode();
if(strcmp(tmp.GetString(), nodeId.GetString())!=0)
_lst_wb.push_back(nodeId);
}
}
/**
* ViSaG : clementval
* return the last Node
* @return The node ID of the next node in the way back
*/
paroc_string POPWayback::getNextNode() const {
paroc_string node = _lst_wb.back();
return node;
}
/**
* ViSaG : clementval
* Delete the next node in the way back
*/
void POPWayback::deleteNextNode(){
_lst_wb.pop_back();
}
/**
* ViSaG : clementval
* Check if it's the last node in the way back or if there is no node
* @return Return true if there is 1 or 0 node in the way back
*/
const bool POPWayback::isLastNode() const {
if(_lst_wb.size() == 1 || _lst_wb.empty())
return true;
return false;
}
/**
* ViSaG : clementval
* Check if the way back is empty
* @return Return true if the way back is empty
*/
const bool POPWayback::isEmpty() const {
return _lst_wb.empty();
}
/**
* ViSaG : clementval
* Marshall or unmarshall the object to be sent over the network.
* Remark : This method is overwritten from the POPBase class
* @param buf The POPBuffer to be used for the (un)marshalling
* @param If true=masrhalling, if false=unmarshalling
*/
void POPWayback::Serialize(POPBuffer &buf, bool pack){
if(pack){
//Pack the size
int size = _lst_wb.size();
buf.Pack(&size, 1);
//Pack elements
while(!_lst_wb.empty()){
paroc_string elt = _lst_wb.front();
_lst_wb.pop_front();
buf.Pack(&elt, 1);
}
} else {
//Clear the current list
_lst_wb.clear();
//Unpack the size
int size;
buf.UnPack(&size, 1);
//Unpack elements
for(int i=0; i< size; i++){
paroc_string elt;
buf.UnPack(&elt, 1);
_lst_wb.push_back(elt);
}
}
}
| {
"content_hash": "9e09dd1f7dd4ad698e02c53e155383f2",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 124,
"avg_line_length": 24.328859060402685,
"alnum_prop": 0.6355862068965518,
"repo_name": "GaretJax/pop-utils",
"id": "f027e71289b0bebac236f22c1dda7829b442b6fd",
"size": "3625",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/master/packages/popc/lib/popwayback.cc",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "189513"
},
{
"name": "C++",
"bytes": "1389566"
},
{
"name": "Perl",
"bytes": "53030"
},
{
"name": "Python",
"bytes": "75382"
},
{
"name": "Shell",
"bytes": "246824"
}
],
"symlink_target": ""
} |
package msgpack4z
import scala.util.control.NonFatal
import scalaz._
trait MsgpackCodec[A] {
def pack(packer: MsgPacker, a: A): Unit
def packF: Packer[A] =
pack
final def toBytes(a: A, packer: MsgPacker): Array[Byte] = {
pack(packer, a)
packer.result()
}
final def unpackAndClose(unpacker: MsgUnpacker): UnpackResult[A] =
try {
unpack(unpacker)
} finally {
unpacker.close()
}
def unpack(unpacker: MsgUnpacker): UnpackResult[A]
def unpackF: Unpacker[A] =
unpack
final def xmap[B](f: A => B, g: B => A): MsgpackCodec[B] =
MsgpackCodec.codec[B]((packer, a) => pack(packer, g(a)), unpackF.andThen(_.map(f)))
final def roundtripz(a: A, packer: MsgPacker, unpacker: Array[Byte] => MsgUnpacker)(implicit A: Equal[A]): Option[UnpackError \/ A] = {
val u = unpacker(toBytes(a, packer))
unpackAndClose(u) match {
case aa @ \/-(a0) =>
if (A.equal(a, a0))
None
else
Some(aa)
case e @ -\/(_) =>
Some(e)
}
}
/**
* @return
* `None` if success
* `Some(-\/(_))` if `fromBytes` returns deserialize error
* `Some(\/-(_))` if `fromBytes` and `toByte` are inconsistent
*/
final def roundtrip(a: A, packer: MsgPacker, unpacker: Array[Byte] => MsgUnpacker): Option[UnpackError \/ A] =
roundtripz(a, packer, unpacker)(Equal.equalA[A])
}
private class MsgpackCodecConstant[A](
override val packF: Packer[A],
override val unpackF: Unpacker[A]
) extends MsgpackCodec[A] {
override def pack(packer: MsgPacker, a: A) =
packF(packer, a)
override def unpack(unpacker: MsgUnpacker): UnpackResult[A] =
unpackF(unpacker)
}
object MsgpackCodec {
@inline def apply[A](implicit A: MsgpackCodec[A]): MsgpackCodec[A] = A
/**
* @example {{{
* case class UserId(value: Int)
*
* object UserId {
* implicit val msgpackCodec: MsgpackCodec[UserId] =
* MsgpackCodec.from(apply, unapply)
* }
* }}}
*/
def from[A, B](applyFunc: A => B, unapplyFunc: B => Option[A])(implicit A: MsgpackCodec[A]): MsgpackCodec[B] =
A.xmap(applyFunc, Function.unlift(unapplyFunc))
def codec[A](packerF: Packer[A], unpackerF: Unpacker[A]): MsgpackCodec[A] =
new MsgpackCodec[A] {
override def pack(packer: MsgPacker, a: A) =
packerF(packer, a)
override def unpack(unpacker: MsgUnpacker) =
unpackerF(unpacker)
}
def codecTry[A](packF: Packer[A], unpackF: MsgUnpacker => A): MsgpackCodec[A] =
tryE[A](
packF,
u => \/-(unpackF(u))
)
private[msgpack4z] def tryE[A](packF: Packer[A], unpackF: MsgUnpacker => UnpackResult[A]): MsgpackCodec[A] =
codec[A](
packF,
u =>
try {
unpackF(u)
} catch {
case NonFatal(e) =>
-\/(Err(e))
}
)
private[msgpack4z] def tryConst[A](packF: Packer[A], unpackF: MsgUnpacker => A): MsgpackCodec[A] =
tryConstE(packF, u => \/-(unpackF(u)))
private[msgpack4z] def tryConstE[A](packF: Packer[A], unpackF: MsgUnpacker => UnpackResult[A]): MsgpackCodec[A] =
new MsgpackCodecConstant[A](
packF,
u =>
try {
unpackF(u)
} catch {
case NonFatal(e) =>
-\/(Err(e))
}
)
}
| {
"content_hash": "74481765f6565068e1a3ee4f5bf15942",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 137,
"avg_line_length": 26.6260162601626,
"alnum_prop": 0.5938931297709924,
"repo_name": "msgpack4z/msgpack4z-core",
"id": "1bf5497b1533ee6569c72e9cadeb0dd0b48569a5",
"size": "3275",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/msgpack4z/MsgpackCodec.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Scala",
"bytes": "252026"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "38f0bc60906adc6f4df9c49bba6d1389",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "a7efabf47e9b510528d45dabefb856aa86d547f3",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Cactaceae/Pyrrhocactus/Pyrrhocactus choapensis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System.Threading.Tasks;
namespace PeanutButter.Utils
{
/// <summary>
/// Extension methoss for tasks
/// </summary>
public static class TaskExtensions
{
/// <summary>
/// Runs a task which returns a result synchronously, returning that result
/// </summary>
/// <param name="task"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static T GetResultSync<T>(
this Task<T> task
)
{
return task
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
}
/// <summary>
/// Waits on a void-result task for completion
/// </summary>
/// <param name="task"></param>
public static void WaitSync(
this Task task)
{
task.ConfigureAwait(false);
task.Wait();
}
}
} | {
"content_hash": "63849fc0000d906ebb809f43d552926d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 83,
"avg_line_length": 25,
"alnum_prop": 0.4957894736842105,
"repo_name": "fluffynuts/PeanutButter",
"id": "a2b461827f744fecccf5ebf1334bf47ede4a2357",
"size": "950",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/Utils/PeanutButter.Utils/TaskExtensions.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "384"
},
{
"name": "C#",
"bytes": "4976711"
},
{
"name": "Inno Setup",
"bytes": "1774"
},
{
"name": "JavaScript",
"bytes": "18778"
},
{
"name": "PowerShell",
"bytes": "2399"
},
{
"name": "Shell",
"bytes": "741"
},
{
"name": "TSQL",
"bytes": "20441"
},
{
"name": "Visual Basic .NET",
"bytes": "253266"
}
],
"symlink_target": ""
} |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsHtml5PlainTextUtils_h
#define nsHtml5PlainTextUtils_h
#include "nsHtml5HtmlAttributes.h"
class nsHtml5PlainTextUtils
{
public:
static nsHtml5HtmlAttributes* NewLinkAttributes();
};
#endif // nsHtml5PlainTextUtils_h
| {
"content_hash": "475a6a7b98624a81ee97b9343ec45ecd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 70,
"avg_line_length": 27.5,
"alnum_prop": 0.7568181818181818,
"repo_name": "andrasigneczi/TravelOptimizer",
"id": "997702cffffd50a9135d8e64ec5540d09b83789e",
"size": "440",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "DataCollector/mozilla/xulrunner-sdk/include/nsHtml5PlainTextUtils.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "3443874"
},
{
"name": "C++",
"bytes": "33624518"
},
{
"name": "CSS",
"bytes": "1225"
},
{
"name": "HTML",
"bytes": "13117"
},
{
"name": "IDL",
"bytes": "1110940"
},
{
"name": "Java",
"bytes": "562163"
},
{
"name": "JavaScript",
"bytes": "1480"
},
{
"name": "Makefile",
"bytes": "360"
},
{
"name": "Objective-C",
"bytes": "3166"
},
{
"name": "Python",
"bytes": "322743"
},
{
"name": "Shell",
"bytes": "2539"
}
],
"symlink_target": ""
} |
using DogeNews.Services.Common.Contracts;
using DogeNews.Web.Infrastructure.Bindings;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using Ninject;
namespace DogeNews.Web.Hubs
{
[HubName("notificationHub")]
public class NotificationHub : Hub
{
public void Init()
{
INotificationsService notificationsService = NinjectWebCommon.Kernel.Get<INotificationsService>();
notificationsService.Clients = this.Clients.All;
}
}
} | {
"content_hash": "d7edf1157eac99a652a0e2353292abb8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 110,
"avg_line_length": 25.4,
"alnum_prop": 0.7106299212598425,
"repo_name": "SuchTeam-NoJoro-MuchSad/Doge-News",
"id": "ab122da68bcb9af040dfa233c83acbefcbdd6436",
"size": "510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DogeNews/Src/Web/DogeNews.Web/Hubs/NotificationHub.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "38583"
},
{
"name": "C#",
"bytes": "360049"
},
{
"name": "CSS",
"bytes": "157373"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "510037"
}
],
"symlink_target": ""
} |
$(function () {
left();
$("#tabul >li").each(function () {
$(this).bind("click",function(){
$("#tabul >li").removeClass("active_tab");
$(this).toggleClass("active_tab");
});
});
});
function left(){
var html="";
html=leftli(html,"jq_index i_32_tables","首页","","index.html");
html=leftli(html,"jq_dialog i_32_dashboard ","Dialog","对话框控件","dialog.html");
html=leftli(html,"jq_datepicker i_32_dashboard ","Datepicker","日期控件","datepicker.html");
$("#tabul").append(html);
var smallhtml="";
smallhtml=leftsmallli(smallhtml,"jq_index i_22_tables","首页","","index.html");
smallhtml=leftsmallli(smallhtml,"jq_dialog i_22_dashboard ","Dialog","对话框控件","dialog.html");
smallhtml=leftsmallli(smallhtml,"jq_datepicker i_22_dashboard ","Datepicker","日期控件","datepicker.html");
$("#smalltabul").append(smallhtml);
}
//licss图片在Icons下32直接填名字
function leftli(h,licss,label,info,ahref){
h+="<li class='"+licss+"'>";
h+="<a href='"+ahref+"' title='"+info+"'>";
h+="<span class='tab_label'>"+label+"</span>";
h+="<span class='tab_info'>"+info+"</span>";
h+="</a>";
h+="</li>";
return h;
}
function leftsmallli(h,licss,label,info,ahref){
h+="<li><a title='"+label+"' class='"+licss+"' href='"+ahref+"'></a></li>";
return h;
} | {
"content_hash": "9d8847c5a5bee8e747b6ba234bb5b932",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 104,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6286407766990292,
"repo_name": "futureskywei/whale",
"id": "92f75ff97abab3d041c3c3f63e733e8ee5aafe0e",
"size": "1298",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/webapp/static/apidoc/jquery/js/main.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "784148"
},
{
"name": "ColdFusion",
"bytes": "2253"
},
{
"name": "HTML",
"bytes": "2208161"
},
{
"name": "Java",
"bytes": "1987736"
},
{
"name": "JavaScript",
"bytes": "5161683"
},
{
"name": "PHP",
"bytes": "38915"
}
],
"symlink_target": ""
} |
package org.apache.sentry.tests.e2e.dbprovider;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import org.apache.sentry.provider.file.PolicyFile;
import org.apache.sentry.tests.e2e.hive.AbstractTestWithStaticConfiguration;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestDbComplexView extends AbstractTestWithStaticConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TestDbComplexView.class);
private static final String TEST_VIEW_DB = "test_complex_view_database";
private static final String TEST_VIEW_TB = "test_complex_view_table";
private static final String TEST_VIEW_TB2 = "test_complex_view_table_2";
private static final String TEST_VIEW = "test_complex_view";
private static final String TEST_VIEW_ROLE = "test_complex_view_role";
/**
* Run query and validate one column with given column name
* @param user
* @param sql
* @param db
* @param colName
* @param colVal
* @return
* @throws Exception
*/
private static boolean execValidate(String user, String sql, String db,
String colName, String colVal) throws Exception {
boolean status = false;
Connection conn = null;
Statement stmt = null;
try {
conn = context.createConnection(user);
stmt = context.createStatement(conn);
LOGGER.info("Running [USE " + db + ";" + sql + "] to validate column " + colName + " = " + colVal);
stmt.execute("USE " + db);
ResultSet rset = stmt.executeQuery(sql);
while (rset.next()) {
String val = rset.getString(colName);
if (val.equalsIgnoreCase(colVal)) {
LOGGER.info("found [" + colName + "] = " + colVal);
status = true;
break;
} else {
LOGGER.warn("[" + colName + "] = " + val + " not equal to " + colVal);
}
}
rset.close();
} catch (SQLException ex) {
LOGGER.error("SQLException: ", ex);
} catch (Exception ex) {
LOGGER.error("Exception: ", ex);
} finally {
try {
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception ex) {
LOGGER.error("failed to close connection and statement: " + ex);
}
}
return status;
}
@BeforeClass
public static void setupTestStaticConfiguration() throws Exception {
useSentryService = true;
AbstractTestWithStaticConfiguration.setupTestStaticConfiguration();
}
@Override
@Before
public void setup() throws Exception {
super.setupAdmin();
super.setup();
PolicyFile.setAdminOnServer1(ADMINGROUP);
// prepare test db and base table
List<String> sqls = new ArrayList<String>();
sqls.add("USE DEFAULT");
sqls.add("DROP DATABASE IF EXISTS " + TEST_VIEW_DB + " CASCADE");
sqls.add("CREATE DATABASE IF NOT EXISTS " + TEST_VIEW_DB);
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("CREATE TABLE " + TEST_VIEW_TB + " (userid VARCHAR(64), link STRING, source STRING) "
+ "PARTITIONED BY (datestamp STRING) CLUSTERED BY (userid) INTO 256 BUCKETS STORED AS ORC");
sqls.add("INSERT INTO TABLE " + TEST_VIEW_TB + " PARTITION (datestamp = '2014-09-23') VALUES "
+ "('tlee', " + "'mail.com', 'sports.com'), ('jdoe', 'mail.com', null)");
sqls.add("SELECT userid FROM " + TEST_VIEW_TB);
sqls.add("CREATE TABLE " + TEST_VIEW_TB2 + " (userid VARCHAR(64), name VARCHAR(64), age INT, "
+ "gpa DECIMAL(3, 2)) CLUSTERED BY (age) INTO 2 BUCKETS STORED AS ORC");
sqls.add("INSERT INTO TABLE " + TEST_VIEW_TB2 + " VALUES ('rgates', 'Robert Gates', 35, 1.28), "
+ "('tlee', 'Tod Lee', 32, 2.32)");
sqls.add("SELECT * FROM " + TEST_VIEW_TB2);
execBatch(ADMIN1, sqls);
}
private void createTestRole(String user, String roleName) throws Exception {
Connection conn = context.createConnection(user);
Statement stmt = conn.createStatement();
try {
exec(stmt, "DROP ROLE " + roleName);
} catch (Exception ex) {
LOGGER.info("test role doesn't exist, but it's ok");
} finally {
exec(stmt, "CREATE ROLE " + roleName);
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
}
private void grantAndValidatePrivilege(String testView, String testRole, String testGroup,
String user, boolean revoke) throws Exception {
createTestRole(ADMIN1, testRole);
List<String> sqls = new ArrayList<String>();
// grant privilege
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("GRANT SELECT ON TABLE " + testView + " TO ROLE " + testRole);
sqls.add("GRANT ROLE " + testRole + " TO GROUP " + testGroup);
execBatch(ADMIN1, sqls);
// show grant should pass and could list view
assertTrue("can not find select privilege from " + testRole,
execValidate(ADMIN1, "SHOW GRANT ROLE " + testRole + " ON TABLE " + testView,
TEST_VIEW_DB, "privilege", "select"));
assertTrue("can not find " + testView,
execValidate(user, "SHOW TABLES", TEST_VIEW_DB, "tab_name", testView));
// select from view should pass
sqls.clear();
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("SELECT * FROM " + testView);
execBatch(user, sqls);
if (revoke) {
// revoke privilege
sqls.clear();
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("REVOKE SELECT ON TABLE " + testView + " FROM ROLE " + testRole);
execBatch(ADMIN1, sqls);
// shouldn't be able to show grant
assertFalse("should not find select from " + testRole,
execValidate(ADMIN1, "SHOW GRANT ROLE " + testRole + " ON TABLE " + testView,
TEST_VIEW_DB, "privilege", "select"));
// select from view should fail
sqls.clear();
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("SELECT * FROM " + testView);
try {
execBatch(user, sqls);
} catch (SQLException ex) {
LOGGER.info("Expected SQLException here", ex);
}
}
}
private void grantAndValidatePrivilege(String testView, String testRole,
String testGroup, String user) throws Exception {
grantAndValidatePrivilege(testView, testRole, testGroup, user, true);
}
/**
* Create view1 and view2 from view1
* Grant and validate select privileges to both views
* @throws Exception
*/
@Test
public void testDbViewFromView() throws Exception {
List<String> sqls = new ArrayList<String>();
// create a simple view
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("CREATE VIEW " + TEST_VIEW +
"(userid,link) AS SELECT userid,link from " + TEST_VIEW_TB);
// create another view from the previous view
String testView2 = "view1_from_" + TEST_VIEW;
String testRole2 = testView2 + "_test_role";
sqls.add(String.format("CREATE VIEW %s AS SELECT userid,link from %s",
testView2, TEST_VIEW));
String testView3 = "view2_from_" + TEST_VIEW;
sqls.add(String.format("CREATE VIEW %s(userid,link) AS SELECT userid,link from %s",
testView3, TEST_VIEW));
execBatch(ADMIN1, sqls);
// validate privileges
grantAndValidatePrivilege(TEST_VIEW, TEST_VIEW_ROLE, USERGROUP1, USER1_1);
grantAndValidatePrivilege(testView2, testRole2, USERGROUP2, USER2_1);
// Disabled because of SENTRY-745, also need to backport HIVE-10875
//grantAndValidatePrivilege(testView3, testRole3, USERGROUP3, USER3_1);
}
/**
* Create a view by join two tables
* Grant and verify select privilege
* @throws Exception
*/
@Test
public void TestDbViewWithJoin() throws Exception {
List<String> sqls = new ArrayList<String>();
// create a joint view
sqls.add("USE " + TEST_VIEW_DB);
sqls.add(String.format("create view %s as select name,age,gpa from %s join %s on "
+ "(%s.userid=%s.userid) where name='Tod Lee'", TEST_VIEW, TEST_VIEW_TB2,
TEST_VIEW_TB, TEST_VIEW_TB2, TEST_VIEW_TB));
execBatch(ADMIN1, sqls);
// validate privileges
grantAndValidatePrivilege(TEST_VIEW, TEST_VIEW_ROLE, USERGROUP1, USER1_1);
}
/**
* Create a view with nested query
* Grant and verify select privilege
* @throws Exception
* SENTRY-716: Hive plugin does not correctly enforce
* privileges for new in case of nested queries
* Once backport HIVE-10875 to Sentry repo, will enable this test.
*/
@Ignore ("After SENTRY-716 is fixed, turn on this test")
@Test
public void TestDbViewWithNestedQuery() throws Exception {
List<String> sqls = new ArrayList<String>();
// create a joint view
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("CREATE VIEW " + TEST_VIEW + " AS SELECT * FROM " + TEST_VIEW_TB);
execBatch(ADMIN1, sqls);
grantAndValidatePrivilege(TEST_VIEW, TEST_VIEW_ROLE, USERGROUP1, USER1_1, false);
sqls.clear();
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("SELECT * FROM (SELECT * FROM " + TEST_VIEW + ") v2");
execBatch(USER1_1, sqls);
}
/**
* Create a view with union two tables
* Grant and verify select privilege
* @throws Exception
* SENTRY-747: Create a view by union tables, grant select
* then select from view encounter errors
* Once backport HIVE-10875 to Sentry repo, will enable this test.
*/
@Ignore ("After SENTRY-747 is fixed, turn on this test")
@Test
public void TestDbViewWithUnion() throws Exception {
List<String> sqls = new ArrayList<String>();
String testTable = "test_user_info";
sqls.add("USE " + TEST_VIEW_DB);
sqls.add("DROP TABLE IF EXISTS " + testTable);
sqls.add("CREATE TABLE " + testTable + " (userid VARCHAR(64), name STRING, address STRING, tel STRING) ");
sqls.add("INSERT INTO TABLE " + testTable + " VALUES "
+ "('tlee', " + "'Tod Lee', '1234 23nd Ave SFO, CA', '123-456-7890')");
sqls.add("SELECT * FROM " + testTable);
sqls.add(String.format("CREATE VIEW " + TEST_VIEW + " AS "
+ "SELECT u.userid, u.name, u.address, res.uid "
+ "FROM ("
+ "SELECT t1.userid AS uid "
+ "FROM %s t1 "
+ "UNION ALL "
+ "SELECT t2.userid AS uid "
+ "FROM %s t2 "
+ ") res JOIN %s u ON (u.userid = res.uid)",
TEST_VIEW_TB, TEST_VIEW_TB2, testTable));
execBatch(ADMIN1, sqls);
grantAndValidatePrivilege(TEST_VIEW, TEST_VIEW_ROLE, USERGROUP1, USER1_1);
}
}
| {
"content_hash": "201504e158174972afe61f167ce3cbb8",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 114,
"avg_line_length": 39.73913043478261,
"alnum_prop": 0.5747348931156371,
"repo_name": "apache/incubator-sentry",
"id": "35f41c6efc15afe566c760ac0e524946e4725991",
"size": "12684",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbComplexView.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4846"
},
{
"name": "HTML",
"bytes": "5005"
},
{
"name": "Java",
"bytes": "3922648"
},
{
"name": "JavaScript",
"bytes": "22225"
},
{
"name": "PLpgSQL",
"bytes": "410"
},
{
"name": "Python",
"bytes": "11367"
},
{
"name": "SQLPL",
"bytes": "30"
},
{
"name": "Shell",
"bytes": "27225"
},
{
"name": "Thrift",
"bytes": "27270"
},
{
"name": "XSLT",
"bytes": "25595"
}
],
"symlink_target": ""
} |
namespace clover {
namespace game { namespace editor {
using namespace net::msg;
struct CloverPathMsgTraits {
NET_MSG_TRAITS_NAME("clpt") // CLover PaTh
NET_MSG_TRAITS_VALUE(util::Str8) // Path to binary directory
};
struct ResourceRootMsgTraits {
NET_MSG_TRAITS_NAME("rsrt") // ReSource RooT
NET_MSG_TRAITS_VALUE(util::Str8) // Path from binary directory to resource root folder
};
struct ResourceMsgTraits {
NET_MSG_TRAITS_NAME("rsrc") // ReSouRCe
NET_MSG_TRAITS_VALUE(resources::SerializedResource)
};
struct ResourceRequestMsgTraits {
NET_MSG_TRAITS_NAME("rsrq") // ReSource ReQuest
NET_MSG_TRAITS_VALUE(resources::ResourceId)
};
BlenderEE::BlenderEE()
: server(ServerInfo{"BlenderEE server", 19595, 5.0}){
server.registerReceivable<ResourceMsgTraits>([=] (const resources::SerializedResource& res){
print(debug::Ch::Net, debug::Vb::Trivial, "Resource received from Blender: %s", res.getTypeName().cStr());
global::g_env.resCache->parseResource(res);
});
server.registerReceivable<ResourceRequestMsgTraits>([=] (const resources::ResourceId& res_id){
print(debug::Ch::Net, debug::Vb::Trivial, "Resource request from Blender: %s - %s", res_id.getTypeName().cStr(), res_id.getIdentifier().generateText().cStr());
server.send<ResourceMsgTraits>(global::g_env.resCache->getResource(res_id).getSerializedResource());
});
server.setOnConnectCallback([=] (){
// Tell where clover is
server.send<CloverPathMsgTraits>(global::g_env.device->getWorkingDirectory());
// Tell where resources are
server.send<ResourceRootMsgTraits>(global::g_env.resCache->getResourceRootPath());
});
listenForEvent(global::Event::OnEditorResourceSelect);
}
void BlenderEE::onEvent(global::Event& e){
switch(e.getType()){
case global::Event::OnEditorResourceSelect:
if (server.isConnected()){
// Resource selected, send to blender
resources::Resource* res= e(global::Event::Resource).getPtr<resources::Resource>();
ensure(res);
server.send<ResourceMsgTraits>(res->getSerializedResource(), [=] (){
print(debug::Ch::Dev, debug::Vb::Trivial, "Resource (%s) %s sent to Blender",
res->getResourceTypeName().cStr(),
res->getIdentifierAsString().cStr());
});
}
break;
default:;
}
}
void BlenderEE::update(){
server.update();
}
}} // game::editor
} // clover
| {
"content_hash": "60859ae84739cc21f16b2b7af788d514",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 161,
"avg_line_length": 30.415584415584416,
"alnum_prop": 0.7087959009393681,
"repo_name": "crafn/clover",
"id": "866a43a0968c9a899efa47499159a5d260ac66f4",
"size": "2488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "code/source/game/editor/extensions/ee_blender.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "16329136"
},
{
"name": "C++",
"bytes": "3005254"
},
{
"name": "Objective-C",
"bytes": "52894"
},
{
"name": "Perl",
"bytes": "3982"
},
{
"name": "Python",
"bytes": "16716"
},
{
"name": "Shell",
"bytes": "32"
}
],
"symlink_target": ""
} |
package org.apache.jena.commonsrdf.impl;
import org.apache.jena.graph.Node;
import org.apache.jena.riot.out.NodeFmtLib;
import org.apache.jena.shared.PrefixMapping;
import org.apache.jena.shared.impl.PrefixMappingImpl;
class JCR_Term implements JenaNode {
private Node node;
static private PrefixMapping empty = new PrefixMappingImpl();
protected JCR_Term(Node node) {
this.node = node;
}
@Override
public Node getNode() {
return node;
}
public String ntriplesString() {
return NodeFmtLib.strNT(node);
}
@Override
public String toString() {
return ntriplesString();
}
}
| {
"content_hash": "28f8b0a78337b5edacb3e0ecfb8144b7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 65,
"avg_line_length": 20.59375,
"alnum_prop": 0.6798179059180577,
"repo_name": "apache/jena",
"id": "9a54c4fde526350b8caa8e3c2a68c80976585a54",
"size": "1465",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "jena-extras/jena-commonsrdf/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "22246"
},
{
"name": "C++",
"bytes": "5877"
},
{
"name": "CSS",
"bytes": "3241"
},
{
"name": "Dockerfile",
"bytes": "3341"
},
{
"name": "Elixir",
"bytes": "2548"
},
{
"name": "HTML",
"bytes": "69029"
},
{
"name": "Haml",
"bytes": "30030"
},
{
"name": "Java",
"bytes": "35185092"
},
{
"name": "JavaScript",
"bytes": "72788"
},
{
"name": "Lex",
"bytes": "82672"
},
{
"name": "Makefile",
"bytes": "198"
},
{
"name": "Perl",
"bytes": "35662"
},
{
"name": "Python",
"bytes": "416"
},
{
"name": "Ruby",
"bytes": "216471"
},
{
"name": "SCSS",
"bytes": "4242"
},
{
"name": "Shell",
"bytes": "264124"
},
{
"name": "Thrift",
"bytes": "3755"
},
{
"name": "Vue",
"bytes": "104702"
},
{
"name": "XSLT",
"bytes": "65126"
}
],
"symlink_target": ""
} |
package com.sample.httpCore.httpInterface;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.SocketTimeoutException;
import java.util.List;
/**
* network tools
*
* @author caro
*/
public class NetworkUtil {
/**
* 获取网路连接类型
*
* @param context 上下文
* @return 网络类型
* 需要添加权限<uses-permission android:name="android.permission.INTERNET"/>
* 需要添加权限<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
*/
public String getNetType(Context context) {
ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = conn.getActiveNetworkInfo();
String result = null;
if (info != null && info.isAvailable()) {
if (info.isConnected()) {
int type = info.getType();
String typeName = info.getTypeName();
switch (type) {
case ConnectivityManager.TYPE_BLUETOOTH:
result = "蓝牙连接 : " + typeName;
break;
case ConnectivityManager.TYPE_DUMMY:
result = "虚拟数据连接 : " + typeName;
break;
case ConnectivityManager.TYPE_ETHERNET:
result = "以太网数据连接 : " + typeName;
break;
case ConnectivityManager.TYPE_MOBILE:
result = "移动数据连接 : " + typeName;
break;
case ConnectivityManager.TYPE_MOBILE_DUN:
result = "网络桥接 : " + typeName;
break;
case ConnectivityManager.TYPE_MOBILE_HIPRI:
result = "高优先级的移动数据连接 : " + typeName;
break;
case ConnectivityManager.TYPE_MOBILE_MMS:
result = "运营商的多媒体消息服务 : " + typeName;
break;
case ConnectivityManager.TYPE_MOBILE_SUPL:
result = "平面定位特定移动数据连接 : " + typeName;
break;
case ConnectivityManager.TYPE_WIFI:
result = "Wifi数据连接 : " + typeName;
break;
case ConnectivityManager.TYPE_WIMAX:
result = "全球微波互联 : " + typeName;
break;
default:
break;
}
}
}
return result;
}
/**
* 网络是否可用
*
* @param context
* @return
*/
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity == null) {
} else {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
}
return false;
}
/**
* Gps是否打开
*
* @param context
* @return
*/
public static boolean isGpsEnabled(Context context) {
LocationManager locationManager = ((LocationManager) context
.getSystemService(Context.LOCATION_SERVICE));
List<String> accessibleProviders = locationManager.getProviders(true);
return accessibleProviders != null && accessibleProviders.size() > 0;
}
/**
* 判断当前网络是否是wifi网络并且已连接
*
* @param context
* @return boolean
*/
public static boolean isWifiEnabled(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetInfo != null && activeNetInfo.getType() == ConnectivityManager.TYPE_WIFI && connectivityManager.getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED) {
return true;
}
return false;
}
/**
* 网络检测
*
* @param context 上下文
* @return false:无网络,true:有网络
*/
public boolean isOnline(Context context) {
boolean isOnline = false;
final ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
final NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo != null) {
isOnline = networkInfo.isAvailable();
}
// String netType = "当前网络类型为:" + networkInfo.getTypeName();
return isOnline;
}
/**
* 获取Wifi下的Ip地址
* 需要添加权限: <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
*
* @param context 上下文
* @return IP地址
*/
public String getWifiLocalIpAddress(Context context) {
WifiManager wifi = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo();
int ipAddress = info.getIpAddress();
return intToIp(ipAddress);
}
private String intToIp(int i) {
return (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF)
+ "." + ((i >> 24) & 0xFF);
}
/**
* 正确的打开网络设置
*/
public static void openSysSetting(Context context) {
if (android.os.Build.VERSION.SDK_INT > 13) {
context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
} else {
context.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
}
}
/**
* Get Phone IMEI Number
*
* @return imei
*/
public String getImei(Context c) {
TelephonyManager telephonyManager = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
String imei = telephonyManager.getDeviceId();
return imei;
}
public static boolean isNetworkConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
if (mNetworkInfo != null) {
return mNetworkInfo.isAvailable();
}
}
return false;
}
/**
* @param server ip
* @param timeout
* @return true
*/
public static boolean pingserver(String server, int timeout) {
BufferedReader in = null;
Runtime r = Runtime.getRuntime();
String pingcommand = "ping " + server + " -n 1 -w " + timeout;
try {
Process p = r.exec(pingcommand);
if (p == null) {
return false;
}
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
if (line.startsWith("reply from")) {
return true;
}
}
} catch (SocketTimeoutException socket) {
socket.printStackTrace();
return false;
} catch (Exception ex) {
ex.printStackTrace();
return false;
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
}
| {
"content_hash": "3773960493ea20006a28ba6e7654242c",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 184,
"avg_line_length": 32.684,
"alnum_prop": 0.5497491127157019,
"repo_name": "carozhu/EducationProject",
"id": "1f8bcabaed7ae8a071dbfbf776216f5fed01356b",
"size": "8513",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SmartProject/src/main/java/com/sample/httpCore/httpInterface/NetworkUtil.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "277435"
},
{
"name": "Kotlin",
"bytes": "905"
}
],
"symlink_target": ""
} |
using namespace mx::core;
using namespace std;
using namespace mxtest;
TEST( Test01, Properties )
{
TestMode v = TestMode::one;
PropertiesPtr object = tgenProperties( v );
stringstream expected;
tgenPropertiesExpected( expected, 1, v );
stringstream actual;
// object->toStream( std::cout, 1 );
object->toStream( actual, 1 );
CHECK_EQUAL( expected.str(), actual.str() )
CHECK( ! object->hasAttributes() )
CHECK( ! object->hasContents() )
}
TEST( Test02, Properties )
{
TestMode v = TestMode::two;
PropertiesPtr object = tgenProperties( v );
stringstream expected;
tgenPropertiesExpected( expected, 1, v );
stringstream actual;
// object->toStream( std::cout, 1 );
object->toStream( actual, 1 );
CHECK_EQUAL( expected.str(), actual.str() )
CHECK( ! object->hasAttributes() )
CHECK( object->hasContents() )
}
TEST( Test03, Properties )
{
TestMode v = TestMode::three;
PropertiesPtr object = tgenProperties( v );
stringstream expected;
tgenPropertiesExpected( expected, 1, v );
stringstream actual;
// object->toStream( std::cout, 1 );
object->toStream( actual, 1 );
CHECK_EQUAL( expected.str(), actual.str() )
CHECK( ! object->hasAttributes() )
CHECK( object->hasContents() )
}
namespace mxtest
{
PropertiesPtr tgenProperties( TestMode v )
{
PropertiesPtr o = makeProperties();
switch ( v )
{
case TestMode::one:
{
}
break;
case TestMode::two:
{
o->setEditorialGroup( tgenEditorialGroup( v ) );
auto d = makeDivisions();
d->setValue( PositiveDivisionsValue( 120 ) );
o->setDivisions( d );
o->setHasDivisions( true );
auto k = makeKey();
k->getKeyChoice()->setChoice( KeyChoice::Choice::traditionalKey );
k->getKeyChoice()->getTraditionalKey()->getFifths()->setValue( FifthsValue( -2 ) );
k->getKeyChoice()->getTraditionalKey()->setHasCancel( true );
k->getKeyChoice()->getTraditionalKey()->getCancel()->setValue( FifthsValue ( 1 ) );
o->addKey( k );
auto t = makeTime();
t->getTimeChoice()->setChoice( TimeChoice::Choice::timeSignature );
auto timeSignature = makeTimeSignatureGroup();
timeSignature->getBeats()->setValue( XsString( "3" ) );
timeSignature->getBeatType()->setValue( XsString( "4" ) );
t->getTimeChoice()->addTimeSignatureGroup( timeSignature );
t->getTimeChoice()->removeTimeSignatureGroup( t->getTimeChoice()->getTimeSignatureGroupSet().cbegin() );
o->addTime( t );
o->setHasStaves( true );
o->getStaves()->setValue( NonNegativeInteger( 4 ) );
o->setHasPartSymbol( true );
o->getPartSymbol()->setValue( GroupSymbolValue::none );
o->setHasInstruments( true );
o->getInstruments()->setValue( NonNegativeInteger( 3 ) );
auto c = makeClef();
c->getSign()->setValue( ClefSign::g );
c->getLine()->setValue( StaffLine( 2 ) );
c->setHasLine( true );
o->addClef( c );
auto sd = makeStaffDetails();
sd->setHasStaffLines( true );
sd->getStaffLines()->setValue( NonNegativeInteger( 5 ) );
sd->setHasStaffType( true );
sd->getStaffType()->setValue( StaffTypeEnum::regular );
o->addStaffDetails( sd );
auto dir = makeDirective();
dir->setValue( XsString( "allegro" ) );
dir->getAttributes()->hasLang = true;
o->addDirective( dir );
auto ms = makeMeasureStyle();
ms->getMeasureStyleChoice()->setChoice( MeasureStyleChoice::Choice::slash );
ms->getMeasureStyleChoice()->getSlash()->getSlashType()->setValue( NoteTypeValue::eighth );
o->addMeasureStyle( ms );
}
break;
case TestMode::three:
{
o->setEditorialGroup( tgenEditorialGroup( v ) );
auto d = makeDivisions();
d->setValue( PositiveDivisionsValue( 99 ) );
o->setDivisions( d );
o->setHasDivisions( true );
auto k = makeKey();
k->getKeyChoice()->setChoice( KeyChoice::Choice::traditionalKey );
k->getKeyChoice()->getTraditionalKey()->getFifths()->setValue( FifthsValue( -2 ) );
k->getKeyChoice()->getTraditionalKey()->setHasCancel( true );
k->getKeyChoice()->getTraditionalKey()->getCancel()->setValue( FifthsValue ( 1 ) );
o->addKey( k );
auto t = makeTime();
t->getTimeChoice()->setChoice( TimeChoice::Choice::timeSignature );
auto timeSignature = makeTimeSignatureGroup();
timeSignature->getBeats()->setValue( XsString( "5" ) );
timeSignature->getBeatType()->setValue( XsString( "4" ) );
t->getTimeChoice()->addTimeSignatureGroup( timeSignature );
t->getTimeChoice()->removeTimeSignatureGroup( t->getTimeChoice()->getTimeSignatureGroupSet().cbegin() );
o->addTime( t );
o->setHasStaves( true );
o->getStaves()->setValue( NonNegativeInteger( 4 ) );
o->setHasPartSymbol( true );
o->getPartSymbol()->setValue( GroupSymbolValue::none );
o->setHasInstruments( true );
o->getInstruments()->setValue( NonNegativeInteger( 3 ) );
auto c = makeClef();
c->getSign()->setValue( ClefSign::g );
c->getLine()->setValue( StaffLine( 2 ) );
c->setHasLine( true );
o->addClef( c );
c = makeClef();
c->getSign()->setValue( ClefSign::c );
c->getLine()->setValue( StaffLine( 3 ) );
c->setHasLine( true );
o->addClef( c );
// auto sd = makeStaffDetails();
// sd->setHasStaffLines( true );
// sd->getStaffLines()->setValue( NonNegativeInteger( 5 ) );
// sd->setHasStaffType( true );
// sd->getStaffType()->setValue( StaffTypeEnum::regular );
// o->addStaffDetails( sd );
auto dir = makeDirective();
dir->setValue( XsString( "allegro" ) );
dir->getAttributes()->hasLang = true;
o->addDirective( dir );
auto ms = makeMeasureStyle();
ms->getMeasureStyleChoice()->setChoice( MeasureStyleChoice::Choice::slash );
ms->getMeasureStyleChoice()->getSlash()->getSlashType()->setValue( NoteTypeValue::eighth );
o->addMeasureStyle( ms );
}
break;
default:
break;
}
return o;
}
void tgenPropertiesExpected(std::ostream& os, int i, TestMode v )
{
switch ( v )
{
case TestMode::one:
{
streamLine( os, i, R"(<attributes/>)", false );
}
break;
case TestMode::two:
{
streamLine( os, i, R"(<attributes>)" );
tgenEditorialGroupExpected( os, i+1, v );
os << std::endl;
streamLine( os, i+1, R"(<divisions>120</divisions>)" );
streamLine( os, i+1, R"(<key>)" );
streamLine( os, i+2, R"(<cancel>1</cancel>)" );
streamLine( os, i+2, R"(<fifths>-2</fifths>)" );
streamLine( os, i+1, R"(</key>)" );
streamLine( os, i+1, R"(<time>)" );
streamLine( os, i+2, R"(<beats>3</beats>)" );
streamLine( os, i+2, R"(<beat-type>4</beat-type>)" );
streamLine( os, i+1, R"(</time>)" );
streamLine( os, i+1, R"(<staves>4</staves>)" );
streamLine( os, i+1, R"(<part-symbol>none</part-symbol>)" );
streamLine( os, i+1, R"(<instruments>3</instruments>)" );
streamLine( os, i+1, R"(<clef>)" );
streamLine( os, i+2, R"(<sign>G</sign>)" );
streamLine( os, i+2, R"(<line>2</line>)" );
streamLine( os, i+1, R"(</clef>)" );
streamLine( os, i+1, R"(<staff-details>)" );
streamLine( os, i+2, R"(<staff-type>regular</staff-type>)" );
streamLine( os, i+2, R"(<staff-lines>5</staff-lines>)" );
streamLine( os, i+1, R"(</staff-details>)" );
streamLine( os, i+1, R"(<directive xml:lang="it">allegro</directive>)" );
streamLine( os, i+1, R"(<measure-style>)" );
streamLine( os, i+2, R"(<slash type="start">)" );
streamLine( os, i+3, R"(<slash-type>eighth</slash-type>)" );
streamLine( os, i+2, R"(</slash>)" );
streamLine( os, i+1, R"(</measure-style>)" );
streamLine( os, i, R"(</attributes>)", false );
}
break;
case TestMode::three:
{
streamLine( os, i, R"(<attributes>)" );
tgenEditorialGroupExpected( os, i+1, v );
os << std::endl;
streamLine( os, i+1, R"(<divisions>99</divisions>)" );
streamLine( os, i+1, R"(<key>)" );
streamLine( os, i+2, R"(<cancel>1</cancel>)" );
streamLine( os, i+2, R"(<fifths>-2</fifths>)" );
streamLine( os, i+1, R"(</key>)" );
streamLine( os, i+1, R"(<time>)" );
streamLine( os, i+2, R"(<beats>5</beats>)" );
streamLine( os, i+2, R"(<beat-type>4</beat-type>)" );
streamLine( os, i+1, R"(</time>)" );
streamLine( os, i+1, R"(<staves>4</staves>)" );
streamLine( os, i+1, R"(<part-symbol>none</part-symbol>)" );
streamLine( os, i+1, R"(<instruments>3</instruments>)" );
streamLine( os, i+1, R"(<clef>)" );
streamLine( os, i+2, R"(<sign>G</sign>)" );
streamLine( os, i+2, R"(<line>2</line>)" );
streamLine( os, i+1, R"(</clef>)" );
streamLine( os, i+1, R"(<clef>)" );
streamLine( os, i+2, R"(<sign>C</sign>)" );
streamLine( os, i+2, R"(<line>3</line>)" );
streamLine( os, i+1, R"(</clef>)" );
// streamLine( os, i+1, R"(<staff-details>)" );
// streamLine( os, i+2, R"(<staff-type>regular</staff-type>)" );
// streamLine( os, i+2, R"(<staff-lines>5</staff-lines>)" );
// streamLine( os, i+1, R"(</staff-details>)" );
streamLine( os, i+1, R"(<directive xml:lang="it">allegro</directive>)" );
streamLine( os, i+1, R"(<measure-style>)" );
streamLine( os, i+2, R"(<slash type="start">)" );
streamLine( os, i+3, R"(<slash-type>eighth</slash-type>)" );
streamLine( os, i+2, R"(</slash>)" );
streamLine( os, i+1, R"(</measure-style>)" );
streamLine( os, i, R"(</attributes>)", false );
}
break;
default:
break;
}
}
}
#endif
| {
"content_hash": "949ce3f566285a4e73092fc8e03d3382",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 120,
"avg_line_length": 45.8828125,
"alnum_prop": 0.4902945683636983,
"repo_name": "Webern/MusicXML-Class-Library",
"id": "dfb1a7a7e3dd9bb48c5d356966d0c3d82fb27753",
"size": "12084",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sourcecode/private/mxtest/core/PropertiesTest.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1796"
},
{
"name": "C++",
"bytes": "8167393"
},
{
"name": "CMake",
"bytes": "2762"
},
{
"name": "HTML",
"bytes": "8450"
},
{
"name": "Objective-C",
"bytes": "1428"
},
{
"name": "Ruby",
"bytes": "141276"
},
{
"name": "Shell",
"bytes": "1997"
}
],
"symlink_target": ""
} |
package com.michaelfotiadis.ibeaconscanner.activities;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.Switch;
import com.github.johnpersano.supertoasts.SuperActivityToast;
import com.michaelfotiadis.ibeaconscanner.R;
import com.michaelfotiadis.ibeaconscanner.adapter.MyExpandableListAdapter;
import com.michaelfotiadis.ibeaconscanner.containers.CustomConstants;
import com.michaelfotiadis.ibeaconscanner.datastore.Singleton;
import com.michaelfotiadis.ibeaconscanner.processes.ScanProcess;
import com.michaelfotiadis.ibeaconscanner.tasks.MonitorTask;
import com.michaelfotiadis.ibeaconscanner.tasks.MonitorTask.OnBeaconDataChangedListener;
import com.michaelfotiadis.ibeaconscanner.utils.BluetoothUtils;
import com.michaelfotiadis.ibeaconscanner.utils.Logger;
import com.michaelfotiadis.ibeaconscanner.utils.ToastUtils;
public class MainActivity extends FragmentActivity implements OnChildClickListener, OnCheckedChangeListener {
public class ResponseReceiver extends BroadcastReceiver {
private String TAG = "Response Receiver";
@Override
public void onReceive(Context context, Intent intent) {
Logger.d(TAG, "On Receiver Result");
if (intent.getAction().equalsIgnoreCase(
CustomConstants.Broadcasts.BROADCAST_1.getString())) {
Logger.i(TAG, "Scan Running");
SuperActivityToast.cancelAllSuperActivityToasts();
isScanRunning = true;
isToastScanningNowShown = true;
mSuperActivityToast = ToastUtils.makeProgressToast(MainActivity.this, mSuperActivityToast, mToastStringScanningNow);
} else if (intent.getAction().equalsIgnoreCase(
CustomConstants.Broadcasts.BROADCAST_2.getString())) {
Logger.i(TAG, "Service Finished");
SuperActivityToast.cancelAllSuperActivityToasts();
isToastScanningNowShown = false;
// isToastStoppingScanShown = false;
ToastUtils.makeInfoToast(MainActivity.this, mToastStringScanFinished);
}
}
}
private final String TAG = this.toString();
private BluetoothUtils mBluetoothUtils;
private ExpandableListView mExpandableListView;
private CharSequence mTextViewContents;
private MonitorTask mMonitorTask;
// Receivers
private ResponseReceiver mScanReceiver;
private SharedPreferences mSharedPrefs;
private boolean isScanRunning = false;
private SuperActivityToast mSuperActivityToast;
private final String mToastStringScanningNow = "Scanning...";
private final String mToastStringScanFinished = "Scan Finished";
private final String mToastStringEnableLE = "Waiting for Bluetooth adapter...";
private final String mToastStringNoLE = "Device does not support Bluetooth LE";
private final String mToastStringScanInterrupted = "Scan Interrupted";
private boolean isToastScanningNowShown;
private boolean isToastStoppingScanShown;
MyExpandableListAdapter mListAdapter;
List<String> mListDataHeader;
HashMap<String, List<String>> mListDataChild;
MenuItem mMenuItem;
private static final int RESULT_SETTINGS = 1;
private int getPauseTime(){
String result = mSharedPrefs.getString(
getString(R.string.pref_pausetime),
String.valueOf(getResources().getInteger(R.integer.default_pausetime)));
return Integer.parseInt(result);
}
private int getScanTime(){
String result = mSharedPrefs.getString(
getString(R.string.pref_scantime),
String.valueOf(getResources().getInteger(R.integer.default_scantime)));
return Integer.parseInt(result);
}
private void notifyDataChanged() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (Singleton.getInstance().getAvailableDevicesList() != null) {
updateListData();
}
}
});
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Logger.d(TAG, "onCheckedStateListener");
serviceToggle();
}
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
try {
Logger.d(TAG, "Size of Data Child List " + mListDataChild.values().size());
Logger.d(TAG, "Group Position : " + groupPosition);
Logger.d(TAG, "Child Position : " + childPosition);
String address = mListDataChild.get(mListDataHeader.get(groupPosition)).get(childPosition);
Logger.d(TAG, "Starting Display Activity for address " + address);
Intent intent = new Intent(this, DeviceActivity.class);
intent.putExtra(CustomConstants.Payloads.PAYLOAD_1.toString(),
Singleton.getInstance().getBluetoothLeDeviceForAddress(address));
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, "Null Data Child List " + e.getLocalizedMessage());
e.printStackTrace();
}
return false;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
Logger.d(TAG, "Starting Main Activity");
mExpandableListView = (ExpandableListView) findViewById(R.id.listViewResults);
mExpandableListView.setOnChildClickListener(this);
mSharedPrefs = PreferenceManager
.getDefaultSharedPreferences(this);
if (savedInstanceState != null) {
mTextViewContents = savedInstanceState.getCharSequence(CustomConstants.Payloads.PAYLOAD_1.toString());
isScanRunning = savedInstanceState.getBoolean(CustomConstants.Payloads.PAYLOAD_2.toString(), false);
isToastScanningNowShown = savedInstanceState.getBoolean(CustomConstants.Payloads.PAYLOAD_4.toString(), false);
isToastStoppingScanShown = savedInstanceState.getBoolean(CustomConstants.Payloads.PAYLOAD_5.toString(), false);
}
// initialise Bluetooth utilities
mBluetoothUtils = new BluetoothUtils(this);
// monitor the singleton
registerMonitorTask();
// Wait for broadcasts from the scanning process
registerResponseReceiver();
SuperActivityToast.cancelAllSuperActivityToasts();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
protected void onDestroy() {
removeReceivers();
Logger.d(TAG, "App onDestroy");
super.onDestroy();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// same as using a normal menu
switch (item.getItemId()) {
case R.id.action_settings:
startPreferencesActivity();
break;
default:
break;
}
return true;
}
@Override
protected void onPause() {
// Cancel the alarm
SuperActivityToast.cancelAllSuperActivityToasts();
new ScanProcess().cancelService(this);
Logger.d(TAG, "App onPause");
super.onPause();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem switchMenuItem = menu.getItem(0);
Switch tb = (Switch) switchMenuItem.getActionView().findViewById(R.id.switchForActionBar);
tb.setChecked(isScanRunning);
tb.setOnCheckedChangeListener(this);
return super.onPrepareOptionsMenu(menu);
}
@Override
protected void onResume() {
super.onResume();
SuperActivityToast.cancelAllSuperActivityToasts();
if (!mBluetoothUtils.isBluetoothLeSupported()) {
mSuperActivityToast = ToastUtils.makeWarningToast(this, mToastStringNoLE );
// mButton.setEnabled(false);
} else {
if (!mBluetoothUtils.isBluetoothOn()) {
new ScanProcess().cancelService(this);
mBluetoothUtils.askUserToEnableBluetoothIfNeeded();
}
if (mBluetoothUtils.isBluetoothOn()
&& mBluetoothUtils.isBluetoothLeSupported()) {
Logger.i(TAG, "Bluetooth has been activated");
if (isScanRunning) {
Logger.d(TAG, "Restarting Scan Service");
// mButton.setChecked(isScanRunning);
new ScanProcess().scanForIBeacons(MainActivity.this, getScanTime(), getPauseTime());
}
if(isToastScanningNowShown) {
mSuperActivityToast = ToastUtils.makeProgressToast(this, mSuperActivityToast, mToastStringScanningNow);
}
updateListData();
} else {
SuperActivityToast.cancelAllSuperActivityToasts();
mSuperActivityToast = ToastUtils.makeProgressToast(this, mSuperActivityToast, mToastStringEnableLE);
}
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putCharSequence(CustomConstants.Payloads.PAYLOAD_1.toString(), mTextViewContents);
outState.putBoolean(CustomConstants.Payloads.PAYLOAD_2.toString(), isScanRunning);
outState.putBoolean(CustomConstants.Payloads.PAYLOAD_4.toString(), isToastScanningNowShown);
outState.putBoolean(CustomConstants.Payloads.PAYLOAD_5.toString(), isToastStoppingScanShown);
super.onSaveInstanceState(outState);
}
private void registerMonitorTask() {
Logger.d(TAG, "Starting Monitor Task");
mMonitorTask = new MonitorTask(new OnBeaconDataChangedListener() {
@Override
public void onDataChanged() {
Logger.d(TAG, "Singleton Data Changed");
notifyDataChanged();
}
});
mMonitorTask.start();
}
private void registerResponseReceiver() {
Logger.d(TAG, "Registering Response Receiver");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(CustomConstants.Broadcasts.BROADCAST_1.getString());
intentFilter.addAction(CustomConstants.Broadcasts.BROADCAST_2.getString());
mScanReceiver = new ResponseReceiver();
this.registerReceiver(mScanReceiver, intentFilter);
}
protected void removeReceivers() {
try {
this.unregisterReceiver(mScanReceiver);
Logger.d(TAG, "Scan Receiver Unregistered Successfully");
} catch (Exception e) {
Logger.d(
TAG,
"Scan Receiver Already Unregistered. Exception : "
+ e.getLocalizedMessage());
}
}
public void serviceToggle() {
Logger.d(TAG, "Click on Scan Button");
SuperActivityToast.cancelAllSuperActivityToasts();
if (isScanRunning) {
// Cancels the alarms if the scan is already running
new ScanProcess().cancelService(this);
isToastScanningNowShown = false;
mSuperActivityToast = ToastUtils.makeInfoToast(this, mToastStringScanInterrupted);
isScanRunning = false;
} else {
// This ScanProcess will also cancel all alarms on continuation
new ScanProcess().scanForIBeacons(MainActivity.this, getScanTime(), getPauseTime());
}
}
private void startPreferencesActivity() {
Logger.d(TAG, "Starting Settings Activity");
Intent intent = new Intent(this, ScanPreferencesActivity.class);
startActivityForResult(intent, RESULT_SETTINGS);
}
protected void stopMonitorTask() {
if (mMonitorTask != null) {
Logger.d(TAG, "Monitor Task paused");
mMonitorTask.stop();
}
}
private void updateListData() {
Logger.d(TAG, "Updating List Data");
mListDataHeader = new ArrayList<String>();
mListDataHeader.add("Available Devices (" + Singleton.getInstance().getAvailableDeviceListSize() + ")");
mListDataHeader.add("New Devices (" + Singleton.getInstance().getNewDeviceListSize() + ")");
mListDataHeader.add("Updated Devices (" + Singleton.getInstance().getUpdatedDeviceListSize() + ")");
mListDataHeader.add("Moving Closer Devices (" + Singleton.getInstance().getMovingCloserDeviceListSize() + ")");
mListDataHeader.add("Moving Farther Device (" + Singleton.getInstance().getMovingFartherDeviceListSize() + ")");
mListDataHeader.add("Dissappearing Devices (" + Singleton.getInstance().getDissappearingDeviceListSize() + ")");
mListDataChild = new HashMap<String, List<String>>();
mListDataChild.put(mListDataHeader.get(0), Singleton.getInstance().getDevicesAvailableAsStringList());
mListDataChild.put(mListDataHeader.get(1), Singleton.getInstance().getDevicesNewAsStringList());
mListDataChild.put(mListDataHeader.get(2), Singleton.getInstance().getDevicesUpdatedAsStringList());
mListDataChild.put(mListDataHeader.get(3), Singleton.getInstance().getDevicesMovingCloserAsStringList());
mListDataChild.put(mListDataHeader.get(4), Singleton.getInstance().getDevicesMovingFartherAsStringList());
mListDataChild.put(mListDataHeader.get(5), Singleton.getInstance().getDevicesDissappearingAsStringList());
mListAdapter = new MyExpandableListAdapter(this, mListDataHeader, mListDataChild);
Logger.d(TAG, "Setting Adapter");
mExpandableListView.setAdapter(mListAdapter);
}
}
| {
"content_hash": "403fe3fc479bf390cca0036f27a19c6c",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 120,
"avg_line_length": 35.069252077562325,
"alnum_prop": 0.7712480252764613,
"repo_name": "joeyvanderbie/Android--iBeacon-Scanner-Service",
"id": "ab53209bd7fe207fad474b29cac19faf0c0d978d",
"size": "12660",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/michaelfotiadis/ibeaconscanner/activities/MainActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "11156"
},
{
"name": "Java",
"bytes": "57574"
}
],
"symlink_target": ""
} |
package org.sana.android.activity;
import org.sana.R;
import org.sana.android.provider.Notifications;
import android.app.NotificationManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* NotificationViewer builds the interface for viewing a single received
* notification. This displays the diagnosis, pertaining patient, and allows the
* user to dismiss the notification if desired.
*
* @author Sana Dev Team
*/
public class NotificationViewer extends FragmentActivity implements OnClickListener {
private static String TAG = NotificationViewer.class.getSimpleName();
private static final String[] PROJECTION = new String[] {
Notifications.Contract._ID, Notifications.Contract.PROCEDURE_ID,
Notifications.Contract.PATIENT_ID, Notifications.Contract.FULL_MESSAGE};
private Button dismiss, save;
private Uri notification;
/** {@inheritDoc} */
@Override
public void onCreate(Bundle instance) {
super.onCreate(instance);
notification = getIntent().getData();
Cursor cursor = managedQuery(getIntent().getData(), PROJECTION, null,
null, Notifications.DEFAULT_SORT_ORDER);
cursor.moveToFirst();
String procedureIdentifier = cursor.getString(cursor.getColumnIndex(
Notifications.Contract.PROCEDURE_ID));
String patientId = cursor.getString(cursor.getColumnIndex(
Notifications.Contract.PATIENT_ID));
String message = cursor.getString(cursor.getColumnIndex(
Notifications.Contract.FULL_MESSAGE));
cursor.close();
/*
cursor = managedQuery(Encounters.CONTENT_URI, new String[] {Encounters._ID, Encounters.PROCEDURE, Encounters.STATE},
Encounters.UUID + " = ?",
new String[] { procedureIdentifier }, null);
if(cursor.getCount() == 0) {
// doh
}
cursor.moveToFirst();
int spId = cursor.getInt(0);
int procedureId = cursor.getInt(1);
String answers = cursor.getString(2);
cursor.close();
Uri savedUri = ContentUris.withAppendedId(Encounters.CONTENT_URI, spId);
Uri procedureUri = ContentUris.withAppendedId(Procedures.CONTENT_URI, procedureId);
Log.i(TAG, "Getting procedure " + procedureUri.toString());
cursor = getContentResolver().query(procedureUri, new String[] { Procedures.PROCEDURE }, null, null, null);
cursor.moveToFirst();
String procedureXml = cursor.getString(0);
cursor.deactivate();
Map<String, Map<String,String>> questionsAnswers = new HashMap<String, Map<String,String>>();
try{
Procedure p = Procedure.fromXMLString(procedureXml);
p.setInstanceUri(savedUri);
JSONTokener tokener = new JSONTokener(answers);
JSONObject answersDict = new JSONObject(tokener);
Map<String,String> answersMap = new HashMap<String,String>();
Iterator it = answersDict.keys();
while(it.hasNext()) {
String key = (String)it.next();
answersMap.put(key, answersDict.getString(key));
Log.i(TAG, "onCreate() : answer '" + key + "' : '" + answersDict.getString(key) +"'");
}
Log.i(TAG, "onCreate() : restoreAnswers");
p.restoreAnswers(answersMap);
questionsAnswers = p.toQAMap();
} catch(ProcedureParseException e) {
} catch(JSONException e) {
} catch (IOException e) {
} catch (ParserConfigurationException e) {
} catch (SAXException e) {
}
*/
LinearLayout notifView = new LinearLayout(this);
notifView.setOrientation(LinearLayout.VERTICAL);
TextView tv1 = new TextView(this);
tv1.setText(getString(R.string.note_pt_diagnosis)+" " + patientId);
tv1.setTextAppearance(this, android.R.style.TextAppearance_Large);
tv1.setGravity(Gravity.CENTER_HORIZONTAL);
TextView tv2 = new TextView(this);
tv2.setText("");
tv2.setTextAppearance(this, android.R.style.TextAppearance_Medium);
TextView tv4 = new TextView(this);
tv4.setText("");
tv4.setTextAppearance(this, android.R.style.TextAppearance_Medium);
TextView tv3 = new TextView(this);
tv3.setText(message);
tv3.setTextAppearance(this, android.R.style.TextAppearance_Medium);
dismiss = new Button(this);
dismiss.setText(getString(R.string.general_dismiss));
dismiss.setOnClickListener(this);
save = new Button(this);
save.setText(getString(R.string.general_save));
save.setOnClickListener(this);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.addView(dismiss,new LinearLayout.LayoutParams(-2,-1, 0.5f));
ll.addView(save,new LinearLayout.LayoutParams(-2,-1, 0.5f));
notifView.setWeightSum(1.0f);
ll.setGravity(Gravity.BOTTOM);
notifView.addView(tv1);
notifView.addView(tv2);
notifView.addView(tv3);
notifView.addView(tv4);
notifView.addView(ll);
this.setContentView(notifView);
}
/**
* If a user elects to dismiss the notification, the status bar will be
* cleared of ALL notification alerts. This employs a "only the latest
* notification in status bar" policy.
*/
@Override
public void onClick(View v) {
if (v == dismiss) {
this.getContentResolver().delete(notification, null, null);
((NotificationManager)this.getSystemService(NOTIFICATION_SERVICE))
.cancelAll();
this.finish();
} else if (v == save) {
((NotificationManager)this.getSystemService(NOTIFICATION_SERVICE))
.cancelAll();
this.finish();
}
}
}
| {
"content_hash": "2f3550fc75091ae30fc466d8b1ee13d7",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 124,
"avg_line_length": 38.234177215189874,
"alnum_prop": 0.6636318490316173,
"repo_name": "UNFPAInnovation/GetIn_Mobile",
"id": "3dd0d0b66a3a1f66fbae35bd4daf30e964c5c4ce",
"size": "6041",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/org/sana/android/activity/NotificationViewer.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "2235840"
},
{
"name": "Shell",
"bytes": "1182"
}
],
"symlink_target": ""
} |
<?php
namespace StickyNotes\Model\Entity;
/**
* Class StickyNote
* module/StickyNotes/src/StickyNotes/Model/Entity/StickyNote.php
* @package StickyNotes\Model\Entity
*/
class StickyNote {
protected $_id;
protected $_note;
protected $_created;
public function __construct(array $options = null) {
if (is_array($options)) {
$this->setOptions($options);
}
}
public function __set($name, $value) {
$method = 'set' . $name;
if (!method_exists($this, $method)) {
throw new Exception('Invalid Method');
}
$this->$method($value);
}
public function __get($name) {
$method = 'get' . $name;
if (!method_exists($this, $method)) {
throw new Exception('Invalid Method');
}
return $this->$method();
}
public function setOptions(array $options) {
$methods = get_class_methods($this);
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this->$method($value);
}
}
return $this;
}
public function getId() {
return $this->_id;
}
public function setId($id) {
$this->_id = $id;
return $this;
}
public function getNote() {
return $this->_note;
}
public function setNote($note) {
$this->_note = $note;
return $this;
}
public function getCreated() {
return $this->_created;
}
public function setCreated($created) {
$this->_created = $created;
return $this;
}
} | {
"content_hash": "426a7252c7cbef01c44f15c9c2d929e7",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 65,
"avg_line_length": 22.039473684210527,
"alnum_prop": 0.5253731343283582,
"repo_name": "TimvanSteenbergen/FatBoy",
"id": "f2c87744bba8f1fa838b9fe5144c30999f296c42",
"size": "1675",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "module/StickyNotes/src/StickyNotes/Model/Entity/StickyNote.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "711"
},
{
"name": "CSS",
"bytes": "1133"
},
{
"name": "HTML",
"bytes": "57865"
},
{
"name": "JavaScript",
"bytes": "5580"
},
{
"name": "PHP",
"bytes": "72792"
}
],
"symlink_target": ""
} |
#ifndef PHALCON_TRANSLATE_ADAPTER_GETTEXT_H
#define PHALCON_TRANSLATE_ADAPTER_GETTEXT_H
#include "php_phalcon.h"
extern zend_class_entry *phalcon_translate_adapter_gettext_ce;
PHALCON_INIT_CLASS(Phalcon_Translate_Adapter_Gettext);
#endif /* PHALCON_TRANSLATE_ADAPTER_GETTEXT_H */
| {
"content_hash": "9e6a966a14a166539268d5cc4d21b5d4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 22.076923076923077,
"alnum_prop": 0.7874564459930313,
"repo_name": "unisys12/phalcon-hhvm",
"id": "b63950bad63b59ec5da3a52fb514cbce2dc56098",
"size": "1447",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ext/translate/adapter/gettext.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "1206378"
},
{
"name": "C++",
"bytes": "15147063"
},
{
"name": "CSS",
"bytes": "120"
},
{
"name": "JavaScript",
"bytes": "196"
},
{
"name": "Objective-C",
"bytes": "4265"
},
{
"name": "PHP",
"bytes": "1390450"
},
{
"name": "Python",
"bytes": "2197"
},
{
"name": "Shell",
"bytes": "30771"
},
{
"name": "Volt",
"bytes": "2715"
}
],
"symlink_target": ""
} |
title: Add New Properties to a JavaScript Object
localeTitle: Adicionar novas propriedades a um objeto JavaScript
---
## Adicionar novas propriedades a um objeto JavaScript
Aqui está o exemplo:
```js
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"]
};
ourDog.bark = "bow-wow";
```
Aqui está uma solução:
```js
var myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"]
};
// Only change code below this line.
myDog.bark = "woof";
``` | {
"content_hash": "ff82d22432259f48c3b7160541558de6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 17.15625,
"alnum_prop": 0.6211293260473588,
"repo_name": "pahosler/freecodecamp",
"id": "a431cdeae0fb34cd14f910c876db32d3903fa5d4",
"size": "557",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "guide/portuguese/certifications/javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object/index.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "35491"
},
{
"name": "HTML",
"bytes": "17600"
},
{
"name": "JavaScript",
"bytes": "777274"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
Index Fungorum
#### Published in
null
#### Original name
Puccinia ribesii-caricis f. sp
### Remarks
null | {
"content_hash": "02a56aa8958713af16b84ae062989558",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 30,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.7014925373134329,
"repo_name": "mdoering/backbone",
"id": "8f924a813ddc7b678126250b70ced1a8531176f2",
"size": "185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Pucciniomycetes/Pucciniales/Pucciniaceae/Puccinia/Puccinia ribesii-caricis/ Syn. Puccinia ribesii-caricis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<<<<<<< HEAD
# ordmon
Monitors orders on c-cex
=======
# cxfreexenviron
something I use to convert my scripts to executables
>>>>>>> e605c2d5fc24ab4716a4a59443d10c76e8a7cbd8
Certain sites do not like being scraped, to get around this python needs to pretend to be a browser.
You need to download the program chrome driver http://chromedriver.storage.googleapis.com/index.html
I use 2.9 win32
just place chromedriver.exe into the same directory as gormonsel.exe
Instructions:
You need to log in after clicking on the Open log Page button in order for it to work. After the first time you log in, it shouldn't have to log in again for awhile,
you can open up a new tab and use the c-cex website normally but you don't want to work on the first tab the app opens
any questions or comments you can contact me at:
noe@stakeco.in
To fix.
The app throws an exception when not in the correct website, this is a user error because it can only work on the trading log page but I can eliminate that as a bug. | {
"content_hash": "9cbb750d881d8da9515d8e02f0d14426",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 165,
"avg_line_length": 50,
"alnum_prop": 0.777,
"repo_name": "Triballian/ordmon",
"id": "de6d610641d5c63d5bf745b0b0bc276d47d600bf",
"size": "1000",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ordmon/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "156"
},
{
"name": "Python",
"bytes": "39814"
}
],
"symlink_target": ""
} |
<?php
/**
* File SchemaInterface.php
*
* @author Edward Pfremmer <epfremme@nerdery.com>
*/
namespace Epfremme\Swagger\Entity\Schemas;
/**
* Class SchemaInterface
*
* @package Epfremme\Swagger
* @subpackage Entity\Schemas
*/
interface SchemaInterface
{
/**
* Return schema type
* @return string
*/
public function getType();
/**
* Return schema title
* @return string
*/
public function getTitle();
/**
* Set schema title
* @param string $title
* @return self
*/
public function setTitle($title);
/**
* Return schema description
* @return string
*/
public function getDescription();
/**
* Set schema description
* @param string $description
* @return self
*/
public function setDescription($description);
}
| {
"content_hash": "3c99631e18d8272cd6b7ba2a7e871829",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 49,
"avg_line_length": 17.26530612244898,
"alnum_prop": 0.6028368794326241,
"repo_name": "epfremmer/swagger",
"id": "4a0c76faf2ebeb191d8180a7144cb246f728217d",
"size": "846",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Entity/Schemas/SchemaInterface.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "PHP",
"bytes": "301173"
}
],
"symlink_target": ""
} |
import unittest
import mock
from ...haystack.utils import get_instance
class GetInstanceTestCase(unittest.TestCase):
def test_get_instance_should_call_and_return_managers_get_with_pk_from_model_class(
self):
# setup
model_class = mock.Mock()
pk = '1'
get = model_class._default_manager.get
# action
returned_value = get_instance(model_class, pk)
# assert
self.assertDictEqual(dict(pk=int(pk)), get.call_args[1])
self.assertEqual(id(get.return_value), id(returned_value))
def test_get_instance_should_return_none_when_pk_does_not_exist(
self):
# setup
model_class = mock.Mock()
pk = '1'
get = model_class._default_manager.get
model_class.DoesNotExist = Exception
get.side_effect = model_class.DoesNotExist()
# action
returned_value = get_instance(model_class, pk)
# assert
self.assertDictEqual(dict(pk=int(pk)), get.call_args[1])
self.assertIsNone(returned_value)
def test_get_instance_should_return_none_when_pk_yields_multiple_objects(
self):
# setup
model_class = mock.Mock()
pk = '1'
get = model_class._default_manager.get
model_class.MultipleObjectsReturned = Exception
get.side_effect = model_class.MultipleObjectsReturned()
# action
returned_value = get_instance(model_class, pk)
# assert
self.assertDictEqual(dict(pk=int(pk)), get.call_args[1])
self.assertIsNone(returned_value)
| {
"content_hash": "a39bd572d099c6842d4d2fac455e253c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 87,
"avg_line_length": 30.634615384615383,
"alnum_prop": 0.6195856873822976,
"repo_name": "hellhound/dentexchange",
"id": "f6fdd41e6064cd3db7a1cb7ee9b0c35d9cc8a7ed",
"size": "1616",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dentexchange/apps/libs/tests/haystack/test_get_instance.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "6611"
},
{
"name": "JavaScript",
"bytes": "23966"
},
{
"name": "Python",
"bytes": "563289"
},
{
"name": "Shell",
"bytes": "2274"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace FoursquareApi.Services
{
internal static class QueryStringHelper
{
internal static string BuildQueryString(Dictionary<string, string> argsDictionary)
{
var sb = new StringBuilder("?");
foreach (var item in argsDictionary)
{
sb.AppendFormat("{0}={1}", item.Key, HttpUtility.UrlEncode(item.Value));
sb.Append("&");
}
if (sb.Length > 0) sb.Remove(sb.Length - 1, 1);
return sb.ToString();
}
internal static string BuildPostData(Dictionary<string, string> argsDictionary)
{
var sb = new StringBuilder();
foreach (var item in argsDictionary)
{
sb.AppendFormat("{0}={1}", item.Key, HttpUtility.UrlEncode(item.Value));
sb.Append("&");
}
if (sb.Length > 0) sb.Remove(sb.Length - 1, 1);
return sb.ToString();
}
}
}
| {
"content_hash": "00b44c1c438213b5b8a0d48f5fbd9f9d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 90,
"avg_line_length": 31.11111111111111,
"alnum_prop": 0.5607142857142857,
"repo_name": "dmitrysmorodinnikov/FoursquareAPI",
"id": "9af41ca9d02e9014d5e28553642767eb6de12550",
"size": "1122",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "FoursquareAPI/FoursquareApi.Services/QueryStringHelper.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "106"
},
{
"name": "C#",
"bytes": "233379"
},
{
"name": "CSS",
"bytes": "13188"
},
{
"name": "HTML",
"bytes": "7053"
},
{
"name": "JavaScript",
"bytes": "572"
}
],
"symlink_target": ""
} |
using namespace arangodb::aql;
size_t QueryOptions::defaultMemoryLimit = 0;
size_t QueryOptions::defaultMaxNumberOfPlans = 128;
#ifdef __APPLE__
// On OSX the default stack size for worker threads (non-main thread) is 512kb
// which is rather low, so we have to use a lower default
size_t QueryOptions::defaultMaxNodesPerCallstack = 150;
#else
size_t QueryOptions::defaultMaxNodesPerCallstack = 250;
#endif
size_t QueryOptions::defaultSpillOverThresholdNumRows = 5000000;
size_t QueryOptions::defaultSpillOverThresholdMemoryUsage = 128 * 1024 * 1024;
double QueryOptions::defaultMaxRuntime = 0.0;
double QueryOptions::defaultTtl;
bool QueryOptions::defaultFailOnWarning = false;
bool QueryOptions::allowMemoryLimitOverride = true;
QueryOptions::QueryOptions()
: memoryLimit(0),
maxNumberOfPlans(QueryOptions::defaultMaxNumberOfPlans),
maxWarningCount(10),
maxNodesPerCallstack(QueryOptions::defaultMaxNodesPerCallstack),
spillOverThresholdNumRows(QueryOptions::defaultSpillOverThresholdNumRows),
spillOverThresholdMemoryUsage(
QueryOptions::defaultSpillOverThresholdMemoryUsage),
maxRuntime(0.0),
satelliteSyncWait(60.0),
ttl(QueryOptions::defaultTtl), // get global default ttl
profile(ProfileLevel::None),
traversalProfile(TraversalProfileLevel::None),
allPlans(false),
verbosePlans(false),
explainInternals(true),
stream(false),
silent(false),
failOnWarning(
QueryOptions::defaultFailOnWarning), // use global "failOnWarning"
// value
cache(false),
fullCount(false),
count(false),
skipAudit(false),
explainRegisters(ExplainRegisterPlan::No) {
// now set some default values from server configuration options
{
// use global memory limit value
uint64_t globalLimit = QueryOptions::defaultMemoryLimit;
if (globalLimit > 0) {
memoryLimit = globalLimit;
}
}
{
// use global max runtime value
double globalLimit = QueryOptions::defaultMaxRuntime;
if (globalLimit > 0.0) {
maxRuntime = globalLimit;
}
}
// "cache" only defaults to true if query cache is turned on
auto queryCacheMode = QueryCache::instance()->mode();
cache = (queryCacheMode == CACHE_ALWAYS_ON);
TRI_ASSERT(maxNumberOfPlans > 0);
}
QueryOptions::QueryOptions(arangodb::velocypack::Slice const slice)
: QueryOptions() {
this->fromVelocyPack(slice);
}
void QueryOptions::fromVelocyPack(VPackSlice slice) {
if (!slice.isObject()) {
return;
}
VPackSlice value;
// use global memory limit value first
if (QueryOptions::defaultMemoryLimit > 0) {
memoryLimit = QueryOptions::defaultMemoryLimit;
}
// numeric options
value = slice.get("memoryLimit");
if (value.isNumber()) {
size_t v = value.getNumber<size_t>();
if (v > 0 && (allowMemoryLimitOverride || v < memoryLimit)) {
// only allow increasing the memory limit if the respective startup option
// is set. and if it is set, only allow decreasing the memory limit
memoryLimit = v;
}
}
value = slice.get("maxNumberOfPlans");
if (value.isNumber()) {
maxNumberOfPlans = value.getNumber<size_t>();
if (maxNumberOfPlans == 0) {
maxNumberOfPlans = 1;
}
}
value = slice.get("maxWarningCount");
if (value.isNumber()) {
maxWarningCount = value.getNumber<size_t>();
}
value = slice.get("maxNodesPerCallstack");
if (value.isNumber()) {
maxNodesPerCallstack = value.getNumber<size_t>();
}
value = slice.get("spillOverThresholdNumRows");
if (value.isNumber()) {
spillOverThresholdNumRows = value.getNumber<size_t>();
}
value = slice.get("spillOverThresholdMemoryUsage");
if (value.isNumber()) {
spillOverThresholdMemoryUsage = value.getNumber<size_t>();
}
value = slice.get("maxRuntime");
if (value.isNumber()) {
maxRuntime = value.getNumber<double>();
}
value = slice.get("satelliteSyncWait");
if (value.isNumber()) {
satelliteSyncWait = value.getNumber<double>();
}
value = slice.get("ttl");
if (value.isNumber()) {
ttl = value.getNumber<double>();
}
// boolean options
value = slice.get("profile");
if (value.isBool()) {
profile = value.getBool() ? ProfileLevel::Basic : ProfileLevel::None;
} else if (value.isNumber()) {
profile = static_cast<ProfileLevel>(value.getNumber<uint16_t>());
}
value = slice.get(StaticStrings::GraphTraversalProfileLevel);
if (value.isBool()) {
traversalProfile = value.getBool() ? TraversalProfileLevel::Basic
: TraversalProfileLevel::None;
} else if (value.isNumber()) {
traversalProfile =
static_cast<TraversalProfileLevel>(value.getNumber<uint16_t>());
}
if (value = slice.get("allPlans"); value.isBool()) {
allPlans = value.getBool();
}
if (value = slice.get("verbosePlans"); value.isBool()) {
verbosePlans = value.getBool();
}
if (value = slice.get("explainInternals"); value.isBool()) {
explainInternals = value.getBool();
}
if (value = slice.get("stream"); value.isBool()) {
stream = value.getBool();
}
if (value = slice.get("silent"); value.isBool()) {
silent = value.getBool();
}
if (value = slice.get("failOnWarning"); value.isBool()) {
failOnWarning = value.getBool();
}
if (value = slice.get("cache"); value.isBool()) {
cache = value.getBool();
}
if (value = slice.get("fullCount"); value.isBool()) {
fullCount = value.getBool();
}
if (value = slice.get("count"); value.isBool()) {
count = value.getBool();
}
if (value = slice.get("explainRegisters"); value.isBool()) {
explainRegisters =
value.getBool() ? ExplainRegisterPlan::Yes : ExplainRegisterPlan::No;
}
// note: skipAudit is intentionally not read here.
// the end user cannot override this setting
if (value = slice.get(StaticStrings::ForceOneShardAttributeValue);
value.isString()) {
forceOneShardAttributeValue = value.copyString();
}
VPackSlice optimizer = slice.get("optimizer");
if (optimizer.isObject()) {
value = optimizer.get("rules");
if (value.isArray()) {
for (auto const& rule : VPackArrayIterator(value)) {
if (rule.isString()) {
optimizerRules.emplace_back(rule.copyString());
}
}
}
}
value = slice.get("shardIds");
if (value.isArray()) {
VPackArrayIterator it(value);
while (it.valid()) {
value = it.value();
if (value.isString()) {
restrictToShards.emplace(value.copyString());
}
it.next();
}
}
#ifdef USE_ENTERPRISE
value = slice.get("inaccessibleCollections");
if (value.isArray()) {
VPackArrayIterator it(value);
while (it.valid()) {
value = it.value();
if (value.isString()) {
inaccessibleCollections.emplace(value.copyString());
}
it.next();
}
}
#endif
// also handle transaction options
transactionOptions.fromVelocyPack(slice);
}
void QueryOptions::toVelocyPack(VPackBuilder& builder,
bool disableOptimizerRules) const {
builder.openObject();
builder.add("memoryLimit", VPackValue(memoryLimit));
builder.add("maxNumberOfPlans", VPackValue(maxNumberOfPlans));
builder.add("maxWarningCount", VPackValue(maxWarningCount));
builder.add("maxNodesPerCallstack", VPackValue(maxNodesPerCallstack));
builder.add("spillOverThresholdNumRows",
VPackValue(spillOverThresholdNumRows));
builder.add("spillOverThresholdMemoryUsage",
VPackValue(spillOverThresholdMemoryUsage));
builder.add("maxRuntime", VPackValue(maxRuntime));
builder.add("satelliteSyncWait", VPackValue(satelliteSyncWait));
builder.add("ttl", VPackValue(ttl));
builder.add("profile", VPackValue(static_cast<uint32_t>(profile)));
builder.add(StaticStrings::GraphTraversalProfileLevel,
VPackValue(static_cast<uint32_t>(traversalProfile)));
builder.add("allPlans", VPackValue(allPlans));
builder.add("verbosePlans", VPackValue(verbosePlans));
builder.add("explainInternals", VPackValue(explainInternals));
builder.add("stream", VPackValue(stream));
builder.add("silent", VPackValue(silent));
builder.add("failOnWarning", VPackValue(failOnWarning));
builder.add("cache", VPackValue(cache));
builder.add("fullCount", VPackValue(fullCount));
builder.add("count", VPackValue(count));
if (!forceOneShardAttributeValue.empty()) {
builder.add(StaticStrings::ForceOneShardAttributeValue,
VPackValue(forceOneShardAttributeValue));
}
// note: skipAudit is intentionally not serialized here.
// the end user cannot override this setting anyway.
builder.add("optimizer", VPackValue(VPackValueType::Object));
// hard-coded since 3.8, option will be removed in the future
builder.add("inspectSimplePlans", VPackValue(true));
if (!optimizerRules.empty() || disableOptimizerRules) {
builder.add("rules", VPackValue(VPackValueType::Array));
if (disableOptimizerRules) {
// turn off all optimizer rules
builder.add(VPackValue("-all"));
} else {
for (auto const& it : optimizerRules) {
builder.add(VPackValue(it));
}
}
builder.close(); // optimizer.rules
}
builder.close(); // optimizer
if (!restrictToShards.empty()) {
builder.add("shardIds", VPackValue(VPackValueType::Array));
for (auto const& it : restrictToShards) {
builder.add(VPackValue(it));
}
builder.close(); // shardIds
}
#ifdef USE_ENTERPRISE
if (!inaccessibleCollections.empty()) {
builder.add("inaccessibleCollections", VPackValue(VPackValueType::Array));
for (auto const& it : inaccessibleCollections) {
builder.add(VPackValue(it));
}
builder.close(); // inaccessibleCollections
}
#endif
// also handle transaction options
transactionOptions.toVelocyPack(builder);
builder.close();
}
| {
"content_hash": "c5a8a5c562cb6cd8808e0d9163a0a054",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 80,
"avg_line_length": 32.07395498392283,
"alnum_prop": 0.6752882205513785,
"repo_name": "wiltonlazary/arangodb",
"id": "1e8aab7ade8f8828e2b350cbf899f9f77dd9e81a",
"size": "11145",
"binary": false,
"copies": "1",
"ref": "refs/heads/devel",
"path": "arangod/Aql/QueryOptions.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "61827"
},
{
"name": "C",
"bytes": "309788"
},
{
"name": "C++",
"bytes": "34723629"
},
{
"name": "CMake",
"bytes": "383904"
},
{
"name": "CSS",
"bytes": "210549"
},
{
"name": "EJS",
"bytes": "231166"
},
{
"name": "HTML",
"bytes": "23114"
},
{
"name": "JavaScript",
"bytes": "33741286"
},
{
"name": "LLVM",
"bytes": "14975"
},
{
"name": "NASL",
"bytes": "269512"
},
{
"name": "NSIS",
"bytes": "47138"
},
{
"name": "Pascal",
"bytes": "75391"
},
{
"name": "Perl",
"bytes": "9811"
},
{
"name": "PowerShell",
"bytes": "7869"
},
{
"name": "Python",
"bytes": "184352"
},
{
"name": "SCSS",
"bytes": "255542"
},
{
"name": "Shell",
"bytes": "134504"
},
{
"name": "TypeScript",
"bytes": "179074"
},
{
"name": "Yacc",
"bytes": "79620"
}
],
"symlink_target": ""
} |
package com.sixsq.slipstream.connector.local;
import com.sixsq.slipstream.connector.CredentialsBase;
import com.sixsq.slipstream.credentials.Credentials;
import com.sixsq.slipstream.credentials.ICloudCredential;
import com.sixsq.slipstream.exceptions.InvalidElementException;
import com.sixsq.slipstream.exceptions.SlipStreamRuntimeException;
import com.sixsq.slipstream.exceptions.ValidationException;
import com.sixsq.slipstream.persistence.User;
import com.sixsq.slipstream.persistence.UserParameter;
import java.util.Map;
class LocalCredentials extends CredentialsBase implements Credentials {
public LocalCredentials(User user, String connectorInstanceName) {
super(user);
try {
cloudParametersFactory = new LocalUserParametersFactory(connectorInstanceName);
} catch (ValidationException e) {
e.printStackTrace();
throw (new SlipStreamRuntimeException(e));
}
}
public String getKey() throws InvalidElementException {
return getParameterValue(LocalUserParametersFactory.KEY_PARAMETER_NAME);
}
public String getSecret() throws InvalidElementException {
return getParameterValue(LocalUserParametersFactory.SECRET_PARAMETER_NAME);
}
@Override
public ICloudCredential getCloudCredential(Map<String, UserParameter> params, String connInstanceName) {
return null;
}
}
| {
"content_hash": "ab84f49ac7aa1815cbb49b6b7ca2a0c7",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 105,
"avg_line_length": 31.902439024390244,
"alnum_prop": 0.823394495412844,
"repo_name": "slipstream/SlipStreamServer",
"id": "fb2f0fe73bd205898b8aeb134914fadd8c962b15",
"size": "2104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jar-connector/src/main/java/com/sixsq/slipstream/connector/local/LocalCredentials.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "106"
},
{
"name": "Clojure",
"bytes": "1890161"
},
{
"name": "HTML",
"bytes": "149740"
},
{
"name": "Java",
"bytes": "1476155"
},
{
"name": "Makefile",
"bytes": "6625"
},
{
"name": "PLpgSQL",
"bytes": "2571"
},
{
"name": "Python",
"bytes": "41223"
},
{
"name": "Shell",
"bytes": "9608"
},
{
"name": "XSLT",
"bytes": "4699"
}
],
"symlink_target": ""
} |
var ghostBookshelf,
Bookshelf = require('bookshelf'),
when = require('when'),
moment = require('moment'),
_ = require('underscore'),
uuid = require('node-uuid'),
config = require('../../../config'),
Validator = require('validator').Validator,
sanitize = require('validator').sanitize;
// Initializes a new Bookshelf instance, for reference elsewhere in Ghost.
ghostBookshelf = Bookshelf.initialize(config[process.env.NODE_ENV || 'development'].database);
ghostBookshelf.client = config[process.env.NODE_ENV].database.client;
ghostBookshelf.validator = new Validator();
// The Base Model which other Ghost objects will inherit from,
// including some convenience functions as static properties on the model.
ghostBookshelf.Model = ghostBookshelf.Model.extend({
hasTimestamps: true,
defaults: function () {
return {
uuid: uuid.v4()
};
},
initialize: function () {
this.on('creating', this.creating, this);
this.on('saving', this.saving, this);
this.on('saving', this.validate, this);
},
creating: function () {
if (!this.get('created_by')) {
this.set('created_by', 1);
}
},
saving: function () {
// Remove any properties which don't belong on the post model
this.attributes = this.pick(this.permittedAttributes);
this.set('updated_by', 1);
},
// Base prototype properties will go here
// Fix problems with dates
fixDates: function (attrs) {
_.each(attrs, function (value, key) {
if (key.substr(-3) === '_at' && value !== null) {
attrs[key] = moment(attrs[key]).toDate();
}
});
return attrs;
},
format: function (attrs) {
return this.fixDates(attrs);
},
toJSON: function (options) {
var attrs = this.fixDates(_.extend({}, this.attributes)),
relations = this.relations;
if (options && options.shallow) {
return attrs;
}
_.each(relations, function (relation, key) {
if (key.substring(0, 7) !== '_pivot_') {
attrs[key] = relation.toJSON ? relation.toJSON() : relation;
}
});
return attrs;
},
sanitize: function (attr) {
return sanitize(this.get(attr)).xss();
},
// #### generateSlug
// Create a string act as the permalink for an object.
generateSlug: function (Model, base) {
var slug,
slugTryCount = 1,
// Look for a post with a matching slug, append an incrementing number if so
checkIfSlugExists = function (slugToFind) {
return Model.read({slug: slugToFind}).then(function (found) {
var trimSpace;
if (!found) {
return when.resolve(slugToFind);
}
slugTryCount += 1;
// If this is the first time through, add the hyphen
if (slugTryCount === 2) {
slugToFind += '-';
} else {
// Otherwise, trim the number off the end
trimSpace = -(String(slugTryCount - 1).length);
slugToFind = slugToFind.slice(0, trimSpace);
}
slugToFind += slugTryCount;
return checkIfSlugExists(slugToFind);
});
};
// Remove URL reserved chars: `:/?#[]@!$&'()*+,;=` as well as `\%<>|^~£"`
slug = base.trim().replace(/[:\/\?#\[\]@!$&'()*+,;=\\%<>\|\^~£"]/g, '')
// Replace dots and spaces with a dash
.replace(/(\s|\.)/g, '-')
// Convert 2 or more dashes into a single dash
.replace(/-+/g, '-')
// Make the whole thing lowercase
.toLowerCase();
// Remove trailing hyphen
slug = slug.charAt(slug.length - 1) === '-' ? slug.substr(0, slug.length - 1) : slug;
// Check the filtered slug doesn't match any of the reserved keywords
slug = /^(ghost|ghost\-admin|admin|wp\-admin|wp\-login|dashboard|logout|login|signin|signup|signout|register|archive|archives|category|categories|tag|tags|page|pages|post|posts|user|users)$/g
.test(slug) ? slug + '-post' : slug;
//if slug is empty after trimming use "post"
if (!slug) {
slug = 'post';
}
// Test for duplicate slugs.
return checkIfSlugExists(slug);
}
}, {
/**
* Naive find all
* @param options (optional)
*/
findAll: function (options) {
options = options || {};
return ghostBookshelf.Collection.forge([], {model: this}).fetch(options);
},
browse: function () {
return this.findAll.apply(this, arguments);
},
/**
* Naive find one where args match
* @param args
* @param options (optional)
*/
findOne: function (args, options) {
options = options || {};
return this.forge(args).fetch(options);
},
read: function () {
return this.findOne.apply(this, arguments);
},
/**
* Naive edit
* @param editedObj
* @param options (optional)
*/
edit: function (editedObj, options) {
options = options || {};
return this.forge({id: editedObj.id}).fetch(options).then(function (foundObj) {
return foundObj.save(editedObj);
});
},
update: function () {
return this.edit.apply(this, arguments);
},
/**
* Naive create
* @param newObj
* @param options (optional)
*/
add: function (newObj, options) {
options = options || {};
return this.forge(newObj).save(options);
},
create: function () {
return this.add.apply(this, arguments);
},
/**
* Naive destroy
* @param _identifier
* @param options (optional)
*/
destroy: function (_identifier, options) {
options = options || {};
return this.forge({id: _identifier}).destroy(options);
},
'delete': function () {
return this.destroy.apply(this, arguments);
}
});
module.exports = ghostBookshelf;
| {
"content_hash": "03eb7c2fa3d1b3dc2a63fa3b746c11d0",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 199,
"avg_line_length": 29.626168224299064,
"alnum_prop": 0.5358044164037855,
"repo_name": "1kevgriff/Ghost",
"id": "aa5e3f95c91759df2ab89480460fc52bec58246a",
"size": "6342",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/server/models/base.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "34"
},
{
"name": "JavaScript",
"bytes": "536753"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main"><source path="/home/paolo/Development/com.numix.calculator.pro/app/src/androidTest/assets"/></dataSet></merger> | {
"content_hash": "52655659c8e86ee6db5ead71365247fc",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 154,
"avg_line_length": 96.5,
"alnum_prop": 0.7357512953367875,
"repo_name": "numixproject/com.numix.calculator",
"id": "ab993d11108b73c3ab9a8515a56a3ece0afd5f52",
"size": "193",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Calculator-Pro/app/build/intermediates/incremental/mergeAssets/test/debug/merger.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1488963"
}
],
"symlink_target": ""
} |
package com.mehmetakiftutuncu.muezzin.activities;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
/**
* Created by akif on 04/06/16.
*/
public abstract class MuezzinActivity extends AppCompatActivity {
public void setTitle(String title) {
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setTitle(title);
}
}
public void setTitle(int titleResId) {
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setTitle(titleResId);
}
}
public void setSubtitle(String subtitle) {
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setSubtitle(subtitle);
}
}
public void setSubtitle(int subtitleResId) {
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setSubtitle(subtitleResId);
}
}
}
| {
"content_hash": "acae469e6d200d3cb7ab03c3b4bf2ebe",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 65,
"avg_line_length": 27,
"alnum_prop": 0.6639566395663956,
"repo_name": "mehmetakiftutuncu/Muezzin",
"id": "b19a00a783941c69659ea1eeef8dffe679ce40af",
"size": "1107",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/mehmetakiftutuncu/muezzin/activities/MuezzinActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "277833"
}
],
"symlink_target": ""
} |
<?php
namespace Fabs\CouchDB2\Tool;
use Fabs\CouchDB2\Couch;
use Fabs\CouchDB2\CouchConfig;
use Fabs\CouchDB2\Model\DesignDocument;
use Fabs\CouchDB2\Model\FullText;
use Fabs\CouchDB2\Model\ReplicatorDocument;
use Fabs\CouchDB2\Model\View;
use Fabs\CouchDB2\Query\DBQuery;
class DesignDocumentsReplicator
{
/** @var Couch */
private $couch = null;
/**
* @param Couch $couch
* @return DesignDocumentsReplicator
* @author necipallef <necipallef@gmail.com>
*/
public function setCouch($couch)
{
$this->couch = $couch;
return $this;
}
/**
* @param string $design_documents_path
* @param null|string $db_name_prefix
* @return array
* @author necipallef <necipallef@gmail.com>
*/
public function createFromDirectory($design_documents_path, $db_name_prefix = null)
{
if ($db_name_prefix !== null && !is_string($db_name_prefix)) {
return ['db_name_prefix is expected to be string'];
}
if ($this->couch === null) {
return ['aborting, no Couch instance found. Please provide a Couch instance by using setCouch() method'];
}
$db_names = $this->couch->getAllDatabases()
->execute()
->getRawData();
/** @var DesignDocument[] $total_design_document_updated_list */
$total_design_document_updated_list = [];
foreach (self::folderList($design_documents_path) as $db_path) {
$db_name = str_replace($design_documents_path . '/', '', $db_path);
if ($db_name_prefix !== null) {
$db_name = $db_name_prefix . $db_name;
}
if (!in_array($db_name, $db_names)) {
$this->couch->createDatabase($db_name)
->execute();
}
/** @var DesignDocument[] $design_document_list */
$design_document_list = [];
$design_document_rows = $this->couch->selectDatabase($db_name)
->getAllDocs()
->setStartKey('_design')
->setEndKey('_design{')
->setIncludeDocs(true)
->execute()
->getRows();
foreach ($design_document_rows as $row) {
/** @var DesignDocument $design_document_from_db */
$design_document_from_db = $row->getDocWithType(DesignDocument::class);
$design_document_list[$design_document_from_db->_id] = $design_document_from_db;
}
$design_document_updated_list = [];
foreach (self::folderList($db_path) as $design_document_path) {
$design_document_name = str_replace($db_path . '/', '', $design_document_path);
$design_document_id = '_design/' . $design_document_name;
if (array_key_exists($design_document_id, $design_document_list)) {
$design_document = $design_document_list[$design_document_id];
} else {
$design_document = new DesignDocument();
$design_document->_id = $design_document_id;
}
$design_document->db_name = $db_name;
foreach (self::folderList($design_document_path) as $design_document_element_path) {
$design_document_element_name = str_replace($design_document_path . '/', '', $design_document_element_path);
$design_document_element_files = glob($design_document_element_path . '/*.js');
switch ($design_document_element_name) {
case 'views':
foreach ($design_document_element_files as $view_file) {
$view_name = str_replace('.js', '',
str_replace($design_document_element_path . '/', '', $view_file));
$view_entity = new View();
$view_entity->map = self::getDesignDocumentContent($view_file);
$reduce_file = $design_document_element_path . '/reduce/' . $view_name . '.js';
if (file_exists($reduce_file)) {
$view_entity->reduce = self::getDesignDocumentContent($reduce_file);
}
$design_document->views[$view_name] = $view_entity;
}
break;
case 'updates':
foreach ($design_document_element_files as $update_file) {
$update_name = str_replace('.js', '',
str_replace($design_document_element_path . '/', '', $update_file));
$design_document->updates[$update_name] = self::getDesignDocumentContent($update_file);
}
break;
case 'lists':
// todo
break;
case 'fulltext':
foreach ($design_document_element_files as $fulltext_file) {
$fulltext_name = str_replace('.js', '',
str_replace($design_document_element_path . '/', '', $fulltext_file));
$fulltext_entity = new FullText();
$fulltext_entity->index = self::getDesignDocumentContent($fulltext_file);
$design_document->fulltext[$fulltext_name] = $fulltext_entity;
}
break;
case 'filters':
foreach ($design_document_element_files as $filter_file) {
$filter_name = str_replace(
'.js',
'',
str_replace($design_document_element_path . '/', '', $filter_file)
);
$design_document->filters[$filter_name] = self::getDesignDocumentContent($filter_file);
}
break;
default:
break;
}
}
if ($design_document->isChanged()) {
$design_document_updated_list[] = $design_document;
}
}
if (count($design_document_updated_list) > 0) {
$this->couch->selectDatabase($db_name)
->bulkDocs()
->addDocs($design_document_updated_list)
->execute();
}
$total_design_document_updated_list = array_merge($total_design_document_updated_list, $design_document_updated_list);
}
$design_document_name_list = [];
foreach ($total_design_document_updated_list as $design_document) {
$design_document_name_list[] = sprintf('%s/%s', $design_document->db_name, $design_document->_id);
}
$design_document_name_list = array_unique($design_document_name_list);
return
[
'details' => $total_design_document_updated_list,
'count' => count($total_design_document_updated_list),
'design_docs' => $design_document_name_list
];
}
/**
* @param string $design_documents_path
* @return array
* @author necipallef <necipallef@gmail.com>
*/
public function createDirectoriesFromDB($design_documents_path)
{
if ($this->couch === null) {
return ['aborting, no Couch instance found. Please provide a Couch instance by using setCouch() method'];
}
$db_names = $this->couch->getAllDatabases()
->execute()
->getRawData();
/** @var DesignDocument[] $total_design_document_updated_list */
$total_design_document_updated_list = [];
foreach ($db_names as $db_name) {
$db_path = $design_documents_path . '/' . $db_name;
$this->createDir($db_path);
$rows = $this->couch->selectDatabase($db_name)
->getAllDocs()
->setIncludeDocs(true)
->setStartKey('_design')
->setEndKey('_design{')
->execute()
->getRows();
/** @var DesignDocument[] $design_document_list */
$design_document_list = [];
foreach ($rows as $row) {
$design_document_list[] = $row->getDocWithType(DesignDocument::class);
}
foreach ($design_document_list as $design_document) {
$design_document_name = str_replace('_design/', '', $design_document->_id);
$design_document_path = $db_path . '/' . $design_document_name;
$this->createDir($design_document_path);
// Views
if (count($design_document->views) > 0) {
$views_path = $design_document_path . '/views';
$this->createDir($views_path);
foreach ($design_document->views as $view_name => $view) {
$view_file_name = $view_name . '.js';
$view_file_path = $views_path . '/' . $view_file_name;
file_put_contents($view_file_path, $view->map);
// Reduce
if ($view->reduce !== null) {
$reduce_path = $views_path . '/reduce';
$this->createDir($reduce_path);
$reduce_file_name = $view_name . '.js';
$reduce_file_path = $reduce_path . '/' . $reduce_file_name;
file_put_contents($reduce_file_path, $view->reduce);
}
}
}
// Fulltexts
if (count($design_document->fulltext) > 0) {
$fulltexts_path = $design_document_path . '/fulltext';
$this->createDir($fulltexts_path);
foreach ($design_document->fulltext as $fulltext_name => $fulltext_entity) {
$fulltext_file_name = $fulltext_name . '.js';
$fulltext_file_path = $fulltexts_path . '/' . $fulltext_file_name;
file_put_contents($fulltext_file_path, $fulltext_entity->index);
}
}
// Updates
if (count($design_document->updates) > 0) {
$updates_path = $design_document_path . '/updates';
$this->createDir($updates_path);
foreach ($design_document->updates as $update_name => $update) {
$update_file_name = $update_name . '.js';
$update_file_path = $updates_path . '/' . $update_file_name;
file_put_contents($update_file_path, $update);
}
}
// todo Filters
// todo Validations
// todo Lists
if ($design_document->isChanged()) {
$total_design_document_updated_list[] = $design_document;
}
}
}
$design_document_name_list = [];
foreach ($total_design_document_updated_list as $design_document) {
$design_document_name_list[] = sprintf('%s/%s', $design_document->db_name, $design_document->_id);
}
$design_document_name_list = array_unique($design_document_name_list);
return
[
'details' => $total_design_document_updated_list,
'count' => count($total_design_document_updated_list),
'design_docs' => $design_document_name_list
];
}
// todo allow replicating db without replicating views
/**
* @param CouchConfig $source_couch_config
* @param CouchConfig $target_couch_config
* @param bool $is_continuous
* @param bool $create_target
* @param bool $include_views
* @return array
* @author necipallef <necipallef@gmail.com>
*/
public function createReplicatorsAll(
$source_couch_config,
$target_couch_config,
$is_continuous = false,
$create_target = false,
$include_views = true)
{
$source_couch = new Couch($source_couch_config);
$target_couch = new Couch($target_couch_config);
$db_names = $source_couch->getAllDatabases()
->execute()
->getRawData();
$count = 0;
$db_query = $target_couch->selectDatabase('_replicator')->bulkDocs();
foreach ($db_names as $db_name) {
if (strpos($db_name, '_') === 0) {
continue;
}
$replicator_document_entity = new ReplicatorDocument();
$replicator_document_entity->_id = $db_name . '_replicator';
$source = sprintf('http://%s:%s@%s:%s/%s',
$source_couch_config->username,
$source_couch_config->password,
$source_couch_config->server,
$source_couch_config->port,
$db_name);
$replicator_document_entity->source = $source;
if ($include_views === false) {
$target = $db_name;
} else {
$target = sprintf('http://%s:%s@%s:%s/%s',
$target_couch_config->username,
$target_couch_config->password,
$target_couch_config->server,
$target_couch_config->port,
$db_name);
}
$replicator_document_entity->target = $target;
$replicator_document_entity->continuous = $is_continuous;
$replicator_document_entity->create_target = $create_target;
$db_query->addDoc($replicator_document_entity);
$count++;
}
$db_query->execute();
return ['count' => $count];
}
/**
* @param string $db_name
* @param CouchConfig $source_couch_config
* @param CouchConfig $target_couch_config
* @param bool $is_continuous
* @param bool $create_target
* @param bool $include_views
* @return array
* @author necipallef <necipallef@gmail.com>
*/
public function createReplicator(
$db_name,
$source_couch_config,
$target_couch_config,
$is_continuous = false,
$create_target = false,
$include_views = true)
{
if (strpos($db_name, '_') === 0) {
return ['aborting, db_name cannot start with underscore'];
}
$target_couch = new Couch($target_couch_config);
$replicator_document_entity = new ReplicatorDocument();
$replicator_document_entity->_id = $db_name . '_replicator';
$source = sprintf('http://%s:%s@%s:%s/%s',
$source_couch_config->username,
$source_couch_config->password,
$source_couch_config->server,
$source_couch_config->port,
$db_name);
$replicator_document_entity->source = $source;
if ($include_views === false) {
$target = $db_name;
} else {
$target = sprintf('http://%s:%s@%s:%s/%s',
$target_couch_config->username,
$target_couch_config->password,
$target_couch_config->server,
$target_couch_config->port,
$db_name);
}
$replicator_document_entity->target = $target;
$replicator_document_entity->continuous = $is_continuous;
$replicator_document_entity->create_target = $create_target;
$result = $target_couch->selectDatabase('_replicator')
->bulkDocs()
->addDoc($replicator_document_entity)
->execute() !== null;
return [$db_name . ' result' => $result];
}
/**
* @return array
* @author ahmetturk <ahmetturk93@gmail.com>
*/
public function executeAllDesignDocuments()
{
if ($this->couch === null) {
return ['aborting, no Couch instance found. Please provide a Couch instance by using setCouch() method'];
}
$db_names = $this->couch->getAllDatabases()
->execute()
->getRawData();
$count = 0;
$fail_count = 0;
foreach ($db_names as $db_name) {
$rows = $this->couch->selectDatabase($db_name)
->getAllDocs()
->setIncludeDocs(true)
->setStartKey('_design')
->setEndKey('_design{')
->execute()
->getRows();
/** @var DesignDocument[] $design_document_list */
$design_document_list = [];
foreach ($rows as $row) {
$design_document_list[] = $row->getDocWithType(DesignDocument::class);
}
foreach ($design_document_list as $design_document) {
$design_document_name = str_replace('_design/', '', $design_document->_id);
if (count($design_document->views) > 0) {
foreach ($design_document->views as $view_name => $view) {
$result = $this->executeView($db_name, $design_document_name, $view_name);
if ($result === true) {
$count++;
} else {
$fail_count++;
}
break;
}
}
}
}
return ['count' => $count, 'fail_count' => $fail_count];
}
/**
* @param string $database_name
* @param string $design_document_name
* @param string $view_name
* @return array
* @author ahmetturk <ahmetturk93@gmail.com>
*/
public function executeView($database_name, $design_document_name, $view_name)
{
if ($this->couch === null) {
throw new \Exception('no Couch instance found. Please provide a Couch instance by using setCouch() method');
}
$response = $this->couch->selectDatabase($database_name)
->getView($design_document_name, $view_name)
->setStale('update_after')
->setLimit(1)
->execute();
return $response !== null;
}
/**
* @param string $file
* @return string
*/
public function getDesignDocumentContent($file)
{
return str_replace('couch_fun', '', file_get_contents($file));
}
/**
* @param string $path
* @return string[]
*/
public function folderList($path)
{
return array_filter(glob($path . '/*'), 'is_dir');
}
/**
* @param string $path
* @return bool
* @author necipallef <necipallef@gmail.com>
*/
private function createDir($path)
{
if (file_exists($path) === false) {
return mkdir($path);
}
return true;
}
} | {
"content_hash": "64724e707688b8607cb0f6d8d78661eb",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 130,
"avg_line_length": 37.89105058365759,
"alnum_prop": 0.48844731977818856,
"repo_name": "necipallef/CouchDB2-PHP-Client",
"id": "343d0c2164f5f6440cbd3688f4fa3f3a1fe7edd3",
"size": "19476",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/Fabs/CouchDB2/Tool/DesignDocumentsReplicator.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "94189"
}
],
"symlink_target": ""
} |
+ src/
- config.h - Configure file
- base.h&.c - Included by all other header file.
- opcode.h&.c - Opcode declarations and some opcode utilities.
- parser.h&.c - Achieve a token scanner and a recursive descent parser.
- parser_callback.h&.c - Callback functions, which are called when parser deductes successfully. Opcode generator is located here!
- mem.h&.c - Memory allocator.
- object.h&.c - Luax object management.
- vm.h&.c - Luax virtual machine.
- luax_api.h&.c - Luax api for the communication between C and luax.
- standard_lib/ - Running time environment.
- luax_exec.c - A standalone executable interpreter.
- luax.h - All included in one.
- luax.hpp - Wrapper for c++. | {
"content_hash": "aad03f20b6e640ed4c638081df86700a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 134,
"avg_line_length": 42,
"alnum_prop": 0.6574074074074074,
"repo_name": "morrow1nd/luax",
"id": "4f6f2878f17e7d741ee837dead2e5eb058068c89",
"size": "781",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/source_code_structure.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "240634"
},
{
"name": "C++",
"bytes": "11524"
},
{
"name": "CMake",
"bytes": "2466"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Mycotaxon 5(1): 1629 (1977)
#### Original name
Stictis carpenteriana Sherwood
### Remarks
null | {
"content_hash": "d7ec528bc97ee425fbed717dcd6c8414",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 30,
"avg_line_length": 12.153846153846153,
"alnum_prop": 0.7151898734177216,
"repo_name": "mdoering/backbone",
"id": "5d95fd33b4605ada5d10dcdec92cba38463021bc",
"size": "212",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Lecanoromycetes/Ostropales/Stictidaceae/Stictis/Stictis carpenteriana/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package Buddha::TestFixture2;
1;
| {
"content_hash": "2213df470209971fc4a9dbe10859db56",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 29,
"avg_line_length": 11.333333333333334,
"alnum_prop": 0.7647058823529411,
"repo_name": "gitpan/Test-FITesque",
"id": "7439b98bbb940a49b7443476f26a20663116feda",
"size": "34",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "t/lib/Buddha/TestFixture2.pm",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Perl",
"bytes": "95370"
}
],
"symlink_target": ""
} |
require 'mida/vocabulary'
module Mida
module SchemaOrg
autoload :Thing, 'mida/vocabularies/schemaorg/thing'
autoload :Event, 'mida/vocabularies/schemaorg/event'
# User interaction: Tweets.
class UserTweets < Mida::Vocabulary
itemtype %r{http://schema.org/UserTweets}i
include_vocabulary Mida::SchemaOrg::Thing
include_vocabulary Mida::SchemaOrg::Event
end
end
end
| {
"content_hash": "25984db01f2a0b087776ac8e8d0a2878",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 56,
"avg_line_length": 24.11764705882353,
"alnum_prop": 0.7170731707317073,
"repo_name": "LawrenceWoodman/mida",
"id": "1a940e9d2fa332eabdf2cec9f8fe48540c0f1245",
"size": "410",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/mida/vocabularies/schemaorg/usertweets.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "287678"
}
],
"symlink_target": ""
} |
class Ey::Core::Client
class Real
def request_callback(options={})
(url = options["url"]) || (id = options.fetch("id"))
request(
:path => "/requests/#{id}/callback",
:method => :post,
:url => url,
)
end
end
class Mock
def request_callback(options={})
request_id = resource_identity(options)
request = find(:requests, request_id).dup
request.delete("resource")
response(
:body => {"request" => request},
)
end
end
end
| {
"content_hash": "56d9644f14d53da42cbbd7b81eef86e4",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 58,
"avg_line_length": 20.384615384615383,
"alnum_prop": 0.5358490566037736,
"repo_name": "engineyard/core-client-rb",
"id": "f42c356a597e21da22e31216cedacfef97a63f78",
"size": "530",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/ey-core/requests/request_callback.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Gherkin",
"bytes": "7158"
},
{
"name": "Ruby",
"bytes": "582533"
}
],
"symlink_target": ""
} |
import datetime
import numpy
import grocsvs
VCF_HEADER = \
"""##fileformat=VCFv4.3
##fileDate={date}
##source=grocsvs_v{version}
##reference=file://{reference}
{chromosomes}
##INFO=<ID=ASSEMBLED,Number=0,Type=Flag,Description="Event is supported by a read-cloud-based sequence assembly across the breakpoints">
##INFO=<ID=MATEID,Number=1,Type=String,Description="ID of mate breakend">
##INFO=<ID=SVTYPE,Number=1,Type=String,Description="Type of structural variant">
##INFO=<ID=EVENT,Number=1,Type=String,Description="Cluster ID used to specify when multiple breakpoints belong to a single complex event">
##FILTER=<ID=NOLONGFRAGS,Description="No samples found with long fragments supporting event (likely segdup)">
##FILTER=<ID=NEARBYSNVS,Description="Very high number of possible SNVs detected in vicinity of breakpoint (likely segdup)">
##FILTER=<ID=ASSEMBLYGAP,Description="Nearby gap in the reference assembly found; these gaps can appear to mimic SVs">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype (currently either 1 when breakpoint is present in sample or 0 if not)">
##FORMAT=<ID=BS,Number=1,Type=Integer,Description="Number of barcodes supporting the event">
##FORMAT=<ID=BT,Number=1,Type=Integer,Description="Total number of barcodes, calculated as the union of barcodes at each site">
##FORMAT=<ID=F50,Number=1,Type=Float,Description="Median fragment length supporting the breakpoint; estimated as the total across all supporting segments">
##FORMAT=<ID=F90,Number=1,Type=Float,Description="90th percentile of fragment lengths supporting the breakpoint; estimated as the total across all supporting segments">
##FORMAT=<ID=PR,Number=1,Type=Float,Description="p-value for the event, calculated by resampling from the number of supporting and total barcodes">
##FORMAT=<ID=H1x,Number=1,Type=String,Description="Number of supporting barcodes assigned to haplotype 1 (left side of breakpoint)">
##FORMAT=<ID=H2x,Number=1,Type=String,Description="Number of supporting barcodes assigned to haplotype 2 (left side of breakpoint)">
##FORMAT=<ID=H1y,Number=1,Type=String,Description="Number of supporting barcodes assigned to haplotype 1 (right side of breakpoint)">
##FORMAT=<ID=H2y,Number=1,Type=String,Description="Number of supporting barcodes assigned to haplotype 2 (right side of breakpoint)">
{samples}
#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t{sample_columns}
"""
CHROMOSOME = "##contig=<ID={name},length={length}>"
SAMPLE = "##SAMPLE=<ID={name},URL=file://{path}>"
FORMAT = ["GT", "BS", "BT", "F50", "F90", "PR", "H1x", "H2x", "H1y", "H2y"]
def get_header(options):
chromosomes = []
for chrom, length in options.reference.chrom_lengths.items():
chromosomes.append(CHROMOSOME.format(name=chrom, length=length))
chromosomes = "\n".join(chromosomes)
samples = []
sample_columns = []
for sample_name, sample in options.samples.items():
samples.append(SAMPLE.format(name=sample_name, path=sample.get_10x_dataset().bam))
sample_columns.append(sample_name)
samples = "\n".join(samples)
sample_columns = "\t".join(sample_columns)
header = VCF_HEADER.format(
date=datetime.datetime.now().strftime("%Y%m%d"),
version=grocsvs.__version__,
reference=options.reference.path,
chromosomes=chromosomes,
samples=samples,
sample_columns=sample_columns
)
return header
def get_alt_breakend(options, chromx, x, chromy, y, orientation):
# note that vcf uses one-based coords so we add 1 to all positions
ref = options.reference.fasta[chromx][x].upper()
if orientation == "+-":
alt = "{}[{}:{}[".format(ref, chromy, y+1)
elif orientation == "++":
alt = "{}]{}:{}]".format(ref, chromy, y+1)
elif orientation == "-+":
alt = "]{}:{}]{}".format(chromy, y+1, ref)
elif orientation == "--":
alt = "[{}:{}[{}".format(chromy, y+1, ref)
return ref, alt
def get_sample_info(sample, event):
sample_info = {}
sample_info["BS"] = event["{}_shared".format(sample.name)]
sample_info["BT"] = event["{}_total".format(sample.name)]
if sample_info["BS"] > 5:
sample_info["GT"] = "1"
else:
sample_info["GT"] = "0"
if "{}_lengths_50".format(sample.name) in event:
sample_info["F50"] = event["{}_lengths_50".format(sample.name)]
sample_info["F90"] = event["{}_lengths_90".format(sample.name)]
else:
sample_info["F50"] = "."
sample_info["F90"] = "."
sample_info["PR"] = event["{}_p_resampling".format(sample.name)]
sample_info["H1x"] = event["{}_x_hap0".format(sample.name)]
sample_info["H2x"] = event["{}_x_hap1".format(sample.name)]
sample_info["H1y"] = event["{}_y_hap0".format(sample.name)]
sample_info["H2y"] = event["{}_y_hap1".format(sample.name)]
sample_info = [sample_info[key] for key in FORMAT]
return ":".join(map(str, sample_info))
def get_filters(event):
filters = []
try:
if "N=" in event["blacklist"]:
filters.append("ASSEMBLYGAP")
except TypeError:
pass
if event["nearby_snvs"] >= 15:
filters.append("NEARBYSNVS")
if "frag_length_passes" in event and not event["frag_length_passes"]:
filters.append("NOLONGFRAGS")
if len(filters) == 0:
return "PASS"
return ";".join(filters)
def get_info(event, mateid=None):
info = []
info.append("SVTYPE=BND")
if mateid is not None:
info.append("MATEID={}".format(mateid))
if event["assembled"]:
info.append("ASSEMBLED")
info.append("EVENT={}".format(event["cluster"]))
if len(info) == 0:
return "."
return ";".join(info)
def convert_event(options, event_id, event):
chromx, x, chromy, y, orientation = event["chromx"], event["x"], event["chromy"], event["y"], event["orientation"]
for i in [0,1]:
if i == 1:
chromx, x, chromy, y = chromy, y, chromx, x
orientation = orientation[1]+orientation[0]
this_id = "{}:{}".format(event_id, i)
other_id = "{}:{}".format(event_id, 1-i)
ref, alt_breakend = get_alt_breakend(options, chromx, x, chromy, y, orientation)
info = get_info(event, mateid=other_id)
filters = get_filters(event)
fields = [chromx, x+1, this_id, ref, alt_breakend, 0, filters, info, ":".join(FORMAT)]
for sample_name, sample in options.samples.items():
fields.append(get_sample_info(sample, event))
yield "\t".join(map(str, fields))
def convert_to_vcf(options, results):
header = get_header(options)
for line in header.splitlines():
yield line
for event_id, result in results.iterrows():
for line in convert_event(options, event_id, result):
yield line
| {
"content_hash": "ed211df8ff2cc0dfdff4e7f39d10cf87",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 168,
"avg_line_length": 39.6242774566474,
"alnum_prop": 0.6545587162654997,
"repo_name": "grocsvs/grocsvs",
"id": "bcad50b72a8c8f347e4013ae61524d16fdecf2c2",
"size": "6855",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/grocsvs/stages/export_vcf.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "1158"
},
{
"name": "Python",
"bytes": "347931"
}
],
"symlink_target": ""
} |
/*global describe, it*/
"use strict";
var should = require("should"),
through = require("through2"),
path = require("path"),
fs = require("fs"),
join = path.join,
git = require("../lib/git");
require("mocha");
var gutil = require("gulp-util"),
gulp = require("gulp"),
suffix = require("../");
describe("gulp-gitmodified", function () {
it("should return a stream", function (done) {
var stream = suffix();
should.exist(stream.on);
should.exist(stream.write);
done();
});
it('should suffix folders', function(done) {
var testSha = "aaabbbcccddd0123456",
instream = gulp.src(join(__dirname, "./fixtures")),
outstream = suffix();
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
should.exist(file);
should.exist(file.path);
file.path.should.contain("-aaabb")
should.exist(file.relative.indexOf("aaabb") !== -1);
done();
});
instream.pipe(outstream);
});
it('should default to - as separator and the first 6 characters', function(done) {
var testSha = "fbb790d601f7cb0ad0fabe5feff023b02aa9a03d",
instream = gulp.src(join(__dirname, "./fixtures/a.txt")),
outstream = suffix();
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
var split = file.relative.split("-");
should.exist(file);
should.exist(file.path);
should.exist(split);
should.exist(split[1]);
split.length.should.equal(2);
split[1].should.equal(testSha.substring(0, 6) + ".txt");
done();
});
instream.pipe(outstream);
});
it('should be able to prefix with folder', function(done) {
var testSha = "fbb790d601f7cb0ad0fabe5feff023b02aa9a03d",
instream = gulp.src(join(__dirname, "./fixtures/a.txt")),
outstream = suffix({
folder: true
});
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
should.exist(file);
should.exist(file.path);
file.path.should.contain("/" + testSha.substring(0, 6) + "/");
done();
});
instream.pipe(outstream);
});
it('should take suffix length as argument', function(done) {
var testSha = "fbb790d601f7cb0ad0fabe5feff023b02aa9a03d",
length = 8,
instream = gulp.src(join(__dirname, "./fixtures/a.txt")),
outstream = suffix({length: length});
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
var split = file.relative.split("-");
should.exist(file);
should.exist(file.path);
should.exist(split);
should.exist(split[1]);
split.length.should.equal(2);
split[1].split(".")[0].length.should.equal(length);
split[1].should.equal(testSha.substring(0, length) + ".txt");
done();
});
instream.pipe(outstream);
});
it('should take separator as argument', function(done) {
var testSha = "fbb790d601f7cb0ad0fabe5feff023b02aa9a03d",
separator = "***",
instream = gulp.src(join(__dirname, "./fixtures/a.txt")),
outstream = suffix({
length: 6,
separator: separator
});
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
should.exist(file.relative.indexOf(separator) !== -1);
var split = file.relative.split(separator);
should.exist(file);
should.exist(file.path);
should.exist(split);
should.exist(split[1]);
split.length.should.equal(2);
split[1].should.equal(testSha.substring(0, 6) + ".txt");
done();
});
instream.pipe(outstream);
});
it('should take seperator as argument', function(done) {
var testSha = "fbb790d601f7cb0ad0fabe5feff023b02aa9a03d",
separator = "***",
instream = gulp.src(join(__dirname, "./fixtures/a.txt")),
outstream = suffix({
length: 6,
seperator: separator
});
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
should.exist(file.relative.indexOf(separator) !== -1);
var split = file.relative.split(separator);
should.exist(file);
should.exist(file.path);
should.exist(split);
should.exist(split[1]);
split.length.should.equal(2);
split[1].should.equal(testSha.substring(0, 6) + ".txt");
done();
});
instream.pipe(outstream);
});
it('should set suffix on all files', function(done) {
var testSha = "fbb790d601f7cb0ad0fabe5feff023b02aa9a03d",
separator = "***",
instream = gulp.src(join(__dirname, "./fixtures/*")),
outstream = suffix({
length: 6,
separator: separator
});
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
var ext = path.extname(file.path);
should.exist(file.relative.indexOf(separator) !== -1);
var split = file.relative.split(separator);
should.exist(file);
should.exist(file.path);
should.exist(split);
should.exist(split[1]);
split.length.should.equal(2);
split[1].should.equal(testSha.substring(0, 6) + ext);
});
outstream.on('end', function () {
done();
});
instream.pipe(outstream);
});
it('should handle streamed files', function (done) {
var expectedFile = new gutil.File({
path: "test/fixtures/a.txt",
cwd: "test/",
base: "test/fixtures/",
contents: fs.createReadStream(join(__dirname, "/fixtures/a.txt"))
});
var testSha = "aaabbbcccddd0123456",
outstream = suffix();
git.getLatestSha = function (cb) {
return cb(null, testSha);
};
outstream.on('data', function(file) {
should.exist(file);
should.exist(file.path);
should.exist(file.isStream());
should(file.isNull()).not.equal(true);
file.contents.should.equal(expectedFile.contents);
should.exist(file.relative.indexOf("aaabb") !== -1);
done();
});
outstream.write(expectedFile);
});
});
| {
"content_hash": "2afc3fe71525819ce53e40b311a8841f",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 84,
"avg_line_length": 27.61572052401747,
"alnum_prop": 0.5929791271347249,
"repo_name": "shawn-simon/gulp-gitshasuffix",
"id": "5622d32af43f31aa87d994c06c60e87ff8bc232a",
"size": "6324",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/main.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "11529"
}
],
"symlink_target": ""
} |
<!--lint enable maximum-line-length-->
alpha bravo charlie delta echo foxtrot golf hotel india julliet kilo lima mike november.
<!--lint disable maximum-line-length-->
alpha bravo charlie delta echo foxtrot golf hotel india julliet kilo lima mike november.
| {
"content_hash": "b2595aee85c8e36f85f00e6b1c69bb5a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 88,
"avg_line_length": 37.142857142857146,
"alnum_prop": 0.7807692307692308,
"repo_name": "basyura/mdast-lint",
"id": "29a7330b8c36be3c75d734165597a31a038a1ccf",
"size": "260",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/fixtures/comments-enable.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "359298"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title>Recent Books</title>
<script src="site_libs/header-attrs-2.13/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/yeti.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<style>h1 {font-size: 34px;}
h1.title {font-size: 38px;}
h2 {font-size: 30px;}
h3 {font-size: 24px;}
h4 {font-size: 18px;}
h5 {font-size: 16px;}
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">code{white-space: pre;}</style>
<script type="text/javascript">
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() { hljs.initHighlighting(); }, 0);
}
}
</script>
<link rel="stylesheet" href="alans.css" type="text/css" />
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
details > summary > p:only-child {
display: inline;
}
pre code {
padding: 0;
}
</style>
<style type="text/css">
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #cccccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #adb5bd;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
border-radius: 6px 0 6px 6px;
}
</style>
<script type="text/javascript">
// manage active state of menu based on current page
$(document).ready(function () {
// active menu anchor
href = window.location.pathname
href = href.substr(href.lastIndexOf('/') + 1)
if (href === "")
href = "index.html";
var menuAnchor = $('a[href="' + href + '"]');
// mark it active
menuAnchor.tab('show');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
// Navbar adjustments
var navHeight = $(".navbar").first().height() + 15;
var style = document.createElement('style');
var pt = "padding-top: " + navHeight + "px; ";
var mt = "margin-top: -" + navHeight + "px; ";
var css = "";
// offset scroll position for anchor links (for fixed navbar)
for (var i = 1; i <= 6; i++) {
css += ".section h" + i + "{ " + pt + mt + "}\n";
}
style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css;
document.head.appendChild(style);
});
</script>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
</head>
<body>
<div class="container-fluid main-container">
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-bs-toggle="collapse" data-target="#navbar" data-bs-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Alan T. Arnholt</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="for-students.html">For Students</a>
</li>
<li>
<a href="resources.html">Resources</a>
</li>
<li>
<a href="teaching.html">Teaching</a>
</li>
<li>
<a href="https://alanarnholt.github.io/GeneralStatistics/">Misc. Stats</a>
</li>
<li>
<a href="software.html">Software</a>
</li>
<li>
<a href="scholarship.html">Scholarship</a>
</li>
<li>
<a href="coolstuff.html">Cool Stuff</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="about.html">
<span class="glyphicon glyphicon-info-sign"></span>
</a>
</li>
<li>
<a href="https://github.com/alanarnholt/alanarnholt.github.io/">
<span class="fa fa-github fa-lg"></span>
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div id="header">
<h1 class="title toc-ignore">Recent Books</h1>
</div>
<p><a href="http://alanarnholt.github.io/PASWR2E-Book/"><em>Probability and Statistics with R, Second Edition</em></a></p>
<hr />
<div id="footer">
<p><strong>Alan T. Arnholt,</strong> Ph.D. </br>
Professor of Statistics </br>
<a href="mailto:arnholtat@appstate.edu"> arnholtat@appstate.edu</a> </br>
<img src="images/asu-logo-white-600.png" style="background-color:black; width:180px; float:left;" width = />
</p>
<p><strong>Office Hours</strong> </br>
<a href="https://calendar.google.com/calendar/u/0/selfsched?sstoken=UUtZb3I1Z1pFczdjfGRlZmF1bHR8MTZjOTU5MGY0ZTFlOTA2MmExNzhlYWQ5MGIzZWQ0OGM"> Click for Availability</a> </br>
</p>
<p>
<strong>Mailing Address</strong><br />
<a href = "http://www.appstate.edu/"> Appalachian State University</a><br />
<a href= "https://mathsci.appstate.edu/"> Department of Mathematical Sciences</a><br />
Walker Hall 237<br />
121 Bodenheimer Dr<br />
Boone, NC 28608
</p>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.odd').parent('tbody').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open');
});
});
</script>
<!-- code folding -->
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>
| {
"content_hash": "a81b3e1b93a95743e0945ef181991db3",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 181,
"avg_line_length": 23.943548387096776,
"alnum_prop": 0.6411810935219491,
"repo_name": "alanarnholt/alanarnholt.github.io",
"id": "9d1abd3fa1de072cab5789d618e7e76f41ffe49a",
"size": "8911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scholarship.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "107113"
},
{
"name": "HTML",
"bytes": "132138"
},
{
"name": "JavaScript",
"bytes": "1423875"
}
],
"symlink_target": ""
} |
class ProxyImage implements Image {
private RealImage image = null;
private String filename = null;
public ProxyImage(String FILENAME) {
filename = FILENAME;
}
public void displayImage() {
if (image == null) {
image = new RealImage(filename);
}
image.displayImage();
}
} | {
"content_hash": "73b05919aff8eaf2b166b778216babf4",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 43,
"avg_line_length": 22.75,
"alnum_prop": 0.5521978021978022,
"repo_name": "jucimarjr/ooerlang",
"id": "a3c91f59c5309dc10af87c9a50047aa741acd55e",
"size": "364",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "examples/design_patterns/12_Proxy/Java/ProxyImage.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Elixir",
"bytes": "5003"
},
{
"name": "Erlang",
"bytes": "228664"
},
{
"name": "Java",
"bytes": "187993"
},
{
"name": "Python",
"bytes": "6553"
},
{
"name": "Ruby",
"bytes": "5538"
},
{
"name": "Scala",
"bytes": "7016"
},
{
"name": "Shell",
"bytes": "3642"
}
],
"symlink_target": ""
} |
// In the JVT syntax, frequently flags are used that indicate the presence of
// certain pieces of information in the NALU. Here, these flags are also
// present. In the encoder, those bits indicate that the values signalled to
// be present are meaningful and that this part of the syntax should be
// written to the NALU. In the decoder, the flag indicates that information
// was received from the decoded NALU and should be used henceforth.
// The structure names were chosen as indicated in the JVT syntax
#ifndef _PARSETCOMMON_H_
#define _PARSETCOMMON_H_
#include "defines.h"
#define MAXIMUMPARSETRBSPSIZE 1500
#define MAXIMUMPARSETNALUSIZE 1500
#define SIZEslice_group_id (sizeof (int) * 60000) // should be sufficient for HUGE pictures, need one int per MB in a picture
#define MAXSPS 32
#define MAXPPS 256
//! Boolean Type
#ifdef FALSE
# define Boolean int
#else
typedef enum {
FALSE,
TRUE
} Boolean;
#endif
#define MAXIMUMVALUEOFcpb_cnt 32
typedef struct
{
unsigned int cpb_cnt_minus1; // ue(v)
unsigned int bit_rate_scale; // u(4)
unsigned int cpb_size_scale; // u(4)
unsigned int bit_rate_value_minus1 [MAXIMUMVALUEOFcpb_cnt]; // ue(v)
unsigned int cpb_size_value_minus1 [MAXIMUMVALUEOFcpb_cnt]; // ue(v)
unsigned int cbr_flag [MAXIMUMVALUEOFcpb_cnt]; // u(1)
unsigned int initial_cpb_removal_delay_length_minus1; // u(5)
unsigned int cpb_removal_delay_length_minus1; // u(5)
unsigned int dpb_output_delay_length_minus1; // u(5)
unsigned int time_offset_length; // u(5)
} hrd_parameters_t;
typedef struct
{
Boolean aspect_ratio_info_present_flag; // u(1)
unsigned int aspect_ratio_idc; // u(8)
unsigned int sar_width; // u(16)
unsigned int sar_height; // u(16)
Boolean overscan_info_present_flag; // u(1)
Boolean overscan_appropriate_flag; // u(1)
Boolean video_signal_type_present_flag; // u(1)
unsigned video_format; // u(3)
Boolean video_full_range_flag; // u(1)
Boolean colour_description_present_flag; // u(1)
unsigned int colour_primaries; // u(8)
unsigned int transfer_characteristics; // u(8)
unsigned int matrix_coefficients; // u(8)
Boolean chroma_location_info_present_flag; // u(1)
unsigned int chroma_sample_loc_type_top_field; // ue(v)
unsigned int chroma_sample_loc_type_bottom_field; // ue(v)
Boolean timing_info_present_flag; // u(1)
unsigned int num_units_in_tick; // u(32)
unsigned int time_scale; // u(32)
Boolean fixed_frame_rate_flag; // u(1)
Boolean nal_hrd_parameters_present_flag; // u(1)
hrd_parameters_t nal_hrd_parameters; // hrd_paramters_t
Boolean vcl_hrd_parameters_present_flag; // u(1)
hrd_parameters_t vcl_hrd_parameters; // hrd_paramters_t
// if ((nal_hrd_parameters_present_flag || (vcl_hrd_parameters_present_flag))
Boolean low_delay_hrd_flag; // u(1)
Boolean pic_struct_present_flag; // u(1)
Boolean bitstream_restriction_flag; // u(1)
Boolean motion_vectors_over_pic_boundaries_flag; // u(1)
unsigned int max_bytes_per_pic_denom; // ue(v)
unsigned int max_bits_per_mb_denom; // ue(v)
unsigned int log2_max_mv_length_vertical; // ue(v)
unsigned int log2_max_mv_length_horizontal; // ue(v)
unsigned int num_reorder_frames; // ue(v)
unsigned int max_dec_frame_buffering; // ue(v)
} vui_seq_parameters_t;
#define MAXnum_slice_groups_minus1 8
typedef struct
{
Boolean Valid; // indicates the parameter set is valid
unsigned int pic_parameter_set_id; // ue(v)
unsigned int seq_parameter_set_id; // ue(v)
Boolean entropy_coding_mode_flag; // u(1)
Boolean transform_8x8_mode_flag; // u(1)
Boolean pic_scaling_matrix_present_flag; // u(1)
int pic_scaling_list_present_flag[8]; // u(1)
int ScalingList4x4[6][16]; // se(v)
int ScalingList8x8[2][64]; // se(v)
Boolean UseDefaultScalingMatrix4x4Flag[6];
Boolean UseDefaultScalingMatrix8x8Flag[2];
// if( pic_order_cnt_type < 2 ) in the sequence parameter set
Boolean pic_order_present_flag; // u(1)
unsigned int num_slice_groups_minus1; // ue(v)
unsigned int slice_group_map_type; // ue(v)
// if( slice_group_map_type = = 0 )
unsigned int run_length_minus1[MAXnum_slice_groups_minus1]; // ue(v)
// else if( slice_group_map_type = = 2 )
unsigned int top_left[MAXnum_slice_groups_minus1]; // ue(v)
unsigned int bottom_right[MAXnum_slice_groups_minus1]; // ue(v)
// else if( slice_group_map_type = = 3 || 4 || 5
Boolean slice_group_change_direction_flag; // u(1)
unsigned int slice_group_change_rate_minus1; // ue(v)
// else if( slice_group_map_type = = 6 )
unsigned int num_slice_group_map_units_minus1; // ue(v)
unsigned int *slice_group_id; // complete MBAmap u(v)
unsigned int num_ref_idx_l0_active_minus1; // ue(v)
unsigned int num_ref_idx_l1_active_minus1; // ue(v)
Boolean weighted_pred_flag; // u(1)
unsigned int weighted_bipred_idc; // u(2)
int pic_init_qp_minus26; // se(v)
int pic_init_qs_minus26; // se(v)
int chroma_qp_index_offset; // se(v)
int second_chroma_qp_index_offset; // se(v)
Boolean deblocking_filter_control_present_flag; // u(1)
Boolean constrained_intra_pred_flag; // u(1)
Boolean redundant_pic_cnt_present_flag; // u(1)
} pic_parameter_set_rbsp_t;
#define MAXnum_ref_frames_in_pic_order_cnt_cycle 256
typedef struct
{
Boolean Valid; // indicates the parameter set is valid
unsigned int profile_idc; // u(8)
Boolean constrained_set0_flag; // u(1)
Boolean constrained_set1_flag; // u(1)
Boolean constrained_set2_flag; // u(1)
Boolean constrained_set3_flag; // u(1)
unsigned int level_idc; // u(8)
unsigned int seq_parameter_set_id; // ue(v)
unsigned int chroma_format_idc; // ue(v)
Boolean seq_scaling_matrix_present_flag; // u(1)
int seq_scaling_list_present_flag[8]; // u(1)
int ScalingList4x4[6][16]; // se(v)
int ScalingList8x8[2][64]; // se(v)
Boolean UseDefaultScalingMatrix4x4Flag[6];
Boolean UseDefaultScalingMatrix8x8Flag[2];
unsigned int bit_depth_luma_minus8; // ue(v)
unsigned int bit_depth_chroma_minus8; // ue(v)
unsigned int log2_max_frame_num_minus4; // ue(v)
unsigned int pic_order_cnt_type;
// if( pic_order_cnt_type == 0 )
unsigned log2_max_pic_order_cnt_lsb_minus4; // ue(v)
// else if( pic_order_cnt_type == 1 )
Boolean delta_pic_order_always_zero_flag; // u(1)
int offset_for_non_ref_pic; // se(v)
int offset_for_top_to_bottom_field; // se(v)
unsigned int num_ref_frames_in_pic_order_cnt_cycle; // ue(v)
// for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
int offset_for_ref_frame[MAXnum_ref_frames_in_pic_order_cnt_cycle]; // se(v)
unsigned int num_ref_frames; // ue(v)
Boolean gaps_in_frame_num_value_allowed_flag; // u(1)
unsigned int pic_width_in_mbs_minus1; // ue(v)
unsigned int pic_height_in_map_units_minus1; // ue(v)
Boolean frame_mbs_only_flag; // u(1)
// if( !frame_mbs_only_flag )
Boolean mb_adaptive_frame_field_flag; // u(1)
Boolean direct_8x8_inference_flag; // u(1)
Boolean frame_cropping_flag; // u(1)
unsigned int frame_cropping_rect_left_offset; // ue(v)
unsigned int frame_cropping_rect_right_offset; // ue(v)
unsigned int frame_cropping_rect_top_offset; // ue(v)
unsigned int frame_cropping_rect_bottom_offset; // ue(v)
Boolean vui_parameters_present_flag; // u(1)
vui_seq_parameters_t vui_seq_parameters; // vui_seq_parameters_t
} seq_parameter_set_rbsp_t;
pic_parameter_set_rbsp_t *AllocPPS ();
seq_parameter_set_rbsp_t *AllocSPS ();
void FreePPS (pic_parameter_set_rbsp_t *pps);
void FreeSPS (seq_parameter_set_rbsp_t *sps);
int sps_is_equal(seq_parameter_set_rbsp_t *sps1, seq_parameter_set_rbsp_t *sps2);
int pps_is_equal(pic_parameter_set_rbsp_t *pps1, pic_parameter_set_rbsp_t *pps2);
#endif
| {
"content_hash": "98f5d8180d87cdd4d8b6f9638447d2c7",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 133,
"avg_line_length": 51.40594059405941,
"alnum_prop": 0.514926810477658,
"repo_name": "ensemblr/llvm-project-boilerplate",
"id": "79267e25d3d4442d9d6a0090169deee358a41443",
"size": "10919",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "include/llvm/projects/test-suite/MultiSource/Applications/JM/ldecod/parsetcommon.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "32"
},
{
"name": "AppleScript",
"bytes": "1429"
},
{
"name": "Assembly",
"bytes": "15649629"
},
{
"name": "Awk",
"bytes": "1747037"
},
{
"name": "Batchfile",
"bytes": "34481"
},
{
"name": "Brainfuck",
"bytes": "284"
},
{
"name": "C",
"bytes": "85584624"
},
{
"name": "C#",
"bytes": "20737"
},
{
"name": "C++",
"bytes": "168418524"
},
{
"name": "CMake",
"bytes": "1174816"
},
{
"name": "CSS",
"bytes": "49900"
},
{
"name": "Cuda",
"bytes": "414703"
},
{
"name": "Emacs Lisp",
"bytes": "110018"
},
{
"name": "Forth",
"bytes": "1490"
},
{
"name": "Fortran",
"bytes": "356707"
},
{
"name": "GAP",
"bytes": "6167"
},
{
"name": "Go",
"bytes": "132137"
},
{
"name": "HTML",
"bytes": "1751124"
},
{
"name": "JavaScript",
"bytes": "141512"
},
{
"name": "LLVM",
"bytes": "62219250"
},
{
"name": "Limbo",
"bytes": "7437"
},
{
"name": "Logos",
"bytes": "1572537943"
},
{
"name": "Lua",
"bytes": "86606"
},
{
"name": "M",
"bytes": "2008"
},
{
"name": "M4",
"bytes": "109560"
},
{
"name": "Makefile",
"bytes": "616437"
},
{
"name": "Mathematica",
"bytes": "7845"
},
{
"name": "Matlab",
"bytes": "53817"
},
{
"name": "Mercury",
"bytes": "1194"
},
{
"name": "Mirah",
"bytes": "1079943"
},
{
"name": "OCaml",
"bytes": "407143"
},
{
"name": "Objective-C",
"bytes": "5910944"
},
{
"name": "Objective-C++",
"bytes": "1720450"
},
{
"name": "OpenEdge ABL",
"bytes": "690534"
},
{
"name": "PHP",
"bytes": "15986"
},
{
"name": "POV-Ray SDL",
"bytes": "19471"
},
{
"name": "Perl",
"bytes": "591927"
},
{
"name": "PostScript",
"bytes": "845774"
},
{
"name": "Protocol Buffer",
"bytes": "20013"
},
{
"name": "Python",
"bytes": "1895427"
},
{
"name": "QMake",
"bytes": "15580"
},
{
"name": "RenderScript",
"bytes": "741"
},
{
"name": "Roff",
"bytes": "94555"
},
{
"name": "Rust",
"bytes": "200"
},
{
"name": "Scheme",
"bytes": "2654"
},
{
"name": "Shell",
"bytes": "1144090"
},
{
"name": "Smalltalk",
"bytes": "144607"
},
{
"name": "SourcePawn",
"bytes": "1544"
},
{
"name": "Standard ML",
"bytes": "2841"
},
{
"name": "Tcl",
"bytes": "8285"
},
{
"name": "TeX",
"bytes": "320484"
},
{
"name": "Vim script",
"bytes": "17239"
},
{
"name": "Yacc",
"bytes": "163484"
}
],
"symlink_target": ""
} |
layout: nohead
---
# Crear Actividades
## Cuestionarios
Puedes agregar cuestionarios sencillos que incluan preguntas de opción
múltiple y de completar. El cuestionario se captura en dos partes como
se muestra en la imágen:

* ***La sección de instrucciones o imágenes que está en la parte superior.*** Aquí
debes de escribir directamente en HTML, las instrucciones, el problema,código
o imágenes sobre las cuales vas a preguntar. Puedes utilizar los
elementos y atributos de estilo de Bootstrap 4.0 y el código con sintáxis resaltada.
Para resaltar código utilizamos [prisimjs](http://prismjs.com/), por lo que
puedes escribir algo como:
```
<pre>
<code class="language-css">
p { color: red }
</code>
</pre>
```
* ***La sección de preguntas.*** Esta sección debes escribirla utilizando
el formato Markdown de la siguiente manera:
#### Para preguntas de opción múltiple de una sola respuesta:
```
>>¿Qué es un intérprete?<<
() Una persona que traduce entre varios lenguajes.
() Es un programa informático que traduce un programa que ha sido escrito en un lenguaje de programación a un lenguaje diferente.
(x) Un programa informático capaz de analizar y ejecutar otros programas.
```
* Escribe la pregunta entre las marcas: >> <<
* Cada opción va en una línea nueva, en este caso los paréntesis indican
los botones tipo radio.
* Con una x indicas la respuesta correcta.
#### Preguntas de opción múltiple:
```
>>Son lenguajes interpretados:<<
[x] Python
[] c++
[x] Ruby
```
* Escribe la pregunta entre las marcas: >> <<
* Cada opción va en una línea nueva, en este caso los corchetes indican
que se debe seleccionar más de una respuesta.
* Con una x indicas aquellas opciones que deberán ser seleccionadas para
que se considere una respuesta correcta.
#### Preguntas de completar:
```
>>¿Que empresa desarrolló el lenguaje GO?<<
{{Empieza con G}}
=Google=
=google=
```
* Escribe la pregunta entre las marcas: >> <<
* Cada opción va en una línea nueva. El texto va entre los simbolos de igualdad: = =
* En todos los casos puedes indicar entre llaves dobles \{\{ \}\} la pista que se dará al
estudiante en caso de que lo requiera.
Para el ejemplo anterior el estudiante vería el siguiente cuestionario:

## Ejercicios de Programación
Un ejercicios de programación tiene varios componentes, los cuales se muestran
en las siguientes pestañas:
### Instrucciones
Las instrucciones debes de escribirlas en código HTML utilizando
Bootstrap 4.0, por ejemplo:
```
<h4>La clase <code>Product</code> tiene errores</h4>
<p>
La clase <code>Product</code> se utiliza en un programa de la siguiente manera:
</p>
<div class="card card-block bg-faded">
<pre>
<code class="language-csharp">
Product p = new Product(1, "iPhone 6");
p.Print();
</code>
</pre>
</div>
<p>
Completa el código para que funcione.
</p>
<row>
<button aria-controls="collapseExample" aria-expanded="false" class="btn btn-info" data-target="#collapseExample" data-toggle="collapse" type="button">
Ayuda
</button>
</row>
<div class="collapse" id="collapseExample">
<div class="card card-block bg-faded">
<p>
En C# al declarar los campos debes indicar su tipo de dato. Por ejemplo:
</p>
<pre>
<code class="language-csharp">
public int intentos;
public string email;
</code>
</pre>
</div>
</div>
```
En este ejemplo se utiliza un elemento adicional de Bootstrap 4.0 para
mostrar un botón de ayuda el cual muestra texto adicional al presionarlo.
### Código inicial
El código inicial, es el código con el cual el estudiante empezará
a hacer el ejercicio. Por ejemplo, en el caso de que tenga que
corregir el código, estará el programa incompleto, etc. Por ejemplo:
```
using System.IO;
using System;
public class Product
{
public code;
public desc;
public Product(int c, string d)
{
code=c;
desc=d;
}
public void Print()
{
Console.WriteLine("Producto {0}: {1}", code,desc);
}
}
```
### Prueba
En la pestaña de prueba, va el código que evaluará el ejercicio.
El ejercicio se evalúa con una prueba unitaria y el código
dependerá del lenguaje del ejercicio. Por ejemplo para C#:
```
[TestFixture]
public class ProductTest
{
[Test, Description("Prueba del Constructor")]
public void Constructor()
{
Product p = new Product(1,"hola");
// Constraint Syntax
Assert.AreEqual(p.code,1);
}
[Test, Description("Imprimir la Descripción")]
public void PrintTest()
{
Product p = new Product(1,"hola");
p.Print();
using (StringWriter sw = new StringWriter())
{
Console.SetOut(sw);
p.Print();
string expected = "Producto 1: hola";
StringAssert.StartsWith(expected, sw.ToString());
}
}
}
```
### RegExp
Se pueden poner expresiones regulares que deban satisfacerse.
### Solución Correcta
Es opcional y todavía no se utiliza.
### HTML Generado
En el caso de ejercicios de JavaScript es código HTML
que se genererá.
## Videos
## HTML
# Crear Cursos
## Árbol de Actividades
## Agregar Actividades
## Reglas de Secuenciado
| {
"content_hash": "87c790c14d1650327d3cea04c6893b94",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 152,
"avg_line_length": 24.149321266968325,
"alnum_prop": 0.6940228592842421,
"repo_name": "mariosky/protoboard",
"id": "a52fbe113d4802af58099b9accd2d443e22d4a89",
"size": "5402",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/doc-es/index.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "7881"
},
{
"name": "Dockerfile",
"bytes": "611"
},
{
"name": "HTML",
"bytes": "322054"
},
{
"name": "JavaScript",
"bytes": "59836"
},
{
"name": "Mustache",
"bytes": "1985"
},
{
"name": "Python",
"bytes": "190989"
},
{
"name": "SCSS",
"bytes": "1634"
},
{
"name": "Shell",
"bytes": "482"
}
],
"symlink_target": ""
} |
#region Licence
#endregion
namespace Paramore.Brighter.MessagingGateway.RMQ
{
public class RmqMessageConsumerFactory : IAmAMessageConsumerFactory
{
private readonly RmqMessagingGatewayConnection _rmqConnection;
/// <summary>
/// Initializes a new instance of the <see cref="RmqMessageConsumerFactory"/> class.
/// <param name="rmqConnection">The connection to the broker hosting the queue</param>
/// </summary>
public RmqMessageConsumerFactory(RmqMessagingGatewayConnection rmqConnection)
{
_rmqConnection = rmqConnection;
}
/// <summary>
/// Creates a consumer for the specified queue.
/// </summary>
/// <param name="connection">The queue to connect to</param>
/// <returns>IAmAMessageConsumer.</returns>
public IAmAMessageConsumer Create(Connection connection)
{
return new RmqMessageConsumer(
_rmqConnection,
connection.ChannelName, //RMQ Queue Name
connection.RoutingKey,
connection.IsDurable,
connection.HighAvailability);
}
}
}
| {
"content_hash": "6c5eda089e0ba408c9059d9fd994925f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 94,
"avg_line_length": 33.083333333333336,
"alnum_prop": 0.6246851385390428,
"repo_name": "BrighterCommand/Paramore.Brighter",
"id": "9a8ff82e041d4057ba5d42e2d91167f37f0ccb28",
"size": "2286",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Paramore.Brighter.MessagingGateway.RMQ/RmqMessageConsumerFactory.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2890218"
},
{
"name": "PLpgSQL",
"bytes": "1354"
},
{
"name": "Shell",
"bytes": "1718"
},
{
"name": "Smalltalk",
"bytes": "133396"
}
],
"symlink_target": ""
} |
const UrlParamsController = new class
{
constructor(){
this.getParameters = {};
this.hashParameters = {};
this._fetch();
}
_clearParams(){
this.getParameters = {};
this.hashParameters = {};
}
_fetch(){
this._clearParams();
window.location.search.substr(1).split("&").forEach(pair => {
let parts = pair.split("=");
this.getParameters[parts[0]] = decodeURIComponent(parts[1]);
});
window.location.hash.substr(1).split("&").forEach(pair => {
let parts = pair.split("=");
this.hashParameters[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
});
}
getHas(key){
this._fetch();
return !! Object.keys(this.getParameters).filter(getKey=>getKey === key).length;
}
getParams(){
this._fetch();
return this.getParameters;
}
hashParams(){
this._fetch();
return this.hashParameters;
}
};
const Environment = new class
{
constructor(){
this._setEnvironment();
this._setDevice();
}
_setDevice(){
this.device = window.device;
}
_setEnvironment(){
this.environment = 'browser';
if (new RegExp(/(localhost)|(file)/).test(document.URL)) {
this.environment = 'app';
}
}
deviceIs(device){
return this.device === device;
}
is(env) {
return this.environment === env;
}
};
export {UrlParamsController,Environment}; | {
"content_hash": "9443143ebec27b6856448c5dc7038631",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 93,
"avg_line_length": 22.205479452054796,
"alnum_prop": 0.5163479333744602,
"repo_name": "jivemonkey2000/evhighwaystatus",
"id": "466f54a388e8fbff195e530d607d226ab86ed600",
"size": "1621",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/assets/js/classes/Controllers.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "27003"
},
{
"name": "JavaScript",
"bytes": "834950"
},
{
"name": "PHP",
"bytes": "665096"
},
{
"name": "Vue",
"bytes": "53220"
}
],
"symlink_target": ""
} |
<?php
namespace Bundle\ChessBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class PageController extends Controller
{
public function indexAction()
{
return $this->render('BloggerBlogBundle:Page:index.html.twig');
}
}
| {
"content_hash": "b22d7c160c8d97b35291e6f41864681d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 20.76923076923077,
"alnum_prop": 0.7444444444444445,
"repo_name": "palletorsson/symfony-of-chess",
"id": "b06b47852b10da65a48569f70404359fc48eaaa5",
"size": "270",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Bundle/ChessBundle/Controller/PageController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "14914"
},
{
"name": "PHP",
"bytes": "243403"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ExtensibleILRewriter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtensibleILRewriter")]
[assembly: AssemblyCopyright("Copyright © Hubert Kindermann 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b8631325-d271-4581-8d79-6c1bbdb83464")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "f5e974ec4cc1dac94243f83e53b3dbdd",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.666666666666664,
"alnum_prop": 0.75,
"repo_name": "kindermannhubert/ExtensibleILRewriter",
"id": "2923ee46e751f2ddd555c3a347fdf6d94ce821b4",
"size": "1431",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ExtensibleILRewriter/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "159109"
}
],
"symlink_target": ""
} |
using System.Web;
using System.Web.Optimization;
namespace SingularityLandingPage
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| {
"content_hash": "7dd9295722924741ee8896d1ae29f10a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 112,
"avg_line_length": 40.354838709677416,
"alnum_prop": 0.5771382893685052,
"repo_name": "ownacademy/SingularityLandingPage",
"id": "71c394e6923a88132daee012c99d6823f1bea609",
"size": "1253",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SingularityLandingPage/SingularityLandingPage/App_Start/BundleConfig.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "113"
},
{
"name": "C#",
"bytes": "5657"
},
{
"name": "CSS",
"bytes": "1153"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "10918"
}
],
"symlink_target": ""
} |
void pfun(double x[], double y[], double u[], double v[], int points)
{
char * commandsForGnuplot[] = {"set terminal png","set output 'energy.png'","set title \"Integral Values as a Function of Distance\"","set logscale x 2", "set logscale y 10", "plot 'data.temp' u 1:2 title 'VEGAS' w l, 'data.temp' u 1:3 title 'Handmade Integrator' w l, 'data.temp' u 1:4 title 'Dipole Approximation' w l"};
FILE * temp = fopen("data.temp", "w"); // write coordinates here.
FILE * gnuplotPipe = popen ("gnuplot -persistent", "w");
int i;
int q;
for(q = 0; q < points ;q++)
{
fprintf(temp, "%lf %lf %lf %lf\n", x[q], y[q], u[q], v[q]);
}
for (i=0; i < 6; i++)
{
fprintf(gnuplotPipe, "%s \n", commandsForGnuplot[i]); //Send commands to gnuplot one by one.
}
}
| {
"content_hash": "2179a7b46d1a9165b4a506c0e77b913f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 326,
"avg_line_length": 41.78947368421053,
"alnum_prop": 0.5969773299748111,
"repo_name": "connor-occhialini/fin2",
"id": "008c073d38a1aef0c73ae83344a94afcec1c777d",
"size": "950",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plotfun.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5908"
},
{
"name": "Makefile",
"bytes": "684"
},
{
"name": "Prolog",
"bytes": "902"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebApplication1")]
[assembly: AssemblyCopyright("© Václav Dajbych 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("aefdbf5d-eece-43f2-b16d-a2ab83210753")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "e4823874fa60243ab6fdd6b01751ba5b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 84,
"avg_line_length": 40.05714285714286,
"alnum_prop": 0.7318116975748931,
"repo_name": "dajbych/samples",
"id": "3b56462cf65c3a1c10f4140edc0875e30331b2eb",
"size": "1406",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2013/HTML5/Subtitles/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "261"
},
{
"name": "C#",
"bytes": "112075"
},
{
"name": "CSS",
"bytes": "4951"
},
{
"name": "F#",
"bytes": "578"
},
{
"name": "HTML",
"bytes": "243772050"
},
{
"name": "JavaScript",
"bytes": "226"
},
{
"name": "PowerShell",
"bytes": "9562"
}
],
"symlink_target": ""
} |
""" recording warnings during test function execution. """
from __future__ import absolute_import, division, print_function
import inspect
import _pytest._code
import py
import sys
import warnings
import re
from _pytest.fixtures import yield_fixture
from _pytest.outcomes import fail
@yield_fixture
def recwarn():
"""Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
See http://docs.python.org/library/warnings.html for information
on warning categories.
"""
wrec = WarningsRecorder()
with wrec:
warnings.simplefilter('default')
yield wrec
def deprecated_call(func=None, *args, **kwargs):
"""context manager that can be used to ensure a block of code triggers a
``DeprecationWarning`` or ``PendingDeprecationWarning``::
>>> import warnings
>>> def api_call_v2():
... warnings.warn('use v3 of this api', DeprecationWarning)
... return 200
>>> with deprecated_call():
... assert api_call_v2() == 200
``deprecated_call`` can also be used by passing a function and ``*args`` and ``*kwargs``,
in which case it will ensure calling ``func(*args, **kwargs)`` produces one of the warnings
types above.
"""
if not func:
return _DeprecatedCallContext()
else:
__tracebackhide__ = True
with _DeprecatedCallContext():
return func(*args, **kwargs)
class _DeprecatedCallContext(object):
"""Implements the logic to capture deprecation warnings as a context manager."""
def __enter__(self):
self._captured_categories = []
self._old_warn = warnings.warn
self._old_warn_explicit = warnings.warn_explicit
warnings.warn_explicit = self._warn_explicit
warnings.warn = self._warn
def _warn_explicit(self, message, category, *args, **kwargs):
self._captured_categories.append(category)
def _warn(self, message, category=None, *args, **kwargs):
if isinstance(message, Warning):
self._captured_categories.append(message.__class__)
else:
self._captured_categories.append(category)
def __exit__(self, exc_type, exc_val, exc_tb):
warnings.warn_explicit = self._old_warn_explicit
warnings.warn = self._old_warn
if exc_type is None:
deprecation_categories = (DeprecationWarning, PendingDeprecationWarning)
if not any(issubclass(c, deprecation_categories) for c in self._captured_categories):
__tracebackhide__ = True
msg = "Did not produce DeprecationWarning or PendingDeprecationWarning"
raise AssertionError(msg)
def warns(expected_warning, *args, **kwargs):
"""Assert that code raises a particular class of warning.
Specifically, the parameter ``expected_warning`` can be a warning class or
sequence of warning classes, and the inside the ``with`` block must issue a warning of that class or
classes.
This helper produces a list of :class:`warnings.WarningMessage` objects,
one for each warning raised.
This function can be used as a context manager, or any of the other ways
``pytest.raises`` can be used::
>>> with warns(RuntimeWarning):
... warnings.warn("my warning", RuntimeWarning)
In the context manager form you may use the keyword argument ``match`` to assert
that the exception matches a text or regex::
>>> with warns(UserWarning, match='must be 0 or None'):
... warnings.warn("value must be 0 or None", UserWarning)
>>> with warns(UserWarning, match=r'must be \d+$'):
... warnings.warn("value must be 42", UserWarning)
>>> with warns(UserWarning, match=r'must be \d+$'):
... warnings.warn("this is not here", UserWarning)
Traceback (most recent call last):
...
Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...
"""
match_expr = None
if not args:
if "match" in kwargs:
match_expr = kwargs.pop("match")
return WarningsChecker(expected_warning, match_expr=match_expr)
elif isinstance(args[0], str):
code, = args
assert isinstance(code, str)
frame = sys._getframe(1)
loc = frame.f_locals.copy()
loc.update(kwargs)
with WarningsChecker(expected_warning, match_expr=match_expr):
code = _pytest._code.Source(code).compile()
py.builtin.exec_(code, frame.f_globals, loc)
else:
func = args[0]
with WarningsChecker(expected_warning, match_expr=match_expr):
return func(*args[1:], **kwargs)
class WarningsRecorder(warnings.catch_warnings):
"""A context manager to record raised warnings.
Adapted from `warnings.catch_warnings`.
"""
def __init__(self):
super(WarningsRecorder, self).__init__(record=True)
self._entered = False
self._list = []
@property
def list(self):
"""The list of recorded warnings."""
return self._list
def __getitem__(self, i):
"""Get a recorded warning by index."""
return self._list[i]
def __iter__(self):
"""Iterate through the recorded warnings."""
return iter(self._list)
def __len__(self):
"""The number of recorded warnings."""
return len(self._list)
def pop(self, cls=Warning):
"""Pop the first recorded warning, raise exception if not exists."""
for i, w in enumerate(self._list):
if issubclass(w.category, cls):
return self._list.pop(i)
__tracebackhide__ = True
raise AssertionError("%r not found in warning list" % cls)
def clear(self):
"""Clear the list of recorded warnings."""
self._list[:] = []
def __enter__(self):
if self._entered:
__tracebackhide__ = True
raise RuntimeError("Cannot enter %r twice" % self)
self._list = super(WarningsRecorder, self).__enter__()
warnings.simplefilter('always')
return self
def __exit__(self, *exc_info):
if not self._entered:
__tracebackhide__ = True
raise RuntimeError("Cannot exit %r without entering first" % self)
super(WarningsRecorder, self).__exit__(*exc_info)
class WarningsChecker(WarningsRecorder):
def __init__(self, expected_warning=None, match_expr=None):
super(WarningsChecker, self).__init__()
msg = ("exceptions must be old-style classes or "
"derived from Warning, not %s")
if isinstance(expected_warning, tuple):
for exc in expected_warning:
if not inspect.isclass(exc):
raise TypeError(msg % type(exc))
elif inspect.isclass(expected_warning):
expected_warning = (expected_warning,)
elif expected_warning is not None:
raise TypeError(msg % type(expected_warning))
self.expected_warning = expected_warning
self.match_expr = match_expr
def __exit__(self, *exc_info):
super(WarningsChecker, self).__exit__(*exc_info)
# only check if we're not currently handling an exception
if all(a is None for a in exc_info):
if self.expected_warning is not None:
if not any(issubclass(r.category, self.expected_warning)
for r in self):
__tracebackhide__ = True
fail("DID NOT WARN. No warnings of type {0} was emitted. "
"The list of emitted warnings is: {1}.".format(
self.expected_warning,
[each.message for each in self]))
elif self.match_expr is not None:
for r in self:
if issubclass(r.category, self.expected_warning):
if re.compile(self.match_expr).search(str(r.message)):
break
else:
fail("DID NOT WARN. No warnings of type {0} matching"
" ('{1}') was emitted. The list of emitted warnings"
" is: {2}.".format(self.expected_warning, self.match_expr,
[each.message for each in self]))
| {
"content_hash": "788d49049d83c8b71040a5db5bd88be5",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 104,
"avg_line_length": 36.291845493562235,
"alnum_prop": 0.5956717123935666,
"repo_name": "tareqalayan/pytest",
"id": "ab0f79c75baa920d9e730fdaff6eb59b49a37cbf",
"size": "8456",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_pytest/recwarn.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "568"
},
{
"name": "Python",
"bytes": "1554146"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<!--<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />-->
<link rel="stylesheet" type="text/css" href="css/index.css" />
<meta name="msapplication-tap-highlight" content="no" />
<title>ALL PLUGINS</title>
<link rel="stylesheet" media="not screen and (device-width: 1200px) and (device-height: 900px)"
href="lib/sugar-web/graphics/css/sugar-96dpi.css">
<link rel="stylesheet" media="screen and (device-width: 1200px) and (device-height: 900px)"
href="lib/sugar-web/graphics/css/sugar-200dpi.css">
<link rel="stylesheet" href="css/activity.css">
<script data-main="js/loader" src="lib/require.js"></script>
</head>
<body>
<div id="main-toolbar" class="toolbar">
<button class="toolbutton" id="activity-button" title="My Activity"></button>
<button class="toolbutton" id="accelerometer_plugin" title="Accelerometer Plugin" onclick="show_accelerometer()"></button>
<button class="toolbutton" id="camera_plugin" title="Camera Plugin" onclick="show_camera()"></button>
<button class="toolbutton" id="dialog_plugin" title="Dialog Plugin" onclick="show_dialog()"></button>
<button class="toolbutton" id="device_plugin" title="Device Plugin" onclick="show_device()"></button>
<button class="toolbutton" id="network_plugin" title="Network Plugin" onclick="show_network()"></button>
<button class="toolbutton" id="globalization_plugin" title="Globalization Plugin" onclick="show_globalization()"></button>
<!-- Buttons with class="pull-right" will be right aligned -->
<button class="toolbutton pull-right" id="stop-button" title="Stop"></button>
</div>
<div id="canvas">
<div class="app" id="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
<p class="event notcompatible">Device not compatible</p>
</div>
</div>
<div id="accelerometer">
<h1>ACCELEROMETER</h1><br><br>
<button onclick="navigator.accelerometer.getCurrentAcceleration(onSuccess_accelerometer1, onError_accelerometer1);">Accelerometer - Test 1 </button> navigator.accelerometer.getCurrentAcceleration - Get the current acceleration along the _x_, _y_, and _z_ axes.
<br><br>
<button onclick="startWatch();">Accelerometer - Test 2 </button>navigator.accelerometer.watchAcceleration - Retrieves the device's current `Acceleration` at a regular interval, executing
the `accelerometerSuccess` callback function each time.
<br>
<div id="accelerometervalue"></div>
<br><br>
<button onclick="stopWatch();">Accelerometer - Test 3 </button> navigator.accelerometer.clearWatch - Stop watching the `Acceleration` referenced by the `watchID` parameter.
<br><br>
</div>
<div id="camera">
<h1>CAMERA</h1><br><br>
<button onclick="getPicture1()">Camera - Test 1 </button> get picture from journal
<br><br>
<button onclick="getPicture2()">Camera - Test 2 </button> get the picture from camera
<br>
<img id="myImage" width="250px" height="250px"></img>
<br><br>
</div>
<div id="dialog">
<h1>DIALOG PLUGIN</h1><br><br>
<button onclick="navigator.notification.alert('You are the winner!',alertDismissed,'Game Over','Done');">Dialog - Test 1 </button> navigator.notification.alert(message, alertCallback, [title], [buttonName]) :<br> message: Dialog message (String), alertCallback : Callback to invoke when alert dialog is dismissed (Function), <br>title: Dialog title(String) (Optional, defaults to `Alert`),<br> buttonName: Button name (String) (Optional, defaults to `OK`)
<br><br>
<button onclick="navigator.notification.confirm('You are the winner!',onConfirm,'Game Over',['Restart','Exit']);">Dialog - Test 2 </button>navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) - <br> message: Dialog message (String), <br> confirmCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0) (Function),<br> title: Dialog title (String)(Optional, defaults to `Confirm`) <br> buttonLabels: Array of strings specifying button labels(Array)(Optional, defaults to [`OK,Cancel`])
<br><br>
<button onclick="navigator.notification.prompt('Please enter your name',onPrompt,'Registration',['Ok','Exit'],'Jane Doe');">Dialog - Test 2 </button> navigator.notification.prompt - Displays a native dialog box that is more customizable than the browser's `prompt` function - navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) :: message:<br> Dialog message.(String) ; <br>promptCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). (Function);<br> title: Dialog title(String) (Optional, defaults to `Prompt`) ;<br> buttonLabels: Array of strings specifying button labels (Array) (Optional, defaults to `["OK","Cancel"]`); <br> defaultText: Default textbox input value (`String`) (Optional, Default: empty string)
<br><br>
</div>
<div id="device">
<h1>DEVICE</h1><br><br>
<p id="deviceProperties">Loading device properties...</p><br>
It defines a global object device with the following properties :
<br>device.model : Get the hardware model from the gio ssettings
<br> device.cordova: the version of cordova
<br> device.platform: returns 'sugar'
<br> device.uuid:returns the serial number
<br> device.version:version of sugar
<br><br>
</div>
<div id="network">
<h1>NETWORK CONNECTION</h1><br><br>
<button onclick="checkConnection()">Network connection - Test 1 </button> The `connection` object, exposed via `navigator.connection`, provides information about the device's cellular and wifi connection.
<br><br>
</div>
<div id="globalization">
<h1>GLOBALIZATION</h1><br><br>
<button onclick="navigator.globalization.getPreferredLanguage(function (language) {alert('language: ' + language.value + '\n');},function () {alert('Error getting language\n');});">Globalization - Test 1 </button> navigator.globalization.getPreferredLanguage. Get the BCP 47 language tag for the client's current language.
<br><br>
<button onclick="navigator.globalization.getLocaleName(function (locale) {alert('locale: ' + locale.value + '\n');},function () {alert('Error getting locale\n');});">Globalization - Test 2 </button> navigator.globalization.getLocaleName. Returns the BCP 47 compliant tag for the client's current locale setting.
<br><br>
</div>
</div>
<script type="text/javascript" src="../../cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/init.js"></script>
</body>
</html>
| {
"content_hash": "368ee1a9f957481d49166d15882c0956",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 837,
"avg_line_length": 54.47019867549669,
"alnum_prop": 0.6909422492401216,
"repo_name": "samswag/sugarizer",
"id": "ebb69cb0d3a2224f41843fa4b138b30e9408d8fc",
"size": "8225",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "activities/Cordova.activity/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "141"
},
{
"name": "CSS",
"bytes": "850854"
},
{
"name": "CoffeeScript",
"bytes": "78585"
},
{
"name": "Gettext Catalog",
"bytes": "646"
},
{
"name": "HTML",
"bytes": "484778"
},
{
"name": "JavaScript",
"bytes": "7641990"
},
{
"name": "Makefile",
"bytes": "1933"
},
{
"name": "Python",
"bytes": "14643"
},
{
"name": "Shell",
"bytes": "286"
}
],
"symlink_target": ""
} |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.09.09 at 01:22:27 PM CEST
//
package test;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="content-type" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "fax")
public class Fax {
@XmlValue
protected String content;
@XmlAttribute(name = "content-type")
@XmlSchemaType(name = "anySimpleType")
protected String contentType;
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
/**
* Gets the value of the contentType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContentType() {
return contentType;
}
/**
* Sets the value of the contentType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContentType(String value) {
this.contentType = value;
}
}
| {
"content_hash": "c55a0443504b53bcbce9ceac8165585d",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 124,
"avg_line_length": 24.632653061224488,
"alnum_prop": 0.6230323115161558,
"repo_name": "BlueBrain/bluima",
"id": "be07ec59aa9e046196c4a44a878d0c0d52e1f5ae",
"size": "2414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/bluima_xml/src/test/Fax.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "962"
},
{
"name": "C",
"bytes": "84537"
},
{
"name": "CSS",
"bytes": "61917"
},
{
"name": "Groff",
"bytes": "2511"
},
{
"name": "HTML",
"bytes": "240735"
},
{
"name": "Java",
"bytes": "15064102"
},
{
"name": "JavaScript",
"bytes": "365145"
},
{
"name": "Makefile",
"bytes": "964"
},
{
"name": "Matlab",
"bytes": "587"
},
{
"name": "Perl",
"bytes": "9852"
},
{
"name": "Python",
"bytes": "910928"
},
{
"name": "R",
"bytes": "16070"
},
{
"name": "Scala",
"bytes": "117040"
},
{
"name": "Shell",
"bytes": "1481466"
},
{
"name": "Tcl",
"bytes": "15"
},
{
"name": "TeX",
"bytes": "61732"
},
{
"name": "Web Ontology Language",
"bytes": "6749276"
},
{
"name": "XSLT",
"bytes": "19324"
}
],
"symlink_target": ""
} |
// Copyright 2006 Nemanja Trifunovic
#ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include <iterator>
namespace utf8
{
// The typedefs for 8-bit, 16-bit and 32-bit unsigned integers
// You may need to change them to match your system.
// These typedefs have the same names as ones from cstdint, or boost/cstdint
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
// Helper code - not intended to be directly called by the library users. May be changed at any time
namespace internal
{
// Unicode constants
// Leading (high) surrogates: 0xd800 - 0xdbff
// Trailing (low) surrogates: 0xdc00 - 0xdfff
const uint16_t LEAD_SURROGATE_MIN = 0xd800u;
const uint16_t LEAD_SURROGATE_MAX = 0xdbffu;
const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u;
const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu;
const uint16_t LEAD_OFFSET = LEAD_SURROGATE_MIN - (0x10000 >> 10);
const uint32_t SURROGATE_OFFSET = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN;
// Maximum valid value for a Unicode code point
const uint32_t CODE_POINT_MAX = 0x0010ffffu;
template<typename octet_type>
inline uint8_t mask8(octet_type oc)
{
return static_cast<uint8_t>(0xff & oc);
}
template<typename u16_type>
inline uint16_t mask16(u16_type oc)
{
return static_cast<uint16_t>(0xffff & oc);
}
template<typename octet_type>
inline bool is_trail(octet_type oc)
{
return ((utf8::internal::mask8(oc) >> 6) == 0x2);
}
template <typename u16>
inline bool is_lead_surrogate(u16 cp)
{
return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX);
}
template <typename u16>
inline bool is_trail_surrogate(u16 cp)
{
return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
}
template <typename u16>
inline bool is_surrogate(u16 cp)
{
return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
}
template <typename u32>
inline bool is_code_point_valid(u32 cp)
{
return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp));
}
template <typename octet_iterator>
inline typename std::iterator_traits<octet_iterator>::difference_type
sequence_length(octet_iterator lead_it)
{
uint8_t lead = utf8::internal::mask8(*lead_it);
if (lead < 0x80)
return 1;
else if ((lead >> 5) == 0x6)
return 2;
else if ((lead >> 4) == 0xe)
return 3;
else if ((lead >> 3) == 0x1e)
return 4;
else
return 0;
}
template <typename octet_difference_type>
inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length)
{
if (cp < 0x80) {
if (length != 1)
return true;
}
else if (cp < 0x800) {
if (length != 2)
return true;
}
else if (cp < 0x10000) {
if (length != 3)
return true;
}
return false;
}
enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT};
/// Helper for get_sequence_x
template <typename octet_iterator>
utf_error increase_safely(octet_iterator& it, octet_iterator end)
{
if (++it == end)
return NOT_ENOUGH_ROOM;
if (!utf8::internal::is_trail(*it))
return INCOMPLETE_SEQUENCE;
return UTF8_OK;
}
#define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;}
/// get_sequence_x functions decode utf-8 sequences of the length x
template <typename octet_iterator>
utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
return UTF8_OK;
}
template <typename octet_iterator>
utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f);
return UTF8_OK;
}
template <typename octet_iterator>
utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point += (*it) & 0x3f;
return UTF8_OK;
}
template <typename octet_iterator>
utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point += (utf8::internal::mask8(*it) << 6) & 0xfff;
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point += (*it) & 0x3f;
return UTF8_OK;
}
#undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR
template <typename octet_iterator>
utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
// Save the original value of it so we can go back in case of failure
// Of course, it does not make much sense with i.e. stream iterators
octet_iterator original_it = it;
uint32_t cp = 0;
// Determine the sequence length based on the lead octet
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
const octet_difference_type length = utf8::internal::sequence_length(it);
// Get trail octets and calculate the code point
utf_error err = UTF8_OK;
switch (length) {
case 0:
return INVALID_LEAD;
case 1:
err = utf8::internal::get_sequence_1(it, end, cp);
break;
case 2:
err = utf8::internal::get_sequence_2(it, end, cp);
break;
case 3:
err = utf8::internal::get_sequence_3(it, end, cp);
break;
case 4:
err = utf8::internal::get_sequence_4(it, end, cp);
break;
}
if (err == UTF8_OK) {
// Decoding succeeded. Now, security checks...
if (utf8::internal::is_code_point_valid(cp)) {
if (!utf8::internal::is_overlong_sequence(cp, length)){
// Passed! Return here.
code_point = cp;
++it;
return UTF8_OK;
}
else
err = OVERLONG_SEQUENCE;
}
else
err = INVALID_CODE_POINT;
}
// Failure branch - restore the original value of the iterator
it = original_it;
return err;
}
template <typename octet_iterator>
inline utf_error validate_next(octet_iterator& it, octet_iterator end) {
uint32_t ignored;
return utf8::internal::validate_next(it, end, ignored);
}
} // namespace internal
/// The library API - functions intended to be called by the users
// Byte order mark
const uint8_t bom[] = {0xef, 0xbb, 0xbf};
const uint8_t bom16be[] = {0xfe, 0xff};
const uint8_t bom16le[] = {0xff, 0xfe};
const uint8_t bom32be[] = {0, 0, 0xfe, 0xff};
const uint8_t bom32le[] = {0xff, 0xfe, 0, 0};
template <typename octet_iterator>
octet_iterator find_invalid(octet_iterator start, octet_iterator end)
{
octet_iterator result = start;
while (result != end) {
utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end);
if (err_code != internal::UTF8_OK)
return result;
}
return result;
}
template <typename octet_iterator>
inline bool is_valid(octet_iterator start, octet_iterator end)
{
return (utf8::find_invalid(start, end) == end);
}
template <typename octet_iterator>
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
{
return (
((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) &&
((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) &&
((it != end) && (utf8::internal::mask8(*it)) == bom[2])
);
}
template <typename octet_iterator>
inline bool starts_with_bom (octet_iterator it, octet_iterator end,
const uint8_t* bom16or32, unsigned bomlen)
{
for (unsigned i = 0; i < bomlen; i++) {
if (it == end || (utf8::internal::mask8(*it++)) != bom16or32[i])
return false;
}
return true;
}
//Deprecated in release 2.3
template <typename octet_iterator>
inline bool is_bom (octet_iterator it)
{
return (
(utf8::internal::mask8(*it++)) == bom[0] &&
(utf8::internal::mask8(*it++)) == bom[1] &&
(utf8::internal::mask8(*it)) == bom[2]
);
}
} // namespace utf8
#endif // header guard
| {
"content_hash": "75d735a373a88089465aa2fdcccfdcd0",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 138,
"avg_line_length": 31.024844720496894,
"alnum_prop": 0.568968968968969,
"repo_name": "wangjianxue/TouchVG",
"id": "0d1676f26b996a8864ffe4530a77c163c7020065",
"size": "11275",
"binary": false,
"copies": "6",
"ref": "refs/heads/develop",
"path": "core/src/jsonstorage/utf8_core.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "45276"
},
{
"name": "C#",
"bytes": "1389246"
},
{
"name": "C++",
"bytes": "3932266"
},
{
"name": "Java",
"bytes": "957845"
},
{
"name": "Makefile",
"bytes": "23048"
},
{
"name": "Objective-C",
"bytes": "41346"
},
{
"name": "Objective-C++",
"bytes": "119233"
},
{
"name": "Python",
"bytes": "3239"
},
{
"name": "Shell",
"bytes": "4402"
}
],
"symlink_target": ""
} |
package org.meltwater.amanze.spellchecker;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
public class SpellChecker {
private static Hashtable<String, String> dictionary;
private static FileWriter fw;
private static BufferedWriter bw;
public static void main(String[] args){
dictionary = new Hashtable<String, String>();
long startTime = System.nanoTime();
loadDictionary(args[1]);
loadFile(args[0]);
long endTime = System.nanoTime();
long duration = (endTime - startTime);
System.out.println("Time spent: " + duration/1000000 + " ms");
}
/*
* loads the dictionary provided through the console parameters
*/
private static void loadDictionary(String dic){
try {
BufferedReader reader = new BufferedReader(new FileReader(new File("src/org/meltwater/amanze/spellchecker/"+dic)));
String rawLine;
while ((rawLine = reader.readLine()) != null) {
String word = rawLine.toLowerCase().trim();
dictionary.put(word, word);
}
System.out.println("Done reading dictionary: src/org/meltwater/amanze/spellchecker/"+dic);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/*
* returns a permutation of scrambled arrangements of the text which is not in the dictionary
*/
private final static ArrayList<String> edits(String word) {
ArrayList<String> result = new ArrayList<String>();
for(int i=0; i < word.length(); ++i)
result.add(word.substring(0, i) + word.substring(i+1));
for(int i=0; i < word.length()-1; ++i)
result.add(word.substring(0, i) + word.substring(i+1, i+2) + word.substring(i, i+1) + word.substring(i+2));
for(int i=0; i < word.length(); ++i)
for(char c='a'; c <= 'z'; ++c)
result.add(word.substring(0, i) + String.valueOf(c) + word.substring(i+1));
for(int i=0; i <= word.length(); ++i)
for(char c='a'; c <= 'z'; ++c)
result.add(word.substring(0, i) + String.valueOf(c) + word.substring(i));
return result;
}
/*The method gets various forms of a word and chooses the one that closely fits the one queried
*/
private static String correct(String word) {
ArrayList<String> list = edits(word);
HashMap<String, String> candidates = new HashMap<String, String>();
for(String s : list)
if(dictionary.containsKey(s)) candidates.put(dictionary.get(s),s);
if(candidates.size() > 0)
return candidates.get(Collections.max(candidates.keySet()));
for(String s : list)
for(String w : edits(s))
if(dictionary.containsKey(w)) candidates.put(dictionary.get(w),w);
return candidates.size() > 0 ? candidates.get(Collections.max(candidates.keySet())) : word;
}
/*
* loads the sample document for spell-checking
*/
private static void loadFile(String document){
try {
initOutput();
BufferedReader reader = new BufferedReader(new FileReader(new File("src/org/meltwater/amanze/spellchecker/"+document)));
String rawLine;
while ((rawLine = reader.readLine()) != null) {
String[] words = rawLine.split(" ");
for (String word : words) {
boolean isCapitalized = !(word.equals(word.toLowerCase()));
word = word.toLowerCase();
if (dictionary.contains(word) || word.matches(".*[.,()]")) {
bw.write((isCapitalized ? capitalize(word) : word)+" ");
}else{
String out = correct(word);
bw.write((isCapitalized ? capitalize(out) : out)+ " ");
}
}
bw.newLine();
}
bw.close();
System.out.println("Done loading document src/org/meltwater/amanze/spellchecker/"+document);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static String capitalize(final String line) {
return Character.toUpperCase(line.charAt(0)) + line.substring(1);
}
/*
* The method initializes the FileWriter and BufferedWriter objects for out output
*/
private static void initOutput(){
File file = new File("src/org/meltwater/amanze/spellchecker/document-corrected.txt");
try {
if (!file.exists())
file.createNewFile();
fw = new FileWriter(file.getAbsoluteFile());
bw = new BufferedWriter(fw);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| {
"content_hash": "1142713bc8893cd188a12eaa0f0e454e",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 123,
"avg_line_length": 34.036764705882355,
"alnum_prop": 0.6517606394469648,
"repo_name": "darlingtonamz/SpellChecker",
"id": "f09666c27fd2d80651db62476762ea841c7c7ea1",
"size": "4629",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/meltwater/amanze/spellchecker/SpellChecker.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "4629"
}
],
"symlink_target": ""
} |
#include "config.h"
#include "gom/gomjsmouseevent.h"
#include "gom/dom/gomdomexception.h"
#include "gom/dom/gommouseevent.h"
#include "gom/gomjsexception.h"
#include "gom/gomjsobject.h"
#include "gom/gomjsuievent.h"
#include "gommacros.h"
#include <glib.h>
static void
gom_js_mouse_event_finalize (JSContext *cx, JSObject *obj)
{
GomJSUIEventClass.finalize (cx, obj);
}
JSClass GomJSMouseEventClass = {
"MouseEvent", JSCLASS_NEW_ENUMERATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
(JSEnumerateOp)gom_js_object_enumerate,
JS_ResolveStub,
JS_ConvertStub,
gom_js_mouse_event_finalize
};
static JSPropertySpec gom_js_mouse_event_props[] = { { NULL } };
static JSBool
gom_js_event_init_mouse_event (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
GOM_JS_NOT_IMPLEMENTED (cx);
return JS_FALSE;
}
static JSBool
gom_js_event_get_modifier_state (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
GOM_JS_NOT_IMPLEMENTED (cx);
return JS_FALSE;
}
static JSBool
gom_js_event_init_mouse_event_ns (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
GOM_JS_NOT_IMPLEMENTED (cx);
return JS_FALSE;
}
static JSFunctionSpec gom_js_mouse_event_funcs[] = {
{ "initMouseEvent", gom_js_event_init_mouse_event, 15 },
{ "getModifierState", gom_js_event_get_modifier_state, 1 },
{ "initMouseEventNS", gom_js_event_init_mouse_event_ns, 16 },
{ NULL }
};
static JSBool
gom_js_mouse_event_construct (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_TRUE;
}
JSObject *
gom_js_mouse_event_init_class (JSContext *cx, JSObject *obj)
{
gom_js_object_register_js_class (cx, GOM_TYPE_MOUSE_EVENT, &GomJSMouseEventClass);
return JS_InitClass (cx, obj,
JS_ConstructObject (cx, &GomJSUIEventClass, NULL, NULL),
&GomJSMouseEventClass, gom_js_mouse_event_construct, 0,
gom_js_mouse_event_props, gom_js_mouse_event_funcs, NULL, NULL);
}
| {
"content_hash": "c370bb5eeaa9d19ebe3427b7bab91046",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 101,
"avg_line_length": 26.60759493670886,
"alnum_prop": 0.6779257849666984,
"repo_name": "jberkman/gom",
"id": "a42a04501f87628c389054600b53a6c510a62935",
"size": "3202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/libgom/gomjsmouseevent.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "756229"
},
{
"name": "C++",
"bytes": "239960"
},
{
"name": "JavaScript",
"bytes": "8744"
},
{
"name": "Shell",
"bytes": "2405"
}
],
"symlink_target": ""
} |
<?php
require_once ("../Includes/simplecms-config.php");
require_once ("../Includes/connectDB.php");
require_once ("../Includes/session.php");
//判断用户是否登录
$totalCount = 0;
$totalPage = 0;
if (isset($_GET['pageNum']) && isset($_GET['pageSize']) && isset($_GET['newsCategoryId'])) {
$pageNum = intval($_GET['pageNum']);
$pageSize = intval($_GET['pageSize']);
$sWhere=$_GET['newsCategoryId']==0?'':" WHERE news_category_id=" .$_GET['newsCategoryId'];
$startIndex = $pageNum == 1 ? 0 : ($pageNum - 1) * $pageSize;
$sLimit = ' LIMIT ' . $startIndex . "," . $pageSize;
$query = "SELECT * FROM news"
. $sWhere
. $sLimit;
$statement = $databaseConnection->prepare($query);
$statement->execute();
$statement->bind_result($newsId, $newsTitle, $newsContent, $newsCategoryId);
$data_array = [];
$page_arry = [];
while ($statement->fetch()) {
$row = array(
"id" => $newsId,
"title" => $newsTitle,
"category_id" => $newsCategoryId
);
array_push($page_arry, $row);
}
$totalQuery = "SELECT COUNT(*)"
. " FROM news"
. $sWhere;
$totalStatement = $databaseConnection->prepare($totalQuery);
$totalStatement->execute();
$totalStatement->bind_result($totalCount);
$totalArray = $totalStatement->fetch();
$totalPage = $totalCount % $pageSize == 0 ? ($totalCount / $pageSize) : (floor($totalCount / $pageSize) + 1);
$data_array = array(
"list" => $page_arry,
"totalCount" => $totalCount,
"totalPage" => $totalPage
);
$meta_arr = array("success" => true, "message" => "ok");
$result_array = array('meta' => $meta_arr, 'data' => $data_array);
echo json_encode($result_array);
$statement->close();
mysqli_close($databaseConnection);
//c lose database;
}
?> | {
"content_hash": "b81f32fe41cca3669e7b7a386cedd8ff",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 113,
"avg_line_length": 21.355555555555554,
"alnum_prop": 0.554630593132154,
"repo_name": "cmssfe/tushuguan",
"id": "9b6ff94a9b0bf62c0481dc40300831d137c58938",
"size": "1938",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/news_list.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "124485"
},
{
"name": "HTML",
"bytes": "73057"
},
{
"name": "JavaScript",
"bytes": "465024"
},
{
"name": "PHP",
"bytes": "49500"
}
],
"symlink_target": ""
} |
import {Component, Input} from '@angular/core';
@Component({
selector: 'inner',
template: `<p>{{val}}`
})
export class InnerComponent {
@Input() val:number;
}
| {
"content_hash": "97d32038d3097a29e24c80a4cc4e875d",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 18.444444444444443,
"alnum_prop": 0.6506024096385542,
"repo_name": "msfrisbie/angular-2-cookbook",
"id": "cd5133d16d8b6d17fbd7743574ea3d18b75ebae8",
"size": "166",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Chapter-05/4112/How-to-do-it/app/inner.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "48482"
},
{
"name": "JavaScript",
"bytes": "203724"
},
{
"name": "TypeScript",
"bytes": "146465"
}
],
"symlink_target": ""
} |
// Copyright (c) 2016-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <versionbits.h>
#include <consensus/params.h>
ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const
{
int nPeriod = Period(params);
int nThreshold = Threshold(params);
int min_activation_height = MinActivationHeight(params);
int64_t nTimeStart = BeginTime(params);
int64_t nTimeTimeout = EndTime(params);
// Check if this deployment is always active.
if (nTimeStart == Consensus::BIP9Deployment::ALWAYS_ACTIVE) {
return ThresholdState::ACTIVE;
}
// Check if this deployment is never active.
if (nTimeStart == Consensus::BIP9Deployment::NEVER_ACTIVE) {
return ThresholdState::FAILED;
}
// A block's state is always the same as that of the first of its period, so it is computed based on a pindexPrev whose height equals a multiple of nPeriod - 1.
if (pindexPrev != nullptr) {
pindexPrev = pindexPrev->GetAncestor(pindexPrev->nHeight - ((pindexPrev->nHeight + 1) % nPeriod));
}
// Walk backwards in steps of nPeriod to find a pindexPrev whose information is known
std::vector<const CBlockIndex*> vToCompute;
while (cache.count(pindexPrev) == 0) {
if (pindexPrev == nullptr) {
// The genesis block is by definition defined.
cache[pindexPrev] = ThresholdState::DEFINED;
break;
}
if (pindexPrev->GetMedianTimePast() < nTimeStart) {
// Optimization: don't recompute down further, as we know every earlier block will be before the start time
cache[pindexPrev] = ThresholdState::DEFINED;
break;
}
vToCompute.push_back(pindexPrev);
pindexPrev = pindexPrev->GetAncestor(pindexPrev->nHeight - nPeriod);
}
// At this point, cache[pindexPrev] is known
assert(cache.count(pindexPrev));
ThresholdState state = cache[pindexPrev];
// Now walk forward and compute the state of descendants of pindexPrev
while (!vToCompute.empty()) {
ThresholdState stateNext = state;
pindexPrev = vToCompute.back();
vToCompute.pop_back();
switch (state) {
case ThresholdState::DEFINED: {
if (pindexPrev->GetMedianTimePast() >= nTimeStart) {
stateNext = ThresholdState::STARTED;
}
break;
}
case ThresholdState::STARTED: {
// We need to count
const CBlockIndex* pindexCount = pindexPrev;
int count = 0;
for (int i = 0; i < nPeriod; i++) {
if (Condition(pindexCount, params)) {
count++;
}
pindexCount = pindexCount->pprev;
}
if (count >= nThreshold) {
stateNext = ThresholdState::LOCKED_IN;
} else if (pindexPrev->GetMedianTimePast() >= nTimeTimeout) {
stateNext = ThresholdState::FAILED;
}
break;
}
case ThresholdState::LOCKED_IN: {
// Progresses into ACTIVE provided activation height will have been reached.
if (pindexPrev->nHeight + 1 >= min_activation_height) {
stateNext = ThresholdState::ACTIVE;
}
break;
}
case ThresholdState::FAILED:
case ThresholdState::ACTIVE: {
// Nothing happens, these are terminal states.
break;
}
}
cache[pindexPrev] = state = stateNext;
}
return state;
}
BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params, std::vector<bool>* signalling_blocks) const
{
BIP9Stats stats = {};
stats.period = Period(params);
stats.threshold = Threshold(params);
if (pindex == nullptr) return stats;
// Find how many blocks are in the current period
int blocks_in_period = 1 + (pindex->nHeight % stats.period);
// Reset signalling_blocks
if (signalling_blocks) {
signalling_blocks->assign(blocks_in_period, false);
}
// Count from current block to beginning of period
int elapsed = 0;
int count = 0;
const CBlockIndex* currentIndex = pindex;
do {
++elapsed;
--blocks_in_period;
if (Condition(currentIndex, params)) {
++count;
if (signalling_blocks) signalling_blocks->at(blocks_in_period) = true;
}
currentIndex = currentIndex->pprev;
} while(blocks_in_period > 0);
stats.elapsed = elapsed;
stats.count = count;
stats.possible = (stats.period - stats.threshold ) >= (stats.elapsed - count);
return stats;
}
int AbstractThresholdConditionChecker::GetStateSinceHeightFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const
{
int64_t start_time = BeginTime(params);
if (start_time == Consensus::BIP9Deployment::ALWAYS_ACTIVE || start_time == Consensus::BIP9Deployment::NEVER_ACTIVE) {
return 0;
}
const ThresholdState initialState = GetStateFor(pindexPrev, params, cache);
// BIP 9 about state DEFINED: "The genesis block is by definition in this state for each deployment."
if (initialState == ThresholdState::DEFINED) {
return 0;
}
const int nPeriod = Period(params);
// A block's state is always the same as that of the first of its period, so it is computed based on a pindexPrev whose height equals a multiple of nPeriod - 1.
// To ease understanding of the following height calculation, it helps to remember that
// right now pindexPrev points to the block prior to the block that we are computing for, thus:
// if we are computing for the last block of a period, then pindexPrev points to the second to last block of the period, and
// if we are computing for the first block of a period, then pindexPrev points to the last block of the previous period.
// The parent of the genesis block is represented by nullptr.
pindexPrev = pindexPrev->GetAncestor(pindexPrev->nHeight - ((pindexPrev->nHeight + 1) % nPeriod));
const CBlockIndex* previousPeriodParent = pindexPrev->GetAncestor(pindexPrev->nHeight - nPeriod);
while (previousPeriodParent != nullptr && GetStateFor(previousPeriodParent, params, cache) == initialState) {
pindexPrev = previousPeriodParent;
previousPeriodParent = pindexPrev->GetAncestor(pindexPrev->nHeight - nPeriod);
}
// Adjust the result because right now we point to the parent block.
return pindexPrev->nHeight + 1;
}
namespace
{
/**
* Class to implement versionbits logic.
*/
class VersionBitsConditionChecker : public AbstractThresholdConditionChecker {
private:
const Consensus::DeploymentPos id;
protected:
int64_t BeginTime(const Consensus::Params& params) const override { return params.vDeployments[id].nStartTime; }
int64_t EndTime(const Consensus::Params& params) const override { return params.vDeployments[id].nTimeout; }
int MinActivationHeight(const Consensus::Params& params) const override { return params.vDeployments[id].min_activation_height; }
int Period(const Consensus::Params& params) const override { return params.nMinerConfirmationWindow; }
int Threshold(const Consensus::Params& params) const override { return params.nRuleChangeActivationThreshold; }
bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override
{
return (((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && (pindex->nVersion & Mask(params)) != 0);
}
public:
explicit VersionBitsConditionChecker(Consensus::DeploymentPos id_) : id(id_) {}
uint32_t Mask(const Consensus::Params& params) const { return ((uint32_t)1) << params.vDeployments[id].bit; }
};
} // namespace
ThresholdState VersionBitsCache::State(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos)
{
LOCK(m_mutex);
return VersionBitsConditionChecker(pos).GetStateFor(pindexPrev, params, m_caches[pos]);
}
BIP9Stats VersionBitsCache::Statistics(const CBlockIndex* pindex, const Consensus::Params& params, Consensus::DeploymentPos pos, std::vector<bool>* signalling_blocks)
{
return VersionBitsConditionChecker(pos).GetStateStatisticsFor(pindex, params, signalling_blocks);
}
int VersionBitsCache::StateSinceHeight(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos)
{
LOCK(m_mutex);
return VersionBitsConditionChecker(pos).GetStateSinceHeightFor(pindexPrev, params, m_caches[pos]);
}
uint32_t VersionBitsCache::Mask(const Consensus::Params& params, Consensus::DeploymentPos pos)
{
return VersionBitsConditionChecker(pos).Mask(params);
}
int32_t VersionBitsCache::ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Params& params)
{
LOCK(m_mutex);
int32_t nVersion = VERSIONBITS_TOP_BITS;
for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
Consensus::DeploymentPos pos = static_cast<Consensus::DeploymentPos>(i);
ThresholdState state = VersionBitsConditionChecker(pos).GetStateFor(pindexPrev, params, m_caches[pos]);
if (state == ThresholdState::LOCKED_IN || state == ThresholdState::STARTED) {
nVersion |= Mask(params, pos);
}
}
return nVersion;
}
void VersionBitsCache::Clear()
{
LOCK(m_mutex);
for (unsigned int d = 0; d < Consensus::MAX_VERSION_BITS_DEPLOYMENTS; d++) {
m_caches[d].clear();
}
}
| {
"content_hash": "4823b7ee690ca7cb0214f242ddc9f118",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 170,
"avg_line_length": 40.552845528455286,
"alnum_prop": 0.6679029671210907,
"repo_name": "achow101/bitcoin",
"id": "7a297c2bbb63e78b2cd7992cd4bc17cd2b52c6af",
"size": "9976",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/versionbits.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "28178"
},
{
"name": "Batchfile",
"bytes": "13"
},
{
"name": "C",
"bytes": "1225820"
},
{
"name": "C++",
"bytes": "9615124"
},
{
"name": "CMake",
"bytes": "29132"
},
{
"name": "Cap'n Proto",
"bytes": "1256"
},
{
"name": "Dockerfile",
"bytes": "1721"
},
{
"name": "HTML",
"bytes": "21833"
},
{
"name": "Java",
"bytes": "541"
},
{
"name": "M4",
"bytes": "237973"
},
{
"name": "Makefile",
"bytes": "141372"
},
{
"name": "Objective-C++",
"bytes": "5497"
},
{
"name": "Python",
"bytes": "2718039"
},
{
"name": "QMake",
"bytes": "438"
},
{
"name": "Sage",
"bytes": "56897"
},
{
"name": "Scheme",
"bytes": "24332"
},
{
"name": "Shell",
"bytes": "207137"
}
],
"symlink_target": ""
} |
@implementation UIView (XYSExtension)
-(void)setXys_x:(CGFloat)xys_x
{
CGRect frame = self.frame;
frame.origin.x = xys_x;
self.frame = frame;
}
-(CGFloat)xys_x
{
return self.frame.origin.x;
}
-(void)setXys_y:(CGFloat)xys_y
{
CGRect frame = self.frame;
frame.origin.y = xys_y;
self.frame = frame;
}
-(CGFloat)xys_y
{
return self.frame.origin.y;
}
-(void)setXys_size:(CGSize)xys_size
{
CGRect frame = self.frame;
frame.size.width = xys_size.width;
frame.size.height = xys_size.height;
self.frame = frame;
}
-(CGSize)xys_size
{
return self.frame.size;
}
-(void)setXys_height:(CGFloat)xys_height
{
CGRect frame = self.frame;
frame.size.height = xys_height;
self.frame = frame;
}
-(CGFloat)xys_height
{
return self.frame.size.height;
}
-(void)setXys_width:(CGFloat)xys_width
{
CGRect frame = self.frame;
frame.size.width= xys_width;
self.frame = frame;
}
-(CGFloat)xys_width
{
return self.frame.size.width;
}
-(void)setXys_centerX:(CGFloat)xys_centerX
{
CGPoint center = self.center;
center.x = xys_centerX;
self.center = center;
}
-(void)setXys_centerY:(CGFloat)xys_centerY
{
CGPoint center = self.center;
center.y = xys_centerY;
self.center = center;
}
-(CGFloat)xys_centerX
{
return self.center.x;
}
-(CGFloat)xys_centerY
{
return self.center.y;
}
-(BOOL)isOnCurrentScreen
{
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
CGRect newFrame = [self.superview convertRect:self.frame toView:nil];
CGRect windowFrame = keyWindow.frame;
BOOL isInWindow = CGRectIntersectsRect(newFrame, windowFrame);
if (!self.hidden && self.alpha>0.01 && isInWindow &&self.window == keyWindow) {
return YES;
}else
{
return NO;
}
}
@end
| {
"content_hash": "c9d90d3c40805dde0a10b77f9b8da67b",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 83,
"avg_line_length": 19.619565217391305,
"alnum_prop": 0.657617728531856,
"repo_name": "XuYeS/simulateBS",
"id": "13a66dc90da064f56056ec1f5f66765a8fb103ab",
"size": "1983",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "imitationOfBSBDJ/imitationOfBSBDJ/Classes/Main/Category/UIView+XYSExtension.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "54687"
},
{
"name": "Objective-C",
"bytes": "1123301"
},
{
"name": "Objective-C++",
"bytes": "124423"
},
{
"name": "Ruby",
"bytes": "284"
},
{
"name": "Shell",
"bytes": "8989"
}
],
"symlink_target": ""
} |
About
======
`muni` is a simple NextBus API Client library and command line tool for retrieving
San Francisco Muni bus route and stop prediction information.
Install
=======
```bash
$ gem install muni
```
Client Library
===============
Usage
------
```ruby
# Find all routes.
Muni::Route.find(:all)
# => [<Muni::Route tag="F" title="F-Market & Wharves">, ...]
# Find a specific route
r21 = Muni::Route.find(21)
# => <Muni::Route directions=[<Muni::Direction id="21_IB1" name="Inbound to Steuart Terminal" ...
# Get a prediction
r21.outbound.stop_at("Hayes and Laguna").predictions
# => [<Muni::Prediction block="2108" delayed="true" dirTag="21_OB4" epochTime="1306877956823" isDeparture="false" minutes="3" seconds="198" ...
```
CLI
====
`muni` includes a basic command-line interface, mostly as example usage of the client library. See `bin/muni`.
Usage
------
```bash
Tasks:
muni help [TASK] # Describe available tasks or one specific task
muni list # Lists all routes
muni predict [ROUTE] [DIRECTION] [STOP] # Retrieve predictions for a route at a specific stop
muni show [ROUTE_TAG] [DIRECTION] # Shows a specifc route by name
```
Contributors
============
* [@jeffremer](https://github.com/jeffremer) (maintainer)
* [@gregorym](https://github.com/gregorym)
* [@jameshwang](https://github.com/jameshwang)
* [bf4](https://github.com/bf4)
| {
"content_hash": "31a89950fe736b48815456f59c5c949b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 143,
"avg_line_length": 25.482142857142858,
"alnum_prop": 0.649614576033637,
"repo_name": "jeffremer/muni",
"id": "8c8e8bb28198b7d1ddf3fefbc475c1d9b7956474",
"size": "1427",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "9680"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<!--
<parameters>
<parameter key="bootbusiness_theme.example.class">AlphaLemon\Theme\BootbusinessThemeBundle\Example</parameter>
</parameters>
<services>
<service id="bootbusiness_theme.example" class="%bootbusiness_theme.example.class%">
<argument type="service" id="service_id" />
<argument>plain_value</argument>
<argument>%parameter_name%</argument>
</service>
</services>
-->
</container>
| {
"content_hash": "58c0430c567337f69f86b6eb36a6dfd5",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 120,
"avg_line_length": 37.05,
"alnum_prop": 0.659919028340081,
"repo_name": "alphalemon/BootbusinessThemeBundle",
"id": "d588ea5d015e13a7982db30c8d36e73cb633b0ed",
"size": "741",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Resources/config/services.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1020"
},
{
"name": "PHP",
"bytes": "4039"
}
],
"symlink_target": ""
} |
<?php
namespace osCommerce\OM\Core\Site\Website\SQL\_Global;
use osCommerce\OM\Core\Registry;
class SaveUserServerInfo
{
public static function execute(array $data): int
{
$OSCOM_PDO = Registry::get('PDO');
$Qcheck = $OSCOM_PDO->prepare('select id from :table_website_user_server_info where submit_ip = :submit_ip limit 1');
$Qcheck->bindValue(':submit_ip', $data['ip_address']);
$Qcheck->execute();
if (count($Qcheck->fetchAll()) > 0) {
$Qrecord = $OSCOM_PDO->prepare('update :table_website_user_server_info set osc_version = :osc_version, system_os = :system_os, http_server = :http_server, php_version = :php_version, php_extensions = :php_extensions, php_sapi = :php_sapi, php_memory = :php_memory, mysql_version = :mysql_version, php_other = :php_other, system_other = :system_other, mysql_other = :mysql_other, date_updated = now(), update_count = update_count+1 where submit_ip = :submit_ip');
} else {
$Qrecord = $OSCOM_PDO->prepare('insert into :table_website_user_server_info values (null, :submit_ip, :osc_version, :system_os, :http_server, :php_version, :php_extensions, :php_sapi, :php_memory, :mysql_version, :php_other, :system_other, :mysql_other, now(), now(), 1)');
}
$Qrecord->bindValue(':submit_ip', $data['ip_address']);
$Qrecord->bindValue(':osc_version', $data['osc_version']);
$Qrecord->bindValue(':system_os', $data['system_os']);
$Qrecord->bindValue(':http_server', $data['http_server']);
$Qrecord->bindValue(':php_version', $data['php_version']);
$Qrecord->bindValue(':php_extensions', $data['php_extensions']);
$Qrecord->bindValue(':php_sapi', $data['php_sapi']);
$Qrecord->bindValue(':php_memory', $data['php_memory']);
$Qrecord->bindValue(':mysql_version', $data['mysql_version']);
$Qrecord->bindValue(':php_other', $data['php_other']);
$Qrecord->bindValue(':mysql_other', $data['mysql_other']);
$Qrecord->bindValue(':system_other', $data['system_other']);
$Qrecord->execute();
return $Qrecord->rowCount();
}
}
| {
"content_hash": "4ef0267ff9e7ae34b29e6d372dc660d4",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 474,
"avg_line_length": 53.825,
"alnum_prop": 0.6270320483046912,
"repo_name": "haraldpdl/oscommerce_website",
"id": "57a73a22f9bb4d8c95202b3f39e27fd39f79bae6",
"size": "2307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "osCommerce/OM/Custom/Site/Website/SQL/_Global/SaveUserServerInfo.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "3033"
},
{
"name": "HTML",
"bytes": "257412"
},
{
"name": "Hack",
"bytes": "130992"
},
{
"name": "JavaScript",
"bytes": "47477"
},
{
"name": "PHP",
"bytes": "512564"
},
{
"name": "TSQL",
"bytes": "7448"
}
],
"symlink_target": ""
} |
//
// DkimBodyFilterBase.cs
//
// Author: Jeffrey Stedfast <jeff@xamarin.com>
//
// Copyright (c) 2015 Xamarin Inc. (www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using MimeKit.IO.Filters;
namespace MimeKit.Cryptography
{
/// <summary>
/// A base implementation for DKIM body filters.
/// </summary>
/// <remarks>
/// A base implementation for DKIM body filters.
/// </remarks>
abstract class DkimBodyFilter : MimeFilterBase
{
/// <summary>
/// Get or set whether the last filtered character was a newline.
/// </summary>
/// <remarks>
/// Gets or sets whether the last filtered character was a newline.
/// </remarks>
internal protected bool LastWasNewLine;
/// <summary>
/// Get or set whether the current line is empty.
/// </summary>
/// <remarks>
/// Gets or sets whether the current line is empty.
/// </remarks>
protected bool IsEmptyLine;
/// <summary>
/// Get or set the number of consecutive empty lines encountered.
/// </summary>
/// <remarks>
/// Gets or sets the number of consecutive empty lines encountered.
/// </remarks>
protected int EmptyLines;
/// <summary>
/// Initializes a new instance of the <see cref="MimeKit.Cryptography.DkimBodyFilter"/> class.
/// </summary>
/// <remarks>
/// Creates a new <see cref="DkimBodyFilter"/>.
/// </remarks>
protected DkimBodyFilter ()
{
}
}
}
| {
"content_hash": "e711bf5f3803cb76085cc9725ed96803",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 96,
"avg_line_length": 33.23287671232877,
"alnum_prop": 0.7052761747732894,
"repo_name": "nachocove/MimeKit",
"id": "7ccf10305da9fe778dd646d77feae70cf2a6ae95",
"size": "2428",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MimeKit/Cryptography/DkimBodyFilter.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "395"
},
{
"name": "C#",
"bytes": "4157070"
},
{
"name": "HTML",
"bytes": "937448"
},
{
"name": "Makefile",
"bytes": "1214"
},
{
"name": "PowerShell",
"bytes": "994"
},
{
"name": "Shell",
"bytes": "1343"
}
],
"symlink_target": ""
} |
package ch.post.pf.gradus.ViewModel;
import ch.post.pf.gradus.Models.User;
import ch.post.pf.gradus.ViewModel.User.UserView;
public class SubjectView {
private Long id;
private String name;
private User creator;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setCreator(User creator) {
this.creator = creator;
}
public User getCreator() {
return creator;
}
}
| {
"content_hash": "de0cf0556dc105d7bc20051087cfee0b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 49,
"avg_line_length": 15.55,
"alnum_prop": 0.5996784565916399,
"repo_name": "mirioeggmann/gradus",
"id": "cdc447f6142b6ee26e4ac992419be0156bdc689d",
"size": "622",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/main/java/ch/post/pf/gradus/ViewModel/SubjectView.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "167687"
},
{
"name": "HTML",
"bytes": "55980"
},
{
"name": "Java",
"bytes": "33642"
},
{
"name": "JavaScript",
"bytes": "1833"
},
{
"name": "TypeScript",
"bytes": "42902"
}
],
"symlink_target": ""
} |
typedef NS_ENUM(NSInteger, DynamicIncludeType) {
DynamicIncludeALL,
DynamicIncludeWithoutNull,
DynamicIncludeObjectOnly,
};
@interface DynamicClass : NSObject
+ (void)showProperties:(id)instanceClass;
+ (void)showObjectType:(id)instanceClass;
+ (NSMutableDictionary *)dictionaryWithObject:(id)instanceClass type:(DynamicIncludeType)includeType;
@end
| {
"content_hash": "e812d621224c632f2b8ab09b596e59fd",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 101,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.7950819672131147,
"repo_name": "comcxx11/DynamicClassForObjective-C",
"id": "019d0ca7458a66d477d63618500da8507544ccb4",
"size": "547",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DynamicClasses/DynamicClass/DynamicClass.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "13652"
}
],
"symlink_target": ""
} |
<?php
namespace TreeSoft\Specifications\DAL\Eloquent\Transformers;
use TreeSoft\Specifications\DAL\Eloquent\Model;
use TreeSoft\Specifications\Support\DataPreparator;
use TreeSoft\Specifications\Support\Transformers\EntityTransformer as ParentTransformer;
use TreeSoft\Specifications\Transforming\Converter\Extractor;
use TreeSoft\Specifications\Transforming\Converter\Populator;
/**
* @author Sergei Melnikov <me@rnr.name>
*/
class EntityTransformer extends ParentTransformer
{
/**
* @param object $entity
* @param Model $model
*
* @return Model
*/
public function extract($entity, Model $model): Model
{
assert(isset($this->class));
$schema = $this->getSchema($this->class);
/**
* @var Extractor $extractor
*/
$extractor = $this->container->make(Extractor::class);
$data = $extractor->convert($entity, $schema);
$transformer = $this->factory->create($schema, $model->schema);
$model->fill((array) $transformer->transform($data));
return $model;
}
/**
* @param Model $model
* @param object $entity
*
* @return object
*/
public function populate(Model $model, $entity = null)
{
assert(isset($this->class));
$schema = $this->getSchema($this->class);
$transformer = $this->factory->create($model->schema, $schema);
/**
* @var DataPreparator $preparator
*/
$preparator = $this->container->make(DataPreparator::class);
$data = $transformer->transform($preparator->prepare($model->toArray()));
/**
* @var Populator $populator
*/
$populator = $this->container->make(Populator::class);
return $populator->convert($this->mergeWithOriginal($data, $entity), $schema);
}
/**
* @param mixed $data
* @param object $entity
*
* @return mixed
*/
public function mergeWithOriginal($data, $entity = null)
{
if (empty($entity)) {
return $data;
}
$schema = $this->getSchema($this->class);
/**
* @var Extractor $extractor
*/
$extractor = $this->container->make(Extractor::class);
$originalData = $extractor->convert($entity, $schema);
foreach ((array) $data as $key => $value) {
$originalData->{$key} = $value;
}
return $originalData;
}
}
| {
"content_hash": "50e68c02e667a67ca3f1e53d72158773",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 88,
"avg_line_length": 25.193877551020407,
"alnum_prop": 0.5901174564601053,
"repo_name": "Tree-soft/specifications",
"id": "53006195d2d9e6c6a7eef347c7eb9b402af005aa",
"size": "2469",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/DAL/Eloquent/Transformers/EntityTransformer.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "927"
},
{
"name": "PHP",
"bytes": "339784"
}
],
"symlink_target": ""
} |
package main
const version = "v0.2.0-dev"
| {
"content_hash": "0558a261acaffaa25811f1140a7f1a03",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 28,
"avg_line_length": 14.333333333333334,
"alnum_prop": 0.6976744186046512,
"repo_name": "bmorton/deployctl",
"id": "7823e0c2a750fd4cda4c7cd2732d50322432133c",
"size": "43",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "version.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "10343"
}
],
"symlink_target": ""
} |
package org.elasticsearch.transport.netty4;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.buffer.UnpooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.nio.NioEventLoopGroup;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.test.ESTestCase;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
public class CopyBytesSocketChannelTests extends ESTestCase {
private final UnpooledByteBufAllocator alloc = new UnpooledByteBufAllocator(false);
private final AtomicReference<CopyBytesSocketChannel> accepted = new AtomicReference<>();
private final AtomicInteger serverBytesReceived = new AtomicInteger();
private final AtomicInteger clientBytesReceived = new AtomicInteger();
private final ConcurrentLinkedQueue<ByteBuf> serverReceived = new ConcurrentLinkedQueue<>();
private final ConcurrentLinkedQueue<ByteBuf> clientReceived = new ConcurrentLinkedQueue<>();
private NioEventLoopGroup eventLoopGroup;
private InetSocketAddress serverAddress;
private Channel serverChannel;
@Override
@SuppressForbidden(reason = "calls getLocalHost")
public void setUp() throws Exception {
super.setUp();
eventLoopGroup = new NioEventLoopGroup(1);
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.channel(CopyBytesServerSocketChannel.class);
serverBootstrap.group(eventLoopGroup);
serverBootstrap.option(ChannelOption.ALLOCATOR, alloc);
serverBootstrap.childOption(ChannelOption.ALLOCATOR, alloc);
serverBootstrap.childHandler(new ChannelInitializer<>() {
@Override
protected void initChannel(Channel ch) {
accepted.set((CopyBytesSocketChannel) ch);
ch.pipeline().addLast(new SimpleChannelInboundHandler<>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
ByteBuf buffer = (ByteBuf) msg;
serverBytesReceived.addAndGet(buffer.readableBytes());
serverReceived.add(buffer.retain());
}
});
}
});
ChannelFuture bindFuture = serverBootstrap.bind(new InetSocketAddress(InetAddress.getLocalHost(), 0));
assertTrue(bindFuture.await(10, TimeUnit.SECONDS));
serverAddress = (InetSocketAddress) bindFuture.channel().localAddress();
bindFuture.isSuccess();
serverChannel = bindFuture.channel();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
try {
assertTrue(serverChannel.close().await(10, TimeUnit.SECONDS));
} finally {
eventLoopGroup.shutdownGracefully().await(10, TimeUnit.SECONDS);
}
}
public void testSendAndReceive() throws Exception {
final Bootstrap bootstrap = new Bootstrap();
bootstrap.group(eventLoopGroup);
bootstrap.channel(VerifyingCopyChannel.class);
bootstrap.option(ChannelOption.ALLOCATOR, alloc);
bootstrap.handler(new ChannelInitializer<>() {
@Override
protected void initChannel(Channel ch) {
ch.pipeline().addLast(new SimpleChannelInboundHandler<>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
ByteBuf buffer = (ByteBuf) msg;
clientBytesReceived.addAndGet(buffer.readableBytes());
clientReceived.add(buffer.retain());
}
});
}
});
ChannelFuture connectFuture = bootstrap.connect(serverAddress);
connectFuture.await(10, TimeUnit.SECONDS);
assertTrue(connectFuture.isSuccess());
CopyBytesSocketChannel copyChannel = (CopyBytesSocketChannel) connectFuture.channel();
ByteBuf clientData = generateData();
ByteBuf serverData = generateData();
try {
assertBusy(() -> assertNotNull(accepted.get()));
int clientBytesToWrite = clientData.readableBytes();
ChannelFuture clientWriteFuture = copyChannel.writeAndFlush(clientData.retainedSlice());
clientWriteFuture.await(10, TimeUnit.SECONDS);
assertBusy(() -> assertEquals(clientBytesToWrite, serverBytesReceived.get()));
int serverBytesToWrite = serverData.readableBytes();
ChannelFuture serverWriteFuture = accepted.get().writeAndFlush(serverData.retainedSlice());
assertTrue(serverWriteFuture.await(10, TimeUnit.SECONDS));
assertBusy(() -> assertEquals(serverBytesToWrite, clientBytesReceived.get()));
ByteBuf compositeServerReceived = Unpooled.wrappedBuffer(serverReceived.toArray(new ByteBuf[0]));
assertEquals(clientData, compositeServerReceived);
ByteBuf compositeClientReceived = Unpooled.wrappedBuffer(clientReceived.toArray(new ByteBuf[0]));
assertEquals(serverData, compositeClientReceived);
} finally {
clientData.release();
serverData.release();
serverReceived.forEach(ByteBuf::release);
clientReceived.forEach(ByteBuf::release);
assertTrue(copyChannel.close().await(10, TimeUnit.SECONDS));
}
}
private ByteBuf generateData() {
return Unpooled.wrappedBuffer(randomAlphaOfLength(randomIntBetween(1 << 22, 1 << 23)).getBytes(StandardCharsets.UTF_8));
}
public static class VerifyingCopyChannel extends CopyBytesSocketChannel {
public VerifyingCopyChannel() {
super();
}
@Override
protected int writeToSocketChannel(SocketChannel socketChannel, ByteBuffer buffer) throws IOException {
assertTrue("IO Buffer must be a direct byte buffer", buffer.isDirect());
int remaining = buffer.remaining();
int originalLimit = buffer.limit();
// If greater than a KB, possibly invoke a partial write.
if (remaining > 1024) {
if (randomBoolean()) {
int bytes = randomIntBetween(remaining / 2, remaining);
buffer.limit(buffer.position() + bytes);
}
}
int written = socketChannel.write(buffer);
buffer.limit(originalLimit);
return written;
}
@Override
protected int readFromSocketChannel(SocketChannel socketChannel, ByteBuffer buffer) throws IOException {
assertTrue("IO Buffer must be a direct byte buffer", buffer.isDirect());
return socketChannel.read(buffer);
}
}
}
| {
"content_hash": "7c4d327ac33a34023c54091d1953cb65",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 128,
"avg_line_length": 44.142011834319526,
"alnum_prop": 0.6735924932975871,
"repo_name": "GlenRSmith/elasticsearch",
"id": "2f0440e9df97a80beed260885972e289f2acd3cb",
"size": "7813",
"binary": false,
"copies": "26",
"ref": "refs/heads/master",
"path": "modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/CopyBytesSocketChannelTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "11082"
},
{
"name": "Batchfile",
"bytes": "11057"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "337461"
},
{
"name": "HTML",
"bytes": "2186"
},
{
"name": "Java",
"bytes": "43224931"
},
{
"name": "Perl",
"bytes": "11756"
},
{
"name": "Python",
"bytes": "19852"
},
{
"name": "Shell",
"bytes": "99571"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.