text stringlengths 2 1.04M | meta dict |
|---|---|
namespace EPI.Strings
{
/// <summary>
/// Reverse all words in a sentence
/// e.g. "Alice likes Bob" transforms to "Bob likes Alice"
/// Preserve the sequence of whitespaces from the original string
/// e.g. " Hello World " transforms to " World Hello "
/// </summary>
public static class WordsReversal
{
public static string ReverseWords(string input)
{
if (null != input)
{
// use char[] to modify values at specific indices
char[] inputCharArray = input.ToCharArray();
// first pass: let reverse the entire string
Reverse(inputCharArray, 0, input.Length - 1);
// second pass : traverse the string and reverse each word
const char wordDelimiter = ' ';
int wordStart = 0;
for (int i = 0; i < inputCharArray.Length; i++)
{
if (inputCharArray[i] == wordDelimiter)
{
Reverse(inputCharArray, wordStart, i - 1);
wordStart = i + 1;
}
}
// the string may not have ended with a delimiter, so reverse the last remaining word
Reverse(inputCharArray, wordStart, inputCharArray.Length - 1);
input = new string(inputCharArray);
}
return input;
}
private static void Reverse(char[] input, int start, int end)
{
while (start < end)
{
Swap(input, start, end);
start++;
end--;
}
}
// Use XOR trick to swap in-place without additional storage
private static void Swap(char[] input, int i, int j)
{
input[i] ^= input[j];
input[j] ^= input[i];
input[i] ^= input[j];
}
}
}
| {
"content_hash": "a246ef0947571f2276e79d49a7888bca",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 89,
"avg_line_length": 25.216666666666665,
"alnum_prop": 0.6311962987442168,
"repo_name": "dipakboyed/epibook.github.io.Puzzles",
"id": "ae3c1e29db21917022c13ce0fb494cfa81770a3c",
"size": "1515",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EPIProblems/Strings/WordsReversal.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "386385"
}
],
"symlink_target": ""
} |
title: Daily Lesson
date: 12/06/2017
---
### <center>We are working on this lesson</center>
<center>Please come back later</center> | {
"content_hash": "be56ef648b4171c241347bc4b5931ca6",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 50,
"avg_line_length": 22.5,
"alnum_prop": 0.7037037037037037,
"repo_name": "imasaru/sabbath-school-lessons",
"id": "4c949dff500ec273cb642a4f72cfebdcf3d2c7b9",
"size": "139",
"binary": false,
"copies": "3",
"ref": "refs/heads/stage",
"path": "src/en/2017-02-cq/12/03.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "160533"
},
{
"name": "HTML",
"bytes": "20725"
},
{
"name": "JavaScript",
"bytes": "54661"
}
],
"symlink_target": ""
} |
var registerGeometry = require('../core/geometry').registerGeometry;
var THREE = require('../lib/three');
registerGeometry('tetrahedron', {
schema: {
detail: {default: 0, min: 0, max: 5, type: 'int'},
radius: {default: 1, min: 0}
},
init: function (data) {
this.geometry = new THREE.TetrahedronGeometry(data.radius, data.detail);
}
});
| {
"content_hash": "244f0ab2cab2d992baf78b899e0f79b2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 27.53846153846154,
"alnum_prop": 0.6480446927374302,
"repo_name": "dmarcos/aframe",
"id": "829ae5455eac5d0eda7b4f20daeefdc17937e44c",
"size": "358",
"binary": false,
"copies": "18",
"ref": "refs/heads/master",
"path": "src/geometries/tetrahedron.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11509"
},
{
"name": "HTML",
"bytes": "2071"
},
{
"name": "JavaScript",
"bytes": "1075187"
}
],
"symlink_target": ""
} |
package nu.nerd.beastmaster.zones;
import java.util.ArrayList;
import java.util.List;
import nu.nerd.beastmaster.zones.nodes.AndExpression;
import nu.nerd.beastmaster.zones.nodes.NotExpression;
import nu.nerd.beastmaster.zones.nodes.NumberExpression;
import nu.nerd.beastmaster.zones.nodes.OrExpression;
import nu.nerd.beastmaster.zones.nodes.PredicateExpression;
import nu.nerd.beastmaster.zones.nodes.StringExpression;
import nu.nerd.beastmaster.zones.nodes.XorExpression;
// ----------------------------------------------------------------------------
/**
* Recursive descent parser for Zone Specifications.
*
* The EBNF syntax of the Zone Specification Language is as follows:
*
* <pre>
* desc ::= or-expr EOF
* or-expr ::= xor-expr ( '|' xor-expr )*
* xor-expr ::= and-expr ( '^' and-expr )*
* and-expr ::= primary ( '&' primary )*
* primary ::= pred | '(' or-expr ')' | '!' primary
* pred ::= ident '(' ( arg ( ',' arg )* )? ')'
* arg ::= number | string
* </pre>
*/
public class Parser {
// ------------------------------------------------------------------------
/**
* Main program for informal testing.
*
* @param args
*/
public static void main(String[] args) {
test("circle(0,0,500)");
test("biome(\"END_BARRENS\")");
test("!donut(0,0,500,600) | !y(1,5) ^ biome(\"END_BARRENS\") & wg(\"test\")");
test("!biome(\"END_BARRENS\") & !wg(\"test\") ^ (circle(1000,1000,200) | circle(500,-500,200))");
}
// ------------------------------------------------------------------------
/**
* Parse the specified input for informal testing.
*
* @param input the Zone Specification to parse.
*/
static void test(String input) {
Lexer lexer = null;
try {
lexer = new Lexer(input);
Parser parser = new Parser(lexer);
Expression expr = parser.parse();
// Print expression.
FormatExpressionVisitor debug = new FormatExpressionVisitor();
StringBuilder sb = new StringBuilder();
expr.visit(debug, sb);
System.out.println("Expr: " + sb.toString());
// Evaluate, with tracing.
EvalExpressionVisitor eval = new EvalExpressionVisitor(sb);
sb.setLength(0);
eval.showBoolean(sb, (Boolean) expr.visit(eval, null));
System.out.println("Eval: " + sb.toString());
} catch (ParseError ex) {
int errorColumn = ex.getToken().getColumn();
int errorStart = errorColumn - 1;
int errorEnd = Math.min(input.length(), errorStart + ex.getToken().getLength());
System.out.println(input.substring(0, errorStart) + ">>>" +
input.substring(errorStart, errorEnd) +
"<<<" + input.substring(errorEnd));
System.out.println("\nERROR: column " + errorColumn +
": " + ex.getMessage());
}
}
// ------------------------------------------------------------------------
/**
* Constructor.
*
* @param lexer the Lexer used to extract tokens from the input.
*/
public Parser(Lexer lexer) {
_lexer = lexer;
}
// ------------------------------------------------------------------------
/**
* Return an {@link Expression} representing a Zone Specification in the
* parsed input.
*
* The EBNF syntax rule describing the part of the Zone Specification parsed
* by this method is:
*
* <pre>
* desc ::= or-expr EOF
* </pre>
*
* @return an {@link Expression} representing a Zone Specification in the
* parsed input.
*/
public Expression parse() {
Expression expr = orExpr();
expect(Token.Type.END);
return expr;
}
// ------------------------------------------------------------------------
/**
* The EBNF syntax rule describing the part of the Zone Specification parsed
* by this method is:
*
* <pre>
* or-expr ::= xor-expr ( '|' xor-expr )*
* </pre>
*/
Expression orExpr() {
Expression left = xorExpr();
if (have(Token.Type.OR)) {
Expression operator = new OrExpression();
operator.addChild(left);
while (take(Token.Type.OR)) {
operator.addChild(xorExpr());
}
return operator;
} else {
return left;
}
}
// ------------------------------------------------------------------------
/**
* The EBNF syntax rule describing the part of the Zone Specification parsed
* by this method is:
*
* <pre>
* xor-expr ::= and-expr ( '^' and-expr )*
* </pre>
*/
Expression xorExpr() {
Expression left = andExpr();
if (have(Token.Type.XOR)) {
Expression operator = new XorExpression();
operator.addChild(left);
while (take(Token.Type.XOR)) {
operator.addChild(andExpr());
}
return operator;
} else {
return left;
}
}
// ------------------------------------------------------------------------
/**
* The EBNF syntax rule describing the part of the Zone Specification parsed
* by this method is:
*
* <pre>
* and-expr ::= primary ( '&' primary )*
* </pre>
*/
Expression andExpr() {
Expression left = primary();
if (have(Token.Type.AND)) {
Expression operator = new AndExpression();
operator.addChild(left);
while (take(Token.Type.AND)) {
operator.addChild(primary());
}
return operator;
} else {
return left;
}
}
// ------------------------------------------------------------------------
/**
* The EBNF syntax rule describing the part of the Zone Specification parsed
* by this method is:
*
* <pre>
* primary ::= pred | '(' or-expr ')' | '!' primary
* </pre>
*/
Expression primary() {
if (have(Token.Type.IDENT)) {
// Don't consume IDENT here. Let predicate() do it.
return predicate();
} else if (take(Token.Type.L_PAREN)) {
Expression expr = orExpr();
expect(Token.Type.R_PAREN);
return expr;
} else if (take(Token.Type.NOT)) {
Expression not = new NotExpression();
not.addChild(primary());
return not;
} else {
throw new ParseError("expecting parentheses, ! or a predicate, but got " + _lexer.current(),
_lexer.current());
}
}
// ------------------------------------------------------------------------
/**
* The EBNF syntax rule describing the part of the Zone Specification parsed
* by this method is:
*
* <pre>
* pred ::= ident '(' ( arg ( ',' arg )* )? ')'
* arg ::= number | string
* </pre>
*
* Note that predicates can take zero or more arguments.
*/
Expression predicate() {
Token ident = expect(Token.Type.IDENT);
PredicateExpression predExpr = new PredicateExpression(ident.getText());
expect(Token.Type.L_PAREN);
List<Token> argTokens = new ArrayList<>();
do {
if (have(Token.Type.NUMBER) || have(Token.Type.STRING)) {
argTokens.add(take());
}
} while (take(Token.Type.COMMA));
if (have(Token.Type.IDENT)) {
// Don't call take() so we avoid parsing next character, e.g.
// '_' in END_BARRENS.
Token unexpected = _lexer.current();
throw new ParseError("got an identifier when expecting a string or number (did you forget to put double quotes around a string?)",
unexpected);
}
Token rParen = expect(Token.Type.R_PAREN);
// Validate number and types of arguments before expecting the R_PAREN
// for a more informative error message.
ZonePredicate zonePred = ZonePredicate.byIdent(predExpr.getIdent());
if (zonePred == null) {
// TODO: replace ParseError with a call to an error() function with
// an error ID to allow us to show suggestions for predicate names.
throw new ParseError("unknown predicate \"" + predExpr.getIdent() + "\"", ident);
}
int expectedArgCount = zonePred.getParameters().size();
if (expectedArgCount != argTokens.size()) {
String plural = (expectedArgCount == 1) ? "" : "s";
throw new ParseError("expecting " + expectedArgCount +
" predicate argument" + plural + " but got " + argTokens.size(),
rParen);
}
zonePred.getParameters().validateTypes(argTokens);
for (int i = 0; i < argTokens.size(); ++i) {
Token token = argTokens.get(i);
if (token.getType() == Token.Type.NUMBER) {
predExpr.addChild(new NumberExpression(token.getDouble()));
} else { // (token.getType() == Token.Type.STRING)
predExpr.addChild(new StringExpression((String) token.getValue()));
}
predExpr.args.add(token.getValue());
}
try {
zonePred.validateArgs(argTokens, predExpr.args);
} catch (ParseError ex) {
throw new ParseError("invalid arguments to " + predExpr.getIdent() +
"(): " + ex.getMessage(),
ex.getToken());
}
return predExpr;
}
// ------------------------------------------------------------------------
/**
* Return true if the current token has the specified type.
*
* @param tokenType the type of the token.
* @return true if the current token matched.
*/
boolean have(Token.Type tokenType) {
return (_lexer.current().getType() == tokenType);
}
// ------------------------------------------------------------------------
/**
* If the current token has the specified type, advance to the next Token
* and return true.
*
* Otherwise, don't advance and return false.
*
* @param tokenType the type of Token to take.
* @return true if the current token matched.
*/
boolean take(Token.Type tokenType) {
if (have(tokenType)) {
_lexer.next();
return true;
} else {
return false;
}
}
// ------------------------------------------------------------------------
/**
* Return the current token and advance the Lexer to the next token.
*
* @return the current token.
*/
Token take() {
Token token = _lexer.current();
_lexer.next();
return token;
}
// ------------------------------------------------------------------------
/**
* Throw a ParseError if the current token is not of the expected type.
*
* @return the expected Token and advance to the next Token.
* @throws ParseError if the expected Token cannot be taken.
*/
Token expect(Token.Type tokenType) {
Token token = _lexer.current();
if (take(tokenType)) {
return token;
} else {
Token current = _lexer.current();
if (current.getType() == Token.Type.END) {
throw new ParseError("unexpected end of input (forgot to close your parentheses?)", current);
}
throw new ParseError("got " + current + " when expecting " + tokenType.asExpected(), current);
}
}
// ------------------------------------------------------------------------
/**
* The Lexer.
*/
protected Lexer _lexer;
} // class Parser | {
"content_hash": "2d2d65c5f1d014230d2e09aba0e6fb89",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 142,
"avg_line_length": 34.51724137931034,
"alnum_prop": 0.49009324009324007,
"repo_name": "NerdNu/BeastMaster",
"id": "b7fcecbf3b3d6ff909c94dea83f1a3514aafe721",
"size": "12012",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/nu/nerd/beastmaster/zones/Parser.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "519598"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for RxJS/dist/cjs/operators/zip-static.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../../../../prettify.css">
<link rel="stylesheet" href="../../../../base.css">
<style type='text/css'>
div.coverage-summary .sorter {
background-image: url(../../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">RxJS/dist/cjs/operators/zip-static.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(15 / 15)</small></span>
Branches: <span class="metric">83.33% <small>(5 / 6)</small></span>
Functions: <span class="metric">100% <small>(2 / 2)</small></span>
Lines: <span class="metric">100% <small>(14 / 14)</small></span>
Ignored: <span class="metric"><span class="ignore-none">none</span></span>
</h2>
<div class="path"><a href="../../../../index.html">All files</a> » <a href="index.html">RxJS/dist/cjs/operators/</a> » zip-static.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26</td><td class="line-coverage"><span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">43</span>
<span class="cline-any cline-yes">100</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">43</span>
<span class="cline-any cline-yes">43</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">43</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
exports.__esModule = true;
exports['default'] = zip;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? <span class="branch-0 cbranch-no" title="branch not covered" >obj </span>: { 'default': obj }; }
var _observablesArrayObservable = require('../observables/ArrayObservable');
var _observablesArrayObservable2 = _interopRequireDefault(_observablesArrayObservable);
var _zipSupport = require('./zip-support');
function zip() {
for (var _len = arguments.length, observables = Array(_len), _key = 0; _key < _len; _key++) {
observables[_key] = arguments[_key];
}
var project = observables[observables.length - 1];
if (typeof project === 'function') {
observables.pop();
}
return new _observablesArrayObservable2['default'](observables).lift(new _zipSupport.ZipOperator(project));
}
module.exports = exports['default'];</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Oct 14 2015 19:04:36 GMT-0700 (PDT)</div>
</div>
<script src="../../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../../sorter.js"></script>
</body>
</html>
| {
"content_hash": "569fd54a165996252b21d7a823a8e229",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 174,
"avg_line_length": 34.483333333333334,
"alnum_prop": 0.6483808603189947,
"repo_name": "iproduct/ipt-angular2-reactive-websocket-demo",
"id": "84738c9777f15a2e7a7faa3477d129e9e009e662",
"size": "4138",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "IPT_Reactor_Demo_JUG_Wishes_1_0/src/main/webapp/node_modules/angular2/node_modules/@reactivex/rxjs/coverage/lcov-report/RxJS/dist/cjs/operators/zip-static.js.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1387"
},
{
"name": "Java",
"bytes": "7695"
},
{
"name": "JavaScript",
"bytes": "137640"
},
{
"name": "TypeScript",
"bytes": "8179"
}
],
"symlink_target": ""
} |
/** @file
* @brief Generic data compression/decompression handling (RLE) implementation
*/
/** @addtogroup iolib_he
* @{
*/
#ifndef _IOLIB_HELIUM_MEMORY_COMPRESSION_H_
#define _IOLIB_HELIUM_MEMORY_COMPRESSION_H_
#include "he.memory.dynbuff.h"
/// Generic data compression/decompression handling (RLE)
class iRLE
{
public:
/// Compresses source buffer using RLE compression
static bool Compress(const iDynamicBuffer& src, iDynamicBuffer& dst);
/// Decompresses RLE compressed source buffer
static bool Decompress(const iDynamicBuffer& src, iDynamicBuffer& dst);
};
#endif //_IOLIB_HELIUM_MEMORY_COMPRESSION_H_
/** @} */ // iolib_he
| {
"content_hash": "9cb84660d26cbb67fc0a1b2c9c0ec18b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 26.84,
"alnum_prop": 0.7078986587183308,
"repo_name": "Reynmar/pocketheroes",
"id": "ac19d0680af7ff7a1b0f319df73c6f10778622b7",
"size": "1449",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "iolib/He/he.memory.compress.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "1097"
},
{
"name": "C",
"bytes": "5323503"
},
{
"name": "C++",
"bytes": "3659975"
},
{
"name": "NSIS",
"bytes": "2200"
},
{
"name": "Shell",
"bytes": "5897"
}
],
"symlink_target": ""
} |
layout: default
title: ICCSTE'19 - 4th International Conference on Civil, Structural and Transportation Engineering (ICCSTE)
meta: 4th International Conference on Civil, Structural and Transportation Engineering (ICCSTE 2019). This conference covers different topics such as Geotechnical Research, Structural Engineering, Traffic Engineering, Air, Soli, Water, and wastewater pollution and treatment, Global Warming, and Climate Change, desalination.
keyword: Civil Engineering Conference, Civil Engineering Conference 2019, Geotechnical Conference 2019, Structural Engineering Conference 2019, Structural Engineering Conference ,Environmental Engineering Conference, Environmental Engineering Conference 2019, Geotechnical Research Conference, Structural Engineering Conference, Traffic Engineering Conference, Air, Soli, Water, and wastewater pollution and treatment, Global Warming, environmental conferences, environmental conferences 2019
---
<div class="unit unit-s-1 unit-m-1-4-1 unit-l-1-4-1">
<div class="unit-spacer content">
<p class="announcement-text" align="center" style="color:#0078B3"><strong>The conference proceedings of this conference will be indexed by Scopus and Google Scholar.</strong></p>
<p class="body"><strong>The 4<sup>th</sup> International Conference on Civil, Structural and Transportation Engineering (ICCSTE'19) aims to become the leading annual conference in fields related to civil, structural, and transportation engineering.</strong> The goal of ICCSTE'19 is to gather scholars from all over the world to present advances in the relavant fields and to foster an environment conducive to exchanging ideas and information. This conference will also provide an ideal environment to develop new collaborations and meet experts on the fundamentals, applications, and products of the mentioned fields.</p>
<p class="body"><b>ICCSTE</b> is an acronym for <b>I</b>nternational <b>C</b>onference on <b>C</b>ivil, <b>S</b>tructural and <b>T</b>ransportation <b>E</b>ngineering.</p>
<br>
<h2>Submissions</h2>
<p class="body">Submissions in the form of extended abstracts, short papers, and full manuscripts are welcome.</p>
<ul>
<li>all submitted papers will be <strong>peer-reviewed</strong></li>
<li>the congress proceedings will be published under an <strong>ISSN</strong> and <strong>ISBN</strong> number</li>
<li>each paper will be assigned a unique <strong>DOI</strong> number by <strong><a href="https://www.crossref.org/" target="_blank" class="body-link">Crossref</a></strong></li>
<li>the conference proceedings will be indexed by <strong><a href="https://www.scopus.com/" target="_blank" class="body-link">Scopus</a></strong> and <strong><a href="https://scholar.google.com/" target="_blank" class="body-link">Google Scholar</a></strong></li>
<li>the proceedings will be permanently archived in <strong><a href="http://www.portico.org/digital-preservation/" target="_blank" class="body-link">Portico</a></strong> (one of the largest community-supported digital archives in the world). </li>
<li>selected papers from the congress will be submitted for possible publication in the <strong><a href="http://ijci.avestia.com/" target="_blank" class="body-link">International Journal of Civil Infrastructure (IJCI)</a></strong> (publication fees may apply)</li>
</ul>
<p class="body">To learn more about the previous event in this conference series, please visit: <a href="/past-events/" class="body-link">Past Event</a>.</p>
<br>
<h2>Paper Topics</h2>
<p class="body">ICCSTE'19 is now accepting papers on the following topics.</p>
<ul class="topics">
<li>Advanced structural materials</li>
<li>Architecture engineering</li>
<li>Earthquake and structural engineering</li>
<li>Green building materials and technology</li>
<li>New technologies, methods and techniques in civil engineering</li>
<li>Traffic engineering</li>
<li>Water resources</li>
<li>Urban development</li>
</ul>
<p class="body">For a complete list of the paper topics, please visit: <a href="/papers" class="body-link">Submissions</a>.</p>
<br>
<h2>Keynote Speakers:</h2>
<center>
<div class="unit unit-s-1-1 unit-m-1-4 unit-l-1-2 keynoteIndex">
<img src="../img/Grasselli.jpg" class="flex-img" alt="Dr. Giovanni Grasselli,">
<p class="body"><b>Dr. Giovanni Grasselli, </b><br>University of Toronto, Canada<br><a href="../keynote#Dr. Giovanni Grasselli" class="body-link">Biography & Abstract</a></p>
<br>
</div>
<!--
<div class="unit unit-s-1-1 unit-m-1-4 unit-l-1-2 keynoteIndex">
<img src="../img/Hossain.jpg" class="flex-img" alt="Dr. Khandaker M. Anwar Hossain">
<p class="body"><b>Dr. Khandaker M. Anwar Hossain, </b><br>Ryerson University, Canada<br><!--<a href="../keynote#Dr. Khandaker M. Anwar Hossain" class="body-link">Biography & Abstract</a>--><!--</p>
<br>
</div>-->
<div class="unit unit-s-1-1 unit-m-1-4 unit-l-1-2 keynoteIndex">
<img src="../img/Mohareb.jpg" class="flex-img" alt="Dr. Magdi Mohareb">
<p class="body"><b>Dr. Magdi Mohareb, </b><br>University of Ottawa, Canada<br><a href="../keynote#Dr. Magdi Mohareb" class="body-link">Biography & Abstract</a></p>
<br>
</div>
<br><br>
</center>
<div class="sponsor">
<h2></h2>
<a href="http://international-aset.com" target="_blank"><img src="../img/int-aset.svg" alt="International Academy of Science, Engineering and Technology (International ASET Inc.) " style="max-width:250px; float:left; padding: 40px 25px 20px 25px;"></a>
<a href="http://avestia.com" target="_blank"><img src="../img/avestia.png" alt="Avestia Publishing" style="max-width:150px; float:left; padding: 0px 20px 0px 20px;"></a>
<a href="http://where2submit.com" target="_blank"><img src="../img/W2S_logo.png" alt="Where2Submit" style="max-width:230px; float:left; padding: 35px 25px 0px 25px;"></a>
<a href="https://carleton.ca/" target="_blank"><img src="../img/Carleton-University.png" alt="Carleton University" style="max-width:230px; float:left; padding: 35px 25px 0px 25px;"></a>
<div class="cf"></div>
</div>
</div>
</div> | {
"content_hash": "0c237d2ae04558b478ba3d52d1b13a65",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 627,
"avg_line_length": 76.07142857142857,
"alnum_prop": 0.6940532081377152,
"repo_name": "emdsgn/iccste",
"id": "0668b5a994e45a6aeee370365093a058091ceb17",
"size": "6394",
"binary": false,
"copies": "1",
"ref": "refs/heads/2019",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "89515"
},
{
"name": "HTML",
"bytes": "429541"
},
{
"name": "JavaScript",
"bytes": "338038"
},
{
"name": "PHP",
"bytes": "48756"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Header <boost/convert/base.hpp></title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Convert 2.0">
<link rel="up" href="../../../boost_convert_c___reference.html" title="Boost.Convert C++ Reference">
<link rel="prev" href="../../../boost/convert_idp28461104.html" title="Function template convert">
<link rel="next" href="../../../boost/cnv/cnvbase.html" title="Struct template cnvbase">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../../boost/convert_idp28461104.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../boost_convert_c___reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../boost/cnv/cnvbase.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.convert.base_hpp"></a>Header <<a href="../../../../../../../boost/convert/base.hpp" target="_top">boost/convert/base.hpp</a>></h3></div></div></div>
<pre class="synopsis">
<a class="link" href="../../../BOOST_CNV_TO_STRING.html" title="Macro BOOST_CNV_TO_STRING">BOOST_CNV_TO_STRING</a>
<a class="link" href="../../../BOOST_CNV_STRING_TO.html" title="Macro BOOST_CNV_STRING_TO">BOOST_CNV_STRING_TO</a>
<a class="link" href="../../../BOOST_CNV_PARA_idp40372752.html" title="Macro BOOST_CNV_PARAM">BOOST_CNV_PARAM</a>(param_name, param_type)</pre>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">cnv</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="special">></span> <span class="keyword">struct</span> <a class="link" href="../../../boost/cnv/cnvbase.html" title="Struct template cnvbase">cnvbase</a><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2016 Vladimir Batov<p>
Distributed under the Boost Software License, Version 1.0. See copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>.
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../../boost/convert_idp28461104.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../boost_convert_c___reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../boost/cnv/cnvbase.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "439699a799262e136f761a5d229d82c4",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 510,
"avg_line_length": 81.45098039215686,
"alnum_prop": 0.61651420317766,
"repo_name": "nawawi/poedit",
"id": "249c6de99ece73252c3292da0ea3439aa86082e0",
"size": "4154",
"binary": false,
"copies": "5",
"ref": "refs/heads/stable",
"path": "deps/boost/libs/convert/doc/html/header/boost/convert/base_hpp.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "48113"
},
{
"name": "C++",
"bytes": "1284178"
},
{
"name": "Inno Setup",
"bytes": "11180"
},
{
"name": "M4",
"bytes": "103958"
},
{
"name": "Makefile",
"bytes": "9507"
},
{
"name": "Objective-C",
"bytes": "16519"
},
{
"name": "Objective-C++",
"bytes": "14681"
},
{
"name": "Python",
"bytes": "6594"
},
{
"name": "Ruby",
"bytes": "292"
},
{
"name": "Shell",
"bytes": "11982"
}
],
"symlink_target": ""
} |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
File Name: lexical-052.js
Corresponds to: 7.8.2-4-n.js
ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
Description: compare some specific examples of the automatic
insertion rules in the EMCA specification.
Author: christine@netscape.com
Date: 15 september 1997
*/
var SECTION = "lexical-052";
var VERSION = "JS1_4";
var TITLE = "Examples of Automatic Semicolon Insertion";
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
var result = "Failed";
var exception = "No exception thrown";
var expect = "Passed";
try {
MyFunction();
} catch ( e ) {
result = expect;
exception = e.toString();
}
new TestCase(
SECTION,
"calling return indirectly" +
" (threw " + exception +")",
expect,
result );
test();
function MyFunction() {
var s = "return";
eval(s);
}
| {
"content_hash": "61d044c44a49aff41d4ea0369e691495",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 79,
"avg_line_length": 24.72340425531915,
"alnum_prop": 0.6376936316695353,
"repo_name": "sergecodd/FireFox-OS",
"id": "94ae2e72faf5c7cd1f8517c5662e350474045b67",
"size": "1162",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "B2G/gecko/js/src/tests/ecma_2/Exceptions/lexical-052.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "443"
},
{
"name": "ApacheConf",
"bytes": "85"
},
{
"name": "Assembly",
"bytes": "5123438"
},
{
"name": "Awk",
"bytes": "46481"
},
{
"name": "Batchfile",
"bytes": "56250"
},
{
"name": "C",
"bytes": "101720951"
},
{
"name": "C#",
"bytes": "38531"
},
{
"name": "C++",
"bytes": "148896543"
},
{
"name": "CMake",
"bytes": "23541"
},
{
"name": "CSS",
"bytes": "2758664"
},
{
"name": "DIGITAL Command Language",
"bytes": "56757"
},
{
"name": "Emacs Lisp",
"bytes": "12694"
},
{
"name": "Erlang",
"bytes": "889"
},
{
"name": "FLUX",
"bytes": "34449"
},
{
"name": "GLSL",
"bytes": "26344"
},
{
"name": "Gnuplot",
"bytes": "710"
},
{
"name": "Groff",
"bytes": "447012"
},
{
"name": "HTML",
"bytes": "43343468"
},
{
"name": "IDL",
"bytes": "1455122"
},
{
"name": "Java",
"bytes": "43261012"
},
{
"name": "JavaScript",
"bytes": "46646658"
},
{
"name": "Lex",
"bytes": "38358"
},
{
"name": "Logos",
"bytes": "21054"
},
{
"name": "Makefile",
"bytes": "2733844"
},
{
"name": "Matlab",
"bytes": "67316"
},
{
"name": "Max",
"bytes": "3698"
},
{
"name": "NSIS",
"bytes": "421625"
},
{
"name": "Objective-C",
"bytes": "877657"
},
{
"name": "Objective-C++",
"bytes": "737713"
},
{
"name": "PHP",
"bytes": "17415"
},
{
"name": "Pascal",
"bytes": "6780"
},
{
"name": "Perl",
"bytes": "1153180"
},
{
"name": "Perl6",
"bytes": "1255"
},
{
"name": "PostScript",
"bytes": "1139"
},
{
"name": "PowerShell",
"bytes": "8252"
},
{
"name": "Protocol Buffer",
"bytes": "26553"
},
{
"name": "Python",
"bytes": "8453201"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3481"
},
{
"name": "Ruby",
"bytes": "5116"
},
{
"name": "Scilab",
"bytes": "7"
},
{
"name": "Shell",
"bytes": "3383832"
},
{
"name": "SourcePawn",
"bytes": "23661"
},
{
"name": "TeX",
"bytes": "879606"
},
{
"name": "WebIDL",
"bytes": "1902"
},
{
"name": "XSLT",
"bytes": "13134"
},
{
"name": "Yacc",
"bytes": "112744"
}
],
"symlink_target": ""
} |
<div class="dialogwrapper label">
<div class="dialogheader">
<h3>Manage Users</h3>
<div class="line-bottom line"></div>
</div>
<div class="dialogscroll">
<div class="nano">
<div class="nano-content">
<table class="admintable" ng-if="!$ctrl.showNewUser && !$ctrl.editUser">
<thead>
<tr>
<th>id</th>
<th>firstName</th>
<th>lastName</th>
<th>role</th>
<th>status</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in $ctrl.users | orderBy: 'id'">
<td>{{ user.id }}</td>
<td>{{ user.firstName }}</td>
<td>{{ user.lastName }}</td>
<td>{{ user.role }}</td>
<td>{{ user.status }}</td>
<td><button class="logout" ng-click="$ctrl.showUserEdit(user)">edit</button></td>
</tr>
</tbody>
</table>
<!-- new user -->
<div class="dialogbox dialog-full" ng-if="$ctrl.showNewUser">
<!-- <h4>id</h4> -->
<input type="text" placeholder="id" ng-model="$ctrl.newUser.id">
<input type="text" placeholder="title (optional)" ng-model="$ctrl.newUser.title">
<input type="text" placeholder="firstName" ng-model="$ctrl.newUser.firstName">
<input type="text" placeholder="lastName" ng-model="$ctrl.newUser.lastName">
<input type="text" placeholder="orcid" ng-model="$ctrl.newUser.orcid">
<input type="text" placeholder="affiliation" ng-model="$ctrl.newUser.affiliation">
<input type="password" placeholder="password" ng-model="$ctrl.newUser.pwd">
<input type="password" placeholder="confirm password" ng-model="$ctrl.newUser.passwordConfirm">
<span ng-if="$ctrl.error">error!</span>
</div>
<!-- edit user -->
<div class="dialogbox dialog-full" ng-if="$ctrl.editUser">
<input type="text" placeholder="id" ng-model="$ctrl.user.id" ng-class="{'inactive': true}" disabled>
<input type="text" placeholder="title (optional)" ng-model="$ctrl.user.title">
<input type="text" placeholder="firstName" ng-model="$ctrl.user.firstName">
<input type="text" placeholder="lastName" ng-model="$ctrl.user.lastName">
<input type="text" placeholder="orcid" ng-model="$ctrl.user.orcid">
<input type="text" placeholder="affiliation" ng-model="$ctrl.user.affiliation">
<select ng-model="$ctrl.user.status">
<option value="active">active</option>
<option value="inactive">inactive</option>
</select>
<span ng-if="$ctrl.error">error!</span>
</div>
</div>
</div>
</div>
<button class="logout apply" ng-click="$ctrl.openNewUser()" ng-if="!$ctrl.showNewUser && !$ctrl.editUser">
Create User
</button>
<!-- back button -->
<button class="logout cancel" ng-if="$ctrl.showNewUser || $ctrl.editUser" ng-click="$ctrl.showNewUser = false; $ctrl.editUser = false"> back
</button>
<button class="logout apply" ng-click="$ctrl.save($ctrl.user)" ng-if="$ctrl.editUser" ng-class="{'inactive': !$ctrl.isValidUpdate($ctrl.user)}" ng-disabled="!$ctrl.isValidUpdate($ctrl.user)">
save
</button>
<button class="logout apply" ng-click="$ctrl.create()" ng-class="{'inactive': !$ctrl.isValidNew($ctrl.newUser)}" ng-disabled="!$ctrl.isValidNew($ctrl.newUser)" ng-if="$ctrl.showNewUser">
create
</button>
</div>
| {
"content_hash": "0353eacc4e09d5f718075db0cf661b19",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 195,
"avg_line_length": 46.98850574712644,
"alnum_prop": 0.4963307240704501,
"repo_name": "i3mainz/labels",
"id": "56dbd428628fc152356b71000f71331298d2a44a",
"size": "4088",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/scripts/components/shared/footer/edit-users-button/dialog.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "63953"
},
{
"name": "HTML",
"bytes": "81916"
},
{
"name": "JavaScript",
"bytes": "171018"
}
],
"symlink_target": ""
} |
import * as $G from '../../src/core/Graph';
import * as $N from '../../src/core/Nodes';
import * as $J from '../../src/io/input/JSONInput';
import * as $C from '../../src/io/input/CSVInput';
import * as $BF from '../../src/search/BellmanFord';
import { Logger } from '../../src/utils/logger';
const logger = new Logger();
let JSON_IN = $J.JSONInput;
let CSV_IN = $C.CSVInput;
let bf_graph_file = "./test/test_data/bellman_ford.json",
bf_graph_neg_cycle_file = "./test/test_data/negative_cycle.json";
describe('GRAPH SEARCH Tests - Bellman Ford - ', () => {
let json : $J.IJSONInput,
csv : $C.ICSVInput,
bf_graph : $G.IGraph,
bf_neg_cycle_graph: $G.IGraph,
stats : $G.GraphStats,
BF : Function = $BF.BellmanFordDict,
BF_expect : {} = {},
BF_neg_expect : {} = {},
BF_compute : {} = {},
BF_expect_array : Array<number>,
BF_compute_array : any; // TODO refactor w.r.t union return type
beforeAll(() => {
json = new JSON_IN(true,false,true);
csv = new CSV_IN(' ',false,false);
bf_graph = json.readFromJSONFile(bf_graph_file);
bf_neg_cycle_graph = json.readFromJSONFile(bf_graph_neg_cycle_file);
BF_expect = { S: 0, A: 5, E: 8, C: 7, B: 5, D: 9 };
BF_expect_array = [ 0, 5, 8, 7, 5, 9 ];
});
test('should correctly instantiate the test BF graph', () => {
stats = bf_graph.getStats();
expect(stats.nr_nodes).toBe(6);
expect(stats.nr_dir_edges).toBe(8);
expect(stats.nr_und_edges).toBe(0);
});
describe('Bellman Ford Sanity Checks Tests - ', () => {
test('should reject an undefined or null graph', () => {
expect($BF.BellmanFordDict.bind($BF.BellmanFordDict, undefined)).toThrowError('Graph as well as start node have to be valid objects.');
expect($BF.BellmanFordDict.bind($BF.BellmanFordDict, null)).toThrowError('Graph as well as start node have to be valid objects.');
});
test('should reject an undefined or null start node', () => {
let graph = new $G.BaseGraph('emptinius');
expect($BF.BellmanFordDict.bind($BF.BellmanFordDict, graph, undefined)).toThrowError('Graph as well as start node have to be valid objects.');
expect($BF.BellmanFordDict.bind($BF.BellmanFordDict, graph, null)).toThrowError('Graph as well as start node have to be valid objects.');
});
test('should refuse to search a graph without edges', () => {
let graph = new $G.BaseGraph('emptinius');
let node = graph.addNodeByID('firstus');
expect($BF.BellmanFordDict.bind($BF.BellmanFordDict, graph, node)).toThrowError('Cowardly refusing to traverse a graph without edges.');
});
test('should reject an outside node', () => {
let node = new $N.BaseNode('firstus');
expect($BF.BellmanFordDict.bind($BF.BellmanFordDict, bf_graph, node)).toThrowError('Cannot start from an outside node.');
});
});
/**
* TODO more test cases (directed, undirected, weighted, unweighted graphs)
*/
describe('BF Dict version tests - ', () => {
test('should correctly compute distances from S within BF test graph', () => {
BF_compute = $BF.BellmanFordDict(bf_graph, bf_graph.getNodeById("S")).distances;
expect(BF_compute).toEqual(BF_expect);
});
/**
* Computing 'correct' distances with negative cycles makes no sense,
* since they are not even defined in finite time.
*/
test('BF should not detect any negative cycle in the bf graph', () => {
expect($BF.BellmanFordDict(bf_graph, bf_graph.getNodeById("S")).neg_cycle).toBe(false);
});
test('BF should detect the negative cycle in the bf_neg_cycle graph', () => {
expect($BF.BellmanFordDict(bf_neg_cycle_graph, bf_neg_cycle_graph.getNodeById("S")).neg_cycle).toBe(true);
});
});
/**
* TODO more test cases (directed, undirected, weighted, unweighted graphs)
*/
describe('BF Array version tests - ', () => {
test('should correctly compute dists for BF test graph', () => {
BF_compute_array = $BF.BellmanFordArray(bf_graph, bf_graph.getNodeById("S")).distances;
expect(BF_compute_array).toEqual(BF_expect_array);
});
test('BF should not detect any negative cycle in the bf graph', () => {
expect($BF.BellmanFordArray(bf_graph, bf_graph.getNodeById("S")).neg_cycle).toBe(false);
});
test('BF should detect the negative cycle in the bf_neg_cycle graph', () => {
expect($BF.BellmanFordArray(bf_neg_cycle_graph, bf_neg_cycle_graph.getNodeById("S")).neg_cycle).toBe(true);
});
});
/**
* @todo abstract out to performance test suite
*/
describe('Performance Tests - ', () => {
let social_300_file = "./test/test_data/social_network_edges_300.csv",
social_1k_file = "./test/test_data/social_network_edges_1K.csv",
graph_6k_file = "./test/test_data/real_graph.json",
sn_300_graph : $G.IGraph,
sn_1k_graph : $G.IGraph,
graph_6k : $G.IGraph;
beforeAll(() => {
sn_300_graph = csv.readFromEdgeListFile(social_300_file);
sn_1k_graph = csv.readFromEdgeListFile(social_1k_file);
graph_6k = json.readFromJSONFile(graph_6k_file);
});
test('BF performance test on ~300 node social network graph', () => {
let d = +new Date();
BF_compute = $BF.BellmanFordDict(sn_300_graph, sn_300_graph.getRandomNode());
let e = +new Date();
logger.log("BellmanFord on social network of ~300 nodes took " + (e-d) + " ms. to finish");
d = +new Date();
BF_compute = $BF.BellmanFordArray(sn_300_graph, sn_300_graph.getRandomNode());
e = +new Date();
logger.log("BellmanFord (Array) on social network of ~300 nodes took " + (e-d) + " ms. to finish");
});
test('BF performance test on ~1k node social network graph', () => {
let d = +new Date();
BF_compute = $BF.BellmanFordDict(sn_1k_graph, sn_1k_graph.getRandomNode());
let e = +new Date();
logger.log("BellmanFord on social network of ~1k nodes took " + (e-d) + " ms. to finish");
d = +new Date();
BF_compute = $BF.BellmanFordArray(sn_1k_graph, sn_1k_graph.getRandomNode());
e = +new Date();
logger.log("BellmanFord (Array) on social network of ~1k nodes took " + (e-d) + " ms. to finish");
});
test.skip('BF performance test on ~6k graph', () => {
logger.log(`Real sized graph has: ${graph_6k.nrNodes()} nodes.`);
logger.log(`Real sized graph has ${graph_6k.nrDirEdges() + graph_6k.nrUndEdges()} edges.`);
let d = +new Date();
BF_compute = $BF.BellmanFordDict(graph_6k, graph_6k.getRandomNode());
let e = +new Date();
logger.log("BellmanFord (Dict) on social network of ~1k nodes took " + (e-d) + " ms. to finish");
d = +new Date();
BF_compute = $BF.BellmanFordArray(graph_6k, graph_6k.getRandomNode());
e = +new Date();
logger.log("BellmanFord (Array) on social network of ~1k nodes took " + (e-d) + " ms. to finish");
});
});
}); | {
"content_hash": "fc16f2240f6b37d51e0db5bf6c1ec41f",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 145,
"avg_line_length": 35.84126984126984,
"alnum_prop": 0.6418659580749926,
"repo_name": "cassinius/Graphinius",
"id": "e5593c22a4477deb61aa19bf445e01f83bb9de3b",
"size": "6774",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/search/BellmanFord.test.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "132289"
},
{
"name": "Shell",
"bytes": "634"
},
{
"name": "TypeScript",
"bytes": "210619"
}
],
"symlink_target": ""
} |
package org.killbill.billing.server.log.obfuscators;
import java.util.Collection;
import java.util.LinkedList;
import java.util.regex.Pattern;
import ch.qos.logback.classic.spi.ILoggingEvent;
import com.google.common.collect.ImmutableList;
public class LoggingFilterObfuscator extends Obfuscator {
private static final String[] DEFAULT_SENSITIVE_HEADERS = {
"Authorization",
"X-Killbill-ApiSecret",
};
private final Collection<Pattern> patterns = new LinkedList<Pattern>();
public LoggingFilterObfuscator() {
this(ImmutableList.<Pattern>of());
}
public LoggingFilterObfuscator(final Collection<Pattern> extraPatterns) {
super();
for (final String sensitiveKey : DEFAULT_SENSITIVE_HEADERS) {
this.patterns.add(buildPattern(sensitiveKey));
}
this.patterns.addAll(extraPatterns);
}
@Override
public String obfuscate(final String originalString, final ILoggingEvent event) {
return obfuscate(originalString, patterns, event);
}
private Pattern buildPattern(final String key) {
return Pattern.compile("\\s*" + key + ":\\s*([^\\n]+)", DEFAULT_PATTERN_FLAGS);
}
}
| {
"content_hash": "c8a04230cd35ca5d33dd525f45535a69",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 87,
"avg_line_length": 28.785714285714285,
"alnum_prop": 0.6898263027295285,
"repo_name": "marksimu/killbill",
"id": "536682f412be13aa033d52e92008c93aa3376805",
"size": "1896",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "profiles/killbill/src/main/java/org/killbill/billing/server/log/obfuscators/LoggingFilterObfuscator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "206958"
},
{
"name": "HTML",
"bytes": "21430"
},
{
"name": "Java",
"bytes": "10376015"
},
{
"name": "JavaScript",
"bytes": "272772"
},
{
"name": "PLpgSQL",
"bytes": "1423"
},
{
"name": "Ruby",
"bytes": "8940"
},
{
"name": "SQLPL",
"bytes": "8585"
},
{
"name": "Shell",
"bytes": "19608"
}
],
"symlink_target": ""
} |
typedef std::string String;
#else
#if PLATFORM_ID == 88
#include "Arduino.h"
#else
#include <WString.h>
#endif
#endif
| {
"content_hash": "0cc8093caa3004e34243b68699f49660",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 27,
"avg_line_length": 7.875,
"alnum_prop": 0.6666666666666666,
"repo_name": "manGoweb/BLEDataTransfer",
"id": "b6b4379ed39a313713bcb78ad4ea07ffd88160c5",
"size": "349",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "firmware/examples/FW/1.0/libraries/ArduinoJson/include/ArduinoJson/Arduino/String.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Arduino",
"bytes": "28162"
},
{
"name": "C",
"bytes": "868"
},
{
"name": "C++",
"bytes": "394709"
},
{
"name": "CMake",
"bytes": "2856"
},
{
"name": "CSS",
"bytes": "25017"
},
{
"name": "HTML",
"bytes": "189976"
},
{
"name": "JavaScript",
"bytes": "9327"
},
{
"name": "Makefile",
"bytes": "692"
},
{
"name": "Processing",
"bytes": "35319"
},
{
"name": "Shell",
"bytes": "5258"
}
],
"symlink_target": ""
} |
const DrawCard = require('../../drawcard.js');
class WalderFrey extends DrawCard {
setupCardAbilities(ability) {
this.persistentEffect({
condition: () => this.game.currentChallenge && this.game.currentChallenge.isAttacking(this),
match: card => card !== this && card.hasTrait('House Frey') && card.getType() === 'character',
effect: ability.effects.consideredToBeAttacking()
});
}
}
WalderFrey.code = '06077';
module.exports = WalderFrey;
| {
"content_hash": "77e420cc48ac70110e3eafd9b5b28a06",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 106,
"avg_line_length": 33.46666666666667,
"alnum_prop": 0.6374501992031872,
"repo_name": "cryogen/gameteki",
"id": "231eaa2e4237e6e57e576f05126765a4e4e4c5ba",
"size": "502",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "server/game/cards/06.4-TRW/WalderFrey.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "32422"
},
{
"name": "HTML",
"bytes": "1200"
},
{
"name": "JavaScript",
"bytes": "2322467"
}
],
"symlink_target": ""
} |
<!doctype html>
<html>
<head>
<style>
h4 {font-weight:bold;}
</style>
</head>
<body>
<h4>
Versions
</h4>
<p>
blinkbox Books for iOS</br>
Version: %@</br>
%@
©Copyright 2014 blinkbox Books Ltd. All Rights Reserved.
</p>
<h4>
About blinkbox Books
</h4>
<p>
blinkbox Books is a service that lets you browse, discover, buy and read from a choice of hundreds of thousands of books. It works simply on your tablet or smartphone, so you can enjoy great stories whenever and wherever you want.
</p>
<h4>
Who are we?
</h4>
<p>
We are an online digital books store owned by Tesco. As such, we are able to deliver our readers great offers and Clubcard points on their book purchases. And as we are also partners of blinkbox movies and blinkbox music, you will also be able to get great offers on the latest blockbusters and listen to the latest sounds absolutely free.
</p>
<h4>
Why choose us?
</h4>
<ul>
<li>Earn Tesco Clubcard points on your purchases (not available on all purchases)</li>
<li>Read your books on any iOS device</li>
<li>Choose from hundreds of thousands of books</li>
</ul>
<h4>
Licenses
</h4>
<ul>
<li><b>WEPopover Controller</b> </li>
<li><b>Apple Reachability</b></li>
<li><b>CocoaHttpServer</b></li>
<li><b>Bugsense released under the Bugsense license</b></li>
<li><b>Google Analytics released under the Google Analytics license</b></li>
<li><b>Chilkat Zip Objective-C Library</b></li>
</ul>
</body>
</html> | {
"content_hash": "4564e5cb0b0d7dee99e39261801f2b4e",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 347,
"avg_line_length": 27,
"alnum_prop": 0.6265938069216758,
"repo_name": "blinkboxbooks/ios-app",
"id": "b402cbb9e35d5bb5870ea8a4eabeb75b1e301f48",
"size": "1647",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/HTML/app_info.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "6977"
},
{
"name": "CSS",
"bytes": "9480"
},
{
"name": "Objective-C",
"bytes": "2338349"
},
{
"name": "Objective-C++",
"bytes": "3698"
},
{
"name": "Perl",
"bytes": "357507"
},
{
"name": "Python",
"bytes": "341"
},
{
"name": "Ruby",
"bytes": "843"
},
{
"name": "Shell",
"bytes": "19535"
}
],
"symlink_target": ""
} |
package com.testdemo.entity;
import java.io.Serializable;
/**
* @AUTHOR:niejq@1dian.la
* @DATETIME:2017 05 02 13:45
* @DESC:
*/
public class PhoneInfo implements Serializable{
private String phone;
private String name;
public PhoneInfo(String phone, String name) {
this.phone = phone;
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "PhoneInfo{" +
"phone='" + phone + '\'' +
", name='" + name + '\'' +
'}';
}
}
| {
"content_hash": "1476d463c8a5a9ea9f119318f46923e4",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 49,
"avg_line_length": 18.651162790697676,
"alnum_prop": 0.5386533665835411,
"repo_name": "niejuqian/TestDemo",
"id": "4bdf5cfdd54ba6b0c0b9757d12b7d1a7718e20be",
"size": "808",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/testdemo/entity/PhoneInfo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "4334"
},
{
"name": "Java",
"bytes": "395195"
}
],
"symlink_target": ""
} |
package com.oracle.ptsdemo.healthcare.business.datasync.dynamic;
/**
*/
public class PharmacyMetaInfo extends MetaInfo {
/**
*/
public PharmacyMetaInfo() {
super();
}
}
| {
"content_hash": "1d50a500122ac8f71deac4befa0feb33",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 64,
"avg_line_length": 17.818181818181817,
"alnum_prop": 0.6377551020408163,
"repo_name": "delkyd/Oracle-Cloud",
"id": "2349c2db44ed4ecd725168702185dcd80502c6e6",
"size": "196",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "PaaS-SaaS_HealthCareApp/DoctorPatientCRMExtension/HealthCare/HealthCare/src/com/oracle/ptsdemo/healthcare/business/datasync/dynamic/PharmacyMetaInfo.java",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "810"
},
{
"name": "C#",
"bytes": "2922162"
},
{
"name": "CSS",
"bytes": "405502"
},
{
"name": "HTML",
"bytes": "2487"
},
{
"name": "Java",
"bytes": "33061859"
},
{
"name": "JavaScript",
"bytes": "43011"
},
{
"name": "PLSQL",
"bytes": "48918"
}
],
"symlink_target": ""
} |
//---------------------------------------------------------------------------
//
// Copyright (c) 2008-2010 AlazarTech, Inc.
//
// AlazarTech, Inc. licenses this software under specific terms and
// conditions. Use of any of the software or derviatives thereof in any
// product without an AlazarTech digitizer board is strictly prohibited.
//
// AlazarTech, Inc. provides this software AS IS, WITHOUT ANY WARRANTY,
// EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. AlazarTech makes no
// guarantee or representations regarding the use of, or the results of the
// use of, the software and documentation in terms of correctness, accuracy,
// reliability, currentness, or otherwise; and you rely on the software,
// documentation and results solely at your own risk.
//
// IN NO EVENT SHALL ALAZARTECH BE LIABLE FOR ANY LOSS OF USE, LOSS OF
// BUSINESS, LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL
// DAMAGES OF ANY KIND. IN NO EVENT SHALL ALAZARTECH'S TOTAL LIABILITY EXCEED
// THE SUM PAID TO ALAZARTECH FOR THE PRODUCT LICENSED HEREUNDER.
//
//---------------------------------------------------------------------------
using System;
using System.IO;
using System.Runtime.InteropServices;
using AlazarTech;
namespace CS_WaitNextBuffer
{
// This console program demonstrates how to configure an ATS660
// to make a continuous streaming, AutoDMA acquisition.
class AcqToDiskApp
{
private static double samplesPerSec = 0;
static void Main(string[] args)
{
// TODO: Select a board
UInt32 systemId = 1;
UInt32 boardId = 1;
// Get a handle to the board
IntPtr handle = AlazarAPI.AlazarGetBoardBySystemID(systemId, boardId);
if (handle == IntPtr.Zero)
{
Console.WriteLine("Error: Open board {0}:{1} failed.", systemId, boardId);
return;
}
// Configure sample rate, input, and trigger parameters
if (!ConfigureBoard(handle))
{
Console.WriteLine("Error: Configure board {0}:{1} failed", systemId, boardId);
return;
}
// Acquire data from the board to an application buffer,
// optionally saving the data to file
if (!AcquireData(handle))
{
Console.WriteLine("Error: Acquire from board {0}:{1} failed", systemId, boardId);
return;
}
}
//----------------------------------------------------------------------------
//
// Function : ConfigureBoard
//
// Description : Configure sample rate, input, and trigger settings
//
//----------------------------------------------------------------------------
static public bool ConfigureBoard(IntPtr boardHandle)
{
UInt32 retCode;
// TODO: Specify the sample rate (in samples per second),
// and appropriate sample rate identifier
samplesPerSec = 10e6;
UInt32 sampleRateId = AlazarAPI.SAMPLE_RATE_10MSPS;
// TODO: Select clock parameters as required.
retCode =
AlazarAPI.AlazarSetCaptureClock(
boardHandle, // HANDLE -- board handle
AlazarAPI.INTERNAL_CLOCK, // U32 -- clock source id
sampleRateId, // U32 -- sample rate id
AlazarAPI.CLOCK_EDGE_RISING, // U32 -- clock edge id
0 // U32 -- clock decimation
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetCaptureClock failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Select CHA input parameters as required
retCode =
AlazarAPI.AlazarInputControl(
boardHandle, // HANDLE -- board handle
AlazarAPI.CHANNEL_A, // U8 -- input channel
AlazarAPI.DC_COUPLING, // U32 -- input coupling id
AlazarAPI.INPUT_RANGE_PM_800_MV, // U32 -- input range id
AlazarAPI.IMPEDANCE_50_OHM // U32 -- input impedance id
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarInputControl failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Select CHA bandwidth limit as required
retCode =
AlazarAPI.AlazarSetBWLimit(
boardHandle, // HANDLE -- board handle
AlazarAPI.CHANNEL_A, // U8 -- channel identifier
0 // U32 -- 0 = disable, 1 = enable
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetBWLimit failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false ;
}
// TODO: Select CHB input parameters as required
retCode =
AlazarAPI.AlazarInputControl(
boardHandle, // HANDLE -- board handle
AlazarAPI.CHANNEL_B, // U8 -- channel identifier
AlazarAPI.DC_COUPLING, // U32 -- input coupling id
AlazarAPI.INPUT_RANGE_PM_800_MV, // U32 -- input range id
AlazarAPI.IMPEDANCE_50_OHM // U32 -- input impedance id
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarInputControl failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Select CHB bandwidth limit as required
retCode =
AlazarAPI.AlazarSetBWLimit(
boardHandle, // HANDLE -- board handle
AlazarAPI.CHANNEL_B, // U8 -- channel identifier
0 // U32 -- 0 = disable, 1 = enable
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetBWLimit failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Select trigger inputs and levels as required
retCode =
AlazarAPI.AlazarSetTriggerOperation(
boardHandle, // HANDLE -- board handle
AlazarAPI.TRIG_ENGINE_OP_J, // U32 -- trigger operation
AlazarAPI.TRIG_ENGINE_J, // U32 -- trigger engine id
AlazarAPI.TRIG_CHAN_A, // U32 -- trigger source id
AlazarAPI.TRIGGER_SLOPE_POSITIVE, // U32 -- trigger slope id
128, // U32 -- trigger level from 0 (-range) to 255 (+range)
AlazarAPI.TRIG_ENGINE_K, // U32 -- trigger engine id
AlazarAPI.TRIG_DISABLE, // U32 -- trigger source id for engine K
AlazarAPI.TRIGGER_SLOPE_POSITIVE, // U32 -- trigger slope id
128 // U32 -- trigger level from 0 (-range) to 255 (+range)
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetTriggerOperation failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Select external trigger parameters as required
retCode =
AlazarAPI.AlazarSetExternalTrigger(
boardHandle, // HANDLE -- board handle
AlazarAPI.DC_COUPLING, // U32 -- external trigger coupling id
AlazarAPI.ETR_5V // U32 -- external trigger range id
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetExternalTrigger failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Set trigger delay as required.
double triggerDelay_sec = 0;
UInt32 triggerDelay_samples = (UInt32) (triggerDelay_sec * samplesPerSec + 0.5);
retCode =
AlazarAPI.AlazarSetTriggerDelay(
boardHandle, // HANDLE -- board handle
triggerDelay_samples // U32 -- trigger delay in samples
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetTriggerDelay failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Set trigger timeout as required.
// NOTE:
// The board will wait for a for this amount of time for a trigger event.
// If a trigger event does not arrive, then the board will automatically
// trigger. Set the trigger timeout value to 0 to force the board to wait
// forever for a trigger event.
//
// IMPORTANT:
// The trigger timeout value should be set to zero after appropriate
// trigger parameters have been determined, otherwise the
// board may trigger if the timeout interval expires before a
// hardware trigger event arrives.
double triggerTimeout_sec = 0;
UInt32 triggerTimeout_clocks = (UInt32) (triggerTimeout_sec / 10E-6 + 0.5);
retCode =
AlazarAPI.AlazarSetTriggerTimeOut(
boardHandle, // HANDLE -- board handle
triggerTimeout_clocks // U32 -- timeout_sec / 10.e-6 (0 means wait forever)
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarSetTriggerTimeOut failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// TODO: Configure AUX I/O connector as required
retCode =
AlazarAPI.AlazarConfigureAuxIO(
boardHandle, // HANDLE -- board handle
AlazarAPI.AUX_OUT_TRIGGER, // U32 -- mode
0 // U32 -- parameter
);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarConfigureAuxIO failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
return true;
}
// Use this structure to access a byte array as a short array,
// without making an intermediate copy in memory.
[StructLayout(LayoutKind.Explicit)]
struct ByteToShortArray
{
[FieldOffset(0)]
public byte[] bytes;
[FieldOffset(0)]
public short[] shorts;
}
//----------------------------------------------------------------------------
//
// Function : Acquire data
//
// Description : Acquire data from board, optionally saving data to file.
//
//----------------------------------------------------------------------------
static public unsafe bool AcquireData(IntPtr boardHandle)
{
// TODO: Select the total acquisition time in seconds
double acquisitionTime_sec = 30;
// TODO: Select the number of samples in each DMA transfer
UInt32 samplesPerBuffer = 1024 * 1024;
// TODO: Select which channels to capture (A, B, or both)
UInt32 channelMask = AlazarAPI.CHANNEL_A | AlazarAPI.CHANNEL_B;
// TODO: Select if you wish to save the sample data to a file
bool saveData = false;
// Calculate the number of enabled channels from the channel mask
UInt32 channelCount = 0;
switch (channelMask)
{
case AlazarAPI.CHANNEL_A:
case AlazarAPI.CHANNEL_B:
channelCount = 1;
break;
case AlazarAPI.CHANNEL_A | AlazarAPI.CHANNEL_B:
channelCount = 2;
break;
default:
Console.WriteLine("Error: Invalid channel mask -- {0}", channelMask);
return false;
}
// Get the sample size in bits, and the on-board memory size in samples per channel
Byte bitsPerSample;
UInt32 maxSamplesPerChannel;
UInt32 retCode = AlazarAPI.AlazarGetChannelInfo(boardHandle, &maxSamplesPerChannel, &bitsPerSample);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarGetChannelInfo failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
return false;
}
// Calculate the size of each DMA buffer in bytes
UInt32 bytesPerSample = ((UInt32) bitsPerSample + 7) / 8;
UInt32 bytesPerBuffer = bytesPerSample * samplesPerBuffer * channelCount;
// Calculate the number of buffers in the acquisition
UInt32 samplesPerAcquisition = (UInt32)(samplesPerSec * acquisitionTime_sec + 0.5);
UInt32 buffersPerAcquisition = (samplesPerAcquisition + samplesPerBuffer - 1) / samplesPerBuffer;
FileStream fs = null;
bool success = true;
try
{
// Create a data file if required
if (saveData)
{
fs = File.Create(@"data.bin");
}
// Allocate memory for sample buffer
byte[] buffer = new byte[bytesPerBuffer];
// Cast byte array to short array
ByteToShortArray byteToShortArray = new ByteToShortArray();
byteToShortArray.bytes = buffer;
fixed (short* pBuffer = byteToShortArray.shorts)
{
// Configure the board to make an NPT AutoDMA acquisition
UInt32 admaFlags = AlazarAPI.ADMA_EXTERNAL_STARTCAPTURE | // Start acquisition when we call AlazarStartCapture
AlazarAPI.ADMA_CONTINUOUS_MODE | // Acquire a continuous stream of sample data without trigger
AlazarAPI.ADMA_ALLOC_BUFFERS; // Allow API to allocate and manages DMA buffers, and copy data into our buffer.
retCode =
AlazarAPI.AlazarBeforeAsyncRead(
boardHandle, // HANDLE -- board handle
channelMask, // U32 -- enabled channel mask
0, // long -- offset from trigger in samples
samplesPerBuffer, // U32 -- samples per buffer
1, // U32 -- records per buffer (must be 1)
buffersPerAcquisition, // U32 -- records per acquisition
admaFlags // U32 -- AutoDMA flags
);
if (retCode != AlazarAPI.ApiSuccess)
{
throw new System.Exception("Error: AlazarBeforeAsyncRead failed -- " + AlazarAPI.AlazarErrorToText(retCode));
}
// Arm the board to begin the acquisition
retCode = AlazarAPI.AlazarStartCapture(boardHandle);
if (retCode != AlazarAPI.ApiSuccess)
{
throw new System.Exception("Error: AlazarStartCapture failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
}
// Wait for each buffer to be filled, then process the buffer
Console.WriteLine("Capturing {0} buffers ... press any key to abort",
buffersPerAcquisition);
int startTickCount = System.Environment.TickCount;
UInt32 buffersCompleted = 0;
Int64 bytesTransferred = 0;
bool done = false;
while (!done)
{
// TODO: Set a buffer timeout that is longer than the time
// required to capture all the records in one buffer.
UInt32 timeout_ms = 5000;
// Wait for a buffer to be filled by the board.
retCode = AlazarAPI.AlazarWaitNextAsyncBufferComplete(boardHandle, pBuffer, bytesPerBuffer, timeout_ms);
if (retCode == AlazarAPI.ApiSuccess)
{
// This buffer is full, but there are more buffers in the acquisition.
}
else if (retCode == AlazarAPI.ApiTransferComplete)
{
// This buffer is full, and it's the last buffer of the acqusition.
done = true;
}
else
{
throw new System.Exception("Error: AlazarWaitNextAsyncBufferComplete failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
}
buffersCompleted++;
bytesTransferred += bytesPerBuffer;
// TODO: Process sample data in this buffer.
// NOTE:
//
// While you are processing this buffer, the board is already
// filling the next available buffer(s).
//
// You MUST finish processing this buffer and post it back to the
// board before the board fills all of the available DMA buffers,
// and its on-board memory.
//
// Records are arranged in the buffer as follows: R0A, R0B
//
// Samples are arranged contiguously in each record.
// A 16-bit sample code occupies each 16-bit sample value in the record.
//
// Sample codes are unsigned by default. As a result:
// - a sample code of 0x0000 represents a negative full scale input signal.
// - a sample code of 0x8000 represents a ~0V signal.
// - a sample code of 0xFFFF represents a positive full scale input signal.
if (saveData)
{
// Write record to file
fs.Write(buffer, 0, (int)bytesPerBuffer);
}
// If a key was pressed, exit the acquisition loop
if (Console.KeyAvailable == true)
{
Console.WriteLine("Aborted...");
done = true;
}
// Display progress
Console.Write("Completed {0} buffers\r", buffersCompleted);
}
// Display results
double transferTime_sec = ((double)(System.Environment.TickCount - startTickCount)) / 1000;
Console.WriteLine("Capture completed in {0:N3} sec", transferTime_sec);
double buffersPerSec;
double bytesPerSec;
if (transferTime_sec > 0)
{
buffersPerSec = buffersCompleted / transferTime_sec;
bytesPerSec = bytesTransferred / transferTime_sec;
}
else
{
buffersPerSec = 0;
bytesPerSec = 0;
}
Console.WriteLine("Captured {0} buffers ({1:G4} buffers per sec)", buffersCompleted, buffersPerSec);
Console.WriteLine("Transferred {0} bytes ({1:G4} bytes per sec)", bytesTransferred, bytesPerSec);
}
}
catch (Exception exception)
{
Console.WriteLine(exception.ToString());
success = false;
}
finally
{
// Close the data file
if (fs != null)
fs.Close();
// Abort the acquisition
retCode = AlazarAPI.AlazarAbortAsyncRead(boardHandle);
if (retCode != AlazarAPI.ApiSuccess)
{
Console.WriteLine("Error: AlazarAbortAsyncRead failed -- " +
AlazarAPI.AlazarErrorToText(retCode));
}
}
return success;
}
}
}
| {
"content_hash": "ab2aaef7f87cd411cc7a0cc830dae0d8",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 151,
"avg_line_length": 41.770992366412216,
"alnum_prop": 0.49122807017543857,
"repo_name": "TeravoxelTwoPhotonTomography/fetch",
"id": "3fb7d5c7af3f3405edaee1d0d7d680e8bd8ccbbb",
"size": "21890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "3rdParty/AlazarTech/ATS-SDK/5.8.2/Samples_CSharp/ATS660/DualPort/CS_WaitNextBuffer/CS_WaitNextBuffer/Program.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "3924668"
},
{
"name": "C#",
"bytes": "1431933"
},
{
"name": "C++",
"bytes": "7636003"
},
{
"name": "CMake",
"bytes": "50609"
},
{
"name": "CSS",
"bytes": "23984"
},
{
"name": "Cuda",
"bytes": "24282"
},
{
"name": "GLSL",
"bytes": "5452"
},
{
"name": "HTML",
"bytes": "1430382"
},
{
"name": "Makefile",
"bytes": "1042281"
},
{
"name": "Objective-C",
"bytes": "26020"
},
{
"name": "Protocol Buffer",
"bytes": "24415"
},
{
"name": "Python",
"bytes": "214699"
},
{
"name": "Shell",
"bytes": "325028"
},
{
"name": "Visual Basic",
"bytes": "21490"
},
{
"name": "XSLT",
"bytes": "49388"
}
],
"symlink_target": ""
} |
// Copyright (c) 2012 Ecma International. All rights reserved.
// Ecma International makes this code available under the terms and conditions set
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
// "Use Terms"). Any redistribution of this code must retain the above
// copyright and this notice and otherwise comply with the Use Terms.
/*---
es5id: 15.2.3.3-4-228
description: >
Object.getOwnPropertyDescriptor - ensure that 'writable' property
of returned object is data property with correct 'writable'
attribute
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { "property": "ownDataProperty" };
var desc = Object.getOwnPropertyDescriptor(obj, "property");
try {
desc.writable = "overwriteDataProperty";
return desc.writable === "overwriteDataProperty";
} catch (e) {
return false;
}
}
runTestCase(testcase);
| {
"content_hash": "89108379affbd145d835d02f408f025a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 82,
"avg_line_length": 34.107142857142854,
"alnum_prop": 0.6764397905759162,
"repo_name": "PiotrDabkowski/Js2Py",
"id": "dd9e75e157de92f0c2f4ea47ffb5fe81e510d6f2",
"size": "955",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_cases/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-228.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "289"
},
{
"name": "JavaScript",
"bytes": "8556970"
},
{
"name": "Python",
"bytes": "4583980"
},
{
"name": "Shell",
"bytes": "457"
}
],
"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 xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Docs for page OutputByteStream.php</title>
<link rel="stylesheet" href="../../media/stylesheet.css" />
<script src="../../media/lib/classTree.js"></script>
<link id="webfx-tab-style-sheet" type="text/css" rel="stylesheet" href="../../media/lib/tab.webfx.css" />
<script type="text/javascript" src="../../media/lib/tabpane.js"></script>
<script language="javascript" type="text/javascript" src="../../media/lib/ua.js"></script>
<script language="javascript" type="text/javascript">
var imgPlus = new Image();
var imgMinus = new Image();
imgPlus.src = "../../media/images/plus.gif";
imgMinus.src = "../../media/images/minus.gif";
function showNode(Node){
switch(navigator.family){
case 'nn4':
// Nav 4.x code fork...
var oTable = document.layers["span" + Node];
var oImg = document.layers["img" + Node];
break;
case 'ie4':
// IE 4/5 code fork...
var oTable = document.all["span" + Node];
var oImg = document.all["img" + Node];
break;
case 'gecko':
// Standards Compliant code fork...
var oTable = document.getElementById("span" + Node);
var oImg = document.getElementById("img" + Node);
break;
}
oImg.src = imgMinus.src;
oTable.style.display = "block";
}
function hideNode(Node){
switch(navigator.family){
case 'nn4':
// Nav 4.x code fork...
var oTable = document.layers["span" + Node];
var oImg = document.layers["img" + Node];
break;
case 'ie4':
// IE 4/5 code fork...
var oTable = document.all["span" + Node];
var oImg = document.all["img" + Node];
break;
case 'gecko':
// Standards Compliant code fork...
var oTable = document.getElementById("span" + Node);
var oImg = document.getElementById("img" + Node);
break;
}
oImg.src = imgPlus.src;
oTable.style.display = "none";
}
function nodeIsVisible(Node){
switch(navigator.family){
case 'nn4':
// Nav 4.x code fork...
var oTable = document.layers["span" + Node];
break;
case 'ie4':
// IE 4/5 code fork...
var oTable = document.all["span" + Node];
break;
case 'gecko':
// Standards Compliant code fork...
var oTable = document.getElementById("span" + Node);
break;
}
return (oTable && oTable.style.display == "block");
}
function toggleNodeVisibility(Node){
if (nodeIsVisible(Node)){
hideNode(Node);
}else{
showNode(Node);
}
}
</script>
<!-- template designed by Julien Damon based on PHPEdit's generated templates, and tweaked by Greg Beaver -->
<body bgcolor="#ffffff" ><h2>File: /vendors/swiftMailer/classes/Swift/OutputByteStream.php</h2>
<div class="tab-pane" id="tabPane1">
<script type="text/javascript">
tp1 = new WebFXTabPane( document.getElementById( "tabPane1" ) );
</script>
<div class="tab-page" id="Description">
<h2 class="tab">Description</h2>
<!-- ========== Info from phpDoc block ========= -->
<ul>
</ul>
<!-- =========== Used Classes =========== -->
<A NAME='classes_summary'><!-- --></A>
<h3>Classes defined in this file</h3>
<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
<THEAD>
<TR><TD STYLE="width:20%"><h4>CLASS NAME</h4></TD><TD STYLE="width: 80%"><h4>DESCRIPTION</h4></TD></TR>
</THEAD>
<TBODY>
<TR BGCOLOR='white' CLASS='TableRowColor'>
<TD><a href="../../Swift/ByteStream/Swift_OutputByteStream.html">Swift_OutputByteStream</a></TD>
<TD>An abstract means of reading data.</TD>
</TR>
</TBODY>
</TABLE>
</div>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "Description" ) );</script>
<div class="tab-page" id="tabPage1">
<!-- ============ Includes DETAIL =========== -->
<h2 class="tab">Include/Require Statements</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage1" ) );</script>
</div>
<div class="tab-page" id="tabPage2">
<!-- ============ GLOBAL DETAIL =========== -->
<h2 class="tab">Global Variables</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage2" ) );</script>
</div>
<div class="tab-page" id="tabPage3">
<!-- ============ CONSTANT DETAIL =========== -->
<A NAME='constant_detail'></A>
<h2 class="tab">Constants</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage3" ) );</script>
</div>
<div class="tab-page" id="tabPage4">
<!-- ============ FUNCTION DETAIL =========== -->
<h2 class="tab">Functions</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage4" ) );</script>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
setupAllTabs();
//]]>
</script>
<div id="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 20:45:26 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
</div>
</body>
</html> | {
"content_hash": "9a7ca5bc8ffca27827f0b9fd68ef3809",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 135,
"avg_line_length": 31.786585365853657,
"alnum_prop": 0.604642240552465,
"repo_name": "troikaitsulutions/templeadvisor",
"id": "57d0189474a32f235419460e626fde40e5d2cd5b",
"size": "5213",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "protected/extensions/yii-mail/doc/Swift/ByteStream/_vendors---swiftMailer---classes---Swift---OutputByteStream.php.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "46548"
},
{
"name": "ApacheConf",
"bytes": "7094"
},
{
"name": "Batchfile",
"bytes": "1598"
},
{
"name": "CSS",
"bytes": "6301031"
},
{
"name": "Groff",
"bytes": "8203833"
},
{
"name": "HTML",
"bytes": "7431205"
},
{
"name": "JavaScript",
"bytes": "4942263"
},
{
"name": "PHP",
"bytes": "38217161"
},
{
"name": "Ruby",
"bytes": "1384"
},
{
"name": "Shell",
"bytes": "464"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Ceské Houby 3: 624 (1921)
#### Original name
Leptonia decurrens Velen.
### Remarks
null | {
"content_hash": "a0578d5b4d3876a045ff0ba62dc47d47",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 25,
"avg_line_length": 11.615384615384615,
"alnum_prop": 0.7019867549668874,
"repo_name": "mdoering/backbone",
"id": "4ca69c4ed5eb44f9dad6dfec17613081c65935f3",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Entolomataceae/Leptonia/Leptonia decurrens/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
"use strict";
var Ember = require("ember")["default"] || require("ember");
var computed = require("ember").computed;
var typeOf = require("ember").typeOf;
var inspect = require("ember").inspect;
var on = require("ember").on;
var capitalCamelize = require("./utils").capitalCamelize;
var contains = require("./utils").contains;
var Transition = require("./transition")["default"] || require("./transition");
var Definition = require("./definition")["default"] || require("./definition");
exports["default"] = Ember.Object.extend({
isTransitioning: false,
events: null,
states: null,
activeTransitions: null,
currentState: null,
initialState: null,
init: function() {
var target = this.get('target');
var events = this.get('events');
var states = this.get('states');
if (!target) {
this.set('target', this);
}
if (events && !events.error) {
events.error = { transition: { $all: 'failed' } };
}
this.set('activeTransitions', Ember.A());
this.definition = new Definition({
states: states,
events: events
});
this.set('stateNames', this.definition.stateNames);
this.set('eventNames', this.definition.eventNames);
this.set('currentState', this.get('initialState') || this.definition.initialState);
},
send: function(event) {
var args = [].slice.call(arguments, 1, arguments.length);
var fsm = this;
var transition;
var promise;
var sameState;
if (!contains(this.get('eventNames'), event)) {
throw new Ember.Error(
'unknown state event "' + event + '" try one of [' +
this.get('eventNames').join(', ') + ']'
);
}
transition = this.transitionFor(event, args);
sameState = transition.toState === this.get('currentState');
if (this.get('isTransitioning') && !sameState) {
throw new Ember.Error(
'unable to transition out of "' + this.get('currentState') + '" ' +
'state to "' + transition.toState + '" state while transitions are ' +
'active: ' + inspect(this.get('activeTransitions'))
);
}
promise = transition.perform();
promise.catch(function(error) {
fsm.abortActiveTransitions();
fsm.send('error', {
error: error,
transition: transition
});
});
return promise;
},
abortActiveTransition: function(transition) {
if (this.hasActiveTransition(transition)) {
transition.abort();
this.removeActiveTransition(transition);
}
},
hasActiveTransition: function(transition) {
return contains(this.get('activeTransitions'), transition);
},
abortActiveTransitions: function() {
var activeTransitions = this.get('activeTransitions');
while (activeTransitions.length) {
activeTransitions.popObject().abort();
}
this.set('isTransitioning', false);
},
pushActiveTransition: function(transition) {
var activeTransitions = this.get('activeTransitions');
activeTransitions.pushObject(transition);
if (activeTransitions.get('length')) {
this.set('isTransitioning', true);
}
},
removeActiveTransition: function(transition) {
var activeTransitions = this.get('activeTransitions');
activeTransitions.removeObject(transition);
if (!activeTransitions.get('length')) {
this.set('isTransitioning', false);
}
},
checkGuard: function(guardProperty, isInverse) {
var target = this.get('target');
var guardValue = target.get(guardProperty);
var result;
if (guardValue === undefined) {
throw new Error('expected guard "' + guardProperty + '" on target "' +
target + '" to be defined');
} else if (typeOf(guardValue) === 'function') {
result = guardValue.call(this) ? true : false;
} else {
result = guardValue ? true : false;
}
return isInverse ? !result : result;
},
outcomeOfPotentialTransitions: function(potentials) {
var target = this.get('target');
var potential;
var outcomeParams;
var i;
if (!potentials.length) {
return null;
}
for (i = 0; i < potentials.length; i++) {
potential = potentials[i];
if (!potential.isGuarded) {
outcomeParams = potential;
break;
}
if (potential.doIf && this.checkGuard(potential.doIf)) {
outcomeParams = potential;
break;
}
if (potential.doUnless && this.checkGuard(potential.doUnless, true)) {
outcomeParams = potential;
break;
}
}
if (!outcomeParams) {
return null;
}
outcomeParams.machine = this;
outcomeParams.target = target;
return outcomeParams;
},
transitionFor: function(event, args) {
var currentState = this.get('currentState');
var potentials = this.definition.transitionsFor(event, currentState);
var transitionParams;
if (!potentials.length) {
throw new Ember.Error('no transition is defined for event "' + event +
'" in state "' + currentState + '"');
}
transitionParams = this.outcomeOfPotentialTransitions(potentials);
if (!transitionParams) {
throw new Ember.Error('no unguarded transition was resolved for event "' +
event + '" in state "' + currentState + '"');
}
transitionParams.eventArgs = args;
return Transition.create(transitionParams);
},
inState: function(stateOrPrefix) {
var currentState = this.definition.lookupState(this.get('currentState'));
var states = this.definition.lookupStates(stateOrPrefix);
return contains(states, currentState);
},
canEnterState: function(state) {
var currentState = this.definition.lookupState(this.get('currentState'));
var potentials;
potentials = currentState.exitTransitions.filter(function(t) {
return t.toState === state;
});
return this.outcomeOfPotentialTransitions(potentials) ? true : false;
},
_setNewState_: function(transition) {
this.set('currentState', transition.get('toState'));
},
_activateTransition_: function(transition) {
this.pushActiveTransition(transition);
},
_deactivateTransition_: function(transition) {
this.removeActiveTransition(transition);
},
_setupIsStateAccessors: on('init', function() {
var mixin = {};
var prefixes = this.definition.stateNamespaces.slice(0);
var properties = [];
var prefix;
var i;
function addAccessor(prefix) {
var property = ('isIn' + capitalCamelize(prefix));
properties.push(property);
mixin[property] = computed(function() {
return this.inState(prefix);
}).property('currentState');
}
for (i = 0; i < this.definition.stateNames.length; i++) {
prefix = this.definition.stateNames[i];
if (prefixes.indexOf(prefix) !== -1) {
continue;
}
prefixes.push(prefix);
}
for (i = 0; i < prefixes.length; i++) {
addAccessor(prefixes[i]);
}
this.isInStateAccessorProperties = properties;
this.reopen(mixin);
})
}); | {
"content_hash": "6b757ce4c8199572256ebc146657430d",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 87,
"avg_line_length": 26.6203007518797,
"alnum_prop": 0.6316904392035023,
"repo_name": "greyhwndz/ember-fsm",
"id": "82ff05a4918b75d8a1ccd67e6ed6f0840769a04d",
"size": "7081",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dist/cjs/machine.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "214221"
}
],
"symlink_target": ""
} |
import mocha from 'mocha'
import chai from 'chai'
import expect from 'expect'
import { findIndex } from '../src/findIndex'
describe( 'findIndex', () => {
it( 'returns -1 when no values pass the truth test', () => {
const isPrime = (number) => {
let start = 2;
while(start <= Math.sqrt(number)) {
if (number % start++ < 1) return false
}
return number > 1
}
const input = [4, 6, 8, 12]
expect( findIndex(input, isPrime )).toEqual(-1)
})
it( 'returns the index of the first value that passes the truth test', () => {
const isPrime = (number) => {
let start = 2;
while(start <= Math.sqrt(number)) {
if (number % start++ < 1) return false
}
return number > 1
}
const input = [4, 6, 7, 12]
expect( findIndex(input, isPrime )).toEqual(2)
})
})
| {
"content_hash": "d1cd7fb370708353978ff603da12e1f4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 80,
"avg_line_length": 21.736842105263158,
"alnum_prop": 0.5786924939467313,
"repo_name": "yaseenagag/AwesomeLibrary-",
"id": "bad3bb577305590da55a10ee60f61d0b328a0aea",
"size": "826",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/findIndex.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "748"
},
{
"name": "JavaScript",
"bytes": "50473"
}
],
"symlink_target": ""
} |
package pipelines.images.cifar
import scala.reflect.ClassTag
import breeze.linalg._
import breeze.numerics._
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.rdd.RDD
import scopt.OptionParser
import evaluation.{AugmentedExamplesEvaluator, MulticlassClassifierEvaluator}
import loaders.CifarLoader
import nodes.images._
import nodes.learning.{GaussianKernelGenerator, KernelRidgeRegression, ZCAWhitener, ZCAWhitenerEstimator}
import nodes.stats.{StandardScaler, Sampler}
import nodes.util.{Cacher, ClassLabelIndicatorsFromIntLabels, Shuffler}
import pipelines.FunctionNode
import pipelines.Logging
import workflow.Pipeline
import utils.{MatrixUtils, Stats, Image, ImageUtils}
object RandomPatchCifarAugmentedKernel extends Serializable with Logging {
val appName = "RandomPatchCifarAugmentedKernel"
class LabelAugmenter[T: ClassTag](mult: Int) extends FunctionNode[RDD[T], RDD[T]] {
def apply(in: RDD[T]) = in.flatMap(x => Seq.fill(mult)(x))
}
def run(sc: SparkContext, conf: RandomPatchCifarAugmentedKernelConfig): Pipeline[Image, DenseVector[Double]] = {
// Set up some constants.
val numClasses = 10
val numChannels = 3
val whitenerSize = 100000
val augmentImgSize = 24
val flipChance = 0.5
// Load up training data, and optionally sample.
val trainData = conf.sampleFrac match {
case Some(f) => CifarLoader(sc, conf.trainLocation).sample(false, f).cache
case None => CifarLoader(sc, conf.trainLocation).cache
}
val trainImages = ImageExtractor(trainData)
val patchExtractor = new Windower(conf.patchSteps, conf.patchSize) andThen
ImageVectorizer.apply andThen
new Sampler(whitenerSize)
val (filters, whitener): (DenseMatrix[Double], ZCAWhitener) = {
val baseFilters = patchExtractor(trainImages)
val baseFilterMat = Stats.normalizeRows(MatrixUtils.rowsToMatrix(baseFilters), 10.0)
val whitener = new ZCAWhitenerEstimator(eps=conf.whiteningEpsilon).fitSingle(baseFilterMat)
//Normalize them.
val sampleFilters = MatrixUtils.sampleRows(baseFilterMat, conf.numFilters)
val unnormFilters = whitener(sampleFilters)
val unnormSq = pow(unnormFilters, 2.0)
val twoNorms = sqrt(sum(unnormSq(*, ::)))
((unnormFilters(::, *) / (twoNorms + 1e-10)) * whitener.whitener.t, whitener)
}
val trainImagesAugmented = RandomImageTransformer(flipChance, ImageUtils.flipHorizontal).apply(
RandomPatcher(conf.numRandomImagesAugment, augmentImgSize, augmentImgSize).apply(
trainImages))
val labelExtractor = LabelExtractor andThen ClassLabelIndicatorsFromIntLabels(numClasses)
val trainLabels = labelExtractor(trainData)
val trainLabelsAugmented = new LabelAugmenter(conf.numRandomImagesAugment).apply(trainLabels.get)
val trainImageLabelsShuffled = (new Shuffler[(Image, DenseVector[Double])] andThen
new Cacher[(Image, DenseVector[Double])](Some("shuffled"))).apply(
trainImagesAugmented.zip(trainLabelsAugmented))
val trainImagesShuffled = trainImageLabelsShuffled.get.map(_._1)
val trainLabelsShuffled = trainImageLabelsShuffled.get.map(_._2)
val predictionPipeline =
new Convolver(filters, augmentImgSize, augmentImgSize, numChannels, Some(whitener), true) andThen
SymmetricRectifier(alpha=conf.alpha) andThen
new Pooler(conf.poolStride, conf.poolSize, identity, sum(_)) andThen
ImageVectorizer andThen
new Cacher[DenseVector[Double]](Some("features")) andThen
(new StandardScaler, trainImagesShuffled) andThen
(new KernelRidgeRegression(
new GaussianKernelGenerator(conf.gamma, conf.cacheKernel),
conf.lambda.getOrElse(0.0),
conf.blockSize, // blockSize
conf.numEpochs, // numEpochs
conf.seed), // blockPermuter
trainImagesShuffled, trainLabelsShuffled) andThen
new Cacher[DenseVector[Double]]
// Do testing.
val testData = CifarLoader(sc, conf.testLocation)
val testImages = ImageExtractor(testData)
val numTestAugment = 10 // 4 corners, center and flips of each of the 5
val testImagesAugmented = CenterCornerPatcher(augmentImgSize, augmentImgSize, true).apply(
testImages)
// Create augmented image-ids by assiging a unique id to each test image and then
// augmenting the id
val testImageIdsAugmented = new LabelAugmenter(numTestAugment).apply(
testImages.zipWithUniqueId.map(x => x._2))
val testLabelsAugmented = new LabelAugmenter(numTestAugment).apply(LabelExtractor(testData))
val testPredictions = predictionPipeline(testImagesAugmented)
val testEval = AugmentedExamplesEvaluator(
testImageIdsAugmented, testPredictions.get, testLabelsAugmented, numClasses)
logInfo(s"Test error is: ${testEval.totalError}")
predictionPipeline
}
case class RandomPatchCifarAugmentedKernelConfig(
trainLocation: String = "",
testLocation: String = "",
numFilters: Int = 100,
whiteningEpsilon: Double = 0.1,
patchSize: Int = 6,
patchSteps: Int = 1,
poolSize: Int = 10,
poolStride: Int = 9,
alpha: Double = 0.25,
gamma: Double = 2e-4,
cacheKernel: Boolean = true,
blockSize: Int = 5000,
numEpochs: Int = 1,
seed: Option[Long] = None,
lambda: Option[Double] = None,
sampleFrac: Option[Double] = None,
numRandomImagesAugment: Int = 10,
checkpointDir: Option[String] = None)
def parse(args: Array[String]): RandomPatchCifarAugmentedKernelConfig = {
new OptionParser[RandomPatchCifarAugmentedKernelConfig](appName) {
head(appName, "0.1")
help("help") text("prints this usage text")
opt[String]("trainLocation") required() action { (x,c) => c.copy(trainLocation=x) }
opt[String]("testLocation") required() action { (x,c) => c.copy(testLocation=x) }
opt[Int]("numFilters") action { (x,c) => c.copy(numFilters=x) }
opt[Double]("whiteningEpsilon") required() action { (x,c) => c.copy(whiteningEpsilon=x) }
opt[Int]("patchSize") action { (x,c) => c.copy(patchSize=x) }
opt[Int]("patchSteps") action { (x,c) => c.copy(patchSteps=x) }
opt[Int]("poolSize") action { (x,c) => c.copy(poolSize=x) }
opt[Int]("numRandomImagesAugment") action { (x,c) => c.copy(numRandomImagesAugment=x) }
opt[Double]("alpha") action { (x,c) => c.copy(alpha=x) }
opt[Double]("gamma") action { (x,c) => c.copy(gamma=x) }
opt[Boolean]("cacheKernel") action { (x,c) => c.copy(cacheKernel=x) }
opt[Int]("blockSize") action { (x,c) => c.copy(blockSize=x) }
opt[Int]("numEpochs") action { (x,c) => c.copy(numEpochs=x) }
opt[Long]("seed") action { (x,c) => c.copy(seed=Some(x)) }
opt[Double]("lambda") action { (x,c) => c.copy(lambda=Some(x)) }
opt[Double]("sampleFrac") action { (x,c) => c.copy(sampleFrac=Some(x)) }
opt[String]("checkpointDir") action { (x,c) => c.copy(checkpointDir=Some(x)) }
}.parse(args, RandomPatchCifarAugmentedKernelConfig()).get
}
/**
* The actual driver receives its configuration parameters from spark-submit usually.
* @param args
*/
def main(args: Array[String]) = {
val appConfig = parse(args)
val conf = new SparkConf().setAppName(appName)
conf.setIfMissing("spark.master", "local[2]")
// NOTE: ONLY APPLICABLE IF YOU CAN DONE COPY-DIR
conf.remove("spark.jars")
val sc = new SparkContext(conf)
appConfig.checkpointDir.foreach(dir => sc.setCheckpointDir(dir))
run(sc, appConfig)
sc.stop()
}
}
| {
"content_hash": "979cdbab55a7356162e0c0a30cea8c16",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 114,
"avg_line_length": 42.11602209944751,
"alnum_prop": 0.6972320608684245,
"repo_name": "tomerk/keystone",
"id": "2c4261ce2c5b5c44b45db43db2c50d9dc6903827",
"size": "7623",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/pipelines/images/cifar/RandomPatchCifarAugmentedKernel.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "15759"
},
{
"name": "Makefile",
"bytes": "2711"
},
{
"name": "Python",
"bytes": "812"
},
{
"name": "R",
"bytes": "1559"
},
{
"name": "Scala",
"bytes": "690196"
},
{
"name": "Shell",
"bytes": "6427"
}
],
"symlink_target": ""
} |
DO LANGUAGE plpgsql $$
BEGIN
IF (SELECT COUNT(id)::int FROM departement WHERE nom = 'testing') = 0 THEN
INSERT INTO departement (nom, numero) VALUES ('testing', 999);
RAISE NOTICE 'departement testing has been inserted';
END IF;
END;
$$;
DO LANGUAGE plpgsql $$
DECLARE
departement_id int;
zupc_id int;
BEGIN
SELECT id INTO departement_id FROM departement WHERE nom='testing';
IF (SELECT COUNT(id)::int FROM "ZUPC" WHERE nom = 'testing') = 0 THEN
INSERT INTO "ZUPC" ("departement_id", "nom", "insee", "shape", active) VALUES (departement_id, 'testing', '999999', ST_geomFROMGEOJSON('{"type": "MultiPolygon","coordinates": [[[[0.0, 0.0], [0.0, 1.0], [1.0, 1.0],[1.0, 0.0], [0.0, 0.0] ]]]}'), true);
RAISE NOTICE 'zupc testing has been inserted';
END IF;
SELECT id INTO zupc_id FROM "ZUPC" where nom = 'testing';
UPDATE "ZUPC" SET parent_id = zupc_id where id = zupc_id;
END;
$$;
| {
"content_hash": "ed6f2ecb201f44b2cc580cc9dd93e8db",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 262,
"avg_line_length": 44,
"alnum_prop": 0.5928853754940712,
"repo_name": "openmaraude/fab_taxi",
"id": "9244f2833e220ad89fa4b3c4d7e86ec007142138",
"size": "1012",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "files/add_departement_zupc.sql",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "129"
},
{
"name": "PLpgSQL",
"bytes": "1606"
},
{
"name": "Python",
"bytes": "35862"
},
{
"name": "Shell",
"bytes": "231"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>QsciCommand</name>
<message>
<location filename="qscicommandset.cpp" line="44"/>
<source>Move down one line</source>
<translation>Mover uma linha para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="54"/>
<source>Extend selection down one line</source>
<translation>Extender a seleção uma linha para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="71"/>
<source>Scroll view down one line</source>
<translation>Descer a visão uma linha para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="64"/>
<source>Extend rectangular selection down one line</source>
<translation>Extender a seleção retangular uma linha para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="81"/>
<source>Move up one line</source>
<translation>Mover uma linha para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="91"/>
<source>Extend selection up one line</source>
<translation>Extender a seleção uma linha para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="108"/>
<source>Scroll view up one line</source>
<translation>Subir a visão uma linha para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="101"/>
<source>Extend rectangular selection up one line</source>
<translation>Extender a seleção retangular uma linha para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="158"/>
<source>Move up one paragraph</source>
<translation>Mover um paragrafo para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="164"/>
<source>Extend selection up one paragraph</source>
<translation>Extender a seleção um paragrafo para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="145"/>
<source>Move down one paragraph</source>
<translation>Mover um paragrafo para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="118"/>
<source>Scroll to start of document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="128"/>
<source>Scroll to end of document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="138"/>
<source>Scroll vertically to centre current line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="151"/>
<source>Extend selection down one paragraph</source>
<translation>Extender a seleção um paragrafo para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="175"/>
<source>Move left one character</source>
<translation>Mover um caractere para a esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="185"/>
<source>Extend selection left one character</source>
<translation>Extender a seleção um caractere para esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="239"/>
<source>Move left one word</source>
<translation>Mover uma palavra para esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="249"/>
<source>Extend selection left one word</source>
<translation>Extender a seleção uma palavra para esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="196"/>
<source>Extend rectangular selection left one character</source>
<translation>Extender a seleção retangular um caractere para esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="207"/>
<source>Move right one character</source>
<translation>Mover um caractere para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="217"/>
<source>Extend selection right one character</source>
<translation>Extender a seleção um caractere para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="259"/>
<source>Move right one word</source>
<translation>Mover uma palavra para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="265"/>
<source>Extend selection right one word</source>
<translation>Extender a seleção uma palavra para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="228"/>
<source>Extend rectangular selection right one character</source>
<translation>Extender a seleção retangular um caractere para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="271"/>
<source>Move to end of previous word</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="277"/>
<source>Extend selection to end of previous word</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="288"/>
<source>Move to end of next word</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="298"/>
<source>Extend selection to end of next word</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="305"/>
<source>Move left one word part</source>
<translation>Mover uma parte da palavra para esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="311"/>
<source>Extend selection left one word part</source>
<translation>Extender a seleção uma parte de palavra para esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="318"/>
<source>Move right one word part</source>
<translation>Mover uma parte da palavra para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="324"/>
<source>Extend selection right one word part</source>
<translation>Extender a seleção uma parte de palavra para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="558"/>
<source>Move up one page</source>
<translation>Mover uma página para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="568"/>
<source>Extend selection up one page</source>
<translation>Extender a seleção uma página para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="578"/>
<source>Extend rectangular selection up one page</source>
<translation>Extender a seleção retangular uma página para cima</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="593"/>
<source>Move down one page</source>
<translation>Mover uma página para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="607"/>
<source>Extend selection down one page</source>
<translation>Extender a seleção uma página para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="621"/>
<source>Extend rectangular selection down one page</source>
<translation>Extender a seleção retangular uma página para baixo</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="658"/>
<source>Delete current character</source>
<translation>Excluir caractere atual</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="788"/>
<source>Cut selection</source>
<translation>Recortar seleção</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="687"/>
<source>Delete word to right</source>
<translation>Excluir palavra para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="335"/>
<source>Move to start of document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="345"/>
<source>Extend selection to start of document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="356"/>
<source>Extend rectangular selection to start of document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="367"/>
<source>Move to start of display line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="377"/>
<source>Extend selection to start of display line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="384"/>
<source>Move to start of display or document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="391"/>
<source>Extend selection to start of display or document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="402"/>
<source>Move to first visible character in document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="413"/>
<source>Extend selection to first visible character in document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="424"/>
<source>Extend rectangular selection to first visible character in document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="431"/>
<source>Move to first visible character of display in document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="438"/>
<source>Extend selection to first visible character in display or document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="449"/>
<source>Move to end of document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="459"/>
<source>Extend selection to end of document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="470"/>
<source>Extend rectangular selection to end of document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="481"/>
<source>Move to end of display line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="491"/>
<source>Extend selection to end of display line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="498"/>
<source>Move to end of display or document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="505"/>
<source>Extend selection to end of display or document line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="516"/>
<source>Move to start of document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="526"/>
<source>Extend selection to start of document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="537"/>
<source>Move to end of document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="547"/>
<source>Extend selection to end of document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="628"/>
<source>Stuttered move up one page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="634"/>
<source>Stuttered extend selection up one page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="641"/>
<source>Stuttered move down one page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="647"/>
<source>Stuttered extend selection down one page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="674"/>
<source>Delete previous character if not at start of line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="697"/>
<source>Delete right to end of next word</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="714"/>
<source>Delete line to right</source>
<translation>Excluir linha para direita</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="738"/>
<source>Transpose current and previous lines</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="745"/>
<source>Duplicate the current line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="751"/>
<source>Select all</source>
<oldsource>Select document</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="757"/>
<source>Move selected lines up one line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="763"/>
<source>Move selected lines down one line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="806"/>
<source>Toggle insert/overtype</source>
<translation>Alternar entre modo de inserir/sobreescrever</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="800"/>
<source>Paste</source>
<translation>Copiar</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="794"/>
<source>Copy selection</source>
<translation>Copiar seleção</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="812"/>
<source>Insert newline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="830"/>
<source>De-indent one level</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="836"/>
<source>Cancel</source>
<translation>Cancelar</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="668"/>
<source>Delete previous character</source>
<translation>Excluir caractere anterior</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="681"/>
<source>Delete word to left</source>
<translation>Excluir palavra a esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="704"/>
<source>Delete line to left</source>
<translation>Excluir linha a esquerda</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="842"/>
<source>Undo last command</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="852"/>
<source>Redo last command</source>
<translation>Refazer último comando</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="824"/>
<source>Indent one level</source>
<translation>Indentar um nível</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="858"/>
<source>Zoom in</source>
<translation>Aumentar zoom</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="864"/>
<source>Zoom out</source>
<translation>Diminuir zoom</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="818"/>
<source>Formfeed</source>
<translation>Alimentação da Página</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="726"/>
<source>Cut current line</source>
<translation>Configurar linha atual</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="720"/>
<source>Delete current line</source>
<translation>Excluir linha atual</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="732"/>
<source>Copy current line</source>
<translation>Copiar linha atual</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="776"/>
<source>Convert selection to lower case</source>
<translation>Converter a seleção para minúscula</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="782"/>
<source>Convert selection to upper case</source>
<translation>Converter a seleção para maiúscula</translation>
</message>
<message>
<location filename="qscicommandset.cpp" line="770"/>
<source>Duplicate selection</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerAVS</name>
<message>
<location filename="qscilexeravs.cpp" line="280"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="283"/>
<source>Block comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="286"/>
<source>Nested block comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="289"/>
<source>Line comment</source>
<translation type="unfinished">Comentar Linha</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="292"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="295"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="298"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="301"/>
<source>Double-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="304"/>
<source>Triple double-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por três aspas duplas</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="307"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="310"/>
<source>Filter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="313"/>
<source>Plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="316"/>
<source>Function</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="319"/>
<source>Clip property</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeravs.cpp" line="322"/>
<source>User defined</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerBash</name>
<message>
<location filename="qscilexerbash.cpp" line="193"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="196"/>
<source>Error</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="199"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="202"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="205"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="208"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="211"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="214"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="217"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="220"/>
<source>Scalar</source>
<translation>Escalar</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="223"/>
<source>Parameter expansion</source>
<translation>Parâmetro de Expansão</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="226"/>
<source>Backticks</source>
<translation>Aspas Invertidas</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="229"/>
<source>Here document delimiter</source>
<translation>Delimitador de "here documents"</translation>
</message>
<message>
<location filename="qscilexerbash.cpp" line="232"/>
<source>Single-quoted here document</source>
<translation>"here document" envolvido por aspas simples</translation>
</message>
</context>
<context>
<name>QsciLexerBatch</name>
<message>
<location filename="qscilexerbatch.cpp" line="164"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="167"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="170"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="173"/>
<source>Label</source>
<translation>Rótulo</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="176"/>
<source>Hide command character</source>
<translation>Esconder caractere de comando</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="179"/>
<source>External command</source>
<translation>Comando externo</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="182"/>
<source>Variable</source>
<translation>Variável</translation>
</message>
<message>
<location filename="qscilexerbatch.cpp" line="185"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
</context>
<context>
<name>QsciLexerCMake</name>
<message>
<location filename="qscilexercmake.cpp" line="181"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="184"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="187"/>
<source>String</source>
<translation type="unfinished">Cadeia de Caracteres</translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="190"/>
<source>Left quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="193"/>
<source>Right quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="196"/>
<source>Function</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="199"/>
<source>Variable</source>
<translation type="unfinished">Variável</translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="202"/>
<source>Label</source>
<translation type="unfinished">Rótulo</translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="205"/>
<source>User defined</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="208"/>
<source>WHILE block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="211"/>
<source>FOREACH block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="214"/>
<source>IF block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="217"/>
<source>MACRO block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="220"/>
<source>Variable within a string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercmake.cpp" line="223"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
</context>
<context>
<name>QsciLexerCPP</name>
<message>
<location filename="qscilexercpp.cpp" line="340"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="343"/>
<source>Inactive default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="346"/>
<source>C comment</source>
<translation>Comentário C</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="349"/>
<source>Inactive C comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="352"/>
<source>C++ comment</source>
<translation>Comentário C++</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="355"/>
<source>Inactive C++ comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="358"/>
<source>JavaDoc style C comment</source>
<translation>Comentário JavaDoc estilo C</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="361"/>
<source>Inactive JavaDoc style C comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="364"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="367"/>
<source>Inactive number</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="370"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="373"/>
<source>Inactive keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="376"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="379"/>
<source>Inactive double-quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="382"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="385"/>
<source>Inactive single-quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="388"/>
<source>IDL UUID</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="391"/>
<source>Inactive IDL UUID</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="394"/>
<source>Pre-processor block</source>
<translation>Instruções de pré-processamento</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="397"/>
<source>Inactive pre-processor block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="400"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="403"/>
<source>Inactive operator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="406"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="409"/>
<source>Inactive identifier</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="412"/>
<source>Unclosed string</source>
<translation>Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="415"/>
<source>Inactive unclosed string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="418"/>
<source>C# verbatim string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="421"/>
<source>Inactive C# verbatim string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="424"/>
<source>JavaScript regular expression</source>
<translation type="unfinished">Expressão regular JavaScript</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="427"/>
<source>Inactive JavaScript regular expression</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="430"/>
<source>JavaDoc style C++ comment</source>
<translation>Comentário JavaDoc estilo C++</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="433"/>
<source>Inactive JavaDoc style C++ comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="436"/>
<source>Secondary keywords and identifiers</source>
<translation>Identificadores e palavras chave secundárias</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="439"/>
<source>Inactive secondary keywords and identifiers</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="442"/>
<source>JavaDoc keyword</source>
<translation>Palavra chave JavaDoc</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="445"/>
<source>Inactive JavaDoc keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="448"/>
<source>JavaDoc keyword error</source>
<translation>Erro de palavra chave do JavaDoc</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="451"/>
<source>Inactive JavaDoc keyword error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="454"/>
<source>Global classes and typedefs</source>
<translation>Classes e definições de tipo globais</translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="457"/>
<source>Inactive global classes and typedefs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="460"/>
<source>C++ raw string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="463"/>
<source>Inactive C++ raw string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="466"/>
<source>Vala triple-quoted verbatim string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="469"/>
<source>Inactive Vala triple-quoted verbatim string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="472"/>
<source>Pike hash-quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="475"/>
<source>Inactive Pike hash-quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="478"/>
<source>Pre-processor C comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="481"/>
<source>Inactive pre-processor C comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="484"/>
<source>JavaDoc style pre-processor comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercpp.cpp" line="487"/>
<source>Inactive JavaDoc style pre-processor comment</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerCSS</name>
<message>
<location filename="qscilexercss.cpp" line="222"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="225"/>
<source>Tag</source>
<translation>Marcador</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="228"/>
<source>Class selector</source>
<translation>Seletor de classe</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="231"/>
<source>Pseudo-class</source>
<translation>Pseudo-classe</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="234"/>
<source>Unknown pseudo-class</source>
<translation>Pseudo-classe desconhecida</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="237"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="240"/>
<source>CSS1 property</source>
<translation>Propriedade CSS1</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="243"/>
<source>Unknown property</source>
<translation>Propriedade desconhecida</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="246"/>
<source>Value</source>
<translation>Valor</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="249"/>
<source>ID selector</source>
<translation>Seletor de ID</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="252"/>
<source>Important</source>
<translation>Importante</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="255"/>
<source>@-rule</source>
<translation>regra-@</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="258"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="261"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="264"/>
<source>CSS2 property</source>
<translation>Propriedade CSS2</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="267"/>
<source>Attribute</source>
<translation>Atributo</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="270"/>
<source>CSS3 property</source>
<translation type="unfinished">Propriedade CSS2 {3 ?}</translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="273"/>
<source>Pseudo-element</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="276"/>
<source>Extended CSS property</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="279"/>
<source>Extended pseudo-class</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="282"/>
<source>Extended pseudo-element</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="285"/>
<source>Media rule</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercss.cpp" line="288"/>
<source>Variable</source>
<translation type="unfinished">Variável</translation>
</message>
</context>
<context>
<name>QsciLexerCSharp</name>
<message>
<location filename="qscilexercsharp.cpp" line="95"/>
<source>Verbatim string</source>
<translation>Cadeia de caracteres no formato verbatim</translation>
</message>
</context>
<context>
<name>QsciLexerCoffeeScript</name>
<message>
<location filename="qscilexercoffeescript.cpp" line="244"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="247"/>
<source>C-style comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="250"/>
<source>C++-style comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="253"/>
<source>JavaDoc C-style comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="256"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="259"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="262"/>
<source>Double-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="265"/>
<source>Single-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="268"/>
<source>IDL UUID</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="271"/>
<source>Pre-processor block</source>
<translation type="unfinished">Instruções de pré-processamento</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="274"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="277"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="280"/>
<source>Unclosed string</source>
<translation type="unfinished">Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="283"/>
<source>C# verbatim string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="286"/>
<source>Regular expression</source>
<translation type="unfinished">Expressão Regular</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="289"/>
<source>JavaDoc C++-style comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="292"/>
<source>Secondary keywords and identifiers</source>
<translation type="unfinished">Identificadores e palavras chave secundárias</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="295"/>
<source>JavaDoc keyword</source>
<translation type="unfinished">Palavra chave JavaDoc</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="298"/>
<source>JavaDoc keyword error</source>
<translation type="unfinished">Erro de palavra chave do JavaDoc</translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="301"/>
<source>Global classes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="304"/>
<source>Block comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="307"/>
<source>Block regular expression</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexercoffeescript.cpp" line="310"/>
<source>Block regular expression comment</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerD</name>
<message>
<location filename="qscilexerd.cpp" line="256"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="259"/>
<source>Block comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="262"/>
<source>Line comment</source>
<translation type="unfinished">Comentar Linha</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="265"/>
<source>DDoc style block comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="268"/>
<source>Nesting comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="271"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="274"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="277"/>
<source>Secondary keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="280"/>
<source>Documentation keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="283"/>
<source>Type definition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="286"/>
<source>String</source>
<translation type="unfinished">Cadeia de Caracteres</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="289"/>
<source>Unclosed string</source>
<translation type="unfinished">Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="292"/>
<source>Character</source>
<translation type="unfinished">Caractere</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="295"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="298"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="301"/>
<source>DDoc style line comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="304"/>
<source>DDoc keyword</source>
<translation type="unfinished">Palavra chave JavaDoc</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="307"/>
<source>DDoc keyword error</source>
<translation type="unfinished">Erro de palavra chave do JavaDoc</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="310"/>
<source>Backquoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="313"/>
<source>Raw string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="316"/>
<source>User defined 1</source>
<translation type="unfinished">Definição de usuário 1</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="319"/>
<source>User defined 2</source>
<translation type="unfinished">Definição de usuário 2</translation>
</message>
<message>
<location filename="qscilexerd.cpp" line="322"/>
<source>User defined 3</source>
<translation type="unfinished">Definição de usuário 3</translation>
</message>
</context>
<context>
<name>QsciLexerDiff</name>
<message>
<location filename="qscilexerdiff.cpp" line="92"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="95"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="98"/>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="101"/>
<source>Header</source>
<translation>Cabeçalho</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="104"/>
<source>Position</source>
<translation>Posição</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="107"/>
<source>Removed line</source>
<translation>Linha Removida</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="110"/>
<source>Added line</source>
<translation>Linha Adicionada</translation>
</message>
<message>
<location filename="qscilexerdiff.cpp" line="113"/>
<source>Changed line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerFortran77</name>
<message>
<location filename="qscilexerfortran77.cpp" line="176"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="179"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="182"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="185"/>
<source>Single-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="188"/>
<source>Double-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="191"/>
<source>Unclosed string</source>
<translation type="unfinished">Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="194"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="197"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="200"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="203"/>
<source>Intrinsic function</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="206"/>
<source>Extended function</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="209"/>
<source>Pre-processor block</source>
<translation type="unfinished">Instruções de pré-processamento</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="212"/>
<source>Dotted operator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="215"/>
<source>Label</source>
<translation type="unfinished">Rótulo</translation>
</message>
<message>
<location filename="qscilexerfortran77.cpp" line="218"/>
<source>Continuation</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerHTML</name>
<message>
<location filename="qscilexerhtml.cpp" line="553"/>
<source>HTML default</source>
<translation>HTML por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="556"/>
<source>Tag</source>
<translation>Marcador</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="559"/>
<source>Unknown tag</source>
<translation>Marcador desconhecido</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="562"/>
<source>Attribute</source>
<translation>Atributo</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="565"/>
<source>Unknown attribute</source>
<translation>Atributo desconhecido</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="568"/>
<source>HTML number</source>
<translation>Número HTML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="571"/>
<source>HTML double-quoted string</source>
<translation>Cadeia de caracteres HTML envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="574"/>
<source>HTML single-quoted string</source>
<translation>Cadeia de caracteres HTML envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="577"/>
<source>Other text in a tag</source>
<translation>Outro texto em um marcador</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="580"/>
<source>HTML comment</source>
<translation>Comentário HTML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="583"/>
<source>Entity</source>
<translation>Entidade</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="586"/>
<source>End of a tag</source>
<translation>Final de um marcador</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="589"/>
<source>Start of an XML fragment</source>
<translation>Início de um bloco XML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="592"/>
<source>End of an XML fragment</source>
<translation>Final de um bloco XML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="595"/>
<source>Script tag</source>
<translation>Marcador de script</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="598"/>
<source>Start of an ASP fragment with @</source>
<translation>Início de um bloco ASP com @</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="601"/>
<source>Start of an ASP fragment</source>
<translation>Início de um bloco ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="604"/>
<source>CDATA</source>
<translation>CDATA</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="607"/>
<source>Start of a PHP fragment</source>
<translation>Início de um bloco PHP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="610"/>
<source>Unquoted HTML value</source>
<translation>Valor HTML não envolvido por aspas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="613"/>
<source>ASP X-Code comment</source>
<translation>Comentário ASP X-Code</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="616"/>
<source>SGML default</source>
<translation>SGML por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="619"/>
<source>SGML command</source>
<translation>Comando SGML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="622"/>
<source>First parameter of an SGML command</source>
<translation>Primeiro parâmetro em um comando SGML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="625"/>
<source>SGML double-quoted string</source>
<translation>Cadeia de caracteres SGML envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="628"/>
<source>SGML single-quoted string</source>
<translation>Cadeia de caracteres SGML envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="631"/>
<source>SGML error</source>
<translation>Erro SGML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="634"/>
<source>SGML special entity</source>
<translation>Entidade especial SGML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="637"/>
<source>SGML comment</source>
<translation>Comando SGML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="640"/>
<source>First parameter comment of an SGML command</source>
<translation>Primeiro comentário de parâmetro de uma comando SGML</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="643"/>
<source>SGML block default</source>
<translation>Bloco SGML por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="646"/>
<source>Start of a JavaScript fragment</source>
<translation>Início de um bloco Javascript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="649"/>
<source>JavaScript default</source>
<translation>JavaScript por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="652"/>
<source>JavaScript comment</source>
<translation>Comentário JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="655"/>
<source>JavaScript line comment</source>
<translation>Comentário de linha JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="658"/>
<source>JavaDoc style JavaScript comment</source>
<translation>Comentário JavaScript no estilo JavaDoc</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="661"/>
<source>JavaScript number</source>
<translation>Número JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="664"/>
<source>JavaScript word</source>
<translation>Palavra JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="667"/>
<source>JavaScript keyword</source>
<translation>Palavra chave JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="670"/>
<source>JavaScript double-quoted string</source>
<translation>Cadeia de caracteres JavaScript envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="673"/>
<source>JavaScript single-quoted string</source>
<translation>Cadeia de caracteres JavaScript envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="676"/>
<source>JavaScript symbol</source>
<translation>Símbolo JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="679"/>
<source>JavaScript unclosed string</source>
<translation>Cadeia de caracteres JavaScript não fechada</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="682"/>
<source>JavaScript regular expression</source>
<translation>Expressão regular JavaScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="685"/>
<source>Start of an ASP JavaScript fragment</source>
<translation>Início de um bloco Javascript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="688"/>
<source>ASP JavaScript default</source>
<translation>JavaScript ASP por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="691"/>
<source>ASP JavaScript comment</source>
<translation>Comentário JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="694"/>
<source>ASP JavaScript line comment</source>
<translation>Comentário de linha JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="697"/>
<source>JavaDoc style ASP JavaScript comment</source>
<translation>Comentário JavaScript ASP no estilo JavaDoc</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="700"/>
<source>ASP JavaScript number</source>
<translation>Número JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="703"/>
<source>ASP JavaScript word</source>
<translation>Palavra chave JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="706"/>
<source>ASP JavaScript keyword</source>
<translation>Palavra chave JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="709"/>
<source>ASP JavaScript double-quoted string</source>
<translation>Cadeia de caracteres JavaScript ASP envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="712"/>
<source>ASP JavaScript single-quoted string</source>
<translation>Cadeia de caracteres JavaScript ASP envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="715"/>
<source>ASP JavaScript symbol</source>
<translation>Símbolo JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="718"/>
<source>ASP JavaScript unclosed string</source>
<translation>Cadeia de caracteres JavaScript ASP não fechada</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="721"/>
<source>ASP JavaScript regular expression</source>
<translation>Expressão regular JavaScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="724"/>
<source>Start of a VBScript fragment</source>
<translation>Início de um bloco VBScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="727"/>
<source>VBScript default</source>
<translation>VBScript por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="730"/>
<source>VBScript comment</source>
<translation>Comentário VBScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="733"/>
<source>VBScript number</source>
<translation>Número VBScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="736"/>
<source>VBScript keyword</source>
<translation>Palavra chave VBScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="739"/>
<source>VBScript string</source>
<translation>Cadeia de caracteres VBScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="742"/>
<source>VBScript identifier</source>
<translation>Identificador VBScript</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="745"/>
<source>VBScript unclosed string</source>
<translation>Cadeia de caracteres VBScript não fechada</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="748"/>
<source>Start of an ASP VBScript fragment</source>
<translation>Início de um bloco VBScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="751"/>
<source>ASP VBScript default</source>
<translation>VBScript ASP por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="754"/>
<source>ASP VBScript comment</source>
<translation>Comentário VBScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="757"/>
<source>ASP VBScript number</source>
<translation>Número VBScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="760"/>
<source>ASP VBScript keyword</source>
<translation>Palavra chave VBScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="763"/>
<source>ASP VBScript string</source>
<translation>Cadeia de caracteres VBScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="766"/>
<source>ASP VBScript identifier</source>
<translation>Identificador VBScript ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="769"/>
<source>ASP VBScript unclosed string</source>
<translation>Cadeia de caracteres VBScript ASP não fechada</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="772"/>
<source>Start of a Python fragment</source>
<translation>Início de um bloco Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="775"/>
<source>Python default</source>
<translation>Python por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="778"/>
<source>Python comment</source>
<translation>Comentário Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="781"/>
<source>Python number</source>
<translation>Número Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="784"/>
<source>Python double-quoted string</source>
<translation>Cadeia de caracteres Python envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="787"/>
<source>Python single-quoted string</source>
<translation>Cadeia de caracteres Python envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="790"/>
<source>Python keyword</source>
<translation>Palavra chave Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="793"/>
<source>Python triple double-quoted string</source>
<translation>Cadeia de caracteres Python envolvida por aspas triplas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="796"/>
<source>Python triple single-quoted string</source>
<translation>Cadeia de caracteres Python envolvida por aspas triplas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="799"/>
<source>Python class name</source>
<translation>Nome de classe Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="802"/>
<source>Python function or method name</source>
<translation>Nome de método ou função Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="805"/>
<source>Python operator</source>
<translation>Operador Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="808"/>
<source>Python identifier</source>
<translation>Identificador Python</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="811"/>
<source>Start of an ASP Python fragment</source>
<translation>Início de um bloco Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="814"/>
<source>ASP Python default</source>
<translation>Python ASP por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="817"/>
<source>ASP Python comment</source>
<translation>Comentário Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="820"/>
<source>ASP Python number</source>
<translation>Número Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="823"/>
<source>ASP Python double-quoted string</source>
<translation>Cadeia de caracteres Python ASP envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="826"/>
<source>ASP Python single-quoted string</source>
<translation>Cadeia de caracteres Python ASP envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="829"/>
<source>ASP Python keyword</source>
<translation>Palavra chave Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="832"/>
<source>ASP Python triple double-quoted string</source>
<translation>Cadeia de caracteres Python ASP envolvida por aspas triplas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="835"/>
<source>ASP Python triple single-quoted string</source>
<translation>Cadeia de caracteres Python ASP envolvida por aspas triplas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="838"/>
<source>ASP Python class name</source>
<translation>Nome de classe Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="841"/>
<source>ASP Python function or method name</source>
<translation>Nome de método ou função Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="844"/>
<source>ASP Python operator</source>
<translation>Operador Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="847"/>
<source>ASP Python identifier</source>
<translation>Identificador Python ASP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="850"/>
<source>PHP default</source>
<translation>PHP por padrão</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="853"/>
<source>PHP double-quoted string</source>
<translation>Cadeia de caracteres PHP envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="856"/>
<source>PHP single-quoted string</source>
<translation>Cadeia de caracteres PHP envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="859"/>
<source>PHP keyword</source>
<translation>Palavra chave PHP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="862"/>
<source>PHP number</source>
<translation>Número PHP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="865"/>
<source>PHP variable</source>
<translation>Variável PHP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="868"/>
<source>PHP comment</source>
<translation>Comentário PHP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="871"/>
<source>PHP line comment</source>
<translation>Comentário de linha PHP</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="874"/>
<source>PHP double-quoted variable</source>
<translation>Variável PHP envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerhtml.cpp" line="877"/>
<source>PHP operator</source>
<translation>Operador PHP</translation>
</message>
</context>
<context>
<name>QsciLexerIDL</name>
<message>
<location filename="qscilexeridl.cpp" line="87"/>
<source>UUID</source>
<translation>UUID</translation>
</message>
</context>
<context>
<name>QsciLexerJavaScript</name>
<message>
<location filename="qscilexerjavascript.cpp" line="97"/>
<source>Regular expression</source>
<translation>Expressão Regular</translation>
</message>
</context>
<context>
<name>QsciLexerLua</name>
<message>
<location filename="qscilexerlua.cpp" line="218"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="221"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="224"/>
<source>Line comment</source>
<translation>Comentar Linha</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="227"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="230"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="233"/>
<source>String</source>
<translation>Cadeia de Caracteres</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="236"/>
<source>Character</source>
<translation>Caractere</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="239"/>
<source>Literal string</source>
<translation>Cadeia de caracteres literal</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="242"/>
<source>Preprocessor</source>
<translation>Preprocessador</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="245"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="248"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="251"/>
<source>Unclosed string</source>
<translation>Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="254"/>
<source>Basic functions</source>
<translation>Funções básicas</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="257"/>
<source>String, table and maths functions</source>
<translation>Funções de cadeia de caracteres e de tabelas matemáticas</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="260"/>
<source>Coroutines, i/o and system facilities</source>
<translation>Funções auxiiares, e/s e funções de sistema</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="263"/>
<source>User defined 1</source>
<translation type="unfinished">Definição de usuário 1</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="266"/>
<source>User defined 2</source>
<translation type="unfinished">Definição de usuário 2</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="269"/>
<source>User defined 3</source>
<translation type="unfinished">Definição de usuário 3</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="272"/>
<source>User defined 4</source>
<translation type="unfinished">Definição de usuário 4</translation>
</message>
<message>
<location filename="qscilexerlua.cpp" line="275"/>
<source>Label</source>
<translation type="unfinished">Rótulo</translation>
</message>
</context>
<context>
<name>QsciLexerMakefile</name>
<message>
<location filename="qscilexermakefile.cpp" line="116"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexermakefile.cpp" line="119"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexermakefile.cpp" line="122"/>
<source>Preprocessor</source>
<translation>Preprocessador</translation>
</message>
<message>
<location filename="qscilexermakefile.cpp" line="125"/>
<source>Variable</source>
<translation>Variável</translation>
</message>
<message>
<location filename="qscilexermakefile.cpp" line="128"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexermakefile.cpp" line="131"/>
<source>Target</source>
<translation>Destino</translation>
</message>
<message>
<location filename="qscilexermakefile.cpp" line="134"/>
<source>Error</source>
<translation>Erro</translation>
</message>
</context>
<context>
<name>QsciLexerMatlab</name>
<message>
<location filename="qscilexermatlab.cpp" line="123"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="126"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="129"/>
<source>Command</source>
<translation type="unfinished">Comando</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="132"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="135"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="138"/>
<source>Single-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="141"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="144"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexermatlab.cpp" line="147"/>
<source>Double-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
</context>
<context>
<name>QsciLexerPO</name>
<message>
<location filename="qscilexerpo.cpp" line="90"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="93"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="96"/>
<source>Message identifier</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="99"/>
<source>Message identifier text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="102"/>
<source>Message string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="105"/>
<source>Message string text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="108"/>
<source>Message context</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="111"/>
<source>Message context text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="114"/>
<source>Fuzzy flag</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="117"/>
<source>Programmer comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="120"/>
<source>Reference</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="123"/>
<source>Flags</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="126"/>
<source>Message identifier text end-of-line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="129"/>
<source>Message string text end-of-line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpo.cpp" line="132"/>
<source>Message context text end-of-line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerPOV</name>
<message>
<location filename="qscilexerpov.cpp" line="267"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="270"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="273"/>
<source>Comment line</source>
<translation>Comentar Linha</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="276"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="279"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="282"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="285"/>
<source>String</source>
<translation>Cadeia de Caracteres</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="288"/>
<source>Unclosed string</source>
<translation>Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="291"/>
<source>Directive</source>
<translation>Diretiva</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="294"/>
<source>Bad directive</source>
<translation>Diretiva ruim</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="297"/>
<source>Objects, CSG and appearance</source>
<translation>Objetos, CSG e aparência</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="300"/>
<source>Types, modifiers and items</source>
<translation>Tipos, modificadores e itens</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="303"/>
<source>Predefined identifiers</source>
<translation>Identificadores predefinidos</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="306"/>
<source>Predefined functions</source>
<translation>Funções predefinidas</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="309"/>
<source>User defined 1</source>
<translation>Definição de usuário 1</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="312"/>
<source>User defined 2</source>
<translation>Definição de usuário 2</translation>
</message>
<message>
<location filename="qscilexerpov.cpp" line="315"/>
<source>User defined 3</source>
<translation>Definição de usuário 3</translation>
</message>
</context>
<context>
<name>QsciLexerPascal</name>
<message>
<location filename="qscilexerpascal.cpp" line="246"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="258"/>
<source>Line comment</source>
<translation type="unfinished">Comentar Linha</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="267"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="273"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="276"/>
<source>Single-quoted string</source>
<translation type="unfinished">Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="285"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="249"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="252"/>
<source>'{ ... }' style comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="255"/>
<source>'(* ... *)' style comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="261"/>
<source>'{$ ... }' style pre-processor block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="264"/>
<source>'(*$ ... *)' style pre-processor block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="270"/>
<source>Hexadecimal number</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="279"/>
<source>Unclosed string</source>
<translation type="unfinished">Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="282"/>
<source>Character</source>
<translation type="unfinished">Caractere</translation>
</message>
<message>
<location filename="qscilexerpascal.cpp" line="288"/>
<source>Inline asm</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerPerl</name>
<message>
<location filename="qscilexerperl.cpp" line="318"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="321"/>
<source>Error</source>
<translation>Erro</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="324"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="327"/>
<source>POD</source>
<translation>POD</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="330"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="333"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="336"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="339"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="342"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="345"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="348"/>
<source>Scalar</source>
<translation>Escalar</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="351"/>
<source>Array</source>
<translation>Vetor</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="354"/>
<source>Hash</source>
<translation>Hash</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="357"/>
<source>Symbol table</source>
<translation>Tabela de Símbolos</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="360"/>
<source>Regular expression</source>
<translation>Expressão Regular</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="363"/>
<source>Substitution</source>
<translation>Substituição</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="366"/>
<source>Backticks</source>
<translation>Aspas Invertidas</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="369"/>
<source>Data section</source>
<translation>Seção de dados</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="372"/>
<source>Here document delimiter</source>
<translation>Delimitador de documentos criados através de redicionadores (>> e >)</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="375"/>
<source>Single-quoted here document</source>
<translation>"here document" envolvido por aspas simples</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="378"/>
<source>Double-quoted here document</source>
<translation>"here document" envolvido por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="381"/>
<source>Backtick here document</source>
<translation>"here document" envolvido por aspas invertidas</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="384"/>
<source>Quoted string (q)</source>
<translation>Cadeia de caracteres envolvida por aspas (q)</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="387"/>
<source>Quoted string (qq)</source>
<translation>Cadeia de caracteres envolvida por aspas (qq)</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="390"/>
<source>Quoted string (qx)</source>
<translation>Cadeia de caracteres envolvida por aspas (qx)</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="393"/>
<source>Quoted string (qr)</source>
<translation>Cadeia de caracteres envolvida por aspas (qr)</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="396"/>
<source>Quoted string (qw)</source>
<translation>Cadeia de caracteres envolvida por aspas (qw)</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="399"/>
<source>POD verbatim</source>
<translation>POD em formato verbatim</translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="402"/>
<source>Subroutine prototype</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="405"/>
<source>Format identifier</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="408"/>
<source>Format body</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="411"/>
<source>Double-quoted string (interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="414"/>
<source>Translation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="417"/>
<source>Regular expression (interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="420"/>
<source>Substitution (interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="423"/>
<source>Backticks (interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="426"/>
<source>Double-quoted here document (interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="429"/>
<source>Backtick here document (interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="432"/>
<source>Quoted string (qq, interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="435"/>
<source>Quoted string (qx, interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerperl.cpp" line="438"/>
<source>Quoted string (qr, interpolated variable)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerPostScript</name>
<message>
<location filename="qscilexerpostscript.cpp" line="249"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="252"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="255"/>
<source>DSC comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="258"/>
<source>DSC comment value</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="261"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="264"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="267"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="270"/>
<source>Literal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="273"/>
<source>Immediately evaluated literal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="276"/>
<source>Array parenthesis</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="279"/>
<source>Dictionary parenthesis</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="282"/>
<source>Procedure parenthesis</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="285"/>
<source>Text</source>
<translation type="unfinished">Texto</translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="288"/>
<source>Hexadecimal string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="291"/>
<source>Base85 string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpostscript.cpp" line="294"/>
<source>Bad string character</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerProperties</name>
<message>
<location filename="qscilexerproperties.cpp" line="111"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerproperties.cpp" line="114"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerproperties.cpp" line="117"/>
<source>Section</source>
<translation>Seção</translation>
</message>
<message>
<location filename="qscilexerproperties.cpp" line="120"/>
<source>Assignment</source>
<translation>Atribuição</translation>
</message>
<message>
<location filename="qscilexerproperties.cpp" line="123"/>
<source>Default value</source>
<translation>Valor Padrão</translation>
</message>
<message>
<location filename="qscilexerproperties.cpp" line="126"/>
<source>Key</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerPython</name>
<message>
<location filename="qscilexerpython.cpp" line="222"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="225"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="228"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="231"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="234"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="237"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="240"/>
<source>Triple single-quoted string</source>
<translation>Cadeia de caracteres envolvida por três aspas simples</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="243"/>
<source>Triple double-quoted string</source>
<translation>Cadeia de caracteres envolvida por três aspas duplas</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="246"/>
<source>Class name</source>
<translation>Nome da classe</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="249"/>
<source>Function or method name</source>
<translation>Nome da função ou método</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="252"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="255"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="258"/>
<source>Comment block</source>
<translation>Bloco de comentários</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="261"/>
<source>Unclosed string</source>
<translation>Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="264"/>
<source>Highlighted identifier</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerpython.cpp" line="267"/>
<source>Decorator</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerRuby</name>
<message>
<location filename="qscilexerruby.cpp" line="239"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="245"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="251"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="257"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="260"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="254"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="263"/>
<source>Class name</source>
<translation>Nome da classe</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="266"/>
<source>Function or method name</source>
<translation>Nome da função ou método</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="269"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="272"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="242"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="248"/>
<source>POD</source>
<translation type="unfinished">POD</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="275"/>
<source>Regular expression</source>
<translation type="unfinished">Expressão Regular</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="278"/>
<source>Global</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="281"/>
<source>Symbol</source>
<translation type="unfinished">Símbolo</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="284"/>
<source>Module name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="287"/>
<source>Instance variable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="290"/>
<source>Class variable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="293"/>
<source>Backticks</source>
<translation type="unfinished">Aspas Invertidas</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="296"/>
<source>Data section</source>
<translation type="unfinished">Seção de dados</translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="299"/>
<source>Here document delimiter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="302"/>
<source>Here document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="305"/>
<source>%q string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="308"/>
<source>%Q string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="311"/>
<source>%x string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="314"/>
<source>%r string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="317"/>
<source>%w string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="320"/>
<source>Demoted keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="323"/>
<source>stdin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="326"/>
<source>stdout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerruby.cpp" line="329"/>
<source>stderr</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerSQL</name>
<message>
<location filename="qscilexersql.cpp" line="256"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="259"/>
<source>Comment</source>
<translation>Comentário</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="268"/>
<source>Number</source>
<translation>Número</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="271"/>
<source>Keyword</source>
<translation>Palavra Chave</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="277"/>
<source>Single-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas simples</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="286"/>
<source>Operator</source>
<translation>Operador</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="289"/>
<source>Identifier</source>
<translation>Identificador</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="262"/>
<source>Comment line</source>
<translation>Comentário de Linha</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="265"/>
<source>JavaDoc style comment</source>
<translation>Comentário estilo JavaDoc</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="274"/>
<source>Double-quoted string</source>
<translation>Cadeia de caracteres envolvida por aspas duplas</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="280"/>
<source>SQL*Plus keyword</source>
<translation>Palavra chave do SQL*Plus</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="283"/>
<source>SQL*Plus prompt</source>
<translation>Prompt do SQL*Plus</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="292"/>
<source>SQL*Plus comment</source>
<translation>Comentário do SQL*Plus</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="295"/>
<source># comment line</source>
<translation>Comentário de linha usando #</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="298"/>
<source>JavaDoc keyword</source>
<translation>Palavra chave JavaDoc</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="301"/>
<source>JavaDoc keyword error</source>
<translation>Erro de palavra chave do JavaDoc</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="304"/>
<source>User defined 1</source>
<translation>Definição de usuário 1</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="307"/>
<source>User defined 2</source>
<translation>Definição de usuário 2</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="310"/>
<source>User defined 3</source>
<translation>Definição de usuário 3</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="313"/>
<source>User defined 4</source>
<translation>Definição de usuário 4</translation>
</message>
<message>
<location filename="qscilexersql.cpp" line="316"/>
<source>Quoted identifier</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerSpice</name>
<message>
<location filename="qscilexerspice.cpp" line="156"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="159"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="162"/>
<source>Command</source>
<translation type="unfinished">Comando</translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="165"/>
<source>Function</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="168"/>
<source>Parameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="171"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="174"/>
<source>Delimiter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="177"/>
<source>Value</source>
<translation type="unfinished">Valor</translation>
</message>
<message>
<location filename="qscilexerspice.cpp" line="180"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
</context>
<context>
<name>QsciLexerTCL</name>
<message>
<location filename="qscilexertcl.cpp" line="283"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="286"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="289"/>
<source>Comment line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="292"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="295"/>
<source>Quoted keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="298"/>
<source>Quoted string</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="301"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="304"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="307"/>
<source>Substitution</source>
<translation type="unfinished">Substituição</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="310"/>
<source>Brace substitution</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="313"/>
<source>Modifier</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="316"/>
<source>Expand keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="319"/>
<source>TCL keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="322"/>
<source>Tk keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="325"/>
<source>iTCL keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="328"/>
<source>Tk command</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="331"/>
<source>User defined 1</source>
<translation type="unfinished">Definição de usuário 1</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="334"/>
<source>User defined 2</source>
<translation type="unfinished">Definição de usuário 2</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="337"/>
<source>User defined 3</source>
<translation type="unfinished">Definição de usuário 3</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="340"/>
<source>User defined 4</source>
<translation type="unfinished">Definição de usuário 4</translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="343"/>
<source>Comment box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexertcl.cpp" line="346"/>
<source>Comment block</source>
<translation type="unfinished">Bloco de comentários</translation>
</message>
</context>
<context>
<name>QsciLexerTeX</name>
<message>
<location filename="qscilexertex.cpp" line="177"/>
<source>Default</source>
<translation>Padrão</translation>
</message>
<message>
<location filename="qscilexertex.cpp" line="180"/>
<source>Special</source>
<translation>Especial</translation>
</message>
<message>
<location filename="qscilexertex.cpp" line="183"/>
<source>Group</source>
<translation>Grupo</translation>
</message>
<message>
<location filename="qscilexertex.cpp" line="186"/>
<source>Symbol</source>
<translation>Símbolo</translation>
</message>
<message>
<location filename="qscilexertex.cpp" line="189"/>
<source>Command</source>
<translation>Comando</translation>
</message>
<message>
<location filename="qscilexertex.cpp" line="192"/>
<source>Text</source>
<translation>Texto</translation>
</message>
</context>
<context>
<name>QsciLexerVHDL</name>
<message>
<location filename="qscilexervhdl.cpp" line="197"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="200"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="203"/>
<source>Comment line</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="206"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="209"/>
<source>String</source>
<translation type="unfinished">Cadeia de Caracteres</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="212"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="215"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="218"/>
<source>Unclosed string</source>
<translation type="unfinished">Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="221"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="224"/>
<source>Standard operator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="227"/>
<source>Attribute</source>
<translation type="unfinished">Atributo</translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="230"/>
<source>Standard function</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="233"/>
<source>Standard package</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="236"/>
<source>Standard type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexervhdl.cpp" line="239"/>
<source>User defined</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerVerilog</name>
<message>
<location filename="qscilexerverilog.cpp" line="209"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="212"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="215"/>
<source>Line comment</source>
<translation type="unfinished">Comentar Linha</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="218"/>
<source>Bang comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="221"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="224"/>
<source>Primary keywords and identifiers</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="227"/>
<source>String</source>
<translation type="unfinished">Cadeia de Caracteres</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="230"/>
<source>Secondary keywords and identifiers</source>
<translation type="unfinished">Identificadores e palavras chave secundárias</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="233"/>
<source>System task</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="236"/>
<source>Preprocessor block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="239"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="242"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="245"/>
<source>Unclosed string</source>
<translation type="unfinished">Cadeia de caracteres não fechada</translation>
</message>
<message>
<location filename="qscilexerverilog.cpp" line="248"/>
<source>User defined tasks and identifiers</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QsciLexerYAML</name>
<message>
<location filename="qscilexeryaml.cpp" line="161"/>
<source>Default</source>
<translation type="unfinished">Padrão</translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="164"/>
<source>Comment</source>
<translation type="unfinished">Comentário</translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="167"/>
<source>Identifier</source>
<translation type="unfinished">Identificador</translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="170"/>
<source>Keyword</source>
<translation type="unfinished">Palavra Chave</translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="173"/>
<source>Number</source>
<translation type="unfinished">Número</translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="176"/>
<source>Reference</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="179"/>
<source>Document delimiter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="182"/>
<source>Text block marker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="185"/>
<source>Syntax error marker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qscilexeryaml.cpp" line="188"/>
<source>Operator</source>
<translation type="unfinished">Operador</translation>
</message>
</context>
<context>
<name>QsciScintilla</name>
<message>
<location filename="qsciscintilla.cpp" line="4359"/>
<source>&Undo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qsciscintilla.cpp" line="4363"/>
<source>&Redo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qsciscintilla.cpp" line="4369"/>
<source>Cu&t</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qsciscintilla.cpp" line="4374"/>
<source>&Copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qsciscintilla.cpp" line="4380"/>
<source>&Paste</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qsciscintilla.cpp" line="4384"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qsciscintilla.cpp" line="4391"/>
<source>Select All</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
| {
"content_hash": "d2132642768b0719ad4303238ee06019",
"timestamp": "",
"source": "github",
"line_count": 3612,
"max_line_length": 112,
"avg_line_length": 38.03045404208195,
"alnum_prop": 0.6405587991205975,
"repo_name": "ChanJLee/ChanIDE",
"id": "5538ae177c8ce8aeba07e9920823c767e48842a5",
"size": "137703",
"binary": false,
"copies": "33",
"ref": "refs/heads/master",
"path": "Qt4Qt5/qscintilla_pt_br.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1335"
},
{
"name": "C++",
"bytes": "1882232"
},
{
"name": "QMake",
"bytes": "10893"
}
],
"symlink_target": ""
} |
import React from 'react';
import { GeneralPropTypes, FlexboxPropTypes, createClassName, generalClassNames, removeProps, objectKeys } from '../utils';
/**
* Thumbnail component.
* http://foundation.zurb.com/sites/docs/switch.html
*
* @param {Object} props
* @returns {Object}
*/
export const Thumbnail = (props) => {
const className = createClassName(
props.noDefaultClassName ? null : 'thumbnail',
props.className,
generalClassNames(props)
);
const passProps = removeProps(props, objectKeys(Thumbnail.propTypes));
return <img {...passProps} className={className}/>;
};
Thumbnail.propTypes = {
...GeneralPropTypes,
...FlexboxPropTypes
};
/**
* Thumbnail link component.
* http://foundation.zurb.com/sites/docs/switch.html
*
* @param {Object} props
* @returns {Object}
*/
export const ThumbnailLink = (props) => {
const className = createClassName(
props.noDefaultClassName ? null : 'thumbnail',
props.className,
generalClassNames(props)
);
// TODO: Consider improving how properties are set for both the link and image.
const passProps = removeProps(props, objectKeys(ThumbnailLink.propTypes));
return <a className={className}><img {...passProps}/></a>;
};
ThumbnailLink.propTypes = {
...GeneralPropTypes,
...FlexboxPropTypes
};
| {
"content_hash": "2e97556f291ef0cad32e3b4316c89fc6",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 123,
"avg_line_length": 25,
"alnum_prop": 0.703076923076923,
"repo_name": "nordsoftware/react-foundation",
"id": "45e5134c8507f2303011444390dde6f803cd5050",
"size": "1300",
"binary": false,
"copies": "1",
"ref": "refs/heads/dependabot/npm_and_yarn/ua-parser-js-0.7.28",
"path": "src/components/thumbnail.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "114307"
}
],
"symlink_target": ""
} |
// @formatter:off
package com.microsoft.alm.visualstudio.services.security;
/**
* Represents a request to rename a token in a security namespace.
*
*/
public class TokenRename {
/**
* True if the existing token should be preserved; false if it should be deleted.
*/
private boolean copy;
/**
* The desired new name of the token.
*/
private String newToken;
/**
* The current name of the token.
*/
private String oldToken;
/**
* True if the scope of the operation should be extended to all child tokens of OldToken; false otherwise.
*/
private boolean recurse;
/**
* True if the existing token should be preserved; false if it should be deleted.
*/
public boolean getCopy() {
return copy;
}
/**
* True if the existing token should be preserved; false if it should be deleted.
*/
public void setCopy(final boolean copy) {
this.copy = copy;
}
/**
* The desired new name of the token.
*/
public String getNewToken() {
return newToken;
}
/**
* The desired new name of the token.
*/
public void setNewToken(final String newToken) {
this.newToken = newToken;
}
/**
* The current name of the token.
*/
public String getOldToken() {
return oldToken;
}
/**
* The current name of the token.
*/
public void setOldToken(final String oldToken) {
this.oldToken = oldToken;
}
/**
* True if the scope of the operation should be extended to all child tokens of OldToken; false otherwise.
*/
public boolean getRecurse() {
return recurse;
}
/**
* True if the scope of the operation should be extended to all child tokens of OldToken; false otherwise.
*/
public void setRecurse(final boolean recurse) {
this.recurse = recurse;
}
}
| {
"content_hash": "99e2966d12667b5b670673eaf46c2b4e",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 109,
"avg_line_length": 22.541176470588237,
"alnum_prop": 0.6122129436325678,
"repo_name": "Microsoft/vso-httpclient-java",
"id": "87bb209bf30928033956cc409a89b93757d59e41",
"size": "2453",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Rest/alm-vss-client/src/main/generated/com/microsoft/alm/visualstudio/services/security/TokenRename.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "760"
},
{
"name": "Java",
"bytes": "4771131"
}
],
"symlink_target": ""
} |
const {
assert
} = require('chai');
const hooksCommon = require('../../lib/services');
var hook;
describe('services setSlug', () => {
beforeEach(() => {
hook = { type: 'before', method: 'create', params: { provider: 'rest', query: { a: 'a' } } };
});
describe('ignore feathers-socketio & feathers-rest clients', () => {
it('ignore feathers-socketio', () => {
hook.params.provider = 'socketio';
hooksCommon.setSlug('stockId')(hook);
assert.deepEqual(hook.params.query, { a: 'a' });
});
it('ignore feathers-rest', () => {
hook.params.route = {};
hook.params.route.storeId = ':storeId';
hooksCommon.setSlug('stockId')(hook);
assert.deepEqual(hook.params.query, { a: 'a' });
});
});
describe('handles raw HTTP clients', () => {
it('copies slug to query', () => {
hook.params.route = {};
hook.params.route.storeId = '123';
hooksCommon.setSlug('storeId')(hook);
assert.deepEqual(hook.params.query, { a: 'a', storeId: '123' });
});
});
describe('handles field name', () => {
it('copies slug to query', () => {
hook.params.route = {};
hook.params.route.storeId = '123';
hooksCommon.setSlug('storeId', 'slugger')(hook);
assert.equal(hook.params.slugger, '123');
});
});
describe('handles field name with dot notation', () => {
it('copies slug to query', () => {
hook.params.route = {};
hook.params.route.storeId = '123';
hooksCommon.setSlug('storeId', 'query.slugger')(hook);
assert.deepEqual(hook.params.query, { a: 'a', slugger: '123' });
});
});
});
| {
"content_hash": "b1c3c90dcd0205415a651cdb9d05e731",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 97,
"avg_line_length": 29.672727272727272,
"alnum_prop": 0.5649509803921569,
"repo_name": "feathersjs/feathers-hooks-common",
"id": "0b0d8c8924e57854d329097119b4fbf3e56e29bb",
"size": "1633",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/services/set-slug.test.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "331567"
}
],
"symlink_target": ""
} |
package MIP::Recipes::Download::Cadd_to_vcf_header;
use 5.026;
use Carp;
use charnames qw{ :full :short };
use English qw{ -no_match_vars };
use File::Basename qw{ dirname };
use File::Spec::Functions qw{ catfile };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use utf8;
use warnings;
use warnings qw{ FATAL utf8 };
## CPANM
use autodie qw{ :all };
use Readonly;
## MIPs lib/
use MIP::Constants qw{ $NEWLINE $SPACE $UNDERSCORE };
BEGIN {
require Exporter;
use base qw{ Exporter };
# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{ download_cadd_to_vcf_header };
}
sub download_cadd_to_vcf_header {
## Function : Download Cadd to VCF header file
## Returns :
## Arguments: $active_parameter_href => Active parameters for this download hash {REF}
## : $genome_version => Human genome version
## : $job_id_href => The job_id hash {REF}
## : $profile_base_command => Submission profile base command
## : $recipe_name => Recipe name
## : $reference_href => Reference hash {REF}
## : $reference_version => Reference version
## : $quiet => Quiet (no output)
## : $temp_directory => Temporary directory for recipe
## : $verbose => Verbosity
my ($arg_href) = @_;
## Flatten argument(s)
my $active_parameter_href;
my $genome_version;
my $job_id_href;
my $recipe_name;
my $reference_href;
my $reference_version;
## Default(s)
my $profile_base_command;
my $quiet;
my $temp_directory;
my $verbose;
my $tmpl = {
active_parameter_href => {
default => {},
defined => 1,
required => 1,
store => \$active_parameter_href,
strict_type => 1,
},
genome_version => {
store => \$genome_version,
strict_type => 1,
},
job_id_href => {
default => {},
defined => 1,
required => 1,
store => \$job_id_href,
strict_type => 1,
},
profile_base_command => {
default => q{sbatch},
store => \$profile_base_command,
strict_type => 1,
},
recipe_name => {
defined => 1,
required => 1,
store => \$recipe_name,
strict_type => 1,
},
reference_href => {
default => {},
defined => 1,
required => 1,
store => \$reference_href,
strict_type => 1,
},
reference_version => {
defined => 1,
required => 1,
store => \$reference_version,
strict_type => 1,
},
quiet => {
allow => [ undef, 0, 1 ],
default => 1,
store => \$quiet,
strict_type => 1,
},
temp_directory => {
store => \$temp_directory,
strict_type => 1,
},
};
check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
use MIP::Processmanagement::Slurm_processes qw{ slurm_submit_job_no_dependency_dead_end };
use MIP::Recipe qw{ parse_recipe_prerequisites };
use MIP::Recipes::Download::Get_reference qw{ get_reference };
use MIP::Script::Setup_script qw{ setup_script };
### PREPROCESSING:
## Retrieve logger object
my $log = Log::Log4perl->get_logger( uc q{mip_download} );
## Unpack parameters
my $reference_dir = $active_parameter_href->{reference_dir};
my %recipe = parse_recipe_prerequisites(
{
active_parameter_href => $active_parameter_href,
recipe_name => $recipe_name,
}
);
## Filehandle(s)
# Create anonymous filehandle
my $filehandle = IO::Handle->new();
## Creates recipe directories (info & data & script), recipe script filenames and writes sbatch header
my ( $recipe_file_path, $recipe_info_path ) = setup_script(
{
active_parameter_href => $active_parameter_href,
core_number => $recipe{core_number},
directory_id => q{mip_download},
filehandle => $filehandle,
info_file_id => $genome_version . $UNDERSCORE . $reference_version,
job_id_href => $job_id_href,
memory_allocation => $recipe{memory},
outdata_dir => $reference_dir,
outscript_dir => $reference_dir,
process_time => $recipe{time},
recipe_data_directory_path => $active_parameter_href->{reference_dir},
recipe_directory => $recipe_name . $UNDERSCORE . $reference_version,
recipe_name => $recipe_name,
source_environment_commands_ref => $recipe{load_env_ref},
}
);
### SHELL:
say {$filehandle} q{## } . $recipe_name;
get_reference(
{
filehandle => $filehandle,
recipe_name => $recipe_name,
reference_dir => $reference_dir,
reference_href => $reference_href,
quiet => $quiet,
verbose => $verbose,
}
);
## Close filehandleS
close $filehandle or $log->logcroak(q{Could not close filehandle});
if ( $recipe{mode} == 1 ) {
## No upstream or downstream dependencies
slurm_submit_job_no_dependency_dead_end(
{
base_command => $profile_base_command,
job_id_href => $job_id_href,
log => $log,
sbatch_file_name => $recipe_file_path,
}
);
}
return 1;
}
1;
| {
"content_hash": "7abf4156b8ba307e86e3737756de966a",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 106,
"avg_line_length": 31.17766497461929,
"alnum_prop": 0.4903940084662976,
"repo_name": "henrikstranneheim/MIP",
"id": "5ed4cc3b8bb9cdfa61d67bd4c3ce852fcee9e249",
"size": "6142",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/MIP/Recipes/Download/Cadd_to_vcf_header.pm",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Perl",
"bytes": "2311217"
},
{
"name": "R",
"bytes": "8999"
}
],
"symlink_target": ""
} |
package com.example.weizifen.coolweather;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Launch extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launch);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(Launch.this,MainActivity.class);
startActivity(intent);
Launch.this.finish();
}
},3000);
}
}
| {
"content_hash": "d2e8fee303c754ef8642e69b42cc1c43",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 73,
"avg_line_length": 29.82608695652174,
"alnum_prop": 0.6516034985422741,
"repo_name": "weizifen/cool-weather",
"id": "3d05a2ef8f69f55c3e53221d1dc622192b6841ff",
"size": "686",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/example/weizifen/coolweather/Launch.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "77798"
}
],
"symlink_target": ""
} |
/**
* Contains the {@link com.hazelcast.spi.impl.operationservice.InternalOperationService} API.
*/
package com.hazelcast.spi.impl.operationservice;
| {
"content_hash": "c8c69f39448e95d99d526de81bb33d5b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 93,
"avg_line_length": 25.5,
"alnum_prop": 0.7777777777777778,
"repo_name": "tombujok/hazelcast",
"id": "3dd47b7348bfc39626b48121e848d76bedffb4fd",
"size": "778",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "hazelcast/src/main/java/com/hazelcast/spi/impl/operationservice/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1449"
},
{
"name": "Java",
"bytes": "33147517"
},
{
"name": "Shell",
"bytes": "12286"
}
],
"symlink_target": ""
} |
<html><body>
<h4>Windows 10 x64 (18363.720)</h4><br>
<h2>wil_details_CachedHasNotificationState</h2>
<font face="arial"> wil_details_CachedHasNotificationState_Unknown = 0n0<br>
wil_details_CachedHasNotificationState_DoesNotHaveNotifications = 0n1<br>
wil_details_CachedHasNotificationState_HasNotification = 0n2<br>
</font></body></html> | {
"content_hash": "f381339b76b6631f6703b23e92136a7d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 78,
"avg_line_length": 50.285714285714285,
"alnum_prop": 0.7613636363636364,
"repo_name": "epikcraw/ggool",
"id": "efb41e15fae00d880b9054acd2ed82c5b41226c1",
"size": "352",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/Windows 10 x64 (18363.720)/wil_details_CachedHasNotificationState.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "17631902"
},
{
"name": "JavaScript",
"bytes": "552"
}
],
"symlink_target": ""
} |
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ash/policy/dlp/dlp_content_manager.h"
#include <memory>
#include <string>
#include <vector>
#include "ash/public/cpp/privacy_screen_dlp_helper.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/containers/cxx20_erase.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ash/policy/dlp/dlp_notification_helper.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_confidential_contents.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_content_restriction_set.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_histogram_helper.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_reporting_manager.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_warn_notifier.h"
#include "chrome/browser/ui/ash/capture_mode/chrome_capture_mode_delegate.h"
#include "content/public/browser/visibility.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "url/gurl.h"
namespace policy {
namespace {
// Delay to wait to turn off privacy screen enforcement after confidential data
// becomes not visible. This is done to not blink the privacy screen in case of
// a quick switch from one confidential data to another.
const base::TimeDelta kPrivacyScreenOffDelay = base::Milliseconds(500);
// Reports events to `reporting_manager`.
void ReportEvent(GURL url,
DlpRulesManager::Restriction restriction,
DlpRulesManager::Level level,
DlpReportingManager* reporting_manager) {
DCHECK(reporting_manager);
DlpRulesManager* rules_manager =
DlpRulesManagerFactory::GetForPrimaryProfile();
if (!rules_manager)
return;
const std::string src_url =
rules_manager->GetSourceUrlPattern(url, restriction, level);
reporting_manager->ReportEvent(src_url, restriction, level);
}
// Reports events of type DlpPolicyEvent::Mode::WARN_PROCEED to
// `reporting_manager`.
void ReportWarningProceededEvent(const GURL& url,
DlpRulesManager::Restriction restriction,
DlpReportingManager* reporting_manager) {
if (!reporting_manager)
return;
DlpRulesManager* rules_manager =
DlpRulesManagerFactory::GetForPrimaryProfile();
if (rules_manager) {
const std::string src_url = rules_manager->GetSourceUrlPattern(
url, restriction, DlpRulesManager::Level::kWarn);
reporting_manager->ReportWarningProceededEvent(src_url, restriction);
}
}
// Helper method to create a callback with ReportWarningProceededEvent function.
bool MaybeReportWarningProceededEvent(GURL url,
DlpRulesManager::Restriction restriction,
DlpReportingManager* reporting_manager,
bool should_proceed) {
if (should_proceed) {
ReportWarningProceededEvent(url, restriction, reporting_manager);
}
return should_proceed;
}
// Helper method to check whether the restriction level is kBlock.
bool IsBlocked(RestrictionLevelAndUrl restriction_info) {
return restriction_info.level == DlpRulesManager::Level::kBlock;
}
// Helper method to check whether the restriction level is kWarn.
bool IsWarn(RestrictionLevelAndUrl restriction_info) {
return restriction_info.level == DlpRulesManager::Level::kWarn;
}
// Helper method to check if event should be reported.
// Does not apply to warning mode reporting.
bool IsReported(RestrictionLevelAndUrl restriction_info) {
return restriction_info.level == DlpRulesManager::Level::kReport ||
IsBlocked(restriction_info);
}
// If there is an on going video recording, interrupts it and notifies the user.
void InterruptVideoRecording() {
if (ChromeCaptureModeDelegate::Get()->InterruptVideoRecordingIfAny())
ShowDlpVideoCaptureStoppedNotification();
}
} // namespace
static DlpContentManager* g_dlp_content_manager = nullptr;
// static
DlpContentManager* DlpContentManager::Get() {
if (!g_dlp_content_manager) {
g_dlp_content_manager = new DlpContentManager();
g_dlp_content_manager->Init();
}
return g_dlp_content_manager;
}
void DlpContentManager::OnWindowOcclusionChanged(aura::Window* window) {
// Stop video captures that now might include restricted content.
CheckRunningVideoCapture();
}
DlpContentRestrictionSet DlpContentManager::GetConfidentialRestrictions(
content::WebContents* web_contents) const {
if (!base::Contains(confidential_web_contents_, web_contents))
return DlpContentRestrictionSet();
return confidential_web_contents_.at(web_contents);
}
DlpContentRestrictionSet DlpContentManager::GetOnScreenPresentRestrictions()
const {
return on_screen_restrictions_;
}
bool DlpContentManager::IsScreenshotRestricted(const ScreenshotArea& area) {
const ConfidentialContentsInfo info =
GetAreaConfidentialContentsInfo(area, DlpContentRestriction::kScreenshot);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenshot);
DlpBooleanHistogram(dlp::kScreenshotBlockedUMA,
IsBlocked(info.restriction_info));
return IsBlocked(info.restriction_info);
}
bool DlpContentManager::IsScreenshotApiRestricted(const ScreenshotArea& area) {
const ConfidentialContentsInfo info =
GetAreaConfidentialContentsInfo(area, DlpContentRestriction::kScreenshot);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenshot);
DlpBooleanHistogram(dlp::kScreenshotBlockedUMA,
IsBlocked(info.restriction_info));
// TODO(crbug.com/1252736): Properly handle WARN for screenshots API.
return IsBlocked(info.restriction_info) || IsWarn(info.restriction_info);
}
void DlpContentManager::CheckScreenshotRestriction(
const ScreenshotArea& area,
ash::OnCaptureModeDlpRestrictionChecked callback) {
const ConfidentialContentsInfo info =
GetAreaConfidentialContentsInfo(area, DlpContentRestriction::kScreenshot);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenshot);
DlpBooleanHistogram(dlp::kScreenshotBlockedUMA,
IsBlocked(info.restriction_info));
CheckScreenCaptureRestriction(info, std::move(callback));
}
void DlpContentManager::CheckPrintingRestriction(
content::WebContents* web_contents,
OnDlpRestrictionCheckedCallback callback) {
const RestrictionLevelAndUrl restriction_info =
GetPrintingRestrictionInfo(web_contents);
MaybeReportEvent(restriction_info, DlpRulesManager::Restriction::kPrinting);
DlpBooleanHistogram(dlp::kPrintingBlockedUMA, IsBlocked(restriction_info));
if (IsBlocked(restriction_info)) {
ShowDlpPrintDisabledNotification();
std::move(callback).Run(false);
return;
}
if (IsWarn(restriction_info)) {
// Check if the contents were already allowed and don't warn in that case.
if (user_allowed_contents_cache_.Contains(
web_contents, DlpRulesManager::Restriction::kPrinting)) {
ReportWarningProceededEvent(restriction_info.url,
DlpRulesManager::Restriction::kPrinting,
reporting_manager_);
std::move(callback).Run(true);
return;
}
// Immediately report a warning event.
ReportWarningEvent(restriction_info,
DlpRulesManager::Restriction::kPrinting);
// Report a warning proceeded event only after a user proceeds with printing
// in the warn dialog.
auto reporting_callback = base::BindOnce(
&MaybeReportWarningProceededEvent, restriction_info.url,
DlpRulesManager::Restriction::kPrinting, reporting_manager_);
warn_notifier_->ShowDlpPrintWarningDialog(base::BindOnce(
&DlpContentManager::OnDlpWarnDialogReply, base::Unretained(this),
DlpConfidentialContents({web_contents}),
DlpRulesManager::Restriction::kPrinting,
std::move(reporting_callback).Then(std::move(callback))));
return;
}
// No restrictions apply.
std::move(callback).Run(true);
}
bool DlpContentManager::IsScreenCaptureRestricted(
const content::DesktopMediaID& media_id) {
const ConfidentialContentsInfo info =
GetScreenShareConfidentialContentsInfo(media_id);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenShare);
DlpBooleanHistogram(dlp::kScreenShareBlockedUMA,
IsBlocked(info.restriction_info));
return IsBlocked(info.restriction_info);
}
void DlpContentManager::CheckScreenShareRestriction(
const content::DesktopMediaID& media_id,
const std::u16string& application_title,
OnDlpRestrictionCheckedCallback callback) {
ConfidentialContentsInfo info =
GetScreenShareConfidentialContentsInfo(media_id);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenShare);
DlpBooleanHistogram(dlp::kScreenShareBlockedUMA,
IsBlocked(info.restriction_info));
if (IsBlocked(info.restriction_info)) {
ShowDlpScreenShareDisabledNotification(application_title);
std::move(callback).Run(false);
return;
}
if (is_screen_share_warning_mode_enabled_ && IsWarn(info.restriction_info)) {
// Check which of the contents were already allowed and don't warn for
// those.
RemoveAllowedContents(info.confidential_contents,
DlpRulesManager::Restriction::kScreenShare);
if (info.confidential_contents.IsEmpty()) {
// The user already allowed all the visible content.
std::move(callback).Run(true);
return;
}
// base::Unretained(this) is safe here because DlpContentManager is
// initialized as a singleton that's always available in the system.
warn_notifier_->ShowDlpScreenShareWarningDialog(
base::BindOnce(&DlpContentManager::OnDlpWarnDialogReply,
base::Unretained(this), info.confidential_contents,
DlpRulesManager::Restriction::kScreenShare,
std::move(callback)),
info.confidential_contents, application_title);
return;
}
// No restrictions apply.
std::move(callback).Run(true);
}
void DlpContentManager::OnVideoCaptureStarted(const ScreenshotArea& area) {
if (IsScreenshotRestricted(area)) {
InterruptVideoRecording();
return;
}
DCHECK(!running_video_capture_info_.has_value());
running_video_capture_info_.emplace(area);
}
void DlpContentManager::CheckStoppedVideoCapture(
ash::OnCaptureModeDlpRestrictionChecked callback) {
// If some confidential content was shown during the recording, but not
// before, warn the user before saving the file.
if (running_video_capture_info_.has_value() &&
!running_video_capture_info_->confidential_contents.IsEmpty()) {
warn_notifier_->ShowDlpVideoCaptureWarningDialog(
std::move(callback),
running_video_capture_info_->confidential_contents);
} else {
std::move(callback).Run(/*proceed=*/true);
}
running_video_capture_info_.reset();
}
bool DlpContentManager::IsCaptureModeInitRestricted() {
const RestrictionLevelAndUrl restriction_info =
GetOnScreenPresentRestrictions().GetRestrictionLevelAndUrl(
DlpContentRestriction::kScreenshot);
MaybeReportEvent(restriction_info, DlpRulesManager::Restriction::kScreenshot);
DlpBooleanHistogram(dlp::kCaptureModeInitBlockedUMA,
IsBlocked(restriction_info));
return IsBlocked(restriction_info);
}
void DlpContentManager::CheckCaptureModeInitRestriction(
ash::OnCaptureModeDlpRestrictionChecked callback) {
const ConfidentialContentsInfo info =
GetConfidentialContentsOnScreen(DlpContentRestriction::kScreenshot);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenshot);
DlpBooleanHistogram(dlp::kCaptureModeInitBlockedUMA,
IsBlocked(info.restriction_info));
CheckScreenCaptureRestriction(info, std::move(callback));
}
void DlpContentManager::OnScreenCaptureStarted(
const std::string& label,
std::vector<content::DesktopMediaID> screen_capture_ids,
const std::u16string& application_title,
content::MediaStreamUI::StateChangeCallback state_change_callback) {
for (const content::DesktopMediaID& id : screen_capture_ids) {
ScreenShareInfo screen_share_info(label, id, application_title,
state_change_callback);
DCHECK(!base::Contains(running_screen_shares_, screen_share_info));
running_screen_shares_.push_back(screen_share_info);
}
CheckRunningScreenShares();
}
void DlpContentManager::OnScreenCaptureStopped(
const std::string& label,
const content::DesktopMediaID& media_id) {
base::EraseIf(
running_screen_shares_, [=](ScreenShareInfo& screen_share_info) -> bool {
const bool erased = screen_share_info.GetLabel() == label &&
screen_share_info.GetMediaId() == media_id;
// Hide notifications if necessary.
screen_share_info.HideNotifications();
return erased;
});
}
/* static */
void DlpContentManager::SetDlpContentManagerForTesting(
DlpContentManager* dlp_content_manager) {
if (g_dlp_content_manager)
delete g_dlp_content_manager;
g_dlp_content_manager = dlp_content_manager;
}
/* static */
void DlpContentManager::ResetDlpContentManagerForTesting() {
g_dlp_content_manager = nullptr;
}
DlpContentManager::ScreenShareInfo::ScreenShareInfo() = default;
DlpContentManager::ScreenShareInfo::ScreenShareInfo(
const std::string& label,
const content::DesktopMediaID& media_id,
const std::u16string& application_title,
content::MediaStreamUI::StateChangeCallback state_change_callback)
: label_(label),
media_id_(media_id),
application_title_(application_title),
state_change_callback_(state_change_callback) {}
DlpContentManager::ScreenShareInfo::ScreenShareInfo(
const DlpContentManager::ScreenShareInfo& other) = default;
DlpContentManager::ScreenShareInfo&
DlpContentManager::ScreenShareInfo::operator=(
const DlpContentManager::ScreenShareInfo& other) = default;
DlpContentManager::ScreenShareInfo::~ScreenShareInfo() = default;
bool DlpContentManager::ScreenShareInfo::operator==(
const DlpContentManager::ScreenShareInfo& other) const {
return label_ == other.label_ && media_id_ == other.media_id_;
}
bool DlpContentManager::ScreenShareInfo::operator!=(
const DlpContentManager::ScreenShareInfo& other) const {
return !(*this == other);
}
const content::DesktopMediaID& DlpContentManager::ScreenShareInfo::GetMediaId()
const {
return media_id_;
}
const std::string& DlpContentManager::ScreenShareInfo::GetLabel() const {
return label_;
}
const std::u16string& DlpContentManager::ScreenShareInfo::GetApplicationTitle()
const {
// TODO(crbug.com/1264793): Don't cache the application name, but compute it
// here.
return application_title_;
}
bool DlpContentManager::ScreenShareInfo::IsRunning() const {
return is_running_;
}
void DlpContentManager::ScreenShareInfo::Pause() {
DCHECK(is_running_);
state_change_callback_.Run(media_id_,
blink::mojom::MediaStreamStateChange::PAUSE);
is_running_ = false;
}
void DlpContentManager::ScreenShareInfo::Resume() {
DCHECK(!is_running_);
state_change_callback_.Run(media_id_,
blink::mojom::MediaStreamStateChange::PLAY);
is_running_ = true;
}
void DlpContentManager::ScreenShareInfo::MaybeUpdateNotifications() {
UpdatePausedNotification(/*show=*/!is_running_);
UpdateResumedNotification(/*show=*/is_running_);
}
void DlpContentManager::ScreenShareInfo::HideNotifications() {
UpdatePausedNotification(/*show=*/false);
UpdateResumedNotification(/*show=*/false);
}
void DlpContentManager::ScreenShareInfo::UpdatePausedNotification(bool show) {
if ((notification_state_ == NotificationState::kShowingPausedNotification) ==
show)
return;
if (show) {
ShowDlpScreenSharePausedNotification(label_, application_title_);
notification_state_ = NotificationState::kShowingPausedNotification;
} else {
HideDlpScreenSharePausedNotification(label_);
notification_state_ = NotificationState::kNotShowingNotification;
}
}
void DlpContentManager::ScreenShareInfo::UpdateResumedNotification(bool show) {
if ((notification_state_ == NotificationState::kShowingResumedNotification) ==
show)
return;
if (show) {
ShowDlpScreenShareResumedNotification(label_, application_title_);
notification_state_ = NotificationState::kShowingResumedNotification;
} else {
HideDlpScreenShareResumedNotification(label_);
notification_state_ = NotificationState::kNotShowingNotification;
}
}
DlpContentManager::VideoCaptureInfo::VideoCaptureInfo(
const ScreenshotArea& area)
: area(area) {}
DlpContentManager::DlpContentManager() = default;
void DlpContentManager::Init() {
DlpRulesManager* rules_manager =
DlpRulesManagerFactory::GetForPrimaryProfile();
if (rules_manager)
reporting_manager_ =
DlpRulesManagerFactory::GetForPrimaryProfile()->GetReportingManager();
warn_notifier_ = std::make_unique<DlpWarnNotifier>();
}
DlpContentManager::~DlpContentManager() = default;
void DlpContentManager::OnConfidentialityChanged(
content::WebContents* web_contents,
const DlpContentRestrictionSet& restriction_set) {
if (restriction_set.IsEmpty()) {
RemoveFromConfidential(web_contents);
} else {
confidential_web_contents_[web_contents] = restriction_set;
window_observers_[web_contents] = std::make_unique<DlpWindowObserver>(
web_contents->GetNativeView(), this);
if (web_contents->GetVisibility() == content::Visibility::VISIBLE) {
MaybeChangeOnScreenRestrictions();
}
}
CheckRunningScreenShares();
}
void DlpContentManager::OnWebContentsDestroyed(
content::WebContents* web_contents) {
RemoveFromConfidential(web_contents);
}
void DlpContentManager::OnVisibilityChanged(
content::WebContents* web_contents) {
MaybeChangeOnScreenRestrictions();
}
void DlpContentManager::RemoveFromConfidential(
content::WebContents* web_contents) {
confidential_web_contents_.erase(web_contents);
window_observers_.erase(web_contents);
MaybeChangeOnScreenRestrictions();
}
void DlpContentManager::MaybeChangeOnScreenRestrictions() {
DlpContentRestrictionSet new_restriction_set;
for (const auto& entry : confidential_web_contents_) {
if (entry.first->GetVisibility() == content::Visibility::VISIBLE) {
new_restriction_set.UnionWith(entry.second);
}
}
if (on_screen_restrictions_ != new_restriction_set) {
DlpContentRestrictionSet added_restrictions =
new_restriction_set.DifferenceWith(on_screen_restrictions_);
DlpContentRestrictionSet removed_restrictions =
on_screen_restrictions_.DifferenceWith(new_restriction_set);
on_screen_restrictions_ = new_restriction_set;
OnScreenRestrictionsChanged(added_restrictions, removed_restrictions);
}
CheckRunningVideoCapture();
CheckRunningScreenShares();
}
void DlpContentManager::OnScreenRestrictionsChanged(
const DlpContentRestrictionSet& added_restrictions,
const DlpContentRestrictionSet& removed_restrictions) const {
DCHECK(!(added_restrictions.GetRestrictionLevel(
DlpContentRestriction::kPrivacyScreen) ==
DlpRulesManager::Level::kBlock &&
removed_restrictions.GetRestrictionLevel(
DlpContentRestriction::kPrivacyScreen) ==
DlpRulesManager::Level::kBlock));
ash::PrivacyScreenDlpHelper* privacy_screen_helper =
ash::PrivacyScreenDlpHelper::Get();
if (!privacy_screen_helper->IsSupported())
return;
const RestrictionLevelAndUrl added_restriction_info =
added_restrictions.GetRestrictionLevelAndUrl(
DlpContentRestriction::kPrivacyScreen);
if (added_restriction_info.level == DlpRulesManager::Level::kBlock) {
DlpBooleanHistogram(dlp::kPrivacyScreenEnforcedUMA, true);
privacy_screen_helper->SetEnforced(true);
}
if (added_restriction_info.level == DlpRulesManager::Level::kBlock ||
added_restriction_info.level == DlpRulesManager::Level::kReport) {
if (reporting_manager_) {
ReportEvent(added_restriction_info.url,
DlpRulesManager::Restriction::kPrivacyScreen,
added_restriction_info.level, reporting_manager_);
}
}
if (removed_restrictions.GetRestrictionLevel(
DlpContentRestriction::kPrivacyScreen) ==
DlpRulesManager::Level::kBlock) {
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&DlpContentManager::MaybeRemovePrivacyScreenEnforcement,
base::Unretained(this)),
kPrivacyScreenOffDelay);
}
}
void DlpContentManager::MaybeRemovePrivacyScreenEnforcement() const {
if (GetOnScreenPresentRestrictions().GetRestrictionLevel(
DlpContentRestriction::kPrivacyScreen) !=
DlpRulesManager::Level::kBlock) {
DlpBooleanHistogram(dlp::kPrivacyScreenEnforcedUMA, false);
ash::PrivacyScreenDlpHelper::Get()->SetEnforced(false);
}
}
DlpContentManager::ConfidentialContentsInfo
DlpContentManager::GetConfidentialContentsOnScreen(
DlpContentRestriction restriction) const {
DlpContentManager::ConfidentialContentsInfo info;
info.restriction_info =
GetOnScreenPresentRestrictions().GetRestrictionLevelAndUrl(restriction);
for (auto& entry : confidential_web_contents_) {
if (entry.first->GetVisibility() != content::Visibility::VISIBLE)
continue;
if (entry.second.GetRestrictionLevel(restriction) ==
info.restriction_info.level) {
info.confidential_contents.Add(entry.first);
}
}
return info;
}
DlpContentManager::ConfidentialContentsInfo
DlpContentManager::GetAreaConfidentialContentsInfo(
const ScreenshotArea& area,
DlpContentRestriction restriction) const {
DlpContentManager::ConfidentialContentsInfo info;
// Fullscreen - restricted if any confidential data is visible.
if (area.type == ScreenshotType::kAllRootWindows) {
return GetConfidentialContentsOnScreen(restriction);
}
// Window - restricted if the window contains confidential data.
if (area.type == ScreenshotType::kWindow) {
DCHECK(area.window);
for (auto& entry : confidential_web_contents_) {
aura::Window* web_contents_window = entry.first->GetNativeView();
if (area.window->Contains(web_contents_window)) {
if (entry.second.GetRestrictionLevel(restriction) ==
info.restriction_info.level) {
info.confidential_contents.Add(entry.first);
} else if (entry.second.GetRestrictionLevel(restriction) >
info.restriction_info.level) {
info.restriction_info =
entry.second.GetRestrictionLevelAndUrl(restriction);
info.confidential_contents.ClearAndAdd(entry.first);
}
}
}
return info;
}
DCHECK_EQ(area.type, ScreenshotType::kPartialWindow);
DCHECK(area.rect);
DCHECK(area.window);
// Partial - restricted if any visible confidential WebContents intersects
// with the area.
for (auto& entry : confidential_web_contents_) {
if (entry.first->GetVisibility() != content::Visibility::VISIBLE ||
entry.second.GetRestrictionLevel(restriction) ==
DlpRulesManager::Level::kNotSet) {
continue;
}
aura::Window* web_contents_window = entry.first->GetNativeView();
if (web_contents_window->GetOcclusionState() ==
aura::Window::OcclusionState::OCCLUDED) {
continue;
}
aura::Window* root_window = web_contents_window->GetRootWindow();
// If no root window, then the WebContent shouldn't be visible.
if (!root_window)
continue;
// Not allowing if the area intersects with confidential WebContents,
// but the intersection doesn't belong to occluded area.
gfx::Rect intersection(*area.rect);
aura::Window::ConvertRectToTarget(area.window, root_window, &intersection);
intersection.Intersect(web_contents_window->GetBoundsInRootWindow());
if (intersection.IsEmpty() ||
web_contents_window->occluded_region_in_root().contains(
gfx::RectToSkIRect(intersection)))
continue;
if (entry.second.GetRestrictionLevel(restriction) ==
info.restriction_info.level) {
info.confidential_contents.Add(entry.first);
} else if (entry.second.GetRestrictionLevel(restriction) >
info.restriction_info.level) {
info.restriction_info =
entry.second.GetRestrictionLevelAndUrl(restriction);
info.confidential_contents.ClearAndAdd(entry.first);
}
}
return info;
}
DlpContentManager::ConfidentialContentsInfo
DlpContentManager::GetScreenShareConfidentialContentsInfo(
const content::DesktopMediaID& media_id) const {
if (media_id.type == content::DesktopMediaID::Type::TYPE_SCREEN) {
return GetConfidentialContentsOnScreen(DlpContentRestriction::kScreenShare);
}
if (media_id.type == content::DesktopMediaID::Type::TYPE_WEB_CONTENTS) {
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(
content::RenderFrameHost::FromID(
media_id.web_contents_id.render_process_id,
media_id.web_contents_id.main_render_frame_id));
ConfidentialContentsInfo info;
if (web_contents && !web_contents->IsBeingDestroyed()) {
info.restriction_info =
GetConfidentialRestrictions(web_contents)
.GetRestrictionLevelAndUrl(DlpContentRestriction::kScreenShare);
info.confidential_contents.Add(web_contents);
} else {
NOTREACHED();
}
return info;
}
DCHECK_EQ(media_id.type, content::DesktopMediaID::Type::TYPE_WINDOW);
ConfidentialContentsInfo info;
aura::Window* window = content::DesktopMediaID::GetNativeWindowById(media_id);
if (window) {
for (auto& entry : confidential_web_contents_) {
aura::Window* web_contents_window = entry.first->GetNativeView();
if (!window->Contains(web_contents_window))
continue;
if (entry.second.GetRestrictionLevel(
DlpContentRestriction::kScreenShare) ==
info.restriction_info.level) {
info.confidential_contents.Add(entry.first);
} else if (entry.second.GetRestrictionLevel(
DlpContentRestriction::kScreenShare) >
info.restriction_info.level) {
info.restriction_info = entry.second.GetRestrictionLevelAndUrl(
DlpContentRestriction::kScreenShare);
info.confidential_contents.ClearAndAdd(entry.first);
}
}
}
return info;
}
void DlpContentManager::CheckRunningVideoCapture() {
if (!running_video_capture_info_.has_value())
return;
ConfidentialContentsInfo info = GetAreaConfidentialContentsInfo(
running_video_capture_info_->area, DlpContentRestriction::kScreenshot);
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenshot);
if (IsBlocked(info.restriction_info)) {
DlpBooleanHistogram(dlp::kVideoCaptureInterruptedUMA, true);
InterruptVideoRecording();
running_video_capture_info_.reset();
return;
}
if (IsWarn(info.restriction_info)) {
// Remember any confidential content captured during the recording, so we
// can inform the user about it after the recording is finished. We drop
// those that the user was already warned about and has allowed the screen
// capture to proceed.
RemoveAllowedContents(info.confidential_contents,
DlpRulesManager::Restriction::kScreenshot);
running_video_capture_info_->confidential_contents.UnionWith(
info.confidential_contents);
return;
}
}
void DlpContentManager::CheckRunningScreenShares() {
for (auto& screen_share : running_screen_shares_) {
ConfidentialContentsInfo info =
GetScreenShareConfidentialContentsInfo(screen_share.GetMediaId());
if (IsBlocked(info.restriction_info)) {
if (screen_share.IsRunning()) {
screen_share.Pause();
MaybeReportEvent(info.restriction_info,
DlpRulesManager::Restriction::kScreenShare);
DlpBooleanHistogram(dlp::kScreenSharePausedOrResumedUMA, true);
screen_share.MaybeUpdateNotifications();
}
return;
}
if (is_screen_share_warning_mode_enabled_ &&
IsWarn(info.restriction_info)) {
// Check which of the contents were already allowed and don't warn for
// those.
RemoveAllowedContents(info.confidential_contents,
DlpRulesManager::Restriction::kScreenShare);
if (info.confidential_contents.IsEmpty()) {
// The user already allowed all the visible content.
if (!screen_share.IsRunning()) {
screen_share.Resume();
screen_share.MaybeUpdateNotifications();
}
return;
}
if (screen_share.IsRunning()) {
screen_share.Pause();
screen_share.HideNotifications();
}
// base::Unretained(this) is safe here because DlpContentManager is
// initialized as a singleton that's always available in the system.
warn_notifier_->ShowDlpScreenShareWarningDialog(
base::BindOnce(&DlpContentManager::OnDlpScreenShareWarnDialogReply,
base::Unretained(this), info.confidential_contents,
screen_share),
info.confidential_contents, screen_share.GetApplicationTitle());
return;
}
// No restrictions apply, only resume if necessary.
if (!screen_share.IsRunning()) {
screen_share.Resume();
DlpBooleanHistogram(dlp::kScreenSharePausedOrResumedUMA, false);
screen_share.MaybeUpdateNotifications();
}
}
}
void DlpContentManager::SetReportingManagerForTesting(
DlpReportingManager* reporting_manager) {
reporting_manager_ = reporting_manager;
}
void DlpContentManager::SetWarnNotifierForTesting(
std::unique_ptr<DlpWarnNotifier> warn_notifier) {
DCHECK(warn_notifier);
warn_notifier_ = std::move(warn_notifier);
}
void DlpContentManager::ResetWarnNotifierForTesting() {
warn_notifier_ = std::make_unique<DlpWarnNotifier>();
}
// static
base::TimeDelta DlpContentManager::GetPrivacyScreenOffDelayForTesting() {
return kPrivacyScreenOffDelay;
}
RestrictionLevelAndUrl DlpContentManager::GetPrintingRestrictionInfo(
content::WebContents* web_contents) const {
// If we're viewing the PDF in a MimeHandlerViewGuest, use its embedded
// WebContents.
auto* guest_view =
extensions::MimeHandlerViewGuest::FromWebContents(web_contents);
web_contents =
guest_view ? guest_view->embedder_web_contents() : web_contents;
return GetConfidentialRestrictions(web_contents)
.GetRestrictionLevelAndUrl(DlpContentRestriction::kPrint);
}
void DlpContentManager::CheckScreenCaptureRestriction(
ConfidentialContentsInfo info,
ash::OnCaptureModeDlpRestrictionChecked callback) {
if (IsBlocked(info.restriction_info)) {
ShowDlpScreenCaptureDisabledNotification();
std::move(callback).Run(false);
return;
}
if (IsWarn(info.restriction_info)) {
// Check which of the contents were already allowed and don't warn for
// those.
RemoveAllowedContents(info.confidential_contents,
DlpRulesManager::Restriction::kScreenshot);
if (info.confidential_contents.IsEmpty()) {
// The user already allowed all the visible content.
std::move(callback).Run(true);
return;
}
// base::Unretained(this) is safe here because DlpContentManager is
// initialized as a singleton that's always available in the system.
warn_notifier_->ShowDlpScreenCaptureWarningDialog(
base::BindOnce(&DlpContentManager::OnDlpWarnDialogReply,
base::Unretained(this), info.confidential_contents,
DlpRulesManager::Restriction::kScreenshot,
std::move(callback)),
info.confidential_contents);
return;
}
// No restrictions apply.
std::move(callback).Run(true);
}
void DlpContentManager::OnDlpScreenShareWarnDialogReply(
const DlpConfidentialContents& confidential_contents,
ScreenShareInfo screen_share,
bool should_proceed) {
if (should_proceed) {
screen_share.Resume();
for (const auto& content : confidential_contents.GetContents()) {
user_allowed_contents_cache_.Cache(
content, DlpRulesManager::Restriction::kScreenShare);
}
} else {
// TODO(crbug.com/1259605): stop instead of pause.
screen_share.Pause();
}
screen_share.MaybeUpdateNotifications();
}
void DlpContentManager::OnDlpWarnDialogReply(
const DlpConfidentialContents& confidential_contents,
DlpRulesManager::Restriction restriction,
OnDlpRestrictionCheckedCallback callback,
bool should_proceed) {
if (should_proceed) {
for (const auto& content : confidential_contents.GetContents()) {
user_allowed_contents_cache_.Cache(content, restriction);
}
}
std::move(callback).Run(should_proceed);
}
void DlpContentManager::MaybeReportEvent(
const RestrictionLevelAndUrl& restriction_info,
DlpRulesManager::Restriction restriction) {
// TODO(crbug.com/1260302): Add reporting and metrics for WARN restrictions.
if (IsReported(restriction_info) && reporting_manager_) {
ReportEvent(restriction_info.url, restriction, restriction_info.level,
reporting_manager_);
}
}
void DlpContentManager::ReportWarningEvent(
const RestrictionLevelAndUrl& restriction_info,
DlpRulesManager::Restriction restriction) {
DCHECK(IsWarn(restriction_info));
if (reporting_manager_) {
ReportEvent(restriction_info.url, restriction,
DlpRulesManager::Level::kWarn, reporting_manager_);
}
}
void DlpContentManager::RemoveAllowedContents(
DlpConfidentialContents& contents,
DlpRulesManager::Restriction restriction) {
base::EraseIf(
contents.GetContents(), [=](const DlpConfidentialContent& content) {
return user_allowed_contents_cache_.Contains(content, restriction);
});
}
// ScopedDlpContentManagerForTesting
ScopedDlpContentManagerForTesting::ScopedDlpContentManagerForTesting(
DlpContentManager* test_dlp_content_manager) {
DlpContentManager::SetDlpContentManagerForTesting(test_dlp_content_manager);
}
ScopedDlpContentManagerForTesting::~ScopedDlpContentManagerForTesting() {
DlpContentManager::ResetDlpContentManagerForTesting();
}
} // namespace policy
| {
"content_hash": "74b7a91d63e2fc977b3bd69a31b8c029",
"timestamp": "",
"source": "github",
"line_count": 924,
"max_line_length": 84,
"avg_line_length": 38.234848484848484,
"alnum_prop": 0.719861869851963,
"repo_name": "ric2b/Vivaldi-browser",
"id": "543f56d19795974c84e76b1afd5d0fafd930c276",
"size": "35329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chromium/chrome/browser/ash/policy/dlp/dlp_content_manager.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
title: "Layout: Header Video"
header:
video:
id: XsxDH4HcOWA
provider: youtube
categories:
- Layout
- Uncategorized
tags:
- video
- layout
---
This post should display a **header with a responsive video**, if the theme supports it.
## Settings
| Parameter | Required | Description |
|---------- |--------- | ----------- |
| `id` | **Required** | ID of the video |
| `provider` | **Required** | Hosting provider of the video, either `youtube` or `vimeo` |
### YouTube
To embed the following YouTube video at url `https://www.youtube.com/watch?v=XsxDH4HcOWA` (long version) or `XsxDH4HcOWA` (short version) into a post or page's main content you'd use:
```liquid
{% raw %}{% include video id="XsxDH4HcOWA" provider="youtube" %}{% endraw %}
```
{% include video id="XsxDH4HcOWA" provider="youtube" %}
To embed it as a video header you'd use the following YAML Front Matter
```yaml
header:
video:
id: XsxDH4HcOWA
provider: youtube
```
### Vimeo
To embed the following Vimeo video at url `https://vimeo.com/97649261` into a post or page's main content you'd use:
```liquid
{% raw %}{% include video id="97649261" provider="vimeo" %}{% endraw %}
```
{% include video id="97649261" provider="vimeo" %}
To embed it as a video header you'd use the following YAML Front Matter
```yaml
header:
video:
id: 97649261
provider: vimeo
``` | {
"content_hash": "69f1cbdbeb969dc8d90f8f68f92b4674",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 184,
"avg_line_length": 23.610169491525422,
"alnum_prop": 0.6525484565685571,
"repo_name": "fkkmemi/fkkmemi.github.io",
"id": "9286d9799a60be050c2bf291919861e3bf956880",
"size": "1397",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/_posts/2017-01-23-layout-header-video.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "95912"
},
{
"name": "HTML",
"bytes": "94813"
},
{
"name": "JavaScript",
"bytes": "220022"
},
{
"name": "Ruby",
"bytes": "6125"
}
],
"symlink_target": ""
} |
package org.jtheque.xml.utils.javax;
import org.jtheque.xml.utils.NodeSaver;
import org.jtheque.xml.utils.XMLWriter;
import org.jtheque.xml.utils.Node;
import org.jtheque.xml.utils.NodeAttribute;
/**
* A Node Saver implementation with Java.
*
* @author Baptiste Wicht
*/
public final class JavaxNodeSaver implements NodeSaver<XMLWriter<org.w3c.dom.Node>> {
@Override
public void writeNodes(XMLWriter<org.w3c.dom.Node> writer, Iterable<Node> nodes) {
for (Node node : nodes) {
add(node, writer);
}
}
/**
* Add the node state to the writer.
*
* @param node The node state to add to the writer.
* @param writer The XML writer.
*/
private void add(Node node, XMLWriter<org.w3c.dom.Node> writer) {
if (node.hasChildren()) {
writer.add(node.getName());
writeNodes(writer, node.getChildrens());
} else {
writer.add(node.getName(), node.getText());
}
if (node.hasAttribute()) {
for (NodeAttribute attribute : node.getAttributes()) {
writer.addAttribute(attribute.getKey(), attribute.getValue());
}
}
writer.switchToParent();
}
} | {
"content_hash": "fd8752bb79b17032aa75b9785057f67f",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 86,
"avg_line_length": 27.82608695652174,
"alnum_prop": 0.58984375,
"repo_name": "wichtounet/jtheque-xml-utils",
"id": "dd83e4775718318e45ae464690be3b040399968a",
"size": "1892",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/jtheque/xml/utils/javax/JavaxNodeSaver.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "78664"
}
],
"symlink_target": ""
} |
{-# LANGUAGE CPP, TemplateHaskell #-}
-----------------------------------------------------------------------------
--
-- Module : Main
-- Copyright : John Lång
-- License : The MIT License
--
-- Maintainer :
-- Stability :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------
module Main (
main
) where
import Control.Monad (unless)
import Data.List (stripPrefix)
import System.Exit (exitFailure)
import Test.QuickCheck.All (quickCheckAll)
import Graphics.UI.WX
{-
-- Simple function to create a hello message.
hello s = "Hello " ++ s
-- Tell QuickCheck that if you strip "Hello " from the start of
-- hello s you will be left with s (for any s).
prop_hello s = stripPrefix "Hello " (hello s) == Just s
-- Hello World
exeMain = do
putStrLn (hello "World")
-- Entry point for unit tests.
testMain = do
allPass <- $quickCheckAll -- Run QuickCheck on all prop_ functions
unless allPass exitFailure
-- This is a clunky, but portable, way to use the same Main module file
-- for both an application and for unit tests.
-- MAIN_FUNCTION is preprocessor macro set to exeMain or testMain.
-- That way we can use the same file for both an application and for tests.
#ifndef MAIN_FUNCTION
#define MAIN_FUNCTION exeMain
#endif
main = MAIN_FUNCTION
-}
main :: IO ()
main = start gui
gui :: IO ()
gui = do
frame [text := "Hello World!"]
return ()
{-
import System.IO
import Codec.Picture
import Complex
import ReadArgs
a = 4.0
n = 255
main :: IO ()
main = do
(width, height) <- readArgs
writePng "test.png" (generateImage pixelRenderer width height)
pixelRenderer :: (Integral a1, Integral a2) => a1 -> a2 -> PixelRGB8
pixelRenderer x y = let (fx, fy, fz) = colorFunction x y
in PixelRGB8 fx fy fz
colorFunction :: (Integral a1, Integral a2, Num b1, Num b2, Num b3) =>
a1 -> a2 -> (b1, b2, b3)
colorFunction x y = (fromIntegral w, fromIntegral 0, fromIntegral 0)
where w = mandelbrot $ Complex ((fromIntegral x) / 1000.0) ((fromIntegral y) / 1000.0)
mandelbrot :: Complex -> Int
mandelbrot c = length $ takeWhile (\(m, z) -> (re . abs) z < a && m < n) $
zip [1,2..] $ iterate f $ Complex 0 0
where f z = z * z + c
-}
| {
"content_hash": "113b7d120de740ac1b180a241ca9671f",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 90,
"avg_line_length": 25.730337078651687,
"alnum_prop": 0.6043668122270742,
"repo_name": "jllang/Combinator",
"id": "fd3b7e449b2c8f7a2c2f4764b9777db2d7f7599f",
"size": "2291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Main.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Haskell",
"bytes": "3607"
}
],
"symlink_target": ""
} |
using System;
using System.Collections;
using System.Threading;
using Alachisoft.NCache.Runtime;
using Alachisoft.NCache.Web.Caching;
using Factory = Alachisoft.NCache.Web.Caching.NCache;
namespace Alachisoft.NCache.Tools.StressTestTool
{
/// <summary>
/// ThreadTest class, that contains all the logic used to instantiate multiple threads
/// on the basis of given parameters.
/// </summary>
internal sealed class ThreadTest
{
string _cacheId = "";
int _totalLoopCount = 0;
int _testCaseIterations = 10;
int _testCaseIterationDelay = 0;
int _getsPerIteration = 1;
int _updatesPerIteration = 1;
int _dataSize = 1024;
int _expiration = 300;
int _threadCount = 1;
int _reportingInterval = 5000;
/// <summary>
/// Overriden constructor that uses all user supplied parameters
/// </summary>
public ThreadTest(string cacheId, int totalLoopCount, int testCaseIterations, int testCaseIterationDelay, int getsPerIteration, int updatesPerIteration, int dataSize, int expiration, int threadCount, int reportingInterval, bool noLogo)
{
_cacheId = cacheId;
_totalLoopCount = totalLoopCount;
_testCaseIterations = testCaseIterations;
_testCaseIterationDelay = testCaseIterationDelay;
_getsPerIteration = getsPerIteration;
_updatesPerIteration = updatesPerIteration;
_dataSize = dataSize;
_expiration = expiration;
_threadCount = threadCount;
_reportingInterval = reportingInterval;
}
/// <summary>
/// Main test starting point. This method instantiate multiple threads and keeps track of
/// all of them.
/// </summary>
public void Test()
{
try
{
Thread[] threads = new Thread[_threadCount];
Cache cache = Factory.InitializeCache(_cacheId);
cache.ExceptionsEnabled = true;
string pid = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
for (int threadIndex = 0; threadIndex < _threadCount; threadIndex++)
{
ThreadContainer tc = new ThreadContainer(cache, _totalLoopCount, _testCaseIterations, _testCaseIterationDelay, _getsPerIteration, _updatesPerIteration, _dataSize, _expiration, _threadCount, _reportingInterval, threadIndex);
ThreadStart threadDelegate = new ThreadStart(tc.DoTest);
threads[threadIndex] = new Thread(threadDelegate);
threads[threadIndex].Name = "ThreadIndex: " + threadIndex;
threads[threadIndex].Start();
}
//--- wait on threads to complete their work before finishing
for (int threadIndex = 0; threadIndex < threads.Length; threadIndex++)
{
threads[threadIndex].Join();
}
cache.Dispose();
}
catch (Exception e)
{
Console.Error.WriteLine("Error :- " + e.Message);
Console.Error.WriteLine();
Console.Error.WriteLine(e.ToString());
}
}
}
/// <summary>
/// ThreadContainer class.
/// This class is being used to be run under each thread.
/// </summary>
internal class ThreadContainer
{
Cache _cache = null;
int _totalLoopCount = 0;
int _testCaseIterations = 10;
int _testCaseIterationDelay = 0;
int _getsPerIteration = 1;
int _updatesPerIteration = 1;
int _dataSize = 1024;
int _expiration = 300;
int _threadCount = 1;
int _reportingInterval = 5000;
int _threadIndex = 0;
int _pid = 0;
int numErrors = 0;
int maxErrors = 1000;
/// <summary>
/// Constructor
/// </summary>
public ThreadContainer(Cache cache, int totalLoopCount, int testCaseIterations, int testCaseIterationDelay, int getsPerIteration, int updatesPerIteration, int dataSize, int expiration, int threadCount, int reportingInterval, int threadIndex)
{
_cache = cache;
_totalLoopCount = totalLoopCount;
_testCaseIterations = testCaseIterations;
_testCaseIterationDelay = testCaseIterationDelay;
_getsPerIteration = getsPerIteration;
_updatesPerIteration = updatesPerIteration;
_dataSize = dataSize;
_expiration = expiration;
_threadCount = threadCount;
_reportingInterval = reportingInterval;
_threadIndex = threadIndex;
_pid = System.Diagnostics.Process.GetCurrentProcess().Id;
}
/// <summary>
/// Test starting call
/// </summary>
public void DoTest()
{
DoGetInsert();
}
/// <summary>
/// Perform Get/Insert operations on cache, bsed on user given input.
/// </summary>
private void DoGetInsert()
{
byte[] data = new byte[_dataSize];
if (_totalLoopCount <= 0)
{
// this means an infinite loop. user will have to do Ctrl-C to stop the program
for (long totalIndex = 0; ; totalIndex++)
{
ProcessGetInsertIteration(data);
if (totalIndex >= _reportingInterval)
{
long count = _cache.Count;
System.Console.WriteLine(DateTime.Now.ToString() + ": Cache count: " + count);
totalIndex = 1;
}
}
}
else
{
for (long totalIndex = 0; totalIndex < _totalLoopCount; totalIndex++)
{
ProcessGetInsertIteration(data);
if (totalIndex >= _reportingInterval)
{
long count = _cache.Count;
System.Console.WriteLine(DateTime.Now.ToString() + ": Cache count: " + count);
}
}
}
}
/// <summary>
/// Perform Get/Insert task on cache.
/// Called by DoGetInsert method
/// </summary>
private void ProcessGetInsertIteration(byte[] data)
{
string guid = System.Guid.NewGuid().ToString(); //create a unique key to be inserted in store.
for (long testCaseIndex = 0; testCaseIndex < _testCaseIterations; testCaseIndex++)
{
string key = guid;
for (int getsIndex = 0; getsIndex < _getsPerIteration; getsIndex++)
{
try
{
object obj = _cache.Get(key);
}
catch (Exception e)
{
Console.Error.WriteLine("GET Error: Key: " + key + ", Exception: " + e.ToString() + "\n");
numErrors++;
if (this.numErrors > this.maxErrors)
{
Console.Error.WriteLine("Too many errors. Press any key to exit ...");
Console.ReadKey(true);
System.Environment.Exit(0);
//This causes the programe to crash
//throw e;
}
}
}
for (int updatesIndex = 0; updatesIndex < _updatesPerIteration; updatesIndex++)
{
try
{
_cache.Insert(key, data,
Cache.NoAbsoluteExpiration,
new TimeSpan(0, 0, 0, _expiration),
CacheItemPriority.Default);
}
catch (Exception e)
{
Console.Error.WriteLine("INSERT Error: Key: " + key + ", Exception: " + e.ToString() + "\n");
numErrors++;
if (numErrors > this.maxErrors)
{
Console.Error.WriteLine("Too many errors. Press any key to exit ...");
Console.ReadKey(true);
System.Environment.Exit(0);
//This causes the programe to crash
//throw e;
}
}
}
if (_testCaseIterationDelay > 0)
{
// Sleep for this many seconds
Thread.Sleep(_testCaseIterationDelay * 1000);
}
}
}
/// <summary>
/// Creates and returns a unique key on the basis of thread index
/// Although not been called by any method.
/// </summary>
//private string GetKey(long index)
//{
// return Environment.MachineName + "key:" + Thread.CurrentThread.Name + ":" + index;
//}
}
}
| {
"content_hash": "d558948a6a6e629e7db6202ea523244a",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 249,
"avg_line_length": 37.38492063492063,
"alnum_prop": 0.5023882814987793,
"repo_name": "modulexcite/NCache",
"id": "14cba410b633aa84e1f9206c56053744e83f8c4d",
"size": "10014",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Tools/StressTestTool/ThreadTest.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6835"
},
{
"name": "C",
"bytes": "849"
},
{
"name": "C#",
"bytes": "7847243"
},
{
"name": "C++",
"bytes": "11428"
},
{
"name": "CSS",
"bytes": "13185"
},
{
"name": "HTML",
"bytes": "297159"
},
{
"name": "PowerShell",
"bytes": "15593"
},
{
"name": "Protocol Buffer",
"bytes": "38694"
}
],
"symlink_target": ""
} |
var utils = require('../../e2e/utils')
describe('angular.simple_app', function () {
beforeEach(utils.verifyNoBrowserErrors)
it('should have correct number of transactions and traces', function (done) {
browser.url('/angular/index.e2e.html')
.executeAsync(function (cb) {
window.e2eUtils.runFixture('./simple_app/simple_app.js', ['angular', './opbeat-angular.e2e.js', 'angular-route'], {
beforeInit: function (app, deps) {
window.e2e.getTransactions(function (trs) {
cb(trs)
}, 0, 1)
app.init()
},
appName: 'simple_app',
useNgApp: undefined,
uiRouter: false
})
})
.then(function (response) {
var transactions = response.value
// console.log('transactions', transactions)
expect(transactions.length).toBe(1)
var first = transactions[0]
expect(first.traces.groups.length).toBeGreaterThan(7)
expect(first.traces.raw[0].length).toBeGreaterThan(11)
expect(first.transactions.length).toBe(1)
expect(first.transactions[0].transaction).toBe('/')
done()
}, function (error) {
console.log(error)
})
})
it('should have correct number of transactions and traces using ng-app', function (done) {
browser.url('/angular/index.ngApp.html')
.executeAsync(function (cb) {
window.simple_app.init()
window.e2e.getTransactions(function (trs) {
cb(trs)
}, 0, 1)
})
.then(function (response) {
var transactions = response.value
expect(transactions.length).toBe(1)
var first = transactions[0]
expect(first.traces.groups.length).toBeGreaterThan(7)
expect(first.traces.raw[0].length).toBeGreaterThan(11)
expect(first.transactions.length).toBe(1)
expect(first.transactions[0].transaction).toBe('/')
done()
}, function (error) {
console.log(error)
})
})
it('should be running the correct major/minor version of angular', function (done) {
browser.url('/angular/index.e2e.html').then(function () {
browser.executeAsync(function (cb) {
window.e2eUtils.loadDependencies(['angular'], function () {
cb(window.angular.version)
})
}).then(function (response) {
var version = response.value
console.log('Browser angular version: ' + version.full)
console.log('Expected angular version: ' + browser.expectedAngularVersion.full)
expect(version.major).toEqual(browser.expectedAngularVersion.major)
expect(version.minor).toEqual(browser.expectedAngularVersion.minor)
done()
})
})
})
afterEach(utils.verifyNoBrowserErrors)
})
| {
"content_hash": "6e39f9ad26821d1a85a5a21b53cc87ca",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 123,
"avg_line_length": 33.91463414634146,
"alnum_prop": 0.6163250629270047,
"repo_name": "jahtalab/opbeat-js",
"id": "374571f74cc2f12c075023148d230ec54f9dc6d6",
"size": "2781",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/e2e/angular/simple_app/simple_app.e2e-spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "12830"
},
{
"name": "JavaScript",
"bytes": "192855"
},
{
"name": "Shell",
"bytes": "2759"
}
],
"symlink_target": ""
} |
<?php
namespace app\controllers;
use Yii;
use app\models\SerieClassLink;
use app\models\SerieClassLinkSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* SerieClassLinkController implements the CRUD actions for SerieClassLink model.
*/
class SerieClassLinkController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all SerieClassLink models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new SerieClassLinkSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single SerieClassLink model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new SerieClassLink model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new SerieClassLink();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing SerieClassLink model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing SerieClassLink model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the SerieClassLink model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return SerieClassLink the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = SerieClassLink::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
| {
"content_hash": "7dbcac9b1febba984e02e08e663a6137",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 85,
"avg_line_length": 26.43801652892562,
"alnum_prop": 0.5470459518599562,
"repo_name": "dyarob/diane_yii2",
"id": "6e6e01386a62af4bc928a3eaafa0a774e4d40edb",
"size": "3199",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "controllers/SerieClassLinkController.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "2846"
},
{
"name": "JavaScript",
"bytes": "43349"
},
{
"name": "PHP",
"bytes": "164559"
},
{
"name": "Shell",
"bytes": "1041"
}
],
"symlink_target": ""
} |
export default class TodoService {
constructor($http) {
this.$http = $http;
}
getAll() {
return this.$http.get('https://jsonplaceholder.typicode.com/todos');
}
} | {
"content_hash": "0e4007103945ebb2c9ec93979416176f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 76,
"avg_line_length": 22.444444444444443,
"alnum_prop": 0.5693069306930693,
"repo_name": "giovannigiordano/angular-electron-boilerplate",
"id": "2230a0a96f117fe4461b7e6e4222fe82351198f6",
"size": "202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/services/todo.service.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "121"
},
{
"name": "JavaScript",
"bytes": "3565"
}
],
"symlink_target": ""
} |
<div id="view">
<img id="button_list" src="apps/app_image/images/list.svg" class="image" onclick="app_image.triggerList();" />
<p>Aucune image à afficher pour le moment.</p>
</div>
<div id="list" style="display: none;">
<img src="apps/app_image/images/arrow.svg" class="arrow" />
<div id="content">
<span>
<p>Chargement en cours...</p>
</span>
</div>
</div>
<div id="control">
<p><img src="apps/app_image/images/actions/rotate_left.svg" onclick="app_image.actions.rotate(-90);" /><br />Pivoter de -90°</p>
<p><img src="apps/app_image/images/actions/see_fullscreen.svg" onclick="app_image.actions.fullscreen();" /><br />Mettre en plein-écran</p>
<p><img src="apps/app_image/images/actions/rotate_right.svg" onclick="app_image.actions.rotate(+90);" /><br />Pivoter de 90°</p>
</div> | {
"content_hash": "d178eee5109ca13054dcf5e3cd4a45e1",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 142,
"avg_line_length": 40.57142857142857,
"alnum_prop": 0.6244131455399061,
"repo_name": "Ne0blast/cosmos",
"id": "57087568bc82af0f1a542ce670e234735c88fc58",
"size": "856",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "apps/app_image/application.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "13"
},
{
"name": "CSS",
"bytes": "93375"
},
{
"name": "HTML",
"bytes": "21348"
},
{
"name": "JavaScript",
"bytes": "299854"
},
{
"name": "PHP",
"bytes": "127718"
}
],
"symlink_target": ""
} |
function [w,b] = shooting(x,y, reallambda)
[nd, dim] = size(x);
w=zeros(dim,1);
b = 0;
residuals = y;
lambda = 0.001;
for j = 1:1000
a=randperm(dim);
for i = a
% solve the local squared loss minimization step
% first, my contribution to the 'y's are
localcontribution = w(i) * x(:,i);
% take away my contributions
residuals = residuals + localcontribution;
% solve a local least squares
ix = 1.0 / (x(:,i)' * x(:,i)); % this should be a scaler!
w(i) = ix * x(:,i)' * residuals;
if (w(i) > lambda)
w(i) = w(i) - lambda;
elseif (w(i) < -lambda)
w(i) = w(i) + lambda;
else
w(i) = 0;
end
% compute my new contributions and subtract from the residuals
localcontribution = w(i) * x(:,i);
residuals = residuals - localcontribution;
end
end
end | {
"content_hash": "368e3e65e354d176923c1d4bab2444b7",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 70,
"avg_line_length": 29.322580645161292,
"alnum_prop": 0.5302530253025303,
"repo_name": "ekoontz/graphlab",
"id": "ebe4abdb1ef85de9cf8209cd52ed576fbddf3035",
"size": "909",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "apps/shooting/shooting.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "1662156"
},
{
"name": "C++",
"bytes": "1103089"
},
{
"name": "Objective-C",
"bytes": "1419"
},
{
"name": "Shell",
"bytes": "791"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>state</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
| {
"content_hash": "48cffa01be8cfdd8403613cf5e6e071d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 149,
"avg_line_length": 34.111111111111114,
"alnum_prop": 0.6758957654723127,
"repo_name": "john0xff/java-design-patterns",
"id": "8afae338cd1c4da5262652e60a32ad6280d4b944",
"size": "614",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "state/pom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "238318"
}
],
"symlink_target": ""
} |
'use strict';
var models = require('./index');
var util = require('util');
/**
* @class
* Initializes a new instance of the Salmon class.
* @constructor
* @member {string} [location]
*
* @member {boolean} [iswild]
*
*/
function Salmon() {
Salmon['super_'].call(this);
}
util.inherits(Salmon, models['Fish']);
/**
* Defines the metadata of Salmon
*
* @returns {object} metadata of Salmon
*
*/
Salmon.prototype.mapper = function () {
return {
required: false,
serializedName: 'salmon',
type: {
name: 'Composite',
className: 'Salmon',
modelProperties: {
species: {
required: false,
serializedName: 'species',
type: {
name: 'String'
}
},
length: {
required: true,
serializedName: 'length',
type: {
name: 'Number'
}
},
siblings: {
required: false,
serializedName: 'siblings',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'FishElementType',
type: {
name: 'Composite',
polymorphicDiscriminator: 'fishtype',
uberParent: 'Fish',
className: 'Fish'
}
}
}
},
fishtype: {
required: true,
serializedName: 'fishtype',
type: {
name: 'String'
}
},
location: {
required: false,
serializedName: 'location',
type: {
name: 'String'
}
},
iswild: {
required: false,
serializedName: 'iswild',
type: {
name: 'Boolean'
}
}
}
}
};
};
module.exports = Salmon;
| {
"content_hash": "ec4632fbe908616d5116ffe95f4bcc20",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 55,
"avg_line_length": 19.936842105263157,
"alnum_prop": 0.44878563885955647,
"repo_name": "jkonecki/autorest",
"id": "e1ead6a5cb87936b04564f3d6729d396ad06bfdc",
"size": "2212",
"binary": false,
"copies": "26",
"ref": "refs/heads/master",
"path": "AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/models/salmon.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "270"
},
{
"name": "C#",
"bytes": "6404226"
},
{
"name": "CSS",
"bytes": "110"
},
{
"name": "HTML",
"bytes": "589"
},
{
"name": "Java",
"bytes": "52197"
},
{
"name": "JavaScript",
"bytes": "2844345"
},
{
"name": "PowerShell",
"bytes": "16348"
},
{
"name": "Ruby",
"bytes": "121623"
}
],
"symlink_target": ""
} |
package graphql.schema;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static graphql.Assert.assertNotNull;
public class GraphQLInterfaceType implements GraphQLType, GraphQLOutputType, GraphQLFieldsContainer, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {
private final String name;
private final String description;
private final Map<String, GraphQLFieldDefinition> fieldDefinitionsByName = new LinkedHashMap<>();
private final TypeResolver typeResolver;
public GraphQLInterfaceType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions, TypeResolver typeResolver) {
assertNotNull(name, "name can't null");
assertNotNull(typeResolver, "typeResolver can't null");
assertNotNull(fieldDefinitions, "fieldDefinitions can't null");
this.name = name;
this.description = description;
buildDefinitionMap(fieldDefinitions);
this.typeResolver = typeResolver;
}
private void buildDefinitionMap(List<GraphQLFieldDefinition> fieldDefinitions) {
for (GraphQLFieldDefinition fieldDefinition : fieldDefinitions) {
fieldDefinitionsByName.put(fieldDefinition.getName(), fieldDefinition);
}
}
public GraphQLFieldDefinition getFieldDefinition(String name) {
return fieldDefinitionsByName.get(name);
}
public List<GraphQLFieldDefinition> getFieldDefinitions() {
return new ArrayList<>(fieldDefinitionsByName.values());
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public TypeResolver getTypeResolver() {
return typeResolver;
}
@Override
public String toString() {
return "GraphQLInterfaceType{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", fieldDefinitionsByName=" + fieldDefinitionsByName +
", typeResolver=" + typeResolver +
'}';
}
public static Builder newInterface() {
return new Builder();
}
public static class Builder {
private String name;
private String description;
private List<GraphQLFieldDefinition> fields = new ArrayList<>();
private TypeResolver typeResolver;
public Builder name(String name) {
this.name = name;
return this;
}
public Builder description(String description) {
this.description = description;
return this;
}
public Builder field(GraphQLFieldDefinition fieldDefinition) {
fields.add(fieldDefinition);
return this;
}
public Builder fields(List<GraphQLFieldDefinition> fieldDefinitions) {
assertNotNull(fieldDefinitions, "fieldDefinitions can't be null");
fields.addAll(fieldDefinitions);
return this;
}
public Builder typeResolver(TypeResolver typeResolver) {
this.typeResolver = typeResolver;
return this;
}
public GraphQLInterfaceType build() {
return new GraphQLInterfaceType(name, description, fields, typeResolver);
}
}
}
| {
"content_hash": "30bf4c6b8ab96628dea00f8b193d6399",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 167,
"avg_line_length": 30.144144144144143,
"alnum_prop": 0.6583980872683801,
"repo_name": "BenjaminMalley/graphql-java",
"id": "07c5bd276cb32a418776e0050d2f6ce1fcdda798",
"size": "3346",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/graphql/schema/GraphQLInterfaceType.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "2460"
},
{
"name": "Groovy",
"bytes": "143963"
},
{
"name": "Java",
"bytes": "395181"
}
],
"symlink_target": ""
} |
package org.hawkular.client.android.adapter;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import org.hawkular.client.android.backend.model.Alert;
import org.hawkular.client.android.backend.model.Note;
import org.hawkular.client.android.util.Randomizer;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
@RunWith(AndroidJUnit4.class)
public final class AlertsAdapterTester {
private Context context;
@Before
public void setUp() {
context = InstrumentationRegistry.getTargetContext();
}
@Test
public void count() {
List<Alert> alerts = generateAlerts();
AlertsAdapter alertsAdapter = new AlertsAdapter(context, new AlertMenuAdapter(), alerts);
assertThat(alertsAdapter.getItemCount(), is(alerts.size()));
}
@Test
public void item() {
Alert alert = generateAlert();
List<Alert> alerts = new ArrayList<>();
alerts.add(alert);
alerts.addAll(generateAlerts());
AlertsAdapter alertsAdapter = new AlertsAdapter(context, new AlertMenuAdapter(), alerts);
assertThat(alertsAdapter.getItem(0), is(alert));
}
private List<Alert> generateAlerts() {
List<Alert> alerts = new ArrayList<>();
for (int alertPosition = 0; alertPosition < Randomizer.generateNumber(); alertPosition++) {
alerts.add(generateAlert());
}
return alerts;
}
private Alert generateAlert() {
return new Alert(
Randomizer.generateString(),
Randomizer.generateNumber(),
(new ArrayList<Alert.Lister>()),
Randomizer.generateString(),
Randomizer.generateString(),
new ArrayList<Note>());
}
private static final class AlertMenuAdapter implements AlertsAdapter.AlertListener {
@Override
public void onAlertMenuClick(View alertView, int alertPosition) {
}
@Override public void onAlertBodyClick(View alertView, int alertPosition) {
}
}
}
| {
"content_hash": "2c05d3493143cd8198ef27331e6e8877",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 99,
"avg_line_length": 27.93975903614458,
"alnum_prop": 0.6722725312634756,
"repo_name": "sauravvishal8797/hawkular-android-client",
"id": "bf9c7711695504d02703ebf06a6ba9db05f278a1",
"size": "3001",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "mobile/src/androidTest/java/org/hawkular/client/android/adapter/AlertsAdapterTester.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "IDL",
"bytes": "643"
},
{
"name": "Java",
"bytes": "424712"
},
{
"name": "Prolog",
"bytes": "1292"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>openshift on Federico Ragona</title>
<link>https://fedragon.github.io/tags/openshift/</link>
<description>Recent content in openshift on Federico Ragona</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-US</language>
<copyright>Creative Commons license 4.0</copyright>
<lastBuildDate>Sat, 01 Aug 2020 21:21:51 +0200</lastBuildDate>
<atom:link href="https://fedragon.github.io/tags/openshift/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Setup CodeReady Containers for OpenShift 4.x with internal image registry</title>
<link>https://fedragon.github.io/posts/2020/08/01/setup-crc-with-internal-image-registry/</link>
<pubDate>Sat, 01 Aug 2020 21:21:51 +0200</pubDate>
<guid>https://fedragon.github.io/posts/2020/08/01/setup-crc-with-internal-image-registry/</guid>
<description>Red Hat CodeReady Containers (CrC) is a project that enables us to run a minimal OpenShift 4.x cluster on a laptop for local development. Since we&rsquo;ll be frequently building Docker images while developing, we might not want to be forced to push them to Docker Hub every time in order to be able to deploy them to the local cluster: to avoid that, we can make use of OpenShift&rsquo;s internal image registry.</description>
</item>
</channel>
</rss> | {
"content_hash": "83a24ae57a7f62645f99684e59a596e6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 454,
"avg_line_length": 60.32,
"alnum_prop": 0.71684350132626,
"repo_name": "fedragon/fedragon.github.io",
"id": "71c23fccdade2d2d48a7cf24270badecdc9ed6da",
"size": "1508",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags/openshift/index.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3364"
},
{
"name": "HTML",
"bytes": "127490"
},
{
"name": "JavaScript",
"bytes": "457"
}
],
"symlink_target": ""
} |
int
main (int argc, char** argv)
{
// Load input file into a PointCloud<T> with an appropriate type
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ> ());
// Load bun0.pcd -- should be available with the PCL archive in test
pcl::io::loadPCDFile ("bun0.pcd", *cloud);
// Create a KD-Tree
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);
// Output has the PointNormal type in order to store the normals calculated by MLS
pcl::PointCloud<pcl::PointNormal> mls_points;
// Init object (second point type is for the normals, even if unused)
pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;
mls.setComputeNormals (true);
// Set parameters
mls.setInputCloud (cloud);
mls.setPolynomialOrder (2);
mls.setSearchMethod (tree);
mls.setSearchRadius (0.03);
// Reconstruct
mls.process (mls_points);
// Save output
pcl::io::savePCDFile ("bun0-mls.pcd", mls_points);
}
| {
"content_hash": "967358a05e29617eb790cc99386db518",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 88,
"avg_line_length": 31.612903225806452,
"alnum_prop": 0.7,
"repo_name": "drmateo/pcl",
"id": "0efbca9c30b9685450dba1932830a4c143ebeeb5",
"size": "1103",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "doc/tutorials/content/sources/resampling/resampling.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "172874"
},
{
"name": "C++",
"bytes": "19619498"
},
{
"name": "CMake",
"bytes": "440645"
},
{
"name": "Cuda",
"bytes": "923615"
},
{
"name": "GLSL",
"bytes": "2653"
},
{
"name": "Matlab",
"bytes": "3407"
},
{
"name": "Objective-C",
"bytes": "5638"
},
{
"name": "Objective-C++",
"bytes": "7489"
},
{
"name": "Python",
"bytes": "29169"
},
{
"name": "Shell",
"bytes": "9857"
}
],
"symlink_target": ""
} |
<div class="commune_descr limited">
<p>
Marigné-Peuton est
un village
situé dans le département de Mayenne en Pays de la Loire. Elle comptait 543 habitants en 2008.</p>
<p>La commune compte quelques équipements, elle dispose, entre autres, de un terrain de tennis, un terrain de sport et un équipement de roller/skate.</p>
<p>Le parc d'habitations, à Marigné-Peuton, se décomposait en 2011 en un appartements et 232 maisons soit
un marché plutôt équilibré.</p>
<p>Si vous envisagez de emmenager à Marigné-Peuton, vous pourrez aisément trouver une maison à acheter. </p>
<p>À proximité de Marigné-Peuton sont localisées les communes de
<a href="{{VLROOT}}/immobilier/houssay_53117/">Houssay</a> située à 7 km, 388 habitants,
<a href="{{VLROOT}}/immobilier/simple_53260/">Simplé</a> située à 3 km, 342 habitants,
<a href="{{VLROOT}}/immobilier/laigne_53124/">Laigné</a> située à 2 km, 750 habitants,
<a href="{{VLROOT}}/immobilier/loigne-sur-mayenne_53136/">Loigné-sur-Mayenne</a> située à 4 km, 839 habitants,
<a href="{{VLROOT}}/immobilier/peuton_53178/">Peuton</a> localisée à 1 km, 224 habitants,
<a href="{{VLROOT}}/immobilier/quelaines-saint-gault_53186/">Quelaines-Saint-Gault</a> située à 6 km, 1 822 habitants,
entre autres. De plus, Marigné-Peuton est située à seulement 22 km de <a href="{{VLROOT}}/immobilier/laval_53130/">Laval</a>.</p>
<p>À Marigné-Peuton, le prix moyen à l'achat d'un appartement se situe à zero € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 1 252 € du m². À la location le prix moyen se situe à 0 € du m² mensuel.</p>
</div>
| {
"content_hash": "edc83e0fa04eaa39e4eeb98859aa5a87",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 240,
"avg_line_length": 87.10526315789474,
"alnum_prop": 0.7341389728096677,
"repo_name": "donaldinou/frontend",
"id": "299cb94cf1e56f93da5cbde072ff76cd5958903b",
"size": "1704",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Viteloge/CoreBundle/Resources/descriptions/53145.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "111338"
},
{
"name": "HTML",
"bytes": "58634405"
},
{
"name": "JavaScript",
"bytes": "88564"
},
{
"name": "PHP",
"bytes": "841919"
}
],
"symlink_target": ""
} |
// A good bit of this code was derived from the Three20 project
// and was customized to work inside NclApp
//
// All modifications by NclApp are licensed under
// the Apache License, Version 2.0
//
//
// Copyright 2009 Facebook
//
// 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.
//
#ifdef USE_TI_UIDASHBOARDVIEW
#ifndef TI_INVALIDATE_TIMER
#define TI_INVALIDATE_TIMER(__TIMER) { [__TIMER invalidate]; __TIMER = nil; }
#endif
#import "LauncherView.h"
#import "LauncherItem.h"
#import "LauncherButton.h"
static const CGFloat kLauncherViewMargin = 0;
static const CGFloat kLauncherViewPadding = 0;
static const CGFloat kLauncherViewPagerHeight = 20;
static const CGFloat kLauncherViewWobbleRadians = 1.5;
static const CGFloat kLauncherViewSpringLoadFraction = 0.18;
static const NSTimeInterval kLauncherViewEditHoldTimeInterval = 1;
static const NSTimeInterval kLauncherViewSpringLoadTimeInterval = 0.5;
static const NSTimeInterval kLauncherViewWobbleTime = 0.07;
static const NSInteger kLauncherViewDefaultColumnCount = 3;
static const NSTimeInterval kLauncherViewTransitionDuration = 0.3;
static const NSTimeInterval kLauncherViewFastTransitionDuration = 0.2;
@interface LauncherScrollView : UIScrollView
@end
@implementation LauncherScrollView
- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
return !self.delaysContentTouches;
}
@end
@implementation LauncherView
@synthesize columnCount, rowCount, delegate, editable;
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame]))
{
self.columnCount = kLauncherViewDefaultColumnCount;
self.rowCount = 0;
self.currentPageIndex = 0;
self.editable = YES;
renderingButtons = NO;
scrollView = [[LauncherScrollView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height - kLauncherViewPagerHeight - 30)];
scrollView.delegate = self;
scrollView.scrollsToTop = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.alwaysBounceHorizontal = YES;
scrollView.pagingEnabled = YES;
scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
scrollView.delaysContentTouches = NO;
scrollView.multipleTouchEnabled = NO;
[self addSubview:scrollView];
pager = [[UIPageControl alloc] init];
pager.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
[pager addTarget:self action:@selector(pageChanged) forControlEvents:UIControlEventValueChanged];
[self addSubview:pager];
}
return self;
}
- (void)dealloc
{
delegate = nil;
if (editing)
{
[self endEditing];
}
[pager release];
[buttons release];
[scrollView release];
[pages release];
[super dealloc];
}
-(LauncherButton*)addButtonWithItem:(LauncherItem*)item
{
LauncherButton *button = [[LauncherButton alloc] initWithFrame:CGRectZero];
[button setTitle:item.title forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonTouchedUpInside:) forControlEvents:UIControlEventTouchUpInside];
[button addTarget:self action:@selector(buttonTouchedUpOutside:) forControlEvents:UIControlEventTouchUpOutside];
[button addTarget:self action:@selector(buttonTouchedDown:withEvent:) forControlEvents:UIControlEventTouchDown];
[scrollView addSubview:button];
button.item = item;
return [button autorelease];
}
-(NSInteger)rowHeight
{
return MAX(33,(scrollView.frame.size.height /3));
}
- (NSMutableArray*)pageWithFreeSpace:(NSInteger)pageIndex
{
for (NSInteger i = self.currentPageIndex; i < pages.count; ++i)
{
NSMutableArray* page = [pages objectAtIndex:i];
if (page.count < self.columnCount*self.rowCount)
{
return page;
}
}
NSMutableArray* page = [NSMutableArray array];
[pages addObject:page];
return page;
}
- (NSInteger)rowCount
{
if (!rowCount)
{
rowCount = floor(self.frame.size.height / [self rowHeight]);
}
return rowCount;
}
- (NSInteger)currentPageIndex
{
return floor(scrollView.contentOffset.x/scrollView.frame.size.width);
}
- (NSMutableArray*)pageWithItem:(LauncherItem*)item
{
for (NSMutableArray* page in pages)
{
NSUInteger itemIndex = [page indexOfObject:item];
if (itemIndex != NSNotFound)
{
return page;
}
}
return nil;
}
- (NSIndexPath*)indexPathOfItem:(LauncherItem*)item
{
for (NSUInteger pageIndex = 0; pageIndex < pages.count; ++pageIndex)
{
NSArray* page = [pages objectAtIndex:pageIndex];
NSUInteger itemIndex = [page indexOfObject:item];
if (itemIndex != NSNotFound)
{
NSUInteger path[] = {pageIndex, itemIndex};
return [NSIndexPath indexPathWithIndexes:path length:2];
}
}
return nil;
}
- (NSMutableArray*)pageWithButton:(LauncherButton*)button
{
NSIndexPath* path = [self indexPathOfItem:button.item];
if (path)
{
NSInteger pageIndex = [path indexAtPosition:0];
return [buttons objectAtIndex:pageIndex];
}
return nil;
}
- (void)setCurrentPageIndex:(NSInteger)pageIndex
{
scrollView.contentOffset = CGPointMake(scrollView.frame.size.width*pageIndex, 0);
}
- (void)updateContentSize:(NSInteger)numberOfPages
{
scrollView.contentSize = CGSizeMake(numberOfPages*scrollView.frame.size.width, scrollView.frame.size.height);
if (numberOfPages != pager.numberOfPages)
{
pager.numberOfPages = numberOfPages;
[pager setCurrentPage:numberOfPages-1];
}
}
- (void)layoutButtons
{
[self layoutIfNeeded];
CGFloat buttonWidth = ceil((self.frame.size.width - (kLauncherViewMargin*2 + kLauncherViewPadding*(self.columnCount-1))) / self.columnCount);
CGFloat buttonHeight = [self rowHeight];
CGFloat pageWidth = scrollView.frame.size.width;
CGFloat x = kLauncherViewMargin, minX = 0;
for (NSMutableArray* buttonPage in buttons)
{
CGFloat y = kLauncherViewMargin;
for (LauncherButton* button in buttonPage)
{
CGRect frame = CGRectMake(x, y, buttonWidth, buttonHeight);
if (!button.dragging)
{
button.transform = CGAffineTransformIdentity;
button.frame = button == dragButton ? [scrollView convertRect:frame toView:self] : frame;
}
x += buttonWidth + kLauncherViewPadding;
if (x >= minX+pageWidth)
{
y += buttonHeight + kLauncherViewPadding;
x = minX+kLauncherViewMargin;
}
}
minX += pageWidth;
x = minX;
}
NSInteger numberOfPages = pages.count;
[self updateContentSize:numberOfPages];
}
- (void)recreateButtons
{
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self recreateButtons];
});
return;
}
renderingButtons = YES;
[self layoutIfNeeded];
NSInteger curIndex = self.currentPageIndex;
for (UIView *view in [scrollView subviews])
{
[view removeFromSuperview];
}
[buttons release];
buttons = [[NSMutableArray alloc] init];
for (NSArray* page in pages)
{
NSMutableArray* buttonPage = [NSMutableArray array];
[buttons addObject:buttonPage];
for (LauncherItem* item in page)
{
LauncherButton* button = [self addButtonWithItem:item];
[buttonPage addObject:button];
}
}
renderingButtons = NO;
[self layoutButtons];
[pager setCurrentPage:curIndex];
}
- (void)scrollToItem:(LauncherItem*)item animated:(BOOL)animated
{
NSIndexPath* path = [self indexPathOfItem:item];
if (path!=nil)
{
NSUInteger page = [path indexAtPosition:0];
CGFloat x = page * scrollView.frame.size.width;
[scrollView setContentOffset:CGPointMake(x, 0) animated:animated];
}
}
- (void)addItem:(LauncherItem*)item animated:(BOOL)animated
{
if (pages==nil)
{
pages = [[NSMutableArray arrayWithObject:[NSMutableArray arrayWithObject:item]] retain];
}
else
{
NSMutableArray* page = [self pageWithFreeSpace:self.currentPageIndex];
[page addObject:item];
}
if ([delegate respondsToSelector:@selector(launcherView:didAddItem:)])
{
[delegate launcherView:self didAddItem:item];
}
if (buttons)
{
[self recreateButtons];
}
}
- (void)layoutSubviews
{
[super layoutSubviews];
pager.frame = CGRectMake(0, scrollView.frame.size.height, self.frame.size.width, kLauncherViewPagerHeight);
if (buttons==nil && !renderingButtons)
{
[self recreateButtons];
}
}
- (void)startDraggingButton:(LauncherButton*)button withEvent:(UIEvent*)event
{
TI_INVALIDATE_TIMER(springLoadTimer);
if (button)
{
if ([delegate respondsToSelector:@selector(launcherView:willDragItem:)]) {
[delegate launcherView:self willDragItem:button.item];
}
button.transform = CGAffineTransformIdentity;
[self addSubview:button];
CGPoint point = [scrollView convertPoint:button.frame.origin toView:self];
button.frame = CGRectMake(point.x, point.y, button.frame.size.width, button.frame.size.height);
[button layoutIfNeeded];
}
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kLauncherViewFastTransitionDuration];
if (dragButton)
{
dragButton.selected = NO;
dragButton.highlighted = NO;
dragButton.dragging = NO;
[self layoutButtons];
}
if (button)
{
dragButton = button;
NSIndexPath* indexPath = [self indexPathOfItem:button.item];
positionOrigin = [indexPath indexAtPosition:1];
UITouch* touch = [[event allTouches] anyObject];
touchOrigin = [touch locationInView:scrollView];
dragOrigin = button.center;
dragTouch = touch;
button.dragging = YES;
scrollView.scrollEnabled = NO;
}
else
{
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(releaseButtonDidStop)];
scrollView.scrollEnabled = YES;
}
[UIView commitAnimations];
}
- (void)releaseButtonDidStop
{
[scrollView addSubview:dragButton];
CGPoint point = [self convertPoint:dragButton.frame.origin toView:scrollView];
dragButton.frame = CGRectMake(point.x, point.y, dragButton.frame.size.width, dragButton.frame.size.height);
dragButton = nil;
}
- (void)deselectButton:(LauncherButton*)button
{
[button setSelected:NO];
}
- (void)buttonTouchedUpInside:(LauncherButton*)button
{
if (editing)
{
if (button == dragButton)
{
[self startDraggingButton:nil withEvent:nil];
}
}
else
{
TI_INVALIDATE_TIMER(editHoldTimer);
[button setSelected:YES];
[self performSelector:@selector(deselectButton:) withObject:button afterDelay:kLauncherViewTransitionDuration];
if ([delegate respondsToSelector:@selector(launcherView:didSelectItem:)])
{
[delegate launcherView:self didSelectItem:button.item];
}
}
}
- (void)buttonTouchedUpOutside:(LauncherButton*)button
{
if (editing)
{
if (button == dragButton)
{
[self startDraggingButton:nil withEvent:nil];
}
}
else
{
TI_INVALIDATE_TIMER(editHoldTimer);
}
}
- (void)wobble
{
static BOOL wobblesLeft = NO;
if (editing)
{
CGFloat rotation = (kLauncherViewWobbleRadians * M_PI) / 180.0;
CGAffineTransform wobbleLeft = CGAffineTransformMakeRotation(rotation);
CGAffineTransform wobbleRight = CGAffineTransformMakeRotation(-rotation);
[UIView beginAnimations:nil context:nil];
NSInteger i = 0;
NSInteger nWobblyButtons = 0;
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
if (button != dragButton)
{
++nWobblyButtons;
if (i % 2)
{
button.transform = wobblesLeft ? wobbleRight : wobbleLeft;
}
else
{
button.transform = wobblesLeft ? wobbleLeft : wobbleRight;
}
}
++i;
}
}
if (nWobblyButtons >= 1)
{
[UIView setAnimationDuration:kLauncherViewWobbleTime];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(wobble)];
wobblesLeft = !wobblesLeft;
}
else
{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[self performSelector:@selector(wobble) withObject:nil afterDelay:kLauncherViewWobbleTime];
}
[UIView commitAnimations];
}
}
- (void)endEditingAnimationDidStop:(NSString*)animationID finished:(NSNumber*)finished
context:(void*)context
{
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
button.editing = NO;
}
}
}
- (LauncherButton*)buttonForItem:(LauncherItem*)item
{
NSIndexPath* path = [self indexPathOfItem:item];
if (path)
{
NSInteger pageIndex = [path indexAtPosition:0];
NSArray* buttonPage = [buttons objectAtIndex:pageIndex];
NSInteger itemIndex = [path indexAtPosition:1];
return [buttonPage objectAtIndex:itemIndex];
}
return nil;
}
- (void)removeItem:(LauncherItem*)item animated:(BOOL)animated
{
NSMutableArray* itemPage = [self pageWithItem:item];
if (itemPage)
{
LauncherButton* button = [self buttonForItem:item];
NSMutableArray* buttonPage = [self pageWithButton:button];
[itemPage removeObject:button.item];
if (buttonPage)
{
[buttonPage removeObject:button];
if (animated)
{
[UIView beginAnimations:nil context:button];
[UIView setAnimationDuration:kLauncherViewFastTransitionDuration];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(removeButtonAnimationDidStop:finished:context:)];
[self layoutButtons];
button.transform = CGAffineTransformMakeScale(0.01, 0.01);
button.alpha = 0;
[UIView commitAnimations];
}
else
{
[button removeFromSuperview];
[self layoutButtons];
}
}
if ([delegate respondsToSelector:@selector(launcherView:didRemoveItem:)])
{
[delegate launcherView:self didRemoveItem:item];
}
}
}
- (void)closeButtonTouchedUpInside:(LauncherButton*)closeButton
{
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
if (button.closeButton == closeButton)
{
[self removeItem:button.item animated:YES];
return;
}
}
}
}
- (NSArray*)items
{
NSMutableArray *items = [NSMutableArray array];
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
[items addObject:button.item.userData];
}
}
return items;
}
- (LauncherItem*)itemForIndex:(NSInteger)index
{
NSInteger c = 0;
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
if (c == index)
{
return button.item;
}
c++;
}
}
return nil;
}
- (void)beginEditing
{
editing = YES;
scrollView.delaysContentTouches = YES;
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
button.editing = YES;
[button.closeButton addTarget:self action:@selector(closeButtonTouchedUpInside:) forControlEvents:UIControlEventTouchUpInside];
}
}
// Add a page at the end
[pages addObject:[NSMutableArray array]];
[buttons addObject:[NSMutableArray array]];
[self updateContentSize:pages.count];
BOOL shouldWobble = YES;
if ([delegate respondsToSelector:@selector(launcherViewShouldWobble:)])
{
shouldWobble = [delegate launcherViewShouldWobble:self];
}
if (shouldWobble)
{
[self wobble];
}
if ([delegate respondsToSelector:@selector(launcherViewDidBeginEditing:)])
{
[delegate launcherViewDidBeginEditing:self];
}
}
- (void)endEditing
{
editing = NO;
scrollView.delaysContentTouches = NO;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kLauncherViewTransitionDuration];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(endEditingAnimationDidStop:finished:context:)];
for (NSArray* buttonPage in buttons)
{
for (LauncherButton* button in buttonPage)
{
button.transform = CGAffineTransformIdentity;
button.closeButton.alpha = 0;
}
}
[UIView commitAnimations];
NSInteger curIndex = self.currentPageIndex;
for (NSInteger i = 0; i < pages.count; ++i)
{
NSArray* page = [pages objectAtIndex:i];
if (!page.count)
{
[pages removeObjectAtIndex:i];
[buttons removeObjectAtIndex:i];
--i;
}
}
[self layoutButtons];
[pager setCurrentPage:curIndex];
if ([delegate respondsToSelector:@selector(launcherViewDidEndEditing:)])
{
[delegate launcherViewDidEndEditing:self];
}
}
- (void)editHoldTimer:(NSTimer*)timer
{
editHoldTimer = nil;
NSArray *data = timer.userInfo;
LauncherButton *button = [data objectAtIndex:0];
UIEvent *event = [data objectAtIndex:1];
if (button.item.userData == nil) {
return;
}
[self beginEditing];
button.selected = NO;
button.highlighted = NO;
[self startDraggingButton:button withEvent:event];
}
- (void)buttonTouchedDown:(LauncherButton*)button withEvent:(UIEvent*)event
{
if (editing)
{
if (!dragButton)
{
[self startDraggingButton:button withEvent:event];
}
}
else
{
TI_INVALIDATE_TIMER(editHoldTimer);
if (editable) {
editHoldTimer = [NSTimer scheduledTimerWithTimeInterval:kLauncherViewEditHoldTimeInterval
target:self selector:@selector(editHoldTimer:)
userInfo:[NSArray arrayWithObjects:button,event,nil]
repeats:NO];
}
}
}
- (void)checkButtonOverflow:(NSInteger)pageIndex
{
NSMutableArray* buttonPage = [buttons objectAtIndex:pageIndex];
NSInteger maxButtonsPerPage = self.columnCount*self.rowCount;
if (buttonPage.count > maxButtonsPerPage)
{
BOOL isLastPage = pageIndex == [buttons count]-1;
NSMutableArray* itemsPage = [pages objectAtIndex:pageIndex];
NSMutableArray* nextButtonPage = nil;
NSMutableArray* nextItemsPage = nil;
if (isLastPage)
{
nextButtonPage = [NSMutableArray array];
[buttons addObject:nextButtonPage];
nextItemsPage = [NSMutableArray array];
[pages addObject:nextItemsPage];
}
else
{
nextButtonPage = [buttons objectAtIndex:pageIndex+1];
nextItemsPage = [pages objectAtIndex:pageIndex+1];
}
while (buttonPage.count > maxButtonsPerPage)
{
[nextButtonPage insertObject:[buttonPage lastObject] atIndex:0];
[buttonPage removeLastObject];
[nextItemsPage insertObject:[itemsPage lastObject] atIndex:0];
[itemsPage removeLastObject];
}
if (pageIndex+1 < [buttons count])
{
[self checkButtonOverflow:pageIndex+1];
}
}
}
- (void)updatePagerWithContentOffset:(CGPoint)contentOffset
{
CGFloat pageWidth = scrollView.frame.size.width;
pager.currentPage = floor((contentOffset.x - pageWidth / 2) / pageWidth) + 1;
}
- (void)springLoadTimer:(NSTimer*)timer
{
springLoadTimer = nil;
if ([(NSNumber*)timer.userInfo boolValue])
{
CGFloat newX = scrollView.contentOffset.x - scrollView.frame.size.width;
if (newX >= 0)
{
CGPoint offset = CGPointMake(newX, 0);
[scrollView setContentOffset:offset animated:YES];
[self updatePagerWithContentOffset:offset];
dragOrigin.x += scrollView.frame.size.width;
positionOrigin = -1;
springing = YES;
[self performSelector:@selector(springingDidStop) withObject:nil afterDelay:0.3];
}
}
else
{
CGFloat newX = scrollView.contentOffset.x + scrollView.frame.size.width;
if (newX <= scrollView.contentSize.width - scrollView.frame.size.width)
{
CGPoint offset = CGPointMake(newX, 0);
[scrollView setContentOffset:offset animated:YES];
[self updatePagerWithContentOffset:offset];
dragOrigin.x -= scrollView.frame.size.width;
positionOrigin = -1;
springing = YES;
[self performSelector:@selector(springingDidStop) withObject:nil afterDelay:0.3];
}
}
}
- (void)springingDidStop
{
springing = NO;
}
- (void)updateTouch
{
CGPoint origin = [dragTouch locationInView:scrollView];
dragButton.center = CGPointMake(dragOrigin.x + (origin.x - touchOrigin.x),
dragOrigin.y + (origin.y - touchOrigin.y));
CGFloat x = origin.x - scrollView.contentOffset.x;
NSInteger column = round(x/dragButton.frame.size.width);
NSInteger row = round(origin.y/dragButton.frame.size.height);
NSInteger itemIndex = (row * self.columnCount) + column;
NSInteger pageIndex = MAX(floor(scrollView.contentOffset.x/scrollView.frame.size.width),0);
if (itemIndex != positionOrigin)
{
NSMutableArray* currentButtonPage = [buttons objectAtIndex:pageIndex];
if (itemIndex > currentButtonPage.count)
{
itemIndex = currentButtonPage.count;
}
if (itemIndex != positionOrigin)
{
[[dragButton retain] autorelease];
NSMutableArray* itemPage = [self pageWithItem:dragButton.item];
NSMutableArray* buttonPage = [self pageWithButton:dragButton];
[itemPage removeObject:dragButton.item];
[buttonPage removeObject:dragButton];
if (itemIndex > currentButtonPage.count)
{
itemIndex = currentButtonPage.count;
}
BOOL didMove = itemIndex != positionOrigin;
NSMutableArray* currentItemPage = [pages objectAtIndex:pageIndex];
[currentItemPage insertObject:dragButton.item atIndex:itemIndex];
[currentButtonPage insertObject:dragButton atIndex:itemIndex];
positionOrigin = itemIndex;
[self checkButtonOverflow:pageIndex];
if (didMove)
{
if ([delegate respondsToSelector:@selector(launcherView:didMoveItem:)])
{
[delegate launcherView:self didMoveItem:dragButton.item];
}
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kLauncherViewTransitionDuration];
[self layoutButtons];
[UIView commitAnimations];
}
}
}
CGFloat springLoadDistance = dragButton.frame.size.width*kLauncherViewSpringLoadFraction;
BOOL goToPreviousPage = dragButton.center.x - springLoadDistance < 0;
BOOL goToNextPage = ((scrollView.frame.size.width - dragButton.center.x) - springLoadDistance) < 0;
if (goToPreviousPage || goToNextPage)
{
if (!springLoadTimer)
{
springLoadTimer = [NSTimer scheduledTimerWithTimeInterval:kLauncherViewSpringLoadTimeInterval
target:self selector:@selector(springLoadTimer:)
userInfo:[NSNumber numberWithBool:goToPreviousPage] repeats:NO];
}
}
else
{
TI_INVALIDATE_TIMER(springLoadTimer);
}
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
if (dragButton && !springing)
{
for (UITouch* touch in touches)
{
if (touch == dragTouch)
{
[self updateTouch];
break;
}
}
}
}
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
if (dragTouch)
{
for (UITouch* touch in touches)
{
if (touch == dragTouch)
{
dragTouch = nil;
if ([delegate respondsToSelector:@selector(launcherView:didDragItem:)]) {
[delegate launcherView:self didDragItem:dragButton.item];
}
break;
}
}
}
}
- (BOOL)editing
{
return editing;
}
- (void)pageChanged
{
scrollView.contentOffset = CGPointMake(pager.currentPage * scrollView.frame.size.width, 0);
}
- (void)scrollViewWillBeginDragging:(UIScrollView*)scrollView
{
TI_INVALIDATE_TIMER(editHoldTimer);
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView_
{
[self updatePagerWithContentOffset:scrollView.contentOffset];
}
@end
#endif | {
"content_hash": "1fc7b3b91457c05a69160963d5bea112",
"timestamp": "",
"source": "github",
"line_count": 941,
"max_line_length": 144,
"avg_line_length": 25.109458023379382,
"alnum_prop": 0.7173269002877941,
"repo_name": "philellwood/nclapp",
"id": "0c21a388d411621941d7fd0d1de250fe787fb86c",
"size": "23950",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build/iphone/Classes/LauncherView.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "131211"
},
{
"name": "C++",
"bytes": "63511"
},
{
"name": "D",
"bytes": "745190"
},
{
"name": "Java",
"bytes": "4120"
},
{
"name": "JavaScript",
"bytes": "54307"
},
{
"name": "Objective-C",
"bytes": "3252377"
},
{
"name": "Shell",
"bytes": "146"
}
],
"symlink_target": ""
} |
filenames: Implements UFO User Name to File Name Algorithm
##########################################################
.. automodule:: fontTools.misc.filenames
:members: userNameToFileName
:undoc-members:
| {
"content_hash": "835e616fb9f637df53f203b9d0e8c0b6",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 58,
"avg_line_length": 35.166666666666664,
"alnum_prop": 0.5592417061611374,
"repo_name": "fonttools/fonttools",
"id": "2ebef3535bae1654a5c807e8cbce06a3e76cbaea",
"size": "270",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "Doc/source/misc/filenames.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "3522"
},
{
"name": "Makefile",
"bytes": "352"
},
{
"name": "Python",
"bytes": "5442538"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MvcCore.Services
{
public interface ISmsSender
{
Task SendSmsAsync(string number, string message);
}
}
| {
"content_hash": "886b075cd68229d4bdc3fdf39f79f218",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 57,
"avg_line_length": 19.333333333333332,
"alnum_prop": 0.7327586206896551,
"repo_name": "haoyk/IdentityServer4.Samples",
"id": "2e1bba3fce28fdb7388916b9d50ef22550bdccab",
"size": "234",
"binary": false,
"copies": "1",
"ref": "refs/heads/release",
"path": "Clients/MvcCore/Services/ISmsSender.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "972270"
},
{
"name": "CSS",
"bytes": "21957"
},
{
"name": "HTML",
"bytes": "13453"
},
{
"name": "JavaScript",
"bytes": "8178987"
},
{
"name": "Shell",
"bytes": "268"
}
],
"symlink_target": ""
} |
package miner
import (
"errors"
"fmt"
"sync"
"time"
"github.com/NebulousLabs/Sia/build"
"github.com/NebulousLabs/Sia/crypto"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/persist"
siasync "github.com/NebulousLabs/Sia/sync"
"github.com/NebulousLabs/Sia/types"
)
var (
errNilCS = errors.New("miner cannot use a nil consensus set")
errNilTpool = errors.New("miner cannot use a nil transaction pool")
errNilWallet = errors.New("miner cannot use a nil wallet")
// HeaderMemory is the number of previous calls to 'header'
// that are remembered. Additionally, 'header' will only poll for a
// new block every 'headerMemory / blockMemory' times it is
// called. This reduces the amount of memory used, but comes at the cost of
// not always having the most recent transactions.
HeaderMemory = build.Select(build.Var{
Standard: 10000,
Dev: 500,
Testing: 50,
}).(int)
// BlockMemory is the maximum number of blocks the miner will store
// Blocks take up to 2 megabytes of memory, which is why this number is
// limited.
BlockMemory = build.Select(build.Var{
Standard: 50,
Dev: 10,
Testing: 5,
}).(int)
// MaxSourceBlockAge is the maximum amount of time that is allowed to
// elapse between generating source blocks.
MaxSourceBlockAge = build.Select(build.Var{
Standard: 30 * time.Second,
Dev: 5 * time.Second,
Testing: 1 * time.Second,
}).(time.Duration)
)
// splitSet defines a transaction set that can be added componenet-wise to a
// block. It's split because it doesn't necessarily represent the full set
// prpovided by the transaction pool. Splits can be sorted so that the largest
// and most valuable sets can be selected when picking transactions.
type splitSet struct {
averageFee types.Currency
size uint64
transactions []types.Transaction
}
type splitSetID int
// Miner struct contains all variables the miner needs
// in order to create and submit blocks.
type Miner struct {
// Module dependencies.
cs modules.ConsensusSet
tpool modules.TransactionPool
wallet modules.Wallet
// BlockManager variables. Becaues blocks are large, one block is used to
// make many headers which can be used by miners. Headers include an
// arbitrary data transaction (appended to the block) to make the merkle
// roots unique (preventing miners from doing redundant work). Every N
// requests or M seconds, a new block is used to create headers.
//
// Only 'blocksMemory' blocks are kept in memory at a time, which
// keeps ram usage reasonable. Miners may request many headers in parallel,
// and thus may be working on different blocks. When they submit the solved
// header to the block manager, the rest of the block needs to be found in
// a lookup.
blockMem map[types.BlockHeader]*types.Block // Mappings from headers to the blocks they are derived from.
arbDataMem map[types.BlockHeader][crypto.EntropySize]byte // Mappings from the headers to their unique arb data.
headerMem []types.BlockHeader // A circular list of headers that have been given out from the api recently.
sourceBlock *types.Block // The block from which new headers for mining are created.
sourceBlockTime time.Time // How long headers have been using the same block (different from 'recent block').
memProgress int // The index of the most recent header used in headerMem.
// Transaction pool variables.
fullSets map[modules.TransactionSetID][]int
blockMapHeap *mapHeap
overflowMapHeap *mapHeap
setCounter int
splitSets map[splitSetID]*splitSet
splitSetIDFromTxID map[types.TransactionID]splitSetID
unsolvedBlockIndex map[types.TransactionID]int
// CPUMiner variables.
miningOn bool // indicates if the miner is supposed to be running
mining bool // indicates if the miner is actually running
hashRate int64 // indicates hashes per second
// Utils
log *persist.Logger
mu sync.RWMutex
persist persistence
persistDir string
// tg signals the Miner's goroutines to shut down and blocks until all
// goroutines have exited before returning from Close().
tg siasync.ThreadGroup
}
// startupRescan will rescan the blockchain in the event that the miner
// persistence layer has become desynchronized from the consensus persistence
// layer. This might happen if a user replaces any of the folders with backups
// or deletes any of the folders.
func (m *Miner) startupRescan() error {
// Reset all of the variables that have relevance to the consensus set. The
// operations are wrapped by an anonymous function so that the locking can
// be handled using a defer statement.
err := func() error {
m.mu.Lock()
defer m.mu.Unlock()
m.log.Println("Performing a miner rescan.")
m.persist.RecentChange = modules.ConsensusChangeBeginning
m.persist.Height = 0
m.persist.Target = types.Target{}
return m.saveSync()
}()
if err != nil {
return err
}
// Subscribe to the consensus set. This is a blocking call that will not
// return until the miner has fully caught up to the current block.
err = m.cs.ConsensusSetSubscribe(m, modules.ConsensusChangeBeginning, m.tg.StopChan())
if err != nil {
return err
}
m.tg.OnStop(func() {
m.cs.Unsubscribe(m)
})
return nil
}
// New returns a ready-to-go miner that is not mining.
func New(cs modules.ConsensusSet, tpool modules.TransactionPool, w modules.Wallet, persistDir string) (*Miner, error) {
// Create the miner and its dependencies.
if cs == nil {
return nil, errNilCS
}
if tpool == nil {
return nil, errNilTpool
}
if w == nil {
return nil, errNilWallet
}
// Assemble the miner. The miner is assembled without an address because
// the wallet is likely not unlocked yet. The miner will grab an address
// after the miner is unlocked (this must be coded manually for each
// function that potentially requires the miner to have an address.
m := &Miner{
cs: cs,
tpool: tpool,
wallet: w,
blockMem: make(map[types.BlockHeader]*types.Block),
arbDataMem: make(map[types.BlockHeader][crypto.EntropySize]byte),
headerMem: make([]types.BlockHeader, HeaderMemory),
fullSets: make(map[modules.TransactionSetID][]int),
splitSets: make(map[splitSetID]*splitSet),
blockMapHeap: &mapHeap{
selectID: make(map[splitSetID]*mapElement),
data: nil,
minHeap: true,
},
overflowMapHeap: &mapHeap{
selectID: make(map[splitSetID]*mapElement),
data: nil,
minHeap: false,
},
splitSetIDFromTxID: make(map[types.TransactionID]splitSetID),
unsolvedBlockIndex: make(map[types.TransactionID]int),
persistDir: persistDir,
}
err := m.initPersist()
if err != nil {
return nil, errors.New("miner persistence startup failed: " + err.Error())
}
err = m.cs.ConsensusSetSubscribe(m, m.persist.RecentChange, m.tg.StopChan())
if err == modules.ErrInvalidConsensusChangeID {
// Perform a rescan of the consensus set if the change id is not found.
// The id will only be not found if there has been desynchronization
// between the miner and the consensus package.
err = m.startupRescan()
if err != nil {
return nil, errors.New("miner startup failed - rescanning failed: " + err.Error())
}
} else if err != nil {
return nil, errors.New("miner subscription failed: " + err.Error())
}
m.tg.OnStop(func() {
m.cs.Unsubscribe(m)
})
m.tpool.TransactionPoolSubscribe(m)
m.tg.OnStop(func() {
m.tpool.Unsubscribe(m)
})
// Save after synchronizing with consensus
err = m.saveSync()
if err != nil {
return nil, errors.New("miner could not save during startup: " + err.Error())
}
return m, nil
}
// Close terminates all ongoing processes involving the miner, enabling garbage
// collection.
func (m *Miner) Close() error {
if err := m.tg.Stop(); err != nil {
return err
}
m.mu.Lock()
defer m.mu.Unlock()
m.cs.Unsubscribe(m)
var errs []error
if err := m.saveSync(); err != nil {
errs = append(errs, fmt.Errorf("save failed: %v", err))
}
if err := m.log.Close(); err != nil {
errs = append(errs, fmt.Errorf("log.Close failed: %v", err))
}
return build.JoinErrors(errs, "; ")
}
// checkAddress checks that the miner has an address, fetching an address from
// the wallet if not.
func (m *Miner) checkAddress() error {
if m.persist.Address != (types.UnlockHash{}) {
return nil
}
uc, err := m.wallet.NextAddress()
if err != nil {
return err
}
m.persist.Address = uc.UnlockHash()
return nil
}
// BlocksMined returns the number of good blocks and stale blocks that have
// been mined by the miner.
func (m *Miner) BlocksMined() (goodBlocks, staleBlocks int) {
if err := m.tg.Add(); err != nil {
build.Critical(err)
}
defer m.tg.Done()
m.mu.Lock()
defer m.mu.Unlock()
for _, blockID := range m.persist.BlocksFound {
if m.cs.InCurrentPath(blockID) {
goodBlocks++
} else {
staleBlocks++
}
}
return
}
| {
"content_hash": "bff4eb016e17693344f9adcc18000ff1",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 147,
"avg_line_length": 32.2491103202847,
"alnum_prop": 0.7019421761200618,
"repo_name": "MrStrong/Sia",
"id": "2bfb4583ca66e26a2b93213fd145d7876e39349b",
"size": "9062",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/miner/miner.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "3014007"
},
{
"name": "Makefile",
"bytes": "4569"
},
{
"name": "Shell",
"bytes": "1373"
}
],
"symlink_target": ""
} |
package com.navigation.reactnative;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.annotations.ReactProp;
import java.util.Map;
import javax.annotation.Nonnull;
public class TabBarItemManager extends ViewGroupManager<TabBarItemView> {
@Nonnull
@Override
public String getName() {
return "NVTabBarItem";
}
@ReactProp(name = "title")
public void setTitle(TabBarItemView view, String title) {
view.setTitle(title);
}
@ReactProp(name = "fontFamily")
public void setFontFamily(TabBarItemView view, String fontFamily) {
view.setFontFamily(fontFamily);
}
@ReactProp(name = "fontWeight")
public void setFontWeight(TabBarItemView view, String fontWeight) {
view.setFontWeight(fontWeight);
}
@ReactProp(name = "fontStyle")
public void setFontStyle(TabBarItemView view, String fontStyle) {
view.setFontStyle(fontStyle);
}
@ReactProp(name = "fontSize")
public void setFontSize(TabBarItemView view, Integer fontSize) {
view.setFontSize(fontSize);
}
@ReactProp(name = "image")
public void setImage(TabBarItemView view, @Nullable ReadableMap icon) {
view.setIconSource(icon);
}
@ReactProp(name = "badge")
public void setBadge(TabBarItemView view, @Nullable String badge) {
view.setBadge(badge != null ? Integer.parseInt(badge) : null);
}
@ReactProp(name = "badgeColor", customType = "Color", defaultInt = Integer.MAX_VALUE)
public void setBadgeColor(TabBarItemView view, int badgeColor) {
view.setBadgeColor(badgeColor != Integer.MAX_VALUE ? badgeColor : null);
}
@ReactProp(name = "testID")
public void setTestID(TabBarItemView view, String testID) {
view.setTestID(testID);
}
@Override
protected void onAfterUpdateTransaction(@NonNull TabBarItemView view) {
super.onAfterUpdateTransaction(view);
view.styleTitle();
}
@Nonnull
@Override
protected TabBarItemView createViewInstance(@Nonnull ThemedReactContext reactContext) {
return new TabBarItemView(reactContext);
}
@Override
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
return MapBuilder.<String, Object>builder()
.put("topOnPress", MapBuilder.of("registrationName", "onPress"))
.build();
}
@Override
public int getChildCount(TabBarItemView parent) {
return parent.content.size();
}
@Override
public View getChildAt(TabBarItemView parent, int index) {
return parent.content.get(index);
}
@Override
public void addView(TabBarItemView parent, View child, int index) {
parent.content.add(index, child);
if (parent.changeListener != null) {
parent.changeListener.onChange(parent);
}
}
@Override
public void removeViewAt(TabBarItemView parent, int index) {
parent.content.remove(index);
}
}
| {
"content_hash": "f46aa3e3476842ef8ec475f6d37d7b6f",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 91,
"avg_line_length": 28.97345132743363,
"alnum_prop": 0.6908979841172878,
"repo_name": "grahammendick/navigation",
"id": "09ccbf4fb990bb7e40a593f6f16338e5638969fe",
"size": "3274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/TabBarItemManager.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "64353"
},
{
"name": "CMake",
"bytes": "1298"
},
{
"name": "HTML",
"bytes": "23406"
},
{
"name": "Java",
"bytes": "426800"
},
{
"name": "JavaScript",
"bytes": "1131984"
},
{
"name": "Makefile",
"bytes": "7523"
},
{
"name": "Objective-C",
"bytes": "95067"
},
{
"name": "Objective-C++",
"bytes": "119760"
},
{
"name": "Ruby",
"bytes": "7517"
},
{
"name": "Shell",
"bytes": "2410"
},
{
"name": "Starlark",
"bytes": "3010"
},
{
"name": "TypeScript",
"bytes": "1764682"
}
],
"symlink_target": ""
} |
#include <aws/appstream/model/DeleteDirectoryConfigResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::AppStream::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
DeleteDirectoryConfigResult::DeleteDirectoryConfigResult()
{
}
DeleteDirectoryConfigResult::DeleteDirectoryConfigResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
DeleteDirectoryConfigResult& DeleteDirectoryConfigResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
AWS_UNREFERENCED_PARAM(result);
return *this;
}
| {
"content_hash": "d9379123ca8e98c5fbf0f4dc31a8b133",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 122,
"avg_line_length": 24.64516129032258,
"alnum_prop": 0.7997382198952879,
"repo_name": "JoyIfBam5/aws-sdk-cpp",
"id": "6db8c2d292c135295d4a10b2c4c45ead9a7562d2",
"size": "1337",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-appstream/source/model/DeleteDirectoryConfigResult.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "11868"
},
{
"name": "C++",
"bytes": "167818064"
},
{
"name": "CMake",
"bytes": "591577"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "271801"
},
{
"name": "Python",
"bytes": "85650"
},
{
"name": "Shell",
"bytes": "5277"
}
],
"symlink_target": ""
} |
import argparse
import json
import os
import re
import urllib.request
_REPO_URL = 'https://dl.google.com/dl/android/maven2'
_GROUP_NAME = 'com/android/support'
_MODULE_NAME = 'cardview-v7'
_FILE_EXT = 'aar'
_OVERRIDE_LATEST = None
_PATCH_VERSION = 'cr1'
def do_latest():
if _OVERRIDE_LATEST is not None:
print(_OVERRIDE_LATEST + f'.{_PATCH_VERSION}')
return
maven_metadata_url = '{}/{}/{}/maven-metadata.xml'.format(
_REPO_URL, _GROUP_NAME, _MODULE_NAME)
metadata = urllib.request.urlopen(maven_metadata_url).read().decode(
'utf-8')
# Do not parse xml with the python included parser since it is susceptible
# to maliciously crafted xmls. Only use regular expression parsing to be
# safe. RE should be enough to handle what we need to extract.
match = re.search('<latest>([^<]+)</latest>', metadata)
if match:
latest = match.group(1)
else:
# if no latest info was found just hope the versions are sorted and the
# last one is the latest (as is commonly the case).
latest = re.findall('<version>([^<]+)</version>', metadata)[-1]
print(latest + f'.{_PATCH_VERSION}')
def get_download_url(version):
# Remove the patch version when getting the download url
version_no_patch, patch = version.rsplit('.', 1)
if patch.startswith('cr'):
version = version_no_patch
file_url = '{0}/{1}/{2}/{3}/{2}-{3}.{4}'.format(_REPO_URL, _GROUP_NAME,
_MODULE_NAME, version,
_FILE_EXT)
file_name = file_url.rsplit('/', 1)[-1]
partial_manifest = {
'url': [file_url],
'name': [file_name],
'ext': '.' + _FILE_EXT,
}
print(json.dumps(partial_manifest))
def main():
ap = argparse.ArgumentParser()
sub = ap.add_subparsers()
latest = sub.add_parser('latest')
latest.set_defaults(func=lambda _opts: do_latest())
download = sub.add_parser('get_url')
download.set_defaults(
func=lambda _opts: get_download_url(os.environ['_3PP_VERSION']))
opts = ap.parse_args()
opts.func(opts)
if __name__ == '__main__':
main()
| {
"content_hash": "41213d5af9247549d31a80d3498dc0a9",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 31.52857142857143,
"alnum_prop": 0.594019030357952,
"repo_name": "scheib/chromium",
"id": "7be954e2a54027924b05b8fc34ccb38fd3b78927",
"size": "2496",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "third_party/android_deps/libs/com_android_support_cardview_v7/3pp/fetch.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
namespace v8 {
namespace internal {
// This macro provides a platform independent use of sscanf. The reason for
// SScanF not being implemented in a platform independent way through
// ::v8::internal::OS in the same way as SNPrintF is that the
// Windows C Run-Time Library does not provide vsscanf.
#define SScanF sscanf // NOLINT
// The ArmDebugger class is used by the simulator while debugging simulated ARM
// code.
class ArmDebugger {
public:
explicit ArmDebugger(Simulator* sim) : sim_(sim) { }
~ArmDebugger();
void Stop(Instruction* instr);
void Debug();
private:
static const Instr kBreakpointInstr =
(al | (7*B25) | (1*B24) | kBreakpoint);
static const Instr kNopInstr = (al | (13*B21));
Simulator* sim_;
int32_t GetRegisterValue(int regnum);
double GetRegisterPairDoubleValue(int regnum);
double GetVFPDoubleRegisterValue(int regnum);
bool GetValue(const char* desc, int32_t* value);
bool GetVFPSingleValue(const char* desc, float* value);
bool GetVFPDoubleValue(const char* desc, double* value);
// Set or delete a breakpoint. Returns true if successful.
bool SetBreakpoint(Instruction* breakpc);
bool DeleteBreakpoint(Instruction* breakpc);
// Undo and redo all breakpoints. This is needed to bracket disassembly and
// execution to skip past breakpoints when run from the debugger.
void UndoBreakpoints();
void RedoBreakpoints();
};
ArmDebugger::~ArmDebugger() {
}
#ifdef GENERATED_CODE_COVERAGE
static FILE* coverage_log = NULL;
static void InitializeCoverage() {
char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG");
if (file_name != NULL) {
coverage_log = fopen(file_name, "aw+");
}
}
void ArmDebugger::Stop(Instruction* instr) {
// Get the stop code.
uint32_t code = instr->SvcValue() & kStopCodeMask;
// Retrieve the encoded address, which comes just after this stop.
char** msg_address =
reinterpret_cast<char**>(sim_->get_pc() + Instruction::kInstrSize);
char* msg = *msg_address;
ASSERT(msg != NULL);
// Update this stop description.
if (isWatchedStop(code) && !watched_stops[code].desc) {
watched_stops[code].desc = msg;
}
if (strlen(msg) > 0) {
if (coverage_log != NULL) {
fprintf(coverage_log, "%s\n", msg);
fflush(coverage_log);
}
// Overwrite the instruction and address with nops.
instr->SetInstructionBits(kNopInstr);
reinterpret_cast<Instruction*>(msg_address)->SetInstructionBits(kNopInstr);
}
sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstrSize);
}
#else // ndef GENERATED_CODE_COVERAGE
static void InitializeCoverage() {
}
void ArmDebugger::Stop(Instruction* instr) {
// Get the stop code.
uint32_t code = instr->SvcValue() & kStopCodeMask;
// Retrieve the encoded address, which comes just after this stop.
char* msg = *reinterpret_cast<char**>(sim_->get_pc()
+ Instruction::kInstrSize);
// Update this stop description.
if (sim_->isWatchedStop(code) && !sim_->watched_stops[code].desc) {
sim_->watched_stops[code].desc = msg;
}
// Print the stop message and code if it is not the default code.
if (code != kMaxStopCode) {
PrintF("Simulator hit stop %u: %s\n", code, msg);
} else {
PrintF("Simulator hit %s\n", msg);
}
sim_->set_pc(sim_->get_pc() + 2 * Instruction::kInstrSize);
Debug();
}
#endif
int32_t ArmDebugger::GetRegisterValue(int regnum) {
if (regnum == kPCRegister) {
return sim_->get_pc();
} else {
return sim_->get_register(regnum);
}
}
double ArmDebugger::GetRegisterPairDoubleValue(int regnum) {
return sim_->get_double_from_register_pair(regnum);
}
double ArmDebugger::GetVFPDoubleRegisterValue(int regnum) {
return sim_->get_double_from_d_register(regnum);
}
bool ArmDebugger::GetValue(const char* desc, int32_t* value) {
int regnum = Registers::Number(desc);
if (regnum != kNoRegister) {
*value = GetRegisterValue(regnum);
return true;
} else {
if (strncmp(desc, "0x", 2) == 0) {
return SScanF(desc + 2, "%x", reinterpret_cast<uint32_t*>(value)) == 1;
} else {
return SScanF(desc, "%u", reinterpret_cast<uint32_t*>(value)) == 1;
}
}
return false;
}
bool ArmDebugger::GetVFPSingleValue(const char* desc, float* value) {
bool is_double;
int regnum = VFPRegisters::Number(desc, &is_double);
if (regnum != kNoRegister && !is_double) {
*value = sim_->get_float_from_s_register(regnum);
return true;
}
return false;
}
bool ArmDebugger::GetVFPDoubleValue(const char* desc, double* value) {
bool is_double;
int regnum = VFPRegisters::Number(desc, &is_double);
if (regnum != kNoRegister && is_double) {
*value = sim_->get_double_from_d_register(regnum);
return true;
}
return false;
}
bool ArmDebugger::SetBreakpoint(Instruction* breakpc) {
// Check if a breakpoint can be set. If not return without any side-effects.
if (sim_->break_pc_ != NULL) {
return false;
}
// Set the breakpoint.
sim_->break_pc_ = breakpc;
sim_->break_instr_ = breakpc->InstructionBits();
// Not setting the breakpoint instruction in the code itself. It will be set
// when the debugger shell continues.
return true;
}
bool ArmDebugger::DeleteBreakpoint(Instruction* breakpc) {
if (sim_->break_pc_ != NULL) {
sim_->break_pc_->SetInstructionBits(sim_->break_instr_);
}
sim_->break_pc_ = NULL;
sim_->break_instr_ = 0;
return true;
}
void ArmDebugger::UndoBreakpoints() {
if (sim_->break_pc_ != NULL) {
sim_->break_pc_->SetInstructionBits(sim_->break_instr_);
}
}
void ArmDebugger::RedoBreakpoints() {
if (sim_->break_pc_ != NULL) {
sim_->break_pc_->SetInstructionBits(kBreakpointInstr);
}
}
void ArmDebugger::Debug() {
intptr_t last_pc = -1;
bool done = false;
#define COMMAND_SIZE 63
#define ARG_SIZE 255
#define STR(a) #a
#define XSTR(a) STR(a)
char cmd[COMMAND_SIZE + 1];
char arg1[ARG_SIZE + 1];
char arg2[ARG_SIZE + 1];
char* argv[3] = { cmd, arg1, arg2 };
// make sure to have a proper terminating character if reaching the limit
cmd[COMMAND_SIZE] = 0;
arg1[ARG_SIZE] = 0;
arg2[ARG_SIZE] = 0;
// Undo all set breakpoints while running in the debugger shell. This will
// make them invisible to all commands.
UndoBreakpoints();
while (!done) {
if (last_pc != sim_->get_pc()) {
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// use a reasonably large buffer
v8::internal::EmbeddedVector<char, 256> buffer;
dasm.InstructionDecode(buffer,
reinterpret_cast<byte*>(sim_->get_pc()));
PrintF(" 0x%08x %s\n", sim_->get_pc(), buffer.start());
last_pc = sim_->get_pc();
}
char* line = ReadLine("sim> ");
if (line == NULL) {
break;
} else {
char* last_input = sim_->last_debugger_input();
if (strcmp(line, "\n") == 0 && last_input != NULL) {
line = last_input;
} else {
// Ownership is transferred to sim_;
sim_->set_last_debugger_input(line);
}
// Use sscanf to parse the individual parts of the command line. At the
// moment no command expects more than two parameters.
int argc = SScanF(line,
"%" XSTR(COMMAND_SIZE) "s "
"%" XSTR(ARG_SIZE) "s "
"%" XSTR(ARG_SIZE) "s",
cmd, arg1, arg2);
if ((strcmp(cmd, "si") == 0) || (strcmp(cmd, "stepi") == 0)) {
sim_->InstructionDecode(reinterpret_cast<Instruction*>(sim_->get_pc()));
} else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) {
// Execute the one instruction we broke at with breakpoints disabled.
sim_->InstructionDecode(reinterpret_cast<Instruction*>(sim_->get_pc()));
// Leave the debugger shell.
done = true;
} else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) {
if (argc == 2 || (argc == 3 && strcmp(arg2, "fp") == 0)) {
int32_t value;
float svalue;
double dvalue;
if (strcmp(arg1, "all") == 0) {
for (int i = 0; i < kNumRegisters; i++) {
value = GetRegisterValue(i);
PrintF("%3s: 0x%08x %10d", Registers::Name(i), value, value);
if ((argc == 3 && strcmp(arg2, "fp") == 0) &&
i < 8 &&
(i % 2) == 0) {
dvalue = GetRegisterPairDoubleValue(i);
PrintF(" (%f)\n", dvalue);
} else {
PrintF("\n");
}
}
for (int i = 0; i < kNumVFPDoubleRegisters; i++) {
dvalue = GetVFPDoubleRegisterValue(i);
uint64_t as_words = BitCast<uint64_t>(dvalue);
PrintF("%3s: %f 0x%08x %08x\n",
VFPRegisters::Name(i, true),
dvalue,
static_cast<uint32_t>(as_words >> 32),
static_cast<uint32_t>(as_words & 0xffffffff));
}
} else {
if (GetValue(arg1, &value)) {
PrintF("%s: 0x%08x %d \n", arg1, value, value);
} else if (GetVFPSingleValue(arg1, &svalue)) {
uint32_t as_word = BitCast<uint32_t>(svalue);
PrintF("%s: %f 0x%08x\n", arg1, svalue, as_word);
} else if (GetVFPDoubleValue(arg1, &dvalue)) {
uint64_t as_words = BitCast<uint64_t>(dvalue);
PrintF("%s: %f 0x%08x %08x\n",
arg1,
dvalue,
static_cast<uint32_t>(as_words >> 32),
static_cast<uint32_t>(as_words & 0xffffffff));
} else {
PrintF("%s unrecognized\n", arg1);
}
}
} else {
PrintF("print <register>\n");
}
} else if ((strcmp(cmd, "po") == 0)
|| (strcmp(cmd, "printobject") == 0)) {
if (argc == 2) {
int32_t value;
if (GetValue(arg1, &value)) {
Object* obj = reinterpret_cast<Object*>(value);
PrintF("%s: \n", arg1);
#ifdef DEBUG
obj->PrintLn();
#else
obj->ShortPrint();
PrintF("\n");
#endif
} else {
PrintF("%s unrecognized\n", arg1);
}
} else {
PrintF("printobject <value>\n");
}
} else if (strcmp(cmd, "stack") == 0 || strcmp(cmd, "mem") == 0) {
int32_t* cur = NULL;
int32_t* end = NULL;
int next_arg = 1;
if (strcmp(cmd, "stack") == 0) {
cur = reinterpret_cast<int32_t*>(sim_->get_register(Simulator::sp));
} else { // "mem"
int32_t value;
if (!GetValue(arg1, &value)) {
PrintF("%s unrecognized\n", arg1);
continue;
}
cur = reinterpret_cast<int32_t*>(value);
next_arg++;
}
int32_t words;
if (argc == next_arg) {
words = 10;
} else if (argc == next_arg + 1) {
if (!GetValue(argv[next_arg], &words)) {
words = 10;
}
}
end = cur + words;
while (cur < end) {
PrintF(" 0x%08x: 0x%08x %10d",
reinterpret_cast<intptr_t>(cur), *cur, *cur);
HeapObject* obj = reinterpret_cast<HeapObject*>(*cur);
int value = *cur;
Heap* current_heap = v8::internal::Isolate::Current()->heap();
if (current_heap->Contains(obj) || ((value & 1) == 0)) {
PrintF(" (");
if ((value & 1) == 0) {
PrintF("smi %d", value / 2);
} else {
obj->ShortPrint();
}
PrintF(")");
}
PrintF("\n");
cur++;
}
} else if (strcmp(cmd, "disasm") == 0 || strcmp(cmd, "di") == 0) {
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// use a reasonably large buffer
v8::internal::EmbeddedVector<char, 256> buffer;
byte* prev = NULL;
byte* cur = NULL;
byte* end = NULL;
if (argc == 1) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
end = cur + (10 * Instruction::kInstrSize);
} else if (argc == 2) {
int regnum = Registers::Number(arg1);
if (regnum != kNoRegister || strncmp(arg1, "0x", 2) == 0) {
// The argument is an address or a register name.
int32_t value;
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(value);
// Disassemble 10 instructions at <arg1>.
end = cur + (10 * Instruction::kInstrSize);
}
} else {
// The argument is the number of instructions.
int32_t value;
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
// Disassemble <arg1> instructions.
end = cur + (value * Instruction::kInstrSize);
}
}
} else {
int32_t value1;
int32_t value2;
if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
cur = reinterpret_cast<byte*>(value1);
end = cur + (value2 * Instruction::kInstrSize);
}
}
while (cur < end) {
prev = cur;
cur += dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08x %s\n",
reinterpret_cast<intptr_t>(prev), buffer.start());
}
} else if (strcmp(cmd, "gdb") == 0) {
PrintF("relinquishing control to gdb\n");
v8::internal::OS::DebugBreak();
PrintF("regaining control from gdb\n");
} else if (strcmp(cmd, "break") == 0) {
if (argc == 2) {
int32_t value;
if (GetValue(arg1, &value)) {
if (!SetBreakpoint(reinterpret_cast<Instruction*>(value))) {
PrintF("setting breakpoint failed\n");
}
} else {
PrintF("%s unrecognized\n", arg1);
}
} else {
PrintF("break <address>\n");
}
} else if (strcmp(cmd, "del") == 0) {
if (!DeleteBreakpoint(NULL)) {
PrintF("deleting breakpoint failed\n");
}
} else if (strcmp(cmd, "flags") == 0) {
PrintF("N flag: %d; ", sim_->n_flag_);
PrintF("Z flag: %d; ", sim_->z_flag_);
PrintF("C flag: %d; ", sim_->c_flag_);
PrintF("V flag: %d\n", sim_->v_flag_);
PrintF("INVALID OP flag: %d; ", sim_->inv_op_vfp_flag_);
PrintF("DIV BY ZERO flag: %d; ", sim_->div_zero_vfp_flag_);
PrintF("OVERFLOW flag: %d; ", sim_->overflow_vfp_flag_);
PrintF("UNDERFLOW flag: %d; ", sim_->underflow_vfp_flag_);
PrintF("INEXACT flag: %d;\n", sim_->inexact_vfp_flag_);
} else if (strcmp(cmd, "stop") == 0) {
int32_t value;
intptr_t stop_pc = sim_->get_pc() - 2 * Instruction::kInstrSize;
Instruction* stop_instr = reinterpret_cast<Instruction*>(stop_pc);
Instruction* msg_address =
reinterpret_cast<Instruction*>(stop_pc + Instruction::kInstrSize);
if ((argc == 2) && (strcmp(arg1, "unstop") == 0)) {
// Remove the current stop.
if (sim_->isStopInstruction(stop_instr)) {
stop_instr->SetInstructionBits(kNopInstr);
msg_address->SetInstructionBits(kNopInstr);
} else {
PrintF("Not at debugger stop.\n");
}
} else if (argc == 3) {
// Print information about all/the specified breakpoint(s).
if (strcmp(arg1, "info") == 0) {
if (strcmp(arg2, "all") == 0) {
PrintF("Stop information:\n");
for (uint32_t i = 0; i < sim_->kNumOfWatchedStops; i++) {
sim_->PrintStopInfo(i);
}
} else if (GetValue(arg2, &value)) {
sim_->PrintStopInfo(value);
} else {
PrintF("Unrecognized argument.\n");
}
} else if (strcmp(arg1, "enable") == 0) {
// Enable all/the specified breakpoint(s).
if (strcmp(arg2, "all") == 0) {
for (uint32_t i = 0; i < sim_->kNumOfWatchedStops; i++) {
sim_->EnableStop(i);
}
} else if (GetValue(arg2, &value)) {
sim_->EnableStop(value);
} else {
PrintF("Unrecognized argument.\n");
}
} else if (strcmp(arg1, "disable") == 0) {
// Disable all/the specified breakpoint(s).
if (strcmp(arg2, "all") == 0) {
for (uint32_t i = 0; i < sim_->kNumOfWatchedStops; i++) {
sim_->DisableStop(i);
}
} else if (GetValue(arg2, &value)) {
sim_->DisableStop(value);
} else {
PrintF("Unrecognized argument.\n");
}
}
} else {
PrintF("Wrong usage. Use help command for more information.\n");
}
} else if ((strcmp(cmd, "t") == 0) || strcmp(cmd, "trace") == 0) {
::v8::internal::FLAG_trace_sim = !::v8::internal::FLAG_trace_sim;
PrintF("Trace of executed instructions is %s\n",
::v8::internal::FLAG_trace_sim ? "on" : "off");
} else if ((strcmp(cmd, "h") == 0) || (strcmp(cmd, "help") == 0)) {
PrintF("cont\n");
PrintF(" continue execution (alias 'c')\n");
PrintF("stepi\n");
PrintF(" step one instruction (alias 'si')\n");
PrintF("print <register>\n");
PrintF(" print register content (alias 'p')\n");
PrintF(" use register name 'all' to print all registers\n");
PrintF(" add argument 'fp' to print register pair double values\n");
PrintF("printobject <register>\n");
PrintF(" print an object from a register (alias 'po')\n");
PrintF("flags\n");
PrintF(" print flags\n");
PrintF("stack [<words>]\n");
PrintF(" dump stack content, default dump 10 words)\n");
PrintF("mem <address> [<words>]\n");
PrintF(" dump memory content, default dump 10 words)\n");
PrintF("disasm [<instructions>]\n");
PrintF("disasm [<address/register>]\n");
PrintF("disasm [[<address/register>] <instructions>]\n");
PrintF(" disassemble code, default is 10 instructions\n");
PrintF(" from pc (alias 'di')\n");
PrintF("gdb\n");
PrintF(" enter gdb\n");
PrintF("break <address>\n");
PrintF(" set a break point on the address\n");
PrintF("del\n");
PrintF(" delete the breakpoint\n");
PrintF("trace (alias 't')\n");
PrintF(" toogle the tracing of all executed statements\n");
PrintF("stop feature:\n");
PrintF(" Description:\n");
PrintF(" Stops are debug instructions inserted by\n");
PrintF(" the Assembler::stop() function.\n");
PrintF(" When hitting a stop, the Simulator will\n");
PrintF(" stop and and give control to the ArmDebugger.\n");
PrintF(" The first %d stop codes are watched:\n",
Simulator::kNumOfWatchedStops);
PrintF(" - They can be enabled / disabled: the Simulator\n");
PrintF(" will / won't stop when hitting them.\n");
PrintF(" - The Simulator keeps track of how many times they \n");
PrintF(" are met. (See the info command.) Going over a\n");
PrintF(" disabled stop still increases its counter. \n");
PrintF(" Commands:\n");
PrintF(" stop info all/<code> : print infos about number <code>\n");
PrintF(" or all stop(s).\n");
PrintF(" stop enable/disable all/<code> : enables / disables\n");
PrintF(" all or number <code> stop(s)\n");
PrintF(" stop unstop\n");
PrintF(" ignore the stop instruction at the current location\n");
PrintF(" from now on\n");
} else {
PrintF("Unknown command: %s\n", cmd);
}
}
}
// Add all the breakpoints back to stop execution and enter the debugger
// shell when hit.
RedoBreakpoints();
#undef COMMAND_SIZE
#undef ARG_SIZE
#undef STR
#undef XSTR
}
static bool ICacheMatch(void* one, void* two) {
ASSERT((reinterpret_cast<intptr_t>(one) & CachePage::kPageMask) == 0);
ASSERT((reinterpret_cast<intptr_t>(two) & CachePage::kPageMask) == 0);
return one == two;
}
static uint32_t ICacheHash(void* key) {
return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)) >> 2;
}
static bool AllOnOnePage(uintptr_t start, int size) {
intptr_t start_page = (start & ~CachePage::kPageMask);
intptr_t end_page = ((start + size) & ~CachePage::kPageMask);
return start_page == end_page;
}
void Simulator::set_last_debugger_input(char* input) {
DeleteArray(last_debugger_input_);
last_debugger_input_ = input;
}
void Simulator::FlushICache(v8::internal::HashMap* i_cache,
void* start_addr,
size_t size) {
intptr_t start = reinterpret_cast<intptr_t>(start_addr);
int intra_line = (start & CachePage::kLineMask);
start -= intra_line;
size += intra_line;
size = ((size - 1) | CachePage::kLineMask) + 1;
int offset = (start & CachePage::kPageMask);
while (!AllOnOnePage(start, size - 1)) {
int bytes_to_flush = CachePage::kPageSize - offset;
FlushOnePage(i_cache, start, bytes_to_flush);
start += bytes_to_flush;
size -= bytes_to_flush;
ASSERT_EQ(0, start & CachePage::kPageMask);
offset = 0;
}
if (size != 0) {
FlushOnePage(i_cache, start, size);
}
}
CachePage* Simulator::GetCachePage(v8::internal::HashMap* i_cache, void* page) {
v8::internal::HashMap::Entry* entry = i_cache->Lookup(page,
ICacheHash(page),
true);
if (entry->value == NULL) {
CachePage* new_page = new CachePage();
entry->value = new_page;
}
return reinterpret_cast<CachePage*>(entry->value);
}
// Flush from start up to and not including start + size.
void Simulator::FlushOnePage(v8::internal::HashMap* i_cache,
intptr_t start,
int size) {
ASSERT(size <= CachePage::kPageSize);
ASSERT(AllOnOnePage(start, size - 1));
ASSERT((start & CachePage::kLineMask) == 0);
ASSERT((size & CachePage::kLineMask) == 0);
void* page = reinterpret_cast<void*>(start & (~CachePage::kPageMask));
int offset = (start & CachePage::kPageMask);
CachePage* cache_page = GetCachePage(i_cache, page);
char* valid_bytemap = cache_page->ValidityByte(offset);
memset(valid_bytemap, CachePage::LINE_INVALID, size >> CachePage::kLineShift);
}
void Simulator::CheckICache(v8::internal::HashMap* i_cache,
Instruction* instr) {
intptr_t address = reinterpret_cast<intptr_t>(instr);
void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask));
void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask));
int offset = (address & CachePage::kPageMask);
CachePage* cache_page = GetCachePage(i_cache, page);
char* cache_valid_byte = cache_page->ValidityByte(offset);
bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID);
char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask);
if (cache_hit) {
// Check that the data in memory matches the contents of the I-cache.
CHECK(memcmp(reinterpret_cast<void*>(instr),
cache_page->CachedData(offset),
Instruction::kInstrSize) == 0);
} else {
// Cache miss. Load memory into the cache.
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
void Simulator::Initialize(Isolate* isolate) {
if (isolate->simulator_initialized()) return;
isolate->set_simulator_initialized(true);
::v8::internal::ExternalReference::set_redirector(isolate,
&RedirectExternalReference);
}
Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
i_cache_ = isolate_->simulator_i_cache();
if (i_cache_ == NULL) {
i_cache_ = new v8::internal::HashMap(&ICacheMatch);
isolate_->set_simulator_i_cache(i_cache_);
}
Initialize(isolate);
// Set up simulator support first. Some of this information is needed to
// setup the architecture state.
size_t stack_size = 1 * 1024*1024; // allocate 1MB for stack
stack_ = reinterpret_cast<char*>(malloc(stack_size));
pc_modified_ = false;
icount_ = 0;
break_pc_ = NULL;
break_instr_ = 0;
// Set up architecture state.
// All registers are initialized to zero to start with.
for (int i = 0; i < num_registers; i++) {
registers_[i] = 0;
}
n_flag_ = false;
z_flag_ = false;
c_flag_ = false;
v_flag_ = false;
// Initializing VFP registers.
// All registers are initialized to zero to start with
// even though s_registers_ & d_registers_ share the same
// physical registers in the target.
for (int i = 0; i < num_s_registers; i++) {
vfp_register[i] = 0;
}
n_flag_FPSCR_ = false;
z_flag_FPSCR_ = false;
c_flag_FPSCR_ = false;
v_flag_FPSCR_ = false;
FPSCR_rounding_mode_ = RZ;
inv_op_vfp_flag_ = false;
div_zero_vfp_flag_ = false;
overflow_vfp_flag_ = false;
underflow_vfp_flag_ = false;
inexact_vfp_flag_ = false;
// The sp is initialized to point to the bottom (high address) of the
// allocated stack area. To be safe in potential stack underflows we leave
// some buffer below.
registers_[sp] = reinterpret_cast<int32_t>(stack_) + stack_size - 64;
// The lr and pc are initialized to a known bad value that will cause an
// access violation if the simulator ever tries to execute it.
registers_[pc] = bad_lr;
registers_[lr] = bad_lr;
InitializeCoverage();
last_debugger_input_ = NULL;
}
// When the generated code calls an external reference we need to catch that in
// the simulator. The external reference will be a function compiled for the
// host architecture. We need to call that function instead of trying to
// execute it with the simulator. We do that by redirecting the external
// reference to a svc (Supervisor Call) instruction that is handled by
// the simulator. We write the original destination of the jump just at a known
// offset from the svc instruction so the simulator knows what to call.
class Redirection {
public:
Redirection(void* external_function, ExternalReference::Type type)
: external_function_(external_function),
swi_instruction_(al | (0xf*B24) | kCallRtRedirected),
type_(type),
next_(NULL) {
Isolate* isolate = Isolate::Current();
next_ = isolate->simulator_redirection();
Simulator::current(isolate)->
FlushICache(isolate->simulator_i_cache(),
reinterpret_cast<void*>(&swi_instruction_),
Instruction::kInstrSize);
isolate->set_simulator_redirection(this);
}
void* address_of_swi_instruction() {
return reinterpret_cast<void*>(&swi_instruction_);
}
void* external_function() { return external_function_; }
ExternalReference::Type type() { return type_; }
static Redirection* Get(void* external_function,
ExternalReference::Type type) {
Isolate* isolate = Isolate::Current();
Redirection* current = isolate->simulator_redirection();
for (; current != NULL; current = current->next_) {
if (current->external_function_ == external_function) return current;
}
return new Redirection(external_function, type);
}
static Redirection* FromSwiInstruction(Instruction* swi_instruction) {
char* addr_of_swi = reinterpret_cast<char*>(swi_instruction);
char* addr_of_redirection =
addr_of_swi - OFFSET_OF(Redirection, swi_instruction_);
return reinterpret_cast<Redirection*>(addr_of_redirection);
}
private:
void* external_function_;
uint32_t swi_instruction_;
ExternalReference::Type type_;
Redirection* next_;
};
void* Simulator::RedirectExternalReference(void* external_function,
ExternalReference::Type type) {
Redirection* redirection = Redirection::Get(external_function, type);
return redirection->address_of_swi_instruction();
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {
v8::internal::Isolate::PerIsolateThreadData* isolate_data =
isolate->FindOrAllocatePerThreadDataForThisThread();
ASSERT(isolate_data != NULL);
Simulator* sim = isolate_data->simulator();
if (sim == NULL) {
// TODO(146): delete the simulator object when a thread/isolate goes away.
sim = new Simulator(isolate);
isolate_data->set_simulator(sim);
}
return sim;
}
// Sets the register in the architecture state. It will also deal with updating
// Simulator internal state for special registers such as PC.
void Simulator::set_register(int reg, int32_t value) {
ASSERT((reg >= 0) && (reg < num_registers));
if (reg == pc) {
pc_modified_ = true;
}
registers_[reg] = value;
}
// Get the register from the architecture state. This function does handle
// the special case of accessing the PC register.
int32_t Simulator::get_register(int reg) const {
ASSERT((reg >= 0) && (reg < num_registers));
// Stupid code added to avoid bug in GCC.
// See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43949
if (reg >= num_registers) return 0;
// End stupid code.
return registers_[reg] + ((reg == pc) ? Instruction::kPCReadOffset : 0);
}
double Simulator::get_double_from_register_pair(int reg) {
ASSERT((reg >= 0) && (reg < num_registers) && ((reg % 2) == 0));
double dm_val = 0.0;
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[2 * sizeof(vfp_register[0])];
memcpy(buffer, ®isters_[reg], 2 * sizeof(registers_[0]));
memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
return(dm_val);
}
void Simulator::set_dw_register(int dreg, const int* dbl) {
ASSERT((dreg >= 0) && (dreg < num_d_registers));
registers_[dreg] = dbl[0];
registers_[dreg + 1] = dbl[1];
}
// Raw access to the PC register.
void Simulator::set_pc(int32_t value) {
pc_modified_ = true;
registers_[pc] = value;
}
bool Simulator::has_bad_pc() const {
return ((registers_[pc] == bad_lr) || (registers_[pc] == end_sim_pc));
}
// Raw access to the PC register without the special adjustment when reading.
int32_t Simulator::get_pc() const {
return registers_[pc];
}
// Getting from and setting into VFP registers.
void Simulator::set_s_register(int sreg, unsigned int value) {
ASSERT((sreg >= 0) && (sreg < num_s_registers));
vfp_register[sreg] = value;
}
unsigned int Simulator::get_s_register(int sreg) const {
ASSERT((sreg >= 0) && (sreg < num_s_registers));
return vfp_register[sreg];
}
void Simulator::set_s_register_from_float(int sreg, const float flt) {
ASSERT((sreg >= 0) && (sreg < num_s_registers));
// Read the bits from the single precision floating point value
// into the unsigned integer element of vfp_register[] given by index=sreg.
char buffer[sizeof(vfp_register[0])];
memcpy(buffer, &flt, sizeof(vfp_register[0]));
memcpy(&vfp_register[sreg], buffer, sizeof(vfp_register[0]));
}
void Simulator::set_s_register_from_sinteger(int sreg, const int sint) {
ASSERT((sreg >= 0) && (sreg < num_s_registers));
// Read the bits from the integer value into the unsigned integer element of
// vfp_register[] given by index=sreg.
char buffer[sizeof(vfp_register[0])];
memcpy(buffer, &sint, sizeof(vfp_register[0]));
memcpy(&vfp_register[sreg], buffer, sizeof(vfp_register[0]));
}
void Simulator::set_d_register_from_double(int dreg, const double& dbl) {
ASSERT((dreg >= 0) && (dreg < num_d_registers));
// Read the bits from the double precision floating point value into the two
// consecutive unsigned integer elements of vfp_register[] given by index
// 2*sreg and 2*sreg+1.
char buffer[2 * sizeof(vfp_register[0])];
memcpy(buffer, &dbl, 2 * sizeof(vfp_register[0]));
memcpy(&vfp_register[dreg * 2], buffer, 2 * sizeof(vfp_register[0]));
}
float Simulator::get_float_from_s_register(int sreg) {
ASSERT((sreg >= 0) && (sreg < num_s_registers));
float sm_val = 0.0;
// Read the bits from the unsigned integer vfp_register[] array
// into the single precision floating point value and return it.
char buffer[sizeof(vfp_register[0])];
memcpy(buffer, &vfp_register[sreg], sizeof(vfp_register[0]));
memcpy(&sm_val, buffer, sizeof(vfp_register[0]));
return(sm_val);
}
int Simulator::get_sinteger_from_s_register(int sreg) {
ASSERT((sreg >= 0) && (sreg < num_s_registers));
int sm_val = 0;
// Read the bits from the unsigned integer vfp_register[] array
// into the single precision floating point value and return it.
char buffer[sizeof(vfp_register[0])];
memcpy(buffer, &vfp_register[sreg], sizeof(vfp_register[0]));
memcpy(&sm_val, buffer, sizeof(vfp_register[0]));
return(sm_val);
}
double Simulator::get_double_from_d_register(int dreg) {
ASSERT((dreg >= 0) && (dreg < num_d_registers));
double dm_val = 0.0;
// Read the bits from the unsigned integer vfp_register[] array
// into the double precision floating point value and return it.
char buffer[2 * sizeof(vfp_register[0])];
memcpy(buffer, &vfp_register[2 * dreg], 2 * sizeof(vfp_register[0]));
memcpy(&dm_val, buffer, 2 * sizeof(vfp_register[0]));
return(dm_val);
}
// For use in calls that take two double values, constructed either
// from r0-r3 or d0 and d1.
void Simulator::GetFpArgs(double* x, double* y) {
if (use_eabi_hardfloat()) {
*x = vfp_register[0];
*y = vfp_register[1];
} else {
// We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy.
char buffer[sizeof(*x)];
// Registers 0 and 1 -> x.
memcpy(buffer, registers_, sizeof(*x));
memcpy(x, buffer, sizeof(*x));
// Registers 2 and 3 -> y.
memcpy(buffer, registers_ + 2, sizeof(*y));
memcpy(y, buffer, sizeof(*y));
}
}
// For use in calls that take one double value, constructed either
// from r0 and r1 or d0.
void Simulator::GetFpArgs(double* x) {
if (use_eabi_hardfloat()) {
*x = vfp_register[0];
} else {
// We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy.
char buffer[sizeof(*x)];
// Registers 0 and 1 -> x.
memcpy(buffer, registers_, sizeof(*x));
memcpy(x, buffer, sizeof(*x));
}
}
// For use in calls that take one double value constructed either
// from r0 and r1 or d0 and one integer value.
void Simulator::GetFpArgs(double* x, int32_t* y) {
if (use_eabi_hardfloat()) {
*x = vfp_register[0];
*y = registers_[1];
} else {
// We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy.
char buffer[sizeof(*x)];
// Registers 0 and 1 -> x.
memcpy(buffer, registers_, sizeof(*x));
memcpy(x, buffer, sizeof(*x));
// Register 2 -> y.
memcpy(buffer, registers_ + 2, sizeof(*y));
memcpy(y, buffer, sizeof(*y));
}
}
// The return value is either in r0/r1 or d0.
void Simulator::SetFpResult(const double& result) {
if (use_eabi_hardfloat()) {
char buffer[2 * sizeof(vfp_register[0])];
memcpy(buffer, &result, sizeof(buffer));
// Copy result to d0.
memcpy(vfp_register, buffer, sizeof(buffer));
} else {
char buffer[2 * sizeof(registers_[0])];
memcpy(buffer, &result, sizeof(buffer));
// Copy result to r0 and r1.
memcpy(registers_, buffer, sizeof(buffer));
}
}
void Simulator::TrashCallerSaveRegisters() {
// We don't trash the registers with the return value.
registers_[2] = 0x50Bad4U;
registers_[3] = 0x50Bad4U;
registers_[12] = 0x50Bad4U;
}
// Some Operating Systems allow unaligned access on ARMv7 targets. We
// assume that unaligned accesses are not allowed unless the v8 build system
// defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero.
// The following statements below describes the behavior of the ARM CPUs
// that don't support unaligned access.
// Some ARM platforms raise an interrupt on detecting unaligned access.
// On others it does a funky rotation thing. For now we
// simply disallow unaligned reads. Note that simulator runs have the runtime
// system running directly on the host system and only generated code is
// executed in the simulator. Since the host is typically IA32 we will not
// get the correct ARM-like behaviour on unaligned accesses for those ARM
// targets that don't support unaligned loads and stores.
int Simulator::ReadW(int32_t addr, Instruction* instr) {
#if V8_TARGET_CAN_READ_UNALIGNED
intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
return *ptr;
#else
if ((addr & 3) == 0) {
intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
return *ptr;
}
PrintF("Unaligned read at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
addr,
reinterpret_cast<intptr_t>(instr));
UNIMPLEMENTED();
return 0;
#endif
}
void Simulator::WriteW(int32_t addr, int value, Instruction* instr) {
#if V8_TARGET_CAN_READ_UNALIGNED
intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
*ptr = value;
return;
#else
if ((addr & 3) == 0) {
intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
addr,
reinterpret_cast<intptr_t>(instr));
UNIMPLEMENTED();
#endif
}
uint16_t Simulator::ReadHU(int32_t addr, Instruction* instr) {
#if V8_TARGET_CAN_READ_UNALIGNED
uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
return *ptr;
#else
if ((addr & 1) == 0) {
uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
return *ptr;
}
PrintF("Unaligned unsigned halfword read at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
addr,
reinterpret_cast<intptr_t>(instr));
UNIMPLEMENTED();
return 0;
#endif
}
int16_t Simulator::ReadH(int32_t addr, Instruction* instr) {
#if V8_TARGET_CAN_READ_UNALIGNED
int16_t* ptr = reinterpret_cast<int16_t*>(addr);
return *ptr;
#else
if ((addr & 1) == 0) {
int16_t* ptr = reinterpret_cast<int16_t*>(addr);
return *ptr;
}
PrintF("Unaligned signed halfword read at 0x%08x\n", addr);
UNIMPLEMENTED();
return 0;
#endif
}
void Simulator::WriteH(int32_t addr, uint16_t value, Instruction* instr) {
#if V8_TARGET_CAN_READ_UNALIGNED
uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
*ptr = value;
return;
#else
if ((addr & 1) == 0) {
uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned unsigned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
addr,
reinterpret_cast<intptr_t>(instr));
UNIMPLEMENTED();
#endif
}
void Simulator::WriteH(int32_t addr, int16_t value, Instruction* instr) {
#if V8_TARGET_CAN_READ_UNALIGNED
int16_t* ptr = reinterpret_cast<int16_t*>(addr);
*ptr = value;
return;
#else
if ((addr & 1) == 0) {
int16_t* ptr = reinterpret_cast<int16_t*>(addr);
*ptr = value;
return;
}
PrintF("Unaligned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
addr,
reinterpret_cast<intptr_t>(instr));
UNIMPLEMENTED();
#endif
}
uint8_t Simulator::ReadBU(int32_t addr) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
return *ptr;
}
int8_t Simulator::ReadB(int32_t addr) {
int8_t* ptr = reinterpret_cast<int8_t*>(addr);
return *ptr;
}
void Simulator::WriteB(int32_t addr, uint8_t value) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
*ptr = value;
}
void Simulator::WriteB(int32_t addr, int8_t value) {
int8_t* ptr = reinterpret_cast<int8_t*>(addr);
*ptr = value;
}
int32_t* Simulator::ReadDW(int32_t addr) {
#if V8_TARGET_CAN_READ_UNALIGNED
int32_t* ptr = reinterpret_cast<int32_t*>(addr);
return ptr;
#else
if ((addr & 3) == 0) {
int32_t* ptr = reinterpret_cast<int32_t*>(addr);
return ptr;
}
PrintF("Unaligned read at 0x%08x\n", addr);
UNIMPLEMENTED();
return 0;
#endif
}
void Simulator::WriteDW(int32_t addr, int32_t value1, int32_t value2) {
#if V8_TARGET_CAN_READ_UNALIGNED
int32_t* ptr = reinterpret_cast<int32_t*>(addr);
*ptr++ = value1;
*ptr = value2;
return;
#else
if ((addr & 3) == 0) {
int32_t* ptr = reinterpret_cast<int32_t*>(addr);
*ptr++ = value1;
*ptr = value2;
return;
}
PrintF("Unaligned write at 0x%08x\n", addr);
UNIMPLEMENTED();
#endif
}
// Returns the limit of the stack area to enable checking for stack overflows.
uintptr_t Simulator::StackLimit() const {
// Leave a safety margin of 1024 bytes to prevent overrunning the stack when
// pushing values.
return reinterpret_cast<uintptr_t>(stack_) + 1024;
}
// Unsupported instructions use Format to print an error and stop execution.
void Simulator::Format(Instruction* instr, const char* format) {
PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n",
reinterpret_cast<intptr_t>(instr), format);
UNIMPLEMENTED();
}
// Checks if the current instruction should be executed based on its
// condition bits.
bool Simulator::ConditionallyExecute(Instruction* instr) {
switch (instr->ConditionField()) {
case eq: return z_flag_;
case ne: return !z_flag_;
case cs: return c_flag_;
case cc: return !c_flag_;
case mi: return n_flag_;
case pl: return !n_flag_;
case vs: return v_flag_;
case vc: return !v_flag_;
case hi: return c_flag_ && !z_flag_;
case ls: return !c_flag_ || z_flag_;
case ge: return n_flag_ == v_flag_;
case lt: return n_flag_ != v_flag_;
case gt: return !z_flag_ && (n_flag_ == v_flag_);
case le: return z_flag_ || (n_flag_ != v_flag_);
case al: return true;
default: UNREACHABLE();
}
return false;
}
// Calculate and set the Negative and Zero flags.
void Simulator::SetNZFlags(int32_t val) {
n_flag_ = (val < 0);
z_flag_ = (val == 0);
}
// Set the Carry flag.
void Simulator::SetCFlag(bool val) {
c_flag_ = val;
}
// Set the oVerflow flag.
void Simulator::SetVFlag(bool val) {
v_flag_ = val;
}
// Calculate C flag value for additions.
bool Simulator::CarryFrom(int32_t left, int32_t right, int32_t carry) {
uint32_t uleft = static_cast<uint32_t>(left);
uint32_t uright = static_cast<uint32_t>(right);
uint32_t urest = 0xffffffffU - uleft;
return (uright > urest) ||
(carry && (((uright + 1) > urest) || (uright > (urest - 1))));
}
// Calculate C flag value for subtractions.
bool Simulator::BorrowFrom(int32_t left, int32_t right) {
uint32_t uleft = static_cast<uint32_t>(left);
uint32_t uright = static_cast<uint32_t>(right);
return (uright > uleft);
}
// Calculate V flag value for additions and subtractions.
bool Simulator::OverflowFrom(int32_t alu_out,
int32_t left, int32_t right, bool addition) {
bool overflow;
if (addition) {
// operands have the same sign
overflow = ((left >= 0 && right >= 0) || (left < 0 && right < 0))
// and operands and result have different sign
&& ((left < 0 && alu_out >= 0) || (left >= 0 && alu_out < 0));
} else {
// operands have different signs
overflow = ((left < 0 && right >= 0) || (left >= 0 && right < 0))
// and first operand and result have different signs
&& ((left < 0 && alu_out >= 0) || (left >= 0 && alu_out < 0));
}
return overflow;
}
// Support for VFP comparisons.
void Simulator::Compute_FPSCR_Flags(double val1, double val2) {
if (isnan(val1) || isnan(val2)) {
n_flag_FPSCR_ = false;
z_flag_FPSCR_ = false;
c_flag_FPSCR_ = true;
v_flag_FPSCR_ = true;
// All non-NaN cases.
} else if (val1 == val2) {
n_flag_FPSCR_ = false;
z_flag_FPSCR_ = true;
c_flag_FPSCR_ = true;
v_flag_FPSCR_ = false;
} else if (val1 < val2) {
n_flag_FPSCR_ = true;
z_flag_FPSCR_ = false;
c_flag_FPSCR_ = false;
v_flag_FPSCR_ = false;
} else {
// Case when (val1 > val2).
n_flag_FPSCR_ = false;
z_flag_FPSCR_ = false;
c_flag_FPSCR_ = true;
v_flag_FPSCR_ = false;
}
}
void Simulator::Copy_FPSCR_to_APSR() {
n_flag_ = n_flag_FPSCR_;
z_flag_ = z_flag_FPSCR_;
c_flag_ = c_flag_FPSCR_;
v_flag_ = v_flag_FPSCR_;
}
// Addressing Mode 1 - Data-processing operands:
// Get the value based on the shifter_operand with register.
int32_t Simulator::GetShiftRm(Instruction* instr, bool* carry_out) {
ShiftOp shift = instr->ShiftField();
int shift_amount = instr->ShiftAmountValue();
int32_t result = get_register(instr->RmValue());
if (instr->Bit(4) == 0) {
// by immediate
if ((shift == ROR) && (shift_amount == 0)) {
UNIMPLEMENTED();
return result;
} else if (((shift == LSR) || (shift == ASR)) && (shift_amount == 0)) {
shift_amount = 32;
}
switch (shift) {
case ASR: {
if (shift_amount == 0) {
if (result < 0) {
result = 0xffffffff;
*carry_out = true;
} else {
result = 0;
*carry_out = false;
}
} else {
result >>= (shift_amount - 1);
*carry_out = (result & 1) == 1;
result >>= 1;
}
break;
}
case LSL: {
if (shift_amount == 0) {
*carry_out = c_flag_;
} else {
result <<= (shift_amount - 1);
*carry_out = (result < 0);
result <<= 1;
}
break;
}
case LSR: {
if (shift_amount == 0) {
result = 0;
*carry_out = c_flag_;
} else {
uint32_t uresult = static_cast<uint32_t>(result);
uresult >>= (shift_amount - 1);
*carry_out = (uresult & 1) == 1;
uresult >>= 1;
result = static_cast<int32_t>(uresult);
}
break;
}
case ROR: {
UNIMPLEMENTED();
break;
}
default: {
UNREACHABLE();
break;
}
}
} else {
// by register
int rs = instr->RsValue();
shift_amount = get_register(rs) &0xff;
switch (shift) {
case ASR: {
if (shift_amount == 0) {
*carry_out = c_flag_;
} else if (shift_amount < 32) {
result >>= (shift_amount - 1);
*carry_out = (result & 1) == 1;
result >>= 1;
} else {
ASSERT(shift_amount >= 32);
if (result < 0) {
*carry_out = true;
result = 0xffffffff;
} else {
*carry_out = false;
result = 0;
}
}
break;
}
case LSL: {
if (shift_amount == 0) {
*carry_out = c_flag_;
} else if (shift_amount < 32) {
result <<= (shift_amount - 1);
*carry_out = (result < 0);
result <<= 1;
} else if (shift_amount == 32) {
*carry_out = (result & 1) == 1;
result = 0;
} else {
ASSERT(shift_amount > 32);
*carry_out = false;
result = 0;
}
break;
}
case LSR: {
if (shift_amount == 0) {
*carry_out = c_flag_;
} else if (shift_amount < 32) {
uint32_t uresult = static_cast<uint32_t>(result);
uresult >>= (shift_amount - 1);
*carry_out = (uresult & 1) == 1;
uresult >>= 1;
result = static_cast<int32_t>(uresult);
} else if (shift_amount == 32) {
*carry_out = (result < 0);
result = 0;
} else {
*carry_out = false;
result = 0;
}
break;
}
case ROR: {
UNIMPLEMENTED();
break;
}
default: {
UNREACHABLE();
break;
}
}
}
return result;
}
// Addressing Mode 1 - Data-processing operands:
// Get the value based on the shifter_operand with immediate.
int32_t Simulator::GetImm(Instruction* instr, bool* carry_out) {
int rotate = instr->RotateValue() * 2;
int immed8 = instr->Immed8Value();
int imm = (immed8 >> rotate) | (immed8 << (32 - rotate));
*carry_out = (rotate == 0) ? c_flag_ : (imm < 0);
return imm;
}
static int count_bits(int bit_vector) {
int count = 0;
while (bit_vector != 0) {
if ((bit_vector & 1) != 0) {
count++;
}
bit_vector >>= 1;
}
return count;
}
void Simulator::ProcessPUW(Instruction* instr,
int num_regs,
int reg_size,
intptr_t* start_address,
intptr_t* end_address) {
int rn = instr->RnValue();
int32_t rn_val = get_register(rn);
switch (instr->PUField()) {
case da_x: {
UNIMPLEMENTED();
break;
}
case ia_x: {
*start_address = rn_val;
*end_address = rn_val + (num_regs * reg_size) - reg_size;
rn_val = rn_val + (num_regs * reg_size);
break;
}
case db_x: {
*start_address = rn_val - (num_regs * reg_size);
*end_address = rn_val - reg_size;
rn_val = *start_address;
break;
}
case ib_x: {
*start_address = rn_val + reg_size;
*end_address = rn_val + (num_regs * reg_size);
rn_val = *end_address;
break;
}
default: {
UNREACHABLE();
break;
}
}
if (instr->HasW()) {
set_register(rn, rn_val);
}
}
// Addressing Mode 4 - Load and Store Multiple
void Simulator::HandleRList(Instruction* instr, bool load) {
int rlist = instr->RlistValue();
int num_regs = count_bits(rlist);
intptr_t start_address = 0;
intptr_t end_address = 0;
ProcessPUW(instr, num_regs, kPointerSize, &start_address, &end_address);
intptr_t* address = reinterpret_cast<intptr_t*>(start_address);
// Catch null pointers a little earlier.
ASSERT(start_address > 8191 || start_address < 0);
int reg = 0;
while (rlist != 0) {
if ((rlist & 1) != 0) {
if (load) {
set_register(reg, *address);
} else {
*address = get_register(reg);
}
address += 1;
}
reg++;
rlist >>= 1;
}
ASSERT(end_address == ((intptr_t)address) - 4);
}
// Addressing Mode 6 - Load and Store Multiple Coprocessor registers.
void Simulator::HandleVList(Instruction* instr) {
VFPRegPrecision precision =
(instr->SzValue() == 0) ? kSinglePrecision : kDoublePrecision;
int operand_size = (precision == kSinglePrecision) ? 4 : 8;
bool load = (instr->VLValue() == 0x1);
int vd;
int num_regs;
vd = instr->VFPDRegValue(precision);
if (precision == kSinglePrecision) {
num_regs = instr->Immed8Value();
} else {
num_regs = instr->Immed8Value() / 2;
}
intptr_t start_address = 0;
intptr_t end_address = 0;
ProcessPUW(instr, num_regs, operand_size, &start_address, &end_address);
intptr_t* address = reinterpret_cast<intptr_t*>(start_address);
for (int reg = vd; reg < vd + num_regs; reg++) {
if (precision == kSinglePrecision) {
if (load) {
set_s_register_from_sinteger(
reg, ReadW(reinterpret_cast<int32_t>(address), instr));
} else {
WriteW(reinterpret_cast<int32_t>(address),
get_sinteger_from_s_register(reg), instr);
}
address += 1;
} else {
if (load) {
set_s_register_from_sinteger(
2 * reg, ReadW(reinterpret_cast<int32_t>(address), instr));
set_s_register_from_sinteger(
2 * reg + 1, ReadW(reinterpret_cast<int32_t>(address + 1), instr));
} else {
WriteW(reinterpret_cast<int32_t>(address),
get_sinteger_from_s_register(2 * reg), instr);
WriteW(reinterpret_cast<int32_t>(address + 1),
get_sinteger_from_s_register(2 * reg + 1), instr);
}
address += 2;
}
}
ASSERT(reinterpret_cast<intptr_t>(address) - operand_size == end_address);
}
// Calls into the V8 runtime are based on this very simple interface.
// Note: To be able to return two values from some calls the code in runtime.cc
// uses the ObjectPair which is essentially two 32-bit values stuffed into a
// 64-bit value. With the code below we assume that all runtime calls return
// 64 bits of result. If they don't, the r1 result register contains a bogus
// value, which is fine because it is caller-saved.
typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0,
int32_t arg1,
int32_t arg2,
int32_t arg3,
int32_t arg4,
int32_t arg5);
typedef double (*SimulatorRuntimeFPCall)(int32_t arg0,
int32_t arg1,
int32_t arg2,
int32_t arg3);
// This signature supports direct call in to API function native callback
// (refer to InvocationCallback in v8.h).
typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
// This signature supports direct call to accessor getter callback.
typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0,
int32_t arg1);
// Software interrupt instructions are used by the simulator to call into the
// C-based V8 runtime.
void Simulator::SoftwareInterrupt(Instruction* instr) {
int svc = instr->SvcValue();
switch (svc) {
case kCallRtRedirected: {
// Check if stack is aligned. Error if not aligned is reported below to
// include information on the function called.
bool stack_aligned =
(get_register(sp)
& (::v8::internal::FLAG_sim_stack_alignment - 1)) == 0;
Redirection* redirection = Redirection::FromSwiInstruction(instr);
int32_t arg0 = get_register(r0);
int32_t arg1 = get_register(r1);
int32_t arg2 = get_register(r2);
int32_t arg3 = get_register(r3);
int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp));
int32_t arg4 = stack_pointer[0];
int32_t arg5 = stack_pointer[1];
bool fp_call =
(redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_FP_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL);
if (use_eabi_hardfloat()) {
// With the hard floating point calling convention, double
// arguments are passed in VFP registers. Fetch the arguments
// from there and call the builtin using soft floating point
// convention.
switch (redirection->type()) {
case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_COMPARE_CALL:
arg0 = vfp_register[0];
arg1 = vfp_register[1];
arg2 = vfp_register[2];
arg3 = vfp_register[3];
break;
case ExternalReference::BUILTIN_FP_CALL:
arg0 = vfp_register[0];
arg1 = vfp_register[1];
break;
case ExternalReference::BUILTIN_FP_INT_CALL:
arg0 = vfp_register[0];
arg1 = vfp_register[1];
arg2 = get_register(0);
break;
default:
break;
}
}
// This is dodgy but it works because the C entry stubs are never moved.
// See comment in codegen-arm.cc and bug 1242173.
int32_t saved_lr = get_register(lr);
intptr_t external =
reinterpret_cast<intptr_t>(redirection->external_function());
if (fp_call) {
if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
SimulatorRuntimeFPCall target =
reinterpret_cast<SimulatorRuntimeFPCall>(external);
double dval0, dval1;
int32_t ival;
switch (redirection->type()) {
case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_COMPARE_CALL:
GetFpArgs(&dval0, &dval1);
PrintF("Call to host function at %p with args %f, %f",
FUNCTION_ADDR(target), dval0, dval1);
break;
case ExternalReference::BUILTIN_FP_CALL:
GetFpArgs(&dval0);
PrintF("Call to host function at %p with arg %f",
FUNCTION_ADDR(target), dval0);
break;
case ExternalReference::BUILTIN_FP_INT_CALL:
GetFpArgs(&dval0, &ival);
PrintF("Call to host function at %p with args %f, %d",
FUNCTION_ADDR(target), dval0, ival);
break;
default:
UNREACHABLE();
break;
}
if (!stack_aligned) {
PrintF(" with unaligned stack %08x\n", get_register(sp));
}
PrintF("\n");
}
CHECK(stack_aligned);
if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) {
SimulatorRuntimeFPCall target =
reinterpret_cast<SimulatorRuntimeFPCall>(external);
double result = target(arg0, arg1, arg2, arg3);
SetFpResult(result);
} else {
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5);
int32_t lo_res = static_cast<int32_t>(result);
int32_t hi_res = static_cast<int32_t>(result >> 32);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %08x\n", lo_res);
}
set_register(r0, lo_res);
set_register(r1, hi_res);
}
} else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
SimulatorRuntimeDirectApiCall target =
reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
PrintF("Call to host function at %p args %08x",
FUNCTION_ADDR(target), arg0);
if (!stack_aligned) {
PrintF(" with unaligned stack %08x\n", get_register(sp));
}
PrintF("\n");
}
CHECK(stack_aligned);
v8::Handle<v8::Value> result = target(arg0);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
}
set_register(r0, (int32_t) *result);
} else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
SimulatorRuntimeDirectGetterCall target =
reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
PrintF("Call to host function at %p args %08x %08x",
FUNCTION_ADDR(target), arg0, arg1);
if (!stack_aligned) {
PrintF(" with unaligned stack %08x\n", get_register(sp));
}
PrintF("\n");
}
CHECK(stack_aligned);
v8::Handle<v8::Value> result = target(arg0, arg1);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
}
set_register(r0, (int32_t) *result);
} else {
// builtin call.
ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL);
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
PrintF(
"Call to host function at %p"
"args %08x, %08x, %08x, %08x, %08x, %08x",
FUNCTION_ADDR(target),
arg0,
arg1,
arg2,
arg3,
arg4,
arg5);
if (!stack_aligned) {
PrintF(" with unaligned stack %08x\n", get_register(sp));
}
PrintF("\n");
}
CHECK(stack_aligned);
int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5);
int32_t lo_res = static_cast<int32_t>(result);
int32_t hi_res = static_cast<int32_t>(result >> 32);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %08x\n", lo_res);
}
set_register(r0, lo_res);
set_register(r1, hi_res);
}
set_register(lr, saved_lr);
set_pc(get_register(lr));
break;
}
case kBreakpoint: {
ArmDebugger dbg(this);
dbg.Debug();
break;
}
// stop uses all codes greater than 1 << 23.
default: {
if (svc >= (1 << 23)) {
uint32_t code = svc & kStopCodeMask;
if (isWatchedStop(code)) {
IncreaseStopCounter(code);
}
// Stop if it is enabled, otherwise go on jumping over the stop
// and the message address.
if (isEnabledStop(code)) {
ArmDebugger dbg(this);
dbg.Stop(instr);
} else {
set_pc(get_pc() + 2 * Instruction::kInstrSize);
}
} else {
// This is not a valid svc code.
UNREACHABLE();
break;
}
}
}
}
// Stop helper functions.
bool Simulator::isStopInstruction(Instruction* instr) {
return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode);
}
bool Simulator::isWatchedStop(uint32_t code) {
ASSERT(code <= kMaxStopCode);
return code < kNumOfWatchedStops;
}
bool Simulator::isEnabledStop(uint32_t code) {
ASSERT(code <= kMaxStopCode);
// Unwatched stops are always enabled.
return !isWatchedStop(code) ||
!(watched_stops[code].count & kStopDisabledBit);
}
void Simulator::EnableStop(uint32_t code) {
ASSERT(isWatchedStop(code));
if (!isEnabledStop(code)) {
watched_stops[code].count &= ~kStopDisabledBit;
}
}
void Simulator::DisableStop(uint32_t code) {
ASSERT(isWatchedStop(code));
if (isEnabledStop(code)) {
watched_stops[code].count |= kStopDisabledBit;
}
}
void Simulator::IncreaseStopCounter(uint32_t code) {
ASSERT(code <= kMaxStopCode);
ASSERT(isWatchedStop(code));
if ((watched_stops[code].count & ~(1 << 31)) == 0x7fffffff) {
PrintF("Stop counter for code %i has overflowed.\n"
"Enabling this code and reseting the counter to 0.\n", code);
watched_stops[code].count = 0;
EnableStop(code);
} else {
watched_stops[code].count++;
}
}
// Print a stop status.
void Simulator::PrintStopInfo(uint32_t code) {
ASSERT(code <= kMaxStopCode);
if (!isWatchedStop(code)) {
PrintF("Stop not watched.");
} else {
const char* state = isEnabledStop(code) ? "Enabled" : "Disabled";
int32_t count = watched_stops[code].count & ~kStopDisabledBit;
// Don't print the state of unused breakpoints.
if (count != 0) {
if (watched_stops[code].desc) {
PrintF("stop %i - 0x%x: \t%s, \tcounter = %i, \t%s\n",
code, code, state, count, watched_stops[code].desc);
} else {
PrintF("stop %i - 0x%x: \t%s, \tcounter = %i\n",
code, code, state, count);
}
}
}
}
// Handle execution based on instruction types.
// Instruction types 0 and 1 are both rolled into one function because they
// only differ in the handling of the shifter_operand.
void Simulator::DecodeType01(Instruction* instr) {
int type = instr->TypeValue();
if ((type == 0) && instr->IsSpecialType0()) {
// multiply instruction or extra loads and stores
if (instr->Bits(7, 4) == 9) {
if (instr->Bit(24) == 0) {
// Raw field decoding here. Multiply instructions have their Rd in
// funny places.
int rn = instr->RnValue();
int rm = instr->RmValue();
int rs = instr->RsValue();
int32_t rs_val = get_register(rs);
int32_t rm_val = get_register(rm);
if (instr->Bit(23) == 0) {
if (instr->Bit(21) == 0) {
// The MUL instruction description (A 4.1.33) refers to Rd as being
// the destination for the operation, but it confusingly uses the
// Rn field to encode it.
// Format(instr, "mul'cond's 'rn, 'rm, 'rs");
int rd = rn; // Remap the rn field to the Rd register.
int32_t alu_out = rm_val * rs_val;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
}
} else {
// The MLA instruction description (A 4.1.28) refers to the order
// of registers as "Rd, Rm, Rs, Rn". But confusingly it uses the
// Rn field to encode the Rd register and the Rd field to encode
// the Rn register.
Format(instr, "mla'cond's 'rn, 'rm, 'rs, 'rd");
}
} else {
// The signed/long multiply instructions use the terms RdHi and RdLo
// when referring to the target registers. They are mapped to the Rn
// and Rd fields as follows:
// RdLo == Rd
// RdHi == Rn (This is confusingly stored in variable rd here
// because the mul instruction from above uses the
// Rn field to encode the Rd register. Good luck figuring
// this out without reading the ARM instruction manual
// at a very detailed level.)
// Format(instr, "'um'al'cond's 'rd, 'rn, 'rs, 'rm");
int rd_hi = rn; // Remap the rn field to the RdHi register.
int rd_lo = instr->RdValue();
int32_t hi_res = 0;
int32_t lo_res = 0;
if (instr->Bit(22) == 1) {
int64_t left_op = static_cast<int32_t>(rm_val);
int64_t right_op = static_cast<int32_t>(rs_val);
uint64_t result = left_op * right_op;
hi_res = static_cast<int32_t>(result >> 32);
lo_res = static_cast<int32_t>(result & 0xffffffff);
} else {
// unsigned multiply
uint64_t left_op = static_cast<uint32_t>(rm_val);
uint64_t right_op = static_cast<uint32_t>(rs_val);
uint64_t result = left_op * right_op;
hi_res = static_cast<int32_t>(result >> 32);
lo_res = static_cast<int32_t>(result & 0xffffffff);
}
set_register(rd_lo, lo_res);
set_register(rd_hi, hi_res);
if (instr->HasS()) {
UNIMPLEMENTED();
}
}
} else {
UNIMPLEMENTED(); // Not used by V8.
}
} else {
// extra load/store instructions
int rd = instr->RdValue();
int rn = instr->RnValue();
int32_t rn_val = get_register(rn);
int32_t addr = 0;
if (instr->Bit(22) == 0) {
int rm = instr->RmValue();
int32_t rm_val = get_register(rm);
switch (instr->PUField()) {
case da_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm");
ASSERT(!instr->HasW());
addr = rn_val;
rn_val -= rm_val;
set_register(rn, rn_val);
break;
}
case ia_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn], +'rm");
ASSERT(!instr->HasW());
addr = rn_val;
rn_val += rm_val;
set_register(rn, rn_val);
break;
}
case db_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn, -'rm]'w");
rn_val -= rm_val;
addr = rn_val;
if (instr->HasW()) {
set_register(rn, rn_val);
}
break;
}
case ib_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn, +'rm]'w");
rn_val += rm_val;
addr = rn_val;
if (instr->HasW()) {
set_register(rn, rn_val);
}
break;
}
default: {
// The PU field is a 2-bit field.
UNREACHABLE();
break;
}
}
} else {
int32_t imm_val = (instr->ImmedHValue() << 4) | instr->ImmedLValue();
switch (instr->PUField()) {
case da_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn], #-'off8");
ASSERT(!instr->HasW());
addr = rn_val;
rn_val -= imm_val;
set_register(rn, rn_val);
break;
}
case ia_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn], #+'off8");
ASSERT(!instr->HasW());
addr = rn_val;
rn_val += imm_val;
set_register(rn, rn_val);
break;
}
case db_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn, #-'off8]'w");
rn_val -= imm_val;
addr = rn_val;
if (instr->HasW()) {
set_register(rn, rn_val);
}
break;
}
case ib_x: {
// Format(instr, "'memop'cond'sign'h 'rd, ['rn, #+'off8]'w");
rn_val += imm_val;
addr = rn_val;
if (instr->HasW()) {
set_register(rn, rn_val);
}
break;
}
default: {
// The PU field is a 2-bit field.
UNREACHABLE();
break;
}
}
}
if (((instr->Bits(7, 4) & 0xd) == 0xd) && (instr->Bit(20) == 0)) {
ASSERT((rd % 2) == 0);
if (instr->HasH()) {
// The strd instruction.
int32_t value1 = get_register(rd);
int32_t value2 = get_register(rd+1);
WriteDW(addr, value1, value2);
} else {
// The ldrd instruction.
int* rn_data = ReadDW(addr);
set_dw_register(rd, rn_data);
}
} else if (instr->HasH()) {
if (instr->HasSign()) {
if (instr->HasL()) {
int16_t val = ReadH(addr, instr);
set_register(rd, val);
} else {
int16_t val = get_register(rd);
WriteH(addr, val, instr);
}
} else {
if (instr->HasL()) {
uint16_t val = ReadHU(addr, instr);
set_register(rd, val);
} else {
uint16_t val = get_register(rd);
WriteH(addr, val, instr);
}
}
} else {
// signed byte loads
ASSERT(instr->HasSign());
ASSERT(instr->HasL());
int8_t val = ReadB(addr);
set_register(rd, val);
}
return;
}
} else if ((type == 0) && instr->IsMiscType0()) {
if (instr->Bits(22, 21) == 1) {
int rm = instr->RmValue();
switch (instr->BitField(7, 4)) {
case BX:
set_pc(get_register(rm));
break;
case BLX: {
uint32_t old_pc = get_pc();
set_pc(get_register(rm));
set_register(lr, old_pc + Instruction::kInstrSize);
break;
}
case BKPT: {
ArmDebugger dbg(this);
PrintF("Simulator hit BKPT.\n");
dbg.Debug();
break;
}
default:
UNIMPLEMENTED();
}
} else if (instr->Bits(22, 21) == 3) {
int rm = instr->RmValue();
int rd = instr->RdValue();
switch (instr->BitField(7, 4)) {
case CLZ: {
uint32_t bits = get_register(rm);
int leading_zeros = 0;
if (bits == 0) {
leading_zeros = 32;
} else {
while ((bits & 0x80000000u) == 0) {
bits <<= 1;
leading_zeros++;
}
}
set_register(rd, leading_zeros);
break;
}
default:
UNIMPLEMENTED();
}
} else {
PrintF("%08x\n", instr->InstructionBits());
UNIMPLEMENTED();
}
} else {
int rd = instr->RdValue();
int rn = instr->RnValue();
int32_t rn_val = get_register(rn);
int32_t shifter_operand = 0;
bool shifter_carry_out = 0;
if (type == 0) {
shifter_operand = GetShiftRm(instr, &shifter_carry_out);
} else {
ASSERT(instr->TypeValue() == 1);
shifter_operand = GetImm(instr, &shifter_carry_out);
}
int32_t alu_out;
switch (instr->OpcodeField()) {
case AND: {
// Format(instr, "and'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "and'cond's 'rd, 'rn, 'imm");
alu_out = rn_val & shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
}
break;
}
case EOR: {
// Format(instr, "eor'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "eor'cond's 'rd, 'rn, 'imm");
alu_out = rn_val ^ shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
}
break;
}
case SUB: {
// Format(instr, "sub'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "sub'cond's 'rd, 'rn, 'imm");
alu_out = rn_val - shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(!BorrowFrom(rn_val, shifter_operand));
SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, false));
}
break;
}
case RSB: {
// Format(instr, "rsb'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "rsb'cond's 'rd, 'rn, 'imm");
alu_out = shifter_operand - rn_val;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(!BorrowFrom(shifter_operand, rn_val));
SetVFlag(OverflowFrom(alu_out, shifter_operand, rn_val, false));
}
break;
}
case ADD: {
// Format(instr, "add'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "add'cond's 'rd, 'rn, 'imm");
alu_out = rn_val + shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(CarryFrom(rn_val, shifter_operand));
SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, true));
}
break;
}
case ADC: {
// Format(instr, "adc'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "adc'cond's 'rd, 'rn, 'imm");
alu_out = rn_val + shifter_operand + GetCarry();
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(CarryFrom(rn_val, shifter_operand, GetCarry()));
SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, true));
}
break;
}
case SBC: {
Format(instr, "sbc'cond's 'rd, 'rn, 'shift_rm");
Format(instr, "sbc'cond's 'rd, 'rn, 'imm");
break;
}
case RSC: {
Format(instr, "rsc'cond's 'rd, 'rn, 'shift_rm");
Format(instr, "rsc'cond's 'rd, 'rn, 'imm");
break;
}
case TST: {
if (instr->HasS()) {
// Format(instr, "tst'cond 'rn, 'shift_rm");
// Format(instr, "tst'cond 'rn, 'imm");
alu_out = rn_val & shifter_operand;
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
} else {
// Format(instr, "movw'cond 'rd, 'imm").
alu_out = instr->ImmedMovwMovtValue();
set_register(rd, alu_out);
}
break;
}
case TEQ: {
if (instr->HasS()) {
// Format(instr, "teq'cond 'rn, 'shift_rm");
// Format(instr, "teq'cond 'rn, 'imm");
alu_out = rn_val ^ shifter_operand;
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
} else {
// Other instructions matching this pattern are handled in the
// miscellaneous instructions part above.
UNREACHABLE();
}
break;
}
case CMP: {
if (instr->HasS()) {
// Format(instr, "cmp'cond 'rn, 'shift_rm");
// Format(instr, "cmp'cond 'rn, 'imm");
alu_out = rn_val - shifter_operand;
SetNZFlags(alu_out);
SetCFlag(!BorrowFrom(rn_val, shifter_operand));
SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, false));
} else {
// Format(instr, "movt'cond 'rd, 'imm").
alu_out = (get_register(rd) & 0xffff) |
(instr->ImmedMovwMovtValue() << 16);
set_register(rd, alu_out);
}
break;
}
case CMN: {
if (instr->HasS()) {
// Format(instr, "cmn'cond 'rn, 'shift_rm");
// Format(instr, "cmn'cond 'rn, 'imm");
alu_out = rn_val + shifter_operand;
SetNZFlags(alu_out);
SetCFlag(!CarryFrom(rn_val, shifter_operand));
SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, true));
} else {
// Other instructions matching this pattern are handled in the
// miscellaneous instructions part above.
UNREACHABLE();
}
break;
}
case ORR: {
// Format(instr, "orr'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "orr'cond's 'rd, 'rn, 'imm");
alu_out = rn_val | shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
}
break;
}
case MOV: {
// Format(instr, "mov'cond's 'rd, 'shift_rm");
// Format(instr, "mov'cond's 'rd, 'imm");
alu_out = shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
}
break;
}
case BIC: {
// Format(instr, "bic'cond's 'rd, 'rn, 'shift_rm");
// Format(instr, "bic'cond's 'rd, 'rn, 'imm");
alu_out = rn_val & ~shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
}
break;
}
case MVN: {
// Format(instr, "mvn'cond's 'rd, 'shift_rm");
// Format(instr, "mvn'cond's 'rd, 'imm");
alu_out = ~shifter_operand;
set_register(rd, alu_out);
if (instr->HasS()) {
SetNZFlags(alu_out);
SetCFlag(shifter_carry_out);
}
break;
}
default: {
UNREACHABLE();
break;
}
}
}
}
void Simulator::DecodeType2(Instruction* instr) {
int rd = instr->RdValue();
int rn = instr->RnValue();
int32_t rn_val = get_register(rn);
int32_t im_val = instr->Offset12Value();
int32_t addr = 0;
switch (instr->PUField()) {
case da_x: {
// Format(instr, "'memop'cond'b 'rd, ['rn], #-'off12");
ASSERT(!instr->HasW());
addr = rn_val;
rn_val -= im_val;
set_register(rn, rn_val);
break;
}
case ia_x: {
// Format(instr, "'memop'cond'b 'rd, ['rn], #+'off12");
ASSERT(!instr->HasW());
addr = rn_val;
rn_val += im_val;
set_register(rn, rn_val);
break;
}
case db_x: {
// Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w");
rn_val -= im_val;
addr = rn_val;
if (instr->HasW()) {
set_register(rn, rn_val);
}
break;
}
case ib_x: {
// Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w");
rn_val += im_val;
addr = rn_val;
if (instr->HasW()) {
set_register(rn, rn_val);
}
break;
}
default: {
UNREACHABLE();
break;
}
}
if (instr->HasB()) {
if (instr->HasL()) {
byte val = ReadBU(addr);
set_register(rd, val);
} else {
byte val = get_register(rd);
WriteB(addr, val);
}
} else {
if (instr->HasL()) {
set_register(rd, ReadW(addr, instr));
} else {
WriteW(addr, get_register(rd), instr);
}
}
}
void Simulator::DecodeType3(Instruction* instr) {
int rd = instr->RdValue();
int rn = instr->RnValue();
int32_t rn_val = get_register(rn);
bool shifter_carry_out = 0;
int32_t shifter_operand = GetShiftRm(instr, &shifter_carry_out);
int32_t addr = 0;
switch (instr->PUField()) {
case da_x: {
ASSERT(!instr->HasW());
Format(instr, "'memop'cond'b 'rd, ['rn], -'shift_rm");
UNIMPLEMENTED();
break;
}
case ia_x: {
if (instr->HasW()) {
ASSERT(instr->Bits(5, 4) == 0x1);
if (instr->Bit(22) == 0x1) { // USAT.
int32_t sat_pos = instr->Bits(20, 16);
int32_t sat_val = (1 << sat_pos) - 1;
int32_t shift = instr->Bits(11, 7);
int32_t shift_type = instr->Bit(6);
int32_t rm_val = get_register(instr->RmValue());
if (shift_type == 0) { // LSL
rm_val <<= shift;
} else { // ASR
rm_val >>= shift;
}
// If saturation occurs, the Q flag should be set in the CPSR.
// There is no Q flag yet, and no instruction (MRS) to read the
// CPSR directly.
if (rm_val > sat_val) {
rm_val = sat_val;
} else if (rm_val < 0) {
rm_val = 0;
}
set_register(rd, rm_val);
} else { // SSAT.
UNIMPLEMENTED();
}
return;
} else {
Format(instr, "'memop'cond'b 'rd, ['rn], +'shift_rm");
UNIMPLEMENTED();
}
break;
}
case db_x: {
// Format(instr, "'memop'cond'b 'rd, ['rn, -'shift_rm]'w");
addr = rn_val - shifter_operand;
if (instr->HasW()) {
set_register(rn, addr);
}
break;
}
case ib_x: {
if (instr->HasW() && (instr->Bits(6, 4) == 0x5)) {
uint32_t widthminus1 = static_cast<uint32_t>(instr->Bits(20, 16));
uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7));
uint32_t msbit = widthminus1 + lsbit;
if (msbit <= 31) {
if (instr->Bit(22)) {
// ubfx - unsigned bitfield extract.
uint32_t rm_val =
static_cast<uint32_t>(get_register(instr->RmValue()));
uint32_t extr_val = rm_val << (31 - msbit);
extr_val = extr_val >> (31 - widthminus1);
set_register(instr->RdValue(), extr_val);
} else {
// sbfx - signed bitfield extract.
int32_t rm_val = get_register(instr->RmValue());
int32_t extr_val = rm_val << (31 - msbit);
extr_val = extr_val >> (31 - widthminus1);
set_register(instr->RdValue(), extr_val);
}
} else {
UNREACHABLE();
}
return;
} else if (!instr->HasW() && (instr->Bits(6, 4) == 0x1)) {
uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7));
uint32_t msbit = static_cast<uint32_t>(instr->Bits(20, 16));
if (msbit >= lsbit) {
// bfc or bfi - bitfield clear/insert.
uint32_t rd_val =
static_cast<uint32_t>(get_register(instr->RdValue()));
uint32_t bitcount = msbit - lsbit + 1;
uint32_t mask = (1 << bitcount) - 1;
rd_val &= ~(mask << lsbit);
if (instr->RmValue() != 15) {
// bfi - bitfield insert.
uint32_t rm_val =
static_cast<uint32_t>(get_register(instr->RmValue()));
rm_val &= mask;
rd_val |= rm_val << lsbit;
}
set_register(instr->RdValue(), rd_val);
} else {
UNREACHABLE();
}
return;
} else {
// Format(instr, "'memop'cond'b 'rd, ['rn, +'shift_rm]'w");
addr = rn_val + shifter_operand;
if (instr->HasW()) {
set_register(rn, addr);
}
}
break;
}
default: {
UNREACHABLE();
break;
}
}
if (instr->HasB()) {
if (instr->HasL()) {
uint8_t byte = ReadB(addr);
set_register(rd, byte);
} else {
uint8_t byte = get_register(rd);
WriteB(addr, byte);
}
} else {
if (instr->HasL()) {
set_register(rd, ReadW(addr, instr));
} else {
WriteW(addr, get_register(rd), instr);
}
}
}
void Simulator::DecodeType4(Instruction* instr) {
ASSERT(instr->Bit(22) == 0); // only allowed to be set in privileged mode
if (instr->HasL()) {
// Format(instr, "ldm'cond'pu 'rn'w, 'rlist");
HandleRList(instr, true);
} else {
// Format(instr, "stm'cond'pu 'rn'w, 'rlist");
HandleRList(instr, false);
}
}
void Simulator::DecodeType5(Instruction* instr) {
// Format(instr, "b'l'cond 'target");
int off = (instr->SImmed24Value() << 2);
intptr_t pc_address = get_pc();
if (instr->HasLink()) {
set_register(lr, pc_address + Instruction::kInstrSize);
}
int pc_reg = get_register(pc);
set_pc(pc_reg + off);
}
void Simulator::DecodeType6(Instruction* instr) {
DecodeType6CoprocessorIns(instr);
}
void Simulator::DecodeType7(Instruction* instr) {
if (instr->Bit(24) == 1) {
SoftwareInterrupt(instr);
} else {
DecodeTypeVFP(instr);
}
}
// void Simulator::DecodeTypeVFP(Instruction* instr)
// The Following ARMv7 VFPv instructions are currently supported.
// vmov :Sn = Rt
// vmov :Rt = Sn
// vcvt: Dd = Sm
// vcvt: Sd = Dm
// Dd = vabs(Dm)
// Dd = vneg(Dm)
// Dd = vadd(Dn, Dm)
// Dd = vsub(Dn, Dm)
// Dd = vmul(Dn, Dm)
// Dd = vdiv(Dn, Dm)
// vcmp(Dd, Dm)
// vmrs
// Dd = vsqrt(Dm)
void Simulator::DecodeTypeVFP(Instruction* instr) {
ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) );
ASSERT(instr->Bits(11, 9) == 0x5);
// Obtain double precision register codes.
int vm = instr->VFPMRegValue(kDoublePrecision);
int vd = instr->VFPDRegValue(kDoublePrecision);
int vn = instr->VFPNRegValue(kDoublePrecision);
if (instr->Bit(4) == 0) {
if (instr->Opc1Value() == 0x7) {
// Other data processing instructions
if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x1)) {
// vmov register to register.
if (instr->SzValue() == 0x1) {
int m = instr->VFPMRegValue(kDoublePrecision);
int d = instr->VFPDRegValue(kDoublePrecision);
set_d_register_from_double(d, get_double_from_d_register(m));
} else {
int m = instr->VFPMRegValue(kSinglePrecision);
int d = instr->VFPDRegValue(kSinglePrecision);
set_s_register_from_float(d, get_float_from_s_register(m));
}
} else if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x3)) {
// vabs
double dm_value = get_double_from_d_register(vm);
double dd_value = fabs(dm_value);
set_d_register_from_double(vd, dd_value);
} else if ((instr->Opc2Value() == 0x1) && (instr->Opc3Value() == 0x1)) {
// vneg
double dm_value = get_double_from_d_register(vm);
double dd_value = -dm_value;
set_d_register_from_double(vd, dd_value);
} else if ((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3)) {
DecodeVCVTBetweenDoubleAndSingle(instr);
} else if ((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) {
DecodeVCVTBetweenFloatingPointAndInteger(instr);
} else if (((instr->Opc2Value() >> 1) == 0x6) &&
(instr->Opc3Value() & 0x1)) {
DecodeVCVTBetweenFloatingPointAndInteger(instr);
} else if (((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) &&
(instr->Opc3Value() & 0x1)) {
DecodeVCMP(instr);
} else if (((instr->Opc2Value() == 0x1)) && (instr->Opc3Value() == 0x3)) {
// vsqrt
double dm_value = get_double_from_d_register(vm);
double dd_value = sqrt(dm_value);
set_d_register_from_double(vd, dd_value);
} else if (instr->Opc3Value() == 0x0) {
// vmov immediate.
if (instr->SzValue() == 0x1) {
set_d_register_from_double(vd, instr->DoubleImmedVmov());
} else {
UNREACHABLE(); // Not used by v8.
}
} else {
UNREACHABLE(); // Not used by V8.
}
} else if (instr->Opc1Value() == 0x3) {
if (instr->SzValue() != 0x1) {
UNREACHABLE(); // Not used by V8.
}
if (instr->Opc3Value() & 0x1) {
// vsub
double dn_value = get_double_from_d_register(vn);
double dm_value = get_double_from_d_register(vm);
double dd_value = dn_value - dm_value;
set_d_register_from_double(vd, dd_value);
} else {
// vadd
double dn_value = get_double_from_d_register(vn);
double dm_value = get_double_from_d_register(vm);
double dd_value = dn_value + dm_value;
set_d_register_from_double(vd, dd_value);
}
} else if ((instr->Opc1Value() == 0x2) && !(instr->Opc3Value() & 0x1)) {
// vmul
if (instr->SzValue() != 0x1) {
UNREACHABLE(); // Not used by V8.
}
double dn_value = get_double_from_d_register(vn);
double dm_value = get_double_from_d_register(vm);
double dd_value = dn_value * dm_value;
set_d_register_from_double(vd, dd_value);
} else if ((instr->Opc1Value() == 0x4) && !(instr->Opc3Value() & 0x1)) {
// vdiv
if (instr->SzValue() != 0x1) {
UNREACHABLE(); // Not used by V8.
}
double dn_value = get_double_from_d_register(vn);
double dm_value = get_double_from_d_register(vm);
double dd_value = dn_value / dm_value;
div_zero_vfp_flag_ = (dm_value == 0);
set_d_register_from_double(vd, dd_value);
} else {
UNIMPLEMENTED(); // Not used by V8.
}
} else {
if ((instr->VCValue() == 0x0) &&
(instr->VAValue() == 0x0)) {
DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr);
} else if ((instr->VLValue() == 0x1) &&
(instr->VCValue() == 0x0) &&
(instr->VAValue() == 0x7) &&
(instr->Bits(19, 16) == 0x1)) {
// vmrs
uint32_t rt = instr->RtValue();
if (rt == 0xF) {
Copy_FPSCR_to_APSR();
} else {
// Emulate FPSCR from the Simulator flags.
uint32_t fpscr = (n_flag_FPSCR_ << 31) |
(z_flag_FPSCR_ << 30) |
(c_flag_FPSCR_ << 29) |
(v_flag_FPSCR_ << 28) |
(inexact_vfp_flag_ << 4) |
(underflow_vfp_flag_ << 3) |
(overflow_vfp_flag_ << 2) |
(div_zero_vfp_flag_ << 1) |
(inv_op_vfp_flag_ << 0) |
(FPSCR_rounding_mode_);
set_register(rt, fpscr);
}
} else if ((instr->VLValue() == 0x0) &&
(instr->VCValue() == 0x0) &&
(instr->VAValue() == 0x7) &&
(instr->Bits(19, 16) == 0x1)) {
// vmsr
uint32_t rt = instr->RtValue();
if (rt == pc) {
UNREACHABLE();
} else {
uint32_t rt_value = get_register(rt);
n_flag_FPSCR_ = (rt_value >> 31) & 1;
z_flag_FPSCR_ = (rt_value >> 30) & 1;
c_flag_FPSCR_ = (rt_value >> 29) & 1;
v_flag_FPSCR_ = (rt_value >> 28) & 1;
inexact_vfp_flag_ = (rt_value >> 4) & 1;
underflow_vfp_flag_ = (rt_value >> 3) & 1;
overflow_vfp_flag_ = (rt_value >> 2) & 1;
div_zero_vfp_flag_ = (rt_value >> 1) & 1;
inv_op_vfp_flag_ = (rt_value >> 0) & 1;
FPSCR_rounding_mode_ =
static_cast<VFPRoundingMode>((rt_value) & kVFPRoundingModeMask);
}
} else {
UNIMPLEMENTED(); // Not used by V8.
}
}
}
void Simulator::DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(
Instruction* instr) {
ASSERT((instr->Bit(4) == 1) && (instr->VCValue() == 0x0) &&
(instr->VAValue() == 0x0));
int t = instr->RtValue();
int n = instr->VFPNRegValue(kSinglePrecision);
bool to_arm_register = (instr->VLValue() == 0x1);
if (to_arm_register) {
int32_t int_value = get_sinteger_from_s_register(n);
set_register(t, int_value);
} else {
int32_t rs_val = get_register(t);
set_s_register_from_sinteger(n, rs_val);
}
}
void Simulator::DecodeVCMP(Instruction* instr) {
ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
ASSERT(((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) &&
(instr->Opc3Value() & 0x1));
// Comparison.
VFPRegPrecision precision = kSinglePrecision;
if (instr->SzValue() == 1) {
precision = kDoublePrecision;
}
int d = instr->VFPDRegValue(precision);
int m = 0;
if (instr->Opc2Value() == 0x4) {
m = instr->VFPMRegValue(precision);
}
if (precision == kDoublePrecision) {
double dd_value = get_double_from_d_register(d);
double dm_value = 0.0;
if (instr->Opc2Value() == 0x4) {
dm_value = get_double_from_d_register(m);
}
// Raise exceptions for quiet NaNs if necessary.
if (instr->Bit(7) == 1) {
if (isnan(dd_value)) {
inv_op_vfp_flag_ = true;
}
}
Compute_FPSCR_Flags(dd_value, dm_value);
} else {
UNIMPLEMENTED(); // Not used by V8.
}
}
void Simulator::DecodeVCVTBetweenDoubleAndSingle(Instruction* instr) {
ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
ASSERT((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3));
VFPRegPrecision dst_precision = kDoublePrecision;
VFPRegPrecision src_precision = kSinglePrecision;
if (instr->SzValue() == 1) {
dst_precision = kSinglePrecision;
src_precision = kDoublePrecision;
}
int dst = instr->VFPDRegValue(dst_precision);
int src = instr->VFPMRegValue(src_precision);
if (dst_precision == kSinglePrecision) {
double val = get_double_from_d_register(src);
set_s_register_from_float(dst, static_cast<float>(val));
} else {
float val = get_float_from_s_register(src);
set_d_register_from_double(dst, static_cast<double>(val));
}
}
bool get_inv_op_vfp_flag(VFPRoundingMode mode,
double val,
bool unsigned_) {
ASSERT((mode == RN) || (mode == RM) || (mode == RZ));
double max_uint = static_cast<double>(0xffffffffu);
double max_int = static_cast<double>(kMaxInt);
double min_int = static_cast<double>(kMinInt);
// Check for NaN.
if (val != val) {
return true;
}
// Check for overflow. This code works because 32bit integers can be
// exactly represented by ieee-754 64bit floating-point values.
switch (mode) {
case RN:
return unsigned_ ? (val >= (max_uint + 0.5)) ||
(val < -0.5)
: (val >= (max_int + 0.5)) ||
(val < (min_int - 0.5));
case RM:
return unsigned_ ? (val >= (max_uint + 1.0)) ||
(val < 0)
: (val >= (max_int + 1.0)) ||
(val < min_int);
case RZ:
return unsigned_ ? (val >= (max_uint + 1.0)) ||
(val <= -1)
: (val >= (max_int + 1.0)) ||
(val <= (min_int - 1.0));
default:
UNREACHABLE();
return true;
}
}
// We call this function only if we had a vfp invalid exception.
// It returns the correct saturated value.
int VFPConversionSaturate(double val, bool unsigned_res) {
if (val != val) {
return 0;
} else {
if (unsigned_res) {
return (val < 0) ? 0 : 0xffffffffu;
} else {
return (val < 0) ? kMinInt : kMaxInt;
}
}
}
void Simulator::DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr) {
ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7) &&
(instr->Bits(27, 23) == 0x1D));
ASSERT(((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) ||
(((instr->Opc2Value() >> 1) == 0x6) && (instr->Opc3Value() & 0x1)));
// Conversion between floating-point and integer.
bool to_integer = (instr->Bit(18) == 1);
VFPRegPrecision src_precision = (instr->SzValue() == 1) ? kDoublePrecision
: kSinglePrecision;
if (to_integer) {
// We are playing with code close to the C++ standard's limits below,
// hence the very simple code and heavy checks.
//
// Note:
// C++ defines default type casting from floating point to integer as
// (close to) rounding toward zero ("fractional part discarded").
int dst = instr->VFPDRegValue(kSinglePrecision);
int src = instr->VFPMRegValue(src_precision);
// Bit 7 in vcvt instructions indicates if we should use the FPSCR rounding
// mode or the default Round to Zero mode.
VFPRoundingMode mode = (instr->Bit(7) != 1) ? FPSCR_rounding_mode_
: RZ;
ASSERT((mode == RM) || (mode == RZ) || (mode == RN));
bool unsigned_integer = (instr->Bit(16) == 0);
bool double_precision = (src_precision == kDoublePrecision);
double val = double_precision ? get_double_from_d_register(src)
: get_float_from_s_register(src);
int temp = unsigned_integer ? static_cast<uint32_t>(val)
: static_cast<int32_t>(val);
inv_op_vfp_flag_ = get_inv_op_vfp_flag(mode, val, unsigned_integer);
double abs_diff =
unsigned_integer ? fabs(val - static_cast<uint32_t>(temp))
: fabs(val - temp);
inexact_vfp_flag_ = (abs_diff != 0);
if (inv_op_vfp_flag_) {
temp = VFPConversionSaturate(val, unsigned_integer);
} else {
switch (mode) {
case RN: {
int val_sign = (val > 0) ? 1 : -1;
if (abs_diff > 0.5) {
temp += val_sign;
} else if (abs_diff == 0.5) {
// Round to even if exactly halfway.
temp = ((temp % 2) == 0) ? temp : temp + val_sign;
}
break;
}
case RM:
temp = temp > val ? temp - 1 : temp;
break;
case RZ:
// Nothing to do.
break;
default:
UNREACHABLE();
}
}
// Update the destination register.
set_s_register_from_sinteger(dst, temp);
} else {
bool unsigned_integer = (instr->Bit(7) == 0);
int dst = instr->VFPDRegValue(src_precision);
int src = instr->VFPMRegValue(kSinglePrecision);
int val = get_sinteger_from_s_register(src);
if (src_precision == kDoublePrecision) {
if (unsigned_integer) {
set_d_register_from_double(dst,
static_cast<double>((uint32_t)val));
} else {
set_d_register_from_double(dst, static_cast<double>(val));
}
} else {
if (unsigned_integer) {
set_s_register_from_float(dst,
static_cast<float>((uint32_t)val));
} else {
set_s_register_from_float(dst, static_cast<float>(val));
}
}
}
}
// void Simulator::DecodeType6CoprocessorIns(Instruction* instr)
// Decode Type 6 coprocessor instructions.
// Dm = vmov(Rt, Rt2)
// <Rt, Rt2> = vmov(Dm)
// Ddst = MEM(Rbase + 4*offset).
// MEM(Rbase + 4*offset) = Dsrc.
void Simulator::DecodeType6CoprocessorIns(Instruction* instr) {
ASSERT((instr->TypeValue() == 6));
if (instr->CoprocessorValue() == 0xA) {
switch (instr->OpcodeValue()) {
case 0x8:
case 0xA:
case 0xC:
case 0xE: { // Load and store single precision float to memory.
int rn = instr->RnValue();
int vd = instr->VFPDRegValue(kSinglePrecision);
int offset = instr->Immed8Value();
if (!instr->HasU()) {
offset = -offset;
}
int32_t address = get_register(rn) + 4 * offset;
if (instr->HasL()) {
// Load double from memory: vldr.
set_s_register_from_sinteger(vd, ReadW(address, instr));
} else {
// Store double to memory: vstr.
WriteW(address, get_sinteger_from_s_register(vd), instr);
}
break;
}
case 0x4:
case 0x5:
case 0x6:
case 0x7:
case 0x9:
case 0xB:
// Load/store multiple single from memory: vldm/vstm.
HandleVList(instr);
break;
default:
UNIMPLEMENTED(); // Not used by V8.
}
} else if (instr->CoprocessorValue() == 0xB) {
switch (instr->OpcodeValue()) {
case 0x2:
// Load and store double to two GP registers
if (instr->Bits(7, 4) != 0x1) {
UNIMPLEMENTED(); // Not used by V8.
} else {
int rt = instr->RtValue();
int rn = instr->RnValue();
int vm = instr->VmValue();
if (instr->HasL()) {
int32_t rt_int_value = get_sinteger_from_s_register(2*vm);
int32_t rn_int_value = get_sinteger_from_s_register(2*vm+1);
set_register(rt, rt_int_value);
set_register(rn, rn_int_value);
} else {
int32_t rs_val = get_register(rt);
int32_t rn_val = get_register(rn);
set_s_register_from_sinteger(2*vm, rs_val);
set_s_register_from_sinteger((2*vm+1), rn_val);
}
}
break;
case 0x8:
case 0xC: { // Load and store double to memory.
int rn = instr->RnValue();
int vd = instr->VdValue();
int offset = instr->Immed8Value();
if (!instr->HasU()) {
offset = -offset;
}
int32_t address = get_register(rn) + 4 * offset;
if (instr->HasL()) {
// Load double from memory: vldr.
set_s_register_from_sinteger(2*vd, ReadW(address, instr));
set_s_register_from_sinteger(2*vd + 1, ReadW(address + 4, instr));
} else {
// Store double to memory: vstr.
WriteW(address, get_sinteger_from_s_register(2*vd), instr);
WriteW(address + 4, get_sinteger_from_s_register(2*vd + 1), instr);
}
break;
}
case 0x4:
case 0x5:
case 0x9:
// Load/store multiple double from memory: vldm/vstm.
HandleVList(instr);
break;
default:
UNIMPLEMENTED(); // Not used by V8.
}
} else {
UNIMPLEMENTED(); // Not used by V8.
}
}
// Executes the current instruction.
void Simulator::InstructionDecode(Instruction* instr) {
if (v8::internal::FLAG_check_icache) {
CheckICache(isolate_->simulator_i_cache(), instr);
}
pc_modified_ = false;
if (::v8::internal::FLAG_trace_sim) {
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// use a reasonably large buffer
v8::internal::EmbeddedVector<char, 256> buffer;
dasm.InstructionDecode(buffer,
reinterpret_cast<byte*>(instr));
PrintF(" 0x%08x %s\n", reinterpret_cast<intptr_t>(instr), buffer.start());
}
if (instr->ConditionField() == kSpecialCondition) {
UNIMPLEMENTED();
} else if (ConditionallyExecute(instr)) {
switch (instr->TypeValue()) {
case 0:
case 1: {
DecodeType01(instr);
break;
}
case 2: {
DecodeType2(instr);
break;
}
case 3: {
DecodeType3(instr);
break;
}
case 4: {
DecodeType4(instr);
break;
}
case 5: {
DecodeType5(instr);
break;
}
case 6: {
DecodeType6(instr);
break;
}
case 7: {
DecodeType7(instr);
break;
}
default: {
UNIMPLEMENTED();
break;
}
}
// If the instruction is a non taken conditional stop, we need to skip the
// inlined message address.
} else if (instr->IsStop()) {
set_pc(get_pc() + 2 * Instruction::kInstrSize);
}
if (!pc_modified_) {
set_register(pc, reinterpret_cast<int32_t>(instr)
+ Instruction::kInstrSize);
}
}
void Simulator::Execute() {
// Get the PC to simulate. Cannot use the accessor here as we need the
// raw PC value and not the one used as input to arithmetic instructions.
int program_counter = get_pc();
if (::v8::internal::FLAG_stop_sim_at == 0) {
// Fast version of the dispatch loop without checking whether the simulator
// should be stopping at a particular executed instruction.
while (program_counter != end_sim_pc) {
Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
icount_++;
InstructionDecode(instr);
program_counter = get_pc();
}
} else {
// FLAG_stop_sim_at is at the non-default value. Stop in the debugger when
// we reach the particular instuction count.
while (program_counter != end_sim_pc) {
Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
icount_++;
if (icount_ == ::v8::internal::FLAG_stop_sim_at) {
ArmDebugger dbg(this);
dbg.Debug();
} else {
InstructionDecode(instr);
}
program_counter = get_pc();
}
}
}
int32_t Simulator::Call(byte* entry, int argument_count, ...) {
va_list parameters;
va_start(parameters, argument_count);
// Set up arguments
// First four arguments passed in registers.
ASSERT(argument_count >= 4);
set_register(r0, va_arg(parameters, int32_t));
set_register(r1, va_arg(parameters, int32_t));
set_register(r2, va_arg(parameters, int32_t));
set_register(r3, va_arg(parameters, int32_t));
// Remaining arguments passed on stack.
int original_stack = get_register(sp);
// Compute position of stack on entry to generated code.
int entry_stack = (original_stack - (argument_count - 4) * sizeof(int32_t));
if (OS::ActivationFrameAlignment() != 0) {
entry_stack &= -OS::ActivationFrameAlignment();
}
// Store remaining arguments on stack, from low to high memory.
intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack);
for (int i = 4; i < argument_count; i++) {
stack_argument[i - 4] = va_arg(parameters, int32_t);
}
va_end(parameters);
set_register(sp, entry_stack);
// Prepare to execute the code at entry
set_register(pc, reinterpret_cast<int32_t>(entry));
// Put down marker for end of simulation. The simulator will stop simulation
// when the PC reaches this value. By saving the "end simulation" value into
// the LR the simulation stops when returning to this call point.
set_register(lr, end_sim_pc);
// Remember the values of callee-saved registers.
// The code below assumes that r9 is not used as sb (static base) in
// simulator code and therefore is regarded as a callee-saved register.
int32_t r4_val = get_register(r4);
int32_t r5_val = get_register(r5);
int32_t r6_val = get_register(r6);
int32_t r7_val = get_register(r7);
int32_t r8_val = get_register(r8);
int32_t r9_val = get_register(r9);
int32_t r10_val = get_register(r10);
int32_t r11_val = get_register(r11);
// Set up the callee-saved registers with a known value. To be able to check
// that they are preserved properly across JS execution.
int32_t callee_saved_value = icount_;
set_register(r4, callee_saved_value);
set_register(r5, callee_saved_value);
set_register(r6, callee_saved_value);
set_register(r7, callee_saved_value);
set_register(r8, callee_saved_value);
set_register(r9, callee_saved_value);
set_register(r10, callee_saved_value);
set_register(r11, callee_saved_value);
// Start the simulation
Execute();
// Check that the callee-saved registers have been preserved.
CHECK_EQ(callee_saved_value, get_register(r4));
CHECK_EQ(callee_saved_value, get_register(r5));
CHECK_EQ(callee_saved_value, get_register(r6));
CHECK_EQ(callee_saved_value, get_register(r7));
CHECK_EQ(callee_saved_value, get_register(r8));
CHECK_EQ(callee_saved_value, get_register(r9));
CHECK_EQ(callee_saved_value, get_register(r10));
CHECK_EQ(callee_saved_value, get_register(r11));
// Restore callee-saved registers with the original value.
set_register(r4, r4_val);
set_register(r5, r5_val);
set_register(r6, r6_val);
set_register(r7, r7_val);
set_register(r8, r8_val);
set_register(r9, r9_val);
set_register(r10, r10_val);
set_register(r11, r11_val);
// Pop stack passed arguments.
CHECK_EQ(entry_stack, get_register(sp));
set_register(sp, original_stack);
int32_t result = get_register(r0);
return result;
}
uintptr_t Simulator::PushAddress(uintptr_t address) {
int new_sp = get_register(sp) - sizeof(uintptr_t);
uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(new_sp);
*stack_slot = address;
set_register(sp, new_sp);
return new_sp;
}
uintptr_t Simulator::PopAddress() {
int current_sp = get_register(sp);
uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
uintptr_t address = *stack_slot;
set_register(sp, current_sp + sizeof(uintptr_t));
return address;
}
} } // namespace v8::internal
#endif // USE_SIMULATOR
#endif // V8_TARGET_ARCH_ARM
| {
"content_hash": "b4eaeabb47ccbb8a543409ed45f0f36e",
"timestamp": "",
"source": "github",
"line_count": 3393,
"max_line_length": 80,
"avg_line_length": 32.249336870026525,
"alnum_prop": 0.5611485807241688,
"repo_name": "mogoweb/webkit_for_android5.1",
"id": "629c209ea2f30a3949ad123e51315d0e80bff0f3",
"size": "111329",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "v8/src/arm/simulator-arm.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AppleScript",
"bytes": "6772"
},
{
"name": "Assembly",
"bytes": "26025"
},
{
"name": "Awk",
"bytes": "2800"
},
{
"name": "Batchfile",
"bytes": "57337"
},
{
"name": "C",
"bytes": "7713030"
},
{
"name": "C++",
"bytes": "153178707"
},
{
"name": "CMake",
"bytes": "192330"
},
{
"name": "CSS",
"bytes": "483041"
},
{
"name": "Common Lisp",
"bytes": "9920"
},
{
"name": "DIGITAL Command Language",
"bytes": "5243"
},
{
"name": "DTrace",
"bytes": "1931"
},
{
"name": "Go",
"bytes": "3744"
},
{
"name": "HTML",
"bytes": "14998422"
},
{
"name": "Java",
"bytes": "1522083"
},
{
"name": "JavaScript",
"bytes": "18008829"
},
{
"name": "Lex",
"bytes": "42554"
},
{
"name": "Lua",
"bytes": "13768"
},
{
"name": "M4",
"bytes": "49839"
},
{
"name": "Makefile",
"bytes": "476166"
},
{
"name": "Module Management System",
"bytes": "9756"
},
{
"name": "Objective-C",
"bytes": "2798053"
},
{
"name": "Objective-C++",
"bytes": "7846322"
},
{
"name": "PHP",
"bytes": "66595"
},
{
"name": "Perl",
"bytes": "1130475"
},
{
"name": "Perl 6",
"bytes": "445215"
},
{
"name": "Python",
"bytes": "5503045"
},
{
"name": "QML",
"bytes": "3331"
},
{
"name": "QMake",
"bytes": "294800"
},
{
"name": "R",
"bytes": "290"
},
{
"name": "Roff",
"bytes": "273562"
},
{
"name": "Ruby",
"bytes": "81928"
},
{
"name": "Scheme",
"bytes": "10604"
},
{
"name": "Shell",
"bytes": "488223"
},
{
"name": "Yacc",
"bytes": "153801"
},
{
"name": "xBase",
"bytes": "328"
}
],
"symlink_target": ""
} |
import unittest
import re
import threading
import time
from selenium import webdriver
from app import create_app, db
from app.models import User, Role, Post, Permission
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
#start Chrome
try:
cls.client = webdriver.Chrome()
except:
pass
if cls.client:
cls.app = create_app('testing')
cls.app_context = cls.app.app_context()
cls.app_context.push()
import logging
logger = logging.getLogger('werkzeug')
logger.setLevel("ERROR")
db.create_all()
Role.insert_roles()
User.generate_fake(100)
Post.generate_fake(100)
admin_role = Role.query.filter_by(permissions=0xff).first()
admin = User(email='pamplemouse.rose@example.com', username='pamplemouse', password='test', role=admin_role, confirmed=True)
db.session.add(admin)
db.session.commit()
threading.Thread(target=cls.app.run).start()
@classmethod
def tearDownClass(cls):
if cls.client:
cls.client.get('http://localhost:5000/shutdown')
cls.client.stop()
db.drop_all()
db.session.remove()
cls.app_context.pop()
def setUp(self):
if not self.client:
self.skipTest('Web browser not available')
def tearDown(self):
pass
def test_admin_home_page(self):
self.client.get('http://localhost:5000/')
self.assertTrue(re.search('Hello,\s+Stranger!', self.client.page_source))
self.client.find_element_by_link_text('Sign in').click()
self.assertTrue('<h1>Login</h1>' in self.client.page_source)
self.client.find_element_by_name('email').send_keys('pamplemouse.rose@example.com')
self.client.find_element_by_name('password').send_keys('test')
self.client.find_element_by_name('submit').click()
self.assertTrue(re.search('Hello,\s+pamplemouse!', self.client.page_source))
self.client.find_element_by_link_text('Profile').click()
self.assertTrue('<h1>pamplemouse</h1>' in self.client.page_source)
| {
"content_hash": "632ac9e263914566b9d339b791aae998",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 136,
"avg_line_length": 32.47945205479452,
"alnum_prop": 0.5845634753268663,
"repo_name": "delitamakanda/socialite",
"id": "fb6744a5d2ba9d535c0a4160a9e2d490058b33db",
"size": "2371",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_selenium.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "134"
},
{
"name": "HTML",
"bytes": "50249"
},
{
"name": "JavaScript",
"bytes": "825"
},
{
"name": "Mako",
"bytes": "412"
},
{
"name": "Python",
"bytes": "76668"
}
],
"symlink_target": ""
} |
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.ResourceManager;
namespace Azure.ResourceManager.CustomerInsights
{
/// <summary>
/// A Class representing a RelationshipResourceFormat along with the instance operations that can be performed on it.
/// If you have a <see cref="ResourceIdentifier" /> you can construct a <see cref="RelationshipResourceFormatResource" />
/// from an instance of <see cref="ArmClient" /> using the GetRelationshipResourceFormatResource method.
/// Otherwise you can get one from its parent resource <see cref="HubResource" /> using the GetRelationshipResourceFormat method.
/// </summary>
public partial class RelationshipResourceFormatResource : ArmResource
{
/// <summary> Generate the resource identifier of a <see cref="RelationshipResourceFormatResource"/> instance. </summary>
public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string relationshipName)
{
var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}";
return new ResourceIdentifier(resourceId);
}
private readonly ClientDiagnostics _relationshipResourceFormatRelationshipsClientDiagnostics;
private readonly RelationshipsRestOperations _relationshipResourceFormatRelationshipsRestClient;
private readonly RelationshipResourceFormatData _data;
/// <summary> Initializes a new instance of the <see cref="RelationshipResourceFormatResource"/> class for mocking. </summary>
protected RelationshipResourceFormatResource()
{
}
/// <summary> Initializes a new instance of the <see cref = "RelationshipResourceFormatResource"/> class. </summary>
/// <param name="client"> The client parameters to use in these operations. </param>
/// <param name="data"> The resource that is the target of operations. </param>
internal RelationshipResourceFormatResource(ArmClient client, RelationshipResourceFormatData data) : this(client, data.Id)
{
HasData = true;
_data = data;
}
/// <summary> Initializes a new instance of the <see cref="RelationshipResourceFormatResource"/> class. </summary>
/// <param name="client"> The client parameters to use in these operations. </param>
/// <param name="id"> The identifier of the resource that is the target of operations. </param>
internal RelationshipResourceFormatResource(ArmClient client, ResourceIdentifier id) : base(client, id)
{
_relationshipResourceFormatRelationshipsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CustomerInsights", ResourceType.Namespace, Diagnostics);
TryGetApiVersion(ResourceType, out string relationshipResourceFormatRelationshipsApiVersion);
_relationshipResourceFormatRelationshipsRestClient = new RelationshipsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, relationshipResourceFormatRelationshipsApiVersion);
#if DEBUG
ValidateResourceId(Id);
#endif
}
/// <summary> Gets the resource type for the operations. </summary>
public static readonly ResourceType ResourceType = "Microsoft.CustomerInsights/hubs/relationships";
/// <summary> Gets whether or not the current instance has data. </summary>
public virtual bool HasData { get; }
/// <summary> Gets the data representing this Feature. </summary>
/// <exception cref="InvalidOperationException"> Throws if there is no data loaded in the current instance. </exception>
public virtual RelationshipResourceFormatData Data
{
get
{
if (!HasData)
throw new InvalidOperationException("The current instance does not have data, you must call Get first.");
return _data;
}
}
internal static void ValidateResourceId(ResourceIdentifier id)
{
if (id.ResourceType != ResourceType)
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
}
/// <summary>
/// Gets information about the specified relationship.
/// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}
/// Operation Id: Relationships_Get
/// </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<RelationshipResourceFormatResource>> GetAsync(CancellationToken cancellationToken = default)
{
using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatResource.Get");
scope.Start();
try
{
var response = await _relationshipResourceFormatRelationshipsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
if (response.Value == null)
throw new RequestFailedException(response.GetRawResponse());
return Response.FromValue(new RelationshipResourceFormatResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
/// Gets information about the specified relationship.
/// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}
/// Operation Id: Relationships_Get
/// </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<RelationshipResourceFormatResource> Get(CancellationToken cancellationToken = default)
{
using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatResource.Get");
scope.Start();
try
{
var response = _relationshipResourceFormatRelationshipsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
if (response.Value == null)
throw new RequestFailedException(response.GetRawResponse());
return Response.FromValue(new RelationshipResourceFormatResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
/// Deletes a relationship within a hub.
/// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}
/// Operation Id: Relationships_Delete
/// </summary>
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<ArmOperation> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
{
using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatResource.Delete");
scope.Start();
try
{
var response = await _relationshipResourceFormatRelationshipsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
var operation = new CustomerInsightsArmOperation(_relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, _relationshipResourceFormatRelationshipsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
return operation;
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
/// Deletes a relationship within a hub.
/// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}
/// Operation Id: Relationships_Delete
/// </summary>
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default)
{
using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatResource.Delete");
scope.Start();
try
{
var response = _relationshipResourceFormatRelationshipsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
var operation = new CustomerInsightsArmOperation(_relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, _relationshipResourceFormatRelationshipsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
operation.WaitForCompletionResponse(cancellationToken);
return operation;
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
/// Creates a relationship or updates an existing relationship within a hub.
/// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}
/// Operation Id: Relationships_CreateOrUpdate
/// </summary>
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
/// <param name="data"> Parameters supplied to the CreateOrUpdate Relationship operation. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
public virtual async Task<ArmOperation<RelationshipResourceFormatResource>> UpdateAsync(WaitUntil waitUntil, RelationshipResourceFormatData data, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(data, nameof(data));
using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatResource.Update");
scope.Start();
try
{
var response = await _relationshipResourceFormatRelationshipsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false);
var operation = new CustomerInsightsArmOperation<RelationshipResourceFormatResource>(new RelationshipResourceFormatOperationSource(Client), _relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, _relationshipResourceFormatRelationshipsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
return operation;
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary>
/// Creates a relationship or updates an existing relationship within a hub.
/// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}
/// Operation Id: Relationships_CreateOrUpdate
/// </summary>
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
/// <param name="data"> Parameters supplied to the CreateOrUpdate Relationship operation. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
public virtual ArmOperation<RelationshipResourceFormatResource> Update(WaitUntil waitUntil, RelationshipResourceFormatData data, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(data, nameof(data));
using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatResource.Update");
scope.Start();
try
{
var response = _relationshipResourceFormatRelationshipsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
var operation = new CustomerInsightsArmOperation<RelationshipResourceFormatResource>(new RelationshipResourceFormatOperationSource(Client), _relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, _relationshipResourceFormatRelationshipsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
operation.WaitForCompletion(cancellationToken);
return operation;
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}
| {
"content_hash": "7ba5e5e4694012acc5b346cc75d29189",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 488,
"avg_line_length": 67.85123966942149,
"alnum_prop": 0.7004263093788063,
"repo_name": "Azure/azure-sdk-for-net",
"id": "f0d412a00a008d183c3940f06051c35fde337f59",
"size": "16558",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatResource.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package com.google.cloud.vmmigration.v1.samples;
// [START vmmigration_v1_generated_vmmigrationclient_listcutoverjobs_paged_async]
import com.google.cloud.vmmigration.v1.CutoverJob;
import com.google.cloud.vmmigration.v1.ListCutoverJobsRequest;
import com.google.cloud.vmmigration.v1.ListCutoverJobsResponse;
import com.google.cloud.vmmigration.v1.MigratingVmName;
import com.google.cloud.vmmigration.v1.VmMigrationClient;
import com.google.common.base.Strings;
public class AsyncListCutoverJobsPaged {
public static void main(String[] args) throws Exception {
asyncListCutoverJobsPaged();
}
public static void asyncListCutoverJobsPaged() throws Exception {
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VmMigrationClient vmMigrationClient = VmMigrationClient.create()) {
ListCutoverJobsRequest request =
ListCutoverJobsRequest.newBuilder()
.setParent(
MigratingVmName.of("[PROJECT]", "[LOCATION]", "[SOURCE]", "[MIGRATING_VM]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while (true) {
ListCutoverJobsResponse response =
vmMigrationClient.listCutoverJobsCallable().call(request);
for (CutoverJob element : response.getCutoverJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
}
// [END vmmigration_v1_generated_vmmigrationclient_listcutoverjobs_paged_async]
| {
"content_hash": "579d08f82ea366cc9184d889a0920820",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 100,
"avg_line_length": 42.15384615384615,
"alnum_prop": 0.6952554744525548,
"repo_name": "googleapis/java-vmmigration",
"id": "e720f9d3f7de9f74719599cb7422f7935a1d6b19",
"size": "2787",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "samples/snippets/generated/com/google/cloud/vmmigration/v1/vmmigrationclient/listcutoverjobs/AsyncListCutoverJobsPaged.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "801"
},
{
"name": "Java",
"bytes": "5674319"
},
{
"name": "Python",
"bytes": "787"
},
{
"name": "Shell",
"bytes": "20456"
}
],
"symlink_target": ""
} |
package client.app.products.tasks;
import java.awt.Color;
import share.app.brands.Brand;
import share.app.sections.Section;
import client.app.brands.tasks.SearchBrand;
import client.app.products.gui.def.GUIEditProduct;
import client.app.sections.tasks.SearchSection;
import client.core.gui.taks.Activity;
public abstract class BaseProduct<ResultType> extends Activity<ResultType>
{
protected GUIEditProduct gui = new GUIEditProduct();
protected int sectionID = 0;
protected int brandID = 0;
public BaseProduct()
{
super(GUIEditProduct.PATH, Type.MODAL);
setGUI(this.gui);
}
protected boolean validate()
{
boolean valid = false;
clearInputsBorders();
if (this.gui.name.isEmpty())
{
showWarning(GUIEditProduct.Literals.NAME_REQUIRED);
this.gui.name.focus();
this.gui.name.setBorderColor(Color.RED);
}
else if (this.gui.sectionName.isEmpty())
{
showWarning(GUIEditProduct.Literals.SECTION_REQUIRED);
this.gui.sectionName.focus();
this.gui.sectionName.setBorderColor(Color.RED);
}
else if (this.gui.barCode.isEmpty())
{
showWarning(GUIEditProduct.Literals.BAR_CODE_REQUIRED);
this.gui.barCode.focus();
this.gui.barCode.setBorderColor(Color.RED);
}
else if (this.gui.costPrice.isEmpty())
{
showWarning(GUIEditProduct.Literals.COST_PRICE_REQUIRED);
this.gui.costPrice.focus();
this.gui.costPrice.setBorderColor(Color.RED);
}
else if (this.gui.salePrice.isEmpty())
{
showWarning(GUIEditProduct.Literals.SALE_PRICE_REQUIRED);
this.gui.salePrice.focus();
this.gui.salePrice.setBorderColor(Color.RED);
}
else if (this.gui.tax.isEmpty())
{
showWarning(GUIEditProduct.Literals.TAX_REQUIRED);
this.gui.tax.focus();
this.gui.tax.setBorderColor(Color.RED);
}
else if (this.gui.brandName.isEmpty())
{
showWarning(GUIEditProduct.Literals.BRAND_REQUIRED);
this.gui.brandName.focus();
this.gui.brandName.setBorderColor(Color.RED);
}
else if (this.gui.model.isEmpty())
{
showWarning(GUIEditProduct.Literals.MODEL_REQUIRED);
this.gui.model.focus();
this.gui.model.setBorderColor(Color.RED);
}
else if (this.gui.measuringUnit.isEmpty())
{
showWarning(GUIEditProduct.Literals.MEASURING_UNIT_REQUIRED);
this.gui.measuringUnit.focus();
this.gui.measuringUnit.setBorderColor(Color.RED);
}
else
{
valid = true;
}
return valid;
}
protected void searchSection()
{
SearchSection task = new SearchSection();
Section section = task.run();
if (section != null)
{
this.sectionID = section.id;
this.gui.sectionName.set(section.name);
}
this.gui.sectionName.focus();
}
protected void searchBrand()
{
SearchBrand task = new SearchBrand();
Brand brand = task.run();
if (brand != null)
{
this.brandID = brand.id;
this.gui.brandName.set(brand.name);
}
this.gui.sectionName.focus();
}
} | {
"content_hash": "166bdcce9a28481caa2cec2ff63841e3",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 74,
"avg_line_length": 25.058823529411764,
"alnum_prop": 0.6887994634473508,
"repo_name": "vndly/saas",
"id": "0774a93b826f9784ce1d582e05d9f843ce2662cf",
"size": "2982",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/src/client/app/products/tasks/BaseProduct.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "594322"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<!-- vim: set expandtab softtabstop=2 shiftwidth=2 tabstop=8: -->
<ruleset name="Lousson">
<description>The Lousson Project's coding standard</description>
<!--
The Lousson Project's coding standard derives directly from PSR1
(https://github.com/php-fig/fig-standards) -->
<rule ref="PSR1"/>
<!--
All PHP files MUST use the Unix LF (linefeed) line ending.
Windows CR/LF and clasic Mac CR endings are prohibited -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!--
The closing ?> tag MUST be omitted from files where the last
section is a PHP block (and no HTML code, for example). Instead,
all those files MUST end with a signle blank line -->
<rule ref="Zend.Files.ClosingTag"/>
<!--
All lines SHOULD NOT consist of more than 75 characters.
This leaves enough space for line numbers and a separator,
even on most terminals. The hard-limit each line MUST NOT
exceed, however, is 120 characters -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="75"/>
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>
<!--
There MUST NOT be any trailing whitespace at the end
of any line. One shall Use their encoded form in case
this becomes necessary anywere -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<!--
There MUST NOT be more than one statement per line -->
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<!--
All code MUST use an indent of 4 spaces, and MUST NOT use
tabs for indenting -->
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!--
All PHP keywords MUST be in lower case -->
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<!--
When present, there MUST be one blank line after the namespace
declaration -->
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
<!--
When present, all use declarations MUST go after the namespace
declaration. There MUST be one use keyword per declaration and
there MUST be one blank line after the use block -->
<rule ref="PSR2.Namespaces.UseDeclaration"/>
<!--
Visibility MUST be declared on all properties, the "var" keyword
is prohibited. There MUST NOT be more than one property declared
per statement. Property names SHOULD NOT be prefixed with a single
underscore to indicate protected or private visibility -->
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<!--
Visibility MUST be declared on all methods -->
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<!--
Method names SHOULD NOT be prefixed with a single underscore to
indicate protected or private visibility.
When present, the abstract and final declarations MUST precede the
visibility declaration. When present, the static declaration MUST
come after the visibility declaration -->
<rule ref="PSR2.Methods.MethodDeclaration"/>
<!--
Method names MUST NOT be declared with a space after the method
name. The opening brace MUST go on its own line, and the closing
brace MUST go on the next line following the body. There MUST NOT
be a space after the opening parenthesis, and there MUST NOT be a
space before the closing parenthesis -->
<rule ref="Squiz.Functions.FunctionDeclaration"/>
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
<!--
In the argument list, there MUST NOT be a space before each comma,
and there MUST be one space after each comma -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<!--
Method arguments with default values MUST go at the end of the
argument list -->
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<!--
When making a method or function call, there MUST NOT be a space
between the method or function name and the opening parenthesis,
there MUST NOT be a space after the opening parenthesis, and there
MUST NOT be a space before the closing parenthesis. In the argument
list, there MUST NOT be a space before each comma, and there MUST
be one space after each comma -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<!--
Argument lists MAY be split across multiple lines, where each
subsequent line is indented once. When doing so, the first item
in the list MUST be on the next line -->
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="true"/>
</properties>
</rule>
<!--
The general style rules for control structures are as follows:
There MUST be one space after the control structure keyword, there
MUST NOT be a space after the opening parenthesis, there MUST NOT
be a space before the closing parenthesis, there MUST be one space
between the closing parenthesis and the opening brace, the structure
body MUST be indented once, and the closing brace MUST be on the next
line after the body -->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
<!--
Within this standard there are some rather exotic control
structure patterns white-listed within the implementation of the
Lousson_Sniffs_ControlStructures_ControlSignatureSniff -->
<rule ref="Lousson.ControlStructures.ControlSignature"/>
</ruleset>
| {
"content_hash": "c1ed4612a6f1f73dd949a872f94c5546",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 73,
"avg_line_length": 38.328947368421055,
"alnum_prop": 0.7143837967730862,
"repo_name": "lousson/sniffs",
"id": "bc23b10a0d156e4a86570fc62ea649bf2f8b49b1",
"size": "5826",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/php/Lousson/ruleset.xml",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "PHP",
"bytes": "19439"
}
],
"symlink_target": ""
} |
//-----------------------------------------------------------------------------
//Copyright (c) 2014 Peter Lama
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef NODE_H
#define NODE_H
namespace sg {
class Renderer;
/**
* Base class for all scene graph nodes.
* For nodes that can have children, see GroupNode.
*/
class Node
{
public:
Node();
virtual ~Node();
unsigned int id();
Node* parent();
void setParent(Node* parent);
/**
* Called once before render. By default, does nothing.
*/
virtual void renderInit(Renderer* renderer);
/**
* All subclasses must define how to render themselves.
*/
virtual void render(Renderer* renderer) = 0;
protected:
bool needsRendering();
void setNeedsRendering(bool needsRendering);
private:
unsigned int generateUid();
Node* m_parent;
bool m_needsRendering;
unsigned int m_id;
};
}
#endif // NODE_H | {
"content_hash": "4dcb5f00d9525c9776019e5224ae3fc9",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 28.7,
"alnum_prop": 0.6699850671976108,
"repo_name": "peterl94/SMeshViewer",
"id": "f563ec1cdc71083756f1ba314a307518ef65cb27",
"size": "2009",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/SceneGraph/Node.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "8619"
},
{
"name": "C++",
"bytes": "2360144"
},
{
"name": "CSS",
"bytes": "32534"
},
{
"name": "JavaScript",
"bytes": "3265"
},
{
"name": "Objective-C",
"bytes": "8432"
}
],
"symlink_target": ""
} |
/**@file
*
* @defgroup nrf_dfu_transport DFU transport API.
* @{
*
* @brief DFU transport module interface.
*/
#ifndef DFU_TRANSPORT_H__
#define DFU_TRANSPORT_H__
#include <stdint.h>
/**@brief Function for starting the update of Device Firmware.
*
* @retval NRF_SUCCESS Operation success.
*/
uint32_t dfu_transport_update_start(void);
/**@brief Function for closing the transport layer.
*
* @retval NRF_SUCCESS Operation success.
*/
uint32_t dfu_transport_close(void);
#endif // DFU_TRANSPORT_H__
/**@} */
| {
"content_hash": "4578ffbfe2b34dcb6dc9a3e911e86e03",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 62,
"avg_line_length": 18.033333333333335,
"alnum_prop": 0.6635859519408502,
"repo_name": "kevin-ledinh/banana-tree",
"id": "130beb3800d06ca01ffa18170c202aa9b16d515f",
"size": "979",
"binary": false,
"copies": "17",
"ref": "refs/heads/master",
"path": "sw/nRF51_SDK_10.0.0_dc26b5e/components/libraries/bootloader_dfu/dfu_transport.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "906946"
},
{
"name": "Batchfile",
"bytes": "42"
},
{
"name": "C",
"bytes": "20436653"
},
{
"name": "C++",
"bytes": "2892120"
},
{
"name": "Eagle",
"bytes": "8929649"
},
{
"name": "Java",
"bytes": "230552"
},
{
"name": "Makefile",
"bytes": "4663424"
},
{
"name": "Objective-C",
"bytes": "34966"
},
{
"name": "Python",
"bytes": "43188"
},
{
"name": "Tcl",
"bytes": "1944"
}
],
"symlink_target": ""
} |
@interface MLTableViewController : MLViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, readwrite, strong) IBOutlet UITableView * tableView;
@property (nonatomic, readwrite, assign) BOOL clearsSelectionOnViewWillAppear;
@property (nonatomic, readwrite, assign) BOOL clearsSelectionOnReloadData;
@property (nonatomic, readwrite, assign) BOOL reloadOnCurrentLocaleChange;
@property (nonatomic, readwrite, assign) BOOL reloadOnAppearsFirstTime;
@property (nonatomic, readwrite, assign) BOOL showsBackgroundView;
- (instancetype)initWithStyle:(UITableViewStyle)style;
- (void)setNeedsReload;
- (BOOL)needsReload;
- (void)reloadIfNeeded;
- (void)reloadIfVisible;
- (void)reloadData;
@end
@interface MLTableViewController (MLSubclassOnly)
+ (UITableViewStyle)defaultTableViewStyle;
+ (UIEdgeInsets)defaultTableViewInset;
- (void)finishInitialize NS_REQUIRES_SUPER;
- (UIView *)backgroundViewForTableView:(UITableView *)tableView;
@end
| {
"content_hash": "4fd90b4d073a3c1f8bf3a94d66b61a17",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 96,
"avg_line_length": 33.41379310344828,
"alnum_prop": 0.8163054695562435,
"repo_name": "achimk/MLOperations",
"id": "1cee81c9a0d525271d77e00b1ba61702a137b2d5",
"size": "1158",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "MLOperations/MLOperations/Controllers/MLTableViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "81286"
}
],
"symlink_target": ""
} |
package com.github.dannil.scbjavaclient.client.businessactivities.database;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.github.dannil.scbjavaclient.client.AbstractClient;
import com.github.dannil.scbjavaclient.communication.URLEndpoint;
import com.github.dannil.scbjavaclient.constants.APIConstants;
import com.github.dannil.scbjavaclient.model.ResponseModel;
/**
* <p>Client which handles business activities database data fetching.</p>
*
* @since 0.3.0
*/
public class BusinessActivitiesDatabaseClient extends AbstractClient {
/**
* <p>Default constructor.</p>
*/
public BusinessActivitiesDatabaseClient() {
super();
}
/**
* <p>Overloaded constructor.</p>
*
* @param locale
* the <code>Locale</code> for this client
*/
public BusinessActivitiesDatabaseClient(Locale locale) {
super(locale);
}
/**
* <p>Fetch all enterprises and employees (SNI 2002) data.</p>
*
* @return the data wrapped in a list of
* {@link com.github.dannil.scbjavaclient.model.ResponseModel ResponseModel}
* objects
*
* @see #getEnterprisesAndEmployeesSNI2002(Collection, Collection, Collection)
*/
public List<ResponseModel> getEnterprisesAndEmployeesSNI2002() {
return getEnterprisesAndEmployeesSNI2002(null, null, null);
}
/**
* <p>Fetch all enterprises and employees (SNI 2002) data which match the input
* constraints.</p>
*
* @param industrialClassifications
* the industrial classifications
* @param sizeClasses
* the size classes
* @param years
* the years
* @return the data wrapped in a list of
* {@link com.github.dannil.scbjavaclient.model.ResponseModel ResponseModel}
* objects
*/
public List<ResponseModel> getEnterprisesAndEmployeesSNI2002(Collection<String> industrialClassifications,
Collection<String> sizeClasses, Collection<Integer> years) {
Map<String, Collection<?>> mappings = new HashMap<>();
mappings.put(APIConstants.SNI2002_CODE, industrialClassifications);
mappings.put(APIConstants.SIZECLASS_CODE, sizeClasses);
mappings.put(APIConstants.TIME_CODE, years);
return getResponseModels("FDBR", mappings);
}
/**
* <p>Fetch all enterprises and employees (SNI 2007) data.</p>
*
* @return the data wrapped in a list of
* {@link com.github.dannil.scbjavaclient.model.ResponseModel ResponseModel}
* objects
* @see #getEnterprisesAndEmployeesSNI2007(Collection, Collection, Collection)
*/
public List<ResponseModel> getEnterprisesAndEmployeesSNI2007() {
return getEnterprisesAndEmployeesSNI2007(null, null, null);
}
/**
* <p>Fetch all enterprises and employees (SNI 2007) data which match the input
* constraints.</p>
*
* @param industrialClassifications
* the industrial classifications
* @param sizeClasses
* the size classes
* @param years
* the years
* @return the data wrapped in a list of
* {@link com.github.dannil.scbjavaclient.model.ResponseModel ResponseModel}
* objects
*/
public List<ResponseModel> getEnterprisesAndEmployeesSNI2007(Collection<String> industrialClassifications,
Collection<String> sizeClasses, Collection<Integer> years) {
Map<String, Collection<?>> mappings = new HashMap<>();
mappings.put(APIConstants.SNI2007_CODE, industrialClassifications);
mappings.put(APIConstants.SIZECLASS_CODE, sizeClasses);
mappings.put(APIConstants.TIME_CODE, years);
return getResponseModels("FDBR07", mappings);
}
@Override
public URLEndpoint getUrl() {
return getRootUrl().append("NV/NV0101/");
}
}
| {
"content_hash": "6e878f0a33f13418491ef951f0f287b6",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 110,
"avg_line_length": 34.07627118644068,
"alnum_prop": 0.6652573986570505,
"repo_name": "dannil/scb-java-client",
"id": "570df802d3bbef5e41339769723d89a83140f74a",
"size": "4608",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/main/java/com/github/dannil/scbjavaclient/client/businessactivities/database/BusinessActivitiesDatabaseClient.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2119804"
},
{
"name": "Shell",
"bytes": "659"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe Spree::Admin::SearchController do
stub_authorization!
let(:user) { create(:user) }
before do
user.ship_address = create(:address)
user.bill_address = create(:address)
user.save
end
it "can find a user by their email "do
spree_xhr_get :users, :q => user.email
assigns[:users].should include(user)
end
it "can find a user by their ship address's first name" do
spree_xhr_get :users, :q => user.ship_address.firstname
assigns[:users].should include(user)
end
it "can find a user by their ship address's last name" do
spree_xhr_get :users, :q => user.ship_address.lastname
assigns[:users].should include(user)
end
it "can find a user by their bill address's first name" do
spree_xhr_get :users, :q => user.bill_address.firstname
assigns[:users].should include(user)
end
it "can find a user by their bill address's last name" do
spree_xhr_get :users, :q => user.bill_address.lastname
assigns[:users].should include(user)
end
end
| {
"content_hash": "884bf69db84a4332d04ce5b912253dbd",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 60,
"avg_line_length": 27.44736842105263,
"alnum_prop": 0.6855225311601151,
"repo_name": "ambertch/stylestalk-spree",
"id": "4dfe2e6a9289a27dbf21cc2ddb12e4c81d72265c",
"size": "1043",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/spec/controllers/spree/admin/search_controller_spec.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CoffeeScript",
"bytes": "5924"
},
{
"name": "JavaScript",
"bytes": "22303"
},
{
"name": "Ruby",
"bytes": "1032474"
},
{
"name": "Shell",
"bytes": "358"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--L
Copyright Northwestern University.
Distributed under the OSI-approved BSD 3-Clause License.
See http://ncip.github.io/psc/LICENSE.txt for details.
L-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
">
<bean id="completeAuthenticationSystem"
class="edu.northwestern.bioinformatics.studycalendar.security.internal.CompleteAuthenticationSystemImpl">
<property name="filters">
<list>
<ref bean="logInfoFilter"/>
<ref bean="httpSessionContextIntegrationFilter"/>
<ref bean="securityContextReloadFilter"/>
<ref bean="authenticationSystemLogoutFilter"/>
<ref bean="apiAuthenticationFilter"/>
<ref bean="authenticationSystemSocket"/>
<ref bean="authenticationLogInfoFilter"/>
<ref bean="exceptionTranslationFilter"/>
<ref bean="filterInvocationInterceptor"/>
</list>
</property>
<property name="configuration" ref="authenticationSystemConfiguration"/>
</bean>
<bean id="authenticationSystemConfiguration"
class="edu.northwestern.bioinformatics.studycalendar.security.AuthenticationSystemConfiguration"/>
<bean id="authenticationSystemSocket"
class="edu.northwestern.bioinformatics.studycalendar.security.internal.AuthenticationSystemSocket">
<property name="configuration" ref="authenticationSystemConfiguration"/>
</bean>
<bean id="httpSessionContextIntegrationFilter"
class="org.acegisecurity.context.HttpSessionContextIntegrationFilter"/>
<bean id="securityContextReloadFilter"
class="edu.northwestern.bioinformatics.studycalendar.security.internal.SecurityContextReloadFilter">
<property name="pscUserDetailsService" ref="pscUserDetailsService"/>
</bean>
<bean id="authenticationSystemLogoutFilter"
class="edu.northwestern.bioinformatics.studycalendar.security.internal.AuthenticationSystemLogoutFilter">
<property name="authenticationSystemConfiguration" ref="authenticationSystemConfiguration"/>
<property name="defaultLogoutFilter" ref="defaultLogoutFilter"/>
</bean>
<bean id="defaultLogoutFilter"
class="org.acegisecurity.ui.logout.LogoutFilter">
<!-- URL redirected to after logout -->
<constructor-arg value="/"/>
<constructor-arg>
<list>
<bean class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler"/>
</list>
</constructor-arg>
<property name="filterProcessesUrl" value="/auth/logout"/>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>
<bean id="userCache"
class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
<property name="cache">
<bean class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager" ref="cacheManager"/>
<property name="cacheName" value="userCache"/>
</bean>
</property>
</bean>
<bean id="anonymousProcessingFilter"
class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
<property name="key" value="PSC_ANON"/>
<property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/>
</bean>
<bean id="exceptionTranslationFilter"
class="org.acegisecurity.ui.ExceptionTranslationFilter">
<property name="authenticationEntryPoint" ref="authenticationSystemSocket"/>
</bean>
<bean id="filterInvocationInterceptor"
class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationSystemSocket"/>
<property name="accessDecisionManager">
<ref local="accessDecisionManager"/>
</property>
<!-- session authentication enforced for UI only -->
<!-- authorization is handled elsewhere -->
<property name="objectDefinitionSource">
<value>
PATTERN_TYPE_APACHE_ANT
/pages/**=IS_AUTHENTICATED_FULLY
</value>
</property>
</bean>
<bean id="apiAuthenticationFilter"
class="edu.northwestern.bioinformatics.studycalendar.security.internal.ApiAuthenticationFilter">
<property name="authenticationSystemConfiguration" ref="authenticationSystemConfiguration"/>
</bean>
<bean id="logInfoFilter"
class="edu.northwestern.bioinformatics.studycalendar.tools.HttpRequestLogInfoFilter"/>
<bean id="authenticationLogInfoFilter"
class="edu.northwestern.bioinformatics.studycalendar.security.internal.AuthenticationLogInfoFilter"/>
<bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
<property name="decisionVoters">
<list>
<bean class="org.acegisecurity.vote.AuthenticatedVoter"/>
</list>
</property>
</bean>
</beans> | {
"content_hash": "abd250df9b1efa2dda61af89d9fd066a",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 115,
"avg_line_length": 43.088,
"alnum_prop": 0.6721128852580764,
"repo_name": "NCIP/psc",
"id": "ed61eceb71565deb1b2ce643ddc223eadf580572",
"size": "5386",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "authentication/socket/src/main/resources/META-INF/spring/bundle-context.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Groovy",
"bytes": "169396"
},
{
"name": "Java",
"bytes": "6565287"
},
{
"name": "JavaScript",
"bytes": "809902"
},
{
"name": "Ruby",
"bytes": "381123"
},
{
"name": "Shell",
"bytes": "364"
},
{
"name": "XML",
"bytes": "227992"
}
],
"symlink_target": ""
} |
function plotAndSaveHSV(imgH, imgS, imgV, figVisEnable, titleStr, outputPath,fileType)
% h = figure;set(h, 'Visible', figVisEnable);
% imshow(uint8(hsv2rgb(cat(3,imgH,imgS,imgV))))
% title(titleStr);
% if ~isempty(outputPath)
% saveas(h,outputPath,fileType);
% end
imgV(imgV>255)= 255;
imwrite(uint8(hsv2rgb(cat(3,imgH,imgS,imgV))),[outputPath '.' fileType],fileType); | {
"content_hash": "a0fda51ac0ee76a3816150d5f048f275",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 86,
"avg_line_length": 41.44444444444444,
"alnum_prop": 0.7265415549597856,
"repo_name": "orlyliba/OCT_Reconstruction_and_Spectral_Analysis",
"id": "17021f33530a78ce53645bf5a0f860fc8ce4caeb",
"size": "373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "functions/plotAndSaveHSV.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "M",
"bytes": "56"
},
{
"name": "Matlab",
"bytes": "291762"
}
],
"symlink_target": ""
} |
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat.Listing;
using osu.Game.Users.Drawables;
using osuTK;
namespace osu.Game.Overlays.Chat.ChannelList
{
public class ChannelListItem : OsuClickableContainer
{
public event Action<Channel>? OnRequestSelect;
public event Action<Channel>? OnRequestLeave;
public readonly Channel Channel;
public readonly BindableInt Mentions = new BindableInt();
public readonly BindableBool Unread = new BindableBool();
private Box hoverBox = null!;
private Box selectBox = null!;
private OsuSpriteText text = null!;
private ChannelListItemCloseButton? close;
[Resolved]
private Bindable<Channel> selectedChannel { get; set; } = null!;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public ChannelListItem(Channel channel)
{
Channel = channel;
}
[BackgroundDependencyLoader]
private void load()
{
Height = 30;
RelativeSizeAxes = Axes.X;
Children = new Drawable[]
{
hoverBox = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background3,
Alpha = 0f,
},
selectBox = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4,
Alpha = 0f,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 18, Right = 10 },
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable?[]
{
createIcon(),
text = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = Channel.Name,
Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold),
Colour = colourProvider.Light3,
Margin = new MarginPadding { Bottom = 2 },
RelativeSizeAxes = Axes.X,
Truncate = true,
},
createMentionPill(),
close = createCloseButton(),
}
},
},
},
};
Action = () => OnRequestSelect?.Invoke(Channel);
}
protected override void LoadComplete()
{
base.LoadComplete();
selectedChannel.BindValueChanged(_ => updateState(), true);
Unread.BindValueChanged(_ => updateState(), true);
}
protected override bool OnHover(HoverEvent e)
{
hoverBox.FadeIn(300, Easing.OutQuint);
close?.FadeIn(300, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
hoverBox.FadeOut(200, Easing.OutQuint);
close?.FadeOut(200, Easing.OutQuint);
base.OnHoverLost(e);
}
private UpdateableAvatar? createIcon()
{
if (Channel.Type != ChannelType.PM)
return null;
return new UpdateableAvatar(Channel.Users.First(), isInteractive: false)
{
Size = new Vector2(20),
Margin = new MarginPadding { Right = 5 },
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
CornerRadius = 10,
Masking = true,
};
}
private ChannelListItemMentionPill? createMentionPill()
{
if (isSelector)
return null;
return new ChannelListItemMentionPill
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Right = 3 },
Mentions = { BindTarget = Mentions },
};
}
private ChannelListItemCloseButton? createCloseButton()
{
if (isSelector)
return null;
return new ChannelListItemCloseButton
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Right = 3 },
Action = () => OnRequestLeave?.Invoke(Channel),
};
}
private void updateState()
{
bool selected = selectedChannel.Value == Channel;
if (selected)
selectBox.FadeIn(300, Easing.OutQuint);
else
selectBox.FadeOut(200, Easing.OutQuint);
if (Unread.Value || selected)
text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint);
else
text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint);
}
private bool isSelector => Channel is ChannelListing.ChannelListingChannel;
}
}
| {
"content_hash": "9bbf2d92693cbd2807b17db1352aefdd",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 101,
"avg_line_length": 33.020833333333336,
"alnum_prop": 0.48832807570977915,
"repo_name": "NeoAdonis/osu",
"id": "9ab0c2792acd35dd011e9ab3caaebdea147385c1",
"size": "6508",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "12741336"
},
{
"name": "GLSL",
"bytes": "230"
},
{
"name": "PowerShell",
"bytes": "468"
},
{
"name": "Ruby",
"bytes": "4185"
},
{
"name": "Shell",
"bytes": "258"
}
],
"symlink_target": ""
} |
"""
Cache driver that uses SQLite to store information about cached images
"""
from __future__ import absolute_import
from contextlib import contextmanager
import os
import sqlite3
import stat
import time
from eventlet import sleep
from eventlet import timeout
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from glance.common import exception
from glance.i18n import _, _LE, _LI, _LW
from glance.image_cache.drivers import base
LOG = logging.getLogger(__name__)
sqlite_opts = [
cfg.StrOpt('image_cache_sqlite_db', default='cache.db',
help=_('The path to the sqlite file database that will be '
'used for image cache management.')),
]
CONF = cfg.CONF
CONF.register_opts(sqlite_opts)
DEFAULT_SQL_CALL_TIMEOUT = 2
class SqliteConnection(sqlite3.Connection):
"""
SQLite DB Connection handler that plays well with eventlet,
slightly modified from Swift's similar code.
"""
def __init__(self, *args, **kwargs):
self.timeout_seconds = kwargs.get('timeout', DEFAULT_SQL_CALL_TIMEOUT)
kwargs['timeout'] = 0
sqlite3.Connection.__init__(self, *args, **kwargs)
def _timeout(self, call):
with timeout.Timeout(self.timeout_seconds):
while True:
try:
return call()
except sqlite3.OperationalError as e:
if 'locked' not in str(e):
raise
sleep(0.05)
def execute(self, *args, **kwargs):
return self._timeout(lambda: sqlite3.Connection.execute(
self, *args, **kwargs))
def commit(self):
return self._timeout(lambda: sqlite3.Connection.commit(self))
def dict_factory(cur, row):
return {col[0]: row[idx] for idx, col in enumerate(cur.description)}
class Driver(base.Driver):
"""
Cache driver that uses xattr file tags and requires a filesystem
that has atimes set.
"""
def configure(self):
"""
Configure the driver to use the stored configuration options
Any store that needs special configuration should implement
this method. If the store was not able to successfully configure
itself, it should raise `exception.BadDriverConfiguration`
"""
super(Driver, self).configure()
# Create the SQLite database that will hold our cache attributes
self.initialize_db()
def initialize_db(self):
db = CONF.image_cache_sqlite_db
self.db_path = os.path.join(self.base_dir, db)
try:
conn = sqlite3.connect(self.db_path, check_same_thread=False,
factory=SqliteConnection)
conn.executescript("""
CREATE TABLE IF NOT EXISTS cached_images (
image_id TEXT PRIMARY KEY,
last_accessed REAL DEFAULT 0.0,
last_modified REAL DEFAULT 0.0,
size INTEGER DEFAULT 0,
hits INTEGER DEFAULT 0,
checksum TEXT
);
""")
conn.close()
except sqlite3.DatabaseError as e:
msg = _("Failed to initialize the image cache database. "
"Got error: %s") % e
LOG.error(msg)
raise exception.BadDriverConfiguration(driver_name='sqlite',
reason=msg)
def get_cache_size(self):
"""
Returns the total size in bytes of the image cache.
"""
sizes = []
for path in self.get_cache_files(self.base_dir):
if path == self.db_path:
continue
file_info = os.stat(path)
sizes.append(file_info[stat.ST_SIZE])
return sum(sizes)
def get_hit_count(self, image_id):
"""
Return the number of hits that an image has.
:param image_id: Opaque image identifier
"""
if not self.is_cached(image_id):
return 0
hits = 0
with self.get_db() as db:
cur = db.execute("""SELECT hits FROM cached_images
WHERE image_id = ?""",
(image_id,))
hits = cur.fetchone()[0]
return hits
def get_cached_images(self):
"""
Returns a list of records about cached images.
"""
LOG.debug("Gathering cached image entries.")
with self.get_db() as db:
cur = db.execute("""SELECT
image_id, hits, last_accessed, last_modified, size
FROM cached_images
ORDER BY image_id""")
cur.row_factory = dict_factory
return [r for r in cur]
def is_cached(self, image_id):
"""
Returns True if the image with the supplied ID has its image
file cached.
:param image_id: Image ID
"""
return os.path.exists(self.get_image_filepath(image_id))
def is_cacheable(self, image_id):
"""
Returns True if the image with the supplied ID can have its
image file cached, False otherwise.
:param image_id: Image ID
"""
# Make sure we're not already cached or caching the image
return not (self.is_cached(image_id) or
self.is_being_cached(image_id))
def is_being_cached(self, image_id):
"""
Returns True if the image with supplied id is currently
in the process of having its image file cached.
:param image_id: Image ID
"""
path = self.get_image_filepath(image_id, 'incomplete')
return os.path.exists(path)
def is_queued(self, image_id):
"""
Returns True if the image identifier is in our cache queue.
:param image_id: Image ID
"""
path = self.get_image_filepath(image_id, 'queue')
return os.path.exists(path)
def delete_all_cached_images(self):
"""
Removes all cached image files and any attributes about the images
"""
deleted = 0
with self.get_db() as db:
for path in self.get_cache_files(self.base_dir):
delete_cached_file(path)
deleted += 1
db.execute("""DELETE FROM cached_images""")
db.commit()
return deleted
def delete_cached_image(self, image_id):
"""
Removes a specific cached image file and any attributes about the image
:param image_id: Image ID
"""
path = self.get_image_filepath(image_id)
with self.get_db() as db:
delete_cached_file(path)
db.execute("""DELETE FROM cached_images WHERE image_id = ?""",
(image_id, ))
db.commit()
def delete_all_queued_images(self):
"""
Removes all queued image files and any attributes about the images
"""
files = [f for f in self.get_cache_files(self.queue_dir)]
for file in files:
os.unlink(file)
return len(files)
def delete_queued_image(self, image_id):
"""
Removes a specific queued image file and any attributes about the image
:param image_id: Image ID
"""
path = self.get_image_filepath(image_id, 'queue')
if os.path.exists(path):
os.unlink(path)
def clean(self, stall_time=None):
"""
Delete any image files in the invalid directory and any
files in the incomplete directory that are older than a
configurable amount of time.
"""
self.delete_invalid_files()
if stall_time is None:
stall_time = CONF.image_cache_stall_time
now = time.time()
older_than = now - stall_time
self.delete_stalled_files(older_than)
def get_least_recently_accessed(self):
"""
Return a tuple containing the image_id and size of the least recently
accessed cached file, or None if no cached files.
"""
with self.get_db() as db:
cur = db.execute("""SELECT image_id FROM cached_images
ORDER BY last_accessed LIMIT 1""")
try:
image_id = cur.fetchone()[0]
except TypeError:
# There are no more cached images
return None
path = self.get_image_filepath(image_id)
try:
file_info = os.stat(path)
size = file_info[stat.ST_SIZE]
except OSError:
size = 0
return image_id, size
@contextmanager
def open_for_write(self, image_id):
"""
Open a file for writing the image file for an image
with supplied identifier.
:param image_id: Image ID
"""
incomplete_path = self.get_image_filepath(image_id, 'incomplete')
def commit():
with self.get_db() as db:
final_path = self.get_image_filepath(image_id)
LOG.debug("Fetch finished, moving "
"'%(incomplete_path)s' to '%(final_path)s'",
dict(incomplete_path=incomplete_path,
final_path=final_path))
os.rename(incomplete_path, final_path)
# Make sure that we "pop" the image from the queue...
if self.is_queued(image_id):
os.unlink(self.get_image_filepath(image_id, 'queue'))
filesize = os.path.getsize(final_path)
now = time.time()
db.execute("""INSERT INTO cached_images
(image_id, last_accessed, last_modified, hits, size)
VALUES (?, ?, ?, 0, ?)""",
(image_id, now, now, filesize))
db.commit()
def rollback(e):
with self.get_db() as db:
if os.path.exists(incomplete_path):
invalid_path = self.get_image_filepath(image_id, 'invalid')
LOG.warn(_LW("Fetch of cache file failed (%(e)s), rolling "
"back by moving '%(incomplete_path)s' to "
"'%(invalid_path)s'") %
{'e': e,
'incomplete_path': incomplete_path,
'invalid_path': invalid_path})
os.rename(incomplete_path, invalid_path)
db.execute("""DELETE FROM cached_images
WHERE image_id = ?""", (image_id, ))
db.commit()
try:
with open(incomplete_path, 'wb') as cache_file:
yield cache_file
except Exception as e:
with excutils.save_and_reraise_exception():
rollback(e)
else:
commit()
finally:
# if the generator filling the cache file neither raises an
# exception, nor completes fetching all data, neither rollback
# nor commit will have been called, so the incomplete file
# will persist - in that case remove it as it is unusable
# example: ^c from client fetch
if os.path.exists(incomplete_path):
rollback('incomplete fetch')
@contextmanager
def open_for_read(self, image_id):
"""
Open and yield file for reading the image file for an image
with supplied identifier.
:param image_id: Image ID
"""
path = self.get_image_filepath(image_id)
with open(path, 'rb') as cache_file:
yield cache_file
now = time.time()
with self.get_db() as db:
db.execute("""UPDATE cached_images
SET hits = hits + 1, last_accessed = ?
WHERE image_id = ?""",
(now, image_id))
db.commit()
@contextmanager
def get_db(self):
"""
Returns a context manager that produces a database connection that
self-closes and calls rollback if an error occurs while using the
database connection
"""
conn = sqlite3.connect(self.db_path, check_same_thread=False,
factory=SqliteConnection)
conn.row_factory = sqlite3.Row
conn.text_factory = str
conn.execute('PRAGMA synchronous = NORMAL')
conn.execute('PRAGMA count_changes = OFF')
conn.execute('PRAGMA temp_store = MEMORY')
try:
yield conn
except sqlite3.DatabaseError as e:
msg = _LE("Error executing SQLite call. Got error: %s") % e
LOG.error(msg)
conn.rollback()
finally:
conn.close()
def queue_image(self, image_id):
"""
This adds a image to be cache to the queue.
If the image already exists in the queue or has already been
cached, we return False, True otherwise
:param image_id: Image ID
"""
if self.is_cached(image_id):
LOG.info(_LI("Not queueing image '%s'. Already cached."), image_id)
return False
if self.is_being_cached(image_id):
LOG.info(_LI("Not queueing image '%s'. Already being "
"written to cache"), image_id)
return False
if self.is_queued(image_id):
LOG.info(_LI("Not queueing image '%s'. Already queued."), image_id)
return False
path = self.get_image_filepath(image_id, 'queue')
# Touch the file to add it to the queue
with open(path, "w"):
pass
return True
def delete_invalid_files(self):
"""
Removes any invalid cache entries
"""
for path in self.get_cache_files(self.invalid_dir):
os.unlink(path)
LOG.info(_LI("Removed invalid cache file %s"), path)
def delete_stalled_files(self, older_than):
"""
Removes any incomplete cache entries older than a
supplied modified time.
:param older_than: Files written to on or before this timestamp
will be deleted.
"""
for path in self.get_cache_files(self.incomplete_dir):
if os.path.getmtime(path) < older_than:
try:
os.unlink(path)
LOG.info(_LI("Removed stalled cache file %s"), path)
except Exception as e:
msg = (_LW("Failed to delete file %(path)s. "
"Got error: %(e)s"),
dict(path=path, e=e))
LOG.warn(msg)
def get_queued_images(self):
"""
Returns a list of image IDs that are in the queue. The
list should be sorted by the time the image ID was inserted
into the queue.
"""
files = [f for f in self.get_cache_files(self.queue_dir)]
items = []
for path in files:
mtime = os.path.getmtime(path)
items.append((mtime, os.path.basename(path)))
items.sort()
return [image_id for (modtime, image_id) in items]
def get_cache_files(self, basepath):
"""
Returns cache files in the supplied directory
:param basepath: Directory to look in for cache files
"""
for fname in os.listdir(basepath):
path = os.path.join(basepath, fname)
if path != self.db_path and os.path.isfile(path):
yield path
def delete_cached_file(path):
if os.path.exists(path):
LOG.debug("Deleting image cache file '%s'", path)
os.unlink(path)
else:
LOG.warn(_LW("Cached image file '%s' doesn't exist, unable to"
" delete") % path)
| {
"content_hash": "121bf7ee76e5185034ac9417ab31407e",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 79,
"avg_line_length": 33.78902953586498,
"alnum_prop": 0.5427072927072927,
"repo_name": "klmitch/glance",
"id": "e30b59efa51cbcb99df37c1dd66f43ebeb8dc8e2",
"size": "16652",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "glance/image_cache/drivers/sqlite.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "4140950"
},
{
"name": "Shell",
"bytes": "7753"
}
],
"symlink_target": ""
} |
#import "RCTBridgeModule.h"
#import "RCTURLRequestDelegate.h"
/**
* Provides the interface needed to register a request handler. Request handlers
* are also bridge modules, so should be registered using RCT_EXPORT_MODULE().
*/
@protocol RCTURLRequestHandler <RCTBridgeModule>
/**
* Indicates whether this handler is capable of processing the specified
* request. Typically the handler would examine the scheme/protocol of the
* request URL (and possibly the HTTP method and/or headers) to determine this.
*/
- (BOOL)canHandleRequest:(NSURLRequest *)request;
/**
* Send a network request and call the delegate with the response data. The
* method should return a token, which can be anything, including the request
* itself. This will be used later to refer to the request in callbacks. The
* `sendRequest:withDelegate:` method *must* return before calling any of the
* delegate methods, or the delegate won't recognize the token.
*
* This method will be called from the module's methodQueue if set.
*/
- (id)sendRequest:(NSURLRequest *)request
withDelegate:(id<RCTURLRequestDelegate>)delegate;
@optional
/**
* Not all request types can be cancelled, but this method can be implemented
* for ones that can. It should be used to free up any resources on ongoing
* processes associated with the request.
*
* You must call the delegate's URLRequest:didCompleteWithError: method with an
* appropriate error after cancellation completes.
*
* This method can be called from any thread.
*/
- (void)cancelRequest:(id)requestToken;
/**
* If more than one RCTURLRequestHandler responds YES to `canHandleRequest:`
* then `handlerPriority` is used to determine which one to use. The handler
* with the highest priority will be selected. Default priority is zero. If
* two or more valid handlers have the same priority, the selection order is
* undefined.
*/
- (float)handlerPriority;
@end
| {
"content_hash": "7d5d7e9da45deb51b10d521a298ed4af",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 80,
"avg_line_length": 35.55555555555556,
"alnum_prop": 0.7583333333333333,
"repo_name": "15chrjef/mobileHackerNews",
"id": "c65c6bfd052235d76b7c819e3e044cc7ff35d18c",
"size": "2228",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/react-native/React/Base/RCTURLRequestHandler.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "18044"
}
],
"symlink_target": ""
} |
DECLARE_LOG_CATEGORY_EXTERN(LogCharacterAI, Verbose, All);
| {
"content_hash": "1cb60e524253555c6c9be1e0037fe237",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 58,
"avg_line_length": 30,
"alnum_prop": 0.8,
"repo_name": "PopCap/GameIdea",
"id": "5e1fce462f4250a38e6ad54b1ff20f86f5f5a576",
"size": "240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Engine/Plugins/Experimental/CharacterAI/Source/CharacterAI/Private/CharacterAIPrivatePCH.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": ""
} |
package org.visallo.web.routes.notification;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.visallo.webster.ParameterizedHandler;
import org.visallo.webster.annotations.Handle;
import org.visallo.webster.annotations.Required;
import org.visallo.core.exception.VisalloResourceNotFoundException;
import org.visallo.core.model.notification.SystemNotification;
import org.visallo.core.model.notification.SystemNotificationRepository;
import org.visallo.core.model.workQueue.WorkQueueRepository;
import org.visallo.core.user.User;
import org.visallo.web.VisalloResponse;
import org.visallo.web.clientapi.model.ClientApiSuccess;
@Singleton
public class SystemNotificationDelete implements ParameterizedHandler {
private final SystemNotificationRepository systemNotificationRepository;
private final WorkQueueRepository workQueueRepository;
@Inject
public SystemNotificationDelete(
final SystemNotificationRepository systemNotificationRepository,
final WorkQueueRepository workQueueRepository
) {
this.systemNotificationRepository = systemNotificationRepository;
this.workQueueRepository = workQueueRepository;
}
@Handle
public ClientApiSuccess handle(
@Required(name = "notificationId") String notificationId,
User user
) throws Exception {
SystemNotification notification = systemNotificationRepository.getNotification(notificationId, user);
if (notification == null) {
throw new VisalloResourceNotFoundException("Could not find notification with id: " + notificationId);
}
systemNotificationRepository.endNotification(notification, user);
workQueueRepository.pushSystemNotificationEnded(notificationId);
return VisalloResponse.SUCCESS;
}
}
| {
"content_hash": "bae2007baf2613c74aa7ef5393a74d39",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 113,
"avg_line_length": 41.77272727272727,
"alnum_prop": 0.7845484221980413,
"repo_name": "visallo/visallo",
"id": "d5b3c6b66bc11ddc20d0bf7b2c341fb78c141325",
"size": "1838",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/web-base/src/main/java/org/visallo/web/routes/notification/SystemNotificationDelete.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "205371"
},
{
"name": "Go",
"bytes": "2988"
},
{
"name": "HTML",
"bytes": "66006"
},
{
"name": "Java",
"bytes": "3686598"
},
{
"name": "JavaScript",
"bytes": "4648797"
},
{
"name": "Makefile",
"bytes": "623"
},
{
"name": "Shell",
"bytes": "17212"
}
],
"symlink_target": ""
} |
namespace cc {
// The frame index starts at 2 so that empty frames will be treated as
// completely damaged the first time they're drawn from.
static const int kFrameIndexStart = 2;
Surface::Surface(const SurfaceId& id, SurfaceFactory* factory)
: surface_id_(id),
previous_frame_surface_id_(id),
factory_(factory->AsWeakPtr()),
frame_index_(kFrameIndexStart),
destroyed_(false) {}
Surface::~Surface() {
ClearCopyRequests();
if (current_frame_.delegated_frame_data && factory_) {
UnrefFrameResources(current_frame_.delegated_frame_data.get());
}
if (!draw_callback_.is_null())
draw_callback_.Run();
}
void Surface::SetPreviousFrameSurface(Surface* surface) {
DCHECK(surface);
frame_index_ = surface->frame_index() + 1;
previous_frame_surface_id_ = surface->surface_id();
}
void Surface::QueueFrame(CompositorFrame frame, const DrawCallback& callback) {
DCHECK(factory_);
ClearCopyRequests();
if (frame.delegated_frame_data) {
TakeLatencyInfo(&frame.metadata.latency_info);
}
CompositorFrame previous_frame = std::move(current_frame_);
current_frame_ = std::move(frame);
if (current_frame_.delegated_frame_data) {
factory_->ReceiveFromChild(
current_frame_.delegated_frame_data->resource_list);
}
// Empty frames shouldn't be drawn and shouldn't contribute damage, so don't
// increment frame index for them.
if (current_frame_.delegated_frame_data &&
!current_frame_.delegated_frame_data->render_pass_list.empty()) {
++frame_index_;
}
previous_frame_surface_id_ = surface_id();
std::vector<SurfaceId> new_referenced_surfaces;
new_referenced_surfaces = current_frame_.metadata.referenced_surfaces;
if (previous_frame.delegated_frame_data)
UnrefFrameResources(previous_frame.delegated_frame_data.get());
if (!draw_callback_.is_null())
draw_callback_.Run();
draw_callback_ = callback;
bool referenced_surfaces_changed =
(referenced_surfaces_ != new_referenced_surfaces);
referenced_surfaces_ = new_referenced_surfaces;
std::vector<uint32_t> satisfies_sequences =
std::move(current_frame_.metadata.satisfies_sequences);
if (referenced_surfaces_changed || !satisfies_sequences.empty()) {
// Notify the manager that sequences were satisfied either if some new
// sequences were satisfied, or if the set of referenced surfaces changed
// to force a GC to happen.
factory_->manager()->DidSatisfySequences(surface_id_.client_id(),
&satisfies_sequences);
}
}
void Surface::RequestCopyOfOutput(
std::unique_ptr<CopyOutputRequest> copy_request) {
if (current_frame_.delegated_frame_data &&
!current_frame_.delegated_frame_data->render_pass_list.empty()) {
std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests =
current_frame_.delegated_frame_data->render_pass_list.back()
->copy_requests;
if (void* source = copy_request->source()) {
// Remove existing CopyOutputRequests made on the Surface by the same
// source.
auto to_remove =
std::remove_if(copy_requests.begin(), copy_requests.end(),
[source](const std::unique_ptr<CopyOutputRequest>& x) {
return x->source() == source;
});
copy_requests.erase(to_remove, copy_requests.end());
}
copy_requests.push_back(std::move(copy_request));
} else {
copy_request->SendEmptyResult();
}
}
void Surface::TakeCopyOutputRequests(
std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>*
copy_requests) {
DCHECK(copy_requests->empty());
if (current_frame_.delegated_frame_data) {
for (const auto& render_pass :
current_frame_.delegated_frame_data->render_pass_list) {
for (auto& request : render_pass->copy_requests) {
copy_requests->insert(
std::make_pair(render_pass->id, std::move(request)));
}
render_pass->copy_requests.clear();
}
}
}
const CompositorFrame& Surface::GetEligibleFrame() {
return current_frame_;
}
void Surface::TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info) {
if (!current_frame_.delegated_frame_data)
return;
if (latency_info->empty()) {
current_frame_.metadata.latency_info.swap(*latency_info);
return;
}
std::copy(current_frame_.metadata.latency_info.begin(),
current_frame_.metadata.latency_info.end(),
std::back_inserter(*latency_info));
current_frame_.metadata.latency_info.clear();
}
void Surface::RunDrawCallbacks() {
if (!draw_callback_.is_null()) {
DrawCallback callback = draw_callback_;
draw_callback_ = DrawCallback();
callback.Run();
}
}
void Surface::AddDestructionDependency(SurfaceSequence sequence) {
destruction_dependencies_.push_back(sequence);
}
void Surface::SatisfyDestructionDependencies(
std::unordered_set<SurfaceSequence, SurfaceSequenceHash>* sequences,
std::unordered_set<uint32_t>* valid_client_ids) {
destruction_dependencies_.erase(
std::remove_if(destruction_dependencies_.begin(),
destruction_dependencies_.end(),
[sequences, valid_client_ids](SurfaceSequence seq) {
return (!!sequences->erase(seq) ||
!valid_client_ids->count(seq.client_id));
}),
destruction_dependencies_.end());
}
void Surface::UnrefFrameResources(DelegatedFrameData* frame_data) {
ReturnedResourceArray resources;
TransferableResource::ReturnResources(frame_data->resource_list, &resources);
// No point in returning same sync token to sender.
for (auto& resource : resources)
resource.sync_token.Clear();
factory_->UnrefResources(resources);
}
void Surface::ClearCopyRequests() {
if (current_frame_.delegated_frame_data) {
for (const auto& render_pass :
current_frame_.delegated_frame_data->render_pass_list) {
for (const auto& copy_request : render_pass->copy_requests)
copy_request->SendEmptyResult();
}
}
}
} // namespace cc
| {
"content_hash": "5cda93850e6fe31e5ab137179b2d11f4",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 80,
"avg_line_length": 34.09444444444444,
"alnum_prop": 0.6677529737656835,
"repo_name": "danakj/chromium",
"id": "639a15ed7189aff19c6d14b287351113e6a3e838",
"size": "6648",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cc/surfaces/surface.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
"""
pycodeexport is a Python package for code generation.
"""
from __future__ import absolute_import, division, print_function
from ._release import __version__
from .dist import PCEExtension, pce_build_ext
| {
"content_hash": "7b72865ca5d08fd178ba2cbba0e133ff",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 64,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.7548076923076923,
"repo_name": "bjodah/pycodeexport",
"id": "f057ae9f07354f42e3d19eb168ec6f18b1fed964",
"size": "232",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pycodeexport/__init__.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Python",
"bytes": "30796"
},
{
"name": "Shell",
"bytes": "8982"
}
],
"symlink_target": ""
} |
package gov.hhs.fha.nhinc.patientdiscovery.aspect;
import gov.hhs.fha.nhinc.util.Base64Coder;
import java.util.ArrayList;
import java.util.List;
import org.hl7.v3.BinaryDataEncoding;
import org.hl7.v3.EDExplicit;
import org.hl7.v3.MCCIMT000300UV01Acknowledgement;
import org.hl7.v3.MCCIMT000300UV01AcknowledgementDetail;
import org.hl7.v3.PRPAIN201306UV02;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import java.util.HashSet;
import java.util.Set;
class PRPAIN201306UV02StatusExtractor implements Function<PRPAIN201306UV02, Set<String>> {
private static final PRPAIN201306UV02StatusExtractor.StatusFunction STATUS_FUNCTION = new StatusFunction();
@Override
public Set<String> apply(PRPAIN201306UV02 input) {
Set<String> statuses = new HashSet<String>();
for (MCCIMT000300UV01Acknowledgement acknowledgement : input.getAcknowledgement()) {
List<Optional<String>> tmp = Lists.transform(acknowledgement.getAcknowledgementDetail(), STATUS_FUNCTION);
statuses.addAll(Lists.newArrayList(Optional.presentInstances(tmp)));
}
return statuses;
}
private static class StatusFunction implements Function<MCCIMT000300UV01AcknowledgementDetail, Optional<String>> {
@Override
public Optional<String> apply(MCCIMT000300UV01AcknowledgementDetail detail) {
EDExplicit edExplicit = detail.getText();
if (edExplicit == null || edExplicit.getContent().size() == 0) {
return Optional.absent();
}
return Optional.of(convertContent(edExplicit));
}
private String convertContent(EDExplicit edExplicit) {
String rawText = edExplicit.getContent().get(0).toString(); // Not dealing with multiple contents
if (edExplicit.getRepresentation().equals(BinaryDataEncoding.TXT)) {
return rawText;
} else {
return Base64Coder.decodeString(rawText);
}
}
}
} | {
"content_hash": "0a1a96702f349553d80fd67d84c923f1",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 118,
"avg_line_length": 37.67272727272727,
"alnum_prop": 0.708011583011583,
"repo_name": "beiyuxinke/CONNECT",
"id": "c5abb42c01f2166b3db8ab1f3b199c7c5e108724",
"size": "3747",
"binary": false,
"copies": "2",
"ref": "refs/heads/CONNECT_integration",
"path": "Product/Production/Services/PatientDiscoveryCore/src/main/java/gov/hhs/fha/nhinc/patientdiscovery/aspect/PRPAIN201306UV02StatusExtractor.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "73091"
},
{
"name": "HTML",
"bytes": "178809"
},
{
"name": "Java",
"bytes": "14358905"
},
{
"name": "JavaScript",
"bytes": "6991"
},
{
"name": "PLSQL",
"bytes": "67148"
},
{
"name": "Python",
"bytes": "773"
},
{
"name": "SQLPL",
"bytes": "1363363"
},
{
"name": "Shell",
"bytes": "7384"
},
{
"name": "XSLT",
"bytes": "108247"
}
],
"symlink_target": ""
} |
namespace media {
const char MediaLog::kEventKey[] = "event";
const char MediaLog::kStatusText[] = "pipeline_error";
// A count of all MediaLogs created in the current process. Used to generate
// unique IDs.
static base::AtomicSequenceNumber g_media_log_count;
MediaLog::MediaLog() : MediaLog(new ParentLogRecord(this)) {}
MediaLog::MediaLog(scoped_refptr<ParentLogRecord> parent_log_record)
: parent_log_record_(std::move(parent_log_record)) {}
MediaLog::~MediaLog() {
// If we are the underlying log, then somebody should have called
// InvalidateLog before now. Otherwise, there could be concurrent calls into
// this after we're destroyed. Note that calling it here isn't really much
// better, since there could be concurrent calls into the now destroyed
// derived class.
//
// However, we can't DCHECK on it, since lots of folks create a base Medialog
// implementation temporarily. So, the best we can do is invalidate the log.
// We could get around this if we introduce a new NullMediaLog that handles
// log invalidation, so we could dcheck here. However, that seems like a lot
// of boilerplate.
InvalidateLog();
}
// Default *Locked implementations
void MediaLog::AddLogRecordLocked(std::unique_ptr<MediaLogRecord> event) {}
std::string MediaLog::GetErrorMessageLocked() {
return "";
}
void MediaLog::AddMessage(MediaLogMessageLevel level, std::string message) {
std::unique_ptr<MediaLogRecord> record(
CreateRecord(MediaLogRecord::Type::kMessage));
record->params.SetStringPath(MediaLogMessageLevelToString(level),
std::move(message));
AddLogRecord(std::move(record));
}
void MediaLog::NotifyError(PipelineStatus status) {
std::unique_ptr<MediaLogRecord> record(
CreateRecord(MediaLogRecord::Type::kMediaStatus));
record->params.SetIntPath(MediaLog::kStatusText, status);
AddLogRecord(std::move(record));
}
void MediaLog::NotifyError(Status status) {
DCHECK(!status.is_ok());
std::string output_str;
base::JSONWriter::Write(MediaSerialize(status), &output_str);
AddMessage(MediaLogMessageLevel::kERROR, output_str);
}
void MediaLog::OnWebMediaPlayerDestroyedLocked() {}
void MediaLog::OnWebMediaPlayerDestroyed() {
AddEvent<MediaLogEvent::kWebMediaPlayerDestroyed>();
base::AutoLock auto_lock(parent_log_record_->lock);
// Forward to the parent log's implementation.
if (parent_log_record_->media_log)
parent_log_record_->media_log->OnWebMediaPlayerDestroyedLocked();
}
std::string MediaLog::GetErrorMessage() {
base::AutoLock auto_lock(parent_log_record_->lock);
// Forward to the parent log's implementation.
if (parent_log_record_->media_log)
return parent_log_record_->media_log->GetErrorMessageLocked();
return "";
}
std::unique_ptr<MediaLog> MediaLog::Clone() {
// Protected ctor, so we can't use std::make_unique.
return base::WrapUnique(new MediaLog(parent_log_record_));
}
void MediaLog::AddLogRecord(std::unique_ptr<MediaLogRecord> record) {
base::AutoLock auto_lock(parent_log_record_->lock);
// Forward to the parent log's implementation.
if (parent_log_record_->media_log)
parent_log_record_->media_log->AddLogRecordLocked(std::move(record));
}
std::unique_ptr<MediaLogRecord> MediaLog::CreateRecord(
MediaLogRecord::Type type) {
auto record = std::make_unique<MediaLogRecord>();
record->id = id();
record->type = type;
record->time = base::TimeTicks::Now();
return record;
}
void MediaLog::InvalidateLog() {
base::AutoLock auto_lock(parent_log_record_->lock);
// Do nothing if this log didn't create the record, i.e.
// it's not the parent log. The parent log should invalidate itself.
if (parent_log_record_->media_log == this)
parent_log_record_->media_log = nullptr;
// Keep |parent_log_record_| around, since the lock must keep working.
}
MediaLog::ParentLogRecord::ParentLogRecord(MediaLog* log)
: id(g_media_log_count.GetNext()), media_log(log) {}
MediaLog::ParentLogRecord::~ParentLogRecord() = default;
LogHelper::LogHelper(MediaLogMessageLevel level, MediaLog* media_log)
: level_(level), media_log_(media_log) {
DCHECK(media_log_);
}
LogHelper::LogHelper(MediaLogMessageLevel level,
const std::unique_ptr<MediaLog>& media_log)
: LogHelper(level, media_log.get()) {}
LogHelper::~LogHelper() {
media_log_->AddMessage(level_, stream_.str());
}
} //namespace media
| {
"content_hash": "f729d666d144a9904ca42885a6dac841",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 79,
"avg_line_length": 35.66935483870968,
"alnum_prop": 0.7210038435451052,
"repo_name": "youtube/cobalt",
"id": "6cb08ed64cb3fe9e6910e4c24c7f0280b050fc15",
"size": "4819",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "third_party/chromium/media/base/media_log.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
#include "modules/audio_processing/vad/pitch_based_vad.h"
#include <math.h>
#include <string.h>
#include "modules/audio_processing/vad/vad_circular_buffer.h"
#include "modules/audio_processing/vad/common.h"
#include "modules/audio_processing/vad/noise_gmm_tables.h"
#include "modules/audio_processing/vad/voice_gmm_tables.h"
#include BOSS_WEBRTC_U_modules__include__module_common_types_h //original-code:"modules/include/module_common_types.h"
namespace webrtc {
static_assert(kNoiseGmmDim == kVoiceGmmDim,
"noise and voice gmm dimension not equal");
// These values should match MATLAB counterparts for unit-tests to pass.
static const int kPosteriorHistorySize = 500; // 5 sec of 10 ms frames.
static const double kInitialPriorProbability = 0.3;
static const int kTransientWidthThreshold = 7;
static const double kLowProbabilityThreshold = 0.2;
static double LimitProbability(double p) {
const double kLimHigh = 0.99;
const double kLimLow = 0.01;
if (p > kLimHigh)
p = kLimHigh;
else if (p < kLimLow)
p = kLimLow;
return p;
}
PitchBasedVad::PitchBasedVad()
: p_prior_(kInitialPriorProbability),
circular_buffer_(VadCircularBuffer::Create(kPosteriorHistorySize)) {
// Setup noise GMM.
noise_gmm_.dimension = kNoiseGmmDim;
noise_gmm_.num_mixtures = kNoiseGmmNumMixtures;
noise_gmm_.weight = kNoiseGmmWeights;
noise_gmm_.mean = &kNoiseGmmMean[0][0];
noise_gmm_.covar_inverse = &kNoiseGmmCovarInverse[0][0][0];
// Setup voice GMM.
voice_gmm_.dimension = kVoiceGmmDim;
voice_gmm_.num_mixtures = kVoiceGmmNumMixtures;
voice_gmm_.weight = kVoiceGmmWeights;
voice_gmm_.mean = &kVoiceGmmMean[0][0];
voice_gmm_.covar_inverse = &kVoiceGmmCovarInverse[0][0][0];
}
PitchBasedVad::~PitchBasedVad() {
}
int PitchBasedVad::VoicingProbability(const AudioFeatures& features,
double* p_combined) {
double p;
double gmm_features[3];
double pdf_features_given_voice;
double pdf_features_given_noise;
// These limits are the same in matlab implementation 'VoicingProbGMM().'
const double kLimLowLogPitchGain = -2.0;
const double kLimHighLogPitchGain = -0.9;
const double kLimLowSpectralPeak = 200;
const double kLimHighSpectralPeak = 2000;
const double kEps = 1e-12;
for (size_t n = 0; n < features.num_frames; n++) {
gmm_features[0] = features.log_pitch_gain[n];
gmm_features[1] = features.spectral_peak[n];
gmm_features[2] = features.pitch_lag_hz[n];
pdf_features_given_voice = EvaluateGmm(gmm_features, voice_gmm_);
pdf_features_given_noise = EvaluateGmm(gmm_features, noise_gmm_);
if (features.spectral_peak[n] < kLimLowSpectralPeak ||
features.spectral_peak[n] > kLimHighSpectralPeak ||
features.log_pitch_gain[n] < kLimLowLogPitchGain) {
pdf_features_given_voice = kEps * pdf_features_given_noise;
} else if (features.log_pitch_gain[n] > kLimHighLogPitchGain) {
pdf_features_given_noise = kEps * pdf_features_given_voice;
}
p = p_prior_ * pdf_features_given_voice /
(pdf_features_given_voice * p_prior_ +
pdf_features_given_noise * (1 - p_prior_));
p = LimitProbability(p);
// Combine pitch-based probability with standalone probability, before
// updating prior probabilities.
double prod_active = p * p_combined[n];
double prod_inactive = (1 - p) * (1 - p_combined[n]);
p_combined[n] = prod_active / (prod_active + prod_inactive);
if (UpdatePrior(p_combined[n]) < 0)
return -1;
// Limit prior probability. With a zero prior probability the posterior
// probability is always zero.
p_prior_ = LimitProbability(p_prior_);
}
return 0;
}
int PitchBasedVad::UpdatePrior(double p) {
circular_buffer_->Insert(p);
if (circular_buffer_->RemoveTransient(kTransientWidthThreshold,
kLowProbabilityThreshold) < 0)
return -1;
p_prior_ = circular_buffer_->Mean();
return 0;
}
} // namespace webrtc
| {
"content_hash": "cbd169d6f5fee31a52b8ba975f979c62",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 118,
"avg_line_length": 34.80869565217391,
"alnum_prop": 0.6932300774419186,
"repo_name": "koobonil/Boss2D",
"id": "8b5421aa4f74dabdf0cf572c01394640cd32bb05",
"size": "4415",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Boss2D/addon/_old/webrtc-qt5.11.2_for_boss/modules/audio_processing/vad/pitch_based_vad.cc",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "4820445"
},
{
"name": "Awk",
"bytes": "4272"
},
{
"name": "Batchfile",
"bytes": "89930"
},
{
"name": "C",
"bytes": "119747922"
},
{
"name": "C#",
"bytes": "87505"
},
{
"name": "C++",
"bytes": "272329620"
},
{
"name": "CMake",
"bytes": "1199656"
},
{
"name": "CSS",
"bytes": "42679"
},
{
"name": "Clojure",
"bytes": "1487"
},
{
"name": "Cuda",
"bytes": "1651996"
},
{
"name": "DIGITAL Command Language",
"bytes": "239527"
},
{
"name": "Dockerfile",
"bytes": "9638"
},
{
"name": "Emacs Lisp",
"bytes": "15570"
},
{
"name": "Go",
"bytes": "858185"
},
{
"name": "HLSL",
"bytes": "3314"
},
{
"name": "HTML",
"bytes": "2958385"
},
{
"name": "Java",
"bytes": "2921052"
},
{
"name": "JavaScript",
"bytes": "178190"
},
{
"name": "Jupyter Notebook",
"bytes": "1833654"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "M4",
"bytes": "775724"
},
{
"name": "MATLAB",
"bytes": "74606"
},
{
"name": "Makefile",
"bytes": "3941551"
},
{
"name": "Meson",
"bytes": "2847"
},
{
"name": "Module Management System",
"bytes": "2626"
},
{
"name": "NSIS",
"bytes": "4505"
},
{
"name": "Objective-C",
"bytes": "4090702"
},
{
"name": "Objective-C++",
"bytes": "1702390"
},
{
"name": "PHP",
"bytes": "3530"
},
{
"name": "Perl",
"bytes": "11096338"
},
{
"name": "Perl 6",
"bytes": "11802"
},
{
"name": "PowerShell",
"bytes": "38571"
},
{
"name": "Python",
"bytes": "24123805"
},
{
"name": "QMake",
"bytes": "18188"
},
{
"name": "Roff",
"bytes": "1261269"
},
{
"name": "Ruby",
"bytes": "5890"
},
{
"name": "Scala",
"bytes": "5683"
},
{
"name": "Shell",
"bytes": "2879948"
},
{
"name": "TeX",
"bytes": "243507"
},
{
"name": "TypeScript",
"bytes": "1593696"
},
{
"name": "Verilog",
"bytes": "1215"
},
{
"name": "Vim Script",
"bytes": "3759"
},
{
"name": "Visual Basic",
"bytes": "16186"
},
{
"name": "eC",
"bytes": "9705"
}
],
"symlink_target": ""
} |
<?php
echo '<div id="wrapper"> <div class="resulter">This is not your resource. ';
echo '<a href="'.base_url().'edit/" style="display:inline; font-size:.8em;">Try Again</a>';
echo '</div></div><br>';
?> | {
"content_hash": "078f92f9105cc7f7260e699a36782e08",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 91,
"avg_line_length": 22.88888888888889,
"alnum_prop": 0.6116504854368932,
"repo_name": "Chicodemilo/sanangelo.apartments",
"id": "df139fba227958b7cd8d7f7f560187118db452a5",
"size": "206",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "application/views/edit/not_yours.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "124067"
},
{
"name": "HTML",
"bytes": "8276697"
},
{
"name": "JavaScript",
"bytes": "371133"
},
{
"name": "PHP",
"bytes": "2449620"
}
],
"symlink_target": ""
} |
package org.mortbay.jetty.client;
import java.io.File;
public class ExternalKeyStoreAsyncSslHttpExchangeTest extends SslHttpExchangeTest
{
protected void setUp() throws Exception
{
_scheme="https://";
startServer();
_httpClient=new HttpClient();
_httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
_httpClient.setMaxConnectionsPerAddress(2);
String keystore = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator
+ "keystore";
_httpClient.setKeyStoreLocation( keystore );
_httpClient.setKeyStorePassword( "storepwd");
_httpClient.setKeyManagerPassword( "keypwd" );
_httpClient.start();
}
public void testSun() throws Exception
{
}
} | {
"content_hash": "927d42e7986d2524293dca28441c7e2e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 155,
"avg_line_length": 30.357142857142858,
"alnum_prop": 0.6670588235294118,
"repo_name": "cscotta/miso-java",
"id": "1f0b757c0757d3ed9ed99c55625889ab2c682e9a",
"size": "1665",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jetty/extras/client/src/test/java/org/mortbay/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "16295"
},
{
"name": "Groovy",
"bytes": "7099"
},
{
"name": "Java",
"bytes": "5396831"
},
{
"name": "JavaScript",
"bytes": "34952"
},
{
"name": "Ruby",
"bytes": "7594"
},
{
"name": "Shell",
"bytes": "67795"
}
],
"symlink_target": ""
} |
% Day 7: Calculating Diversity I
% Raymond Yee
% February 11, 2014 (<http://is.gd/wwod1407>)
# Goals Today
* Continue work on census data
* Preview Graphing and Map-Making
* Have time in class to work.
# Preview of Plotting Graphs and Maps
Do the following notebooks work for you to show basic graphics?
*
[Day_07_A_D3_Choropleth.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_A_D3_Choropleth.ipynb)
*
[Day_07_B_Google_Chart_Example.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_B_Google_Chart_Example.ipynb)
*[Day_07_C_Google_Map_API.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_C_Google_Map_API.ipynb)
*[Day_07_D_Matplotlib.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_D_Matplotlib.ipynb)
If not, please post on bCourses about problems you see.
# Census has lots of interesting data
[Day_07_E_Census_fields.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_E_Census_fields.ipynb)
is an exploration of the concepts and variables in the 2010 Census.
# The heart of today's work
* [Day_07_F_Groupby.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_F_Groupby.ipynb)
and
* [Day_07_G_Calculating_Diversity.ipynb](http://nbviewer.ipython.org/github/rdhyee/working-open-data-2014/blob/master/notebooks/Day_07_G_Calculating_Diversity.ipynb)
# Assignments / Homework
* I expect you to review all the notebooks so far and pinpoint what
you do and don't understand.
What you should be able to do by the end of working through Day 7:
* calculate the total population of Whites, Blacks, Hispanics, Asians, and
Other in all 2010 Census Places.
| {
"content_hash": "5778b7e12133cce19f53334149591618",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 165,
"avg_line_length": 39.3125,
"alnum_prop": 0.7689454160042395,
"repo_name": "prabhamatta/Analyzing-Open-Data",
"id": "9e9d5894f5898787a736995e1ba7a9ebd23ed942",
"size": "1887",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lectures/day07.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "445223"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>Auntie’s Skirts | A Child's Garden of Verses: Selected Poems | Robert Louis Stevenson | Lit2Go ETC</title>
<link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/screenless.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/printless.css" type="text/css" media="print" title="no title" charset="utf-8">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" defer src="http://etc.usf.edu/lit2go/js/js.min.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5574891-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
$(document).ready(function() {
$('img').unveil();
$('#contactable').contactable({
url: 'http://etc.usf.edu/lit2go/welcome/feedback/',
subject: 'Lit2Go Feedback — Auntie’s Skirts | A Child\'s Garden of Verses: Selected Poems | Robert Louis Stevenson — http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/'
});
});
</script>
</head>
<body>
<div class="page"> <header>
<h1>
<a href="http://etc.usf.edu/lit2go/">Lit<span class="blue">2</span>Go</a>
</h1>
<ul>
<li id="search"><form action="http://etc.usf.edu/lit2go/search/"><input type="text" name="q" placeholder="Search" value=""></form></li>
</ul>
</header>
<nav id="shell">
<ul>
<li><a href="http://etc.usf.edu/lit2go/authors/" class="">Authors</a></li>
<li><a href="http://etc.usf.edu/lit2go/books/" class="selected">Books</a></li>
<li><a href="http://etc.usf.edu/lit2go/genres/" class="">Genres</a></li>
<li><a href="http://etc.usf.edu/lit2go/collections/" class="">Collections</a></li>
<li><a href="http://etc.usf.edu/lit2go/readability/" class="">Readability</a></li>
</ul>
</nav>
<section id="content">
<div id="contactable"><!-- contactable html placeholder --></div>
<div id="page_content">
<header>
<h2>
<a href="http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/">A Child's Garden of Verses: Selected Poems</a>
</h2>
<h3>
by <a href="http://etc.usf.edu/lit2go/authors/96/robert-louis-stevenson/">Robert Louis Stevenson</a>
</h3>
<h4>
Auntie’s Skirts </h4>
</header>
<div id="poem">
<details open>
<summary>
Additional Information
</summary>
<div id="columns">
<ul>
<li>
<strong>Year Published:</strong>
1913 </li>
<li>
<strong>Language:</strong>
English </li>
<li>
<strong>Country of Origin:</strong>
England </li>
<li>
<strong>Source:</strong>
Stevenson, R.L. (1913). <em>A Child’s Garden of Verses</em>. Simon & Schuster Children’s. </li>
</ul>
</div>
<div id="columns">
<ul>
<li>
<strong>Readability:</strong>
<ul>
<li>
Flesch–Kincaid Level:
<a href="http://etc.usf.edu/lit2go/readability/flesch_kincaid_grade_level/2/" title="Flesch–Kincaid Grade Level 2.4">2.4</a>
</li>
</ul>
</li>
<li>
<strong>Word Count:</strong>
23 </li>
</ul>
</div>
<div id="columns">
<ul>
<li>
<strong>Genre:</strong>
<a href="http://etc.usf.edu/lit2go/genres/24/poetry/">Poetry</a>
</li>
<li>
<a class="btn" data-toggle="modal" href="#cite_this" >✎ Cite This</a>
</li>
<li>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a addthis:ui_delay="500" href="http://www.addthis.com/bookmark.php?v=250&pub=roywinkelman" class="addthis_button_compact">Share</a>
<span class="addthis_separator">|</span>
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
</div>
<script type="text/javascript">$($.getScript("http://s7.addthis.com/js/250/addthis_widget.js?pub=roywinkelman"))</script>
<!-- <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=roywinkelman"></script> -->
<!-- AddThis Button END -->
</li>
</ul>
</div>
<h4>Downloads</h4>
<ul id="downloads">
<li>
<a href="http://etc.usf.edu/lit2go/audio/mp3/a-childs-garden-of-verses-selected-poems-002-aunties-skirts.4708.mp3">Audio</a>
</li>
<li>
<a href="http://etc.usf.edu/lit2go/pdf/passage/4708/a-childs-garden-of-verses-selected-poems-002-aunties-skirts.pdf">Passage PDF</a>
</li>
</ul>
<hr>
</details>
<div class="modal hide" id="cite_this">
<script>
$($('#myTab a').click(function (e) {e.preventDefault();$('#myTab a[href="#apa"]').tab('show');}));
</script>
<nav>
<ul id="myTab">
<li class="active">
<a href="#apa" data-toggle="tab">APA</a>
</li>
<li>
<a href="#mla" data-toggle="tab">MLA</a>
</li>
<li>
<a href="#chicago" data-toggle="tab">Chicago</a>
</li>
</ul>
</nav>
<div class="tab-content">
<div class="content tab-pane hide active" id="apa">
<p class="citation">
Stevenson, R. (1913). Auntie’s Skirts. <em>A Child's Garden of Verses: Selected Poems</em> (Lit2Go Edition). Retrieved February 15, 2016, from <span class="faux_link">http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/</span>
</p>
</div>
<div class="content tab-pane" id="mla">
<p class="citation">
Stevenson, Robert Louis. "Auntie’s Skirts." <em>A Child's Garden of Verses: Selected Poems</em>. Lit2Go Edition. 1913. Web. <<span class="faux_link">http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/</span>>. February 15, 2016.
</p>
</div>
<div class="content tab-pane" id="chicago">
<p class="citation">
Robert Louis Stevenson, "Auntie’s Skirts," <em>A Child's Garden of Verses: Selected Poems</em>, Lit2Go Edition, (1913), accessed February 15, 2016, <span class="faux_link">http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/</span>.
</p>
</div>
</div>
</div>
<span class="top"> <nav class="passage">
<ul>
<li><a href="http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4707/at-the-sea-side/" title="At the Sea-Side" class="back">Back</a></li>
<li><a href="http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4709/autumn-fires/" title="Autumn Fires" class="next">Next</a></li>
</ul>
</nav>
</span>
<div id="shrink_wrap">
<div id="i_apologize_for_the_soup">
<audio controls style="width:99%;">
<source src="http://etc.usf.edu/lit2go/audio/mp3/a-childs-garden-of-verses-selected-poems-002-aunties-skirts.4708.mp3" type="audio/mpeg" />
<source src="http://etc.usf.edu/lit2go/audio/ogg/a-childs-garden-of-verses-selected-poems-002-aunties-skirts.4708.ogg" type="audio/ogg" />
The embedded audio player requires a modern internet browser. You should visit <a href="http://browsehappy.com/">Browse Happy</a> and update your internet browser today!
</audio>
<p>
Whenever Auntie moves around,<br />
Her dresses make a curious sound,<br />
They trail behind her up the floor,<br />
And trundle after through the door.</p>
</div>
</div>
<span class="bottom"> <nav class="passage">
<ul>
<li><a href="http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4707/at-the-sea-side/" title="At the Sea-Side" class="back">Back</a></li>
<li><a href="http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4709/autumn-fires/" title="Autumn Fires" class="next">Next</a></li>
</ul>
</nav>
</span>
</div>
</div>
</section>
<footer screen>
<div id="footer-text">
<p>
This collection of children's literature is a part of the <a href="http://etc.usf.edu/">Educational Technology Clearinghouse</a> and is funded by various <a href="http://etc.usf.edu/lit2go/welcome/funding/">grants</a>.
</p>
<p>
Copyright © 2006—2016 by the <a href="http://fcit.usf.edu/">Florida Center for Instructional Technology</a>, <a href="http://www.coedu.usf.edu/">College of Education</a>, <a href="http://www.usf.edu/">University of South Florida</a>.
</p>
</div>
<ul id="footer-links">
<li><a href="http://etc.usf.edu/lit2go/welcome/license/">License</a></li>
<li><a href="http://etc.usf.edu/lit2go/welcome/credits/">Credits</a></li>
<li><a href="http://etc.usf.edu/lit2go/welcome/faq/">FAQ</a></li>
<li><a href="http://etc.usf.edu/lit2go/giving/">Giving</a></li>
</ul>
</footer>
<footer print>
<div id="footer-text">
<p>This document was downloaded from <a href="http://etc.usf.edu/lit2go/">Lit2Go</a>, a free online collection of stories and poems in Mp3 (audiobook) format published by the <a href="http://fcit.usf.edu/">Florida Center for Instructional Technology</a>. For more information, including classroom activities, readability data, and original sources, please visit <a href="http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/">http://etc.usf.edu/lit2go/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/</a>.</p>
</div>
<div id="book-footer">
<p>Lit2Go: <em>A Child's Garden of Verses: Selected Poems</em></p>
<p>Auntie’s Skirts</p>
</div>
</footer>
<script type="text/javascript" defer src="http://etc.usf.edu/lit2go/js/details.js"></script>
</div>
</body>
</html>
| {
"content_hash": "6a739e6295c5a0cc7124fd4b560c447f",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 574,
"avg_line_length": 47.054621848739494,
"alnum_prop": 0.5710331279578533,
"repo_name": "adrianosb/maprecude_team_adriano_barbosa_and_andre_matsuda",
"id": "8d403689fc23f79e879192978236eb0fa1d16189",
"size": "11227",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "HtmlToText/lit2go.ok/59/a-childs-garden-of-verses-selected-poems/4708/aunties-skirts/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "145411809"
},
{
"name": "Java",
"bytes": "6677"
}
],
"symlink_target": ""
} |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:genius="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="#e8e8e8"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Genius UI"
android:textSize="28sp"
genius:g_textColor="main"
genius:g_theme="@array/StrawberryIce" />
<!-- TextView -->
<net.qiujuer.genius.widget.GeniusTextView
android:id="@+id/title_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:maxLines="1"
android:text="TextView"
android:textSize="20sp"
genius:g_textColor="main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:weightSum="4">
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Normal"
android:textSize="16sp" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Theme"
android:textSize="16sp"
genius:g_theme="@array/ScubaBlue" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Color"
android:textSize="16sp"
genius:g_textColor="darker" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Background"
android:textSize="16sp"
genius:g_backgroundColor="light" />
</LinearLayout>
<!-- CheckBox -->
<net.qiujuer.genius.widget.GeniusTextView
android:id="@+id/title_checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:maxLines="1"
android:text="CheckBox"
android:textSize="20sp"
genius:g_textColor="main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:gravity="center_vertical"
android:text="Enabled"
android:textSize="16dip"
genius:g_textColor="main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:orientation="vertical">
<net.qiujuer.genius.widget.GeniusCheckBox
android:id="@+id/checkbox_enable_blue"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_margin="5dip"
genius:g_theme="@array/ScubaBlue" />
<net.qiujuer.genius.widget.GeniusCheckBox
android:id="@+id/checkbox_enable_strawberryIce"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_margin="5dip"
genius:g_checked="true"
genius:g_ringWidth="2dp"
genius:g_theme="@array/StrawberryIce" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:gravity="center_vertical"
android:text="Disabled"
android:textSize="16dip"
genius:g_textColor="main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:orientation="vertical">
<net.qiujuer.genius.widget.GeniusCheckBox
android:id="@+id/checkbox_disEnable_blue"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_margin="5dip"
genius:g_enabled="false"
genius:g_theme="@array/ScubaBlue" />
<net.qiujuer.genius.widget.GeniusCheckBox
android:id="@+id/checkbox_disEnable_strawberryIce"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_margin="5dip"
genius:g_checked="true"
genius:g_enabled="false"
genius:g_ringWidth="2dp"
genius:g_theme="@array/StrawberryIce" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- Button -->
<net.qiujuer.genius.widget.GeniusTextView
android:id="@+id/title_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Button"
android:textSize="20sp"
genius:g_textColor="main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="68dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Move"
genius:g_textAppearance="light"
genius:g_theme="@array/Dark"
genius:g_touchEffect="move" />
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="68dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Ripple"
genius:g_textAppearance="light"
genius:g_theme="@array/Dark"
genius:g_touchEffect="ripple" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="68dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Ease"
genius:g_textAppearance="light"
genius:g_theme="@array/ScubaBlue"
genius:g_touchEffect="ease" />
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="68dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Press"
genius:g_textAppearance="light"
genius:g_theme="@array/ScubaBlue"
genius:g_touchEffect="press" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3">
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Color"
genius:g_textAppearance="none"
genius:g_touchEffect="press"
genius:g_touchEffectColor="#ff4181ff" />
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Corner "
genius:g_cornerRadius="10dp"
genius:g_textAppearance="light"
genius:g_theme="@array/StrawberryIce" />
<net.qiujuer.genius.widget.GeniusButton
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Block"
genius:g_blockButtonEffectHeight="4dp"
genius:g_textAppearance="light"
genius:g_theme="@array/StrawberryIce" />
</LinearLayout>
<!-- CheckBox -->
<net.qiujuer.genius.widget.GeniusTextView
android:id="@+id/title_blur"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Blur Kit"
android:textSize="20sp"
genius:g_textColor="main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:weightSum="4">
<RelativeLayout
android:id="@+id/blur_java"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="@+id/image_blur_self"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_blur" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Src"
android:textColor="#FFFF" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="@+id/image_blur_java"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_blur" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Java Blur"
android:textColor="#FFFF" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="@+id/image_blur_jni_pixels"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_blur" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Jni Pixels"
android:textColor="#FFFF" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="@+id/image_blur_jni_bitmap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_blur" />
<net.qiujuer.genius.widget.GeniusTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Jni Bitmap"
android:textColor="#FFFF" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<net.qiujuer.genius.widget.GeniusCheckBox
android:id="@+id/checkbox_blur_isCompress"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="5dip"
genius:g_theme="@array/StrawberryIce" />
<net.qiujuer.genius.widget.GeniusTextView
android:id="@+id/text_blur_isCompress"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="Is Compress"
android:textSize="14sp"
genius:g_textColor="main"
genius:g_theme="@array/StrawberryIce" />
<net.qiujuer.genius.widget.GeniusTextView
android:id="@+id/text_blur_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dip"
android:gravity="center_horizontal|center_vertical"
android:text="Blur Time: 0 0 0"
android:textSize="14sp"
genius:g_textColor="main"
genius:g_theme="@array/StrawberryIce" />
</LinearLayout>
</LinearLayout>
</ScrollView>
| {
"content_hash": "1b7e06c6d2bb6b5c6195f499897964e4",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 74,
"avg_line_length": 40.455882352941174,
"alnum_prop": 0.5301968115490471,
"repo_name": "x-android/Genius-Android",
"id": "b85d674c48aa12a67264748cbf53e2f3ac00de99",
"size": "19257",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sample/src/main/res/layout/activity_main.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "7651"
},
{
"name": "Java",
"bytes": "258222"
},
{
"name": "Makefile",
"bytes": "259"
}
],
"symlink_target": ""
} |
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
namespace macdoc
{
class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.Main (args);
}
}
}
| {
"content_hash": "d96cd74636de4b1d9e4d4adc31b56d39",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 34,
"avg_line_length": 14.222222222222221,
"alnum_prop": 0.71484375,
"repo_name": "kangaroo/monomac",
"id": "ac7931a6aa7f653efc03feb2af4191ee9dd3ce5a",
"size": "256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/macdoc/Main.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "8582454"
}
],
"symlink_target": ""
} |
@interface CCSMACDData : CCSBaseData {
CCFloat _dea;
CCFloat _diff;
CCFloat _macd;
NSString *_date;
}
@property(assign, nonatomic) CCFloat dea;
@property(assign, nonatomic) CCFloat diff;
@property(assign, nonatomic) CCFloat macd;
@property(strong, nonatomic) NSString *date;
- (id)initWithDea:(CCFloat )dea diff:(CCFloat )diff macd:(CCFloat )macd date:(NSString *)date;
@end
| {
"content_hash": "f77595f492377e77e2b3f16fbdde4ccf",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 94,
"avg_line_length": 26.266666666666666,
"alnum_prop": 0.7182741116751269,
"repo_name": "waynett/Cocoa-Charts",
"id": "048ad3a4a7dafe5ec177786dc9c43bc5e8b9e0f0",
"size": "552",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/CocoaChartsWithARC/CCSMACDData.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "6773958"
},
{
"name": "C++",
"bytes": "6670"
},
{
"name": "Objective-C",
"bytes": "2110435"
},
{
"name": "Shell",
"bytes": "137"
}
],
"symlink_target": ""
} |
package ackcord.util
import ackcord.APIMessage
import ackcord.data.{GuildChannel, GuildId}
import akka.actor.typed._
import akka.actor.typed.scaladsl._
class APIGuildRouter[Inner](
ctx: ActorContext[GuildRouter.Command[APIMessage, Inner]],
replyTo: Option[ActorRef[GuildRouter.GuildActorCreated[Inner]]],
behavior: GuildId => Behavior[Inner],
notGuildHandler: Option[ActorRef[Inner]],
handleEvent: (ActorRef[Inner], APIMessage) => Unit,
shutdownBehavior: GuildRouter.ShutdownBehavior[Inner]
) extends GuildRouter[APIMessage, Inner](ctx, replyTo, behavior, notGuildHandler, shutdownBehavior) {
override def handleThroughMessage(a: APIMessage): Unit = a match {
case msg: APIMessage.Ready =>
msg.cache.current.unavailableGuildMap.keys.foreach(sendToGuild(_, msg, handleEvent))
case msg @ (_: APIMessage.Resumed | _: APIMessage.UserUpdate) => sendToAll(msg, handleEvent)
case APIMessage.GuildDelete(guild, false, _) => stopHandler(guild.id)
case msg: APIMessage.GuildMessage => sendToGuild(msg.guild.id, msg, handleEvent)
case msg: APIMessage.ChannelMessage =>
msg.channel match {
case ch: GuildChannel => sendToGuild(ch.guildId, msg, handleEvent)
case _ => sendToNotGuild(msg, handleEvent)
}
case msg: APIMessage.MessageMessage =>
msg.message.channelId.resolve(msg.cache.current) match {
case Some(guildChannel: GuildChannel) => sendToGuild(guildChannel.guildId, msg, handleEvent)
case _ => sendToNotGuild(msg, handleEvent)
}
case msg @ APIMessage.VoiceStateUpdate(state, _) =>
state.guildId match {
case Some(guildId) => sendToGuild(guildId, msg, handleEvent)
case None => sendToNotGuild(msg, handleEvent)
}
}
}
object APIGuildRouter {
def router(
replyTo: Option[ActorRef[GuildRouter.GuildActorCreated[APIMessage]]],
behavior: GuildId => Behavior[APIMessage],
notGuildHandler: Option[ActorRef[APIMessage]]
): Behavior[GuildRouter.Command[APIMessage, APIMessage]] = Behaviors.setup { ctx =>
new APIGuildRouter(ctx, replyTo, behavior, notGuildHandler, _ ! _, GuildRouter.OnShutdownStop)
}
def partitioner[Inner](
replyTo: Option[ActorRef[GuildRouter.GuildActorCreated[Inner]]],
behavior: GuildId => Behavior[Inner],
notGuildHandler: Option[ActorRef[Inner]],
shutdownBehavior: GuildRouter.ShutdownBehavior[Inner]
): Behavior[GuildRouter.Command[APIMessage, Inner]] = Behaviors.setup { ctx =>
new APIGuildRouter(ctx, replyTo, behavior, notGuildHandler, (_, _) => (), shutdownBehavior)
}
}
| {
"content_hash": "14f10c8fd02f76d1c9559baef428f1b5",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 112,
"avg_line_length": 45,
"alnum_prop": 0.6914814814814815,
"repo_name": "Katrix-/AckCord",
"id": "a352d57ec4dc8e932c111aec150ac75a1adddcc2",
"size": "3884",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/scala/ackcord/util/APIGuildRouter.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "87430"
},
{
"name": "Scala",
"bytes": "771592"
}
],
"symlink_target": ""
} |
/**
* WikimediaUI Base v0.10.0
* Wikimedia Foundation user interface base variables
*/
.oo-ui-icon-alert {
background-image: url('themes/wikimediaui/images/icons/alert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/alert.svg');
}
.oo-ui-image-warning.oo-ui-icon-alert {
background-image: url('themes/wikimediaui/images/icons/alert-warning.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/alert-warning.svg');
}
.oo-ui-image-invert.oo-ui-icon-alert {
background-image: url('themes/wikimediaui/images/icons/alert-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/alert-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-alert {
background-image: url('themes/wikimediaui/images/icons/alert-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/alert-progressive.svg');
}
.oo-ui-icon-bell {
background-image: url('themes/wikimediaui/images/icons/bell.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bell.svg');
}
.oo-ui-image-invert.oo-ui-icon-bell {
background-image: url('themes/wikimediaui/images/icons/bell-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bell-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-bell {
background-image: url('themes/wikimediaui/images/icons/bell-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bell-progressive.svg');
}
.oo-ui-icon-bellOn {
background-image: url('themes/wikimediaui/images/icons/bellOn-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bellOn-ltr.svg');
}
.oo-ui-image-invert.oo-ui-icon-bellOn {
background-image: url('themes/wikimediaui/images/icons/bellOn-ltr-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bellOn-ltr-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-bellOn {
background-image: url('themes/wikimediaui/images/icons/bellOn-ltr-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/bellOn-ltr-progressive.svg');
}
.oo-ui-icon-comment {
background-image: url('themes/wikimediaui/images/icons/comment.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/comment.svg');
}
.oo-ui-image-invert.oo-ui-icon-comment {
background-image: url('themes/wikimediaui/images/icons/comment-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/comment-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-comment {
background-image: url('themes/wikimediaui/images/icons/comment-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/comment-progressive.svg');
}
.oo-ui-icon-message {
background-image: url('themes/wikimediaui/images/icons/message-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/message-ltr.svg');
}
.oo-ui-image-invert.oo-ui-icon-message {
background-image: url('themes/wikimediaui/images/icons/message-ltr-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/message-ltr-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-message {
background-image: url('themes/wikimediaui/images/icons/message-ltr-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/message-ltr-progressive.svg');
}
.oo-ui-icon-notice {
background-image: url('themes/wikimediaui/images/icons/notice.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notice.svg');
}
.oo-ui-image-invert.oo-ui-icon-notice {
background-image: url('themes/wikimediaui/images/icons/notice-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notice-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-notice {
background-image: url('themes/wikimediaui/images/icons/notice-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/notice-progressive.svg');
}
.oo-ui-icon-speechBubble {
background-image: url('themes/wikimediaui/images/icons/speechBubble-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubble-ltr.svg');
}
.oo-ui-image-invert.oo-ui-icon-speechBubble {
background-image: url('themes/wikimediaui/images/icons/speechBubble-ltr-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubble-ltr-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-speechBubble {
background-image: url('themes/wikimediaui/images/icons/speechBubble-ltr-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubble-ltr-progressive.svg');
}
.oo-ui-icon-speechBubbleAdd {
background-image: url('themes/wikimediaui/images/icons/speechBubbleAdd-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubbleAdd-ltr.svg');
}
.oo-ui-image-invert.oo-ui-icon-speechBubbleAdd {
background-image: url('themes/wikimediaui/images/icons/speechBubbleAdd-ltr-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubbleAdd-ltr-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-speechBubbleAdd {
background-image: url('themes/wikimediaui/images/icons/speechBubbleAdd-ltr-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubbleAdd-ltr-progressive.svg');
}
.oo-ui-icon-speechBubbles {
background-image: url('themes/wikimediaui/images/icons/speechBubbles-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubbles-ltr.svg');
}
.oo-ui-image-invert.oo-ui-icon-speechBubbles {
background-image: url('themes/wikimediaui/images/icons/speechBubbles-ltr-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubbles-ltr-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-speechBubbles {
background-image: url('themes/wikimediaui/images/icons/speechBubbles-ltr-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/speechBubbles-ltr-progressive.svg');
}
.oo-ui-icon-tray {
background-image: url('themes/wikimediaui/images/icons/tray.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/tray.svg');
}
.oo-ui-image-invert.oo-ui-icon-tray {
background-image: url('themes/wikimediaui/images/icons/tray-invert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/tray-invert.svg');
}
.oo-ui-image-progressive.oo-ui-icon-tray {
background-image: url('themes/wikimediaui/images/icons/tray-progressive.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/wikimediaui/images/icons/tray-progressive.svg');
}
| {
"content_hash": "a44435b8f0444c5b124a912821db6fd2",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 151,
"avg_line_length": 62.604651162790695,
"alnum_prop": 0.7625061911837543,
"repo_name": "cdnjs/cdnjs",
"id": "691251e176e504355415f9270c308093f857a4a7",
"size": "8307",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "ajax/libs/oojs-ui/0.24.4/oojs-ui-wikimediaui-icons-alerts.css",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
All notable changes to this project will be documented in this file.
## [Unreleased]
## [0.2.0]
New API.
### Add
- Gradle publish script: github release, bintray upload and maven.
- README: Explanation for publish
### Changed
- API change: Package is now 'tokyo.northside.io'
- API change: class names are FileUtils2 and IOUtils2
- Now northside-io classes are extends commons-io.
- Project configuration is placed on gradle.properties
- Private configuration is required in ~/.gradle/gradle.properties
for github account, bintray account etc.
## [0.1.1]
### Changed
- Project name is now northside-io and package is tokyo.northside.
### Fixed
- Update license preamble section in source file.
- (missing) expose methods as public.
## 0.1.0
### Add
- Start project to provide two convenient methods.
[0.1.1]: https://github.com/miurahr/northside-io-java/compare/v0.1.0...v0.1.1
[0.2.0]: https://github.com/miurahr/northside-io-java/compare/v0.1.1...v0.2.0
[Unreleased]: https://github.com/miurahr/northside-io-java/compare/v0.2.0...HEAD
| {
"content_hash": "cf8f21c3123449e4058c1306f5594726",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 29.942857142857143,
"alnum_prop": 0.7347328244274809,
"repo_name": "miurahr/northside-io-java",
"id": "731e1793f42a0dc3fac7c6cb457abc25d30a9823",
"size": "1061",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CHANGELOG.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "11246"
}
],
"symlink_target": ""
} |
package org.antlr.tool;
import antlr.Token;
import org.antlr.Tool;
import org.antlr.misc.BitSet;
import org.antlr.analysis.DFAState;
import org.antlr.analysis.DecisionProbe;
import org.antlr.analysis.Label;
import org.antlr.stringtemplate.StringTemplate;
import org.antlr.stringtemplate.StringTemplateErrorListener;
import org.antlr.stringtemplate.StringTemplateGroup;
import org.antlr.stringtemplate.language.AngleBracketTemplateLexer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/** Defines all the errors ANTLR can generator for both the tool and for
* issues with a grammar.
*
* Here is a list of language names:
*
* http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt
*
* Here is a list of country names:
*
* http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
*
* I use constants not strings to identify messages as the compiler will
* find any errors/mismatches rather than leaving a mistyped string in
* the code to be found randomly in the future. Further, Intellij can
* do field name expansion to save me some typing. I have to map
* int constants to template names, however, which could introduce a mismatch.
* Someone could provide a .stg file that had a template name wrong. When
* I load the group, then, I must verify that all messages are there.
*
* This is essentially the functionality of the resource bundle stuff Java
* has, but I don't want to load a property file--I want to load a template
* group file and this is so simple, why mess with their junk.
*
* I use the default Locale as defined by java to compute a group file name
* in the org/antlr/tool/templates/messages dir called en_US.stg and so on.
*
* Normally we want to use the default locale, but often a message file will
* not exist for it so we must fall back on the US local.
*
* During initialization of this class, all errors go straight to System.err.
* There is no way around this. If I have not set up the error system, how
* can I do errors properly? For example, if the string template group file
* full of messages has an error, how could I print to anything but System.err?
*
* TODO: how to map locale to a file encoding for the stringtemplate group file?
* StringTemplate knows how to pay attention to the default encoding so it
* should probably just work unless a GUI sets the local to some chinese
* variation but System.getProperty("file.encoding") is US. Hmm...
*
* TODO: get antlr.g etc.. parsing errors to come here.
*/
public class ErrorManager {
// TOOL ERRORS
// file errors
public static final int MSG_CANNOT_WRITE_FILE = 1;
public static final int MSG_CANNOT_CLOSE_FILE = 2;
public static final int MSG_CANNOT_FIND_TOKENS_FILE = 3;
public static final int MSG_ERROR_READING_TOKENS_FILE = 4;
public static final int MSG_DIR_NOT_FOUND = 5;
public static final int MSG_OUTPUT_DIR_IS_FILE = 6;
public static final int MSG_CANNOT_OPEN_FILE = 7;
public static final int MSG_FILE_AND_GRAMMAR_NAME_DIFFER = 8;
public static final int MSG_FILENAME_EXTENSION_ERROR = 9;
public static final int MSG_INTERNAL_ERROR = 10;
public static final int MSG_INTERNAL_WARNING = 11;
public static final int MSG_ERROR_CREATING_ARTIFICIAL_RULE = 12;
public static final int MSG_TOKENS_FILE_SYNTAX_ERROR = 13;
public static final int MSG_CANNOT_GEN_DOT_FILE = 14;
public static final int MSG_BAD_AST_STRUCTURE = 15;
public static final int MSG_BAD_ACTION_AST_STRUCTURE = 16;
// code gen errors
public static final int MSG_MISSING_CODE_GEN_TEMPLATES = 20;
public static final int MSG_MISSING_CYCLIC_DFA_CODE_GEN_TEMPLATES = 21;
public static final int MSG_CODE_GEN_TEMPLATES_INCOMPLETE = 22;
public static final int MSG_CANNOT_CREATE_TARGET_GENERATOR = 23;
//public static final int MSG_CANNOT_COMPUTE_SAMPLE_INPUT_SEQ = 24;
// GRAMMAR ERRORS
public static final int MSG_SYNTAX_ERROR = 100;
public static final int MSG_RULE_REDEFINITION = 101;
public static final int MSG_LEXER_RULES_NOT_ALLOWED = 102;
public static final int MSG_PARSER_RULES_NOT_ALLOWED = 103;
public static final int MSG_CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL = 104;
public static final int MSG_NO_TOKEN_DEFINITION = 105;
public static final int MSG_UNDEFINED_RULE_REF = 106;
public static final int MSG_LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE = 107;
public static final int MSG_CANNOT_ALIAS_TOKENS_IN_LEXER = 108;
public static final int MSG_ATTRIBUTE_REF_NOT_IN_RULE = 111;
public static final int MSG_INVALID_RULE_SCOPE_ATTRIBUTE_REF = 112;
public static final int MSG_UNKNOWN_ATTRIBUTE_IN_SCOPE = 113;
public static final int MSG_UNKNOWN_SIMPLE_ATTRIBUTE = 114;
public static final int MSG_INVALID_RULE_PARAMETER_REF = 115;
public static final int MSG_UNKNOWN_RULE_ATTRIBUTE = 116;
public static final int MSG_ISOLATED_RULE_SCOPE = 117;
public static final int MSG_SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE = 118;
public static final int MSG_LABEL_CONFLICTS_WITH_RULE = 119;
public static final int MSG_LABEL_CONFLICTS_WITH_TOKEN = 120;
public static final int MSG_LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE = 121;
public static final int MSG_LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL = 122;
public static final int MSG_ATTRIBUTE_CONFLICTS_WITH_RULE = 123;
public static final int MSG_ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL = 124;
public static final int MSG_LABEL_TYPE_CONFLICT = 125;
public static final int MSG_ARG_RETVAL_CONFLICT = 126;
public static final int MSG_NONUNIQUE_REF = 127;
public static final int MSG_FORWARD_ELEMENT_REF = 128;
public static final int MSG_MISSING_RULE_ARGS = 129;
public static final int MSG_RULE_HAS_NO_ARGS = 130;
public static final int MSG_ARGS_ON_TOKEN_REF = 131;
public static final int MSG_RULE_REF_AMBIG_WITH_RULE_IN_ALT = 132;
public static final int MSG_ILLEGAL_OPTION = 133;
public static final int MSG_LIST_LABEL_INVALID_UNLESS_RETVAL_STRUCT = 134;
public static final int MSG_UNDEFINED_TOKEN_REF_IN_REWRITE = 135;
public static final int MSG_REWRITE_ELEMENT_NOT_PRESENT_ON_LHS = 136;
public static final int MSG_UNDEFINED_LABEL_REF_IN_REWRITE = 137;
public static final int MSG_NO_GRAMMAR_START_RULE = 138;
public static final int MSG_EMPTY_COMPLEMENT = 139;
public static final int MSG_UNKNOWN_DYNAMIC_SCOPE = 140;
public static final int MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE = 141;
public static final int MSG_ISOLATED_RULE_ATTRIBUTE = 142;
public static final int MSG_INVALID_ACTION_SCOPE = 143;
public static final int MSG_ACTION_REDEFINITION = 144;
public static final int MSG_DOUBLE_QUOTES_ILLEGAL = 145;
public static final int MSG_INVALID_TEMPLATE_ACTION = 146;
public static final int MSG_MISSING_ATTRIBUTE_NAME = 147;
public static final int MSG_ARG_INIT_VALUES_ILLEGAL = 148;
public static final int MSG_REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION = 149;
public static final int MSG_NO_RULES = 150;
public static final int MSG_WRITE_TO_READONLY_ATTR = 151;
public static final int MSG_MISSING_AST_TYPE_IN_TREE_GRAMMAR = 152;
public static final int MSG_REWRITE_FOR_MULTI_ELEMENT_ALT = 153;
public static final int MSG_RULE_INVALID_SET = 154;
public static final int MSG_HETERO_ILLEGAL_IN_REWRITE_ALT = 155;
public static final int MSG_NO_SUCH_GRAMMAR_SCOPE = 156;
public static final int MSG_NO_SUCH_RULE_IN_SCOPE = 157;
public static final int MSG_TOKEN_ALIAS_CONFLICT = 158;
public static final int MSG_TOKEN_ALIAS_REASSIGNMENT = 159;
public static final int MSG_TOKEN_VOCAB_IN_DELEGATE = 160;
public static final int MSG_INVALID_IMPORT = 161;
public static final int MSG_IMPORTED_TOKENS_RULE_EMPTY = 162;
public static final int MSG_IMPORT_NAME_CLASH = 163;
public static final int MSG_AST_OP_WITH_NON_AST_OUTPUT_OPTION = 164;
public static final int MSG_AST_OP_IN_ALT_WITH_REWRITE = 165;
// GRAMMAR WARNINGS
public static final int MSG_GRAMMAR_NONDETERMINISM = 200; // A predicts alts 1,2
public static final int MSG_UNREACHABLE_ALTS = 201; // nothing predicts alt i
public static final int MSG_DANGLING_STATE = 202; // no edges out of state
public static final int MSG_INSUFFICIENT_PREDICATES = 203;
public static final int MSG_DUPLICATE_SET_ENTRY = 204; // (A|A)
public static final int MSG_ANALYSIS_ABORTED = 205;
public static final int MSG_RECURSION_OVERLOW = 206;
public static final int MSG_LEFT_RECURSION = 207;
public static final int MSG_UNREACHABLE_TOKENS = 208; // nothing predicts token
public static final int MSG_TOKEN_NONDETERMINISM = 209; // alts of Tokens rule
public static final int MSG_LEFT_RECURSION_CYCLES = 210;
public static final int MSG_NONREGULAR_DECISION = 211;
public static final int MAX_MESSAGE_NUMBER = 211;
/** Do not do perform analysis if one of these happens */
public static final BitSet ERRORS_FORCING_NO_ANALYSIS = new BitSet() {
{
add(MSG_RULE_REDEFINITION);
add(MSG_UNDEFINED_RULE_REF);
add(MSG_LEFT_RECURSION_CYCLES);
add(MSG_REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION);
add(MSG_NO_RULES);
add(MSG_NO_SUCH_GRAMMAR_SCOPE);
add(MSG_NO_SUCH_RULE_IN_SCOPE);
add(MSG_LEXER_RULES_NOT_ALLOWED);
// TODO: ...
}
};
/** Do not do code gen if one of these happens */
public static final BitSet ERRORS_FORCING_NO_CODEGEN = new BitSet() {
{
add(MSG_NONREGULAR_DECISION);
add(MSG_RECURSION_OVERLOW);
add(MSG_UNREACHABLE_ALTS);
add(MSG_FILE_AND_GRAMMAR_NAME_DIFFER);
add(MSG_INVALID_IMPORT);
add(MSG_AST_OP_WITH_NON_AST_OUTPUT_OPTION);
// TODO: ...
}
};
/** Only one error can be emitted for any entry in this table.
* Map<String,Set> where the key is a method name like danglingState.
* The set is whatever that method accepts or derives like a DFA.
*/
public static final Map emitSingleError = new HashMap() {
{
put("danglingState", new HashSet());
}
};
/** Messages should be sensitive to the locale. */
private static Locale locale;
private static String formatName;
/** Each thread might need it's own error listener; e.g., a GUI with
* multiple window frames holding multiple grammars.
*/
private static Map threadToListenerMap = new HashMap();
static class ErrorState {
public int errors;
public int warnings;
public int infos;
/** Track all msgIDs; we use to abort later if necessary
* also used in Message to find out what type of message it is via getMessageType()
*/
public BitSet errorMsgIDs = new BitSet();
public BitSet warningMsgIDs = new BitSet();
// TODO: figure out how to do info messages. these do not have IDs...kr
//public BitSet infoMsgIDs = new BitSet();
}
/** Track the number of errors regardless of the listener but track
* per thread.
*/
private static Map threadToErrorStateMap = new HashMap();
/** Each thread has its own ptr to a Tool object, which knows how
* to panic, for example. In a GUI, the thread might just throw an Error
* to exit rather than the suicide System.exit.
*/
private static Map threadToToolMap = new HashMap();
/** The group of templates that represent all possible ANTLR errors. */
private static StringTemplateGroup messages;
/** The group of templates that represent the current message format. */
private static StringTemplateGroup format;
/** From a msgID how can I get the name of the template that describes
* the error or warning?
*/
private static String[] idToMessageTemplateName = new String[MAX_MESSAGE_NUMBER+1];
static ANTLRErrorListener theDefaultErrorListener = new ANTLRErrorListener() {
public void info(String msg) {
if (formatWantsSingleLineMessage()) {
msg = msg.replaceAll("\n", " ");
}
System.err.println(msg);
}
public void error(Message msg) {
String outputMsg = msg.toString();
if (formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
System.err.println(outputMsg);
}
public void warning(Message msg) {
String outputMsg = msg.toString();
if (formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
System.err.println(outputMsg);
}
public void error(ToolMessage msg) {
String outputMsg = msg.toString();
if (formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
System.err.println(outputMsg);
}
};
/** Handle all ST error listeners here (code gen, Grammar, and this class
* use templates.
*/
static StringTemplateErrorListener initSTListener =
new StringTemplateErrorListener() {
public void error(String s, Throwable e) {
System.err.println("ErrorManager init error: "+s);
if ( e!=null ) {
System.err.println("exception: "+e);
}
/*
if ( e!=null ) {
e.printStackTrace(System.err);
}
*/
}
public void warning(String s) {
System.err.println("ErrorManager init warning: "+s);
}
public void debug(String s) {}
};
/** During verification of the messages group file, don't gen errors.
* I'll handle them here. This is used only after file has loaded ok
* and only for the messages STG.
*/
static StringTemplateErrorListener blankSTListener =
new StringTemplateErrorListener() {
public void error(String s, Throwable e) {}
public void warning(String s) {}
public void debug(String s) {}
};
/** Errors during initialization related to ST must all go to System.err.
*/
static StringTemplateErrorListener theDefaultSTListener =
new StringTemplateErrorListener() {
public void error(String s, Throwable e) {
if ( e instanceof InvocationTargetException ) {
e = ((InvocationTargetException)e).getTargetException();
}
ErrorManager.error(ErrorManager.MSG_INTERNAL_ERROR, s, e);
}
public void warning(String s) {
ErrorManager.warning(ErrorManager.MSG_INTERNAL_WARNING, s);
}
public void debug(String s) {
}
};
// make sure that this class is ready to use after loading
static {
initIdToMessageNameMapping();
// it is inefficient to set the default locale here if another
// piece of code is going to set the locale, but that would
// require that a user call an init() function or something. I prefer
// that this class be ready to go when loaded as I'm absentminded ;)
setLocale(Locale.getDefault());
// try to load the message format group
// the user might have specified one on the command line
// if not, or if the user has given an illegal value, we will fall back to "antlr"
setFormat("antlr");
}
public static StringTemplateErrorListener getStringTemplateErrorListener() {
return theDefaultSTListener;
}
/** We really only need a single locale for entire running ANTLR code
* in a single VM. Only pay attention to the language, not the country
* so that French Canadians and French Frenchies all get the same
* template file, fr.stg. Just easier this way.
*/
public static void setLocale(Locale locale) {
ErrorManager.locale = locale;
String language = locale.getLanguage();
String fileName = "org/antlr/tool/templates/messages/languages/"+language+".stg";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream(fileName);
if ( is==null ) {
cl = ErrorManager.class.getClassLoader();
is = cl.getResourceAsStream(fileName);
}
if ( is==null && language.equals(Locale.US.getLanguage()) ) {
rawError("ANTLR installation corrupted; cannot find English messages file "+fileName);
panic();
}
else if ( is==null ) {
//rawError("no such locale file "+fileName+" retrying with English locale");
setLocale(Locale.US); // recurse on this rule, trying the US locale
return;
}
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(is));
messages = new StringTemplateGroup(br,
AngleBracketTemplateLexer.class,
initSTListener);
br.close();
}
catch (IOException ioe) {
rawError("error reading message file "+fileName, ioe);
}
finally {
if ( br!=null ) {
try {
br.close();
}
catch (IOException ioe) {
rawError("cannot close message file "+fileName, ioe);
}
}
}
messages.setErrorListener(blankSTListener);
boolean messagesOK = verifyMessages();
if ( !messagesOK && language.equals(Locale.US.getLanguage()) ) {
rawError("ANTLR installation corrupted; English messages file "+language+".stg incomplete");
panic();
}
else if ( !messagesOK ) {
setLocale(Locale.US); // try US to see if that will work
}
}
/** The format gets reset either from the Tool if the user supplied a command line option to that effect
* Otherwise we just use the default "antlr".
*/
public static void setFormat(String formatName) {
ErrorManager.formatName = formatName;
String fileName = "org/antlr/tool/templates/messages/formats/"+formatName+".stg";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream(fileName);
if ( is==null ) {
cl = ErrorManager.class.getClassLoader();
is = cl.getResourceAsStream(fileName);
}
if ( is==null && formatName.equals("antlr") ) {
rawError("ANTLR installation corrupted; cannot find ANTLR messages format file "+fileName);
panic();
}
else if ( is==null ) {
rawError("no such message format file "+fileName+" retrying with default ANTLR format");
setFormat("antlr"); // recurse on this rule, trying the default message format
return;
}
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(is));
format = new StringTemplateGroup(br,
AngleBracketTemplateLexer.class,
initSTListener);
}
finally {
try {
if ( br!=null ) {
br.close();
}
}
catch (IOException ioe) {
rawError("cannot close message format file "+fileName, ioe);
}
}
format.setErrorListener(blankSTListener);
boolean formatOK = verifyFormat();
if ( !formatOK && formatName.equals("antlr") ) {
rawError("ANTLR installation corrupted; ANTLR messages format file "+formatName+".stg incomplete");
panic();
}
else if ( !formatOK ) {
setFormat("antlr"); // recurse on this rule, trying the default message format
}
}
/** Encodes the error handling found in setLocale, but does not trigger
* panics, which would make GUI tools die if ANTLR's installation was
* a bit screwy. Duplicated code...ick.
public static Locale getLocaleForValidMessages(Locale locale) {
ErrorManager.locale = locale;
String language = locale.getLanguage();
String fileName = "org/antlr/tool/templates/messages/"+language+".stg";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream(fileName);
if ( is==null && language.equals(Locale.US.getLanguage()) ) {
return null;
}
else if ( is==null ) {
return getLocaleForValidMessages(Locale.US); // recurse on this rule, trying the US locale
}
boolean messagesOK = verifyMessages();
if ( !messagesOK && language.equals(Locale.US.getLanguage()) ) {
return null;
}
else if ( !messagesOK ) {
return getLocaleForValidMessages(Locale.US); // try US to see if that will work
}
return true;
}
*/
/** In general, you'll want all errors to go to a single spot.
* However, in a GUI, you might have two frames up with two
* different grammars. Two threads might launch to process the
* grammars--you would want errors to go to different objects
* depending on the thread. I store a single listener per
* thread.
*/
public static void setErrorListener(ANTLRErrorListener listener) {
threadToListenerMap.put(Thread.currentThread(), listener);
}
public static void removeErrorListener() {
threadToListenerMap.remove(Thread.currentThread());
}
public static void setTool(Tool tool) {
threadToToolMap.put(Thread.currentThread(), tool);
}
/** Given a message ID, return a StringTemplate that somebody can fill
* with data. We need to convert the int ID to the name of a template
* in the messages ST group.
*/
public static StringTemplate getMessage(int msgID) {
String msgName = idToMessageTemplateName[msgID];
return messages.getInstanceOf(msgName);
}
public static String getMessageType(int msgID) {
if (getErrorState().warningMsgIDs.member(msgID)) {
return messages.getInstanceOf("warning").toString();
}
else if (getErrorState().errorMsgIDs.member(msgID)) {
return messages.getInstanceOf("error").toString();
}
assertTrue(false, "Assertion failed! Message ID " + msgID + " created but is not present in errorMsgIDs or warningMsgIDs.");
return "";
}
/** Return a StringTemplate that refers to the current format used for
* emitting messages.
*/
public static StringTemplate getLocationFormat() {
return format.getInstanceOf("location");
}
public static StringTemplate getReportFormat() {
return format.getInstanceOf("report");
}
public static StringTemplate getMessageFormat() {
return format.getInstanceOf("message");
}
public static boolean formatWantsSingleLineMessage() {
return format.getInstanceOf("wantsSingleLineMessage").toString().equals("true");
}
public static ANTLRErrorListener getErrorListener() {
ANTLRErrorListener el =
(ANTLRErrorListener)threadToListenerMap.get(Thread.currentThread());
if ( el==null ) {
return theDefaultErrorListener;
}
return el;
}
public static ErrorState getErrorState() {
ErrorState ec =
(ErrorState)threadToErrorStateMap.get(Thread.currentThread());
if ( ec==null ) {
ec = new ErrorState();
threadToErrorStateMap.put(Thread.currentThread(), ec);
}
return ec;
}
public static int getNumErrors() {
return getErrorState().errors;
}
public static void resetErrorState() {
ErrorState ec = new ErrorState();
threadToErrorStateMap.put(Thread.currentThread(), ec);
}
public static void info(String msg) {
getErrorState().infos++;
getErrorListener().info(msg);
}
public static void error(int msgID) {
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(new ToolMessage(msgID));
}
public static void error(int msgID, Throwable e) {
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(new ToolMessage(msgID,e));
}
public static void error(int msgID, Object arg) {
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(new ToolMessage(msgID, arg));
}
public static void error(int msgID, Object arg, Object arg2) {
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(new ToolMessage(msgID, arg, arg2));
}
public static void error(int msgID, Object arg, Throwable e) {
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(new ToolMessage(msgID, arg, e));
}
public static void warning(int msgID, Object arg) {
getErrorState().warnings++;
getErrorState().warningMsgIDs.add(msgID);
getErrorListener().warning(new ToolMessage(msgID, arg));
}
public static void nondeterminism(DecisionProbe probe,
DFAState d)
{
getErrorState().warnings++;
Message msg = new GrammarNonDeterminismMessage(probe,d);
getErrorState().warningMsgIDs.add(msg.msgID);
getErrorListener().warning(msg);
}
public static void danglingState(DecisionProbe probe,
DFAState d)
{
getErrorState().errors++;
Message msg = new GrammarDanglingStateMessage(probe,d);
getErrorState().errorMsgIDs.add(msg.msgID);
Set seen = (Set)emitSingleError.get("danglingState");
if ( !seen.contains(d.dfa.decisionNumber+"|"+d.getAltSet()) ) {
getErrorListener().error(msg);
// we've seen this decision and this alt set; never again
seen.add(d.dfa.decisionNumber+"|"+d.getAltSet());
}
}
public static void analysisAborted(DecisionProbe probe)
{
getErrorState().warnings++;
Message msg = new GrammarAnalysisAbortedMessage(probe);
getErrorState().warningMsgIDs.add(msg.msgID);
getErrorListener().warning(msg);
}
public static void unreachableAlts(DecisionProbe probe,
List alts)
{
getErrorState().errors++;
Message msg = new GrammarUnreachableAltsMessage(probe,alts);
getErrorState().errorMsgIDs.add(msg.msgID);
getErrorListener().error(msg);
}
public static void insufficientPredicates(DecisionProbe probe,
DFAState d,
Map<Integer, Set<Token>> altToUncoveredLocations)
{
getErrorState().warnings++;
Message msg = new GrammarInsufficientPredicatesMessage(probe,d,altToUncoveredLocations);
getErrorState().warningMsgIDs.add(msg.msgID);
getErrorListener().warning(msg);
}
public static void nonLLStarDecision(DecisionProbe probe) {
getErrorState().errors++;
Message msg = new NonRegularDecisionMessage(probe, probe.getNonDeterministicAlts());
getErrorState().errorMsgIDs.add(msg.msgID);
getErrorListener().error(msg);
}
public static void recursionOverflow(DecisionProbe probe,
DFAState sampleBadState,
int alt,
Collection targetRules,
Collection callSiteStates)
{
getErrorState().errors++;
Message msg = new RecursionOverflowMessage(probe,sampleBadState, alt,
targetRules, callSiteStates);
getErrorState().errorMsgIDs.add(msg.msgID);
getErrorListener().error(msg);
}
/*
// TODO: we can remove I think. All detected now with cycles check.
public static void leftRecursion(DecisionProbe probe,
int alt,
Collection targetRules,
Collection callSiteStates)
{
getErrorState().warnings++;
Message msg = new LeftRecursionMessage(probe, alt, targetRules, callSiteStates);
getErrorState().warningMsgIDs.add(msg.msgID);
getErrorListener().warning(msg);
}
*/
public static void leftRecursionCycles(Collection cycles) {
getErrorState().errors++;
Message msg = new LeftRecursionCyclesMessage(cycles);
getErrorState().errorMsgIDs.add(msg.msgID);
getErrorListener().warning(msg);
}
public static void grammarError(int msgID,
Grammar g,
Token token,
Object arg,
Object arg2)
{
getErrorState().errors++;
Message msg = new GrammarSemanticsMessage(msgID,g,token,arg,arg2);
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(msg);
}
public static void grammarError(int msgID,
Grammar g,
Token token,
Object arg)
{
grammarError(msgID,g,token,arg,null);
}
public static void grammarError(int msgID,
Grammar g,
Token token)
{
grammarError(msgID,g,token,null,null);
}
public static void grammarWarning(int msgID,
Grammar g,
Token token,
Object arg,
Object arg2)
{
getErrorState().warnings++;
Message msg = new GrammarSemanticsMessage(msgID,g,token,arg,arg2);
getErrorState().warningMsgIDs.add(msgID);
getErrorListener().warning(msg);
}
public static void grammarWarning(int msgID,
Grammar g,
Token token,
Object arg)
{
grammarWarning(msgID,g,token,arg,null);
}
public static void grammarWarning(int msgID,
Grammar g,
Token token)
{
grammarWarning(msgID,g,token,null,null);
}
public static void syntaxError(int msgID,
Grammar grammar,
Token token,
Object arg,
antlr.RecognitionException re)
{
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
getErrorListener().error(
new GrammarSyntaxMessage(msgID,grammar,token,arg,re)
);
}
public static void internalError(Object error, Throwable e) {
StackTraceElement location = getLastNonErrorManagerCodeLocation(e);
String msg = "Exception "+e+"@"+location+": "+error;
error(MSG_INTERNAL_ERROR, msg);
}
public static void internalError(Object error) {
StackTraceElement location =
getLastNonErrorManagerCodeLocation(new Exception());
String msg = location+": "+error;
error(MSG_INTERNAL_ERROR, msg);
}
public static boolean doNotAttemptAnalysis() {
return !getErrorState().errorMsgIDs.and(ERRORS_FORCING_NO_ANALYSIS).isNil();
}
public static boolean doNotAttemptCodeGen() {
return doNotAttemptAnalysis() ||
!getErrorState().errorMsgIDs.and(ERRORS_FORCING_NO_CODEGEN).isNil();
}
/** Return first non ErrorManager code location for generating messages */
private static StackTraceElement getLastNonErrorManagerCodeLocation(Throwable e) {
StackTraceElement[] stack = e.getStackTrace();
int i = 0;
for (; i < stack.length; i++) {
StackTraceElement t = stack[i];
if ( t.toString().indexOf("ErrorManager")<0 ) {
break;
}
}
StackTraceElement location = stack[i];
return location;
}
// A S S E R T I O N C O D E
public static void assertTrue(boolean condition, String message) {
if ( !condition ) {
internalError(message);
}
}
// S U P P O R T C O D E
protected static boolean initIdToMessageNameMapping() {
// make sure a message exists, even if it's just to indicate a problem
for (int i = 0; i < idToMessageTemplateName.length; i++) {
idToMessageTemplateName[i] = "INVALID MESSAGE ID: "+i;
}
// get list of fields and use it to fill in idToMessageTemplateName mapping
Field[] fields = ErrorManager.class.getFields();
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String fieldName = f.getName();
if ( !fieldName.startsWith("MSG_") ) {
continue;
}
String templateName =
fieldName.substring("MSG_".length(),fieldName.length());
int msgID = 0;
try {
// get the constant value from this class object
msgID = f.getInt(ErrorManager.class);
}
catch (IllegalAccessException iae) {
System.err.println("cannot get const value for "+f.getName());
continue;
}
if ( fieldName.startsWith("MSG_") ) {
idToMessageTemplateName[msgID] = templateName;
}
}
return true;
}
/** Use reflection to find list of MSG_ fields and then verify a
* template exists for each one from the locale's group.
*/
protected static boolean verifyMessages() {
boolean ok = true;
Field[] fields = ErrorManager.class.getFields();
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String fieldName = f.getName();
String templateName =
fieldName.substring("MSG_".length(),fieldName.length());
if ( fieldName.startsWith("MSG_") ) {
if ( !messages.isDefined(templateName) ) {
System.err.println("Message "+templateName+" in locale "+
locale+" not found");
ok = false;
}
}
}
// check for special templates
if (!messages.isDefined("warning")) {
System.err.println("Message template 'warning' not found in locale "+ locale);
ok = false;
}
if (!messages.isDefined("error")) {
System.err.println("Message template 'error' not found in locale "+ locale);
ok = false;
}
return ok;
}
/** Verify the message format template group */
protected static boolean verifyFormat() {
boolean ok = true;
if (!format.isDefined("location")) {
System.err.println("Format template 'location' not found in " + formatName);
ok = false;
}
if (!format.isDefined("message")) {
System.err.println("Format template 'message' not found in " + formatName);
ok = false;
}
if (!format.isDefined("report")) {
System.err.println("Format template 'report' not found in " + formatName);
ok = false;
}
return ok;
}
/** If there are errors during ErrorManager init, we have no choice
* but to go to System.err.
*/
static void rawError(String msg) {
System.err.println(msg);
}
static void rawError(String msg, Throwable e) {
rawError(msg);
e.printStackTrace(System.err);
}
/** I *think* this will allow Tool subclasses to exit gracefully
* for GUIs etc...
*/
public static void panic() {
Tool tool = (Tool)threadToToolMap.get(Thread.currentThread());
if ( tool==null ) {
// no tool registered, exit
throw new Error("ANTLR ErrorManager panic");
}
else {
tool.panic();
}
}
}
| {
"content_hash": "19466cc640ec24c92b08be01791dfd97",
"timestamp": "",
"source": "github",
"line_count": 925,
"max_line_length": 126,
"avg_line_length": 34.71891891891892,
"alnum_prop": 0.7124085318387047,
"repo_name": "neelance/antlr4ruby",
"id": "63b31024b16b72044a46bb73a6de95ce779a0e1c",
"size": "33559",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "antlr4ruby/src/org/antlr/tool/ErrorManager.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "2588943"
},
{
"name": "Ruby",
"bytes": "3099327"
},
{
"name": "Smalltalk",
"bytes": "1692"
}
],
"symlink_target": ""
} |
module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
# instead of rendering.
module Streaming
DEFAULT_SEND_FILE_OPTIONS = {
:type => 'application/octet-stream'.freeze,
:disposition => 'attachment'.freeze,
:stream => true,
:buffer_size => 4096,
:x_sendfile => false
}.freeze
X_SENDFILE_HEADER = 'X-Sendfile'.freeze
protected
# Sends the file, by default streaming it 4096 bytes at a time. This way the
# whole file doesn't need to be read into memory at once. This makes it
# feasible to send even large files. You can optionally turn off streaming
# and send the whole file at once.
#
# Be careful to sanitize the path parameter if it is coming from a web
# page. <tt>send_file(params[:path])</tt> allows a malicious user to
# download any file on your server.
#
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# Defaults to <tt>File.basename(path)</tt>.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <tt>:length</tt> - used to manually override the length (in bytes) of the content that
# is going to be sent to the client. Defaults to <tt>File.size(path)</tt>.
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
# Valid values are 'inline' and 'attachment' (default).
# * <tt>:stream</tt> - whether to send the file to the user agent as it is read (+true+)
# or to read the entire file before sending (+false+). Defaults to +true+.
# * <tt>:buffer_size</tt> - specifies size (in bytes) of the buffer used to stream the file.
# Defaults to 4096.
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to '200 OK'.
# * <tt>:url_based_filename</tt> - set to +true+ if you want the browser guess the filename from
# the URL, which is necessary for i18n filenames on certain browsers
# (setting <tt>:filename</tt> overrides this option).
# * <tt>:x_sendfile</tt> - uses X-Sendfile to send the file when set to +true+. This is currently
# only available with Lighttpd/Apache2 and specific modules installed and activated. Since this
# uses the web server to send the file, this may lower memory consumption on your server and
# it will not block your application for further requests.
# See http://blog.lighttpd.net/articles/2006/07/02/x-sendfile and
# http://tn123.ath.cx/mod_xsendfile/ for details. Defaults to +false+.
#
# The default Content-Type and Content-Disposition headers are
# set to download arbitrary binary files in as many browsers as
# possible. IE versions 4, 5, 5.5, and 6 are all known to have
# a variety of quirks (especially when downloading over SSL).
#
# Simple download:
#
# send_file '/path/to.zip'
#
# Show a JPEG in the browser:
#
# send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
#
# Show a 404 page in the browser:
#
# send_file '/path/to/404.html', :type => 'text/html; charset=utf-8', :status => 404
#
# Read about the other Content-* HTTP headers if you'd like to
# provide the user with more information (such as Content-Description) in
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11.
#
# Also be aware that the document may be cached by proxies and browsers.
# The Pragma and Cache-Control headers declare how the file may be cached
# by intermediaries. They default to require clients to validate with
# the server before releasing cached responses. See
# http://www.mnot.net/cache_docs/ for an overview of web caching and
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
# for the Cache-Control header spec.
def send_file(path, options = {}) #:doc:
raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)
options[:length] ||= File.size(path)
options[:filename] ||= File.basename(path) unless options[:url_based_filename]
send_file_headers! options
@performed_render = false
if options[:x_sendfile]
logger.info "Sending #{X_SENDFILE_HEADER} header #{path}" if logger
head options[:status], X_SENDFILE_HEADER => path
else
if options[:stream]
render :status => options[:status], :text => Proc.new { |response, output|
logger.info "Streaming file #{path}" unless logger.nil?
len = options[:buffer_size] || 4096
File.open(path, 'rb') do |file|
while buf = file.read(len)
output.write(buf)
end
end
}
else
logger.info "Sending file #{path}" unless logger.nil?
File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }
end
end
end
# Sends the given binary data to the browser. This method is similar to
# <tt>render :text => data</tt>, but also allows you to specify whether
# the browser should display the response as a file attachment (i.e. in a
# download dialog) or as inline data. You may also set the content type,
# the apparent file name, and other things.
#
# Options:
# * <tt>:filename</tt> - suggests a filename for the browser to use.
# * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
# either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
# Valid values are 'inline' and 'attachment' (default).
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to '200 OK'.
#
# Generic data download:
#
# send_data buffer
#
# Download a dynamically-generated tarball:
#
# send_data generate_tgz('dir'), :filename => 'dir.tgz'
#
# Display an image Active Record in the browser:
#
# send_data image.data, :type => image.content_type, :disposition => 'inline'
#
# See +send_file+ for more information on HTTP Content-* headers and caching.
#
# <b>Tip:</b> if you want to stream large amounts of on-the-fly generated
# data to the browser, then use <tt>render :text => proc { ... }</tt>
# instead. See ActionController::Base#render for more information.
def send_data(data, options = {}) #:doc:
logger.info "Sending data #{options[:filename]}" if logger
send_file_headers! options.merge(:length => data.size)
@performed_render = false
render :status => options[:status], :text => data
end
private
def send_file_headers!(options)
options.update(DEFAULT_SEND_FILE_OPTIONS.merge(options))
[:length, :type, :disposition].each do |arg|
raise ArgumentError, ":#{arg} option required" if options[arg].nil?
end
disposition = options[:disposition].dup || 'attachment'
disposition <<= %(; filename="#{options[:filename]}") if options[:filename]
content_type = options[:type]
if content_type.is_a?(Symbol)
raise ArgumentError, "Unknown MIME type #{options[:type]}" unless Mime::EXTENSION_LOOKUP.has_key?(content_type.to_s)
content_type = Mime::Type.lookup_by_extension(content_type.to_s)
end
content_type = content_type.to_s.strip # fixes a problem with extra '\r' with some browsers
headers.merge!(
'Content-Length' => options[:length].to_s,
'Content-Type' => content_type,
'Content-Disposition' => disposition,
'Content-Transfer-Encoding' => 'binary'
)
# Fix a problem with IE 6.0 on opening downloaded files:
# If Cache-Control: no-cache is set (which Rails does by default),
# IE removes the file it just downloaded from its cache immediately
# after it displays the "open/save" dialog, which means that if you
# hit "open" the file isn't there anymore when the application that
# is called for handling the download is run, so let's workaround that
headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'
end
end
end
| {
"content_hash": "2227457f78ec036c85c890fe41ceab4a",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 126,
"avg_line_length": 49.92178770949721,
"alnum_prop": 0.625,
"repo_name": "unilogic/zackup",
"id": "8a9fbfc1e09322891f8412525aad912642d605f5",
"size": "8936",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "vendor/rails/actionpack/lib/action_controller/streaming.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "243829"
},
{
"name": "Ruby",
"bytes": "140663"
}
],
"symlink_target": ""
} |
package main
import "fmt"
type Curr struct {
Currency string
Name string
Country string
Number int
}
var currencies = []Curr{
Curr{"DZD", "Algerian Dinar", "Algeria", 12},
Curr{"AUD", "Australian Dollar", "Australia", 36},
Curr{"EUR", "Euro", "Belgium", 978},
Curr{"CLP", "Chilean Peso", "Chile", 152},
Curr{"EUR", "Euro", "Greece", 978},
Curr{"HTG", "Gourde", "Haiti", 332},
Curr{"HKD", "Hong Kong Dollar", "Hong Koong", 344},
Curr{"KES", "Kenyan Shilling", "Kenya", 404},
Curr{"MXN", "Mexican Peso", "Mexico", 484},
Curr{"USD", "US Dollar", "United States", 840},
Curr{"EUR", "Euro", "Italy", 978},
}
func isDollar(curr Curr) bool {
var result bool
switch curr {
default:
result = false
case Curr{"AUD", "Australian Dollar", "Australia", 36}:
result = true
case Curr{"HKD", "Hong Kong Dollar", "Hong Koong", 344}:
result = true
case Curr{"USD", "US Dollar", "United States", 840}:
result = true
}
return result
}
func isDollar2(curr Curr) bool {
switch curr {
case Curr{"AUD", "Australian Dollar", "Australia", 36}:
fallthrough
case Curr{"HKD", "Hong Kong Dollar", "Hong Koong", 344}:
fallthrough
case Curr{"USD", "US Dollar", "United States", 840}:
return true
default:
return false
}
}
func isEuro(curr Curr) bool {
switch curr {
case currencies[2], currencies[4], currencies[10]:
return true
default:
return false
}
}
func main() {
curr := Curr{"EUR", "Euro", "Italy", 978}
if isDollar(curr) {
fmt.Printf("%+v is Dollar currency\n", curr)
} else if isEuro(curr) {
fmt.Printf("%+v is Euro currency\n", curr)
} else {
fmt.Println("Currency is not Dollar or Euro")
}
dol := Curr{"AUD", "Australian Dollar", "Australia", 36}
if isDollar2(dol) {
fmt.Println("Dollar currency found:", dol)
}
}
| {
"content_hash": "77bc4e2096f5a8194b835d183add431e",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 57,
"avg_line_length": 23.07792207792208,
"alnum_prop": 0.6398424310635903,
"repo_name": "vladimirvivien/learning-go",
"id": "51f28e975c1872daa4a1d2965aa2b1dd63ff0506",
"size": "1777",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ch03/switchstmt.go",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "8912"
},
{
"name": "Go",
"bytes": "181411"
},
{
"name": "HTML",
"bytes": "4503"
}
],
"symlink_target": ""
} |
package com.siyeh.ig.fixes.style;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.testFramework.IdeaTestUtil;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.IGQuickFixesTestCase;
import com.siyeh.ig.style.MethodRefCanBeReplacedWithLambdaInspection;
public class MethodRefCanBeReplacedWithLambdaFixTest extends IGQuickFixesTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
ModuleRootModificationUtil.setModuleSdk(myModule, IdeaTestUtil.getMockJdk18());
myFixture.enableInspections(new MethodRefCanBeReplacedWithLambdaInspection());
myDefaultHint = InspectionGadgetsBundle.message("method.ref.can.be.replaced.with.lambda.quickfix");
}
@Override
protected String getRelativePath() {
return "style/methodRefs2lambda";
}
public void testRedundantCast() {
doTest();
}
public void testStaticMethodRef() {
doTest();
}
public void testThisRefs() {
doTest();
}
public void testSuperRefs() {
doTest();
}
public void testExprRefs() {
doTest();
}
public void testReceiver() {
doTest();
}
public void testNewRefs() {
doTest();
}
public void testNewRefsDefaultConstructor() {
doTest();
}
public void testNewRefsInnerClass() {
doTest();
}
public void testNewRefsStaticInnerClass() {
doTest();
}
public void testNewRefsInference() {
doTest(myDefaultHint);
}
public void testNewRefsInference1() {
doTest();
}
public void testAmbiguity() {
doTest();
}
public void testSubst() {
doTest();
}
public void testTypeElementOnTheLeft() {
doTest();
}
public void testNewDefaultConstructor() {
doTest();
}
public void testArrayConstructorRef() {
doTest();
}
public void testArrayConstructorRef2Dim() {
doTest();
}
public void testArrayMethodRef() {
doTest(myDefaultHint );
}
public void testArrayConstructorRefUniqueParamName() {
doTest();
}
public void testNameConflicts() {
doTest();
}
public void testIntroduceVariableForSideEffectQualifier() {
doTest(myDefaultHint + " (side effects)");
}
public void testCollapseToExpressionLambdaWhenCast() {
doTest();
}
public void testPreserveExpressionQualifier() {
doTest();
}
public void testNoUnderscoreInLambdaParameterName() {
doTest();
}
public void testNoCastWhereCaptureArgIsExpected() {
doTest();
}
public void testSpecifyFormalParameterTypesWhenMethodReferenceWasExactAndTypeOfParameterIsUnknown() {
doTest();
}
public void testNewArrayMethodReferenceHasNoSideEffects() { doTest(); }
public void testExplicitTypeRequired() { doTest(); }
public void testEnsureNoConversionIsSuggestedWhenLambdaWithoutCantBeInferredAndFormalParametersAreNotDenotable() {
assertQuickfixNotAvailable();
}
}
| {
"content_hash": "2f70c502e1856a38c94858841e2994ef",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 116,
"avg_line_length": 20.884057971014492,
"alnum_prop": 0.7182512144344205,
"repo_name": "ThiagoGarciaAlves/intellij-community",
"id": "3466af99c0e4c78c48f4417f923d3432c1207987",
"size": "3482",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/MethodRefCanBeReplacedWithLambdaFixTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "63518"
},
{
"name": "C",
"bytes": "214180"
},
{
"name": "C#",
"bytes": "1538"
},
{
"name": "C++",
"bytes": "190028"
},
{
"name": "CSS",
"bytes": "111474"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Cucumber",
"bytes": "14382"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "FLUX",
"bytes": "57"
},
{
"name": "Groff",
"bytes": "35232"
},
{
"name": "Groovy",
"bytes": "2194261"
},
{
"name": "HTML",
"bytes": "1726130"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "148273590"
},
{
"name": "JavaScript",
"bytes": "125292"
},
{
"name": "Kotlin",
"bytes": "454154"
},
{
"name": "Lex",
"bytes": "166177"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "85969"
},
{
"name": "Objective-C",
"bytes": "28634"
},
{
"name": "Perl6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6570"
},
{
"name": "Python",
"bytes": "21460459"
},
{
"name": "Ruby",
"bytes": "1213"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "63190"
},
{
"name": "Smalltalk",
"bytes": "64"
},
{
"name": "TeX",
"bytes": "60798"
},
{
"name": "TypeScript",
"bytes": "6152"
},
{
"name": "XSLT",
"bytes": "113040"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.legacy.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.grids.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.frames.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.forms.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.tables.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.drawers.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.tabs.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/symphony.notices.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../../../assets/css/admin.css">
<script type="text/javascript" src="../../../../assets/js/jquery.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.collapsible.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.orderable.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.selectable.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.duplicator.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.tags.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.pickable.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.timeago.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.notify.js"></script>
<script type="text/javascript" src="../../../../assets/js/symphony.drawer.js"></script>
<script type="text/javascript" src="../../../../assets/js/admin.js"></script>
<script type="text/javascript">Symphony.Context.add('env', {"page-namespace":"\/blueprints\/events","0":"edit","1":"save_message"}); Symphony.Context.add('root', '/apps/symphony/html');</script>
<title>Save Message – Events – Symphony</title>
</head>
<body id="blueprints-events" class="edit save_message single">
<div id="wrapper">
<header id="header">
<p class="notice">Your Symphony installation is up to date, but the installer was still detected. For security reasons, it should be removed. <a href="#remove">Remove installer?</a></p>
<h1>
<a href="../../../../../">Symphony CMS</a>
</h1>
<ul id="session">
<li>
<a href="../../../../system/authors/edit/1/" data-id="1" data-name="John" data-type="developer">John Smith</a>
</li>
<li>
<a href="../../../../../" accesskey="l">Log out</a>
</li>
</ul>
<nav id="nav">
<ul class="content">
<li>Content
<ul>
<li>
<a href="../../../../publish/articles/">Articles</a>
</li>
<li>
<a href="../../../../publish/categories/">Categories</a>
</li>
<li>
<a href="../../../../publish/notes/">Notes</a>
</li>
<li>
<a href="../../../../publish/comments/">Comments</a>
</li>
<li>
<a href="../../../../publish/messages/">Messages</a>
</li>
</ul>
</li>
</ul>
<ul class="structure">
<li class="active">Blueprints
<ul>
<li>
<a href="../../../../blueprints/pages/">Pages</a>
</li>
<li>
<a href="../../../../blueprints/sections/">Sections</a>
</li>
<li>
<a href="../../../../blueprints/datasources/">Data Sources</a>
</li>
<li>
<a href="../../../../blueprints/events/">Events</a>
</li>
<li>
<a href="../../../../blueprints/utilities/">Utilities</a>
</li>
</ul>
</li>
<li>System
<ul>
<li>
<a href="../../../../system/authors/">Authors</a>
</li>
<li>
<a href="../../../../system/preferences/">Preferences</a>
</li>
<li>
<a href="../../../../system/extensions/">Extensions</a>
</li>
</ul>
</li>
</ul>
</nav>
</header>
<div id="context">
<div id="breadcrumbs">
<nav>
<p>
<a href="../../../../blueprints/events/">Events</a>
<span class="sep">›</span>
</p>
</nav>
<h2>Save Message</h2>
</div>
</div>
<div id="contents">
<form action="../../../../blueprints/events/edit/save_message/" method="post">
<fieldset class="settings picker">
<legend>Essentials</legend>
<div class="two columns">
<div class="column">
<label>Name
<input name="fields[name]" type="text" value="Save Message">
</label>
</div>
<div class="column">
<label>Source
<select name="fields[source]" id="event-context" class="picker">
<optgroup label="Sections" data-label="Sections">
<option value="1">Articles</option>
<option value="2">Categories</option>
<option value="4">Comments</option>
<option value="5">Images</option>
<option value="6" selected="selected">Messages</option>
<option value="3">Notes</option>
</optgroup>
</select>
</label>
</div>
</div>
</fieldset>
<div id="Sections" class="pickable">
<fieldset class="settings">
<legend>Filters</legend>
<p class="help">Event Filters add additional conditions or actions to an event.</p>
<select name="fields[filters][]" multiple="multiple">
<option value="admin-only">Admin Only</option>
<option value="send-email" selected="selected">Send Notification Email</option>
<option value="expect-multiple">Allow Multiple</option>
<option value="xss-fail">Filter XSS: Fail if malicious input is detected</option>
</select>
</fieldset>
</div>
<fieldset class="settings"><legend>Description</legend>
<h3>Success and Failure XML Examples</h3>
<p>When saved successfully, the following XML will be returned:</p>
<pre class="XML"><code><save-message result="success" type="create | edit">
<message>Entry [created | edited] successfully.</message>
</save-message></code></pre>
<p>When an error occurs during saving, due to either missing or invalid fields, the following XML will be returned:</p>
<pre class="XML"><code><save-message result="error">
<message>Entry encountered errors when saving.</message>
<field-name type="invalid | missing" />
...
</save-message></code></pre>
<p>The following is an example of what is returned if any filters fail:</p>
<pre class="XML"><code><save-message result="error">
<message>Entry encountered errors when saving.</message>
<filter name="admin-only" status="failed" />
<filter name="send-email" status="failed">Recipient username was invalid</filter>
...
</save-message></code></pre>
<h3>Example Front-end Form Markup</h3>
<p>This is an example of the form markup you can use on your frontend:</p>
<pre class="XML"><code><form method="post" action="" enctype="multipart/form-data">
<input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
<label>Name
<input name="fields[name]" type="text" />
</label>
<label>Email
<input name="fields[email]" type="text" />
</label>
<label>Subject
<input name="fields[subject]" type="text" />
</label>
<label>Message
<textarea name="fields[message]" rows="9" cols="50"></textarea>
</label>
<input name="action[save-message]" type="submit" value="Submit" />
</form></code></pre>
<p>To edit an existing entry, include the entry ID value of the entry in the form. This is best as a hidden field like so:</p>
<pre class="XML"><code><input name="id" type="hidden" value="23" /></code></pre>
<p>To redirect to a different location upon a successful save, include the redirect location in the form. This is best as a hidden field like so, where the value is the URL to redirect to:</p>
<pre class="XML"><code><input name="redirect" type="hidden" value="http://example.com/success/" /></code></pre>
<h3>Send Email Filter</h3>
<p>The send email filter, upon the event successfully saving the entry, takes input from the form and send an email to the desired recipient. <b>This filter currently does not work with the "Allow Multiple" option.</b> The following are the recognised fields:</p>
<pre class="XML"><code>send-email[sender-email] // Optional
send-email[sender-name] // Optional
send-email[reply-to-email] // Optional
send-email[reply-to-name] // Optional
send-email[subject]
send-email[body]
send-email[recipient] // list of comma-separated author usernames.</code></pre>
<p>All of these fields can be set dynamically using the exact field name of another field in the form as shown below in the example form:</p>
<pre class="XML"><code><form action="" method="post">
<fieldset>
<label>Name <input type="text" name="fields[author]" value="" /></label>
<label>Email <input type="text" name="fields[email]" value="" /></label>
<label>Message <textarea name="fields[message]" rows="5" cols="21"></textarea></label>
<input name="send-email[sender-email]" value="fields[email]" type="hidden" />
<input name="send-email[sender-name]" value="fields[author]" type="hidden" />
<input name="send-email[reply-to-email]" value="fields[email]" type="hidden" />
<input name="send-email[reply-to-name]" value="fields[author]" type="hidden" />
<input name="send-email[subject]" value="You are being contacted" type="hidden" />
<input name="send-email[body]" value="fields[message]" type="hidden" />
<input name="send-email[recipient]" value="fred" type="hidden" />
<input id="submit" type="submit" name="action[save-contact-form]" value="Send" />
</fieldset>
</form></code></pre></fieldset>
<div class="actions">
<input name="action[save]" type="submit" value="Save Changes" accesskey="s">
<button name="action[delete]" class="button confirm delete" title="Delete this event" type="submit" accesskey="d" data-message="Are you sure you want to delete this event?">Delete</button>
</div>
</form>
</div>
</div>
</body>
</html>
| {
"content_hash": "e74954d9526aa9c05f81459960699384",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 267,
"avg_line_length": 47.78947368421053,
"alnum_prop": 0.6071953010279001,
"repo_name": "bauhouse/html-symphony",
"id": "ab4179199e327fda13fee64c555b0d73b86dc0aa",
"size": "10896",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "symphony/blueprints/events/edit/save_message/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "73226"
}
],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: sharif ahrari
* Date: 7/6/2016
* Time: 3:06 AM
*/
namespace Cobonto\Commands;
use Illuminate\Support\Str;
use Module\Commands\ModuleCommand;
use Symfony\Component\Console\Input\InputArgument;
class ModelCommand extends ModuleCommand
{
/**
* @string name
*/
protected $name='cobonto:model';
protected function getStub()
{
return __DIR__.'/stubs/model.stub';
}
protected function getDefaultNamespace($Class)
{
return 'Cobonto\\Classes';
}
/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Model';
protected function getArguments()
{
return [
['class', InputArgument::REQUIRED, 'The name of the model'],
];
}
public function handle()
{
$class = $this->argument('class');
$path = $this->getPath($class);
$name = $this->parseName($class);
if ($this->alreadyExists($name)) {
$this->error($this->type.' already exists!');
return false;
}
$this->makeDirectory($path);
// create Module.php file
$this->files->put($path, $this->buildClass($name));
$this->info($this->type.' created successfully.');
}
/**
* Parse the name and format according to the root namespace.
*
* @param string $name
* @return string
*/
protected function parseName($name)
{
return ($this->getDefaultNamespace('').'\\'.$name);
}
/**
* Get the destination class path.
*
* @param string $name
* @return string
*/
protected function getPath($name)
{
$path = base_path('vendor/cobonto/core/src/Classes');
return $path.'/'.str_replace('\\', '/', $name).'.php';
}
} | {
"content_hash": "1fe26881d43fab89d194739076e05a62",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 72,
"avg_line_length": 22.301204819277107,
"alnum_prop": 0.5569962182603998,
"repo_name": "cobonto/core",
"id": "f29c374e968556668432d398cd547c20d509c134",
"size": "1851",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Commands/ModelCommand.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "141158"
},
{
"name": "JavaScript",
"bytes": "655"
},
{
"name": "PHP",
"bytes": "275308"
}
],
"symlink_target": ""
} |
/**
* This is where the magic happens (Part 2)
* Now we are going to send commands to our Desktop App
*/
var requestHandle = null;
var searchYoutube = function(query, callback) {
var maxResults = 25;
// This searches the Youtube API endpoint and loads a list of results
var endpoint = "http://gdata.youtube.com/feeds/api/videos?q="+ encodeURIComponent(query) +"&format=5&v=2&max-results="+ maxResults +"&alt=jsonc";
if( requestHandle !== null ){ requestHandle.abort(); }
requestHandle = $.ajax({
type: "GET",
url: endpoint,
dataType: "jsonp",
success: function(response) {
renderSearchResults( response.data.items );
if( typeof callback === 'function' ) {
callback();
}
}
});
};
var renderSearchResults = function( videos ) {
$('#results').html('');
var $template = $(".__templates .video");
if( typeof videos === 'undefined' || videos.length <= 0 ){ return; }
videos.forEach(function(video){
// You should really use something like handlebars here
var $video = $template.clone();
$video.data('id', video.id);
$video.data('title', video.title);
$video.data('thumbnail', video.thumbnail.hqDefault);
$video.find('img').attr('src', video.thumbnail.hqDefault );
$video.find('h2').text( video.title );
$('#results').append($video);
});
};
| {
"content_hash": "32f1dec242c392aee0db3693149904ea",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 147,
"avg_line_length": 25.528301886792452,
"alnum_prop": 0.6319290465631929,
"repo_name": "Aerolab/jsconf2014-workshop",
"id": "7a2c834a76f5f9c627d0231b77b487a22d322f9d",
"size": "1353",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "steps/step-0/app/remote/js/search.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "28574"
},
{
"name": "JavaScript",
"bytes": "47436"
},
{
"name": "Shell",
"bytes": "150"
}
],
"symlink_target": ""
} |
<div id="dialog-upload-new-signature-version" title="Upload New Version">
<script type="text/javascript">
$(document).ready(function() {
$("#id_data_type_dependency").tagit({
showAutocompleteOnFocus: true,
allowSpaces: true,
removeConfirmation: true,
afterTagAdded: function(event, ui) {
//Issue with tagit height is too high...
$("li.tagit-choice").height('14px');
},
afterTagRemoved: function(event, ui) {
},
onTagClicked: function(event, ui) {
},
autocomplete: {
delay: 0,
minLength: 2,
source: function(request, response) {
data = {term: request.term}
$.ajax({
type: 'POST',
url: "{% url 'crits.signatures.views.dependency_autocomplete' %}",
data: data,
datatype: 'json',
success: function(data) {
response(data);
}
});
}
}
});
//These are changes to make tagit work with a modal dialog, these are not ideal changes.
//Put these in css file and change class to fix it for modal
$("#form-upload-new-signature-version").find("ul.tagit").height($("#id_data_type_dependency").height()*3);
$("#form-upload-new-signature-version").find("ul.tagit").width($("#id_data_type_dependency").width()*2);
//The autocomplete shows up behind the modal dialog, this will bring the autocomplete to the foreground
//This should be fixed, probably not the best way to do this.
var autoSuggestion = $('.ui-autocomplete');
var dialogZ = $(".ui-dialog").css("z-index");
if(autoSuggestion.length > 0) {
for(var i = 0; i <autoSuggestion.length; i++)
autoSuggestion[i].style.zIndex=dialogZ+1;
}
});
</script>
<form id="form-upload-new-signature-version"
method='POST' enctype="multipart/form-data" item-type="Signature">
<table class="form">{{ upload_signature.as_table }}</table>
<div id="form-upload-new-signature-version-results" class="message"></div>
</form>
</div>
{% block javascript_includes %}
{% endblock %}
| {
"content_hash": "44f65c272157b8514a992b65b9e660be",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 114,
"avg_line_length": 39.67213114754098,
"alnum_prop": 0.5276859504132232,
"repo_name": "ckane/crits",
"id": "fb70b96dfe8d4095663149d74edab3e67be51d8a",
"size": "2421",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "crits/signatures/templates/dialogs/upload-new-signature-version.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "8694"
},
{
"name": "CSS",
"bytes": "390510"
},
{
"name": "HTML",
"bytes": "478069"
},
{
"name": "JavaScript",
"bytes": "3555668"
},
{
"name": "Python",
"bytes": "2002476"
},
{
"name": "Shell",
"bytes": "20173"
}
],
"symlink_target": ""
} |
using System.Windows;
namespace Mass_Effect_2_TLK_Tool
{
/// <summary>
/// Interaction logic for AboutWindow.xaml
/// </summary>
public partial class AboutWindow : Window
{
public string ApplicationVersion
{
get { return "v. " + App.GetVersion(); }
}
public AboutWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}
| {
"content_hash": "dd65fb6074a6cbc9b8ef6b5a894f0276",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 68,
"avg_line_length": 20.84,
"alnum_prop": 0.5239923224568138,
"repo_name": "jgoclawski/me2-tlk-tool",
"id": "b910d3c1216b7a6f534281e5ae14e8076fdf07ad",
"size": "523",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Mass Effect 2 TLK Tool/AboutWindow.xaml.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "51316"
}
],
"symlink_target": ""
} |
__author__ = 'techkid6'
""" Allows for modification of requests from proxy clients"""
def handle_request(request):
return None
""" Allows for modification of responses returned to proxy clients"""
def handle_response(response):
return None | {
"content_hash": "ab8243b8be203d38c1b104d545a5a8fe",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 69,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.7349397590361446,
"repo_name": "techkid6/pyproxy",
"id": "f650b8abe7018f4a9bbaf23d7211c98b2bb80898",
"size": "1365",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugins/demo.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "14010"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.