text stringlengths 2 1.04M | meta dict |
|---|---|
angular.module('wiz.features.tag', [])
.config(['$stateProvider',
function ($stateProvider) {
$stateProvider
.state('tag', {
url: "^/tag/:tag",
templateUrl: "theme/templates/tag.tpl.html",
controller: 'TagCtrl',
resolve: {
posts: ['wizPostsSvc', function (wizPostsSvc) {
return wizPostsSvc.getPosts();
}]
}
});
}
]); | {
"content_hash": "c0d5ba561b3bdfd9d0139284dfe461e0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 53,
"avg_line_length": 22.235294117647058,
"alnum_prop": 0.5714285714285714,
"repo_name": "GrumpyWizards/ngBlog",
"id": "bd9abd5468921000e0622e21d95bf6294a6cbf0b",
"size": "378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/features/tag/tag.mod.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "80731"
},
{
"name": "JavaScript",
"bytes": "143419"
}
],
"symlink_target": ""
} |
package com.salesforce.dva.argus.service.metric.transform;
import java.util.List;
import java.util.Map;
import com.salesforce.dva.argus.entity.Metric;
import com.salesforce.dva.argus.system.SystemAssert;
import com.salesforce.dva.argus.util.QueryContext;
public class AliasByTagTransform implements Transform {
static final String DELIMITER = ",";
@Override
public List<Metric> transform(QueryContext context, List<Metric> metrics) {
SystemAssert.requireArgument(metrics != null, "Metric list cannot be null.");
for(Metric metric : metrics) {
String displayName = "";
for(Map.Entry<String, String> entry : metric.getTags().entrySet()) {
displayName += entry.getValue() + DELIMITER;
}
if(!displayName.isEmpty()) {
displayName = displayName.substring(0, displayName.length() - 1);
metric.setDisplayName(displayName);
}
}
return metrics;
}
@Override
public List<Metric> transform(QueryContext queryContext, List<Metric> metrics, List<String> constants) {
SystemAssert.requireArgument(metrics != null, "Metric list cannot be null.");
SystemAssert.requireArgument(constants != null && !constants.isEmpty(), "Constant list cannot be null or empty.");
for(Metric metric : metrics) {
String displayName = "";
Map<String, String> tags = metric.getTags();
for(String tagKey : constants) {
if(tags.containsKey(tagKey)) {
displayName += tags.get(tagKey) + DELIMITER;
}
}
if(!displayName.isEmpty()) {
displayName = displayName.substring(0, displayName.length() - 1);
metric.setDisplayName(displayName);
}
}
return metrics;
}
@Override
public List<Metric> transform(QueryContext queryContext, @SuppressWarnings("unchecked") List<Metric>... metrics) {
throw new UnsupportedOperationException("ALIASBYTAG doesn't need a list of lists!");
}
@Override
public String getResultScopeName() {
return TransformFactory.Function.ALIASBYTAG.name();
}
}
| {
"content_hash": "f1ed15c0b8a76b3b95acd8f5a2419153",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 116,
"avg_line_length": 28.91176470588235,
"alnum_prop": 0.7151576805696847,
"repo_name": "rajsarkapally/Argus",
"id": "7a341fee9ad7709c919b2859795a0dee4d0a78a5",
"size": "1966",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AliasByTagTransform.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "16576"
},
{
"name": "Dockerfile",
"bytes": "803"
},
{
"name": "HTML",
"bytes": "93216"
},
{
"name": "Java",
"bytes": "3909387"
},
{
"name": "JavaScript",
"bytes": "449576"
},
{
"name": "Makefile",
"bytes": "928"
},
{
"name": "Python",
"bytes": "4927"
},
{
"name": "Shell",
"bytes": "3725"
}
],
"symlink_target": ""
} |
<?php
include "citrix.php";
$citrix = new Citrix('API Key');
$citrix->set_organizer_key('organizer_key');
$citrix->set_access_token('access_token');
try
{
$organizer_key = $citrix->get_organizer_key();
$citrix->pr($organizer_key);
}catch (Exception $e) {
$citrix->pr($e->getMessage());
}
try
{
$webinars = $citrix->citrixonline_get_list_of_webinars() ;
$citrix->pr($webinars);
}catch (Exception $e) {
$citrix->pr($e->getMessage());
}
try
{
$response = $citrix->citrixonline_create_registrant_of_webinar('webinar id', $data = array('first_name' => 'First Name', 'last_name' => 'Lastnmae', 'email'=>'email@email.com')) ;
$citrix->pr($response);
}catch (Exception $e) {
$citrix->pr($e->getMessage());
}
try
{
$webinars = $citrix->get_registrants_of_webinars('webinar id') ;
$citrix->pr($webinars);
}catch (Exception $e) {
$citrix->pr($e->getMessage());
}
try
{
$citrix->citrixonline_delete_registrant_of_webinar('webinar id', 'registrant id') ;
}catch (Exception $e) {
$citrix->pr($e->getMessage());
} | {
"content_hash": "f05b665508e4f511c8232bccf2b11918",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 179,
"avg_line_length": 22.434782608695652,
"alnum_prop": 0.6443798449612403,
"repo_name": "zakir-hyder/Citrix-GoToWebinar-PHP-Library",
"id": "ca864d8467e4dee292f35163d0b7e24c463ec1eb",
"size": "1032",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "12620"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "74d809cddd8b0277a958ea85897757c7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "316c998ed95c1e04f6729c45f2a56a067bab963d",
"size": "173",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Psoralea/Psoralea sibirica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.9.8: deps Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.9.8
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_94a36784afa54c0b50996002372b429e.html">deps</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">deps Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a>
Directories</h2></td></tr>
<tr class="memitem:dir_7edecdc49f3d0e5b35ff20670f3bf33e"><td class="memItemLeft" align="right" valign="top">directory  </td><td class="memItemRight" valign="bottom"><a class="el" href="dir_7edecdc49f3d0e5b35ff20670f3bf33e.html">v8</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:49:04 for V8 API Reference Guide for node.js v0.9.8 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| {
"content_hash": "d363552bc192f1d0652c9f6b8e6e416a",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 249,
"avg_line_length": 42.51485148514851,
"alnum_prop": 0.6551001397298556,
"repo_name": "v8-dox/v8-dox.github.io",
"id": "0a5e052cb3ab59af2ec5c543f69f49032fcbb127",
"size": "4294",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "7a2ebce/html/dir_94a36784afa54c0b50996002372b429e.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package io.youi.component
import io.youi.component.types.Prop
import io.youi.dom
import org.scalajs.dom.html
class LinkView(element: html.Anchor = dom.create.anchor) extends TextView(element) {
lazy val href: Prop[String] = new Prop(element.href, element.href_=)
lazy val target: Prop[String] = new Prop(element.target, element.target_=)
} | {
"content_hash": "5df2dfead861eb132560e4f1c697213b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 84,
"avg_line_length": 34.5,
"alnum_prop": 0.7623188405797101,
"repo_name": "outr/youi",
"id": "b8c76047e7bc57076a181d42c22aa913aeedc928",
"size": "345",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gui/src/main/scala/io/youi/component/LinkView.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "844"
},
{
"name": "HTML",
"bytes": "6666"
},
{
"name": "JavaScript",
"bytes": "106413"
},
{
"name": "Scala",
"bytes": "3490560"
},
{
"name": "Shell",
"bytes": "89"
}
],
"symlink_target": ""
} |
package com.chute.sdk.api.account;
import android.content.Context;
import com.chute.sdk.api.GCHttpCallback;
import com.chute.sdk.api.GCParameterHttpRequestImpl;
import com.chute.sdk.parsers.base.GCHttpResponseParser;
import com.chute.sdk.utils.GCRestConstants;
import com.chute.sdk.utils.rest.GCBaseRestClient.RequestMethod;
public class AccountsGetRequest<T> extends GCParameterHttpRequestImpl<T> {
public static final String TAG = AccountsGetRequest.class.getSimpleName();
public AccountsGetRequest(Context context, GCHttpResponseParser<T> parser,
GCHttpCallback<T> callback) {
super(context, RequestMethod.GET, parser, callback);
}
@Override
protected void prepareParams() {
}
@Override
public void execute() {
runRequest(String.format(GCRestConstants.URL_ACCOUNTS));
}
}
| {
"content_hash": "7834c12af1f05fa4958224b24f3663c8",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 28.5,
"alnum_prop": 0.7994987468671679,
"repo_name": "chute/Chute-SDK",
"id": "b2e1f775a197adf2a995f3561bcf2c590efe630d",
"size": "798",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Android/src/com/chute/sdk/api/account/AccountsGetRequest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Erlang",
"bytes": "1084"
},
{
"name": "Java",
"bytes": "499652"
},
{
"name": "Objective-C",
"bytes": "747363"
}
],
"symlink_target": ""
} |
package com.redhat.ceylon.tools.test;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.junit.Assert;
import org.junit.Test;
import com.redhat.ceylon.common.Versions;
import com.redhat.ceylon.common.tool.OptionArgumentException;
import com.redhat.ceylon.common.tool.ToolModel;
import com.redhat.ceylon.tools.fatjar.CeylonFatJarTool;
public class FatJarToolTests extends AbstractToolTests {
@Test
public void testNoArgs() throws Exception {
ToolModel<CeylonFatJarTool> model = pluginLoader.loadToolModel("fat-jar");
Assert.assertNotNull(model);
try {
pluginFactory.bindArguments(model, getMainTool(), Collections.<String>emptyList());
Assert.fail();
} catch (OptionArgumentException e) {
// asserting this is thrown
}
}
@Test
public void testJar() throws Exception {
ToolModel<CeylonFatJarTool> model = pluginLoader.loadToolModel("fat-jar");
Assert.assertNotNull(model);
File out = new File(getOutPath(), "fatjar.jar");
CeylonFatJarTool tool = pluginFactory.bindArguments(model, getMainTool(),
Arrays.asList(
"--rep", "../dist/dist/repo",
"--out", out.getAbsolutePath(),
"ceylon.language/"+Versions.CEYLON_VERSION_NUMBER,
"com.redhat.ceylon.module-resolver/"+Versions.CEYLON_VERSION_NUMBER));
tool.run();
Assert.assertTrue(out.exists());
try(ZipFile zf = new ZipFile(out)){
Assert.assertNotNull(zf.getEntry("ceylon/language/true_.class"));
// dependency
Assert.assertNotNull(zf.getEntry("com/redhat/ceylon/common/log/Logger.class"));
// extra jar
Assert.assertNotNull(zf.getEntry("com/redhat/ceylon/cmr/api/Overrides.class"));
Assert.assertNull(zf.getEntry("META-INF/INDEX.LIST"));
Assert.assertNull(zf.getEntry("META-INF/mapping.txt"));
ZipEntry manifestEntry = zf.getEntry("META-INF/MANIFEST.MF");
Assert.assertNotNull(manifestEntry);
Manifest manifest = new Manifest(zf.getInputStream(manifestEntry));
Attributes attributes = manifest.getMainAttributes();
Assert.assertEquals("ceylon.language.run_", attributes.getValue("Main-Class"));
}
}
}
| {
"content_hash": "4e4f30d8c73b94852fd86a1b31f65c04",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 95,
"avg_line_length": 39.8125,
"alnum_prop": 0.6503139717425431,
"repo_name": "gijsleussink/ceylon",
"id": "9ff13f808bb9d9519fd9233ad96416043f606bc4",
"size": "3479",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "compiler-java/test/src/com/redhat/ceylon/tools/test/FatJarToolTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4574"
},
{
"name": "CSS",
"bytes": "19001"
},
{
"name": "Ceylon",
"bytes": "5755595"
},
{
"name": "GAP",
"bytes": "167605"
},
{
"name": "Groff",
"bytes": "47559"
},
{
"name": "HTML",
"bytes": "4562"
},
{
"name": "Java",
"bytes": "23452104"
},
{
"name": "JavaScript",
"bytes": "480101"
},
{
"name": "Makefile",
"bytes": "19934"
},
{
"name": "Perl",
"bytes": "2756"
},
{
"name": "Shell",
"bytes": "185109"
},
{
"name": "XSLT",
"bytes": "2000144"
}
],
"symlink_target": ""
} |
function drawClassificationComparison_forVideo(docName, docLength, classificationResult, manualClassificationResult, documents, classesPerDocument, parameter)
%DRAWCLASSIFICATIONRESULT this function draws figures that compare the
%manual classification to the automatic classification.
% DB_concat: Database description optained by DB_index_load
% classificationResult:
% manualClassificationResult:
% documens: 1xD vector containing the indices of the documents in
% DB_concat for which a figure should be drawn.
% classesPerDocument: 1xD cell array. The d-th entry is a cell array
% containing the names of the classes that should be considered in the
% figure of the d-th document
% parameter.countingPR =[]: set this to the countingPR cost measure
% calculated by evaluateClassification if you want these values to be
% visualized for each drawn document.
% parameter.framewisePR =[]: set this to the framewisePR cost measure
% calculated by evaluateClassification if you want these values to be
% visualized for each drawn document.
% parameter.printFigure
% parameter.filenamePrefix
% parameter.paperPosition
% parameter.omitTitle
%
% parameter.delta: % include the delta and
% parameter.classificationDelta: % classificationDelta functions and the
% parameter.motion_classes = {}; % motion classes names that correspond to
% each line in the delta and cDelta if you want the deltas to be shown
% when right klicking on the title of the figure.
%
% parameter.highlightFrame
% parameter.position figure position and size
if isfield(parameter, 'printFigure') == 0
parameter.printFigure = 0;
end
if isfield(parameter, 'filenamePrefix') == 0
parameter.filenamePrefix = 'figures/classificationComparison_constantThreshold_0.1_';
end
if isfield(parameter, 'paperPosition') == 0
parameter.paperPosition = [1,1,6.3,2.5];
end
if isfield(parameter, 'omitTitle') == 0
parameter.omitTitle = 0;
end
if isfield(parameter,'countingPR')==0
parameter.countingPR = [];
end
if isfield(parameter,'framewisePR')==0
parameter.framewisePR = [];
end
if isfield(parameter,'delta')==0
parameter.delta = [];
end
if isfield(parameter,'classificationDelta')==0
parameter.classificationDelta = [];
end
if isfield(parameter,'classificationDelta')==0
parameter.motion_classes = {};
end
if isfield(parameter,'highlightFrame')==0
parameter.highlightFrame = 0;
end
if isfield(parameter,'position')==0
parameter.position = [ 1601 -79 1000 440];
end
global VARS_GLOBAL;
%for d=1:length(documents)
d=1;
currentDocument = documents;
%docName = DB_concat.files_name{currentDocument};
% idx = strfind(docName, filesep);
% docShortName = docName((idx(end)+1):end-4);
% docLength = DB_concat.files_frame_length(currentDocument);
classes = classesPerDocument{d};
figure;
% if parameter.omitTitle == 0
% t=title(docName, 'interpreter', 'none');
% filename = fullfile(VARS_GLOBAL.dir_root, docName);
% [info, ok] = filename2info(filename);
% if ok
% [skel,mot] = readMocap(fullfile(info.amcpath, info.asfname), fullfile(info.amcpath, info.amcname));
% set(t, 'buttondownFcn', {@motionPlayerCallback, skel,mot, currentDocument});
% end
% end
set(gca, 'xlim', [1, docLength]);
set(gca, 'ylim', [0.5, length(classes)*2+0.5]);
% yticklabels = cell(1,2*length(classes));
% yticklabels(1:2:2*length(classes)) = classes;
%
% yticklabels(2:2:2*length(classes)) = repmat({'manual'}, 1, length(classes));
%
% idx = strmatch('walk2StepsLstart_walk2StepsRstart', yticklabels);
% if ~isempty(idx)
% yticklabels(idx) = repmat({'walk'}, 1, length(idx));
% end
%
% set(gca, 'ytick', 1:2*length(classes));
% set(gca, 'yticklabel', yticklabels);
% draw class labels inbetween two rows
yticklabel = classes;
idx = strmatch('walk2StepsLstart_walk2StepsRstart', yticklabel);
if ~isempty(idx)
yticklabel(idx) = repmat({'walk'}, 1, length(idx));
end
idx = strmatch('standStill500', yticklabel);
if ~isempty(idx)
yticklabel(idx) = repmat({'neutral'}, 1, length(idx));
end
idx = strmatch('lying', yticklabel);
if ~isempty(idx)
yticklabel(idx) = repmat({'lie'}, 1, length(idx));
end
set(gca, 'ytick', [1.5:2:2*length(classes)]);
set(gca, 'yticklabel', yticklabel);
for c=1:length(classes)
class = classes{c};
% draw a line that separates the classes in the figure
line([1, docLength], [2*c+0.5, 2*c+0.5]);
% find out all hits of the current document belonging to the
% current class (using classificationResult)
hitData = classificationResult.(class)((classificationResult.(class)(:,1) == currentDocument), [2:3, 6]);
for h=1:size(hitData, 1)
hitStart = hitData(h, 1);
hitEnd = hitData(h, 2);
cost = hitData(h, 3);
% remap from 30Hz to 120 Hz
animationStart = hitStart * 4 - 4 + 1;
animationEnd = hitEnd * 4 - 4 + 1;
%draw rectangle
color = [1 0 0]; %[0 127 14]/255;
yPosition = 2*c - 1;
hitWidth = hitStart-hitEnd;
if hitWidth == 0
handle = line([hitStart, hitStart], [yPosition-0.3, yPosition+0.3], 'Color', [0,0,0], 'LineWidth', 1);
else
if parameter.highlightFrame >= hitStart && parameter.highlightFrame <= hitEnd
color = [0,1,1]; % cyan
end
handle = rectangle('Position', [hitStart, yPosition-0.3,...
hitEnd - hitStart, 0.6],...
'EdgeColor', [0 0 0],...
'FaceColor', color,...
'LineWidth', 0.1);
end
% set(handle,'ButtonDownFcn',{@animateRectOnClick,...
% docName,...
% animationStart,...
% animationEnd, ...
% cost,...
% hitStart,...
% hitEnd,...
% });
end
% set(gcf, 'name', [docShortName]);
set(gcf, 'position', parameter.position);
% now draw all manual classifications
% find out which struct of the manualClassificationResult fits to
% the current document
idx = strmatch(docName, {manualClassificationResult.filename});
if length(idx) < 1
disp(['No manual classifications found for the file ' docName '.']);
continue;
end
if length(idx) > 1
error(['More than one manual classification has been found for document ' docName '.']);
end
if ~isfield(manualClassificationResult(idx).classInfo, class)
disp(['Manual annotation of class ' class ' not found for document ' docName]);
continue;
end
hitData = manualClassificationResult(idx).classification{manualClassificationResult(idx).classInfo.(class)};
%remap from 120 Hz to 30 Hz
if ~isempty(hitData)
hitData(:, 1:2) = ceil(hitData(:, 1:2)/4);
end
for h=1:size(hitData, 1)
hitStart = hitData(h, 1);
hitEnd = hitData(h, 2);
cost = 0;
% remap from 30Hz to 120 Hz
animationStart = hitStart * 4 - 4 + 1;
animationEnd = hitEnd * 4 - 4 + 1;
%draw rectangle
color = [0 0 0];
yPosition = 2*c;
hitWidth = hitStart-hitEnd;
if hitWidth == 0
handle = line([hitStart, hitStart], [yPosition-0.3, yPosition+0.3], 'Color', [0,0,0], 'LineWidth', 1);
else
handle = rectangle('Position', [hitStart, yPosition-0.3,...
hitEnd - hitStart, 0.6],...
'EdgeColor', color, ... %[0 127 14]/255,...
'FaceColor', color,...
'LineWidth', 0.1);
end
% set(handle,'ButtonDownFcn',{@animateRectOnClick,...
% docName,...
% animationStart,...
% animationEnd, ...
% cost,...
% hitStart,...
% hitEnd,...
% });
end
% draw the box around the figure manually to avoid the tickmarks on
% the right with the command 'box on'
line([docLength, docLength], [0.5, 2*length(classes)+0.5], 'Color', [0,0,0]);
line([1, docLength], [2*length(classes)+0.5, 2*length(classes)+0.5], 'Color', [0,0,0]);
if parameter.highlightFrame > 0
line([parameter.highlightFrame, parameter.highlightFrame], [0.5, 2*length(classes)+0.5], 'Color', [0,1,1]);
end
% if ~isempty(parameter.countingPR)
% textString = sprintf('Counting P: %1.2f R: %1.2f', parameter.countingPR(currentDocument, 1), parameter.countingPR(currentDocument, 2));
% text(1, -1.5 , textString);
% end
%
% if ~isempty(parameter.framewisePR)
% textString = sprintf('Framewise P: %1.2f R: %1.2f', parameter.framewisePR(currentDocument, 1), parameter.framewisePR(currentDocument, 2));
% text(docLength/2, -1.5, textString);
% end
end
% if parameter.printFigure
% set(gcf, 'paperPosition', parameter.paperPosition);
% filename = [parameter.filenamePrefix docShortName '.eps'];
% % filename = ['figures/classificationComparison_classDependentThreshold_' docShortName '.eps'];
% print('-depsc2', filename);
% end
% end
% function motionPlayerCallback(src, eventdata, skel, mot, document)
% t = get(gcf,'selectionType');
% switch t
% %%%%%%%%%% left click %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%% play the document in the motion player%%%%%%%%%%%%%%%%%%%%%%
% case 'normal'
% motionplayer('skel',{skel}, 'mot', {mot});
% %%%%%%%%%% right click %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%% show the deltas and classification deltas %%%%%%%%%%%%%%%%%%%
% case 'alt'
% if ~isempty(parameter.delta) && ~isempty(parameter.classificationDelta) && ~isempty(parameter.motion_classes)
%
% parameter.manualClassificationResult = manualClassificationResult;
% parameter.cmap = hot(64);
% parameter.cAxisLimits = [0, 0.2];
%
% parameter.deltaAll = 0;
% parameter.deltaSuper = 0;
% parameter.cdeltaAll = 1;
% parameter.cdeltaSuper = 1;
% parameter.superClassOrder = parameter.superclasses;
% drawAnnotationDeltas(DB_concat, document, parameter.motion_classes, parameter.delta, parameter.classificationDelta, parameter);
% end
%
% %%%%%%%%%% shift click %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%% draw the features %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% case 'extend'
% drawFeaturesForDatabaseDocument( DB_concat, document)
%
%
% end
% end
% end %function
%
%
%
| {
"content_hash": "448d17a382aab66569f92c6e2152a712",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 165,
"avg_line_length": 39.74183006535948,
"alnum_prop": 0.5372091110928378,
"repo_name": "iqbalu/3D_Pose_Estimation_CVPR2016",
"id": "cbbbd80530cbec14154d34a5475fee466eda122b",
"size": "12161",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/motionplayer/video/drawClassificationComparison_forVideo.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "3751"
},
{
"name": "C",
"bytes": "188196"
},
{
"name": "C++",
"bytes": "2016823"
},
{
"name": "CMake",
"bytes": "12832"
},
{
"name": "CSS",
"bytes": "3682"
},
{
"name": "HTML",
"bytes": "340919"
},
{
"name": "Limbo",
"bytes": "42"
},
{
"name": "M",
"bytes": "4133"
},
{
"name": "Makefile",
"bytes": "26071"
},
{
"name": "Matlab",
"bytes": "5856729"
},
{
"name": "Mercury",
"bytes": "520"
},
{
"name": "Objective-C",
"bytes": "6778"
},
{
"name": "Protocol Buffer",
"bytes": "662"
},
{
"name": "Shell",
"bytes": "20881"
},
{
"name": "TeX",
"bytes": "12883"
},
{
"name": "XSLT",
"bytes": "15892"
}
],
"symlink_target": ""
} |
void hello(void) {
printf("hello, library world\n");
}
| {
"content_hash": "689db7d5a46c3572f5e20f754bb67fed",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.6271186440677966,
"repo_name": "yangaofeng/x_socket",
"id": "905db5cf4be155b2bb2f57518addae6d6b6c4fe2",
"size": "140",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "linux/so_soname/hello/hello.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "98090"
},
{
"name": "C++",
"bytes": "156581"
},
{
"name": "Go",
"bytes": "9465"
},
{
"name": "Java",
"bytes": "46395"
},
{
"name": "Lex",
"bytes": "396"
},
{
"name": "Lua",
"bytes": "1831"
},
{
"name": "M4",
"bytes": "3229"
},
{
"name": "Makefile",
"bytes": "38919"
},
{
"name": "PHP",
"bytes": "10080"
},
{
"name": "Perl",
"bytes": "50"
},
{
"name": "Python",
"bytes": "12127"
},
{
"name": "Rust",
"bytes": "2076"
},
{
"name": "Shell",
"bytes": "27593"
},
{
"name": "Yacc",
"bytes": "1043"
}
],
"symlink_target": ""
} |
<li>{{$category->name}}
@if ($category->hasChild())
<ol class="nav nav-pills">
@foreach (Menu::getFirstChildCategories($category) as $child)
@include('menu.item', array('category'=>$child))
@endforeach
</ol>
@endif
</li> | {
"content_hash": "778f9178abb0a132bd74033e4964d191",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 63,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.648068669527897,
"repo_name": "kornvollis/smaragd",
"id": "ec55a869cd8ce46e0695117df75369592b6b35d4",
"size": "233",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/views/menu/item.blade.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "29234"
},
{
"name": "JavaScript",
"bytes": "14371"
},
{
"name": "PHP",
"bytes": "180392"
}
],
"symlink_target": ""
} |
/**
* Add getComputedStyle support to elements
*/
(function ( w ) {
if ( !w.getComputedStyle ) {
w.getComputedStyle = function( el ) {
this.el = el;
this.getPropertyValue = function( prop ) {
var re = /(\-([a-z]){1})/g;
if ( prop == 'float' ) prop = 'styleFloat';
if ( re.test(prop) ) {
prop = prop.replace(re, function () {
return arguments[2].toUpperCase();
});
}
return el.currentStyle[prop] ? el.currentStyle[prop] : null;
};
return this;
};
}
})(window);
/**
* Add dataset support to elements
* No globals, no overriding prototype with non-standard methods,
* handles CamelCase properly, attempts to use standard
* Object.defineProperty() (and Function bind()) methods,
* falls back to native implementation when existing
* Inspired by http://code.eligrey.com/html5/dataset/
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js )
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (shims below)
* Licensed under the X11/MIT License
*/
// Inspired by https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind#Compatibility
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
'use strict';
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function () {},
fBound = function () {
return fToBind.apply(
this instanceof FNOP && oThis ? this : oThis,
aArgs.concat(Array.prototype.slice.call(arguments))
);
};
FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();
return fBound;
};
}
/*
* Xccessors Standard: Cross-browser ECMAScript 5 accessors
* http://purl.eligrey.com/github/Xccessors
*
* 2010-06-21
*
* By Eli Grey, http://eligrey.com
*
* A shim that partially implements Object.defineProperty,
* Object.getOwnPropertyDescriptor, and Object.defineProperties in browsers that have
* legacy __(define|lookup)[GS]etter__ support.
*
* Licensed under the X11/MIT License
* See LICENSE.md
*/
// Removed a few JSLint options as Notepad++ JSLint validator complaining and
// made comply with JSLint; also moved 'use strict' inside function
/*jslint white: true, undef: true, plusplus: true,
bitwise: true, regexp: true, newcap: true, maxlen: 90 */
/*! @source http://purl.eligrey.com/github/Xccessors/blob/master/xccessors-standard.js*/
(function () {
'use strict';
var ObjectProto = Object.prototype,
defineGetter = ObjectProto.__defineGetter__,
defineSetter = ObjectProto.__defineSetter__,
lookupGetter = ObjectProto.__lookupGetter__,
lookupSetter = ObjectProto.__lookupSetter__,
hasOwnProp = ObjectProto.hasOwnProperty;
if (defineGetter && defineSetter && lookupGetter && lookupSetter) {
if (!Object.defineProperty) {
Object.defineProperty = function (obj, prop, descriptor) {
if (arguments.length < 3) { // all arguments required
throw new TypeError("Arguments not optional");
}
prop += ""; // convert prop to string
if (hasOwnProp.call(descriptor, "value")) {
if (!lookupGetter.call(obj, prop) && !lookupSetter.call(obj, prop)) {
// data property defined and no pre-existing accessors
obj[prop] = descriptor.value;
}
if ((hasOwnProp.call(descriptor, "get") ||
hasOwnProp.call(descriptor, "set")))
{
// descriptor has a value prop but accessor already exists
throw new TypeError("Cannot specify an accessor and a value");
}
}
// can't switch off these features in ECMAScript 3
// so throw a TypeError if any are false
if (!(descriptor.writable && descriptor.enumerable &&
descriptor.configurable))
{
throw new TypeError(
"This implementation of Object.defineProperty does not support" +
" false for configurable, enumerable, or writable."
);
}
if (descriptor.get) {
defineGetter.call(obj, prop, descriptor.get);
}
if (descriptor.set) {
defineSetter.call(obj, prop, descriptor.set);
}
return obj;
};
}
if (!Object.getOwnPropertyDescriptor) {
Object.getOwnPropertyDescriptor = function (obj, prop) {
if (arguments.length < 2) { // all arguments required
throw new TypeError("Arguments not optional.");
}
prop += ""; // convert prop to string
var descriptor = {
configurable: true,
enumerable : true,
writable : true
},
getter = lookupGetter.call(obj, prop),
setter = lookupSetter.call(obj, prop);
if (!hasOwnProp.call(obj, prop)) {
// property doesn't exist or is inherited
return descriptor;
}
if (!getter && !setter) { // not an accessor so return prop
descriptor.value = obj[prop];
return descriptor;
}
// there is an accessor, remove descriptor.writable;
// populate descriptor.get and descriptor.set (IE's behavior)
delete descriptor.writable;
descriptor.get = descriptor.set = undefined;
if (getter) {
descriptor.get = getter;
}
if (setter) {
descriptor.set = setter;
}
return descriptor;
};
}
if (!Object.defineProperties) {
Object.defineProperties = function (obj, props) {
var prop;
for (prop in props) {
if (hasOwnProp.call(props, prop)) {
Object.defineProperty(obj, prop, props[prop]);
}
}
};
}
}
}());
// Begin dataset code
if (!document.documentElement.dataset &&
// FF is empty while IE gives empty object
(!Object.getOwnPropertyDescriptor(Element.prototype, 'dataset') ||
!Object.getOwnPropertyDescriptor(Element.prototype, 'dataset').get)
) {
var propDescriptor = {
enumerable: true,
get: function () {
'use strict';
var i,
that = this,
HTML5_DOMStringMap,
attrVal, attrName, propName,
attribute,
attributes = this.attributes,
attsLength = attributes.length,
toUpperCase = function (n0) {
return n0.charAt(1).toUpperCase();
},
getter = function () {
return this;
},
setter = function (attrName, value) {
return (typeof value !== 'undefined') ?
this.setAttribute(attrName, value) :
this.removeAttribute(attrName);
};
try { // Simulate DOMStringMap w/accessor support
// Test setting accessor on normal object
({}).__defineGetter__('test', function () {});
HTML5_DOMStringMap = {};
}
catch (e1) { // Use a DOM object for IE8
HTML5_DOMStringMap = document.createElement('div');
}
for (i = 0; i < attsLength; i++) {
attribute = attributes[i];
// Fix: This test really should allow any XML Name without
// colons (and non-uppercase for XHTML)
if (attribute && attribute.name &&
(/^data-\w[\w\-]*$/).test(attribute.name)) {
attrVal = attribute.value;
attrName = attribute.name;
// Change to CamelCase
propName = attrName.substr(5).replace(/-./g, toUpperCase);
try {
Object.defineProperty(HTML5_DOMStringMap, propName, {
enumerable: this.enumerable,
get: getter.bind(attrVal || ''),
set: setter.bind(that, attrName)
});
}
catch (e2) { // if accessors are not working
HTML5_DOMStringMap[propName] = attrVal;
}
}
}
return HTML5_DOMStringMap;
}
};
try {
// FF enumerates over element's dataset, but not
// Element.prototype.dataset; IE9 iterates over both
Object.defineProperty(Element.prototype, 'dataset', propDescriptor);
} catch (e) {
propDescriptor.enumerable = false; // IE8 does not allow setting to true
Object.defineProperty(Element.prototype, 'dataset', propDescriptor);
}
}
/*
* classList.js: Cross-browser full element.classList implementation.
* 2014-12-13
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*global self, document, DOMException */
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
if ("document" in self) {
// Full polyfill for browsers with no classList support
if (!("classList" in document.createElement("_"))) {
(function (view) {
"use strict";
if (!('Element' in view)) return;
var
classListProp = "classList"
, protoProp = "prototype"
, elemCtrProto = view.Element[protoProp]
, objCtr = Object
, strTrim = String[protoProp].trim || function () {
return this.replace(/^\s+|\s+$/g, "");
}
, arrIndexOf = Array[protoProp].indexOf || function (item) {
var
i = 0
, len = this.length
;
for (; i < len; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
}
// Vendors: please allow content code to instantiate DOMExceptions
, DOMEx = function (type, message) {
this.name = type;
this.code = DOMException[type];
this.message = message;
}
, checkTokenAndGetIndex = function (classList, token) {
if (token === "") {
throw new DOMEx(
"SYNTAX_ERR"
, "An invalid or illegal string was specified"
);
}
if (/\s/.test(token)) {
throw new DOMEx(
"INVALID_CHARACTER_ERR"
, "String contains an invalid character"
);
}
return arrIndexOf.call(classList, token);
}
, ClassList = function (elem) {
var
trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
, i = 0
, len = classes.length
;
for (; i < len; i++) {
this.push(classes[i]);
}
this._updateClassName = function () {
elem.setAttribute("class", this.toString());
};
}
, classListProto = ClassList[protoProp] = []
, classListGetter = function () {
return new ClassList(this);
}
;
// Most DOMException implementations don't allow calling DOMException's toString()
// on non-DOMExceptions. Error's toString() is sufficient here.
DOMEx[protoProp] = Error[protoProp];
classListProto.item = function (i) {
return this[i] || null;
};
classListProto.contains = function (token) {
token += "";
return checkTokenAndGetIndex(this, token) !== -1;
};
classListProto.add = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
;
do {
token = tokens[i] + "";
if (checkTokenAndGetIndex(this, token) === -1) {
this.push(token);
updated = true;
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.remove = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
, index
;
do {
token = tokens[i] + "";
index = checkTokenAndGetIndex(this, token);
while (index !== -1) {
this.splice(index, 1);
updated = true;
index = checkTokenAndGetIndex(this, token);
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.toggle = function (token, force) {
token += "";
var
result = this.contains(token)
, method = result ?
force !== true && "remove"
:
force !== false && "add"
;
if (method) {
this[method](token);
}
if (force === true || force === false) {
return force;
} else {
return !result;
}
};
classListProto.toString = function () {
return this.join(" ");
};
if (objCtr.defineProperty) {
var classListPropDesc = {
get: classListGetter
, enumerable: true
, configurable: true
};
try {
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
} catch (ex) { // IE 8 doesn't support enumerable:true
if (ex.number === -0x7FF5EC54) {
classListPropDesc.enumerable = false;
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
}
}
} else if (objCtr[protoProp].__defineGetter__) {
elemCtrProto.__defineGetter__(classListProp, classListGetter);
}
}(self));
} else {
// There is full or partial native classList support, so just check if we need
// to normalize the add/remove and toggle APIs.
(function () {
"use strict";
var testElement = document.createElement("_");
testElement.classList.add("c1", "c2");
// Polyfill for IE 10/11 and Firefox <26, where classList.add and
// classList.remove exist but support only one argument at a time.
if (!testElement.classList.contains("c2")) {
var createMethod = function(method) {
var original = DOMTokenList.prototype[method];
DOMTokenList.prototype[method] = function(token) {
var i, len = arguments.length;
for (i = 0; i < len; i++) {
token = arguments[i];
original.call(this, token);
}
};
};
createMethod('add');
createMethod('remove');
}
testElement.classList.toggle("c3", false);
// Polyfill for IE 10 and Firefox <24, where classList.toggle does not
// support the second argument.
if (testElement.classList.contains("c3")) {
var _toggle = DOMTokenList.prototype.toggle;
DOMTokenList.prototype.toggle = function(token, force) {
if (1 in arguments && !this.contains(token) === !force) {
return force;
} else {
return _toggle.call(this, token);
}
};
}
testElement = null;
}());
}
}
/**
* Running the following code before any other code will create trim() if it's not natively available.
*/
if (!String.prototype.trim) {
(function() {
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
String.prototype.trim = function() {
return this.replace(rtrim, '');
};
})();
}
/**
* The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
*/
// Production steps of ECMA-262, Edition 5, 15.4.4.14
// Reference: http://es5.github.io/#x15.4.4.14
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) {
var k;
// 1. Let O be the result of calling ToObject passing
// the this value as the argument.
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
// 2. Let lenValue be the result of calling the Get
// internal method of O with the argument "length".
// 3. Let len be ToUint32(lenValue).
var len = O.length >>> 0;
// 4. If len is 0, return -1.
if (len === 0) {
return -1;
}
// 5. If argument fromIndex was passed let n be
// ToInteger(fromIndex); else let n be 0.
var n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
// 6. If n >= len, return -1.
if (n >= len) {
return -1;
}
// 7. If n >= 0, then Let k be n.
// 8. Else, n<0, Let k be len - abs(n).
// If k is less than 0, then let k be 0.
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
// 9. Repeat, while k < len
while (k < len) {
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the
// HasProperty internal method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
// i. Let elementK be the result of calling the Get
// internal method of O with the argument ToString(k).
// ii. Let same be the result of applying the
// Strict Equality Comparison Algorithm to
// searchElement and elementK.
// iii. If same is true, return k.
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
/**
* @license addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
* https://gist.github.com/2864711/946225eb3822c203e8d6218095d888aac5e1748e
*/
(function (window, document, listeners_prop_name) {
if ((!window.addEventListener || !window.removeEventListener) && window.attachEvent && window.detachEvent) {
/**
* @param {*} value
* @return {boolean}
*/
var is_callable = function (value) {
return typeof value === 'function';
};
/**
* @param {!Window|HTMLDocument|Node} self
* @param {EventListener|function(!Event):(boolean|undefined)} listener
* @return {!function(Event)|undefined}
*/
var listener_get = function (self, listener) {
var listeners = listener[listeners_prop_name];
if (listeners) {
var lis;
var i = listeners.length;
while (i--) {
lis = listeners[i];
if (lis[0] === self) {
return lis[1];
}
}
}
};
/**
* @param {!Window|HTMLDocument|Node} self
* @param {EventListener|function(!Event):(boolean|undefined)} listener
* @param {!function(Event)} callback
* @return {!function(Event)}
*/
var listener_set = function (self, listener, callback) {
var listeners = listener[listeners_prop_name] || (listener[listeners_prop_name] = []);
return listener_get(self, listener) || (listeners[listeners.length] = [self, callback], callback);
};
/**
* @param {string} methodName
*/
var docHijack = function (methodName) {
var old = document[methodName];
document[methodName] = function (v) {
return addListen(old(v));
};
};
/**
* @this {!Window|HTMLDocument|Node}
* @param {string} type
* @param {EventListener|function(!Event):(boolean|undefined)} listener
* @param {boolean=} useCapture
*/
var addEvent = function (type, listener, useCapture) {
if (is_callable(listener)) {
var self = this;
self.attachEvent(
'on' + type,
listener_set(self, listener, function (e) {
e = e || window.event;
e.preventDefault = e.preventDefault || function () { e.returnValue = false };
e.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true };
e.target = e.target || e.srcElement || document.documentElement;
e.currentTarget = e.currentTarget || self;
e.timeStamp = e.timeStamp || (new Date()).getTime();
listener.call(self, e);
})
);
}
};
/**
* @this {!Window|HTMLDocument|Node}
* @param {string} type
* @param {EventListener|function(!Event):(boolean|undefined)} listener
* @param {boolean=} useCapture
*/
var removeEvent = function (type, listener, useCapture) {
if (is_callable(listener)) {
var self = this;
var lis = listener_get(self, listener);
if (lis) {
self.detachEvent('on' + type, lis);
}
}
};
/**
* @param {!Node|NodeList|Array} obj
* @return {!Node|NodeList|Array}
*/
var addListen = function (obj) {
var i = obj.length;
if (i) {
while (i--) {
obj[i].addEventListener = addEvent;
obj[i].removeEventListener = removeEvent;
}
} else {
obj.addEventListener = addEvent;
obj.removeEventListener = removeEvent;
}
return obj;
};
addListen([document, window]);
if ('Element' in window) {
/**
* IE8
*/
var element = window.Element;
element.prototype.addEventListener = addEvent;
element.prototype.removeEventListener = removeEvent;
} else {
/**
* IE < 8
*/
//Make sure we also init at domReady
document.attachEvent('onreadystatechange', function () { addListen(document.all) });
docHijack('getElementsByTagName');
docHijack('getElementById');
docHijack('createElement');
addListen(document.all);
}
}
})(window, document, 'x-ms-event-listeners');
/**
* :scope polyfill
* http://stackoverflow.com/questions/6481612/queryselector-search-immediate-children
*/
(function(doc, proto) {
try { // check if browser supports :scope natively
doc.querySelector(':scope body');
} catch (err) { // polyfill native methods if it doesn't
['querySelector', 'querySelectorAll'].forEach(function(method) {
var native = proto[method];
proto[method] = function(selectors) {
if (/(^|,)\s*:scope/.test(selectors)) { // only if selectors contains :scope
var id = this.id; // remember current element id
this.id = 'ID_' + Date.now(); // assign new unique id
selectors = selectors.replace(/((^|,)\s*):scope/g, '$1#' + this.id); // replace :scope with #ID
var result = doc[method](selectors);
this.id = id; // restore previous id
return result;
} else {
return native.call(this, selectors); // use native code for other selectors
}
}
});
}
})(window.document, Element.prototype); | {
"content_hash": "19d536c0776ea25d49d6e47276c0a719",
"timestamp": "",
"source": "github",
"line_count": 737,
"max_line_length": 127,
"avg_line_length": 36.83175033921302,
"alnum_prop": 0.4751888008841407,
"repo_name": "galaxysss/god",
"id": "548562d8546c8de96b5734ba17641cca66eaa25e",
"size": "27145",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "public_html/custombox/src/js/legacy.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "159"
},
{
"name": "Batchfile",
"bytes": "660"
},
{
"name": "CSS",
"bytes": "114987"
},
{
"name": "HTML",
"bytes": "271306"
},
{
"name": "JavaScript",
"bytes": "541079"
},
{
"name": "PHP",
"bytes": "831700"
},
{
"name": "Shell",
"bytes": "42"
},
{
"name": "Smarty",
"bytes": "11167"
}
],
"symlink_target": ""
} |
<DIV NAME="detail" ID="detail" xmlns="http://www.w3.org/TR/REC-html40"><H3><A NAME='detail_RenameFile'></A>Autoit DDDriverFileCommands::<BIG>RenameFile</BIG>
</H3> <TABLE><TR>
<TD class="borderStyle"><SPAN CLASS='Support' TITLE='SAFS TID Commands'>TID</SPAN></TD>
<TD class="borderStyle"><SPAN CLASS='Support' TITLE='SAFS Driver Commands'>SDC</SPAN></TD>
</TR></TABLE>
<DIV NAME="list" ID="short_desc"><short_desc xmlns="">
Rename the file from the old file name to the new filename
</short_desc></DIV>
<BR/>
<DIV NAME="list" ID="detail_desc"/>
<BR/>
<DIV NAME="list" ID="other">
<p><B>Fields: </B><SMALL>[ ]=Optional with Default Value</SMALL></p>
<code class="safs">
<OL start="3" ><LI>
<B>OldFileName</B>
<BR/>
<DIV NAME="list" ID="short_desc"><short_desc xmlns="">
The file path and file name of the file to be renamed.
</short_desc></DIV>
<BR/>
<DIV NAME="list" ID="detail_desc"/>
</LI>
<LI>
<B>NewFileName</B>
<BR/>
<DIV NAME="list" ID="short_desc"><short_desc xmlns="">
The new file path and file name of the file.
</short_desc></DIV>
<BR/>
<DIV NAME="list" ID="detail_desc"/>
</LI>
<LI>[ <B>NoVerify</B> = ]<BR/>
<DIV NAME="list" ID="short_desc"><short_desc xmlns="">
String Equal to "NOVERIFY" if file is not verified prior to renaming.
</short_desc></DIV>
<BR/>
<DIV NAME="list" ID="detail_desc"/>
</LI></OL ></code>
<br/>
<p><B>Examples:</B></p>
<code class="safs"><UL>
<LI>
<B><usage xmlns="">
C, RenameFile, "C:/Test/Test1.txt" , "C:/Test/Test2.txt"
</usage></B>
<BR/><DIV NAME="list" ID="short_desc"><short_desc xmlns="">
Rename file C:/Test/Test1.txt to C:/Test/Test2.txt
</short_desc></DIV>
<BR/>
<DIV NAME="list" ID="detail_desc"/>
</LI>
<LI>
<B><usage xmlns="">
C, RenameFile, "C:/Test/Test1.txt" , "C:/Test/Test2.txt","NOVERIFY"
</usage></B>
<BR/><DIV NAME="list" ID="short_desc"><short_desc xmlns="">
Rename file C:/Test/Test1.txt to C:/Test/Test2.txt no file existence verification
</short_desc></DIV>
<BR/>
<DIV NAME="list" ID="detail_desc"/>
</LI>
</UL>
</code>
<br/>
<A href="SAFSReferenceKey.htm" alt="Reference Legend or Key">
<SMALL><B>[How To Read This Reference]</B></SMALL>
</A>
<HR/>
</DIV>
</DIV>
| {
"content_hash": "f32e8bf9ada90b331080b925ce25b81b",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 157,
"avg_line_length": 32.791666666666664,
"alnum_prop": 0.5840745446844557,
"repo_name": "kid551/safsdev.test.github.io",
"id": "509aed421afd86e00303438565815fa6bfcb2c77",
"size": "2361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "keyref/AutoitDDDriverFileCommandsRenameFile.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "27646"
},
{
"name": "HTML",
"bytes": "27805169"
},
{
"name": "JavaScript",
"bytes": "2769"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Bull. Soc. bot. Genève 3: (1911)
#### Original name
Rhizohypha radicis-limodori Chodat & Sigr., 1911
### Remarks
null | {
"content_hash": "5027659bb84198238be7df282450db20",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 48,
"avg_line_length": 15.846153846153847,
"alnum_prop": 0.7038834951456311,
"repo_name": "mdoering/backbone",
"id": "959bf3a82e24fb027c73127370040fba6d8816b2",
"size": "279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Rhizohypha/Rhizohypha radicis-limodori/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
namespace ash {
class CellularESimProfileHandler;
class NetworkState;
namespace network_name_util {
// Returns eSIM profile name for a given |network_state|.
// Returns null if |cellular_esim_profile_handler| is null, or network is not
// an eSIM network.
COMPONENT_EXPORT(CHROMEOS_NETWORK)
absl::optional<std::string> GetESimProfileName(
CellularESimProfileHandler* cellular_esim_profile_handler,
const NetworkState* network_state);
// Returns network name for a given |network_state|. If network
// is eSIM it calls GetESimProfileName and uses |cellular_esim_profile_handler|
// to get the eSIM profile name. If |cellular_esim_profile_handler| is null,
// this function returns |network_state->name|.
COMPONENT_EXPORT(CHROMEOS_NETWORK)
std::string GetNetworkName(
CellularESimProfileHandler* cellular_esim_profile_handler,
const NetworkState* network_state);
} // namespace network_name_util
} // namespace ash
// TODO(https://crbug.com/1164001): remove when the migration is finished.
namespace chromeos::network_name_util {
using ::ash::network_name_util::GetESimProfileName;
using ::ash::network_name_util::GetNetworkName;
} // namespace chromeos::network_name_util
#endif // CHROMEOS_ASH_COMPONENTS_NETWORK_NETWORK_NAME_UTIL_H_
| {
"content_hash": "1672b2f915af7c058d1ff470199ebfd3",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 37.11764705882353,
"alnum_prop": 0.768621236133122,
"repo_name": "nwjs/chromium.src",
"id": "5c12786b4af6a5216f97a5494352d93a7a116cb2",
"size": "1640",
"binary": false,
"copies": "6",
"ref": "refs/heads/nw70",
"path": "chromeos/ash/components/network/network_name_util.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
namespace Content.Client.Disease;
/// <summary>
/// Holds the idle and running state for machines to control
/// playing animtions on the client.
/// </summary>
[RegisterComponent]
public sealed class DiseaseMachineVisualsComponent : Component
{
[DataField("idleState", required: true)]
public string IdleState = default!;
[DataField("runningState", required: true)]
public string RunningState = default!;
}
| {
"content_hash": "6d66b4488e334c41e5eb9168675e092f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 62,
"avg_line_length": 28.4,
"alnum_prop": 0.7323943661971831,
"repo_name": "space-wizards/space-station-14",
"id": "2194cd1c789b4ce85519f07a5e040a26d5c01df7",
"size": "426",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Content.Client/Disease/DiseaseMachineVisualsComponent.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "207"
},
{
"name": "C#",
"bytes": "11693587"
},
{
"name": "CSS",
"bytes": "8911"
},
{
"name": "Fluent",
"bytes": "375648"
},
{
"name": "FreeMarker",
"bytes": "2267"
},
{
"name": "Go",
"bytes": "5199"
},
{
"name": "JavaScript",
"bytes": "1135"
},
{
"name": "MATLAB",
"bytes": "4971"
},
{
"name": "PowerShell",
"bytes": "3902"
},
{
"name": "Python",
"bytes": "36026"
},
{
"name": "Shell",
"bytes": "1140"
}
],
"symlink_target": ""
} |
SET(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")
# The top level Makefile was generated from the following files:
SET(CMAKE_MAKEFILE_DEPENDS
"CMakeCache.txt"
"CMakeFiles/2.8.12.2/CMakeCCompiler.cmake"
"CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake"
"CMakeFiles/2.8.12.2/CMakeSystem.cmake"
"Lab4/CMakeLists.txt"
"Lab4/MathFunctions/CMakeLists.txt"
"Lab4/TutorialConfig.h.in"
"/usr/share/cmake-2.8/Modules/CMakeCInformation.cmake"
"/usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake"
"/usr/share/cmake-2.8/Modules/CMakeCommonLanguageInclude.cmake"
"/usr/share/cmake-2.8/Modules/CMakeGenericSystem.cmake"
"/usr/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake"
"/usr/share/cmake-2.8/Modules/CTest.cmake"
"/usr/share/cmake-2.8/Modules/CTestTargets.cmake"
"/usr/share/cmake-2.8/Modules/CTestUseLaunchers.cmake"
"/usr/share/cmake-2.8/Modules/CheckFunctionExists.c"
"/usr/share/cmake-2.8/Modules/CheckFunctionExists.cmake"
"/usr/share/cmake-2.8/Modules/Compiler/GNU-C.cmake"
"/usr/share/cmake-2.8/Modules/Compiler/GNU-CXX.cmake"
"/usr/share/cmake-2.8/Modules/Compiler/GNU.cmake"
"/usr/share/cmake-2.8/Modules/DartConfiguration.tcl.in"
"/usr/share/cmake-2.8/Modules/Platform/Linux-GNU-C.cmake"
"/usr/share/cmake-2.8/Modules/Platform/Linux-GNU-CXX.cmake"
"/usr/share/cmake-2.8/Modules/Platform/Linux-GNU.cmake"
"/usr/share/cmake-2.8/Modules/Platform/Linux.cmake"
"/usr/share/cmake-2.8/Modules/Platform/UnixPaths.cmake"
)
# The corresponding makefile is:
SET(CMAKE_MAKEFILE_OUTPUTS
"Makefile"
"CMakeFiles/cmake.check_cache"
)
# Byproducts of CMake generate step:
SET(CMAKE_MAKEFILE_PRODUCTS
"DartConfiguration.tcl"
"TutorialConfig.h"
"CMakeFiles/CMakeDirectoryInformation.cmake"
"MathFunctions/CMakeFiles/CMakeDirectoryInformation.cmake"
)
# Dependency information for all targets:
SET(CMAKE_DEPEND_INFO_FILES
"CMakeFiles/Continuous.dir/DependInfo.cmake"
"CMakeFiles/ContinuousBuild.dir/DependInfo.cmake"
"CMakeFiles/ContinuousConfigure.dir/DependInfo.cmake"
"CMakeFiles/ContinuousCoverage.dir/DependInfo.cmake"
"CMakeFiles/ContinuousMemCheck.dir/DependInfo.cmake"
"CMakeFiles/ContinuousStart.dir/DependInfo.cmake"
"CMakeFiles/ContinuousSubmit.dir/DependInfo.cmake"
"CMakeFiles/ContinuousTest.dir/DependInfo.cmake"
"CMakeFiles/ContinuousUpdate.dir/DependInfo.cmake"
"CMakeFiles/Experimental.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalBuild.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalConfigure.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalCoverage.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalMemCheck.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalStart.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalSubmit.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalTest.dir/DependInfo.cmake"
"CMakeFiles/ExperimentalUpdate.dir/DependInfo.cmake"
"CMakeFiles/Nightly.dir/DependInfo.cmake"
"CMakeFiles/NightlyBuild.dir/DependInfo.cmake"
"CMakeFiles/NightlyConfigure.dir/DependInfo.cmake"
"CMakeFiles/NightlyCoverage.dir/DependInfo.cmake"
"CMakeFiles/NightlyMemCheck.dir/DependInfo.cmake"
"CMakeFiles/NightlyMemoryCheck.dir/DependInfo.cmake"
"CMakeFiles/NightlyStart.dir/DependInfo.cmake"
"CMakeFiles/NightlySubmit.dir/DependInfo.cmake"
"CMakeFiles/NightlyTest.dir/DependInfo.cmake"
"CMakeFiles/NightlyUpdate.dir/DependInfo.cmake"
"CMakeFiles/Tutorial.dir/DependInfo.cmake"
"MathFunctions/CMakeFiles/MakeTable.dir/DependInfo.cmake"
"MathFunctions/CMakeFiles/MathFunctions.dir/DependInfo.cmake"
)
| {
"content_hash": "b790fba54396a4959a4105fe3a31425c",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 69,
"avg_line_length": 44.0625,
"alnum_prop": 0.7934751773049645,
"repo_name": "NickSquared/OpenSource",
"id": "7968118eb3b6e9417f8b9ce7c7d9edc6fdda7135",
"size": "3649",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CMakeFiles/Makefile.cmake",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "12194"
},
{
"name": "C++",
"bytes": "13900"
},
{
"name": "CMake",
"bytes": "41872"
},
{
"name": "Makefile",
"bytes": "107949"
},
{
"name": "Python",
"bytes": "310"
},
{
"name": "Tcl",
"bytes": "2247"
}
],
"symlink_target": ""
} |
package com.castle.repo.jpa.json;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.databind.ObjectMapper;
@Configuration
public class JpaJsonConfigBean implements InitializingBean {
@Autowired
private ObjectMapper objectMapper;
@Bean
public JpaModule jpaModule() {
return new JpaModule();
}
@Override
public void afterPropertiesSet() throws Exception {
objectMapper.registerModule(jpaModule());
}
}
| {
"content_hash": "e021635cf2853cd1f64cf74e24b6eecd",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 62,
"avg_line_length": 25.346153846153847,
"alnum_prop": 0.7845220030349014,
"repo_name": "xiangxik/castle-platform",
"id": "46be1eef09415cb3be304b694d6ee1f4c323457f",
"size": "659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "castle-framework/castle-repo-jpa/src/main/java/com/castle/repo/jpa/json/JpaJsonConfigBean.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "688244"
},
{
"name": "Java",
"bytes": "257125"
},
{
"name": "JavaScript",
"bytes": "1705481"
}
],
"symlink_target": ""
} |
<?php
$this->load->view('template/head');
?>
<meta http-equiv="refresh" content="600">
<script src="../../application/views/rawat-inap/index.js"></script>
<!--tambahkan custom css disini-->
<?php
$this->load->view('template/topbar');
$this->load->view('template/sidebar');
?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Transaksi Rawat Inap
</h1>
</section>
<!-- Main content -->
<section class="content" ng-app="myApp" ng-controller="myController" ng-init="del_access='<?= $this->session->userdata('del') ?>'">
<!-- Default box -->
<div class="box">
<div class="box-header with-border">
<!-- daterangepicker -->
<div id="reportrange" date-range-picker class="date-picker pull-left" ng-model="datePicker.date" options="opts" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 250px">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
<span></span> <b class="caret"></b>
</div>
<!-- add -->
<button class="btn btn-success pull-right" ng-click="add()">Tambah</button>
</div>
<div class="box-body">
<table
ng-table="tableParams"
ng-form="tableForm"
show-filter="true"
demo-tracked-table="tableTracker"
class="table table-bordered table-striped nowrap table-responsive" cellspacing="0" width="100%">
<colgroup>
<col>
<col>
<col>
<col>
<!-- <col> -->
<col>
<col>
<col>
<col>
<col width="130px">
<col width="100px">
</colgroup>
<tr
ng-repeat="row in $data"
ng-form="rowForm"
demo-tracked-table-row="row" ng-class="{'danger': row.is_close == '0' || row.is_close == '1'}">
<td title="'#'" sortable="'$index'">{{ $index + 1 }}</td>
<td title="'Kode Transaksi'" filter="{ kode_transaksi: 'text'}" sortable="'kode_transaksi'">{{ row.kode_transaksi }}</td>
<td title="'No Rm'" filter="{ no_rm: 'text'}" sortable="'no_rm'">{{ row.no_rm }}</td>
<td title="'Nama Pasien'" filter="{ nama_pasien: 'text'}" sortable="'nama_pasien'">{{ row.nama_pasien }}</td>
<td title="'Alamat'" filter="{ alamat: 'text'}" sortable="'alamat'">{{ row.alamat }}</td>
<td title="'Telp'" filter="{ nama: 'text'}" sortable="'telp'">{{ row.telp }}</td>
<td title="'Tgl Masuk'" filter="{ tgl_masuk: 'text'}" sortable="'tgl_masuk'">{{ row.tgl_masuk }}</td>
<td title="'Tgl Keluar'" filter="{ tgl_keluar: 'text'}" sortable="'tgl_keluar'">{{ row.tgl_keluar }}</td>
<!-- -->
<td align="center">
<a class="btn btn-sm btn-default" ng-href="rawat_inap/view/{{row.kode_transaksi}}">
<i class="fa fa-arrow-circle-o-right"></i></a>
<a class="btn btn-sm btn-default" ng-href="{{row.is_close == '0' ? 'rawat_inap/transaksi/' + row.kode_transaksi : 'rawat_inap/view_transaksi/' + row.kode_transaksi}}">
<i ng-class="{'fa fa-plus': row.is_close == '0', 'fa fa-check': row.is_close != '0'}"></i></a>
<a class="btn btn-sm btn-default" type="submit" ng-href="rawat_inap/detail/{{row.kode_transaksi}}">
<i class="fa fa-eye"></i></a>
</td>
<td align="center">
<div ng-if="row.is_close != '2'">
<!-- edit -->
<a class="btn btn-sm btn-default" ng-href="{{row.is_close == '0' ? 'rawat_inap/edit/' + row.kode_transaksi : 'rawat_inap/do_undo/' + row.kode_transaksi}}">
<i class="{{row.is_close == '0' ? 'fa fa-edit' : 'fa fa-undo'}}"></i></a>
<!-- delete -->
<a class="btn btn-sm btn-danger" ng-click="del(row.kode_transaksi, $index)">
<i class="fa fa-remove"></i></a>
</div>
</td>
</tr>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</section><!-- /.content -->
<?php
$this->load->view('template/js');
?>
<!--tambahkan custom js disini-->
<!-- page script -->
<?php
$this->load->view('template/foot');
?> | {
"content_hash": "a7317756c77a1fc5dbb93a22d19a774d",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 193,
"avg_line_length": 40.72549019607843,
"alnum_prop": 0.5317766008666346,
"repo_name": "nizamiftahul/ci_p1",
"id": "9ccff9a02e87ae95df9b20a89fa425408a8f376f",
"size": "4154",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/rawat-inap/index.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "265"
},
{
"name": "CSS",
"bytes": "903300"
},
{
"name": "HTML",
"bytes": "11163728"
},
{
"name": "JavaScript",
"bytes": "3032614"
},
{
"name": "PHP",
"bytes": "2692351"
},
{
"name": "Python",
"bytes": "32324"
}
],
"symlink_target": ""
} |
/*************************************************************************/
/* gradle_export_util.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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. */
/*************************************************************************/
#ifndef GODOT_GRADLE_EXPORT_UTIL_H
#define GODOT_GRADLE_EXPORT_UTIL_H
#include "core/io/zip_io.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "editor/editor_export.h"
const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="utf-8"?>
<!--WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME-->
<resources>
<string name="godot_project_name_string">%s</string>
</resources>
)";
DisplayServer::ScreenOrientation _get_screen_orientation() {
String orientation_settings = ProjectSettings::get_singleton()->get("display/window/handheld/orientation");
DisplayServer::ScreenOrientation screen_orientation;
if (orientation_settings == "portrait") {
screen_orientation = DisplayServer::SCREEN_PORTRAIT;
} else if (orientation_settings == "reverse_landscape") {
screen_orientation = DisplayServer::SCREEN_REVERSE_LANDSCAPE;
} else if (orientation_settings == "reverse_portrait") {
screen_orientation = DisplayServer::SCREEN_REVERSE_PORTRAIT;
} else if (orientation_settings == "sensor_landscape") {
screen_orientation = DisplayServer::SCREEN_SENSOR_LANDSCAPE;
} else if (orientation_settings == "sensor_portrait") {
screen_orientation = DisplayServer::SCREEN_SENSOR_PORTRAIT;
} else if (orientation_settings == "sensor") {
screen_orientation = DisplayServer::SCREEN_SENSOR;
} else {
screen_orientation = DisplayServer::SCREEN_LANDSCAPE;
}
return screen_orientation;
}
int _get_android_orientation_value(DisplayServer::ScreenOrientation screen_orientation) {
switch (screen_orientation) {
case DisplayServer::SCREEN_PORTRAIT:
return 1;
case DisplayServer::SCREEN_REVERSE_LANDSCAPE:
return 8;
case DisplayServer::SCREEN_REVERSE_PORTRAIT:
return 9;
case DisplayServer::SCREEN_SENSOR_LANDSCAPE:
return 11;
case DisplayServer::SCREEN_SENSOR_PORTRAIT:
return 12;
case DisplayServer::SCREEN_SENSOR:
return 13;
case DisplayServer::SCREEN_LANDSCAPE:
default:
return 0;
}
}
String _get_android_orientation_label(DisplayServer::ScreenOrientation screen_orientation) {
switch (screen_orientation) {
case DisplayServer::SCREEN_PORTRAIT:
return "portrait";
case DisplayServer::SCREEN_REVERSE_LANDSCAPE:
return "reverseLandscape";
case DisplayServer::SCREEN_REVERSE_PORTRAIT:
return "reversePortrait";
case DisplayServer::SCREEN_SENSOR_LANDSCAPE:
return "userLandscape";
case DisplayServer::SCREEN_SENSOR_PORTRAIT:
return "userPortrait";
case DisplayServer::SCREEN_SENSOR:
return "fullUser";
case DisplayServer::SCREEN_LANDSCAPE:
default:
return "landscape";
}
}
// Utility method used to create a directory.
Error create_directory(const String &p_dir) {
if (!DirAccess::exists(p_dir)) {
DirAccess *filesystem_da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
ERR_FAIL_COND_V_MSG(!filesystem_da, ERR_CANT_CREATE, "Cannot create directory '" + p_dir + "'.");
Error err = filesystem_da->make_dir_recursive(p_dir);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "Cannot create directory '" + p_dir + "'.");
memdelete(filesystem_da);
}
return OK;
}
// Implementation of EditorExportSaveSharedObject.
// This method will only be called as an input to export_project_files.
// This method lets the .so files for all ABIs to be copied
// into the gradle project from the .AAR file
Error ignore_so_file(void *p_userdata, const SharedObject &p_so) {
return OK;
}
// Writes p_data into a file at p_path, creating directories if necessary.
// Note: this will overwrite the file at p_path if it already exists.
Error store_file_at_path(const String &p_path, const Vector<uint8_t> &p_data) {
String dir = p_path.get_base_dir();
Error err = create_directory(dir);
if (err != OK) {
return err;
}
FileAccess *fa = FileAccess::open(p_path, FileAccess::WRITE);
ERR_FAIL_COND_V_MSG(!fa, ERR_CANT_CREATE, "Cannot create file '" + p_path + "'.");
fa->store_buffer(p_data.ptr(), p_data.size());
memdelete(fa);
return OK;
}
// Writes string p_data into a file at p_path, creating directories if necessary.
// Note: this will overwrite the file at p_path if it already exists.
Error store_string_at_path(const String &p_path, const String &p_data) {
String dir = p_path.get_base_dir();
Error err = create_directory(dir);
if (err != OK) {
if (OS::get_singleton()->is_stdout_verbose()) {
print_error("Unable to write data into " + p_path);
}
return err;
}
FileAccess *fa = FileAccess::open(p_path, FileAccess::WRITE);
ERR_FAIL_COND_V_MSG(!fa, ERR_CANT_CREATE, "Cannot create file '" + p_path + "'.");
fa->store_string(p_data);
memdelete(fa);
return OK;
}
// Implementation of EditorExportSaveFunction.
// This method will only be called as an input to export_project_files.
// It is used by the export_project_files method to save all the asset files into the gradle project.
// It's functionality mirrors that of the method save_apk_file.
// This method will be called ONLY when custom build is enabled.
Error rename_and_store_file_in_gradle_project(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key) {
String dst_path = p_path.replace_first("res://", "res://android/build/assets/");
print_verbose("Saving project files from " + p_path + " into " + dst_path);
Error err = store_file_at_path(dst_path, p_data);
return err;
}
// Creates strings.xml files inside the gradle project for different locales.
Error _create_project_name_strings_files(const Ref<EditorExportPreset> &p_preset, const String &project_name) {
print_verbose("Creating strings resources for supported locales for project " + project_name);
// Stores the string into the default values directory.
String processed_default_xml_string = vformat(godot_project_name_xml_string, project_name.xml_escape(true));
store_string_at_path("res://android/build/res/values/godot_project_name_string.xml", processed_default_xml_string);
// Searches the Gradle project res/ directory to find all supported locales
DirAccessRef da = DirAccess::open("res://android/build/res");
if (!da) {
if (OS::get_singleton()->is_stdout_verbose()) {
print_error("Unable to open Android resources directory.");
}
return ERR_CANT_OPEN;
}
da->list_dir_begin();
while (true) {
String file = da->get_next();
if (file == "") {
break;
}
if (!file.begins_with("values-")) {
// NOTE: This assumes all directories that start with "values-" are for localization.
continue;
}
String locale = file.replace("values-", "").replace("-r", "_");
String property_name = "application/config/name_" + locale;
String locale_directory = "res://android/build/res/" + file + "/godot_project_name_string.xml";
if (ProjectSettings::get_singleton()->has_setting(property_name)) {
String locale_project_name = ProjectSettings::get_singleton()->get(property_name);
String processed_xml_string = vformat(godot_project_name_xml_string, locale_project_name.xml_escape(true));
print_verbose("Storing project name for locale " + locale + " under " + locale_directory);
store_string_at_path(locale_directory, processed_xml_string);
} else {
// TODO: Once the legacy build system is deprecated we don't need to have xml files for this else branch
store_string_at_path(locale_directory, processed_default_xml_string);
}
}
da->list_dir_end();
return OK;
}
String bool_to_string(bool v) {
return v ? "true" : "false";
}
String _get_gles_tag() {
bool min_gles3 = ProjectSettings::get_singleton()->get("rendering/driver/driver_name") == "GLES3" &&
!ProjectSettings::get_singleton()->get("rendering/driver/fallback_to_gles2");
return min_gles3 ? " <uses-feature android:glEsVersion=\"0x00030000\" android:required=\"true\" />\n" : "";
}
String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset) {
String manifest_screen_sizes = " <supports-screens \n tools:node=\"replace\"";
String sizes[] = { "small", "normal", "large", "xlarge" };
size_t num_sizes = sizeof(sizes) / sizeof(sizes[0]);
for (size_t i = 0; i < num_sizes; i++) {
String feature_name = vformat("screen/support_%s", sizes[i]);
String feature_support = bool_to_string(p_preset->get(feature_name));
String xml_entry = vformat("\n android:%sScreens=\"%s\"", sizes[i], feature_support);
manifest_screen_sizes += xml_entry;
}
manifest_screen_sizes += " />\n";
return manifest_screen_sizes;
}
String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset) {
String manifest_xr_features;
bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1;
if (uses_xr) {
int dof_index = p_preset->get("xr_features/degrees_of_freedom"); // 0: none, 1: 3dof and 6dof, 2: 6dof
if (dof_index == 1) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"android.hardware.vr.headtracking\" android:required=\"false\" android:version=\"1\" />\n";
} else if (dof_index == 2) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"android.hardware.vr.headtracking\" android:required=\"true\" android:version=\"1\" />\n";
}
int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required
if (hand_tracking_index == 1) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"oculus.software.handtracking\" android:required=\"false\" />\n";
} else if (hand_tracking_index == 2) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"oculus.software.handtracking\" android:required=\"true\" />\n";
}
}
return manifest_xr_features;
}
String _get_instrumentation_tag(const Ref<EditorExportPreset> &p_preset) {
String package_name = p_preset->get("package/unique_name");
String manifest_instrumentation_text = vformat(
" <instrumentation\n"
" tools:node=\"replace\"\n"
" android:name=\".GodotInstrumentation\"\n"
" android:icon=\"@mipmap/icon\"\n"
" android:label=\"@string/godot_project_name_string\"\n"
" android:targetPackage=\"%s\" />\n",
package_name);
return manifest_instrumentation_text;
}
String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1;
String orientation = _get_android_orientation_label(_get_screen_orientation());
String manifest_activity_text = vformat(
" <activity android:name=\"com.godot.game.GodotApp\" "
"tools:replace=\"android:screenOrientation\" "
"android:screenOrientation=\"%s\">\n",
orientation);
if (uses_xr) {
String focus_awareness = bool_to_string(p_preset->get("xr_features/focus_awareness"));
manifest_activity_text += vformat(" <meta-data tools:node=\"replace\" android:name=\"com.oculus.vr.focusaware\" android:value=\"%s\" />\n", focus_awareness);
} else {
manifest_activity_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.vr.focusaware\" />\n";
}
manifest_activity_text += " </activity>\n";
return manifest_activity_text;
}
String _get_application_tag(const Ref<EditorExportPreset> &p_preset) {
bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1;
String manifest_application_text =
" <application android:label=\"@string/godot_project_name_string\"\n"
" android:allowBackup=\"false\" tools:ignore=\"GoogleAppIndexingWarning\"\n"
" android:icon=\"@mipmap/icon\">\n\n"
" <meta-data tools:node=\"remove\" android:name=\"xr_mode_metadata_name\" />\n";
if (uses_xr) {
manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.samsung.android.vr.application.mode\" android:value=\"vr_only\" />\n";
}
manifest_application_text += _get_activity_tag(p_preset);
manifest_application_text += " </application>\n";
return manifest_application_text;
}
#endif //GODOT_GRADLE_EXPORT_UTIL_H
| {
"content_hash": "3bc24357d4cd8b472f5f77369ce6dfc5",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 253,
"avg_line_length": 46.381107491856675,
"alnum_prop": 0.6607907858697942,
"repo_name": "MarianoGnu/godot",
"id": "40b8e90c6f3a1e5cfbad32bd3b46bc8277cbc1ba",
"size": "14239",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "platform/android/export/gradle_export_util.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "820090"
},
{
"name": "C#",
"bytes": "763062"
},
{
"name": "C++",
"bytes": "31755969"
},
{
"name": "CMake",
"bytes": "589"
},
{
"name": "GDScript",
"bytes": "874"
},
{
"name": "GLSL",
"bytes": "527494"
},
{
"name": "Java",
"bytes": "517749"
},
{
"name": "JavaScript",
"bytes": "164017"
},
{
"name": "Kotlin",
"bytes": "16048"
},
{
"name": "Makefile",
"bytes": "451"
},
{
"name": "Objective-C",
"bytes": "30165"
},
{
"name": "Objective-C++",
"bytes": "275236"
},
{
"name": "PowerShell",
"bytes": "2713"
},
{
"name": "Python",
"bytes": "421222"
},
{
"name": "Shell",
"bytes": "24777"
}
],
"symlink_target": ""
} |
package org.edx.mobile.discussion;
public enum DiscussionPostsSort {
LastActivityAt,
VoteCount,
None
}
| {
"content_hash": "9c285c03f85d99f0f29b12b49fa00efb",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 34,
"avg_line_length": 16.571428571428573,
"alnum_prop": 0.7327586206896551,
"repo_name": "miptliot/edx-app-android",
"id": "7b0cee00301056990c46df52db84b5ae33be04e2",
"size": "116",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "VideoLocker/src/main/java/org/edx/mobile/discussion/DiscussionPostsSort.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1402"
},
{
"name": "HTML",
"bytes": "152757"
},
{
"name": "Java",
"bytes": "3013936"
},
{
"name": "Shell",
"bytes": "1699"
}
],
"symlink_target": ""
} |
layout: post
title: JBoss Marshalling the hidden serialization framework
categories : [JBoss-Marshalling]
tags:
- Java
- Hibernate
- JBoss Marshalling
- Serialization
post_author: Flemming Harms
redirect_from: "/2015/06/29/JBoss-Marshalling-the-hidden-serialization-framework/"
---
A few years back, I had the challenge to find a better solution for sending data between our client and server, and I think it’s about time to blog about it :-) We have been using XStream to serialize our java model to XML and it is sent via web service. This has been working fine for a long time, but our data structure was increasing in size and we started to suffer for performance, increasing memory footprint and unnecessary complexity.
It was time to come up with a new solution.
<!--more-->
## <a name=”thegoal”>[./](#thegoal) The goal is to
* Increase serialization speed and lower memory footprint.
* Support for custom object translators.
* Serializes arbitrary object graphs.
* Cycle detection.
## <a name="whatdidifoundout"></a>[./](#whatdidifoundout) What did I found out
First of all, there are a lot of frameworks that can help you to serialize your java objects, and they all come with pro and cons. So, I started to do a little research on different frameworks based on the listed requirements.
I narrowed it down to three frameworks that seem interesting:
* Kryo seems promising and really fast. Unfortunately, we had to do a lot refactoring on inner classes to get it to work with Kryo.
* Protobuf is another really fast serialization framework. The biggest issue with Protobuf, in our case, was that you have to describe the data structured up front.
* JBoss Marshalling is a sub project under the JBoss Remoting project. This looked very promising, especially because it supported all of our requirements right out off the box.
After a few prototypes, we decided to go with the JBoss Marshalling. The rest of the post shows how easy it is to use JBoss Marshalling for serializing java objects.
## <a name="solution"></a>[./](#solution) The solution
I created a small example showing how you can serialize/deserialize an object graph to the disk. This could easily be changed to use with a REST service between a client and server.
To spice up the example, I’m adding Hibernate to show how you can use object resolvers to unproxy Hibernate objects in the serialization process.
### The first step is to set up the MarshallerFactory.
The MashallerFactory is the entry point and will create a MarshallerFactory with the specified protocol. The parameter “river” sets the protocol it’s using for serialization.
See the [MarshallingService](https://github.com/fharms/java-examples/blob/master/jboss-marshalling-example/src/main/java/com/fharms/marshalling/service/MarshallingService.java#L56)
```java
MarshallerFactory marshallerFactory =
Marshalling.getProvidedMarshallerFactory("river");
```
At the moment, you can choose between the “river” and “serial” protocol, and there is not much information on the river protocol. However, this is what [@dmlloyd0](https://twitter.com/dmlloyd0) from the JBoss Marshalling project told me.
>The river protocol has a higher degree of compression. There are short forms for dozens of JDK classes and objects that require an extended form for standard serialization.
### Next step is the configuration
There are different configuration options you can set but not all are necessary by default, so you can play around with them to optimize performance.
``` java
MarshallingConfiguration configuration =
new MarshallingConfiguration();
configuration.setVersion(3);
configuration.setClassCount(10);
configuration.setBufferSize(8096);
configuration.setInstanceCount(100);
configuration.setExceptionListener(new MarshallingException());
configuration.setClassResolver(new SimpleClassResolver(getClass().getClassLoader()));
```
* The **"setClassCount"** will pre-size the internal map for class information. To avoid unnecessary resize later, find the number that is closest to the number of classes your model holds.
* The **"setBufferSize"** sets the size of the internal byte array for the input buffer. The bytes’ read is equal to the length of the buffer size. You can experiment with this parameter to increase performance. The default size is 512.
* The **"setInstanceCount"** will pre-size the internal map for instances. To avoid unnecessary resize later, find the number that is closest to the number of instances your object model holds.
* The **"setExceptionListener"** gives possibility to set your own exception lister. This is useful if you want to intercept special exceptions.
* The **"setClassResolver"** sets the classloader, which is use to resolve the classes. There are three options: “SimpleClassResolver”, “ContextClassResolver” and “ModularClassResolver”. The last option is for JBoss Module, and my guess is you can stick with the first two.
There are plenty more configuration options you can play with.
### Set up the object resolver and create marshaller.
The object resolver gives you the possibility to intercept objects when they are processed. There are two types of object resolvers: “pre resolver” and “resolver”.
```java
private Marshaller createMarshaller() throws IOException {
configuration.setObjectPreResolver(new ChainingObjectResolver(Collections.singletonList(new HibernateDetachResolver())));
return marshallerFactory.createMarshaller(configuration);
}
```
* **"setObjectPreResolver"** is invoked before user replacement and global object resolver. This is useful when handling Hibernate SerializableProxy objects to avoid the user replacement being executed before we can get the implementation class.
* **"setObjectResolver"** is invoked after user replacement and global object resolver. This is typically the object resolve you will use for most cases.
### The final step is to serialize and deserialize your objects.
The important part here is that you call the start before you serialize and deserialize and stop when you are finished.
```java
public void serialize(Object object, OutputStream outputStream) throws IOException {
Marshaller marshaller = createMarshaller();
marshaller.start(Marshalling.createByteOutput(outputStream));
try {
marshaller.writeObject(object);
} finally {
marshaller.finish();
}
}
public <T extends Object> T deserialize(InputStream inputStream, Class<T> type) throws Exception {
Unmarshaller unmarshaller = createUnmarshaller();
unmarshaller.start(Marshalling.createByteInput(inputStream));
try {
return type.cast(unmarshaller.readObject());
} finally {
unmarshaller.finish();
}
}
```
## <a name="wheredoifindthecode"></a>[./](#wheredoifindthecode) Where do I find the code.
>Jump to the [source code](https://github.com/fharms/java-examples/tree/master/jboss-marshalling-example) on github
## <a name="whatdidilearn"></a>[./](#whatdidilearn) What did I learn?
The [JBoss Marshalling](http://jbossmarshalling.jboss.org/) might not be the fasted serialization framework, but it does follow the java serialization specification, which means it pretty much works right out of the box with arbitrary object graphs.
The object resolvers are really powerful because it gives you control over the serialization and deserialization process. We have build object resolvers that detach objects and only send the id of the object because they already known on the client.
Some of our concerns were that we haven’t seen many others using Marshalling beside internal JBoss projects and our self. It’s hard to find examples and documentation. However, there is help to get both from the IRC channel #jboss-marshalling and the API documentation [Marshalling API](http://jbossmarshalling.jboss.org/docs)
You can also learn a great deal from the Marshalling [source code](https://github.com/jboss-remoting/jboss-marshalling)
If you are looking for a fast serialization framework that requires little investment and low risk, JBoss Marshalling is a good choice and we still use it as serialization framework between our client and server.
| {
"content_hash": "e047c611a575437a0ee3cb49ca0a4f5b",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 442,
"avg_line_length": 65.232,
"alnum_prop": 0.7863625214618593,
"repo_name": "fharms/fharms.github.io",
"id": "c2c85e0b99a925b191ed71b01367b905e58744c7",
"size": "8206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/29-06-2015-JBoss-Marshalling-the-hidden-serialization-framework.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10238"
},
{
"name": "HTML",
"bytes": "9549"
},
{
"name": "JavaScript",
"bytes": "48"
},
{
"name": "Ruby",
"bytes": "49"
},
{
"name": "Shell",
"bytes": "506"
}
],
"symlink_target": ""
} |
angular.module('fsReferenceClientShared', [
'loDash',
'angularMoment',
'panzoom',
'ui.bootstrap',
'infinite-scroll',
'angular-growl'
]); | {
"content_hash": "d43ff070f786231b55e1c5f9e9805ddd",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 18.5,
"alnum_prop": 0.668918918918919,
"repo_name": "cglancy/familytree-changereview",
"id": "55f2ab52429c397db3d993f918285895165295e7",
"size": "148",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/common/fsReferenceClientShared/fsReferenceClientShared.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "374542"
},
{
"name": "JavaScript",
"bytes": "150772"
}
],
"symlink_target": ""
} |
package org.apache.skywalking.oal.rt.parser;
import java.util.LinkedList;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ConditionExpression {
// original from script
private String expressionType;
private String attribute;
private String value;
private List<String> values;
public ConditionExpression(final String expressionType, final String attribute, final String value) {
this.expressionType = expressionType;
this.attribute = attribute;
this.value = value;
}
public void addValue(String value) {
if (values != null) {
values.add(value);
} else {
this.value = value;
}
}
public void enterMultiConditionValue() {
values = new LinkedList<>();
}
public void exitMultiConditionValue() {
value = "new Object[]{" + String.join(",", values) + "}";
}
}
| {
"content_hash": "859b55cd2279d3cddc5f27f3b2dc4961",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 105,
"avg_line_length": 23.785714285714285,
"alnum_prop": 0.6546546546546547,
"repo_name": "wu-sheng/sky-walking",
"id": "8f7bc1015267997700e3a4b2662447d80d02825b",
"size": "1803",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/ConditionExpression.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
'use strict';
angular.module('arethusaTranslateGuiApp').directive('subContainer', [
'containerHelper',
function(containerHelper) {
var SC_CHANGE = 'subcontainerChange';
return {
restrict: 'A',
link: function(scope, element) {
scope.title = 'Sub-Container';
containerHelper.nameWatch(scope);
containerHelper.dirtyWatch(scope, function() {
scope.$emit(SC_CHANGE);
});
containerHelper.addEventListeners(scope);
scope.addSubContainer = scope.subContainerFactory(scope);
scope.addValue = scope.valueFactory(scope);
scope.remove = function() {
scope.removeHelper(scope.$parent.container.containers, scope.container, function() {
// We can skip this scope, as it's removed anyway!
scope.$parent.$emit('containerRemoved', scope.container);
scope.$parent.$emit(SC_CHANGE);
scope.immediateUpdate();
});
};
scope.scrollWatch(scope, scope.container._id, element);
},
templateUrl: 'app/i18n/container.directive.html'
};
}
]);
| {
"content_hash": "37a86918d76094d502ae93d864041bb0",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 94,
"avg_line_length": 30.27027027027027,
"alnum_prop": 0.6205357142857143,
"repo_name": "LFDM/angular-translate-gui",
"id": "7a17178f398c2f97b12ab1478e9dd7362662ce66",
"size": "1120",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/app/i18n/sub_container.directive.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3710"
},
{
"name": "JavaScript",
"bytes": "70633"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('content', '0005_auto_20151021_0902'),
]
operations = [
migrations.AddField(
model_name='contenttype',
name='published',
field=models.DateTimeField(null=True, blank=True),
),
migrations.AddField(
model_name='contenttype',
name='status',
field=models.CharField(default=b'new', max_length=20, choices=[(b'new', b'New'), (b'published', b'Published')]),
),
]
| {
"content_hash": "8247264d310ed4c7feb5865d058adc71",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 124,
"avg_line_length": 27.217391304347824,
"alnum_prop": 0.5814696485623003,
"repo_name": "AASHE/hub",
"id": "eec9937a99acc4134d97d21beb01ce3fe387dcf4",
"size": "650",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hub/apps/content/migrations/0006_auto_20151021_0920.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9044"
},
{
"name": "HTML",
"bytes": "104612"
},
{
"name": "JavaScript",
"bytes": "10807"
},
{
"name": "Python",
"bytes": "498577"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Parinya_MasterProject
{
public partial class Site_Mobile : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
} | {
"content_hash": "43e3a0012cdee2819fe70773d9319362",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 19.58823529411765,
"alnum_prop": 0.6996996996996997,
"repo_name": "ParinyaWichawong/Parinya_MasterProject",
"id": "fd4be6b902ccf249efc79a579b5313d87046ae04",
"size": "333",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Parinya_MasterProject/Site.Mobile.Master.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "40507"
},
{
"name": "C#",
"bytes": "58984"
},
{
"name": "CSS",
"bytes": "872"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "170709"
}
],
"symlink_target": ""
} |
FactoryGirl.define do
factory :product do
sequence(:name) {|i| "Test Product #{i}"}
size 33.33
category
sku
calories 123
picture Rack::Test::UploadedFile.new(Rails.root.join('spec', 'support', 'images', 'product', '01.jpg'), 'image/jpg')
end
end | {
"content_hash": "ef80b686de780077d8805f8308d465be",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 120,
"avg_line_length": 27.3,
"alnum_prop": 0.6446886446886447,
"repo_name": "Uepsilon/consumo",
"id": "fa037148abc09a4fcaeb0df6b9dfecd9e799a9c0",
"size": "805",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/factories/product.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3443"
},
{
"name": "CoffeeScript",
"bytes": "3210"
},
{
"name": "HTML",
"bytes": "54681"
},
{
"name": "Ruby",
"bytes": "79701"
}
],
"symlink_target": ""
} |
<?php
namespace PHPExiftool\Driver\Tag\FLIR;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class UnknownSerial2 extends AbstractTag
{
protected $Id = 45;
protected $Name = 'UnknownSerial2';
protected $FullName = 'FLIR::SerialNums';
protected $GroupName = 'FLIR';
protected $g0 = 'MakerNotes';
protected $g1 = 'FLIR';
protected $g2 = 'Camera';
protected $Type = 'string';
protected $Writable = false;
protected $Description = 'Unknown Serial 2';
protected $flag_Permanent = true;
protected $MaxLength = 33;
}
| {
"content_hash": "6eefd4c9ffa0cf56bf723bad93e3e1eb",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 48,
"avg_line_length": 16.15,
"alnum_prop": 0.6656346749226006,
"repo_name": "bburnichon/PHPExiftool",
"id": "75df1157900061e57d7bfbd2e355c07873b27e85",
"size": "870",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/PHPExiftool/Driver/Tag/FLIR/UnknownSerial2.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "22076400"
}
],
"symlink_target": ""
} |
/* global stats, valueToPoint */
casper.test.begin('svg', 18, function (test) {
casper
.start('examples/svg/index.html')
.then(function () {
test.assertElementCount('g', 1)
test.assertElementCount('polygon', 1)
test.assertElementCount('circle', 1)
test.assertElementCount('text', 6)
test.assertElementCount('label', 6)
test.assertElementCount('button', 7)
test.assertElementCount('input[type="range"]', 6)
test.assertEval(function () {
var points = stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, 6)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
})
})
.thenClick('button', function () {
test.assertElementCount('text', 5)
test.assertElementCount('label', 5)
test.assertElementCount('button', 6)
test.assertElementCount('input[type="range"]', 5)
test.assertEval(function () {
var points = stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, 5)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
})
})
.then(function () {
this.fill('#add', {
newlabel: 'hi'
})
})
.thenClick('#add > button', function () {
test.assertElementCount('text', 6)
test.assertElementCount('label', 6)
test.assertElementCount('button', 7)
test.assertElementCount('input[type="range"]', 6)
test.assertEval(function () {
var points = stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, 6)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
})
})
// run
.run(function () {
test.done()
})
})
| {
"content_hash": "b38922a0077a92d6260190dbf96ab1c2",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 32.49122807017544,
"alnum_prop": 0.6106911447084233,
"repo_name": "diermengdierme/vue",
"id": "6613b40094e3121706e295c4c9729e22ee7c7900",
"size": "1852",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "test/e2e/svg.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "420"
},
{
"name": "JavaScript",
"bytes": "1185877"
},
{
"name": "Shell",
"bytes": "1075"
}
],
"symlink_target": ""
} |
use ::capnp::Word;
use ::std::cell::RefCell;
pub struct Arena {
allocations : RefCell<Vec<Vec<Word>>>,
}
impl Arena {
pub fn new() -> Arena {
Arena { allocations : RefCell::new(Vec::new()) }
}
pub fn alloc<'a>(&'a self, length : usize) -> &'a mut [Word] {
let mut v = ::capnp::Word::allocate_zeroed_vec(length);
let result = unsafe {::std::slice::from_raw_parts_mut(v.as_mut_ptr(), v.len())};
self.allocations.borrow_mut().push(v);
result
}
}
pub struct SchemaLoader<'a> {
arena : &'a Arena,
schemas : ::std::collections::hash_map::HashMap<u64, &'a [Word]>,
}
impl <'a> SchemaLoader<'a> {
pub fn new(arena : &'a Arena) -> SchemaLoader<'a> {
SchemaLoader {
arena : arena,
schemas : ::std::collections::hash_map::HashMap::new(),
}
}
pub fn load(&mut self, reader : ::schema_capnp::node::Reader) {
let id = reader.get_id();
let num_words = reader.total_size().unwrap().word_count;
self.schemas.get(&id);
let _words = self.arena.alloc(num_words as usize);
//ScratchSpaceMallocMessageBuilder::new
}
}
| {
"content_hash": "888c6edc1684ae3cfdcf341822030031",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 88,
"avg_line_length": 27.785714285714285,
"alnum_prop": 0.5646958011996572,
"repo_name": "maurer/capnpc-rust",
"id": "0199e8a05d6159fbd4598794d693e415ea190b18",
"size": "2413",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/schema.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Cap'n Proto",
"bytes": "17971"
},
{
"name": "Rust",
"bytes": "426315"
},
{
"name": "Shell",
"bytes": "2301"
}
],
"symlink_target": ""
} |
#include "ros.h"
#include "rcl.h"
#include <stdarg.h>
#include <stdio.h>
#include "device_config.h"
// application memory
char memory[20 * 1024];
unsigned int offset = 0;
void* os_malloc(unsigned int size)
{
unsigned int index = offset;
taskENTER_CRITICAL();
offset += size;
taskEXIT_CRITICAL();
return &memory[index];
}
#define MAX_CHARS 128
#define TERMINAL_QUEUE_LEN 10
#define TERMINAL_QUEUE_TIMEOUT 10
xQueueHandle terminalQueue;
//#define USART_TERMINAL 1
#ifdef USART_TERMINAL
void TerminalTask( void *pvParameters )
{
terminalQueue = xQueueCreate(TERMINAL_QUEUE_LEN, MAX_CHARS);
// Initialize memory (in stack) for message.
static unsigned char string[MAX_CHARS];
// Try to receive message, put the task to sleep for at most RXTIMEOUT ticks if queue is empty.
for(;;)
{
if (xQueueReceive(terminalQueue, string, TERMINAL_QUEUE_TIMEOUT))
{
taskDISABLE_INTERRUPTS();
USART_puts(USART1, (volatile char*)string);
taskENABLE_INTERRUPTS();
}
}
}
#else
#include "netconf.h"
#include "tcpip.h"
void TerminalTask(void* params)
{
terminalQueue = xQueueCreate(TERMINAL_QUEUE_LEN, MAX_CHARS);
char msg[MAX_CHARS];
struct netconn* conn = netconn_new( NETCONN_UDP );
netconn_bind(conn, IP_ADDR_ANY, LOG_LOCAL_PORT);
struct ip_addr ip;
ip.addr = inet_addr(LOG_REMOTE_IP);
netconn_connect(conn, &ip, LOG_REMOTE_PORT);
for(;;)
{
// Try to receive message, block the task for at most TERMINAL_QUEUE_TIMEOUT ticks if queue is empty.
if (xQueueReceive(terminalQueue, &msg, TERMINAL_QUEUE_TIMEOUT))
{
// Methods for UDP send.
struct netbuf *buf = netbuf_new();
char * data = netbuf_alloc(buf, sizeof(msg)); // Also deallocated with netbuf_delete(buf)
if (data != NULL)
{
memcpy (data, msg, sizeof (msg));
netconn_send(conn, buf);
netbuf_delete(buf); // Deallocate packet buffer
}
else
os_printf("Netbuf_alloc: Cannot allocate memory!\n");
}
}
}
#endif // USART_TERMINAL
#include "USARTHandler.h"
void os_printf(const char* fmt, ...)
{
va_list ap;
char string[MAX_CHARS];
va_start(ap, fmt);
vsprintf(string, fmt, ap);
va_end(ap);
#ifdef USART_TERMINAL
if (strlen(string) > 2 && strlen(string) < 128 && string[strlen(string)-1] == '\n' && string[strlen(string)-2] != '\r')
{
string[strlen(string)-1] = '\r';
string[strlen(string)] = '\n';
}
#endif// USART_TERMINAL
if (terminalQueue != NULL)
{
xQueueSend(terminalQueue, &string, 0);
}
/*
taskDISABLE_INTERRUPTS();
USART_puts(USART1, (volatile char*)string);
taskENABLE_INTERRUPTS();*/
//tr_log(string);
}
| {
"content_hash": "1104e6afd5c30e9d5165392b3d0e04a1",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 123,
"avg_line_length": 24.469026548672566,
"alnum_prop": 0.633996383363472,
"repo_name": "bosch-ros-pkg/stm32",
"id": "c68332c1e708c683d60dfb05e05a3a0d51b53c0d",
"size": "2765",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/os/main/ros.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1138"
},
{
"name": "C",
"bytes": "7834665"
},
{
"name": "C++",
"bytes": "475634"
},
{
"name": "CMake",
"bytes": "7794"
},
{
"name": "HTML",
"bytes": "82813"
},
{
"name": "Objective-C",
"bytes": "20755"
},
{
"name": "Shell",
"bytes": "1217"
}
],
"symlink_target": ""
} |
from __future__ import print_function, division, absolute_import
import numpy as np
from matplotlib.text import Text
from .frame import RectangularFrame
def sort_using(X, Y):
return [x for (y, x) in sorted(zip(Y, X))]
class TickLabels(Text):
def __init__(self, frame, *args, **kwargs):
self.clear()
self._frame = frame
super(TickLabels, self).__init__(*args, **kwargs)
self.set_clip_on(True)
self.set_visible_axes('all')
self.pad = 0.3
self._exclude_overlapping = False
def clear(self):
self.world = {}
self.pixel = {}
self.angle = {}
self.text = {}
self.disp = {}
def add(self, axis, world, pixel, angle, text, axis_displacement):
if axis not in self.world:
self.world[axis] = [world]
self.pixel[axis] = [pixel]
self.angle[axis] = [angle]
self.text[axis] = [text]
self.disp[axis] = [axis_displacement]
else:
self.world[axis].append(world)
self.pixel[axis].append(pixel)
self.angle[axis].append(angle)
self.text[axis].append(text)
self.disp[axis].append(axis_displacement)
def sort(self):
"""
Sort by axis displacement, which allows us to figure out which parts
of labels to not repeat.
"""
for axis in self.world:
self.world[axis] = sort_using(self.world[axis], self.disp[axis])
self.pixel[axis] = sort_using(self.pixel[axis], self.disp[axis])
self.angle[axis] = sort_using(self.angle[axis], self.disp[axis])
self.text[axis] = sort_using(self.text[axis], self.disp[axis])
self.disp[axis] = sort_using(self.disp[axis], self.disp[axis])
def simplify_labels(self):
"""
Figure out which parts of labels can be dropped to avoid repetition.
"""
self.sort()
for axis in self.world:
t1 = self.text[axis][0]
for i in range(1, len(self.world[axis])):
t2 = self.text[axis][i]
if len(t1) != len(t2):
t1 = self.text[axis][i]
continue
start = 0
for j in range(len(t1)):
if t1[j] != t2[j]:
break
if t1[j] not in '-0123456789.':
start = j + 1
if start == 0:
t1 = self.text[axis][i]
else:
self.text[axis][i] = self.text[axis][i][start:]
def set_visible_axes(self, visible_axes):
self._visible_axes = visible_axes
def get_visible_axes(self):
if self._visible_axes == 'all':
return self.world.keys()
else:
return [x for x in self._visible_axes if x in self.world]
def set_exclude_overlapping(self, exclude_overlapping):
self._exclude_overlapping = exclude_overlapping
def draw(self, renderer, bboxes, ticklabels_bbox):
if not self.get_visible():
return
self.simplify_labels()
text_size = renderer.points_to_pixels(self.get_size())
for axis in self.get_visible_axes():
for i in range(len(self.world[axis])):
self.set_text(self.text[axis][i])
x, y = self.pixel[axis][i]
if isinstance(self._frame, RectangularFrame):
# This is just to preserve the current results, but can be
# removed next time the reference images are re-generated.
if np.abs(self.angle[axis][i]) < 45.:
ha = 'right'
va = 'bottom'
dx = - text_size * 0.5
dy = - text_size * 0.5
elif np.abs(self.angle[axis][i] - 90.) < 45:
ha = 'center'
va = 'bottom'
dx = 0
dy = - text_size * 1.5
elif np.abs(self.angle[axis][i] - 180.) < 45:
ha = 'left'
va = 'bottom'
dx = text_size * 0.5
dy = - text_size * 0.5
else:
ha = 'center'
va = 'bottom'
dx = 0
dy = text_size * 0.2
self.set_position((x + dx, y + dy))
self.set_ha(ha)
self.set_va(va)
else:
# This is the more general code for arbitrarily oriented
# axes
# Set initial position and find bounding box
self.set_position((x, y))
bb = super(TickLabels, self).get_window_extent(renderer)
# Find width and height, as well as angle at which we
# transition which side of the label we use to anchor the
# label.
width = bb.width
height = bb.height
# Project axis angle onto bounding box
ax = np.cos(np.radians(self.angle[axis][i]))
ay = np.sin(np.radians(self.angle[axis][i]))
# Set anchor point for label
if np.abs(self.angle[axis][i]) < 45.:
dx = width
dy = ay * height
elif np.abs(self.angle[axis][i] - 90.) < 45:
dx = ax * width
dy = height
elif np.abs(self.angle[axis][i] - 180.) < 45:
dx = -width
dy = ay * height
else:
dx = ax * width
dy = -height
dx *= 0.5
dy *= 0.5
# Find normalized vector along axis normal, so as to be
# able to nudge the label away by a constant padding factor
dist = np.hypot(dx, dy)
ddx = dx / dist
ddy = dy / dist
dx += ddx * text_size * self.pad
dy += ddy * text_size * self.pad
self.set_position((x - dx, y - dy))
self.set_ha('center')
self.set_va('center')
bb = super(TickLabels, self).get_window_extent(renderer)
# TODO: the problem here is that we might get rid of a label
# that has a key starting bit such as -0:30 where the -0
# might be dropped from all other labels.
if not self._exclude_overlapping or bb.count_overlaps(bboxes) == 0:
super(TickLabels, self).draw(renderer)
bboxes.append(bb)
ticklabels_bbox.append(bb)
| {
"content_hash": "a83242815f1003fd1c16da3b8da45946",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 83,
"avg_line_length": 35.285,
"alnum_prop": 0.4584100892730622,
"repo_name": "tbabej/astropy",
"id": "f48f73340cee8b60585b5da14ce95c9bd77c06f4",
"size": "7122",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "astropy/visualization/wcsaxes/ticklabels.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "366874"
},
{
"name": "C++",
"bytes": "1825"
},
{
"name": "HTML",
"bytes": "1172"
},
{
"name": "Jupyter Notebook",
"bytes": "62553"
},
{
"name": "Python",
"bytes": "7610601"
},
{
"name": "Shell",
"bytes": "425"
},
{
"name": "TeX",
"bytes": "778"
}
],
"symlink_target": ""
} |
#include "buffer.hpp"
#include "exception.hpp"
namespace glpp{
buffer::buffer(buffer_type type)
:m_buf_type(type),
m_size(0) {
::glGenBuffers(1, &m_gl_name);
assert_no_glerror("glGenBuffers failed.");
}
buffer::~buffer() {
if (::glIsBuffer(m_gl_name)) {
::glDeleteBuffers(1, &m_gl_name);
}
}
void buffer::define_data(size_t size, const void * pdata, buffer_usage_pattern usage) {
bind();
m_size = size;
::glBufferData(GLPP_CAST_TO_SCALAR(GLenum, type()), size, pdata, GLPP_CAST_TO_SCALAR(GLenum, usage));
}
void buffer::update_subdata(size_t offset, size_t size, const void * pdata) {
bind();
::glBufferSubData(GLPP_CAST_TO_SCALAR(GLenum, type()), offset, size, pdata);
}
std::vector<uint8_t> buffer::get_data(size_t offset, size_t size) {
bind();
std::vector<uint8_t> buf(size);
::glGetBufferSubData(GLPP_CAST_TO_SCALAR(GLenum, type()), offset, size, &buf[0]);
# if (GLPP_LANG == GLPP_LANG_CXX11)
return std::move(buf);
# else
return buf;
# endif
}
void * buffer::map_data(buffer_access_mode access) {
bind();
return ::glMapBuffer(GLPP_CAST_TO_SCALAR(GLenum, type()), GLPP_CAST_TO_SCALAR(GLenum, access));
}
bool buffer::unmap_data() {
bind();
return (bool)::glUnmapBuffer(GLPP_CAST_TO_SCALAR(GLenum, type()));
}
void * buffer::map_data_range(size_t offset, size_t size, map_access_bit access) {
bind();
return ::glMapBufferRange(GLPP_CAST_TO_SCALAR(GLenum, type()), offset, size,GLPP_CAST_TO_SCALAR(GLenum, access));
}
void buffer::flush_mapped_range(size_t offset, size_t size) {
bind();
::glFlushMappedBufferRange(GLPP_CAST_TO_SCALAR(GLenum, type()), offset, size);
}
}
| {
"content_hash": "0bc5c357e7ae39793ffaea8cae59f880",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 116,
"avg_line_length": 26.822580645161292,
"alnum_prop": 0.6638604930847866,
"repo_name": "sque/glpp",
"id": "0e305272c2f4ba956d723ecd406be63612e4f65a",
"size": "2826",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/glpp/buffer.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "268972"
},
{
"name": "CMake",
"bytes": "12098"
}
],
"symlink_target": ""
} |
using System;
namespace Hvz.Ui
{
public enum NavDrawerItemType
{
Section,
Item
}
public interface INavDrawerItem
{
int Id { get; }
string Label { get; }
NavDrawerItemType Type { get; }
bool Enabled { get; }
bool ShouldUpdateActionBarTitle { get; }
}
}
| {
"content_hash": "3600f8ec4abdd98fbc2929b094ddda3c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 48,
"avg_line_length": 14.166666666666666,
"alnum_prop": 0.5441176470588235,
"repo_name": "redxdev/hvz-app",
"id": "d28547c270c39eb0e286571a2af113daded46e26",
"size": "342",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "HvzAndroid/Ui/INavDrawerItem.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "164134"
}
],
"symlink_target": ""
} |
package org.openecard.ws.soap;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
*
* @author Tobias Wich <tobias.wich@ecsec.de>
*/
public class SOAPMessage {
private final Document doc;
private final String namespace;
private final SOAPEnvelope env;
private final SOAPHeader head;
private final SOAPBody body;
protected SOAPMessage(DocumentBuilder docBuilder, String namespace) throws SOAPException {
doc = docBuilder.newDocument();
this.namespace = namespace;
// add envelope and that stuff
Element envElem = doc.createElementNS(namespace, "Envelope");
env = new SOAPEnvelope(envElem);
doc.appendChild(envElem);
Element headElem = env.addChildElement(new QName(namespace, "Header"));
head = new SOAPHeader(headElem);
Element bodyElem = env.addChildElement(new QName(namespace, "Body"));
body = new SOAPBody(bodyElem);
}
protected SOAPMessage(Document doc) throws SOAPException {
this.doc = doc;
Element envElem = (Element) doc.getFirstChild();
if (envElem == null) {
throw new SOAPException("No Envelope element in SOAP message.");
}
env = new SOAPEnvelope(envElem);
namespace = MessageFactory.verifyNamespace(envElem.getNamespaceURI());
// extract envelope and stuff from doc
boolean headProcessed = false;
Element headElem = null;
boolean bodyProcessed = false;
Element bodyElem = null;
// extract info
NodeList nodes = envElem.getChildNodes();
for (int i=0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element e = (Element) n;
if (e.getNamespaceURI().equals(namespace)) {
// head is next
if (!headProcessed && !bodyProcessed && "Header".equals(e.getLocalName())) {
headProcessed = true;
headElem = e;
} else if (!bodyProcessed && "Body".equals(e.getLocalName())) {
bodyProcessed = true;
bodyElem = e;
} else {
throw new SOAPException("Undefined element (" + e.getLocalName() + ") in SOAP message.");
}
} else {
throw new SOAPException("Undefined namespace (" + e.getNamespaceURI() + ") in SOAP message.");
}
} else if (n.getNodeType() == Node.TEXT_NODE || n.getNodeType() == Node.CDATA_SECTION_NODE) {
//throw new SOAPException("Undefined node type in SOAP message.");
System.out.println("Undefined node type in SOAP message: " + n.getNodeType() + n.getNodeName() + n.getNodeValue() + n.getTextContent());
}
}
// check if all info is present, else create it
if (! bodyProcessed) {
throw new SOAPException("No Body element present in SOAP message.");
}
if (! headProcessed) {
headElem = doc.createElementNS(namespace, "Header");
headElem = (Element) envElem.insertBefore(headElem, bodyElem);
}
head = new SOAPHeader(headElem);
body = new SOAPBody(bodyElem);
}
public Document getDocument() {
return doc;
}
public SOAPEnvelope getSOAPEnvelope() {
return env;
}
public SOAPHeader getSOAPHeader() {
return head;
}
public SOAPBody getSOAPBody() {
return body;
}
}
| {
"content_hash": "d17ea877b4525ce8a6931807ee5a9c78",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 138,
"avg_line_length": 28.473214285714285,
"alnum_prop": 0.6895578551269991,
"repo_name": "credentials/irma_future_id",
"id": "1dba470886fd21531d3e8e464ed33e3b8d364588",
"size": "4088",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "wsdef/wsdef-common/src/main/java/org/openecard/ws/soap/SOAPMessage.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2007422"
},
{
"name": "C++",
"bytes": "684063"
},
{
"name": "CSS",
"bytes": "638"
},
{
"name": "Groovy",
"bytes": "777"
},
{
"name": "Java",
"bytes": "25455032"
}
],
"symlink_target": ""
} |
/* $Id: armsd_conf_parse.h 22136 2012-06-13 06:32:51Z m-oki $ */
/*
* Copyright (c) 2012, Internet Initiative Japan, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __ARMSD_CONF_PARSE_H__
#define __ARMSD_CONF_PARSE_H__
enum miconf_tokens {
TOK_INVAL = 0,
TOK_APPPOE, /* line-apppoe */
TOK_LPPPOE, /* line-pppoe */
TOK_APPPOE_IPV6, /* line-apppoe-ipv6 */
TOK_LPPPOE_IPV6, /* line-pppoe-ipv6 */
TOK_LDHCP, /* line-dhcp */
TOK_AMOBILE,/* line-amobile */
TOK_LMOBILE,/* line-mobile */
TOK_LSTATIC,/* line-static */
TOK_LRA, /* line-ra */
TOK_IFINDEX, /* ifindex */
TOK_ACCOUNT, /* account */
TOK_PASSWD, /* password */
TOK_TELNO, /* tel number */
TOK_CID, /* cid */
TOK_APN, /* apn */
TOK_PDP, /* PDP type */
TOK_IPADDR, /* IP address */
TOK_RSCERT, /* rs-certificate */
TOK_OC, /* { */
TOK_CC, /* } */
TOK_SC, /* ; */
TOK_BEGIN_CERT, /* -----BEGIN */
TOK_END_CERT, /* -----END */
TOK_CERT, /* CERTIFICATE----- */
};
enum miconf_parse_st {
ST_INITIAL = 0,
ST_LINE,
ST_LINE_IFINDEX,
ST_LINE_ACCOUNT,
ST_LINE_PASSWD,
ST_LINE_TELNO,
ST_LINE_CID,
ST_LINE_APN,
ST_LINE_PDP,
ST_LINE_IPADDR,
ST_RSCERT,
};
int text_config_parse(ACMI *acmi, int idx, char *src, int len);
#endif /* __ARMSD_CONF_PARSE_H__ */
| {
"content_hash": "a2e9830e522efaf28a4eba61dd8cc14a",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 31.95,
"alnum_prop": 0.6854460093896714,
"repo_name": "seil-smf/libarms",
"id": "9a67bd16f8a258bdfb45115bf7b26efcfc2b55ae",
"size": "2556",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "miconf/armsd_conf_parse.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "675771"
},
{
"name": "CSS",
"bytes": "18622"
},
{
"name": "JavaScript",
"bytes": "18702"
},
{
"name": "Makefile",
"bytes": "367"
},
{
"name": "Shell",
"bytes": "279925"
}
],
"symlink_target": ""
} |
package eu.qualimaster.events;
import eu.qualimaster.common.QMInternal;
/**
* Defines the interface of a message that is an answer. This is a separate interface
* to avoid sending unnecessary data.
*
* @author Holger Eichelberger
*/
@QMInternal
public interface IResponseEvent extends IEvent {
/**
* Returns the receiver JVM id.
*
* @return the id
*/
@QMInternal
public String getReceiverId();
/**
* Returns the id of this message.
*
* @return the id
*/
@QMInternal
public String getMessageId();
}
| {
"content_hash": "1f25c96d3487e85d29b30c79d86dc1ba",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 85,
"avg_line_length": 19.774193548387096,
"alnum_prop": 0.6068515497553018,
"repo_name": "QualiMaster/Infrastructure",
"id": "37be5678473589bb2e65f2ac60dfdb3b1cc06ea6",
"size": "1268",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "QualiMaster.Events/src/eu/qualimaster/events/IResponseEvent.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "575"
},
{
"name": "Java",
"bytes": "4750737"
},
{
"name": "Shell",
"bytes": "9223"
}
],
"symlink_target": ""
} |
This project is generated with [yo angular generator](https://github.com/yeoman/generator-angular)
version 0.11.1.
## Build & development
Run `grunt` for building and `grunt serve` for preview.
## Testing
Running `grunt test` will run the unit tests with karma.
Credits to creator of original template:
**David Miller**, Managing Parter at Iron Summit Media Strategies.
* https://twitter.com/davidmillerskt
* https://github.com/davidtmiller
| {
"content_hash": "12c987bf25d563deca60283aad63481b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 98,
"avg_line_length": 27.9375,
"alnum_prop": 0.7628635346756152,
"repo_name": "raulnayak/site-ointerface",
"id": "6bbc2372e7598b2c449c3644736b5e69e38df57d",
"size": "458",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "113387"
},
{
"name": "HTML",
"bytes": "13577"
},
{
"name": "JavaScript",
"bytes": "15046"
}
],
"symlink_target": ""
} |
export default {
common: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans GB", "Hiragino Sans GB W3", "Microsoft YaHei", "Wenquanyi Micro Hei", sans-serif',
monospace: 'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace "source code pro"',
quote: 'Georgia, "Times New Roman", STKaiti, BiauKai, KaiTi, "DFKai-SB", "KaiTi_GB2312", serif',
}
| {
"content_hash": "91a3511dd69aa20526adb88d302ba8fc",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 188,
"avg_line_length": 82,
"alnum_prop": 0.7073170731707317,
"repo_name": "meis5/ms5.me",
"id": "379c8d2a66b1db66cf3146858762393f916c6b63",
"size": "410",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "react-stack/src/library/styles/variables/fontFamilies.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10594"
},
{
"name": "Go",
"bytes": "7901"
},
{
"name": "HTML",
"bytes": "2104"
},
{
"name": "JavaScript",
"bytes": "54462"
},
{
"name": "TypeScript",
"bytes": "58"
}
],
"symlink_target": ""
} |
using System;
namespace DALib.Drawing
{
public class MpfFrame : IRenderable
{
private readonly byte[] _data;
public MpfFrame(int top, int left, int bottom, int right, int xOffset, int yOffset, byte[] data)
{
Top = top;
Left = left;
Bottom = bottom;
Right = right;
XOffset = xOffset;
YOffset = yOffset;
_data = new byte[data.Length];
Buffer.BlockCopy(data, 0, _data, 0, data.Length);
}
public int Top { get; }
public int Left { get; }
public int Bottom { get; }
public int Right { get; }
public int XOffset { get; }
public int YOffset { get; }
public int Width => Right - Left;
public int Height => Bottom - Top;
public byte this[int index] => _data[index];
public byte[] Data => _data;
}
}
| {
"content_hash": "10ccbe58c6fcf346f48a524d1f6d4497",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 104,
"avg_line_length": 28.5625,
"alnum_prop": 0.5218818380743983,
"repo_name": "kojasou/dalib",
"id": "50fdbdf5565d5a9015c81c7ca58ad9763831ba60",
"size": "916",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DALib/Drawing/MPFFrame.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "55472"
}
],
"symlink_target": ""
} |
require 'test_helper'
class Ccls::OrganizationTest < ActiveSupport::TestCase
assert_should_behave_like_a_hash( :value => :name )
assert_should_create_default_object
assert_should_act_as_list
assert_should_not_require_attributes( :position, :person_id )
assert_should_belong_to( :person )
assert_should_have_many( :patients )
# assert_should_have_many( :hospitals )
assert_should_have_one( :hospital )
assert_should_have_many(:aliquots,
:foreign_key => :owner_id)
with_options :class_name => 'Transfer' do |o|
o.assert_should_have_many(:incoming_transfers,
:foreign_key => :to_organization_id)
o.assert_should_have_many(:outgoing_transfers,
:foreign_key => :from_organization_id)
end
test "explicit Factory organization test" do
assert_difference('Organization.count',1) {
organization = Factory(:organization)
assert_match /Key \d*/, organization.key
assert_match /Name \d*/, organization.name
}
end
test "new incoming_transfer should have matching organization id" do
organization = create_organization
transfer = organization.incoming_transfers.build
assert_equal organization.id, transfer.to_organization_id
end
test "new outgoing_transfer should have matching organization id" do
organization = create_organization
transfer = organization.outgoing_transfers.build
assert_equal organization.id, transfer.from_organization_id
end
# TODO haven't really implemented organization samples yet
# test "should have many samples" do
# # this is unclear in my diagram
# pending
# end
test "should return name as to_s" do
organization = create_organization
assert_equal organization.name, "#{organization}"
end
#protected
#
# def create_organization(options={})
# organization = Factory.build(:organization,options)
# organization.save
# organization
# end
end
| {
"content_hash": "70191638ff7a8ecbcb96dd49707ce21e",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 69,
"avg_line_length": 28.671875,
"alnum_prop": 0.7476839237057221,
"repo_name": "ccls/ccls_engine",
"id": "2eb89d96a8dfe70c29505a83af7a71d188d2036c",
"size": "1835",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/unit/ccls/organization_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "3879"
},
{
"name": "Ruby",
"bytes": "865318"
},
{
"name": "Shell",
"bytes": "271"
}
],
"symlink_target": ""
} |
namespace LearningSystem.Web.Controllers
{
using Data.Models;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Models.Trainers;
using Services;
using Services.Models;
using System;
using System.Threading.Tasks;
using static WebConstants;
[Authorize(Roles = TrainerRole)]
public class TrainersController : Controller
{
private readonly ITrainerService trainerService;
private readonly UserManager<User> userManageer;
private readonly ICourseService courseService;
public TrainersController(ITrainerService trainerService, UserManager<User> userManageer, ICourseService courseService)
{
this.trainerService = trainerService;
this.userManageer = userManageer;
this.courseService = courseService;
}
public async Task<IActionResult> Courses()
{
var userId = this.userManageer.GetUserId(this.User);
var courses = await this.trainerService.CourcesByTrainerAsync(userId);
return this.View(courses);
}
public async Task<IActionResult> Students(int courseId)
{
var trainerId = this.userManageer.GetUserId(this.User);
var isTrainerInCourse = await this.trainerService.IsTrainerInCourse(trainerId, courseId);
if (!isTrainerInCourse)
{
return this.NotFound();
}
var students = new StudentsInCourseViewModel
{
Students = await this.trainerService.StudentsInCourseAsync(courseId),
Course = await this.courseService.DetailsAsync<CourseListingInfoServiceModel>(courseId)
};
return this.View(students);
}
[HttpPost]
public async Task<IActionResult> GradeStudent(int id, string studentId, Grade grade, string studentName)
{
if (string.IsNullOrEmpty(studentId))
{
return this.BadRequest();
}
var trainerId = this.userManageer.GetUserId(this.User);
var isTrainerInCourse = await this.trainerService.IsTrainerInCourse(trainerId, id);
if (!isTrainerInCourse)
{
return this.NotFound();
}
bool success = await this.trainerService.AddGradeAsync(id, studentId, grade);
if (!success)
{
return this.BadRequest();
}
this.TempData.AddSuccessMessage($"Grade {grade.ToString()} has been added to student {studentName}");
return this.RedirectToAction(nameof(this.Students), new { courseId = id });
}
public async Task<IActionResult> DownloadExam(int courseId, string studentId)
{
if (string.IsNullOrEmpty(studentId))
{
return this.BadRequest();
}
var trainerId = this.userManageer.GetUserId(this.User);
var isTrainerInCourse = await this.trainerService.IsTrainerInCourse(trainerId, courseId);
if (!isTrainerInCourse)
{
return this.NotFound();
}
byte[] examContents = await this.trainerService.GetExamSubmissionAsync(courseId, studentId);
if (examContents == null)
{
this.TempData.AddErrorMessage("There is no submitted exam for this user.");
return this.RedirectToAction(nameof(this.Students), new { courseId });
}
var studentInCourseNames = await this.trainerService.StudentInCourseNamesAsync(courseId, studentId);
var fileName = $"{studentInCourseNames.CourseTitle}-{studentInCourseNames.Username}-{DateTime.UtcNow:MM-DD-yyyy}.zip";
return this.File(examContents, "application/zip", fileName);
}
}
} | {
"content_hash": "306f23cab4ac682bc762b5d7f7c0f4f0",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 130,
"avg_line_length": 35.01754385964912,
"alnum_prop": 0.6214929859719439,
"repo_name": "sevdalin/Software-University-SoftUni",
"id": "61e28163bb2a5ef9357435f694908075eff3fa1c",
"size": "3994",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "C# MVC Frameworks - ASP.NET Core/05. Identity/LearningSystem/LearningSystem.Web/Controllers/TrainersController.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "388"
},
{
"name": "C#",
"bytes": "3998101"
},
{
"name": "CSS",
"bytes": "161101"
},
{
"name": "HTML",
"bytes": "261529"
},
{
"name": "Java",
"bytes": "20909"
},
{
"name": "JavaScript",
"bytes": "609440"
},
{
"name": "PHP",
"bytes": "16185"
},
{
"name": "PLSQL",
"bytes": "723"
},
{
"name": "PLpgSQL",
"bytes": "4714"
},
{
"name": "PowerShell",
"bytes": "471"
},
{
"name": "Ruby",
"bytes": "1030"
},
{
"name": "SQLPL",
"bytes": "3383"
},
{
"name": "Smalltalk",
"bytes": "2065"
}
],
"symlink_target": ""
} |
/*eslint-env node, mocha*/
/**
* @author kecso / https://github.com/kecso
*/
var testFixture = require('../../../_globals');
describe('Plugin SearchNodes', function () {
'use strict';
var pluginName = 'SearchNodes',
PluginBase,
logger,
gmeConfig,
storage,
expect,
Q = testFixture.Q,
PluginCliManager,
project,
projectName = 'Plugin_SearchNodes',
commitHash,
gmeAuth,
importResult,
pluginManager;
before(function (done) {
PluginBase = testFixture.requirejs('plugin/PluginBase');
logger = testFixture.logger.fork(pluginName);
gmeConfig = testFixture.getGmeConfig();
PluginCliManager = require('../../../../src/plugin/climanager');
expect = testFixture.expect;
var importParam = {
projectSeed: './seeds/EmptyProject.webgmex',
projectName: projectName,
logger: logger,
gmeConfig: gmeConfig
};
testFixture.clearDBAndGetGMEAuth(gmeConfig, projectName)
.then(function (gmeAuth_) {
gmeAuth = gmeAuth_;
storage = testFixture.getMemoryStorage(logger, gmeConfig, gmeAuth);
return storage.openDatabase();
})
.then(function () {
return testFixture.importProject(storage, importParam);
})
.then(function (importResult_) {
importResult = importResult_;
project = importResult.project;
commitHash = importResult.commitHash;
pluginManager = new PluginCliManager(project, logger, gmeConfig);
})
.nodeify(done);
});
after(function (done) {
Q.allDone([
storage.closeDatabase(),
gmeAuth.unload()
])
.nodeify(done);
});
it('should initialize plugin and get name, version and description', function (done) {
pluginManager.initializePlugin(pluginName)
.then(function (plugin) {
expect(plugin instanceof PluginBase).to.equal(true);
expect(plugin.getName()).to.equal('Search Nodes');
expect(typeof plugin.getDescription ()).to.equal('string');
expect(plugin.getConfigStructure() instanceof Array).to.equal(true);
expect(plugin.getConfigStructure().length).to.equal(3);
})
.nodeify(done);
});
it('should find ROOT and FCO with "O" lookup', function (done) {
var pluginContext = {
commitHash: commitHash,
activeNode: '',
branchName: 'master'
},
pluginConfig = {
searchPattern: 'O',
matchCase: true,
};
pluginManager.executePlugin(pluginName, pluginConfig, pluginContext, function (err, result) {
expect(err).to.eql(null);
expect(result.messages).to.have.length(2);
expect(result.messages[0].message).to.contain('ROOT');
expect(result.messages[1].message).to.contain('FCO');
done();
});
});
it('should find ROOT with "OO" lookup', function (done) {
var pluginContext = {
commitHash: commitHash,
activeNode: '',
branchName: 'master'
},
pluginConfig = {
searchPattern: 'OO',
matchCase: true,
};
pluginManager.executePlugin(pluginName, pluginConfig, pluginContext, function (err, result) {
expect(err).to.eql(null);
expect(result.messages).to.have.length(1);
expect(result.messages[0].message).to.contain('ROOT');
done();
});
});
it('should find ROOT with "oo" lookup and case insensitivity', function (done) {
var pluginContext = {
commitHash: commitHash,
activeNode: '',
branchName: 'master'
},
pluginConfig = {
searchPattern: 'oo',
matchCase: false,
};
pluginManager.executePlugin(pluginName, pluginConfig, pluginContext, function (err, result) {
expect(err).to.eql(null);
expect(result.messages).to.have.length(1);
expect(result.messages[0].message).to.contain('ROOT');
done();
});
});
it('should find ROOT and FCO with ".o" lookup and case insensitivity', function (done) {
var pluginContext = {
commitHash: commitHash,
activeNode: '',
branchName: 'master'
},
pluginConfig = {
attributeName: 'name',
searchPattern: '.o',
matchCase: false,
};
pluginManager.executePlugin(pluginName, pluginConfig, pluginContext, function (err, result) {
expect(err).to.eql(null);
expect(result.messages).to.have.length(2);
expect(result.messages[0].message).to.contain('ROOT');
expect(result.messages[1].message).to.contain('FCO');
done();
});
});
it('should not find a node with ".o" lookup', function (done) {
var pluginContext = {
commitHash: commitHash,
activeNode: '',
branchName: 'master'
},
pluginConfig = {
attributeName: 'name',
searchPattern: '.o',
matchCase: true,
};
pluginManager.executePlugin(pluginName, pluginConfig, pluginContext, function (err, result) {
expect(err).to.eql(null);
expect(result.messages).to.have.length(0);
done();
});
});
it('should find every node by default', function (done) {
var pluginContext = {
commitHash: commitHash,
activeNode: '',
branchName: 'master'
},
pluginConfig = {
};
pluginManager.executePlugin(pluginName, pluginConfig, pluginContext, function (err, result) {
expect(err).to.eql(null);
expect(result.messages).to.have.length(2);
done();
});
});
}); | {
"content_hash": "c2e88810dfb16ffad61c3a82ba86f6bd",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 101,
"avg_line_length": 33.302083333333336,
"alnum_prop": 0.5261182358461057,
"repo_name": "webgme/webgme-engine",
"id": "67e1212d6a737801475185638c45019376c2e550",
"size": "6394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/plugin/coreplugins/SearchNodes/SearchNodes.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "EJS",
"bytes": "68713"
},
{
"name": "HTML",
"bytes": "6425"
},
{
"name": "JavaScript",
"bytes": "6301847"
},
{
"name": "Pug",
"bytes": "228"
},
{
"name": "RAML",
"bytes": "32908"
},
{
"name": "Shell",
"bytes": "654"
}
],
"symlink_target": ""
} |
'use strict';
angular.module('angularPassportApp')
.controller('VisitCtrl', function ($scope, Visits, $location, $routeParams, $rootScope) {
$scope.loadPage = function(){
$scope.visit = new Visits();
}
$scope.create = function() {
debugger;
var visit = new Visits({
Complaint: $scope.visit.Complaint,
Bililng: $scope.visit.Bililng,
Patient: $routeParams.patientId
});
visit.$save(function(response) {
$location.path("visit/" + $routeParams.patientId);
});
$scope.visit = new Visits();
};
$scope.createLink = function(){
$location.path("visit/" + $routeParams.patientId + "/create");
}
$scope.find = function(patientId) {
};
});
| {
"content_hash": "6a51632e703ad7aa3628c423c08b937f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 91,
"avg_line_length": 23,
"alnum_prop": 0.5823451910408433,
"repo_name": "marlon407/HealthApp-Passport",
"id": "cde09a82c7c9ca49a23d31db03479d25f91b3ac8",
"size": "759",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/scripts/controllers/visits.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "1999"
},
{
"name": "HTML",
"bytes": "24664"
},
{
"name": "JavaScript",
"bytes": "55383"
}
],
"symlink_target": ""
} |
namespace Kts.ObjectSync.Common
{
public abstract class ObjectForSynchronization
{
public const string WantsAllSuffix = "__WANTS_ALL";
public abstract string ID { get; }
protected internal virtual bool ShouldGetOnConnected { get { return true; } }
protected internal virtual bool ShouldReceive(string fullPath)
{
return true;
}
protected internal virtual bool ShouldSend(string fullPath)
{
return true;
}
}
} | {
"content_hash": "5294dc81e267b42fc597f91aeb93d2e7",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 85,
"avg_line_length": 22.047619047619047,
"alnum_prop": 0.6976241900647948,
"repo_name": "BrannonKing/Kts.ObjectSync",
"id": "097a3568fa883caa5b3152ef47e1d73fc83da8ca",
"size": "463",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Kts.ObjectSync.Common/ObjectForSynchronization.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "47470"
}
],
"symlink_target": ""
} |
//=============================================================================================================
//=============================================================================================================
// INCLUDES
//=============================================================================================================
#include "abstractview.h"
#include "../engine/view/view3D.h"
#include "../engine/model/data3Dtreemodel.h"
#include "../engine/delegate/data3Dtreedelegate.h"
#include <inverse/dipoleFit/dipole_fit_settings.h>
#include <inverse/dipoleFit/ecd_set.h>
#include <mne/mne_bem.h>
#include <disp/viewers/quickcontrolview.h>
#include <disp/viewers/control3dview.h>
//=============================================================================================================
// QT INCLUDES
//=============================================================================================================
#include <QGridLayout>
#include <QSizePolicy>
//=============================================================================================================
// USED NAMESPACES
//=============================================================================================================
using namespace DISP3DLIB;
//=============================================================================================================
// DEFINE MEMBER METHODS
//=============================================================================================================
AbstractView::AbstractView(QWidget* parent,
Qt::WindowFlags f)
: QWidget(parent, f)
, m_p3DView(View3D::SPtr(new View3D()))
, m_pData3DModel(Data3DTreeModel::SPtr(new Data3DTreeModel()))
{
//Init 3D View
m_p3DView->setFlag(Qt::FramelessWindowHint, true);
m_p3DView->setModel(m_pData3DModel);
// Init 3D control view
QStringList slControlFlags;
slControlFlags << "Data" << "View" << "Light";
m_pControl3DView = DISPLIB::Control3DView::SPtr(new DISPLIB::Control3DView("DISP3D", this, slControlFlags));
Data3DTreeDelegate* pData3DTreeDelegate = new Data3DTreeDelegate(this);
m_pControl3DView->setDelegate(pData3DTreeDelegate);
m_pControl3DView->setModel(m_pData3DModel.data());
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::sceneColorChanged,
m_p3DView.data(), &View3D::setSceneColor);
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::rotationChanged,
m_p3DView.data(), &View3D::startStopCameraRotation);
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::showCoordAxis,
m_p3DView.data(), &View3D::toggleCoordAxis);
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::showFullScreen,
m_p3DView.data(), &View3D::showFullScreen);
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::lightColorChanged,
m_p3DView.data(), &View3D::setLightColor);
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::lightIntensityChanged,
m_p3DView.data(), &View3D::setLightIntensity);
connect(m_pControl3DView.data(), &DISPLIB::Control3DView::takeScreenshotChanged,
m_p3DView.data(), &View3D::takeScreenshot);
createGUI();
}
//=============================================================================================================
AbstractView::~AbstractView()
{
}
//=============================================================================================================
QSharedPointer<DISP3DLIB::View3D> AbstractView::getView()
{
return m_p3DView;
}
//=============================================================================================================
QSharedPointer<DISPLIB::Control3DView> AbstractView::getControlView()
{
return m_pControl3DView;
}
//=============================================================================================================
QSharedPointer<DISP3DLIB::Data3DTreeModel> AbstractView::getTreeModel()
{
return m_pData3DModel;
}
//=============================================================================================================
QPointer<DISPLIB::QuickControlView> AbstractView::getQuickControl()
{
return m_pQuickControlView;
}
//=============================================================================================================
void AbstractView::setQuickControlWidgets(const QList<QWidget*>& lControlWidgets)
{
if(m_pQuickControlView) {
for(int i = 0; i < lControlWidgets.size(); i++) {
if(lControlWidgets.at(i)) {
m_pQuickControlView->addGroupBox(lControlWidgets.at(i),
lControlWidgets.at(i)->windowTitle(),
"AbstractView");
}
}
}
}
//=============================================================================================================
void AbstractView::createGUI()
{
m_pQuickControlView = new DISPLIB::QuickControlView("3DView",
"3D View",
Qt::Widget,
this,
false);
m_pQuickControlView->setVisiblityHideOpacityClose(false);
//Create widget GUI
m_pQuickControlView->addGroupBox(m_pControl3DView.data(), "3D View", "AbstractView");
QWidget *pWidgetContainer = QWidget::createWindowContainer(m_p3DView.data(), this, Qt::Widget);
pWidgetContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
pWidgetContainer->setMinimumSize(400,400);
QGridLayout* pMainLayoutView = new QGridLayout();
pMainLayoutView->addWidget(pWidgetContainer,0,0);
pMainLayoutView->addWidget(m_pQuickControlView.data(),0,1);
pMainLayoutView->setContentsMargins(0,0,0,0);
this->setLayout(pMainLayoutView);
}
| {
"content_hash": "72ca1f5caac93a5d0e28cb50ab4f7bf7",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 112,
"avg_line_length": 39.15686274509804,
"alnum_prop": 0.4593557002169922,
"repo_name": "chdinh/mne-cpp",
"id": "786044abe2687cbfa611d72b1ec482a85e6f55ce",
"size": "7757",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "libraries/disp3D/viewers/abstractview.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "16999"
},
{
"name": "C",
"bytes": "83705"
},
{
"name": "C++",
"bytes": "10808604"
},
{
"name": "GLSL",
"bytes": "31865"
},
{
"name": "HTML",
"bytes": "165"
},
{
"name": "JavaScript",
"bytes": "3885"
},
{
"name": "Python",
"bytes": "4073"
},
{
"name": "QMake",
"bytes": "430905"
},
{
"name": "Qt Script",
"bytes": "8560"
},
{
"name": "Shell",
"bytes": "5452"
}
],
"symlink_target": ""
} |
/* eslint-disable global-require,no-unused-vars,class-methods-use-this */
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Dimensions, View, WebView, StyleSheet, Platform } from 'react-native';
import ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/Ionicons';
import { Actions } from 'react-native-router-flux';
import { connect } from 'react-redux';
import AppSizes from '../../../theme/sizes';
import MoregexWebViewServices from '../../../utils/MoregexWebViewServices';
const styles = StyleSheet.create({
container: {
},
background: {
backgroundColor: 'transparent',
height: AppSizes.screen.height,
width: AppSizes.screen.width,
},
logo: {
width: AppSizes.screen.width * 0.85,
resizeMode: 'contain',
},
whiteText: {
color: '#FFF',
},
});
const webViewWidth = Dimensions.get('window').width;
class MoRegexView extends Component {
static componentName = 'MoRegexView';
static propTypes = {
regex: React.PropTypes.shape({
name: PropTypes.string,
regex: PropTypes.instanceOf(RegExp),
description: PropTypes.string,
tags: PropTypes.string,
}),
};
static defaultProps = {
regex: {
name: '',
regex: /1-9a-Z/,
descriptions: '',
tag: '',
},
};
constructor() {
super();
this.webview = null;
}
componentDidMount() {
MoregexWebViewServices.setWebView(this.webview);
}
componentWillReceiveProps() {
if (this.webview || MoregexWebViewServices.getWebView()) {
this.webview.postMessage(JSON.stringify({ action: 'trigger' }));
}
}
handleMessage = (event: Object) => {
const message = JSON.parse(event.nativeEvent.data);
const regex = this.props.regex;
if (regex.name !== '' && message.status && message.status === 'ready') {
regex.regex = this.props.regex.regex.toString();
this.webview.postMessage(JSON.stringify(regex));
}
};
render = () => {
let source;
if (__DEV__) {
source = require('./www/index.html');
} else {
source = Platform.OS === 'ios' ? require('./www/index.html') : { uri: 'file:///android_asset/moregex/index.html' };
}
return (
<View style={{ flex: 1, backgroundColor: '#f3f3f3' }}>
<WebView
ref={(webview) => {
this.webview = webview;
}}
startInLoadingState
source={source}
onMessage={this.handleMessage}
automaticallyAdjustContentInsets={false}
style={[styles.container, { height: Dimensions.get('window').height, width: webViewWidth }]}
/>
<ActionButton buttonColor="rgba(231,76,60,1)">
<ActionButton.Item buttonColor="#9b59b6" title="资料" onPress={() => Actions.moRegexInfoView()}>
<Icon name="md-information" style={styles.actionButtonIcon} />
</ActionButton.Item>
</ActionButton>
</View>
);
}
}
const mapStateToProps = state => ({
regex: state.regex.regex,
});
const mapDispatchToProps = {
};
export default connect(mapStateToProps, mapDispatchToProps)(MoRegexView);
| {
"content_hash": "138b97a6611802c3aceff9280e69ccd7",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 121,
"avg_line_length": 27.224137931034484,
"alnum_prop": 0.6276124129195694,
"repo_name": "phodal/growth-ng",
"id": "4fe7142ace0b98a436e2dff7f1cd34da22aa5007",
"size": "3162",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/containers/practises/moregex/MoRegexView.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3868"
},
{
"name": "HTML",
"bytes": "49656"
},
{
"name": "Java",
"bytes": "8270"
},
{
"name": "JavaScript",
"bytes": "334141"
},
{
"name": "Objective-C",
"bytes": "4464"
},
{
"name": "Python",
"bytes": "3346"
},
{
"name": "Ruby",
"bytes": "8048"
},
{
"name": "Shell",
"bytes": "443"
}
],
"symlink_target": ""
} |
module BlogHelper
def blog_preview(content)
if(content.length > 100)
content[0..99] + " ..."
else
content
end
end
end
| {
"content_hash": "57a4d7b36bf5263a0b58aa8413d3078c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 29,
"avg_line_length": 16.22222222222222,
"alnum_prop": 0.5821917808219178,
"repo_name": "tmdt-1718/lab01-1412320-1412321",
"id": "e4f4d48073f5eb394349c9912e186b567b82cecb",
"size": "146",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/blog_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "565294"
},
{
"name": "HTML",
"bytes": "37495"
},
{
"name": "JavaScript",
"bytes": "553184"
},
{
"name": "Ruby",
"bytes": "76603"
}
],
"symlink_target": ""
} |
namespace ui {
class CompositorVSyncManager;
}
namespace content {
// Adapts a WebGraphicsContext3DCommandBufferImpl into a
// cc::OutputSurface that also handles vsync parameter updates
// arriving from the GPU process.
class GpuBrowserCompositorOutputSurface
: public BrowserCompositorOutputSurface {
public:
GpuBrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context,
int surface_id,
IDMap<BrowserCompositorOutputSurface>* output_surface_map,
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager);
virtual ~GpuBrowserCompositorOutputSurface();
private:
// cc::OutputSurface implementation.
virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface);
};
} // namespace content
#endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
| {
"content_hash": "4b0bae0e98bed2e3ced1436ec41e755b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 30.5,
"alnum_prop": 0.7879781420765027,
"repo_name": "ChromiumWebApps/chromium",
"id": "a773ad54b74d1925b5211c79f7ad8a1d68ea4096",
"size": "1309",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "content/browser/compositor/gpu_browser_compositor_output_surface.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "52960"
},
{
"name": "Awk",
"bytes": "8660"
},
{
"name": "C",
"bytes": "42286199"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "198616766"
},
{
"name": "CSS",
"bytes": "937333"
},
{
"name": "DOT",
"bytes": "2984"
},
{
"name": "Java",
"bytes": "5695686"
},
{
"name": "JavaScript",
"bytes": "21967126"
},
{
"name": "M",
"bytes": "2190"
},
{
"name": "Matlab",
"bytes": "2262"
},
{
"name": "Objective-C",
"bytes": "7602057"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "1210885"
},
{
"name": "Python",
"bytes": "10774996"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Shell",
"bytes": "1316721"
},
{
"name": "Tcl",
"bytes": "277091"
},
{
"name": "TypeScript",
"bytes": "1560024"
},
{
"name": "XSLT",
"bytes": "13493"
},
{
"name": "nesC",
"bytes": "15243"
}
],
"symlink_target": ""
} |
import {Globals} from '../globals';
import {Integer} from '../integer';
//Assumes input cipher is adequate for base
export function toString(A: Integer): string {
const cipher = Globals.CIPHER;
//If zero
if(A.precision === 0){
return (cipher.length < A.base) ? '0' : cipher[0];
}
//If negative
const sign: string = A.isNegative ? "-" : "";
//Print without cipher if cipher too small for base
if(cipher.length < A.base){
return sign + A.digits.slice(0, A.precision).reverse().join(':');
}
//Print with cipher
let i = 0;
let n: number = A.precision;
const digits = A.digits;
const strings = new Array(n);
while(n > 0){
strings[i++] = cipher[digits[--n]];
}
return sign + strings.join('');
}
| {
"content_hash": "9a43a231e24bb616dd10dcd4fbf4055b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 69,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6229729729729729,
"repo_name": "havelessbemore/big.js",
"id": "2b19cd713171ca13a2368855b9f7207b51afc48a",
"size": "740",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/functional/toString.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1402"
},
{
"name": "TypeScript",
"bytes": "225236"
}
],
"symlink_target": ""
} |
using System.Data.Entity;
using System.Security.Cryptography.X509Certificates;
namespace Sogeti.Capstone.Data.Model
{
public class CapstoneContext : DbContext
{
public CapstoneContext() : base()
{
Database.SetInitializer<CapstoneContext>(new CreateDatabaseIfNotExists<CapstoneContext>());
}
public CapstoneContext(string connectionString) : base(connectionString)
{
Database.SetInitializer<CapstoneContext>(new CreateDatabaseIfNotExists<CapstoneContext>());
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
}
public DbSet<Event> Events { get; set; }
public DbSet<EventType> EventType { get; set; }
public DbSet<RegistrationType> Category { get; set; }
public DbSet<Registration> Registrations { get; set; }
public DbSet<Status> Statuses { get; set; }
public DbSet<FoodType> FoodType { get; set; }
}
} | {
"content_hash": "9f472a22733ab0b053b263f51d6bca40",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 103,
"avg_line_length": 31.21875,
"alnum_prop": 0.6556556556556556,
"repo_name": "DavidMGardner/sogeti.capstone",
"id": "cd19ce0991fe24e35cf952955b7a2b0dd86dfaf0",
"size": "999",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sogeti.Capstone.Web/Sogeti.Capstone.Data.Model/CapstoneContext.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "223"
},
{
"name": "C#",
"bytes": "395857"
},
{
"name": "CSS",
"bytes": "135143"
},
{
"name": "HTML",
"bytes": "10206"
},
{
"name": "JavaScript",
"bytes": "55259"
}
],
"symlink_target": ""
} |
package iterator_pattern;
public interface MyIterator {
public Object next();
public boolean hasNext();
}
| {
"content_hash": "bb27dbbeaf2d262b88333987f4b595e8",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 29,
"avg_line_length": 12.666666666666666,
"alnum_prop": 0.7280701754385965,
"repo_name": "JonArnfred/Design-Patterns",
"id": "39c4c49e93431b3b0c94030bdefe4a75390b2043",
"size": "114",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "iterator_pattern-java/MyIterator.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "64367"
}
],
"symlink_target": ""
} |
import Swiper from './core/core.js';
export { default as Swiper, default } from './core/core.js';
import Virtual from './modules/virtual/virtual.js';
import Keyboard from './modules/keyboard/keyboard.js';
import Mousewheel from './modules/mousewheel/mousewheel.js';
import Navigation from './modules/navigation/navigation.js';
import Pagination from './modules/pagination/pagination.js';
import Scrollbar from './modules/scrollbar/scrollbar.js';
import Parallax from './modules/parallax/parallax.js';
import Zoom from './modules/zoom/zoom.js';
import Lazy from './modules/lazy/lazy.js';
import Controller from './modules/controller/controller.js';
import A11y from './modules/a11y/a11y.js';
import History from './modules/history/history.js';
import HashNavigation from './modules/hash-navigation/hash-navigation.js';
import Autoplay from './modules/autoplay/autoplay.js';
import EffectFade from './modules/effect-fade/effect-fade.js';
import EffectCube from './modules/effect-cube/effect-cube.js';
import EffectFlip from './modules/effect-flip/effect-flip.js';
import EffectCoverflow from './modules/effect-coverflow/effect-coverflow.js';
import Thumbs from './modules/thumbs/thumbs.js';
import FreeMode from './modules/free-mode/free-mode.js';
import Grid from './modules/grid/grid.js';
import Manipulation from './modules/manipulation/manipulation.js';
// Swiper Class
const modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Lazy, Controller, A11y, History, HashNavigation, Autoplay, EffectFade, EffectCube, EffectFlip, EffectCoverflow, Thumbs, FreeMode, Grid, Manipulation];
Swiper.use(modules);
| {
"content_hash": "456297920674524a9e95257ea58e7256",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 249,
"avg_line_length": 54.86666666666667,
"alnum_prop": 0.775820170109356,
"repo_name": "cdnjs/cdnjs",
"id": "149b971eb52a003558a74108de6b0a2bdc5f922e",
"size": "1907",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ajax/libs/Swiper/7.0.0-alpha.16/swiper-bundle.esm.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Lightbox Example</title>
<link rel="stylesheet" href="../dist/css/lightbox.css">
</head>
<body>
<section>
<h3>Two Individual Images</h3>
<div>
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-1.jpg" data-lightbox="example-1"><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-1.jpg" alt="image-1" /></a>
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-2.jpg" data-lightbox="example-2" data-title="Optional caption."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-2.jpg" alt="image-1"/></a>
</div>
<hr />
<h3>A Four Image Set</h3>
<div>
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-3.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-3.jpg" alt=""/></a>
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-4.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-4.jpg" alt="" /></a>
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-5.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-5.jpg" alt="" /></a>
<a class="example-image-link" href="http://lokeshdhakar.com/projects/lightbox2/images/image-6.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="http://lokeshdhakar.com/projects/lightbox2/images/thumb-6.jpg" alt="" /></a>
</div>
</section>
<section>
<p>
For more information, visit <a href="http://lokeshdhakar.com/projects/lightbox2/">http://lokeshdhakar.com/projects/lightbox2/</a>
</p>
</section>
<script src="../dist/js/lightbox-plus-jquery.min.js"></script>
</body>
</html>
| {
"content_hash": "9808e4093652096e682a3c98d727ef1c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 319,
"avg_line_length": 64.43243243243244,
"alnum_prop": 0.6925335570469798,
"repo_name": "Gazing/MC2",
"id": "802afe866459d77ab917c6d95ba878ba677a36e1",
"size": "2384",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "public/lib/plugins/lightbox2/examples/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "472333"
},
{
"name": "CoffeeScript",
"bytes": "3111"
},
{
"name": "HTML",
"bytes": "1862267"
},
{
"name": "JavaScript",
"bytes": "3925249"
},
{
"name": "PHP",
"bytes": "3859"
}
],
"symlink_target": ""
} |
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
class Example
{
static void Main()
{
var response = new VoiceResponse();
var start = new Start();
start.Stream(name: "Example Audio Stream", url: "wss://mystream.ngrok.io/audiostream");
response.Append(start);
Console.WriteLine(response.ToString());
}
}
| {
"content_hash": "bcccea5cd19378a5cc1da9d532747d1d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 95,
"avg_line_length": 21.705882352941178,
"alnum_prop": 0.6314363143631436,
"repo_name": "TwilioDevEd/api-snippets",
"id": "da36e817db8b8b65fcc55cbc2ceb72c56740eb48",
"size": "369",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "twiml/voice/stream/stream-1/stream-1.5.x.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "637161"
},
{
"name": "C++",
"bytes": "24856"
},
{
"name": "Go",
"bytes": "7217"
},
{
"name": "HTML",
"bytes": "335"
},
{
"name": "Java",
"bytes": "912474"
},
{
"name": "JavaScript",
"bytes": "512877"
},
{
"name": "M",
"bytes": "147"
},
{
"name": "Objective-C",
"bytes": "53325"
},
{
"name": "PHP",
"bytes": "517186"
},
{
"name": "Python",
"bytes": "442184"
},
{
"name": "Ruby",
"bytes": "438928"
},
{
"name": "Shell",
"bytes": "3854"
},
{
"name": "Swift",
"bytes": "42345"
},
{
"name": "TypeScript",
"bytes": "16767"
}
],
"symlink_target": ""
} |
export { Resolver } from './resolver';
import { ThrowErrorResolver } from './throwErrorResolver';
import { KeepNewResolver } from './keepNewResolver';
import { KeepOldResolver } from './keepOldResolver';
export class Resolvers {
static KeepNewResolver = new KeepNewResolver();
static KeepOldResolver = new KeepOldResolver();
static ThrowErrorResolver = new ThrowErrorResolver();
} | {
"content_hash": "09d80c7bc3d694f602cb0859f84dc81f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 38.7,
"alnum_prop": 0.7622739018087855,
"repo_name": "slavik57/divisa",
"id": "0a825ff751471b688b0159ebbb411f810e5b62c4",
"size": "387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/resolvers/resolvers.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "TypeScript",
"bytes": "40121"
}
],
"symlink_target": ""
} |
package com.reactnativenavigation.options.parsers;
import com.reactnativenavigation.options.params.FloatParam;
import com.reactnativenavigation.options.params.NullFloatParam;
import org.json.JSONObject;
public class FloatParser {
public static FloatParam parse(JSONObject json, String number) {
return json.has(number) ? new FloatParam((float) json.optDouble(number)) : new NullFloatParam();
}
}
| {
"content_hash": "ff1cf7e2eafa6f80f9a7790f5f493ff9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 104,
"avg_line_length": 34.583333333333336,
"alnum_prop": 0.7855421686746988,
"repo_name": "3sidedcube/react-native-navigation",
"id": "559211f87c805d34e7dad3d554dac0aa54ac562e",
"size": "415",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/FloatParser.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "519956"
},
{
"name": "JavaScript",
"bytes": "183382"
},
{
"name": "Objective-C",
"bytes": "401375"
},
{
"name": "Python",
"bytes": "1511"
},
{
"name": "Shell",
"bytes": "529"
}
],
"symlink_target": ""
} |
title: ack50
type: products
image: /img/Screen Shot 2017-05-09 at 11.56.54 AM.png
heading: k50
description: lksadjf lkasdjf lksajdf lksdaj flksadj flksa fdj
main:
heading: Foo Bar BAz
description: |-
***This is i a thing***kjh hjk kj
# Blah Blah
## Blah
### Baah
image1:
alt: kkkk
---
| {
"content_hash": "1816befd30876cdc1e47e2d39532e35b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6656716417910448,
"repo_name": "pblack/kaldi-hugo-cms-template",
"id": "51fc4541b308e3d3bac47f8e4cb40928cb5c81ec",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/content/pages2/ack50.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "94394"
},
{
"name": "HTML",
"bytes": "18889"
},
{
"name": "JavaScript",
"bytes": "10014"
}
],
"symlink_target": ""
} |
if [ -z "$EFG_SRC" ] || [ ! -d $EFG_SRC ]; then
echo ":: You have not yet initialised the eFG environment"
return
fi
#still have to source the funcs!
#As not exported in env?
. $funcs_file
#To do
#1 Integrate this into pipeline.env?
# This requires set up of a instance file and input dir. Also is less visible?
# Need to fettle with Help to list funcs better?
# As we have no structure to the functions, but at least we have a dir
# structure when we have separate scripts, add outdir ?
#2 remove hardcoded fastagrep path
#3 Done redirect output to standardised alignments output directory structure
#4 Done Take any input path, so we don't have to have standardised structure for fastq dirs as this often mirrors source repository structure
#5 Add -cell_type and -feature_type opts and cat to CellType_FeatureType(_.*).fastq, or just add set_name?
#6 DONE Finish files handling
#7 DONE Add fastq.list file to log the true uncat'd input fastq file(s)
#8 Optionally wait for job success and remove cat'd file if present?
#9 Use $EFG_DATA for scratch_dir. Currently set to group rather than personal scratch dir
# Need to handle both $EFG_DATA and $EFG_GROUP_DATA?
#10 DONE Integrate Daniel's batch code
#11 Wrap bsub cmd to catch errors and exit properly
#12 Add no clean up flag to keep intermediate files?
OPTIND=1 #Reset the getopts if we have used it previously
VALID_GENDERS='male female'
gender=
species=
index_home=/lustre/scratch103/ensembl/funcgen/bwa_indexes #Set this in pipeline/efg.config?
assembly=GRCh37
mask='_unmasked'
align_type='samse'
resource='-R"select[mem>5000] rusage[mem=5000]" -M5000000'
dir=
clean=
experiment_name=
name=
outdir=
format=sam
merge_only=0
#Change this to $EFG_DATA
scratch_dir=/lustre/scratch103/ensembl/funcgen
usage="Usage:\t\trun_bwa.sh <options> [ file1 file2 ]
\n\nDescription:\tThis script will take either a fastq file or a directory as input, unzip cat/rename
\n\t\tand rezip as necessary to generate a single fastq file. The relevant bwa indexes will be validated
\n\t\tbefore submitting the bwa job to the farm.
\n\nExample:\trun_bwa.sh -g male -a GRCh37 -s homo_sapiens -e Stamatoyannopoulos_DNase1_EpiRoadmap_GSE18927 -n IMR90_DNase1 SRX01242*/*fastq*
\n\nMandatory options:
\n\t-s(pecies e.g. homo_sapiens)
\n\t-g(ender e.g male|female)
\n\t-n(set name i.e. CellType_FeatureType(_.*), in line with expected input for peaks.env)
\n\nOther options:
\n\t-e(xperiment name, required if input files are split over different directories)
\n\t-o(utdir overrides default $scratch_dir/alignments/\$species/\$experiment_name)
\n\t-a(ssembly default is $assembly)
\n\t-p(aired default is single reads)
\n\t-i(ndex_home default=$index_home)
\n\t-r(esource default=$resource)
\n\t-c(lean away cat'd fastq file)
\n\t-m(erge only, only submit the merge job if it has previously failed due to the absence of the same header)
\n\t-b(am output default=sam)
\n\t-h(elp)"
#Add opts:
#ftype
#ctype
#experiment name
#build alignments dir based on $EFG_DATA/alignments/species/assembly/exp_name
#remove file option and just have as args?
while getopts ":g:s:e:n:d:o:i:r:a:mbcph" opt; do
case $opt in
g ) gender=$OPTARG ;;
s ) species=$OPTARG ;;
e ) experiment_name=$OPTARG ;;
n ) name=$OPTARG ;;
d ) dir=$OPTARG ;;
o ) outdir=$OPTARG ;;
i ) index_file=$OPTARG ;;
r ) resource=$OPTARG ;;
a ) assembly=$OPTARG ;;
p ) align_type='sampe' ;;
c ) clean=1 ;;
m ) merge_only=1 ;;
b ) format='bam' ;;
h ) echo -e $usage; exit 0;;
\? ) echo -e $usage; exit 1;;
esac
done
#Get trailing file name arguments
idx=1
while [[ $idx -lt $OPTIND ]]; do
idx=$(($idx + 1))
shift
done
files=($*)
#Parameter checks
CheckVariablesOrUsage "$usage" gender species index_home name
ValidateVariableOrUsage "$usage" gender VALID_GENDERS
if [[ ! "$files" ]] && [[ ! $dir ]]; then
echo -e "ERROR:\tYou must supply either a -d(ir) parameter or some file arguments\n"
echo -e $usage
exit
elif [[ "$files" ]] && [[ $dir ]]; then
echo -e "ERROR:You have specified -d(irectory) and input files, please use one or the other\n"
echo -e $usage
exit
fi
file_prefix=
new_input=1
unzipped_files=
split_files=
if [[ $dir ]] && [[ ! -d $dir ]]; then
echo "-d $dir is not a valid directory"
exit
fi
if [ ! "$experiment_name" ]; then
if [[ "$files" ]]; then
echo -e "ERROR:\tYou must explicitly set an -e(experiment name) when specify multiple file paths\n"
echo -e $usage
exit
fi
if [ ! "$dir" ]; then
#Get exp name from dir name
experiment_name=$(echo $dir | sed -r 's/\/$//')
experiment_name=$(echo $experiment_name | sed -r 's/.*\///')
fi
fi
if [ ! "$outdir" ]; then
outdir="${scratch_dir}/alignments/${species}/${assembly}/${experiment_name}"
fi
file_prefix="${outdir}/${name}."
split_file="${file_prefix}1.fastq"
#Test for pre-cat'd file
if [[ -f $split_file ]]; then
if [ $clean ]; then
echo -e "Removing previously cached fastq files:\n\t"
ls ${file_prefix}[1-9]*.fastq
rm -f ${file_prefix}[1-9]*.fastq
else
new_input=0
split_files=($(ls ${file_prefix}[1-9]*.fastq))
tmp=$(echo "${split_files[*]}" | sed 's/ /\n\t/g')
echo -e "WARNING:\tUsing previously cached fastq files:\n\t${tmp}\n"
echo -e "Specify -c(lean) to override this behaviour"
sleep 5
fi
else
#Remove just incase we have other cached files hanging around
rm -f ${file_prefix}[1-9]*.fastq
fi
#Get files
if [[ $new_input = 1 ]] && [[ $dir ]]; then
files=($(ls ${dir}/*fastq*))
if [[ ! "$files" ]]; then
echo -e "ERROR:\tNo fastq files found in input dir:\t$dir\n"
echo -e $usage
exit
fi
fi
#Do we not have a function for this unzipping/cating?
if [[ $new_input = 1 ]]; then
zipped_files=
for f in ${files[*]}; do
if [[ $f != *fastq* ]]; then
echo -e "Ignoring non-fastq file:\t$f"
else
CheckFile $f
echo -e "Using fastq file:\t$f"
funzipped=$f
#Unzip those which are zipped
#would be nice to list to files first before unzipping, so we know what we are running with immediately
if [[ $f = *.gz ]]; then
zipped_files=($f ${zipped_files[*]})
funzipped=$(echo $f | sed 's/\.gz//')
fi
unzipped_files=(${unzipped_files[*]} $funzipped)
fi
done
if [ "$zipped_files" ]; then
echo -e "Unzipping files..."
Execute gunzip ${zipped_files[*]}
fi
if [ ! "$unzipped_files" ]; then
echo -e "ERROR:\tCould not find any valid input fastq files from list:\n${files[*]}"
exit
fi
fi
#Cat if required and log inputs
alignment_log="${outdir}/${name}.alignment.log"
input_file="$file_prefix\$LSB_JOBINDEX.fastq"
if [[ $new_input = 1 ]]; then
split=1
#Run from single input file
#Run from source if it is < 8000000 line long
#This will preserve space on device and prevent uneccessary cat | split
if [[ ${#unzipped_files[*]} = 1 ]]; then
if [[ $(cat ${unzipped_files[0]} | wc -l) -lt 8000000 ]]; then
#cat | wc to avoid filename in output
echo "Skipping file batch as single input file is < 8000000 lines long"
split=0
echo "Input fastq file for $experiment_name $name alignments:" > $alignment_log
echo "\t${unzipped_files[0]}" >> $alignment_log
split_files=(${unzipped_files[0]})
input_file=${unzipped_files[0]}
fi
fi
if [[ $split = 1 ]]; then
MakeDirs $outdir
echo -e "Batching files to:\t${file_prefix}[1-9]\*\.fastq"
#This is not catching failure!
Execute cat ${unzipped_files[*]} | split -d -a 4 -l 8000000 - $file_prefix
#rename files to add suffix, remove leading 0s
#and +1 to the number to work with LSB_JOBINDEX values
ls $file_prefix[0-9][0-9][0-9][0-9] | while read f; do num=$(echo $f | sed -r "s/.*\.([0-9]+)$/\1/"); num=$(echo $num | sed -r "s/^[0]+([0-9][0-9]*)/\1/"); num=$(($num + 1)); mv $f "${file_prefix}${num}.fastq"; done
split_files=($(ls $file_prefix[1-9]*.fastq))
echo -e "Created ${#split_files[*]} batch files"
echo "Input fastq files for $experiment_name $name alignments:" > $alignment_log
for f in ${unzipped_files[*]}; do
echo "\t${f}" >> $alignment_log
done
#Could maybe add a validation step here to wc -l the batches versus the input
#echo -e "Total reads in fastq files" >> $alignment_log
#echo -e $(expr $(cat ${unzipped_files[*]} | wc -l) / 4) >> $alignment_log
echo "Gzipping all source fastq files"
Execute gzip ${unzipped_files[*]}
fi
fi
#Should always have split_files by now
#but let's test for sanity
if [[ ! "$split_files" ]]; then
echo -e "ERROR:\tCould not identify split_files. Something is wrong with the script!"
exit
fi
#Could also log other run params here?
lc_species=$(echo $species | tr [A-Z] [a-z])
uc_species=$(echo $species | tr [a-z] [A-Z])
index_name="${lc_species}_${gender}_${assembly}${mask}.fasta"
fasta_file=${index_home}/${uc_species}/${index_name}
#Check index/fasta files
for ext in amb ann bwt pac rbwt rpac rsa sa; do
error=$(CheckFile "${index_home}/${uc_species}/${index_name}.${ext}")
if [ $? -ne 0 ]; then
echo -e $error
if [[ ! -f $fasta_file ]]; then
echo -e "\nYou need to create the fasta file to index:\t$fasta_file"
#Add how to dump here?
echo -e "\ne.g. bsub -J ${lc_species}_top_level_unmasked -e ${lc_species}_top_level_unmasked.err -o ${lc_species}_top_level_unmasked.out -R\"select[mem>3500] rusage[mem=3500]\" -M3500000 $EFG_PERL $SRC/ensembl-analysis/scripts/sequence_dump.pl -dbhost ens-livemirror -dbuser ensro -dbname ${lc_species}_core_SCHEMA_BUILD -species $lc_species -coord_system_name toplevel -filename $lc_species_male_ASSEMBLY_unmasked.fasta"
echo -e "Then create the female file as follows:\n\tcat ${lc_species}_male_ASSEMBLY_unmasked.fasta | /nfs/users/nfs_d/dkeefe/bin/fastagrep -t -v -P -p 'chromosome:ASSEMBLY:Y' > ${lc_species}_female_ASSEMBLY_unmasked.fasta"
fi
echo -e "\nYou need to generate the bwa indexes using:\n\tbsub -J ${index_name}_indexes -o ${index_name}_bwa_indexes.out -e ${index_name}_bwa_indexes.err $resource bwa index -a bwtsw $fasta_file"
exit
fi
done
### Submit jobs
run_txt="\nRunning bwa with following options:\n\tIndex name\t= $index_name\n\tAlignment type\t= $align_type\n\tOutput dir\t= $outdir\n\tOutput format\t= $format\n"
echo -e $run_txt
echo -e $run_txt >> $alignment_log
### Run bwa and remove intermediate files...
#Use submitJob to avoid truncation of bsub cmd
align_job_name="bwa_${align_type}_${experiment_name}_${name}";
clean_cmd=
if [[ $merge_only = 1 ]]; then
echo -e "Skipping alignment job:\t$align_job_name"
else
#Is the index job still running?
checkJob ${index_name}_indexes exit_if_running
if [[ $new_data = 1 ]]; then
echo -e "ERROR:\tCannot skip alignment job as there is new data, please omit -m(erge only)"
exit;
fi
#we have problem with $LSB var being interpolated before they are set
#Solution is to interpolate in the environment?
#Do this passing '$job_cmd'
#Will this still not interpolate when submitting job?
bsub_cmd="-q long $resource -o ${outdir}/${align_job_name}.%J.%I.out -e ${outdir}/${align_job_name}.%J.%I.err"
align_job_cmd="bwa aln $fasta_file $input_file | "
align_job_cmd="$align_job_cmd bwa $align_type $fasta_file - $input_file | "
#This bam sort is a little redundant at the moment as
#pipeline imports only take sam at present and always sorts before import.
#However, needed for merging and bam sort should be faster
#When we implement bam parsers, we can optionally remove the sam conversion
#and also add a sorted flag to the imports
align_job_cmd="$align_job_cmd samtools view -uS - | "
align_job_cmd="$align_job_cmd samtools sort - $file_prefix\$LSB_JOBID.\$LSB_JOBINDEX.${align_type}.sorted"
echo -e "\n"
submitJob "$align_job_name[1-${#split_files[*]}]" "$bsub_cmd" '$align_job_cmd' eval
fi
#Now add merge and clean up job dependent on completion of first job
sam_header="${index_home}/${uc_species}/${lc_species}_${gender}_${assembly}${mask}.header.sam"
if [[ ! -f $sam_header ]]; then
echo -e "ERROR:\tCould not find sam header to mere with:\t$sam_header"
exit
fi
merge_cmd="samtools merge -h $sam_header - ${file_prefix}[0-9]*.[1-9]*.${align_type}.sorted.bam | "
merge_job_name="merge_${align_job_name}"
bsub_cmd=" -o ${outdir}/${merge_job_name}.%J.out -e ${outdir}/${merge_job_name}.%J.err"
if [[ $merge_only != 1 ]]; then
bsub_cmd="$bsub_cmd -w 'done(${align_job_name}[1-${#split_files[*]}])' "
fi
# Consider removing duplicates...
#merge_cmd="$merge_cmd samtools rmdup -s - | "
merge_cmd="$merge_cmd samtools view -h - | gzip -c > ${file_prefix}${align_type}.sam.gz"
clean_cmd=
echo "format is $format"
clean_cmd="rm -f ${file_prefix}[0-9]*.[1-9]*.${align_type}.sorted.bam"
# ouput some statistics
#possibly need to add the sam index (.fai file equivalent to header...)
#sam_index="${index_home}/${uc_species}/${lc_species}_${gender}_${assembly}${mask}.fa.fai"
log_cmd="echo \"Alignment QC - total reads as input: \" >> ${alignment_log}"
log_cmd="${log_cmd}; samtools view -uS ${file_prefix}${align_type}.sam.gz | samtools flagstat - | head -n 1 >> ${alignment_log}"
log_cmd="${log_cmd}; echo \"Alignment QC - mapped reads: \" >> ${alignment_log} "
log_cmd="${log_cmd}; samtools view -uS -F 4 ${file_prefix}${align_type}.sam.gz | samtools flagstat - | head -n 1 >> ${alignment_log}"
log_cmd="${log_cmd}; echo \"Alignment QC - reliably aligned reads (mapping quality >= 1): \" >> ${alignment_log}"
log_cmd="${log_cmd}; samtools view -uS -F 4 -q 1 ${file_prefix}${align_type}.sam.gz | samtools flagstat - | head -n 1 >> ${alignment_log}"
# Maybe do some percentages?
job_cmd="$merge_cmd; $clean_cmd; $log_cmd;"
#job_cmd="$merge_cmd; $clean_cmd;"
echo -e "\n"
submitJob "$merge_job_name" "$bsub_cmd" "$job_cmd"
#Could really do with submitting this to farm if we are waiting
#for cat gzip split activity
#Wait for job success here and remove cache file if present?
#Could also filter and convert sam2bed
echo -e "\nNOTE:\tNeed to remove the cat'd fastq file after the job has successfully completed"
| {
"content_hash": "6b6bb59f145a91afaeb1735e95bebb48",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 424,
"avg_line_length": 33.004672897196265,
"alnum_prop": 0.6673509840011327,
"repo_name": "adamsardar/perl-libs-custom",
"id": "402ee8cfbbe5c12e0c647afe150d2d9a432a6146",
"size": "14167",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EnsemblAPI/ensembl-functgenomics/scripts/run_bwa.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "23699"
},
{
"name": "C++",
"bytes": "262813"
},
{
"name": "Java",
"bytes": "11912"
},
{
"name": "Perl",
"bytes": "16848036"
},
{
"name": "Prolog",
"bytes": "31116"
},
{
"name": "Shell",
"bytes": "111607"
},
{
"name": "Tcl",
"bytes": "2051"
},
{
"name": "XSLT",
"bytes": "84130"
}
],
"symlink_target": ""
} |
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using Newtonsoft.Json;
using osu.Framework.Localisation;
using osu.Game.Scoring;
using osu.Game.Utils;
using static osu.Game.Users.User;
namespace osu.Game.Users
{
public class UserStatistics
{
[JsonProperty]
public User User;
[JsonProperty(@"level")]
public LevelInfo Level;
public struct LevelInfo
{
[JsonProperty(@"current")]
public int Current;
[JsonProperty(@"progress")]
public int Progress;
}
[JsonProperty(@"global_rank")]
public int? GlobalRank;
[JsonProperty(@"country_rank")]
public int? CountryRank;
// populated via User model, as that's where the data currently lives.
public RankHistoryData RankHistory;
[JsonProperty(@"pp")]
public decimal? PP;
[JsonProperty(@"ranked_score")]
public long RankedScore;
[JsonProperty(@"hit_accuracy")]
public double Accuracy;
[JsonIgnore]
public LocalisableString DisplayAccuracy => (Accuracy / 100).FormatAccuracy();
[JsonProperty(@"play_count")]
public int PlayCount;
[JsonProperty(@"play_time")]
public int? PlayTime;
[JsonProperty(@"total_score")]
public long TotalScore;
[JsonProperty(@"total_hits")]
public int TotalHits;
[JsonProperty(@"maximum_combo")]
public int MaxCombo;
[JsonProperty(@"replays_watched_by_others")]
public int ReplaysWatched;
[JsonProperty(@"grade_counts")]
public Grades GradesCount;
public struct Grades
{
[JsonProperty(@"ssh")]
public int? SSPlus;
[JsonProperty(@"ss")]
public int SS;
[JsonProperty(@"sh")]
public int? SPlus;
[JsonProperty(@"s")]
public int S;
[JsonProperty(@"a")]
public int A;
public int this[ScoreRank rank]
{
get
{
switch (rank)
{
case ScoreRank.XH:
return SSPlus ?? 0;
case ScoreRank.X:
return SS;
case ScoreRank.SH:
return SPlus ?? 0;
case ScoreRank.S:
return S;
case ScoreRank.A:
return A;
default:
throw new ArgumentException($"API does not return {rank.ToString()}");
}
}
}
}
}
}
| {
"content_hash": "23cd309949338b5b8d22d955ff5b2758",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 98,
"avg_line_length": 24.94871794871795,
"alnum_prop": 0.5001712915381981,
"repo_name": "peppy/osu-new",
"id": "449b0aa212c24446684f4252a6f6e05358d369f9",
"size": "2921",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "osu.Game/Users/UserStatistics.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "281779"
}
],
"symlink_target": ""
} |
package org.apache.asterix.optimizer.rules;
import org.apache.asterix.metadata.declared.DataSource;
import org.apache.asterix.metadata.declared.FeedDataSource;
import org.apache.asterix.metadata.entities.FeedConnection;
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator.ExecutionMode;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.physical.AssignPOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.physical.RandomPartitionExchangePOperator;
import org.apache.hyracks.algebricks.core.algebra.properties.DefaultNodeGroupDomain;
import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;
import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
public class IntroduceRandomPartitioningFeedComputationRule implements IAlgebraicRewriteRule {
@Override
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
ILogicalOperator op = opRef.getValue();
if (!op.getOperatorTag().equals(LogicalOperatorTag.ASSIGN)) {
return false;
}
ILogicalOperator opChild = op.getInputs().get(0).getValue();
if (!opChild.getOperatorTag().equals(LogicalOperatorTag.DATASOURCESCAN)) {
return false;
}
DataSourceScanOperator scanOp = (DataSourceScanOperator) opChild;
DataSource dataSource = (DataSource) scanOp.getDataSource();
if (dataSource.getDatasourceType() != DataSource.Type.FEED) {
return false;
}
final FeedDataSource feedDataSource = (FeedDataSource) dataSource;
FeedConnection feedConnection = feedDataSource.getFeedConnection();
if (feedConnection.getAppliedFunctions() == null || feedConnection.getAppliedFunctions().size() == 0) {
return false;
}
ExchangeOperator exchangeOp = new ExchangeOperator();
exchangeOp.setSourceLocation(op.getSourceLocation());
INodeDomain runtimeDomain = feedDataSource.getComputationNodeDomain();
exchangeOp.setPhysicalOperator(new RandomPartitionExchangePOperator(runtimeDomain));
op.getInputs().get(0).setValue(exchangeOp);
exchangeOp.getInputs().add(new MutableObject<ILogicalOperator>(scanOp));
ExecutionMode em = scanOp.getExecutionMode();
exchangeOp.setExecutionMode(em);
exchangeOp.computeDeliveredPhysicalProperties(context);
context.computeAndSetTypeEnvironmentForOperator(exchangeOp);
exchangeOp.recomputeSchema();
AssignOperator assignOp = (AssignOperator) opRef.getValue();
AssignPOperator assignPhyOp = (AssignPOperator) assignOp.getPhysicalOperator();
DefaultNodeGroupDomain computationNode = (DefaultNodeGroupDomain) runtimeDomain;
String[] nodes = computationNode.getNodes();
assignPhyOp.setLocationConstraint(nodes);
return true;
}
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
return false;
}
}
| {
"content_hash": "858ddbf498e62d32fd11cfe8ab6ef223",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 111,
"avg_line_length": 49.55844155844156,
"alnum_prop": 0.7667714884696016,
"repo_name": "apache/incubator-asterixdb",
"id": "9195c5eac88011482607003eb388e8573b5ed050",
"size": "4623",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceRandomPartitioningFeedComputationRule.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6115"
},
{
"name": "C",
"bytes": "421"
},
{
"name": "CSS",
"bytes": "4763"
},
{
"name": "Crystal",
"bytes": "453"
},
{
"name": "Gnuplot",
"bytes": "89"
},
{
"name": "HTML",
"bytes": "115120"
},
{
"name": "Java",
"bytes": "10091258"
},
{
"name": "JavaScript",
"bytes": "237719"
},
{
"name": "Python",
"bytes": "281315"
},
{
"name": "Ruby",
"bytes": "3078"
},
{
"name": "Scheme",
"bytes": "1105"
},
{
"name": "Shell",
"bytes": "186924"
},
{
"name": "Smarty",
"bytes": "31412"
}
],
"symlink_target": ""
} |
@interface PPSViewController ()
@property (nonatomic, strong) PPSPingServices *service;
@property (weak, nonatomic) IBOutlet UITextView *pingResultTextView;
@property (nonatomic, strong) NSMutableString *resultString;
@end
@implementation PPSViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.resultString = [[NSMutableString alloc] initWithString:@"ping结果:\n"];
self.service = [PPSPingServices serviceWithAddress:@"www.163.com"];
[self.service startWithCallbackHandler:^(PPSPingSummary *pingItem, NSArray *pingItems) {
NSLog(@"%@",pingItem);
[self.resultString appendFormat:@"%@\n",pingItem];
dispatch_async(dispatch_get_main_queue(), ^{
self.pingResultTextView.text = self.resultString;
});
}];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
| {
"content_hash": "bcfc0ff6e9894c82b4128a9dcf13dfac",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 92,
"avg_line_length": 30.875,
"alnum_prop": 0.7125506072874493,
"repo_name": "yangqian111/PPSPing",
"id": "6106174aad1783a2622bac76cfa8ebad87627a83",
"size": "1226",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/PPSPing/PPSViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2256"
},
{
"name": "Objective-C",
"bytes": "165930"
},
{
"name": "Ruby",
"bytes": "899"
},
{
"name": "Shell",
"bytes": "17453"
}
],
"symlink_target": ""
} |
require 'test_helper'
class RoutesTest < ActionController::TestCase
tests ApplicationController
def assert_path_and_url(name, prepend_path=nil)
@request.path = '/users/session'
prepend_path = "#{prepend_path}_" if prepend_path
# Resource param
assert_equal @controller.send(:"#{prepend_path}#{name}_path", :user),
send(:"#{prepend_path}user_#{name}_path")
assert_equal @controller.send(:"#{prepend_path}#{name}_url", :user),
send(:"#{prepend_path}user_#{name}_url")
# Default url params
assert_equal @controller.send(:"#{prepend_path}#{name}_path", :user, :param => 123),
send(:"#{prepend_path}user_#{name}_path", :param => 123)
assert_equal @controller.send(:"#{prepend_path}#{name}_url", :user, :param => 123),
send(:"#{prepend_path}user_#{name}_url", :param => 123)
@request.path = nil
# With an AR object
assert_equal @controller.send(:"#{prepend_path}#{name}_path", User.new),
send(:"#{prepend_path}user_#{name}_path")
assert_equal @controller.send(:"#{prepend_path}#{name}_url", User.new),
send(:"#{prepend_path}user_#{name}_url")
end
test 'should alias session to mapped user session' do
assert_path_and_url :session
assert_path_and_url :session, :new
assert_path_and_url :session, :destroy
end
test 'should alias password to mapped user password' do
assert_path_and_url :password
assert_path_and_url :password, :new
assert_path_and_url :password, :edit
end
test 'should alias confirmation to mapped user confirmation' do
assert_path_and_url :confirmation
assert_path_and_url :confirmation, :new
end
test 'should alias unlock to mapped user unlock' do
assert_path_and_url :unlock
assert_path_and_url :unlock, :new
end
test 'should alias registration to mapped user registration' do
assert_path_and_url :registration
assert_path_and_url :registration, :new
assert_path_and_url :registration, :edit
end
end
| {
"content_hash": "07ef731f8fda68f37907f32592a63b6c",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 88,
"avg_line_length": 35.36206896551724,
"alnum_prop": 0.6470014627011214,
"repo_name": "hkairi/devise-french",
"id": "00ff5b82533b96bdc576d27319a14c360fe10e2b",
"size": "2051",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/controllers/url_helpers_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "270633"
}
],
"symlink_target": ""
} |
"""Basic test coverage for agent training."""
from absl.testing import absltest
from absl.testing import parameterized
from bsuite import bsuite
from bsuite import sweep
from bsuite.baselines import experiment
from bsuite.baselines.tf import actor_critic_rnn
class RunTest(parameterized.TestCase):
@parameterized.parameters(*sweep.TESTING)
def test_run(self, bsuite_id: str):
env = bsuite.load_from_id(bsuite_id)
agent = actor_critic_rnn.default_agent(
env.observation_spec(), env.action_spec())
experiment.run(
agent=agent,
environment=env,
num_episodes=5)
if __name__ == '__main__':
absltest.main()
| {
"content_hash": "59ab5a788300b6a7d7ed8670a0966625",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 50,
"avg_line_length": 23.571428571428573,
"alnum_prop": 0.7090909090909091,
"repo_name": "deepmind/bsuite",
"id": "a8437e5cbd8188ab0ea33fc13e655b5d9d07be94",
"size": "1390",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "bsuite/baselines/tf/actor_critic_rnn/run_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "106470"
},
{
"name": "Python",
"bytes": "448602"
},
{
"name": "Shell",
"bytes": "2425"
},
{
"name": "TeX",
"bytes": "233184"
}
],
"symlink_target": ""
} |
angular.module('app.directives').directive('voatImageActions', ['$timeout', '$ionicGesture', function ($timeout, $ionicGesture) {
return {
restrict: 'A',
link: function (scope, element) {
var tapCount = 0;
var imageTapGesture = function imageTapGesture(event) {
tapCount++;
if (tapCount == 1) {
$timeout(function () {
try {
if (tapCount === 1) {
scope.onSingleTap();
} else {
scope.onDoubleTap();
}
} finally {
tapCount = 0;
}
}, 450);
}
};
//var tapEvent = $ionicGesture.on('tap', imageTapGesture, element);
//
//scope.$on('$destroy', function () {
// $ionicGesture.off(tapEvent, 'tap', imageTapGesture);
//});
}
}
}]);
| {
"content_hash": "55ecad9cd6ec8760ecc7d8b805e1cb46",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 129,
"avg_line_length": 25.264705882352942,
"alnum_prop": 0.47729918509895225,
"repo_name": "MJLaboratories/voat-pics-hd",
"id": "113e2667fdf0f1555c292a6294a8db24b8f049d3",
"size": "859",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "voatPicsHd/www/js/directive/voat-image-actions.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "16341"
},
{
"name": "C",
"bytes": "1663"
},
{
"name": "C#",
"bytes": "21011"
},
{
"name": "C++",
"bytes": "211682"
},
{
"name": "CSS",
"bytes": "1262117"
},
{
"name": "HTML",
"bytes": "9395"
},
{
"name": "Java",
"bytes": "317372"
},
{
"name": "JavaScript",
"bytes": "5675992"
},
{
"name": "Objective-C",
"bytes": "373150"
},
{
"name": "Shell",
"bytes": "2025"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.chimesdkvoice.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/chime-sdk-voice-2022-08-03/EmergencyCallingConfiguration"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class EmergencyCallingConfiguration implements Serializable, Cloneable, StructuredPojo {
private java.util.List<DNISEmergencyCallingConfiguration> dNIS;
/**
* @return
*/
public java.util.List<DNISEmergencyCallingConfiguration> getDNIS() {
return dNIS;
}
/**
* @param dNIS
*/
public void setDNIS(java.util.Collection<DNISEmergencyCallingConfiguration> dNIS) {
if (dNIS == null) {
this.dNIS = null;
return;
}
this.dNIS = new java.util.ArrayList<DNISEmergencyCallingConfiguration>(dNIS);
}
/**
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setDNIS(java.util.Collection)} or {@link #withDNIS(java.util.Collection)} if you want to override the
* existing values.
* </p>
*
* @param dNIS
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EmergencyCallingConfiguration withDNIS(DNISEmergencyCallingConfiguration... dNIS) {
if (this.dNIS == null) {
setDNIS(new java.util.ArrayList<DNISEmergencyCallingConfiguration>(dNIS.length));
}
for (DNISEmergencyCallingConfiguration ele : dNIS) {
this.dNIS.add(ele);
}
return this;
}
/**
* @param dNIS
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EmergencyCallingConfiguration withDNIS(java.util.Collection<DNISEmergencyCallingConfiguration> dNIS) {
setDNIS(dNIS);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getDNIS() != null)
sb.append("DNIS: ").append(getDNIS());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof EmergencyCallingConfiguration == false)
return false;
EmergencyCallingConfiguration other = (EmergencyCallingConfiguration) obj;
if (other.getDNIS() == null ^ this.getDNIS() == null)
return false;
if (other.getDNIS() != null && other.getDNIS().equals(this.getDNIS()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDNIS() == null) ? 0 : getDNIS().hashCode());
return hashCode;
}
@Override
public EmergencyCallingConfiguration clone() {
try {
return (EmergencyCallingConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.chimesdkvoice.model.transform.EmergencyCallingConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| {
"content_hash": "0474550cd12c36faaea5f3d693787d4e",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 150,
"avg_line_length": 31.62015503875969,
"alnum_prop": 0.6408433439568522,
"repo_name": "aws/aws-sdk-java",
"id": "40e8deb4b95a35a71877c88c9b8dd63d39e02ac3",
"size": "4659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-chimesdkvoice/src/main/java/com/amazonaws/services/chimesdkvoice/model/EmergencyCallingConfiguration.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package runtime
import (
"fmt"
"sync"
"time"
)
// BuildInfo holds information about the build
type BuildInfo struct {
Version string `json:"version"`
Time time.Time `json:"-"`
}
// String implements fmt.String
func (b BuildInfo) String() string {
return fmt.Sprintf("%s (%s)", b.Version, b.Time)
}
var build = BuildInfo{
Version: "",
Time: time.Time{},
}
// Build returns the information about the current build
// of the application. In development mode this will almost
// always run zero values for BuildInfo.
func Build() BuildInfo {
return build
}
var so sync.Once
// SetBuild allows the setting of build information only once.
// This is typically managed by the binary built by `buffalo build`.
func SetBuild(b BuildInfo) {
so.Do(func() {
build = b
})
}
| {
"content_hash": "f21a530747208b6684b2f355406c32c5",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 68,
"avg_line_length": 19.75,
"alnum_prop": 0.6962025316455697,
"repo_name": "markbates/buffalo",
"id": "3d82b08aaf2df4ca443a9960ee1d7d3b65323f78",
"size": "790",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "runtime/build.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "119887"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Request;
use Sabre\CalDAV\Plugin;
use Sabre\CalDAV\SharingPlugin;
use Sabre\DAV;
use Sabre\DAV\Exception\BadRequest;
use Sabre\Xml\Element\KeyValue;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
class InviteReply implements XmlDeserializable
{
/**
* The sharee calendar user address.
*
* This is the address that the original invite was set to
*
* @var string
*/
public $href;
/**
* The uri to the calendar that was being shared.
*
* @var string
*/
public $calendarUri;
/**
* The id of the invite message that's being responded to.
*
* @var string
*/
public $inReplyTo;
/**
* An optional message.
*
* @var string
*/
public $summary;
/**
* Either SharingPlugin::STATUS_ACCEPTED or SharingPlugin::STATUS_DECLINED.
*
* @var int
*/
public $status;
/**
* Constructor.
*
* @param string $href
* @param string $calendarUri
* @param string $inReplyTo
* @param string $summary
* @param int $status
*/
public function __construct($href, $calendarUri, $inReplyTo, $summary, $status)
{
$this->href = $href;
$this->calendarUri = $calendarUri;
$this->inReplyTo = $inReplyTo;
$this->summary = $summary;
$this->status = $status;
}
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @param Reader $reader
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$elems = KeyValue::xmlDeserialize($reader);
$href = null;
$calendarUri = null;
$inReplyTo = null;
$summary = null;
$status = null;
foreach ($elems as $name => $value) {
switch ($name) {
case '{'.Plugin::NS_CALENDARSERVER.'}hosturl':
foreach ($value as $bla) {
if ('{DAV:}href' === $bla['name']) {
$calendarUri = $bla['value'];
}
}
break;
case '{'.Plugin::NS_CALENDARSERVER.'}invite-accepted':
$status = DAV\Sharing\Plugin::INVITE_ACCEPTED;
break;
case '{'.Plugin::NS_CALENDARSERVER.'}invite-declined':
$status = DAV\Sharing\Plugin::INVITE_DECLINED;
break;
case '{'.Plugin::NS_CALENDARSERVER.'}in-reply-to':
$inReplyTo = $value;
break;
case '{'.Plugin::NS_CALENDARSERVER.'}summary':
$summary = $value;
break;
case '{DAV:}href':
$href = $value;
break;
}
}
if (is_null($calendarUri)) {
throw new BadRequest('The {http://calendarserver.org/ns/}hosturl/{DAV:}href element must exist');
}
return new self($href, $calendarUri, $inReplyTo, $summary, $status);
}
}
| {
"content_hash": "377ff02e50bf06e1d70f0bb84ac3f28a",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 109,
"avg_line_length": 27.83941605839416,
"alnum_prop": 0.5359202936549554,
"repo_name": "PVince81/sabre-dav",
"id": "710095bb2962775fcf94c98ea1fd67b4936a9861",
"size": "4210",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "lib/CalDAV/Xml/Request/InviteReply.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "17108"
},
{
"name": "PHP",
"bytes": "2108080"
},
{
"name": "Python",
"bytes": "12922"
},
{
"name": "Shell",
"bytes": "56"
}
],
"symlink_target": ""
} |
<?php
class Logger {
protected static $logFile = 'log.txt';
protected static $dbName = 'services';
protected static $dbUser = 'root';
protected static $dbPassword = 'root';
protected static $dbTable = 'com_pheide_trainose';
public static function logToFile($message) {
$fh = fopen(self::$logFile,'a');
fwrite($fh,$message . "\n");
fclose($fh);
}
public static function logToDatabase($source, $destination, $numRoutes, $cached, $data, $url = '', $level = 0) {
mysql_connect("localhost", self::$dbUser, self::$dbPassword) or die(mysql_error());
mysql_select_db(self::$dbName) or die(mysql_error());
$query = "INSERT INTO " . self::$dbTable . " SET"
. " tstamp = NOW() "
. ", severity = " . self::cleanInt($level)
. ", data = '" . self::cleanString($data) . "'"
. ", source = " . self::cleanString($source)
. ", destination = " . self::cleanString($destination)
. ", num_routes = " . self::cleanInt($numRoutes)
. ", cached = " . self::cleanInt($cached)
. ";";
if (!mysql_query($query)) {
self::logToFile($query . "\n" . mysql_error());
}
}
protected static function clean($data) {
return substr(mysql_real_escape_string($data),0,10000);
}
protected static function cleanString($data) {
return '"' . self::clean($data) . '"';
}
protected static function cleanInt($data) {
return (int)self::clean($data);
}
}
?>
| {
"content_hash": "7fa79c36acb7a42544f8d59a1785a292",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 113,
"avg_line_length": 27.254901960784313,
"alnum_prop": 0.6172661870503597,
"repo_name": "phoxicle/TrainOse-Backend",
"id": "41ace3a22870fe819ee58c6c2ca817419690d789",
"size": "1390",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Logger.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "63681"
}
],
"symlink_target": ""
} |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('microdevices', '0021'),
]
operations = [
migrations.AlterModelOptions(
name='microphysiologycenter',
options={'ordering': ('name',), 'verbose_name': 'Microphysiology Center'},
),
migrations.AddField(
model_name='microdevice',
name='device_material',
field=models.CharField(blank=True, default='', max_length=150, verbose_name='Device Material'),
),
migrations.AddField(
model_name='microdevice',
name='device_webpage',
field=models.URLField(blank=True, null=True, verbose_name='Device Webpage'),
),
migrations.AddField(
model_name='microdevice',
name='model_fluid_volume',
field=models.FloatField(blank=True, null=True, verbose_name='Model Region Fluid Volume (μL)'),
),
migrations.AddField(
model_name='microdevice',
name='model_length',
field=models.FloatField(blank=True, null=True, verbose_name='Model Region Length (mm)'),
),
migrations.AddField(
model_name='microdevice',
name='model_thickness',
field=models.FloatField(blank=True, null=True, verbose_name='Model Region Thickness (mm)'),
),
migrations.AddField(
model_name='microdevice',
name='model_width',
field=models.FloatField(blank=True, null=True, verbose_name='Model Region Width (mm)'),
),
migrations.AddField(
model_name='microdevice',
name='product_sheet',
field=models.FileField(blank=True, null=True, upload_to='device_product_sheets', verbose_name='Product Sheet'),
),
migrations.AlterField(
model_name='microdevice',
name='device_fluid_volume',
field=models.FloatField(blank=True, null=True, verbose_name='Device Fluid Volume (μL)'),
),
migrations.AlterField(
model_name='microdevice',
name='device_length',
field=models.FloatField(blank=True, null=True, verbose_name='Device Length (mm)'),
),
migrations.AlterField(
model_name='microdevice',
name='device_thickness',
field=models.FloatField(blank=True, null=True, verbose_name='Device Thickness (mm)'),
),
migrations.AlterField(
model_name='microdevice',
name='device_width',
field=models.FloatField(blank=True, null=True, verbose_name='Device Width (mm)'),
),
]
| {
"content_hash": "03358c90acd7a13df6326c2542219650",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 123,
"avg_line_length": 38.91428571428571,
"alnum_prop": 0.5803964757709251,
"repo_name": "UPDDI/mps-database-server",
"id": "cc1fad5bcc2f0426ad478cedb5418ef6e92de819",
"size": "2776",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "microdevices/migrations/0022.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14194"
},
{
"name": "HTML",
"bytes": "1128291"
},
{
"name": "JavaScript",
"bytes": "701549"
},
{
"name": "Python",
"bytes": "1735408"
},
{
"name": "Shell",
"bytes": "1535"
},
{
"name": "TSQL",
"bytes": "41508"
}
],
"symlink_target": ""
} |
var Lesson07B = (function() {
var self = this;
self.prototype = new App();
window.app = self.prototype;
window.app.outer = self;
self.setupGUI();
// Create lights
var parent = self.prototype;
parent.renderer.antialias = true;
parent.renderer.shadowMapEnabled = true;
parent.renderer.shadowMapSoft = true;
var color = new THREE.Color();
color.setRGB(this.params.ambientR, this.params.ambientG, this.params.ambientB);
var lightA = new THREE.AmbientLight({color: color});
parent.scene.add(lightA);
color.setRGB(this.params.directionR, this.params.directionG, this.params.directionB);
var spotLight = new THREE.SpotLight( 0xff0000 );
spotLight.position.set(this.params.spotlightX, this.params.spotlightY, this.params.spotlightZ);
spotLight.castShadow = true;
spotLight.shadowMapWidth = 1024;
spotLight.shadowMapHeight = 1024;
spotLight.shadowCameraNear = 3;
spotLight.shadowCameraFar = parent.camera.far;
spotLight.shadowCameraFov = 30;
spotLight.distance = 1000;
spotLight.shadowCameraVisible = this.params.shadowCameraVisible;
parent.scene.add(spotLight);
self.drawScene();
return self;
});
Lesson07B.prototype.setupGUI = function() {
var self = this.prototype;
// Create GUI
this.gui = new dat.GUI({
height : 9 * 32 - 1
});
this.params = {
'spotlightX': 100,
'spotlightY': 50,
'spotlightZ': 100,
'ambientR': 0.2,
'ambientG': 0.2,
'ambientB': 0.2,
'shadowCameraVisible': true
};
this.gui.add(this.params, 'spotlightX', -100, 100).onFinishChange(this.changeSpotLightPosition);
this.gui.add(this.params, 'spotlightY', 0, 100).onFinishChange(this.changeSpotLightPosition);
this.gui.add(this.params, 'spotlightZ', -100, 100).onFinishChange(this.changeSpotLightPosition);
this.gui.add(this.params, 'ambientR', 0.0, 1.0).onFinishChange(this.changeAmbientLightRGB);
this.gui.add(this.params, 'ambientG', 0.0, 1.0).onFinishChange(this.changeAmbientLightRGB);
this.gui.add(this.params, 'ambientB', 0.0, 1.0).onFinishChange(this.changeAmbientLightRGB);
this.gui.add(this.params, 'shadowCameraVisible').onFinishChange(this.toggleShadowCamera);
}
Lesson07B.prototype.toggleLighting = function () {
var parent = window.app;
var children = parent.scene.children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child instanceof THREE.Light) {
if (parent.outer.params.useLighting == true) {
child.intensity = 1.0;
} else {
child.intensity = 0;
}
}
}
console.log("toggled lighting");
}
Lesson07B.prototype.toggleShadowCamera = function () {
var parent = window.app;
var children = parent.scene.children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child instanceof THREE.SpotLight) {
if (parent.outer.params.shadowCameraVisible == true) {
console.log(child);
child.shadowCameraVisible = true;
} else {
child.shadowCameraVisible = false;
}
}
}
console.log("toggled shadow camera");
}
Lesson07B.prototype.changeAmbientLightRGB = function() {
console.log("changed ambient");
var parent = window.app;
var children = parent.scene.children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child instanceof THREE.AmbientLight) {
child.color.setRGB(
parent.outer.params.ambientR,
parent.outer.params.ambientG,
parent.outer.params.ambientB
);
break;
}
}
}
Lesson07B.prototype.changeSpotLightPosition = function() {
console.log("changed directional");
var parent = window.app;
var children = parent.scene.children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child instanceof THREE.SpotLight) {
child.position.set(
parent.outer.params.spotlightX,
parent.outer.params.spotlightY,
parent.outer.params.spotlightZ
);
break;
}
}
}
Lesson07B.prototype.drawScene = function () {
var self = this.prototype;
var texture = THREE.ImageUtils.loadTexture('images/crate.gif');
var material = new THREE.MeshPhongMaterial({color: 0xFFFFFF , map: texture});
self.cube = new THREE.Mesh(
new THREE.BoxGeometry(30, 30, 30, 32, 32, 32), material
);
var plane = new THREE.Mesh(
new THREE.PlaneGeometry(500,500),
new THREE.MeshPhongMaterial({color: 0x00FF00, ambient: 0x888888, side: THREE.DoubleSide})
);
plane.rotation.x = 90;
plane.position.y = -50;
plane.receiveShadow = true;
self.cube.position.z = -30;
self.cube.castShadow = true;
self.scene.add(self.cube);
self.scene.add(plane);
}
// Override App's render class
App.prototype.render = function () {
var self = this;
self.cube.rotation.x += 0.01;
self.cube.rotation.y += 0.01;
self.renderer.render(self.scene, self.camera);
};
window.Lesson07B = Lesson07B;
| {
"content_hash": "a269220dcc4ce2115d820d89e33057bf",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 100,
"avg_line_length": 29.351190476190474,
"alnum_prop": 0.6785641857635368,
"repo_name": "jwill/FutureInsightsLive-ThreeJS",
"id": "024e4249319e0fac1ad0f6d2b597c0188145f5dd",
"size": "4931",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/Lesson07B.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "1349004"
}
],
"symlink_target": ""
} |
A project demonstrating how to deal with the deficiencies in the Bluetooth Low Energy APIs on Android.
This is a work in progress that will be updated as I publish additional posts about BLE on https://www.hellsoft.se
| {
"content_hash": "d3769bb9ac3a7750d0ce1fa7841e4816",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 114,
"avg_line_length": 73,
"alnum_prop": 0.8036529680365296,
"repo_name": "ErikHellman/AndroidBleWrapper",
"id": "5e48429153c6cb2dcd16412bf2389af4a87586e0",
"size": "240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "5602"
}
],
"symlink_target": ""
} |
package net.eleritec.fractalui.events;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
/**
* @author cbutler
*/
public class EnabledListenerProxy extends AbstractInvocationHandler implements
Enabler {
private boolean enabled;
private Object delegate;
public static void setEnabled(Object object, boolean enabled) {
if(object instanceof EnabledListenerProxy) {
((EnabledListenerProxy)object).setEnabled(enabled);
}
}
public static Object getProxy(Object delegate, Class...interfaces) {
ClassLoader cl = EnabledListenerProxy.class.getClassLoader();
EnabledListenerProxy proxy = new EnabledListenerProxy(delegate);
Class[] classes = getInterfaces(interfaces, Enabler.class);
return Proxy.newProxyInstance(cl, classes, proxy);
}
private static Class[] getInterfaces(Class[] interfaces, Class...required) {
ArrayList<Class> classes = new ArrayList<Class>();
for(Class c: interfaces) {
classes.add(c);
}
for(Class c: required) {
if(!classes.contains(c)) {
classes.add(c);
}
}
return classes.toArray(new Class[0]);
}
public EnabledListenerProxy(Object delegate) {
this.delegate = delegate;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public Object getDelegate() {
return delegate;
}
protected String[] getNonProxiedMethodNames() {
return new String[] {"isEnabled", "setEnabled"};
}
protected Object dispatch(Object proxy, Method method, Object[] args) throws Throwable {
if(isEnabled()) {
Method impl = findMethod(delegate, method);
return impl==null? null: impl.invoke(delegate, args);
}
return null;
}
}
| {
"content_hash": "955fddb9294e630b6c62a8558687a539",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 92,
"avg_line_length": 28.928571428571427,
"alnum_prop": 0.6187654320987654,
"repo_name": "eleritec/fractal-ui",
"id": "29fe80233b4c7720102dc6b77988bbec7a562844",
"size": "2025",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/eleritec/fractalui/events/EnabledListenerProxy.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "135134"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="59dp"
android:gravity="center_horizontal"
android:text="@string/next"
android:onClick="nextFrame"/>
</LinearLayout>
| {
"content_hash": "37a9305020250aeab778335b7ecb2842",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 35.27777777777778,
"alnum_prop": 0.6692913385826772,
"repo_name": "Robmaister/auto-contact-exchange",
"id": "6f2eef391dd7062bd7880e3583bf70c797c3f66d",
"size": "635",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/add_contact_screen.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "18232"
}
],
"symlink_target": ""
} |
<ul class="list-inline text-center">
@if(Route::has('feeds.blog'))
<li class="list-inline-item">
<a href="{{ route('feeds.blog') }}" data-toggle="tooltip" title="RSS feed">
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
@endif
@if(config('blog.sm.twitter_url'))
<li class="list-inline-item">
<a href="{{ config('blog.sm.twitter_url') }}" target="_blank" data-toggle="tooltip" title="Twitter">
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fab fa-twitter fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
@endif
@if(config('blog.sm.facebook_url'))
<li class="list-inline-item">
<a href="{{ config('blog.sm.facebook_url') }}" target="_blank" data-toggle="tooltip" title="Facebook">
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fab fa-facebook-f fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
@endif
@if(config('blog.sm.linkedin_url'))
<li class="list-inline-item">
<a href="{{ config('blog.sm.linkedin_url') }}" target="_blank" data-toggle="tooltip" title="LinkedIn">
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fa fa-linkedin fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
@endif
@if(config('blog.sm.googleplus_url'))
<li class="list-inline-item">
<a href="{{ config('blog.sm.googleplus_url') }}" target="_blank" data-toggle="tooltip" title="Google+">
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fa fa-google-plus fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
@endif
@if(config('blog.sm.github_url'))
<li class="list-inline-item">
<a href="{{ config('blog.sm.github_url') }}" target="_blank" data-toggle="tooltip" title="GitHub">
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fab fa-github fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
@endif
</ul>
| {
"content_hash": "df0971d6228c38d4075b3de62d49b04c",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 115,
"avg_line_length": 38.53623188405797,
"alnum_prop": 0.47348627303497554,
"repo_name": "jeremykenedy/larablog",
"id": "476926dcd2bb48ed5a1daa637e69c4e4da280852",
"size": "2659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/views/blog/partials/social-media.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "165858"
},
{
"name": "PHP",
"bytes": "238488"
},
{
"name": "Vue",
"bytes": "565"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using Umbraco.Core.Logging;
namespace NuSync.Api.Helpers
{
/// <summary>
/// works out just what the differences between a nuSync file and
/// the Umbraco bits are... used for the difference reports
///
/// Will form the backbone of reporting, when you just want to
/// see changes, but not make them...
/// </summary>
public class DifferenceEngine
{
private readonly List<Difference> _changeSet;
public DifferenceEngine()
{
_changeSet = new List<Difference>();
}
/// <summary>
/// chuck everything into the log.
/// </summary>
public void LogChanges()
{
LogHelper.Info<DifferenceEngine>("Logging Changes");
LogHelper.Info<DifferenceEngine>("Processed {0} Changes found", () => _changeSet.Count());
foreach(var diffrence in _changeSet)
{
LogHelper.Info<DifferenceEngine>("DE: {0} {1} {2}", () => diffrence.Name, ()=> diffrence.ChangeType, ()=> diffrence.Changes.Count());
foreach(var change in diffrence.Changes)
{
LogHelper.Info<DifferenceEngine>("DE: {0} Change {1} {2} : {3} -> {4}",
() => diffrence.Name, () => change.Name, () => change.ChangeType, () => change.Before, () => change.After);
}
}
}
public void LogChange(XElement before, XElement after)
{
var diffrence = new Difference
{
UmbracoType = after.Name.LocalName
};
switch( after.Name.LocalName )
{
case "DataType":
LogDataTypeChange(diffrence, before, after);
break;
case "MediaType":
break;
case "DocumentType":
break;
case "Language":
break;
case "Dictionary":
break;
case "Template":
break;
case "Stylesheet":
break;
}
}
/// <summary>
/// passed the xml export for both current (before)
/// and our nuSync file (after).
/// </summary>
/// <param name="diffrence"></param>
/// <param name="before"></param>
/// <param name="after"></param>
public void LogDataTypeChange(Difference diffrence, XElement before, XElement after)
{
if (before == null)
{
diffrence.ChangeType = DifferenceType.New;
}
foreach (var attrib in after.Attributes())
{
if (before != null && before.Attribute(attrib.Name.LocalName) != null)
{
// exists is it the same...
if (before.Attribute(attrib.Name.LocalName).Value != attrib.Value)
{
// change
diffrence.ChangeType = DifferenceType.Change;
diffrence.Changes.Add(
new DifferenceDetail
{
Name = diffrence.Name,
ChangeType = DifferenceType.Change,
PropName = attrib.Name.LocalName,
Before = before.Attribute(attrib.Name.LocalName).Value,
After = attrib.Value
});
}
}
else
{
diffrence.ChangeType = DifferenceType.Change;
// doesn't exist so it's an add
diffrence.Changes.Add(
new DifferenceDetail
{
Name = diffrence.Name,
ChangeType = DifferenceType.New,
PropName = attrib.Name.LocalName,
After = attrib.Value,
Before = ""
});
}
}
_changeSet.Add(diffrence);
}
}
}
| {
"content_hash": "889de6c3826ffca9ecb7f10ed59a4d68",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 149,
"avg_line_length": 35.45967741935484,
"alnum_prop": 0.4448487605185354,
"repo_name": "TomDudfield/nuSync",
"id": "9ea74f03779b4db763b81a28f437841a37a90af1",
"size": "4399",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "nuSync.Api/helpers/DifferenceEngine.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "7113"
},
{
"name": "C#",
"bytes": "147885"
},
{
"name": "Shell",
"bytes": "435"
}
],
"symlink_target": ""
} |
require File.expand_path('../boot', __FILE__)
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module ContactForm
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
| {
"content_hash": "f39b592200a6304489ec60463f13db2d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 99,
"avg_line_length": 40,
"alnum_prop": 0.7364285714285714,
"repo_name": "rurudo/contact_form",
"id": "6e98f0a3a0f2b2bd4cea1bb13a80d5b5cc0b0889",
"size": "1400",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/application.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "230"
},
{
"name": "HTML",
"bytes": "5836"
},
{
"name": "JavaScript",
"bytes": "847"
},
{
"name": "Ruby",
"bytes": "37704"
}
],
"symlink_target": ""
} |
window.addEvent('domready',function(){
SimpleTree = new Mif.Tree({
container: $('tree_container'),
types: {
folder: {
openIcon: 'mif-tree-open-icon',
closeIcon: 'mif-tree-close-icon'
}
},
dfltType: 'folder',
animate: {
toggle: false
},
height: 20
})
.load({
url: '../assets/files/simpleTree.json'
})
.addEvent('load', function(){
this.root.recursive(function(){
this.toggle();
});
this.select(this.root);
});
});
| {
"content_hash": "420273350586c7a012f6f6f2f2e1e327",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 40,
"avg_line_length": 19.44,
"alnum_prop": 0.5679012345679012,
"repo_name": "creaven/miftree",
"id": "f1d78b128d0a2cb64305528548b506f435bf60c8",
"size": "486",
"binary": false,
"copies": "1",
"ref": "refs/heads/v1.2",
"path": "Demos/TreeOtherStyle/demo.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "97229"
},
{
"name": "PHP",
"bytes": "5509"
}
],
"symlink_target": ""
} |
// Copyright 2018 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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.
package com.google.devtools.build.android.desugar.scan;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Nullable;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.TypePath;
/** {@link ClassVisitor} that records references to classes starting with a given prefix. */
class PrefixReferenceScanner extends ClassVisitor {
/**
* Returns references with the given prefix in the given class.
*
* @param prefix an internal name prefix, typically a package such as {@code com/google/}
*/
public static ImmutableSet<KeepReference> scan(ClassReader reader, String prefix) {
PrefixReferenceScanner scanner = new PrefixReferenceScanner(prefix);
// Frames irrelevant for Android so skip them. Don't skip debug info in case the class we're
// visiting has local variable tables (typically it doesn't anyways).
reader.accept(scanner, ClassReader.SKIP_FRAMES);
return scanner.roots.build();
}
private final ImmutableSet.Builder<KeepReference> roots = ImmutableSet.builder();
private final PrefixReferenceMethodVisitor mv = new PrefixReferenceMethodVisitor();
private final PrefixReferenceFieldVisitor fv = new PrefixReferenceFieldVisitor();
private final PrefixReferenceAnnotationVisitor av = new PrefixReferenceAnnotationVisitor();
private final String prefix;
public PrefixReferenceScanner(String prefix) {
super(Opcodes.ASM7);
this.prefix = prefix;
}
@Override
public void visit(
int version,
int access,
String name,
String signature,
String superName,
String[] interfaces) {
checkArgument(!name.startsWith(prefix));
if (superName != null) {
classReference(superName);
}
classReferences(interfaces);
super.visit(version, access, name, signature, superName, interfaces);
}
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public void visitOuterClass(String owner, String name, String desc) {
classReference(owner);
if (desc != null) {
typeReference(Type.getMethodType(desc));
}
}
@Override
public AnnotationVisitor visitTypeAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public void visitInnerClass(String name, String outerName, String innerName, int access) {
classReference(name);
if (outerName != null) {
classReference(outerName);
}
}
@Override
public FieldVisitor visitField(
int access, String name, String desc, String signature, Object value) {
typeReference(desc);
return fv;
}
@Override
public MethodVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
typeReference(Type.getMethodType(desc));
classReferences(exceptions);
return mv;
}
private void classReferences(@Nullable String[] internalNames) {
if (internalNames != null) {
for (String itf : internalNames) {
classReference(itf);
}
}
}
// The following methods are package-private so they don't incur bridge methods when called from
// inner classes below.
void classReference(String internalName) {
checkArgument(internalName.charAt(0) != '[' && internalName.charAt(0) != '(', internalName);
checkArgument(!internalName.endsWith(";"), internalName);
if (internalName.startsWith(prefix)) {
roots.add(KeepReference.classReference(internalName));
}
}
void objectReference(String internalName) {
// don't call this for method types, convert to Type instead
checkArgument(internalName.charAt(0) != '(', internalName);
if (internalName.charAt(0) == '[') {
typeReference(internalName);
} else {
classReference(internalName);
}
}
void typeReference(String typeDesc) {
// don't call this for method types, convert to Type instead
checkArgument(typeDesc.charAt(0) != '(', typeDesc);
int lpos = typeDesc.lastIndexOf('[') + 1;
if (typeDesc.charAt(lpos) == 'L') {
checkArgument(typeDesc.endsWith(";"), typeDesc);
classReference(typeDesc.substring(lpos, typeDesc.length() - 1));
} else {
// else primitive or primitive array
checkArgument(typeDesc.length() == lpos + 1, typeDesc);
switch (typeDesc.charAt(lpos)) {
case 'B':
case 'C':
case 'S':
case 'I':
case 'J':
case 'D':
case 'F':
case 'Z':
break;
default:
throw new AssertionError("Unexpected type descriptor: " + typeDesc);
}
}
}
void typeReference(Type type) {
switch (type.getSort()) {
case Type.ARRAY:
typeReference(type.getElementType());
break;
case Type.OBJECT:
classReference(type.getInternalName());
break;
case Type.METHOD:
for (Type param : type.getArgumentTypes()) {
typeReference(param);
}
typeReference(type.getReturnType());
break;
default:
break;
}
}
void fieldReference(String owner, String name, String desc) {
objectReference(owner);
typeReference(desc);
if (owner.startsWith(prefix)) {
roots.add(KeepReference.memberReference(owner, name, desc));
}
}
void methodReference(String owner, String name, String desc) {
checkArgument(desc.charAt(0) == '(', desc);
objectReference(owner);
typeReference(Type.getMethodType(desc));
if (owner.startsWith(prefix)) {
roots.add(KeepReference.memberReference(owner, name, desc));
}
}
void handleReference(Handle handle) {
switch (handle.getTag()) {
case Opcodes.H_GETFIELD:
case Opcodes.H_GETSTATIC:
case Opcodes.H_PUTFIELD:
case Opcodes.H_PUTSTATIC:
fieldReference(handle.getOwner(), handle.getName(), handle.getDesc());
break;
default:
methodReference(handle.getOwner(), handle.getName(), handle.getDesc());
break;
}
}
private class PrefixReferenceMethodVisitor extends MethodVisitor {
public PrefixReferenceMethodVisitor() {
super(Opcodes.ASM7);
}
@Override
public AnnotationVisitor visitAnnotationDefault() {
return av;
}
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public AnnotationVisitor visitTypeAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public void visitTypeInsn(int opcode, String type) {
objectReference(type);
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
fieldReference(owner, name, desc);
}
@Override
@SuppressWarnings("deprecation") // Implementing deprecated method to be sure
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
visitMethodInsn(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
methodReference(owner, name, desc);
}
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
typeReference(Type.getMethodType(desc));
handleReference(bsm);
for (Object bsmArg : bsmArgs) {
visitConstant(bsmArg);
}
}
@Override
public void visitLdcInsn(Object cst) {
visitConstant(cst);
}
private void visitConstant(Object cst) {
if (cst instanceof Type) {
typeReference((Type) cst);
} else if (cst instanceof Handle) {
handleReference((Handle) cst);
} else {
// Check for other expected types as javadoc recommends
checkArgument(
cst instanceof String
|| cst instanceof Integer
|| cst instanceof Long
|| cst instanceof Float
|| cst instanceof Double,
"Unexpected constant: ",
cst);
}
}
@Override
public void visitMultiANewArrayInsn(String desc, int dims) {
typeReference(desc);
}
@Override
public AnnotationVisitor visitInsnAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
if (type != null) {
classReference(type);
}
}
@Override
public AnnotationVisitor visitTryCatchAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public void visitLocalVariable(
String name, String desc, String signature, Label start, Label end, int index) {
typeReference(desc);
}
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
int typeRef,
TypePath typePath,
Label[] start,
Label[] end,
int[] index,
String desc,
boolean visible) {
typeReference(desc);
return av;
}
}
private class PrefixReferenceFieldVisitor extends FieldVisitor {
public PrefixReferenceFieldVisitor() {
super(Opcodes.ASM7);
}
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
typeReference(desc);
return av;
}
@Override
public AnnotationVisitor visitTypeAnnotation(
int typeRef, TypePath typePath, String desc, boolean visible) {
typeReference(desc);
return av;
}
}
private class PrefixReferenceAnnotationVisitor extends AnnotationVisitor {
public PrefixReferenceAnnotationVisitor() {
super(Opcodes.ASM7);
}
@Override
public void visit(String name, Object value) {
if (value instanceof Type) {
typeReference((Type) value);
}
}
@Override
public void visitEnum(String name, String desc, String value) {
fieldReference(desc.substring(1, desc.length() - 1), value, desc);
}
@Override
public AnnotationVisitor visitAnnotation(String name, String desc) {
typeReference(desc);
return av;
}
@Override
public AnnotationVisitor visitArray(String name) {
return av;
}
}
}
| {
"content_hash": "d38e1fd7b7311b597c64b09143869096",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 100,
"avg_line_length": 28.891625615763548,
"alnum_prop": 0.6701619778346121,
"repo_name": "dslomov/bazel",
"id": "5b577466da6cc8d1603f946681c104f511a082ed",
"size": "11730",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/tools/android/java/com/google/devtools/build/android/desugar/scan/PrefixReferenceScanner.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1588"
},
{
"name": "C",
"bytes": "27067"
},
{
"name": "C++",
"bytes": "1510300"
},
{
"name": "Dockerfile",
"bytes": "839"
},
{
"name": "HTML",
"bytes": "21053"
},
{
"name": "Java",
"bytes": "35106285"
},
{
"name": "Makefile",
"bytes": "248"
},
{
"name": "Objective-C",
"bytes": "10369"
},
{
"name": "Objective-C++",
"bytes": "1043"
},
{
"name": "PowerShell",
"bytes": "15438"
},
{
"name": "Python",
"bytes": "2514049"
},
{
"name": "Ruby",
"bytes": "639"
},
{
"name": "Shell",
"bytes": "1906593"
},
{
"name": "Smarty",
"bytes": "18683"
}
],
"symlink_target": ""
} |
template <class T> class scoped_refptr;
namespace net {
class BoundNetLog;
class HttpAuthHandler;
class HttpAuthHandlerFactory;
class HttpResponseHeaders;
class SSLInfo;
// Utility class for http authentication.
class NET_EXPORT_PRIVATE HttpAuth {
public:
// Http authentication can be done the the proxy server, origin server,
// or both. This enum tracks who the target is.
enum Target {
AUTH_NONE = -1,
// We depend on the valid targets (!= AUTH_NONE) being usable as indexes
// in an array, so start from 0.
AUTH_PROXY = 0,
AUTH_SERVER = 1,
AUTH_NUM_TARGETS = 2,
};
// What the HTTP WWW-Authenticate/Proxy-Authenticate headers indicate about
// the previous authorization attempt.
enum AuthorizationResult {
AUTHORIZATION_RESULT_ACCEPT, // The authorization attempt was accepted,
// although there still may be additional
// rounds of challenges.
AUTHORIZATION_RESULT_REJECT, // The authorization attempt was rejected.
AUTHORIZATION_RESULT_STALE, // (Digest) The nonce used in the
// authorization attempt is stale, but
// otherwise the attempt was valid.
AUTHORIZATION_RESULT_INVALID, // The authentication challenge headers are
// poorly formed (the authorization attempt
// itself may have been fine).
AUTHORIZATION_RESULT_DIFFERENT_REALM, // The authorization
// attempt was rejected,
// but the realm associated
// with the new challenge
// is different from the
// previous attempt.
};
// Describes where the identity used for authentication came from.
enum IdentitySource {
// Came from nowhere -- the identity is not initialized.
IDENT_SRC_NONE,
// The identity came from the auth cache, by doing a path-based
// lookup (premptive authorization).
IDENT_SRC_PATH_LOOKUP,
// The identity was extracted from a URL of the form:
// http://<username>:<password>@host:port
IDENT_SRC_URL,
// The identity was retrieved from the auth cache, by doing a
// realm lookup.
IDENT_SRC_REALM_LOOKUP,
// The identity was provided by RestartWithAuth -- it likely
// came from a prompt (or maybe the password manager).
IDENT_SRC_EXTERNAL,
// The identity used the default credentials for the computer,
// on schemes that support single sign-on.
IDENT_SRC_DEFAULT_CREDENTIALS,
};
enum Scheme {
AUTH_SCHEME_BASIC = 0,
AUTH_SCHEME_DIGEST,
AUTH_SCHEME_NTLM,
AUTH_SCHEME_NEGOTIATE,
AUTH_SCHEME_SPDYPROXY,
AUTH_SCHEME_MOCK,
AUTH_SCHEME_MAX,
};
// Helper structure used by HttpNetworkTransaction to track
// the current identity being used for authorization.
struct Identity {
Identity();
IdentitySource source;
bool invalid;
AuthCredentials credentials;
};
// Get the name of the header containing the auth challenge
// (either WWW-Authenticate or Proxy-Authenticate).
static std::string GetChallengeHeaderName(Target target);
// Get the name of the header where the credentials go
// (either Authorization or Proxy-Authorization).
static std::string GetAuthorizationHeaderName(Target target);
// Returns a string representation of a Target value that can be used in log
// messages.
static std::string GetAuthTargetString(Target target);
// Returns a string representation of an authentication Scheme.
static const char* SchemeToString(Scheme scheme);
// Iterate through |response_headers|, and pick the best one that we support.
// Obtains the implementation class for handling the challenge, and passes it
// back in |*handler|. If no supported challenge was found, |*handler| is set
// to NULL.
//
// |disabled_schemes| is the set of schemes that we should not use.
//
// |origin| is used by the NTLM and Negotiation authentication scheme to
// construct the service principal name. It is ignored by other schemes.
//
// |ssl_info| is passed through to the scheme specific authentication handlers
// to use as appropriate.
static void ChooseBestChallenge(
HttpAuthHandlerFactory* http_auth_handler_factory,
const HttpResponseHeaders& response_headers,
const SSLInfo& ssl_info,
Target target,
const GURL& origin,
const std::set<Scheme>& disabled_schemes,
const BoundNetLog& net_log,
std::unique_ptr<HttpAuthHandler>* handler);
// Handle a 401/407 response from a server/proxy after a previous
// authentication attempt. For connection-based authentication schemes, the
// new response may be another round in a multi-round authentication sequence.
// For request-based schemes, a 401/407 response is typically treated like a
// rejection of the previous challenge, except in the Digest case when a
// "stale" attribute is present.
//
// |handler| must be non-NULL, and is the HttpAuthHandler from the previous
// authentication round.
//
// |response_headers| must contain the new HTTP response.
//
// |target| specifies whether the authentication challenge response came
// from a server or a proxy.
//
// |disabled_schemes| are the authentication schemes to ignore.
//
// |challenge_used| is the text of the authentication challenge used in
// support of the returned AuthorizationResult. If no headers were used for
// the result (for example, all headers have unknown authentication schemes),
// the value is cleared.
static AuthorizationResult HandleChallengeResponse(
HttpAuthHandler* handler,
const HttpResponseHeaders& response_headers,
Target target,
const std::set<Scheme>& disabled_schemes,
std::string* challenge_used);
};
} // namespace net
#endif // NET_HTTP_HTTP_AUTH_H_
| {
"content_hash": "4fa691e98cab0fd4ea398b966ce2f19b",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 80,
"avg_line_length": 37.18292682926829,
"alnum_prop": 0.6687438504427681,
"repo_name": "axinging/chromium-crosswalk",
"id": "464a39e1b795fb453a4574c1713d4c1ed7b3e4f7",
"size": "6474",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "net/http/http_auth.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "8242"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "23945"
},
{
"name": "C",
"bytes": "4103204"
},
{
"name": "C++",
"bytes": "225022948"
},
{
"name": "CSS",
"bytes": "949808"
},
{
"name": "Dart",
"bytes": "74976"
},
{
"name": "Go",
"bytes": "18155"
},
{
"name": "HTML",
"bytes": "28206993"
},
{
"name": "Java",
"bytes": "7651204"
},
{
"name": "JavaScript",
"bytes": "18831169"
},
{
"name": "Makefile",
"bytes": "96270"
},
{
"name": "Objective-C",
"bytes": "1228122"
},
{
"name": "Objective-C++",
"bytes": "7563676"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "63937"
},
{
"name": "Protocol Buffer",
"bytes": "418221"
},
{
"name": "Python",
"bytes": "7855597"
},
{
"name": "Shell",
"bytes": "472586"
},
{
"name": "Standard ML",
"bytes": "4965"
},
{
"name": "XSLT",
"bytes": "418"
},
{
"name": "nesC",
"bytes": "18335"
}
],
"symlink_target": ""
} |
PROFILE=""
if [[ ! -z "${TRAVIS_TAG}" ]] ; then
PROFILE="-Prelease"
fi
mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn deploy jacoco:report coveralls:report -B -V -e $PROFILE | {
"content_hash": "9e49dcb710e3a6d0703d45ff7effbcc0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 150,
"avg_line_length": 32,
"alnum_prop": 0.7366071428571429,
"repo_name": "hheg/jitstatic",
"id": "66cd9a7eebcaf7d6d3897e5cac3592e54d02c9fe",
"size": "237",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "build.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1159"
},
{
"name": "Java",
"bytes": "1345007"
},
{
"name": "Shell",
"bytes": "13000"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace Sonata\AdminBundle\Security\Handler;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface;
/**
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
interface AclSecurityHandlerInterface extends SecurityHandlerInterface
{
/**
* Set the permissions not related to an object instance and also to be available when objects do not exist.
*/
public function setAdminPermissions(array $permissions);
/**
* Return the permissions not related to an object instance and also to be available when objects do not exist.
*
* @return array
*/
public function getAdminPermissions();
/**
* Set the permissions related to an object instance.
*/
public function setObjectPermissions(array $permissions);
/**
* Return the permissions related to an object instance.
*
* @return array
*/
public function getObjectPermissions();
/**
* Get the ACL for the passed object identity.
*
* @return AclInterface|null or NULL if not found
*/
public function getObjectAcl(ObjectIdentityInterface $objectIdentity);
/**
* Find the ACLs for the passed object identities.
*
* @param \Traversable $oids a collection of ObjectIdentityInterface implementations
* @param array $sids an array of SecurityIdentityInterface implementations
*
* @throws \Exception
*
* @return \SplObjectStorage mapping the passed object identities to ACLs
*/
public function findObjectAcls(\Traversable $oids, array $sids = []);
/**
* Add an object owner ACE to the object ACL.
*/
public function addObjectOwner(AclInterface $acl, ?UserSecurityIdentity $securityIdentity = null);
/**
* Add the object class ACE's to the object ACL.
*/
public function addObjectClassAces(AclInterface $acl, array $roleInformation = []);
/**
* Create an object ACL.
*
* @return AclInterface
*/
public function createAcl(ObjectIdentityInterface $objectIdentity);
/**
* Update the ACL.
*/
public function updateAcl(AclInterface $acl);
/**
* Delete the ACL.
*/
public function deleteAcl(ObjectIdentityInterface $objectIdentity);
/**
* Helper method to find the index of a class ACE for a role.
*
* @param string $role
*
* @return mixed index if found, FALSE if not found
*/
public function findClassAceIndexByRole(AclInterface $acl, $role);
/**
* Helper method to find the index of a class ACE for a username.
*
* @param string $username
*
* @return mixed index if found, FALSE if not found
*/
public function findClassAceIndexByUsername(AclInterface $acl, $username);
}
| {
"content_hash": "ee6a659a1d254dfba48a58eaf06bf126",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 115,
"avg_line_length": 28.047619047619047,
"alnum_prop": 0.6730050933786078,
"repo_name": "jordisala1991/SonataAdminBundle",
"id": "9e5b15e51af49ebfdd58d0654479eda575135d35",
"size": "3192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Security/Handler/AclSecurityHandlerInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21409"
},
{
"name": "HTML",
"bytes": "264436"
},
{
"name": "JavaScript",
"bytes": "34671"
},
{
"name": "Makefile",
"bytes": "1475"
},
{
"name": "PHP",
"bytes": "1744480"
},
{
"name": "Shell",
"bytes": "1210"
}
],
"symlink_target": ""
} |
<section>
<div class="container">
<div class="row">
<br />
<br />
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xs-offset-0 col-sm-offset-0 col-md-offset-3 col-lg-offset-3">
<div class="panel panel-info">
<div class="panel-heading">
<h3 id="nome" class="panel-title"></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-9 col-lg-9">
<table class="table table-user-information">
<tbody>
<tr>
<td>Email</td>
<td id="email"></td>
</tr>
<tr>
<td>Morada</td>
<td id="morada"></td>
</tr>
<tr id="paypal">
<td>Email Paypal</td>
<td id="epaypal"></td>
</tr>
<tr id="paypal1">
<td>Password</td>
<td id="ppaypal"></td>
</tr>
<tr id="cartao">
<td>Número Cartão Crédito</td>
<td id="numcartao"></td>
</tr>
<tr id="cartao1">
<td>Validade Cartão</td>
<td id="validade"></td>
</tr>
<tr id="cartao2">
<td>Código</td>
<td id="codigo"></td>
</tr>
</tbody>
</table>
</div>
<div id="editar" class="form-signin col-md-9 col-lg-9" hidden>
<label for="primeironome" class="control-label">Primeiro Nome: </label>
<input id="primeironome" class="form-control" placeholder="Introduza o seu primeiro nome" required="" type="text" />
<label for="ultimonome" class="control-label">Último Nome: </label>
<input id="ultimonome" class="form-control" placeholder="Introduza o seu último nome" required="" type="text" />
<label for="registoEmail" class="control-label">Endereço Email</label>
<input id="registoEmail" class="form-control" placeholder="Introduza o endereço email" required="" autofocus="" type="email">
<label for="registoPassword" class="control-label">Password</label>
<input id="registoPassword" class="form-control" placeholder="Introduza a password" required="" type="password">
<div class="control-group">
<label class="control-label">Morada: </label>
<input id="address" class="form-control" placeholder="Introduza a sua morada" required="" type="text" />
</div>
<div id="pagamento" class="control-group">
<label class="control-label">Tipo de Pagamento Preferido:</label>
<select class="form-control" id="paymentype" name="accountype" onchange="pagamento()">
<option>PaySafeCard</option>
<option id="cartaocredito">Cartão de Crédito</option>
<option id="pay">Paypal</option>
</select>
<br />
<div id="card" class="panel panel-default" hidden>
<div class="panel panel-body">
<label for="ncartao" class="control-label">Número do Cartão: </label>
<input id="ncartao" class="form-control" placeholder="Introduza o número do cartão" required="" type="number" />
<hr />
<label for="datavalidade" class="control-label col-xs-12 col-sm-12">Data de Validade: </label>
<label for="mesvalidade" class="control-label col-xs-5 col-sm-5">
<input id="mesvalidade" class="form-control" placeholder="Mês" required="" type="month" />
</label>
<label for="anovalidade" class="control-label col-xs-5 col-sm-5">
<input id="anovalidade" class="form-control" placeholder="Ano" required="" type="number" />
</label>
<hr class="col-xs-12 col-sm-12" />
<label for="code" class="control-label">Código de Segurança: </label>
<input id="code" class="form-control" placeholder="Introduza o código de segurança" required="" type="number" />
<hr />
<label class="control-label" for="marca"></label>
<div class="col-xs-5">
<label class="radio inline" for="visa">
<input name="cartao" id="visa" value="visa" checked="checked" type="radio">Visa
</label>
<label class="radio inline" for="maestro">
<input name="cartao" id="maestro" value="maestro" type="radio">Maestro
</label>
</div>
<div class="col-xs-5">
<label class="radio inline" for="mastercard">
<input name="cartao" id="mastercard" value="mastercard" type="radio">MasterCard
</label>
<label class="radio inline" for="jcb">
<input name="cartao" id="jcb" value="jcb" type="radio">JCB
</label>
</div>
</div>
</div>
<div id="payment" class="panel panel-default" hidden>
<div class="panel panel-body">
<label for="emailpaypal" class="control-label">Email da conta Paypal: </label>
<input id="emailpaypal" class="form-control" placeholder="Introduza o email" required="" type="email" />
<hr />
<label for="passpaypal" class="control-label">Password: </label>
<input id="passpaypal" class="form-control" placeholder="Introduza a password" required="" type="password" />
</div>
</div>
</div>
</div>
</div>
</div>
<div id="loginbotoes" class="panel-footer col-xs-12">
<button class="btn btn-warning col-xs-5" onclick="editar()">Editar</button>
<button class="btn btn-danger col-xs-5" onclick="logout()">Sair</button>
</div>
<div id="editarbotoes" class="panel-footer col-xs-12" hidden>
<button class="btn btn-warning col-xs-5" onclick="guardar()">Guardar</button>
<button class="btn btn-danger col-xs-5" onclick="logout()">Sair</button>
</div>
</div>
</div>
</div>
</div>
</section> | {
"content_hash": "8e8d4fa0d6441ac63c7ddb3b6fe5c12b",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 157,
"avg_line_length": 73.265625,
"alnum_prop": 0.3509277031349968,
"repo_name": "Painatalio/VegiMarket",
"id": "e173fe727ec3f2961f85b127c973708a691ab85d",
"size": "9400",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/views/cliente.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1475"
},
{
"name": "CSS",
"bytes": "55168"
},
{
"name": "HTML",
"bytes": "64580"
},
{
"name": "JavaScript",
"bytes": "3210359"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Max;
using Autodesk.Max.MaxSDK.AssetManagement;
using PJanssen.Outliner.Controls.Tree;
using PJanssen.Outliner.MaxUtils;
using PJanssen.Outliner.Modes;
using PJanssen.Outliner.Plugins;
using PJanssen.Outliner.Scene;
namespace PJanssen.Outliner.Modes.XRef
{
[OutlinerPlugin(OutlinerPluginType.TreeMode)]
[LocalizedDisplayName(typeof(Resources), "Str_XrefMode")]
public class XRefMode : TreeMode
{
protected GlobalDelegates.Delegate5 proc_XrefSceneFlagsChanged;
protected GlobalDelegates.Delegate5 proc_XrefSceneDeleted;
protected GlobalDelegates.Delegate5 proc_XrefObjectRecordDeleted;
public XRefMode(TreeView tree) : base(tree)
{
proc_XrefSceneFlagsChanged = new GlobalDelegates.Delegate5(this.XrefSceneFlagsChanged);
proc_XrefSceneDeleted = new GlobalDelegates.Delegate5(this.XrefSceneDeleted);
proc_XrefObjectRecordDeleted = new GlobalDelegates.Delegate5(this.XrefObjectRecordDeleted);
}
public override void Start()
{
base.Start();
this.RegisterSystemNotification(proc_XrefSceneFlagsChanged, XRefNotificationCodes.XRefSceneFlagsChanged);
this.RegisterSystemNotification(proc_XrefSceneDeleted, XRefNotificationCodes.XRefSceneDeleted);
this.RegisterSystemNotification(proc_XrefObjectRecordDeleted, XRefNotificationCodes.XRefObjectRecordDeleted);
}
#region FillTree
protected override void FillTree()
{
AddXrefScenes();
AddXrefObjects();
}
private void AddXrefScenes()
{
IINode root = MaxInterfaces.COREInterface.RootNode;
for (int i = 0; i < root.XRefFileCount; i++)
{
TreeNodeCollection parentCollection = this.Tree.Nodes;
IINode parent = root.GetXRefParent(i);
if (parent != null)
{
TreeNode parentTn = this.AddNode(parent, this.Tree.Nodes);
parentCollection = parentTn.Nodes;
}
IAssetUser asset = root.GetXRefFile(i);
XRefSceneRecord xrefScene = new XRefSceneRecord(asset, i);
this.AddNode(xrefScene, parentCollection);
}
}
private void AddXrefObjects()
{
IIObjXRefManager8 objXrefManager = MaxInterfaces.Global.IObjXRefManager8.Instance;
for (uint i = 0; i < objXrefManager.RecordCount; i++)
{
IIObjXRefRecord record = objXrefManager.GetRecord(i);
XRefObjectRecord xrefRecord = new XRefObjectRecord(record);
TreeNode tn = this.AddNode(xrefRecord, this.Tree.Nodes);
foreach (object recordItem in xrefRecord.ChildBaseObjects)
{
this.AddNode(recordItem, tn.Nodes);
}
}
}
#endregion
#region System notifications
protected virtual void XrefSceneFlagsChanged(IntPtr param, IntPtr info)
{
IAssetUser asset = SystemNotifications.GetCallParam(info) as IAssetUser;
if (asset != null)
this.InvalidateObject(asset, false, false);
}
protected virtual void XrefSceneDeleted(IntPtr param, IntPtr info)
{
IAssetUser asset = SystemNotifications.GetCallParam(info) as IAssetUser;
if (asset != null)
this.RemoveNode(asset);
}
protected virtual void XrefObjectRecordDeleted(IntPtr param, IntPtr info)
{
IIObjXRefRecord record = SystemNotifications.GetCallParam(info) as IIObjXRefRecord;
if (record != null)
this.RemoveNode(record);
}
#endregion
}
}
| {
"content_hash": "19d65bf496ba2cafd35e6a8b474d7309",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 118,
"avg_line_length": 34.06363636363636,
"alnum_prop": 0.6706698692287163,
"repo_name": "Pjanssen/Outliner-3.0",
"id": "c137375ced5acd59f8f9623a5f604f0434646c51",
"size": "3749",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Plugins/XrefMode/XRefMode.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "222"
},
{
"name": "C#",
"bytes": "921327"
},
{
"name": "Shell",
"bytes": "4240"
}
],
"symlink_target": ""
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vijay.test</groupId>
<artifactId>test-squash</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.13</slf4j.version>
<logback.version>1.1.3</logback.version>
<lucene.version>5.4.1</lucene.version>
</properties>
<dependencies>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- lucene dependency -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "d0be7462cee50bdb9837eeeb378f6540",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 104,
"avg_line_length": 28.278688524590162,
"alnum_prop": 0.6933333333333334,
"repo_name": "vijaykumarsrivastava/test-squash",
"id": "407068be91801611e6e403e67e513e9c62b856d6",
"size": "1725",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1603"
}
],
"symlink_target": ""
} |
NoLifePony
==========
MLP CCG in video game form. Written in Rust.
In this project, only the server is actively being worked on. A separate client is being developed
in Java by a friend to speed up development.
Progress
--------
Basic server that accepts connections and responds to pings.
| {
"content_hash": "e6c45ec60bf3b7d32114e4e638870d67",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 98,
"avg_line_length": 26.636363636363637,
"alnum_prop": 0.7440273037542662,
"repo_name": "retep998/mlpccg-rs",
"id": "8042364b970dfe650d8a0900e840f0a204162680",
"size": "293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Rust",
"bytes": "10196"
}
],
"symlink_target": ""
} |
Unity3D Game Engine study
| {
"content_hash": "411750e90b31f3214048bed0afa54568",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 25,
"avg_line_length": 26,
"alnum_prop": 0.8461538461538461,
"repo_name": "EstudosLivres/Unreal3D",
"id": "920e8a52d347bef90ef5c0b0b881d3dc48f07c16",
"size": "37",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
namespace PapaParse.Net
{
public class Meta
{
public string delimiter;
public string linebreak;
public bool aborted;
public List<string> fields;
public bool truncated;
public int cursor;
public bool paused;
public override string ToString()
{
return delimiter + "|" + linebreak + "|" + aborted + "|" + truncated + "|" + cursor + "|" + paused;
}
public override bool Equals(object obj)
{
return this.ToString() == obj.ToString();
}
}
}
| {
"content_hash": "02ad6382fa30e2231988def81b8b4176",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 111,
"avg_line_length": 24.115384615384617,
"alnum_prop": 0.5566188197767146,
"repo_name": "andekande/PapaParse.Net",
"id": "b4f3ddf9e925c82796672d112d7c04a750f6fe5a",
"size": "629",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PapaParse.Net/Meta.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "110986"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>stalmarck-tactic: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.0 / stalmarck-tactic - 8.13.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
stalmarck-tactic
<small>
8.13.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-08 12:52:38 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-08 12:52:38 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "palmskog@gmail.com"
homepage: "https://github.com/coq-community/stalmarck"
dev-repo: "git+https://github.com/coq-community/stalmarck.git"
bug-reports: "https://github.com/coq-community/stalmarck/issues"
license: "LGPL-2.1-or-later"
synopsis: "Coq tactic and verified tool for proving tautologies using Stålmarck's algorithm"
build: ["dune" "build" "-p" name "-j" jobs]
depends: [
"ocaml" {>= "4.05"}
"dune" {>= "2.5"}
"coq" {>= "8.13" & < "8.14~"}
"coq-stalmarck" {= version}
]
tags: [
"category:Miscellaneous/Coq Extensions"
"category:Miscellaneous/Extracted Programs/Decision procedures"
"keyword:boolean formula"
"keyword:tautology checker"
"keyword:tactics"
"logpath:Stalmarck.Tactic"
"date:2021-08-02"
]
authors: [
"Pierre Letouzey"
"Laurent Théry"
]
url {
src: "https://github.com/coq-community/stalmarck/archive/v8.13.0.tar.gz"
checksum: "sha512=30e012aa8bc944b1d6834c60f84eed2847b53c53f1b7f16575ed60757bcfddd49706826da2621883f955fb190b000af0469cf8a1db06740825d8146dc53048f8"
}
</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-stalmarck-tactic.8.13.0 coq.8.7.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.0).
The following dependencies couldn't be met:
- coq-stalmarck-tactic -> ocaml >= 4.05
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-stalmarck-tactic.8.13.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "e0418e06e6e6118e09aea3dc53247834",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 159,
"avg_line_length": 41.80346820809248,
"alnum_prop": 0.5529590707964602,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "f7bc137b2f51f9e6a553bd86ba6f58a5770dc0f4",
"size": "7259",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.02.3-2.0.6/released/8.7.0/stalmarck-tactic/8.13.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/**
* @file
* This file implements general thread device required Spinel interface to the OpenThread stack.
*/
#include "ncp_base.hpp"
#include <stdarg.h>
#include <stdlib.h>
#include <openthread/diag.h>
#include <openthread/icmp6.h>
#include <openthread/ncp.h>
#include <openthread/openthread.h>
#include <openthread/platform/misc.h>
#include <openthread/platform/radio.h>
#include "common/code_utils.hpp"
#include "common/debug.hpp"
#include "common/instance.hpp"
#include "mac/mac_frame.hpp"
#include "net/ip6.hpp"
namespace ot {
namespace Ncp {
// ----------------------------------------------------------------------------
// MARK: Property Handler Jump Tables and Methods
// ----------------------------------------------------------------------------
#define NCP_GET_PROP_HANDLER_ENTRY(name) { SPINEL_PROP_##name, &NcpBase::GetPropertyHandler_##name }
const NcpBase::PropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] =
{
NCP_GET_PROP_HANDLER_ENTRY(CAPS),
NCP_GET_PROP_HANDLER_ENTRY(DEBUG_TEST_ASSERT),
NCP_GET_PROP_HANDLER_ENTRY(DEBUG_TEST_WATCHDOG),
NCP_GET_PROP_HANDLER_ENTRY(DEBUG_NCP_LOG_LEVEL),
NCP_GET_PROP_HANDLER_ENTRY(HWADDR),
NCP_GET_PROP_HANDLER_ENTRY(HOST_POWER_STATE),
NCP_GET_PROP_HANDLER_ENTRY(INTERFACE_COUNT),
NCP_GET_PROP_HANDLER_ENTRY(INTERFACE_TYPE),
NCP_GET_PROP_HANDLER_ENTRY(LAST_STATUS),
NCP_GET_PROP_HANDLER_ENTRY(LOCK),
NCP_GET_PROP_HANDLER_ENTRY(PHY_ENABLED),
NCP_GET_PROP_HANDLER_ENTRY(PHY_CHAN),
NCP_GET_PROP_HANDLER_ENTRY(PHY_RX_SENSITIVITY),
NCP_GET_PROP_HANDLER_ENTRY(PHY_TX_POWER),
NCP_GET_PROP_HANDLER_ENTRY(POWER_STATE),
NCP_GET_PROP_HANDLER_ENTRY(PROTOCOL_VERSION),
NCP_GET_PROP_HANDLER_ENTRY(MAC_15_4_PANID),
NCP_GET_PROP_HANDLER_ENTRY(MAC_15_4_LADDR),
NCP_GET_PROP_HANDLER_ENTRY(MAC_15_4_SADDR),
NCP_GET_PROP_HANDLER_ENTRY(MAC_RAW_STREAM_ENABLED),
NCP_GET_PROP_HANDLER_ENTRY(MAC_PROMISCUOUS_MODE),
NCP_GET_PROP_HANDLER_ENTRY(NCP_VERSION),
NCP_GET_PROP_HANDLER_ENTRY(UNSOL_UPDATE_FILTER),
NCP_GET_PROP_HANDLER_ENTRY(UNSOL_UPDATE_LIST),
NCP_GET_PROP_HANDLER_ENTRY(VENDOR_ID),
#if OPENTHREAD_MTD || OPENTHREAD_FTD
NCP_GET_PROP_HANDLER_ENTRY(MAC_DATA_POLL_PERIOD),
NCP_GET_PROP_HANDLER_ENTRY(MAC_EXTENDED_ADDR),
NCP_GET_PROP_HANDLER_ENTRY(MAC_SCAN_STATE),
NCP_GET_PROP_HANDLER_ENTRY(MAC_SCAN_MASK),
NCP_GET_PROP_HANDLER_ENTRY(MAC_SCAN_PERIOD),
#if OPENTHREAD_ENABLE_MAC_FILTER
NCP_GET_PROP_HANDLER_ENTRY(MAC_BLACKLIST),
NCP_GET_PROP_HANDLER_ENTRY(MAC_BLACKLIST_ENABLED),
NCP_GET_PROP_HANDLER_ENTRY(MAC_FIXED_RSS),
NCP_GET_PROP_HANDLER_ENTRY(MAC_WHITELIST),
NCP_GET_PROP_HANDLER_ENTRY(MAC_WHITELIST_ENABLED),
#endif
NCP_GET_PROP_HANDLER_ENTRY(MSG_BUFFER_COUNTERS),
NCP_GET_PROP_HANDLER_ENTRY(PHY_CHAN_SUPPORTED),
NCP_GET_PROP_HANDLER_ENTRY(PHY_FREQ),
NCP_GET_PROP_HANDLER_ENTRY(PHY_RSSI),
NCP_GET_PROP_HANDLER_ENTRY(NET_IF_UP),
NCP_GET_PROP_HANDLER_ENTRY(NET_KEY_SEQUENCE_COUNTER),
NCP_GET_PROP_HANDLER_ENTRY(NET_KEY_SWITCH_GUARDTIME),
NCP_GET_PROP_HANDLER_ENTRY(NET_MASTER_KEY),
NCP_GET_PROP_HANDLER_ENTRY(NET_NETWORK_NAME),
NCP_GET_PROP_HANDLER_ENTRY(NET_PARTITION_ID),
NCP_GET_PROP_HANDLER_ENTRY(NET_REQUIRE_JOIN_EXISTING),
NCP_GET_PROP_HANDLER_ENTRY(NET_ROLE),
NCP_GET_PROP_HANDLER_ENTRY(NET_SAVED),
NCP_GET_PROP_HANDLER_ENTRY(NET_STACK_UP),
NCP_GET_PROP_HANDLER_ENTRY(NET_XPANID),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ALLOW_LOCAL_NET_DATA_CHANGE),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ASSISTING_PORTS),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_CHILD_TIMEOUT),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_DISCOVERY_SCAN_JOINER_FLAG),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_DISCOVERY_SCAN_ENABLE_FILTERING),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_DISCOVERY_SCAN_PANID),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_LEADER_ADDR),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_LEADER_NETWORK_DATA),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_LEADER_RID),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_MODE),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_NEIGHBOR_TABLE),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_NETWORK_DATA_VERSION),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_OFF_MESH_ROUTES),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ON_MESH_NETS),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_PARENT),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_RLOC16),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_RLOC16_DEBUG_PASSTHRU),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_STABLE_LEADER_NETWORK_DATA),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_STABLE_NETWORK_DATA_VERSION),
#if OPENTHREAD_ENABLE_BORDER_ROUTER
NCP_GET_PROP_HANDLER_ENTRY(THREAD_NETWORK_DATA),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_STABLE_NETWORK_DATA),
#endif
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ACTIVE_DATASET),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_PENDING_DATASET),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_ADDRESS_TABLE),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_ICMP_PING_OFFLOAD),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_LL_ADDR),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_ML_PREFIX),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_ML_ADDR),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_MULTICAST_ADDRESS_TABLE),
NCP_GET_PROP_HANDLER_ENTRY(IPV6_ROUTE_TABLE),
#if OPENTHREAD_ENABLE_JAM_DETECTION
NCP_GET_PROP_HANDLER_ENTRY(JAM_DETECT_ENABLE),
NCP_GET_PROP_HANDLER_ENTRY(JAM_DETECTED),
NCP_GET_PROP_HANDLER_ENTRY(JAM_DETECT_RSSI_THRESHOLD),
NCP_GET_PROP_HANDLER_ENTRY(JAM_DETECT_WINDOW),
NCP_GET_PROP_HANDLER_ENTRY(JAM_DETECT_BUSY),
NCP_GET_PROP_HANDLER_ENTRY(JAM_DETECT_HISTORY_BITMAP),
#endif
#if OPENTHREAD_ENABLE_LEGACY
NCP_GET_PROP_HANDLER_ENTRY(NEST_LEGACY_ULA_PREFIX),
NCP_GET_PROP_HANDLER_ENTRY(NEST_LEGACY_LAST_NODE_JOINED),
#endif
// MAC counters
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_ACK_REQ),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_ACKED),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_NO_ACK_REQ),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_DATA),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_DATA_POLL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_BEACON),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_BEACON_REQ),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_OTHER),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_RETRY),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_UNICAST),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_PKT_BROADCAST),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_ERR_CCA),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_ERR_ABORT),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_DATA),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_DATA_POLL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_BEACON),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_BEACON_REQ),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_OTHER),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_FILT_WL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_FILT_DA),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_UNICAST),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_BROADCAST),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_ERR_EMPTY),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_ERR_UKWN_NBR),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_ERR_NVLD_SADDR),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_ERR_SECURITY),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_ERR_BAD_FCS),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_ERR_OTHER),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_PKT_DUP),
// NCP counters
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_IP_SEC_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_IP_INSEC_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_IP_DROPPED),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_IP_SEC_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_IP_INSEC_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_IP_DROPPED),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_TX_SPINEL_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_SPINEL_TOTAL),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_RX_SPINEL_ERR),
// IP counters
NCP_GET_PROP_HANDLER_ENTRY(CNTR_IP_TX_SUCCESS),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_IP_RX_SUCCESS),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_IP_TX_FAILURE),
NCP_GET_PROP_HANDLER_ENTRY(CNTR_IP_RX_FAILURE),
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
#if OPENTHREAD_FTD
NCP_GET_PROP_HANDLER_ENTRY(NET_PSKC),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_LEADER_WEIGHT),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_CHILD_TABLE),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_CHILD_TABLE_ADDRESSES),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ROUTER_TABLE),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_LOCAL_LEADER_WEIGHT),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ROUTER_ROLE_ENABLED),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_CHILD_COUNT_MAX),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ROUTER_UPGRADE_THRESHOLD),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ROUTER_DOWNGRADE_THRESHOLD),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_CONTEXT_REUSE_DELAY),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_NETWORK_ID_TIMEOUT),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_ROUTER_SELECTION_JITTER),
NCP_GET_PROP_HANDLER_ENTRY(THREAD_PREFERRED_ROUTER_ID),
#if OPENTHREAD_ENABLE_COMMISSIONER
NCP_GET_PROP_HANDLER_ENTRY(THREAD_COMMISSIONER_ENABLED),
#endif
#if OPENTHREAD_ENABLE_TMF_PROXY
NCP_GET_PROP_HANDLER_ENTRY(THREAD_TMF_PROXY_ENABLED),
#endif
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
NCP_GET_PROP_HANDLER_ENTRY(THREAD_STEERING_DATA),
#endif
#endif // OPENTHREAD_FTD
#if OPENTHREAD_ENABLE_RAW_LINK_API
NCP_GET_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_ENABLED),
#endif
};
#define NCP_SET_PROP_HANDLER_ENTRY(name) { SPINEL_PROP_##name, &NcpBase::SetPropertyHandler_##name }
const NcpBase::PropertyHandlerEntry NcpBase::mSetPropertyHandlerTable[] =
{
NCP_SET_PROP_HANDLER_ENTRY(POWER_STATE),
NCP_SET_PROP_HANDLER_ENTRY(UNSOL_UPDATE_FILTER),
NCP_SET_PROP_HANDLER_ENTRY(PHY_TX_POWER),
NCP_SET_PROP_HANDLER_ENTRY(PHY_CHAN),
NCP_SET_PROP_HANDLER_ENTRY(MAC_PROMISCUOUS_MODE),
NCP_SET_PROP_HANDLER_ENTRY(MAC_15_4_PANID),
NCP_SET_PROP_HANDLER_ENTRY(MAC_15_4_LADDR),
NCP_SET_PROP_HANDLER_ENTRY(MAC_RAW_STREAM_ENABLED),
#if OPENTHREAD_ENABLE_RAW_LINK_API
NCP_SET_PROP_HANDLER_ENTRY(MAC_15_4_SADDR),
NCP_SET_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_ENABLED),
NCP_SET_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_SHORT_ADDRESSES),
NCP_SET_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_EXTENDED_ADDRESSES),
NCP_SET_PROP_HANDLER_ENTRY(PHY_ENABLED),
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
#if OPENTHREAD_MTD || OPENTHREAD_FTD
NCP_SET_PROP_HANDLER_ENTRY(MAC_DATA_POLL_PERIOD),
NCP_SET_PROP_HANDLER_ENTRY(MAC_SCAN_MASK),
NCP_SET_PROP_HANDLER_ENTRY(MAC_SCAN_STATE),
NCP_SET_PROP_HANDLER_ENTRY(MAC_SCAN_PERIOD),
NCP_SET_PROP_HANDLER_ENTRY(NET_IF_UP),
NCP_SET_PROP_HANDLER_ENTRY(NET_STACK_UP),
NCP_SET_PROP_HANDLER_ENTRY(NET_ROLE),
NCP_SET_PROP_HANDLER_ENTRY(NET_NETWORK_NAME),
NCP_SET_PROP_HANDLER_ENTRY(NET_XPANID),
NCP_SET_PROP_HANDLER_ENTRY(NET_MASTER_KEY),
NCP_SET_PROP_HANDLER_ENTRY(NET_KEY_SEQUENCE_COUNTER),
NCP_SET_PROP_HANDLER_ENTRY(NET_KEY_SWITCH_GUARDTIME),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ASSISTING_PORTS),
NCP_SET_PROP_HANDLER_ENTRY(STREAM_NET_INSECURE),
NCP_SET_PROP_HANDLER_ENTRY(STREAM_NET),
NCP_SET_PROP_HANDLER_ENTRY(IPV6_ML_PREFIX),
NCP_SET_PROP_HANDLER_ENTRY(IPV6_ICMP_PING_OFFLOAD),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_RLOC16_DEBUG_PASSTHRU),
#if OPENTHREAD_ENABLE_MAC_FILTER
NCP_SET_PROP_HANDLER_ENTRY(MAC_WHITELIST),
NCP_SET_PROP_HANDLER_ENTRY(MAC_WHITELIST_ENABLED),
NCP_SET_PROP_HANDLER_ENTRY(MAC_BLACKLIST),
NCP_SET_PROP_HANDLER_ENTRY(MAC_BLACKLIST_ENABLED),
NCP_SET_PROP_HANDLER_ENTRY(MAC_FIXED_RSS),
#endif
NCP_SET_PROP_HANDLER_ENTRY(THREAD_MODE),
NCP_SET_PROP_HANDLER_ENTRY(NET_REQUIRE_JOIN_EXISTING),
NCP_SET_PROP_HANDLER_ENTRY(DEBUG_NCP_LOG_LEVEL),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_DISCOVERY_SCAN_JOINER_FLAG),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_DISCOVERY_SCAN_ENABLE_FILTERING),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_DISCOVERY_SCAN_PANID),
#if OPENTHREAD_ENABLE_BORDER_ROUTER
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ALLOW_LOCAL_NET_DATA_CHANGE),
#endif
#if OPENTHREAD_ENABLE_JAM_DETECTION
NCP_SET_PROP_HANDLER_ENTRY(JAM_DETECT_ENABLE),
NCP_SET_PROP_HANDLER_ENTRY(JAM_DETECT_RSSI_THRESHOLD),
NCP_SET_PROP_HANDLER_ENTRY(JAM_DETECT_WINDOW),
NCP_SET_PROP_HANDLER_ENTRY(JAM_DETECT_BUSY),
#endif
#if OPENTHREAD_ENABLE_LEGACY
NCP_SET_PROP_HANDLER_ENTRY(NEST_LEGACY_ULA_PREFIX),
#endif
NCP_SET_PROP_HANDLER_ENTRY(CNTR_RESET),
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
#if OPENTHREAD_FTD
NCP_SET_PROP_HANDLER_ENTRY(NET_PSKC),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_CHILD_TIMEOUT),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_NETWORK_ID_TIMEOUT),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_LOCAL_LEADER_WEIGHT),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ROUTER_ROLE_ENABLED),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_CHILD_COUNT_MAX),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ROUTER_UPGRADE_THRESHOLD),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ROUTER_DOWNGRADE_THRESHOLD),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_CONTEXT_REUSE_DELAY),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ROUTER_SELECTION_JITTER),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_PREFERRED_ROUTER_ID),
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
NCP_SET_PROP_HANDLER_ENTRY(THREAD_STEERING_DATA),
#endif
#if OPENTHREAD_ENABLE_TMF_PROXY
NCP_SET_PROP_HANDLER_ENTRY(THREAD_TMF_PROXY_ENABLED),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_TMF_PROXY_STREAM),
#endif
NCP_SET_PROP_HANDLER_ENTRY(THREAD_ACTIVE_DATASET),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_PENDING_DATASET),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_MGMT_ACTIVE_DATASET),
NCP_SET_PROP_HANDLER_ENTRY(THREAD_MGMT_PENDING_DATASET),
#endif // #if OPENTHREAD_FTD
};
#define NCP_INSERT_PROP_HANDLER_ENTRY(name) { SPINEL_PROP_##name, &NcpBase::InsertPropertyHandler_##name }
const NcpBase::PropertyHandlerEntry NcpBase::mInsertPropertyHandlerTable[] =
{
NCP_INSERT_PROP_HANDLER_ENTRY(UNSOL_UPDATE_FILTER),
#if OPENTHREAD_ENABLE_RAW_LINK_API
NCP_INSERT_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_SHORT_ADDRESSES),
NCP_INSERT_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_EXTENDED_ADDRESSES),
#endif
#if OPENTHREAD_MTD || OPENTHREAD_FTD
NCP_INSERT_PROP_HANDLER_ENTRY(IPV6_ADDRESS_TABLE),
NCP_INSERT_PROP_HANDLER_ENTRY(IPV6_MULTICAST_ADDRESS_TABLE),
NCP_INSERT_PROP_HANDLER_ENTRY(THREAD_ASSISTING_PORTS),
#if OPENTHREAD_ENABLE_BORDER_ROUTER
NCP_INSERT_PROP_HANDLER_ENTRY(THREAD_OFF_MESH_ROUTES),
NCP_INSERT_PROP_HANDLER_ENTRY(THREAD_ON_MESH_NETS),
#endif
#if OPENTHREAD_ENABLE_MAC_FILTER
NCP_INSERT_PROP_HANDLER_ENTRY(MAC_WHITELIST),
NCP_INSERT_PROP_HANDLER_ENTRY(MAC_BLACKLIST),
NCP_INSERT_PROP_HANDLER_ENTRY(MAC_FIXED_RSS),
#endif
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
#if OPENTHREAD_FTD
#if OPENTHREAD_ENABLE_COMMISSIONER
NCP_INSERT_PROP_HANDLER_ENTRY(THREAD_JOINERS),
#endif
#endif // OPENTHREAD_FTD
};
#define NCP_REMOVE_PROP_HANDLER_ENTRY(name) { SPINEL_PROP_##name, &NcpBase::RemovePropertyHandler_##name }
const NcpBase::PropertyHandlerEntry NcpBase::mRemovePropertyHandlerTable[] =
{
NCP_REMOVE_PROP_HANDLER_ENTRY(UNSOL_UPDATE_FILTER),
#if OPENTHREAD_ENABLE_RAW_LINK_API
NCP_REMOVE_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_SHORT_ADDRESSES),
NCP_REMOVE_PROP_HANDLER_ENTRY(MAC_SRC_MATCH_EXTENDED_ADDRESSES),
#endif
#if OPENTHREAD_MTD || OPENTHREAD_FTD
NCP_REMOVE_PROP_HANDLER_ENTRY(IPV6_ADDRESS_TABLE),
NCP_REMOVE_PROP_HANDLER_ENTRY(IPV6_MULTICAST_ADDRESS_TABLE),
#if OPENTHREAD_ENABLE_BORDER_ROUTER
NCP_REMOVE_PROP_HANDLER_ENTRY(THREAD_OFF_MESH_ROUTES),
NCP_REMOVE_PROP_HANDLER_ENTRY(THREAD_ON_MESH_NETS),
#endif
NCP_REMOVE_PROP_HANDLER_ENTRY(THREAD_ASSISTING_PORTS),
#if OPENTHREAD_ENABLE_MAC_FILTER
NCP_REMOVE_PROP_HANDLER_ENTRY(MAC_WHITELIST),
NCP_REMOVE_PROP_HANDLER_ENTRY(MAC_BLACKLIST),
NCP_REMOVE_PROP_HANDLER_ENTRY(MAC_FIXED_RSS),
#endif
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
#if OPENTHREAD_FTD
NCP_REMOVE_PROP_HANDLER_ENTRY(THREAD_ACTIVE_ROUTER_IDS),
#endif
};
// ----------------------------------------------------------------------------
// MARK: Utility Functions
// ----------------------------------------------------------------------------
spinel_status_t NcpBase::ThreadErrorToSpinelStatus(otError aError)
{
spinel_status_t ret;
switch (aError)
{
case OT_ERROR_NONE:
ret = SPINEL_STATUS_OK;
break;
case OT_ERROR_FAILED:
ret = SPINEL_STATUS_FAILURE;
break;
case OT_ERROR_DROP:
ret = SPINEL_STATUS_DROPPED;
break;
case OT_ERROR_NO_BUFS:
ret = SPINEL_STATUS_NOMEM;
break;
case OT_ERROR_BUSY:
ret = SPINEL_STATUS_BUSY;
break;
case OT_ERROR_PARSE:
ret = SPINEL_STATUS_PARSE_ERROR;
break;
case OT_ERROR_INVALID_ARGS:
ret = SPINEL_STATUS_INVALID_ARGUMENT;
break;
case OT_ERROR_NOT_IMPLEMENTED:
ret = SPINEL_STATUS_UNIMPLEMENTED;
break;
case OT_ERROR_INVALID_STATE:
ret = SPINEL_STATUS_INVALID_STATE;
break;
case OT_ERROR_NO_ACK:
ret = SPINEL_STATUS_NO_ACK;
break;
case OT_ERROR_CHANNEL_ACCESS_FAILURE:
ret = SPINEL_STATUS_CCA_FAILURE;
break;
case OT_ERROR_ALREADY:
ret = SPINEL_STATUS_ALREADY;
break;
case OT_ERROR_NOT_FOUND:
ret = SPINEL_STATUS_ITEM_NOT_FOUND;
break;
case OT_ERROR_DISABLED_FEATURE:
ret = SPINEL_STATUS_INVALID_COMMAND_FOR_PROP;
break;
default:
// Unknown error code. Wrap it as a Spinel status and return that.
ret = static_cast<spinel_status_t>(SPINEL_STATUS_STACK_NATIVE__BEGIN + static_cast<uint32_t>(aError));
break;
}
return ret;
}
static spinel_status_t ResetReasonToSpinelStatus(otPlatResetReason aReason)
{
spinel_status_t ret;
switch (aReason)
{
case OT_PLAT_RESET_REASON_POWER_ON:
ret = SPINEL_STATUS_RESET_POWER_ON;
break;
case OT_PLAT_RESET_REASON_EXTERNAL:
ret = SPINEL_STATUS_RESET_EXTERNAL;
break;
case OT_PLAT_RESET_REASON_SOFTWARE:
ret = SPINEL_STATUS_RESET_SOFTWARE;
break;
case OT_PLAT_RESET_REASON_FAULT:
ret = SPINEL_STATUS_RESET_FAULT;
break;
case OT_PLAT_RESET_REASON_CRASH:
ret = SPINEL_STATUS_RESET_CRASH;
break;
case OT_PLAT_RESET_REASON_ASSERT:
ret = SPINEL_STATUS_RESET_ASSERT;
break;
case OT_PLAT_RESET_REASON_WATCHDOG:
ret = SPINEL_STATUS_RESET_WATCHDOG;
break;
case OT_PLAT_RESET_REASON_OTHER:
ret = SPINEL_STATUS_RESET_OTHER;
break;
default:
ret = SPINEL_STATUS_RESET_UNKNOWN;
break;
}
return ret;
}
// ----------------------------------------------------------------------------
// MARK: Class Boilerplate
// ----------------------------------------------------------------------------
NcpBase *NcpBase::sNcpInstance = NULL;
NcpBase::NcpBase(Instance *aInstance):
mInstance(aInstance),
mTxFrameBuffer(mTxBuffer, sizeof(mTxBuffer)),
mEncoder(mTxFrameBuffer),
mDecoder(),
mHostPowerStateInProgress(false),
mLastStatus(SPINEL_STATUS_OK),
mSupportedChannelMask(OT_RADIO_SUPPORTED_CHANNELS),
mChannelMask(OT_RADIO_SUPPORTED_CHANNELS),
mScanPeriod(200), // ms
mDiscoveryScanJoinerFlag(false),
mDiscoveryScanEnableFiltering(false),
mDiscoveryScanPanId(0xffff),
mUpdateChangedPropsTask(*aInstance, &NcpBase::UpdateChangedProps, this),
mThreadChangedFlags(0),
mChangedPropsSet(),
mHostPowerState(SPINEL_HOST_POWER_STATE_ONLINE),
mHostPowerReplyFrameTag(NcpFrameBuffer::kInvalidTag),
mHostPowerStateHeader(0),
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
mAllowPeekDelegate(NULL),
mAllowPokeDelegate(NULL),
#endif
mNextExpectedTid(0),
mResponseQueueHead(0),
mResponseQueueTail(0),
mAllowLocalNetworkDataChange(false),
mRequireJoinExistingNetwork(false),
mIsRawStreamEnabled(false),
mDisableStreamWrite(false),
mShouldEmitChildTableUpdate(false),
#if OPENTHREAD_FTD
mPreferredRouteId(0),
#endif
#if OPENTHREAD_ENABLE_RAW_LINK_API
mCurTransmitTID(0),
mCurReceiveChannel(OPENTHREAD_CONFIG_DEFAULT_CHANNEL),
mCurScanChannel(kInvalidScanChannel),
mSrcMatchEnabled(false),
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
#if OPENTHREAD_MTD || OPENTHREAD_FTD
mInboundSecureIpFrameCounter(0),
mInboundInsecureIpFrameCounter(0),
mOutboundSecureIpFrameCounter(0),
mOutboundInsecureIpFrameCounter(0),
mDroppedOutboundIpFrameCounter(0),
mDroppedInboundIpFrameCounter(0),
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
mFramingErrorCounter(0),
mRxSpinelFrameCounter(0),
mRxSpinelOutOfOrderTidCounter(0),
mTxSpinelFrameCounter(0),
mDidInitialUpdates(false)
{
assert(mInstance != NULL);
sNcpInstance = this;
mTxFrameBuffer.SetFrameRemovedCallback(&NcpBase::HandleFrameRemovedFromNcpBuffer, this);
memset(&mResponseQueue, 0, sizeof(mResponseQueue));
#if OPENTHREAD_MTD || OPENTHREAD_FTD
otMessageQueueInit(&mMessageQueue);
otSetStateChangedCallback(mInstance, &NcpBase::HandleStateChanged, this);
otIp6SetReceiveCallback(mInstance, &NcpBase::HandleDatagramFromStack, this);
otIp6SetReceiveFilterEnabled(mInstance, true);
otLinkSetPcapCallback(mInstance, &NcpBase::HandleRawFrame, static_cast<void *>(this));
otIcmp6SetEchoEnabled(mInstance, false);
#if OPENTHREAD_FTD
otThreadSetChildTableCallback(mInstance, &NcpBase::HandleChildTableChanged);
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
memset(&mSteeringDataAddress, 0, sizeof(mSteeringDataAddress));
#endif
#endif // OPENTHREAD_FTD
#if OPENTHREAD_ENABLE_LEGACY
mLegacyNodeDidJoin = false;
mLegacyHandlers = NULL;
memset(mLegacyUlaPrefix, 0, sizeof(mLegacyUlaPrefix));
memset(&mLegacyLastJoinedNode, 0, sizeof(mLegacyLastJoinedNode));
#endif
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
mChangedPropsSet.AddLastStatus(SPINEL_STATUS_RESET_UNKNOWN);
mUpdateChangedPropsTask.Post();
}
NcpBase *NcpBase::GetNcpInstance(void)
{
return sNcpInstance;
}
// ----------------------------------------------------------------------------
// MARK: Serial Traffic Glue
// ----------------------------------------------------------------------------
NcpFrameBuffer::FrameTag NcpBase::GetLastOutboundFrameTag(void)
{
return mTxFrameBuffer.InFrameGetLastTag();
}
void NcpBase::HandleReceive(const uint8_t *aBuf, uint16_t aBufLength)
{
otError error = OT_ERROR_NONE;
uint8_t header = 0;
spinel_tid_t tid = 0;
mDisableStreamWrite = true;
// Initialize the decoder with the newly received spinel frame.
mDecoder.Init(aBuf, aBufLength);
// Receiving any message from the host has the side effect of transitioning the host power state to online.
mHostPowerState = SPINEL_HOST_POWER_STATE_ONLINE;
mHostPowerStateInProgress = false;
// Skip if there is no header byte to read or this isn't a spinel frame.
SuccessOrExit(mDecoder.ReadUint8(header));
VerifyOrExit((SPINEL_HEADER_FLAG & header) == SPINEL_HEADER_FLAG);
mRxSpinelFrameCounter++;
// We only support IID zero for now.
if (SPINEL_HEADER_GET_IID(header) != 0)
{
WriteLastStatusFrame(header, SPINEL_STATUS_INVALID_INTERFACE);
ExitNow();
}
error = HandleCommand(header);
if (error != OT_ERROR_NONE)
{
PrepareLastStatusResponse(header, ThreadErrorToSpinelStatus(error));
}
if (!IsResponseQueueEmpty())
{
// A response may have been prepared and queued for this command,
// so we attempt to send/write any queued responses. Note that
// if the response was prepared but cannot be sent now (not
// enough buffer space available), it will be attempted again
// from `HandleFrameRemovedFromNcpBuffer()` when buffer space
// becomes available.
IgnoreReturnValue(SendQueuedResponses());
}
// Check for out of sequence TIDs and update `mNextExpectedTid`,
tid = SPINEL_HEADER_GET_TID(header);
if ((mNextExpectedTid != 0) && (tid != mNextExpectedTid))
{
mRxSpinelOutOfOrderTidCounter++;
}
mNextExpectedTid = SPINEL_GET_NEXT_TID(tid);
exit:
mDisableStreamWrite = false;
}
void NcpBase::HandleFrameRemovedFromNcpBuffer(void *aContext, NcpFrameBuffer::FrameTag aFrameTag,
NcpFrameBuffer::Priority aPriority, NcpFrameBuffer *aNcpBuffer)
{
OT_UNUSED_VARIABLE(aNcpBuffer);
OT_UNUSED_VARIABLE(aPriority);
static_cast<NcpBase *>(aContext)->HandleFrameRemovedFromNcpBuffer(aFrameTag);
}
void NcpBase::HandleFrameRemovedFromNcpBuffer(NcpFrameBuffer::FrameTag aFrameTag)
{
if (mHostPowerStateInProgress == true)
{
if (aFrameTag == mHostPowerReplyFrameTag)
{
mHostPowerStateInProgress = false;
}
}
// A frame was removed from NCP TX buffer, so more space is now available.
// We attempt to write/send any pending frames. Order of the checks
// below is important: First any queued command responses, then
// any queued IPv6 datagram messages, then any asynchronous property updates.
// If a frame still can not fit in the available buffer, we exit immediately
// and wait for next time this callback is invoked (when another frame is
// removed and more buffer space becomes available).
SuccessOrExit(SendQueuedResponses());
// Check if `HOST_POWER_STATE` property update is required.
if (mHostPowerStateHeader)
{
SuccessOrExit(WritePropertyValueIsFrame(mHostPowerStateHeader, SPINEL_PROP_HOST_POWER_STATE));
mHostPowerStateHeader = 0;
if (mHostPowerState != SPINEL_HOST_POWER_STATE_ONLINE)
{
mHostPowerReplyFrameTag = GetLastOutboundFrameTag();
mHostPowerStateInProgress = true;
}
}
#if OPENTHREAD_MTD || OPENTHREAD_FTD
// Send any queued IPv6 datagram message.
SuccessOrExit(SendQueuedDatagramMessages());
#endif
// Send any unsolicited event-triggered property updates.
UpdateChangedProps();
exit:
return;
}
bool NcpBase::ShouldWakeHost(void)
{
return (mHostPowerState != SPINEL_HOST_POWER_STATE_ONLINE && !mHostPowerStateInProgress);
}
bool NcpBase::ShouldDeferHostSend(void)
{
return (mHostPowerState == SPINEL_HOST_POWER_STATE_DEEP_SLEEP && !mHostPowerStateInProgress);
}
void NcpBase::IncrementFrameErrorCounter(void)
{
mFramingErrorCounter++;
}
otError NcpBase::StreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen)
{
otError error = OT_ERROR_NONE;
uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0;
spinel_prop_key_t streamPropKey;
if (aStreamId == 0)
{
streamPropKey = SPINEL_PROP_STREAM_DEBUG;
}
else
{
streamPropKey = static_cast<spinel_prop_key_t>(aStreamId);
}
VerifyOrExit(!mDisableStreamWrite, error = OT_ERROR_INVALID_STATE);
VerifyOrExit(!mChangedPropsSet.IsPropertyFiltered(streamPropKey), error = OT_ERROR_INVALID_STATE);
// If there is a pending queued response we do not allow any new log
// stream writes. This is to ensure that log messages can not continue
// to use the NCP buffer space and block other spinel frames.
VerifyOrExit(IsResponseQueueEmpty(), error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, streamPropKey));
SuccessOrExit(error = mEncoder.WriteData(aDataPtr, static_cast<uint16_t>(aDataLen)));
SuccessOrExit(error = mEncoder.EndFrame());
exit:
if (error == OT_ERROR_NO_BUFS)
{
mChangedPropsSet.AddLastStatus(SPINEL_STATUS_NOMEM);
mUpdateChangedPropsTask.Post();
}
return error;
}
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
void NcpBase::RegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
{
mAllowPeekDelegate = aAllowPeekDelegate;
mAllowPokeDelegate = aAllowPokeDelegate;
}
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
// ----------------------------------------------------------------------------
// MARK: Raw frame handling
// ----------------------------------------------------------------------------
void NcpBase::HandleRawFrame(const otRadioFrame *aFrame, void *aContext)
{
static_cast<NcpBase *>(aContext)->HandleRawFrame(aFrame);
}
void NcpBase::HandleRawFrame(const otRadioFrame *aFrame)
{
uint16_t flags = 0;
uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0;
if (!mIsRawStreamEnabled)
{
goto exit;
}
if (aFrame->mDidTX)
{
flags |= SPINEL_MD_FLAG_TX;
}
// Append frame header and frame length
SuccessOrExit(mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_STREAM_RAW));
SuccessOrExit(mEncoder.WriteUint16(aFrame->mLength));
// Append the frame contents
SuccessOrExit(mEncoder.WriteData(aFrame->mPsdu, aFrame->mLength));
// Append metadata (rssi, etc)
SuccessOrExit(mEncoder.WriteInt8(aFrame->mRssi)); // RSSI
SuccessOrExit(mEncoder.WriteInt8(-128)); // Noise floor (Currently unused)
SuccessOrExit(mEncoder.WriteUint16(flags)); // Flags
SuccessOrExit(mEncoder.OpenStruct()); // PHY-data
// Empty for now
SuccessOrExit(mEncoder.CloseStruct());
SuccessOrExit(mEncoder.OpenStruct()); // Vendor-data
// Empty for now
SuccessOrExit(mEncoder.CloseStruct());
SuccessOrExit(mEncoder.EndFrame());
exit:
return;
}
// ----------------------------------------------------------------------------
// MARK: Spinel Response Handling
// ----------------------------------------------------------------------------
uint8_t NcpBase::GetWrappedResponseQueueIndex(uint8_t aPosition)
{
while (aPosition >= kResponseQueueSize)
{
aPosition -= kResponseQueueSize;
}
return aPosition;
}
otError NcpBase::PrepareResponse(uint8_t aHeader, bool aIsLastStatus, bool aIsGetResponse, unsigned int aKeyOrStatus)
{
otError error = OT_ERROR_NONE;
spinel_tid_t tid = SPINEL_HEADER_GET_TID(aHeader);
ResponseEntry *entry;
if (tid == 0)
{
// No response is required for TID zero. But we may emit a
// `LAST_STATUS` error status (if not filtered) for TID
// zero (e.g., for a dropped `STREAM_NET` set command).
if (aIsLastStatus)
{
mChangedPropsSet.AddLastStatus(static_cast<spinel_status_t>(aKeyOrStatus));
}
ExitNow();
}
if ((mResponseQueueTail - mResponseQueueHead) >= kResponseQueueSize)
{
// If there is no room a for a response, emit an unsolicited
// `DROPPED` error status to indicate a spinel response was
// dropped.
mChangedPropsSet.AddLastStatus(SPINEL_STATUS_DROPPED);
ExitNow(error = OT_ERROR_NO_BUFS);
}
// Transaction IDs are expected to come in sequence, if however, we
// get an out of sequence TID, check if we already have a response
// queued for this TID and if so mark the old entry as deleted.
if (tid != mNextExpectedTid)
{
for (uint8_t cur = mResponseQueueHead; cur < mResponseQueueTail; cur++)
{
entry = &mResponseQueue[GetWrappedResponseQueueIndex(cur)];
if (entry->mIsInUse && (entry->mTid == tid))
{
// Entry is just marked here and will be removed
// from `SendQueuedResponses()`.
entry->mIsInUse = false;
break;
}
}
}
// Add the new entry in the queue at tail.
entry = &mResponseQueue[GetWrappedResponseQueueIndex(mResponseQueueTail)];
entry->mTid = tid;
entry->mIsInUse = true;
entry->mIsLastStatus = aIsLastStatus;
entry->mIsGetResponse = aIsGetResponse;
entry->mPropKeyOrStatus = aKeyOrStatus;
mResponseQueueTail++;
exit:
return error;
}
otError NcpBase::SendQueuedResponses(void)
{
otError error = OT_ERROR_NONE;
while (mResponseQueueHead != mResponseQueueTail)
{
ResponseEntry &entry = mResponseQueue[mResponseQueueHead];
if (entry.mIsInUse)
{
uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0;
header |= static_cast<uint8_t>(entry.mTid << SPINEL_HEADER_TID_SHIFT);
if (entry.mIsLastStatus)
{
spinel_status_t status = static_cast<spinel_status_t>(entry.mPropKeyOrStatus);
SuccessOrExit(error = WriteLastStatusFrame(header, status));
}
else
{
spinel_prop_key_t propKey = static_cast<spinel_prop_key_t>(entry.mPropKeyOrStatus);
SuccessOrExit(error = WritePropertyValueIsFrame(header, propKey, entry.mIsGetResponse));
}
}
// Remove the response entry.
entry.mIsInUse = false;
mResponseQueueHead++;
if (mResponseQueueHead == kResponseQueueSize)
{
// Only when `head` wraps, the `tail` will be wrapped as well.
//
// This ensures that `tail` is always bigger than `head` and
// `(tail - head)` to correctly give the number of items in
// the queue.
mResponseQueueHead = 0;
mResponseQueueTail = GetWrappedResponseQueueIndex(mResponseQueueTail);
}
}
exit:
return error;
}
// ----------------------------------------------------------------------------
// MARK: Property/Status Changed
// ----------------------------------------------------------------------------
void NcpBase::UpdateChangedProps(Tasklet &aTasklet)
{
OT_UNUSED_VARIABLE(aTasklet);
GetNcpInstance()->UpdateChangedProps();
}
void NcpBase::UpdateChangedProps(void)
{
uint8_t numEntries;
spinel_prop_key_t propKey;
const ChangedPropsSet::Entry *entry;
#if OPENTHREAD_MTD || OPENTHREAD_FTD
ProcessThreadChangedFlags();
#endif
VerifyOrExit(!mChangedPropsSet.IsEmpty());
entry = mChangedPropsSet.GetSupportedEntries(numEntries);
for (uint8_t index = 0; index < numEntries; index++, entry++)
{
if (!mChangedPropsSet.IsEntryChanged(index))
{
continue;
}
propKey = entry->mPropKey;
if (propKey == SPINEL_PROP_LAST_STATUS)
{
spinel_status_t status = entry->mStatus;
if (status == SPINEL_STATUS_RESET_UNKNOWN)
{
status = ResetReasonToSpinelStatus(otPlatGetResetReason(mInstance));
}
SuccessOrExit(WriteLastStatusFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, status));
}
else if (mDidInitialUpdates)
{
SuccessOrExit(WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, propKey));
}
mChangedPropsSet.RemoveEntry(index);
VerifyOrExit(!mChangedPropsSet.IsEmpty());
}
exit:
mDidInitialUpdates = true;
return;
}
// ----------------------------------------------------------------------------
// MARK: Inbound Command Handler
// ----------------------------------------------------------------------------
otError NcpBase::HandleCommand(uint8_t aHeader)
{
otError error = OT_ERROR_NONE;
unsigned int command;
SuccessOrExit(error = mDecoder.ReadUintPacked(command));
switch (command)
{
case SPINEL_CMD_NOOP:
error = CommandHandler_NOOP(aHeader);
break;
case SPINEL_CMD_RESET:
error = CommandHandler_RESET(aHeader);
break;
case SPINEL_CMD_PROP_VALUE_GET:
case SPINEL_CMD_PROP_VALUE_SET:
case SPINEL_CMD_PROP_VALUE_INSERT:
case SPINEL_CMD_PROP_VALUE_REMOVE:
error = CommandHandler_PROP_VALUE_update(aHeader, command);
break;
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
case SPINEL_CMD_PEEK:
error = CommandHandler_PEEK(aHeader);
break;
case SPINEL_CMD_POKE:
error = CommandHandler_POKE(aHeader);
break;
#endif
#if OPENTHREAD_MTD || OPENTHREAD_FTD
case SPINEL_CMD_NET_SAVE:
error = CommandHandler_NET_SAVE(aHeader);
break;
case SPINEL_CMD_NET_CLEAR:
error = CommandHandler_NET_CLEAR(aHeader);
break;
case SPINEL_CMD_NET_RECALL:
error = CommandHandler_NET_RECALL(aHeader);
break;
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
default:
#if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
if (command >= SPINEL_CMD_VENDOR__BEGIN && command < SPINEL_CMD_VENDOR__END)
{
error = VendorCommandHandler(aHeader, command);
break;
}
#endif
error = PrepareLastStatusResponse(aHeader, SPINEL_STATUS_INVALID_COMMAND);
break;
}
exit:
return error;
}
// ----------------------------------------------------------------------------
// MARK: Property Get/Set/Insert/Remove Commands
// ----------------------------------------------------------------------------
NcpBase::PropertyHandler NcpBase::FindPropertyHandler(spinel_prop_key_t aKey, const PropertyHandlerEntry *aTableEntry,
size_t aTableLen)
{
PropertyHandler handler = NULL;
while (aTableLen--)
{
if (aTableEntry->mPropKey == aKey)
{
handler = aTableEntry->mHandler;
break;
}
aTableEntry++;
}
return handler;
}
NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
{
return FindPropertyHandler(
aKey,
mGetPropertyHandlerTable,
sizeof(mGetPropertyHandlerTable) / sizeof(mGetPropertyHandlerTable[0])
);
}
NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
{
return FindPropertyHandler(
aKey,
mSetPropertyHandlerTable,
sizeof(mSetPropertyHandlerTable) / sizeof(mSetPropertyHandlerTable[0])
);
}
NcpBase::PropertyHandler NcpBase::FindInsertPropertyHandler(spinel_prop_key_t aKey)
{
return FindPropertyHandler(
aKey,
mInsertPropertyHandlerTable,
sizeof(mInsertPropertyHandlerTable) / sizeof(mInsertPropertyHandlerTable[0])
);
}
NcpBase::PropertyHandler NcpBase::FindRemovePropertyHandler(spinel_prop_key_t aKey)
{
return FindPropertyHandler(
aKey,
mRemovePropertyHandlerTable,
sizeof(mRemovePropertyHandlerTable) / sizeof(mRemovePropertyHandlerTable[0])
);
}
// Returns `true` and updates the `aError` on success.
bool NcpBase::HandlePropertySetForSpecialProperties(uint8_t aHeader, spinel_prop_key_t aKey, otError &aError)
{
bool didHandle = true;
// Here the properties that require special treatment are handled.
// These properties are expected to form/write the response from
// their set handler directly.
switch (aKey)
{
case SPINEL_PROP_HOST_POWER_STATE:
ExitNow(aError = SetPropertyHandler_HOST_POWER_STATE(aHeader));
#if OPENTHREAD_ENABLE_DIAG
case SPINEL_PROP_NEST_STREAM_MFG:
ExitNow(aError = SetPropertyHandler_NEST_STREAM_MFG(aHeader));
#endif
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
case SPINEL_PROP_THREAD_COMMISSIONER_ENABLED:
ExitNow(aError = SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(aHeader));
#endif
#if OPENTHREAD_ENABLE_RAW_LINK_API
case SPINEL_PROP_STREAM_RAW:
ExitNow(aError = SetPropertyHandler_STREAM_RAW(aHeader));
#endif
default:
didHandle = false;
break;
}
exit:
return didHandle;
}
otError NcpBase::HandleCommandPropertySet(uint8_t aHeader, spinel_prop_key_t aKey)
{
otError error = OT_ERROR_NONE;
PropertyHandler handler = FindSetPropertyHandler(aKey);
if (handler == NULL)
{
// If there is no "set" handler, check if this property is one of the
// ones that require different treatment.
bool didHandle = HandlePropertySetForSpecialProperties(aHeader, aKey, error);
VerifyOrExit(!didHandle);
ExitNow(error = PrepareLastStatusResponse(aHeader, SPINEL_STATUS_PROP_NOT_FOUND));
}
error = (this->*handler)();
if (error == OT_ERROR_NONE)
{
error = PrepareSetResponse(aHeader, aKey);
}
else
{
error = PrepareLastStatusResponse(aHeader, ThreadErrorToSpinelStatus(error));
}
exit:
return error;
}
otError NcpBase::HandleCommandPropertyInsertRemove(uint8_t aHeader, spinel_prop_key_t aKey, unsigned int aCommand)
{
otError error = OT_ERROR_NONE;
PropertyHandler handler = NULL;
unsigned int responseCommand = 0;
const uint8_t *valuePtr;
uint16_t valueLen;
switch (aCommand)
{
case SPINEL_CMD_PROP_VALUE_INSERT:
handler = FindInsertPropertyHandler(aKey);
responseCommand = SPINEL_CMD_PROP_VALUE_INSERTED;
break;
case SPINEL_CMD_PROP_VALUE_REMOVE:
handler = FindRemovePropertyHandler(aKey);
responseCommand = SPINEL_CMD_PROP_VALUE_REMOVED;
break;
default:
assert(false);
break;
}
VerifyOrExit(handler != NULL, error = PrepareLastStatusResponse(aHeader, SPINEL_STATUS_PROP_NOT_FOUND));
// Save current read position in the decoder. Read the entire
// content as a data blob (which is used in forming the response
// in case of success), then reset the read position back so
// that the `PropertyHandler` method can parse the content.
mDecoder.SavePosition();
mDecoder.ReadData(valuePtr, valueLen);
mDecoder.ResetToSaved();
error = (this->*handler)();
VerifyOrExit(error == OT_ERROR_NONE, error = PrepareLastStatusResponse(aHeader, ThreadErrorToSpinelStatus(error)));
error = WritePropertyValueInsertedRemovedFrame(aHeader, responseCommand, aKey, valuePtr, valueLen);
// If the full response cannot be written now, instead prepare
// a `LAST_STATUS(STATUS_OK)` update as response.
if (error != OT_ERROR_NONE)
{
error = PrepareLastStatusResponse(aHeader, SPINEL_STATUS_OK);
}
exit:
return error;
}
// ----------------------------------------------------------------------------
// MARK: Outbound Frame Methods
// ----------------------------------------------------------------------------
otError NcpBase::WriteLastStatusFrame(uint8_t aHeader, spinel_status_t aLastStatus)
{
otError error = OT_ERROR_NONE;
if (SPINEL_HEADER_GET_IID(aHeader) == 0)
{
mLastStatus = aLastStatus;
}
SuccessOrExit(error = mEncoder.BeginFrame(aHeader, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_LAST_STATUS));
SuccessOrExit(error = mEncoder.WriteUintPacked(aLastStatus));
SuccessOrExit(error = mEncoder.EndFrame());
exit:
return error;
}
otError NcpBase::WritePropertyValueIsFrame(uint8_t aHeader, spinel_prop_key_t aPropKey, bool aIsGetResponse)
{
otError error = OT_ERROR_NONE;
PropertyHandler handler = FindGetPropertyHandler(aPropKey);
if (handler != NULL)
{
SuccessOrExit(error = mEncoder.BeginFrame(aHeader, SPINEL_CMD_PROP_VALUE_IS, aPropKey));
SuccessOrExit(error = (this->*handler)());
ExitNow(error = mEncoder.EndFrame());
}
if (aIsGetResponse)
{
SuccessOrExit(error = WriteLastStatusFrame(aHeader, SPINEL_STATUS_PROP_NOT_FOUND));
}
else
{
// Send a STATUS_OK for "set" response to a property that
// has no corresponding get handler.
SuccessOrExit(error = WriteLastStatusFrame(aHeader, SPINEL_STATUS_OK));
}
exit:
return error;
}
otError NcpBase::WritePropertyValueInsertedRemovedFrame(uint8_t aHeader, unsigned int aResponseCommand,
spinel_prop_key_t aPropKey, const uint8_t *aValuePtr,
uint16_t aValueLen)
{
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mEncoder.BeginFrame(aHeader, aResponseCommand, aPropKey));
SuccessOrExit(error = mEncoder.WriteData(aValuePtr, aValueLen));
SuccessOrExit(error = mEncoder.EndFrame());
exit:
return error;
}
// ----------------------------------------------------------------------------
// MARK: Individual Command Handlers
// ----------------------------------------------------------------------------
otError NcpBase::CommandHandler_NOOP(uint8_t aHeader)
{
return PrepareLastStatusResponse(aHeader, SPINEL_STATUS_OK);
}
otError NcpBase::CommandHandler_RESET(uint8_t aHeader)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aHeader);
// Signal a platform reset. If implemented, this function
// shouldn't return.
otInstanceReset(mInstance);
#if OPENTHREAD_MTD || OPENTHREAD_FTD
// We only get to this point if the
// platform doesn't support resetting.
// In such a case we fake it.
otThreadSetEnabled(mInstance, false);
otIp6SetEnabled(mInstance, false);
#endif
error = WriteLastStatusFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_STATUS_RESET_SOFTWARE);
if (error != OT_ERROR_NONE)
{
mChangedPropsSet.AddLastStatus(SPINEL_STATUS_RESET_UNKNOWN);
mUpdateChangedPropsTask.Post();
}
return error;
}
otError NcpBase::CommandHandler_PROP_VALUE_update(uint8_t aHeader, unsigned int aCommand)
{
otError error = OT_ERROR_NONE;
unsigned int propKey = 0;
error = mDecoder.ReadUintPacked(propKey);
VerifyOrExit(error == OT_ERROR_NONE, error = PrepareLastStatusResponse(aHeader, ThreadErrorToSpinelStatus(error)));
switch (aCommand)
{
case SPINEL_CMD_PROP_VALUE_GET:
error = PrepareGetResponse(aHeader, static_cast<spinel_prop_key_t>(propKey));
break;
case SPINEL_CMD_PROP_VALUE_SET:
error = HandleCommandPropertySet(aHeader, static_cast<spinel_prop_key_t>(propKey));
break;
case SPINEL_CMD_PROP_VALUE_INSERT:
case SPINEL_CMD_PROP_VALUE_REMOVE:
error = HandleCommandPropertyInsertRemove(aHeader, static_cast<spinel_prop_key_t>(propKey), aCommand);
break;
default:
break;
}
exit:
return error;
}
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
otError NcpBase::CommandHandler_PEEK(uint8_t aHeader)
{
otError parseError = OT_ERROR_NONE;
otError responseError = OT_ERROR_NONE;
uint32_t address;
uint16_t count;
SuccessOrExit(parseError = mDecoder.ReadUint32(address));
SuccessOrExit(parseError = mDecoder.ReadUint16(count));
VerifyOrExit(count != 0, parseError = OT_ERROR_INVALID_ARGS);
if (mAllowPeekDelegate != NULL)
{
VerifyOrExit(mAllowPeekDelegate(address, count), parseError = OT_ERROR_INVALID_ARGS);
}
SuccessOrExit(responseError = mEncoder.BeginFrame(aHeader, SPINEL_CMD_PEEK_RET));
SuccessOrExit(responseError = mEncoder.WriteUint32(address));
SuccessOrExit(responseError = mEncoder.WriteUint16(count));
SuccessOrExit(responseError = mEncoder.WriteData(reinterpret_cast<const uint8_t *>(address), count));
SuccessOrExit(responseError = mEncoder.EndFrame());
exit:
if (parseError != OT_ERROR_NONE)
{
responseError = PrepareLastStatusResponse(aHeader, ThreadErrorToSpinelStatus(parseError));
}
return responseError;
}
otError NcpBase::CommandHandler_POKE(uint8_t aHeader)
{
otError parseError = OT_ERROR_NONE;
uint32_t address;
uint16_t count;
const uint8_t *dataPtr = NULL;
uint16_t dataLen;
SuccessOrExit(parseError = mDecoder.ReadUint32(address));
SuccessOrExit(parseError = mDecoder.ReadUint16(count));
SuccessOrExit(parseError = mDecoder.ReadData(dataPtr, dataLen));
VerifyOrExit(count != 0, parseError = OT_ERROR_INVALID_ARGS);
VerifyOrExit(count <= dataLen, parseError = OT_ERROR_INVALID_ARGS);
if (mAllowPokeDelegate != NULL)
{
VerifyOrExit(mAllowPokeDelegate(address, count), parseError = OT_ERROR_INVALID_ARGS);
}
memcpy(reinterpret_cast<uint8_t *>(address), dataPtr, count);
exit:
return PrepareLastStatusResponse(aHeader, ThreadErrorToSpinelStatus(parseError));
}
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
// ----------------------------------------------------------------------------
// MARK: Individual Property Getters and Setters
// ----------------------------------------------------------------------------
otError NcpBase::GetPropertyHandler_PHY_ENABLED(void)
{
#if OPENTHREAD_ENABLE_RAW_LINK_API
return mEncoder.WriteBool(otLinkRawIsEnabled(mInstance));
#else
return mEncoder.WriteBool(false);
#endif
}
otError NcpBase::GetPropertyHandler_PHY_CHAN(void)
{
return mEncoder.WriteUint8(otLinkGetChannel(mInstance));
}
otError NcpBase::SetPropertyHandler_PHY_CHAN(void)
{
unsigned int channel = 0;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadUintPacked(channel));
#if OPENTHREAD_MTD || OPENTHREAD_FTD
error = otLinkSetChannel(mInstance, static_cast<uint8_t>(channel));
#endif
#if OPENTHREAD_ENABLE_RAW_LINK_API
SuccessOrExit(error);
// Cache the channel. If the raw link layer isn't enabled yet, the otSetChannel call
// doesn't call into the radio layer to set the channel. We will have to do it
// manually whenever the radios are enabled and/or raw stream is enabled.
mCurReceiveChannel = static_cast<uint8_t>(channel);
// Make sure we are update the receiving channel if raw link is enabled and we have raw
// stream enabled already
if (otLinkRawIsEnabled(mInstance) && mIsRawStreamEnabled)
{
error = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone);
}
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
exit:
return error;
}
otError NcpBase::GetPropertyHandler_MAC_PROMISCUOUS_MODE(void)
{
return mEncoder.WriteUint8(otPlatRadioGetPromiscuous(mInstance)
? SPINEL_MAC_PROMISCUOUS_MODE_FULL
: SPINEL_MAC_PROMISCUOUS_MODE_OFF
);
}
otError NcpBase::SetPropertyHandler_MAC_PROMISCUOUS_MODE(void)
{
uint8_t mode = 0;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadUint8(mode));
switch (mode)
{
case SPINEL_MAC_PROMISCUOUS_MODE_OFF:
otPlatRadioSetPromiscuous(mInstance, false);
break;
case SPINEL_MAC_PROMISCUOUS_MODE_NETWORK:
case SPINEL_MAC_PROMISCUOUS_MODE_FULL:
otPlatRadioSetPromiscuous(mInstance, true);
break;
default:
error = OT_ERROR_INVALID_ARGS;
break;
}
exit:
return error;
}
otError NcpBase::GetPropertyHandler_MAC_15_4_PANID(void)
{
return mEncoder.WriteUint16(otLinkGetPanId(mInstance));
}
otError NcpBase::SetPropertyHandler_MAC_15_4_PANID(void)
{
uint16_t panid;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadUint16(panid));
error = otLinkSetPanId(mInstance, panid);
exit:
return error;
}
otError NcpBase::GetPropertyHandler_MAC_15_4_LADDR(void)
{
return mEncoder.WriteEui64(*otLinkGetExtendedAddress(mInstance));
}
otError NcpBase::SetPropertyHandler_MAC_15_4_LADDR(void)
{
const otExtAddress *extAddress;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadEui64(extAddress));
error = otLinkSetExtendedAddress(mInstance, extAddress);
exit:
return error;
}
otError NcpBase::GetPropertyHandler_MAC_15_4_SADDR(void)
{
return mEncoder.WriteUint16(otLinkGetShortAddress(mInstance));
}
otError NcpBase::GetPropertyHandler_MAC_RAW_STREAM_ENABLED(void)
{
return mEncoder.WriteBool(mIsRawStreamEnabled);
}
otError NcpBase::SetPropertyHandler_MAC_RAW_STREAM_ENABLED(void)
{
bool enabled = false;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadBool(enabled));
#if OPENTHREAD_ENABLE_RAW_LINK_API
if (otLinkRawIsEnabled(mInstance))
{
if (enabled)
{
error = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone);
}
else
{
error = otLinkRawSleep(mInstance);
}
}
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
mIsRawStreamEnabled = enabled;
exit:
return error;
}
otError NcpBase::GetPropertyHandler_UNSOL_UPDATE_FILTER(void)
{
otError error = OT_ERROR_NONE;
uint8_t numEntries;
const ChangedPropsSet::Entry *entry;
entry = mChangedPropsSet.GetSupportedEntries(numEntries);
for (uint8_t index = 0; index < numEntries; index++, entry++)
{
if (mChangedPropsSet.IsEntryFiltered(index))
{
SuccessOrExit(error = mEncoder.WriteUintPacked(entry->mPropKey));
}
}
exit:
return error;
}
otError NcpBase::SetPropertyHandler_UNSOL_UPDATE_FILTER(void)
{
unsigned int propKey;
otError error = OT_ERROR_NONE;
// First clear the current filter.
mChangedPropsSet.ClearFilter();
while (mDecoder.GetRemainingLengthInStruct() > 0)
{
SuccessOrExit(error = mDecoder.ReadUintPacked(propKey));
IgnoreReturnValue(mChangedPropsSet.EnablePropertyFilter(static_cast<spinel_prop_key_t>(propKey), true));
}
exit:
// If we had an error, we may have actually changed
// the state of the filter, So we need to report
// those incomplete changes via an asynchronous
// change event.
if (error != OT_ERROR_NONE)
{
WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_PROP_UNSOL_UPDATE_FILTER);
}
return error;
}
otError NcpBase::InsertPropertyHandler_UNSOL_UPDATE_FILTER(void)
{
otError error = OT_ERROR_NONE;
unsigned int propKey;
SuccessOrExit(error = mDecoder.ReadUintPacked(propKey));
error = mChangedPropsSet.EnablePropertyFilter(static_cast<spinel_prop_key_t>(propKey), true);
exit:
return error;
}
otError NcpBase::RemovePropertyHandler_UNSOL_UPDATE_FILTER(void)
{
otError error = OT_ERROR_NONE;
unsigned int propKey;
SuccessOrExit(error = mDecoder.ReadUintPacked(propKey));
error = mChangedPropsSet.EnablePropertyFilter(static_cast<spinel_prop_key_t>(propKey), false);
exit:
return error;
}
otError NcpBase::GetPropertyHandler_LAST_STATUS(void)
{
return mEncoder.WriteUintPacked(mLastStatus);
}
otError NcpBase::GetPropertyHandler_PROTOCOL_VERSION(void)
{
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROTOCOL_VERSION_THREAD_MAJOR));
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROTOCOL_VERSION_THREAD_MINOR));
exit:
return error;
}
otError NcpBase::GetPropertyHandler_INTERFACE_TYPE(void)
{
return mEncoder.WriteUintPacked(SPINEL_PROTOCOL_TYPE_THREAD);
}
otError NcpBase::GetPropertyHandler_VENDOR_ID(void)
{
return mEncoder.WriteUintPacked(0); // Vendor ID. Zero for unknown.
}
otError NcpBase::GetPropertyHandler_CAPS(void)
{
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_COUNTERS));
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_UNSOL_UPDATE_FILTER));
#if OPENTHREAD_ENABLE_RAW_LINK_API
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_MAC_RAW));
#endif
#if OPENTHREAD_MTD || OPENTHREAD_FTD
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_NET_THREAD_1_0));
#if OPENTHREAD_ENABLE_MAC_FILTER
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_MAC_WHITELIST));
#endif
#if OPENTHREAD_ENABLE_JAM_DETECTION
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_JAM_DETECT));
#endif
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_OOB_STEERING_DATA));
#endif
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_PEEK_POKE));
#endif
// TODO: Somehow get the following capability from the radio.
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_802_15_4_2450MHZ_OQPSK));
#if OPENTHREAD_CONFIG_MAX_CHILDREN > 0
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_ROLE_ROUTER));
#endif
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_ROLE_SLEEPY));
#if OPENTHREAD_ENABLE_LEGACY
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_NEST_LEGACY_INTERFACE));
#endif
#if OPENTHREAD_ENABLE_TMF_PROXY
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_TMF_PROXY));
#endif
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
exit:
return error;
}
otError NcpBase::GetPropertyHandler_NCP_VERSION(void)
{
return mEncoder.WriteUtf8(otGetVersionString());
}
otError NcpBase::GetPropertyHandler_INTERFACE_COUNT(void)
{
return mEncoder.WriteUint8(1); // Only one interface for now
}
otError NcpBase::GetPropertyHandler_POWER_STATE(void)
{
return mEncoder.WriteUint8(SPINEL_POWER_STATE_ONLINE); // Always online at the moment
}
otError NcpBase::SetPropertyHandler_POWER_STATE(void)
{
return OT_ERROR_NOT_IMPLEMENTED;
}
otError NcpBase::GetPropertyHandler_HWADDR(void)
{
otExtAddress hwAddr;
otLinkGetFactoryAssignedIeeeEui64(mInstance, &hwAddr);
return mEncoder.WriteEui64(hwAddr);
}
otError NcpBase::GetPropertyHandler_LOCK(void)
{
// TODO: Implement property lock (Needs API!)
return mEncoder.OverwriteWithLastStatusError(SPINEL_STATUS_UNIMPLEMENTED);
}
otError NcpBase::GetPropertyHandler_HOST_POWER_STATE(void)
{
return mEncoder.WriteUint8(mHostPowerState);
}
// Setting `HOST_POWER_STATE` is treated and implemented differently from other
// handlers as it requires two special behaviors (a) the response frame for the
// set operation should be tracked and only when it is delivered we can assume
// that host is sleep (b) the response is critical so if there is no spinel
// buffer to prepare the response, the current spinel header is saved to
// prepare and send the response as soon as buffer space becomes available.
otError NcpBase::SetPropertyHandler_HOST_POWER_STATE(uint8_t aHeader)
{
uint8_t powerState;
otError error = OT_ERROR_NONE;
error = mDecoder.ReadUint8(powerState);
if (error == OT_ERROR_NONE)
{
switch (powerState)
{
case SPINEL_HOST_POWER_STATE_OFFLINE:
case SPINEL_HOST_POWER_STATE_DEEP_SLEEP:
case SPINEL_HOST_POWER_STATE_LOW_POWER:
case SPINEL_HOST_POWER_STATE_ONLINE:
// Adopt the requested power state.
mHostPowerState = static_cast<spinel_host_power_state_t>(powerState);
break;
case SPINEL_HOST_POWER_STATE_RESERVED:
// Per the specification, treat this as synonymous with SPINEL_HOST_POWER_STATE_DEEP_SLEEP.
mHostPowerState = SPINEL_HOST_POWER_STATE_DEEP_SLEEP;
break;
default:
// Per the specification, treat unrecognized values as synonymous with SPINEL_HOST_POWER_STATE_LOW_POWER.
mHostPowerState = SPINEL_HOST_POWER_STATE_LOW_POWER;
break;
}
mHostPowerStateHeader = 0;
error = WritePropertyValueIsFrame(aHeader, SPINEL_PROP_HOST_POWER_STATE);
if (mHostPowerState != SPINEL_HOST_POWER_STATE_ONLINE)
{
if (error == OT_ERROR_NONE)
{
mHostPowerReplyFrameTag = GetLastOutboundFrameTag();
}
else
{
mHostPowerReplyFrameTag = NcpFrameBuffer::kInvalidTag;
}
mHostPowerStateInProgress = true;
}
if (error != OT_ERROR_NONE)
{
mHostPowerStateHeader = aHeader;
// The reply will be queued when buffer space becomes available
// in the NCP tx buffer so we return `success` to avoid sending a
// NOMEM status for the same tid through `mDroppedReplyTid` list.
error = OT_ERROR_NONE;
}
}
else
{
error = WriteLastStatusFrame(aHeader, ThreadErrorToSpinelStatus(error));
}
return error;
}
otError NcpBase::GetPropertyHandler_UNSOL_UPDATE_LIST(void)
{
otError error = OT_ERROR_NONE;
uint8_t numEntries;
const ChangedPropsSet::Entry *entry;
entry = mChangedPropsSet.GetSupportedEntries(numEntries);
for (uint8_t index = 0; index < numEntries; index++, entry++)
{
if (entry->mFilterable)
{
SuccessOrExit(error = mEncoder.WriteUintPacked(entry->mPropKey));
}
}
exit:
return error;
}
otError NcpBase::GetPropertyHandler_PHY_RX_SENSITIVITY(void)
{
return mEncoder.WriteInt8(otPlatRadioGetReceiveSensitivity(mInstance));
}
otError NcpBase::GetPropertyHandler_PHY_TX_POWER(void)
{
int8_t power;
otError error;
error = otPlatRadioGetTransmitPower(mInstance, &power);
if (error == OT_ERROR_NONE)
{
error = mEncoder.WriteInt8(power);
}
else
{
error = mEncoder.OverwriteWithLastStatusError(ThreadErrorToSpinelStatus(error));
}
return error;
}
otError NcpBase::SetPropertyHandler_PHY_TX_POWER(void)
{
int8_t txPower = 0;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadInt8(txPower));
error = otPlatRadioSetTransmitPower(mInstance, txPower);
exit:
return error;
}
otError NcpBase::GetPropertyHandler_DEBUG_TEST_ASSERT(void)
{
assert(false);
// We only get to this point if `assert(false)`
// does not cause an NCP reset on the platform.
// In such a case we return `false` as the
// property value to indicate this.
OT_UNREACHABLE_CODE(
return mEncoder.WriteBool(false);
)
}
otError NcpBase::GetPropertyHandler_DEBUG_TEST_WATCHDOG(void)
{
while (true)
;
OT_UNREACHABLE_CODE(
return OT_ERROR_NONE;
)
}
otError NcpBase::GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(void)
{
uint8_t logLevel = 0;
switch (otGetDynamicLogLevel(mInstance))
{
case OT_LOG_LEVEL_NONE:
logLevel = SPINEL_NCP_LOG_LEVEL_EMERG;
break;
case OT_LOG_LEVEL_CRIT:
logLevel = SPINEL_NCP_LOG_LEVEL_CRIT;
break;
case OT_LOG_LEVEL_WARN:
logLevel = SPINEL_NCP_LOG_LEVEL_WARN;
break;
case OT_LOG_LEVEL_INFO:
logLevel = SPINEL_NCP_LOG_LEVEL_INFO;
break;
case OT_LOG_LEVEL_DEBG:
logLevel = SPINEL_NCP_LOG_LEVEL_DEBUG;
break;
}
return mEncoder.WriteUint8(logLevel);
}
otError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(void)
{
uint8_t spinelNcpLogLevel = 0;
otLogLevel logLevel;
otError error = OT_ERROR_NONE;
SuccessOrExit(error = mDecoder.ReadUint8(spinelNcpLogLevel));
switch (spinelNcpLogLevel)
{
case SPINEL_NCP_LOG_LEVEL_EMERG:
case SPINEL_NCP_LOG_LEVEL_ALERT:
logLevel = OT_LOG_LEVEL_NONE;
break;
case SPINEL_NCP_LOG_LEVEL_CRIT:
logLevel = OT_LOG_LEVEL_CRIT;
break;
case SPINEL_NCP_LOG_LEVEL_ERR:
case SPINEL_NCP_LOG_LEVEL_WARN:
logLevel = OT_LOG_LEVEL_WARN;
break;
case SPINEL_NCP_LOG_LEVEL_NOTICE:
case SPINEL_NCP_LOG_LEVEL_INFO:
logLevel = OT_LOG_LEVEL_INFO;
break;
case SPINEL_NCP_LOG_LEVEL_DEBUG:
logLevel = OT_LOG_LEVEL_DEBG;
break;
default:
ExitNow(error = OT_ERROR_INVALID_ARGS);
break;
}
error = otSetDynamicLogLevel(mInstance, logLevel);
exit:
return error;
}
} // namespace Ncp
} // namespace ot
// ----------------------------------------------------------------------------
// MARK: Peek/Poke delegate API
// ----------------------------------------------------------------------------
otError otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
{
otError error = OT_ERROR_NONE;
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance();
if (ncp != NULL)
{
ncp->RegisterPeekPokeDelagates(aAllowPeekDelegate, aAllowPokeDelegate);
}
#else
OT_UNUSED_VARIABLE(aAllowPeekDelegate);
OT_UNUSED_VARIABLE(aAllowPokeDelegate);
error = OT_ERROR_DISABLED_FEATURE;
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
return error;
}
// ----------------------------------------------------------------------------
// MARK: Virtual Datastream I/O (Public API)
// ----------------------------------------------------------------------------
otError otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen)
{
otError error = OT_ERROR_INVALID_STATE;
ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance();
if (ncp != NULL)
{
error = ncp->StreamWrite(aStreamId, aDataPtr, aDataLen);
}
return error;
}
extern "C" void otNcpPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs)
{
char logString[128];
int charsWritten;
if ((charsWritten = vsnprintf(logString, sizeof(logString), aFormat, aArgs)) > 0)
{
if (charsWritten > static_cast<int>(sizeof(logString) - 1))
{
charsWritten = static_cast<int>(sizeof(logString) - 1);
}
otNcpStreamWrite(0, reinterpret_cast<uint8_t *>(logString), charsWritten);
}
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
}
| {
"content_hash": "0fc0c5738e94dce18518a81e1855a75c",
"timestamp": "",
"source": "github",
"line_count": 2118,
"max_line_length": 119,
"avg_line_length": 30.924457034938623,
"alnum_prop": 0.669333414760756,
"repo_name": "xiaom-GitHub/openthread",
"id": "865aa62251220239eea2df960d2a71857df9d6cb",
"size": "67151",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ncp/ncp_base.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "10128"
},
{
"name": "C",
"bytes": "572698"
},
{
"name": "C#",
"bytes": "18077"
},
{
"name": "C++",
"bytes": "3486464"
},
{
"name": "M4",
"bytes": "48751"
},
{
"name": "Makefile",
"bytes": "82554"
},
{
"name": "Python",
"bytes": "1060869"
},
{
"name": "Ruby",
"bytes": "3397"
},
{
"name": "Shell",
"bytes": "28070"
}
],
"symlink_target": ""
} |
require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
class Piston::Svn::TestSvnWorkingCopyExistence < Piston::TestCase
def setup
super
@wcdir = Pathname.new(File.expand_path("tmp/wc"))
@wc = Piston::Svn::WorkingCopy.new(@wcdir)
end
def test_exist_false_when_dir_not_present
deny @wc.exist?
end
def test_exist_false_when_dir_present_but_not_an_svn_wc
@wcdir.mkpath
deny @wc.exist?
end
def test_exist_true_when_svn_working_copy_at_path
@wc.expects(:svn).with(:info, @wcdir).returns("Path: b")
assert @wc.exist?
end
end
| {
"content_hash": "df5987644f206848fe52966af5bb9a4b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 74,
"avg_line_length": 25.73913043478261,
"alnum_prop": 0.6672297297297297,
"repo_name": "francois/piston",
"id": "5ed2bf1f985b20798beef92fefe23ca1450003a9",
"size": "592",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/unit/svn/working_copy/test_existence.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "147654"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.nbandroid.netbeans.gradle.core.sdk;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.repository.api.ProgressIndicatorAdapter;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.netbeans.modules.android.spi.AndroidIO;
import org.openide.windows.InputOutput;
/**
* ProgressIndicatorAdapter for Android tools APLI
*
* @author arsi
*/
public class NbOutputWindowProgressIndicator extends ProgressIndicatorAdapter {
private static final InputOutput io = AndroidIO.getDefaultIO();
@Override
public void logWarning(@NonNull String s, @Nullable Throwable e) {
io.getOut().println("Warning: " + s);
if (e != null) {
io.getOut().println(throwableToString(e));
}
}
@Override
public void logError(@NonNull String s, @Nullable Throwable e) {
io.getErr().println("Error: " + s);
if (e != null) {
io.getErr().println(throwableToString(e));
}
}
@Override
public void logInfo(@NonNull String s) {
io.getOut().println("Info: " + s);
}
private static String throwableToString(@NonNull Throwable e) {
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
return writer.toString();
}
}
| {
"content_hash": "ba4354c634a667218983462dc3df0a5c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 29.346153846153847,
"alnum_prop": 0.6841415465268676,
"repo_name": "NBANDROIDTEAM/NBANDROID-V2",
"id": "d06e011546f234977c9992cced553e64770d9d41",
"size": "1526",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "nbandroid.core/src/main/java/org/nbandroid/netbeans/gradle/core/sdk/NbOutputWindowProgressIndicator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "FreeMarker",
"bytes": "747732"
},
{
"name": "GAP",
"bytes": "9978"
},
{
"name": "GLSL",
"bytes": "632"
},
{
"name": "HTML",
"bytes": "51779"
},
{
"name": "Java",
"bytes": "3770028"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>V8 API Reference Guide for node.js v7.9.0: v8_inspector::V8Inspector Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v7.9.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>v8_inspector</b></li><li class="navelem"><a class="el" href="classv8__inspector_1_1V8Inspector.html">V8Inspector</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="classv8__inspector_1_1V8Inspector-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">v8_inspector::V8Inspector Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8__inspector_1_1V8Inspector_1_1Channel.html">Channel</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a2027babae023eb7745a699de30ef2040"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2027babae023eb7745a699de30ef2040"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>contextCreated</b> (const <a class="el" href="classv8__inspector_1_1V8ContextInfo.html">V8ContextInfo</a> &)=0</td></tr>
<tr class="separator:a2027babae023eb7745a699de30ef2040"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a519c21ce7d4693e27c0b2859f3c5901d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a519c21ce7d4693e27c0b2859f3c5901d"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>contextDestroyed</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >)=0</td></tr>
<tr class="separator:a519c21ce7d4693e27c0b2859f3c5901d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab65e4ca3316c60644bfdefc52a769d99"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab65e4ca3316c60644bfdefc52a769d99"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>resetContextGroup</b> (int contextGroupId)=0</td></tr>
<tr class="separator:ab65e4ca3316c60644bfdefc52a769d99"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a16206dc4f7befe9dec6f66aaab66e246"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a16206dc4f7befe9dec6f66aaab66e246"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>willExecuteScript</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >, int scriptId)=0</td></tr>
<tr class="separator:a16206dc4f7befe9dec6f66aaab66e246"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9e8819ef9f9bd231aa0f2f9b94421879"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9e8819ef9f9bd231aa0f2f9b94421879"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>didExecuteScript</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >)=0</td></tr>
<tr class="separator:a9e8819ef9f9bd231aa0f2f9b94421879"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a923d7681b39db723a43b279a7429d9ea"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a923d7681b39db723a43b279a7429d9ea"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>idleStarted</b> ()=0</td></tr>
<tr class="separator:a923d7681b39db723a43b279a7429d9ea"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a679251f1e8f90799c45dde8a86c73a80"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a679251f1e8f90799c45dde8a86c73a80"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>idleFinished</b> ()=0</td></tr>
<tr class="separator:a679251f1e8f90799c45dde8a86c73a80"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab9d050ddc357b771b932af978e52aff3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab9d050ddc357b771b932af978e52aff3"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskScheduled</b> (const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &taskName, void *task, bool recurring)=0</td></tr>
<tr class="separator:ab9d050ddc357b771b932af978e52aff3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad443be8234a20744558250b92451fc9d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad443be8234a20744558250b92451fc9d"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskCanceled</b> (void *task)=0</td></tr>
<tr class="separator:ad443be8234a20744558250b92451fc9d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a18081a671c17b6c8cc9e827e834518fc"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a18081a671c17b6c8cc9e827e834518fc"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskStarted</b> (void *task)=0</td></tr>
<tr class="separator:a18081a671c17b6c8cc9e827e834518fc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa19d6664fb011102014395d54d16ed68"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa19d6664fb011102014395d54d16ed68"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskFinished</b> (void *task)=0</td></tr>
<tr class="separator:aa19d6664fb011102014395d54d16ed68"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2a92520981e6d348ae004c6c72098975"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a92520981e6d348ae004c6c72098975"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>allAsyncTasksCanceled</b> ()=0</td></tr>
<tr class="separator:a2a92520981e6d348ae004c6c72098975"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a71e69c7b3fbb5eb9c0b5272f6aab3a2d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a71e69c7b3fbb5eb9c0b5272f6aab3a2d"></a>
virtual unsigned </td><td class="memItemRight" valign="bottom"><b>exceptionThrown</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &message, <a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Value.html">v8::Value</a> > exception, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &detailedMessage, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8StackTrace.html">V8StackTrace</a> >, int scriptId)=0</td></tr>
<tr class="separator:a71e69c7b3fbb5eb9c0b5272f6aab3a2d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6853e6b53df0a0058b0e7ff2a3cc94ec"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6853e6b53df0a0058b0e7ff2a3cc94ec"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>exceptionRevoked</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >, unsigned exceptionId, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &message)=0</td></tr>
<tr class="separator:a6853e6b53df0a0058b0e7ff2a3cc94ec"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ada36fa35ede4b3fda70b07fc855458e4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ada36fa35ede4b3fda70b07fc855458e4"></a>
virtual std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8InspectorSession.html">V8InspectorSession</a> > </td><td class="memItemRight" valign="bottom"><b>connect</b> (int contextGroupId, <a class="el" href="classv8__inspector_1_1V8Inspector_1_1Channel.html">Channel</a> *, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &state)=0</td></tr>
<tr class="separator:ada36fa35ede4b3fda70b07fc855458e4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4ac935e4871eef8ee5cb2e5ca41a2142"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4ac935e4871eef8ee5cb2e5ca41a2142"></a>
virtual std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8StackTrace.html">V8StackTrace</a> > </td><td class="memItemRight" valign="bottom"><b>createStackTrace</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1StackTrace.html">v8::StackTrace</a> >)=0</td></tr>
<tr class="separator:a4ac935e4871eef8ee5cb2e5ca41a2142"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a22af900e1627ca8ef9382c0507645d70"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a22af900e1627ca8ef9382c0507645d70"></a>
virtual std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8StackTrace.html">V8StackTrace</a> > </td><td class="memItemRight" valign="bottom"><b>captureStackTrace</b> (bool fullStack)=0</td></tr>
<tr class="separator:a22af900e1627ca8ef9382c0507645d70"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ac7b64842334aadde7dabff1ac6d82cff"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7b64842334aadde7dabff1ac6d82cff"></a>
static std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8Inspector.html">V8Inspector</a> > </td><td class="memItemRight" valign="bottom"><b>create</b> (<a class="el" href="classv8_1_1Isolate.html">v8::Isolate</a> *, <a class="el" href="classv8__inspector_1_1V8InspectorClient.html">V8InspectorClient</a> *)</td></tr>
<tr class="separator:ac7b64842334aadde7dabff1ac6d82cff"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>deps/v8/include/<a class="el" href="v8-inspector_8h_source.html">v8-inspector.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
| {
"content_hash": "500d73432b88a694e36497deb99ac965",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 813,
"avg_line_length": 84.05649717514125,
"alnum_prop": 0.7099072455975266,
"repo_name": "v8-dox/v8-dox.github.io",
"id": "b39da936e504beb0f98db9459be27a154feefdb0",
"size": "14878",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "9f73df5/html/classv8__inspector_1_1V8Inspector.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
set -e
set -x
if [[ "$(uname -s)" == 'Darwin' ]]; then
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
pyenv activate conan
fi
nosetests --with-coverage conans.test
| {
"content_hash": "e06ab8ba3a6648d2ee56e6334f139da4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 18,
"alnum_prop": 0.5808080808080808,
"repo_name": "mropert/conan",
"id": "15efea3a88f7fd40d1e92cb9982abf18da217779",
"size": "211",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": ".ci/travis/run.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "653"
},
{
"name": "Python",
"bytes": "1898890"
},
{
"name": "Shell",
"bytes": "1342"
}
],
"symlink_target": ""
} |
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE CPP #-}
#ifdef DEBUG_CONFLICT_SETS
{-# LANGUAGE ImplicitParams #-}
#endif
module Distribution.Solver.Modular.Dependency (
-- * Variables
Var(..)
, simplifyVar
, varPI
, showVar
-- * Conflict sets
, ConflictSet
, CS.showCS
-- * Constrained instances
, CI(..)
, merge
-- * Flagged dependencies
, FlaggedDeps
, FlaggedDep(..)
, Dep(..)
, showDep
, flattenFlaggedDeps
, QualifyOptions(..)
, qualifyDeps
, unqualifyDeps
-- ** Setting/forgetting components
, forgetCompOpenGoal
, setCompFlaggedDeps
-- * Reverse dependency map
, RevDepMap
-- * Goals
, Goal(..)
, GoalReason(..)
, QGoalReason
, ResetVar(..)
, goalToVar
, goalVarToConflictSet
, varToConflictSet
, goalReasonToVars
-- * Open goals
, OpenGoal(..)
, close
) where
import Prelude hiding (pi)
import Data.Map (Map)
import qualified Data.List as L
import Language.Haskell.Extension (Extension(..), Language(..))
import Distribution.Text
import Distribution.Solver.Modular.ConflictSet (ConflictSet)
import Distribution.Solver.Modular.Flag
import Distribution.Solver.Modular.Package
import Distribution.Solver.Modular.Var
import Distribution.Solver.Modular.Version
import qualified Distribution.Solver.Modular.ConflictSet as CS
import Distribution.Solver.Types.ComponentDeps (Component(..))
import Distribution.Solver.Types.PackagePath
#ifdef DEBUG_CONFLICT_SETS
import GHC.Stack (CallStack)
#endif
{-------------------------------------------------------------------------------
Constrained instances
-------------------------------------------------------------------------------}
-- | Constrained instance. If the choice has already been made, this is
-- a fixed instance, and we record the package name for which the choice
-- is for convenience. Otherwise, it is a list of version ranges paired with
-- the goals / variables that introduced them.
data CI qpn = Fixed I (Var qpn) | Constrained [VROrigin qpn]
deriving (Eq, Show, Functor)
showCI :: CI QPN -> String
showCI (Fixed i _) = "==" ++ showI i
showCI (Constrained vr) = showVR (collapse vr)
-- | Merge constrained instances. We currently adopt a lazy strategy for
-- merging, i.e., we only perform actual checking if one of the two choices
-- is fixed. If the merge fails, we return a conflict set indicating the
-- variables responsible for the failure, as well as the two conflicting
-- fragments.
--
-- Note that while there may be more than one conflicting pair of version
-- ranges, we only return the first we find.
--
-- TODO: Different pairs might have different conflict sets. We're
-- obviously interested to return a conflict that has a "better" conflict
-- set in the sense the it contains variables that allow us to backjump
-- further. We might apply some heuristics here, such as to change the
-- order in which we check the constraints.
merge ::
#ifdef DEBUG_CONFLICT_SETS
(?loc :: CallStack) =>
#endif
Ord qpn => CI qpn -> CI qpn -> Either (ConflictSet qpn, (CI qpn, CI qpn)) (CI qpn)
merge c@(Fixed i g1) d@(Fixed j g2)
| i == j = Right c
| otherwise = Left (CS.union (varToConflictSet g1) (varToConflictSet g2), (c, d))
merge c@(Fixed (I v _) g1) (Constrained rs) = go rs -- I tried "reverse rs" here, but it seems to slow things down ...
where
go [] = Right c
go (d@(vr, g2) : vrs)
| checkVR vr v = go vrs
| otherwise = Left (CS.union (varToConflictSet g1) (varToConflictSet g2), (c, Constrained [d]))
merge c@(Constrained _) d@(Fixed _ _) = merge d c
merge (Constrained rs) (Constrained ss) = Right (Constrained (rs ++ ss))
{-------------------------------------------------------------------------------
Flagged dependencies
-------------------------------------------------------------------------------}
-- | Flagged dependencies
--
-- 'FlaggedDeps' is the modular solver's view of a packages dependencies:
-- rather than having the dependencies indexed by component, each dependency
-- defines what component it is in.
--
-- However, top-level goals are also modelled as dependencies, but of course
-- these don't actually belong in any component of any package. Therefore, we
-- parameterize 'FlaggedDeps' and derived datatypes with a type argument that
-- specifies whether or not we have a component: we only ever instantiate this
-- type argument with @()@ for top-level goals, or 'Component' for everything
-- else (we could express this as a kind at the type-level, but that would
-- require a very recent GHC).
--
-- Note however, crucially, that independent of the type parameters, the list
-- of dependencies underneath a flag choice or stanza choices _always_ uses
-- Component as the type argument. This is important: when we pick a value for
-- a flag, we _must_ know what component the new dependencies belong to, or
-- else we don't be able to construct fine-grained reverse dependencies.
type FlaggedDeps comp qpn = [FlaggedDep comp qpn]
-- | Flagged dependencies can either be plain dependency constraints,
-- or flag-dependent dependency trees.
data FlaggedDep comp qpn =
-- | Dependencies which are conditional on a flag choice.
Flagged (FN qpn) FInfo (TrueFlaggedDeps qpn) (FalseFlaggedDeps qpn)
-- | Dependencies which are conditional on whether or not a stanza
-- (e.g., a test suite or benchmark) is enabled.
| Stanza (SN qpn) (TrueFlaggedDeps qpn)
-- | Dependencies for which are always enabled, for the component
-- 'comp' (or requested for the user, if comp is @()@).
| Simple (Dep qpn) comp
deriving (Eq, Show)
-- | Conversatively flatten out flagged dependencies
--
-- NOTE: We do not filter out duplicates.
flattenFlaggedDeps :: FlaggedDeps Component qpn -> [(Dep qpn, Component)]
flattenFlaggedDeps = concatMap aux
where
aux :: FlaggedDep Component qpn -> [(Dep qpn, Component)]
aux (Flagged _ _ t f) = flattenFlaggedDeps t ++ flattenFlaggedDeps f
aux (Stanza _ t) = flattenFlaggedDeps t
aux (Simple d c) = [(d, c)]
type TrueFlaggedDeps qpn = FlaggedDeps Component qpn
type FalseFlaggedDeps qpn = FlaggedDeps Component qpn
-- | Is this dependency on an executable
type IsExe = Bool
-- | A dependency (constraint) associates a package name with a
-- constrained instance.
--
-- 'Dep' intentionally has no 'Functor' instance because the type variable
-- is used both to record the dependencies as well as who's doing the
-- depending; having a 'Functor' instance makes bugs where we don't distinguish
-- these two far too likely. (By rights 'Dep' ought to have two type variables.)
data Dep qpn = Dep IsExe qpn (CI qpn) -- dependency on a package (possibly for executable
| Ext Extension -- dependency on a language extension
| Lang Language -- dependency on a language version
| Pkg PN VR -- dependency on a pkg-config package
deriving (Eq, Show)
showDep :: Dep QPN -> String
showDep (Dep is_exe qpn (Fixed i v) ) =
(if P qpn /= v then showVar v ++ " => " else "") ++
showQPN qpn ++
(if is_exe then " (exe) " else "") ++ "==" ++ showI i
showDep (Dep is_exe qpn (Constrained [(vr, v)])) =
showVar v ++ " => " ++ showQPN qpn ++
(if is_exe then " (exe) " else "") ++ showVR vr
showDep (Dep is_exe qpn ci ) =
showQPN qpn ++ (if is_exe then " (exe) " else "") ++ showCI ci
showDep (Ext ext) = "requires " ++ display ext
showDep (Lang lang) = "requires " ++ display lang
showDep (Pkg pn vr) = "requires pkg-config package "
++ display pn ++ display vr
++ ", not found in the pkg-config database"
-- | Options for goal qualification (used in 'qualifyDeps')
--
-- See also 'defaultQualifyOptions'
data QualifyOptions = QO {
-- | Do we have a version of base relying on another version of base?
qoBaseShim :: Bool
-- Should dependencies of the setup script be treated as independent?
, qoSetupIndependent :: Bool
}
deriving Show
-- | Apply built-in rules for package qualifiers
--
-- Although the behaviour of 'qualifyDeps' depends on the 'QualifyOptions',
-- it is important that these 'QualifyOptions' are _static_. Qualification
-- does NOT depend on flag assignment; in other words, it behaves the same no
-- matter which choices the solver makes (modulo the global 'QualifyOptions');
-- we rely on this in 'linkDeps' (see comment there).
--
-- NOTE: It's the _dependencies_ of a package that may or may not be independent
-- from the package itself. Package flag choices must of course be consistent.
qualifyDeps :: QualifyOptions -> QPN -> FlaggedDeps Component PN -> FlaggedDeps Component QPN
qualifyDeps QO{..} (Q pp@(PackagePath ns q) pn) = go
where
go :: FlaggedDeps Component PN -> FlaggedDeps Component QPN
go = map go1
go1 :: FlaggedDep Component PN -> FlaggedDep Component QPN
go1 (Flagged fn nfo t f) = Flagged (fmap (Q pp) fn) nfo (go t) (go f)
go1 (Stanza sn t) = Stanza (fmap (Q pp) sn) (go t)
go1 (Simple dep comp) = Simple (goD dep comp) comp
-- Suppose package B has a setup dependency on package A.
-- This will be recorded as something like
--
-- > Dep "A" (Constrained [(AnyVersion, Goal (P "B") reason])
--
-- Observe that when we qualify this dependency, we need to turn that
-- @"A"@ into @"B-setup.A"@, but we should not apply that same qualifier
-- to the goal or the goal reason chain.
goD :: Dep PN -> Component -> Dep QPN
goD (Ext ext) _ = Ext ext
goD (Lang lang) _ = Lang lang
goD (Pkg pkn vr) _ = Pkg pkn vr
goD (Dep is_exe dep ci) comp
| is_exe = Dep is_exe (Q (PackagePath ns (Exe pn dep)) dep) (fmap (Q pp) ci)
| qBase dep = Dep is_exe (Q (PackagePath ns (Base pn)) dep) (fmap (Q pp) ci)
| qSetup comp = Dep is_exe (Q (PackagePath ns (Setup pn)) dep) (fmap (Q pp) ci)
| otherwise = Dep is_exe (Q (PackagePath ns inheritedQ) dep) (fmap (Q pp) ci)
-- If P has a setup dependency on Q, and Q has a regular dependency on R, then
-- we say that the 'Setup' qualifier is inherited: P has an (indirect) setup
-- dependency on R. We do not do this for the base qualifier however.
--
-- The inherited qualifier is only used for regular dependencies; for setup
-- and base deppendencies we override the existing qualifier. See #3160 for
-- a detailed discussion.
inheritedQ :: Qualifier
inheritedQ = case q of
Setup _ -> q
Exe _ _ -> q
Unqualified -> q
Base _ -> Unqualified
-- Should we qualify this goal with the 'Base' package path?
qBase :: PN -> Bool
qBase dep = qoBaseShim && unPackageName dep == "base"
-- Should we qualify this goal with the 'Setup' package path?
qSetup :: Component -> Bool
qSetup comp = qoSetupIndependent && comp == ComponentSetup
-- | Remove qualifiers from set of dependencies
--
-- This is used during link validation: when we link package @Q.A@ to @Q'.A@,
-- then all dependencies @Q.B@ need to be linked to @Q'.B@. In order to compute
-- what to link these dependencies to, we need to requalify @Q.B@ to become
-- @Q'.B@; we do this by first removing all qualifiers and then calling
-- 'qualifyDeps' again.
unqualifyDeps :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
unqualifyDeps = go
where
go :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
go = map go1
go1 :: FlaggedDep comp QPN -> FlaggedDep comp PN
go1 (Flagged fn nfo t f) = Flagged (fmap unq fn) nfo (go t) (go f)
go1 (Stanza sn t) = Stanza (fmap unq sn) (go t)
go1 (Simple dep comp) = Simple (goD dep) comp
goD :: Dep QPN -> Dep PN
goD (Dep is_exe qpn ci) = Dep is_exe (unq qpn) (fmap unq ci)
goD (Ext ext) = Ext ext
goD (Lang lang) = Lang lang
goD (Pkg pn vr) = Pkg pn vr
unq :: QPN -> PN
unq (Q _ pn) = pn
{-------------------------------------------------------------------------------
Setting/forgetting the Component
-------------------------------------------------------------------------------}
forgetCompOpenGoal :: OpenGoal Component -> OpenGoal ()
forgetCompOpenGoal = mapCompOpenGoal $ const ()
setCompFlaggedDeps :: Component -> FlaggedDeps () qpn -> FlaggedDeps Component qpn
setCompFlaggedDeps = mapCompFlaggedDeps . const
{-------------------------------------------------------------------------------
Auxiliary: Mapping over the Component goal
We don't export these, because the only type instantiations for 'a' and 'b'
here should be () or Component. (We could express this at the type level
if we relied on newer versions of GHC.)
-------------------------------------------------------------------------------}
mapCompOpenGoal :: (a -> b) -> OpenGoal a -> OpenGoal b
mapCompOpenGoal g (OpenGoal d gr) = OpenGoal (mapCompFlaggedDep g d) gr
mapCompFlaggedDeps :: (a -> b) -> FlaggedDeps a qpn -> FlaggedDeps b qpn
mapCompFlaggedDeps = L.map . mapCompFlaggedDep
mapCompFlaggedDep :: (a -> b) -> FlaggedDep a qpn -> FlaggedDep b qpn
mapCompFlaggedDep _ (Flagged fn nfo t f) = Flagged fn nfo t f
mapCompFlaggedDep _ (Stanza sn t ) = Stanza sn t
mapCompFlaggedDep g (Simple pn a ) = Simple pn (g a)
{-------------------------------------------------------------------------------
Reverse dependency map
-------------------------------------------------------------------------------}
-- | A map containing reverse dependencies between qualified
-- package names.
type RevDepMap = Map QPN [(Component, QPN)]
{-------------------------------------------------------------------------------
Goals
-------------------------------------------------------------------------------}
-- | A goal is just a solver variable paired with a reason.
-- The reason is only used for tracing.
data Goal qpn = Goal (Var qpn) (GoalReason qpn)
deriving (Eq, Show, Functor)
-- | Reason why a goal is being added to a goal set.
data GoalReason qpn =
UserGoal
| PDependency (PI qpn)
| FDependency (FN qpn) Bool
| SDependency (SN qpn)
deriving (Eq, Show, Functor)
type QGoalReason = GoalReason QPN
class ResetVar f where
resetVar :: Var qpn -> f qpn -> f qpn
instance ResetVar CI where
resetVar v (Fixed i _) = Fixed i v
resetVar v (Constrained vrs) = Constrained (L.map (\ (x, y) -> (x, resetVar v y)) vrs)
instance ResetVar Dep where
resetVar v (Dep is_exe qpn ci) = Dep is_exe qpn (resetVar v ci)
resetVar _ (Ext ext) = Ext ext
resetVar _ (Lang lang) = Lang lang
resetVar _ (Pkg pn vr) = Pkg pn vr
instance ResetVar Var where
resetVar = const
goalToVar :: Goal a -> Var a
goalToVar (Goal v _) = v
-- | Compute a singleton conflict set from a goal, containing just
-- the goal variable.
--
-- NOTE: This is just a call to 'varToConflictSet' under the hood;
-- the 'GoalReason' is ignored.
goalVarToConflictSet :: Goal qpn -> ConflictSet qpn
goalVarToConflictSet (Goal g _gr) = varToConflictSet g
-- | Compute a singleton conflict set from a 'Var'
varToConflictSet :: Var qpn -> ConflictSet qpn
varToConflictSet = CS.singleton
-- | A goal reason is mostly just a variable paired with the
-- decision we made for that variable (except for user goals,
-- where we cannot really point to a solver variable). This
-- function drops the decision and recovers the list of
-- variables (which will be empty or contain one element).
--
goalReasonToVars :: GoalReason qpn -> [Var qpn]
goalReasonToVars UserGoal = []
goalReasonToVars (PDependency (PI qpn _)) = [P qpn]
goalReasonToVars (FDependency qfn _) = [F qfn]
goalReasonToVars (SDependency qsn) = [S qsn]
{-------------------------------------------------------------------------------
Open goals
-------------------------------------------------------------------------------}
-- | For open goals as they occur during the build phase, we need to store
-- additional information about flags.
data OpenGoal comp = OpenGoal (FlaggedDep comp QPN) QGoalReason
deriving (Eq, Show)
-- | Closes a goal, i.e., removes all the extraneous information that we
-- need only during the build phase.
close :: OpenGoal comp -> Goal QPN
close (OpenGoal (Simple (Dep _ qpn _) _) gr) = Goal (P qpn) gr
close (OpenGoal (Simple (Ext _) _) _ ) =
error "Distribution.Solver.Modular.Dependency.close: called on Ext goal"
close (OpenGoal (Simple (Lang _) _) _ ) =
error "Distribution.Solver.Modular.Dependency.close: called on Lang goal"
close (OpenGoal (Simple (Pkg _ _) _) _ ) =
error "Distribution.Solver.Modular.Dependency.close: called on Pkg goal"
close (OpenGoal (Flagged qfn _ _ _ ) gr) = Goal (F qfn) gr
close (OpenGoal (Stanza qsn _) gr) = Goal (S qsn) gr
{-------------------------------------------------------------------------------
Version ranges paired with origins
-------------------------------------------------------------------------------}
type VROrigin qpn = (VR, Var qpn)
-- | Helper function to collapse a list of version ranges with origins into
-- a single, simplified, version range.
collapse :: [VROrigin qpn] -> VR
collapse = simplifyVR . L.foldr ((.&&.) . fst) anyVR
| {
"content_hash": "26868a1d72e3122a8be74b6d990f978e",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 120,
"avg_line_length": 40.479069767441864,
"alnum_prop": 0.6253590715845111,
"repo_name": "sopvop/cabal",
"id": "4c2242ec2d1560af4bd2960fe617930bff4a3ef8",
"size": "17406",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cabal-install/Distribution/Solver/Modular/Dependency.hs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "212"
},
{
"name": "Haskell",
"bytes": "3705613"
},
{
"name": "M4",
"bytes": "539"
},
{
"name": "Makefile",
"bytes": "3299"
},
{
"name": "Python",
"bytes": "33785"
},
{
"name": "Shell",
"bytes": "45003"
}
],
"symlink_target": ""
} |
"""
djangogcal.observer
"""
from django.db.models import signals
from gdata.calendar import CalendarEventEntry, SendEventNotifications
from gdata.calendar.service import CalendarService
from gdata.service import RequestError
from models import CalendarEvent
class CalendarObserver(object):
"""
"""
DEFAULT_FEED = '/calendar/feeds/default/private/full'
def __init__(self, feed=DEFAULT_FEED, service=None):
"""
Initialize an instance of the CalendarObserver class.
"""
self.adapters = {}
self.feed = feed
self.service = service
def observe(self, model, adapter):
"""
Establishes a connection between the model and Google Calendar, using
adapter to transform data.
"""
self.adapters[model] = adapter
signals.post_save.connect(self.on_update, sender=model)
signals.post_delete.connect(self.on_delete, sender=model)
def observe_related(self, model, related, selector):
"""
Updates the Google Calendar entry for model when the related model is
changed or deleted. Selector should be a function object which accepts
an instance of related as a parameter and returns an instance of type
model.
"""
def on_related_update(**kwargs):
self.update(model, selector(kwargs['instance']))
signals.post_save.connect(on_related_update, sender=related, weak=False)
signals.post_delete.connect(on_related_update, sender=related,
weak=False)
def on_update(self, **kwargs):
"""
Called by Django's signal mechanism when an observed model is updated.
"""
self.update(kwargs['sender'], kwargs['instance'])
def on_delete(self, **kwargs):
"""
Called by Django's signal mechanism when an observed model is deleted.
"""
self.delete(kwargs['sender'], kwargs['instance'])
def get_service(self, email, password):
"""
Get an authenticated gdata.calendar.service.CalendarService instance.
"""
if self.service is None:
self.service = CalendarService(
email = email,
password = password
)
self.service.ProgrammaticLogin()
return self.service
def get_event(self, service, instance):
"""
Retrieves the specified event from Google Calendar, or returns None
if the retrieval fails.
"""
event_id = CalendarEvent.objects.get_event_id(instance, self.feed)
try:
event = service.GetCalendarEventEntry(event_id)
except Exception:
event = None
return event
def update(self, sender, instance, retry=False):
"""
Update or create an entry in Google Calendar for the given instance
of the sender model type.
"""
adapter = self.adapters[sender]
email, password = adapter.get_username_password(instance)
if adapter.can_save(instance):
service = self.get_service(email, password)
event = self.get_event(service, instance) or CalendarEventEntry()
adapter.get_event_data(instance).populate_event(event)
if adapter.can_notify(instance):
event.send_event_notifications = SendEventNotifications(
value='true')
if event.GetEditLink():
try:
service.UpdateEvent(
event.GetEditLink().href, event)
except RequestError:
if not retry:
self.service = None
self.update(sender, instance, retry=True)
else:
raise
else:
new_event = service.InsertEvent(event, self.feed)
CalendarEvent.objects.set_event_id(instance, self.feed,
new_event.id.text)
def delete(self, sender, instance):
"""
Delete the entry in Google Calendar corresponding to the given instance
of the sender model type.
"""
adapter = self.adapters[sender]
email, password = adapter.get_username_password(instance)
if adapter.can_delete(instance):
service = self.get_service(email, password)
event = self.get_event(service, instance)
if event:
if adapter.can_notify(instance):
event.send_event_notifications = SendEventNotifications(
value='true')
service.DeleteEvent(event.GetEditLink().href)
CalendarEvent.objects.delete_event_id(instance, self.feed)
| {
"content_hash": "d2b14565714b43e854583f810a3d8131",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 80,
"avg_line_length": 37.417910447761194,
"alnum_prop": 0.5660151575588352,
"repo_name": "metzlar/djangogcal",
"id": "cb9d7fcf66d53f44c5024357dd68022e560c8298",
"size": "5014",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "djangogcal/observer.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "10958"
}
],
"symlink_target": ""
} |
Simple Facebook PHP SDK Integration to get user infos.
| {
"content_hash": "4280f27a0c081a3d920971da59839a0d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 54,
"avg_line_length": 55,
"alnum_prop": 0.8181818181818182,
"repo_name": "diogocezar/dctb-phpfb",
"id": "2a1b4e3f79eb4f9ac1a00f128976ac08849af8d5",
"size": "68",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "3424"
},
{
"name": "PHP",
"bytes": "8871"
}
],
"symlink_target": ""
} |
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React, { PropTypes, Component } from 'react';
import styles from './Overlay.css';
import withStyles from '../../decorators/withStyles';
import withViewport from '../../decorators/withViewport';
@withViewport
@withStyles(styles)
class Overlay extends Component {
render() {
return (
<div className="Overlay"></div>
);
}
}
export default Overlay;
| {
"content_hash": "423721d843db631d3861e99d903be236",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 72,
"avg_line_length": 22.4,
"alnum_prop": 0.6875,
"repo_name": "jessamynsmith/MintWebApp",
"id": "287085f19e51da031a3be0ae9cad984b07181b36",
"size": "448",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/Overlay/Overlay.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "136413"
},
{
"name": "HTML",
"bytes": "7176"
},
{
"name": "JavaScript",
"bytes": "159063"
}
],
"symlink_target": ""
} |
kitchensink-backbone: Shows how to use Backbone.js with JAX-RS and Java EE on JBoss
========================
Author: Joshua Wilson
Level: Intermediate
Technologies: Backbone, CDI, JPA, EJB, JPA, JAX-RS, BV
Summary: An example of Backbone.js integrated with jQuery, REST, and a Java back-end running on JBoss.
Target Product: WFK
Source: <https://github.com/jboss-jdf/jboss-as-quickstart/>
What is it?
-----------
This is your project! It is a sample, deployable Maven 3 project to help you get your foot in the door developing with
Backbone.js on Java EE 6 on JBoss Enterprise Application Platform 6 or JBoss AS 7.
This project is setup to allow you to create a compliant Java EE 6 application using CDI 1.0, EJB 3.1, JPA 2.0 and Bean
Validation 1.0. It includes a persistence unit and some sample persistence and transaction code to introduce you to
database access in enterprise Java.
Backbone.js is a MVC for the browser. That is to say, it has a Model (JavaScript/JSON objects that hold data), a View
(HTML/Templates/CSS for display), and a Controller (JavaScript files that take commands from the screen and send them to
the server and then return the results).
All of the code using the Backbone.js library can be found in /src/main/webapp/js/app.js. You will find the Model
(and the Collection of the Model) there and the View where almost all the logic resides.
System requirements
-------------------
All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven 3.0 or better.
The application this project produces is designed to be run on JBoss Enterprise Application Platform 6 or JBoss AS 7.
Configure Maven
---------------
If you have not yet done so, you must [Configure Maven](../README.md#configure-maven) before testing the quickstarts.
Start JBoss Enterprise Application Platform 6 or JBoss AS 7 with the Web Profile
-------------------------
1. Open a command line and navigate to the root of the JBoss server directory.
2. The following shows the command line to start the server with the web profile:
For Linux: JBOSS_HOME/bin/standalone.sh
For Windows: JBOSS_HOME\bin\standalone.bat
Build and Deploy the Quickstart
-------------------------
_NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include
Maven setting arguments on the command line. See [Build and Deploy the Quickstarts](../README.md#build-and-deploy-the-quickstarts) for
complete instructions and additional options._
1. Make sure you have started the JBoss Server as described above.
2. Open a command line and navigate to the root directory of this quickstart.
3. Type this command to build and deploy the archive:
mvn clean package jboss-as:deploy
4. This will deploy `target/jboss-kitchensink-backbone.war` to the running instance of the server.
Access the application
---------------------
The application will be running at the following URL: <http://localhost:8080/jboss-kitchensink-backbone/>.
Undeploy the Archive
--------------------
1. Make sure you have started the JBoss Server as described above.
2. Open a command line and navigate to the root directory of this quickstart.
3. When you are finished testing, type this command to undeploy the archive:
mvn jboss-as:undeploy
Run the Arquillian Tests
-------------------------
This quickstart provides Arquillian tests. By default, these tests are configured to be skipped as Arquillian tests
require the use of a container.
_NOTE: The following commands assume you have configured your Maven user settings. If you have not, you must include
Maven setting arguments on the command line. See [Run the Arquillian Tests](../README.md#run-the-arquillian-tests) for complete
instructions and additional options._
1. Make sure you have started the JBoss Server as described above.
2. Open a command line and navigate to the root directory of this quickstart.
3. Type the following command to run the test goal with the following profile activated:
mvn clean test -Parq-jbossas-remote
Run the Quickstart in JBoss Developer Studio or Eclipse
-------------------------------------
You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see
[Use JBoss Developer Studio or Eclipse to Run the Quickstarts](../README.md#use-jboss-developer-studio-or-eclipse-to-run-the-quickstarts)
Debug the Application
------------------------------------
If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following
commands to pull them into your local repository. The IDE should then detect them.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
| {
"content_hash": "d4a8a717db59fd317f280d461ebc3461",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 137,
"avg_line_length": 42.39823008849557,
"alnum_prop": 0.7353370903777917,
"repo_name": "rafabene/jboss-eap-quickstarts",
"id": "f1f891ea21b0b5e00d9466561c54ffb94d8a4829",
"size": "4791",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kitchensink-backbone/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "7428"
},
{
"name": "CSS",
"bytes": "131010"
},
{
"name": "Java",
"bytes": "1548266"
},
{
"name": "JavaScript",
"bytes": "2475555"
},
{
"name": "Objective-C",
"bytes": "700304"
},
{
"name": "Perl",
"bytes": "890"
},
{
"name": "Ruby",
"bytes": "5266"
},
{
"name": "Shell",
"bytes": "20431"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.