text stringlengths 2 1.04M | meta dict |
|---|---|
namespace Fixtures.Azure.AcceptanceTestsAzureBodyDuration
{
using Microsoft.Rest.Azure;
using Models;
/// <summary>
/// Test Infrastructure for AutoRest
/// </summary>
public partial interface IAutoRestDurationTestService : System.IDisposable
{
/// <summary>
/// The base URI of the service.
/// </summary>
System.Uri BaseUri { get; set; }
/// <summary>
/// Gets or sets json serialization settings.
/// </summary>
Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
/// <summary>
/// Gets or sets json deserialization settings.
/// </summary>
Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
/// <summary>
/// Credentials needed for the client to connect to Azure.
/// </summary>
Microsoft.Rest.ServiceClientCredentials Credentials { get; }
/// <summary>
/// Gets or sets the preferred language for the response.
/// </summary>
string AcceptLanguage { get; set; }
/// <summary>
/// Gets or sets the retry timeout in seconds for Long Running
/// Operations. Default value is 30.
/// </summary>
int? LongRunningOperationRetryTimeout { get; set; }
/// <summary>
/// When set to true a unique x-ms-client-request-id value is
/// generated and included in each request. Default is true.
/// </summary>
bool? GenerateClientRequestId { get; set; }
/// <summary>
/// Gets the IDurationOperations.
/// </summary>
IDurationOperations Duration { get; }
}
}
| {
"content_hash": "bdd080cb23b00e51d85c56ffd7ecc06e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 79,
"avg_line_length": 30.945454545454545,
"alnum_prop": 0.5928319623971798,
"repo_name": "garimakhulbe/autorest",
"id": "4e793d66add9f8d3accb1093b710776333273f9b",
"size": "2015",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/IAutoRestDurationTestService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "12942"
},
{
"name": "C#",
"bytes": "16113562"
},
{
"name": "CSS",
"bytes": "110"
},
{
"name": "Go",
"bytes": "142541"
},
{
"name": "HTML",
"bytes": "274"
},
{
"name": "Java",
"bytes": "6872864"
},
{
"name": "JavaScript",
"bytes": "4761689"
},
{
"name": "PowerShell",
"bytes": "44986"
},
{
"name": "Python",
"bytes": "2302459"
},
{
"name": "Ruby",
"bytes": "302220"
},
{
"name": "Shell",
"bytes": "423"
},
{
"name": "TypeScript",
"bytes": "179578"
}
],
"symlink_target": ""
} |
package com.linkedin.metadata.search.utils;
import com.linkedin.metadata.query.filter.Condition;
import com.linkedin.metadata.query.filter.Criterion;
import com.linkedin.metadata.query.filter.Filter;
import com.linkedin.metadata.query.filter.SortCriterion;
import java.util.Arrays;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.ScoreSortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import static com.linkedin.metadata.search.utils.SearchUtils.*;
@Slf4j
public class ESUtils {
private static final String DEFAULT_SEARCH_RESULTS_SORT_BY_FIELD = "urn";
public static final String KEYWORD_SUFFIX = ".keyword";
/*
* Refer to https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html for list of reserved
* characters in an Elasticsearch regular expression.
*/
private static final String ELASTICSEARCH_REGEXP_RESERVED_CHARACTERS = "?+*|{}[]()#@&<>~";
private ESUtils() {
}
/**
* Constructs the filter query given filter map.
*
* <p>Multiple values can be selected for a filter, and it is currently modeled as string separated by comma
*
* @param filter the search filter
* @return built filter query
*/
@Nonnull
public static BoolQueryBuilder buildFilterQuery(@Nullable Filter filter) {
BoolQueryBuilder orQueryBuilder = new BoolQueryBuilder();
if (filter == null) {
return orQueryBuilder;
}
if (filter.getOr() != null) {
// If caller is using the new Filters API, build boolean query from that.
filter.getOr().forEach(or -> {
final BoolQueryBuilder andQueryBuilder = new BoolQueryBuilder();
or.getAnd().forEach(criterion -> {
if (!criterion.getValue().trim().isEmpty()) {
andQueryBuilder.must(getQueryBuilderFromCriterionForSearch(criterion));
}
});
orQueryBuilder.should(andQueryBuilder);
});
} else if (filter.getCriteria() != null) {
// Otherwise, build boolean query from the deprecated "criteria" field.
log.warn("Received query Filter with a deprecated field 'criteria'. Use 'or' instead.");
final BoolQueryBuilder andQueryBuilder = new BoolQueryBuilder();
filter.getCriteria().forEach(criterion -> {
if (!criterion.getValue().trim().isEmpty()) {
andQueryBuilder.must(getQueryBuilderFromCriterionForSearch(criterion));
}
});
orQueryBuilder.should(andQueryBuilder);
}
return orQueryBuilder;
}
/**
* Builds search query using criterion.
* This method is similar to SearchUtils.getQueryBuilderFromCriterion().
* The only difference is this method use match query instead of term query for EQUAL.
*
* @param criterion {@link Criterion} single criterion which contains field, value and a comparison operator
* @return QueryBuilder
*/
@Nonnull
public static QueryBuilder getQueryBuilderFromCriterionForSearch(@Nonnull Criterion criterion) {
final Condition condition = criterion.getCondition();
if (condition == Condition.EQUAL) {
BoolQueryBuilder filters = new BoolQueryBuilder();
// TODO(https://github.com/linkedin/datahub-gma/issues/51): support multiple values a field can take without using
// delimiters like comma. This is a hack to support equals with URN that has a comma in it.
if (SearchUtils.isUrn(criterion.getValue())) {
filters.should(QueryBuilders.matchQuery(criterion.getField(), criterion.getValue().trim()));
return filters;
}
Arrays.stream(criterion.getValue().trim().split("\\s*,\\s*"))
.forEach(elem -> filters.should(QueryBuilders.matchQuery(criterion.getField(), elem)));
return filters;
} else {
return getQueryBuilderFromCriterion(criterion);
}
}
/**
* Builds search query given a {@link Criterion}, containing field, value and association/condition between the two.
*
* <p>If the condition between a field and value (specified in {@link Criterion}) is EQUAL, we construct a Terms query.
* In this case, a field can take multiple values, specified using comma as a delimiter - this method will split
* tokens accordingly. This is done because currently there is no support of associating two different {@link Criterion}
* in a {@link Filter} with an OR operator - default operator is AND.
*
* <p>This approach of supporting multiple values using comma as delimiter, prevents us from specifying a value that has comma
* as one of it's characters. This is particularly true when one of the values is an urn e.g. "urn:li:example:(1,2,3)".
* Hence we do not split the value (using comma as delimiter) if the value starts with "urn:li:".
* TODO(https://github.com/linkedin/datahub-gma/issues/51): support multiple values a field can take without using
* delimiters like comma.
*
* <p>If the condition between a field and value is not the same as EQUAL, a Range query is constructed. This
* condition does not support multiple values for the same field.
*
* <p>When CONTAIN, START_WITH and END_WITH conditions are used, the underlying logic is using wildcard query which is
* not performant according to ES. For details, please refer to:
* https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html#wildcard-query-field-params
*
* @param criterion {@link Criterion} single criterion which contains field, value and a comparison operator
*/
@Nonnull
public static QueryBuilder getQueryBuilderFromCriterion(@Nonnull Criterion criterion) {
final Condition condition = criterion.getCondition();
if (condition == Condition.EQUAL) {
// TODO(https://github.com/linkedin/datahub-gma/issues/51): support multiple values a field can take without using
// delimiters like comma. This is a hack to support equals with URN that has a comma in it.
if (isUrn(criterion.getValue())) {
return QueryBuilders.termsQuery(criterion.getField(), criterion.getValue().trim());
}
return QueryBuilders.termsQuery(criterion.getField(), criterion.getValue().trim().split("\\s*,\\s*"));
} else if (condition == Condition.GREATER_THAN) {
return QueryBuilders.rangeQuery(criterion.getField()).gt(criterion.getValue().trim());
} else if (condition == Condition.GREATER_THAN_OR_EQUAL_TO) {
return QueryBuilders.rangeQuery(criterion.getField()).gte(criterion.getValue().trim());
} else if (condition == Condition.LESS_THAN) {
return QueryBuilders.rangeQuery(criterion.getField()).lt(criterion.getValue().trim());
} else if (condition == Condition.LESS_THAN_OR_EQUAL_TO) {
return QueryBuilders.rangeQuery(criterion.getField()).lte(criterion.getValue().trim());
} else if (condition == Condition.CONTAIN) {
return QueryBuilders.wildcardQuery(criterion.getField(),
"*" + ESUtils.escapeReservedCharacters(criterion.getValue().trim()) + "*");
} else if (condition == Condition.START_WITH) {
return QueryBuilders.wildcardQuery(criterion.getField(),
ESUtils.escapeReservedCharacters(criterion.getValue().trim()) + "*");
} else if (condition == Condition.END_WITH) {
return QueryBuilders.wildcardQuery(criterion.getField(),
"*" + ESUtils.escapeReservedCharacters(criterion.getValue().trim()));
}
throw new UnsupportedOperationException("Unsupported condition: " + condition);
}
/**
* Populates source field of search query with the sort order as per the criterion provided.
*
* <p>
* If no sort criterion is provided then the default sorting criterion is chosen which is descending order of score
* Furthermore to resolve conflicts, the results are further sorted by ascending order of urn
* If the input sort criterion is urn itself, then no additional sort criterion is applied as there will be no conflicts.
* </p>
*
* @param searchSourceBuilder {@link SearchSourceBuilder} that needs to be populated with sort order
* @param sortCriterion {@link SortCriterion} to be applied to the search results
*/
public static void buildSortOrder(@Nonnull SearchSourceBuilder searchSourceBuilder,
@Nullable SortCriterion sortCriterion) {
if (sortCriterion == null) {
searchSourceBuilder.sort(new ScoreSortBuilder().order(SortOrder.DESC));
} else {
final SortOrder esSortOrder =
(sortCriterion.getOrder() == com.linkedin.metadata.query.filter.SortOrder.ASCENDING) ? SortOrder.ASC
: SortOrder.DESC;
searchSourceBuilder.sort(new FieldSortBuilder(sortCriterion.getField()).order(esSortOrder));
}
if (sortCriterion == null || !sortCriterion.getField().equals(DEFAULT_SEARCH_RESULTS_SORT_BY_FIELD)) {
searchSourceBuilder.sort(new FieldSortBuilder(DEFAULT_SEARCH_RESULTS_SORT_BY_FIELD).order(SortOrder.ASC));
}
}
/**
* Escapes the Elasticsearch reserved characters in the given input string.
*
* @param input input string
* @return input string in which reserved characters are escaped
*/
@Nonnull
public static String escapeReservedCharacters(@Nonnull String input) {
for (char reservedChar : ELASTICSEARCH_REGEXP_RESERVED_CHARACTERS.toCharArray()) {
input = input.replace(String.valueOf(reservedChar), "\\" + reservedChar);
}
return input;
}
} | {
"content_hash": "89d5f5e8e1825d2c832765453238a6e6",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 128,
"avg_line_length": 48.19402985074627,
"alnum_prop": 0.719004851863322,
"repo_name": "linkedin/WhereHows",
"id": "1189aba254a591a16914e97518cce1b94abb077f",
"size": "9687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "110129"
},
{
"name": "Dockerfile",
"bytes": "2521"
},
{
"name": "HTML",
"bytes": "131513"
},
{
"name": "Java",
"bytes": "1307442"
},
{
"name": "JavaScript",
"bytes": "148450"
},
{
"name": "Nearley",
"bytes": "2837"
},
{
"name": "Python",
"bytes": "1419332"
},
{
"name": "Shell",
"bytes": "2564"
},
{
"name": "TSQL",
"bytes": "42644"
},
{
"name": "TypeScript",
"bytes": "641014"
}
],
"symlink_target": ""
} |
var Canvas2Image = (function() {
// check if we have canvas support
var bHasCanvas = false;
var oCanvas = document.createElement("canvas");
if (oCanvas.getContext("2d")) {
bHasCanvas = true;
}
// no canvas, bail out.
if (!bHasCanvas) {
return {
saveAsBMP : function(){},
saveAsPNG : function(){},
saveAsJPEG : function(){}
}
}
var bHasImageData = !!(oCanvas.getContext("2d").getImageData);
var bHasDataURL = !!(oCanvas.toDataURL);
var bHasBase64 = !!(window.btoa);
var strDownloadMime = "image/octet-stream";
// ok, we're good
var readCanvasData = function(oCanvas) {
var iWidth = parseInt(oCanvas.width);
var iHeight = parseInt(oCanvas.height);
return oCanvas.getContext("2d").getImageData(0,0,iWidth,iHeight);
}
// base64 encodes either a string or an array of charcodes
var encodeData = function(data) {
var strData = "";
if (typeof data == "string") {
strData = data;
} else {
var aData = data;
for (var i=0;i<aData.length;i++) {
strData += String.fromCharCode(aData[i]);
}
}
return btoa(strData);
}
// creates a base64 encoded string containing BMP data
// takes an imagedata object as argument
var createBMP = function(oData) {
var aHeader = [];
var iWidth = oData.width;
var iHeight = oData.height;
aHeader.push(0x42); // magic 1
aHeader.push(0x4D);
var iFileSize = iWidth*iHeight*3 + 54; // total header size = 54 bytes
aHeader.push(iFileSize % 256); iFileSize = Math.floor(iFileSize / 256);
aHeader.push(iFileSize % 256); iFileSize = Math.floor(iFileSize / 256);
aHeader.push(iFileSize % 256); iFileSize = Math.floor(iFileSize / 256);
aHeader.push(iFileSize % 256);
aHeader.push(0); // reserved
aHeader.push(0);
aHeader.push(0); // reserved
aHeader.push(0);
aHeader.push(54); // dataoffset
aHeader.push(0);
aHeader.push(0);
aHeader.push(0);
var aInfoHeader = [];
aInfoHeader.push(40); // info header size
aInfoHeader.push(0);
aInfoHeader.push(0);
aInfoHeader.push(0);
var iImageWidth = iWidth;
aInfoHeader.push(iImageWidth % 256); iImageWidth = Math.floor(iImageWidth / 256);
aInfoHeader.push(iImageWidth % 256); iImageWidth = Math.floor(iImageWidth / 256);
aInfoHeader.push(iImageWidth % 256); iImageWidth = Math.floor(iImageWidth / 256);
aInfoHeader.push(iImageWidth % 256);
var iImageHeight = iHeight;
aInfoHeader.push(iImageHeight % 256); iImageHeight = Math.floor(iImageHeight / 256);
aInfoHeader.push(iImageHeight % 256); iImageHeight = Math.floor(iImageHeight / 256);
aInfoHeader.push(iImageHeight % 256); iImageHeight = Math.floor(iImageHeight / 256);
aInfoHeader.push(iImageHeight % 256);
aInfoHeader.push(1); // num of planes
aInfoHeader.push(0);
aInfoHeader.push(24); // num of bits per pixel
aInfoHeader.push(0);
aInfoHeader.push(0); // compression = none
aInfoHeader.push(0);
aInfoHeader.push(0);
aInfoHeader.push(0);
var iDataSize = iWidth*iHeight*3;
aInfoHeader.push(iDataSize % 256); iDataSize = Math.floor(iDataSize / 256);
aInfoHeader.push(iDataSize % 256); iDataSize = Math.floor(iDataSize / 256);
aInfoHeader.push(iDataSize % 256); iDataSize = Math.floor(iDataSize / 256);
aInfoHeader.push(iDataSize % 256);
for (var i=0;i<16;i++) {
aInfoHeader.push(0); // these bytes not used
}
var iPadding = (4 - ((iWidth * 3) % 4)) % 4;
var aImgData = oData.data;
var strPixelData = "";
var y = iHeight;
do {
var iOffsetY = iWidth*(y-1)*4;
var strPixelRow = "";
for (var x=0;x<iWidth;x++) {
var iOffsetX = 4*x;
strPixelRow += String.fromCharCode(aImgData[iOffsetY+iOffsetX+2]);
strPixelRow += String.fromCharCode(aImgData[iOffsetY+iOffsetX+1]);
strPixelRow += String.fromCharCode(aImgData[iOffsetY+iOffsetX]);
}
for (var c=0;c<iPadding;c++) {
strPixelRow += String.fromCharCode(0);
}
strPixelData += strPixelRow;
} while (--y);
var strEncoded = encodeData(aHeader.concat(aInfoHeader)) + encodeData(strPixelData);
return strEncoded;
}
// sends the generated file to the client
var saveFile = function(strData) {
document.location.href = strData;
}
var makeDataURI = function(strData, strMime) {
return "data:" + strMime + ";base64," + strData;
}
// generates a <img> object containing the imagedata
var makeImageObject = function(strSource) {
var oImgElement = document.createElement("img");
oImgElement.src = strSource;
return oImgElement;
}
var scaleCanvas = function(oCanvas, iWidth, iHeight) {
if (iWidth && iHeight) {
var oSaveCanvas = document.createElement("canvas");
oSaveCanvas.width = iWidth;
oSaveCanvas.height = iHeight;
oSaveCanvas.style.width = iWidth+"px";
oSaveCanvas.style.height = iHeight+"px";
var oSaveCtx = oSaveCanvas.getContext("2d");
oSaveCtx.drawImage(oCanvas, 0, 0, oCanvas.width, oCanvas.height, 0, 0, iWidth, iHeight);
return oSaveCanvas;
}
return oCanvas;
}
return {
saveAsPNG : function(oCanvas, bReturnImg, iWidth, iHeight) {
if (!bHasDataURL) {
return false;
}
var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight);
var strData = oScaledCanvas.toDataURL("image/png");
if (bReturnImg) {
return makeImageObject(strData);
} else {
saveFile(strData.replace("image/png", strDownloadMime));
}
return true;
},
saveAsJPEG : function(oCanvas, bReturnImg, iWidth, iHeight) {
if (!bHasDataURL) {
return false;
}
var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight);
var strMime = "image/jpeg";
var strData = oScaledCanvas.toDataURL(strMime);
// check if browser actually supports jpeg by looking for the mime type in the data uri.
// if not, return false
if (strData.indexOf(strMime) != 5) {
return false;
}
if (bReturnImg) {
return makeImageObject(strData);
} else {
saveFile(strData.replace(strMime, strDownloadMime));
}
return true;
},
saveAsBMP : function(oCanvas, bReturnImg, iWidth, iHeight) {
if (!(bHasImageData && bHasBase64)) {
return false;
}
var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight);
var oData = readCanvasData(oScaledCanvas);
var strImgData = createBMP(oData);
if (bReturnImg) {
return makeImageObject(makeDataURI(strImgData, "image/bmp"));
} else {
saveFile(makeDataURI(strImgData, strDownloadMime));
}
return true;
}
};
})(); | {
"content_hash": "54640363069e8b5185cf7aeedf8e8488",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 100,
"avg_line_length": 33.48471615720524,
"alnum_prop": 0.5653364632237872,
"repo_name": "quytx/chipot",
"id": "84d3829a2cede9b4aa94987ce8d4c2e6b9d2ca1c",
"size": "7668",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/assets/javascripts/canvas2img.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "316302"
},
{
"name": "JavaScript",
"bytes": "148791"
},
{
"name": "Ruby",
"bytes": "38993"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_232) on Tue Sep 15 08:52:56 UTC 2020 -->
<title>org.springframework.test.web.client.match (Spring Framework 5.1.18.RELEASE API)</title>
<meta name="date" content="2020-09-15">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../../../../../org/springframework/test/web/client/match/package-summary.html" target="classFrame">org.springframework.test.web.client.match</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="ContentRequestMatchers.html" title="class in org.springframework.test.web.client.match" target="classFrame">ContentRequestMatchers</a></li>
<li><a href="JsonPathRequestMatchers.html" title="class in org.springframework.test.web.client.match" target="classFrame">JsonPathRequestMatchers</a></li>
<li><a href="MockRestRequestMatchers.html" title="class in org.springframework.test.web.client.match" target="classFrame">MockRestRequestMatchers</a></li>
<li><a href="XpathRequestMatchers.html" title="class in org.springframework.test.web.client.match" target="classFrame">XpathRequestMatchers</a></li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "ecec15df8f74a1b6635085d12e5b6118",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 177,
"avg_line_length": 62.56521739130435,
"alnum_prop": 0.715079916608756,
"repo_name": "akhr/java",
"id": "99ddb71983edd2af3d6bc3c4dcaa01a26c352aaa",
"size": "1439",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Spring/jars/spring-framework-5.1.18.RELEASE/docs/javadoc-api/org/springframework/test/web/client/match/package-frame.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "93017"
},
{
"name": "HTML",
"bytes": "203648040"
},
{
"name": "Java",
"bytes": "1237949"
},
{
"name": "JavaScript",
"bytes": "827"
},
{
"name": "Shell",
"bytes": "59"
}
],
"symlink_target": ""
} |
package org.forwoods.docuwiki.documentationWiki.api;
import java.util.ArrayList;
import java.util.List;
import org.forwoods.docuwiki.documentable.ClassRepresentation.FieldRepresentation;
import org.forwoods.docuwiki.documentable.ClassRepresentation.MethodRepresentation;
import org.forwoods.docuwiki.documentable.ClassRepresentation.PropertyRepresentation;
import org.forwoods.docuwiki.documentable.Documentable;
import org.forwoods.docuwiki.documentable.EnumRepresentation.EnumConstant;
public class SquadClass extends Documentable{
String name;
String fileName;
List<EnumConstant> enums = new ArrayList<>();
List<SquadClass> nested = new ArrayList<>();
private List<FieldRepresentation> fields = new ArrayList<>();
private List<MethodRepresentation> methods = new ArrayList<>();
private List<PropertyRepresentation> properties = new ArrayList<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public List<EnumConstant> getEnums() {
return enums;
}
public void setEnums(List<EnumConstant> enums) {
this.enums = enums;
}
public List<FieldRepresentation> getFields() {
return fields;
}
public List<MethodRepresentation> getMethods() {
return methods;
}
public List<PropertyRepresentation> getProperties() {
return properties;
}
public List<SquadClass> getNested() {
return nested;
}
}
| {
"content_hash": "f5c6694d817ca04e5ae1ce5285ed79bc",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 85,
"avg_line_length": 23.765625,
"alnum_prop": 0.7712031558185405,
"repo_name": "tomforwood/documentationWiki",
"id": "9eff064b9831622708eecc4a6eb072ba8e573d16",
"size": "1521",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docuwiki/documentationWiki/src/main/java/org/forwoods/docuwiki/documentationWiki/api/SquadClass.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "4674"
},
{
"name": "C#",
"bytes": "97002"
},
{
"name": "CSS",
"bytes": "1842"
},
{
"name": "HTML",
"bytes": "18000"
},
{
"name": "Java",
"bytes": "181475"
},
{
"name": "JavaScript",
"bytes": "26272"
},
{
"name": "Shell",
"bytes": "488"
}
],
"symlink_target": ""
} |
/**
* @fileOverview
*/
/**#@+
@type String
@example
*/
/**
* Constains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang['pt-br'] =
{
/**
* The language reading direction. Possible values are "rtl" for
* Right-To-Left languages (like Arabic) and "ltr" for Left-To-Right
* languages (like English).
* @default 'ltr'
*/
dir : 'ltr',
/*
* Screenreader titles. Please note that screenreaders are not always capable
* of reading non-English words. So be careful while translating it.
*/
editorTitle : 'Editor de Texto, %1, pressione ALT 0 para obter ajuda.',
// ARIA descriptions.
toolbars : 'Editor toolbars', // MISSING
editor : 'Editor de Texto',
// Toolbar buttons without dialogs.
source : 'Código-Fonte',
newPage : 'Novo',
save : 'Salvar',
preview : 'Visualizar',
cut : 'Recortar',
copy : 'Copiar',
paste : 'Colar',
print : 'Imprimir',
underline : 'Sublinhado',
bold : 'Negrito',
italic : 'Itálico',
selectAll : 'Selecionar Tudo',
removeFormat : 'Remover Formatação',
strike : 'Tachado',
subscript : 'Subscrito',
superscript : 'Sobrescrito',
horizontalrule : 'Inserir Linha Horizontal',
pagebreak : 'Inserir Quebra de Página',
pagebreakAlt : 'Page Break', // MISSING
unlink : 'Remover Link',
undo : 'Desfazer',
redo : 'Refazer',
// Common messages and labels.
common :
{
browseServer : 'Localizar no Servidor',
url : 'URL',
protocol : 'Protocolo',
upload : 'Enviar ao Servidor',
uploadSubmit : 'Enviar para o Servidor',
image : 'Imagem',
flash : 'Flash',
form : 'Formulário',
checkbox : 'Caixa de Seleção',
radio : 'Botão de Opção',
textField : 'Caixa de Texto',
textarea : 'Área de Texto',
hiddenField : 'Campo Oculto',
button : 'Botão',
select : 'Caixa de Listagem',
imageButton : 'Botão de Imagem',
notSet : '<não ajustado>',
id : 'Id',
name : 'Nome',
langDir : 'Direção do idioma',
langDirLtr : 'Esquerda para Direita (LTR)',
langDirRtl : 'Direita para Esquerda (RTL)',
langCode : 'Idioma',
longDescr : 'Descrição da URL',
cssClass : 'Classe de CSS',
advisoryTitle : 'Título',
cssStyle : 'Estilos',
ok : 'OK',
cancel : 'Cancelar',
close : 'Fechar',
preview : 'Visualizar',
generalTab : 'Geral',
advancedTab : 'Avançado',
validateNumberFailed : 'Este valor não é um número.',
confirmNewPage : 'Todas as mudanças não salvas serão perdidas. Tem certeza de que quer abrir uma nova página?',
confirmCancel : 'Algumas opções foram alteradas. Tem certeza de que quer fechar a caixa de diálogo?',
options : 'Opções',
target : 'Destino',
targetNew : 'Nova Janela (_blank)',
targetTop : 'Janela de Cima (_top)',
targetSelf : 'Mesma Janela (_self)',
targetParent : 'Janela Pai (_parent)',
langDirLTR : 'Left to Right (LTR)', // MISSING
langDirRTL : 'Right to Left (RTL)', // MISSING
styles : 'Style', // MISSING
cssClasses : 'Stylesheet Classes', // MISSING
width : 'Largura',
height : 'Altura',
align : 'Alinhamento',
alignLeft : 'Esquerda',
alignRight : 'Direita',
alignCenter : 'Centralizado',
alignTop : 'Superior',
alignMiddle : 'Centralizado',
alignBottom : 'Inferior',
invalidHeight : 'A altura tem que ser um número',
invalidWidth : 'A largura tem que ser um número.',
invalidCssLength : 'Value specified for the "%1" field must be a positive number with or without a valid CSS measurement unit (px, %, in, cm, mm, em, ex, pt, or pc).', // MISSING
invalidHtmlLength : 'Value specified for the "%1" field must be a positive number with or without a valid HTML measurement unit (px or %).', // MISSING
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, indisponível</span>'
},
contextmenu :
{
options : 'Opções Menu de Contexto'
},
// Special char dialog.
specialChar :
{
toolbar : 'Inserir Caractere Especial',
title : 'Selecione um Caractere Especial',
options : 'Opções de Caractere Especial'
},
// Link dialog.
link :
{
toolbar : 'Inserir/Editar Link',
other : '<outro>',
menu : 'Editar Link',
title : 'Editar Link',
info : 'Informações',
target : 'Destino',
upload : 'Enviar ao Servidor',
advanced : 'Avançado',
type : 'Tipo de hiperlink',
toUrl : 'URL',
toAnchor : 'Âncora nesta página',
toEmail : 'E-Mail',
targetFrame : '<frame>',
targetPopup : '<janela popup>',
targetFrameName : 'Nome do Frame de Destino',
targetPopupName : 'Nome da Janela Pop-up',
popupFeatures : 'Propriedades da Janela Pop-up',
popupResizable : 'Redimensionável',
popupStatusBar : 'Barra de Status',
popupLocationBar: 'Barra de Endereços',
popupToolbar : 'Barra de Ferramentas',
popupMenuBar : 'Barra de Menus',
popupFullScreen : 'Modo Tela Cheia (IE)',
popupScrollBars : 'Barras de Rolagem',
popupDependent : 'Dependente (Netscape)',
popupLeft : 'Esquerda',
popupTop : 'Topo',
id : 'Id',
langDir : 'Direção do idioma',
langDirLTR : 'Esquerda para Direita (LTR)',
langDirRTL : 'Direita para Esquerda (RTL)',
acccessKey : 'Chave de Acesso',
name : 'Nome',
langCode : 'Direção do idioma',
tabIndex : 'Índice de Tabulação',
advisoryTitle : 'Título',
advisoryContentType : 'Tipo de Conteúdo',
cssClasses : 'Classe de CSS',
charset : 'Charset do Link',
styles : 'Estilos',
rel : 'Relationship', // MISSING
selectAnchor : 'Selecione uma âncora',
anchorName : 'Nome da âncora',
anchorId : 'Id da âncora',
emailAddress : 'Endereço E-Mail',
emailSubject : 'Assunto da Mensagem',
emailBody : 'Corpo da Mensagem',
noAnchors : '(Não há âncoras no documento)',
noUrl : 'Por favor, digite o endereço do Link',
noEmail : 'Por favor, digite o endereço de e-mail'
},
// Anchor dialog
anchor :
{
toolbar : 'Inserir/Editar Âncora',
menu : 'Formatar Âncora',
title : 'Formatar Âncora',
name : 'Nome da Âncora',
errorName : 'Por favor, digite o nome da âncora',
remove : 'Remove Anchor' // MISSING
},
// List style dialog
list:
{
numberedTitle : 'Propriedades da Lista Numerada',
bulletedTitle : 'Propriedades da Lista sem Numeros',
type : 'Tipo',
start : 'Início',
validateStartNumber :'List start number must be a whole number.', // MISSING
circle : 'Círculo',
disc : 'Disco',
square : 'Quadrado',
none : 'Nenhum',
notset : '<não definido>',
armenian : 'Numeração Armêna',
georgian : 'Numeração da Geórgia (an, ban, gan, etc.)',
lowerRoman : 'Numeração Romana minúscula (i, ii, iii, iv, v, etc.)',
upperRoman : 'Numeração Romana maiúscula (I, II, III, IV, V, etc.)',
lowerAlpha : 'Numeração Alfabética minúscula (a, b, c, d, e, etc.)',
upperAlpha : 'Numeração Alfabética Maiúscula (A, B, C, D, E, etc.)',
lowerGreek : 'Numeração Grega minúscula (alpha, beta, gamma, etc.)',
decimal : 'Numeração Decimal (1, 2, 3, etc.)',
decimalLeadingZero : 'Numeração Decimal com zeros (01, 02, 03, etc.)'
},
// Find And Replace Dialog
findAndReplace :
{
title : 'Localizar e Substituir',
find : 'Localizar',
replace : 'Substituir',
findWhat : 'Procurar por:',
replaceWith : 'Substituir por:',
notFoundMsg : 'O texto especificado não foi encontrado.',
matchCase : 'Coincidir Maiúsculas/Minúsculas',
matchWord : 'Coincidir a palavra inteira',
matchCyclic : 'Coincidir cíclico',
replaceAll : 'Substituir Tudo',
replaceSuccessMsg : '%1 ocorrência(s) substituída(s).'
},
// Table Dialog
table :
{
toolbar : 'Tabela',
title : 'Formatar Tabela',
menu : 'Formatar Tabela',
deleteTable : 'Apagar Tabela',
rows : 'Linhas',
columns : 'Colunas',
border : 'Borda',
widthPx : 'pixels',
widthPc : '%',
widthUnit : 'unidade largura',
cellSpace : 'Espaçamento',
cellPad : 'Margem interna',
caption : 'Legenda',
summary : 'Resumo',
headers : 'Cabeçalho',
headersNone : 'Nenhum',
headersColumn : 'Primeira coluna',
headersRow : 'Primeira linha',
headersBoth : 'Ambos',
invalidRows : 'O número de linhas tem que ser um número maior que 0.',
invalidCols : 'O número de colunas tem que ser um número maior que 0.',
invalidBorder : 'O tamanho da borda tem que ser um número.',
invalidWidth : 'A largura da tabela tem que ser um número.',
invalidHeight : 'A altura da tabela tem que ser um número.',
invalidCellSpacing : 'O espaçamento das células tem que ser um número.',
invalidCellPadding : 'A margem interna das células tem que ser um número.',
cell :
{
menu : 'Célula',
insertBefore : 'Inserir célula a esquerda',
insertAfter : 'Inserir célula a direita',
deleteCell : 'Remover Células',
merge : 'Mesclar Células',
mergeRight : 'Mesclar com célula a direita',
mergeDown : 'Mesclar com célula abaixo',
splitHorizontal : 'Dividir célula horizontalmente',
splitVertical : 'Dividir célula verticalmente',
title : 'Propriedades da célula',
cellType : 'Tipo de célula',
rowSpan : 'Linhas cobertas',
colSpan : 'Colunas cobertas',
wordWrap : 'Quebra de palavra',
hAlign : 'Alinhamento horizontal',
vAlign : 'Alinhamento vertical',
alignBaseline : 'Patamar de alinhamento',
bgColor : 'Cor de fundo',
borderColor : 'Cor das bordas',
data : 'Dados',
header : 'Cabeçalho',
yes : 'Sim',
no : 'Não',
invalidWidth : 'A largura da célula tem que ser um número.',
invalidHeight : 'A altura da célula tem que ser um número.',
invalidRowSpan : 'Linhas cobertas tem que ser um número inteiro.',
invalidColSpan : 'Colunas cobertas tem que ser um número inteiro.',
chooseColor : 'Escolher'
},
row :
{
menu : 'Linha',
insertBefore : 'Inserir linha acima',
insertAfter : 'Inserir linha abaixo',
deleteRow : 'Remover Linhas'
},
column :
{
menu : 'Coluna',
insertBefore : 'Inserir coluna a esquerda',
insertAfter : 'Inserir coluna a direita',
deleteColumn : 'Remover Colunas'
}
},
// Button Dialog.
button :
{
title : 'Formatar Botão',
text : 'Texto (Valor)',
type : 'Tipo',
typeBtn : 'Botão',
typeSbm : 'Enviar',
typeRst : 'Limpar'
},
// Checkbox and Radio Button Dialogs.
checkboxAndRadio :
{
checkboxTitle : 'Formatar Caixa de Seleção',
radioTitle : 'Formatar Botão de Opção',
value : 'Valor',
selected : 'Selecionado'
},
// Form Dialog.
form :
{
title : 'Formatar Formulário',
menu : 'Formatar Formulário',
action : 'Ação',
method : 'Método',
encoding : 'Codificação'
},
// Select Field Dialog.
select :
{
title : 'Formatar Caixa de Listagem',
selectInfo : 'Informações',
opAvail : 'Opções disponíveis',
value : 'Valor',
size : 'Tamanho',
lines : 'linhas',
chkMulti : 'Permitir múltiplas seleções',
opText : 'Texto',
opValue : 'Valor',
btnAdd : 'Adicionar',
btnModify : 'Modificar',
btnUp : 'Para cima',
btnDown : 'Para baixo',
btnSetValue : 'Definir como selecionado',
btnDelete : 'Remover'
},
// Textarea Dialog.
textarea :
{
title : 'Formatar Área de Texto',
cols : 'Colunas',
rows : 'Linhas'
},
// Text Field Dialog.
textfield :
{
title : 'Formatar Caixa de Texto',
name : 'Nome',
value : 'Valor',
charWidth : 'Comprimento (em caracteres)',
maxChars : 'Número Máximo de Caracteres',
type : 'Tipo',
typeText : 'Texto',
typePass : 'Senha'
},
// Hidden Field Dialog.
hidden :
{
title : 'Formatar Campo Oculto',
name : 'Nome',
value : 'Valor'
},
// Image Dialog.
image :
{
title : 'Formatar Imagem',
titleButton : 'Formatar Botão de Imagem',
menu : 'Formatar Imagem',
infoTab : 'Informações da Imagem',
btnUpload : 'Enviar para o Servidor',
upload : 'Enviar',
alt : 'Texto Alternativo',
lockRatio : 'Travar Proporções',
resetSize : 'Redefinir para o Tamanho Original',
border : 'Borda',
hSpace : 'HSpace',
vSpace : 'VSpace',
alertUrl : 'Por favor, digite a URL da imagem.',
linkTab : 'Link',
button2Img : 'Deseja transformar o botão de imagem em uma imagem comum?',
img2Button : 'Deseja transformar a imagem em um botão de imagem?',
urlMissing : 'URL da imagem está faltando.',
validateBorder : 'A borda deve ser um número inteiro.',
validateHSpace : 'O HSpace deve ser um número inteiro.',
validateVSpace : 'O VSpace deve ser um número inteiro.'
},
// Flash Dialog
flash :
{
properties : 'Propriedades do Flash',
propertiesTab : 'Propriedades',
title : 'Propriedades do Flash',
chkPlay : 'Tocar Automaticamente',
chkLoop : 'Tocar Infinitamente',
chkMenu : 'Habilita Menu Flash',
chkFull : 'Permitir tela cheia',
scale : 'Escala',
scaleAll : 'Mostrar tudo',
scaleNoBorder : 'Sem Borda',
scaleFit : 'Escala Exata',
access : 'Acesso ao script',
accessAlways : 'Sempre',
accessSameDomain: 'Acessar Mesmo Domínio',
accessNever : 'Nunca',
alignAbsBottom : 'Inferior Absoluto',
alignAbsMiddle : 'Centralizado Absoluto',
alignBaseline : 'Baseline',
alignTextTop : 'Superior Absoluto',
quality : 'Qualidade',
qualityBest : 'Qualidade Melhor',
qualityHigh : 'Qualidade Alta',
qualityAutoHigh : 'Qualidade Alta Automática',
qualityMedium : 'Qualidade Média',
qualityAutoLow : 'Qualidade Baixa Automática',
qualityLow : 'Qualidade Baixa',
windowModeWindow: 'Janela',
windowModeOpaque: 'Opaca',
windowModeTransparent : 'Transparente',
windowMode : 'Modo da janela',
flashvars : 'Variáveis do Flash',
bgcolor : 'Cor do Plano de Fundo',
hSpace : 'HSpace',
vSpace : 'VSpace',
validateSrc : 'Por favor, digite o endereço do link',
validateHSpace : 'O HSpace tem que ser um número',
validateVSpace : 'O VSpace tem que ser um número.'
},
// Speller Pages Dialog
spellCheck :
{
toolbar : 'Verificar Ortografia',
title : 'Corretor Ortográfico',
notAvailable : 'Desculpe, o serviço não está disponível no momento.',
errorLoading : 'Erro carregando servidor de aplicação: %s.',
notInDic : 'Não encontrada',
changeTo : 'Alterar para',
btnIgnore : 'Ignorar uma vez',
btnIgnoreAll : 'Ignorar Todas',
btnReplace : 'Alterar',
btnReplaceAll : 'Alterar Todas',
btnUndo : 'Desfazer',
noSuggestions : '-sem sugestões de ortografia-',
progress : 'Verificação ortográfica em andamento...',
noMispell : 'Verificação encerrada: Não foram encontrados erros de ortografia',
noChanges : 'Verificação ortográfica encerrada: Não houve alterações',
oneChange : 'Verificação ortográfica encerrada: Uma palavra foi alterada',
manyChanges : 'Verificação ortográfica encerrada: %1 palavras foram alteradas',
ieSpellDownload : 'A verificação ortográfica não foi instalada. Você gostaria de realizar o download agora?'
},
smiley :
{
toolbar : 'Emoticon',
title : 'Inserir Emoticon',
options : 'Opções de Emoticons'
},
elementsPath :
{
eleLabel : 'Caminho dos Elementos',
eleTitle : 'Elemento %1'
},
numberedlist : 'Lista numerada',
bulletedlist : 'Lista sem números',
indent : 'Aumentar Recuo',
outdent : 'Diminuir Recuo',
justify :
{
left : 'Alinhar Esquerda',
center : 'Centralizar',
right : 'Alinhar Direita',
block : 'Justificado'
},
blockquote : 'Citação',
clipboard :
{
title : 'Colar',
cutError : 'As configurações de segurança do seu navegador não permitem que o editor execute operações de recortar automaticamente. Por favor, utilize o teclado para recortar (Ctrl/Cmd+X).',
copyError : 'As configurações de segurança do seu navegador não permitem que o editor execute operações de copiar automaticamente. Por favor, utilize o teclado para copiar (Ctrl/Cmd+C).',
pasteMsg : 'Transfira o link usado na caixa usando o teclado com (<STRONG>Ctrl/Cmd+V</STRONG>) e <STRONG>OK</STRONG>.',
securityMsg : 'As configurações de segurança do seu navegador não permitem que o editor acesse os dados da área de transferência diretamente. Por favor cole o conteúdo manualmente nesta janela.',
pasteArea : 'Área para Colar'
},
pastefromword :
{
confirmCleanup : 'O texto que você deseja colar parece ter sido copiado do Word. Você gostaria de remover a formatação antes de colar?',
toolbar : 'Colar do Word',
title : 'Colar do Word',
error : 'Não foi possível limpar os dados colados devido a um erro interno'
},
pasteText :
{
button : 'Colar como Texto sem Formatação',
title : 'Colar como Texto sem Formatação'
},
templates :
{
button : 'Modelos de layout',
title : 'Modelo de layout de conteúdo',
options : 'Opções de Template',
insertOption : 'Substituir o conteúdo atual',
selectPromptMsg : 'Selecione um modelo de layout para ser aberto no editor<br>(o conteúdo atual será perdido):',
emptyListMsg : '(Não foram definidos modelos de layout)'
},
showBlocks : 'Mostrar blocos de código',
stylesCombo :
{
label : 'Estilo',
panelTitle : 'Estilos de Formatação',
panelTitle1 : 'Estilos de bloco',
panelTitle2 : 'Estilos de texto corrido',
panelTitle3 : 'Estilos de objeto'
},
format :
{
label : 'Formatação',
panelTitle : 'Formatação',
tag_p : 'Normal',
tag_pre : 'Formatado',
tag_address : 'Endereço',
tag_h1 : 'Título 1',
tag_h2 : 'Título 2',
tag_h3 : 'Título 3',
tag_h4 : 'Título 4',
tag_h5 : 'Título 5',
tag_h6 : 'Título 6',
tag_div : 'Normal (DIV)'
},
div :
{
title : 'Criar Container de DIV',
toolbar : 'Criar Container de DIV',
cssClassInputLabel : 'Classes de CSS',
styleSelectLabel : 'Estilo',
IdInputLabel : 'Id',
languageCodeInputLabel : 'Código de Idioma',
inlineStyleInputLabel : 'Estilo Inline',
advisoryTitleInputLabel : 'Título Consulta',
langDirLabel : 'Direção da Escrita',
langDirLTRLabel : 'Esquerda para Direita (LTR)',
langDirRTLLabel : 'Direita para Esquerda (RTL)',
edit : 'Editar Div',
remove : 'Remover Div'
},
iframe :
{
title : 'IFrame Properties', // MISSING
toolbar : 'IFrame', // MISSING
noUrl : 'Please type the iframe URL', // MISSING
scrolling : 'Enable scrollbars', // MISSING
border : 'Show frame border' // MISSING
},
font :
{
label : 'Fonte',
voiceLabel : 'Fonte',
panelTitle : 'Fonte'
},
fontSize :
{
label : 'Tamanho',
voiceLabel : 'Tamanho da fonte',
panelTitle : 'Tamanho'
},
colorButton :
{
textColorTitle : 'Cor do Texto',
bgColorTitle : 'Cor do Plano de Fundo',
panelTitle : 'Cores',
auto : 'Automático',
more : 'Mais Cores...'
},
colors :
{
'000' : 'Preto',
'800000' : 'Foquete',
'8B4513' : 'Marrom 1',
'2F4F4F' : 'Cinza 1',
'008080' : 'Cerceta',
'000080' : 'Azul Marinho',
'4B0082' : 'Índigo',
'696969' : 'Cinza 2',
'B22222' : 'Tijolo de Fogo',
'A52A2A' : 'Marrom 2',
'DAA520' : 'Vara Dourada',
'006400' : 'Verde Escuro',
'40E0D0' : 'Turquesa',
'0000CD' : 'Azul Médio',
'800080' : 'Roxo',
'808080' : 'Cinza 3',
'F00' : 'Vermelho',
'FF8C00' : 'Laranja Escuro',
'FFD700' : 'Dourado',
'008000' : 'Verde',
'0FF' : 'Ciano',
'00F' : 'Azul',
'EE82EE' : 'Violeta',
'A9A9A9' : 'Cinza Escuro',
'FFA07A' : 'Salmão Claro',
'FFA500' : 'Laranja',
'FFFF00' : 'Amarelo',
'00FF00' : 'Lima',
'AFEEEE' : 'Turquesa Pálido',
'ADD8E6' : 'Azul Claro',
'DDA0DD' : 'Ameixa',
'D3D3D3' : 'Cinza Claro',
'FFF0F5' : 'Lavanda 1',
'FAEBD7' : 'Branco Antiguidade',
'FFFFE0' : 'Amarelo Claro',
'F0FFF0' : 'Orvalho',
'F0FFFF' : 'Azure',
'F0F8FF' : 'Azul Alice',
'E6E6FA' : 'Lavanda 2',
'FFF' : 'Branco'
},
scayt :
{
title : 'Correção ortográfica durante a digitação',
opera_title : 'Não suportado no Opera',
enable : 'Habilitar correção ortográfica durante a digitação',
disable : 'Desabilitar correção ortográfica durante a digitação',
about : 'Sobre a correção ortográfica durante a digitação',
toggle : 'Ativar/desativar correção ortográfica durante a digitação',
options : 'Opções',
langs : 'Idiomas',
moreSuggestions : 'Mais sugestões',
ignore : 'Ignorar',
ignoreAll : 'Ignorar todas',
addWord : 'Adicionar palavra',
emptyDic : 'O nome do dicionário não deveria estar vazio.',
optionsTab : 'Opções',
allCaps : 'Ignorar palavras maiúsculas',
ignoreDomainNames : 'Ignorar nomes de domínio',
mixedCase : 'Ignorar palavras com maiúsculas e minúsculas misturadas',
mixedWithDigits : 'Ignorar palavras com números',
languagesTab : 'Idiomas',
dictionariesTab : 'Dicionários',
dic_field_name : 'Nome do Dicionário',
dic_create : 'Criar',
dic_restore : 'Restaurar',
dic_delete : 'Excluir',
dic_rename : 'Renomear',
dic_info : 'Inicialmente, o dicionário do usuário fica armazenado em um Cookie. Porém, Cookies tem tamanho limitado, portanto quand o dicionário do usuário atingir o tamanho limite poderá ser armazenado no nosso servidor. Para armazenar seu dicionário pessoal no nosso servidor deverá especificar um nome para ele. Se já tiver um dicionário armazenado por favor especifique o seu nome e clique em Restaurar.',
aboutTab : 'Sobre'
},
about :
{
title : 'Sobre o CKEditor',
dlgTitle : 'Sobre o CKEditor',
help : 'Check $1 for help.', // MISSING
userGuide : 'CKEditor User\'s Guide', // MISSING
moreInfo : 'Para informações sobre a licença por favor visite o nosso site:',
copy : 'Copyright © $1. Todos os direitos reservados.'
},
maximize : 'Maximizar',
minimize : 'Minimize',
fakeobjects :
{
anchor : 'Âncora',
flash : 'Animação em Flash',
iframe : 'IFrame', // MISSING
hiddenfield : 'Hidden Field', // MISSING
unknown : 'Objeto desconhecido'
},
resize : 'Arraste para redimensionar',
colordialog :
{
title : 'Selecione uma cor',
options : 'Opções de Cor',
highlight : 'Grifar',
selected : 'Cor Selecionada',
clear : 'Limpar'
},
toolbarCollapse : 'Diminuir Barra de Ferramentas',
toolbarExpand : 'Aumentar Barra de Ferramentas',
toolbarGroups :
{
document : 'Document', // MISSING
clipboard : 'Clipboard/Undo', // MISSING
editing : 'Editing', // MISSING
forms : 'Forms', // MISSING
basicstyles : 'Basic Styles', // MISSING
paragraph : 'Paragraph', // MISSING
links : 'Links', // MISSING
insert : 'Insert', // MISSING
styles : 'Styles', // MISSING
colors : 'Colors', // MISSING
tools : 'Tools' // MISSING
},
bidi :
{
ltr : 'Text direction from left to right', // MISSING
rtl : 'Text direction from right to left' // MISSING
},
docprops :
{
label : 'Propriedades Documento',
title : 'Propriedades Documento',
design : 'Design', // MISSING
meta : 'Meta Dados',
chooseColor : 'Escolher',
other : '<outro>',
docTitle : 'Título da Página',
charset : 'Codificação de Caracteres',
charsetOther : 'Outra Codificação de Caracteres',
charsetASCII : 'ASCII', // MISSING
charsetCE : 'Europa Central',
charsetCT : 'Chinês Tradicional (Big5)',
charsetCR : 'Cirílico',
charsetGR : 'Grego',
charsetJP : 'Japonês',
charsetKR : 'Coreano',
charsetTR : 'Turco',
charsetUN : 'Unicode (UTF-8)', // MISSING
charsetWE : 'Europa Ocidental',
docType : 'Cabeçalho Tipo de Documento',
docTypeOther : 'Other Document Type Heading', // MISSING
xhtmlDec : 'Incluir Declarações XHTML',
bgColor : 'Cor do Plano de Fundo',
bgImage : 'URL da Imagem de Plano de Fundo',
bgFixed : 'Plano de Fundo Fixo',
txtColor : 'Cor do Texto',
margin : 'Margens da Página',
marginTop : 'Superior',
marginLeft : 'Inferior',
marginRight : 'Direita',
marginBottom : 'Inferior',
metaKeywords : 'Palavras-chave de Indexação do Documento (separadas por vírgula)',
metaDescription : 'Descrição do Documento',
metaAuthor : 'Autor',
metaCopyright : 'Direitos Autorais',
previewHtml : '<p>This is some <strong>sample text</strong>. You are using <a href="javascript:void(0)">CKEditor</a>.</p>' // MISSING
}
};
| {
"content_hash": "5754450aaa302b2549cdfb0db794b8a1",
"timestamp": "",
"source": "github",
"line_count": 808,
"max_line_length": 416,
"avg_line_length": 32.43440594059406,
"alnum_prop": 0.6011752585187163,
"repo_name": "LeanLaunchLab/LeanLaunchLab",
"id": "0474cca2193228f590b0d1f40f6dc903e52ad4e3",
"size": "26712",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "public/ckeditor/_source/lang/pt-br.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "768"
},
{
"name": "Batchfile",
"bytes": "261"
},
{
"name": "CSS",
"bytes": "369627"
},
{
"name": "HTML",
"bytes": "1104528"
},
{
"name": "JavaScript",
"bytes": "3990243"
},
{
"name": "Ruby",
"bytes": "621504"
},
{
"name": "Shell",
"bytes": "542"
}
],
"symlink_target": ""
} |
module Azure::MediaServices::Mgmt::V2018_07_01
module Models
#
# A collection of AccountFilter items.
#
class AccountFilterCollection
include MsRestAzure
include MsRest::JSONable
# @return [Array<AccountFilter>] A collection of AccountFilter items.
attr_accessor :value
# @return [String] A link to the next page of the collection (when the
# collection contains too many results to return in one response).
attr_accessor :odatanext_link
# return [Proc] with next page method call.
attr_accessor :next_method
#
# Gets the rest of the items for the request, enabling auto-pagination.
#
# @return [Array<AccountFilter>] operation results.
#
def get_all_items
items = @value
page = self
while page.odatanext_link != nil && !page.odatanext_link.strip.empty? do
page = page.get_next_page
items.concat(page.value)
end
items
end
#
# Gets the next page of results.
#
# @return [AccountFilterCollection] with next page content.
#
def get_next_page
response = @next_method.call(@odatanext_link).value! unless @next_method.nil?
unless response.nil?
@odatanext_link = response.body.odatanext_link
@value = response.body.value
self
end
end
#
# Mapper for AccountFilterCollection class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'AccountFilterCollection',
type: {
name: 'Composite',
class_name: 'AccountFilterCollection',
model_properties: {
value: {
client_side_validation: true,
required: false,
serialized_name: 'value',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'AccountFilterElementType',
type: {
name: 'Composite',
class_name: 'AccountFilter'
}
}
}
},
odatanext_link: {
client_side_validation: true,
required: false,
serialized_name: '@odata\\.nextLink',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
| {
"content_hash": "2855ad29b7a729f7b34f6f796506e873",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 85,
"avg_line_length": 29.21276595744681,
"alnum_prop": 0.5138383102694829,
"repo_name": "Azure/azure-sdk-for-ruby",
"id": "1e149c64a133cc502de73d4cfd5c3f6482754fa0",
"size": "2910",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/models/account_filter_collection.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "345216400"
},
{
"name": "Shell",
"bytes": "305"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="es">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<?php $this->load->view('plantilla/head') ?>
<link href="<?php echo site_url('') ?>metronic/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo site_url('') ?>metronic/admin/pages/css/profile.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo site_url('') ?>metronic/admin/pages/css/tasks.css" rel="stylesheet" type="text/css"/>
</head>
<body class="page-header-fixed page-quick-sidebar-over-content page-container-bg-solid">
<!-- BEGIN HEADER -->
<div class="page-header -i navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<?php echo $barra; ?>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<?php echo $menu; ?>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<div class="col-md-12">
<form action="#" class="form-horizontal">
<div class="form-body">
<!-- BEGIN PROFILE SIDEBAR -->
<div class="profile-sidebar">
<!-- PORTLET MAIN -->
<div class="portlet light profile-sidebar-portlet">
<!-- SIDEBAR USERPIC -->
<div class="profile-userpic">
<img src="<?php echo site_url('') ?>metronic/admin/pages/media/profile/profile_user.jpg" class="img-responsive" alt="">
</div>
<!-- END SIDEBAR USERPIC -->
<!-- SIDEBAR USER TITLE -->
<div class="profile-usertitle">
<div class="profile-usertitle-job">
Foto
</div>
</div>
<!-- END SIDEBAR USER TITLE -->
<!-- SIDEBAR BUTTONS -->
<!-- END SIDEBAR BUTTONS -->
<!-- SIDEBAR MENU -->
<div class="profile-usermenu">
<div class="col-md-12">
<h4 class="profile-desc-title">Fecha de nacimiento</h4>
</div>
<div class="form-group">
<label class="col-md-1"></label>
<div class="col-md-3">
<select class=" input-circle">
<option> Día</option>
<option> 2</option>
<option> 3</option>
<option> 4</option>
<option> 5</option>
</select>
</div>
<div class="col-md-3">
<select class="input-circle">
<option> Mes</option>
<option> 2</option>
<option> 3</option>
<option> 4</option>
<option> 5</option>
</select>
</div>
<div class="col-md-3">
<select class="input-circle">
<option> Año</option>
<option> 2</option>
<option> 3</option>
<option> 4</option>
<option> 5</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3"></label>
<div class="col-md-8">
<div class="input-group">
<div class="icheck-inline">
<label>
<input type="radio" name="radio2" class="form-control input-circle" data-radio="iradio_square-grey">Hombre </label>
<label>
<input type="radio" name="radio2" checked class="form-control input-circle" data-radio="iradio_square-grey"> Mujer</label>
</div>
</div>
</div>
</div>
</div>
<!-- END MENU -->
</div>
<!-- END PORTLET MAIN -->
<!-- PORTLET MAIN -->
<!-- END PORTLET MAIN -->
</div>
<!-- END BEGIN PROFILE SIDEBAR -->
<!-- BEGIN PROFILE CONTENT -->
<div class="profile-content">
<div class="col-md-7">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-user"></i>Datos Personales
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<div class="form-body">
<!-- <h4 class="block">Checkboxe Addons</h4> -->
<div class="form-group">
<label class="col-md-3 control-label">Nombre </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-user"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Nombre">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Email </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-envelope"></i>
</span>
<input type="email" class="form-control input-circle-right" placeholder="Email ..">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Télefono </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-phone"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Télefono">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Celular </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-phone"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Celular">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Calle </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-car"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Calle">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Num. Int. </label>
<div class="col-md-4">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-flag"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Num. Int.">
</div>
</div>
<div class="col-md-4">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-flag"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Num. Ext">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Cidad </label>
<div class="col-md-5">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-home"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Delegación">
</div>
</div>
<div class="col-md-3">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-home"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="CP">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Delegación </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-home"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Delegación">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Notas </label>
<div class="col-md-8">
<div class="input-group">
<textarea class="form-control input-circle">
</textarea>
</div>
</div>
</div>
<!-- END FORM-->
</div>
<div class="form-actions">
<button type="submit" class="btn blue">Guardar</button>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-user"></i>En caso de emergencia contactar a:
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<div class="form-body">
<!-- <h4 class="block">Checkboxe Addons</h4> -->
<div class="form-group">
<label class="col-md-3 control-label">Nombre </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-user"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Nombre">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Télefono </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-phone"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Télefono">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Celular </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-phone"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Celular">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Parentesco </label>
<div class="col-md-8">
<div class="input-group">
<span class="input-group-addon input-circle-left">
<i class="fa fa-users"></i>
</span>
<input type="text" class="form-control input-circle-right" placeholder="Parentesco">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Notas </label>
<div class="col-md-8">
<div class="input-group">
<textarea class="form-control input-circle">
</textarea>
</div>
</div>
</div>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner">
2016 © HelpMex.com.mx
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END JAVASCRIPTS -->
<?php $this->load->view('plantilla/script') ?>
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Metronic.init(); // init metronic core components
Demo.init(); // init demo features
// UIExtendedModals.init();
});
</script>
</body>
<!-- END BODY -->
</html> | {
"content_hash": "06d41db995aadd54fc46e2f799a8d534",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 148,
"avg_line_length": 34.476082004555806,
"alnum_prop": 0.40488932936901223,
"repo_name": "Eduardo2505/Denticlick",
"id": "9549a62b8a722f85e792a13d8e23d13f565c9976",
"size": "15144",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/paciente/paciente.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "290"
},
{
"name": "ApacheConf",
"bytes": "1343"
},
{
"name": "CSS",
"bytes": "2724919"
},
{
"name": "CoffeeScript",
"bytes": "83631"
},
{
"name": "HTML",
"bytes": "4231895"
},
{
"name": "JavaScript",
"bytes": "5429593"
},
{
"name": "PHP",
"bytes": "2184493"
},
{
"name": "Shell",
"bytes": "444"
}
],
"symlink_target": ""
} |
namespace Envoy {
namespace Extensions {
namespace Matching {
namespace InputMatchers {
namespace Hyperscan {
Envoy::Matcher::InputMatcherFactoryCb
Config::createInputMatcherFactoryCb(const Protobuf::Message& config,
Server::Configuration::ServerFactoryContext& factory_context) {
const auto hyperscan_config = MessageUtil::downcastAndValidate<
const envoy::extensions::matching::input_matchers::hyperscan::v3alpha::Hyperscan&>(
config, factory_context.messageValidationVisitor());
#ifdef HYPERSCAN_DISABLED
throw EnvoyException("X86_64 architecture is required for Hyperscan.");
#else
// Hyperscan's API requires vectors of expressions, flags and IDs for matching database
// compilation.
return [hyperscan_config, &factory_context]() {
int size = hyperscan_config.regexes().size();
std::vector<const char*> expressions;
std::vector<unsigned int> flags;
std::vector<unsigned int> ids;
expressions.reserve(size);
flags.reserve(size);
ids.reserve(size);
for (const auto& regex : hyperscan_config.regexes()) {
expressions.push_back(regex.regex().c_str());
unsigned int flag = 0;
if (regex.caseless()) {
flag |= HS_FLAG_CASELESS;
}
if (regex.dot_all()) {
flag |= HS_FLAG_DOTALL;
}
if (regex.multiline()) {
flag |= HS_FLAG_MULTILINE;
}
if (regex.allow_empty()) {
flag |= HS_FLAG_ALLOWEMPTY;
}
if (regex.utf8()) {
flag |= HS_FLAG_UTF8;
if (regex.ucp()) {
flag |= HS_FLAG_UCP;
}
}
if (regex.combination()) {
flag |= HS_FLAG_COMBINATION;
}
if (regex.quiet()) {
flag |= HS_FLAG_QUIET;
}
flags.push_back(flag);
ids.push_back(regex.id());
}
return std::make_unique<Matcher>(expressions, flags, ids, factory_context.threadLocal(), false);
};
#endif
}
REGISTER_FACTORY(Config, Envoy::Matcher::InputMatcherFactory);
} // namespace Hyperscan
} // namespace InputMatchers
} // namespace Matching
} // namespace Extensions
} // namespace Envoy
| {
"content_hash": "395c907d4660d1695ef2dbb2ba801930",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 100,
"avg_line_length": 30.768115942028984,
"alnum_prop": 0.6382477626000942,
"repo_name": "envoyproxy/envoy",
"id": "45b1aefda2a6b58679cd19cfe99c201581c7c70c",
"size": "2381",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "contrib/hyperscan/matching/input_matchers/source/config.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "439"
},
{
"name": "C",
"bytes": "54172"
},
{
"name": "C++",
"bytes": "36279350"
},
{
"name": "CSS",
"bytes": "884"
},
{
"name": "Dockerfile",
"bytes": "891"
},
{
"name": "Emacs Lisp",
"bytes": "966"
},
{
"name": "Go",
"bytes": "558"
},
{
"name": "HTML",
"bytes": "582"
},
{
"name": "Java",
"bytes": "1309139"
},
{
"name": "JavaScript",
"bytes": "76"
},
{
"name": "Jinja",
"bytes": "46306"
},
{
"name": "Kotlin",
"bytes": "311319"
},
{
"name": "Makefile",
"bytes": "303"
},
{
"name": "NASL",
"bytes": "327095"
},
{
"name": "Objective-C",
"bytes": "95941"
},
{
"name": "PureBasic",
"bytes": "472"
},
{
"name": "Python",
"bytes": "630897"
},
{
"name": "Ruby",
"bytes": "47"
},
{
"name": "Rust",
"bytes": "38041"
},
{
"name": "Shell",
"bytes": "194810"
},
{
"name": "Smarty",
"bytes": "3528"
},
{
"name": "Starlark",
"bytes": "2229814"
},
{
"name": "Swift",
"bytes": "307285"
},
{
"name": "Thrift",
"bytes": "748"
}
],
"symlink_target": ""
} |
<html>
<body>
Reports calls to <code>equals()</code> or <code>compareTo()</code> were an object is compared for equality
with itself. This means the argument and the qualifier to the call are identical, and it will always return
<code>true</code> for <code>equals()</code> or always <code>0</code> for <code>compareTo()</code>. Also
reports call to static methods <code>Objects.equals()</code>, <code>Objects.deepEquals()</code>,
<code>Arrays.equals()</code>, <code>Comparator.compare</code> and similar methods with two identical arguments.
<p>Example:</p>
<pre>
class Foo {
boolean foo(Object o) {
return o.equals(o); // warning
}
boolean bar(String[] ss) {
return Arrays.equals(ss, ss); // warning
}
}
</pre>
<!-- tooltip end -->
<p>
</body>
</html> | {
"content_hash": "9468b484504244c140bd027eb304e7d1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 111,
"avg_line_length": 34.21739130434783,
"alnum_prop": 0.6747141041931385,
"repo_name": "zdary/intellij-community",
"id": "110df0f79adc278dd615fca5d64422a21a4305c7",
"size": "787",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "plugins/InspectionGadgets/src/inspectionDescriptions/EqualsWithItself.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package net.openhft.affinity.impl;
/**
* used for Windows API
* Created by rhelbing on 31.03.17.
*/
public class GroupAffinityMask implements Comparable<GroupAffinityMask> {
final int groupId;
final long mask;
public GroupAffinityMask(int groupId, long mask) {
this.groupId = groupId;
this.mask = mask;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GroupAffinityMask that = (GroupAffinityMask) o;
if (groupId != that.groupId) {
return false;
}
return mask == that.mask;
}
@Override
public int hashCode() {
int result = groupId;
result = 31 * result + (int) (mask ^ (mask >>> 32));
return result;
}
@Override
public int compareTo(GroupAffinityMask o) {
int res = Integer.compare(groupId, o.groupId);
if (res != 0) {
return res;
}
return Long.compare(mask, o.mask);
}
public long getMask() {
return mask;
}
public int getGroupId() {
return groupId;
}
public String toString() {
return groupId + "/0x" + Long.toHexString( mask);
}
}
| {
"content_hash": "92fb474a9e055a3be3df067f6b7a96f6",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 73,
"avg_line_length": 22.36842105263158,
"alnum_prop": 0.5662745098039216,
"repo_name": "plusterkopp/Java-Thread-Affinity",
"id": "32e41fa75c668932f4868dd1e8e7c6a35de43716",
"size": "1275",
"binary": false,
"copies": "1",
"ref": "refs/heads/3",
"path": "affinity/src/main/java/net/openhft/affinity/impl/GroupAffinityMask.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2342"
},
{
"name": "C++",
"bytes": "10365"
},
{
"name": "Java",
"bytes": "278658"
},
{
"name": "Makefile",
"bytes": "1330"
}
],
"symlink_target": ""
} |
package org.locationtech.geomesa.accumulo.tools.status
import com.beust.jcommander.Parameters
import org.locationtech.geomesa.accumulo.data.AccumuloDataStore
import org.locationtech.geomesa.accumulo.tools.{AccumuloDataStoreCommand, AccumuloDataStoreParams}
import org.locationtech.geomesa.accumulo.tools.status.AccumuloDescribeSchemaCommand.DescribeParameters
import org.locationtech.geomesa.tools.RequiredTypeNameParam
import org.locationtech.geomesa.tools.status.DescribeSchemaCommand
class AccumuloDescribeSchemaCommand extends DescribeSchemaCommand[AccumuloDataStore] with AccumuloDataStoreCommand {
override val params = new DescribeParameters
}
object AccumuloDescribeSchemaCommand {
@Parameters(commandDescription = "Describe the attributes of a given GeoMesa feature type")
class DescribeParameters extends AccumuloDataStoreParams with RequiredTypeNameParam
}
| {
"content_hash": "5f96c677758d2aa4e1feb7b6824752bc",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 116,
"avg_line_length": 44,
"alnum_prop": 0.8727272727272727,
"repo_name": "spandanagrawal/geomesa",
"id": "3b95e87e0ecac7b055e90e7288c5305293590933",
"size": "1339",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "geomesa-accumulo/geomesa-accumulo-tools/src/main/scala/org/locationtech/geomesa/accumulo/tools/status/AccumuloDescribeSchemaCommand.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "202384"
},
{
"name": "JavaScript",
"bytes": "140"
},
{
"name": "Protocol Buffer",
"bytes": "981"
},
{
"name": "Python",
"bytes": "6257"
},
{
"name": "R",
"bytes": "2716"
},
{
"name": "Scala",
"bytes": "5416072"
},
{
"name": "Scheme",
"bytes": "1516"
},
{
"name": "Shell",
"bytes": "108103"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
tools:context="com.example.wukai.wukaiweather.WeatherActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/bing_pic_img"
android:scaleType="centerCrop"/>
<android.support.v4.widget.DrawerLayout
android:id="@+id/draw_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/weather_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:fitsSystemWindows="true">
<include layout="@layout/title" />
<include layout="@layout/now" />
<include layout="@layout/forecast" />
<include layout="@layout/aqi" />
<include layout="@layout/suggestion" />
</LinearLayout>
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/choose_area_fragment"
android:layout_gravity = "start"
android:name="com.example.wukai.wukaiweather.ChooseAreaFragment"/>
</android.support.v4.widget.DrawerLayout>
</FrameLayout>
| {
"content_hash": "2b6542ef4b1c26cb6cc6faa5c8a31a3c",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 78,
"avg_line_length": 33,
"alnum_prop": 0.5913547237076648,
"repo_name": "w244285636/wukaiweather",
"id": "cc29a0d97617497cd649a224341897a4a9909bd8",
"size": "2244",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/activity_weather.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "36298"
}
],
"symlink_target": ""
} |
package org.kie.workbench.common.widgets.client.handlers;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.jboss.errai.ui.client.local.spi.TranslationService;
import org.kie.soup.commons.validation.PortablePreconditions;
import org.kie.workbench.common.widgets.client.resources.i18n.KieWorkbenchWidgetsConstants;
import org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;
@ApplicationScoped
public class NewResourcePresenter {
private NewResourceView view;
private final TranslationService translationService;
private NewResourceHandler activeHandler = null;
@Inject
public NewResourcePresenter(NewResourceView view,
TranslationService translationService) {
this.view = view;
this.translationService = translationService;
}
@PostConstruct
private void setup() {
view.init(this);
}
public void show(final NewResourceHandler handler) {
activeHandler = PortablePreconditions.checkNotNull("handler",
handler);
view.show();
view.setActiveHandler(activeHandler);
view.setTitle(translationService.getTranslation(KieWorkbenchWidgetsConstants.NewResourceViewPopupTitle) + " " + getActiveHandlerDescription());
}
public void validate(final String fileName,
final ValidatorWithReasonCallback callback) {
if (activeHandler != null) {
activeHandler.validate(fileName,
callback);
}
}
public void makeItem(final String fileName) {
if (activeHandler != null) {
activeHandler.create(view.getSelectedPackage(),
fileName,
NewResourcePresenter.this);
}
}
public void complete() {
view.hide();
}
private String getActiveHandlerDescription() {
if (activeHandler != null) {
return activeHandler.getDescription();
} else {
return "";
}
}
public void setResourceName(String resourceName) {
view.setResourceName(resourceName);
}
}
| {
"content_hash": "2100ba2a4dd0914ce633fd372158dfef",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 151,
"avg_line_length": 31.14864864864865,
"alnum_prop": 0.647288503253796,
"repo_name": "ederign/kie-wb-common",
"id": "8d4c86b11f866a7f1ca46d9d7b210a3a0f1f77aa",
"size": "2926",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "kie-wb-common-widgets/kie-wb-common-ui/src/main/java/org/kie/workbench/common/widgets/client/handlers/NewResourcePresenter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "67975"
},
{
"name": "FreeMarker",
"bytes": "36748"
},
{
"name": "GAP",
"bytes": "86275"
},
{
"name": "HTML",
"bytes": "213132"
},
{
"name": "Java",
"bytes": "27302200"
},
{
"name": "JavaScript",
"bytes": "19109"
},
{
"name": "Shell",
"bytes": "151"
},
{
"name": "Visual Basic",
"bytes": "78106"
}
],
"symlink_target": ""
} |
define( [
"./core",
"./var/document",
"./var/isFunction",
"./var/rnothtmlwhite",
"./ajax/var/location",
"./ajax/var/nonce",
"./ajax/var/rquery",
"./core/init",
"./core/parseXML",
"./event/trigger",
"./deferred",
"./serialize" // jQuery.param
], function( jQuery, document, isFunction, rnothtmlwhite, location, nonce, rquery ) {
"use strict";
var
r20 = /%20/g,
rhash = /#.*$/,
rantiCache = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat( "*" ),
// Anchor tag for parsing the document origin
originAnchor = document.createElement( "a" );
originAnchor.href = location.href;
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
if ( isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( ( dataType = dataTypes[ i++ ] ) ) {
// Prepend if requested
if ( dataType[ 0 ] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
// Otherwise append
} else {
( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if ( typeof dataTypeOrTransport === "string" &&
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
} );
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while ( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s.throws ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
}
}
}
return { state: "success", data: response };
}
jQuery.extend( {
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: location.href,
type: "GET",
isLocal: rlocalProtocol.test( location.protocol ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /\bxml\b/,
html: /\bhtml/,
json: /\bjson\b/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": JSON.parse,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var transport,
// URL without anti-cache param
cacheURL,
// Response headers
responseHeadersString,
responseHeaders,
// timeout handle
timeoutTimer,
// Url cleanup var
urlAnchor,
// Request state (becomes false upon send and true upon completion)
completed,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// uncached part of the url
uncached,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( completed ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
.concat( match[ 2 ] );
}
}
match = responseHeaders[ key.toLowerCase() + " " ];
}
return match == null ? null : match.join( ", " );
},
// Raw string
getAllResponseHeaders: function() {
return completed ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
if ( completed == null ) {
name = requestHeadersNames[ name.toLowerCase() ] =
requestHeadersNames[ name.toLowerCase() ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( completed == null ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( completed ) {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
} else {
// Lazy-add the new callbacks in a way that preserves old ones
for ( code in map ) {
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR );
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || location.href ) + "" )
.replace( rprotocol, location.protocol + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
// A cross-domain request is in order when the origin doesn't match the current origin.
if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" );
// Support: IE <=8 - 11, Edge 12 - 15
// IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/
try {
urlAnchor.href = s.url;
// Support: IE <=8 - 11 only
// Anchor's host property isn't correctly set when s.url is relative
urlAnchor.href = urlAnchor.href;
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
urlAnchor.protocol + "//" + urlAnchor.host;
} catch ( e ) {
// If there is an error parsing the URL, assume it is crossDomain,
// it can be rejected by the transport if it is invalid
s.crossDomain = true;
}
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( completed ) {
return jqXHR;
}
// We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
// Remove hash to simplify url manipulation
cacheURL = s.url.replace( rhash, "" );
// More options handling for requests with no content
if ( !s.hasContent ) {
// Remember the hash so we can put it back
uncached = s.url.slice( cacheURL.length );
// If data is available and should be processed, append data to url
if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add or update anti-cache param if needed
if ( s.cache === false ) {
cacheURL = cacheURL.replace( rantiCache, "$1" );
uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
uncached;
}
// Put hash and anti-cache on the URL that will be requested (gh-1732)
s.url = cacheURL + uncached;
// Change '%20' to '+' if this is encoded form body content (gh-2658)
} else if ( s.data && s.processData &&
( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
s.data = s.data.replace( r20, "+" );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
s.accepts[ s.dataTypes[ 0 ] ] +
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend &&
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// Aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
completeDeferred.add( s.complete );
jqXHR.done( s.success );
jqXHR.fail( s.error );
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// If request was aborted inside ajaxSend, stop there
if ( completed ) {
return jqXHR;
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = window.setTimeout( function() {
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
completed = false;
transport.send( requestHeaders, done );
} catch ( e ) {
// Rethrow post-completion exceptions
if ( completed ) {
throw e;
}
// Propagate others as results
done( -1, e );
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Ignore repeat invocations
if ( completed ) {
return;
}
completed = true;
// Clear timeout if it exists
if ( timeoutTimer ) {
window.clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Use a noop converter for missing script but not if jsonp
if ( !isSuccess &&
jQuery.inArray( "script", s.dataTypes ) > -1 &&
jQuery.inArray( "json", s.dataTypes ) < 0 ) {
s.converters[ "text script" ] = function() {};
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader( "Last-Modified" );
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader( "etag" );
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// Extract error from statusText and normalize for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
} );
jQuery.each( [ "get", "post" ], function( _i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted
if ( isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
// The url can be an options object (which then must have .url)
return jQuery.ajax( jQuery.extend( {
url: url,
type: method,
dataType: type,
data: data,
success: callback
}, jQuery.isPlainObject( url ) && url ) );
};
} );
jQuery.ajaxPrefilter( function( s ) {
var i;
for ( i in s.headers ) {
if ( i.toLowerCase() === "content-type" ) {
s.contentType = s.headers[ i ] || "";
}
}
} );
return jQuery;
} );
| {
"content_hash": "c4b4603634385914183d06d4b0bf687c",
"timestamp": "",
"source": "github",
"line_count": 876,
"max_line_length": 91,
"avg_line_length": 26.12785388127854,
"alnum_prop": 0.6192764767563789,
"repo_name": "umple/umple",
"id": "4be4a9e920123905a937c3f493b1d68e93c0625b",
"size": "22888",
"binary": false,
"copies": "24",
"ref": "refs/heads/master",
"path": "umpleonline/scripts/jquery/src/ajax.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "64"
},
{
"name": "CSS",
"bytes": "88712"
},
{
"name": "Dockerfile",
"bytes": "3687"
},
{
"name": "GAP",
"bytes": "1064953"
},
{
"name": "HTML",
"bytes": "393822"
},
{
"name": "Hack",
"bytes": "688"
},
{
"name": "Java",
"bytes": "40998041"
},
{
"name": "JavaScript",
"bytes": "1738541"
},
{
"name": "Lex",
"bytes": "11050"
},
{
"name": "MATLAB",
"bytes": "1160"
},
{
"name": "PHP",
"bytes": "559284"
},
{
"name": "PowerShell",
"bytes": "546"
},
{
"name": "Python",
"bytes": "47125"
},
{
"name": "Roff",
"bytes": "1622"
},
{
"name": "Ruby",
"bytes": "404520"
},
{
"name": "Shell",
"bytes": "20205"
},
{
"name": "TXL",
"bytes": "65445"
},
{
"name": "Xtend",
"bytes": "351"
}
],
"symlink_target": ""
} |
// Defines the data returned by the XLA buffer assignment packages.
#include "tensorflow/compiler/xla/service/buffer_assignment.h"
#include <algorithm>
#include <deque>
#include <ostream>
#include <utility>
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "tensorflow/compiler/xla/map_util.h"
#include "tensorflow/compiler/xla/service/buffer_value_containers.h"
#include "tensorflow/compiler/xla/service/heap_simulator.h"
#include "tensorflow/compiler/xla/service/hlo.pb.h"
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/compiler/xla/util.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/hash/hash.h"
#include "tensorflow/core/lib/strings/numbers.h"
namespace xla {
namespace {
using absl::StrAppend;
using absl::StrAppendFormat;
using ::tensorflow::gtl::FlatMap;
using ::tensorflow::gtl::FlatSet;
using ::tensorflow::strings::HumanReadableNumBytes;
template <typename T>
string ColocatedBufferSetsToString(const T& container, const char* title) {
string result;
StrAppend(&result, title, "\n");
for (const auto& it : container) {
StrAppend(&result, "\t", it->ToString(), "\n");
}
return result;
}
// Checks that points-to set of 'instruction' is unambiguous and distinct
// (ensured by CopyInsertion), then adds the buffer from the points-to set at
// 'index' to 'colocated_set'.
const LogicalBuffer* AddBufferToColocatedSet(
const HloInstruction* instruction, const ShapeIndex& index,
const TuplePointsToAnalysis& points_to_analysis,
std::vector<const LogicalBuffer*>* colocated_set) {
// CopyInsertion ensures root points-to set is unambiguous and distinct.
const auto& points_to = points_to_analysis.GetPointsToSet(instruction);
DCHECK(!points_to.IsAmbiguous());
colocated_set->push_back(points_to.element(index)[0]);
return colocated_set->back();
}
// Given the interference map of a graph (the list of interfering node indices
// for each node), perform graph coloring such that interfering nodes are
// assigned to different colors. Returns the assigned color of the nodes, where
// the colors are represented as integer values [0, color_count).
std::vector<int64> ColorInterferenceGraph(
const std::vector<std::vector<int64>>& interference_map) {
const int64 node_count = interference_map.size();
// Sort the nodes such that we assign nodes with more interference first. This
// relies on the common heuristic of assigning the most constrained node
// first, but it would be good to investigate other ordering heuristics too.
std::vector<int64> nodes(node_count);
std::iota(nodes.begin(), nodes.end(), 0);
std::sort(nodes.begin(), nodes.end(),
[&interference_map](const int64 i, const int64 j) {
return interference_map[i].size() > interference_map[j].size();
});
const int64 kColorUnassigned = -1;
std::vector<int64> assigned_colors(node_count, kColorUnassigned);
for (int64 node : nodes) {
// Mark the colors that are already assigned to the neighbors.
std::vector<bool> available_colors(node_count, true);
for (int64 neighbor : interference_map[node]) {
int64 color = assigned_colors[neighbor];
if (color != kColorUnassigned) {
available_colors[color] = false;
}
}
// Find the color that is not yet assigned to the neighbors.
int64 color = kColorUnassigned;
for (color = 0; color < available_colors.size(); ++color) {
if (available_colors[color]) {
break;
}
}
CHECK_NE(color, kColorUnassigned);
assigned_colors[node] = color;
}
return assigned_colors;
}
} // namespace
Status GatherComputationsByAllocationType(
const HloModule* module,
std::vector<const HloComputation*>* thread_local_computations,
std::vector<const HloComputation*>* global_computations) {
// Create a worklist of computations paired with whether the allocation must
// be thread-local.
std::deque<std::pair<const HloComputation*, bool>> worklist;
worklist.push_back(std::make_pair(module->entry_computation(),
/*is_thread_local*/ false));
// Sets for quickly checking membership. Computations are returned in vectors
// for stable iteration.
FlatSet<const HloComputation*> thread_local_set;
FlatSet<const HloComputation*> global_set;
while (!worklist.empty()) {
auto worklist_front = worklist.front();
worklist.pop_front();
const HloComputation* computation = worklist_front.first;
bool is_thread_local = worklist_front.second;
bool in_thread_local_set = thread_local_set.count(computation) > 0;
bool in_global_set = global_set.count(computation) > 0;
// If the computation has already been added to the respective set, then
// nothing to do.
if ((is_thread_local && in_thread_local_set) ||
(!is_thread_local && in_global_set)) {
continue;
}
// If the computation has already been added to the other set this is an
// error condition because the global call to the computation (eg,
// while/call) may return a reference to one of the thread-local buffers to
// the calling computation which will become a dangling reference when the
// thread-local is deallocated with the call return.
if ((is_thread_local && in_global_set) ||
(!is_thread_local && in_thread_local_set)) {
return InvalidArgument(
"computation %s has conflicting allocation requirements (global "
"and thread-local)",
computation->name());
}
if (is_thread_local) {
thread_local_set.insert(computation);
} else {
global_set.insert(computation);
}
for (auto* instruction : computation->instructions()) {
for (HloComputation* subcomputation :
instruction->called_computations()) {
switch (instruction->opcode()) {
case HloOpcode::kCall:
case HloOpcode::kConditional:
case HloOpcode::kWhile:
// Call and while must be called from a computation with global
// allocations as they may return references to buffers inside the
// called computation which cannot be thread-local.
if (is_thread_local) {
return InvalidArgument(
"computation %s cannot contain call/while op because it "
"requires thread-local buffer allocations",
computation->name());
}
worklist.push_back(std::make_pair(subcomputation,
false)); // Not thread local.
break;
case HloOpcode::kCrossReplicaSum:
case HloOpcode::kMap:
case HloOpcode::kReduce:
case HloOpcode::kReduceWindow:
case HloOpcode::kScatter:
case HloOpcode::kSelectAndScatter:
case HloOpcode::kFusion:
// Map/reduce etc computations are always thread-local.
worklist.push_back(std::make_pair(subcomputation,
true)); // Thread local.
break;
default:
return InternalError("Unexpected calling opcode: %s",
HloOpcodeString(instruction->opcode()));
}
}
}
}
// Add the computations to the vectors in post order.
for (auto* computation : module->MakeComputationPostOrder()) {
if (thread_local_set.count(computation) > 0) {
thread_local_computations->push_back(computation);
} else if (global_set.count(computation) > 0) {
global_computations->push_back(computation);
}
// If the computation is not reachable from the entry computation, then it
// will not appear in either thread_local_set or global_set. We don't bother
// assigning buffers for these.
}
return Status::OK();
}
size_t BufferAllocation::Slice::Hasher::operator()(Slice s) const {
uint64 h = std::hash<int64>()(s.index());
h = tensorflow::Hash64Combine(h, std::hash<int64>()(s.offset()));
h = tensorflow::Hash64Combine(h, std::hash<int64>()(s.size()));
return h;
}
string BufferAllocation::Slice::ToString() const {
return absl::StrCat("{index:", index(), ", offset:", offset_,
", size:", size_, "}");
}
BufferAllocation::Slice BufferAllocation::GetSlice(
const LogicalBuffer& buffer) const {
const OffsetSize os = FindOrDie(assigned_buffers_, &buffer);
return Slice(this, os.offset, os.size);
}
void BufferAllocation::AddAssignment(const LogicalBuffer& buffer, int64 offset,
int64 size) {
VLOG(4) << "Trying to add " << buffer << " to " << this;
CHECK(assigned_buffers_.count(&buffer) == 0)
<< "LogicalBuffer " << buffer << " already assigned to allocation "
<< index_;
CHECK_LE(offset, size_) << "LogicalBuffer " << buffer
<< " offset out of range";
CHECK_LE(offset + size, size_)
<< "LogicalBuffer " << buffer
<< " size out of range at offset: " << offset << " with size: " << size;
CHECK_EQ(buffer.color(), color())
<< "Buffer color " << buffer.color() << " for buffer " << buffer
<< " does not match allocation color " << color() << ".";
OffsetSize offset_size;
offset_size.offset = offset;
offset_size.size = size;
assigned_buffers_.emplace(&buffer, offset_size);
}
BufferAllocationProto BufferAllocation::ToProto() const {
BufferAllocationProto proto;
proto.set_index(index_);
proto.set_size(size_);
proto.set_is_thread_local(is_thread_local_);
proto.set_is_tuple(is_tuple_);
proto.set_color(color_.value());
if (is_entry_computation_parameter_) {
proto.set_is_entry_computation_parameter(true);
for (int64 idx : param_shape_index()) {
proto.add_parameter_shape_index(idx);
}
proto.set_parameter_number(parameter_number_);
}
proto.set_is_constant(is_constant_);
proto.set_maybe_live_out(maybe_live_out_);
for (const auto& buffer_offset_size : assigned_buffers_) {
BufferAllocationProto::Assigned* proto_assigned = proto.add_assigned();
proto_assigned->set_logical_buffer_id(buffer_offset_size.first->id());
proto_assigned->set_offset(buffer_offset_size.second.offset);
proto_assigned->set_size(buffer_offset_size.second.size);
}
std::sort(proto.mutable_assigned()->begin(), proto.mutable_assigned()->end(),
[](const BufferAllocationProto::Assigned& assign1,
const BufferAllocationProto::Assigned& assign2) {
return assign1.logical_buffer_id() < assign2.logical_buffer_id();
});
return proto;
}
string BufferAllocation::ToString() const {
string output;
StrAppendFormat(&output, "allocation %d: %p, size %d", index_, this, size());
if (color().value() != 0) {
StrAppend(&output, ", color ", color().value());
}
if (is_entry_computation_parameter()) {
StrAppend(&output, ", parameter ", parameter_number(), " at ShapeIndex ",
param_shape_index().ToString());
}
if (is_constant()) {
StrAppend(&output, ", constant");
}
if (is_thread_local()) {
StrAppend(&output, ", thread-local");
}
if (maybe_live_out()) {
StrAppend(&output, ", maybe-live-out");
}
if (IsPreallocatedTempBuffer()) {
StrAppend(&output, ", preallocated-temp");
}
StrAppend(&output, ":\n");
// Dump the assigned buffers ordered by id.
std::vector<const LogicalBuffer*> sorted_buffers;
for (const auto& buffer_offset_size : assigned_buffers_) {
sorted_buffers.push_back(buffer_offset_size.first);
}
std::sort(sorted_buffers.begin(), sorted_buffers.end(),
[](const LogicalBuffer* a, const LogicalBuffer* b) {
return a->id() < b->id();
});
for (const LogicalBuffer* buffer : sorted_buffers) {
const OffsetSize& offset_size = FindOrDie(assigned_buffers_, buffer);
StrAppend(&output, absl::StrFormat(
" %s [%d,%d]: %s\n", buffer->ToString(),
offset_size.offset, offset_size.size,
ShapeUtil::HumanStringWithLayout(buffer->shape())));
}
return output;
}
std::ostream& operator<<(std::ostream& out, const BufferAllocation& buffer) {
out << buffer.ToString();
return out;
}
std::ostream& operator<<(std::ostream& out, const BufferAllocation::Slice& s) {
out << s.ToString();
return out;
}
const PointsToSet& BufferAssignment::GetPointsToSet(
const HloInstruction* instruction) const {
return points_to_analysis().GetPointsToSet(instruction);
}
bool BufferAssignment::HasAllocation(const LogicalBuffer& buffer) const {
TF_CHECK_OK(points_to_analysis().VerifyBuffer(buffer));
return allocation_index_for_buffer_.count(&buffer) > 0;
}
const BufferAllocation& BufferAssignment::GetAssignedAllocation(
const LogicalBuffer& buffer) const {
CHECK(HasAllocation(buffer));
return GetAllocation(allocation_index_for_buffer_.at(&buffer));
}
BufferAllocation* BufferAssignment::GetMutableAssignedAllocation(
const LogicalBuffer& buffer) {
return const_cast<BufferAllocation*>(&GetAssignedAllocation(buffer));
}
std::set<BufferAllocation::Slice> BufferAssignment::GetAllSlices(
const HloInstruction* instruction, const ShapeIndex& index) const {
std::set<BufferAllocation::Slice> result;
for (const LogicalBuffer* buffer : GetSourceBuffers(instruction, index)) {
if (HasAllocation(*buffer)) {
result.insert(GetAssignedAllocation(*buffer).GetSlice(*buffer));
}
}
return result;
}
const BufferAllocation& BufferAssignment::GetAllocation(
BufferAllocation::Index index) const {
CHECK_GE(index, 0);
CHECK_LT(index, allocations_.size());
return allocations_[index];
}
BufferAllocation* BufferAssignment::GetMutableAllocation(
BufferAllocation::Index index) {
return const_cast<BufferAllocation*>(&GetAllocation(index));
}
bool BufferAssignment::HasAllocationAt(const HloInstruction* instruction,
const ShapeIndex& index) const {
for (const LogicalBuffer* buffer :
GetPointsToSet(instruction).element(index)) {
if (allocation_index_for_buffer_.count(buffer) > 0) {
return true;
}
}
return false;
}
bool BufferAssignment::HasTopLevelAllocation(
const HloInstruction* instruction) const {
return HasAllocationAt(instruction, /*index=*/{});
}
StatusOr<BufferAllocation::Slice> BufferAssignment::GetUniqueSlice(
const HloInstruction* instruction, const ShapeIndex& index) const {
VLOG(3) << "Trying to find unique slice for " << instruction->name() << " ["
<< index << "]";
BufferAllocation::Slice result;
for (const LogicalBuffer* buffer :
GetPointsToSet(instruction).element(index)) {
VLOG(3) << "Examining buffer " << *buffer;
if (HasAllocation(*buffer)) {
VLOG(3) << "Has allocation";
const BufferAllocation::Slice slice =
GetAssignedAllocation(*buffer).GetSlice(*buffer);
if (result.allocation() == nullptr) {
result = slice;
} else if (result != slice) {
return FailedPrecondition(
"BufferAllocation::Slice for instruction %s at index %s cannot "
"be determined at compile-time.",
instruction->name(), index.ToString());
}
} else {
VLOG(3) << "No allocation";
}
}
if (result.allocation() == nullptr) {
return FailedPrecondition(
"BufferAllocation::Slice not assigned for instruction %s at index %s",
instruction->name(), index.ToString());
}
return result;
}
StatusOr<BufferAllocation::Slice> BufferAssignment::GetUniqueTopLevelSlice(
const HloInstruction* instruction) const {
return GetUniqueSlice(instruction, /*index=*/{});
}
bool BufferAssignment::SharesSliceAtIndex(
const HloInstruction* hlo_a, const ShapeIndex& shape_index_a,
const HloInstruction* hlo_b, const ShapeIndex& shape_index_b) const {
return GetUniqueSlice(hlo_a, shape_index_a).ConsumeValueOrDie() ==
GetUniqueSlice(hlo_b, shape_index_b).ConsumeValueOrDie();
}
bool BufferAssignment::HaveDisjointSlices(const HloInstruction* hlo_a,
const HloInstruction* hlo_b) const {
using SliceSet =
FlatSet<BufferAllocation::Slice, BufferAllocation::Slice::Hasher>;
// Gets the slices all of instr's subshapes. If any subshape doesn't have an
// assigned slice, returns the empty set.
auto collect_slices = [&](const HloInstruction* instr) -> SliceSet {
SliceSet slices;
Status status = ShapeUtil::ForEachSubshapeWithStatus(
instr->shape(),
[&](const Shape& /*subshape*/, const ShapeIndex& index) {
auto shape_slices = GetAllSlices(instr, index);
if (shape_slices.empty()) {
return InvalidArgument("No slices assigned to part of instr.");
}
slices.insert(shape_slices.begin(), shape_slices.end());
return Status::OK();
});
if (!status.ok()) {
return {};
}
return slices;
};
SliceSet slices_a = collect_slices(hlo_a);
SliceSet slices_b = collect_slices(hlo_b);
// hlo_a and hlo_b have disjoint slices if collect_slices succeeded (i.e.
// didn't return the empty set) for both HLOs, and the two resulting sets of
// slices are disjoint.
return !slices_a.empty() && !slices_b.empty() &&
std::none_of(slices_a.begin(), slices_a.end(),
[&](const BufferAllocation::Slice& slice) {
return slices_b.count(slice) > 0;
});
}
StatusOr<BufferAllocation::Slice>
BufferAssignment::GetUniqueTopLevelOutputSlice() const {
return GetUniqueTopLevelSlice(
module_->entry_computation()->root_instruction());
}
BufferAllocation* BufferAssignment::NewEmptyAllocation(
int64 size, LogicalBuffer::Color color) {
BufferAllocation::Index index = allocations_.size();
allocations_.emplace_back(index, size, color);
BufferAllocation* allocation = &allocations_.back();
return allocation;
}
BufferAllocation* BufferAssignment::NewAllocation(const LogicalBuffer& buffer,
int64 size) {
BufferAllocation* allocation = NewEmptyAllocation(size, buffer.color());
AddAssignment(allocation, buffer, /*offset=*/0, size);
allocation->peak_buffers_.push_back(&buffer);
return allocation;
}
// Adds an instruction to the set assigned to the given buffer.
void BufferAssignment::AddAssignment(BufferAllocation* allocation,
const LogicalBuffer& buffer, int64 offset,
int64 size) {
CHECK_EQ(0, allocation_index_for_buffer_.count(&buffer))
<< "LogicalBuffer " << buffer << " already has an allocation.";
CHECK(allocation->is_reusable() || allocation->assigned_buffers().empty())
<< "Non-reusable allocation already assigned a buffer: "
<< allocation->ToString();
TF_CHECK_OK(points_to_analysis().VerifyBuffer(buffer));
allocation->AddAssignment(buffer, offset, size);
allocation_index_for_buffer_[&buffer] = allocation->index();
}
// Combines allocations of temporary buffers of the same color into one big
// BufferAllocation.
void BufferAssignment::CombineTempAllocations() {
VLOG(1) << "CombineTempAllocations()";
FlatMap<LogicalBuffer::Color, BufferAllocation, LogicalBuffer::Color::Hasher>
combined_allocation_map;
// Move all temp allocations into a single run at the end of the allocations
// vector.
const auto first_temp_it =
std::partition(allocations_.begin(), allocations_.end(),
[](const BufferAllocation& allocation) {
return !allocation.IsPreallocatedTempBuffer();
});
// Walk over the run of temp allocations, collecting the allocations belonging
// to the same color.
if (first_temp_it != allocations_.end()) {
for (auto it = first_temp_it; it != allocations_.end(); ++it) {
const BufferAllocation& temp_allocation = *it;
LogicalBuffer::Color color = temp_allocation.color();
auto combined_it = combined_allocation_map.find(color);
if (combined_it == combined_allocation_map.end()) {
// We have found the first temp allocation of this color. Collect
// the other temp allocations of the same color into it.
VLOG(1) << "Combined temp allocation for color " << color
<< " is: " << temp_allocation;
combined_allocation_map.emplace(color, temp_allocation);
continue;
}
auto* combined_allocation = &combined_it->second;
VLOG(1) << "Combined allocation absorbing temp allocation: "
<< temp_allocation;
// Each temp allocation is placed end-to-end, accounting for alignment.
// The offset of each buffer in the combined allocation is computed from
// the base offset of the allocation.
int64 alignment = color_alignment_(color);
const int64 base =
RoundUpToNearest(combined_allocation->size(), alignment);
combined_allocation->set_size(base + temp_allocation.size());
for (const auto& buffer_offset_size : temp_allocation.assigned_buffers_) {
const LogicalBuffer* buffer = buffer_offset_size.first;
const int64 offset = buffer_offset_size.second.offset;
const int64 size = buffer_offset_size.second.size;
combined_allocation->AddAssignment(*buffer, base + offset, size);
}
if (!temp_allocation.HeapTraces().empty()) {
CHECK_EQ(temp_allocation.HeapTraces().size(), 1);
combined_allocation->AddHeapTrace(temp_allocation.HeapTraces().front());
}
combined_allocation->peak_buffers_.insert(
combined_allocation->peak_buffers_.end(),
temp_allocation.peak_buffers_.begin(),
temp_allocation.peak_buffers_.end());
}
// Replace all existing temporary allocations with the new combined
// allocations.
allocations_.erase(first_temp_it, allocations_.end());
for (auto& combined : combined_allocation_map) {
allocations_.push_back(combined.second);
temp_allocation_total_size_ += combined.second.size();
}
}
// Update allocation indices to their new positions.
allocation_index_for_buffer_.clear_no_resize();
for (size_t index = 0; index < allocations_.size(); ++index) {
BufferAllocation* allocation = &allocations_[index];
allocation->set_index(index);
for (const auto& buffer_offset_size : allocation->assigned_buffers_) {
const LogicalBuffer* buffer = buffer_offset_size.first;
allocation_index_for_buffer_[buffer] = index;
}
}
}
Status BufferAssignment::ComputeSummaryStats() {
for (auto& allocation : Allocations()) {
if (allocation.is_entry_computation_parameter()) {
stats_.parameter_allocation_count++;
stats_.parameter_allocation_bytes += allocation.size();
}
if (allocation.is_constant()) {
stats_.constant_allocation_count++;
stats_.constant_allocation_bytes += allocation.size();
}
if (allocation.maybe_live_out()) {
stats_.maybe_live_out_allocation_count++;
stats_.maybe_live_out_allocation_bytes += allocation.size();
}
if (allocation.IsPreallocatedTempBuffer()) {
stats_.preallocated_temp_allocation_count++;
stats_.preallocated_temp_allocation_bytes += allocation.size();
}
stats_.total_allocation_count++;
stats_.total_allocation_bytes += allocation.size();
}
// Only compute total fragmentation if all computations have schedules.
HloSchedule schedule(module_);
bool schedule_complete = true;
for (const auto& computation : module_->computations()) {
if (!computation->IsFusionComputation()) {
const std::vector<const HloInstruction*>* sequence =
liveness_->hlo_ordering().SequentialOrder(*computation);
if (sequence == nullptr) {
schedule_complete = false;
} else {
schedule.set_sequence(computation, *sequence);
}
}
}
if (schedule_complete) {
TF_RETURN_IF_ERROR(schedule.Verify());
TF_ASSIGN_OR_RETURN(
const int64 min_size,
HeapSimulator::MinimumMemoryForModule(schedule, buffer_size_));
stats_.total_fragmentation_bytes = stats_.total_allocation_bytes - min_size;
}
return Status::OK();
}
string BufferAssignment::Stats::ToString() const {
string s;
StrAppendFormat(&s, "BufferAssignment stats:\n");
StrAppendFormat(&s, " parameter allocation: %10s\n",
HumanReadableNumBytes(parameter_allocation_bytes));
StrAppendFormat(&s, " constant allocation: %10s\n",
HumanReadableNumBytes(constant_allocation_bytes));
StrAppendFormat(&s, " maybe_live_out allocation: %10s\n",
HumanReadableNumBytes(maybe_live_out_allocation_bytes));
StrAppendFormat(&s, " preallocated temp allocation: %10s\n",
HumanReadableNumBytes(preallocated_temp_allocation_bytes));
if (preallocated_temp_fragmentation_bytes >= 0) {
const double percent = 100. * preallocated_temp_fragmentation_bytes /
preallocated_temp_allocation_bytes;
StrAppendFormat(
&s, " preallocated temp fragmentation: %10s (%.2f%%)\n",
HumanReadableNumBytes(preallocated_temp_fragmentation_bytes), percent);
}
StrAppendFormat(&s, " total allocation: %10s\n",
HumanReadableNumBytes(total_allocation_bytes));
if (total_fragmentation_bytes >= 0) {
const double percent =
100. * total_fragmentation_bytes / total_allocation_bytes;
StrAppendFormat(&s, " total fragmentation: %10s (%.2f%%)\n",
HumanReadableNumBytes(total_fragmentation_bytes), percent);
}
return s;
}
string BufferAssignment::ToString() const {
string output;
absl::StrAppend(&output, "BufferAssignment:\n");
for (auto& allocation : allocations_) {
absl::StrAppend(&output, allocation.ToString());
}
return output;
}
BufferAssignmentProto BufferAssignment::ToProto() const {
BufferAssignmentProto proto;
// NOTE: TuplePointsToAnalysis state is serialized here in BufferAssigment,
// because we need to do the HasAllocation check for each buffer. Otherwise
// the buffer_size_ call might fail for some backends.
const TuplePointsToAnalysis& points_to_analysis =
liveness_->points_to_analysis();
for (LogicalBuffer::Id id = 0; id < points_to_analysis.num_logical_buffers();
id++) {
auto& buffer = points_to_analysis.logical_buffer(id);
if (HasAllocation(buffer)) {
LogicalBufferProto proto_buffer = buffer.ToProto(buffer_size_);
proto.add_logical_buffers()->Swap(&proto_buffer);
// Fill buffer aliases.
for (const BufferAlias& alias :
points_to_analysis.GetBufferAliases(buffer)) {
if (alias.instruction() == buffer.instruction() &&
alias.index() == buffer.index()) {
continue; // skip self-aliases
}
BufferAssignmentProto::BufferAlias* proto_alias =
proto.add_buffer_aliases();
LogicalBufferProto::Location proto_alias_location =
BufferValue::ToLocationProto(*alias.instruction(), alias.index());
proto_alias->set_source_buffer_id(buffer.id());
proto_alias->mutable_location()->Swap(&proto_alias_location);
}
}
}
for (const BufferAllocation& allocation : Allocations()) {
BufferAllocationProto proto_allocation = allocation.ToProto();
proto.add_buffer_allocations()->Swap(&proto_allocation);
for (const HeapSimulatorTrace& heap_trace : allocation.HeapTraces()) {
*proto.add_heap_simulator_traces() = heap_trace;
}
}
return proto;
}
/* static */
StatusOr<std::unique_ptr<BufferAssignment>> BufferAssigner::Run(
const HloModule* module, std::unique_ptr<HloOrdering> hlo_ordering,
LogicalBuffer::SizeFunction buffer_size,
LogicalBuffer::AlignmentFunction color_alignment,
bool allow_input_output_aliasing, bool allocate_buffers_for_constants,
BufferLiveness::Colorer colorer) {
BufferAssigner assigner(allow_input_output_aliasing,
allocate_buffers_for_constants, std::move(colorer));
return assigner.CreateAssignment(module, std::move(hlo_ordering),
std::move(buffer_size),
std::move(color_alignment));
}
bool BufferAssigner::MaybeAssignBuffer(BufferAllocation* allocation,
const LogicalBuffer& buffer,
BufferAssignment* assignment) {
const LogicalBuffer::SizeFunction& buffer_size = assignment->buffer_size_;
CHECK(!assignment->HasAllocation(buffer))
<< "buffer " << buffer << " already has an allocation assigned.";
VLOG(4) << "Trying to assign " << buffer << " to allocation: " << *allocation;
if (buffer.color() != allocation->color()) {
VLOG(4) << "Can't assign: buffer has color" << buffer.color()
<< " and allocation has color " << allocation->color() << ".";
return false;
}
if (buffer_size(buffer) > allocation->size()) {
VLOG(4) << "Can't assign: buffer is larger than allocation ("
<< buffer_size(buffer) << " > " << allocation->size() << ")";
return false;
}
if (allocation->is_readonly()) {
VLOG(4) << "Can't assign: allocation is readonly";
return false;
}
if (!allocation->is_reusable()) {
VLOG(4) << "Can't assign: allocation is not reusable";
return false;
}
for (const auto& buffer_offset_size : allocation->assigned_buffers()) {
const LogicalBuffer& assigned_buffer = *buffer_offset_size.first;
if (assignment->liveness().MayInterfere(assigned_buffer, buffer)) {
VLOG(4) << "Can't assign: assignee " << assigned_buffer
<< " may interfere with " << buffer;
return false;
}
// Copy instruction don't share a buffer with their input operand.
if (buffer.instruction()->IsUserOf(assigned_buffer.instruction()) &&
buffer.instruction()->opcode() == HloOpcode::kCopy) {
VLOG(4) << "Can't assign: assignee " << assigned_buffer
<< " is used at copy instruction " << buffer;
return false;
}
}
if (allow_input_output_aliasing_ && allocation->maybe_live_out()) {
const HloComputation* entry_computation =
assignment->module_->entry_computation();
for (auto param : entry_computation->parameter_instructions()) {
for (auto& param_buffer :
assignment->points_to_analysis().GetBuffersDefinedByInstruction(
param)) {
if (assignment->liveness().MayInterfere(*param_buffer, buffer)) {
VLOG(4) << "Can't assign: Parameter interference with result";
return false;
}
}
}
}
// If the buffer is live out of the computation then it should only be
// assigned a buffer which exactly fits the result to avoid wasting memory
// (result buffers can have arbitrary lifetimes).
if (assignment->liveness().MaybeLiveOut(buffer) &&
allocation->size() != buffer_size(buffer)) {
VLOG(4) << "Can't assign: buffer " << buffer
<< "is live out and size not the same as allocation";
return false;
}
assignment->AddAssignment(allocation, buffer, /*offset=*/0,
buffer_size(buffer));
return true;
}
Status BufferAssigner::AssignBuffersForComputation(
const HloComputation* computation, bool is_thread_local,
const FlatSet<const LogicalBuffer*>& colocated_buffers,
const FlatSet<BufferAllocation::Index>& colocated_allocations,
FlatMap<const HloComputation*, FlatSet<const LogicalBuffer*>>*
buffers_to_assign_sequentially,
BufferAssignment* assignment) {
// Buffers are sorted and assigned to BufferAllocations in decreasing order of
// size.
std::vector<const LogicalBuffer*> sorted_buffers;
for (auto* instruction : computation->instructions()) {
// Add all buffers which this instruction defines. Instruction which don't
// define buffers (eg, bitcast which just forwards a pointer) don't need
// any allocations.
for (const LogicalBuffer* buffer :
assignment->points_to_analysis().GetBuffersDefinedByInstruction(
instruction)) {
sorted_buffers.push_back(buffer);
}
}
// Generate a post order sort of instructions for sorting of the
// LogicalBuffers.
FlatMap<const HloInstruction*, int> post_order_position;
int position = 0;
for (auto* instruction : computation->MakeInstructionPostOrder()) {
post_order_position.emplace(instruction, position);
position++;
}
// If there is a sequential instruction ordering, we'll delay assignment of
// temp buffers until after the main assignment loop.
const BufferLiveness& liveness = assignment->liveness();
const bool has_sequential_order =
liveness.hlo_ordering().SequentialOrder(*computation) != nullptr;
if (has_sequential_order && buffers_to_assign_sequentially != nullptr) {
// Every sequential computation must get an entry in the
// buffers_to_assign_sequentially map, even if we end up with an empty set
// of buffers. This ensures we can correctly determine whether to run
// whole-module heap simulation.
buffers_to_assign_sequentially->emplace(computation,
FlatSet<const LogicalBuffer*>());
}
// Sort the LogicalBuffers first by size. We assign the larger LogicalBuffers
// first for simplicity. This means any previously created BufferAllocation is
// necessarily large enough to hold the output of the current Buffer in
// consideration.
//
// As a secondary sorting criteria, if the instructions are sequentially
// ordered, we assign live-out buffers before others. Note that for sequential
// computations, we'll take temp buffers that can't re-use any allocations and
// assign them via a heap scheduler. By assigning live-out buffers first, we
// increase the odds that temp buffers can re-use an allocation.
//
// As a final tiebreaker use post order position of the HLO instruction which
// defines the buffer. This means an instruction will appear after its
// operands (assuming operands are the same/larger size) enabling the
// important reuse case where an elementwise instruction reuses one of its
// operand's buffer. This improves locality.
std::sort(sorted_buffers.begin(), sorted_buffers.end(),
[has_sequential_order, &liveness, &post_order_position, assignment](
const LogicalBuffer* a, const LogicalBuffer* b) {
// Primary sort is by decreasing buffer size.
const int64 a_size = assignment->buffer_size_(*a);
const int64 b_size = assignment->buffer_size_(*b);
if (a_size != b_size) {
return a_size > b_size; // use ">" for decreasing size.
}
// Otherwise live out buffers come before others, if the
// instructions are sequentially ordered.
if (has_sequential_order) {
const bool a_live_out = liveness.MaybeLiveOut(*a);
const bool b_live_out = liveness.MaybeLiveOut(*b);
if (a_live_out != b_live_out) {
return a_live_out;
}
}
// Final tiebreaker is in instruction post order.
return post_order_position.at(a->instruction()) <
post_order_position.at(b->instruction());
});
// BufferAllocations are necessarily created in decreasing size order. Keep
// indices of previously created BufferAllocations in allocation_indices.
std::vector<BufferAllocation::Index> allocation_indices;
for (const LogicalBuffer* buffer : sorted_buffers) {
VLOG(3) << "Assigning allocation to: " << *buffer;
if (colocated_buffers.count(buffer) > 0) {
// Colocated buffers are currently assigned in an earlier pass.
VLOG(3) << "Skipping colocated buffer: " << *buffer;
continue;
}
TF_RET_CHECK(!assignment->HasAllocation(*buffer));
const HloInstruction* instruction = buffer->instruction();
const int64 buffer_size = assignment->buffer_size_(*buffer);
if (instruction->opcode() == HloOpcode::kConstant) {
if (allocate_buffers_for_constants_) {
BufferAllocation* allocation =
assignment->NewAllocation(*buffer, buffer_size);
allocation->set_constant(true);
VLOG(3) << "New allocation #" << allocation->index() << " for constant "
<< *buffer;
}
continue;
}
const bool is_entry_parameter =
instruction->opcode() == HloOpcode::kParameter &&
computation == computation->parent()->entry_computation();
if (is_entry_parameter) {
// If the LogicalBuffer is part of an external parameter, creates a new
// allocation and sets its parameter number. Parameters of non-entry
// computations do not need special allocations because they live inside
// callers.
BufferAllocation* allocation =
assignment->NewAllocation(*buffer, buffer_size);
allocation->set_entry_computation_parameter(
instruction->parameter_number(), buffer->index());
VLOG(3) << "New allocation #" << allocation->index()
<< " for entry computation parameter: " << *buffer;
continue;
}
if (is_thread_local) {
BufferAllocation* allocation =
assignment->NewAllocation(*buffer, buffer_size);
allocation->set_is_thread_local(true);
VLOG(3) << "New allocation #" << allocation->index()
<< " for thread-local: " << *buffer;
continue;
}
if (ShapeUtil::IsTuple(buffer->shape())) {
BufferAllocation* allocation =
assignment->NewAllocation(*buffer, buffer_size);
allocation->set_is_tuple(true);
VLOG(3) << "New allocation #" << allocation->index()
<< " for tuple-shaped buffer: " << *buffer;
continue;
}
// First try to assign a LogicalBuffer to one of its operand allocations to
// improve locality. This is only possible with elementwise operations
// (checked in liveness analysis) which are necessarily top-level
// array-shaped buffers.
if (buffer->IsTopLevel() && !buffer->IsTuple()) {
for (auto* operand : instruction->operands()) {
bool assigned_operand = false;
for (const auto& operand_slice :
assignment->GetAllSlices(operand, /*index=*/{})) {
BufferAllocation* allocation =
assignment->GetMutableAllocation(operand_slice.index());
if (colocated_allocations.count(allocation->index()) == 0) {
// TODO(b/32491382) Colocated buffers are currently assigned in an
// earlier pass, and so can break the "increasing allocation size"
// invariant in this function (causing this CHECK to fail). However,
// the call to MaybeAssignBuffer is safe as it returns false if
// allocation.size < buffer.size.
CHECK_GE(allocation->size(), buffer_size);
}
if (MaybeAssignBuffer(allocation, *buffer, assignment)) {
VLOG(3) << "Reusing (operand) allocation #" << allocation->index()
<< " for: " << *buffer;
assigned_operand = true;
break;
}
}
if (assigned_operand) {
break;
}
}
}
if (!assignment->HasAllocation(*buffer)) {
// Find the smallest buffer which can be reused iterating from end of
// allocation_indices (smallest) to beginning (largest).
for (int allocation_index = allocation_indices.size() - 1;
allocation_index >= 0; allocation_index--) {
BufferAllocation* allocation = assignment->GetMutableAllocation(
allocation_indices[allocation_index]);
// Instructions are iterated in increasing buffer size, so any
// previously create allocation must be large enough to hold this
// instruction's output (with the exception of colocated buffers).
if (colocated_allocations.count(allocation->index()) == 0) {
// TODO(b/32491382) Colocated buffers are currently assigned in an
// earlier pass, and so can break the "increasing allocation size"
// invariant in this function (causing this CHECK to fail). However,
// the call to MaybeAssignBuffer is safe as it returns false if
// allocation.size < buffer.size.
CHECK_GE(allocation->size(), buffer_size);
}
if (MaybeAssignBuffer(allocation, *buffer, assignment)) {
VLOG(3) << "Reusing allocation #" << allocation->index()
<< " for: " << *buffer;
break;
}
}
}
if (!assignment->HasAllocation(*buffer) && has_sequential_order &&
!liveness.MaybeLiveOut(*buffer)) {
// There is a sequential instruction ordering, so we delay assignment of
// temp buffers until after the loop. We do this right before we decide to
// create a new allocation, to ensure we've exhausted all the buffer
// re-use cases above.
//
// Entry parameters and thread local buffers were already handled earlier
// in this loop iteration. See BufferAllocation::IsPreallocatedTempBuffer
// for the definition of temp buffers.
CHECK(!is_entry_parameter) << *buffer;
CHECK(!is_thread_local) << *buffer;
(*buffers_to_assign_sequentially)[computation].insert(buffer);
VLOG(3) << "Delaying assignment of temp buffer: " << *buffer;
continue;
}
if (!assignment->HasAllocation(*buffer)) {
BufferAllocation* allocation =
assignment->NewAllocation(*buffer, buffer_size);
allocation_indices.push_back(allocation->index());
VLOG(3) << "New allocation #" << allocation->index()
<< " for: " << *buffer;
}
}
return Status::OK();
}
FlatMap<LogicalBuffer::Color, FlatSet<const LogicalBuffer*>,
LogicalBuffer::Color::Hasher>
BufferAssigner::SplitBuffersByColor(
const FlatSet<const LogicalBuffer*>& buffers) {
FlatMap<LogicalBuffer::Color, FlatSet<const LogicalBuffer*>,
LogicalBuffer::Color::Hasher>
color_map;
for (auto buffer : buffers) {
color_map[buffer->color()].insert(buffer);
}
return color_map;
}
Status BufferAssigner::AssignBuffersWithSequentialOrdering(
const FlatMap<const HloComputation*, FlatSet<const LogicalBuffer*>>&
buffers_to_assign_sequentially,
bool run_whole_module_heap_simulation, BufferAssignment* assignment) {
// Run the sequence of instructions through the heap simulator. The heuristic
// that seems to give the best results is lazy-best-fit, with all runs of
// alloc / free calls sorted in decreasing size order.
const HloOrdering& hlo_ordering = assignment->liveness().hlo_ordering();
// Returns a heap algorithm that chooses the best result from several
// algorithms.
auto get_heap_algorithm = [&](int64 alignment) {
auto algorithms =
absl::make_unique<std::vector<std::unique_ptr<HeapAlgorithm>>>();
algorithms->push_back(absl::make_unique<DecreasingSizeRunsHeap>(
absl::make_unique<LazyBestFitHeap>(alignment)));
algorithms->push_back(
absl::make_unique<GlobalDecreasingSizeBestFitHeap>(alignment));
return absl::make_unique<ChooseBestHeapAlgorithm>(std::move(algorithms));
};
if (run_whole_module_heap_simulation) {
// Run the heap simulation over the whole module. This reduces memory usage,
// since buffers for kCall, kWhile, and kConditional sub-computations are
// only live for the duration of their calling instructions.
VLOG(1) << "Running whole-module heap simulation";
HloSchedule schedule(&assignment->module());
FlatSet<const LogicalBuffer*> all_buffers_to_assign;
for (const auto& pair : buffers_to_assign_sequentially) {
const HloComputation* computation = pair.first;
const FlatSet<const LogicalBuffer*>& buffers_to_assign = pair.second;
const std::vector<const HloInstruction*>* instruction_sequence =
hlo_ordering.SequentialOrder(*computation);
CHECK(instruction_sequence != nullptr) << computation->name();
schedule.set_sequence(computation, *instruction_sequence);
all_buffers_to_assign.insert(buffers_to_assign.begin(),
buffers_to_assign.end());
}
auto color_map = SplitBuffersByColor(all_buffers_to_assign);
for (auto& single_colored_set : color_map) {
auto color = single_colored_set.first;
VLOG(2) << "Simulating heap for color " << color;
int64 alignment = assignment->color_alignment_(color);
HeapSimulator::Options options;
options.alloc_constants = allocate_buffers_for_constants_;
BufferValueFlatSet buffer_value_set =
ToBufferValueFlatSet(single_colored_set.second);
options.buffers_to_assign = &buffer_value_set;
TF_ASSIGN_OR_RETURN(
const HeapSimulator::Result result,
HeapSimulator::Run(get_heap_algorithm(alignment),
assignment->module(), schedule,
assignment->points_to_analysis(),
assignment->buffer_size_, options));
AssignBuffersFromHeapSimulator(result, assignment,
single_colored_set.first);
}
} else {
// Run the heap-simulation on a per-computation basis. Buffers for
// sub-computations are assigned disjoint BufferAllocations, assuming the
// worst-case that they may all be live concurrently.
VLOG(1) << "Running per-computation heap simulation";
for (const auto& pair : buffers_to_assign_sequentially) {
const HloComputation* computation = pair.first;
const FlatSet<const LogicalBuffer*>& buffers_to_assign = pair.second;
const std::vector<const HloInstruction*>* instruction_sequence =
hlo_ordering.SequentialOrder(*computation);
CHECK(instruction_sequence != nullptr) << computation->name();
auto color_map = SplitBuffersByColor(buffers_to_assign);
for (auto& single_colored_set : color_map) {
auto color = single_colored_set.first;
VLOG(2) << "Simulating heap for color " << color;
int64 alignment = assignment->color_alignment_(color);
HeapSimulator::Options options;
BufferValueFlatSet buffer_value_set =
ToBufferValueFlatSet(single_colored_set.second);
options.buffers_to_assign = &buffer_value_set;
TF_ASSIGN_OR_RETURN(
const HeapSimulator::Result result,
HeapSimulator::Run(get_heap_algorithm(alignment), *computation,
HloInstructionSequence(*instruction_sequence),
assignment->points_to_analysis(),
assignment->buffer_size_, options));
AssignBuffersFromHeapSimulator(result, assignment,
single_colored_set.first);
}
}
}
return Status::OK();
}
namespace {
// Computes and returns the set of logical buffers live at the point of maximal
// liveness in the given heap trace. LogicalBuffers are (stabily) sorted by id.
std::vector<const LogicalBuffer*> ComputePeakMemoryLogicalBuffers(
const BufferAllocation& allocation, const HeapSimulatorTrace& heap_trace) {
// Create a map from LogicalBuffer::Id to LogicalBuffer* for the logical
// buffers in this allocation.
tensorflow::gtl::FlatMap<LogicalBuffer::Id, const LogicalBuffer*>
id_to_buffer;
tensorflow::gtl::FlatMap<const LogicalBuffer*, int64> buffer_sizes;
for (const auto& pair : allocation.assigned_buffers()) {
const LogicalBuffer* buffer = pair.first;
const BufferAllocation::OffsetSize& offset_size = pair.second;
id_to_buffer[buffer->id()] = buffer;
buffer_sizes[buffer] = offset_size.size;
}
// Returns how much the given event increases the total size of live
// buffers. Can be negative.
auto memory_delta = [&id_to_buffer, &buffer_sizes](
const HeapSimulatorTrace::Event& event) -> int64 {
const LogicalBuffer* buffer = id_to_buffer.at(event.buffer_id());
const int64 buffer_size = buffer_sizes.at(buffer);
if (event.kind() == HeapSimulatorTrace::Event::ALLOC) {
return buffer_size;
} else if (event.kind() == HeapSimulatorTrace::Event::SHARE_WITH) {
// Sharing a buffer does not change the live set size for the purposes of
// the heap simulator. Even though the shared-with buffer may be smaller,
// the entire allocation remains live.
return 0;
} else if (event.kind() == HeapSimulatorTrace::Event::FREE) {
return -1 * buffer_size;
}
LOG(FATAL) << "Unknown event kind: " << event.kind();
};
// First compute the size of the maximal live set.
int64 max_live_size = 0;
int64 live_size = 0;
for (const auto& event : heap_trace.events()) {
live_size += memory_delta(event);
if (max_live_size < live_size) {
max_live_size = live_size;
}
}
// Next gather the set of logical buffers live at the earliest point of
// maximal live set size.
tensorflow::gtl::FlatSet<const LogicalBuffer*> live_buffers;
live_size = 0;
for (const auto& event : heap_trace.events()) {
const LogicalBuffer* buffer = id_to_buffer.at(event.buffer_id());
if (event.kind() == HeapSimulatorTrace::Event::ALLOC) {
InsertOrDie(&live_buffers, buffer);
} else if (event.kind() == HeapSimulatorTrace::Event::SHARE_WITH) {
// Nothing to do.
} else if (event.kind() == HeapSimulatorTrace::Event::FREE) {
CHECK(ContainsKey(live_buffers, buffer));
live_buffers.erase(buffer);
}
live_size += memory_delta(event);
if (live_size == max_live_size) {
break;
}
}
CHECK_EQ(live_size, max_live_size);
std::vector<const LogicalBuffer*> live_buffers_vector;
live_buffers_vector.insert(live_buffers_vector.end(), live_buffers.begin(),
live_buffers.end());
// Stabily sort the live buffers.
std::sort(live_buffers_vector.begin(), live_buffers_vector.end(),
[](const LogicalBuffer* a, const LogicalBuffer* b) {
return a->id() < b->id();
});
return live_buffers_vector;
}
} // namespace
void BufferAssigner::AssignBuffersFromHeapSimulator(
const HeapSimulator::Result& result, BufferAssignment* assignment,
LogicalBuffer::Color color) {
if (assignment->stats_.preallocated_temp_fragmentation_bytes == -1) {
assignment->stats_.preallocated_temp_fragmentation_bytes =
result.fragmentation_size;
} else {
assignment->stats_.preallocated_temp_fragmentation_bytes +=
result.fragmentation_size;
}
BufferAllocation* allocation =
assignment->NewEmptyAllocation(result.heap_size, color);
for (const auto& buffer_chunk : result.chunk_map) {
// TODO(lauj) Remove this down_cast after downstream users of
// BufferAllocation::assigned_buffers() are updated to use BufferValue.
const LogicalBuffer& buffer =
*CHECK_NOTNULL(dynamic_cast<const LogicalBuffer*>(buffer_chunk.first));
const HeapSimulator::Chunk& chunk = buffer_chunk.second;
assignment->AddAssignment(allocation, buffer, chunk.offset, chunk.size);
}
allocation->peak_buffers_ =
ComputePeakMemoryLogicalBuffers(*allocation, result.debug_trace);
VLOG(1) << "Ran heap simulation for allocation: " << allocation->ToString();
allocation->AddHeapTrace(result.debug_trace);
}
// Adds the 'colocated_set' of buffers to 'colocated_buffer_sets', maintaining
// the invariant that all sets in 'colocated_buffer_sets' are disjoint.
//
// A practical example of when this is necessary is a chain of kCall ops:
// computation.entry
// %a = call() -> computation.1
// computation.1
// %b = call() -> computation.2
// computation.2
// %c = parameter()
// This yields the logical sets {%a,%b} {%b,%c} {%c}, which need to be merged
// into a single set {%a,%b,%c}
void BufferAssigner::AddSetToColocatedBufferSets(
const std::vector<const LogicalBuffer*>& colocated_set,
std::vector<ColocatedBufferSet>* colocated_buffer_sets) {
if (colocated_set.empty()) {
return;
}
VLOG(5) << ColocatedBufferSetsToString(colocated_set,
"Adding colocated buffer set");
// Find existing sets that overlap with at least one buffer from the
// colocated_set. The resulting 'overlap_set_indices' will have at most
// colocated_buffer_sets->size() entries, and will be in increasing order.
std::vector<size_t> overlap_set_indices;
for (size_t index = 0; index < colocated_buffer_sets->size(); ++index) {
for (const LogicalBuffer* buffer : colocated_set) {
if ((*colocated_buffer_sets)[index].count(buffer) > 0) {
VLOG(5) << "Found overlap with existing set on buffer "
<< buffer->ToString() << "\n"
<< ColocatedBufferSetsToString((*colocated_buffer_sets)[index],
"Overlapping set");
overlap_set_indices.push_back(index);
break;
}
}
}
// If there is no overlap with existing sets, create a new set.
if (overlap_set_indices.empty()) {
colocated_buffer_sets->emplace_back();
colocated_buffer_sets->back().insert(colocated_set.begin(),
colocated_set.end());
VLOG(5) << "No overlap found, new group created";
return;
}
// Merge all overlap sets and the colocated set into the first overlap set.
ColocatedBufferSet* first = &(*colocated_buffer_sets)[overlap_set_indices[0]];
for (size_t index = 1; index < overlap_set_indices.size(); ++index) {
const ColocatedBufferSet& overlap_set =
(*colocated_buffer_sets)[overlap_set_indices[index]];
first->insert(overlap_set.begin(), overlap_set.end());
}
first->insert(colocated_set.begin(), colocated_set.end());
VLOG(5) << ColocatedBufferSetsToString(
*first, "Result of the colocated buffer set merging");
// Remove overlap sets that we just merged. The offset accounts for the fact
// that as elements are erased, the indices need to be adjusted. Keep in mind
// that overlap_set_indices is in increasing order.
for (size_t index = 1; index < overlap_set_indices.size(); ++index) {
const size_t offset = overlap_set_indices[index] - index + 1;
colocated_buffer_sets->erase(colocated_buffer_sets->begin() + offset);
}
}
std::vector<BufferAssigner::ColocatedBufferSet>
BufferAssigner::MergeColocatedBufferSets(
const std::vector<ColocatedBufferSet>& colocated_buffer_sets,
const BufferLiveness& buffer_liveness,
const LogicalBuffer::SizeFunction& buffer_size) {
VLOG(1) << "colocation sets count before coalescing:"
<< colocated_buffer_sets.size();
// Returns true if the given buffer is for the entry parameter.
auto is_entry_parameter = [](const LogicalBuffer& buffer) {
auto* instruction = buffer.instruction();
auto* computation = instruction->parent();
auto* module = computation->parent();
return instruction->opcode() == HloOpcode::kParameter &&
computation == module->entry_computation();
};
// Returns true if the two colocated buffer sets (specified by their indices
// into the colocated_buffer_sets) can be merged into a single set.
auto cannot_merge_buffer_sets = [&colocated_buffer_sets, &buffer_liveness,
&buffer_size,
&is_entry_parameter](int64 i, int64 j) {
// Do not merge if one of the sets includes live outs, entry parameters or
// constants.
//
// Buffer liveness does not report the correct live range for entry
// parameter and live out buffers so we have to special case them here. On
// backends that support constant buffer allocations, constant buffers are
// assigned globals in readonly storage so we can't merge colocated buffer
// sets containing constants with colocated buffer sets containing writing
// instructions or other constants.
//
// Moreover (on the CPU/GPU backends) the entry parameter buffers belong to
// the caller of the executable so we can't write to entry parameters
// either, and the argument for not merging constants also applies to entry
// parameters.
for (int64 key : {i, j}) {
for (auto& buffer : colocated_buffer_sets[key]) {
if (buffer_liveness.MaybeLiveOut(*buffer) ||
is_entry_parameter(*buffer) ||
buffer->instruction()->opcode() == HloOpcode::kConstant) {
return true;
}
}
}
// Colocated sets satisfy the invariant that all buffers within a set have
// the same size. That means we need to check whether the size is the same
// between the two sets, but also that it's enough to look at just one
// buffer within each set.
if (buffer_size(**colocated_buffer_sets[i].begin()) !=
buffer_size(**colocated_buffer_sets[j].begin())) {
return true;
}
// Do not merge if some pair of buffers interferes with each other.
for (auto& buffer_a : colocated_buffer_sets[i]) {
for (auto& buffer_b : colocated_buffer_sets[j]) {
if (buffer_a->id() != buffer_b->id() &&
buffer_liveness.MayInterfere(*buffer_a, *buffer_b)) {
return true;
}
}
}
return false;
};
// Build the interference map among the colocated buffer sets (nodes), by
// adding an edge between any two nodes that cannot be merged into a single
// colocated buffer set.
std::vector<std::vector<int64>> interference_map(
colocated_buffer_sets.size());
for (int64 i = 0; i < colocated_buffer_sets.size(); ++i) {
for (int64 j = i + 1; j < colocated_buffer_sets.size(); ++j) {
if (cannot_merge_buffer_sets(i, j)) {
interference_map[i].push_back(j);
interference_map[j].push_back(i);
}
}
}
// Assign a color to each colocation set in colocated_buffer_sets, such that
// the sets that can be merged are assigned with the same color.
auto assigned_colors = ColorInterferenceGraph(interference_map);
// Merge the buffer sets with the same color.
CHECK(!assigned_colors.empty());
int64 num_sets =
*std::max_element(assigned_colors.begin(), assigned_colors.end()) + 1;
std::vector<ColocatedBufferSet> new_colocated_buffer_sets(num_sets);
for (int64 i = 0; i < colocated_buffer_sets.size(); ++i) {
const auto& buffer_set = colocated_buffer_sets[i];
new_colocated_buffer_sets[assigned_colors[i]].insert(buffer_set.begin(),
buffer_set.end());
}
VLOG(1) << "colocation sets count after coalescing:"
<< colocated_buffer_sets.size();
return new_colocated_buffer_sets;
}
// Builds sets of buffers in 'colocated_buffer_sets' which should be colocated
// in the same allocation (currently just supports kWhile, kCall, and
// kConditional).
void BufferAssigner::BuildColocatedBufferSets(
const HloModule* module, const BufferLiveness& buffer_liveness,
const LogicalBuffer::SizeFunction& buffer_size,
std::vector<ColocatedBufferSet>* colocated_buffer_sets) {
const TuplePointsToAnalysis& points_to_analysis =
buffer_liveness.points_to_analysis();
for (const HloComputation* computation : module->MakeComputationPostOrder()) {
if (computation->IsFusionComputation()) {
continue;
}
for (const HloInstruction* instruction :
computation->MakeInstructionPostOrder()) {
const HloOpcode opcode = instruction->opcode();
if (opcode == HloOpcode::kWhile) {
const HloInstruction* while_hlo = instruction;
ShapeUtil::ForEachSubshape(
while_hlo->shape(),
[this, while_hlo, &points_to_analysis, buffer_size,
colocated_buffer_sets](const Shape& /*subshape*/,
const ShapeIndex& index) {
std::vector<const LogicalBuffer*> colocated_set;
// Add while.init.
AddBufferToColocatedSet(while_hlo->operand(0), index,
points_to_analysis, &colocated_set);
// Add while.result.
AddBufferToColocatedSet(while_hlo, index, points_to_analysis,
&colocated_set);
// Add while.cond.parameter.
AddBufferToColocatedSet(
while_hlo->while_condition()->parameter_instruction(0), index,
points_to_analysis, &colocated_set);
// Add while.body.parameter.
AddBufferToColocatedSet(
while_hlo->while_body()->parameter_instruction(0), index,
points_to_analysis, &colocated_set);
// Add while.body.root.
AddBufferToColocatedSet(
while_hlo->while_body()->root_instruction(), index,
points_to_analysis, &colocated_set);
AddSetToColocatedBufferSets(colocated_set, colocated_buffer_sets);
});
} else if (opcode == HloOpcode::kCall) {
const HloInstruction* call_hlo = instruction;
const HloComputation* callee = call_hlo->to_apply();
const HloInstruction* root_hlo = callee->root_instruction();
for (int64 i = 0; i < call_hlo->operand_count(); i++) {
const HloInstruction* call_param = callee->parameter_instruction(i);
const HloInstruction* call_operand = call_hlo->operand(i);
ShapeUtil::ForEachSubshape(
call_operand->shape(),
[&](const Shape& /*subshape*/, const ShapeIndex& index) {
std::vector<const LogicalBuffer*> colocated_set;
AddBufferToColocatedSet(call_param, index, points_to_analysis,
&colocated_set);
AddBufferToColocatedSet(call_operand, index, points_to_analysis,
&colocated_set);
AddSetToColocatedBufferSets(colocated_set,
colocated_buffer_sets);
});
}
ShapeUtil::ForEachSubshape(
call_hlo->shape(),
[this, call_hlo, root_hlo, &points_to_analysis,
colocated_buffer_sets](const Shape& /*subshape*/,
const ShapeIndex& index) {
std::vector<const LogicalBuffer*> colocated_set;
// Add call.result.
AddBufferToColocatedSet(call_hlo, index, points_to_analysis,
&colocated_set);
// Add call.subcomputation.root.
AddBufferToColocatedSet(root_hlo, index, points_to_analysis,
&colocated_set);
AddSetToColocatedBufferSets(colocated_set, colocated_buffer_sets);
});
} else if (opcode == HloOpcode::kConditional) {
const HloInstruction* conditional_hlo = instruction;
ShapeUtil::ForEachSubshape(
conditional_hlo->shape(),
[this, conditional_hlo, &points_to_analysis, colocated_buffer_sets](
const Shape& /*subshape*/, const ShapeIndex& index) {
std::vector<const LogicalBuffer*> colocated_set;
// Add conditional.result.
AddBufferToColocatedSet(conditional_hlo, index,
points_to_analysis, &colocated_set);
// Add conditional.true_computation.root.
AddBufferToColocatedSet(
conditional_hlo->true_computation()->root_instruction(),
index, points_to_analysis, &colocated_set);
// Add conditional.false_computation.root.
AddBufferToColocatedSet(
conditional_hlo->false_computation()->root_instruction(),
index, points_to_analysis, &colocated_set);
AddSetToColocatedBufferSets(colocated_set, colocated_buffer_sets);
});
// Add true_operand and conditional.true_computation.parameter(0) as a
// colocated buffer set. Note that this has to be done for each subshape
// in the true_operand of the conditional.
ShapeUtil::ForEachSubshape(
conditional_hlo->operand(1)->shape(),
[this, conditional_hlo, &points_to_analysis, colocated_buffer_sets](
const Shape& /*subshape*/, const ShapeIndex& index) {
std::vector<const LogicalBuffer*> true_set;
// Add conditional.true_operand.
AddBufferToColocatedSet(conditional_hlo->operand(1), index,
points_to_analysis, &true_set);
// Add conditional.true_computation.parameter_instruction(0).
AddBufferToColocatedSet(
conditional_hlo->true_computation()->parameter_instruction(0),
index, points_to_analysis, &true_set);
AddSetToColocatedBufferSets(true_set, colocated_buffer_sets);
});
// Add false_operand and conditional.false_computation.parameter(0) as a
// colocated buffer set. Note that this has to be done for each subshape
// in the false_operand of the conditional.
ShapeUtil::ForEachSubshape(
conditional_hlo->operand(2)->shape(),
[this, conditional_hlo, &points_to_analysis, colocated_buffer_sets](
const Shape& /*subshape*/, const ShapeIndex& index) {
std::vector<const LogicalBuffer*> false_set;
// Add conditional.false_operand.
AddBufferToColocatedSet(conditional_hlo->operand(2), index,
points_to_analysis, &false_set);
// Add conditional.false_computation.parameter_instruction(0).
AddBufferToColocatedSet(
conditional_hlo->false_computation()->parameter_instruction(
0),
index, points_to_analysis, &false_set);
AddSetToColocatedBufferSets(false_set, colocated_buffer_sets);
});
}
}
}
if (colocated_buffer_sets->empty()) {
return;
}
// Try to find more coalescing opportunities among the colocated buffer sets.
//
// TODO(b/32491382): We should be able to remove this by using the
// module-level liveness analysis, which would let us directly detect buffer
// sharing opportunities between the while instruction buffer and the buffers
// from the predicate and body computation, as well as sharing across
// different while instructions.
std::vector<ColocatedBufferSet> new_colocated_buffer_sets =
MergeColocatedBufferSets(*colocated_buffer_sets, buffer_liveness,
buffer_size);
std::swap(*colocated_buffer_sets, new_colocated_buffer_sets);
}
// Assigns all colocated buffer sets in 'colocated_buffer_sets' to the same
// allocation in 'assignment'.
void BufferAssigner::AssignColocatedBufferSets(
const std::vector<ColocatedBufferSet>& colocated_buffer_sets,
BufferAssignment* assignment,
FlatSet<const LogicalBuffer*>* colocated_buffers,
FlatSet<BufferAllocation::Index>* colocated_allocations) {
for (const ColocatedBufferSet& colocated_buffer_set : colocated_buffer_sets) {
BufferAllocation* allocation = nullptr;
// Set 'entry_parameter_number' and 'entry_parameter_shape_idx' if entry
// param in 'colocated_buffer_set'.
int64 entry_parameter_number = -1;
const ShapeIndex* entry_parameter_shape_idx = nullptr;
bool is_constant = false;
for (const LogicalBuffer* buffer : colocated_buffer_set) {
const HloInstruction* instruction = buffer->instruction();
const HloComputation* computation = instruction->parent();
if (instruction->opcode() == HloOpcode::kParameter &&
computation == computation->parent()->entry_computation()) {
entry_parameter_number = instruction->parameter_number();
entry_parameter_shape_idx = &buffer->index();
} else if (instruction->opcode() == HloOpcode::kConstant) {
is_constant = true;
}
}
CHECK(!is_constant || entry_parameter_number == -1)
<< "Copy insertion should have inserted copies to prevent this.";
for (const LogicalBuffer* buffer : colocated_buffer_set) {
const int64 buffer_size = assignment->buffer_size_(*buffer);
if (allocation == nullptr) {
// TODO(b/32491382) Avoid current trivial solution of using new
// allocations for each colocated buffer set. When liveness has
// module-level scope, we can allow buffers to be shared across
// computations (in some cases).
allocation = assignment->NewAllocation(*buffer, buffer_size);
if (entry_parameter_number >= 0) {
allocation->set_entry_computation_parameter(
entry_parameter_number, *entry_parameter_shape_idx);
}
if (is_constant) {
allocation->set_constant(true);
}
colocated_allocations->insert(allocation->index());
} else {
CHECK_EQ(buffer_size, allocation->size())
<< "Buffer: " << *buffer << " size mismatch in colocated buffer "
<< "allocation: " << *allocation;
assignment->AddAssignment(allocation, *buffer, /*offset=*/0,
buffer_size);
}
colocated_buffers->insert(buffer);
}
}
}
StatusOr<std::unique_ptr<BufferAssignment>> BufferAssigner::CreateAssignment(
const HloModule* module, std::unique_ptr<HloOrdering> hlo_ordering,
LogicalBuffer::SizeFunction buffer_size,
LogicalBuffer::AlignmentFunction color_alignment) {
TF_ASSIGN_OR_RETURN(std::unique_ptr<BufferLiveness> liveness,
BufferLiveness::Run(module, std::move(hlo_ordering)));
VLOG(1) << "Assigning buffers to module " << module->name();
XLA_VLOG_LINES(2, module->ToString());
XLA_VLOG_LINES(3, liveness->ToString());
XLA_VLOG_LINES(3, liveness->points_to_analysis().ToString());
// Can't use absl::make_unique because BufferAssignment constructor is
// private.
std::unique_ptr<BufferAssignment> assignment(
new BufferAssignment(module, std::move(liveness), std::move(buffer_size),
std::move(color_alignment)));
// Assign buffers with the tightest constraints first (colocated buffer sets).
// Once b/32491382 enables module-level liveness analysis, we may be able
// to assign colocated buffers (or at least reuse their allocation for
// buffers outside of the set) in AssignBuffersForComputation.
FlatSet<const LogicalBuffer*> colocated_buffers;
FlatSet<BufferAllocation::Index> colocated_allocations;
std::vector<ColocatedBufferSet> colocated_buffer_sets;
BuildColocatedBufferSets(module, assignment->liveness(),
assignment->buffer_size_, &colocated_buffer_sets);
TF_RETURN_IF_ERROR(colorer_(assignment->liveness()));
VLOG(3) << "After coloring:";
XLA_VLOG_LINES(3, assignment->points_to_analysis().ToString());
AssignColocatedBufferSets(colocated_buffer_sets, assignment.get(),
&colocated_buffers, &colocated_allocations);
std::vector<const HloComputation*> thread_local_computations;
std::vector<const HloComputation*> global_computations;
TF_RETURN_IF_ERROR(GatherComputationsByAllocationType(
module, &thread_local_computations, &global_computations));
// First assign buffers for global computatations. Temporary buffers for
// sequential computations are collected in 'buffers_to_assign_sequentially'.
FlatMap<const HloComputation*, FlatSet<const LogicalBuffer*>>
buffers_to_assign_sequentially;
for (auto* computation : global_computations) {
TF_RETURN_IF_ERROR(AssignBuffersForComputation(
computation,
/*is_thread_local=*/false, colocated_buffers, colocated_allocations,
&buffers_to_assign_sequentially, assignment.get()));
}
// Assign buffers with sequential ordering, if any. If all global computations
// are sequential, we can run heap simuation on the whole module, which
// reduces memory usage.
const bool run_whole_module_heap_simulation =
buffers_to_assign_sequentially.size() == global_computations.size();
TF_RETURN_IF_ERROR(AssignBuffersWithSequentialOrdering(
buffers_to_assign_sequentially, run_whole_module_heap_simulation,
assignment.get()));
// Now assign buffers for thread-local computations. All LogicalBuffers get
// their own BufferAllocation.
for (auto* computation : thread_local_computations) {
TF_RET_CHECK(computation != module->entry_computation());
if (computation->IsFusionComputation()) {
continue;
}
TF_RETURN_IF_ERROR(AssignBuffersForComputation(
computation,
/*is_thread_local=*/true, colocated_buffers, colocated_allocations,
/*buffers_to_assign_sequentially=*/nullptr, assignment.get()));
}
// Mark all buffers which may be live out of the entry computation as
// "liveout".
for (const LogicalBuffer* buffer :
assignment->liveness().maybe_live_out_buffers()) {
VLOG(3) << "maybe_live_out LogicalBuffer: " << *buffer;
if (assignment->HasAllocation(*buffer)) {
BufferAllocation* alloc =
assignment->GetMutableAssignedAllocation(*buffer);
alloc->set_maybe_live_out(true);
VLOG(3) << "maybe_live_out BufferAllocation: " << *alloc;
}
}
// Combines allocations of temporary buffers into one big BufferAllocation.
// This can only be performed after all buffers have been assigned, and after
// maybe_live_out is marked, since it is used to determine whether an
// allocation contains temporary buffers or not.
assignment->CombineTempAllocations();
XLA_VLOG_LINES(2, assignment->ToString());
TF_RETURN_IF_ERROR(assignment->ComputeSummaryStats());
XLA_VLOG_LINES(1, assignment->GetStats().ToString());
return std::move(assignment);
}
} // namespace xla
| {
"content_hash": "3e727e95cb207a8ffe1765fa07e2cfc0",
"timestamp": "",
"source": "github",
"line_count": 1724,
"max_line_length": 80,
"avg_line_length": 43.31264501160093,
"alnum_prop": 0.6516586090985791,
"repo_name": "kobejean/tensorflow",
"id": "34a7be0e9c079e9e42c28eef10af4079e99853b6",
"size": "75339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/compiler/xla/service/buffer_assignment.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "2867"
},
{
"name": "Batchfile",
"bytes": "9258"
},
{
"name": "C",
"bytes": "341894"
},
{
"name": "C#",
"bytes": "8446"
},
{
"name": "C++",
"bytes": "49273038"
},
{
"name": "CMake",
"bytes": "195712"
},
{
"name": "Dockerfile",
"bytes": "36400"
},
{
"name": "Go",
"bytes": "1253646"
},
{
"name": "HTML",
"bytes": "4680032"
},
{
"name": "Java",
"bytes": "836009"
},
{
"name": "Jupyter Notebook",
"bytes": "2604741"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Makefile",
"bytes": "52734"
},
{
"name": "Objective-C",
"bytes": "15650"
},
{
"name": "Objective-C++",
"bytes": "99243"
},
{
"name": "PHP",
"bytes": "1357"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "PureBasic",
"bytes": "25356"
},
{
"name": "Python",
"bytes": "41122917"
},
{
"name": "Ruby",
"bytes": "553"
},
{
"name": "Shell",
"bytes": "466896"
},
{
"name": "Smarty",
"bytes": "6976"
}
],
"symlink_target": ""
} |
package reactivemongo
import java.util.Arrays
import akka.util.ByteString
import org.specs2.mutable._
import reactivemongo.bson._
import reactivemongo.bson.BSONObjectID
import reactivemongo.bson.utils.Converters
import reactivemongo.core.netty._
class BsonSpec extends Specification {
val simple = Array[Byte](0x16, 0x00, 0x00, 0x00, 0x02, 'h', 'e', 'l', 'l', 'o', 0x00, 0x06, 0x00, 0x00, 0x00, 'w', 'o', 'r', 'l', 'd', 0x00, 0x00)
val embeddingArray = Array[Byte](70, 0, 0, 0, 7, 95, 105, 100, 0, 80, 55, -110, -63, -104, 69, -121, -105, 27, 20, 83, 14, 4, 66, 83, 79, 78, 0, 42, 0, 0, 0, 2, 48, 0, 8, 0, 0, 0, 97, 119, 101, 115, 111, 109, 101, 0, 1, 49, 0, 51, 51, 51, 51, 51, 51, 20, 64, 1, 50, 0, 0, 0, 0, 0, 0, 8, -97, 64, 0, 0)
val bsonArray = Array[Byte](42, 0, 0, 0, 2, 48, 0, 8, 0, 0, 0, 97, 119, 101, 115, 111, 109, 101, 0, 1, 49, 0, 51, 51, 51, 51, 51, 51, 20, 64, 1, 50, 0, 0, 0, 0, 0, 0, 8, -97, 64, 0)
"ReactiveMongo" should {
"produce a simple doc" in {
val doc = BSONDocument("hello" -> BSONString("world"))
val buffer = doc.makeBuffer
compare(simple, buffer)
}
"produce a simple doc through a traversable" in {
val buffer = BSONDocument("hello" -> BSONString("world")).makeBuffer
val buffer2 = buffer.makeDocument.makeBuffer
compare(simple, buffer2)
}
"produce a document embedding an array" in {
val buffer = BSONDocument(
"_id" -> BSONObjectID("503792c1984587971b14530e"),
"BSON" -> BSONArray(
BSONString("awesome"),
BSONDouble(5.05),
BSONDouble(1986))).makeBuffer
compare(embeddingArray, buffer)
}
"produce a document embedding an array through traversable" in {
val buffer = BSONDocument(
"_id" -> BSONObjectID("503792c1984587971b14530e"),
"BSON" -> BSONArray(
BSONString("awesome"),
BSONDouble(5.05),
BSONDouble(1986))).makeBuffer
embeddingArray.length mustEqual buffer.size
val buffer2 = buffer.makeDocument.makeBuffer
compare(embeddingArray, buffer2)
}
"nested subdocuments and arrays" in {
val expected = Array[Byte](72, 0, 0, 0, 3, 112, 117, 115, 104, 65, 108, 108, 0, 58, 0, 0, 0, 4, 99, 111, 110, 102, 105, 103, 0, 45, 0, 0, 0, 3, 48, 0, 37, 0, 0, 0, 2, 110, 97, 109, 101, 0, 7, 0, 0, 0, 102, 111, 111, 98, 97, 114, 0, 2, 118, 97, 108, 117, 101, 0, 4, 0, 0, 0, 98, 97, 114, 0, 0, 0, 0, 0)
// {"pushAll":{"config":[{"name":"foobar","value":"bar"}]}}
val subsubdoc = BSONDocument("name" -> BSONString("foobar"), "value" -> BSONString("bar"))
val arr = BSONArray(subsubdoc)
val subdoc = BSONDocument("config" -> arr)
val doc = BSONDocument("pushAll" -> subdoc)
compare(expected, doc.makeBuffer)
}
"concat two arrays" in {
val array1 = BSONArray(BSONInteger(1), BSONInteger(2))
val array2 = BSONArray(BSONString("a"), BSONString("b"))
val mergedArray = array1 ++ array2
val str = mergedArray.values.map {
case BSONString(value) => value.toString
case BSONInteger(value) => value.toString
case _ => "NOELEM"
}.mkString(",")
str must equalTo("1,2,a,b")
}
"build arrays with mixed values and optional values" in {
val array = BSONArray(
BSONInteger(1),
Some(BSONInteger(2)),
None,
Some(BSONInteger(4)))
val str = array.values.map {
case BSONInteger(value) => value.toString
case _ => "NOELEM"
}.mkString(",")
str mustEqual "1,2,4"
}
val docLike = BSONDocument(
"likeFalseInt" -> BSONInteger(0),
"likeFalseLong" -> BSONLong(0),
"likeFalseDouble" -> BSONDouble(0.0),
"likeFalseUndefined" -> BSONUndefined,
"likeFalseNull" -> BSONNull,
"likeTrueInt" -> BSONInteger(1),
"likeTrueLong" -> BSONLong(2),
"likeTrueDouble" -> BSONDouble(-0.1),
"anInt" -> BSONInteger(200),
"aLong" -> BSONLong(12345678912L),
"aDouble" -> BSONDouble(9876543210.98))
"abstract booleans and numbers" in {
docLike.getAs[BSONBooleanLike]("likeFalseInt").get.toBoolean mustEqual false
docLike.getAs[BSONBooleanLike]("likeFalseLong").get.toBoolean mustEqual false
docLike.getAs[BSONBooleanLike]("likeFalseDouble").get.toBoolean mustEqual false
docLike.getAs[BSONBooleanLike]("likeFalseUndefined").get.toBoolean mustEqual false
docLike.getAs[BSONBooleanLike]("likeFalseNull").get.toBoolean mustEqual false
docLike.getAs[BSONBooleanLike]("likeTrueInt").get.toBoolean mustEqual true
docLike.getAs[BSONBooleanLike]("likeTrueLong").get.toBoolean mustEqual true
docLike.getAs[BSONBooleanLike]("likeTrueDouble").get.toBoolean mustEqual true
docLike.getAs[BSONNumberLike]("anInt").get.toDouble mustEqual 200
docLike.getAs[BSONNumberLike]("aLong").get.toDouble mustEqual 12345678912L
docLike.getAs[BSONNumberLike]("aDouble").get.toDouble mustEqual 9876543210.98
}
}
def compare(origin: Array[Byte], buffer: ByteString) = {
val array = buffer.toArray
val result = array.corresponds(origin)(_ == _)
if (!result) {
log(origin, array)
failure
} else success
}
def log(origin: Array[Byte], test: Array[Byte]) = {
println(Arrays.toString(origin))
println(Arrays.toString(test))
}
}
class BSONObjectIDSpec extends Specification {
"BSONObjectID" should {
"equal when created with string" in {
val objectID = BSONObjectID.generate
val sameObjectID = BSONObjectID(objectID.stringify)
objectID.valueAsArray must equalTo(sameObjectID.valueAsArray)
}
"equal another instance of BSONObjectID with the same value" in {
val objectID = BSONObjectID.generate
val sameObjectID = BSONObjectID(objectID.stringify)
objectID must equalTo(sameObjectID)
}
"not equal another newly generated instance of BSONObjectID" in {
val objectID = BSONObjectID.generate
val nextObjectID = BSONObjectID(BSONObjectID.generate.stringify)
objectID must not equalTo (nextObjectID)
}
}
"Converters" should {
"strings equal each other" in {
val objectID = "506fff5bb8f6b133007b5bcf"
val hex = Converters.str2Hex(objectID)
val string = Converters.hex2Str(hex)
string must equalTo(objectID)
}
"bytes generated equal bytes converted from string" in {
val objectID = BSONObjectID.generate
val bytes = Converters.str2Hex(objectID.stringify)
objectID.valueAsArray must equalTo(bytes)
}
}
} | {
"content_hash": "eae85967121219c66bbf62fbb3e67892",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 307,
"avg_line_length": 39.81927710843374,
"alnum_prop": 0.6408472012102875,
"repo_name": "sh1ng/ReactiveMongo",
"id": "cd74ba5b5a07b81619b108440715656dac21995c",
"size": "6610",
"binary": false,
"copies": "1",
"ref": "refs/heads/akka.io",
"path": "driver/src/test/scala/BsonSpec.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "264"
},
{
"name": "Scala",
"bytes": "508223"
}
],
"symlink_target": ""
} |
package com.tiny.demo.firstlinecode.common.view;
/**
* Created by tiny on 16/12/19.
*/
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.WindowManager;
import android.widget.FrameLayout;
import com.tiny.demo.firstlinecode.R;
/**
*
* A ViewGroup which can limit the max height of its child view, used on android platform
*
* How to use:
* you can add MaxHeightView in xml layout file,and add attr app:mhv_HeightRatio="float in[0,1]" or app:mhv_HeightDimen="dimen".
* mhv_HeightRatio refers to the max height ratio compare to the device screen height.
* mhv_HeightDimen refers to the max height dimension.
*
* <cn.carbs.android.maxheightview.library.MaxHeightView
* android:layout_width="match_parent"
* android:layout_height="wrap_content"
* app:mhv_HeightRatio="0.3">
*
* <ScrollView
* android:layout_width="match_parent"
* android:layout_height="wrap_content">
*
* <LinearLayout
* android:layout_width="match_parent"
* android:layout_height="wrap_content"
* android:orientation="vertical">
*
* // add your content view here
*
* </LinearLayout>
* </ScrollView>
* </cn.carbs.android.maxheightview.library.MaxHeightView>
*
* Analytical procedure:
* 1.if neighter mhv_HeightDimen nor mhv_HeightRatio set, the max height will be
* DEFAULT_MAX_RATIO_WITHOUT_ARGU * device screen height.
* 2.if you just set mhv_HeightRatio, then the max height will be mhv_HeightRatio * device screen height.
* 3.if you just set mhv_HeightDimen, then the max height will be mhv_HeightDimen.
* 4.if you set both mhv_HeightDimen and mhv_HeightRatio, then the max height will be the minume size.
*
* @author Carbs.Wang
*/
public class MaxHeightView extends FrameLayout {
private static final float DEFAULT_MAX_RATIO_WITHOUT_ARGU = 0.6f;
private static final float DEFAULT_MAX_RATIO = 0f;
private static final float DEFAULT_MAX_DIMEN = 0f;
private float mMaxRatio = DEFAULT_MAX_RATIO;
private float mMaxDimen = DEFAULT_MAX_DIMEN;
private float mMaxHeight = 0;
public MaxHeightView(Context context) {
super(context);
init();
}
public MaxHeightView(Context context, AttributeSet attrs) {
super(context, attrs);
initAttrs(context, attrs);
init();
}
public MaxHeightView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initAttrs(context, attrs);
init();
}
private void initAttrs(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.MaxHeightView);
final int count = a.getIndexCount();
for (int i = 0; i < count; ++i) {
int attr = a.getIndex(i);
if(attr == R.styleable.MaxHeightView_mhv_HeightRatio){
mMaxRatio = a.getFloat(attr, DEFAULT_MAX_RATIO);
}else if(attr == R.styleable.MaxHeightView_mhv_HeightDimen){
mMaxDimen = a.getDimension(attr, DEFAULT_MAX_DIMEN);
}
}
a.recycle();
}
private void init(){
if(mMaxDimen <= 0 && mMaxRatio <= 0){
mMaxHeight = DEFAULT_MAX_RATIO_WITHOUT_ARGU * (float) getScreenHeight(getContext());
} else if (mMaxDimen <= 0 && mMaxRatio > 0) {
mMaxHeight = mMaxRatio * (float) getScreenHeight(getContext());
} else if(mMaxDimen > 0 && mMaxRatio <= 0) {
mMaxHeight = mMaxDimen;
} else{
mMaxHeight = Math.min(mMaxDimen, mMaxRatio * (float) getScreenHeight(getContext()));
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (heightMode == MeasureSpec.EXACTLY) {
heightSize = heightSize <= mMaxHeight ? heightSize
: (int) mMaxHeight;
}
if (heightMode == MeasureSpec.UNSPECIFIED) {
heightSize = heightSize <= mMaxHeight ? heightSize
: (int) mMaxHeight;
}
if (heightMode == MeasureSpec.AT_MOST) {
heightSize = heightSize <= mMaxHeight ? heightSize
: (int) mMaxHeight;
}
int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize,
heightMode);
super.onMeasure(widthMeasureSpec, maxHeightMeasureSpec);
}
private int getScreenHeight(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
return wm.getDefaultDisplay().getHeight();
}
} | {
"content_hash": "10bcbc5b75678507aa2adb7a19aa9624",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 129,
"avg_line_length": 35.21739130434783,
"alnum_prop": 0.6423868312757202,
"repo_name": "tinyvampirepudge/Android_Basis_Demo",
"id": "de9a136e45ca9f70c3878342a7b6888d288f9492",
"size": "4860",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Android_Basis_Demo/app/src/main/java/com/tiny/demo/firstlinecode/common/view/MaxHeightView.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "4434358"
}
],
"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.remote.worker;
import build.bazel.remote.execution.v2.ActionCacheUpdateCapabilities;
import build.bazel.remote.execution.v2.CacheCapabilities;
import build.bazel.remote.execution.v2.CapabilitiesGrpc.CapabilitiesImplBase;
import build.bazel.remote.execution.v2.DigestFunction;
import build.bazel.remote.execution.v2.ExecutionCapabilities;
import build.bazel.remote.execution.v2.GetCapabilitiesRequest;
import build.bazel.remote.execution.v2.ServerCapabilities;
import build.bazel.remote.execution.v2.SymlinkAbsolutePathStrategy;
import build.bazel.semver.SemVer;
import com.google.devtools.build.lib.remote.ApiVersion;
import com.google.devtools.build.lib.remote.util.DigestUtil;
import io.grpc.stub.StreamObserver;
/** A basic implementation of a Capabilities service. */
final class CapabilitiesServer extends CapabilitiesImplBase {
private final DigestUtil digestUtil;
private final boolean execEnabled;
public CapabilitiesServer(DigestUtil digestUtil, boolean execEnabled) {
this.digestUtil = digestUtil;
this.execEnabled = execEnabled;
}
@Override
public void getCapabilities(
GetCapabilitiesRequest request, StreamObserver<ServerCapabilities> responseObserver) {
SemVer current = ApiVersion.current.toSemVer();
DigestFunction.Value df = digestUtil.getDigestFunction();
ServerCapabilities.Builder response =
ServerCapabilities.newBuilder()
.setLowApiVersion(current)
.setHighApiVersion(current)
.setCacheCapabilities(
CacheCapabilities.newBuilder()
.addDigestFunctions(df)
.setSymlinkAbsolutePathStrategy(SymlinkAbsolutePathStrategy.Value.DISALLOWED)
.setActionCacheUpdateCapabilities(
ActionCacheUpdateCapabilities.newBuilder().setUpdateEnabled(true).build())
.setMaxBatchTotalSizeBytes(CasServer.MAX_BATCH_SIZE_BYTES)
.build());
if (execEnabled) {
response.setExecutionCapabilities(
ExecutionCapabilities.newBuilder().setDigestFunction(df).setExecEnabled(true).build());
}
responseObserver.onNext(response.build());
responseObserver.onCompleted();
}
}
| {
"content_hash": "41a3e25a49f56fb81d1eb1057245d1f4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 98,
"avg_line_length": 44.8125,
"alnum_prop": 0.7503486750348675,
"repo_name": "bazelbuild/bazel",
"id": "c550aaa8a5d2909fda3ae494c9fd7f15a14d2b39",
"size": "2868",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/tools/remote/src/main/java/com/google/devtools/build/remote/worker/CapabilitiesServer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2997"
},
{
"name": "C",
"bytes": "32332"
},
{
"name": "C++",
"bytes": "1725260"
},
{
"name": "CSS",
"bytes": "3169"
},
{
"name": "HTML",
"bytes": "25884"
},
{
"name": "Java",
"bytes": "42435254"
},
{
"name": "Makefile",
"bytes": "248"
},
{
"name": "Objective-C",
"bytes": "10817"
},
{
"name": "Objective-C++",
"bytes": "1043"
},
{
"name": "PowerShell",
"bytes": "15431"
},
{
"name": "Python",
"bytes": "3709618"
},
{
"name": "Shell",
"bytes": "2777737"
},
{
"name": "Smarty",
"bytes": "30462"
},
{
"name": "Starlark",
"bytes": "22605"
}
],
"symlink_target": ""
} |
/*
* File extensions for anonymization
* Authors: Guillaume TOURON
*/
#ifndef FILES_EXTENSIONS_H
#define FILES_EXTENSIONS_H
/**
* \brief pcap file (wireshark, tcpdump...)
*/
#define PCAP_FILE ".pcap"
#endif
| {
"content_hash": "21b28fb6bf3adace656a18d00ddf75dd",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 43,
"avg_line_length": 15.357142857142858,
"alnum_prop": 0.6883720930232559,
"repo_name": "vighu11/loganon",
"id": "00358443eabf9a918b74cfd4869e21c95e6eb2ed",
"size": "215",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/parser/files_extensions.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "416418"
},
{
"name": "C++",
"bytes": "2731"
},
{
"name": "CMake",
"bytes": "14010"
},
{
"name": "Makefile",
"bytes": "1468"
},
{
"name": "Objective-C",
"bytes": "1925"
},
{
"name": "Perl",
"bytes": "179"
}
],
"symlink_target": ""
} |
layout: post
title: "The bare minimum"
date: 2014-12-14 20:00:00
categories: general
comments: true
---
This last month has been full of changes, mainly because I switched work and country. During this period, the time
I've dedicated to my workout and code training has been reduced.
It's not the first time I've had to endure a tight schedule and, if there is something I've learnt,
is that you have to keep doing at least a liitle bit of training and never stop altogether.
This will allow you to return to your previous timetable without a massive effort.
As with my previous post, this one is going to be a reminder for myself, so that when I face another time shortage
or I feel drained of energy and need a break, I can come here and remember my bare minimum
training routines.
Workout routine
---------------
### When I have access to weights
#### Monday and Friday
* **Squat:** 20 reps, drop set 10 reps
* rest 30 s.
* **Pull ups:** 10 reps, rest 10 s., 10 reps
* rest 30 s.
* **Neutral-grip lat. pull down:** 10 reps, drop set 10 reps
* rest 30 s.
* **Lying leg curl:** 10 reps, drop set 10reps
* rest 30 s.
* **Dumbbell bench press:** 8 reps
* rest 30 s.
* **Dumbbell shoulder press:** 8 reps
* rest 30 s.
* **Superman:** 15 reps
* rest 30 s.
* **Crunch:** 25 reps
#### Wednesday
* **Dumbbell bench press:** 10 reps, drop set 10 reps
* rest 30 s.
* **Press ups:** 20 reps
* rest 30 s.
* **Dumbbell bench shoulder press:** 10 reps, drop set 10 reps
* rest 30 s.
* **Seated lateral raise:** 10 reps, drop set 10 reps
* rest 30 s.
* **Walking lunge:** 10 reps
* **Overhand row:** 10 reps
* **Crunch:** 25 reps
### When I don't have access to weights
* **Chest chair dips:** 6 sets of 6 reps (30s. rest between sets)
* 30 s. / 1 min. rest
* **Chest push ups:** 6 sets of 6 reps (30s. rest between sets)
* 30 s. / 1 min. rest
* **Push ups with legs elevated:** 6 sets of 6 reps (30s. rest between sets)
* 3 mins break
* **Pull ups:** 6 sets of 6 reps (30s. rest between sets)
* 3 mins break
* **Leg squat:** 6 sets of 6 reps (30s. rest between sets)
* 30 s. / 1 min. rest
* **Squat jumps:** 6 sets of 6 reps (30s. rest between sets)
* 3 mins break
* **Abs crunches:** 6 sets of 15 reps (15s. rest between sets)
Apart from this strength workout, I try to go for a 20-30 mins run two or three times per week.
It doesn't matter if the run is after a workout or on a day off,
the only rule is not to run before the workout.
My two pomodoros for writing this post are far gone, so I'll talk about the bare minimum code training routine in
the next one. See you!
| {
"content_hash": "8de4ec2c901e5ef11d0833d0a1290013",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 114,
"avg_line_length": 32.4375,
"alnum_prop": 0.6867052023121387,
"repo_name": "pvcarrera/pvcarrera.github.io",
"id": "5d69f2934d2d757efc0187a0262ed768a308eab1",
"size": "2599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2014-12-14-the-bare-minimum.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11224"
},
{
"name": "HTML",
"bytes": "7593"
},
{
"name": "Ruby",
"bytes": "3364"
}
],
"symlink_target": ""
} |
FROM balenalib/intel-edison-alpine:3.14-run
# Default to UTF-8 file.encoding
ENV LANG C.UTF-8
# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
RUN { \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home
ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
RUN set -x \
&& apk add --no-cache \
openjdk8 \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 32-bit (x86) \nOS: Alpine Linux 3.14 \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nOpenJDK v8-jdk \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh | {
"content_hash": "3042f980178470f235715ac762a6b017",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 693,
"avg_line_length": 58.266666666666666,
"alnum_prop": 0.6990846681922197,
"repo_name": "resin-io-library/base-images",
"id": "21d3d41ff1c4acad618b4aa0cf0ad99854c155ed",
"size": "1769",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/openjdk/intel-edison/alpine/3.14/8-jdk/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "71234697"
},
{
"name": "JavaScript",
"bytes": "13096"
},
{
"name": "Shell",
"bytes": "12051936"
},
{
"name": "Smarty",
"bytes": "59789"
}
],
"symlink_target": ""
} |
<?php
namespace LF\EnvDiff\Composer;
use Composer\Script\Event;
use InvalidArgumentException;
use LF\EnvDiff\Config;
use LF\EnvDiff\IO\ComposerIO;
use LF\EnvDiff\Processor;
use RuntimeException;
class ScriptHandler
{
const CONFIG_KEY = 'lf-env-diff';
/**
* @param Event $event
*
* @throws InvalidArgumentException
* @throws RuntimeException
*/
public static function actualizeEnv(Event $event)
{
$configs = self::extractConfigs($event);
$processor = new Processor(new ComposerIO($event->getIO()));
foreach ($configs as $config) {
$processor->actualizeEnv(Config::createFormArray($config));
}
}
/**
* @param Event $event
*
* @throws InvalidArgumentException
* @throws RuntimeException
*/
public static function showDifference(Event $event)
{
$configs = self::extractConfigs($event);
$processor = new Processor(new ComposerIO($event->getIO()));
foreach ($configs as $config) {
$processor->showDifference(Config::createFormArray($config));
}
}
/**
* @param Event $event
*
* @return array
*
* @throws InvalidArgumentException
*/
private static function extractConfigs(Event $event)
{
$extras = $event->getComposer()->getPackage()->getExtra();
$configs = isset($extras[self::CONFIG_KEY]) ? $extras[self::CONFIG_KEY] : [[]];
if (!is_array($configs)) {
throw new InvalidArgumentException(
'The extra.lf-env-diff setting must be an array or a configuration object'
);
}
foreach ($configs as $config) {
if (!is_array($config)) {
throw new InvalidArgumentException(
'The extra.lf-env-diff setting must be an array of configuration objects'
);
}
}
return $configs;
}
}
| {
"content_hash": "46a75032f07719901a6eb0445bc2e2b8",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 93,
"avg_line_length": 25.532467532467532,
"alnum_prop": 0.5849440488301119,
"repo_name": "Tekill/env-diff",
"id": "7b6f2a402c9ee1f9b29f897c95db0b5e5f133c4f",
"size": "1966",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Composer/ScriptHandler.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "32108"
}
],
"symlink_target": ""
} |
Load arbitrary data packed in an **PNG** from an **URL**.
##Inputs
##Outputs
###array
The loaded **array**.
##Detail
| {
"content_hash": "c4960e49aadc6fe7f20cff22804f474b",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 57,
"avg_line_length": 13.333333333333334,
"alnum_prop": 0.6416666666666667,
"repo_name": "vizorvr/patches",
"id": "38bd5e8194fa995b10384ed5fdfb9d805b41ddfe",
"size": "142",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "documentation/browser/plugins/url_array_generator.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1357"
},
{
"name": "CSS",
"bytes": "282389"
},
{
"name": "Dockerfile",
"bytes": "632"
},
{
"name": "Gherkin",
"bytes": "1862"
},
{
"name": "HTML",
"bytes": "320261"
},
{
"name": "JavaScript",
"bytes": "15326597"
},
{
"name": "Python",
"bytes": "53768"
},
{
"name": "Shell",
"bytes": "6346"
}
],
"symlink_target": ""
} |
* Original: [Release atom-shell v0.15.7 - electron/electron](https://github.com/electron/electron/releases/tag/v0.15.7)
Changelog:
* Add support for `--host-rules` switch.
* (コマンドライン実行において) `--host-rules` スイッチをサポートしました
* Fix a crash when using `protocol` module.
* `protocol` モジュール使用時のクラッシュを修正しました
| {
"content_hash": "e3180c1c4ce1c1915e10018fb217a8ae",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 119,
"avg_line_length": 38,
"alnum_prop": 0.7368421052631579,
"repo_name": "akabekobeko/electron-release-notes-ja-private-edition",
"id": "0b14cedfc7590781ceff78a2ad526aaf6f99555c",
"size": "409",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "v0.x/v0.15/v0.15.7.ja.md",
"mode": "33261",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package org.apereo.cas;
import org.apereo.cas.support.saml.mdui.web.flow.SamlMetadataUIParserActionTests;
import org.apereo.cas.support.saml.mdui.web.flow.SamlMetadataUIParserDynamicActionTests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
* Test suite to run all SAML tests.
*
* @author Misagh Moayyed
* @since 4.2.0
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({SamlMetadataUIParserActionTests.class, SamlMetadataUIParserDynamicActionTests.class})
public class AllTestsSuite {
}
| {
"content_hash": "2e68384e03333b0896a00895f47cc871",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 106,
"avg_line_length": 28.5,
"alnum_prop": 0.8011695906432749,
"repo_name": "frett/cas",
"id": "b780183bc032e06d10cd9325856aede6fd511078",
"size": "513",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "support/cas-server-support-saml-mdui/src/test/java/org/apereo/cas/AllTestsSuite.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "241382"
},
{
"name": "Dockerfile",
"bytes": "647"
},
{
"name": "Groovy",
"bytes": "11335"
},
{
"name": "HTML",
"bytes": "141068"
},
{
"name": "Java",
"bytes": "9545005"
},
{
"name": "JavaScript",
"bytes": "36067"
},
{
"name": "Shell",
"bytes": "101589"
}
],
"symlink_target": ""
} |
package com.sensorberg.sdk.internal.interfaces;
import android.annotation.TargetApi;
import android.bluetooth.BluetoothAdapter;
import android.os.Build;
public interface BluetoothPlatform {
/**
* Returns a flag indicating whether Bluetooth is enabled.
*
* @return a flag indicating whether Bluetooth is enabled
*/
boolean isBluetoothLowEnergyDeviceTurnedOn();
/**
* Returns a flag indicating whether Bluetooth is supported.
*
* @return a flag indicating whether Bluetooth is supported
*/
boolean isBluetoothLowEnergySupported();
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
void startLeScan(BluetoothAdapter.LeScanCallback scanCallback);
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
void stopLeScan();
boolean isLeScanRunning();
}
| {
"content_hash": "0781bc65afaa8174f0e9a058ec3493ac",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 67,
"avg_line_length": 26.419354838709676,
"alnum_prop": 0.7313797313797313,
"repo_name": "sensorberg-dev/android-sdk",
"id": "9e3066247ba0bf7634ec3b38eef7e176c79dbfd4",
"size": "819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android-sdk/src/main/java/com/sensorberg/sdk/internal/interfaces/BluetoothPlatform.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "IDL",
"bytes": "227"
},
{
"name": "Java",
"bytes": "762193"
},
{
"name": "Shell",
"bytes": "497"
}
],
"symlink_target": ""
} |
/**
* @requires OpenLayers/Layer/Grid.js
*/
/**
* Class: OpenLayers.Layer.XYZ
* The XYZ class is designed to make it easier for people who have tiles
* arranged by a standard XYZ grid.
*
* Inherits from:
* - <OpenLayers.Layer.Grid>
*/
OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
/**
* APIProperty: isBaseLayer
* Default is true, as this is designed to be a base tile source.
*/
isBaseLayer: true,
/**
* APIProperty: sphericalMecator
* Whether the tile extents should be set to the defaults for
* spherical mercator. Useful for things like OpenStreetMap.
* Default is false, except for the OSM subclass.
*/
sphericalMercator: false,
/**
* APIProperty: zoomOffset
* {Number} If your cache has more zoom levels than you want to provide
* access to with this layer, supply a zoomOffset. This zoom offset
* is added to the current map zoom level to determine the level
* for a requested tile. For example, if you supply a zoomOffset
* of 3, when the map is at the zoom 0, tiles will be requested from
* level 3 of your cache. Default is 0 (assumes cache level and map
* zoom are equivalent). Using <zoomOffset> is an alternative to
* setting <serverResolutions> if you only want to expose a subset
* of the server resolutions.
*/
zoomOffset: 0,
/**
* APIProperty: serverResolutions
* {Array} A list of all resolutions available on the server. Only set this
* property if the map resolutions differ from the server. This
* property serves two purposes. (a) <serverResolutions> can include
* resolutions that the server supports and that you don't want to
* provide with this layer; you can also look at <zoomOffset>, which is
* an alternative to <serverResolutions> for that specific purpose.
* (b) The map can work with resolutions that aren't supported by
* the server, i.e. that aren't in <serverResolutions>. When the
* map is displayed in such a resolution data for the closest
* server-supported resolution is loaded and the layer div is
* stretched as necessary.
*/
serverResolutions: null,
/**
* Constructor: OpenLayers.Layer.XYZ
*
* Parameters:
* name - {String}
* url - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
if (options && options.sphericalMercator || this.sphericalMercator) {
options = OpenLayers.Util.extend({
maxExtent: new OpenLayers.Bounds(
-128 * 156543.03390625,
-128 * 156543.03390625,
128 * 156543.03390625,
128 * 156543.03390625
),
maxResolution: 156543.03390625,
numZoomLevels: 19,
units: "m",
projection: "EPSG:900913"
}, options);
}
url = url || this.url;
name = name || this.name;
var newArguments = [name, url, {}, options];
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
},
/**
* APIMethod: clone
* Create a clone of this layer
*
* Parameters:
* obj - {Object} Is this ever used?
*
* Returns:
* {<OpenLayers.Layer.XYZ>} An exact clone of this OpenLayers.Layer.XYZ
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.XYZ(this.name,
this.url,
this.getOptions());
}
//get all additions from superclasses
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
return obj;
},
/**
* Method: getURL
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*
* Returns:
* {String} A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as
* parameters
*/
getURL: function (bounds) {
var xyz = this.getXYZ(bounds);
var url = this.url;
if (OpenLayers.Util.isArray(url)) {
var s = '' + xyz.x + xyz.y + xyz.z;
url = this.selectUrl(s, url);
}
return OpenLayers.String.format(url, xyz);
},
/**
* Method: getXYZ
* Calculates x, y and z for the given bounds.
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*
* Returns:
* {Object} - an object with x, y and z properties.
*/
getXYZ: function(bounds) {
var res = this.getServerResolution();
var x = Math.round((bounds.left - this.maxExtent.left) /
(res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) /
(res * this.tileSize.h));
var resolutions = this.serverResolutions || this.resolutions;
var z = this.zoomOffset == 0 ?
OpenLayers.Util.indexOf(resolutions, res) :
this.getServerZoom() + this.zoomOffset;
var limit = Math.pow(2, z);
if (this.wrapDateLine)
{
x = ((x % limit) + limit) % limit;
}
return {'x': x, 'y': y, 'z': z};
},
/* APIMethod: setMap
* When the layer is added to a map, then we can fetch our origin
* (if we don't have one.)
*
* Parameters:
* map - {<OpenLayers.Map>}
*/
setMap: function(map) {
OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
if (!this.tileOrigin) {
this.tileOrigin = new OpenLayers.LonLat(this.maxExtent.left,
this.maxExtent.bottom);
}
},
CLASS_NAME: "OpenLayers.Layer.XYZ"
});
| {
"content_hash": "c1a09800a22e1763aea988006f765092",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 80,
"avg_line_length": 34.42307692307692,
"alnum_prop": 0.5434956105347167,
"repo_name": "flavour/ssf",
"id": "aa850cbd7b5da8224174eba4b7e82f0304636e22",
"size": "6517",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "static/scripts/gis/openlayers/lib/OpenLayers/Layer/XYZ.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "9763120"
},
{
"name": "PHP",
"bytes": "15220"
},
{
"name": "Python",
"bytes": "21558751"
},
{
"name": "Shell",
"bytes": "1171"
}
],
"symlink_target": ""
} |
FROM balenalib/orange-pi-lite-alpine:3.13-run
# remove several traces of python
RUN apk del python*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# install python dependencies
RUN apk add --no-cache ca-certificates libffi \
&& apk add --no-cache libssl1.0 || apk add --no-cache libssl1.1
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
# point Python at a system-provided certificate database. Otherwise, we might hit CERTIFICATE_VERIFY_FAILED.
# https://www.python.org/dev/peps/pep-0476/#trust-database
ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
ENV PYTHON_VERSION 3.9.10
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.3.1
ENV SETUPTOOLS_VERSION 60.5.4
RUN set -x \
&& buildDeps=' \
curl \
gnupg \
' \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-alpine-armv7hf-libffi3.3.tar.gz" \
&& echo "6c0599f15256a7c907ee3b8ac2b5ac85535f39f8c8d0881a1add0f5949927c17 Python-$PYTHON_VERSION.linux-alpine-armv7hf-libffi3.3.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-alpine-armv7hf-libffi3.3.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-alpine-armv7hf-libffi3.3.tar.gz" \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Alpine Linux 3.13 \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.9.10, Pip v21.3.1, Setuptools v60.5.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh | {
"content_hash": "e5aec8b546415585b975f11502fb7169",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 714,
"avg_line_length": 53.38961038961039,
"alnum_prop": 0.7117489661882753,
"repo_name": "resin-io-library/base-images",
"id": "56d7fcaaa04079146879a1019a36d5ee49906c30",
"size": "4132",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/orange-pi-lite/alpine/3.13/3.9.10/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "71234697"
},
{
"name": "JavaScript",
"bytes": "13096"
},
{
"name": "Shell",
"bytes": "12051936"
},
{
"name": "Smarty",
"bytes": "59789"
}
],
"symlink_target": ""
} |
<HTML>
<HEAD>
<TITLE>Berkeley SoftFloat History</TITLE>
</HEAD>
<BODY>
<H1>History of Berkeley SoftFloat, to Release 3c</H1>
<P>
John R. Hauser<BR>
2017 February 10<BR>
</P>
<H3>Release 3c (2017 February)</H3>
<UL>
<LI>
Added optional rounding mode <CODE>odd</CODE> (round to odd, also known as
<EM>jamming</EM>).
<LI>
Corrected the documentation concerning non-canonical representations in
<NOBR>80-bit</NOBR> double-extended-precision.
</UL>
<H3>Release 3b (2016 July)</H3>
<UL>
<LI>
Implemented the common <NOBR>16-bit</NOBR> “half-precision”
floating-point format (<CODE>float16_t</CODE>).
<LI>
Made the integer values returned on invalid conversions to integer formats
be determined by the port-specific specialization instead of being the same for
all ports.
<LI>
Added preprocessor macro <CODE>THREAD_LOCAL</CODE> to allow the floating-point
state (modes and exception flags) to be made per-thread.
<LI>
Modified the provided Makefiles to allow some options to be overridden from the
<CODE>make</CODE> command.
<LI>
Made other minor improvements.
</UL>
<H3>Release 3a (2015 October)</H3>
<UL>
<LI>
Replaced the license text supplied by the University of California, Berkeley.
</UL>
<H3>Release 3 (2015 February)</H3>
<UL>
<LI>
Complete rewrite, funded by the University of California, Berkeley, and
consequently having a different use license than earlier releases.
Major changes included renaming most types and functions, upgrading some
algorithms, restructuring the source files, and making SoftFloat into a true
library.
<LI>
Added functions to convert between floating-point and unsigned integers, both
<NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR> (<CODE>uint32_t</CODE> and
<CODE>uint64_t</CODE>).
<LI>
Added functions for fused multiply-add, for all supported floating-point
formats except <NOBR>80-bit</NOBR> double-extended-precision.
<LI>
Added support for a fifth rounding mode, <CODE>near_maxMag</CODE> (round to
nearest, with ties to maximum magnitude, away from zero).
<LI>
Dropped the <CODE>timesoftfloat</CODE> program (now part of the Berkeley
TestFloat package).
</UL>
<H3>Release 2c (2015 January)</H3>
<UL>
<LI>
Fixed mistakes affecting some <NOBR>64-bit</NOBR> processors.
<LI>
Further improved the documentation and the wording for the legal restrictions
on using SoftFloat releases <NOBR>through 2c</NOBR> (not applicable to
<NOBR>Release 3</NOBR> or later).
</UL>
<H3>Release 2b (2002 May)</H3>
<UL>
<LI>
Made minor updates to the documentation, including improved wording for the
legal restrictions on using SoftFloat.
</UL>
<H3>Release 2a (1998 December)</H3>
<UL>
<LI>
Added functions to convert between <NOBR>64-bit</NOBR> integers
(<CODE>int64</CODE>) and all supported floating-point formats.
<LI>
Fixed a bug in all <NOBR>64-bit</NOBR>-version square root functions except
<CODE>float32_sqrt</CODE> that caused the result sometimes to be off by
<NOBR>1 unit</NOBR> in the last place (<NOBR>1 ulp</NOBR>) from what it should
be.
(Bug discovered by Paul Donahue.)
<LI>
Improved the Makefiles.
</UL>
<H3>Release 2 (1997 June)</H3>
<UL>
<LI>
Created the <NOBR>64-bit</NOBR> (<CODE>bits64</CODE>) version, adding the
<CODE>floatx80</CODE> and <CODE>float128</CODE> formats.
<LI>
Changed the source directory structure, splitting the sources into a
<CODE>bits32</CODE> and a <CODE>bits64</CODE> version.
Renamed <CODE>environment.h</CODE> to <CODE>milieu.h</CODE> to avoid confusion
with environment variables.
<LI>
Fixed a small error that caused <CODE>float64_round_to_int</CODE> often to
round the wrong way in nearest/even mode when the operand was between
2<SUP>20</SUP> and 2<SUP>21</SUP> and halfway between two integers.
</UL>
<H3>Release 1a (1996 July)</H3>
<UL>
<LI>
Corrected a mistake that caused borderline underflow cases not to raise the
underflow flag when they should have.
(Problem reported by Doug Priest.)
<LI>
Added the <CODE>float_detect_tininess</CODE> variable to control whether
tininess is detected before or after rounding.
</UL>
<H3>Release 1 (1996 July)</H3>
<UL>
<LI>
Original release, based on work done for the International Computer Science
Institute (ICSI) in Berkeley, California.
</UL>
</BODY>
| {
"content_hash": "2cec6390c8afb07dbae27a3d7aba4fc9",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 79,
"avg_line_length": 22.548223350253807,
"alnum_prop": 0.7098153984691581,
"repo_name": "juped/urbit",
"id": "eaee1377cf2fa3c1d3fd06392567cca5cda04ee8",
"size": "4442",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "outside/softfloat-3/doc/SoftFloat-history.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "41"
},
{
"name": "C",
"bytes": "6544045"
},
{
"name": "C++",
"bytes": "136379"
},
{
"name": "CMake",
"bytes": "7155"
},
{
"name": "Emacs Lisp",
"bytes": "6158"
},
{
"name": "HTML",
"bytes": "91785"
},
{
"name": "Haskell",
"bytes": "1439"
},
{
"name": "JavaScript",
"bytes": "141864"
},
{
"name": "Lua",
"bytes": "5238"
},
{
"name": "Makefile",
"bytes": "99984"
},
{
"name": "Objective-C",
"bytes": "56964"
},
{
"name": "Perl",
"bytes": "1138"
},
{
"name": "Perl6",
"bytes": "525"
},
{
"name": "Python",
"bytes": "36016"
},
{
"name": "Ragel",
"bytes": "7052"
},
{
"name": "Roff",
"bytes": "5598"
},
{
"name": "Ruby",
"bytes": "307"
},
{
"name": "TeX",
"bytes": "6422"
},
{
"name": "Vim script",
"bytes": "16089"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `N409` type in crate `typenum`.">
<meta name="keywords" content="rust, rustlang, rust-lang, N409">
<title>typenum::consts::N409 - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc type">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../index.html'>typenum</a>::<wbr><a href='index.html'>consts</a></p><script>window.sidebarCurrent = {name: 'N409', ty: 'type', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Type Definition <a href='../index.html'>typenum</a>::<wbr><a href='index.html'>consts</a>::<wbr><a class="type" href=''>N409</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a class='srclink' href='../../src/typenum/home/jacob/nitro-game-engine/target/debug/build/typenum-cb7a8e569dce0703/out/consts.rs.html#878' title='goto source code'>[src]</a></span></h1>
<pre class='rust typedef'>type N409 = <a class="struct" href="../../typenum/int/struct.NInt.html" title="struct typenum::int::NInt">NInt</a><<a class="type" href="../../typenum/consts/type.U409.html" title="type typenum::consts::U409">U409</a>>;</pre></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "typenum";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html> | {
"content_hash": "cfee50e43cb0abc3cf86701b21eab8b3",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 267,
"avg_line_length": 38.52212389380531,
"alnum_prop": 0.5088444750746611,
"repo_name": "nitro-devs/nitro-game-engine",
"id": "c74b90abc3284bc64f132fb46e6072f056e6f4ac",
"size": "4363",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/typenum/consts/type.N409.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CMake",
"bytes": "1032"
},
{
"name": "Rust",
"bytes": "59380"
}
],
"symlink_target": ""
} |
// http://en.cppreference.com/w/cpp/header
// Utility
#include <bitset>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <typeinfo>
#include <utility>
// Memory
#include <memory>
#include <new>
// Numeric limit
#include <cfloat>
#include <climits>
#include <limits>
// Error
#include <cassert>
#include <cerrno>
#include <exception>
#include <stdexcept>
// String
#include <cctype>
#include <cstring>
#include <cwchar>
#include <cwctype>
#include <string>
// Container
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
// Algorithm
#include <algorithm>
// Iterator
#include <iterator>
// Numeric
#include <cmath>
#include <complex>
#include <numeric>
#include <valarray>
// IO
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <ostream>
#include <sstream>
#include <strstream>
#include <streambuf>
// Localization
#include <locale>
#include <clocale>
// Etc
#include <ciso646>
#endif | {
"content_hash": "aa724287a2997dc24a20163e40b89278",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 42,
"avg_line_length": 15.455696202531646,
"alnum_prop": 0.665028665028665,
"repo_name": "kmc7468/Luce",
"id": "45b8ea4c1221091d53a0655bb35b6a4ffe9187f6",
"size": "1309",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Include/Luce/Utility/Cpp98Header.hh",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "20763"
},
{
"name": "C++",
"bytes": "8042634"
}
],
"symlink_target": ""
} |
local typeof = import("./typeof")
describe("functions.typeof", function()
it("should identify all Lua primitives", function()
local values = {
true, false, 0, "hello", {}, newproxy(true),
}
for _, value in ipairs(values) do
assert.equal(type(value), typeof(value))
end
end)
it("should identify all Instances as Instance", function()
local instances = import("../instances")
for _, instance in pairs(instances) do
assert.equal("Instance", typeof(instance:new()))
end
end)
end) | {
"content_hash": "397bc4ce581c909e70e86fdbff4b19ee",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 59,
"avg_line_length": 24.095238095238095,
"alnum_prop": 0.6758893280632411,
"repo_name": "LPGhatguy/lemur",
"id": "8451981b1fcb7af56d8fb938d0a6f2e646b4f251",
"size": "506",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/functions/typeof_spec.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "190701"
},
{
"name": "Shell",
"bytes": "109"
}
],
"symlink_target": ""
} |
#ifndef MZ_STREAM_OS_H
#define MZ_STREAM_OS_H
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
int32_t mz_stream_os_open(void *stream, const char *path, int32_t mode);
int32_t mz_stream_os_is_open(void *stream);
int32_t mz_stream_os_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_os_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_os_tell(void *stream);
int32_t mz_stream_os_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_os_close(void *stream);
int32_t mz_stream_os_error(void *stream);
void* mz_stream_os_create(void **stream);
void mz_stream_os_delete(void **stream);
void* mz_stream_os_get_interface(void);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif
| {
"content_hash": "6b523e83638d7c851c3ff04f5971b87c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 27.1875,
"alnum_prop": 0.5804597701149425,
"repo_name": "stephanheilner/ZipArchive",
"id": "80958581982c5144f61a61e5c01f6f4ee3e03861",
"size": "1223",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "SSZipArchive/minizip/mz_strm_os.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "198928"
},
{
"name": "Objective-C",
"bytes": "55040"
},
{
"name": "Ruby",
"bytes": "720"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ExampleUsage.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExampleUsage.Tests")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f0513902-cf28-4a87-82ed-35ee52682ebb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "b5934f53caaf3994ef6bd8a37235af41",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.138888888888886,
"alnum_prop": 0.7459190915542938,
"repo_name": "jason-roberts/TechDebtAttributes",
"id": "3f872b4f99dfcdd593635b772042cd549932c05e",
"size": "1412",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/TechDebtAttributes/ExampleUsage.Tests/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "15469"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Desbooks Publishing</PublisherName>
</Publisher>
| {
"content_hash": "1903588779e04523a965a90923d2237e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 52,
"avg_line_length": 31,
"alnum_prop": 0.7483870967741936,
"repo_name": "paulaburke/onix",
"id": "c6aa0f9a49f9dcdeb8b50de43d68ee8b387806a0",
"size": "155",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "data/publisher.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "102653"
},
{
"name": "XSLT",
"bytes": "3622"
}
],
"symlink_target": ""
} |
package model
import (
"context"
"errors"
"fmt"
"github.com/jackc/pgx/v4"
)
const fundByIsinQuery = `
SELECT
label,
score
FROM
funds.funds
WHERE
isin = $1
`
const fundsWithScoreAboveQuery = `
SELECT
isin,
label,
score
FROM
funds.funds
WHERE
score >= $1
ORDER BY
isin ASC
`
const fundsCreateQuery = `
INSERT INTO
funds.funds
(
isin,
label,
score
) VALUES (
$1,
$2,
$3
)
`
const fundsUpdateScoreQuery = `
UPDATE
funds.funds
SET
score = $1,
update_date = $2
WHERE
isin = $3
`
var errNilFund = errors.New("save nil Fund")
func (a *App) readFundByIsin(ctx context.Context, isin string) (Fund, error) {
item := Fund{Isin: isin}
scanner := func(row pgx.Row) error {
return row.Scan(&item.Label, &item.Score)
}
err := a.db.Get(ctx, scanner, fundByIsinQuery, isin)
return item, err
}
func (a *App) listFundsWithScoreAbove(ctx context.Context, minScore float64) (funds []Fund, err error) {
list := make([]Fund, 0)
scanner := func(rows pgx.Rows) error {
var item Fund
if err := rows.Scan(&item.Isin, &item.Label, &item.Score); err != nil {
return fmt.Errorf("scan data: %w", err)
}
list = append(list, item)
return nil
}
return list, a.db.List(ctx, scanner, fundsWithScoreAboveQuery, minScore)
}
func (a *App) saveFund(ctx context.Context, fund *Fund) (err error) {
if fund == nil {
return errNilFund
}
if _, err = a.readFundByIsin(ctx, fund.Isin); err != nil {
if err == pgx.ErrNoRows {
err = a.db.Exec(ctx, fundsCreateQuery, fund.Isin, fund.Label, fund.Score)
}
} else {
err = a.db.One(ctx, fundsUpdateScoreQuery, fund.Score, "now()", fund.Isin)
}
return
}
| {
"content_hash": "58f205139d4a3b1d149d93b9f5927df3",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 104,
"avg_line_length": 16.356435643564357,
"alnum_prop": 0.6573849878934624,
"repo_name": "ViBiOh/funds",
"id": "184d43dffe7b5cb90785ae40ced2c5075a495415",
"size": "1652",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "pkg/model/fund_db.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7126"
},
{
"name": "Go",
"bytes": "36073"
},
{
"name": "HTML",
"bytes": "1682"
},
{
"name": "JavaScript",
"bytes": "74064"
},
{
"name": "Makefile",
"bytes": "2704"
},
{
"name": "Shell",
"bytes": "134"
}
],
"symlink_target": ""
} |
/**********************************************************************
***** edit.c ***********
***** VISION editor's main module. ***********
*********************************************************************/
#include "Vk.h"
/***** local includes *****/
#include "stdcurses.h"
#include "page.h"
#include "form.h"
#include "buffers.h"
#include "menu.h"
#include "keys.h"
#include "gopt.h"
#include "error.h"
#include "rsInterface.h"
#include "choices.h"
#include "print.h"
#include "spsheet.h"
#include "vars.h"
/*************************************************
********** Forward Declarations **********
*************************************************/
PublicFnDef int browser (
void
);
PublicFnDef int ED_subShell (
void
);
PrivateFnDef int readFile (
void
);
PrivateFnDef int readFileInt (
void
);
PrivateFnDef int saveFileInt (
void
);
PrivateFnDef int saveFile (
void
);
PrivateFnDef int listFile (
void
);
PrivateFnDef int runSysMenu (
void
);
PrivateFnDef int runEditorInterface (
void
);
PrivateFnDef int execInterface (
void
);
PrivateFnDef int copyPasteBufInt (
void
);
PrivateFnDef int recall (
void
);
PrivateFnDef int printBuffer (
void
);
PrivateFnDef int saveRegionInt (
void
);
PrivateFnDef int printRegion (
void
);
#if 0
PrivateFnDef int uploadRegion (
void
);
#endif
#if 0
PrivateFnDef int downloadRegion (
void
);
#endif
PrivateFnDef int beginRegion (
void
);
PrivateFnDef int endRegion (
void
);
PrivateFnDef int clearRegion (
void
);
PrivateFnDef int deleteRegion (
void
);
PrivateFnDef int insertRegion (
void
);
PrivateFnDef int runRegion (
void
);
PrivateFnDef int switchWindow (
void
);
PrivateFnDef int oneWindow (
void
);
PrivateFnDef int eraseWindow (
void
);
PrivateFnDef int twoWindows (
void
);
PrivateFnDef int saveReportInt (
void
);
PrivateFnDef int printReportInt (
void
);
PrivateFnDef int copyPasteBufReport (
void
);
PrivateFnDef int runReportInterface (
void
);
PrivateFnDef int listReport (
void
);
PrivateFnDef int PrintScreen (
int c
);
PrivateFnDef int copyFile (
char * fname,
char * dname,
int mode,
int filter,
char * filterOpts
);
#define SourceDirEnv "VisionLibrary" /* Env. var needed to locate */
#define EditHelpName "edit.help" /* help files. */
#define OutHelpName "output.help"
PrivateVarDef char UnnamedPasteBuf[] = "default.txt";
#define OBUFSIZE 400000
#define IBUFSIZE 150000
#define RBUFSIZE 150000
#define NUMRECALL 3
#define MAX_OUTPUT_LINE_SIZE (BUF_maxlinesize-1) /* Max # of chars in one line*/
/* of the output buffer. */
#define READ 0 /* these constants are for pipe usage */
#define WRITE 1
#define STDERR 2
/*******************************************************************
********** Menu Declarations ****************************
*******************************************************************/
#define COPYPASTEBUFchoice 3
PrivateVarDef MENU_Choice fileMenu[] = {
" Read ", " Read file and insert into buffer", 'r', readFileInt, ON,
" Save ", " Save buffer contents to file", 's', saveFileInt, ON,
" Print ", " Print buffers contents", 'p', printBuffer, ON,
" Copy ", " Copy output to paste buffer", 'c', copyPasteBufInt, OFF,
" Last ", " Use Last Interface Form", 'l', runEditorInterface, ON,
" Directory ", " List Files in a given Directory", 'd', listFile, ON,
" sHell", " Enter an Operating System Sub-Shell (use 'exit' to return)", 'h', ED_subShell, ON,
NULL,
};
PrivateVarDef MENU_Choice regionMenu[] = {
" Begin ", " Mark the beginning of region at cursor", 'b', beginRegion, ON,
" End ", " Mark the end of region, save to region buffer", 'e', endRegion, ON,
" Clear ", " Clear region markers", 'c', clearRegion, ON,
" Delete ", " Delete region from the edit buffer", 'd', deleteRegion, ON,
" Insert ", " Insert region into buffer at cursor", 'i', insertRegion, ON,
" Run ", " Execute the region buffer", 'r', runRegion, ON,
" Save", " Save the region buffer", 's', saveRegionInt, ON,
" Print ", " Print regions contents", 'p', printRegion, ON,
#if 0
" UpLoad ", " Upload a file from the PC into the Region buffer",
'\0', uploadRegion, OFF,
" Lotus ", " Download a PRN file to the PC from the Region buffer",
'l', downloadRegion, ON,
#endif
NULL,
};
PrivateVarDef MENU_Choice applicMenu[] = {
" Browser ", " Browse Through Objects In System", 'b', browser, ON,
NULL,
};
PrivateVarDef MENU_Choice windowMenu[] = {
" Switch ", " Move cursor to other window", 's', switchWindow, ON,
" One ", " Enlarge current window to fill entire screen", 'o', oneWindow, ON,
" Two ", " Split the screen between Editor and Output", 't', twoWindows, ON,
" Erase ", " Erase buffer associated with current window", 'e', eraseWindow, ON,
NULL,
};
/*******************************************************************
********** Interface Form ****************************
*******************************************************************/
PrivateVarDef PAGE *interfacePage = NULL, *reportPage = NULL;
PrivateVarDef FORM *interfaceForm = NULL;
PrivateVarDef MENU *pbufSMenu = NULL, *pbufDMenu = NULL;
PrivateVarDef CUR_WINDOW *intWin1, *intWin2;
PrivateVarDef int doInterfaceClear = FALSE;
#define FILEfield 0
#define BUFFERfield 1
#define REGIONfield 2
#define PRINTERfield 3
#define PCfield 4
#define PASTEBUFfield 5
#define SourceType 1
#define SourceValue 2
#define DestType 10
#define DestValue 11
#define FilterType 19
#define FilterOpts 20
PrivateVarDef FORM_Field interfaceFields[] = {
1, 1, CUR_A_NORMAL, 7, 0, 'a', "Source:",
NULL, NULL, NULL,
1, 14, CUR_A_REVERSE, 12, 1, 'S', " ",
" Use Arrow Keys to Select Source Type, or F1 For Menu", NULL, NULL,
1, 27, CUR_A_REVERSE, 48, 1, 'X', " ",
NULL, NULL, NULL,
1, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag), 'A', " ",
" Enter Source File Name", NULL, NULL,
1, 27, CUR_A_REVERSE, 48, 0, 'M', " ",
" Use Arrow Keys to Select Source Buffer, or F1 For Menu", NULL, NULL,
1, 27, CUR_A_REVERSE, 48, 0, 'M', " ",
" Use Arrow Keys to Select Source Region, or F1 For Menu", NULL, NULL,
1, 27, CUR_A_REVERSE, 48, 0, 'M', " ",
" Use Arrow Keys to Select Source Printer, or F1 For Menu", NULL, NULL,
1, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag), 'A', " ",
" Enter PC Source File Name", NULL, NULL,
1, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag), 'A', " ",
" Enter Source Paste Buffer Name, or F1 For Menu of existing names", NULL, NULL,
3, 1, CUR_A_NORMAL, 12, 0, 'a', "Destination:",
NULL, NULL, NULL,
3, 14, CUR_A_REVERSE, 12, 1, 'S', " ",
" Use Arrow Keys to Select Destination Type, or F1 For Menu", NULL, NULL,
3, 27, CUR_A_REVERSE, 48, 1, 'X', " ",
NULL, NULL, NULL,
3, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag), 'A', " ",
" Enter Destination File Name", NULL, NULL,
3, 27, CUR_A_REVERSE, 48, 0, 'M', " ",
" Use Arrow Keys to Select Destination Buffer, or F1 For Menu", NULL, NULL,
3, 27, CUR_A_REVERSE, 48, 0, 'M', " ",
" Use Arrow Keys to Select Destination Region, or F1 For Menu", NULL, NULL,
3, 27, CUR_A_REVERSE, 48, 0, 'M', " ",
" Use Arrow Keys to Select Destination Printer, or F1 For Menu", NULL, NULL,
3, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag), 'A', " ",
" Enter PC Destination File Name", NULL, NULL,
3, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag), 'A', " ",
" Enter Destination Paste Buffer Name, or F1 For Menu of existing names", NULL, NULL,
5, 1, CUR_A_NORMAL, 7, 0, 'a', "Filter:",
NULL, NULL, NULL,
5, 14, CUR_A_REVERSE, 12, 1, 'm', " ",
" Use Arrow Keys to Select Filter Type, or F1 For Menu", NULL, NULL,
5, 27, CUR_A_REVERSE, 48, (FORM_ScrollFlag|FORM_InputFlag), 'a', " ",
" Enter Filter Options", NULL, NULL,
#if 0
7, 7, CUR_A_NORMAL, 29, 0, 'a', "Execute(F2) Quit(F9)" ,
NULL, NULL, NULL,
#endif
-1,
};
#define FILTERnone 0
#define FILTERformatter 1
#define FILTERuser 2
PrivateVarDef MENU_Choice filterChoices[] = {
"none ", " Use no intermediate filter for transfer", 'n', FORM_menuToForm, ON,
"Formatter ", " Use the VISION report formatter on Source before sending to Destination", 'f', FORM_menuToForm, ON,
"User Defined", " Use the Command in the Filter Options Field", 'u', FORM_menuToForm, ON,
NULL,
};
PrivateVarDef MENU_Choice srcChoices[] = {
"File ", " Read from a system file", 'f', FORM_menuToForm, ON,
"Buffer ", " Read from an editor buffer", 'b', FORM_menuToForm, ON,
"Region ", " Read from an editor region", 'r', FORM_menuToForm, ON,
"Printer ", " Should never get this message", 'p', FORM_menuToForm, OFF,
"PC ", " Read from a text file on the PC", 'c', FORM_menuToForm, ON,
"Paste Buffer", " Read from an Apollo Paste Buffer",'\0', FORM_menuToForm, OFF,
NULL,
};
PrivateVarDef MENU_Choice dstChoices[] = {
"File ", " Write to a text file", 'f', FORM_menuToForm, ON,
"Buffer ", " Write to an editor buffer", 'b', FORM_menuToForm, ON,
"Region ", " Should never get this message", 'r', FORM_menuToForm, OFF,
"Printer ", " Write to a printer", 'p', FORM_menuToForm, ON,
"PC ", " Write to a text file on the PC", 'c', FORM_menuToForm, ON,
"Paste Buffer", " Write to an Apollo Paste Buffer",'\0', FORM_menuToForm, OFF,
NULL,
};
#define BUFFERedit 0
#define BUFFERoutput 1
#define BUFFERtemp 2
#define BUFFERreport 3
#define BUFFERbrowse 4
PrivateVarDef MENU_Choice intBufferChoices[] = {
"Edit ", " Use editor input buffer", 'e', FORM_menuToForm, ON,
"Output ", " Use editor output buffer", 'o', FORM_menuToForm, ON,
"Temporary ", " Use temporary (Region) buffer", 't', FORM_menuToForm, ON,
"Current Report ", " Use Current Report/Profile/Statement", 'c', FORM_menuToForm, ON,
"Last Browse ", " Use Last Output from Browse Buffer", 'l', FORM_menuToForm, ON,
NULL,
};
#define REGIONlastoutput 0
#define REGIONmarked 1
PrivateVarDef MENU_Choice intRegionChoices[] = {
"Last Output ", " Use last output generated from executing the edit buffer", 'l', FORM_menuToForm, ON,
"Marked ", " Use the region between the current region markers (actually Region buffer)", 'm', FORM_menuToForm, ON,
NULL,
};
#define PRINTERsystem 0
#define PRINTERlaser 1
#define PRINTERpc 2
#ifdef OLD_PRINTER
PrivateVarDef MENU_Choice intPrinterChoices[] = {
"System ", " Use the system line printer", 's', FORM_menuToForm, ON,
"Laser ", " Use the laser printer", 'l', FORM_menuToForm, ON,
"PC ", " Use the printer attached to the PC", 'p', FORM_menuToForm, ON,
NULL,
};
#endif
#define REPORTcopyPB 2
PrivateVarDef MENU_Choice fileReportMenu[] = {
" Save ", " Save Current Report to file", 's', saveReportInt, ON,
" Print ", " Print Current Report", 'p', printReportInt, ON,
" Copy ", " Copy output to paste buffer", 'c', copyPasteBufReport, OFF,
" Last ", " Use Last Interface Form", 'l', runReportInterface, ON,
" Directory ", " List Files in a given Directory", 'd', listReport, ON,
" sHell", " Enter an Operating System Sub-Shell (use 'exit' to return)", 'h', ED_subShell, ON,
NULL,
};
/****************************************
***** System Option Descriptions *****
****************************************/
#if RSATTACH
PublicVarDecl int RS_userSystem;
PublicVarDecl int RS_autog;
#endif
#if NOTRSATTACH
PrivateVarDef int RS_userSystem = TRUE;
PrivateVarDef int RS_autog = TRUE;
#endif
/**************************************
*** GLOBAL WINDOW DECLARATIONS ETC ***
**************************************/
PrivateVarDef int EDIT_Init = FALSE;
PrivateVarDef int NotDone, ExecutedBuffer;
PrivateVarDef void editorIO();
#define EdKeys \
" Edit: Help(F1) Exec(F2) Window(F3) Interface(F5) Regions(F6) Quit(F9) "
#define OutKeys \
" Output: Help(F1) Window(F3) Interface(F5) Regions(F6) Quit(F9) "
PrivateVarDef CUR_WINDOW *StWinOne,
*StWinTwo,
*FileMenuWin,
*RegionMenuWin,
*WindowMenuWin,
*ApplicMenuWin,
*TopWin, *BotWin, *FullWin,
*CurrWin,
*CurrStat,
*HelpWin;
PrivateVarDef int FMWsr, FMWsc, FMWnr, FMWnc,
RMWsr, RMWsc, RMWnr, RMWnc,
AMWsr, AMWsc, AMWnr, AMWnc,
WMWsr, WMWsc, WMWnr, WMWnc;
PrivateVarDef MENU *FileMenu, *RegMenu, *WinMenu, *AppMenu;
PrivateVarDef int TwoWin = FALSE;
PrivateVarDef char CurrentFile[BUF_MaxPathNameChars], *CurrKeys;
/**** buffers *****/
PrivateVarDef LINEBUFFER *Edit, *Region, *Output, *CurrBuffer,
*RecallBuf[NUMRECALL];
PrivateVarDef int useBrowser = FALSE;
PrivateVarDef int doInterface = FALSE;
PrivateVarDef int RecallIndex = 0;
PublicVarDef LINEBUFFER *BrowserBuf = NULL, *BrowserInput = NULL;
#define UploadDir 0
#define DownloadDir 1
#define OVERWRITEmode 0
#define APPENDmode 1
#define ABORTmode 2
#define NOmode 3
PrivateVarDef int EDIT_fileMode = NOmode;
/***********************************
*** Macro Defines for Editor ******
***********************************/
#if defined(_AIX)
/** AIX curses will leave the terminal in ReverseVideo mode if the
*** last character printed for the screen is in ReverseVideo at the
*** time of a ^z suspend. This trailer character has normal attributes,
*** and if a refresh is done in the signal handler for SIG_TSTP,
*** will ensure that the terminal is in normal mode when a ^Z is typed...
**/
#define AppendStatusTrailer(win) CUR_waddch(win, ':')
#else
#define AppendStatusTrailer(win)
#endif
#define current_settings(win, stat, keys, buffer)\
{\
CurrWin = win;\
CurrStat = stat;\
CurrKeys = keys;\
CurrBuffer = buffer;\
}\
#define write_stat(update)\
{ \
CUR_werase (CurrStat);\
CUR_wattron(CurrStat, CUR_A_REVERSE);\
CUR_wmove(CurrStat, 0, 0);\
CUR_wprintw(CurrStat, CurrKeys);\
CUR_wattroff(CurrStat, CUR_A_REVERSE);\
if (!RS_autog)\
{\
CUR_wattron(CurrStat, CUR_A_BOLD);\
CUR_wmove(CurrStat, 0, CUR_WIN_cols(CurrStat)-6);\
CUR_wprintw(CurrStat, "DEBUG");\
CUR_wattroff(CurrStat, CUR_A_BOLD);\
}\
AppendStatusTrailer(CurrStat);\
CUR_wnoutrefresh(CurrStat);\
((update) ? CUR_doupdate() : 1 );\
}
#define init_help()\
{\
HelpWin = CUR_newwin(CUR_LINES,CUR_COLS,0,0);\
CUR_werase(HelpWin);\
if (NULL != (helpfd=fopen(helpfile, "r")))\
{\
CUR_wmove(HelpWin, 0, 0);\
while (EOF != (c=fgetc(helpfd)))\
CUR_waddch(HelpWin, c);\
fclose(helpfd);\
}\
}
#define clear_region(do_start,do_end)\
{ \
if (do_start && BUF_startcol(CurrBuffer) != -1 && BUF_startrow(CurrBuffer) != NULL){\
BUF_startcol(CurrBuffer) = -1;\
BUF_startrow(CurrBuffer) = NULL;\
}\
if (do_end && BUF_endcol(CurrBuffer) != -1 && BUF_endrow(CurrBuffer) != NULL){\
BUF_endcol(CurrBuffer) = -1;\
BUF_endrow(CurrBuffer) = NULL;\
}\
}
#define unset_markers(buffer)\
/* clear region markers */\
{\
BUF_startcol(buffer) = -1;\
BUF_startrow(buffer) = NULL;\
BUF_endrow(buffer) = NULL;\
BUF_endcol(buffer) = -1;\
}
#define one_window()\
{\
CurrWin = FullWin;\
BUF_paintWindow(CurrBuffer, CurrWin);\
CurrStat = StWinOne;\
write_stat(FALSE);\
TwoWin = FALSE;\
}
#define two_windows()\
{\
BUF_paintWindow(Edit, TopWin);\
CUR_werase (StWinTwo);\
CUR_wattron(StWinTwo, CUR_A_REVERSE);\
CUR_wmove(StWinTwo, 0, 0);\
CUR_wprintw(StWinTwo, EdKeys);\
CUR_wattroff(StWinTwo, CUR_A_REVERSE);\
if (!RS_autog)\
{\
CUR_wattron(StWinTwo, CUR_A_BOLD);\
CUR_wmove(StWinTwo, 0, CUR_WIN_cols(StWinTwo)-6);\
CUR_wprintw(StWinTwo, "DEBUG");\
CUR_wattroff(StWinTwo, CUR_A_BOLD);\
}\
AppendStatusTrailer (StWinTwo);\
BUF_paintWindow(Output, BotWin);\
CUR_werase (StWinOne);\
CUR_wattron(StWinOne, CUR_A_REVERSE);\
CUR_wmove(StWinOne, 0, 0);\
CUR_wprintw(StWinOne, OutKeys);\
CUR_wattroff(StWinOne, CUR_A_REVERSE);\
AppendStatusTrailer (StWinOne);\
TwoWin = TRUE;\
if (CurrBuffer == Edit)\
{\
CurrWin = TopWin;\
CurrStat = StWinTwo;\
}\
else\
{\
CurrWin = BotWin;\
CurrStat = StWinOne;\
}\
}
#define refresh_two()\
{\
CUR_touchwin(TopWin);\
CUR_wnoutrefresh(TopWin);\
CUR_touchwin(StWinTwo);\
CUR_wnoutrefresh(StWinTwo);\
CUR_touchwin(BotWin);\
CUR_wnoutrefresh(BotWin);\
CUR_touchwin(StWinOne);\
CUR_wnoutrefresh(StWinOne);\
CUR_doupdate();\
}
#define refresh_one()\
{\
CUR_touchwin(FullWin);\
CUR_wnoutrefresh(FullWin);\
CUR_touchwin(StWinOne);\
CUR_wnoutrefresh(StWinOne);\
CUR_doupdate();\
}
#define hold_screen()\
{\
CUR_waddstr(HelpWin, "\n Hit any key to continue.....");\
CUR_touchwin(HelpWin);\
CUR_wrefresh(HelpWin);\
KEY_getkey(FALSE);\
KEY_QuoteNextKey = FALSE;\
}\
PrivateFnDef int
copyToPasteBuf()
{
return(FALSE);
}
/************************************
*** EDITOR ***
*** When in top window of editor ***
************************************/
PrivateFnDef editor()
{
int c, i, j, length, error, cursrow, curscol;
char *ptr, helpfile[BUF_MaxPathNameChars], *SrcDirName, *getenv();
FILE *helpfd;
SrcDirName = getenv(SourceDirEnv);
if( SrcDirName != NULL )
{
strcpy(helpfile, SrcDirName);
strcat(helpfile,"/");
strcat(helpfile, EditHelpName);
}
else
helpfile[0] = '\0';
/*** erase buffer ***/
if( ExecutedBuffer )
{
BUF_eraseBuffer(Edit);
ExecutedBuffer = FALSE;
}
/*** initialize region markers ***/
/* unset_markers(Edit);*/
/*** display initial screen from the top down ***/
current_settings(TopWin, StWinTwo, EdKeys, Edit);
twoWindows();
ERR_clearMsg();
NotDone = TRUE;
while (NotDone)
{
/*** only refresh screen when there are no characters ***/
if( RepetitionCount > 0 )
{
RepetitionCount--;
c = RepetitionKey;
if( RepetitionQuote )
{
if( (c > 0x00) && (c <= 0x7f) )
{
if ( error = BUF_insertChar (Edit, c, CurrWin))
ERR_displayError(error);
}
else
{
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
}
continue;
}
}
else
{
if (!KEY_cready())
{
if (BUF_repaintScreen(Edit))
BUF_paintWindow(Edit, CurrWin);
BUF_moveCursor(Edit, CurrWin, cursrow, curscol, i);
/* CUR_touchwin (CurrWin);*/
CUR_wnoutrefresh(CurrWin);
CUR_doupdate();
CUR_forceSetCursor(CurrWin, cursrow, curscol);
}
c = KEY_getkey(TRUE);
}
if (BUF_row(Edit) == NULL)
length = 0;
else
length = strlen(BUF_editRow(Edit));
if (ERR_msgDisplayed)
ERR_clearMsg();
switch(c) {
case -1:
case 0:
break;
case KEY_COPYPB:
copyToPasteBuf();
break;
case KEY_REPEAT:
if( ERR_promptForRepetition(&i,CurrWin,CUR_WIN_cury(CurrWin),CUR_WIN_curx(CurrWin)) ||
(i <= 1) )
break;
if( (RepetitionKey = KEY_getkey(FALSE)) == KEY_QUOTE )
{
RepetitionQuote = TRUE;
RepetitionKey = KEY_getkey(FALSE);
}
else
RepetitionQuote = FALSE;
RepetitionCount = i;
break;
case KEY_WORDFORW:
BUF_forwardWord(Edit,CurrWin);
break;
case KEY_WORDBACK:
BUF_backwardWord(Edit,CurrWin);
break;
case KEY_WORDDELC:
BUF_deleteCurrWord(Edit,CurrWin);
break;
case KEY_WORDDELP:
BUF_deletePrevWord(Edit,CurrWin);
break;
case KEY_ONEWINDOW:
oneWindow();
refresh_one();
RepetitionCount = 0;
break;
case KEY_TWOWINDOW:
twoWindows();
refresh_two();
RepetitionCount = 0;
break;
case KEY_ERASEWIN:
eraseWindow();
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_EXEC:
ERR_displayMsg(ERR_ExecBuffer);
#if RSATTACH
editorIO (Edit, Output, Output);
#endif
ExecutedBuffer = TRUE;
RepetitionCount = 0;
BUF_screenRow(Output) = 0;
return(FALSE);
case KEY_RECALL:
recall();
RepetitionCount = 0;
BUF_resetScreen(Edit, CurrWin);
break;
case KEY_ZEROROW:
BUF_screenRow(Edit) = 0;
BUF_resetScreen(Edit, CurrWin);
RepetitionCount = 0;
break;
case KEY_SCROLLUP1:
BUF_scrollUp1(Edit, CurrWin);
break;
case KEY_SCROLLDN1:
BUF_scrollDown1(Edit, CurrWin);
break;
case KEY_HELP:
init_help();
CUR_touchwin(HelpWin);
CUR_wrefresh(HelpWin);
KEY_getkey(FALSE);
KEY_QuoteNextKey = FALSE;
CUR_delwin(HelpWin);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
write_stat (TRUE);
}
ERR_clearMsg();
RepetitionCount = 0;
break;
case KEY_WINDOW:
MENU_handler(WinMenu, WindowMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case CUR_KEY_F4:
if( DefaultModule != NULL )
{
(*DefaultModule)();
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
}
else
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
break;
case KEY_FILES:
MENU_handler(FileMenu, FileMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_REGIONS:
MENU_handler(RegMenu, RegionMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_SMENU:
/* ERR_displayError(ERR_UndefKey);*/
runSysMenu();
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_AMENU:
MENU_handler(AppMenu, ApplicMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_QUIT:
RepetitionCount = 0;
QuitSystem();
if( PAGE_ExitSystem )
return TRUE;
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
break;
case KEY_PREV:
RepetitionCount = 0;
return TRUE;
case KEY_SCRIPTR:
RepetitionCount = 0;
KEY_beginScriptRead();
break;
case KEY_SCRIPTW:
RepetitionCount = 0;
KEY_beginScriptWrite();
break;
case KEY_SUBSHELL:
RepetitionCount = 0;
ED_subShell();
if (TwoWin)
{
refresh_two();
}
else
refresh_one();
break;
case KEY_BKSP:
if (error = BUF_backSpace (Edit, CurrWin))
ERR_displayError(error);
break;
case STD_CTRL('Z'):
/*** toggles on and off the autog setting ***/
/* autog should only be off to use the debugger so no users can
set it */
if (!RS_userSystem)
{
RS_autog = !RS_autog;
write_stat (TRUE);
}
else ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
break;
case KEY_VEOL:
BUF_goToEOL(Edit, length, CurrWin);
RepetitionCount = 0;
break;
case KEY_BOL:
BUF_goToBOL(Edit, CurrWin);
RepetitionCount = 0;
break;
case KEY_BKCH:
case CUR_KEY_LEFT:
BUF_keyLeft(Edit, length, CurrWin);
break;
case KEY_NL:
case CUR_KEY_DOWN:
BUF_keyDown(Edit, length, CurrWin);
break;
case KEY_UPL:
case CUR_KEY_UP:
BUF_keyUp(Edit, length, CurrWin);
break;
case KEY_FCH:
case CUR_KEY_RIGHT:
BUF_keyRight(Edit, length, CurrWin);
break;
case KEY_DEL:
if (error = BUF_deleteChar (Edit, CurrWin))
ERR_displayError(error);
break;
case KEY_CR:
case STD_CTRL('J'):
if (error = BUF_carrReturn (Edit, CurrWin))
ERR_displayError(error);
break;
case KEY_DELEOL:
BUF_deleteEOL(Edit, length, CurrWin, ptr);
break;
case KEY_REPAINT:
CUR_clearok(CUR_curscr);
CUR_wrefresh(CUR_curscr);
RepetitionCount = 0;
break;
case KEY_SCR_R:
BUF_scrollRight(Edit, CurrWin, i);
break;
case KEY_SCR_L:
BUF_scrollLeft(Edit, CurrWin);
break;
case KEY_SCR_U:
BUF_scrollUp(Edit, CurrWin);
break;
case KEY_SCR_D:
BUF_scrollDown(Edit, CurrWin, i);
break;
case KEY_TOP:
BUF_goToTop(Edit, CurrWin);
RepetitionCount = 0;
break;
case KEY_BOTTOM:
BUF_goToBottom(Edit, CurrWin, i);
RepetitionCount = 0;
break;
case KEY_SEARCH:
BUF_searchString(Edit, CurrWin);
RepetitionCount = 0;
break;
case KEY_SNEXT:
BUF_searchNext(Edit, CurrWin);
break;
case KEY_SPREV:
BUF_searchPrev(Edit, CurrWin);
break;
case KEY_TAB:
#if 0
i = (((BUF_col(Edit) + RS_TabSpacing) / RS_TabSpacing) *
RS_TabSpacing) - BUF_col(Edit);
for( j=0 ; j<i ; j++ )
if (error = BUF_insertChar(Edit, ' ', CurrWin))
ERR_displayError(error);
#endif
if (error = BUF_insertChar(Edit, '\t', CurrWin))
ERR_displayError(error);
break;
case KEY_BEGREGION:
beginRegion();
RepetitionCount = 0;
break;
case KEY_ENDREGION:
endRegion();
RepetitionCount = 0;
break;
case KEY_QUERYR:
BUF_queryReplaceString(Edit, CurrWin);
RepetitionCount = 0;
break;
case KEY_REPLACE:
BUF_replaceString(Edit, CurrWin);
RepetitionCount = 0;
break;
case KEY_READFILE:
readFile();
doInterface = FALSE;
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
break;
case KEY_SAVEFILE:
if( !strlen(CurrentFile) )
ERR_displayStr("No current file",TRUE);
else if( (error = BUF_writeFile(CurrBuffer, CurrentFile)) )
ERR_displayError(error);
else
ERR_displayMsg(ERR_WroteFile);
RepetitionCount = 0;
break;
case KEY_WRITEFILE:
saveFile();
doInterface = FALSE;
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_TOGGLEWIN: /* switch to bottom window */
NotDone = FALSE; /* done with this EDIT */
break;
case KEY_INSERTREG:
insertRegion();
break;
case KEY_DELREGION:
deleteRegion();
RepetitionCount = 0;
break;
case KEY_QUOTE:
c = KEY_getkey(FALSE);
if( (c > 0x00) && (c <= 0x7f) )
{
if ( error = BUF_insertChar (Edit, c, CurrWin))
ERR_displayError(error);
}
else
{
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
}
break;
default:
if( !(c & ~0x7f) && isprint(c) )
{
if ( error = BUF_insertChar (Edit, c, CurrWin))
ERR_displayError(error);
}
else
{
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
}
break;
} /*** switch ***/
} /*** while NotDone ***/
return (FALSE);
}
/*************************************************
********** Window Functions **********
*************************************************/
PrivateFnDef int switchWindow (
void
)
{
NotDone = FALSE;
}
PrivateFnDef int eraseWindow (
void
)
{
int error;
if (error = BUF_eraseBuffer(CurrBuffer))
ERR_displayError(error);
else
CUR_werase(CurrWin);
}
PrivateFnDef int oneWindow (
void
)
{
one_window();
}
PrivateFnDef int twoWindows (
void
)
{
two_windows();
refresh_two();
}
/*************************************************
********** File Functions **********
*************************************************/
PrivateFnDef int readFilePrime (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
MENU_currChoice(mptr) = BUFFERedit;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = FILEfield;
if (strlen(CurrentFile) > (size_t)0) strncpy(
FORM_fieldValue(FORM_field(interfaceForm,SourceType+2+FILEfield)),
CurrentFile,
FORM_fieldLen(FORM_field(interfaceForm,SourceType+2+FILEfield))
);
FORM_currField(interfaceForm) = SourceValue;
runEditorInterface();
BUF_resetScreen(CurrBuffer, CurrWin);
}
PrivateFnDef int readFile (
void
)
{
int error;
/**** always read into the Edit buffer ****/
if (CurrBuffer != Edit)
{
KEY_putc(KEY_READFILE);
NotDone = FALSE;
}
else
{
if( !doInterface && (error = BUF_readFile(CurrBuffer, CurrentFile)) != ERR_AskedForHelp )
{
if( error == 0 )
ERR_displayMsg(ERR_ReadFile);
else if( error != ERR_AbortedPrompt )
ERR_displayError(error);
BUF_resetScreen(CurrBuffer, CurrWin);
return;
}
readFilePrime();
doInterface = FALSE;
}
}
PrivateFnDef int readFileInt (
void
)
{
doInterface = TRUE;
readFile();
}
/*---------------------------------------------------------------------*/
PrivateFnDef int
checkFileExistence(dname)
char *dname;
{
int response;
int mode = OVERWRITEmode;
if( access(dname,0) == 0 )
{
if( access(dname,02) == -1 )
{
ERR_displayPause("You do not have permission to write to file");
return(ABORTmode);
}
if( EDIT_fileMode != NOmode )
return(EDIT_fileMode);
response = ERR_promptForChar("Destination file exists, Overwrite/Append/Abort (o/a/<F9>)? ","OoAa");
if( response == KEY_PREV || response == KEY_QUIT )
return(ABORTmode);
if( response == 'A' || response == 'a' )
mode = APPENDmode;
}
return(mode);
}
PrivateFnDef int
getFileName(current_file, pstr)
char *current_file, *pstr;
{
char string[BUF_MaxPathNameChars], prompt[BUF_MaxPathNameChars + 80];
int error;
if (!strlen(current_file))
{
sprintf(prompt, "No current file, enter file to %s to: ",pstr);
if (error = ERR_promptForString(prompt, string, TRUE))
return(error);
else
{
if (strlen(string))
strcpy(current_file, string);
else
return(ERR_AbortedPrompt);
}
}
else
{
sprintf(prompt,
"Enter filename or <CR> to %s to %s: ", pstr, current_file);
if (error = ERR_promptForString(prompt, string, TRUE))
return(error);
if (strlen(string))
strcpy(current_file, string);
}
return(FALSE);
}
PrivateFnDef int saveFilePrime (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
MENU_currChoice(mptr) = (CurrBuffer == Edit ? BUFFERedit : BUFFERoutput);
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = FILEfield;
if (strlen(CurrentFile) > (size_t)0) strncpy (
FORM_fieldValue(FORM_field(interfaceForm,DestType+2+FILEfield)),
CurrentFile,
FORM_fieldLen(FORM_field(interfaceForm,DestType+2+FILEfield))
);
FORM_currField(interfaceForm) = DestValue;
runEditorInterface();
}
PrivateFnDef int saveFile (
void
)
{
int error, mode;
if( !doInterface && (error = getFileName(CurrentFile,"write")) != ERR_AskedForHelp )
{
if( error == 0 )
{
if( (mode = checkFileExistence(CurrentFile)) == ABORTmode )
return;
if( (mode == OVERWRITEmode ) &&
(error = BUF_writeFile(CurrBuffer, CurrentFile)) )
ERR_displayError(error);
else if( (mode == APPENDmode) &&
(error = BUF_appendToFile(CurrBuffer, CurrentFile)) )
ERR_displayError(error);
else
ERR_displayMsg(ERR_WroteFile);
}
return;
}
saveFilePrime();
}
PrivateFnDef int saveFileInt (
void
)
{
doInterface = TRUE;
saveFile();
doInterface = FALSE;
}
PrivateFnDef int saveReportInt (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
MENU_currChoice(mptr) = (useBrowser ? BUFFERbrowse : BUFFERreport);
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = FILEfield;
if (strlen(CurrentFile) > (size_t)0) strncpy (
FORM_fieldValue(FORM_field(interfaceForm,DestType+2+FILEfield)),
CurrentFile,
FORM_fieldLen(FORM_field(interfaceForm,DestType+2+FILEfield))
);
FORM_currField(interfaceForm) = DestValue;
runReportInterface();
}
PrivateFnDef int copyPasteBufInt (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = REGIONfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+REGIONfield));
MENU_currChoice(mptr) = REGIONlastoutput;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = PASTEBUFfield;
FORM_currField(interfaceForm) = DestValue;
runEditorInterface();
}
PrivateFnDef int copyPasteBufReport (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
MENU_currChoice(mptr) = (useBrowser ? BUFFERbrowse : BUFFERreport);
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = PASTEBUFfield;
FORM_currField(interfaceForm) = DestValue;
runReportInterface();
}
/*---------------------------------------------------------------------*/
PrivateVarDef int RefreshAfterList = TRUE;
PrivateFnDef int listFile (
void
)
/* 1) asks the user for a directory name */
/* 2) displays an "ll" of that directory */
/* 3) waits for the user to hit any key */
/* 4) returns to editing session */
{
char Directory[BUF_MaxPathNameChars], buf[BUF_MaxPathNameChars + 80];
int pipe1[2];
int pipe2[2];
FILE *fp;
int onechar;
if (BUF_listFile(CurrBuffer, Directory))
ERR_clearMsg();
else
{
ERR_clearMsg();
CUR_wrefresh(ERR_Window);
if (isBlank(Directory))
strcpy(Directory,".");
HelpWin = CUR_newwin(CUR_LINES,CUR_COLS,0,0);
CUR_werase(HelpWin);
CUR_wmove(HelpWin, 0, 0); /* cursor at top left */
pipe(pipe1);
pipe(pipe2);
if (vfork()==0) {
close(pipe1[READ]); /* child won't be reading */
close(WRITE);
dup(pipe1[WRITE]); /* child's stdout is the write end of pipe1 */
close(pipe1[WRITE]);
close(pipe2[READ]); /* child won't be reading */
close(STDERR);
dup(pipe2[WRITE]); /* child's stderr is the write end of pipe2 */
close(pipe2[WRITE]);
sprintf(buf,"/bin/csh -if -c \"/bin/ls -p -l %s\"",Directory);
execl ("/bin/sh", "ll", "-c", buf, NULL);
_exit(1);
} /* if */
else {
close(pipe1[WRITE]); /* parent won't be writing */
close(pipe2[WRITE]);
fp = fdopen(pipe1[READ],"r"); /* Normal exec of ls */
while ( (onechar = getc(fp)) != EOF )
PrintScreen(onechar);
fclose(fp);
fp = fdopen(pipe2[READ],"r"); /* Error with ls */
while ( (onechar = getc(fp)) != EOF )
PrintScreen(onechar);
fclose(fp);
hold_screen(); /* macro asking user to hit key to cont. */
CUR_delwin(HelpWin);
if( RefreshAfterList )
{
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
write_stat(TRUE);
}
}
} /* else */
} /* else */
}
PrivateFnDef int listReport (
void
)
{
RefreshAfterList = FALSE;
listFile();
RefreshAfterList = TRUE;
}
/*---------------------------------------------------------------------*/
PrivateFnDef int PrintScreen (
int c
)
{
int y;
y = CUR_WIN_cury(HelpWin);
if (y==(CUR_WIN_rows(HelpWin)-3)) /* screen is full */
{
hold_screen(); /* macro asking user to hit key to cont. */
CUR_werase(HelpWin);
}
CUR_waddch(HelpWin, c);
}
/*---------------------------------------------------------------------*/
#if 0
PrivateFnDef int appendFilePrime()
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
MENU_currChoice(mptr) = (CurrBuffer == Edit ? BUFFERedit : BUFFERoutput);
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = FILEfield;
if( strlen(CurrentFile) > 0 )
strncpy(FORM_fieldValue(FORM_field(interfaceForm,DestType+2+FILEfield)),
CurrentFile,
FORM_fieldLen(FORM_field(interfaceForm,DestType+2+FILEfield)));
FORM_currField(interfaceForm) = DestValue;
EDIT_fileMode = APPENDmode;
runEditorInterface();
EDIT_fileMode = NOmode;
}
PrivateFnDef int appendFile (
void
)
{
int error;
if( !doInterface && (error = getFileName(CurrentFile,"append")) != ERR_AskedForHelp )
{
if( error == 0 )
{
EDIT_fileMode = APPENDmode;
if( checkFileExistence(CurrentFile) == ABORTmode )
{
EDIT_fileMode = NOmode;
return;
}
EDIT_fileMode = NOmode;
if( error = BUF_appendToFile(CurrBuffer, CurrentFile) )
ERR_displayError(error);
else
ERR_displayMsg(ERR_WroteFile);
}
return;
}
appendFilePrime();
}
PrivateFnDef int appendFileInt (
void
)
{
doInterface = TRUE;
appendFile();
doInterface = FALSE;
}
#endif
/*---------------------------------------------------------------------*/
#if 0
PrivateFnDef int currentFile (
void
)
{
char buffer[BUF_MaxPathNameChars + 80];
sprintf(buffer, " Current file is: %s ", CurrentFile);
ERR_displayPause(buffer);
return(FALSE);
}
#endif
/*---------------------------------------------------------------------*/
PublicFnDef int ED_update()
{
int len, success, error;
int i = 1;
char fname[BUF_MaxPathNameChars], path[BUF_MaxPathNameChars], user[80];
char buffer2[MAX_OUTPUT_LINE_SIZE + 1], buffer3[80], *cptr, *getenv();
static char *output = ">>> Object Network Updated";
ERR_promptForString("Please enter your initials: ", user, FALSE);
CUR_wmove(CUR_stdscr,0,0);
CUR_wprintw(CUR_stdscr,"Saving Global Environment... (User: %s)\n",user);
CUR_refresh();
if( !EDIT_Init )
{
Output = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(Output) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(Output, OBUFSIZE);
EDIT_Init = TRUE;
}
BUF_appendLine(Output," ");
BUF_appendLine(Output," ");
sprintf(buffer3,"Saving Global Environment... (User: %s)",user);
BUF_appendLine(Output,buffer3);
RS_writeLine("?w");
RS_compile();
success = FALSE;
len = strlen(output);
while (RS_readLine (buffer2, MAX_OUTPUT_LINE_SIZE))
{
if (0 == strncmp(buffer2, output, len))
success = TRUE;
BUF_appendLine(Output,buffer2);
}
if (success)
CUR_wprintw(CUR_stdscr,"\nNetwork Update Successful\n\n");
else
{
CUR_wattron(CUR_stdscr,(CUR_A_BLINK | CUR_A_BOLD));
CUR_wprintw(CUR_stdscr,"\nError Saving Network\n\n");
CUR_wattroff(CUR_stdscr,(CUR_A_BLINK | CUR_A_BOLD));
}
CUR_refresh();
cptr = getenv("DBUpdateLogs");
if( cptr == NULL )
{
CUR_wattron(CUR_stdscr,(CUR_A_BLINK | CUR_A_BOLD));
CUR_wprintw(CUR_stdscr,"Environment variable 'DBUpdateLogs' not set.\n");
CUR_wattroff(CUR_stdscr,(CUR_A_BLINK | CUR_A_BOLD));
CUR_wprintw(CUR_stdscr,"Creating file 'tempLog' in current directory\n");
CUR_refresh();
if( (error = BUF_writeFile( Output, "tempLog" )) )
ERR_displayMsgPause(error);
else
{
chmod("tempLog",0640);
ERR_displayPause(" Contact your INSYTE representative");
}
return;
}
strcpy(path,cptr);
if( access(path,2) )
{
CUR_wattron(CUR_stdscr,(CUR_A_BLINK | CUR_A_BOLD));
CUR_wprintw(CUR_stdscr,"Logs directory: '%s' not accessible.\n",path);
CUR_wattroff(CUR_stdscr,(CUR_A_BLINK | CUR_A_BOLD));
CUR_wprintw(CUR_stdscr,"Creating file 'tempLog' in current directory\n");
CUR_refresh();
if( (error = BUF_writeFile( Output, "tempLog" )) )
ERR_displayMsgPause(error);
else
{
chmod("tempLog",0640);
ERR_displayPause(" Contact your INSYTE representative");
}
return;
}
sprintf(fname,"%s/%d",path,i);
while( !access(fname,0) ) {
i++;
sprintf(fname,"%s/%d",path,i);
}
CUR_wprintw(CUR_stdscr,"Saving output buffer to log file '%s'\n",fname);
CUR_refresh();
if( (error = BUF_writeFile( Output, fname )) )
{
ERR_displayMsgPause(error);
return;
}
else if( success )
ERR_displayPause(" Successful save of network");
else
ERR_displayPause(" Unsuccessful save of network");
chmod(fname,0440);
}
/*************************************************
********** Region Functions **********
*************************************************/
PrivateFnDef int beginRegion (
void
)
{
unset_markers(CurrBuffer);
if BUF_editted(CurrBuffer)
BUF_adjustRow(CurrBuffer);
BUF_startrow(CurrBuffer) = BUF_row(CurrBuffer);
BUF_startcol(CurrBuffer) = BUF_col(CurrBuffer);
ERR_displayMsg(ERR_BegRegion);
}
/*---------------------------------------------------------------------*/
PrivateFnDef int test_region()
{
/* Checks: */
/* 1) for valid values in the region vars (Ex. no negative numbers) */
/* 2) that start_region != end_region */
/* 3) that start_region precedes end_region */
int col, foundit;
char *row;
if (BUF_startcol(CurrBuffer) == -1 || BUF_endcol(CurrBuffer) == -1 ||
BUF_startrow(CurrBuffer) == NULL || BUF_endrow(CurrBuffer) == NULL)
{
ERR_displayError (ERR_NoRegion);
unset_markers(CurrBuffer);
return(TRUE);
}
if (BUF_startrow(CurrBuffer) == BUF_endrow(CurrBuffer) && BUF_startcol(CurrBuffer) == BUF_endcol(CurrBuffer))
{
ERR_displayError (ERR_BadRegion);
return(TRUE);
}
if (BUF_startrow(CurrBuffer) == BUF_endrow(CurrBuffer)) /* If start and end regions are on */
{ /* the same row, make sure the */
if (BUF_startcol(CurrBuffer) > BUF_endcol(CurrBuffer)) /* start column precedes the end */
{ /* column. If they are not in the */
col = BUF_startcol(CurrBuffer); /* correct order, they are switched*/
BUF_startcol(CurrBuffer) = BUF_endcol(CurrBuffer);
BUF_endcol(CurrBuffer) = col;
}
}
else
{ /* Make sure StartRow precedes */
row = BUF_startrow(CurrBuffer);/* EndRow. If this is not true, */
foundit = FALSE; /* swap end region with start */
while (row != NULL) /* region. */
{
if (row == BUF_endrow(CurrBuffer))
{
foundit = TRUE;
break;
}
row = BUF_nextLine(row);
}
if (!foundit)
{
row = BUF_startrow(CurrBuffer);
BUF_startrow(CurrBuffer) = BUF_endrow(CurrBuffer);
BUF_endrow(CurrBuffer) = row;
col = BUF_startcol(CurrBuffer);
BUF_startcol(CurrBuffer) = BUF_endcol(CurrBuffer);
BUF_endcol(CurrBuffer) = col;
}
}
return(FALSE);
}
/*---------------------------------------------------------------------*/
/* Used by the buffers module to check validity of regions */
PublicFnDef void ED_unsetMarkers(buffer)
LINEBUFFER *buffer;
{
unset_markers(buffer);
}
PrivateFnDef int endRegion (
void
)
{
int error;
if BUF_editted(CurrBuffer)
{
if( BUF_startrow(CurrBuffer) == BUF_row(CurrBuffer) )
{
ERR_displayStr(" Begin mark has been invalidated.", TRUE);
ED_unsetMarkers(CurrBuffer);
return(TRUE);
}
BUF_adjustRow(CurrBuffer);
}
BUF_endrow(CurrBuffer) = BUF_row(CurrBuffer);
BUF_endcol(CurrBuffer) = BUF_col(CurrBuffer);
if (test_region ())
return(TRUE); /* error with region */
if (error = BUF_eraseBuffer(Region)) /* erases previous region */
{
ERR_displayError(error);
}
else
{
if (error = BUF_appendRegion(Region, CurrBuffer,
BUF_startrow(CurrBuffer), BUF_startcol(CurrBuffer), BUF_endrow(CurrBuffer), BUF_endcol(CurrBuffer)))
{
ERR_displayError(error);
}
else
ERR_displayMsg(ERR_EndRegion);
}
return(FALSE);
}
/*---------------------------------------------------------------------*/
PrivateFnDef int clearRegion (
void
)
{
unset_markers(CurrBuffer);
BUF_eraseBuffer(Region);
ERR_displayMsg(ERR_ClearRegion);
}
/*---------------------------------------------------------------------*/
PrivateFnDef int deleteRegion (
void
)
{
int error;
if (test_region ()) /* needed because beginRegion doesn't do it*/
return(TRUE); /* error with region */
if (error = BUF_deleteRegion(CurrBuffer, BUF_startrow(CurrBuffer), BUF_startcol(CurrBuffer),
BUF_endrow(CurrBuffer), BUF_endcol(CurrBuffer)))
ERR_displayError(error);
else
{
BUF_resetScreen(CurrBuffer, CurrWin);
ERR_displayMsg(ERR_DeleteRegion);
}
unset_markers(CurrBuffer);
return(FALSE);
}
/*---------------------------------------------------------------------*/
PrivateFnDef int insertRegion (
void
)
{
int error;
if (BUF_firstLine(Region) == NULL && BUF_lastLine(Region) == NULL)
{
ERR_displayError(ERR_NoRegion);
return(TRUE);
}
if (error = BUF_insertRegion(CurrBuffer, CurrWin, Region))
ERR_displayError(error);
else
ERR_displayMsg(ERR_InsertRegion);
BUF_resetScreen(CurrBuffer, CurrWin);
return(FALSE);
}
/*---------------------------------------------------------------------*/
PrivateFnDef int runRegion (
void
)
{
/*
if (CurrBuffer == Output)
{
ERR_displayError(ERR_UndefFn);
return(FALSE);
}
if (test_region())
return(TRUE);
*/
if (BUF_firstLine(Region) == NULL && BUF_lastLine(Region) == NULL)
{
ERR_displayError(ERR_NoRegion);
return(TRUE);
}
ERR_displayMsg(ERR_ExecRegion);
#if RSATTACH
editorIO(Region, Output, Output);
#endif
if (CurrBuffer != Output)
NotDone = FALSE;
return(FALSE);
}
/*---------------------------------------------------------------------*/
static char uplTemplate[] = "/tmp/uplXXXXXX" ;
static char dnlTemplate[] = "/tmp/dnlXXXXXX" ;
#if 0
PrivateFnDef int uploadRegion (
void
)
{
int error;
char *s, tname[128], pcname[128], *mktemp(), cmd[128];
strcpy(tname,uplTemplate);
if( !strlen((s = mktemp(tname))) )
{
ERR_displayError(ERR_OpenError);
return(TRUE);
}
if (error = ERR_promptForString("Enter name of file on PC to upload (F9 to abort): ", pcname, TRUE))
{
if( error == ERR_AbortedPrompt )
return(FALSE);
else
return(error);
}
else if (!strlen(pcname))
return(FALSE);
ERR_clearMsg();
sprintf(cmd,"/bin/csh -if -c \"/usr/local/bin/pcupload %s %s\"",s,pcname);
CUR_saveterm();
CUR_resetterm();
RS_system(cmd);
CUR_fixterm();
CUR_noecho();
CUR_nonl();
CUR_cbreak();
CUR_clearok(CUR_curscr);
CUR_wrefresh(CUR_curscr);
if (TwoWin)
{
refresh_two();
}
else
refresh_one();
ERR_clearMsg();
BUF_eraseBuffer(Region);
if( (error = BUF_getFile( Region, s )) )
{
ERR_displayStr(" Unable to access temporary file",TRUE);
return(TRUE);
}
remove(s);
return(FALSE);
}
#endif
#if 0
PrivateFnDef int downloadRegion (
void
)
{
int error;
char *s, tname[128], pcname[128], *mktemp(), cmd[128];
if (BUF_firstLine(Region) == NULL && BUF_lastLine(Region) == NULL)
{
ERR_displayError(ERR_NoRegion);
return(TRUE);
}
strcpy(tname,dnlTemplate);
if( !strlen((s = mktemp(tname))) )
{
ERR_displayError(ERR_OpenError);
return(TRUE);
}
if( (error = BUF_writeFile( Region, s )) )
{
ERR_displayStr(" Unable to access temporary file",TRUE);
return(TRUE);
}
if (error = ERR_promptForString("Enter name of file (.PRN added automatically) (F9 to abort): ", pcname, TRUE))
{
if( error == ERR_AbortedPrompt )
return(FALSE);
else
return(error);
}
else if (!strlen(pcname))
return(FALSE);
ERR_clearMsg();
strcat(pcname,".PRN");
sprintf(cmd,"/bin/csh -if -c \"/usr/local/bin/pcdownload %s %s\"",s,pcname);
CUR_saveterm();
CUR_resetterm();
RS_system(cmd);
CUR_fixterm();
CUR_noecho();
CUR_nonl();
CUR_cbreak();
CUR_clearok(CUR_curscr);
CUR_wrefresh(CUR_curscr);
if (TwoWin)
{
refresh_two();
}
else
refresh_one();
ERR_clearMsg();
remove(s);
return(FALSE);
}
#endif
PrivateFnDef int saveRegionPrime (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = REGIONfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+REGIONfield));
MENU_currChoice(mptr) = REGIONmarked;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = FILEfield;
if (strlen(CurrentFile) > (size_t)0)
strncpy(FORM_fieldValue(FORM_field(interfaceForm,DestType+2+FILEfield)),
CurrentFile,
FORM_fieldLen(FORM_field(interfaceForm,DestType+2+FILEfield)));
FORM_currField(interfaceForm) = DestValue;
runEditorInterface();
}
PrivateFnDef int saveRegion (
void
)
{
int error, mode;
if (BUF_firstLine(Region) == NULL && BUF_lastLine(Region) == NULL)
{
ERR_displayError(ERR_NoRegion);
return(TRUE);
}
if( (error = getFileName(CurrentFile,"write")) != ERR_AskedForHelp )
{
if( error == 0 )
{
if( (mode = checkFileExistence(CurrentFile)) == ABORTmode )
return(FALSE);
if( (mode == OVERWRITEmode) &&
(error = BUF_writeFile(Region, CurrentFile)) )
ERR_displayError(error);
else if( (mode == APPENDmode) &&
(error = BUF_appendToFile(Region, CurrentFile)) )
ERR_displayError(error);
else
ERR_displayMsg(ERR_WroteFile);
}
return(TRUE);
}
saveRegionPrime();
return(FALSE);
}
PrivateFnDef int saveRegionInt (
void
)
{
doInterface = TRUE;
saveRegion();
doInterface = FALSE;
}
PrivateFnDef int printRegion (
void
)
{
#if 0
PAGE *page;
int i;
/*** print needs to know the current screen contents, so make page ***/
if (TwoWin)
{
PAGE_createPage(page, 4, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(page, 0, NULL, TopWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 1, NULL, StWinTwo, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 2, NULL, BotWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 3, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
else
{
PAGE_createPage(page, 2, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(page, 0, NULL, FullWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 1, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
BUF_printBuffer(Region, page, -1);
PAGE_deletePage(page, i);
#endif
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = REGIONfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+REGIONfield));
MENU_currChoice(mptr) = REGIONlastoutput;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = PRINTERfield;
FORM_currField(interfaceForm) = DestValue;
runEditorInterface();
return(FALSE);
}
/**************************************************************
*************** Misc. Functions ***************
*************************************************************/
PrivateFnDef void editorIO(inbuffer, outbuffer, errbuffer)
LINEBUFFER *inbuffer, *outbuffer, *errbuffer;
{
char *row, *ptr, *ptr2;
int OMemoryError = FALSE, RMemoryError = FALSE;
if (RS_autog || useBrowser)
{
if( (BUF_LastOutput(outbuffer) = BUF_appendLine(outbuffer, "Input:")) == NULL )
OMemoryError = TRUE;
}
else
BUF_LastOutput(outbuffer) = NULL;
row = BUF_firstLine(inbuffer);
if( !useBrowser )
BUF_eraseBuffer(RecallBuf[RecallIndex]);
while (row != NULL)
{
if (row == BUF_row(inbuffer))
ptr2 = BUF_editRow(inbuffer);
else
ptr2 = BUF_line(row);
if( !useBrowser && !RMemoryError )
if( BUF_appendLine(RecallBuf[RecallIndex], ptr2) == NULL )
RMemoryError = TRUE;
if( !OMemoryError )
{
if( (ptr = BUF_appendLine(outbuffer, ptr2)) == NULL )
OMemoryError = TRUE;
else
BUF_LastOutput(outbuffer) = ptr;
}
row = BUF_nextLine(row);
}
if( !useBrowser )
RecallIndex = (RecallIndex + 1) % NUMRECALL;
if( (RS_autog || useBrowser) && !OMemoryError )
BUF_LastOutput(outbuffer) = BUF_appendLine(outbuffer, "Output:");
row = BUF_firstLine(inbuffer);
while (row != NULL)
{
if (row == BUF_row(inbuffer))
ptr2 = BUF_editRow(inbuffer);
else
ptr2 = BUF_line(row);
RS_writeLine(ptr2);
RS_readOutput(outbuffer, errbuffer);
row = BUF_nextLine(row);
}
if (RS_autog || useBrowser)
{
if( BUF_LastOutput(outbuffer) != NULL )
{
BUF_changeRow(outbuffer, BUF_LastOutput(outbuffer));
BUF_setCol(outbuffer, (CUR_WINDOW *)NULL, 0);
}
RS_compile();
RS_readOutput(outbuffer, errbuffer);
if( (BUF_LastOutput(outbuffer) != NULL) &&
(BUF_nextLine(BUF_LastOutput(outbuffer)) != NULL) )
BUF_LastOutput(outbuffer) = BUF_nextLine(BUF_LastOutput(outbuffer));
}
else
{
if( BUF_LastOutput(outbuffer) != NULL )
BUF_changeRow(outbuffer, BUF_LastOutput(outbuffer));
if( (BUF_row(outbuffer) != NULL) &&
(BUF_nextLine(BUF_row(outbuffer)) != NULL) )
BUF_changeRow(outbuffer, BUF_nextLine(BUF_row(outbuffer)));
BUF_LastOutput(outbuffer) = BUF_row(outbuffer);
BUF_setCol(outbuffer, (CUR_WINDOW *)NULL, 0);
}
}
PublicFnDef int
EDIT_browserIO()
{
useBrowser = TRUE;
editorIO(BrowserInput, BrowserBuf, BrowserBuf);
useBrowser = FALSE;
}
/*---------------------------------------------------------------------*/
PublicFnDef int ED_subShell (
void
)
{
ERR_displayStr(" Entering subshell...",FALSE);
CUR_saveterm();
CUR_resetterm();
RS_system("/bin/csh -i"); /* vision's version of a system call */
/***** Exited from shell, setup the screen ... *****/
CUR_fixterm();
CUR_noecho();
CUR_nonl();
CUR_cbreak();
CUR_clearok(CUR_curscr);
ERR_clearMsg();
/* CUR_wrefresh(CUR_curscr);*/
/*****
* This code (I think) is unneccessay but it may be needed to keep the
* Research System in sync.
*****/
RS_dumpOutput ();
KEY_setKeypad();
}
/*---------------------------------------------------------------------*/
PrivateFnDef int recall (
void
)
{
int i, error;
if( RepetitionCount >= NUMRECALL )
{
ERR_displayStr(" Not that many recall buffers",TRUE);
return FALSE;
}
i = (RecallIndex - RepetitionCount - 1) % NUMRECALL;
while( i<0 )
i += NUMRECALL;
if( BUF_firstLine(RecallBuf[i]) == NULL)
{
ERR_displayError(ERR_RecallError);
return FALSE;
}
if (error = BUF_insertRegion(CurrBuffer, CurrWin, RecallBuf[i]))
ERR_displayError(error);
else
ERR_displayMsg(ERR_InsertRegion);
BUF_resetScreen(CurrBuffer, CurrWin);
return FALSE;
}
/*---------------------------------------------------------------------*/
PrivateFnDef int printBuffer (
void
)
{
#if 0
PAGE *page;
int i;
/*** print needs to know the current screen contents, so make page ***/
if (TwoWin)
{
PAGE_createPage(page, 4, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(page, 0, NULL, TopWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 1, NULL, StWinTwo, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 2, NULL, BotWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 3, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
else
{
PAGE_createPage(page, 2, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(page, 0, NULL, FullWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(page, 1, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
BUF_printBuffer(CurrBuffer, page, -1);
PAGE_deletePage(page, i);
#endif
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
MENU_currChoice(mptr) = (CurrBuffer == Edit ? BUFFERedit : BUFFERoutput);
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = PRINTERfield;
FORM_currField(interfaceForm) = DestValue;
runEditorInterface();
return(FALSE);
}
PrivateFnDef int printReportInt (
void
)
{
MENU *mptr;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
MENU_currChoice(mptr) = BUFFERfield;
mptr = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
MENU_currChoice(mptr) = (useBrowser ? BUFFERbrowse : BUFFERreport);
mptr = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
MENU_currChoice(mptr) = PRINTERfield;
FORM_currField(interfaceForm) = DestValue;
runReportInterface();
return(FALSE);
}
/***************************************
*** SESSION ***
*** When in output window of editor ***
**************************************/
PrivateFnDef session ()
{
int c, i, length, cursrow, curscol, error;
char helpfile[BUF_MaxPathNameChars], *SrcDirName, *getenv();
FILE *helpfd;
SrcDirName = getenv(SourceDirEnv);
if( SrcDirName != NULL )
{
strcpy(helpfile, SrcDirName);
strcat(helpfile,"/");
strcat(helpfile, OutHelpName);
}
else
helpfile[0] = '\0';
/***** initialize, display the windows from top down *****/
/* BUF_screenRow(Output) = 0;*/
current_settings(BotWin, StWinOne, OutKeys, Output);
twoWindows();
ERR_clearMsg();
/* unset_markers(Output);*/
/***** the input loop *****/
NotDone = TRUE;
while (NotDone)
{
if( RepetitionCount > 0 )
{
if( RepetitionQuote )
return(FALSE);
RepetitionCount--;
c = RepetitionKey;
}
else
{
if (!KEY_cready())
{
if (BUF_repaintScreen(Output))
BUF_paintWindow(Output, CurrWin);
BUF_moveCursor(Output, CurrWin, cursrow, curscol, i);
/* CUR_touchwin(CurrWin);*/
CUR_wnoutrefresh(CurrWin);
CUR_doupdate();
CUR_forceSetCursor(CurrWin, cursrow, curscol);
}
c = KEY_getkey(TRUE);
}
if (BUF_row(Output) == NULL)
length = 0;
else
length = strlen(BUF_editRow(Output));
if (ERR_msgDisplayed)
ERR_clearMsg();
switch(c) {
case 0:
case -1:
break;
case KEY_COPYPB:
copyToPasteBuf();
break;
case KEY_REPEAT:
if( ERR_promptForRepetition(&i,CurrWin,CUR_WIN_cury(CurrWin),CUR_WIN_curx(CurrWin)) ||
(i <= 1) )
break;
if( (RepetitionKey = KEY_getkey(FALSE)) == KEY_QUOTE )
{
RepetitionQuote = TRUE;
RepetitionKey = KEY_getkey(FALSE);
}
else
RepetitionQuote = FALSE;
RepetitionCount = i;
break;
case KEY_WORDFORW:
BUF_forwardWord(Output,CurrWin);
break;
case KEY_WORDBACK:
BUF_backwardWord(Output,CurrWin);
break;
case KEY_READFILE:
KEY_putc(KEY_READFILE);
NotDone = FALSE;
break;
case KEY_SAVEFILE:
if( !strlen(CurrentFile) )
ERR_displayStr("No current file",TRUE);
else if( (error = BUF_writeFile(CurrBuffer, CurrentFile)) )
ERR_displayError(error);
else
ERR_displayMsg(ERR_WroteFile);
RepetitionCount = 0;
break;
case KEY_WRITEFILE:
saveFile();
doInterface = FALSE;
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_ONEWINDOW:
oneWindow();
refresh_one();
RepetitionCount = 0;
break;
case KEY_TWOWINDOW:
twoWindows();
refresh_two();
RepetitionCount = 0;
break;
case KEY_ERASEWIN:
eraseWindow();
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_EXEC:
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
break;
case KEY_ZEROROW:
BUF_screenRow(Output) = 0;
BUF_resetScreen(Output, CurrWin);
break;
case KEY_SCROLLUP1:
BUF_scrollUp1(Output, CurrWin);
break;
case KEY_SCROLLDN1:
BUF_scrollDown1(Output, CurrWin);
break;
case KEY_HELP:
init_help();
CUR_touchwin(HelpWin);
CUR_wrefresh(HelpWin);
KEY_getkey(FALSE);
KEY_QuoteNextKey = FALSE;
CUR_delwin(HelpWin);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
ERR_clearMsg();
RepetitionCount = 0;
break;
case KEY_WINDOW:
MENU_handler(WinMenu, WindowMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_FILES:
MENU_handler(FileMenu, FileMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_REGIONS:
MENU_handler(RegMenu, RegionMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case CUR_KEY_F4:
if( DefaultModule != NULL )
{
(*DefaultModule)();
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
}
else
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
break;
case KEY_SMENU:
/* ERR_displayError(ERR_UndefKey);*/
runSysMenu();
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_AMENU:
MENU_handler(AppMenu, ApplicMenuWin, PAGE_Input);
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
RepetitionCount = 0;
break;
case KEY_QUIT:
RepetitionCount = 0;
QuitSystem();
if( PAGE_ExitSystem )
return TRUE;
if (TwoWin)
{
refresh_two();
}
else
{
refresh_one();
}
break;
case KEY_PREV:
RepetitionCount = 0;
return (TRUE);
case KEY_SCRIPTR:
RepetitionCount = 0;
KEY_beginScriptRead();
break;
case KEY_SCRIPTW:
RepetitionCount = 0;
KEY_beginScriptWrite();
break;
case KEY_SUBSHELL:
RepetitionCount = 0;
ED_subShell();
if (TwoWin)
{
refresh_two();
}
else
refresh_one();
break;
case KEY_REPAINT:
RepetitionCount = 0;
CUR_clearok(CUR_curscr);
CUR_wrefresh(CUR_curscr);
break;
case KEY_VEOL:
BUF_goToEOL(Output, length, CurrWin);
RepetitionCount = 0;
break;
case KEY_BOL:
BUF_goToBOL(Output, CurrWin);
RepetitionCount = 0;
break;
case CUR_KEY_DOWN:
case KEY_NL:
BUF_keyDown(Output, length, CurrWin);
break;
case KEY_UPL:
case CUR_KEY_UP:
BUF_keyUp(Output, length, CurrWin);
break;
case KEY_BKCH:
case CUR_KEY_LEFT:
BUF_keyLeft(Output, length, CurrWin);
break;
case KEY_FCH:
case CUR_KEY_RIGHT:
BUF_keyRight(Output, length, CurrWin);
break;
case KEY_SCR_R:
BUF_scrollRight(Output, CurrWin, i);
break;
case KEY_SCR_L:
BUF_scrollLeft(Output, CurrWin);
break;
case KEY_SCR_U:
BUF_scrollUp(Output, CurrWin);
break;
case KEY_SCR_D:
BUF_scrollDown(Output, CurrWin, i);
break;
case KEY_TOP:
BUF_goToTop(Output, CurrWin);
RepetitionCount = 0;
break;
case KEY_BOTTOM:
BUF_goToBottom(Output, CurrWin, i);
RepetitionCount = 0;
break;
case KEY_SEARCH:
BUF_searchString(Output, CurrWin);
RepetitionCount = 0;
break;
case KEY_SNEXT:
BUF_searchNext(Output, CurrWin);
break;
case KEY_SPREV:
BUF_searchPrev(Output, CurrWin);
break;
case KEY_SPACE: /* switch to top window */
NotDone = FALSE; /* done with this SESSION */
break;
case KEY_TOGGLEWIN: /* switch to top window */
NotDone = FALSE; /* done with this SESSION */
break;
case KEY_BEGREGION:
beginRegion();
RepetitionCount = 0;
break;
case KEY_ENDREGION:
endRegion();
RepetitionCount = 0;
break;
case KEY_DELREGION:
deleteRegion();
RepetitionCount = 0;
break;
case KEY_RECALL:
if( RepetitionCount > 0 )
RepetitionCount++;
else
KEY_putc(c);
NotDone = FALSE; /* done with this SESSION */
break;
case KEY_QUERYR:
BUF_queryReplaceString(Output, CurrWin);
RepetitionCount = 0;
break;
case KEY_REPLACE:
BUF_replaceString(Output, CurrWin);
RepetitionCount = 0;
break;
case KEY_QUOTE:
KEY_QuoteNextKey = FALSE;
KEY_putc(c);
NotDone = FALSE;
break;
default:
if( !(c & ~0x7f) && (isprint(c) || (c == '\t')) )
{
KEY_putc(c); /* stores 1 char. which will be printed */
return FALSE; /* in the top (edit) window */
}
ERR_displayError(ERR_UndefKey);
RepetitionCount = 0;
break;
} /**** switch ****/
} /**** while ****/
return(FALSE);
}
PublicFnDef int EDIT_reportFileMenu (
PAGE * page,
int doBrowse
)
{
int i, j, longest, sr, sc;
MENU *menu;
CUR_WINDOW *menuWin;
MENU_makeMenu(menu, fileReportMenu, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) =" Interface Menu: ";
i = MENU_choiceCount(menu) + 4;
if( i >= CUR_LINES )
i = CUR_LINES - 1;
j = longest + 4;
if( (size_t)j <= strlen(MENU_title(menu)) )
j = strlen(MENU_title(menu)) + 1;
sr = ((CUR_LINES - 1) - i) / 2;
sc = CUR_COLS - 10 - j;
if( sc < 0 )
{
sc = 5;
j = CUR_COLS - 10;
}
menuWin = CUR_newwin(i, j, sr, sc);
reportPage = page;
useBrowser = doBrowse;
MENU_handler(menu,menuWin,PAGE_Input);
useBrowser = FALSE;
MENU_deleteMenu(menu, i);
CUR_delwin(menuWin);
}
PrivateFnDef initEditor()
{
int longest, i, j, sr, sc;
/* ERR_displayStr(" Initializing editor...");*/
/***** Initialize buffers *****/
Edit = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(Edit) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(Edit, IBUFSIZE);
Region = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(Region) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(Region, RBUFSIZE);
BrowserInput = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(BrowserInput) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(BrowserInput, 4096);
for( i=0 ; i<NUMRECALL ; i++ )
{
RecallBuf[i] = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(RecallBuf[i]) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(RecallBuf[i], RBUFSIZE);
BUF_eraseBuffer(RecallBuf[i]);
}
RecallIndex = 0;
BrowserBuf = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(BrowserBuf) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(BrowserBuf, RBUFSIZE);
Output = (LINEBUFFER *) malloc(sizeof(LINEBUFFER));
BUF_maxLineSize(Output) = MAX_OUTPUT_LINE_SIZE;
BUF_initBuffer(Output, OBUFSIZE);
/* initialize the printers, so the menu choices can be turned off */
if (checkPrinters () == 0)
{
/* turn off the printer choice for each menu */
fileMenu[2].active = OFF;
regionMenu[7].active = OFF;
dstChoices[3].active = OFF;
fileReportMenu[1].active = OFF;
}
/**** initialize menus ****/
MENU_makeMenu (
FileMenu, fileMenu, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j
);
MENU_title(FileMenu) =" Interface Menu: ";
i = MENU_choiceCount(FileMenu) + 4;
if( i >= CUR_LINES )
i = CUR_LINES - 1;
j = longest + 4;
if( (size_t)j <= strlen(MENU_title(FileMenu)) )
j = strlen(MENU_title(FileMenu)) + 1;
sr = ((CUR_LINES - 1) - i) / 2;
sc = CUR_COLS - 10 - j;
if( sc < 0 )
{
sc = 5;
j = CUR_COLS - 10;
}
FMWnr = i; FMWnc = j; FMWsr = sr; FMWsc = sc;
MENU_makeMenu (
WinMenu, windowMenu, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j
);
MENU_title(WinMenu) =" Window Menu: ";
i = MENU_choiceCount(WinMenu) + 4;
if( i >= CUR_LINES )
i = CUR_LINES - 1;
j = longest + 4;
if( (size_t)j <= strlen(MENU_title(WinMenu)) )
j = strlen(MENU_title(WinMenu)) + 1;
sr = ((CUR_LINES - 1) - i) / 2;
sc = CUR_COLS - 10 - j;
if( sc < 0 )
{
sc = 5;
j = CUR_COLS - 10;
}
WMWnr = i; WMWnc = j; WMWsr = sr; WMWsc = sc;
MENU_makeMenu (
RegMenu, regionMenu, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j
);
MENU_title(RegMenu) =" Region Menu: ";
i = MENU_choiceCount(RegMenu) + 4;
if( i >= CUR_LINES )
i = CUR_LINES - 1;
j = longest + 4;
if( (size_t)j <= strlen(MENU_title(RegMenu)) )
j = strlen(MENU_title(RegMenu)) + 1;
sr = ((CUR_LINES - 1) - i) / 2;
sc = CUR_COLS - 10 - j;
if( sc < 0 )
{
sc = 5;
j = CUR_COLS - 10;
}
RMWnr = i; RMWnc = j; RMWsr = sr; RMWsc = sc;
MENU_makeMenu (
AppMenu, applicMenu, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j
);
MENU_title(AppMenu) =" Applications Menu: ";
i = MENU_choiceCount(AppMenu) + 4;
if( i >= CUR_LINES )
i = CUR_LINES - 1;
j = longest + 4;
if( (size_t)j <= strlen(MENU_title(AppMenu)) )
j = strlen(MENU_title(AppMenu)) + 1;
sr = ((CUR_LINES - 1) - i) / 2;
sc = CUR_COLS - 10 - j;
if( sc < 0 )
{
sc = 5;
j = CUR_COLS - 10;
}
AMWnr = i; AMWnc = j; AMWsr = sr; AMWsc = sc;
CurrBuffer = Edit;
EDIT_Init = TRUE;
}
PrivateFnDef createEditorWindows()
{
TopWin = CUR_newwin((CUR_LINES - 3) / 2, CUR_COLS-1, 0, 0);
BotWin = CUR_newwin((CUR_LINES - 3) - ((CUR_LINES - 3) / 2),
CUR_COLS-1, ((CUR_LINES - 3) / 2) + 1, 0);
FullWin = CUR_newwin(CUR_LINES - 2, CUR_COLS-1, 0, 0);
StWinOne = CUR_newwin(1, CUR_COLS, CUR_LINES - 2, 0);
StWinTwo = CUR_newwin(1, CUR_COLS, ((CUR_LINES - 3) / 2), 0);
FileMenuWin = CUR_newwin(FMWnr, FMWnc, FMWsr, FMWsc);
RegionMenuWin = CUR_newwin(RMWnr, RMWnc, RMWsr, RMWsc);
WindowMenuWin = CUR_newwin(WMWnr, WMWnc, WMWsr, WMWsc);
ApplicMenuWin = CUR_newwin(AMWnr, AMWnc, AMWsr, AMWsc);
if( STD_hasInsertDeleteLine )
{
CUR_idlok(TopWin,TRUE);
CUR_idlok(BotWin,TRUE);
CUR_idlok(FullWin,TRUE);
}
CUR_wclear(TopWin);
CUR_wclear(BotWin);
CUR_wclear(FullWin);
}
PrivateFnDef int deleteEditorWindows()
{
CUR_delwin(FileMenuWin);
CUR_delwin(WindowMenuWin);
CUR_delwin(RegionMenuWin);
CUR_delwin(ApplicMenuWin);
if( CurrWin == FullWin )
{
CUR_delwin(TopWin);
CUR_delwin(BotWin);
CUR_delwin(StWinTwo);
CUR_delwin(FullWin);
CUR_delwin(StWinOne);
}
else
{
CUR_delwin(FullWin);
CUR_delwin(TopWin);
CUR_delwin(StWinTwo);
CUR_delwin(BotWin);
CUR_delwin(StWinOne);
}
}
#if 0
PrivateFnDef void cleanupEditor()
{
int i;
BUF_deleteBuffer(Edit);
BUF_deleteBuffer(Region);
BUF_deleteBuffer(Output);
for( i=0 ; i<NUMRECALL ; i++ )
BUF_deleteBuffer(RecallBuf[i]);
CUR_delwin(TopWin);
CUR_delwin(BotWin);
CUR_delwin(FullWin);
CUR_delwin(FileMenuWin);
CUR_delwin(WindowMenuWin);
CUR_delwin(RegionMenuWin);
CUR_delwin(StWinOne);
CUR_delwin(StWinTwo);
MENU_deleteMenu((char *)FileMenu, i);
MENU_deleteMenu((char *)RegMenu, i);
MENU_deleteMenu((char *)WinMenu, i);
}
#endif
/******************
*** MAINEDITOR ***
******************/
PublicVarDef int inEditor = FALSE;
PublicFnDef int
EDIT_main ()
{
if( interfacePage != NULL )
{
ERR_displayPause(" Not allowed to enter editor from Interface Form");
return(0);
}
if( inEditor )
{
ERR_displayPause(" Editor already running");
return(0);
}
#if RSATTACH
/***** dump any RS output that is left over *****/
RS_dumpOutput();
#endif
CUR_werase(CUR_stdscr);
CUR_touchwin(CUR_stdscr);
CUR_wnoutrefresh(CUR_stdscr);
createEditorWindows();
/***** run the program *****/
inEditor = TRUE;
while (TRUE)
{
if (editor()) break;
if (session()) break;
}
inEditor = FALSE;
deleteEditorWindows();
return(0);
}
/************************************************************************
********* Interface Form *******************************
************************************************************************/
PrivateFnDef int
initInterface()
{
int i, j, longest;
MENU *menu;
FORM_makeForm(interfaceForm, interfaceFields, i);
MENU_makeMenu(menu, srcChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Source ";
FORM_fieldMenu(FORM_field(interfaceForm,SourceType)) = menu;
MENU_makeMenu(menu, dstChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Destination ";
FORM_fieldMenu(FORM_field(interfaceForm,DestType)) = menu;
MENU_makeMenu(menu, intBufferChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Buffer ";
FORM_fieldMenu(FORM_field(interfaceForm,SourceValue+1+BUFFERfield)) = menu;
MENU_makeMenu(menu, intBufferChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Buffer ";
FORM_fieldMenu(FORM_field(interfaceForm,DestValue+1+BUFFERfield)) = menu;
MENU_makeMenu(menu, intRegionChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Region ";
FORM_fieldMenu(FORM_field(interfaceForm,SourceValue+1+REGIONfield)) = menu;
MENU_makeMenu(menu, intRegionChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Region ";
FORM_fieldMenu(FORM_field(interfaceForm,DestValue+1+REGIONfield)) = menu;
MENU_makeMenu(menu, printerChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Printer ";
FORM_fieldMenu(FORM_field(interfaceForm,SourceValue+1+PRINTERfield)) = menu;
MENU_makeMenu(menu, printerChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Printer ";
FORM_fieldMenu(FORM_field(interfaceForm,DestValue+1+PRINTERfield)) = menu;
MENU_makeMenu(menu, filterChoices, CUR_A_NORMAL, CUR_A_REVERSE, longest, i, j);
MENU_title(menu) = " Filter ";
FORM_fieldMenu(FORM_field(interfaceForm,FilterType)) = menu;
}
PrivateFnDef int runSysMenu (
void
)
{
PAGE *editPage;
int i;
if (TwoWin)
{
PAGE_createPage(editPage, 4, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(editPage, 0, NULL, TopWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 1, NULL, StWinTwo, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 2, NULL, BotWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 3, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
else
{
PAGE_createPage(editPage, 2, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(editPage, 0, NULL, FullWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 1, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
PAGE_runSysMenu(editPage);
PAGE_deletePage(editPage, i);
}
PrivateFnDef int runEditorInterface (
void
)
{
PAGE *editPage;
int i;
if (TwoWin)
{
PAGE_createPage(editPage, 4, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(editPage, 0, NULL, TopWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 1, NULL, StWinTwo, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 2, NULL, BotWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 3, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
else
{
PAGE_createPage(editPage, 2, NULL, NULL, NULL, PAGE_noType, i);
PAGE_createElement(editPage, 0, NULL, FullWin, PAGE_Init, NULL, FALSE);
PAGE_createElement(editPage, 1, NULL, StWinOne, PAGE_Init, NULL, FALSE);
}
EDIT_runInterface(editPage);
PAGE_deletePage(editPage, i);
}
PrivateFnDef int runReportInterface (
void
)
{
EDIT_runInterface(reportPage);
}
PublicVarDef int displayErr = FALSE;
PublicVarDef char errorMessage[81],
errorName[81];
PublicFnDef int EDIT_runInterface(
PAGE * iPage
)
{
int i;
if( interfacePage != NULL )
{
ERR_displayPause("Already in Interface Form");
ERR_msgDisplayed = FALSE;
return;
}
doInterfaceClear = FALSE;
intWin1 = CUR_newwin(9, 78, ((CUR_LINES - 1) - 9)/2, (CUR_COLS - 78)/2);
WIN_ReverseBox(intWin1,NULL);
CUR_wattron(intWin1,CUR_A_REVERSE);
CUR_wmove(intWin1,0,32);
CUR_wprintw(intWin1,"INTERFACE FORM");
CUR_wmove(intWin1,CUR_WIN_maxy(intWin1),2);
CUR_wprintw(intWin1,"Execute(F2) Quit(F9)");
CUR_wattroff(intWin1,CUR_A_REVERSE);
intWin2 = CUR_subwin(intWin1, 7, 76, (((CUR_LINES - 1) - 9)/2)+1, ((CUR_COLS - 78)/2)+1);
PAGE_createPage(interfacePage,(PAGE_windowCount(iPage)+2),NULL,NULL,NULL,PAGE_noType,i);
for( i=0 ; i<PAGE_windowCount(iPage) ; i++ )
{
PAGE_createElement(interfacePage, i, NULL, PAGE_window(iPage,i), PAGE_Init, NULL, FALSE);
}
PAGE_createElement(interfacePage, i, NULL, intWin1, PAGE_Init, NULL, FALSE);
PAGE_createElement(interfacePage, (i+1), interfaceForm, intWin2, PAGE_Input, FORM_handler, TRUE);
PAGE_fkey(interfacePage, 1) = execInterface;
PAGE_handler(interfacePage);
PAGE_deletePage(interfacePage, i);
interfacePage = NULL;
CUR_delwin(intWin2);
CUR_delwin(intWin1);
EDIT_displayErrorMessage();
if( doInterfaceClear )
CUR_clearok(CUR_curscr);
doInterfaceClear = FALSE;
}
PublicFnDef int
EDIT_displayErrorMessage()
{
if( displayErr )
ERR_displayStrNoRefresh(errorMessage);
displayErr = FALSE;
errorMessage[0] = '\0';
}
PrivateFnDef int
getErrorMessage()
{
int len;
FILE *fp, *fopen();
displayErr = FALSE;
errorMessage[0] = '\0';
if( (fp = fopen(errorName,"r")) == NULL )
return(FALSE);
if( fgets(errorMessage, 81, fp) == NULL )
{
remove(errorName);
return(FALSE);
}
len = strlen(errorMessage);
if( (len > 0) && (errorMessage[len-1] == '\n') )
errorMessage[len-1] = '\0';
displayErr = TRUE;
remove(errorName);
return(FALSE);
}
PrivateFnDef int
doFilter (sname, dname, filter, filterOpts)
char *sname,
*dname;
int filter;
char *filterOpts;
{
char buffer[2 * BUF_MaxPathNameChars + 80];
if (filter == FILTERnone)
{
copyFile (sname, dname, OVERWRITEmode, FILTERnone, NULL);
return (FALSE);
}
switch (filter)
{
case FILTERformatter:
sprintf (errorName, "/tmp/viserr%d", getpid());
sprintf (buffer,"/bin/csh -if -c \"(%s %s < %s > %s) >& %s\"",
"/vision/bin/format",
((filterOpts == NULL) ? " " : filterOpts),
sname,
dname,
errorName);
break;
case FILTERuser:
if ((filterOpts == NULL) || isBlank (filterOpts))
{
copyFile (sname, dname, OVERWRITEmode, FILTERnone, NULL);
return (FALSE);
}
sprintf (errorName, "/tmp/viserr%d", getpid());
sprintf (buffer,"/bin/csh -if -c \"(%s < %s > %s) >& %s\"",
filterOpts,
sname,
dname,
errorName);
break;
default:
ERR_displayPause ("Unknown filter choice. Ignoring filter");
copyFile (sname,dname,OVERWRITEmode,FILTERnone,NULL);
return (TRUE);
}
CUR_saveterm ();
CUR_resetterm ();
RS_system (buffer);
CUR_fixterm();
CUR_noecho();
CUR_nonl();
CUR_cbreak();
getErrorMessage();
return(FALSE);
}
PublicFnDef int
printFile (fname)
char *fname;
{
FILE *fd;
int filtered = FALSE;
char tmpName[BUF_MaxPathNameChars],
buffer[120];
if (isBlank (PRINT_Command.command))
{
ERR_clearMsg ();
return (FALSE);
}
if (!isBlank (PRINT_Command.initString))
{
sprintf (tmpName, "/tmp/visprn%d", getpid ());
if ((fd = fopen (tmpName, "w")) == NULL)
return (FALSE);
fprintf (fd, "%s", PRINT_Command.initString);
fclose (fd);
if (copyFile (fname, tmpName, APPENDmode, FILTERnone, NULL))
{
remove (tmpName);
return (FALSE);
}
filtered = TRUE;
}
else
strcpy (tmpName, fname);
ERR_displayStr ("Printing, please wait...", FALSE);
sprintf (errorName, "/tmp/viserr%d", getpid());
sprintf (buffer, "/bin/csh -if -c \"(%s %s) >& %s\"",
PRINT_Command.command, tmpName, errorName);
RS_system (buffer);
CUR_werase (ERR_Window);
#if 0
CUR_clearok(CUR_curscr); /*** need to repaint the screen ***/
CUR_wrefresh(CUR_curscr);
#endif
doInterfaceClear = TRUE;
if (filtered)
remove (tmpName);
return (FALSE);
}
PrivateFnDef int
pcTransfer(fname, pname, DirFlag, mode, filter, filterOpts)
char *fname, *pname;
int DirFlag, mode, filter;
char *filterOpts;
{
char buffer[256], buffer2[256], tmpName[256], filterName[256];
ERR_displayStr("Transfer in process, please wait...",FALSE);
if( DirFlag == UploadDir )
{
sprintf(tmpName, "/tmp/pctr%d", getpid());
sprintf(buffer, "/bin/csh -if -c \"%s %s %s\"",
"pcupload",
tmpName,
pname);
CUR_saveterm();
CUR_resetterm();
RS_system(buffer);
CUR_fixterm();
CUR_noecho();
CUR_nonl();
CUR_cbreak();
copyFile(tmpName,fname,mode,filter,filterOpts);
remove(tmpName);
}
else
{
if( filter != FILTERnone )
{
sprintf(filterName, "/tmp/visfil%d", getpid());
doFilter(fname, filterName, filter, filterOpts);
}
sprintf(buffer, "/bin/csh -if -c \"%s %s %s\"",
"pcdownload",
((filter == FILTERnone) ? fname : filterName),
pname);
CUR_saveterm();
CUR_resetterm();
RS_system(buffer);
CUR_fixterm();
CUR_noecho();
CUR_nonl();
CUR_cbreak();
if( filter != FILTERnone )
remove(filterName);
}
CUR_werase(ERR_Window);
doInterfaceClear = TRUE;
return(FALSE);
}
PrivateFnDef int copyFile(
char * fname,
char * dname,
int mode,
int filter,
char * filterOpts
)
{
char buffer[1024], filterName[256], *sname;
int ifd, ofd, imode = O_RDONLY, omode = (O_WRONLY|O_CREAT), nread;
if( mode == ABORTmode )
return(TRUE);
ERR_displayStr("Executing, please wait...",FALSE);
sname = fname;
if( filter != FILTERnone )
{
sprintf(filterName, "/tmp/visfil%d", getpid());
doFilter(fname, filterName, filter, filterOpts);
sname = filterName;
}
if( mode == APPENDmode )
omode |= O_APPEND;
else
omode |= O_TRUNC;
if( (ifd = open(sname, imode, 0)) == -1 )
{
ERR_displayPause(" Unable to Open Source File");
return(TRUE);
}
if( (ofd = open(dname, omode, 0640)) == -1 )
{
ERR_displayPause(" Unable to Open Destination File");
close(ifd);
return(TRUE);
}
while( (nread = read(ifd, buffer, 1024)) != 0 )
{
if( nread == -1 )
{
ERR_displayPause(" Error Reading Source File");
close(ifd);
close(ofd);
return(TRUE);
}
if( write(ofd, buffer, nread) == -1 )
{
ERR_displayPause(" Error Writing Destination File");
close(ifd);
close(ofd);
return(TRUE);
}
}
close(ifd);
close(ofd);
if( filter != FILTERnone )
remove(filterName);
return(FALSE);
}
PrivateFnDef int
eatTrailingSpaces(tmpName)
char *tmpName;
{
int i;
i = strlen(tmpName);
while( (i > 0) && isspace(tmpName[i-1]) )
i--;
tmpName[i] = '\0';
return(FALSE);
}
#define checkFileDestination\
dname = FORM_fieldValue(FORM_field(interfaceForm,DestType+2+FILEfield));\
while( *dname != '\0' && isspace(*dname) )\
dname++;\
eatTrailingSpaces(dname);\
if( *dname == '\0' )\
{\
ERR_displayPause(" You must supply a Destination File Name");\
return(TRUE);\
}\
if( (mode = checkFileExistence(dname)) == ABORTmode )\
return(TRUE);
#define checkPCDestination\
dname = FORM_fieldValue(FORM_field(interfaceForm,DestType+2+PCfield));\
while( *dname != '\0' && isspace(*dname) )\
dname++;\
eatTrailingSpaces(dname);\
if( *dname == '\0' )\
{\
ERR_displayPause(" You must supply a PC Destination File Name");\
return(TRUE);\
}
#define checkPasteBufDestination\
dname = FORM_fieldValue(FORM_field(interfaceForm,DestType+2+PASTEBUFfield));\
while( *dname != '\0' && isspace(*dname) )\
dname++;\
eatTrailingSpaces(dname);\
if( *dname == '\0' )\
{\
dname = UnnamedPasteBuf;\
EDIT_fileMode = OVERWRITEmode;\
}\
if( strchr(dname,'/') == NULL )\
{\
realPasteBuf = TRUE;\
strcpy(tmpName2,"/sys/node_data/paste_buffers/");\
strcat(tmpName2,dname);\
}\
else\
strcpy(tmpName2,dname);\
mode = checkFileExistence(tmpName2);\
EDIT_fileMode = NOmode;\
if( realPasteBuf &&\
(mode != ABORTmode) && \
((error = access(tmpName2,0)) == -1) )\
PBUF_createEmptyPbuf(dname);\
else if( realPasteBuf &&\
(mode != ABORTmode) && \
(error == 0) &&\
PBUF_checkPbufType(dname) )\
return(TRUE);
PrivateFnDef int illegalDestination (
void
)
{
MENU *menu;
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
switch( MENU_currChoice(menu) )
{
case BUFFERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
switch( MENU_currChoice(menu) )
{
case BUFFERoutput:
ERR_displayPause(" Not permitted to modify output buffer");
return(TRUE);
case BUFFERbrowse:
ERR_displayPause(" Not permitted to modify browse buffer");
return(TRUE);
case BUFFERreport:
ERR_displayPause(" Operation Not Permitted");
return(TRUE);
default:
break;
}
break;
case REGIONfield:
ERR_displayPause(" Not allowed to use a Region as a destination");
return(TRUE);
default:
break;
}
return(FALSE);
}
PrivateFnDef int doingSPR = FALSE;
PrivateFnDef int execInterfaceFile (
char * fname
)
{
MENU *menu;
char *dname, *sname, tmpName[80], tmpName2[80], *filterOpts;
int error, mode, filterType, realPasteBuf = FALSE;
if( access(fname,04) == -1 )
{
ERR_displayPause("Unable to access Source File");
return(TRUE);
}
sname = fname;
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
filterType = MENU_currChoice(FORM_fieldMenu(FORM_field(interfaceForm,FilterType)));
filterOpts = FORM_fieldValue(FORM_field(interfaceForm,FilterOpts));
switch( MENU_currChoice(menu) )
{
case FILEfield:
checkFileDestination;
if( copyFile(fname,dname,mode,filterType,filterOpts) )
return(TRUE);
break;
case BUFFERfield:
if( filterType != FILTERnone )
{
sprintf(tmpName, "/tmp/visfilf%d", getpid());
if( copyFile(fname,tmpName,OVERWRITEmode,filterType,filterOpts) )
return(TRUE);
sname = tmpName;
}
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
switch( MENU_currChoice(menu) )
{
case BUFFERedit:
if( ExecutedBuffer )
{
BUF_eraseBuffer(Edit);
ExecutedBuffer = FALSE;
}
if( error = BUF_getFile(Edit,sname) )
{
if( filterType != FILTERnone )
remove(tmpName);
ERR_displayError(error);
if( error == ERR_FileEmpty )
return(FALSE);
return(TRUE);
}
else
ERR_displayMsg(ERR_ReadFile);
BUF_repaintScreen(Edit) = TRUE;
break;
case BUFFERtemp:
if( error = BUF_getFile(Region,sname) )
{
if( filterType != FILTERnone )
remove(tmpName);
ERR_displayError(error);
if( error == ERR_FileEmpty )
return(FALSE);
return(TRUE);
}
else
ERR_displayMsg(ERR_ReadFile);
break;
default:
break;
}
if( filterType != FILTERnone )
remove(tmpName);
break;
case PRINTERfield:
if (filterType != FILTERnone)
{
sprintf (tmpName, "/tmp/visfilf%d", getpid ());
if (copyFile (fname,tmpName,OVERWRITEmode,filterType,filterOpts))
return (TRUE);
sname = tmpName;
}
menu = FORM_fieldMenu (FORM_field (interfaceForm,DestType+2+PRINTERfield));
print (interfacePage, MENU_currChoice (menu));
if (printFile (sname))
{
if (filterType != FILTERnone)
remove (tmpName);
return (TRUE);
}
if (filterType != FILTERnone)
remove (tmpName);
break;
case PCfield:
checkPCDestination;
if( pcTransfer(fname,dname,DownloadDir,OVERWRITEmode,filterType,filterOpts) )
return(TRUE);
break;
default:
ERR_displayPause("What destination??????");
return(TRUE);
}
if( !doingSPR )
strcpy(CurrentFile,fname);
return(FALSE);
}
PrivateFnDef int execInterfaceBuffer (
int whichBuf
)
{
MENU *menu;
char *dname, tmpName[80], tmpName2[80];
int error, mode, filterType, realPasteBuf = FALSE;
LINEBUFFER *tmp;
switch( whichBuf )
{
case BUFFERedit: tmp = Edit; break;
case BUFFERoutput: tmp = Output; break;
case BUFFERtemp: tmp = Region; break;
case BUFFERreport:
if( SPR_CurrSPR == NULL )
{
ERR_displayPause("No Current Report Defined");
return(TRUE);
}
sprintf(tmpName, "/tmp/visspr%d", getpid());
if( SPR_writeToFile(SPR_CurrSPR,tmpName) )
{
ERR_displayPause("Error saving to temporary file");
return(TRUE);
}
doingSPR = TRUE;
error = execInterfaceFile(tmpName);
doingSPR = FALSE;
remove(tmpName);
return(error);
case BUFFERbrowse:
if( BUF_LastOutput(BrowserBuf) == NULL )
{
ERR_displayPause("No Last Output in Browse Buffer");
return(TRUE);
}
sprintf(tmpName, "/tmp/visbrow%d", getpid());
if( BUF_writeLastOutput(BrowserBuf, tmpName, "w") )
{
ERR_displayPause("Error saving to temporary file");
return(TRUE);
}
doingSPR = TRUE;
error = execInterfaceFile(tmpName);
doingSPR = FALSE;
remove(tmpName);
return(error);
}
if (BUF_firstLine(tmp) == NULL && BUF_lastLine(tmp) == NULL)
{
ERR_displayPause("Buffer is empty");
return(TRUE);
}
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
filterType = MENU_currChoice(FORM_fieldMenu(FORM_field(interfaceForm,FilterType)));
if( filterType != FILTERnone )
{
sprintf(tmpName, "/tmp/visfilb%d", getpid());
if( BUF_writeFile( tmp, tmpName ) )
{
ERR_displayPause("Unable to create temporary file");
return(TRUE);
}
doingSPR = TRUE;
error = execInterfaceFile(tmpName);
doingSPR = FALSE;
remove(tmpName);
return(error);
}
switch( MENU_currChoice(menu) )
{
case FILEfield:
checkFileDestination;
if( (mode == OVERWRITEmode) &&
(error = BUF_writeFile( tmp, dname )) )
{
ERR_displayMsgPause(error);
return(TRUE);
}
else if( (mode == APPENDmode) &&
(error = BUF_appendToFile( tmp, dname )) )
{
ERR_displayMsgPause(error);
return(TRUE);
}
strcpy(CurrentFile,dname);
break;
case BUFFERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
switch( MENU_currChoice(menu) )
{
case BUFFERedit:
if( tmp == Edit )
{
ERR_displayPause(" Not allowed to copy buffer onto itself");
return(TRUE);
}
if( ExecutedBuffer )
{
BUF_eraseBuffer(Edit);
ExecutedBuffer = FALSE;
}
if( (error = BUF_insertRegion(Edit, NULL, tmp)) )
{
BUF_repaintScreen(Edit) = TRUE;
ERR_displayMsgPause(error);
return(TRUE);
}
BUF_repaintScreen(Edit) = TRUE;
break;
case BUFFERtemp:
if( tmp == Region )
{
ERR_displayPause(" Not allowed to copy buffer onto itself");
return(TRUE);
}
if( (error = BUF_insertRegion(Region, NULL, tmp)) )
{
ERR_displayMsgPause(error);
return(TRUE);
}
break;
default:
break;
}
break;
case PRINTERfield:
menu = FORM_fieldMenu (FORM_field(interfaceForm,DestType+2+PRINTERfield));
sprintf (tmpName, "/tmp/vision%d", getpid());
if ((error = BUF_writeFile (tmp, tmpName)))
{
ERR_displayMsgPause (error);
return (TRUE);
}
print (interfacePage, MENU_currChoice (menu));
if (printFile (tmpName))
return (TRUE);
/* remove (tmpName); */
#if 0
if( BUF_printBuffer(tmp, interfacePage, MENU_currChoice(menu)) )
return(TRUE);
#endif
break;
case PCfield:
checkPCDestination;
sprintf(tmpName, "/tmp/vision%d", getpid());
if( (error = BUF_writeFile( tmp, tmpName )) )
{
ERR_displayPause(" Unable to access temporary file");
return(TRUE);
}
if( pcTransfer(tmpName,dname,DownloadDir,OVERWRITEmode,FILTERnone,NULL) )
return(TRUE);
remove(tmpName);
break;
default:
ERR_displayPause("What destination??????");
return(TRUE);
}
return(FALSE);
}
PrivateFnDef int execInterfaceRegion (
int whichReg
)
{
MENU *menu;
char *dname, tmpName[80], tmpName2[80];
int error, mode, filterType, realPasteBuf = FALSE;
if( whichReg == REGIONmarked )
return( execInterfaceBuffer(BUFFERtemp) );
if( BUF_LastOutput(Output) == NULL )
{
ERR_displayPause(" Last output region is empty or invalid");
return(TRUE);
}
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
filterType = MENU_currChoice(FORM_fieldMenu(FORM_field(interfaceForm,FilterType)));
if( filterType != FILTERnone )
{
sprintf(tmpName, "/tmp/visfilr%d", getpid());
if( BUF_writeLastOutput( Output, tmpName, "w" ) )
{
ERR_displayPause("Unable to create temporary file");
return(TRUE);
}
doingSPR = TRUE;
error = execInterfaceFile(tmpName);
doingSPR = FALSE;
remove(tmpName);
return(error);
}
switch( MENU_currChoice(menu) )
{
case FILEfield:
checkFileDestination;
if( (error = BUF_writeLastOutput( Output, dname, (mode == OVERWRITEmode ? "w" : "a"))) )
{
ERR_displayMsgPause(error);
return(TRUE);
}
strcpy(CurrentFile,dname);
break;
case BUFFERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
switch( MENU_currChoice(menu) )
{
case BUFFERedit:
if( ExecutedBuffer )
{
BUF_eraseBuffer(Edit);
ExecutedBuffer = FALSE;
}
/* Note the fall through here */
case BUFFERtemp:
sprintf(tmpName, "/tmp/vision%d", getpid());
if( (error = BUF_writeLastOutput( Output, tmpName, "w")) )
{
ERR_displayMsgPause(error);
return(TRUE);
}
if( MENU_currChoice(menu) == BUFFERedit )
{
if( error = BUF_getFile(Edit,tmpName) )
{
ERR_displayError(error);
return(TRUE);
}
BUF_repaintScreen(Edit) = TRUE;
}
else
{
if( error = BUF_getFile(Region,tmpName) )
{
ERR_displayError(error);
return(TRUE);
}
}
remove(tmpName);
break;
default:
break;
}
break;
case PRINTERfield:
menu = FORM_fieldMenu (FORM_field (interfaceForm,DestType+2+PRINTERfield));
sprintf (tmpName, "/tmp/vision%d", getpid());
if ((error = BUF_writeLastOutput (Output, tmpName, "w")))
{
ERR_displayMsgPause (error);
return (TRUE);
}
print (interfacePage, MENU_currChoice (menu));
if (printFile (tmpName))
return (TRUE);
/* remove (tmpName); */
break;
case PCfield:
checkPCDestination;
sprintf(tmpName, "/tmp/vision%d", getpid());
if( (error = BUF_writeLastOutput( Output, tmpName, "w")) )
{
ERR_displayMsgPause(error);
return(TRUE);
}
if( pcTransfer(tmpName,dname,DownloadDir,OVERWRITEmode,FILTERnone,NULL) )
return(TRUE);
remove(tmpName);
break;
default:
ERR_displayPause("What destination??????");
return(TRUE);
}
return(FALSE);
}
PrivateFnDef int execInterfacePC (
char * fname
)
{
MENU *menu;
char *dname, *filterOpts;
char tmpName[80], tmpName2[80];
int error, mode, filterType, realPasteBuf = FALSE;
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
filterType = MENU_currChoice(FORM_fieldMenu(FORM_field(interfaceForm,FilterType)));
filterOpts = FORM_fieldValue(FORM_field(interfaceForm,FilterOpts));
switch( MENU_currChoice(menu) )
{
case FILEfield:
checkFileDestination;
if( pcTransfer(dname,fname,UploadDir,mode,filterType,filterOpts) )
return(TRUE);
strcpy(CurrentFile,dname);
break;
case BUFFERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
switch( MENU_currChoice(menu) )
{
case BUFFERedit:
if( ExecutedBuffer )
{
BUF_eraseBuffer(Edit);
ExecutedBuffer = FALSE;
}
/* Note the fall through here */
case BUFFERtemp:
sprintf(tmpName, "/tmp/vision%d", getpid());
if( pcTransfer(tmpName,fname,UploadDir,OVERWRITEmode,filterType,filterOpts) )
return(TRUE);
if( MENU_currChoice(menu) == BUFFERedit )
{
if( error = BUF_getFile(Edit,tmpName) )
{
ERR_displayError(error);
if( error == ERR_FileEmpty )
return(FALSE);
return(TRUE);
}
else
ERR_displayMsg(ERR_ReadFile);
BUF_repaintScreen(Edit) = TRUE;
}
else
{
if( error = BUF_getFile(Region,tmpName) )
{
ERR_displayError(error);
if( error == ERR_FileEmpty )
return(FALSE);
return(TRUE);
}
else
ERR_displayMsg(ERR_ReadFile);
}
remove(tmpName);
break;
default:
break;
}
break;
case PRINTERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+PRINTERfield));
print(interfacePage,MENU_currChoice(menu));
sprintf(tmpName, "/tmp/vision%d", getpid());
if( pcTransfer(tmpName,fname,UploadDir,OVERWRITEmode,filterType,filterOpts) )
return(TRUE);
if( printFile(tmpName) )
return(TRUE);
/* remove(tmpName); */
break;
case PCfield:
ERR_displayPause(" Not permitted. Use the DOS COPY command.");
return(TRUE);
default:
ERR_displayPause("What destination??????");
return(TRUE);
}
return(FALSE);
}
PrivateFnDef int execInterfacePasteBuf (
char * fname
)
{
MENU *menu;
char *dname, tmpName[80], tmpName2[80];
int error, mode, filterType, realPasteBuf = FALSE;
if( strchr(fname,'/') == NULL )
{
strcpy(tmpName,"/sys/node_data/paste_buffers/");
strcat(tmpName,fname);
}
else
strcpy(tmpName,fname);
if( access(tmpName,04) == -1 )
{
ERR_displayPause("Unable to access Source Paste Buffer");
return(TRUE);
}
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType));
filterType = MENU_currChoice(FORM_fieldMenu(FORM_field(interfaceForm,FilterType)));
if( filterType != FILTERnone )
{
doingSPR = TRUE;
error = execInterfaceFile(tmpName);
doingSPR = FALSE;
return(error);
}
switch( MENU_currChoice(menu) )
{
case FILEfield:
checkFileDestination;
if( copyFile(tmpName,dname,mode,FILTERnone,NULL) )
return(TRUE);
strcpy(CurrentFile,dname);
break;
case BUFFERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+BUFFERfield));
switch( MENU_currChoice(menu) )
{
case BUFFERedit:
if( ExecutedBuffer )
{
BUF_eraseBuffer(Edit);
ExecutedBuffer = FALSE;
}
if( error = BUF_getFile(Edit,tmpName) )
{
ERR_displayError(error);
if( error == ERR_FileEmpty )
return(FALSE);
return(TRUE);
}
else
ERR_displayMsg(ERR_ReadFile);
BUF_repaintScreen(Edit) = TRUE;
break;
case BUFFERtemp:
if( error = BUF_getFile(Region,tmpName) )
{
ERR_displayError(error);
if( error == ERR_FileEmpty )
return(FALSE);
return(TRUE);
}
else
ERR_displayMsg(ERR_ReadFile);
break;
default:
break;
}
break;
case PRINTERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,DestType+2+PRINTERfield));
print(interfacePage,MENU_currChoice(menu));
if( printFile(tmpName) )
return(TRUE);
break;
case PCfield:
checkPCDestination;
if( pcTransfer(tmpName,dname,DownloadDir,OVERWRITEmode,FILTERnone,NULL) )
return(TRUE);
break;
default:
ERR_displayPause("What destination??????");
return(TRUE);
}
return(FALSE);
}
PrivateFnDef int execInterface (
void
)
{
MENU *menu;
char *fname;
if( illegalDestination() )
return(TRUE);
menu = FORM_fieldMenu(FORM_field(interfaceForm,SourceType));
switch( MENU_currChoice(menu) )
{
case FILEfield:
fname = FORM_fieldValue(FORM_field(interfaceForm,SourceType+2+FILEfield));
while( *fname != '\0' && isspace(*fname) )
fname++;
eatTrailingSpaces(fname);
if( *fname == '\0' )
{
ERR_displayPause(" You must supply a Source File Name");
return;
}
if( !execInterfaceFile(fname) )
PAGE_status(interfacePage) = PAGE_ExitOnExec;
break;
case BUFFERfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+BUFFERfield));
if( !execInterfaceBuffer(MENU_currChoice(menu)) )
PAGE_status(interfacePage) = PAGE_ExitOnExec;
break;
case REGIONfield:
menu = FORM_fieldMenu(FORM_field(interfaceForm,SourceType+2+REGIONfield));
if( !execInterfaceRegion(MENU_currChoice(menu)) )
PAGE_status(interfacePage) = PAGE_ExitOnExec;
break;
case PRINTERfield:
ERR_displayPause("Not allowed to use a Printer as A Source");
return;
case PCfield:
fname = FORM_fieldValue(FORM_field(interfaceForm,SourceType+2+PCfield));
while( *fname != '\0' && isspace(*fname) )
fname++;
eatTrailingSpaces(fname);
if( *fname == '\0' )
{
ERR_displayPause(" You must supply a PC Source File Name");
return;
}
if( !execInterfacePC(fname) )
PAGE_status(interfacePage) = PAGE_ExitOnExec;
break;
default:
ERR_displayPause("What source??????");
PAGE_status(interfacePage) = PAGE_ExitOnExec;
break;
}
ERR_clearMsg();
}
PublicFnDef int
EDIT_initEditor()
{
if (!EDIT_Init)
{
initEditor();
initInterface();
BUF_eraseBuffer(Region);
}
}
| {
"content_hash": "bfece05140ac85127f0f48ef506dc421",
"timestamp": "",
"source": "github",
"line_count": 4241,
"max_line_length": 120,
"avg_line_length": 24.24852629096911,
"alnum_prop": 0.5984072035628853,
"repo_name": "VisionAerie/vision",
"id": "7b82df13437dc3ebfc9dbef8beabf11c5ef3ffa4",
"size": "102838",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "software/src/8.1/src/frontend/edit.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "1984863"
},
{
"name": "Batchfile",
"bytes": "19723"
},
{
"name": "Brainfuck",
"bytes": "2074"
},
{
"name": "C",
"bytes": "2535208"
},
{
"name": "C++",
"bytes": "33987093"
},
{
"name": "Clojure",
"bytes": "29068"
},
{
"name": "Common Lisp",
"bytes": "644"
},
{
"name": "D",
"bytes": "491845"
},
{
"name": "DTrace",
"bytes": "302165"
},
{
"name": "E",
"bytes": "1428"
},
{
"name": "Eiffel",
"bytes": "2712"
},
{
"name": "Forth",
"bytes": "674"
},
{
"name": "Fortran",
"bytes": "4330"
},
{
"name": "GAP",
"bytes": "794623"
},
{
"name": "HTML",
"bytes": "6391732"
},
{
"name": "Jasmin",
"bytes": "31"
},
{
"name": "Lex",
"bytes": "41327"
},
{
"name": "Limbo",
"bytes": "1363"
},
{
"name": "M",
"bytes": "47"
},
{
"name": "Makefile",
"bytes": "10078"
},
{
"name": "Objective-C",
"bytes": "4408"
},
{
"name": "Objective-J",
"bytes": "6964"
},
{
"name": "PHP",
"bytes": "3212"
},
{
"name": "Python",
"bytes": "4346"
},
{
"name": "Roff",
"bytes": "17946"
},
{
"name": "Shell",
"bytes": "244725"
},
{
"name": "Visual Basic",
"bytes": "151824"
},
{
"name": "Yacc",
"bytes": "65808"
}
],
"symlink_target": ""
} |
#if YCQL_MYSQL
namespace Ycql.Attributes
{
/// <summary>
/// Indicates that a column is an auto increment column (for MySql)
/// </summary>
/// <seealso cref="Ycql.DbColumn.IsAutoIncrement"/>
public class AutoIncrementAttribute : SqlAttributeBase
{
/// <summary>
/// Initializes a new instance of the AutoIncrementAttribute class
/// </summary>
public AutoIncrementAttribute()
{
}
}
}
#endif | {
"content_hash": "e4595d2215149adc4f5495b56bc911c8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 68,
"avg_line_length": 20.65,
"alnum_prop": 0.6973365617433414,
"repo_name": "alt22247/YCQL",
"id": "f23b7896422a0eead7544bd565f9d22d5026d381",
"size": "481",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "YCQL/Attributes/AutoIncrementAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "419082"
}
],
"symlink_target": ""
} |
<?php
namespace Chronos\ChronoAdminBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class WeatherControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/weather/');
$this->assertTrue(200 === $client->getResponse()->getStatusCode());
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'weather[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertTrue($crawler->filter('td:contains("Test")')->count() > 0);
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Edit')->form(array(
'weather[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertTrue($crawler->filter('[value="Foo"]')->count() > 0);
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
}
| {
"content_hash": "6b47cbc12bfcf685494a924937f71a8a",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 86,
"avg_line_length": 32.851851851851855,
"alnum_prop": 0.5856820744081173,
"repo_name": "Guimove/Chronos",
"id": "08c4d5a01976606a154b4fdfc90e193e785c8b1c",
"size": "1774",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Chronos/ChronoAdminBundle/Tests/Controller/WeatherControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "479"
},
{
"name": "PHP",
"bytes": "76989"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?>
<operatorModel
xmlns="http://www.ibm.com/xmlns/prod/streams/spl/operator"
xmlns:cmn="http://www.ibm.com/xmlns/prod/streams/spl/common"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/streams/spl/operator operatorModel.xsd">
<cppOperatorModel>
<context>
<description>Python functional transform.</description>
<iconUri size="16">../opt/icons/transform_16.gif</iconUri>
<iconUri size="32">f../opt/icons/transform_32.gif</iconUri>
<!-- some optional elements
<metrics>
<metric>
<name>metricName</name>
<description>Metric description</description>
<kind>Counter</kind>
</metric>
</metrics>-->
<libraryDependencies>
<library>
<cmn:description>SPL Python includes</cmn:description>
<cmn:managedLibrary>
<cmn:includePath>../../opt/python/include</cmn:includePath>
</cmn:managedLibrary>
</library>
<library>
<cmn:description>Python libraries</cmn:description>
<cmn:managedLibrary>
<cmn:command>../pyversion.sh</cmn:command>
</cmn:managedLibrary>
</library>
</libraryDependencies>
<providesSingleThreadedContext>Always</providesSingleThreadedContext>
</context>
<parameters>
<allowAny>false</allowAny>
<parameter>
<name>toolkitDir</name>
<description>Toolkit the operator was invoked from.</description>
<optional>false</optional>
<rewriteAllowed>true</rewriteAllowed>
<expressionMode>AttributeFree</expressionMode>
<type>rstring</type>
<cardinality>1</cardinality>
</parameter>
<parameter>
<name>pyModule</name>
<description>Function or callable class's module</description>
<optional>false</optional>
<rewriteAllowed>true</rewriteAllowed>
<expressionMode>AttributeFree</expressionMode>
<type>rstring</type>
<cardinality>1</cardinality>
</parameter>
<parameter>
<name>pyName</name>
<description>Function or callable class's name</description>
<optional>false</optional>
<rewriteAllowed>true</rewriteAllowed>
<expressionMode>AttributeFree</expressionMode>
<type>rstring</type>
<cardinality>1</cardinality>
</parameter>
<parameter>
<name>pyCallable</name>
<description>Serialized instance of a callable class</description>
<optional>true</optional>
<rewriteAllowed>true</rewriteAllowed>
<expressionMode>AttributeFree</expressionMode>
<type>rstring</type>
<cardinality>1</cardinality>
</parameter>
<parameter>
<name>pyStyle</name>
<description>Style stream tuples are passed into Python.</description>
<optional>true</optional>
<rewriteAllowed>false</rewriteAllowed>
<expressionMode>Constant</expressionMode>
<type>rstring</type>
<cardinality>1</cardinality>
</parameter>
</parameters>
<inputPorts>
<inputPortSet>
<tupleMutationAllowed>false</tupleMutationAllowed>
<windowingMode>NonWindowed</windowingMode>
<windowPunctuationInputMode>Oblivious</windowPunctuationInputMode>
<cardinality>1</cardinality>
<optional>false</optional>
</inputPortSet>
</inputPorts>
<outputPorts>
<outputPortSet>
<expressionMode>Nonexistent</expressionMode>
<autoAssignment>false</autoAssignment>
<completeAssignment>false</completeAssignment>
<rewriteAllowed>false</rewriteAllowed>
<windowPunctuationOutputMode>Preserving</windowPunctuationOutputMode>
<tupleMutationAllowed>false</tupleMutationAllowed>
<cardinality>1</cardinality>
<optional>false</optional>
</outputPortSet>
</outputPorts>
</cppOperatorModel>
</operatorModel>
| {
"content_hash": "ba798b80adada83e379485b2ee625658",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 92,
"avg_line_length": 37.691588785046726,
"alnum_prop": 0.6481527398958592,
"repo_name": "wmarshall484/streamsx.topology",
"id": "f367422952ce01f157c8140c1ba539509e25875d",
"size": "4033",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "com.ibm.streamsx.topology/com.ibm.streamsx.topology.functional.python/HashAdder/HashAdder.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2947"
},
{
"name": "C++",
"bytes": "182680"
},
{
"name": "HTML",
"bytes": "11056"
},
{
"name": "Java",
"bytes": "1847120"
},
{
"name": "Makefile",
"bytes": "7673"
},
{
"name": "Perl",
"bytes": "22881"
},
{
"name": "Perl 6",
"bytes": "433"
},
{
"name": "Python",
"bytes": "1111626"
},
{
"name": "Scala",
"bytes": "11007"
},
{
"name": "Shell",
"bytes": "6045"
}
],
"symlink_target": ""
} |
module EventsHelper
def external_link_for(event)
return if event.link.nil?
link_to t('go_to_event'), event.link, target: '_blank', rel: 'nofollow', class: 'new-tab fixed-width-icon'
end
def eventbrite_ticket_link(event)
"#{event.link}#tickets"
end
end
| {
"content_hash": "0560310bb5ba314f6d34bb8e5b383dac",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 110,
"avg_line_length": 27.3,
"alnum_prop": 0.6813186813186813,
"repo_name": "MontrealNewTech/website",
"id": "f99f2cb3097c7e4f31238c74bd90bb04fe5b0172",
"size": "303",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/events_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "36098"
},
{
"name": "HTML",
"bytes": "39522"
},
{
"name": "JavaScript",
"bytes": "7382"
},
{
"name": "Ruby",
"bytes": "160461"
}
],
"symlink_target": ""
} |
#!/usr/bin/env python2.7
# Copyright 2015, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * 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.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# 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
# OWNER 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.
import hashlib
import itertools
import collections
import os
import sys
import subprocess
import re
import perfection
# configuration: a list of either strings or 2-tuples of strings
# a single string represents a static grpc_mdstr
# a 2-tuple represents a static grpc_mdelem (and appropriate grpc_mdstrs will
# also be created)
CONFIG = [
# metadata strings
'host',
'grpc-timeout',
'grpc-internal-encoding-request',
'grpc-payload-bin',
':path',
'grpc-encoding',
'grpc-accept-encoding',
'user-agent',
':authority',
'grpc-message',
'grpc-status',
'grpc-tracing-bin',
'grpc-stats-bin',
'',
# channel arg keys
'grpc.wait_for_ready',
'grpc.timeout',
'grpc.max_request_message_bytes',
'grpc.max_response_message_bytes',
# well known method names
'/grpc.lb.v1.LoadBalancer/BalanceLoad',
# metadata elements
('grpc-status', '0'),
('grpc-status', '1'),
('grpc-status', '2'),
('grpc-encoding', 'identity'),
('grpc-encoding', 'gzip'),
('grpc-encoding', 'deflate'),
('te', 'trailers'),
('content-type', 'application/grpc'),
(':method', 'POST'),
(':status', '200'),
(':status', '404'),
(':scheme', 'http'),
(':scheme', 'https'),
(':scheme', 'grpc'),
(':authority', ''),
(':method', 'GET'),
(':method', 'PUT'),
(':path', '/'),
(':path', '/index.html'),
(':status', '204'),
(':status', '206'),
(':status', '304'),
(':status', '400'),
(':status', '500'),
('accept-charset', ''),
('accept-encoding', ''),
('accept-encoding', 'gzip, deflate'),
('accept-language', ''),
('accept-ranges', ''),
('accept', ''),
('access-control-allow-origin', ''),
('age', ''),
('allow', ''),
('authorization', ''),
('cache-control', ''),
('content-disposition', ''),
('content-encoding', ''),
('content-language', ''),
('content-length', ''),
('content-location', ''),
('content-range', ''),
('content-type', ''),
('cookie', ''),
('date', ''),
('etag', ''),
('expect', ''),
('expires', ''),
('from', ''),
('host', ''),
('if-match', ''),
('if-modified-since', ''),
('if-none-match', ''),
('if-range', ''),
('if-unmodified-since', ''),
('last-modified', ''),
('lb-token', ''),
('lb-cost-bin', ''),
('link', ''),
('location', ''),
('max-forwards', ''),
('proxy-authenticate', ''),
('proxy-authorization', ''),
('range', ''),
('referer', ''),
('refresh', ''),
('retry-after', ''),
('server', ''),
('set-cookie', ''),
('strict-transport-security', ''),
('transfer-encoding', ''),
('user-agent', ''),
('vary', ''),
('via', ''),
('www-authenticate', ''),
]
METADATA_BATCH_CALLOUTS = [
':path',
':method',
':status',
':authority',
':scheme',
'te',
'grpc-message',
'grpc-status',
'grpc-payload-bin',
'grpc-encoding',
'grpc-accept-encoding',
'content-type',
'grpc-internal-encoding-request',
'user-agent',
'host',
'lb-token',
'lb-cost-bin',
]
COMPRESSION_ALGORITHMS = [
'identity',
'deflate',
'gzip',
]
# utility: mangle the name of a config
def mangle(elem, name=None):
xl = {
'-': '_',
':': '',
'/': 'slash',
'.': 'dot',
',': 'comma',
' ': '_',
}
def m0(x):
if not x: return 'empty'
r = ''
for c in x:
put = xl.get(c, c.lower())
if not put: continue
last_is_underscore = r[-1] == '_' if r else True
if last_is_underscore and put == '_': continue
elif len(put) > 1:
if not last_is_underscore: r += '_'
r += put
r += '_'
else:
r += put
if r[-1] == '_': r = r[:-1]
return r
def n(default, name=name):
if name is None: return 'grpc_%s_' % default
if name == '': return ''
return 'grpc_%s_' % name
if isinstance(elem, tuple):
return '%s%s_%s' % (n('mdelem'), m0(elem[0]), m0(elem[1]))
else:
return '%s%s' % (n('mdstr'), m0(elem))
# utility: generate some hash value for a string
def fake_hash(elem):
return hashlib.md5(elem).hexdigest()[0:8]
# utility: print a big comment block into a set of files
def put_banner(files, banner):
for f in files:
print >>f, '/*'
for line in banner:
print >>f, ' * %s' % line
print >>f, ' */'
print >>f
# build a list of all the strings we need
all_strs = list()
all_elems = list()
static_userdata = {}
# put metadata batch callouts first, to make the check of if a static metadata
# string is a callout trivial
for elem in METADATA_BATCH_CALLOUTS:
if elem not in all_strs:
all_strs.append(elem)
for elem in CONFIG:
if isinstance(elem, tuple):
if elem[0] not in all_strs:
all_strs.append(elem[0])
if elem[1] not in all_strs:
all_strs.append(elem[1])
if elem not in all_elems:
all_elems.append(elem)
else:
if elem not in all_strs:
all_strs.append(elem)
compression_elems = []
for mask in range(1, 1<<len(COMPRESSION_ALGORITHMS)):
val = ','.join(COMPRESSION_ALGORITHMS[alg]
for alg in range(0, len(COMPRESSION_ALGORITHMS))
if (1 << alg) & mask)
elem = ('grpc-accept-encoding', val)
if val not in all_strs:
all_strs.append(val)
if elem not in all_elems:
all_elems.append(elem)
compression_elems.append(elem)
static_userdata[elem] = 1 + (mask | 1)
# output configuration
args = sys.argv[1:]
H = None
C = None
D = None
if args:
if 'header' in args:
H = sys.stdout
else:
H = open('/dev/null', 'w')
if 'source' in args:
C = sys.stdout
else:
C = open('/dev/null', 'w')
if 'dictionary' in args:
D = sys.stdout
else:
D = open('/dev/null', 'w')
else:
H = open(os.path.join(
os.path.dirname(sys.argv[0]), '../../../src/core/lib/transport/static_metadata.h'), 'w')
C = open(os.path.join(
os.path.dirname(sys.argv[0]), '../../../src/core/lib/transport/static_metadata.c'), 'w')
D = open(os.path.join(
os.path.dirname(sys.argv[0]), '../../../test/core/end2end/fuzzers/hpack.dictionary'), 'w')
# copy-paste copyright notice from this file
with open(sys.argv[0]) as my_source:
copyright = []
for line in my_source:
if line[0] != '#': break
for line in my_source:
if line[0] == '#':
copyright.append(line)
break
for line in my_source:
if line[0] != '#':
break
copyright.append(line)
put_banner([H,C], [line[2:].rstrip() for line in copyright])
hex_bytes = [ord(c) for c in "abcdefABCDEF0123456789"]
def esc_dict(line):
out = "\""
for c in line:
if 32 <= c < 127:
if c != ord('"'):
out += chr(c)
else:
out += "\\\""
else:
out += "\\x%02X" % c
return out + "\""
put_banner([H,C],
"""WARNING: Auto-generated code.
To make changes to this file, change
tools/codegen/core/gen_static_metadata.py, and then re-run it.
See metadata.h for an explanation of the interface here, and metadata.c for
an explanation of what's going on.
""".splitlines())
print >>H, '#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H'
print >>H, '#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H'
print >>H
print >>H, '#include "src/core/lib/transport/metadata.h"'
print >>H
print >>C, '#include "src/core/lib/transport/static_metadata.h"'
print >>C
print >>C, '#include "src/core/lib/slice/slice_internal.h"'
print >>C
str_ofs = 0
id2strofs = {}
for i, elem in enumerate(all_strs):
id2strofs[i] = str_ofs
str_ofs += len(elem);
def slice_def(i):
return '{.refcount = &grpc_static_metadata_refcounts[%d], .data.refcounted = {g_bytes+%d, %d}}' % (i, id2strofs[i], len(all_strs[i]))
# validate configuration
for elem in METADATA_BATCH_CALLOUTS:
assert elem in all_strs
print >>H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs)
print >>H, 'extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];'
for i, elem in enumerate(all_strs):
print >>H, '/* "%s" */' % elem
print >>H, '#define %s (grpc_static_slice_table[%d])' % (mangle(elem).upper(), i)
print >>H
print >>C, 'static uint8_t g_bytes[] = {%s};' % (','.join('%d' % ord(c) for c in ''.join(all_strs)))
print >>C
print >>C, 'static void static_ref(void *unused) {}'
print >>C, 'static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}'
print >>C, 'static const grpc_slice_refcount_vtable static_sub_vtable = {static_ref, static_unref, grpc_slice_default_eq_impl, grpc_slice_default_hash_impl};';
print >>H, 'extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable;';
print >>C, 'const grpc_slice_refcount_vtable grpc_static_metadata_vtable = {static_ref, static_unref, grpc_static_slice_eq, grpc_static_slice_hash};';
print >>C, 'static grpc_slice_refcount static_sub_refcnt = {&static_sub_vtable, &static_sub_refcnt};';
print >>H, 'extern grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];'
print >>C, 'grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {'
for i, elem in enumerate(all_strs):
print >>C, ' {&grpc_static_metadata_vtable, &static_sub_refcnt},'
print >>C, '};'
print >>C
print >>H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\'
print >>H, ' ((slice).refcount != NULL && (slice).refcount->vtable == &grpc_static_metadata_vtable)'
print >>H
print >>C, 'const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {'
for i, elem in enumerate(all_strs):
print >>C, slice_def(i) + ','
print >>C, '};'
print >>C
print >>H, '#define GRPC_STATIC_METADATA_INDEX(static_slice) \\'
print >>H, ' ((int)((static_slice).refcount - grpc_static_metadata_refcounts))'
print >>H
print >>D, '# hpack fuzzing dictionary'
for i, elem in enumerate(all_strs):
print >>D, '%s' % (esc_dict([len(elem)] + [ord(c) for c in elem]))
for i, elem in enumerate(all_elems):
print >>D, '%s' % (esc_dict([0, len(elem[0])] + [ord(c) for c in elem[0]] +
[len(elem[1])] + [ord(c) for c in elem[1]]))
print >>H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems)
print >>H, 'extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];'
print >>H, 'extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];'
for i, elem in enumerate(all_elems):
print >>H, '/* "%s": "%s" */' % elem
print >>H, '#define %s (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[%d], GRPC_MDELEM_STORAGE_STATIC))' % (mangle(elem).upper(), i)
print >>H
print >>C, 'uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {'
print >>C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) for elem in all_elems)
print >>C, '};'
print >>C
def str_idx(s):
for i, s2 in enumerate(all_strs):
if s == s2:
return i
def md_idx(m):
for i, m2 in enumerate(all_elems):
if m == m2:
return i
def offset_trials(mink):
yield 0
for i in range(1, 100):
for mul in [-1, 1]:
yield mul * i
def perfect_hash(keys, name):
p = perfection.hash_parameters(keys)
def f(i, p=p):
i += p.offset
x = i % p.t
y = i / p.t
return x + p.r[y]
return {
'PHASHRANGE': p.t - 1 + max(p.r),
'PHASHNKEYS': len(p.slots),
'pyfunc': f,
'code': """
static const int8_t %(name)s_r[] = {%(r)s};
static uint32_t %(name)s_phash(uint32_t i) {
i %(offset_sign)s= %(offset)d;
uint32_t x = i %% %(t)d;
uint32_t y = i / %(t)d;
uint32_t h = x;
if (y < GPR_ARRAY_SIZE(%(name)s_r)) {
uint32_t delta = (uint32_t)%(name)s_r[y];
h += delta;
}
return h;
}
""" % {
'name': name,
'r': ','.join('%d' % (r if r is not None else 0) for r in p.r),
't': p.t,
'offset': abs(p.offset),
'offset_sign': '+' if p.offset > 0 else '-'
}
}
elem_keys = [str_idx(elem[0]) * len(all_strs) + str_idx(elem[1]) for elem in all_elems]
elem_hash = perfect_hash(elem_keys, "elems")
print >>C, elem_hash['code']
keys = [0] * int(elem_hash['PHASHRANGE'])
idxs = [255] * int(elem_hash['PHASHNKEYS'])
for i, k in enumerate(elem_keys):
h = elem_hash['pyfunc'](k)
assert keys[h] == 0
keys[h] = k
idxs[h] = i
print >>C, 'static const uint16_t elem_keys[] = {%s};' % ','.join('%d' % k for k in keys)
print >>C, 'static const uint8_t elem_idxs[] = {%s};' % ','.join('%d' % i for i in idxs)
print >>C
print >>H, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b);'
print >>C, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {'
print >>C, ' if (a == -1 || b == -1) return GRPC_MDNULL;'
print >>C, ' uint32_t k = (uint32_t)(a * %d + b);' % len(all_strs)
print >>C, ' uint32_t h = elems_phash(k);'
print >>C, ' return elem_keys[h] == k ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], GRPC_MDELEM_STORAGE_STATIC) : GRPC_MDNULL;'
print >>C, '}'
print >>C
print >>C, 'grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {'
for a, b in all_elems:
print >>C, '{%s,%s},' % (slice_def(str_idx(a)), slice_def(str_idx(b)))
print >>C, '};'
print >>H, 'typedef enum {'
for elem in METADATA_BATCH_CALLOUTS:
print >>H, ' %s,' % mangle(elem, 'batch').upper()
print >>H, ' GRPC_BATCH_CALLOUTS_COUNT'
print >>H, '} grpc_metadata_batch_callouts_index;'
print >>H
print >>H, 'typedef union {'
print >>H, ' struct grpc_linked_mdelem *array[GRPC_BATCH_CALLOUTS_COUNT];'
print >>H, ' struct {'
for elem in METADATA_BATCH_CALLOUTS:
print >>H, ' struct grpc_linked_mdelem *%s;' % mangle(elem, '').lower()
print >>H, ' } named;'
print >>H, '} grpc_metadata_batch_callouts;'
print >>H
print >>H, '#define GRPC_BATCH_INDEX_OF(slice) \\'
print >>H, ' (GRPC_IS_STATIC_METADATA_STRING((slice)) ? (grpc_metadata_batch_callouts_index)GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, GRPC_BATCH_CALLOUTS_COUNT) : GRPC_BATCH_CALLOUTS_COUNT)'
print >>H
print >>H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS))
print >>C, 'const uint8_t grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS))
print >>C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in compression_elems)
print >>C, '};'
print >>C
print >>H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]], GRPC_MDELEM_STORAGE_STATIC))'
print >>H, '#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */'
H.close()
C.close()
| {
"content_hash": "b9839defc6fdd22f2647e471d0976351",
"timestamp": "",
"source": "github",
"line_count": 502,
"max_line_length": 199,
"avg_line_length": 31.878486055776893,
"alnum_prop": 0.6082609510716741,
"repo_name": "soltanmm-google/grpc",
"id": "0374cf75a1a17c548b950d6f71bba83c71fd5572",
"size": "16003",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/codegen/core/gen_static_metadata.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "25583"
},
{
"name": "C",
"bytes": "6359547"
},
{
"name": "C#",
"bytes": "1483423"
},
{
"name": "C++",
"bytes": "1804809"
},
{
"name": "CMake",
"bytes": "329667"
},
{
"name": "DTrace",
"bytes": "147"
},
{
"name": "JavaScript",
"bytes": "353380"
},
{
"name": "M4",
"bytes": "38393"
},
{
"name": "Makefile",
"bytes": "734314"
},
{
"name": "Objective-C",
"bytes": "310155"
},
{
"name": "PHP",
"bytes": "152017"
},
{
"name": "Protocol Buffer",
"bytes": "114660"
},
{
"name": "PureBasic",
"bytes": "147"
},
{
"name": "Python",
"bytes": "1327113"
},
{
"name": "Ruby",
"bytes": "623060"
},
{
"name": "Shell",
"bytes": "56454"
},
{
"name": "Swift",
"bytes": "5418"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>jdbc_connection (JdbcSpec::ActiveRecordExtensions)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/active_record/connection_adapters/jdbc_adapter.rb, line 48</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">jdbc_connection</span>(<span class="ruby-identifier">config</span>)
<span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ConnectionAdapters</span><span class="ruby-operator">::</span><span class="ruby-constant">JdbcAdapter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">logger</span>, <span class="ruby-identifier">config</span>)
<span class="ruby-keyword kw">end</span></pre>
</body>
</html> | {
"content_hash": "d51817e8524153547503a198339f737d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 436,
"avg_line_length": 68.27777777777777,
"alnum_prop": 0.6989422294548413,
"repo_name": "varshavaradarajan/functional-tests",
"id": "d52b725d226a236284545909e8df3117988e97d2",
"size": "1229",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/jruby/lib/ruby/gems/1.8/doc/activerecord-jdbc-adapter-0.9.7-java/rdoc/classes/JdbcSpec/ActiveRecordExtensions.src/M000054.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12917"
},
{
"name": "C",
"bytes": "144"
},
{
"name": "C++",
"bytes": "37"
},
{
"name": "CSS",
"bytes": "6622"
},
{
"name": "Gherkin",
"bytes": "484"
},
{
"name": "HTML",
"bytes": "1316282"
},
{
"name": "Java",
"bytes": "1846156"
},
{
"name": "JavaScript",
"bytes": "787482"
},
{
"name": "PHP",
"bytes": "2182"
},
{
"name": "Ruby",
"bytes": "132504"
},
{
"name": "Shell",
"bytes": "116894"
},
{
"name": "Tcl",
"bytes": "11341"
},
{
"name": "Visual Basic",
"bytes": "84"
}
],
"symlink_target": ""
} |
#include "php.h"
#include "php_msgpack.h"
#include "msgpack_pack.h"
#include "msgpack_unpack.h"
#include "msgpack_class.h"
#include "msgpack_convert.h"
#include "msgpack_errors.h"
typedef struct {
zend_object object;
long php_only;
} php_msgpack_base_t;
typedef struct {
zend_object object;
smart_str buffer;
zval *retval;
long offset;
msgpack_unpack_t mp;
msgpack_unserialize_data_t var_hash;
long php_only;
zend_bool finished;
int error;
} php_msgpack_unpacker_t;
#if ZEND_MODULE_API_NO >= 20060613
# define MSGPACK_METHOD_BASE(classname, name) zim_##classname##_##name
#else
# define MSGPACK_METHOD_BASE(classname, name) zif_##classname##_##name
#endif
#if ZEND_MODULE_API_NO >= 20090115
# define PUSH_PARAM(arg) zend_vm_stack_push(arg TSRMLS_CC)
# define POP_PARAM() (void)zend_vm_stack_pop(TSRMLS_C)
# define PUSH_EO_PARAM()
# define POP_EO_PARAM()
#else
# define PUSH_PARAM(arg) zend_ptr_stack_push(&EG(argument_stack), arg)
# define POP_PARAM() (void)zend_ptr_stack_pop(&EG(argument_stack))
# define PUSH_EO_PARAM() zend_ptr_stack_push(&EG(argument_stack), NULL)
# define POP_EO_PARAM() (void)zend_ptr_stack_pop(&EG(argument_stack))
#endif
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
#define MSGPACK_METHOD_HELPER(classname, name, retval, thisptr, num, param) \
PUSH_PARAM(param); PUSH_PARAM((void*)num); \
PUSH_EO_PARAM(); \
MSGPACK_METHOD_BASE(classname, name)(num, retval, NULL, thisptr, 0 TSRMLS_CC); \
POP_EO_PARAM(); \
POP_PARAM(); POP_PARAM();
#define MSGPACK_METHOD(classname, name, retval, thisptr) \
MSGPACK_METHOD_BASE(classname, name)(0, retval, NULL, thisptr, 0 TSRMLS_CC)
#else
#define MSGPACK_METHOD_HELPER(classname, name, retval, thisptr, num, param) \
PUSH_PARAM(param); PUSH_PARAM((void*)num); \
PUSH_EO_PARAM(); \
MSGPACK_METHOD_BASE(classname, name)(num, retval, thisptr, 0 TSRMLS_CC); \
POP_EO_PARAM(); \
POP_PARAM(); POP_PARAM();
#define MSGPACK_METHOD(classname, name, retval, thisptr) \
MSGPACK_METHOD_BASE(classname, name)(0, retval, thisptr, 0 TSRMLS_CC)
#endif
#define MSGPACK_METHOD1(classname, name, retval, thisptr, param1) \
MSGPACK_METHOD_HELPER(classname, name, retval, thisptr, 1, param1);
#define MSGPACK_BASE_OBJECT \
php_msgpack_base_t *base; \
base = (php_msgpack_base_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
#define MSGPACK_UNPACKER_OBJECT \
php_msgpack_unpacker_t *unpacker; \
unpacker = (php_msgpack_unpacker_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
/* MessagePack */
static zend_class_entry *msgpack_ce = NULL;
static ZEND_METHOD(msgpack, __construct);
static ZEND_METHOD(msgpack, setOption);
static ZEND_METHOD(msgpack, pack);
static ZEND_METHOD(msgpack, unpack);
static ZEND_METHOD(msgpack, unpacker);
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_base___construct, 0, 0, 0)
ZEND_ARG_INFO(0, opt)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_base_setOption, 0, 0, 2)
ZEND_ARG_INFO(0, option)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_base_pack, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_base_unpack, 0, 0, 1)
ZEND_ARG_INFO(0, str)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_base_unpacker, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry msgpack_base_methods[] = {
ZEND_ME(msgpack, __construct,
arginfo_msgpack_base___construct, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack, setOption, arginfo_msgpack_base_setOption, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack, pack, arginfo_msgpack_base_pack, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack, unpack, arginfo_msgpack_base_unpack, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack, unpacker, arginfo_msgpack_base_unpacker, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
/* MessagePackUnpacker */
static zend_class_entry *msgpack_unpacker_ce = NULL;
static ZEND_METHOD(msgpack_unpacker, __construct);
static ZEND_METHOD(msgpack_unpacker, __destruct);
static ZEND_METHOD(msgpack_unpacker, setOption);
static ZEND_METHOD(msgpack_unpacker, feed);
static ZEND_METHOD(msgpack_unpacker, execute);
static ZEND_METHOD(msgpack_unpacker, data);
static ZEND_METHOD(msgpack_unpacker, reset);
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker___construct, 0, 0, 0)
ZEND_ARG_INFO(0, opt)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker___destruct, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker_setOption, 0, 0, 2)
ZEND_ARG_INFO(0, option)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker_feed, 0, 0, 1)
ZEND_ARG_INFO(0, str)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker_execute, 1, 0, 0)
ZEND_ARG_INFO(0, str)
ZEND_ARG_INFO(1, offset)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker_data, 0, 0, 0)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgpack_unpacker_reset, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry msgpack_unpacker_methods[] = {
ZEND_ME(msgpack_unpacker, __construct,
arginfo_msgpack_unpacker___construct, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack_unpacker, __destruct,
arginfo_msgpack_unpacker___destruct, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack_unpacker, setOption,
arginfo_msgpack_unpacker_setOption, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack_unpacker, feed,
arginfo_msgpack_unpacker_feed, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack_unpacker, execute,
arginfo_msgpack_unpacker_execute, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack_unpacker, data,
arginfo_msgpack_unpacker_data, ZEND_ACC_PUBLIC)
ZEND_ME(msgpack_unpacker, reset,
arginfo_msgpack_unpacker_reset, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
static void php_msgpack_base_free(php_msgpack_base_t *base TSRMLS_DC)
{
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
zend_object_std_dtor(&base->object TSRMLS_CC);
#else
if (base->object.properties)
{
zend_hash_destroy(base->object.properties);
FREE_HASHTABLE(base->object.properties);
}
#endif
efree(base);
}
static zend_object_value php_msgpack_base_new(zend_class_entry *ce TSRMLS_DC)
{
zend_object_value retval;
php_msgpack_base_t *base;
#if PHP_API_VERSION < 20100412
zval *tmp;
#endif
base = emalloc(sizeof(php_msgpack_base_t));
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
zend_object_std_init(&base->object, ce TSRMLS_CC);
#else
ALLOC_HASHTABLE(base->object.properties);
zend_hash_init(base->object.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
base->object.ce = ce;
#endif
#if PHP_API_VERSION < 20100412
zend_hash_copy(
base->object.properties, &ce->default_properties,
(copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *));
#else
object_properties_init(&base->object, ce);
#endif
retval.handle = zend_objects_store_put(
base, (zend_objects_store_dtor_t)zend_objects_destroy_object,
(zend_objects_free_object_storage_t)php_msgpack_base_free,
NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
}
static void php_msgpack_unpacker_free(
php_msgpack_unpacker_t *unpacker TSRMLS_DC)
{
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
zend_object_std_dtor(&unpacker->object TSRMLS_CC);
#else
if (unpacker->object.properties)
{
zend_hash_destroy(unpacker->object.properties);
FREE_HASHTABLE(unpacker->object.properties);
}
#endif
efree(unpacker);
}
static zend_object_value php_msgpack_unpacker_new(
zend_class_entry *ce TSRMLS_DC)
{
zend_object_value retval;
php_msgpack_unpacker_t *unpacker;
#if PHP_API_VERSION < 20100412
zval *tmp;
#endif
unpacker = emalloc(sizeof(php_msgpack_unpacker_t));
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
zend_object_std_init(&unpacker->object, ce TSRMLS_CC);
#else
ALLOC_HASHTABLE(unpacker->object.properties);
zend_hash_init(unpacker->object.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
unpacker->object.ce = ce;
#endif
#if PHP_API_VERSION < 20100412
zend_hash_copy(
unpacker->object.properties, &ce->default_properties,
(copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *));
#else
object_properties_init(&unpacker->object, ce);
#endif
retval.handle = zend_objects_store_put(
unpacker, (zend_objects_store_dtor_t)zend_objects_destroy_object,
(zend_objects_free_object_storage_t)php_msgpack_unpacker_free,
NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
}
/* MessagePack */
static ZEND_METHOD(msgpack, __construct)
{
zend_bool php_only = MSGPACK_G(php_only);
MSGPACK_BASE_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "|b", &php_only) == FAILURE)
{
return;
}
base->php_only = php_only;
}
static ZEND_METHOD(msgpack, setOption)
{
long option;
zval *value;
MSGPACK_BASE_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "lz", &option, &value) == FAILURE)
{
return;
}
switch (option)
{
case MSGPACK_CLASS_OPT_PHPONLY:
convert_to_boolean(value);
base->php_only = Z_BVAL_P(value);
break;
default:
MSGPACK_WARNING("[msgpack] (MessagePack::setOption) "
"error setting msgpack option");
RETURN_FALSE;
break;
}
RETURN_TRUE;
}
static ZEND_METHOD(msgpack, pack)
{
zval *parameter;
smart_str buf = {0};
int php_only = MSGPACK_G(php_only);
MSGPACK_BASE_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶meter) == FAILURE)
{
return;
}
MSGPACK_G(php_only) = base->php_only;
php_msgpack_serialize(&buf, parameter TSRMLS_CC);
MSGPACK_G(php_only) = php_only;
ZVAL_STRINGL(return_value, buf.c, buf.len, 1);
smart_str_free(&buf);
}
static ZEND_METHOD(msgpack, unpack)
{
char *str;
int str_len;
zval *object = NULL;
int php_only = MSGPACK_G(php_only);
MSGPACK_BASE_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "s|z",
&str, &str_len, &object) == FAILURE)
{
return;
}
if (!str_len)
{
RETURN_FALSE;
}
MSGPACK_G(php_only) = base->php_only;
if (object == NULL)
{
php_msgpack_unserialize(return_value, str, str_len TSRMLS_CC);
}
else
{
zval *zv;
ALLOC_INIT_ZVAL(zv);
php_msgpack_unserialize(zv, str, str_len TSRMLS_CC);
if (msgpack_convert_template(return_value, object, &zv) != SUCCESS)
{
RETURN_FALSE;
}
}
MSGPACK_G(php_only) = php_only;
}
static ZEND_METHOD(msgpack, unpacker)
{
zval temp, *opt;
MSGPACK_BASE_OBJECT;
ALLOC_INIT_ZVAL(opt);
ZVAL_BOOL(opt, base->php_only);
object_init_ex(return_value, msgpack_unpacker_ce);
MSGPACK_METHOD1(msgpack_unpacker, __construct, &temp, return_value, opt);
zval_ptr_dtor(&opt);
}
/* MessagePackUnpacker */
static ZEND_METHOD(msgpack_unpacker, __construct)
{
zend_bool php_only = MSGPACK_G(php_only);
MSGPACK_UNPACKER_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "|b", &php_only) == FAILURE)
{
return;
}
unpacker->php_only = php_only;
unpacker->buffer.c = NULL;
unpacker->buffer.len = 0;
unpacker->buffer.a = 0;
unpacker->retval = NULL;
unpacker->offset = 0;
unpacker->finished = 0;
unpacker->error = 0;
template_init(&unpacker->mp);
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
(msgpack_unserialize_data_t *)&unpacker->var_hash;
}
static ZEND_METHOD(msgpack_unpacker, __destruct)
{
MSGPACK_UNPACKER_OBJECT;
smart_str_free(&unpacker->buffer);
if (unpacker->retval != NULL)
{
zval_ptr_dtor(&unpacker->retval);
}
msgpack_unserialize_var_destroy(&unpacker->var_hash, unpacker->error);
}
static ZEND_METHOD(msgpack_unpacker, setOption)
{
long option;
zval *value;
MSGPACK_UNPACKER_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "lz", &option, &value) == FAILURE)
{
return;
}
switch (option)
{
case MSGPACK_CLASS_OPT_PHPONLY:
convert_to_boolean(value);
unpacker->php_only = Z_BVAL_P(value);
break;
default:
MSGPACK_WARNING("[msgpack] (MessagePackUnpacker::setOption) "
"error setting msgpack option");
RETURN_FALSE;
break;
}
RETURN_TRUE;
}
static ZEND_METHOD(msgpack_unpacker, feed)
{
char *str;
int str_len;
MSGPACK_UNPACKER_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE)
{
return;
}
if (!str_len)
{
RETURN_FALSE;
}
smart_str_appendl(&unpacker->buffer, str, str_len);
RETURN_TRUE;
}
static ZEND_METHOD(msgpack_unpacker, execute)
{
char *str = NULL, *data;
long str_len = 0;
zval *offset = NULL;
int ret;
size_t len, off;
int error_display = MSGPACK_G(error_display);
int php_only = MSGPACK_G(php_only);
MSGPACK_UNPACKER_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "|sz/",
&str, &str_len, &offset) == FAILURE)
{
return;
}
if (str != NULL)
{
data = (char *)str;
len = (size_t)str_len;
if (offset != NULL)
{
off = Z_LVAL_P(offset);
}
else
{
off = 0;
}
}
else
{
data = (char *)unpacker->buffer.c;
len = unpacker->buffer.len;
off = unpacker->offset;
}
if (unpacker->retval == NULL)
{
ALLOC_INIT_ZVAL(unpacker->retval);
}
else if (unpacker->finished)
{
zval_ptr_dtor(&unpacker->retval);
msgpack_unserialize_var_destroy(&unpacker->var_hash, unpacker->error);
unpacker->error = 0;
ALLOC_INIT_ZVAL(unpacker->retval);
template_init(&unpacker->mp);
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
(msgpack_unserialize_data_t *)&unpacker->var_hash;
}
(&unpacker->mp)->user.retval = (zval *)unpacker->retval;
MSGPACK_G(error_display) = 0;
MSGPACK_G(php_only) = unpacker->php_only;
ret = template_execute(&unpacker->mp, data, len, &off);
MSGPACK_G(error_display) = error_display;
MSGPACK_G(php_only) = php_only;
if (str != NULL)
{
if (offset != NULL)
{
ZVAL_LONG(offset, off);
}
}
else
{
unpacker->offset = off;
}
switch (ret)
{
case MSGPACK_UNPACK_EXTRA_BYTES:
case MSGPACK_UNPACK_SUCCESS:
unpacker->finished = 1;
unpacker->error = 0;
RETURN_TRUE;
default:
unpacker->error = 1;
RETURN_FALSE;
}
}
static ZEND_METHOD(msgpack_unpacker, data)
{
zval *object = NULL;
MSGPACK_UNPACKER_OBJECT;
if (zend_parse_parameters(
ZEND_NUM_ARGS() TSRMLS_CC, "|z", &object) == FAILURE)
{
return;
}
if (unpacker->retval != NULL)
{
if (object == NULL)
{
ZVAL_ZVAL(return_value, unpacker->retval, 1, 0);
}
else
{
zval *zv;
ALLOC_INIT_ZVAL(zv);
ZVAL_ZVAL(zv, unpacker->retval, 1, 0);
if (msgpack_convert_object(return_value, object, &zv) != SUCCESS)
{
RETURN_NULL();
}
}
MSGPACK_METHOD(msgpack_unpacker, reset, NULL, getThis());
return;
}
RETURN_FALSE;
}
static ZEND_METHOD(msgpack_unpacker, reset)
{
smart_str buffer = {0};
MSGPACK_UNPACKER_OBJECT;
if (unpacker->buffer.len > unpacker->offset)
{
smart_str_appendl(&buffer, unpacker->buffer.c + unpacker->offset,
unpacker->buffer.len - unpacker->offset);
}
smart_str_free(&unpacker->buffer);
unpacker->buffer.c = NULL;
unpacker->buffer.len = 0;
unpacker->buffer.a = 0;
unpacker->offset = 0;
unpacker->finished = 0;
if (buffer.len > 0)
{
smart_str_appendl(&unpacker->buffer, buffer.c, buffer.len);
}
smart_str_free(&buffer);
if (unpacker->retval != NULL)
{
zval_ptr_dtor(&unpacker->retval);
unpacker->retval = NULL;
}
msgpack_unserialize_var_destroy(&unpacker->var_hash, unpacker->error);
unpacker->error = 0;
template_init(&unpacker->mp);
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
(msgpack_unserialize_data_t *)&unpacker->var_hash;
}
//void msgpack_init_class()
//{
// zend_class_entry ce;
// TSRMLS_FETCH();
//
// /* base */
// INIT_CLASS_ENTRY(ce, "MessagePack", msgpack_base_methods);
// msgpack_ce = zend_register_internal_class(&ce TSRMLS_CC);
// msgpack_ce->create_object = php_msgpack_base_new;
//
//#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
// zend_declare_class_constant_long(
// msgpack_ce, ZEND_STRS("OPT_PHPONLY") - 1,
// MSGPACK_CLASS_OPT_PHPONLY TSRMLS_CC);
//#endif
//
// /* unpacker */
// INIT_CLASS_ENTRY(ce, "MessagePackUnpacker", msgpack_unpacker_methods);
// msgpack_unpacker_ce = zend_register_internal_class(&ce TSRMLS_CC);
// msgpack_unpacker_ce->create_object = php_msgpack_unpacker_new;
//}
| {
"content_hash": "3187d67a2e1841bb78fd2057c0b7aa18",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 91,
"avg_line_length": 26.58746355685131,
"alnum_prop": 0.6123690991830693,
"repo_name": "VampireMe/php-cp",
"id": "c4d6fe7f98b8d34ec1aa370cea76dbcc78039030",
"size": "18239",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "msgpack/msgpack_class.c",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "315219"
},
{
"name": "PHP",
"bytes": "2282"
}
],
"symlink_target": ""
} |
from django.core.urlresolvers import reverse, NoReverseMatch
class Menu:
submenus = ()
def shown(self):
"""
All menus are shown by default.
Override this method to implement custom behavior.
"""
return True
def url(self):
"""
Try to reverse `url_name`, fallback to '#' if not possible.
"""
try:
return reverse(self.url_name)
except AttributeError:
return '#'
except NoReverseMatch:
raise
def is_active(self):
"""
A menu is active either if its `url_name` is the current or if
any of its `submenus` are active.
"""
url = sub_urls = False
if hasattr(self, 'url_name'):
url = reverse(self.url_name) == self.context['request'].path
if hasattr(self, 'submenus'):
sub_urls = any([s.is_active() for s in self.submenus])
return url or sub_urls
| {
"content_hash": "784a1cde4960df8d37f6f3744df63bd8",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 72,
"avg_line_length": 26.944444444444443,
"alnum_prop": 0.5474226804123712,
"repo_name": "hatchrbr/django-alacarte",
"id": "35ecea45a2ad8ec9aea85bd6adb32ba3761b5f67",
"size": "970",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "alacarte/menus.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "436"
},
{
"name": "Python",
"bytes": "6708"
}
],
"symlink_target": ""
} |
package mesosphere.marathon.api
import mesosphere.marathon.api.v2.GroupUpdate
import mesosphere.marathon.state.Container.Docker.PortMapping
import mesosphere.marathon.state.Container._
import mesosphere.marathon.state.PathId._
import mesosphere.marathon.state._
import mesosphere.marathon.{ MarathonSchedulerService, MarathonSpec }
import org.apache.mesos.Protos.ContainerInfo.DockerInfo.Network
import org.mockito.Mockito.when
import org.scalatest.{ BeforeAndAfterAll, Matchers, OptionValues }
import scala.collection.immutable.Seq
class ModelValidationTest
extends MarathonSpec
with Matchers
with BeforeAndAfterAll
with OptionValues {
test("A group update should pass validation") {
val update = GroupUpdate(id = Some("/a/b/c".toPath))
val violations = ModelValidation.checkGroupUpdate(update, true)
violations should have size (0)
}
test("Model validation should catch new apps that conflict with service ports in existing apps") {
val existingApp = createServicePortApp("/app1".toPath, 3200)
val service = mock[MarathonSchedulerService]
when(service.listApps()).thenReturn(List(existingApp))
val conflictingApp = createServicePortApp("/app2".toPath, 3200)
val validations = ModelValidation.checkAppConflicts(conflictingApp, conflictingApp.id, service)
validations should not be Nil
}
test("Model validation should allow new apps that do not conflict with service ports in existing apps") {
val existingApp = createServicePortApp("/app1".toPath, 3200)
val service = mock[MarathonSchedulerService]
when(service.listApps()).thenReturn(List(existingApp))
val conflictingApp = createServicePortApp("/app2".toPath, 3201)
val validations = ModelValidation.checkAppConflicts(conflictingApp, conflictingApp.id, service)
validations should be(Nil)
}
test("Model validation should check for application conflicts") {
val existingApp = createServicePortApp("/app1".toPath, 3200)
val service = mock[MarathonSchedulerService]
when(service.listApps()).thenReturn(List(existingApp))
val conflictingApp = existingApp.copy(id = "/app2".toPath)
val validations = ModelValidation.checkAppConflicts(conflictingApp, conflictingApp.id, service)
validations should not be Nil
}
test("Null groups should be validated correctly") {
val result = ModelValidation.checkGroupUpdate(null, needsId = true)
result should have size 1
result.head.getMessage should be("Given group is empty!")
}
private def createServicePortApp(id: PathId, servicePort: Int) = {
AppDefinition(
id,
container = Some(Container(
docker = Some(Docker(
image = "demothing",
network = Some(Network.BRIDGE),
portMappings = Some(Seq(PortMapping(2000, servicePort = servicePort)))
))
))
)
}
}
| {
"content_hash": "05499bde2d0abd226b31458ff9d8f858",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 107,
"avg_line_length": 34.91463414634146,
"alnum_prop": 0.7443241355221796,
"repo_name": "quamilek/marathon",
"id": "6f40bdfa48c7ce9e7604e6dbfe3dad87d0820219",
"size": "2863",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/scala/mesosphere/marathon/api/ModelValidationTest.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2690"
},
{
"name": "Protocol Buffer",
"bytes": "40534"
},
{
"name": "Python",
"bytes": "21903"
},
{
"name": "Scala",
"bytes": "928333"
},
{
"name": "Shell",
"bytes": "16562"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>highlight.js - RDoc Documentation</title>
<link href="../../../../../../../fonts.css" rel="stylesheet">
<link href="../../../../../../../rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "../../../../../../../";
</script>
<script src="../../../../../../../js/jquery.js"></script>
<script src="../../../../../../../js/navigation.js"></script>
<script src="../../../../../../../js/search_index.js"></script>
<script src="../../../../../../../js/search.js"></script>
<script src="../../../../../../../js/searcher.js"></script>
<script src="../../../../../../../js/darkfish.js"></script>
<body id="top" role="document" class="file">
<nav role="navigation">
<div id="project-navigation">
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
<h2>
<a href="../../../../../../../index.html" rel="home">Home</a>
</h2>
<div id="table-of-contents-navigation">
<a href="../../../../../../../table_of_contents.html#pages">Pages</a>
<a href="../../../../../../../table_of_contents.html#classes">Classes</a>
<a href="../../../../../../../table_of_contents.html#methods">Methods</a>
</div>
</div>
<div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<div id="search-field-wrapper">
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results"
type="text" name="search" placeholder="Search" spellcheck="false"
title="Type to search, Up and Down to navigate, Enter to load">
</div>
<ul id="search-results" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="initially-hidden"></ul>
</form>
</div>
</div>
<div id="project-metadata">
<div id="fileindex-section" class="nav-section">
<h3>Pages</h3>
<ul class="link-list">
<li><a href="../../../../../../../webroot/bower_json.html">bower.json</a>
<li><a href="../../../../../../../webroot/index_html.html">index.html</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui-utils/CHANGELOG_md.html">CHANGELOG</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui-utils/bower_json.html">bower.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui-utils/ui-utils-ieshiv_js.html">ui-utils-ieshiv.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui-utils/ui-utils-ieshiv_min_js.html">ui-utils-ieshiv.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui-utils/ui-utils_js.html">ui-utils.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui-utils/ui-utils_min_js.html">ui-utils.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/CHANGELOG_md.html">CHANGELOG</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/LICENSE.html">LICENSE</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/build/angular-ui-ieshiv_js.html">angular-ui-ieshiv.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/build/angular-ui-ieshiv_min_js.html">angular-ui-ieshiv.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/build/angular-ui_css.html">angular-ui.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/build/angular-ui_js.html">angular-ui.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/build/angular-ui_min_css.html">angular-ui.min.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/build/angular-ui_min_js.html">angular-ui.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/common/ieshiv/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/common/ieshiv/ieshiv_js.html">ieshiv.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/common/module_js.html">module.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/common/stylesheets/angular-ui_less.html">angular-ui.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/common/stylesheets/mixins_less.html">mixins.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/grunt_js.html">grunt.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/animate/animate_js.html">animate.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/animate/test/animateSpec_js.html">animateSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/calendar/calendar_js.html">calendar.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/calendar/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/calendar/test/calendarSpec_js.html">calendarSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/codemirror/codemirror_js.html">codemirror.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/codemirror/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/codemirror/test/codemirrorSpec_js.html">codemirrorSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/currency/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/currency/currency_js.html">currency.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/currency/stylesheets/currency_less.html">currency.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/currency/test/currencySpec_js.html">currencySpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/date/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/date/date_js.html">date.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/date/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/date/test/dateSpec_js.html">dateSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/event/event_js.html">event.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/event/test/eventSpec_js.html">eventSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/if/if_js.html">if.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/if/test/ifSpec_js.html">ifSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/jq/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/jq/jq_js.html">jq.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/jq/test/jqSpec_js.html">jqSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/keypress/keypress_js.html">keypress.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/keypress/test/keydownSpec_js.html">keydownSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/keypress/test/keypressSpec_js.html">keypressSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/keypress/test/keyupSpec_js.html">keyupSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/map/map_js.html">map.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/map/test/mapSpec_js.html">mapSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/mask/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/mask/mask_js.html">mask.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/mask/test/maskSpec_js.html">maskSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/reset/reset_js.html">reset.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/reset/stylesheets/reset_less.html">reset.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/reset/test/resetSpec_js.html">resetSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/route/route_js.html">route.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/route/test/routeSpec_js.html">routeSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/scrollfix/scrollfix_js.html">scrollfix.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/scrollfix/test/scrollfixSpec_js.html">scrollfixSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/select2/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/select2/select2_js.html">select2.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/select2/test/select2Spec_js.html">select2Spec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/showhide/showhide_js.html">showhide.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/showhide/test/showhideSpec_js.html">showhideSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/sortable/REDME_md.html">REDME</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/sortable/sortable_js.html">sortable.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/sortable/test/sortableSpec_js.html">sortableSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/tinymce/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/tinymce/test/tinymceSpec_js.html">tinymceSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/tinymce/tinymce_js.html">tinymce.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/validate/test/validateSpec_js.html">validateSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/directives/validate/validate_js.html">validate.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/format/format_js.html">format.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/format/test/formatSpec_js.html">formatSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/highlight/highlight_js.html">highlight.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/highlight/highlight_less.html">highlight.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/highlight/test/highlightSpec_js.html">highlightSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/inflector/inflector_js.html">inflector.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/inflector/test/inflectorSpec_js.html">inflectorSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/unique/test/uniqueSpec_js.html">uniqueSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/modules/filters/unique/unique_js.html">unique.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/package_json.html">package.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/templates/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/templates/dependencies_json.html">dependencies.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/templates/stylesheets/template_less.html">template.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/templates/template_js.html">template.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/templates/test/templateSpec_js.html">templateSpec.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/angular-1_0_1/angular-mocks_js.html">angular-mocks.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/angular-1_0_1/angular_js.html">angular.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/angular/angular-1_0_0rc4_js.html">angular-1.0.0rc4.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/angular/angular-1_0_0rc5_js.html">angular-1.0.0rc5.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/angular/angular-mocks_js.html">angular-mocks.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/bootstrap/bootstrap-modal_js.html">bootstrap-modal.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/calendar/calendar_js_min.html">calendar.js.min</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/codemirror/codemirror_js.html">codemirror.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/googlemaps/googlemaps_js.html">googlemaps.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/jquery/jquery-1_7_2_js.html">jquery-1.7.2.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/jquery/jquery-ui-1_8_18_js.html">jquery-ui-1.8.18.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/maskedinput/jquery_maskedinput-1_3_js.html">jquery.maskedinput-1.3.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/select2/select2_js.html">select2.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/tinymce/jquery_tinymce_js.html">jquery.tinymce.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/lib/tinymce/tiny_mce_js.html">tiny_mce.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular-ui/test/test-config_js.html">test-config.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/angular-csp_css.html">angular-csp.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/angular_js.html">angular.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/angular_min_js.html">angular.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/angular_min_js_map.html">angular.min.js.map</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/bower_json.html">bower.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/index_js.html">index.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/angular/package_json.html">package.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/Gruntfile_js.html">Gruntfile.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/LICENSE.html">LICENSE</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/README_md.html">README</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/bower_json.html">bower.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/css/bootstrap-theme_css.html">bootstrap-theme.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/css/bootstrap-theme_css_map.html">bootstrap-theme.css.map</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/css/bootstrap-theme_min_css.html">bootstrap-theme.min.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/css/bootstrap_css.html">bootstrap.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/css/bootstrap_css_map.html">bootstrap.css.map</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/css/bootstrap_min_css.html">bootstrap.min.css</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular_svg.html">glyphicons-halflings-regular.svg</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/js/bootstrap_js.html">bootstrap.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/js/bootstrap_min_js.html">bootstrap.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/dist/js/npm_js.html">npm.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/fonts/glyphicons-halflings-regular_svg.html">glyphicons-halflings-regular.svg</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/grunt/bs-commonjs-generator_js.html">bs-commonjs-generator.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/grunt/bs-glyphicons-data-generator_js.html">bs-glyphicons-data-generator.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/grunt/bs-lessdoc-parser_js.html">bs-lessdoc-parser.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/grunt/bs-raw-files-generator_js.html">bs-raw-files-generator.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/grunt/configBridge_json.html">configBridge.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/affix_js.html">affix.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/alert_js.html">alert.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/button_js.html">button.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/carousel_js.html">carousel.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/collapse_js.html">collapse.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/dropdown_js.html">dropdown.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/modal_js.html">modal.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/popover_js.html">popover.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/scrollspy_js.html">scrollspy.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/tab_js.html">tab.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/tooltip_js.html">tooltip.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/js/transition_js.html">transition.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/alerts_less.html">alerts.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/badges_less.html">badges.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/bootstrap_less.html">bootstrap.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/breadcrumbs_less.html">breadcrumbs.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/button-groups_less.html">button-groups.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/buttons_less.html">buttons.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/carousel_less.html">carousel.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/close_less.html">close.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/code_less.html">code.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/component-animations_less.html">component-animations.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/dropdowns_less.html">dropdowns.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/forms_less.html">forms.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/glyphicons_less.html">glyphicons.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/grid_less.html">grid.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/input-groups_less.html">input-groups.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/jumbotron_less.html">jumbotron.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/labels_less.html">labels.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/list-group_less.html">list-group.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/media_less.html">media.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins_less.html">mixins.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/alerts_less.html">alerts.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/background-variant_less.html">background-variant.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/border-radius_less.html">border-radius.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/buttons_less.html">buttons.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/center-block_less.html">center-block.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/clearfix_less.html">clearfix.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/forms_less.html">forms.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/gradients_less.html">gradients.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/grid-framework_less.html">grid-framework.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/grid_less.html">grid.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/hide-text_less.html">hide-text.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/image_less.html">image.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/labels_less.html">labels.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/list-group_less.html">list-group.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/nav-divider_less.html">nav-divider.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/nav-vertical-align_less.html">nav-vertical-align.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/opacity_less.html">opacity.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/pagination_less.html">pagination.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/panels_less.html">panels.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/progress-bar_less.html">progress-bar.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/reset-filter_less.html">reset-filter.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/resize_less.html">resize.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/responsive-visibility_less.html">responsive-visibility.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/size_less.html">size.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/tab-focus_less.html">tab-focus.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/table-row_less.html">table-row.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/text-emphasis_less.html">text-emphasis.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/text-overflow_less.html">text-overflow.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/mixins/vendor-prefixes_less.html">vendor-prefixes.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/modals_less.html">modals.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/navbar_less.html">navbar.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/navs_less.html">navs.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/normalize_less.html">normalize.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/pager_less.html">pager.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/pagination_less.html">pagination.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/panels_less.html">panels.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/popovers_less.html">popovers.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/print_less.html">print.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/progress-bars_less.html">progress-bars.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/responsive-embed_less.html">responsive-embed.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/responsive-utilities_less.html">responsive-utilities.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/scaffolding_less.html">scaffolding.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/tables_less.html">tables.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/theme_less.html">theme.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/thumbnails_less.html">thumbnails.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/tooltip_less.html">tooltip.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/type_less.html">type.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/utilities_less.html">utilities.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/variables_less.html">variables.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/less/wells_less.html">wells.less</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/package_js.html">package.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/bootstrap/package_json.html">package.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/MIT-LICENSE_txt.html">MIT-LICENSE</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/bower_json.html">bower.json</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/dist/jquery_js.html">jquery.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/dist/jquery_min_js.html">jquery.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/dist/jquery_min_map.html">jquery.min.map</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax_js.html">ajax.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/jsonp_js.html">jsonp.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/load_js.html">load.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/parseJSON_js.html">parseJSON.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/parseXML_js.html">parseXML.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/script_js.html">script.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/var/nonce_js.html">nonce.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/var/rquery_js.html">rquery.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/ajax/xhr_js.html">xhr.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/attributes_js.html">attributes.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/attributes/attr_js.html">attr.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/attributes/classes_js.html">classes.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/attributes/prop_js.html">prop.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/attributes/support_js.html">support.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/attributes/val_js.html">val.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/callbacks_js.html">callbacks.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/core_js.html">core.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/core/access_js.html">access.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/core/init_js.html">init.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/core/parseHTML_js.html">parseHTML.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/core/ready_js.html">ready.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/core/var/rsingleTag_js.html">rsingleTag.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css_js.html">css.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/addGetHookIf_js.html">addGetHookIf.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/curCSS_js.html">curCSS.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/defaultDisplay_js.html">defaultDisplay.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/hiddenVisibleSelectors_js.html">hiddenVisibleSelectors.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/support_js.html">support.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/swap_js.html">swap.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/var/cssExpand_js.html">cssExpand.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/var/getStyles_js.html">getStyles.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/var/isHidden_js.html">isHidden.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/var/rmargin_js.html">rmargin.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/css/var/rnumnonpx_js.html">rnumnonpx.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/data_js.html">data.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/data/Data_js.html">Data.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/data/accepts_js.html">accepts.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/data/var/data_priv_js.html">data_priv.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/data/var/data_user_js.html">data_user.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/deferred_js.html">deferred.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/deprecated_js.html">deprecated.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/dimensions_js.html">dimensions.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/effects_js.html">effects.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/effects/Tween_js.html">Tween.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/effects/animatedSelector_js.html">animatedSelector.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/event_js.html">event.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/event/ajax_js.html">ajax.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/event/alias_js.html">alias.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/event/support_js.html">support.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/exports/amd_js.html">amd.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/exports/global_js.html">global.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/intro_js.html">intro.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/jquery_js.html">jquery.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/manipulation_js.html">manipulation.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/manipulation/_evalUrl_js.html">_evalUrl.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/manipulation/support_js.html">support.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/manipulation/var/rcheckableType_js.html">rcheckableType.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/offset_js.html">offset.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/outro_js.html">outro.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/queue_js.html">queue.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/queue/delay_js.html">delay.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/selector-native_js.html">selector-native.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/selector-sizzle_js.html">selector-sizzle.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/selector_js.html">selector.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/serialize_js.html">serialize.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/sizzle/dist/sizzle_js.html">sizzle.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/sizzle/dist/sizzle_min_js.html">sizzle.min.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/sizzle/dist/sizzle_min_map.html">sizzle.min.map</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/traversing_js.html">traversing.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/traversing/findFilter_js.html">findFilter.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/traversing/var/rneedsContext_js.html">rneedsContext.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/arr_js.html">arr.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/class2type_js.html">class2type.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/concat_js.html">concat.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/hasOwn_js.html">hasOwn.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/indexOf_js.html">indexOf.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/pnum_js.html">pnum.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/push_js.html">push.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/rnotwhite_js.html">rnotwhite.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/slice_js.html">slice.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/strundefined_js.html">strundefined.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/support_js.html">support.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/var/toString_js.html">toString.js</a>
<li><a href="../../../../../../../webroot/scripts/bower_components/jquery/src/wrap_js.html">wrap.js</a>
<li><a href="../../../../../../../webroot/scripts/main_js.html">main.js</a>
<li><a href="../../../../../../../webroot/tmp_resp_rhtml.html">tmp_resp.rhtml</a>
</ul>
</div>
</div>
</nav>
<main role="main" aria-label="Page webroot/scripts/bower_components/angular-ui/modules/filters/highlight/highlight.js">
<pre>Wraps the
@param text {string} haystack to search through
@param search {string} needle to search for
@param [caseSensitive] {boolean} optional boolean to use case-sensitive searching</pre>
<p>angular.module('ui.filters').filter('highlight', function
() {</p>
<pre>return function (text, search, caseSensitive) {
if (search || angular.isNumber(search)) {
text = text.toString();
search = search.toString();
if (caseSensitive) {
return text.split(search).join('<span class="ui-match">' + search + '</span>');
} else {
return text.replace(new RegExp(search, 'gi'), '<span class="ui-match">$&</span>');
}
} else {
return text;
}
};</pre>
<p>});</p>
</main>
<footer id="validator-badges" role="contentinfo">
<p><a href="http://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>
| {
"content_hash": "ef2a4cb6dd96bb4d5cc2fca3eb5db413",
"timestamp": "",
"source": "github",
"line_count": 722,
"max_line_length": 167,
"avg_line_length": 61.189750692520775,
"alnum_prop": 0.6142963851603703,
"repo_name": "Laendasill/Flower-fire-raisin",
"id": "8641370dc2b6280319eb7dbbc23b27ac9f7091ab",
"size": "44179",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tmp/webroot/scripts/bower_components/angular-ui/modules/filters/highlight/highlight_js.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15507"
},
{
"name": "HTML",
"bytes": "117474"
},
{
"name": "JavaScript",
"bytes": "17126"
},
{
"name": "Ruby",
"bytes": "3880"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app4am.app4am">
<uses-permission android:name="android.permission.INTERNET"/>
<!--<uses-permission-->
<!--android:name="android.permission.WRITE_EXTERNAL_STORAGE"-->
<!--android:maxSdkVersion="18"/>-->
<!--<uses-permission-->
<!--android:name="android.permission.READ_EXTERNAL_STORAGE"-->
<!--android:maxSdkVersion="18"/>-->
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:name=".App4amApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="sensor">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".TopicIntroductionActivity"
android:label="@string/title_activity_topic_introduction"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.Transparent">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.app4am.app4am.MainActivity"/>
</activity>
<service
android:name=".CheckUpdateIntentService"
android:exported="false">
</service>
<receiver
android:name=".MainActivity$CheckUpdateReceiver"
android:enabled="true"
android:exported="false">
</receiver>
</application>
</manifest>
| {
"content_hash": "d931c779fe0730f30fde429ceb366034",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 75,
"avg_line_length": 35.36842105263158,
"alnum_prop": 0.6096230158730159,
"repo_name": "s5y/APP4AM",
"id": "1be0de08494e44af4b4213981b7204e6bb22aa1d",
"size": "2016",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "1539"
},
{
"name": "Java",
"bytes": "99318"
}
],
"symlink_target": ""
} |
angular.module('search', [])
.controller('DocsSearchCtrl', ['$scope', '$location', 'docsSearch', function($scope, $location, docsSearch) {
function clearResults() {
$scope.results = [];
$scope.colClassName = null;
$scope.hasResults = false;
}
$scope.search = function(q) {
var MIN_SEARCH_LENGTH = 3;
if(q.length >= MIN_SEARCH_LENGTH) {
var results = docsSearch(q);
var totalAreas = 0;
for(var i in results) {
++totalAreas;
}
if(totalAreas > 0) {
$scope.colClassName = 'cols-' + totalAreas;
}
$scope.hasResults = totalAreas > 0;
$scope.results = results;
}
else {
clearResults();
}
if(!$scope.$$phase) $scope.$apply();
};
$scope.submit = function() {
var result;
for(var i in $scope.results) {
result = $scope.results[i][0];
if(result) {
break;
}
}
if(result) {
$location.path(result.url);
$scope.hideResults();
}
};
$scope.hideResults = function() {
clearResults();
$scope.q = '';
};
}])
.controller('Error404SearchCtrl', ['$scope', '$location', 'docsSearch', function($scope, $location, docsSearch) {
$scope.results = docsSearch($location.path().split(/[\/\.:]/).pop());
}])
.factory('lunrSearch', function() {
return function(properties) {
if (window.RUNNING_IN_NG_TEST_RUNNER) return null;
var engine = lunr(properties);
return {
store : function(values) {
engine.add(values);
},
search : function(q) {
return engine.search(q);
}
};
};
})
.factory('docsSearch', ['$rootScope','lunrSearch', 'NG_PAGES',
function($rootScope, lunrSearch, NG_PAGES) {
if (window.RUNNING_IN_NG_TEST_RUNNER) {
return null;
}
var index = lunrSearch(function() {
this.ref('id');
this.field('title', {boost: 50});
this.field('keywords', { boost : 20 });
});
angular.forEach(NG_PAGES, function(page, key) {
if(page.searchTerms) {
index.store({
id : key,
title : page.searchTerms.titleWords,
keywords : page.searchTerms.keywords
});
};
});
return function(q) {
var results = {
api : [],
tutorial : [],
guide : [],
error : [],
misc : []
};
angular.forEach(index.search(q), function(result) {
var key = result.ref;
var item = NG_PAGES[key];
var area = item.area;
item.path = key;
var limit = area == 'api' ? 40 : 14;
if(results[area].length < limit) {
results[area].push(item);
}
});
return results;
};
}])
.directive('focused', function($timeout) {
return function(scope, element, attrs) {
element[0].focus();
element.on('focus', function() {
scope.$apply(attrs.focused + '=true');
});
element.on('blur', function() {
// have to use $timeout, so that we close the drop-down after the user clicks,
// otherwise when the user clicks we process the closing before we process the click.
$timeout(function() {
scope.$eval(attrs.focused + '=false');
});
});
scope.$eval(attrs.focused + '=true');
};
})
.directive('docsSearchInput', ['$document',function($document) {
return function(scope, element, attrs) {
var ESCAPE_KEY_KEYCODE = 27,
FORWARD_SLASH_KEYCODE = 191;
angular.element($document[0].body).on('keydown', function(event) {
var input = element[0];
if(event.keyCode == FORWARD_SLASH_KEYCODE && document.activeElement != input) {
event.stopPropagation();
event.preventDefault();
input.focus();
}
});
element.on('keydown', function(event) {
if(event.keyCode == ESCAPE_KEY_KEYCODE) {
event.stopPropagation();
event.preventDefault();
scope.$apply(function() {
scope.hideResults();
});
}
});
};
}]);
| {
"content_hash": "0934eb0d6452975d3f36632bcab63771",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 113,
"avg_line_length": 25.54248366013072,
"alnum_prop": 0.5655066530194472,
"repo_name": "anasqadrei/angular.js",
"id": "21287dafe6a6ec28e1359b1d33e91b7b99bae965",
"size": "3908",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/app/src/search.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<ui-view>
<article class="container-fluid">
<h3 class="page-header">
Orders
</h3>
<ordercloud-order-search controlleras="orderHistory" filters="orderHistory.filters" usertype="{{orderHistory.userType}}" buyercompanies="orderHistory.buyerCompanies" usergroups="orderHistory.userGroups"></ordercloud-order-search>
<div class="well well-lg text-center" ng-if="!orderHistory.list.Items.length">
<b ng-if="!orderHistory.searching()">The selected buyer does not have any orderHistory.</b>
<b ng-if="orderHistory.searching()"><i class="fa fa-search"></i> No orders match your search.</b>
</div>
<div class="toggle-favorites-button">
<button class="btn btn-primary" ng-click="orderHistory.toggleFavorites()" ng-if="!orderHistory.filters.favorite">
<i class="fa fa-star"> </i> Filter by Favorites
</button>
<button class="btn btn-info" ng-click="orderHistory.toggleFavorites()" ng-if="orderHistory.filters.favorite">
<i class="fa fa-star"> </i> Show All Results
</button>
</div>
<section class="table-fixed-header" ng-if="orderHistory.list.Items.length">
<div class="table-header-bg"></div>
<div class="table-container" ordercloud-infinite-scroll servicename="Orders" controlleras="orderHistory">
<table class="table table-hover">
<thead>
<tr>
<th>
<div>
<a href="#" ng-click="orderHistory.setSort('ID')">
ID
<i ng-show="orderHistory.filters.sortType === 'ID' || orderHistory.filters.sortType === '-ID' " class="fa" ng-class="orderHistory.sortReverse ? 'fa-caret-up' : 'fa-caret-down'"></i>
</a>
</div>
</th>
<th>
<div>
<a href="#" ng-click="orderHistory.setSort('Status')">
Status
<i ng-show="orderHistory.filters.sortType === 'Status' || orderHistory.filters.sortType === '-Status'" class="fa" ng-class="orderHistory.sortReverse ? 'fa-caret-up' : 'fa-caret-down'"></i>
</a>
</div>
</th>
<th>
<div>
<a href="#" ng-click="orderHistory.setSort('DateCreated')">
Date Created/Submitted
<i ng-show="orderHistory.filters.sortType === 'DateCreated' || orderHistory.filters.sortType === '-DateCreated'" class="fa" ng-class="orderHistory.sortReverse ? 'fa-caret-up' : 'fa-caret-down'"></i>
</a>
</div>
</th>
<th>
<div>
Total
</div>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in orderHistory.list.Items">
<td ui-sref="orderHistory.detail({orderid: order.ID})">{{order.ID}}</td>
<td>{{order.Status}}</td>
<td>{{(order.DateSubmitted || order.DateCreated) | date}}</td>
<td>{{order.Total | currency}}</td>
</tr>
</tbody>
</table>
</div>
</section>
</article>
</ui-view>
| {
"content_hash": "294ced844fed899c21adf6d635c96eb3",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 237,
"avg_line_length": 56.36764705882353,
"alnum_prop": 0.45003913383772504,
"repo_name": "mlund01/irce-demo",
"id": "5c4ca041bbb1bf783888fc42253ccaaf55529c04",
"size": "3833",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/app/orderHistory/templates/orderHistory.list.tpl.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11425"
},
{
"name": "HTML",
"bytes": "125036"
},
{
"name": "JavaScript",
"bytes": "314522"
}
],
"symlink_target": ""
} |
package org.apereo.cas.authentication.adaptive.geo;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.StringUtils;
import java.io.Serial;
import java.io.Serializable;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
/**
* This is {@link GeoLocationResponse} that represents a particular geo location
* usually calculated from an ip address.
*
* @author Misagh Moayyed
* @since 5.0.0
*/
@ToString
@Getter
@Setter
@Accessors(chain = true)
@SuperBuilder
@NoArgsConstructor
public class GeoLocationResponse implements Serializable {
@Serial
private static final long serialVersionUID = -4380882448842426005L;
private final Set<String> addresses = new ConcurrentSkipListSet<>();
private double latitude;
private double longitude;
/**
* Add address.
*
* @param address the address
* @return the geo location response
*/
@CanIgnoreReturnValue
public GeoLocationResponse addAddress(final String address) {
if (StringUtils.isNotBlank(address)) {
this.addresses.add(address);
}
return this;
}
/**
* Format the address into a long string.
*
* @return the string
*/
public String build() {
return String.join(",", this.addresses);
}
}
| {
"content_hash": "60ed7ef459887c51bbea18a6c2897c3e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 24.19047619047619,
"alnum_prop": 0.7139107611548556,
"repo_name": "apereo/cas",
"id": "2c01470765246e008cd61ed4bec68e9c58277428",
"size": "1524",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/cas-server-core-api-authentication/src/main/java/org/apereo/cas/authentication/adaptive/geo/GeoLocationResponse.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "16679"
},
{
"name": "Dockerfile",
"bytes": "1207"
},
{
"name": "Groovy",
"bytes": "63590"
},
{
"name": "HTML",
"bytes": "385378"
},
{
"name": "Java",
"bytes": "20049652"
},
{
"name": "JavaScript",
"bytes": "642995"
},
{
"name": "Mustache",
"bytes": "1946"
},
{
"name": "PHP",
"bytes": "33936"
},
{
"name": "Python",
"bytes": "20629"
},
{
"name": "Ruby",
"bytes": "2628"
},
{
"name": "Shell",
"bytes": "165922"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="SolidColorFill,as3isolib.graphics.SolidColorFill,alpha,color,id,begin,clone,end" name="keywords">
<title>as3isolib.graphics.SolidColorFill</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
asdocTitle = 'SolidColorFill - API Documentation';
var baseRef = '../../';
window.onload = configPage;
--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">API Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All Packages</a> | <a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All Classes</a> | <a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a> | <a href="../../index.html?as3isolib/graphics/SolidColorFill.html&as3isolib/graphics/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class SolidColorFill</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a> | <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2"> </td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class SolidColorFill"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">as3isolib.graphics</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class SolidColorFill</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Implements</td><td><a href="IFill.html">IFill</a></td>
</tr>
</table>
<p></p>
<p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th> </th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#alpha">alpha</a> : Number<div class="summaryTableDescription">
The transparency of the fill.</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#color">color</a> : uint<div class="summaryTableDescription">
The fill color.</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#id">id</a> : String<div class="summaryTableDescription">
</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#SolidColorFill()">SolidColorFill</a>(color:uint, alpha:Number)</div>
<div class="summaryTableDescription">
Constructor
</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#begin()">begin</a>(target:Graphics):void</div>
<div class="summaryTableDescription">
Initiates fill logic on target graphics.</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#clone()">clone</a>():<a href="../graphics/IFill.html">IFill</a>
</div>
<div class="summaryTableDescription">
Returns an exact copy of this IFill.</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#end()">end</a>(target:Graphics):void</div>
<div class="summaryTableDescription">
Completes fill logic on the target graphics.</div>
</td><td class="summaryTableOwnerCol">SolidColorFill</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="alpha"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">alpha</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>public var alpha:Number</code><p>
The transparency of the fill.
</p></div>
<a name="color"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">color</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td>
</tr>
</table>
<div class="detailBody">
<code>public var color:uint</code><p>
The fill color.
</p></div>
<a name="id"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">id</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td>
</tr>
</table>
<div class="detailBody">
<code>id:String</code> [read-write]<p>
</p><span class="label">Implementation</span>
<br>
<code> public function get id():String</code>
<br>
<code> public function set id(value:String):void</code>
<br>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="SolidColorFill()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">SolidColorFill</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function SolidColorFill(color:uint, alpha:Number)</code><p>
Constructor
</p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">color</span>:uint</code></td>
</tr>
<tr>
<td class="paramSpacer"> </td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">alpha</span>:Number</code></td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="begin()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">begin</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function begin(target:Graphics):void</code><p>
Initiates fill logic on target graphics.
</p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">target</span>:Graphics</code> — The target graphics object.
</td>
</tr>
</table>
</div>
<a name="clone()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">clone</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td>
</tr>
</table>
<div class="detailBody">
<code>public function clone():<a href="../graphics/IFill.html">IFill</a></code><p>
Returns an exact copy of this IFill.
</p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../graphics/IFill.html">IFill</a></code></td>
</tr>
</table>
</div>
<a name="end()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">end</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td>
</tr>
</table>
<div class="detailBody">
<code>public function end(target:Graphics):void</code><p>
Completes fill logic on the target graphics.
</p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">target</span>:Graphics</code> — The target graphics object.
</td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">
</center>
</div>
</body>
</html>
<!-- -->
| {
"content_hash": "1b49840038e5ed7e375f0fd3fdf32ecb",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 859,
"avg_line_length": 41.25590551181102,
"alnum_prop": 0.7043611031586984,
"repo_name": "as3isolib/as3isolib.v1",
"id": "9fb452ef16087446dfb9fe839f15c6dcbc863ebc",
"size": "10480",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "fp9/asdoc/as3isolib/graphics/SolidColorFill.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "562907"
},
{
"name": "CSS",
"bytes": "22565"
},
{
"name": "HTML",
"bytes": "3906269"
},
{
"name": "JavaScript",
"bytes": "59912"
}
],
"symlink_target": ""
} |
import os
import sys
import pytest
import glob
import json
import numpy as np
import sh
def assert_close(current, expected):
np.testing.assert_allclose(current, expected, atol=1e-2, rtol=1e-2)
def check_reference_feature_json(output, reference_file):
"""Compare JSON to a reference using knowledge about its contents.
Parameters
----------
output : iterable of string
The output being tested. Each string must contain valid JSON.
reference_file : iterable of string
The reference against which the output is being compared.
"""
for line, reference in zip(output, reference_file):
if not line and reference == '\n':
continue # ignore blank lines
d = json.loads(line)
dref = json.loads(reference)
if 'feature_vector' in d:
assert_close(d['feature_vector'], dref['feature_vector'])
elif 'pca_vector' in d:
# 'pca_vector' and 'feature_vector_std' are emitted in the same
# line of JSON, so we only check for one in `d` and assume the
# other is there.
assert_close(d['feature_vector_std'], dref['feature_vector_std'])
assert_close(np.divide(*d['pca_vector']),
np.divide(*dref['pca_vector']))
elif 'neighbours' in d:
assert set(d['neighbours']) == set(dref['neighbours'])
@pytest.fixture
def env():
"""Return dictionary with useful directories to run tests
Returns
-------
dirs : dict
A dictionary with directories pointing to 'bin' (where to find
the mic "binary"), 'testdata' (the location of test data other
than images), and 'images' (the location of test images).
Additionally, the dictionary contains 'env', an environment to
run ``sh``
"""
dirs = {}
curdir = os.path.dirname(__file__)
dirs['root'] = os.path.abspath(os.path.join(curdir, '..'))
dirs['bindir'] = os.path.abspath(os.path.join(dirs['root'], 'bin'))
dirs['bin'] = os.path.join(dirs['bindir'], 'mic')
env_copy = os.environ.copy()
env_copy['PATH'] = ':'.join([dirs['bin'], os.environ['PATH']])
env_copy['PYTHONPATH'] = ':'.join([dirs['root']] + sys.path)
env_copy['PYTHONWARNINGS'] = 'ignore'
dirs['env'] = env_copy
dirs['testdata'] = os.path.join(curdir, 'testdata')
dirs['images'] = os.path.join(dirs['testdata'], 'images')
return dirs
def test_features(env):
images = sorted(glob.glob(os.path.join(env['images'], '*.tif')))
mic = sh.Command(env['bin'])
out = mic.features(*images, S=20, n=2, s='myores', b=8,
random_seed=0, _env=env['env'])
ref = open(os.path.join(env['testdata'], 'emitted-features.json'))
check_reference_feature_json(out.split('\n'), ref)
def test_features_single_threshold(env):
images = sorted(glob.glob(os.path.join(env['images'], '*.tif')))
mic = sh.Command(env['bin'])
out = mic.features(*images, S=20, n=2, s='myores', b=8, G=True,
random_seed=0, _env=env['env'])
ref = open(os.path.join(env['testdata'], 'emitted-features-global-t.json'))
check_reference_feature_json(out.split('\n'), ref)
| {
"content_hash": "44dde8a216e3be22f2cd3398ef77502d",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 36.91954022988506,
"alnum_prop": 0.6080323785803238,
"repo_name": "Don86/microscopium",
"id": "e3176da463b92e2216ea3e24c1dc0ec2ea0700e5",
"size": "3212",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_cli.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "828"
},
{
"name": "Python",
"bytes": "160097"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import, division, print_function
from functools import partial
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow.python import keras
from tensorflow.python.ops import init_ops_v2
from odin.backend.alias import (parse_activation, parse_constraint,
parse_initializer, parse_regularizer)
from odin.bay.helpers import coercible_tensor
class StochasticVariable(keras.layers.Layer, tf.initializers.Initializer):
def __init__(self, sample_shape=(), seed=None):
super().__init__()
self._sample_shape = sample_shape
self._seed = seed
@property
def sample_shape(self):
return self._sample_shape
@sample_shape.setter
def sample_shape(self, shape):
self._sample_shape = shape
def __call__(self, shape, dtype=None):
if not self.built:
self.build(shape, dtype)
distribution = self.call()
assert isinstance(distribution, tfp.distributions.Distribution), \
'StochasticVariable.call must return Distribution'
distribution = coercible_tensor(distribution,
convert_to_tensor_fn=partial(
tfp.distributions.Distribution.sample,
sample_shape=self.sample_shape))
return distribution
class TrainableNormal(StochasticVariable):
def __init__(self,
loc_initializer='truncated_normal',
scale_initializer='truncated_normal',
loc_regularizer=None,
scale_regularizer=None,
loc_activation=None,
scale_activation='softplus',
shared_scale=False,
**kwargs):
super().__init__(**kwargs)
self.loc_initializer = parse_initializer(loc_initializer, 'tf')
self.scale_initializer = parse_initializer(scale_initializer, 'tf')
self.loc_regularizer = parse_regularizer(loc_regularizer, 'tf')
self.scale_regularizer = parse_regularizer(scale_regularizer, 'tf')
self.loc_activation = parse_activation(loc_activation, 'tf')
self.scale_activation = parse_activation(scale_activation, 'tf')
self.shared_scale = bool(shared_scale)
def build(self, shape, dtype=None):
super().build(shape)
self.loc = self.add_weight(
name='loc',
shape=shape,
dtype=dtype,
initializer=self.loc_initializer,
regularizer=self.loc_regularizer,
constraint=None,
trainable=True,
)
self.scale = self.add_weight(
name='scale',
shape=() if self.shared_scale else shape,
dtype=dtype,
initializer=self.scale_initializer,
regularizer=self.scale_regularizer,
constraint=None,
trainable=True,
)
def call(self):
dist = tfp.distributions.Independent(
tfp.distributions.Normal(loc=self.loc_activation(self.loc),
scale=self.scale_activation(self.scale)), 1)
return dist
class TrainableNormalSharedScale(TrainableNormal):
def __init__(self,
loc_initializer='glorot_normal',
scale_initializer='truncated_normal',
loc_regularizer=None,
scale_regularizer=None,
loc_activation=None,
scale_activation='softplus',
**kwargs):
super().__init__(loc_initializer,
scale_initializer,
loc_regularizer,
scale_regularizer,
loc_activation,
scale_activation,
shared_scale=True,
**kwargs)
trainable_normal = TrainableNormal
trainable_normal_shared_scale = TrainableNormalSharedScale
# NOTE: this only hijack the keras.initializers if you import odin.bay
init_ops_v2.trainable_normal = TrainableNormal
init_ops_v2.trainable_normal_shared_scale = TrainableNormalSharedScale
get = keras.initializers.get
| {
"content_hash": "42dc056b40ba1d7cabf31766a438a03c",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 78,
"avg_line_length": 33.75423728813559,
"alnum_prop": 0.627165453175998,
"repo_name": "imito/odin",
"id": "df53aa983f69dbcda304fc22e3ee2239f80e0b5a",
"size": "3983",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "odin/bay/stochastic_initializers.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "1516670"
}
],
"symlink_target": ""
} |
namespace mscorlib
{
namespace System
{
namespace Security
{
namespace Cryptography
{
//Public Methods
std::vector<mscorlib::System::Byte*> ICspAsymmetricAlgorithm::ExportCspBlob(mscorlib::System::Boolean includePrivateParameters)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(includePrivateParameters).name());
__parameters__[0] = reinterpret_cast<void*>(includePrivateParameters);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Security.Cryptography", "ICspAsymmetricAlgorithm", 0, NULL, "ExportCspBlob", __mscorlib_System_Security_Cryptography_ICspAsymmetricAlgorithm, 1, __parameter_types__, __parameters__, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Byte*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Byte (__array_item__));
}
return __array_result__;
}
void ICspAsymmetricAlgorithm::ImportCspBlob(std::vector<mscorlib::System::Byte*> rawData)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameters__[0] = Global::FromArray<mscorlib::System::Byte*>(rawData, typeid(mscorlib::System::Byte).name());
Global::InvokeMethod("mscorlib", "System.Security.Cryptography", "ICspAsymmetricAlgorithm", 0, NULL, "ImportCspBlob", __mscorlib_System_Security_Cryptography_ICspAsymmetricAlgorithm, 1, __parameter_types__, __parameters__, NULL);
}
//Get Set Properties Methods
// Get:CspKeyContainerInfo
mscorlib::System::Security::Cryptography::CspKeyContainerInfo ICspAsymmetricAlgorithm::get_CspKeyContainerInfo() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Security.Cryptography", "ICspAsymmetricAlgorithm", 0, NULL, "get_CspKeyContainerInfo", __mscorlib_System_Security_Cryptography_ICspAsymmetricAlgorithm, 0, NULL, NULL, NULL);
return mscorlib::System::Security::Cryptography::CspKeyContainerInfo(__result__);
}
}
}
}
}
| {
"content_hash": "3d0a396b0c1183f8fcbfa9705d681a29",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 260,
"avg_line_length": 49.3921568627451,
"alnum_prop": 0.6800317586343787,
"repo_name": "brunolauze/MonoNative",
"id": "4ed1b2cace251abab76df61d666a0e018bba0c71",
"size": "2794",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MonoNative/mscorlib/System/Security/Cryptography/mscorlib_System_Security_Cryptography_ICspAsymmetricAlgorithm.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "137243"
},
{
"name": "C#",
"bytes": "104880"
},
{
"name": "C++",
"bytes": "18404064"
},
{
"name": "CSS",
"bytes": "1754"
},
{
"name": "HTML",
"bytes": "16925"
},
{
"name": "Shell",
"bytes": "132"
}
],
"symlink_target": ""
} |
<?php
namespace Symfony\Component\ClassLoader;
/**
*
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
*/
class MapFileClassLoader
{
protected $map = array();
public function __construct($file)
{
$this->map = require $file;
}
/**
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
*/
public function loadClass($class)
{
if ('\\' === $class[0]) {
$class = substr($class, 1);
}
if (isset($this->map[$class])) {
require $this->map[$class];
}
}
}
| {
"content_hash": "306b7ed3cf4367cfa6ccc4c43fa854d0",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 73,
"avg_line_length": 19.933333333333334,
"alnum_prop": 0.5574136008918618,
"repo_name": "jordillonch/symfony2-sandbox-security-login_form",
"id": "8a370af645a85d99bb65ee465cd38f5590bcc83c",
"size": "1144",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/symfony/src/Symfony/Component/ClassLoader/MapFileClassLoader.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "27480"
},
{
"name": "Shell",
"bytes": "622"
}
],
"symlink_target": ""
} |
const enum X {}
enum X {} | {
"content_hash": "24869ad99e2332bc43eb76a529ed8fcb",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 15,
"avg_line_length": 12.5,
"alnum_prop": 0.6,
"repo_name": "Skillupco/babel",
"id": "860bf512749f4098ea0e242101039757efbd0799",
"size": "25",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/input.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "1651"
},
{
"name": "HCL",
"bytes": "1305"
},
{
"name": "HTML",
"bytes": "3207"
},
{
"name": "JavaScript",
"bytes": "3934737"
},
{
"name": "Makefile",
"bytes": "5498"
},
{
"name": "Shell",
"bytes": "3285"
},
{
"name": "TypeScript",
"bytes": "155"
}
],
"symlink_target": ""
} |
package com.ggstudios.divisionbyzero;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
import android.graphics.Rect;
import android.opengl.GLES20;
import com.ggstudios.divisionbyzero.FontManager.TextureRegion;
import com.ggstudios.divisionbyzero.TowerLibrary.TowerEvoTree;
import com.ggstudios.utils.BufferUtils;
import com.ggstudios.utils.DebugLog;
import static fix.android.opengl.GLES20.glVertexAttribPointer;
public class Tower extends PictureBox implements Updatable{
private static final String TAG = "Tower";
private static final int TEXTURE_ATLAS_WIDTH = 512;
private static final int TEXTURE_ATLAS_HEIGHT = 512;
private static final int TEXTURE_ATLAS_TILE_WIDTH = 64;
private static final int TEXTURE_ATLAS_TILE_HEIGHT = 64;
private static final float COOLOFF_TIME = 0.2f;
TowerEvoTree evoTree;
int level;
private int towerType;
private int cost;
private int nextCost;
private int totalCost = 0;
private float attackSpeed;
private float coolDown = 0.0f;
private float rangeSquared;
private float range;
private int resellPrice;
private boolean destroyed = false;
private boolean enabled = true;
private int totalDmgDealt = 0;
private TextureRegion tr;
int tileX, tileY;
private static interface Special {
void updateSpecial(float delta);
void drawSpecial(float offX, float offY);
}
public static interface OnTowerChangeListener {
void onDamageDealtChange(int totalDmgDealt);
void onStatChange();
}
private OnTowerChangeListener towerChangeListener;
private Special special;
public void writeToStream(DataOutputStream stream) throws IOException {
stream.writeInt(evoTree.typeId);
stream.writeInt(level);
stream.writeInt(totalDmgDealt);
stream.writeFloat(coolDown);
}
public Tower(int tileX, int tileY, DataInputStream stream) throws IOException {
this(tileX, tileY, stream.readInt(), stream.readInt());
totalDmgDealt = stream.readInt();
coolDown = stream.readFloat();
}
public Tower(int tileX, int tileY, int type, int level) {
this(tileX, tileY, TowerLibrary.getEvolutionTree(type), level);
}
public Tower(int tileX, int tileY, TowerEvoTree evoTree, int level) {
super(0, 0);
this.evoTree = evoTree;
this.level = level;
this.tileX = tileX;
this.tileY = tileY;
tr = new TextureRegion(TEXTURE_ATLAS_WIDTH, TEXTURE_ATLAS_HEIGHT, TEXTURE_ATLAS_TILE_WIDTH, TEXTURE_ATLAS_TILE_HEIGHT);
refreshTowerInfo(false);
}
private void refreshTowerInfo(boolean textureChanged) {
this.cost = evoTree.cost[level];
this.towerType = evoTree.typeId;
setTexture(evoTree.resId[level]);
this.attackSpeed = evoTree.as[level];
totalCost += cost;
if(evoTree.resell != null && evoTree.resell.length > level) {
resellPrice = evoTree.resell[level];
} else {
resellPrice = totalCost >> 1;
}
if(evoTree.maxLevel == level + 1) {
nextCost = -1;
} else {
nextCost = evoTree.cost[level + 1];
}
setRange(evoTree.range[level] * Core.MAP_SDP);
if(evoTree.hasSpecial[level]) {
switch(towerType) {
case TowerLibrary.TYPE_DYNAMIC:
special = DYNAMIC_SPECIAL;
break;
case TowerLibrary.TYPE_BOSS:
special = BOSS_SPECIAL;
break;
case TowerLibrary.TYPE_CLUSTER:
special = CLUSTER_SPECIAL;
break;
case TowerLibrary.TYPE_BOX:
special = BOX_SPECIAL;
break;
case TowerLibrary.TYPE_NORMAL:
special = NORMAL_SPECIAL;
break;
case TowerLibrary.TYPE_DESIRE:
special = DESIRE_SPECIAL;
break;
case TowerLibrary.TYPE_BRUTAL:
case TowerLibrary.TYPE_DESOLATOR:
special = BRUTAL_SPECIAL; // set target to only ghosts...
break;
default:
break;
}
}
tr.setRegion(evoTree.taTileX[level] * TEXTURE_ATLAS_TILE_WIDTH,
evoTree.taTileY[level] * TEXTURE_ATLAS_TILE_HEIGHT);
if(textureChanged)
Core.game.towerManager.invalidate();
if(towerChangeListener != null)
towerChangeListener.onStatChange();
}
public void build(float w, float h) {
this.w = w;
this.h = h;
generateBuffer();
}
private void setRange(float range) {
this.range = range;
this.rangeSquared = range * range;
}
@Override
public void draw(float offX, float offY) {
super.draw(offX, offY);
if(special != null)
special.drawSpecial(offX, offY);
}
public void drawSpecial(float offX, float offY) {
if(special != null)
special.drawSpecial(offX, offY);
}
public void drawSprite(float[] vertexBuffer, int offset, float offX, float offY) {
final float x1 = x + offX;
final float y1 = y + offY;
final float x2 = x1 + w;
final float y2 = y1 + h;
vertexBuffer[offset++] = x1; // Add X for Vertex 0
vertexBuffer[offset++] = y1; // Add Y for Vertex 0
vertexBuffer[offset++] = tr.u1; // Add U for Vertex 0
vertexBuffer[offset++] = tr.v1; // Add V for Vertex 0
vertexBuffer[offset++] = x2; // Add X for Vertex 1
vertexBuffer[offset++] = y1; // Add Y for Vertex 1
vertexBuffer[offset++] = tr.u2; // Add U for Vertex 1
vertexBuffer[offset++] = tr.v1; // Add V for Vertex 1
vertexBuffer[offset++] = x2; // Add X for Vertex 2
vertexBuffer[offset++] = y2; // Add Y for Vertex 2
vertexBuffer[offset++] = tr.u2; // Add U for Vertex 2
vertexBuffer[offset++] = tr.v2; // Add V for Vertex 2
vertexBuffer[offset++] = x1; // Add X for Vertex 3
vertexBuffer[offset++] = y2; // Add Y for Vertex 3
vertexBuffer[offset++] = tr.u1; // Add U for Vertex 3
vertexBuffer[offset++] = tr.v2; // Add V for Vertex 3
}
private Sprite getTarget() {
List<Sprite> list = Core.game.spriteMgr.getRawList();
final int len = Core.game.spriteMgr.size();
for(int i = 0; i < len; i++) {
Sprite sprite = list.get(i);
if(!sprite.isTargetable()) continue;
final float sX = sprite.x, sY = sprite.y;
final float u = (sX - x)*(sX - x);
final float v = (sY - y)*(sY - y);
if(rangeSquared > u + v){
return sprite;
}
}
return null;
}
private Sprite getGhostTarget() {
List<Sprite> list = Core.game.spriteMgr.getRawList();
final int len = Core.game.spriteMgr.size();
for(int i = 0; i < len; i++) {
Sprite sprite = list.get(i);
if(!sprite.isGhost() || !sprite.isTargetable()) continue;
final float sX = sprite.x, sY = sprite.y;
final float u = (sX - x)*(sX - x);
final float v = (sY - y)*(sY - y);
if(rangeSquared > u + v){
return sprite;
}
}
return null;
}
@Override
public boolean update(float dt) {
if(!enabled) return true;
if(special != null) {
special.updateSpecial(dt);
} else if(coolDown <= 0) {
Sprite target = getTarget();
if(target != null) {
// fire
Bullet b = Core.game.obtainBullet();
b.parent = this;
switch(towerType) {
case TowerLibrary.TYPE_HEAVY:
b.setTexture(R.drawable.bullet_heavy);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_AOE, evoTree.aoe[level] * Core.MAP_SDP);
break;
case TowerLibrary.TYPE_FLAKE:
b.setTexture(R.drawable.demo_flake_shot);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_COMPLEX_AOE_FROST,
evoTree.aoe[level] * Core.MAP_SDP, /* Slow percentage */ ((int[])evoTree.extra)[level]);
b.setState(Sprite.STATE_SLOW);
b.setDuration(SLOW_TIME);
break;
case TowerLibrary.TYPE_DEMO:
b.setTexture(R.drawable.demo_shot);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_COMPLEX_AOE_STUN,
evoTree.aoe[level] * Core.MAP_SDP);
b.setState(Sprite.STATE_STUN);
b.setDuration(/* stun time */ ((float[])evoTree.extra)[level]);
break;
case TowerLibrary.TYPE_NULL:
b.setTexture(R.drawable.bullet);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_SEEKING,
/* dmg multiplier */((float[])evoTree.extra)[level]);
b.setState(Sprite.STATE_DECAY);
break;
default:
b.setTexture(R.drawable.bullet);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_NORMAL);
break;
}
Core.gu.addGameUpdatable(b);
b.isVisible = true;
coolDown = attackSpeed;
} else {
coolDown = COOLOFF_TIME;
}
}
coolDown -= dt;
return !destroyed;
}
public int getUpgradeCost() {
return nextCost;
}
public void upgrade() {
if(evoTree.maxLevel == level + 1) {
DebugLog.e(TAG, "Attempting to upgrade tower over bounds");
} else {
level++;
}
refreshTowerInfo(true);
}
public void upgrade(int selection) {
if(evoTree.maxLevel <= level + 1) {
selection++;
}
if(selection == 0) {
upgrade();
return;
}
evoTree = evoTree.typeUpgrade[level + 1][selection - 1];
level = 0;
refreshTowerInfo(true);
}
public boolean isMaxLevel() {
return evoTree.maxLevel == level + 1;
}
public void setTowerChangeListener(OnTowerChangeListener listener) {
towerChangeListener = listener;
}
public int getSellPrice() {
return resellPrice;
}
public void destroy() {
destroyed = true;
}
public float getRange() {
return range;
}
/**
* Gets the tower range in grid units.
* @return Tower range in grid units.
*/
public float getGridRange() {
return range/Core.MAP_SDP;
}
public boolean hasTypeUpgrade() {
return evoTree.typeUpgrade != null && evoTree.typeUpgrade.length > level + 1 && evoTree.typeUpgrade[level + 1] != null;
}
public int getDamage() {
return evoTree.dmg[level];
}
public int getCost() {
return cost;
}
private static int scopeTexture;
private static int bulletTexture;
private static int handle;
private static int boxBurnTextureHandle;
private static int boxBurnVertexHandle;
private static int normalPulseTextureHandle;
private static int normalPulseVertexHandle;
private static int desireLaserTextureHandle;
private static int desireLaserTextureHandle2;
private static int desireLaserVertexHandle;
private static final float SCOPE_LENGTH = 1f;
public static final float SLOW_TIME = 4f;
private static float scopeLength;
public static void init() {
{
scopeLength = Core.SDP * SCOPE_LENGTH;
final float h = Core.SDP / 16f;
final float arr[] = {
0, -h,
scopeLength, -h,
0, h,
scopeLength, h
};
scopeTexture = Core.tm.get(R.drawable.sniper_asset);
bulletTexture = Core.tm.get(R.drawable.bullet);
handle = BufferUtils.copyToBuffer(arr);
}
{
// box stuff...
final float off = -(Core.MAP_SDP * 0.1f);
final float size = (Core.MAP_SDP * 1.1f);
final float arr[] = {
off, off,
size, off,
off, size,
size, size
};
boxBurnTextureHandle = Core.tm.get(R.drawable.box_burn);
boxBurnVertexHandle = BufferUtils.copyToBuffer(arr);
}
{
final float range = Core.MAP_SDP * 2.0f;
// normal stuff...
final float arr[] = {
-range, -range, //Vertex 0
range, -range, //v1
-range, range, //v2
range, range, //v3
};
normalPulseTextureHandle = Core.tm.get(R.drawable.normal_pulse);
normalPulseVertexHandle = BufferUtils.copyToBuffer(arr);
}
{
final float size = Core.MAP_SDP * 1f;
final float h = size / 2f;
final float arr[] = {
-h, 0,
h, 0,
-h, -size,
h, -size
};
desireLaserTextureHandle = Core.tm.get(R.drawable.lazer_background);
desireLaserTextureHandle2 = Core.tm.get(R.drawable.lazer_overlay);
desireLaserVertexHandle = BufferUtils.copyToBuffer(arr);
}
}
private final Special DYNAMIC_SPECIAL = new Special() {
// imitate sniper effect...
static final float FADE_TIME = 0.5f;
float fadeCounter = 0.0f;
boolean showEff;
float angle;
Sprite target = null;
float targetDistance = 0f;
@Override
public void updateSpecial(float delta) {
final float cd = coolDown;
if(target != null) {
if(target.isAlive())
angle = Utils.fastatan2(x - target.x, y - target.y);
else target = null;
} else if(cd <= 1) {
target = getTarget();
if(target != null) {
angle = Utils.fastatan2(x - target.x, y - target.y);
showEff = true;
}
} else {
showEff = false;
}
if(cd <= 0) {
coolDown = attackSpeed;
if(target != null) {
fadeCounter = FADE_TIME;
target.hitBy(Tower.this);
targetDistance = (float) (Math.sqrt((target.x - x) * (target.x - x) + (target.y - y) * (target.y - y)) / scopeLength);
}
target = null;
showEff = false;
}
if(fadeCounter > 0f) {
fadeCounter -= delta;
}
}
@Override
public void drawSpecial(float offX, float offY) {
final float finalX = x + offX;
final float finalY = y + offY;
if(showEff){
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, scopeTexture);
Utils.resetMatrix();
Utils.rotate(Utils.PI/2.0f + angle);
Utils.translateAndCommit(finalX, finalY);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, handle);
glVertexAttribPointer(Core.A_POSITION_HANDLE, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
}
if(fadeCounter > 0f) {
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, bulletTexture);
Utils.resetMatrix();
Utils.scaleW(targetDistance);
Utils.rotate(Utils.PI/2.0f + angle);
Utils.translateAndCommit(finalX, finalY);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f,( fadeCounter/FADE_TIME));
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, handle);
glVertexAttribPointer(Core.A_POSITION_HANDLE, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, 1.0f);
}
}
};
private final Special BOSS_SPECIAL = new Special() {
int positionIndex = 0;
float[] position = {
-0.5f, -0.5f,
0.5f, -0.5f,
-0.5f, 0f,
0.5f, 0f,
-0.5f, 0.5f,
0.5f, 0.5f
};
static final int MAX_POSITION = 6;
@Override
public void updateSpecial(float delta) {
if(coolDown <= 0) {
Sprite target = getTarget();
if(target != null) {
// fire
Bullet b = Core.game.obtainBullet();
b.setTexture(R.drawable.bullet);
b.setup(x + position[positionIndex<<1] * w, y + position[(positionIndex<<1) + 1] * h, target, evoTree.dmg[level],
evoTree.bs[level] * Core.SDP, Bullet.TYPE_NORMAL);
b.parent = Tower.this;
Core.gu.addGameUpdatable(b);
b.isVisible = true;
coolDown = attackSpeed;
positionIndex++;
if(positionIndex == MAX_POSITION) {
positionIndex = 0;
}
}
}
}
@Override
public void drawSpecial(float offX, float offY) { }
};
private final Special CLUSTER_SPECIAL = new Special() {
private static final float BURST_SPEED = 0.2f;
private int burstLeft = 0;
private float burstCd = BURST_SPEED;
private boolean startBurst = false;
@Override
public void updateSpecial(float delta) {
if(coolDown <= 0) {
burstLeft = (Integer) evoTree.extra;
Sprite target = getTarget();
if(target != null) {
Bullet b = Core.game.obtainBullet();
b.parent = Tower.this;
b.setTexture(R.drawable.bullet_heavy);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.SDP, Bullet.TYPE_AOE_SEEKING, evoTree.aoe[level] * Core.MAP_SDP);
Core.gu.addGameUpdatable(b);
b.isVisible = true;
coolDown = attackSpeed;
burstLeft--;
startBurst = true;
}
}
if(startBurst) {
burstCd -= delta;
}
if(burstCd <= 0f) {
Sprite target = getTarget();
if(target != null) {
Bullet b = Core.game.obtainBullet();
b.parent = Tower.this;
b.setTexture(R.drawable.bullet_heavy);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.SDP, Bullet.TYPE_AOE_SEEKING, evoTree.aoe[level] * Core.MAP_SDP);
Core.gu.addGameUpdatable(b);
b.isVisible = true;
burstCd = BURST_SPEED;
burstLeft--;
if(burstLeft == 0) {
startBurst = false;
}
}
}
}
@Override
public void drawSpecial(float offX, float offY) {
}
};
private final Special BOX_SPECIAL = new Special() {
private static final float BURN_DURATION = 2f;
private Rect rect = new Rect();
private float effectTimeLeft = 0f;
private float burnCd = 0f;
private static final float TRANSPARENCY_MAX = 0.7f, TRANSPARENCY_MIN = 0.3f;
private float transparency = TRANSPARENCY_MIN;
private boolean fading = false;
@Override
public void updateSpecial(float delta) {
if(coolDown <= 0) {
Sprite target = getTarget();
if(target != null) {
final float l = (int)(target.x / Core.MAP_SDP) * Core.MAP_SDP;
final float t = (int)(target.y / Core.MAP_SDP) * Core.MAP_SDP;
rect.left = (int) l;
rect.top = (int) t;
rect.bottom = (int) (rect.top + Core.MAP_SDP);
rect.right = (int) (rect.left + Core.MAP_SDP);
effectTimeLeft = BURN_DURATION;
coolDown = attackSpeed;
transparency = 0f;
burnCd = 0f;
}
}
if(effectTimeLeft > 0) {
effectTimeLeft -= delta;
if(burnCd > 0)
burnCd -= delta;
if(burnCd <= 0) {
burnCd = (Float) evoTree.extra;
List<Sprite> list = Core.game.spriteMgr.getRawList();
final int len = Core.game.spriteMgr.size();
for(int i = 0; i < len; i++) {
Sprite sprite = list.get(i);
if(!sprite.isTargetable()) continue;
if(rect.contains((int)sprite.x, (int)sprite.y)) {
sprite.hitBy(Tower.this);
}
}
}
if(fading) {
transparency -= delta / 2f;
if(transparency <= TRANSPARENCY_MIN) {
transparency = TRANSPARENCY_MIN;
fading = false;
}
} else {
transparency += delta / 2f;
if(transparency >= TRANSPARENCY_MAX) {
transparency = TRANSPARENCY_MAX;
fading = true;
}
}
}
}
@Override
public void drawSpecial(float offX, float offY) {
final float finalX = rect.left + offX;
final float finalY = rect.top + offY;
if(effectTimeLeft > 0) {
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, boxBurnTextureHandle);
Utils.resetMatrix();
Utils.translateAndCommit(finalX, finalY);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, boxBurnVertexHandle);
glVertexAttribPointer(Core.A_POSITION_HANDLE, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, transparency);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, 1.0f);
}
}
};
private final Special NORMAL_SPECIAL = new Special() {
private static final float FADE_DURATION = 0.4f; // in seconds
private static final float EFFECT_DURATION = 0.4f; // in seconds
private static final float TOTAL_EFFECT_DURATION = FADE_DURATION + EFFECT_DURATION;
private boolean showEffect = false;
private float effectTimeLeft = 0f;
private float transparency = 1f;
private float scale = 0f;
private boolean scaling = false;
@Override
public void updateSpecial(float delta) {
if(showEffect) {
effectTimeLeft -= delta;
if(effectTimeLeft <= 0)
showEffect = false;
else if (effectTimeLeft > FADE_DURATION) {
scaling = true;
scale = (TOTAL_EFFECT_DURATION - effectTimeLeft) / EFFECT_DURATION;
scale *= scale;
} else {
if(scaling) {
scaling = false;
List<Sprite> list = Core.game.spriteMgr.getRawList();
final int len = Core.game.spriteMgr.size();
for(int i = 0; i < len; i++) {
Sprite sprite = list.get(i);
if(!sprite.isTargetable()) continue;
final float s_x = sprite.x, s_y = sprite.y;
final float u = (s_x - x)*(s_x - x);
final float v = (s_y - y)*(s_y - y);
if(rangeSquared > u + v){
sprite.hitBy(Tower.this);
}
}
}
scale = 1f;
transparency = effectTimeLeft / FADE_DURATION;
}
}
if(coolDown <= 0) {
boolean hitSomething = false;
List<Sprite> list = Core.game.spriteMgr.getRawList();
final int len = Core.game.spriteMgr.size();
for(int i = 0; i < len; i++) {
Sprite sprite = list.get(i);
final float s_x = sprite.x, s_y = sprite.y;
final float u = (s_x - x)*(s_x - x);
final float v = (s_y - y)*(s_y - y);
if(rangeSquared > u + v){
hitSomething = true;
break;
}
}
if(hitSomething) {
effectTimeLeft = TOTAL_EFFECT_DURATION;
coolDown = attackSpeed;
transparency = 1f;
scale = 0f;
showEffect = true;
}
}
}
@Override
public void drawSpecial(float offX, float offY) {
if(showEffect){
final float finalX = x + offX;
final float finalY = y + offY;
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, normalPulseTextureHandle);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, normalPulseVertexHandle);
Utils.resetMatrix();
Utils.scale(scale);
Utils.translateAndCommit(finalX, finalY);
glVertexAttribPointer(Core.A_POSITION_HANDLE, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, transparency);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, 1.0f);
}
}
};
private final Special DESIRE_SPECIAL = new Special() {
private static final float FADE_TIME = 0.8f;
private float effectTimeLeft = 0f;
private float angle;
private float len;
@Override
public void updateSpecial(float delta) {
if(coolDown <= 0) {
Sprite target = getTarget();
if(target != null) {
// there was a sprite in range...
angle = (float) Utils.fastatan2(x - target.x, y - target.y);
//calc who was hit
float dX = target.x - x;
float dY = target.y - y;
final float multiplier = Math.abs(Core.game.map.getWidth() / dX);
dX *= multiplier;
dY *= multiplier;
final float a = dX*dX + dY*dY;
len = (float) (Math.sqrt(a) / Core.MAP_SDP);
List<Sprite> list = Core.game.spriteMgr.getRawList();
final int len = Core.game.spriteMgr.size();
for(int i = 0; i < len; i++) {
Sprite sprite = list.get(i);
if(!sprite.isTargetable()) continue;
float fX = x - sprite.x;
float fY = y - sprite.y;
float b = 2*(fX*dX + fY*dY);
float c = (fX*fX + fY*fY) - sprite.h * sprite.h;
float discriminant = b*b-4*a*c;
if( discriminant >= 0 ) {
discriminant = (float) Math.sqrt( discriminant );
float t1 = (-b + discriminant)/(2*a);
if( t1 >= 0 && t1 <= 1 ) {
sprite.hitBy(Tower.this);
}
}
}
coolDown = attackSpeed;
effectTimeLeft = FADE_TIME;
}
}
if (effectTimeLeft > 0) {
effectTimeLeft -= delta;
}
}
@Override
public void drawSpecial(float offX, float offY) {
if(effectTimeLeft > 0){
final float interpolatedTime = (effectTimeLeft / FADE_TIME);
final float transparency = -1f * interpolatedTime *(interpolatedTime-2);
final float finalX = x + offX;
final float finalY = y + offY;
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, desireLaserTextureHandle);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, desireLaserVertexHandle);
Utils.resetMatrix();
Utils.scaleH(len);
Utils.rotate(angle);
Utils.translateAndCommit(finalX, finalY);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE);
glVertexAttribPointer(Core.A_POSITION_HANDLE, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 0.0f, 0.0f, transparency);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, transparency);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, desireLaserTextureHandle2);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glUniform4f(Core.U_TEX_COLOR_HANDLE, 1.0f, 1.0f, 1.0f, 1.0f);
Core.gr.resetBlendFunc();
}
}
};
private final Special BRUTAL_SPECIAL = new Special() {
@Override
public void updateSpecial(float delta) {
if(coolDown <= 0) {
Sprite target = getGhostTarget();
if(target != null) {
// fire
Bullet b = Core.game.obtainBullet();
b.parent = Tower.this;
if (towerType == TowerLibrary.TYPE_BRUTAL) {
b.setTexture(R.drawable.bullet);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_GHOST);
} else {
b.setTexture(R.drawable.bullet);
b.setup(x, y, target, evoTree.dmg[level],
evoTree.bs[level] * Core.MAP_SDP, Bullet.TYPE_GHOST_AOE,
evoTree.aoe[level] * Core.MAP_SDP);
}
Core.gu.addGameUpdatable(b);
b.isVisible = true;
coolDown = attackSpeed;
} else {
coolDown = COOLOFF_TIME;
}
}
}
@Override
public void drawSpecial(float offX, float offY) {}
};
public void updateDamageDealt(int dmg) {
totalDmgDealt += dmg;
if(towerChangeListener != null) {
towerChangeListener.onDamageDealtChange(totalDmgDealt);
}
}
public int getTotalDmgDealt() {
return totalDmgDealt;
}
public String getName() {
return evoTree.name[level];
}
public float getAttackSpeed() {
return attackSpeed;
}
public int getTowerType() {
return evoTree.typeId;
}
public int getLevel() {
return level;
}
public String getDescription() {
return evoTree.getDescription();
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
| {
"content_hash": "744e2ead75b51e311fee9387516c3846",
"timestamp": "",
"source": "github",
"line_count": 1049,
"max_line_length": 123,
"avg_line_length": 24.493803622497616,
"alnum_prop": 0.6420954308398849,
"repo_name": "idunnololz/DivisionByZero",
"id": "fcaa1b92f0a9c51eff9153c57bf4154927b535df",
"size": "25694",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/ggstudios/divisionbyzero/Tower.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "497"
},
{
"name": "Java",
"bytes": "428056"
},
{
"name": "Makefile",
"bytes": "202"
}
],
"symlink_target": ""
} |
FROM golang:1.11.1
COPY *.go src/github.com/cockroachdb/examples-go/block_writer/
RUN \
go get github.com/cockroachdb/examples-go/block_writer && \
go install github.com/cockroachdb/examples-go/block_writer && \
rm -rf $GOPATH/src
ENTRYPOINT ["/go/bin/block_writer"]
| {
"content_hash": "41af18da985afbc235ff7be96f4fc5ac",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 65,
"avg_line_length": 27.6,
"alnum_prop": 0.7318840579710145,
"repo_name": "cockroachdb/examples-go",
"id": "40fc530c82b381909e4fd43bf427326612f71173",
"size": "276",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "block_writer/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "276"
},
{
"name": "Go",
"bytes": "121775"
},
{
"name": "Makefile",
"bytes": "2981"
},
{
"name": "Shell",
"bytes": "1973"
}
],
"symlink_target": ""
} |
<?php
/* NomayaSocialBundle:Buttons:linkedinButton.html.twig */
class __TwigTemplate_9faebc5b0e02c241e0ab7dec9de897a229b20f54150d4c5026892fc1dc1bd01f extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
if (( !array_key_exists("url", $context) || ((isset($context["url"]) ? $context["url"] : $this->getContext($context, "url")) == null))) {
// line 2
echo " ";
$context["url"] = $this->getAttribute($this->getAttribute((isset($context["app"]) ? $context["app"] : $this->getContext($context, "app")), "request", array()), "uri", array());
}
// line 4
echo "
";
// line 5
ob_start();
// line 6
echo "
<script src=\"//platform.linkedin.com/in.js\" type=\"text/javascript\">
lang: ";
// line 8
echo twig_escape_filter($this->env, (isset($context["locale"]) ? $context["locale"] : $this->getContext($context, "locale")), "html", null, true);
echo "
</script>
<script type=\"IN/Share\" data-url=\"";
// line 11
echo twig_escape_filter($this->env, (isset($context["url"]) ? $context["url"] : $this->getContext($context, "url")), "html", null, true);
echo "\" data-counter=\"";
echo twig_escape_filter($this->env, (isset($context["counter"]) ? $context["counter"] : $this->getContext($context, "counter")), "html", null, true);
echo "\"></script>
";
echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));
}
public function getTemplateName()
{
return "NomayaSocialBundle:Buttons:linkedinButton.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 40 => 11, 34 => 8, 30 => 6, 28 => 5, 25 => 4, 21 => 2, 19 => 1,);
}
}
/* {% if url is not defined or url == null %}*/
/* {% set url = app.request.uri %}*/
/* {% endif %}*/
/* */
/* {% spaceless %}*/
/* */
/* <script src="//platform.linkedin.com/in.js" type="text/javascript">*/
/* lang: {{ locale }}*/
/* </script>*/
/* */
/* <script type="IN/Share" data-url="{{ url }}" data-counter="{{ counter }}"></script>*/
/* {% endspaceless %}*/
/* */
| {
"content_hash": "cdfacca6ef20632b15f6c577e163abbf",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 188,
"avg_line_length": 32.64,
"alnum_prop": 0.5437091503267973,
"repo_name": "kouuki/CROWDRISEPIDEV",
"id": "6b06fbd10b80adabf56f900e252c832d9aefd0f8",
"size": "2448",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/cache/dev/twig/d4/d4542a0dc11941f6374b6cb37602117f1089312fe1ae621a90dcba290e14d771.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "Batchfile",
"bytes": "290"
},
{
"name": "CSS",
"bytes": "84677"
},
{
"name": "HTML",
"bytes": "83835"
},
{
"name": "JavaScript",
"bytes": "21683"
},
{
"name": "PHP",
"bytes": "76386"
},
{
"name": "Shell",
"bytes": "1853"
}
],
"symlink_target": ""
} |
load 'pf_objects.rb'
class PfField
attr_accessor :description, :objects, :npcs, :chars
def initialize(description, objects=[], npcs=[])
@description = description
@objects = objects
@npcs = npcs
@chars = []
end
def broadcast_msg (char, msg)
@chars.each do |c|
c.puts("[#{char.full_name}]: #{msg}") unless c == char
end
end
def who
# @chars.each do |c|
# puts c
# end
return @chars
end
end | {
"content_hash": "aba230af0b936cc2fd4eb0e5c0a8fe20",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 57,
"avg_line_length": 17.04,
"alnum_prop": 0.6267605633802817,
"repo_name": "despairblue/Porto-Freiberg",
"id": "1fff0772c87cec83617c1168fcb6b104b6a885ea",
"size": "426",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pf_field.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "14760"
}
],
"symlink_target": ""
} |
package mysql
import (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"strings"
"cloud.google.com/go/compute/metadata"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
sqladmin "google.golang.org/api/sqladmin/v1beta3"
)
const cloudSQLSuffix = ".cloudsql.google.internal"
func maybeRemapCloudSQL(host string) (out string, err error) {
if !strings.HasSuffix(host, cloudSQLSuffix) {
return host, nil
}
inst := strings.TrimSuffix(host, cloudSQLSuffix)
if !metadata.OnGCE() {
return "", errors.New("CloudSQL support only available when running on Google Compute Engine.")
}
proj, err := metadata.ProjectID()
if err != nil {
return "", fmt.Errorf("Failed to lookup GCE project ID: %v", err)
}
admin, _ := sqladmin.New(oauth2.NewClient(context.Background(), google.ComputeTokenSource("")))
listRes, err := admin.Instances.List(proj).Do()
if err != nil {
return "", fmt.Errorf("error enumerating Cloud SQL instances: %v", err)
}
for _, it := range listRes.Items {
if !strings.EqualFold(it.Instance, inst) {
continue
}
js, _ := json.Marshal(it)
log.Printf("Found Cloud SQL instance %s: %s", inst, js)
for _, ipm := range it.IpAddresses {
return ipm.IpAddress, nil
}
return "", fmt.Errorf("No external IP address for Cloud SQL instances %s", inst)
}
var found []string
for _, it := range listRes.Items {
found = append(found, it.Instance)
}
return "", fmt.Errorf("Cloud SQL instance %q not found. Found: %q", inst, found)
}
| {
"content_hash": "ee517b30d53bc2f4f1f37f40de5256d4",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 97,
"avg_line_length": 26.927272727272726,
"alnum_prop": 0.6839972991222147,
"repo_name": "mpl/camlistore",
"id": "718a897719fa15c0ebb42234101e2e83801e2b21",
"size": "2047",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "pkg/sorted/mysql/cloudsql.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "217"
},
{
"name": "CSS",
"bytes": "59741"
},
{
"name": "Go",
"bytes": "3694025"
},
{
"name": "HTML",
"bytes": "83161"
},
{
"name": "Java",
"bytes": "130614"
},
{
"name": "JavaScript",
"bytes": "408186"
},
{
"name": "Makefile",
"bytes": "5280"
},
{
"name": "Objective-C",
"bytes": "87307"
},
{
"name": "Perl",
"bytes": "29378"
},
{
"name": "Python",
"bytes": "258905"
},
{
"name": "Ruby",
"bytes": "216"
},
{
"name": "Shell",
"bytes": "8200"
}
],
"symlink_target": ""
} |
import socket,sys
host = ''
port = 55055
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host, port))
s.listen(1)
print "Server is running on port %d; press Ctrl-C to terminate." % port
clientsock,addr = s.accept()
recvfromclientbuf = clientsock.recv(2048)
if 0 < len(recvfromclientbuf):
sys.stdout.write(recvfromclientbuf)
print "Client IP is:", addr
replymessage = "HI, I am Server!!! \r\n"
clientsock.send(replymessage)
clientsock.close()
s.close()
| {
"content_hash": "3fe24d441721377125375deddb98b05a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 24.772727272727273,
"alnum_prop": 0.710091743119266,
"repo_name": "NineLamas/pwq",
"id": "f66e987de00cd5d5962450f556b844dd77a5b539",
"size": "579",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/socket_server.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "7894"
}
],
"symlink_target": ""
} |
package equellatests.pages.search
import com.tle.webtests.framework.PageContext
import equellatests.browserpage.TitledPage
case class FavouritesPage(ctx: PageContext) extends TitledPage("Favourites", "access/favourites.do") | {
"content_hash": "d06b547f4267a7a299e699cc914ce0ae",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 100,
"avg_line_length": 37.5,
"alnum_prop": 0.8488888888888889,
"repo_name": "equella/Equella",
"id": "7377c2ad14bebf3f31dfc8d89beab6f560d4402f",
"size": "225",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "autotest/Tests/src/test/scala/equellatests/pages/search/FavouritesPage.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "402"
},
{
"name": "Batchfile",
"bytes": "38432"
},
{
"name": "CSS",
"bytes": "648823"
},
{
"name": "Dockerfile",
"bytes": "2055"
},
{
"name": "FreeMarker",
"bytes": "370046"
},
{
"name": "HTML",
"bytes": "865667"
},
{
"name": "Java",
"bytes": "27081020"
},
{
"name": "JavaScript",
"bytes": "1673995"
},
{
"name": "PHP",
"bytes": "821"
},
{
"name": "PLpgSQL",
"bytes": "1363"
},
{
"name": "PureScript",
"bytes": "307610"
},
{
"name": "Python",
"bytes": "79871"
},
{
"name": "Scala",
"bytes": "765981"
},
{
"name": "Shell",
"bytes": "64170"
},
{
"name": "TypeScript",
"bytes": "146564"
},
{
"name": "XSLT",
"bytes": "510113"
}
],
"symlink_target": ""
} |
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "SCompoundWidget.h"
#include "SlateDelegates.h"
#include "CulturePointer.h"
struct FCultureEntry
{
FCulturePtr Culture;
TArray< TSharedPtr<FCultureEntry> > Children;
bool IsSelectable;
FCultureEntry(const FCulturePtr& InCulture, const bool InIsSelectable = true)
: Culture(InCulture)
, IsSelectable(InIsSelectable)
{}
FCultureEntry(const FCultureEntry& Source)
: Culture(Source.Culture)
, IsSelectable(Source.IsSelectable)
{
Children.Reserve(Source.Children.Num());
for (const auto& Child : Source.Children)
{
Children.Add( MakeShareable( new FCultureEntry(*Child) ) );
}
}
};
class SCulturePicker : public SCompoundWidget
{
public:
/** A delegate type invoked when a selection changes somewhere. */
DECLARE_DELEGATE_RetVal_OneParam(bool, FIsCulturePickable, FCulturePtr);
typedef TSlateDelegates< FCulturePtr >::FOnSelectionChanged FOnSelectionChanged;
public:
SLATE_BEGIN_ARGS( SCulturePicker ){}
SLATE_EVENT( FOnSelectionChanged, OnSelectionChanged )
SLATE_EVENT( FIsCulturePickable, IsCulturePickable )
SLATE_ARGUMENT( FCulturePtr, InitialSelection )
SLATE_END_ARGS()
void Construct( const FArguments& InArgs );
void RequestTreeRefresh();
private:
void BuildStockEntries();
void RebuildEntries();
void OnFilterStringChanged(const FText& InFilterString);
TSharedRef<ITableRow> OnGenerateRow(TSharedPtr<FCultureEntry> Entry, const TSharedRef<STableViewBase>& Table);
void OnGetChildren(TSharedPtr<FCultureEntry> Entry, TArray< TSharedPtr<FCultureEntry> >& Children);
void OnSelectionChanged(TSharedPtr<FCultureEntry> Entry, ESelectInfo::Type SelectInfo);
private:
TSharedPtr< STreeView< TSharedPtr<FCultureEntry> > > TreeView;
/* The provided cultures array. */
TArray<FCulturePtr> Cultures;
/* The top level culture entries for all possible stock cultures. */
TArray< TSharedPtr<FCultureEntry> > StockEntries;
/* The top level culture entries to be displayed in the tree view. */
TArray< TSharedPtr<FCultureEntry> > RootEntries;
/* The string by which to filter cultures names. */
FString FilterString;
/** Delegate to invoke when selection changes. */
FOnSelectionChanged OnCultureSelectionChanged;
/** Delegate to invoke to set whether a culture is "pickable". */
FIsCulturePickable IsCulturePickable;
}; | {
"content_hash": "50386dcf82e05ae2a1601bac20da0af3",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 111,
"avg_line_length": 30.358974358974358,
"alnum_prop": 0.7732263513513513,
"repo_name": "PopCap/GameIdea",
"id": "f6c2f39f8f63b39192b08521a6fd7b373098f132",
"size": "2368",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Engine/Source/Editor/LocalizationDashboard/Private/SCulturePicker.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ASP",
"bytes": "238055"
},
{
"name": "Assembly",
"bytes": "184134"
},
{
"name": "Batchfile",
"bytes": "116983"
},
{
"name": "C",
"bytes": "84264210"
},
{
"name": "C#",
"bytes": "9612596"
},
{
"name": "C++",
"bytes": "242290999"
},
{
"name": "CMake",
"bytes": "548754"
},
{
"name": "CSS",
"bytes": "134910"
},
{
"name": "GLSL",
"bytes": "96780"
},
{
"name": "HLSL",
"bytes": "124014"
},
{
"name": "HTML",
"bytes": "4097051"
},
{
"name": "Java",
"bytes": "757767"
},
{
"name": "JavaScript",
"bytes": "2742822"
},
{
"name": "Makefile",
"bytes": "1976144"
},
{
"name": "Objective-C",
"bytes": "75778979"
},
{
"name": "Objective-C++",
"bytes": "312592"
},
{
"name": "PAWN",
"bytes": "2029"
},
{
"name": "PHP",
"bytes": "10309"
},
{
"name": "PLSQL",
"bytes": "130426"
},
{
"name": "Pascal",
"bytes": "23662"
},
{
"name": "Perl",
"bytes": "218656"
},
{
"name": "Python",
"bytes": "21593012"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "2889614"
},
{
"name": "Tcl",
"bytes": "1452"
}
],
"symlink_target": ""
} |
This application makes use of the following third party libraries:
## GreenAR
Copyright (c) 2017 Daniel Grenier <seanalair@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Generated by CocoaPods - https://cocoapods.org
| {
"content_hash": "a9109de4a225558b9d6795461dc199a3",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 48.32,
"alnum_prop": 0.8029801324503312,
"repo_name": "Seanalair/GreenAR",
"id": "e4f7d648d1d05af92eb43be434b0cef552ed8899",
"size": "1227",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/Pods/Target Support Files/Pods-GreenAR_Example/Pods-GreenAR_Example-acknowledgements.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "26701"
},
{
"name": "Objective-C",
"bytes": "67330"
},
{
"name": "Ruby",
"bytes": "2183"
},
{
"name": "Shell",
"bytes": "17782"
},
{
"name": "Swift",
"bytes": "368599"
}
],
"symlink_target": ""
} |
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/http'), require('rxjs/Observable'), require('rxjs/add/operator/delay')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/http', 'rxjs/Observable', 'rxjs/add/operator/delay'], factory) :
(factory((global.ng = global.ng || {}, global.ng.inMemoryWebApi = global.ng.inMemoryWebApi || {}),global.ng.core,global.ng.http,global.Rx,global.Rx));
}(this, (function (exports,_angular_core,_angular_http,rxjs_Observable,rxjs_add_operator_delay) { 'use strict';
var STATUS = {
CONTINUE: 100,
SWITCHING_PROTOCOLS: 101,
OK: 200,
CREATED: 201,
ACCEPTED: 202,
NON_AUTHORITATIVE_INFORMATION: 203,
NO_CONTENT: 204,
RESET_CONTENT: 205,
PARTIAL_CONTENT: 206,
MULTIPLE_CHOICES: 300,
MOVED_PERMANTENTLY: 301,
FOUND: 302,
SEE_OTHER: 303,
NOT_MODIFIED: 304,
USE_PROXY: 305,
TEMPORARY_REDIRECT: 307,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
PAYMENT_REQUIRED: 402,
FORBIDDEN: 403,
NOT_FOUND: 404,
METHOD_NOT_ALLOWED: 405,
NOT_ACCEPTABLE: 406,
PROXY_AUTHENTICATION_REQUIRED: 407,
REQUEST_TIMEOUT: 408,
CONFLICT: 409,
GONE: 410,
LENGTH_REQUIRED: 411,
PRECONDITION_FAILED: 412,
PAYLOAD_TO_LARGE: 413,
URI_TOO_LONG: 414,
UNSUPPORTED_MEDIA_TYPE: 415,
RANGE_NOT_SATISFIABLE: 416,
EXPECTATION_FAILED: 417,
IM_A_TEAPOT: 418,
UPGRADE_REQUIRED: 426,
INTERNAL_SERVER_ERROR: 500,
NOT_IMPLEMENTED: 501,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
GATEWAY_TIMEOUT: 504,
HTTP_VERSION_NOT_SUPPORTED: 505,
PROCESSING: 102,
MULTI_STATUS: 207,
IM_USED: 226,
PERMANENT_REDIRECT: 308,
UNPROCESSABLE_ENTRY: 422,
LOCKED: 423,
FAILED_DEPENDENCY: 424,
PRECONDITION_REQUIRED: 428,
TOO_MANY_REQUESTS: 429,
REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
UNAVAILABLE_FOR_LEGAL_REASONS: 451,
VARIANT_ALSO_NEGOTIATES: 506,
INSUFFICIENT_STORAGE: 507,
NETWORK_AUTHENTICATION_REQUIRED: 511
};
/*tslint:disable:quotemark max-line-length one-line */
var STATUS_CODE_INFO = {
'100': {
'code': 100,
'text': 'Continue',
'description': '\"The initial part of a request has been received and has not yet been rejected by the server.\"',
'spec_title': 'RFC7231#6.2.1',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.2.1'
},
'101': {
'code': 101,
'text': 'Switching Protocols',
'description': '\"The server understands and is willing to comply with the client\'s request, via the Upgrade header field, for a change in the application protocol being used on this connection.\"',
'spec_title': 'RFC7231#6.2.2',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.2.2'
},
'200': {
'code': 200,
'text': 'OK',
'description': '\"The request has succeeded.\"',
'spec_title': 'RFC7231#6.3.1',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.1'
},
'201': {
'code': 201,
'text': 'Created',
'description': '\"The request has been fulfilled and has resulted in one or more new resources being created.\"',
'spec_title': 'RFC7231#6.3.2',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.2'
},
'202': {
'code': 202,
'text': 'Accepted',
'description': '\"The request has been accepted for processing, but the processing has not been completed.\"',
'spec_title': 'RFC7231#6.3.3',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.3'
},
'203': {
'code': 203,
'text': 'Non-Authoritative Information',
'description': '\"The request was successful but the enclosed payload has been modified from that of the origin server\'s 200 (OK) response by a transforming proxy.\"',
'spec_title': 'RFC7231#6.3.4',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.4'
},
'204': {
'code': 204,
'text': 'No Content',
'description': '\"The server has successfully fulfilled the request and that there is no additional content to send in the response payload body.\"',
'spec_title': 'RFC7231#6.3.5',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.5'
},
'205': {
'code': 205,
'text': 'Reset Content',
'description': '\"The server has fulfilled the request and desires that the user agent reset the \"document view\", which caused the request to be sent, to its original state as received from the origin server.\"',
'spec_title': 'RFC7231#6.3.6',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.6'
},
'206': {
'code': 206,
'text': 'Partial Content',
'description': '\"The server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the requests\'s Range header field.\"',
'spec_title': 'RFC7233#4.1',
'spec_href': 'http://tools.ietf.org/html/rfc7233#section-4.1'
},
'300': {
'code': 300,
'text': 'Multiple Choices',
'description': '\"The target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers.\"',
'spec_title': 'RFC7231#6.4.1',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.4.1'
},
'301': {
'code': 301,
'text': 'Moved Permanently',
'description': '\"The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs.\"',
'spec_title': 'RFC7231#6.4.2',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.4.2'
},
'302': {
'code': 302,
'text': 'Found',
'description': '\"The target resource resides temporarily under a different URI.\"',
'spec_title': 'RFC7231#6.4.3',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.4.3'
},
'303': {
'code': 303,
'text': 'See Other',
'description': '\"The server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, that is intended to provide an indirect response to the original request.\"',
'spec_title': 'RFC7231#6.4.4',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.4.4'
},
'304': {
'code': 304,
'text': 'Not Modified',
'description': '\"A conditional GET request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition has evaluated to false.\"',
'spec_title': 'RFC7232#4.1',
'spec_href': 'http://tools.ietf.org/html/rfc7232#section-4.1'
},
'305': {
'code': 305,
'text': 'Use Proxy',
'description': '*deprecated*',
'spec_title': 'RFC7231#6.4.5',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.4.5'
},
'307': {
'code': 307,
'text': 'Temporary Redirect',
'description': '\"The target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI.\"',
'spec_title': 'RFC7231#6.4.7',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.4.7'
},
'400': {
'code': 400,
'text': 'Bad Request',
'description': '\"The server cannot or will not process the request because the received syntax is invalid, nonsensical, or exceeds some limitation on what the server is willing to process.\"',
'spec_title': 'RFC7231#6.5.1',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.1'
},
'401': {
'code': 401,
'text': 'Unauthorized',
'description': '\"The request has not been applied because it lacks valid authentication credentials for the target resource.\"',
'spec_title': 'RFC7235#6.3.1',
'spec_href': 'http://tools.ietf.org/html/rfc7235#section-3.1'
},
'402': {
'code': 402,
'text': 'Payment Required',
'description': '*reserved*',
'spec_title': 'RFC7231#6.5.2',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.2'
},
'403': {
'code': 403,
'text': 'Forbidden',
'description': '\"The server understood the request but refuses to authorize it.\"',
'spec_title': 'RFC7231#6.5.3',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.3'
},
'404': {
'code': 404,
'text': 'Not Found',
'description': '\"The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.\"',
'spec_title': 'RFC7231#6.5.4',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.4'
},
'405': {
'code': 405,
'text': 'Method Not Allowed',
'description': '\"The method specified in the request-line is known by the origin server but not supported by the target resource.\"',
'spec_title': 'RFC7231#6.5.5',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.5'
},
'406': {
'code': 406,
'text': 'Not Acceptable',
'description': '\"The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation.\"',
'spec_title': 'RFC7231#6.5.6',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.6'
},
'407': {
'code': 407,
'text': 'Proxy Authentication Required',
'description': '\"The client needs to authenticate itself in order to use a proxy.\"',
'spec_title': 'RFC7231#6.3.2',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.3.2'
},
'408': {
'code': 408,
'text': 'Request Timeout',
'description': '\"The server did not receive a complete request message within the time that it was prepared to wait.\"',
'spec_title': 'RFC7231#6.5.7',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.7'
},
'409': {
'code': 409,
'text': 'Conflict',
'description': '\"The request could not be completed due to a conflict with the current state of the resource.\"',
'spec_title': 'RFC7231#6.5.8',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.8'
},
'410': {
'code': 410,
'text': 'Gone',
'description': '\"Access to the target resource is no longer available at the origin server and that this condition is likely to be permanent.\"',
'spec_title': 'RFC7231#6.5.9',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.9'
},
'411': {
'code': 411,
'text': 'Length Required',
'description': '\"The server refuses to accept the request without a defined Content-Length.\"',
'spec_title': 'RFC7231#6.5.10',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.10'
},
'412': {
'code': 412,
'text': 'Precondition Failed',
'description': '\"One or more preconditions given in the request header fields evaluated to false when tested on the server.\"',
'spec_title': 'RFC7232#4.2',
'spec_href': 'http://tools.ietf.org/html/rfc7232#section-4.2'
},
'413': {
'code': 413,
'text': 'Payload Too Large',
'description': '\"The server is refusing to process a request because the request payload is larger than the server is willing or able to process.\"',
'spec_title': 'RFC7231#6.5.11',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.11'
},
'414': {
'code': 414,
'text': 'URI Too Long',
'description': '\"The server is refusing to service the request because the request-target is longer than the server is willing to interpret.\"',
'spec_title': 'RFC7231#6.5.12',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.12'
},
'415': {
'code': 415,
'text': 'Unsupported Media Type',
'description': '\"The origin server is refusing to service the request because the payload is in a format not supported by the target resource for this method.\"',
'spec_title': 'RFC7231#6.5.13',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.13'
},
'416': {
'code': 416,
'text': 'Range Not Satisfiable',
'description': '\"None of the ranges in the request\'s Range header field overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges.\"',
'spec_title': 'RFC7233#4.4',
'spec_href': 'http://tools.ietf.org/html/rfc7233#section-4.4'
},
'417': {
'code': 417,
'text': 'Expectation Failed',
'description': '\"The expectation given in the request\'s Expect header field could not be met by at least one of the inbound servers.\"',
'spec_title': 'RFC7231#6.5.14',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.14'
},
'418': {
'code': 418,
'text': 'I\'m a teapot',
'description': '\"1988 April Fools Joke. Returned by tea pots requested to brew coffee.\"',
'spec_title': 'RFC 2324',
'spec_href': 'https://tools.ietf.org/html/rfc2324'
},
'426': {
'code': 426,
'text': 'Upgrade Required',
'description': '\"The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.\"',
'spec_title': 'RFC7231#6.5.15',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.5.15'
},
'500': {
'code': 500,
'text': 'Internal Server Error',
'description': '\"The server encountered an unexpected condition that prevented it from fulfilling the request.\"',
'spec_title': 'RFC7231#6.6.1',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.6.1'
},
'501': {
'code': 501,
'text': 'Not Implemented',
'description': '\"The server does not support the functionality required to fulfill the request.\"',
'spec_title': 'RFC7231#6.6.2',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.6.2'
},
'502': {
'code': 502,
'text': 'Bad Gateway',
'description': '\"The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.\"',
'spec_title': 'RFC7231#6.6.3',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.6.3'
},
'503': {
'code': 503,
'text': 'Service Unavailable',
'description': '\"The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.\"',
'spec_title': 'RFC7231#6.6.4',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.6.4'
},
'504': {
'code': 504,
'text': 'Gateway Time-out',
'description': '\"The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.\"',
'spec_title': 'RFC7231#6.6.5',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.6.5'
},
'505': {
'code': 505,
'text': 'HTTP Version Not Supported',
'description': '\"The server does not support, or refuses to support, the protocol version that was used in the request message.\"',
'spec_title': 'RFC7231#6.6.6',
'spec_href': 'http://tools.ietf.org/html/rfc7231#section-6.6.6'
},
'102': {
'code': 102,
'text': 'Processing',
'description': '\"An interim response to inform the client that the server has accepted the complete request, but has not yet completed it.\"',
'spec_title': 'RFC5218#10.1',
'spec_href': 'http://tools.ietf.org/html/rfc2518#section-10.1'
},
'207': {
'code': 207,
'text': 'Multi-Status',
'description': '\"Status for multiple independent operations.\"',
'spec_title': 'RFC5218#10.2',
'spec_href': 'http://tools.ietf.org/html/rfc2518#section-10.2'
},
'226': {
'code': 226,
'text': 'IM Used',
'description': '\"The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\"',
'spec_title': 'RFC3229#10.4.1',
'spec_href': 'http://tools.ietf.org/html/rfc3229#section-10.4.1'
},
'308': {
'code': 308,
'text': 'Permanent Redirect',
'description': '\"The target resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. [...] This status code is similar to 301 Moved Permanently (Section 7.3.2 of rfc7231), except that it does not allow rewriting the request method from POST to GET.\"',
'spec_title': 'RFC7238',
'spec_href': 'http://tools.ietf.org/html/rfc7238'
},
'422': {
'code': 422,
'text': 'Unprocessable Entity',
'description': '\"The server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.\"',
'spec_title': 'RFC5218#10.3',
'spec_href': 'http://tools.ietf.org/html/rfc2518#section-10.3'
},
'423': {
'code': 423,
'text': 'Locked',
'description': '\"The source or destination resource of a method is locked.\"',
'spec_title': 'RFC5218#10.4',
'spec_href': 'http://tools.ietf.org/html/rfc2518#section-10.4'
},
'424': {
'code': 424,
'text': 'Failed Dependency',
'description': '\"The method could not be performed on the resource because the requested action depended on another action and that action failed.\"',
'spec_title': 'RFC5218#10.5',
'spec_href': 'http://tools.ietf.org/html/rfc2518#section-10.5'
},
'428': {
'code': 428,
'text': 'Precondition Required',
'description': '\"The origin server requires the request to be conditional.\"',
'spec_title': 'RFC6585#3',
'spec_href': 'http://tools.ietf.org/html/rfc6585#section-3'
},
'429': {
'code': 429,
'text': 'Too Many Requests',
'description': '\"The user has sent too many requests in a given amount of time (\"rate limiting\").\"',
'spec_title': 'RFC6585#4',
'spec_href': 'http://tools.ietf.org/html/rfc6585#section-4'
},
'431': {
'code': 431,
'text': 'Request Header Fields Too Large',
'description': '\"The server is unwilling to process the request because its header fields are too large.\"',
'spec_title': 'RFC6585#5',
'spec_href': 'http://tools.ietf.org/html/rfc6585#section-5'
},
'451': {
'code': 451,
'text': 'Unavailable For Legal Reasons',
'description': '\"The server is denying access to the resource in response to a legal demand.\"',
'spec_title': 'draft-ietf-httpbis-legally-restricted-status',
'spec_href': 'http://tools.ietf.org/html/draft-ietf-httpbis-legally-restricted-status'
},
'506': {
'code': 506,
'text': 'Variant Also Negotiates',
'description': '\"The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.\"',
'spec_title': 'RFC2295#8.1',
'spec_href': 'http://tools.ietf.org/html/rfc2295#section-8.1'
},
'507': {
'code': 507,
'text': 'Insufficient Storage',
'description': '\The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.\"',
'spec_title': 'RFC5218#10.6',
'spec_href': 'http://tools.ietf.org/html/rfc2518#section-10.6'
},
'511': {
'code': 511,
'text': 'Network Authentication Required',
'description': '\"The client needs to authenticate to gain network access.\"',
'spec_title': 'RFC6585#6',
'spec_href': 'http://tools.ietf.org/html/rfc6585#section-6'
}
};
//////////// HELPERS ///////////
/**
* Create an error Response from an HTTP status code and error message
*/
function createErrorResponse(req, status, message) {
return new _angular_http.ResponseOptions({
body: { 'error': "" + message },
url: req.url,
headers: new _angular_http.Headers({ 'Content-Type': 'application/json' }),
status: status
});
}
/**
* Create an Observable response from response options.
*/
function createObservableResponse(req, resOptions) {
return new rxjs_Observable.Observable(function (responseObserver) {
emitResponse(responseObserver, req, resOptions);
return function () { }; // unsubscribe function
});
}
/**
* Create a response from response options
* and tell "ResponseObserver" (an `Observer<Response>`) to emit it.
* The observer's observable is either completed or in error state after call.
*/
function emitResponse(responseObserver, req, resOptions) {
resOptions.url = resOptions.url || req.url; // make sure url is set
resOptions = setStatusText(resOptions);
var res = new _angular_http.Response(resOptions);
if (isSuccess(res.status)) {
responseObserver.next(res);
responseObserver.complete();
}
else {
responseObserver.error(res);
}
}
/**
* Interface for a class that creates an in-memory database
*
* Its `createDb` method creates a hash of named collections that represents the database
*
* For maximum flexibility, the service may define HTTP method overrides.
* Such methods must match the spelling of an HTTP method in lower case (e.g, "get").
* If a request has a matching method, it will be called as in
* `get(info: requestInfo, db: {})` where `db` is the database object described above.
*/
var InMemoryDbService = (function () {
function InMemoryDbService() {
}
return InMemoryDbService;
}());
/**
* Interface for InMemoryBackend configuration options
*/
var InMemoryBackendConfigArgs = (function () {
function InMemoryBackendConfigArgs() {
}
return InMemoryBackendConfigArgs;
}());
function removeTrailingSlash(path) {
return path.replace(/\/$/, '');
}
/////////////////////////////////
/**
* InMemoryBackendService configuration options
* Usage:
* InMemoryWebApiModule.forRoot(InMemHeroService, {delay: 600})
*
* or if providing separately:
* provide(InMemoryBackendConfig, {useValue: {delay: 600}}),
*/
var InMemoryBackendConfig = (function () {
function InMemoryBackendConfig(config) {
if (config === void 0) { config = {}; }
Object.assign(this, {
// default config:
caseSensitiveSearch: false,
defaultResponseOptions: new _angular_http.BaseResponseOptions(),
delay: 500,
delete404: false,
passThruUnknownUrl: false,
post204: true,
put204: true,
apiBase: undefined,
host: undefined,
rootPath: undefined // default value is actually set in InMemoryBackendService ctor
}, config);
}
InMemoryBackendConfig.decorators = [
{ type: _angular_core.Injectable },
];
/** @nocollapse */
InMemoryBackendConfig.ctorParameters = function () { return [
{ type: InMemoryBackendConfigArgs, },
]; };
return InMemoryBackendConfig;
}());
/**
* Returns true if the the Http Status Code is 200-299 (success)
*/
function isSuccess(status) { return status >= 200 && status < 300; }
/**
* Set the status text in a response:
*/
function setStatusText(options) {
try {
var statusCode = STATUS_CODE_INFO[options.status];
options['statusText'] = statusCode ? statusCode.text : 'Unknown Status';
return options;
}
catch (err) {
return new _angular_http.ResponseOptions({
status: STATUS.INTERNAL_SERVER_ERROR,
statusText: 'Invalid Server Operation'
});
}
}
//////////// InMemoryBackendService ///////////
/**
* Simulate the behavior of a RESTy web api
* backed by the simple in-memory data store provided by the injected InMemoryDataService service.
* Conforms mostly to behavior described here:
* http://www.restapitutorial.com/lessons/httpmethods.html
*
* ### Usage
*
* Create `InMemoryDataService` class that implements `InMemoryDataService`.
* Call `forRoot` static method with this service class and optional configuration object:
* ```
* // other imports
* import { HttpModule } from '@angular/http';
* import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
*
* import { InMemHeroService, inMemConfig } from '../api/in-memory-hero.service';
* @NgModule({
* imports: [
* HttpModule,
* InMemoryWebApiModule.forRoot(InMemHeroService, inMemConfig),
* ...
* ],
* ...
* })
* export class AppModule { ... }
* ```
*/
var InMemoryBackendService = (function () {
function InMemoryBackendService(injector, inMemDbService, config) {
this.injector = injector;
this.inMemDbService = inMemDbService;
this.config = new InMemoryBackendConfig();
this.resetDb();
var loc = this.getLocation('./');
this.config.host = loc.host; // default to app web server host
this.config.rootPath = loc.pathname; // default to path when app is served (e.g.'/')
Object.assign(this.config, config || {});
this.setPassThruBackend();
}
InMemoryBackendService.prototype.createConnection = function (req) {
var response;
try {
response = this.handleRequest(req);
}
catch (error) {
var err = error.message || error;
var options = createErrorResponse(req, STATUS.INTERNAL_SERVER_ERROR, "" + err);
response = this.addDelay(createObservableResponse(req, options));
}
return {
readyState: _angular_http.ReadyState.Done,
request: req,
response: response
};
};
//// protected /////
/**
* Process Request and return an Observable of Http Response object
* in the manner of a RESTy web api.
*
* Expect URI pattern in the form :base/:collectionName/:id?
* Examples:
* // for store with a 'customers' collection
* GET api/customers // all customers
* GET api/customers/42 // the character with id=42
* GET api/customers?name=^j // 'j' is a regex; returns customers whose name starts with 'j' or 'J'
* GET api/customers.json/42 // ignores the ".json"
*
* Also accepts direct commands to the service in which the last segment of the apiBase is the word "commands"
* Examples:
* POST commands/resetDb,
* GET/POST commands/config - get or (re)set the config
*
* HTTP overrides:
* If the injected inMemDbService defines an HTTP method (lowercase)
* The request is forwarded to that method as in
* `inMemDbService.get(httpMethodInterceptorArgs)`
* which must return an `Observable<Response>`
*/
InMemoryBackendService.prototype.handleRequest = function (req) {
var parsed = this.inMemDbService['parseUrl'] ?
// parse with override method
this.inMemDbService['parseUrl'](req.url) :
// parse with default url parser
this.parseUrl(req.url);
var base = parsed.base, collectionName = parsed.collectionName, id = parsed.id, query = parsed.query, resourceUrl = parsed.resourceUrl;
var collection = this.db[collectionName];
var reqInfo = {
req: req,
base: base,
collection: collection,
collectionName: collectionName,
headers: new _angular_http.Headers({ 'Content-Type': 'application/json' }),
id: this.parseId(collection, id),
query: query,
resourceUrl: resourceUrl
};
var reqMethodName = _angular_http.RequestMethod[req.method || 0].toLowerCase();
var resOptions;
if (/commands\/$/i.test(reqInfo.base)) {
return this.commands(reqInfo);
}
else if (this.inMemDbService[reqMethodName]) {
// InMemoryDbService has an overriding interceptor for this HTTP method; call it
// The interceptor result must be an Observable<Response>
var interceptorArgs = {
requestInfo: reqInfo,
db: this.db,
config: this.config,
passThruBackend: this.passThruBackend
};
var interceptorResponse = this.inMemDbService[reqMethodName](interceptorArgs);
return this.addDelay(interceptorResponse);
}
else if (reqInfo.collection) {
// request is for a collection created by the InMemoryDbService
return this.addDelay(this.collectionHandler(reqInfo));
}
else if (this.passThruBackend) {
// Passes request thru to a "real" backend which returns an Observable<Response>
// BAIL OUT with this Observable<Response>
return this.passThruBackend.createConnection(req).response;
}
else {
// can't handle this request
resOptions = createErrorResponse(req, STATUS.NOT_FOUND, "Collection '" + collectionName + "' not found");
return this.addDelay(createObservableResponse(req, resOptions));
}
};
/**
* Add configured delay to response observable unless delay === 0
*/
InMemoryBackendService.prototype.addDelay = function (response) {
var delay = this.config.delay;
return delay === 0 ? response : response.delay(delay || 500);
};
/**
* Apply query/search parameters as a filter over the collection
* This impl only supports RegExp queries on string properties of the collection
* ANDs the conditions together
*/
InMemoryBackendService.prototype.applyQuery = function (collection, query) {
// extract filtering conditions - {propertyName, RegExps) - from query/search parameters
var conditions = [];
var caseSensitive = this.config.caseSensitiveSearch ? undefined : 'i';
query.paramsMap.forEach(function (value, name) {
value.forEach(function (v) { return conditions.push({ name: name, rx: new RegExp(decodeURI(v), caseSensitive) }); });
});
var len = conditions.length;
if (!len) {
return collection;
}
// AND the RegExp conditions
return collection.filter(function (row) {
var ok = true;
var i = len;
while (ok && i) {
i -= 1;
var cond = conditions[i];
ok = cond.rx.test(row[cond.name]);
}
return ok;
});
};
InMemoryBackendService.prototype.clone = function (data) {
return JSON.parse(JSON.stringify(data));
};
InMemoryBackendService.prototype.collectionHandler = function (reqInfo) {
var _this = this;
var req = reqInfo.req;
return new rxjs_Observable.Observable(function (responseObserver) {
var resOptions;
switch (req.method) {
case _angular_http.RequestMethod.Get:
resOptions = _this.get(reqInfo);
break;
case _angular_http.RequestMethod.Post:
resOptions = _this.post(reqInfo);
break;
case _angular_http.RequestMethod.Put:
resOptions = _this.put(reqInfo);
break;
case _angular_http.RequestMethod.Delete:
resOptions = _this.delete(reqInfo);
break;
default:
resOptions = createErrorResponse(req, STATUS.METHOD_NOT_ALLOWED, 'Method not allowed');
break;
}
// If `inMemDbService.responseInterceptor` exists, let it morph the response options
if (_this.inMemDbService['responseInterceptor']) {
resOptions = _this.inMemDbService['responseInterceptor'](resOptions, reqInfo);
}
emitResponse(responseObserver, reqInfo.req, resOptions);
return function () { }; // unsubscribe function
});
};
/**
* When the last segment of the `base` path is "commands", the `collectionName` is the command
* Example URLs:
* commands/resetdb // Reset the "database" to its original state
* commands/config (GET) // Return this service's config object
* commands/config (!GET) // Update the config (e.g. delay)
*
* Commands are "hot", meaning they are always executed immediately
* whether or not someone subscribes to the returned observable
*
* Usage:
* http.post('commands/resetdb', undefined);
* http.get('commands/config');
* http.post('commands/config', '{"delay":1000}');
*/
InMemoryBackendService.prototype.commands = function (reqInfo) {
var command = reqInfo.collectionName.toLowerCase();
var method = reqInfo.req.method;
var resOptions;
switch (command) {
case 'resetdb':
this.resetDb();
resOptions = new _angular_http.ResponseOptions({ status: STATUS.OK });
break;
case 'config':
if (method === _angular_http.RequestMethod.Get) {
resOptions = new _angular_http.ResponseOptions({
body: this.clone(this.config),
status: STATUS.OK
});
}
else {
// Be nice ... any other method is a config update
var body = JSON.parse(reqInfo.req.text() || '{}');
Object.assign(this.config, body);
this.setPassThruBackend();
resOptions = new _angular_http.ResponseOptions({ status: STATUS.NO_CONTENT });
}
break;
default:
resOptions = createErrorResponse(reqInfo.req, STATUS.INTERNAL_SERVER_ERROR, "Unknown command \"" + command + "\"");
}
return createObservableResponse(reqInfo.req, resOptions);
};
InMemoryBackendService.prototype.delete = function (_a) {
var id = _a.id, collection = _a.collection, collectionName = _a.collectionName, headers = _a.headers, req = _a.req;
if (!id) {
return createErrorResponse(req, STATUS.NOT_FOUND, "Missing \"" + collectionName + "\" id");
}
var exists = this.removeById(collection, id);
return new _angular_http.ResponseOptions({
headers: headers,
status: (exists || !this.config.delete404) ? STATUS.NO_CONTENT : STATUS.NOT_FOUND
});
};
InMemoryBackendService.prototype.findById = function (collection, id) {
return collection.find(function (item) { return item.id === id; });
};
InMemoryBackendService.prototype.genId = function (collection) {
// assumes numeric ids
var maxId = 0;
collection.reduce(function (prev, item) {
maxId = Math.max(maxId, typeof item.id === 'number' ? item.id : maxId);
}, undefined);
return maxId + 1;
};
InMemoryBackendService.prototype.get = function (_a) {
var id = _a.id, query = _a.query, collection = _a.collection, collectionName = _a.collectionName, headers = _a.headers, req = _a.req;
var data = collection;
if (id) {
data = this.findById(collection, id);
}
else if (query) {
data = this.applyQuery(collection, query);
}
if (!data) {
return createErrorResponse(req, STATUS.NOT_FOUND, "'" + collectionName + "' with id='" + id + "' not found");
}
return new _angular_http.ResponseOptions({
body: { data: this.clone(data) },
headers: headers,
status: STATUS.OK
});
};
InMemoryBackendService.prototype.getLocation = function (href) {
var l = document.createElement('a');
l.href = href;
return l;
};
InMemoryBackendService.prototype.indexOf = function (collection, id) {
return collection.findIndex(function (item) { return item.id === id; });
};
// tries to parse id as number if collection item.id is a number.
// returns the original param id otherwise.
InMemoryBackendService.prototype.parseId = function (collection, id) {
// tslint:disable-next-line:triple-equals
if (!collection || id == undefined) {
return undefined;
}
var isNumberId = collection[0] && typeof collection[0].id === 'number';
if (isNumberId) {
var idNum = parseFloat(id);
return isNaN(idNum) ? id : idNum;
}
return id;
};
/**
* Parses the request URL into a `ParsedUrl` object.
* Parsing depends upon certain values of `config`: `apiBase`, `host`, and `urlRoot`.
*
* Configuring the `apiBase` yields the most interesting changes to `parseUrl` behavior:
* When apiBase=undefined and url='http://localhost/api/collection/42'
* {base: 'api/', collectionName: 'collection', id: '42', ...}
* When apiBase='some/api/root/' and url='http://localhost/some/api/root/collection'
* {base: 'some/api/root/', collectionName: 'collection', id: undefined, ...}
* When apiBase='/' and url='http://localhost/collection'
* {base: '/', collectionName: 'collection', id: undefined, ...}
*
* The actual api base segment values are ignored. Only the number of segments matters.
* The following api base strings are considered identical: 'a/b' ~ 'some/api/' ~ `two/segments'
*
* To replace this default method, assign your alternative to your InMemDbService['parseUrl']
*/
InMemoryBackendService.prototype.parseUrl = function (url) {
try {
var loc = this.getLocation(url);
var drop = this.config.rootPath.length;
var urlRoot = '';
if (loc.host !== this.config.host) {
// url for a server on a different host!
// assume it's collection is actually here too.
drop = 1; // the leading slash
urlRoot = loc.protocol + '//' + loc.host + '/';
}
var path = loc.pathname.substring(drop);
var pathSegments = path.split('/');
var segmentIx = 0;
// apiBase: the front part of the path devoted to getting to the api route
// Assumes first path segment if no config.apiBase
// else ignores as many path segments as are in config.apiBase
// Does NOT care what the api base chars actually are.
var apiBase = void 0;
// tslint:disable-next-line:triple-equals
if (this.config.apiBase == undefined) {
apiBase = pathSegments[segmentIx++];
}
else {
apiBase = removeTrailingSlash(this.config.apiBase.trim());
if (apiBase) {
segmentIx = apiBase.split('/').length;
}
else {
segmentIx = 0; // no api base at all; unwise but allowed.
}
}
apiBase = apiBase + '/';
var collectionName = pathSegments[segmentIx++];
// ignore anything after a '.' (e.g.,the "json" in "customers.json")
collectionName = collectionName && collectionName.split('.')[0];
var id = pathSegments[segmentIx++];
var query = loc.search && new _angular_http.URLSearchParams(loc.search.substr(1));
var resourceUrl = urlRoot + apiBase + collectionName + '/';
return { base: apiBase, collectionName: collectionName, id: id, query: query, resourceUrl: resourceUrl };
}
catch (err) {
var msg = "unable to parse url '" + url + "'; original error: " + err.message;
throw new Error(msg);
}
};
InMemoryBackendService.prototype.post = function (_a) {
var collection = _a.collection, headers = _a.headers, id = _a.id, req = _a.req, resourceUrl = _a.resourceUrl;
var item = JSON.parse(req.text());
// tslint:disable-next-line:triple-equals
if (item.id == undefined) {
item.id = id || this.genId(collection);
}
// ignore the request id, if any. Alternatively,
// could reject request if id differs from item.id
id = item.id;
var existingIx = this.indexOf(collection, id);
var body = { data: this.clone(item) };
if (existingIx > -1) {
collection[existingIx] = item;
var res = this.config.post204 ?
{ headers: headers, status: STATUS.NO_CONTENT } :
{ headers: headers, body: body, status: STATUS.OK }; // successful; return entity
return new _angular_http.ResponseOptions(res);
}
else {
collection.push(item);
headers.set('Location', resourceUrl + '/' + id);
return new _angular_http.ResponseOptions({ headers: headers, body: body, status: STATUS.CREATED });
}
};
InMemoryBackendService.prototype.put = function (_a) {
var id = _a.id, collection = _a.collection, collectionName = _a.collectionName, headers = _a.headers, req = _a.req;
var item = JSON.parse(req.text());
// tslint:disable-next-line:triple-equals
if (item.id == undefined) {
return createErrorResponse(req, STATUS.NOT_FOUND, "Missing '" + collectionName + "' id");
}
if (id !== item.id) {
return createErrorResponse(req, STATUS.BAD_REQUEST, "\"" + collectionName + "\" id does not match item.id");
}
var existingIx = this.indexOf(collection, id);
var body = { data: this.clone(item) };
if (existingIx > -1) {
collection[existingIx] = item;
var res = this.config.put204 ?
{ headers: headers, status: STATUS.NO_CONTENT } :
{ headers: headers, body: body, status: STATUS.OK }; // successful; return entity
return new _angular_http.ResponseOptions(res);
}
else {
collection.push(item);
return new _angular_http.ResponseOptions({ headers: headers, body: body, status: STATUS.CREATED });
}
};
InMemoryBackendService.prototype.removeById = function (collection, id) {
var ix = this.indexOf(collection, id);
if (ix > -1) {
collection.splice(ix, 1);
return true;
}
return false;
};
/**
* Reset the "database" to its original state
*/
InMemoryBackendService.prototype.resetDb = function () {
this.db = this.inMemDbService.createDb();
};
InMemoryBackendService.prototype.setPassThruBackend = function () {
this.passThruBackend = undefined;
if (this.config.passThruUnknownUrl) {
try {
// copied from @angular/http/backends/xhr_backend
var browserXhr = this.injector.get(_angular_http.BrowserXhr);
var baseResponseOptions = this.injector.get(_angular_http.ResponseOptions);
var xsrfStrategy = this.injector.get(_angular_http.XSRFStrategy);
this.passThruBackend = new _angular_http.XHRBackend(browserXhr, baseResponseOptions, xsrfStrategy);
}
catch (ex) {
ex.message = 'Cannot create passThru404 backend; ' + (ex.message || '');
throw ex;
}
}
};
InMemoryBackendService.decorators = [
{ type: _angular_core.Injectable },
];
/** @nocollapse */
InMemoryBackendService.ctorParameters = function () { return [
{ type: _angular_core.Injector, },
{ type: InMemoryDbService, },
{ type: InMemoryBackendConfigArgs, decorators: [{ type: _angular_core.Inject, args: [InMemoryBackendConfig,] }, { type: _angular_core.Optional },] },
]; };
return InMemoryBackendService;
}());
// AoT requires factory to be exported
function inMemoryBackendServiceFactory(injector, dbService, options) {
var backend = new InMemoryBackendService(injector, dbService, options);
return backend;
}
var InMemoryWebApiModule = (function () {
function InMemoryWebApiModule() {
}
/**
* Prepare in-memory-web-api in the root/boot application module
* with class that implements InMemoryDbService and creates an in-memory database.
*
* @param {Type} dbCreator - Class that creates seed data for in-memory database. Must implement InMemoryDbService.
* @param {InMemoryBackendConfigArgs} [options]
*
* @example
* InMemoryWebApiModule.forRoot(dbCreator);
* InMemoryWebApiModule.forRoot(dbCreator, {useValue: {delay:600}});
*/
InMemoryWebApiModule.forRoot = function (dbCreator, options) {
return {
ngModule: InMemoryWebApiModule,
providers: [
{ provide: InMemoryDbService, useClass: dbCreator },
{ provide: InMemoryBackendConfig, useValue: options },
]
};
};
InMemoryWebApiModule.decorators = [
{ type: _angular_core.NgModule, args: [{
// Must useFactory for AoT
// https://github.com/angular/angular/issues/11178
providers: [{ provide: _angular_http.XHRBackend,
useFactory: inMemoryBackendServiceFactory,
deps: [_angular_core.Injector, InMemoryDbService, InMemoryBackendConfig] }]
},] },
];
/** @nocollapse */
InMemoryWebApiModule.ctorParameters = function () { return []; };
return InMemoryWebApiModule;
}());
exports.STATUS = STATUS;
exports.STATUS_CODE_INFO = STATUS_CODE_INFO;
exports.createErrorResponse = createErrorResponse;
exports.createObservableResponse = createObservableResponse;
exports.emitResponse = emitResponse;
exports.InMemoryDbService = InMemoryDbService;
exports.InMemoryBackendConfigArgs = InMemoryBackendConfigArgs;
exports.removeTrailingSlash = removeTrailingSlash;
exports.InMemoryBackendConfig = InMemoryBackendConfig;
exports.isSuccess = isSuccess;
exports.setStatusText = setStatusText;
exports.InMemoryBackendService = InMemoryBackendService;
exports.inMemoryBackendServiceFactory = inMemoryBackendServiceFactory;
exports.InMemoryWebApiModule = InMemoryWebApiModule;
Object.defineProperty(exports, '__esModule', { value: true });
})));
| {
"content_hash": "6564ac74b1595767ab0f5d5bbe009bde",
"timestamp": "",
"source": "github",
"line_count": 1099,
"max_line_length": 331,
"avg_line_length": 44.08644222020018,
"alnum_prop": 0.6046934015809787,
"repo_name": "tbone849/magic8",
"id": "7e54208be95e743bf7e1f7d6f5f843812fd24e79",
"size": "48451",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "dist/node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3570"
},
{
"name": "HTML",
"bytes": "957"
},
{
"name": "JavaScript",
"bytes": "15608"
},
{
"name": "TypeScript",
"bytes": "7934"
}
],
"symlink_target": ""
} |
.class public final Lcom/aps/ax;
.super Ljava/lang/Object;
# instance fields
.field a:Lcom/aps/ay;
.field b:Landroid/location/Location;
# direct methods
.method protected constructor <init>(Lcom/aps/aw;)V
.locals 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Lcom/aps/ay;
const/4 v1, 0x0
invoke-direct {v0, v1}, Lcom/aps/ay;-><init>(Landroid/telephony/CellLocation;)V
iput-object v0, p0, Lcom/aps/ax;->a:Lcom/aps/ay;
return-void
.end method
| {
"content_hash": "bc43a0292eb20f2c120231a053b058ad",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 83,
"avg_line_length": 19.346153846153847,
"alnum_prop": 0.679920477137177,
"repo_name": "vishnudevk/MiBandDecompiled",
"id": "768f0d712147b041299076cc42e35384d37529bc",
"size": "503",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Original Files/source/smali/com/aps/ax.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "109824"
},
{
"name": "Java",
"bytes": "8906016"
},
{
"name": "Lua",
"bytes": "134432"
}
],
"symlink_target": ""
} |
layout: sidebar-right
title: Chinese New Year of the Monkey for children in 2016
date: 2016-02-02 09:09:39+00:00
author: jo-dixon
category: childrens-ya-books
excerpt: Celebrate the Chinese New Year with our monkey-themed children's books.
breadcrumb: childrens-ya-books
---

## Board books about monkeys
### [<cite>Hug</cite> by Jez Alborough](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9124483?QRY=CTIBIB%3C%20IRN(697201)&QRYTEXT=Hug)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9124483?QRY=CTIBIB%3C%20IRN(697201)&QRYTEXT=Hug)
How can a book with just three words (“Bobo”, “mummy” and most frequently of all “Hug”) evoke such tenderness and pathos? Because Jez Alborough is a genius, that’s why.
### [<cite>How to feed your cheeky monkey</cite> by Jane Clarke and Georgie Birkett](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9125159?QRY=CTIBIB%3C%20IRN(50742120)&QRYTEXT=How%20to%20feed%20your%20cheeky%20monkey)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9125159?QRY=CTIBIB%3C%20IRN(50742120)&QRYTEXT=How%20to%20feed%20your%20cheeky%20monkey)
There’s a jauntiness to the rhyming text in this funny board book, which documents the daily routines of the average toddler.
### [<cite>This little monkey</cite> by Lucy Lyes](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9125823?QRY=CTIBIB%3C%20IRN(1102176)&QRYTEXT=This%20little%20monkey)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9125823?QRY=CTIBIB%3C%20IRN(1102176)&QRYTEXT=This%20little%20monkey)
A good sturdy touchy-feely board book from Ladybird. And it rhymes too.
## Picture books about monkeys
### [<cite>Monkey do!</cite> by Allan Ahlberg](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9127220?QRY=CTIBIB%3C%20IRN(685301)&QRYTEXT=Monkey%20do!)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9127220?QRY=CTIBIB%3C%20IRN(685301)&QRYTEXT=Monkey%20do!)
A delightfully entertaining story in rhyme about a little monkey who pockets the zookeeper’s key, escapes from the zoo and begins a night of escapades.
### [<cite>Monkey and the little one</cite> by Claire Alexander](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9129741?QRY=CTIBIB%3C%20IRN(48510659)&QRYTEXT=Monkey%20and%20the%20Little%20One)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9129741?QRY=CTIBIB%3C%20IRN(48510659)&QRYTEXT=Monkey%20and%20the%20Little%20One)
A very sweet book about friendship, this would also be an excellent choice to share with a child whose younger brother or sister just wants to be near them ALL the time.
### [<cite>Monkey puzzle</cite> by Julia Donaldson and Axel Scheffler](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9130771?QRY=CTIBIB%3C%20IRN(27639)&QRYTEXT=Monkey%20puzzle)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9130771?QRY=CTIBIB%3C%20IRN(27639)&QRYTEXT=Monkey%20puzzle)
Written and illustrated in quintessential Donaldson-Scheffler style, a butterfly helps a little monkey to search for his mummy.
### [<cite>Monkey and me</cite> by Emily Gravett](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9132246?QRY=CTIBIB%3C%20IRN(511863)&QRYTEXT=Monkey%20and%20me)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9132246?QRY=CTIBIB%3C%20IRN(511863)&QRYTEXT=Monkey%20and%20me)
A little girl and her monkey toy swing through this book visiting and copying the animals they meet in Emily Gravett’s first book. It won her a New Illustrator award and feels as fresh today as it did back in 2007. It’s a delight from the off.
## Beginner reads about monkeys
### [<cite>The hungry little monkey</cite> by Andy Blackford](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9133481?QRY=CTIBIB%3C%20IRN(305096)&QRYTEXT=The%20hungry%20little%20monkey)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9133481?QRY=CTIBIB%3C%20IRN(305096)&QRYTEXT=The%20hungry%20little%20monkey)
Now remind me, how do you open a banana?
### [<cite>Cheeky Monkey’s big race</cite> by Ann Cassidy](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9134862?QRY=CTIBIB%3C%20IRN(17404842)&QRYTEXT=Cheeky%20Monkey%27s%20big%20race)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9134862?QRY=CTIBIB%3C%20IRN(17404842)&QRYTEXT=Cheeky%20Monkey%27s%20big%20race)
A colourful story with lovely bright illustrations, perfect for children who have just started to read alone. This cheeky monkey is on a bicycle, by the way and he races against a girl driving a car.
### [<cite>Clever little monkey</cite> by Penny Dolan](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9145222?QRY=CTIBIB%3C%20IRN(45622293)&QRYTEXT=Clever%20Little%20Monkey)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9145222?QRY=CTIBIB%3C%20IRN(45622293)&QRYTEXT=Clever%20Little%20Monkey)
This river bank = clever little monkey; far river bank = bananas; in the river = crocodiles...
### [<cite>Mr Monkey and the magic tricks</cite> by Linda Chapman](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9147547?QRY=CTIBIB%3C%20IRN(38359469)&QRYTEXT=Mr%20Monkey%20and%20the%20magic%20tricks)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9147547?QRY=CTIBIB%3C%20IRN(38359469)&QRYTEXT=Mr%20Monkey%20and%20the%20magic%20tricks)
About a magic toy monkey who comes to life in a classroom in time to deal with the school bullies
## Junior novels about monkeys
### [<cite>The Twits</cite> by Roald Dahl](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9150254?QRY=CTIBIB%3C%20IRN(35721)&QRYTEXT=The%20Twits)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9150254?QRY=CTIBIB%3C%20IRN(35721)&QRYTEXT=The%20Twits)
Have you met the Muggle Wump monkeys? Together with the Roly Poly bird they hatch a plan to teach the truly dreadful Mr and Mrs Twit a lesson. This is a beautiful picture book edition of Dahl’s classic story, perfect for showing off Quentin Blake’s iconic illustrations. We’ve got smaller editions too of course.
### [<cite>Pippi Longstocking</cite> by Astrid Lindgren](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9151338?QRY=CTIBIB%3C%20IRN(50629)&QRYTEXT=Pippi%20Longstocking)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9151338?QRY=CTIBIB%3C%20IRN(50629)&QRYTEXT=Pippi%20Longstocking)
We have several titles about Pippi Longstocking and her monkey. She is “the only girl in the world who can do exactly what she likes,” and though only nine years old she “lives in a cottage with a horse and a monkey.”
### [<cite>Chuckle Bob’s great escape</cite> by Jeremy Strong](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9152408?QRY=CTIBIB%3C%20IRN(19967086)&QRYTEXT=Chuckle%20Bob%27s%20great%20escape)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9152408?QRY=CTIBIB%3C%20IRN(19967086)&QRYTEXT=Chuckle%20Bob%27s%20great%20escape)
Published by Barrington Stoke, this story of a naughty monkey, adopted by a family after he escapes from the zoo, has a “dyslexia friendly” sticker on it, so it would be great for struggling readers.
### [<cite>Monkey business</cite> by Anna Wilson](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9154015?QRY=CTIBIB%3C%20IRN(510907)&QRYTEXT=Monkey%20business)
[](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ/9152408?QRY=CTIBIB%3C%20IRN(19967086)&QRYTEXT=Chuckle%20Bob%27s%20great%20escape)
Felix Horatio Stowe has several normal pets, but feeling his life is dull without something more exotic, he determines to adopt a monkey via the internet.
| {
"content_hash": "6ec9d333c9ef62c1d7e5e2496f51bd5b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 312,
"avg_line_length": 85.02803738317758,
"alnum_prop": 0.7781930094526269,
"repo_name": "suffolklibraries/sljekyll",
"id": "8385c1a35c8506df9dc5125dfb9eafc3123c6827",
"size": "9146",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "parents-carers-and-children/childrens-ya-books/_posts/2016-02-02-chinese-new-year-of-the-monkey-for-children-in-2016.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "157758"
},
{
"name": "HTML",
"bytes": "27181305"
},
{
"name": "JavaScript",
"bytes": "247140"
},
{
"name": "Rich Text Format",
"bytes": "265002"
},
{
"name": "Ruby",
"bytes": "1015"
}
],
"symlink_target": ""
} |
#ifndef __MSTK_CONFIG_HPP__
#define __MSTK_CONFIG_HPP__
#ifdef _MSC_VER
#include "winsock2.h"
#include "vigra/windows.h"
#endif
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#cmakedefine HAVE_UNIX_ISNAN
#cmakedefine HAVE_UNIX_ISINF
#cmakedefine ENABLE_TESTING
#ifdef _WIN32
#define MSTK_EXPORT __declspec( dllexport )
/* Disable a template related MSVC warning.
See: http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html */
#pragma warning( disable: 4251 )
#else
#define MSTK_EXPORT
#endif
/* Use this to avoid unsued variable warnings */
#define MSTK_UNUSED(x) (void)x;
/* Direcory with all the data */
#define MSTK_DATA_DIR "@DATA_INSTALL_DIR@"
// version info
namespace mstk {
extern const char MSTK_VERSION[];
} // namespace mstk
#endif
| {
"content_hash": "d94a33745a4c22759850256fcd0aceb3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 17.444444444444443,
"alnum_prop": 0.7197452229299363,
"repo_name": "kirchnerlab/MSTK",
"id": "6934a4b0f07c088801096054a18430fa47b8a6b6",
"size": "871",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/MSTK/config.hpp.cmake",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3141"
},
{
"name": "C++",
"bytes": "87281"
},
{
"name": "Python",
"bytes": "11126"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<Form xmlns="http://v8.1c.ru/8.3/xcf/logform" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core" xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<WindowOpeningMode>LockOwnerWindow</WindowOpeningMode>
<VerticalScroll>useIfNecessary</VerticalScroll>
<CommandSet>
<ExcludedCommand>Copy</ExcludedCommand>
<ExcludedCommand>Create</ExcludedCommand>
</CommandSet>
<AutoCommandBar name="ФормаКоманднаяПанель" id="-1"/>
<Events>
<Event name="NotificationProcessing">ОбработкаОповещения</Event>
<Event name="OnOpen">ПриОткрытии</Event>
<Event name="OnCreateAtServer">ПриСозданииНаСервере</Event>
<Event name="OnClose">ПриЗакрытии</Event>
</Events>
<ChildItems>
<Table name="Список" id="1">
<Representation>List</Representation>
<CommandBarLocation>None</CommandBarLocation>
<SkipOnInput>false</SkipOnInput>
<DefaultItem>true</DefaultItem>
<ChoiceMode>true</ChoiceMode>
<UseAlternationRowColor>true</UseAlternationRowColor>
<DataPath>Список</DataPath>
<RowPictureDataPath>Список.DefaultPicture</RowPictureDataPath>
<SearchStringLocation>None</SearchStringLocation>
<ViewStatusLocation>None</ViewStatusLocation>
<SearchControlLocation>None</SearchControlLocation>
<AutoRefresh>false</AutoRefresh>
<AutoRefreshPeriod>60</AutoRefreshPeriod>
<Period xsi:type="v8:StandardPeriod">
<v8:variant xsi:type="v8:StandardPeriodVariant">Custom</v8:variant>
<v8:startDate>0001-01-01T00:00:00</v8:startDate>
<v8:endDate>0001-01-01T00:00:00</v8:endDate>
</Period>
<ChoiceFoldersAndItems>Items</ChoiceFoldersAndItems>
<RestoreCurrentRow>false</RestoreCurrentRow>
<TopLevelParent xsi:nil="true"/>
<ShowRoot>false</ShowRoot>
<AllowRootChoice>false</AllowRootChoice>
<UpdateOnDataChange>Auto</UpdateOnDataChange>
<ContextMenu name="СписокКонтекстноеМеню" id="2"/>
<AutoCommandBar name="СписокКоманднаяПанель" id="3"/>
<ExtendedTooltip name="СписокExtendedTooltip" id="22"/>
<SearchStringAddition name="СписокSearchString" id="23">
<Source>
<lf:elementId>1</lf:elementId>
<lf:additionId>0</lf:additionId>
</Source>
<ContextMenu name="СписокSearchStringContextMenu" id="24"/>
<ExtendedTooltip name="СписокSearchStringExtendedTooltip" id="25"/>
</SearchStringAddition>
<ViewStatusAddition name="СписокViewStatus" id="26">
<Source>
<lf:elementId>1</lf:elementId>
<lf:additionId>1</lf:additionId>
</Source>
<ContextMenu name="СписокViewStatusContextMenu" id="27"/>
<ExtendedTooltip name="СписокViewStatusExtendedTooltip" id="28"/>
</ViewStatusAddition>
<SearchControlAddition name="СписокSearchControl" id="29">
<Source>
<lf:elementId>1</lf:elementId>
<lf:additionId>2</lf:additionId>
</Source>
<ContextMenu name="СписокSearchControlContextMenu" id="30"/>
<ExtendedTooltip name="СписокSearchControlExtendedTooltip" id="31"/>
</SearchControlAddition>
<ChildItems>
<InputField name="СписокНомер" id="6">
<DataPath>Список.Number</DataPath>
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Номер</v8:content>
</v8:item>
</Title>
<Width>10</Width>
<HorizontalStretch>false</HorizontalStretch>
<Wrap>false</Wrap>
<ContextMenu name="СписокНомерКонтекстноеМеню" id="7"/>
<ExtendedTooltip name="СписокНомерExtendedTooltip" id="32"/>
</InputField>
<InputField name="СписокДата" id="4">
<DataPath>Список.Date</DataPath>
<DefaultItem>true</DefaultItem>
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Дата</v8:content>
</v8:item>
</Title>
<Width>14</Width>
<HorizontalStretch>false</HorizontalStretch>
<Wrap>false</Wrap>
<ContextMenu name="СписокДатаКонтекстноеМеню" id="5"/>
<ExtendedTooltip name="СписокДатаExtendedTooltip" id="33"/>
</InputField>
<InputField name="СписокСуммаДокумента" id="10">
<DataPath>Список.СуммаДокумента</DataPath>
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Сумма</v8:content>
</v8:item>
</Title>
<Width>9</Width>
<Wrap>false</Wrap>
<ContextMenu name="СписокСуммаДокументаКонтекстноеМеню" id="11"/>
<ExtendedTooltip name="СписокСуммаДокументаExtendedTooltip" id="34"/>
</InputField>
<InputField name="СписокВалюта" id="12">
<DataPath>Список.Валюта</DataPath>
<Width>6</Width>
<HorizontalStretch>false</HorizontalStretch>
<Wrap>false</Wrap>
<ContextMenu name="СписокВалютаКонтекстноеМеню" id="13"/>
<ExtendedTooltip name="СписокВалютаExtendedTooltip" id="35"/>
</InputField>
<InputField name="СписокПартнер" id="14">
<DataPath>Список.ДокументОснование.Партнер</DataPath>
<Width>16</Width>
<Wrap>false</Wrap>
<ContextMenu name="СписокПартнерКонтекстноеМеню" id="15"/>
<ExtendedTooltip name="СписокПартнерExtendedTooltip" id="36"/>
</InputField>
<InputField name="СписокДокументОснование" id="20">
<DataPath>Список.ДокументОснование</DataPath>
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Основание</v8:content>
</v8:item>
</Title>
<Width>16</Width>
<Wrap>false</Wrap>
<ContextMenu name="СписокДокументОснованиеКонтекстноеМеню" id="21"/>
<ExtendedTooltip name="СписокДокументОснованиеExtendedTooltip" id="37"/>
</InputField>
<InputField name="СписокКонтрагент" id="16">
<DataPath>Список.ДокументОснование.Контрагент</DataPath>
<Width>16</Width>
<Wrap>false</Wrap>
<ContextMenu name="СписокКонтрагентКонтекстноеМеню" id="17"/>
<ExtendedTooltip name="СписокКонтрагентExtendedTooltip" id="38"/>
</InputField>
<InputField name="СписокОрганизация" id="18">
<DataPath>Список.Организация</DataPath>
<Width>16</Width>
<Wrap>false</Wrap>
<ContextMenu name="СписокОрганизацияКонтекстноеМеню" id="19"/>
<ExtendedTooltip name="СписокОрганизацияExtendedTooltip" id="39"/>
</InputField>
</ChildItems>
</Table>
</ChildItems>
<Attributes>
<Attribute name="Список" id="1">
<Type>
<v8:Type>cfg:DynamicList</v8:Type>
</Type>
<MainAttribute>true</MainAttribute>
<Settings xsi:type="DynamicList">
<ManualQuery>false</ManualQuery>
<DynamicDataRead>true</DynamicDataRead>
<MainTable>Document.СчетНаОплатуКлиенту</MainTable>
<ListSettings>
<dcsset:filter>
<dcsset:item xsi:type="dcsset:FilterItemComparison">
<dcsset:left xsi:type="dcscor:Field">Аннулирован</dcsset:left>
<dcsset:comparisonType>Equal</dcsset:comparisonType>
<dcsset:right xsi:type="xs:boolean">false</dcsset:right>
</dcsset:item>
<dcsset:viewMode>Normal</dcsset:viewMode>
<dcsset:userSettingID>dfcece9d-5077-440b-b6b3-45a5cb4538eb</dcsset:userSettingID>
</dcsset:filter>
<dcsset:order>
<dcsset:viewMode>Normal</dcsset:viewMode>
<dcsset:userSettingID>88619765-ccb3-46c6-ac52-38e9c992ebd4</dcsset:userSettingID>
</dcsset:order>
<dcsset:conditionalAppearance>
<dcsset:viewMode>Normal</dcsset:viewMode>
<dcsset:userSettingID>b75fecce-942b-4aed-abc9-e6a02e460fb3</dcsset:userSettingID>
</dcsset:conditionalAppearance>
</ListSettings>
</Settings>
</Attribute>
<Attribute name="ИспользоватьПодключаемоеОборудование" id="2">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Использовать подключаемое оборудование</v8:content>
</v8:item>
</Title>
<Type>
<v8:Type>xs:boolean</v8:Type>
</Type>
</Attribute>
<Attribute name="ПоддерживаемыеТипыПодключаемогоОбрудования" id="3">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Поддерживаемые типы подключаемого обрудования</v8:content>
</v8:item>
</Title>
<Type>
<v8:Type>xs:string</v8:Type>
<v8:StringQualifiers>
<v8:Length>0</v8:Length>
<v8:AllowedLength>Variable</v8:AllowedLength>
</v8:StringQualifiers>
</Type>
</Attribute>
</Attributes>
<CommandInterface>
<CommandBar>
<Item>
<Command>Document.ОперацияПоПлатежнойКарте.StandardCommand.CreateBasedOn</Command>
<Type>Auto</Type>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>Document.ПриходныйКассовыйОрдер.StandardCommand.CreateBasedOn</Command>
<Type>Auto</Type>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>Document.ПоступлениеБезналичныхДенежныхСредств.StandardCommand.CreateBasedOn</Command>
<Type>Auto</Type>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>0:5d374fc1-aabc-4cdf-bc71-b07f286affab</Command>
<Type>Auto</Type>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>DataProcessor.ПечатьСчетовНаОплату.Command.ПечатьСчетНаОплату</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.Печать</CommandGroup>
<Index>2</Index>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>CommonCommand.ДополнительныеОтчетыИОбработкиПечатныеФормы</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.Печать</CommandGroup>
<Index>3</Index>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>0:ac55ae63-a355-4272-92ab-0b0cb220c601</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.Печать</CommandGroup>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>0:d24fde8e-9dfd-4e3b-9295-af501f65d731</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.Печать</CommandGroup>
<Index>1</Index>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>DataProcessor.ЭлектронныеДокументы.Command.СформироватьПодписатьОтправитьЭД</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.ЭД</CommandGroup>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>DataProcessor.ЭлектронныеДокументы.Command.ПереотправитьЭД</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.ЭД</CommandGroup>
<Index>2</Index>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>DataProcessor.ЭлектронныеДокументы.Command.СформироватьЭД</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.ЭД</CommandGroup>
<Index>3</Index>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
<Item>
<Command>DataProcessor.ЭлектронныеДокументы.Command.ОткрытьАктуальныйЭД</Command>
<Type>Auto</Type>
<CommandGroup>CommandGroup.ЭД</CommandGroup>
<Index>4</Index>
<DefaultVisible>false</DefaultVisible>
<Visible>
<xr:Common>false</xr:Common>
</Visible>
</Item>
</CommandBar>
</CommandInterface>
</Form> | {
"content_hash": "154302d51245b22a47053eb4ac61e055",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 836,
"avg_line_length": 36.71296296296296,
"alnum_prop": 0.6932324506094998,
"repo_name": "stop-time/pm_ut11",
"id": "87380526ec48980eb7ae34f277de2025d751bcbd",
"size": "13302",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Document/СчетНаОплатуКлиенту/Form/ФормаВыбора/Form.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "8991065"
}
],
"symlink_target": ""
} |
using EasyLOB.Persistence;
using EasyLOB.Security;
namespace Chinook.Persistence
{
public class ChinookUnitOfWorkEF : UnitOfWorkEF, IChinookUnitOfWork
{
#region Methods
public ChinookUnitOfWorkEF(IAuthenticationManager authenticationManager)
: base(new ChinookDbContext(), authenticationManager)
{
//Domain = "Chinook"; // ???
//ChinookDbContext context = (ChinookDbContext)base.context;
}
public override IGenericRepository<TEntity> GetRepository<TEntity>()
{
if (!Repositories.Keys.Contains(typeof(TEntity)))
{
var repository = new ChinookGenericRepositoryEF<TEntity>(this);
Repositories.Add(typeof(TEntity), repository);
}
return Repositories[typeof(TEntity)] as IGenericRepository<TEntity>;
}
#endregion Methods
}
}
| {
"content_hash": "bcfb91153c2669f6ea3e406552104571",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 80,
"avg_line_length": 30,
"alnum_prop": 0.6052083333333333,
"repo_name": "EasyLOB/EasyLOB-Chinook-2",
"id": "887f81c6fb7e85281eaa8f9545b5b3b1bfb2f722",
"size": "962",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Chinook.PersistenceEntityFramework/UnitOfWork/ChinookUnitOfWorkEF.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "220"
},
{
"name": "Batchfile",
"bytes": "400"
},
{
"name": "C#",
"bytes": "1101121"
},
{
"name": "CSS",
"bytes": "83743"
},
{
"name": "HTML",
"bytes": "736297"
},
{
"name": "JavaScript",
"bytes": "2303199"
},
{
"name": "Less",
"bytes": "21304676"
},
{
"name": "TSQL",
"bytes": "9029"
}
],
"symlink_target": ""
} |
package gov.nasa.jpf.jdart.objects;
import gov.nasa.jpf.vm.ClassInfo;
import gov.nasa.jpf.vm.ElementInfo;
import gov.nasa.jpf.vm.Heap;
/**
* Allows to handle arrays of reference types symbolically.
*
*
*/
class ReferenceArrayHandler implements SymbolicObjectHandler {
/*
* (non-Javadoc)
* @see gov.nasa.jpf.jdart.objects.SymbolicObjectHandler#initialize(gov.nasa.jpf.vm.ClassInfo)
*/
@Override
public boolean initialize(ClassInfo ci) {
return ci.isReferenceArray();
}
/*
* (non-Javadoc)
* @see gov.nasa.jpf.jdart.objects.SymbolicObjectHandler#annotateObject(gov.nasa.jpf.vm.ElementInfo, java.lang.String, gov.nasa.jpf.jdart.objects.SymbolicObjectsContext)
*/
@Override
public void annotateObject(ElementInfo ei, String name,
SymbolicObjectsContext ctx) {
int size = ei.arrayLength();
Heap heap = ctx.getHeap();
for(int i = 0; i < size; i++) {
int elemRef = ei.getReferenceElement(i);
ElementInfo elem = heap.get(elemRef);
if(elem != null) {
ctx.processElement(ei, i, name + "[" + i + "]", false);
}
}
}
}
| {
"content_hash": "e4c34bea2e43aedd770cd45b9bce8854",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 171,
"avg_line_length": 25.906976744186046,
"alnum_prop": 0.6723518850987432,
"repo_name": "psycopaths/jdart",
"id": "d65a92d231e7a9b290a8a6657c29690ed10cfce5",
"size": "1931",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/gov/nasa/jpf/jdart/objects/ReferenceArrayHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "3295"
},
{
"name": "HTML",
"bytes": "2258"
},
{
"name": "Java",
"bytes": "642137"
},
{
"name": "Shell",
"bytes": "4611"
},
{
"name": "Smalltalk",
"bytes": "579"
}
],
"symlink_target": ""
} |
#ifndef __FM_FILESYSTEM_H__
#define __FM_FILESYSTEM_H__
#include <stdexcept>
#include <string>
#include "absolute_path.h"
namespace fm {
namespace fs {
extern int find_fm_dir(const ::fs::Absolute_path& path, int limit,
::fs::Absolute_path& result);
/* returns a converted path for the specified path which the system internally
uses. Throws std::invalid_argument if the specified path isn't
a descendant of fm filesystem. */
extern std::string get_fm_path(const ::fs::Absolute_path& fm_dirpath,
const ::fs::Absolute_path& path) throw(std::invalid_argument);
/* convert fm_path to an absolute path based on the specified fm directory. */
extern ::fs::Absolute_path convert_fm_path(
const ::fs::Absolute_path& fm_dirpath, const std::string& fm_path)
throw(std::invalid_argument);
class Filesystem {
public:
Filesystem(const ::fs::Absolute_path& fm_dir)
: fm_dir(fm_dir) {
}
bool is_descendant(const ::fs::Absolute_path& path) const;
/* Returns the path relative to the parent directory of the .fm
directory. Throws an exception if the specified path is not under
the parent directory of the .fm directory.
The argument path should be specified by an absolute path. */
std::string get_fm_path(const ::fs::Absolute_path& path)
throw(std::invalid_argument) {
return fs::get_fm_path(fm_dir, path);
}
::fs::Absolute_path convert_fm_path(const std::string& fm_path)
throw(std::invalid_argument) {
return fs::convert_fm_path(fm_dir, fm_path);
}
std::string get_dbfilepath() const;
private:
::fs::Absolute_path fm_dir;
};
} // fs
} // fm
#endif // __FM_FILESYSTEM_H__
| {
"content_hash": "9ce480b071588b70e9fa600237e2fb77",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 29.30909090909091,
"alnum_prop": 0.706575682382134,
"repo_name": "sugawaray/filemanager",
"id": "ffce92742f06d1dfafcf1f1a59f2fd23739e9553",
"size": "1612",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fm_filesystem.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "307932"
},
{
"name": "Makefile",
"bytes": "6062"
},
{
"name": "Shell",
"bytes": "16552"
}
],
"symlink_target": ""
} |
package com.weibo.sdk.android.org.json;
/**
* The XMLTokener extends the JSONTokener to provide additional methods
* for the parsing of XML texts.
* @author JSON.org
* @version 2008-09-18
*/
public class XMLTokener extends JSONTokener {
/** The table of entity values. It initially contains Character values for
* amp, apos, gt, lt, quot.
*/
public static final java.util.HashMap entity;
static {
entity = new java.util.HashMap(8);
entity.put("amp", XML.AMP);
entity.put("apos", XML.APOS);
entity.put("gt", XML.GT);
entity.put("lt", XML.LT);
entity.put("quot", XML.QUOT);
}
/**
* Construct an XMLTokener from a string.
* @param s A source string.
*/
public XMLTokener(String s) {
super(s);
}
/**
* Get the text in the CDATA block.
* @return The string up to the <code>]]></code>.
* @throws JSONException If the <code>]]></code> is not found.
*/
public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (c == 0) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = sb.length() - 3;
if (i >= 0 && sb.charAt(i) == ']' &&
sb.charAt(i + 1) == ']' && sb.charAt(i + 2) == '>') {
sb.setLength(i);
return sb.toString();
}
}
}
/**
* Get the next XML outer token, trimming whitespace. There are two kinds
* of tokens: the '<' character which begins a markup tag, and the content
* text between markup tags.
*
* @return A string, or a '<' Character, or null if there is no more
* source text.
* @throws JSONException
*/
public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new StringBuffer();
for (;;) {
if (c == '<' || c == 0) {
back();
return sb.toString().trim();
}
if (c == '&') {
sb.append(nextEntity(c));
} else {
sb.append(c);
}
c = next();
}
}
/**
* Return the next entity. These entities are translated to Characters:
* <code>& ' > < "</code>.
* @param a An ampersand character.
* @return A Character or an entity String if the entity is not recognized.
* @throws JSONException If missing ';' in XML entity.
*/
public Object nextEntity(char a) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
break;
} else {
throw syntaxError("Missing ';' in XML entity: &" + sb);
}
}
String s = sb.toString();
Object e = entity.get(s);
return e != null ? e : a + s + ";";
}
/**
* Returns the next XML meta token. This is used for skipping over <!...>
* and <?...?> structures.
* @return Syntax characters (<code>< > / = ! ?</code>) are returned as
* Character, and strings and names are returned as Boolean. We don't care
* what the values actually are.
* @throws JSONException If a string is not properly closed or if the XML
* is badly structured.
*/
public Object nextMeta() throws JSONException {
char c;
char q;
do {
c = next();
} while (Character.isWhitespace(c));
switch (c) {
case 0:
throw syntaxError("Misshaped meta tag");
case '<':
return XML.LT;
case '>':
return XML.GT;
case '/':
return XML.SLASH;
case '=':
return XML.EQ;
case '!':
return XML.BANG;
case '?':
return XML.QUEST;
case '"':
case '\'':
q = c;
for (;;) {
c = next();
if (c == 0) {
throw syntaxError("Unterminated string");
}
if (c == q) {
return Boolean.TRUE;
}
}
default:
for (;;) {
c = next();
if (Character.isWhitespace(c)) {
return Boolean.TRUE;
}
switch (c) {
case 0:
case '<':
case '>':
case '/':
case '=':
case '!':
case '?':
case '"':
case '\'':
back();
return Boolean.TRUE;
}
}
}
}
/**
* Get the next XML Token. These tokens are found inside of angle
* brackets. It may be one of these characters: <code>/ > = ! ?</code> or it
* may be a string wrapped in single quotes or double quotes, or it may be a
* name.
* @return a String or a Character.
* @throws JSONException If the XML is not well formed.
*/
public Object nextToken() throws JSONException {
char c;
char q;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
switch (c) {
case 0:
throw syntaxError("Misshaped element");
case '<':
throw syntaxError("Misplaced '<'");
case '>':
return XML.GT;
case '/':
return XML.SLASH;
case '=':
return XML.EQ;
case '!':
return XML.BANG;
case '?':
return XML.QUEST;
// Quoted string
case '"':
case '\'':
q = c;
sb = new StringBuffer();
for (;;) {
c = next();
if (c == 0) {
throw syntaxError("Unterminated string");
}
if (c == q) {
return sb.toString();
}
if (c == '&') {
sb.append(nextEntity(c));
} else {
sb.append(c);
}
}
default:
// Name
sb = new StringBuffer();
for (;;) {
sb.append(c);
c = next();
if (Character.isWhitespace(c)) {
return sb.toString();
}
switch (c) {
case 0:
return sb.toString();
case '>':
case '/':
case '=':
case '!':
case '?':
case '[':
case ']':
back();
return sb.toString();
case '<':
case '"':
case '\'':
throw syntaxError("Bad character in a name");
}
}
}
}
/**
* Skip characters until past the requested string.
* If it is not found, we are left at the end of the source with a result of false.
* @param to A string to skip past.
* @throws JSONException
*/
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int n = to.length();
char[] circle = new char[n];
/*
* First fill the circle buffer with as many characters as are in the
* to string. If we reach an early end, bail.
*/
for (i = 0; i < n; i += 1) {
c = next();
if (c == 0) {
return false;
}
circle[i] = c;
}
/*
* We will loop, possibly for all of the remaining characters.
*/
for (;;) {
j = offset;
b = true;
/*
* Compare the circle buffer with the to string.
*/
for (i = 0; i < n; i += 1) {
if (circle[j] != to.charAt(i)) {
b = false;
break;
}
j += 1;
if (j >= n) {
j -= n;
}
}
/*
* If we exit the loop with b intact, then victory is ours.
*/
if (b) {
return true;
}
/*
* Get the next character. If there isn't one, then defeat is ours.
*/
c = next();
if (c == 0) {
return false;
}
/*
* Shove the character in the circle buffer and advance the
* circle offset. The offset is mod n.
*/
circle[offset] = c;
offset += 1;
if (offset >= n) {
offset -= n;
}
}
}
}
| {
"content_hash": "60093a68061444e8f2717a38ad55e141",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 87,
"avg_line_length": 26.871720116618075,
"alnum_prop": 0.4262775306498861,
"repo_name": "alexcaisenchuan/FunWeibo",
"id": "c50ce14951b6aea2d45647e6f92422a8fc207647",
"size": "10322",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/com/weibo/sdk/android/org/json/XMLTokener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1010255"
}
],
"symlink_target": ""
} |
using System;
namespace Newtonsoft.Json.Tests.TestObjects
{
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
public class ConvertableIntTestClass
{
public ConvertibleInt Integer { get; set; }
public ConvertibleInt? NullableInteger1 { get; set; }
public ConvertibleInt? NullableInteger2 { get; set; }
}
#endif
} | {
"content_hash": "0e5f056dfbda0eb09539abf3c86cd543",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 26.923076923076923,
"alnum_prop": 0.6914285714285714,
"repo_name": "ValtoLibraries/Newtonsoft.Json",
"id": "9bc040c3b26c8e96c531449c9007eee539d04816",
"size": "1502",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "Src/Newtonsoft.Json.Tests/TestObjects/ConvertableIntTestClass.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "313"
},
{
"name": "C#",
"bytes": "6123896"
},
{
"name": "PowerShell",
"bytes": "62542"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>bdds: 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.11.2 / bdds - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
bdds
<small>
8.6.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-17 22:59:49 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-17 22:59:49 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-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.11.2 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/bdds"
license: "LGPL 2.1"
build: [make]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/BDDs"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
"coq-int-map" {>= "8.6" & < "8.7~"}
]
tags: [
"keyword: BDD"
"keyword: binary decision diagrams"
"keyword: classical logic"
"keyword: propositional logic"
"keyword: validity"
"keyword: satisfiability"
"keyword: model checking"
"keyword: reflection"
"category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures"
"category: Miscellaneous/Extracted Programs/Decision procedures"
"date: May-July 1999"
]
authors: [ "Kumar Neeraj Verma" ]
bug-reports: "https://github.com/coq-contribs/bdds/issues"
dev-repo: "git+https://github.com/coq-contribs/bdds.git"
synopsis: "BDD algorithms and proofs in Coq, by reflection"
description: """
Provides BDD algorithms running under Coq.
(BDD are Binary Decision Diagrams.)
Allows one to do classical validity checking by
reflection in Coq using BDDs, can also be used
to get certified BDD algorithms by extraction.
First step towards actual symbolic model-checkers
in Coq. See file README for operation."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/bdds/archive/v8.6.0.tar.gz"
checksum: "md5=5898deec32af2511ff72be14e4cbff91"
}
</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-bdds.8.6.0 coq.8.11.2</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.11.2).
The following dependencies couldn't be met:
- coq-bdds -> coq < 8.7~ -> ocaml < 4.03.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-bdds.8.6.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": "78f2dc695c7f8e51aa615907e7031e44",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 159,
"avg_line_length": 40.759562841530055,
"alnum_prop": 0.5581177101488135,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "f2572439649feb87157c2e1909e84e43e41188dd",
"size": "7484",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.11.2/bdds/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
/**
* @file
* Contains \Drupal\system\Plugin\ImageToolkit\Operation\gd\CreateNew.
*/
namespace Drupal\system\Plugin\ImageToolkit\Operation\gd;
use Drupal\Component\Utility\Color;
/**
* Defines GD2 create_new image operation.
*
* @ImageToolkitOperation(
* id = "gd_create_new",
* toolkit = "gd",
* operation = "create_new",
* label = @Translation("Set a new image"),
* description = @Translation("Creates a new transparent resource and sets it for the image.")
* )
*/
class CreateNew extends GDImageToolkitOperationBase {
/**
* {@inheritdoc}
*/
protected function arguments() {
return array(
'width' => array(
'description' => 'The width of the image, in pixels',
),
'height' => array(
'description' => 'The height of the image, in pixels',
),
'extension' => array(
'description' => 'The extension of the image file (e.g. png, gif, etc.)',
'required' => FALSE,
'default' => 'png',
),
'transparent_color' => array(
'description' => 'The RGB hex color for GIF transparency',
'required' => FALSE,
'default' => '#ffffff',
),
'is_temp' => array(
'description' => 'If TRUE, this operation is being used to create a temporary image by another GD operation. After performing its function, the caller is responsible for destroying the original GD resource.',
'required' => FALSE,
'default' => FALSE,
),
);
}
/**
* {@inheritdoc}
*/
protected function validateArguments(array $arguments) {
// Assure extension is supported.
if (!in_array($arguments['extension'], $this->getToolkit()->getSupportedExtensions())) {
throw new \InvalidArgumentException("Invalid extension ('{$arguments['extension']}') specified for the image 'convert' operation");
}
// Assure integers for width and height.
$arguments['width'] = (int) round($arguments['width']);
$arguments['height'] = (int) round($arguments['height']);
// Fail when width or height are 0 or negative.
if ($arguments['width'] <= 0) {
throw new \InvalidArgumentException("Invalid width ('{$arguments['width']}') specified for the image 'create_new' operation");
}
if ($arguments['height'] <= 0) {
throw new \InvalidArgumentException("Invalid height ({$arguments['height']}) specified for the image 'create_new' operation");
}
// Assure transparent color is a valid hex string.
if ($arguments['transparent_color'] && !Color::validateHex($arguments['transparent_color'])) {
throw new \InvalidArgumentException("Invalid transparent color ({$arguments['transparent_color']}) specified for the image 'create_new' operation");
}
return $arguments;
}
/**
* {@inheritdoc}
*/
protected function execute(array $arguments) {
// Get the image type.
$type = $this->getToolkit()->extensionToImageType($arguments['extension']);
// Store the original GD resource.
$original_res = $this->getToolkit()->getResource();
// Create the resource.
if (!$res = imagecreatetruecolor($arguments['width'], $arguments['height'])) {
return FALSE;
}
// Fill the resource with transparency as possible.
switch ($type) {
case IMAGETYPE_PNG:
imagealphablending($res, FALSE);
$transparency = imagecolorallocatealpha($res, 0, 0, 0, 127);
imagefill($res, 0, 0, $transparency);
imagealphablending($res, TRUE);
imagesavealpha($res, TRUE);
break;
case IMAGETYPE_GIF:
if (empty($arguments['transparent_color'])) {
// No transparency color specified, fill white transparent.
$fill_color = imagecolorallocatealpha($res, 255, 255, 255, 127);
}
else {
$fill_rgb = Color::hexToRgb($arguments['transparent_color']);
$fill_color = imagecolorallocatealpha($res, $fill_rgb['red'], $fill_rgb['green'], $fill_rgb['blue'], 127);
imagecolortransparent($res, $fill_color);
}
imagefill($res, 0, 0, $fill_color);
break;
case IMAGETYPE_JPEG:
imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255));
break;
}
// Update the toolkit properties.
$this->getToolkit()->setType($type);
$this->getToolkit()->setResource($res);
// Destroy the original resource if it is not needed by other operations.
if (!$arguments['is_temp'] && is_resource($original_res)) {
imagedestroy($original_res);
}
return TRUE;
}
}
| {
"content_hash": "ad79efa5afce637823115c45b08331f7",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 216,
"avg_line_length": 32.884892086330936,
"alnum_prop": 0.621308247648217,
"repo_name": "Suite5/feelmybook",
"id": "d582c680ce2a96ac8673dc07ef3a7115817f06ed",
"size": "4571",
"binary": false,
"copies": "98",
"ref": "refs/heads/master",
"path": "code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateNew.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "97277"
},
{
"name": "C++",
"bytes": "50616"
},
{
"name": "CSS",
"bytes": "424653"
},
{
"name": "HTML",
"bytes": "770008"
},
{
"name": "JavaScript",
"bytes": "4000190"
},
{
"name": "PHP",
"bytes": "29444092"
},
{
"name": "Shell",
"bytes": "47922"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" ?>
<XML>
<Content>UPDATE</Content>
<Clip>
<ClipName>INPRNAD0282</ClipName>
<TipoContenido>INFORMATIVOS PROGRAMAS</TipoContenido>
<Contenido><![CDATA[ NAD 07SEP14]]></Contenido>
<OriginalTitle></OriginalTitle>
<Description> </Description>
<Notes>a</Notes>
<DurPrev></DurPrev>
<Chapter></Chapter>
<EndDate></EndDate>
<EPG></EPG>
<EPG_Content> </EPG_Content>
<Segments>
<Segment>
<SegTitle>1-3 NUESTRA AMERICA DEPORTIVA - NAD 07SEP14</SegTitle>
<MediaID>INPRNAD028201</MediaID>
<Duration>00:08:00.00</Duration>
<SegNumber>1</SegNumber>
<ClipGroup>PROGRAMA</ClipGroup>
<Description> </Description>
</Segment>
<Segment>
<SegTitle>2-3 NUESTRA AMERICA DEPORTIVA - NAD 07SEP14</SegTitle>
<MediaID>INPRNAD028202</MediaID>
<Duration>00:08:00.00</Duration>
<SegNumber>2</SegNumber>
<ClipGroup>PROGRAMA</ClipGroup>
<Description> </Description>
</Segment>
<Segment>
<SegTitle>3-3 NUESTRA AMERICA DEPORTIVA - NAD 07SEP14</SegTitle>
<MediaID>INPRNAD028203</MediaID>
<Duration>00:08:00.00</Duration>
<SegNumber>3</SegNumber>
<ClipGroup>PROGRAMA</ClipGroup>
<Description> </Description>
</Segment>
</Segments></Clip></XML> | {
"content_hash": "2d818d239f8c38cab8be1e0d0fddf5b9",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 84,
"avg_line_length": 42.75,
"alnum_prop": 0.4556087187666135,
"repo_name": "valeraovalles/sait",
"id": "5042ba986bfd65f0cb753e186a8d3df84708e249",
"size": "1881",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/uploads/creatv/xml/INPRNAD0282.xml",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "270692"
},
{
"name": "Erlang",
"bytes": "4333"
},
{
"name": "Java",
"bytes": "65391"
},
{
"name": "JavaScript",
"bytes": "1449856"
},
{
"name": "PHP",
"bytes": "6514811"
},
{
"name": "Perl",
"bytes": "41836"
},
{
"name": "Shell",
"bytes": "5701"
}
],
"symlink_target": ""
} |
package ru.job4j;
public abstract class Base {
private String name;
private String id;
public Base(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| {
"content_hash": "07af4170be79d52bc5c5dd44a1ea6fba",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 34,
"avg_line_length": 16.470588235294116,
"alnum_prop": 0.5607142857142857,
"repo_name": "mifodiy4j/smikhailov",
"id": "0c9f1c6e8d9a3ede4797ee95ed75b1ae23a52bfb",
"size": "280",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chapter_005/src/main/java/ru/job4j/Base.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "72105"
},
{
"name": "Java",
"bytes": "611215"
},
{
"name": "XSLT",
"bytes": "858"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 JBoss Inc
~
~ 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.
-->
<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>
<parent>
<groupId>org.kie.workbench.screens</groupId>
<artifactId>kie-wb-common-screens</artifactId>
<version>6.4.0-SNAPSHOT</version>
</parent>
<artifactId>kie-wb-common-java-editor</artifactId>
<packaging>pom</packaging>
<name>Kie Workbench - Common - Java editor</name>
<description>Kie Workbench - Common - Java editor</description>
<modules>
<module>kie-wb-common-java-editor-api</module>
<module>kie-wb-common-java-editor-client</module>
</modules>
</project> | {
"content_hash": "ff87a54c41049fcc293f66bd5d05c77c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 108,
"avg_line_length": 37.30769230769231,
"alnum_prop": 0.6824742268041237,
"repo_name": "cristianonicolai/kie-wb-common",
"id": "c9e3a0b331a770c7f1d0b66258a8d6361df810a1",
"size": "1455",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kie-wb-common-screens/kie-wb-common-java-editor/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "22894"
},
{
"name": "GAP",
"bytes": "86221"
},
{
"name": "HTML",
"bytes": "2645"
},
{
"name": "Java",
"bytes": "7060792"
}
],
"symlink_target": ""
} |
import arcpy, collections
from Parcel import Parcel
from LegacyCountyStats import *
import json
import webbrowser
from ConfigParser import ConfigParser
class Summary:
def __init__(self):
pass #placeholder
def writeSummaryTxt(Summary,outDirTxt,outName,totError,outPage,outJSON):
try:
Validation_JSON = {
'County_Info':{
'CO_NAME': totError.coName,
'Total_Records': totError.recordTotalCount,
'Legacy': eval((totError.coName).replace(" ","_") + "LegacyDict")
},
'inLineErrors':{
'General_Errors': str(totError.generalErrorCount),
'Geometric_Errors': str(totError.geometricErrorCount),
'Address_Errors': str(totError.addressErrorCount),
'Tax_Errors': str(totError.taxErrorCount)
},
'broadLevelErrors':{
'Geometric_Misplacement_Flag':[],
'Geometric_File_Error':[],
'Coded_Domain_Fields': ', '.join(totError.codedDomainfields)
},
'Tax_Roll_Years_Pcnt':{
'Previous_Taxroll_Year': str(round((float(totError.trYearPast / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)),
'Expected_Taxroll_Year': str(round((float(totError.trYearExpected / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)),
'Future_Taxroll_Years': str(round((float(totError.trYearFuture / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)),
'Other_Taxroll_Years': str(round((float(totError.trYearOther / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2))
},
'Records_Missing':{
'Missing_CONAME': str(totError.coNameMiss),
'Missing_PARCELFIPS': str(totError.fipsMiss),
'Missing_PARCELSRC': str(totError.srcMiss)
},
'Fields_Diffs':{
'PARCELID': str(totError.comparisonDict["PARCELID"]),
'TAXPARCELID': str(totError.comparisonDict["TAXPARCELID"]),
'PARCELDATE': str(totError.comparisonDict["PARCELDATE"]),
'TAXROLLYEAR': str(totError.comparisonDict["TAXROLLYEAR"]),
'OWNERNME1': str(totError.comparisonDict["OWNERNME1"]),
'OWNERNME2': str(totError.comparisonDict["OWNERNME2"]),
'PSTLADRESS': str(totError.comparisonDict["PSTLADRESS"]),
'SITEADRESS': str(totError.comparisonDict["SITEADRESS"]),
'ADDNUMPREFIX': str(totError.comparisonDict["ADDNUMPREFIX"]),
'ADDNUM': str(totError.comparisonDict["ADDNUM"]),
'ADDNUMSUFFIX': str(totError.comparisonDict["ADDNUMSUFFIX"]),
'PREFIX': str(totError.comparisonDict["PREFIX"]),
'STREETNAME': str(totError.comparisonDict["STREETNAME"]),
'STREETTYPE': str(totError.comparisonDict["STREETTYPE"]),
'SUFFIX': str(totError.comparisonDict["SUFFIX"]),
'LANDMARKNAME': str(totError.comparisonDict["LANDMARKNAME"]),
'UNITTYPE': str(totError.comparisonDict["UNITTYPE"]),
'UNITID': str(totError.comparisonDict["UNITID"]),
'PLACENAME': str(totError.comparisonDict["PLACENAME"]),
'ZIPCODE': str(totError.comparisonDict["ZIPCODE"]),
'ZIP4': str(totError.comparisonDict["ZIP4"]),
'SCHOOLDIST': str(totError.comparisonDict["SCHOOLDIST"]),
'SCHOOLDISTNO': str(totError.comparisonDict["SCHOOLDISTNO"]),
#'IMPROVED': str(totError.comparisonDict["IMPROVED"]),
'CNTASSDVALUE': str(totError.comparisonDict["CNTASSDVALUE"]),
'LNDVALUE': str(totError.comparisonDict["LNDVALUE"]),
'IMPVALUE': str(totError.comparisonDict["IMPVALUE"]),
#'FORESTVALUE': str(totError.comparisonDict["FORESTVALUE"]),
'ESTFMKVALUE': str(totError.comparisonDict["ESTFMKVALUE"]),
'NETPRPTA': str(totError.comparisonDict["NETPRPTA"]),
'GRSPRPTA': str(totError.comparisonDict["GRSPRPTA"]),
'PROPCLASS': str(totError.comparisonDict["PROPCLASS"]),
'AUXCLASS': str(totError.comparisonDict["AUXCLASS"]),
'ASSDACRES': str(totError.comparisonDict["ASSDACRES"]),
'DEEDACRES': str(totError.comparisonDict["DEEDACRES"]),
'GISACRES': str(totError.comparisonDict["GISACRES"]),
'CONAME': str(totError.comparisonDict["CONAME"]),
'PARCELFIPS': str(totError.comparisonDict["PARCELFIPS"]),
'PARCELSRC': str(totError.comparisonDict["PARCELSRC"])
}
}
Summary.errorSummaryFile = open(outDirTxt + "/" + outName + "_ValidationSummary.txt","w")
("Creating Validation Summary here: " + outDirTxt + "/" + outName + "_ValidationSummary.txt")
Summary.errorSummaryFile.write(outDirTxt + "\\" + outName + "_ValidationSummary.txt" + "\n")
Summary.errorSummaryFile.write("Validation Summary Table: " + "\n")
Summary.errorSummaryFile.write("This validation summary table contains an overview of any errors found by the Parcel Validation Tool. Please review the contents of this file and make changes to your parcel dataset as necessary." + "\n\n")
Summary.errorSummaryFile.write("************************************************************************\n")
Summary.errorSummaryFile.write("* In-line errors\n")
Summary.errorSummaryFile.write("************************************************************************\n")
Summary.errorSummaryFile.write("The following lines summarized the element-specific errors that were found while validating your parcel dataset. The stats below are meant as a means of reviewing the output. Please see the GeneralElementErrors, AddressElementErrors, TaxrollElementErrors, and GeometricElementErrors fields to address these errors individually.\n")
Summary.errorSummaryFile.write(" General Errors: " + str(totError.generalErrorCount) + "\n")
Summary.errorSummaryFile.write(" Geometric Errors: " + str(totError.geometricErrorCount) + "\n")
Summary.errorSummaryFile.write(" Address Errors: " + str(totError.addressErrorCount) + "\n")
Summary.errorSummaryFile.write(" Tax Errors: " + str(totError.taxErrorCount) + "\n")
Summary.errorSummaryFile.write("\n\n")
Summary.errorSummaryFile.write("************************************************************************\n")
Summary.errorSummaryFile.write("* Broad-level errors:\n")
Summary.errorSummaryFile.write("************************************************************************\n")
Summary.errorSummaryFile.write("The following lines explain any broad geometric errors that were found while validating your parcel dataset."+ "\n")
if len(totError.geometricPlacementErrors) != 0:
for geometricErrorMessage in totError.geometricPlacementErrors:
Summary.errorSummaryFile.write(" Geometric Misplacement Flag: " + str(geometricErrorMessage) + "\n")
Validation_JSON["broadLevelErrors"]['Geometric_Misplacement_Flag'].append(str(geometricErrorMessage))
if len(totError.geometricFileErrors) != 0:
for geometricErrorMessage in totError.geometricFileErrors:
Summary.errorSummaryFile.write(" Geometric File Error: " + str(geometricErrorMessage) + "\n")
Validation_JSON["broadLevelErrors"]['Geometric_File_Error'].append(str(geometricErrorMessage))
if (len(totError.geometricFileErrors) == 0) and (len(totError.geometricPlacementErrors) == 0):
Summary.errorSummaryFile.write(" *No broad-level geometric errors found!" + "\n")
Validation_JSON["broadLevelErrors"]['Geometric_File_Error'].append("None")
Validation_JSON["broadLevelErrors"]['Geometric_Misplacement_Flag'].append("None")
Summary.errorSummaryFile.write("\n\n")
Summary.errorSummaryFile.write("Percentage of records with various Taxroll Years" + "\n")
Summary.errorSummaryFile.write(" Previous Taxroll Year: " + str(round((float(totError.trYearPast / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)) + "%\n")
Summary.errorSummaryFile.write(" Expected Taxroll Year: " + str(round((float(totError.trYearExpected / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)) + "%\n")
Summary.errorSummaryFile.write(" Future Taxroll Years: " + str(round((float(totError.trYearFuture / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)) + "%\n")
Summary.errorSummaryFile.write(" Other Taxroll Years: " + str(round((float(totError.trYearOther / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2)) + "%\n")
Summary.errorSummaryFile.write("\n\n")
Summary.errorSummaryFile.write("Records missing CONAME, PARCELFIPS, or PARCELSOURCE" + "\n")
Summary.errorSummaryFile.write(" Missing CONAME: " + str(totError.coNameMiss) + "\n")
Summary.errorSummaryFile.write(" Missing PARCELFIPS: " + str(totError.fipsMiss) + "\n")
Summary.errorSummaryFile.write(" Missing PARCELSRC: " + str(totError.srcMiss) + "\n\n")
Summary.errorSummaryFile.write("If any of the above values are greater than 0, please add missing values. These 3 fields should be populated for all records submitted.\n\n\n")
Summary.errorSummaryFile.write("BELOW IS A COMPARISON OF COMPLETENESS VALUES FROM YOUR PREVIOUS PARCEL SUBMISSION AND THIS CURRENT SUBMISSION.\n")
Summary.errorSummaryFile.write("-->If the value shown is a seemingly large negative number, please verify that all data was joined correctly and no data was lost during processing.\n")
Summary.errorSummaryFile.write("-->Note: This does not necessarily mean your data is incorrect, we just want to highlight large discrepancies that could indicate missing or incorrect data.\n\n")
Summary.errorSummaryFile.write(" FIELD DIFFERENCE\n")
Summary.errorSummaryFile.write(" ------ ----------\n")
Summary.errorSummaryFile.write(" PARCELID: " + str(totError.comparisonDict["PARCELID"]) + '\n')
Summary.errorSummaryFile.write(" TAXPARCELID: " + str(totError.comparisonDict["TAXPARCELID"]) + '\n')
Summary.errorSummaryFile.write(" PARCELDATE: " + str(totError.comparisonDict["PARCELDATE"]) + '\n')
Summary.errorSummaryFile.write(" TAXROLLYEAR: " + str(totError.comparisonDict["TAXROLLYEAR"]) + '\n')
Summary.errorSummaryFile.write(" OWNERNME1: " + str(totError.comparisonDict["OWNERNME1"]) + '\n')
Summary.errorSummaryFile.write(" OWNERNME2: " + str(totError.comparisonDict["OWNERNME2"]) + '\n')
Summary.errorSummaryFile.write(" PSTLADRESS: " + str(totError.comparisonDict["PSTLADRESS"]) + '\n')
Summary.errorSummaryFile.write(" SITEADRESS: " + str(totError.comparisonDict["SITEADRESS"]) + '\n')
Summary.errorSummaryFile.write(" ADDNUMPREFIX: " + str(totError.comparisonDict["ADDNUMPREFIX"]) + '\n')
Summary.errorSummaryFile.write(" ADDNUM: " + str(totError.comparisonDict["ADDNUM"]) + '\n')
Summary.errorSummaryFile.write(" ADDNUMSUFFIX: " + str(totError.comparisonDict["ADDNUMSUFFIX"]) + '\n')
Summary.errorSummaryFile.write(" PREFIX: " + str(totError.comparisonDict["PREFIX"]) + '\n')
Summary.errorSummaryFile.write(" STREETNAME: " + str(totError.comparisonDict["STREETNAME"]) + '\n')
Summary.errorSummaryFile.write(" STREETTYPE: " + str(totError.comparisonDict["STREETTYPE"]) + '\n')
Summary.errorSummaryFile.write(" SUFFIX: " + str(totError.comparisonDict["SUFFIX"]) + '\n')
Summary.errorSummaryFile.write(" LANDMARKNAME: " + str(totError.comparisonDict["LANDMARKNAME"]) + '\n')
Summary.errorSummaryFile.write(" UNITTYPE: " + str(totError.comparisonDict["UNITTYPE"]) + '\n')
Summary.errorSummaryFile.write(" UNITID: " + str(totError.comparisonDict["UNITID"]) + '\n')
Summary.errorSummaryFile.write(" PLACENAME: " + str(totError.comparisonDict["PLACENAME"]) + '\n')
Summary.errorSummaryFile.write(" ZIPCODE: " + str(totError.comparisonDict["ZIPCODE"]) + '\n')
Summary.errorSummaryFile.write(" ZIP4: " + str(totError.comparisonDict["ZIP4"]) + '\n')
Summary.errorSummaryFile.write(" SCHOOLDIST: " + str(totError.comparisonDict["SCHOOLDIST"]) + '\n')
Summary.errorSummaryFile.write(" SCHOOLDISTNO: " + str(totError.comparisonDict["SCHOOLDISTNO"]) + '\n')
#Summary.errorSummaryFile.write(" IMPROVED: " + str(totError.comparisonDict["IMPROVED"]) + '\n')
Summary.errorSummaryFile.write(" CNTASSDVALUE: " + str(totError.comparisonDict["CNTASSDVALUE"]) + '\n')
Summary.errorSummaryFile.write(" LNDVALUE: " + str(totError.comparisonDict["LNDVALUE"]) + '\n')
Summary.errorSummaryFile.write(" IMPVALUE: " + str(totError.comparisonDict["IMPVALUE"]) + '\n')
#Summary.errorSummaryFile.write(" FORESTVALUE: " + str(totError.comparisonDict["FORESTVALUE"]) + '\n')
Summary.errorSummaryFile.write(" ESTFMKVALUE: " + str(totError.comparisonDict["ESTFMKVALUE"]) + '\n')
Summary.errorSummaryFile.write(" NETPRPTA: " + str(totError.comparisonDict["NETPRPTA"]) + '\n')
Summary.errorSummaryFile.write(" GRSPRPTA: " + str(totError.comparisonDict["GRSPRPTA"]) + '\n')
Summary.errorSummaryFile.write(" PROPCLASS: " + str(totError.comparisonDict["PROPCLASS"]) + '\n')
Summary.errorSummaryFile.write(" AUXCLASS: " + str(totError.comparisonDict["AUXCLASS"]) + '\n')
Summary.errorSummaryFile.write(" ASSDACRES: " + str(totError.comparisonDict["ASSDACRES"]) + '\n')
Summary.errorSummaryFile.write(" DEEDACRES: " + str(totError.comparisonDict["DEEDACRES"]) + '\n')
Summary.errorSummaryFile.write(" GISACRES: " + str(totError.comparisonDict["GISACRES"]) + '\n')
Summary.errorSummaryFile.write(" CONAME: " + str(totError.comparisonDict["CONAME"]) + '\n')
Summary.errorSummaryFile.write(" PARCELFIPS: " + str(totError.comparisonDict["PARCELFIPS"]) + '\n')
Summary.errorSummaryFile.write(" PARCELSRC: " + str(totError.comparisonDict["PARCELSRC"]) + '\n')
Summary.errorSummaryFile.write("\n\n\n* Within: " + outDirTxt + "\\" + outName + "\n")
Summary.errorSummaryFile.write("************************************************************************\n")
Summary.errorSummaryFile.close()
# outJSON - # full (hard coded) path to the output .json file summary.js
with open(outJSON, 'w') as outfile:
outfile.write("var testValues = ")
json.dump(Validation_JSON, outfile)
except Exception as e:
arcpy.AddMessage("!!!!!!!!!!Error writing summary file!!!!!!!!!!")
arcpy.AddMessage(str(e))
webbrowser.open(outPage, new=2)
def writeIniFile(self,inputDict,totError):
arcpy.AddMessage("\n")
arcpy.AddMessage("Creating .ini file")
config = ConfigParser()
config.add_section('PARAMETERS')
for key in inputDict.keys():
config.set('PARAMETERS',key,inputDict[key])
if inputDict['isSearchable'] == 'true':
config.add_section('ERROR COUNTS')
config.set('ERROR COUNTS','General',totError.generalErrorCount)
config.set('ERROR COUNTS','Geometric',totError.geometricErrorCount)
config.set('ERROR COUNTS','Address',totError.addressErrorCount)
config.set('ERROR COUNTS','Tax',totError.taxErrorCount)
config.add_section('PERCENT TAXROLL YEAR')
config.set('PERCENT TAXROLL YEAR','Previous',round((float(totError.trYearPast / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2))
config.set('PERCENT TAXROLL YEAR','Expected',round((float(totError.trYearExpected / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2))
config.set('PERCENT TAXROLL YEAR','Future',round((float(totError.trYearFuture / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2))
config.set('PERCENT TAXROLL YEAR','Other',round((float(totError.trYearOther / float((totError.recordTotalCount - totError.pinSkipCount)))*100),2))
config.add_section('MISSING RECORDS')
config.set('MISSING RECORDS','CONAME',totError.coNameMiss)
config.set('MISSING RECORDS','PARCELFIPS',totError.fipsMiss)
config.set('MISSING RECORDS','PARCELSOURCE',totError.srcMiss)
config.add_section('COMPARISON COMPLETENESS')
for field in totError.comparisonDict.keys():
if field != 'state' or field != 'loaddate':
config.set('COMPARISON COMPLETENESS',field,totError.comparisonDict[field])
try:
#Write out .ini file
with open(inputDict['outINIDir']+'/'+inputDict['county'] +'.ini','w') as configFile:
config.write(configFile)
with open(inputDict['inCert'],'r') as certFile:
for line in certFile:
configFile.write(line)
arcpy.AddMessage("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
arcpy.AddMessage("Wrote .ini file to "+inputDict['outINIDir'])
arcpy.AddMessage("\n")
arcpy.AddMessage("SUBMISSIONS WITHOUT .ini WILL NOT BE ACCEPTED!")
arcpy.AddMessage("\n")
arcpy.AddMessage("------> .ini FILE CREATION COMPLETE! GREAT WORK!! <------\n\n")
arcpy.AddMessage("NOW, ZIP UP THE .ini FILE, THE PARCEL FILE GEODATABASE, THE OTHER_LAYERS FILE GEODATABASE, AND SUBMIT TO wisedecade.legis.wisconsin.gov")
arcpy.AddMessage("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n")
except Exception as e:
arcpy.AddMessage("!!!!!!!!!!Error writing .ini file!!!!!!!!!!")
arcpy.AddMessage(str(e))
def explainCertComplete(self,inFile):
fhand = open(inFile, 'r')
count = 0
for line in fhand:
if len(line.strip()) <> 0:
count += 1
if count < 3:
arcpy.AddMessage("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
arcpy.AddMessage(" IMMEDIATE ISSUE REQUIRING ATTENTION")
arcpy.AddMessage("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n")
arcpy.AddMessage("IT DOESN'T APPEAR THAT YOU FULLY FILLED OUT THE EXPLAIN-CERTIFY FILE REQUIRED FOR SUBMISSION.\n\n")
arcpy.AddMessage("PLEASE FILL OUT THIS FILE IN IT'S ENTIRETY AND RE-RUN THE TOOL IN FINAL MODE.")
arcpy.AddMessage("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
arcpy.AddMessage("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
exit()
def fieldConstraints(self,totError):
if totError.coNameMiss > 0 or totError.fipsMiss > 0 or totError.srcMiss > 0:
arcpy.AddMessage("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
arcpy.AddMessage(" IMMEDIATE ISSUE REQUIRING ATTENTION")
arcpy.AddMessage("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n")
arcpy.AddMessage("ONE OF THE FOLLOWING FIELDS: CONAME, PARCELSRC or PARCELFIPS ARE NOT FULLY POPULATED.\n\n")
arcpy.AddMessage("THESE FIELDS SHOULD BE POPULATED FOR EVERY RECORD IN THE SUMBITTED PARCEL FEATURE CLASS.\n\n")
arcpy.AddMessage("PLEASE ENSURE THESE FIELDS ARE POPULATED FOR ALL RECORDS AND RE-RUN THE TOOL IN FINAL MODE.")
arcpy.AddMessage("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
arcpy.AddMessage("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
exit()
| {
"content_hash": "c0916fab353a4477b0d352fe5d5ea8b5",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 368,
"avg_line_length": 72.08203125,
"alnum_prop": 0.6737115916111202,
"repo_name": "WIStCart/V3ValidationTool",
"id": "c539b9b5f5001beb478e46100e6c279a5f57a71d",
"size": "18453",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "V6ValidationTool_dist/script/Summary.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "317169"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "e75eaab2ba38c6d077fa76b7f2ab36fa",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "2bad21e21deb7d6f68973a212498b3178ece2791",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Orobanchaceae/Agalinis/Agalinis gattingeri/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Boletín de la Academia Nacional de Ciencias de Córdoba 11(2): 275 (1888)
#### Original name
Trochila winteri Speg.
### Remarks
null | {
"content_hash": "d492b4c2d5ab5fc095d3d00a5cdeb1d9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 15,
"alnum_prop": 0.7230769230769231,
"repo_name": "mdoering/backbone",
"id": "28b41487ac348de3863abd28752e94b17a43eb7e",
"size": "243",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Leotiomycetes/Helotiales/Dermateaceae/Trochila/Trochila winteri/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
MediaioStatus createDecoderInstance(void** handle)
{
Decoder* instance = new Decoder();
*handle = instance;
return kMediaioStatusOK;
}
MediaioStatus deleteDecoderInstance(void** handle)
{
delete (Decoder*)*handle;
*handle = nullptr;
return kMediaioStatusOK;
}
MediaioStatus configureDecoder(void* handle, const Metadata* parameters)
{
Decoder* instance = (Decoder*) handle;
return instance->configure( parameters );
}
MediaioStatus decode(void* handle, CodedData* unwrappedFrame, ImageFrame* decodedFrame)
{
Decoder* instance = (Decoder*) handle;
return instance->decode(unwrappedFrame, decodedFrame);
}
Metadata* getDecoderMetadatas(void* handle)
{
Decoder* instance = (Decoder*) handle;
return instance->getMetadatas();
}
MediaioStatus createEncoderInstance(void** handle)
{
Encoder* instance = new Encoder();
*handle = instance;
return kMediaioStatusOK;
}
MediaioStatus deleteEncoderInstance(void** handle)
{
delete (Encoder*)*handle;
*handle = nullptr;
return kMediaioStatusOK;
}
MediaioStatus configureEncoder(void* handle, const Metadata* parameters)
{
Encoder* instance = (Encoder*) handle;
return instance->configure( parameters );
}
MediaioStatus encode(void* handle, Frame* decodedFrame, CodedData* unwrappedFrame)
{
Encoder* instance = (Encoder*) handle;
return instance->encode(decodedFrame, unwrappedFrame);
}
Metadata* getEncoderMetadatas(void* handle)
{
Encoder* instance = (Encoder*) handle;
return instance->getMetadatas();
}
static MediaioPluginInstance DecoderInstance =
{
createDecoderInstance,
deleteDecoderInstance
};
static MediaioPluginDecoder Decoder =
{
configureDecoder,
decode,
getDecoderMetadatas
};
static MediaioPluginInstance EncoderInstance =
{
createEncoderInstance,
deleteEncoderInstance
};
static MediaioPluginEncoder Encoder =
{
configureEncoder,
encode,
getEncoderMetadatas
};
////////////////////////////////////////////////////////////////////////////////
// Plugin definition
static void* pluginActionDecoder(const char *action)
{
switch(get_action(action))
{
case PluginActionInstance: { return &DecoderInstance; }
case PluginActionDecoder: { return &Decoder; }
default: return nullptr;
}
}
static void* pluginActionEncoder(const char *action)
{
switch(get_action(action))
{
case PluginActionInstance: { return &EncoderInstance; }
case PluginActionEncoder: { return &Encoder; }
default: return nullptr;
}
}
Plugin decoderPlugin = Plugin(
PluginApiDecoder,
"fr.co.mediaio:turingdecoder",
"HEVC Decoder",
"Decode HEVC using Turing Codec library",
1,
0,
pluginActionDecoder
);
Plugin encoderPlugin = Plugin(
PluginApiEncoder,
"fr.co.mediaio:turingencoder",
"HEVC Encoder",
"Encode HEVC using Turing Codec library",
1,
0,
pluginActionEncoder
);
std::vector<Plugin> plugins = {decoderPlugin, encoderPlugin};
| {
"content_hash": "2dfb14182f804ca8c9d09cb7b68859f9",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 87,
"avg_line_length": 21.285714285714285,
"alnum_prop": 0.7407276580713529,
"repo_name": "media-io/plugins",
"id": "53ea812329568569d0584e7ff4948192d306c984",
"size": "2909",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/plugin/turingcodec/TuringCodecPlugin.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2557"
},
{
"name": "C++",
"bytes": "216125"
},
{
"name": "Python",
"bytes": "8568"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entidades;
using Datos.Implementaciones;
using Datos;
using Logica.Interface;
namespace Logica.Implementaciones
{
public class EstadoTramiteLN : clsInterfaceLogica<ESTADO_TRAMITES>
{
SADDEXEntities context;
EstadoTramiteAD EstadoTramiteAD;
public EstadoTramiteLN()
{
context = new SADDEXEntities();
EstadoTramiteAD = new EstadoTramiteAD(context);
}
public void Agregar_L(ESTADO_TRAMITES obj)
{
var trans = this.context.Database.BeginTransaction();
try
{
EstadoTramiteAD.Agregar_D(obj);
this.context.SaveChanges();
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
}
}
public void Eliminar_L(ESTADO_TRAMITES obj)
{
var trans = this.context.Database.BeginTransaction();
try
{
EstadoTramiteAD.Eliminar_D(obj);
this.context.SaveChanges();
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
}
}
public void Modificar_L(ESTADO_TRAMITES obj)
{
var trans = this.context.Database.BeginTransaction();
try
{
EstadoTramiteAD.Modificar_D(obj);
this.context.SaveChanges();
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
}
}
public IEnumerable<ESTADO_TRAMITES> devolverLISTA_L()
{
return EstadoTramiteAD.devolverLISTA_D();
}
public ESTADO_TRAMITES buscarporID_L(int id)
{
return EstadoTramiteAD.buscarporID(id);
}
}
}
| {
"content_hash": "1452d0bb128902b72747f21550dde16e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 70,
"avg_line_length": 26.3375,
"alnum_prop": 0.5002373042240151,
"repo_name": "cjporras/SADDEX_App",
"id": "c995277a77de208c027fbc5844b46f9fe79eb87a",
"size": "2109",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Logica/Implementaciones/EstadoTramiteLN.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "128507"
}
],
"symlink_target": ""
} |
["localStorage", "sessionStorage"].forEach(function(name) {
[9, "x"].forEach(function(key) {
test(function() {
var expected = "value for " + this.name;
var value = expected;
var storage = window[name];
storage.clear();
assert_equals(storage[key], undefined);
assert_equals(storage.getItem(key), null);
assert_equals(storage[key] = value, value);
assert_equals(storage[key], expected);
assert_equals(storage.getItem(key), expected);
}, "Setting property for key " + key + " on " + name);
test(function() {
var expected = "value for " + this.name;
var value = {
toString: function() { return expected; }
};
var storage = window[name];
storage.clear();
assert_equals(storage[key], undefined);
assert_equals(storage.getItem(key), null);
assert_equals(storage[key] = value, value);
assert_equals(storage[key], expected);
assert_equals(storage.getItem(key), expected);
}, "Setting property with toString for key " + key + " on " + name);
test(function() {
var proto = "proto for " + this.name;
Storage.prototype[key] = proto;
this.add_cleanup(function() { delete Storage.prototype[key]; });
var value = "value for " + this.name;
var storage = window[name];
storage.clear();
assert_equals(storage[key], proto);
assert_equals(storage.getItem(key), null);
assert_equals(storage[key] = value, value);
// Hidden because no [LegacyOverrideBuiltIns].
assert_equals(storage[key], proto);
assert_equals(Object.getOwnPropertyDescriptor(storage, key), undefined);
assert_equals(storage.getItem(key), value);
}, "Setting property for key " + key + " on " + name + " with data property on prototype");
test(function() {
var proto = "proto for " + this.name;
Storage.prototype[key] = proto;
this.add_cleanup(function() { delete Storage.prototype[key]; });
var value = "value for " + this.name;
var existing = "existing for " + this.name;
var storage = window[name];
storage.clear();
storage.setItem(key, existing);
// Hidden because no [LegacyOverrideBuiltIns].
assert_equals(storage[key], proto);
assert_equals(Object.getOwnPropertyDescriptor(storage, key), undefined);
assert_equals(storage.getItem(key), existing);
assert_equals(storage[key] = value, value);
assert_equals(storage[key], proto);
assert_equals(Object.getOwnPropertyDescriptor(storage, key), undefined);
assert_equals(storage.getItem(key), value);
}, "Setting property for key " + key + " on " + name + " with data property on prototype and existing item");
test(function() {
var storage = window[name];
storage.clear();
var proto = "proto getter for " + this.name;
Object.defineProperty(Storage.prototype, key, {
"get": function() { return proto; },
"set": this.unreached_func("Should not call [[Set]] on prototype"),
"configurable": true,
});
this.add_cleanup(function() {
delete Storage.prototype[key];
delete storage[key];
assert_false(key in storage);
});
var value = "value for " + this.name;
assert_equals(storage[key], proto);
assert_equals(storage.getItem(key), null);
assert_equals(storage[key] = value, value);
// Property is hidden because no [LegacyOverrideBuiltIns].
assert_equals(storage[key], proto);
assert_equals(Object.getOwnPropertyDescriptor(storage, key), undefined);
assert_equals(storage.getItem(key), value);
}, "Setting property for key " + key + " on " + name + " with accessor property on prototype");
});
});
| {
"content_hash": "c35b7bcca3e3e7e957eab2b31eaebebf",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 117,
"avg_line_length": 41.754901960784316,
"alnum_prop": 0.5555294670110354,
"repo_name": "chromium/chromium",
"id": "8e671d2dedd353793da72bdc9aebed269d0d9d4d",
"size": "4259",
"binary": false,
"copies": "23",
"ref": "refs/heads/main",
"path": "third_party/blink/web_tests/external/wpt/webstorage/set.window.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
import Data.Char
import Data.Char
import Data.List
import Data.List.Split
pkcs7pad len bytes = result
where
chunks = chunksOf len bytes
lst = last chunks
needed = len - (length lst)
padding = repeat needed
paddedLast = concat [lst,(take needed padding)]
chunksMinusLast = take (length chunks - 1) chunks
result = concat [chunksMinusLast,[paddedLast]]
main :: IO()
main = putStrLn result
where
bytes = pkcs7pad 20 (map ord "YELLOW SUBMARINE")
result = show bytes
| {
"content_hash": "42b7e4ca0ee383bb19fa5a8a7d5304c0",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 25.2,
"alnum_prop": 0.6964285714285714,
"repo_name": "mozkeeler/cryptopals",
"id": "04c98c4fe1a47fb978dd806aeec43ca30548f30e",
"size": "504",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "set2/challenge9/pkcs7pad.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Haskell",
"bytes": "17022"
}
],
"symlink_target": ""
} |
(function() {
'use strict';
angular
.module('app.customers')
.controller('CustomerDetail', CustomerDetail);
CustomerDetail.$inject = ['$stateParams', '$window', 'dataservice', 'logger'];
/* @ngInject */
function CustomerDetail($stateParams, $window, dataservice, logger) {
var vm = this;
vm.cancel = cancel;
vm.customer = undefined;
vm.goBack = goBack;
vm.isUnchanged = isUnchanged;
vm.getFullName = getFullName;
vm.save = save;
vm.title = 'Customer Detail';
activate();
function activate() {
return getCustomer($stateParams.id).then(function() {
logger.info('Activated Customer Detail View');
});
}
function cancel() {
vm.customer = angular.copy(vm.original);
}
function getCustomer(id) {
return dataservice.getCustomer(id).then(function(data) {
vm.customer = data;
vm.original = angular.copy(vm.customer);
return vm.customer;
});
}
function goBack() {
$window.history.back();
}
function isUnchanged() {
return angular.equals(vm.customer, vm.original);
}
function getFullName() {
return vm.customer && vm.customer.firstName + ' ' + vm.customer.lastName;
}
function save() {
vm.original = angular.copy(vm.customer);
logger.success('Saving Customer (not really)');
}
}
})();
| {
"content_hash": "11646a4a370526c756fe43382116adc2",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 85,
"avg_line_length": 27.53448275862069,
"alnum_prop": 0.5316217908578584,
"repo_name": "danyinfo1/Pluralsigt-gulp-course",
"id": "b31d8ac6090c189ccf070c619aef885bc089d656",
"size": "1597",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/client/app/customers/customer-detail.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "63394"
},
{
"name": "HTML",
"bytes": "16748"
},
{
"name": "JavaScript",
"bytes": "60456"
}
],
"symlink_target": ""
} |
/* IMPORT */
import * as vscode from 'vscode';
import Item from './items/item';
/* VIEW */
class View implements vscode.TreeDataProvider<Item> {
onDidChangeTreeDataEvent = new vscode.EventEmitter<Item | undefined> ();
onDidChangeTreeData = this.onDidChangeTreeDataEvent.event;
getTreeItem ( item: Item ): vscode.TreeItem {
return item;
}
async getChildren ( item?: Item ): Promise<Item[]> {
return [];
}
refresh () {
this.onDidChangeTreeDataEvent.fire ();
}
}
/* EXPORT */
export default View;
| {
"content_hash": "1f4f947375dd24e24de4cd8e2c84a133",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 14.972222222222221,
"alnum_prop": 0.6641929499072357,
"repo_name": "fabiospampinato/vscode-projects-plus",
"id": "5557361c2473b898ece8fab367e6161a51dbeec9",
"size": "539",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/views/view.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "699"
},
{
"name": "TypeScript",
"bytes": "53252"
}
],
"symlink_target": ""
} |
import logging
import time
from parsl.providers.kubernetes.template import template_string
logger = logging.getLogger(__name__)
from parsl.providers.error import *
from parsl.providers.provider_base import ExecutionProvider
from parsl.utils import RepresentationMixin
try:
from kubernetes import client, config
_kubernetes_enabled = True
except (ImportError, NameError, FileNotFoundError):
_kubernetes_enabled = False
class KubernetesProvider(ExecutionProvider, RepresentationMixin):
""" Kubernetes execution provider
Parameters
----------
namespace : str
Kubernetes namespace to create deployments.
image : str
Docker image to use in the deployment.
channel : Channel
Channel for accessing this provider. Possible channels include
:class:`~parsl.channels.LocalChannel` (the default),
:class:`~parsl.channels.SSHChannel`, or
:class:`~parsl.channels.SSHInteractiveLoginChannel`.
nodes_per_block : int
Nodes to provision per block.
init_blocks : int
Number of blocks to provision at the start of the run. Default is 1.
min_blocks : int
Minimum number of blocks to maintain.
max_blocks : int
Maximum number of blocks to maintain.
parallelism : float
Ratio of provisioned task slots to active tasks. A parallelism value of 1 represents aggressive
scaling where as many resources as possible are used; parallelism close to 0 represents
the opposite situation in which as few resources as possible (i.e., min_blocks) are used.
worker_init : str
Command to be run first for the workers, such as `python start.py`.
secret : str
Docker secret to use to pull images
user_id : str
Unix user id to run the container as.
group_id : str
Unix group id to run the container as.
run_as_non_root : bool
Run as non-root (True) or run as root (False).
persistent_volumes: list[(str, str)]
List of tuples describing persistent volumes to be mounted in the pod.
The tuples consist of (PVC Name, Mount Directory).
"""
def __init__(self,
image,
namespace='default',
channel=None,
nodes_per_block=1,
init_blocks=4,
min_blocks=0,
max_blocks=10,
parallelism=1,
worker_init="",
user_id=None,
group_id=None,
run_as_non_root=False,
secret=None,
persistent_volumes=[]):
if not _kubernetes_enabled:
raise OptionalModuleMissing(['kubernetes'],
"Kubernetes provider requires kubernetes module and config.")
config.load_kube_config()
self.namespace = namespace
self.image = image
self.channel = channel
self.nodes_per_block = nodes_per_block
self.init_blocks = init_blocks
self.min_blocks = min_blocks
self.max_blocks = max_blocks
self.parallelism = parallelism
self.worker_init = worker_init
self.secret = secret
self.user_id = user_id
self.group_id = group_id
self.run_as_non_root = run_as_non_root
self.persistent_volumes = persistent_volumes
self.kube_client = client.ExtensionsV1beta1Api()
# Dictionary that keeps track of jobs, keyed on job_id
self.resources = {}
def submit(self, cmd_string, blocksize, tasks_per_node, job_name="parsl.auto"):
""" Submit a job
Args:
- cmd_string :(String) - Name of the container to initiate
- blocksize :(float) - Number of replicas
- tasks_per_node (int) : command invocations to be launched per node
Kwargs:
- job_name (String): Name for job, must be unique
Returns:
- None: At capacity, cannot provision more
- job_id: (string) Identifier for the job
"""
if not self.resources:
job_name = "{0}-{1}".format(job_name, time.time()).split(".")[0]
self.deployment_name = '{}-{}-deployment'.format(job_name,
str(time.time()).split('.')[0])
formatted_cmd = template_string.format(command=cmd_string,
worker_init=self.worker_init)
print("Creating replicas :", self.init_blocks)
self.deployment_obj = self._create_deployment_object(job_name,
self.image,
self.deployment_name,
cmd_string=formatted_cmd,
replicas=self.init_blocks,
volumes=self.persistent_volumes)
logger.debug("Deployment name :{}".format(self.deployment_name))
self._create_deployment(self.deployment_obj)
self.resources[self.deployment_name] = {'status': 'RUNNING',
'pods': self.init_blocks}
return self.deployment_name
def status(self, job_ids):
""" Get the status of a list of jobs identified by the job identifiers
returned from the submit request.
Args:
- job_ids (list) : A list of job identifiers
Returns:
- A list of status from ['PENDING', 'RUNNING', 'CANCELLED', 'COMPLETED',
'FAILED', 'TIMEOUT'] corresponding to each job_id in the job_ids list.
Raises:
- ExecutionProviderExceptions or its subclasses
"""
self._status()
# This is a hack
return ['RUNNING' for jid in job_ids]
def cancel(self, job_ids):
""" Cancels the jobs specified by a list of job ids
Args:
job_ids : [<job_id> ...]
Returns :
[True/False...] : If the cancel operation fails the entire list will be False.
"""
for job in job_ids:
logger.debug("Terminating job/proc_id: {0}".format(job))
# Here we are assuming that for local, the job_ids are the process id's
self._delete_deployment(job)
self.resources[job]['status'] = 'CANCELLED'
rets = [True for i in job_ids]
return rets
def _status(self):
""" Internal: Do not call. Returns the status list for a list of job_ids
Args:
self
Returns:
[status...] : Status list of all jobs
"""
jobs_ids = list(self.resources.keys())
# TODO: fix this
return jobs_ids
# do something to get the deployment's status
def _create_deployment_object(self, job_name, job_image,
deployment_name, port=80,
replicas=1,
cmd_string=None,
engine_json_file='~/.ipython/profile_default/security/ipcontroller-engine.json',
engine_dir='.',
volumes=[]):
""" Create a kubernetes deployment for the job.
Args:
- job_name (string) : Name of the job and deployment
- job_image (string) : Docker image to launch
KWargs:
- port (integer) : Container port
- replicas : Number of replica containers to maintain
Returns:
- True: The deployment object to launch
"""
# sorry, quick hack that doesn't pass this stuff through to test it works.
# TODO it also doesn't only add what is set :(
security_context = None
if self.user_id and self.group_id:
security_context = client.V1SecurityContext(run_as_group=self.group_id,
run_as_user=self.user_id,
run_as_non_root=self.run_as_non_root)
# Create the enviornment variables and command to initiate IPP
environment_vars = client.V1EnvVar(name="TEST", value="SOME DATA")
launch_args = ["-c", "{0}; /app/deploy.sh;".format(cmd_string)]
print(launch_args)
volume_mounts = []
# Create mount paths for the volumes
for volume in volumes:
volume_mounts.append(client.V1VolumeMount(mount_path=volume[1],
name=volume[0]))
# Configureate Pod template container
container = None
if security_context:
container = client.V1Container(
name=job_name,
image=job_image,
ports=[client.V1ContainerPort(container_port=port)],
volume_mounts=volume_mounts,
command=['/bin/bash'],
args=launch_args,
env=[environment_vars],
security_context=security_context)
else:
container = client.V1Container(
name=job_name,
image=job_image,
ports=[client.V1ContainerPort(container_port=port)],
volume_mounts=volume_mounts,
command=['/bin/bash'],
args=launch_args,
env=[environment_vars])
# Create a secret to enable pulling images from secure repositories
secret = None
if self.secret:
secret = client.V1LocalObjectReference(name=self.secret)
# Create list of volumes from (pvc, mount) tuples
volume_defs = []
for volume in volumes:
volume_defs.append(client.V1Volume(name=volume[0],
persistent_volume_claim=client.V1PersistentVolumeClaimVolumeSource(
claim_name=volume[0])))
# Create and configurate a spec section
template = client.V1PodTemplateSpec(
metadata=client.V1ObjectMeta(labels={"app": job_name}),
spec=client.V1PodSpec(containers=[container],
image_pull_secrets=[secret],
volumes=volume_defs
))
# Create the specification of deployment
spec = client.ExtensionsV1beta1DeploymentSpec(replicas=replicas,
template=template)
# Instantiate the deployment object
deployment = client.ExtensionsV1beta1Deployment(
api_version="extensions/v1beta1",
kind="Deployment",
metadata=client.V1ObjectMeta(name=deployment_name),
spec=spec)
return deployment
def _create_deployment(self, deployment):
""" Create the kubernetes deployment """
api_response = self.kube_client.create_namespaced_deployment(
body=deployment,
namespace=self.namespace)
logger.debug("Deployment created. status='{0}'".format(str(api_response.status)))
def _delete_deployment(self, deployment_name):
""" Delete deployment """
api_response = self.kube_client.delete_namespaced_deployment(
name=deployment_name,
namespace=self.namespace,
body=client.V1DeleteOptions(
propagation_policy='Foreground',
grace_period_seconds=5))
logger.debug("Deployment deleted. status='{0}'".format(
str(api_response.status)))
@property
def scaling_enabled(self):
return False
@property
def channels_required(self):
return False
@property
def label(self):
return "kubernetes"
| {
"content_hash": "1f2fb18bcaba1d7f8b3c537078073bae",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 114,
"avg_line_length": 39.86423841059602,
"alnum_prop": 0.551540825649971,
"repo_name": "swift-lang/swift-e-lab",
"id": "070acefb78aceb6116e7f5dcc9c3f27b1b281405",
"size": "12039",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "parsl/providers/kubernetes/kube.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "59197"
},
{
"name": "Python",
"bytes": "104539"
},
{
"name": "Shell",
"bytes": "1283"
}
],
"symlink_target": ""
} |
#ifndef __GLXUtils_H__
#define __GLXUtils_H__
#include "OgrePrerequisites.h"
#include <GL/glew.h>
#include <GL/glxew.h>
namespace Ogre
{
class _OgrePrivate GLXUtils
{
public:
// Portable replacements for some GLX 1.3 function pointers
static PFNGLXCHOOSEFBCONFIGPROC chooseFBConfig;
static PFNGLXCREATENEWCONTEXTPROC createNewContext;
static PFNGLXGETFBCONFIGATTRIBPROC getFBConfigAttrib;
static PFNGLXGETVISUALFROMFBCONFIGPROC getVisualFromFBConfig;
/**
* Get the GLXFBConfig used to create a ::GLXContext
*
* @param display X Display
* @param drawable GLXContext
* @returns GLXFBConfig used to create the context
*/
static GLXFBConfig getFBConfigFromContext (Display *display, ::GLXContext context);
/**
* Get the GLXFBConfig used to create a GLXDrawable.
* Caveat: GLX version 1.3 is needed when the drawable is a GLXPixmap
*
* @param display X Display
* @param drawable GLXDrawable
* @param width Receiver for the drawable width
* @param height Receiver for the drawable height
* @returns GLXFBConfig used to create the drawable
*/
static GLXFBConfig getFBConfigFromDrawable (Display *display, GLXDrawable drawable,
unsigned int *width, unsigned int *height);
/**
* Initialise the parts of GLXEW needed to create a GL Context
*
* @param display X Display
*/
static void initialiseGLXEW (Display *display);
/**
* Select an FBConfig given a list of required and a list of desired properties
*
* @param display X Display
* @param minAttribs FBConfig attributes that must be provided with minimum values
* @param maxAttribs FBConfig attributes that are preferred with maximum values
* @returns GLXFBConfig with attributes or 0 when unsupported.
*/
static GLXFBConfig selectFBConfig(Display *display, const int *minAttribs, const int *maxAttribs);
/**
* Loads an icon from an Ogre resource into the X Server. This currently only
* works for 24 and 32 bit displays. The image must be findable by the Ogre
* resource system, and of format PF_A8R8G8B8.
*
* @param display X display
* @param name Name of image to load
* @param pix Receiver for the output pixmap
* @param mask Receiver for the output mask (alpha bitmap)
* @returns true on success
*/
static bool loadIcon(Display *display, const std::string &name, Pixmap *pix, Pixmap *mask);
};
};
#endif
| {
"content_hash": "70971245a97f73e8152d364e05e1baff",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 100,
"avg_line_length": 32.328947368421055,
"alnum_prop": 0.7142857142857143,
"repo_name": "airgames/vuforia-gamekit-integration",
"id": "59973514f3040d347933ccd0e70a9cf4a53d97d9",
"size": "3816",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Gamekit/Ogre-1.8rc/RenderSystems/GL/include/GLX/OgreGLXUtils.h",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/*
* HTML5 Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*/
/* ==========================================================================
Base styles: opinionated defaults
========================================================================== */
html,
button,
input,
select,
textarea {
color: #222;
}
body {
font-size: 1em;
line-height: 1.4;
}
/*
* Remove text-shadow in selection highlight: h5bp.com/i
* These selection rule sets have to be separate.
* Customize the background color to match your design.
*/
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
/*
* A better looking default horizontal rule
*/
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
/*
* Remove the gap between images and the bottom of their containers: h5bp.com/i/440
*/
img {
vertical-align: middle;
}
/*
* Remove default fieldset styles.
*/
fieldset {
border: 0;
margin: 0;
padding: 0;
}
/*
* Allow only vertical resizing of textareas.
*/
textarea {
resize: vertical;
}
/* ==========================================================================
Chrome Frame prompt
========================================================================== */
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/* ==========================================================================
Author's custom styles
========================================================================== */
body, html{
background-color:#2B2929;
color:#EFEDE1;
font-family:"gotham_lightregular";
}
h2{
text-transform: uppercase;
font-weight:normal;
margin-bottom:0px;
padding-bottom:0px;
font-size:18px;
}
header{
padding:17px 0 17px 0;
background-image: url(../img/ptrn.png);
border-top:2px solid #F5D700;
}
header .logo{
width:189px;
height:70px;
display: block;
background-image: url(../img/logo.png);
background-size:189px 70px;
float:left;
}
header .nokia-phone-name{
font-size:25px;
line-height: 28px;
font-family:"gotham_boldregular";
}
header .avail-exclusively{
margin-top:15px;
text-transform: uppercase;
font-size:12px;
line-height: 16px;
float:right;
}
.section-copy{
padding:42px 0;
}
.section-copy p{
margin-top:0px;
padding-top:0px;
line-height: 22px;
}
.l-content{
background-image:url(../img/video_bkg.png);
background-color:#231F20;
background-repeat: repeat-x;
background-position: 0px 0px;
background-size: 12px 732px;
position: relative;
-webkit-box-shadow: 0 5px 6px -6px black;
-moz-box-shadow: 0 5px 6px -6px black;
box-shadow: 0 5px 6px -6px black;
}
.left-v-gradient{
width:150px;
height:100%;
position: absolute;
top:0;
left:0;
z-index: 99;
background: -moz-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,0,0,1)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#00000000',GradientType=1 ); /* IE6-9 */
}
.right-v-gradient{
width:150px;
height:100%;
position: absolute;
top:0;
right:0;
z-index: 99;
background: -moz-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 1%, rgba(0,0,0,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,0,0,0)), color-stop(1%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,1) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=1 ); /* IE6-9 */
}
.legal-footer{
display: block;
color:#aaa;
text-align: center;
padding: 10px 0;
font-size:10px;
background-image:url(../img/ptrn.png);
}
.l-constrained{
width:992px;
margin: 0 auto;
padding: 0 30px;
}
.section-copy .community-description{
float:left;
width:520px;
font-size:14px;
color:#efede3;
}
.section-copy .community-description p{
margin-bottom:0;
}
.section-copy .windows-phone-store-download{
float: right;
text-decoration: none;
color: #fff;
color: #676465;
font-size: 24px;
margin: 25px 20px 20px 0;
transition: opacity 100ms linear;
background-image: url(../img/windows_logo.png);
width: 312px;
height: 81px;
background-size: 312px 81px;
opacity: 0.3;
}
.section-copy .windows-phone-store-download:hover{
opacity: 1;
}
#main_vid_container {
height: 100%;
width: 100%;
left: 0;
top: 0;
overflow: hidden;
}
video {
min-height: 100%!important;
min-width: 100%!important;
height: auto !important;
width: auto !important;
position: absolute; left: 0; top: 0;
}
.oggl-icon{
width:110px;
height:110px;
background-color:#aaa;
float:right;
width:115px;
height:115px;
background-size:115px 115px;
background-image: url(../img/pro_wp8_tile.png);
}
/* ==========================================================================
Helper classes
========================================================================== */
/*
* Image replacement
*/
.ir {
background-color: transparent;
border: 0;
overflow: hidden;
/* IE 6/7 fallback */
*text-indent: -9999px;
}
.ir:before {
content: "";
display: block;
width: 0;
height: 150%;
}
/*
* Hide from both screenreaders and browsers: h5bp.com/u
*/
.hidden {
display: none !important;
visibility: hidden;
}
/*
* Hide only visually, but have it available for screenreaders: h5bp.com/v
*/
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
/*
* Extends the .visuallyhidden class to allow the element to be focusable
* when navigated to via the keyboard: h5bp.com/p
*/
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
/*
* Hide visually and from screenreaders, but maintain layout
*/
.invisible {
visibility: hidden;
}
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.clearfix:before,
.clearfix:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.clearfix:after {
clear: both;
}
/*
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.clearfix {
*zoom: 1;
}
/* ==========================================================================
EXAMPLE Media Queries for Responsive Design.
These examples override the primary ('mobile first') styles.
Modify as content requires.
========================================================================== */
@media only screen and (min-width: 35em) {
/* Style adjustments for viewports that meet the condition */
}
@media print,
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) {
/* Style adjustments for high resolution devices */
}
/* ==========================================================================
Print styles.
Inlined to avoid required HTTP connection: h5bp.com/r
========================================================================== */
@media print {
* {
background: transparent !important;
color: #000 !important; /* Black prints faster: h5bp.com/s */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/*
* Don't show links for images, or javascript/internal links
*/
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group; /* h5bp.com/t */
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page {
margin: 0.5cm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
| {
"content_hash": "707aa25b4d00925f3505b14ba7652485",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 176,
"avg_line_length": 22.337004405286343,
"alnum_prop": 0.5592150675475791,
"repo_name": "JonathanMatthey/ogglpro",
"id": "65cccdbabd4d289538bbce84155cf06bd197861c",
"size": "10141",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "css/main.css",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "23090"
},
{
"name": "JavaScript",
"bytes": "794"
}
],
"symlink_target": ""
} |
package uk.gov.nationalarchives.droid.gui.action;
import uk.gov.nationalarchives.droid.gui.config.ListSignatureFilesAction;
import uk.gov.nationalarchives.droid.gui.config.InstallSignatureFileAction;
import uk.gov.nationalarchives.droid.gui.export.ExportAction;
import uk.gov.nationalarchives.droid.gui.report.ReportAction;
import uk.gov.nationalarchives.droid.gui.signature.CheckSignatureUpdateAction;
import uk.gov.nationalarchives.droid.gui.signature.UpdateSignatureAction;
/**
* @author rflitcroft
*
*/
public abstract class ActionFactory {
/**
* Gets a signature update action.
* @return a signature update action
*/
public abstract UpdateSignatureAction newSignaureUpdateAction();
/**
* Gets an action to check for signature updates.
* @return a signature update action
*/
public abstract CheckSignatureUpdateAction newCheckSignatureUpdateAction();
/**
* Gets a new profile action.
* @return a new profile action
*/
public abstract NewProfileAction newProfileAction();
/**
* @return a new export action
*/
public abstract ExportAction newExportAction();
/**
* @return a new report action
*/
public abstract ReportAction newReportAction();
/**
* @return a new action to List signature files
*/
public abstract ListSignatureFilesAction newListSignatureFilesAction();
/**
* @return a new action to install a signature file
*/
public abstract InstallSignatureFileAction newInstallSignatureFileAction();
}
| {
"content_hash": "93ca8ce628ef0737075f76c0e3ec5695",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 79,
"avg_line_length": 29.618181818181817,
"alnum_prop": 0.6967464702271332,
"repo_name": "digital-preservation/droid",
"id": "fa54f3d6eecb74f3ca0e64c2c8ab2ec646c85d2d",
"size": "3292",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "droid-swing-ui/src/main/java/uk/gov/nationalarchives/droid/gui/action/ActionFactory.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP.NET",
"bytes": "76"
},
{
"name": "ActionScript",
"bytes": "46"
},
{
"name": "Alloy",
"bytes": "81"
},
{
"name": "Arc",
"bytes": "6322"
},
{
"name": "Batchfile",
"bytes": "5582"
},
{
"name": "COBOL",
"bytes": "32"
},
{
"name": "GLSL",
"bytes": "5"
},
{
"name": "HTML",
"bytes": "280290"
},
{
"name": "Haskell",
"bytes": "992"
},
{
"name": "Java",
"bytes": "4140696"
},
{
"name": "JavaScript",
"bytes": "4"
},
{
"name": "JetBrains MPS",
"bytes": "16"
},
{
"name": "Mathematica",
"bytes": "12"
},
{
"name": "Papyrus",
"bytes": "6"
},
{
"name": "Perl",
"bytes": "7"
},
{
"name": "Portugol",
"bytes": "200"
},
{
"name": "PostScript",
"bytes": "8803"
},
{
"name": "Q#",
"bytes": "8"
},
{
"name": "Rich Text Format",
"bytes": "39"
},
{
"name": "Roff",
"bytes": "60"
},
{
"name": "RouterOS Script",
"bytes": "28"
},
{
"name": "Shell",
"bytes": "5250"
},
{
"name": "Squirrel",
"bytes": "24"
},
{
"name": "Standard ML",
"bytes": "16"
},
{
"name": "XSLT",
"bytes": "22975"
},
{
"name": "nesC",
"bytes": "8"
}
],
"symlink_target": ""
} |
package alluxio.cli;
import alluxio.AlluxioURI;
import alluxio.client.ReadType;
import alluxio.client.WriteType;
import alluxio.client.file.FileSystem;
import alluxio.client.file.options.DeleteOptions;
import alluxio.examples.BasicNonByteBufferOperations;
import alluxio.examples.BasicOperations;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.internal.Lists;
import java.util.Arrays;
import java.util.List;
import javax.annotation.concurrent.ThreadSafe;
/**
* Driver to run Alluxio tests.
*/
@ThreadSafe
public final class TestRunner {
/** Read types to test. */
private static final List<ReadType> READ_TYPES =
Arrays.asList(ReadType.CACHE_PROMOTE, ReadType.CACHE, ReadType.NO_CACHE);
/** Write types to test. */
private static final List<WriteType> WRITE_TYPES = Arrays
.asList(WriteType.MUST_CACHE, WriteType.CACHE_THROUGH, WriteType.THROUGH,
WriteType.ASYNC_THROUGH);
@Parameter(names = {"-h", "--help"}, description = "Prints usage information", help = true)
private boolean mHelp;
@Parameter(names = "--operation", description = "The operation to test, either BASIC or "
+ "BASIC_NON_BYTE_BUFFER. By default both operations are tested.")
private String mOperation;
@Parameter(names = "--readType",
description = "The read type to use. By default all readTypes are tested.")
private String mReadType;
@Parameter(names = "--writeType",
description = "The write type to use. By default all writeTypes are tested.")
private String mWriteType;
/**
* The operation types to test.
*/
enum OperationType {
/**
* Basic operations.
*/
BASIC,
/**
* Basic operations but not using ByteBuffer.
*/
BASIC_NON_BYTE_BUFFER,
}
private TestRunner() {} // prevent instantiation
/** Directory for the test generated files. */
public static final String TEST_PATH = "/default_tests_files";
/**
* Console program that validates the configuration.
*
* @param args there are no arguments needed
*/
public static void main(String[] args) throws Exception {
TestRunner runner = new TestRunner();
JCommander jCommander = new JCommander(runner, args);
jCommander.setProgramName("TestRunner");
if (runner.mHelp) {
jCommander.usage();
return;
}
AlluxioURI testDir = new AlluxioURI(TEST_PATH);
FileSystem fs = FileSystem.Factory.get();
if (fs.exists(testDir)) {
fs.delete(testDir, DeleteOptions.defaults().setRecursive(true).setUnchecked(true));
}
int ret = runner.runTests();
System.exit(ret);
}
/**
* Runs combinations of tests of operation, read and write type.
*
* @return the number of failed tests
*/
private int runTests() {
int failed = 0;
List<ReadType> readTypes =
mReadType == null ? READ_TYPES : Lists.newArrayList(ReadType.valueOf(mReadType));
List<WriteType> writeTypes =
mWriteType == null ? WRITE_TYPES : Lists.newArrayList(WriteType.valueOf(mWriteType));
List<OperationType> operations = mOperation == null ? Lists.newArrayList(OperationType.values())
: Lists.newArrayList(OperationType.valueOf(mOperation));
for (ReadType readType : readTypes) {
for (WriteType writeType : writeTypes) {
for (OperationType opType : operations) {
System.out.println(String.format("runTest %s %s %s", opType, readType, writeType));
failed += runTest(opType, readType, writeType);
}
}
}
if (failed > 0) {
System.out.println("Number of failed tests: " + failed);
}
return failed;
}
/**
* Runs a single test given operation, read and write type.
*
* @param opType operation type
* @param readType read type
* @param writeType write type
* @return 0 on success, 1 on failure
*/
private static int runTest(OperationType opType, ReadType readType, WriteType writeType) {
AlluxioURI filePath =
new AlluxioURI(String.format("%s/%s_%s_%s", TEST_PATH, opType, readType, writeType));
boolean result = true;
switch (opType) {
case BASIC:
result = CliUtils.runExample(new BasicOperations(filePath, readType, writeType));
break;
case BASIC_NON_BYTE_BUFFER:
result = CliUtils
.runExample(new BasicNonByteBufferOperations(filePath, readType, writeType, true, 20));
break;
default:
System.out.println("Unrecognized operation type " + opType);
}
return result ? 0 : 1;
}
}
| {
"content_hash": "754e7c952abea0f6c51be3b3d1809322",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 100,
"avg_line_length": 30.664429530201343,
"alnum_prop": 0.6784854453928649,
"repo_name": "Reidddddd/mo-alluxio",
"id": "48b388041d91bb666b5f74b751102a3a43b2d4e4",
"size": "5081",
"binary": false,
"copies": "3",
"ref": "refs/heads/kerberos",
"path": "examples/src/main/java/alluxio/cli/TestRunner.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "599"
},
{
"name": "Java",
"bytes": "6089346"
},
{
"name": "JavaScript",
"bytes": "1079"
},
{
"name": "Protocol Buffer",
"bytes": "15647"
},
{
"name": "Python",
"bytes": "11471"
},
{
"name": "Roff",
"bytes": "5796"
},
{
"name": "Ruby",
"bytes": "23034"
},
{
"name": "Shell",
"bytes": "111774"
},
{
"name": "Thrift",
"bytes": "39273"
}
],
"symlink_target": ""
} |
if(__COMPILER_XL)
return()
endif()
set(__COMPILER_XL 1)
include(Compiler/CMakeCommonCompilerMacros)
# Find the CreateExportList program that comes with this toolchain.
find_program(CMAKE_XL_CreateExportList
NAMES CreateExportList
DOC "IBM XL CreateExportList tool"
)
macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -g")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
# If we found the tool, we'll use it to create exports, otherwise stick with the regular
# create shared library compile line.
if (CMAKE_XL_CreateExportList)
# The compiler front-end passes all object files, archive files, and shared
# library files named on the command line to CreateExportList to create a
# list of all symbols to be exported from the shared library. This causes
# all archive members to be copied into the shared library whether they are
# needed or not. Instead we run the tool ourselves to pass only the object
# files so that we export only the symbols actually provided by the sources.
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
"<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
endmacro()
| {
"content_hash": "f17ad6af261e02de128fb3060c991714",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 252,
"avg_line_length": 49.951219512195124,
"alnum_prop": 0.71826171875,
"repo_name": "dava/dava.engine",
"id": "47837857081f0eb9ac1d8be7dd3d5159dea0f378",
"size": "2260",
"binary": false,
"copies": "3",
"ref": "refs/heads/development",
"path": "Bin/CMakeMac/CMake.app/Contents/share/cmake-3.9/Modules/Compiler/XL.cmake",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "166572"
},
{
"name": "Batchfile",
"bytes": "18562"
},
{
"name": "C",
"bytes": "61621347"
},
{
"name": "C#",
"bytes": "574524"
},
{
"name": "C++",
"bytes": "50229645"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "11439187"
},
{
"name": "CSS",
"bytes": "32773"
},
{
"name": "Cuda",
"bytes": "37073"
},
{
"name": "DIGITAL Command Language",
"bytes": "27303"
},
{
"name": "Emacs Lisp",
"bytes": "44259"
},
{
"name": "Fortran",
"bytes": "8835"
},
{
"name": "GLSL",
"bytes": "3726"
},
{
"name": "Go",
"bytes": "1235"
},
{
"name": "HTML",
"bytes": "8621333"
},
{
"name": "Java",
"bytes": "232072"
},
{
"name": "JavaScript",
"bytes": "2560"
},
{
"name": "Lua",
"bytes": "43080"
},
{
"name": "M4",
"bytes": "165145"
},
{
"name": "Makefile",
"bytes": "1349214"
},
{
"name": "Mathematica",
"bytes": "4633"
},
{
"name": "Module Management System",
"bytes": "15224"
},
{
"name": "Objective-C",
"bytes": "1909821"
},
{
"name": "Objective-C++",
"bytes": "498191"
},
{
"name": "Pascal",
"bytes": "99390"
},
{
"name": "Perl",
"bytes": "396608"
},
{
"name": "Python",
"bytes": "782784"
},
{
"name": "QML",
"bytes": "43105"
},
{
"name": "QMake",
"bytes": "156"
},
{
"name": "Roff",
"bytes": "71083"
},
{
"name": "Ruby",
"bytes": "22742"
},
{
"name": "SAS",
"bytes": "16030"
},
{
"name": "Shell",
"bytes": "2482394"
},
{
"name": "Slash",
"bytes": "117430"
},
{
"name": "Smalltalk",
"bytes": "5908"
},
{
"name": "TeX",
"bytes": "428489"
},
{
"name": "Vim script",
"bytes": "133255"
},
{
"name": "Visual Basic",
"bytes": "54056"
},
{
"name": "WebAssembly",
"bytes": "13987"
}
],
"symlink_target": ""
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
/// <summary>
/// Specifies the language version.
/// </summary>
public enum LanguageVersion
{
/// <summary>
/// C# language version 1
/// </summary>
CSharp1 = 1,
/// <summary>
/// C# language version 2
/// </summary>
CSharp2 = 2,
/// <summary>
/// C# language version 3
/// </summary>
/// <remarks>
/// Features: LINQ.
/// </remarks>
CSharp3 = 3,
/// <summary>
/// C# language version 4
/// </summary>
/// <remarks>
/// Features: dynamic.
/// </remarks>
CSharp4 = 4,
/// <summary>
/// C# language version 5
/// </summary>
/// <remarks>
/// Features: async, caller info attributes.
/// </remarks>
CSharp5 = 5,
/// <summary>
/// C# language version 6
/// </summary>
/// <remarks>
/// <para>Features:</para>
/// <list type="bullet">
/// <item><description>Using of a static class</description></item>
/// <item><description>Exception filters</description></item>
/// <item><description>Await in catch/finally blocks</description></item>
/// <item><description>Auto-property initializers</description></item>
/// <item><description>Expression-bodied methods and properties</description></item>
/// <item><description>Null-propagating operator ?.</description></item>
/// <item><description>String interpolation</description></item>
/// <item><description>nameof operator</description></item>
/// <item><description>Dictionary initializer</description></item>
/// </list>
/// </remarks>
CSharp6 = 6,
/// <summary>
/// C# language version 7.0
/// </summary>
/// <remarks>
/// <para>Features:</para>
/// <list type="bullet">
/// <item><description>Out variables</description></item>
/// <item><description>Pattern-matching</description></item>
/// <item><description>Tuples</description></item>
/// <item><description>Deconstruction</description></item>
/// <item><description>Discards</description></item>
/// <item><description>Local functions</description></item>
/// <item><description>Digit separators</description></item>
/// <item><description>Ref returns and locals</description></item>
/// <item><description>Generalized async return types</description></item>
/// <item><description>More expression-bodied members</description></item>
/// <item><description>Throw expressions</description></item>
/// </list>
/// </remarks>
CSharp7 = 7,
/// <summary>
/// C# language version 7.1
/// </summary>
/// <remarks>
/// <para>Features:</para>
/// <list type="bullet">
/// <item><description>Async Main</description></item>
/// <item><description>Default literal</description></item>
/// <item><description>Inferred tuple element names</description></item>
/// <item><description>Pattern-matching with generics</description></item>
/// </list>
/// </remarks>
CSharp7_1 = 701,
/// <summary>
/// C# language version 7.2
/// </summary>
/// <remarks>
/// <para>Features:</para>
/// <list type="bullet">
/// <item><description>Ref readonly</description></item>
/// <item><description>Ref and readonly structs</description></item>
/// <item><description>Ref extensions</description></item>
/// <item><description>Conditional ref operator</description></item>
/// <item><description>Private protected</description></item>
/// <item><description>Digit separators after base specifier</description></item>
/// <item><description>Non-trailing named arguments</description></item>
/// </list>
/// </remarks>
CSharp7_2 = 702,
/// <summary>
/// C# language version 7.3
/// </summary>
CSharp7_3 = 703,
/// <summary>
/// C# language version 8.0
/// </summary>
CSharp8 = 800,
/// <summary>
/// The latest major supported version.
/// </summary>
LatestMajor = int.MaxValue - 2,
/// <summary>
/// Preview of the next language version.
/// </summary>
Preview = int.MaxValue - 1,
/// <summary>
/// The latest supported version of the language.
/// </summary>
Latest = int.MaxValue,
/// <summary>
/// The default language version, which is the latest supported version.
/// </summary>
Default = 0,
}
internal static class LanguageVersionExtensionsInternal
{
internal static bool IsValid(this LanguageVersion value)
{
switch (value)
{
case LanguageVersion.CSharp1:
case LanguageVersion.CSharp2:
case LanguageVersion.CSharp3:
case LanguageVersion.CSharp4:
case LanguageVersion.CSharp5:
case LanguageVersion.CSharp6:
case LanguageVersion.CSharp7:
case LanguageVersion.CSharp7_1:
case LanguageVersion.CSharp7_2:
case LanguageVersion.CSharp7_3:
case LanguageVersion.CSharp8:
case LanguageVersion.Preview:
return true;
}
return false;
}
internal static ErrorCode GetErrorCode(this LanguageVersion version)
{
switch (version)
{
case LanguageVersion.CSharp1:
return ErrorCode.ERR_FeatureNotAvailableInVersion1;
case LanguageVersion.CSharp2:
return ErrorCode.ERR_FeatureNotAvailableInVersion2;
case LanguageVersion.CSharp3:
return ErrorCode.ERR_FeatureNotAvailableInVersion3;
case LanguageVersion.CSharp4:
return ErrorCode.ERR_FeatureNotAvailableInVersion4;
case LanguageVersion.CSharp5:
return ErrorCode.ERR_FeatureNotAvailableInVersion5;
case LanguageVersion.CSharp6:
return ErrorCode.ERR_FeatureNotAvailableInVersion6;
case LanguageVersion.CSharp7:
return ErrorCode.ERR_FeatureNotAvailableInVersion7;
case LanguageVersion.CSharp7_1:
return ErrorCode.ERR_FeatureNotAvailableInVersion7_1;
case LanguageVersion.CSharp7_2:
return ErrorCode.ERR_FeatureNotAvailableInVersion7_2;
case LanguageVersion.CSharp7_3:
return ErrorCode.ERR_FeatureNotAvailableInVersion7_3;
case LanguageVersion.CSharp8:
return ErrorCode.ERR_FeatureNotAvailableInVersion8;
default:
throw ExceptionUtilities.UnexpectedValue(version);
}
}
}
internal class CSharpRequiredLanguageVersion : RequiredLanguageVersion
{
internal LanguageVersion Version { get; }
internal CSharpRequiredLanguageVersion(LanguageVersion version)
{
Version = (version == LanguageVersion.Preview.MapSpecifiedToEffectiveVersion()) ? LanguageVersion.Preview : version;
}
public override string ToString() => Version.ToDisplayString();
}
public static class LanguageVersionFacts
{
/// <summary>
/// Displays the version number in the format expected on the command-line (/langver flag).
/// For instance, "6", "7", "7.1", "latest".
/// </summary>
public static string ToDisplayString(this LanguageVersion version)
{
switch (version)
{
case LanguageVersion.CSharp1:
return "1";
case LanguageVersion.CSharp2:
return "2";
case LanguageVersion.CSharp3:
return "3";
case LanguageVersion.CSharp4:
return "4";
case LanguageVersion.CSharp5:
return "5";
case LanguageVersion.CSharp6:
return "6";
case LanguageVersion.CSharp7:
return "7.0";
case LanguageVersion.CSharp7_1:
return "7.1";
case LanguageVersion.CSharp7_2:
return "7.2";
case LanguageVersion.CSharp7_3:
return "7.3";
case LanguageVersion.CSharp8:
return "8.0";
case LanguageVersion.Default:
return "default";
case LanguageVersion.Latest:
return "latest";
case LanguageVersion.LatestMajor:
return "latestmajor";
case LanguageVersion.Preview:
return "preview";
default:
throw ExceptionUtilities.UnexpectedValue(version);
}
}
/// <summary>
/// Try parse a <see cref="LanguageVersion"/> from a string input, returning default if input was null.
/// </summary>
public static bool TryParse(string version, out LanguageVersion result)
{
if (version == null)
{
result = LanguageVersion.Default;
return true;
}
switch (CaseInsensitiveComparison.ToLower(version))
{
case "default":
result = LanguageVersion.Default;
return true;
case "latest":
result = LanguageVersion.Latest;
return true;
case "latestmajor":
result = LanguageVersion.LatestMajor;
return true;
case "preview":
result = LanguageVersion.Preview;
return true;
case "1":
case "1.0":
case "iso-1":
result = LanguageVersion.CSharp1;
return true;
case "2":
case "2.0":
case "iso-2":
result = LanguageVersion.CSharp2;
return true;
case "3":
case "3.0":
result = LanguageVersion.CSharp3;
return true;
case "4":
case "4.0":
result = LanguageVersion.CSharp4;
return true;
case "5":
case "5.0":
result = LanguageVersion.CSharp5;
return true;
case "6":
case "6.0":
result = LanguageVersion.CSharp6;
return true;
case "7":
case "7.0":
result = LanguageVersion.CSharp7;
return true;
case "7.1":
result = LanguageVersion.CSharp7_1;
return true;
case "7.2":
result = LanguageVersion.CSharp7_2;
return true;
case "7.3":
result = LanguageVersion.CSharp7_3;
return true;
case "8":
case "8.0":
result = LanguageVersion.CSharp8;
return true;
default:
result = LanguageVersion.Default;
return false;
}
}
/// <summary>
/// Map a language version (such as Default, Latest, or CSharpN) to a specific version (CSharpM).
/// </summary>
public static LanguageVersion MapSpecifiedToEffectiveVersion(this LanguageVersion version)
{
switch (version)
{
case LanguageVersion.Latest:
case LanguageVersion.Default:
case LanguageVersion.LatestMajor:
return LanguageVersion.CSharp8;
default:
return version;
}
}
internal static LanguageVersion CurrentVersion => LanguageVersion.CSharp8;
/// <summary>Inference of tuple element names was added in C# 7.1</summary>
internal static bool DisallowInferredTupleElementNames(this LanguageVersion self)
{
return self < MessageID.IDS_FeatureInferredTupleNames.RequiredVersion();
}
internal static bool AllowNonTrailingNamedArguments(this LanguageVersion self)
{
return self >= MessageID.IDS_FeatureNonTrailingNamedArguments.RequiredVersion();
}
internal static bool AllowAttributesOnBackingFields(this LanguageVersion self)
{
return self >= MessageID.IDS_FeatureAttributesOnBackingFields.RequiredVersion();
}
internal static bool AllowImprovedOverloadCandidates(this LanguageVersion self)
{
return self >= MessageID.IDS_FeatureImprovedOverloadCandidates.RequiredVersion();
}
}
}
| {
"content_hash": "99995c8d43db98844cca9ee1446aa8f1",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 128,
"avg_line_length": 35.51150895140665,
"alnum_prop": 0.5274756931940944,
"repo_name": "abock/roslyn",
"id": "e42f199084be43a13792732b7dad4f0fc73f785b",
"size": "13887",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Compilers/CSharp/Portable/LanguageVersion.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "289100"
},
{
"name": "Batchfile",
"bytes": "9059"
},
{
"name": "C#",
"bytes": "126276814"
},
{
"name": "C++",
"bytes": "5602"
},
{
"name": "CMake",
"bytes": "8276"
},
{
"name": "Dockerfile",
"bytes": "2450"
},
{
"name": "F#",
"bytes": "549"
},
{
"name": "PowerShell",
"bytes": "236203"
},
{
"name": "Shell",
"bytes": "94929"
},
{
"name": "Visual Basic .NET",
"bytes": "70520200"
}
],
"symlink_target": ""
} |
//Version 1.0
/**
* highlightRow and highlight are used to show a visual feedback. If the row has been successfully modified, it will be highlighted in green. Otherwise, in red
*/
function highlightRow(rowId, bgColor, after)
{
var rowSelector = $("#" + rowId);
rowSelector.css("background-color", bgColor);
rowSelector.fadeTo("normal", 0.5, function() {
rowSelector.fadeTo("fast", 1, function() {
rowSelector.css("background-color", '');
});
});
}
function highlight(div_id, style) {
highlightRow(div_id, style == "error" ? "#e5afaf" : style == "warning" ? "#ffcc00" : "#999999");
}
/**
updateCellValue calls the PHP script that will update the database.
*/
function updateCellValue(EditableGrid, rowIndex, columnIndex, oldValue, newValue, row, onResponse)
{
$.ajax({
url: 'update.php',
type: 'POST',
dataType: "html",
data: {
tablename : EditableGrid.name,
id: EditableGrid.getRowId(rowIndex),
newvalue: EditableGrid.getColumnType(columnIndex) == "boolean" ? (newValue ? 1 : 0) : newValue,
colname: EditableGrid.getColumnName(columnIndex),
coltype: EditableGrid.getColumnType(columnIndex)
},
success: function (response)
{
// reset old value if failed then highlight row
var success = onResponse ? onResponse(response) : (response == "ok" || !isNaN(parseInt(response))); // by default, a sucessfull reponse can be "ok" or a database id
if (!success) EditableGrid.setValueAt(rowIndex, columnIndex, oldValue);
highlight(row.id, success ? "ok" : "error");
},
error: function(XMLHttpRequest, textStatus, exception) { alert("Ajax failure\n" + errortext); },
async: true
});
}
function DatabaseGrid()
{
this.EditableGrid = new EditableGrid("OwnTracks_Waypoint", {
enableSort: true,
// define the number of row visible by page
pageSize: 25,
// Once the table is displayed, we update the paginator state
tableRendered: function() { updatePaginator(this); },
tableLoaded: function() { datagrid.initializeGrid(this); },
modelChanged: function(rowIndex, columnIndex, oldValue, newValue, row) {
updateCellValue(this, rowIndex, columnIndex, oldValue, newValue, row);
}
});
this.fetchGrid();
}
DatabaseGrid.prototype.fetchGrid = function() {
// call a PHP script to get the data
this.EditableGrid.loadJSON("loaddata_owntracks_waypoints.php?db_tablename=OwnTracks_Waypoint");
};
DatabaseGrid.prototype.initializeGrid = function(grid) {
var self = this;
// render for the action column
grid.setCellRenderer("action", new CellRenderer({
render: function(cell, value) {
cell.innerHTML+= "<i onclick=\"datagrid.deleteRow('"+value+"');\" class='fa fa-trash-o red' ></i>";
}
}));
grid.renderGrid("tablecontent", "iRulez");
};
DatabaseGrid.prototype.deleteRow = function(id)
{
var self = this;
if ( confirm(Owntrack_WP_delete.replace('$', id)) ) {
$.ajax({
url: 'delete.php',
type: 'POST',
dataType: "html",
data: {
tablename : self.EditableGrid.name,
id: id
},
success: function (response)
{
if (response == "ok" )
self.EditableGrid.removeRow(id);
},
error: function(XMLHttpRequest, textStatus, exception) { alert("Ajax failure\n" + errortext); },
async: true
});
}
};
DatabaseGrid.prototype.addRow = function(id)
{
var self = this;
$.ajax({
url: 'add_owntracks_waypoints.php',
type: 'POST',
dataType: "html",
data: {
tablename : self.EditableGrid.name,
naam: $("#naam").val(),
description: $("#description").val(),
},
success: function (response)
{
if (response == "ok" ) {
// hide form
showAddForm();
alert(Owntrack_WP_add);
$("#naam").val('');
$("#description").val(''),
self.fetchGrid();
}
else
alert(response);
},
error: function(XMLHttpRequest, textStatus, exception) { alert("Ajax failure\n" + errortext); },
async: true
});
};
function updatePaginator(grid, divId)
{
divId = divId || "paginator";
var paginator = $("#" + divId).empty();
var nbPages = grid.getPageCount();
// get interval
var interval = grid.getSlidingPageInterval(20);
if (interval == null) return;
// get pages in interval (with links except for the current page)
var pages = grid.getPagesInInterval(interval, function(pageIndex, isCurrent) {
if (isCurrent) return "<span id='currentpageindex'>" + (pageIndex + 1) +"</span>";
return $("<a>").css("cursor", "pointer").html(pageIndex + 1).click(function(event) { grid.setPageIndex(parseInt($(this).html()) - 1); });
});
// "first" link
var link = $("<a class='nobg'>").html("<i class='fa fa-fast-backward'></i>");
if (!grid.canGoBack()) link.css({ opacity : 0.4, filter: "alpha(opacity=40)" });
else link.css("cursor", "pointer").click(function(event) { grid.firstPage(); });
paginator.append(link);
// "prev" link
link = $("<a class='nobg'>").html("<i class='fa fa-backward'></i>");
if (!grid.canGoBack()) link.css({ opacity : 0.4, filter: "alpha(opacity=40)" });
else link.css("cursor", "pointer").click(function(event) { grid.prevPage(); });
paginator.append(link);
// pages
for (p = 0; p < pages.length; p++) paginator.append(pages[p]).append(" ");
// "next" link
link = $("<a class='nobg'>").html("<i class='fa fa-forward'>");
if (!grid.canGoForward()) link.css({ opacity : 0.4, filter: "alpha(opacity=40)" });
else link.css("cursor", "pointer").click(function(event) { grid.nextPage(); });
paginator.append(link);
// "last" link
link = $("<a class='nobg'>").html("<i class='fa fa-fast-forward'>");
if (!grid.canGoForward()) link.css({ opacity : 0.4, filter: "alpha(opacity=40)" });
else link.css("cursor", "pointer").click(function(event) { grid.lastPage(); });
paginator.append(link);
};
function showAddForm() {
if ( $("#addform").is(':visible') )
$("#addform").hide();
else
$("#addform").show();
}
$('select').change(function() {
if ($(this).children('option:first-child').is(':selected')) {
$(this).addClass('placeholder');
} else {
$(this).removeClass('placeholder');
}
});
| {
"content_hash": "4df75adf73b9055329a967bd9e1a1d9e",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 168,
"avg_line_length": 27.782222222222224,
"alnum_prop": 0.6272596384578467,
"repo_name": "deklungel/iRulez",
"id": "9d94469fc1ce9070759e9c84df9931aa6d8e7fc5",
"size": "6251",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "old/js/owntracks_waypoints.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "11720"
},
{
"name": "CSS",
"bytes": "318238"
},
{
"name": "HTML",
"bytes": "1697"
},
{
"name": "JavaScript",
"bytes": "522119"
},
{
"name": "PHP",
"bytes": "281732"
},
{
"name": "Python",
"bytes": "1529251"
},
{
"name": "Roff",
"bytes": "111150693"
}
],
"symlink_target": ""
} |
<configuration>
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
</encoder>
</appender>
<!-- <property name="LOG_DIR" value="/var/log/application" /> <appender
name="FILE" class="ch.qos.logback.core.FileAppender"> <file>${LOG_DIR}/tests.log</file> -->
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>tests.log</file>
<append>false</append>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n
</pattern>
</encoder>
</appender>
<appender name="STDERR"
class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target>
<encoder>
<pattern>%date [%thread] - 5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDERR" />
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration> | {
"content_hash": "2475bd1164e9986f2648b1ab906cc5f3",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 93,
"avg_line_length": 30.90625,
"alnum_prop": 0.6339737108190091,
"repo_name": "MyRobotLab/myrobotlab",
"id": "d9e7c6f07fd44c6a18d7b09142c71c6f582740b7",
"size": "989",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/test/resources/logback.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1542"
},
{
"name": "C",
"bytes": "6677"
},
{
"name": "C++",
"bytes": "274868"
},
{
"name": "CSS",
"bytes": "83744"
},
{
"name": "GLSL",
"bytes": "757"
},
{
"name": "HTML",
"bytes": "374401"
},
{
"name": "Java",
"bytes": "7100082"
},
{
"name": "JavaScript",
"bytes": "1536187"
},
{
"name": "Propeller Spin",
"bytes": "14406"
},
{
"name": "Python",
"bytes": "191671"
},
{
"name": "Shell",
"bytes": "3547"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.