Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 585
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 2651)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 585
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
var contactMe = (function (){
var init = function(){
console.log('Инициализация модуля contactMe');
_setUpListners();
},
_setUpListners = function () {
$('#contact-form').on('submit', _submitForm);
},
_submitForm = function (e) {
console.log('Сабмит формы');
e.preventDefault();
var form = $(this),
url = '/ajax.php',
defObject = _ajaxForm(form, url);
if (defObject) {
defObject.done(function(answer) {
var message = answer.message,
status = answer.status;
if (status === 'OK'){
form.trigger('reset');
form.find('.success-message').text(message).show();
} else {
form.find('.error-message').text(message).show();
}
});
}
},
_ajaxForm = function (form, url) {
// вовзращает false, если не проходит валидация
if (!validation.validateForm(form)) return false;
var data = form.serialize();
return $.ajax({
type: 'POST',
url: url,
dataType: 'JSON',
data: data
}).fail( function(answer) {
console.log('Проблемы в PHP');
form.find('.error-message').text('На сервере произошла ошибка').show();
});
};
return {
init: init,
};
})();
contactMe.init();
|
{
"content_hash": "bba17c131b33c9533473a60bfd8f68ab",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 83,
"avg_line_length": 22.765625,
"alnum_prop": 0.4804392587508579,
"repo_name": "100lp/nikitabuchenkov",
"id": "12d33d4441618a355c7a77422402e2d3e5e1825b",
"size": "1597",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/js/contact-me.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "40688"
},
{
"name": "CSS",
"bytes": "55226"
},
{
"name": "HTML",
"bytes": "38317"
},
{
"name": "JavaScript",
"bytes": "11400"
},
{
"name": "PHP",
"bytes": "254"
}
]
}
|
import * as Utils from "./utils"
import { ResponseData } from "./responsedata"
import { GradData, Color } from "../gradient/graddata"
import { Point } from './point'
import { ColorComputer } from '../colorcomputer'
export class FractalBuilder {
private dataparts: Array<ResponseData>
private data: Array<Uint32Array>
private dragcoords: { x: number, y: number }
protected workers: Array<Worker>
protected threadsnumber: number
protected timer: number
protected ready: boolean
protected canvas: HTMLCanvasElement
public center: Point = new Point(0, 0)
public steps: number = 80
public pixelratio: number = 0.008
public supersampling: number = 1
public beforeevent: () => void
public afterevent: () => void
public onzoomin: () => void
public onzoomout: () => void
public ondrag: () => void
public onclick: (e: Point) => void
public redcolorchanel: Uint16Array
public greencolorchanel: Uint16Array
public bluecolorchanel: Uint16Array
constructor(public type: string) {
let instance = this
instance.ready = true;
instance.dataparts = new Array<ResponseData>()
instance.threadsnumber = (<any>navigator).hardwareConcurrency
if (typeof (instance.threadsnumber) == "undefined") instance.threadsnumber = 4
instance.workers = [];
for (let i = 0; i < instance.threadsnumber; i++) {
instance.workers.push(new Worker("./scripts/worker.bundle.js"));
instance.workers[i].onmessage = function (e: MessageEvent) {
let data = new ResponseData()
data.data = new Uint32Array(e.data)
data.threadid = i
instance.dataparts.push(data)
instance.checkready()
}
}
}
public setcanvas(canvas: HTMLCanvasElement) {
let instance = this
instance.canvas = canvas;
let mc = new Hammer(canvas);
mc.get('pan').set({ direction: Hammer.DIRECTION_ALL })
mc.get('pinch').set({ enable: true })
mc.on("pinchend tap panend", function (e) { instance.hammerevents(e, instance) })
instance.canvas.addEventListener("mousewheel", instance, false)
instance.canvas.addEventListener("DOMMouseScroll", instance, false)
}
hammerevents = function (e: HammerInput, instance: FractalBuilder) {
console.log(`type: ${e.type}, point: ${e.center.x} ${e.center.y}, delta: ${e.deltaX} ${e.deltaY}`)
let center = Utils.getcoordsfrompoint(e.center, instance.canvas, instance.pixelratio, instance.center)
switch (e.type) {
case 'tap': instance.onclick(center); break
case 'pinchend': e.scale > 1 ? instance.zoomin(center) : instance.zoomout(); break
case 'panend': instance.drag(new Point(-e.deltaX * instance.pixelratio, -e.deltaY * instance.pixelratio)); break
}
}
handleEvent = function (e: Event) {
let mevent = <MouseEvent>e
let wevent = <WheelEvent>e
let instance = <FractalBuilder>this
let coords = Utils.getcoords(mevent, instance.canvas, instance.pixelratio, instance.center)
if (instance.ready) {
switch (e.type) {
case 'mousewheel':
if (wevent.deltaY > 0) instance.zoomout()
else instance.zoomin(coords)
break
case 'DOMMouseScroll':
if (wevent.detail > 0) instance.zoomout()
else instance.zoomin(coords)
break
}
wevent.preventDefault()
}
}
public zoomin(coords: Point) {
if (coords != null) this.center = coords
this.pixelratio *= 0.5
this.redraw(true)
this.onzoomin()
}
public zoomout() {
if (this.pixelratio * 2 <= 0.008) {
this.pixelratio *= 2
this.redraw(true)
this.onzoomout()
}
}
protected drag(change: Point) {
this.center.x += change.x
this.center.y -= change.y
this.redraw(true)
this.ondrag()
}
protected generate() {
let _this = this;
_this.timer = (new Date()).getTime()
_this.ready = false;
let height = Math.floor(_this.canvas.height / _this.threadsnumber)
let postdata = {
type: _this.type,
width: _this.canvas.width,
height: height,
steps: _this.steps,
pixelratio: _this.pixelratio,
x: _this.center.x,
y: - _this.center.y - (_this.pixelratio * height) * (_this.threadsnumber / 2.0 - 0.5),
supersampling: _this.supersampling
}
for (let i = 0; i < _this.threadsnumber; i++) {
_this.workers[i].postMessage(postdata)
postdata.y += (_this.pixelratio * height)
}
}
private checkready() {
if (this.dataparts.length == this.threadsnumber) {
this.data = _.chain(this.dataparts).sortBy("threadid").map(n => n.data).value()
this.repaint()
this.dataparts = new Array<ResponseData>()
this.ready = true
}
}
public redraw(regenerate = true) {
if (this.ready) {
if (this.beforeevent != null) {
this.beforeevent()
}
if (regenerate) {
this.generate()
} else {
this.repaint()
}
}
}
private repaint() {
let cx = this.canvas.getContext("2d")
let width = this.canvas.width
let height = this.canvas.height
let pxdata = cx.createImageData(width, height)
let datapos = 0
for (let i = 0; i < this.data.length; i++) {
for (let j = 0; j < this.data[i].length; j++) {
pxdata.data[datapos++] = this.redcolorchanel[this.data[i][j]];
pxdata.data[datapos++] = this.greencolorchanel[this.data[i][j]];
pxdata.data[datapos++] = this.bluecolorchanel[this.data[i][j]];
pxdata.data[datapos++] = 255;
}
}
cx.putImageData(pxdata, 0, 0)
if (this.afterevent != null) {
this.afterevent()
}
}
public setgradient(gradient: Array<GradData>) {
this.redcolorchanel = new Int16Array(this.steps + 1)
this.greencolorchanel = new Int16Array(this.steps + 1)
this.bluecolorchanel = new Int16Array(this.steps + 1)
let comp = new ColorComputer(gradient)
for (let i = 0; i <= this.steps; i++) {
let color = comp.getcolor(this.steps, i)
this.redcolorchanel[i] = color.r
this.greencolorchanel[i] = color.g
this.bluecolorchanel[i] = color.b
}
}
}
|
{
"content_hash": "577bef24e94231db05df896933d68571",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 115,
"avg_line_length": 28.889447236180903,
"alnum_prop": 0.6745520960166985,
"repo_name": "7affer/fractalTS",
"id": "5be8dbcf9ab3fc65baf000472d76e81e83ba83f1",
"size": "5749",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/scripts/fractals/fractalbuilder.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21589"
},
{
"name": "HTML",
"bytes": "50098"
},
{
"name": "JavaScript",
"bytes": "57947"
},
{
"name": "TypeScript",
"bytes": "38393"
}
]
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Wed Jul 17 09:39:59 MST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SimpleElectionPolicyConsumer (BOM: * : All 2.4.1.Final-SNAPSHOT API)</title>
<meta name="date" content="2019-07-17">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SimpleElectionPolicyConsumer (BOM: * : All 2.4.1.Final-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":18};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SimpleElectionPolicyConsumer.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.4.1.Final-SNAPSHOT</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicy.html" title="class in org.wildfly.swarm.config.singleton.singleton_policy"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicySupplier.html" title="interface in org.wildfly.swarm.config.singleton.singleton_policy"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" target="_top">Frames</a></li>
<li><a href="SimpleElectionPolicyConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.wildfly.swarm.config.singleton.singleton_policy</div>
<h2 title="Interface SimpleElectionPolicyConsumer" class="title">Interface SimpleElectionPolicyConsumer<T extends <a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicy.html" title="class in org.wildfly.swarm.config.singleton.singleton_policy">SimpleElectionPolicy</a><T>></h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Functional Interface:</dt>
<dd>This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.</dd>
</dl>
<hr>
<br>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/FunctionalInterface.html?is-external=true" title="class or interface in java.lang">@FunctionalInterface</a>
public interface <span class="typeNameLabel">SimpleElectionPolicyConsumer<T extends <a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicy.html" title="class in org.wildfly.swarm.config.singleton.singleton_policy">SimpleElectionPolicy</a><T>></span></pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html#accept-T-">accept</a></span>(<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="type parameter in SimpleElectionPolicyConsumer">T</a> value)</code>
<div class="block">Configure a pre-constructed instance of SimpleElectionPolicy resource</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>default <a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="interface in org.wildfly.swarm.config.singleton.singleton_policy">SimpleElectionPolicyConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="type parameter in SimpleElectionPolicyConsumer">T</a>></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html#andThen-org.wildfly.swarm.config.singleton.singleton_policy.SimpleElectionPolicyConsumer-">andThen</a></span>(<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="interface in org.wildfly.swarm.config.singleton.singleton_policy">SimpleElectionPolicyConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="type parameter in SimpleElectionPolicyConsumer">T</a>> after)</code> </td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="accept-org.wildfly.swarm.config.singleton.singleton_policy.SimpleElectionPolicy-">
<!-- -->
</a><a name="accept-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>accept</h4>
<pre>void accept(<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="type parameter in SimpleElectionPolicyConsumer">T</a> value)</pre>
<div class="block">Configure a pre-constructed instance of SimpleElectionPolicy resource</div>
</li>
</ul>
<a name="andThen-org.wildfly.swarm.config.singleton.singleton_policy.SimpleElectionPolicyConsumer-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>andThen</h4>
<pre>default <a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="interface in org.wildfly.swarm.config.singleton.singleton_policy">SimpleElectionPolicyConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="type parameter in SimpleElectionPolicyConsumer">T</a>> andThen(<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="interface in org.wildfly.swarm.config.singleton.singleton_policy">SimpleElectionPolicyConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" title="type parameter in SimpleElectionPolicyConsumer">T</a>> after)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SimpleElectionPolicyConsumer.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.4.1.Final-SNAPSHOT</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicy.html" title="class in org.wildfly.swarm.config.singleton.singleton_policy"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicySupplier.html" title="interface in org.wildfly.swarm.config.singleton.singleton_policy"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html" target="_top">Frames</a></li>
<li><a href="SimpleElectionPolicyConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
|
{
"content_hash": "d3916ca43b402d2f11449fecf295dc97",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 852,
"avg_line_length": 50.060483870967744,
"alnum_prop": 0.6745066451872734,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "3b9c53b3fe8afb68f721b14a441f8534f38fed58",
"size": "12415",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "2.4.1.Final-SNAPSHOT/apidocs/org/wildfly/swarm/config/singleton/singleton_policy/SimpleElectionPolicyConsumer.html",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
#include "types.h"
#if defined(DSI_TYPES_WINDOWS)
#include "dsi_thread.h"
#include "macros.h"
#include <windows.h>
#include <string.h>
//////////////////////////////////////////////////////////////////////////////////
// Public Functions
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Code below is no longer based on "Strategies for Implementing POSIX Condition
// Variables on Win32" by Douglas C. Schmidt and Irfan Pyarali of
// Department of Computer Science, Washington University, St. Louis,
// Missouri
// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
// This implementation had some flaws that were causing fals
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_MutexInit(DSI_MUTEX *pstMutex_)
{
*pstMutex_ = CreateMutex(
(LPSECURITY_ATTRIBUTES) NULL, // This pstMutex_ gets the default security descriptor.
FALSE, // Not owned by the calling thread; should be "unlocked".
(LPCTSTR) NULL); // Object name not required.
if (*pstMutex_ == NULL)
return DSI_THREAD_EOTHER; // We've failed for some reason.
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_MutexDestroy(DSI_MUTEX *pstMutex_)
{
if (CloseHandle(*pstMutex_))
return DSI_THREAD_ENONE;
return DSI_THREAD_EOTHER;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_MutexLock(DSI_MUTEX *pstMutex_)
{
WaitForSingleObject(*pstMutex_, INFINITE);
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_MutexTryLock(DSI_MUTEX *pstMutex_)
{
DWORD dwWaitObject = WaitForSingleObject(*pstMutex_, 0);
if (dwWaitObject == WAIT_OBJECT_0)
return DSI_THREAD_ENONE;
return DSI_THREAD_EBUSY;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_MutexUnlock(DSI_MUTEX *pstMutex_)
{
ReleaseMutex(*pstMutex_);
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_CondInit(DSI_CONDITION_VAR *pstConditionVariable_)
{
pstConditionVariable_->iWaitersCount = 0;
InitializeCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
//Create the broadcast semaphore
pstConditionVariable_->ahBcastSmph0SignalEvnt1[0] = CreateSemaphore(
(LPSECURITY_ATTRIBUTES) NULL, // This semaphore gets the default security descriptor.
0, // Initially 0.
0x7FFFFFFF, // Max count.
(LPCTSTR) NULL); // Object name not required.
//Create the 'signal one' event
pstConditionVariable_->ahBcastSmph0SignalEvnt1[1] = CreateEvent (
(LPSECURITY_ATTRIBUTES) NULL, // This event gets the default security descriptor.
FALSE, // FALSE means we use auto-reset.
FALSE, // Non-signaled initially.
(LPCTSTR) NULL); // Object name not required.
pstConditionVariable_->hBroadcastDoneEvent = CreateEvent (
(LPSECURITY_ATTRIBUTES) NULL, // This event gets the default security descriptor.
FALSE, // FALSE means we use auto-reset.
FALSE, // Non-signaled initially.
(LPCTSTR) NULL); // Object name not required.
if (pstConditionVariable_->ahBcastSmph0SignalEvnt1[0] == NULL
|| pstConditionVariable_->ahBcastSmph0SignalEvnt1[1] == NULL
|| pstConditionVariable_->hBroadcastDoneEvent == NULL)
return DSI_THREAD_EOTHER; // We've failed initializing objects for some reason, call GetLastError() to figure out why
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_CondDestroy(DSI_CONDITION_VAR *pstConditionVariable_)
{
UCHAR ucRetVal = DSI_THREAD_ENONE;
EnterCriticalSection(&pstConditionVariable_->stStartWaiterCritSec); //Make sure we have ownership before we kill it
DeleteCriticalSection(&pstConditionVariable_->stStartWaiterCritSec); //Now nobody can get it, if someone is still waiting they will be stuck, but it is better than calling LeaveCriticalSection on a deleted cs (which causes possible memory corruption).
//Release all threads that are stuck waiting so we try not to leave any dead waits
ReleaseSemaphore(pstConditionVariable_->ahBcastSmph0SignalEvnt1[0], 0x7fffffff, 0);
//Destroy the rest of the objects
if (!CloseHandle(pstConditionVariable_->hBroadcastDoneEvent))
ucRetVal = DSI_THREAD_EOTHER;
if (!CloseHandle(pstConditionVariable_->ahBcastSmph0SignalEvnt1[1]))
ucRetVal = DSI_THREAD_EOTHER;
if (!CloseHandle(pstConditionVariable_->ahBcastSmph0SignalEvnt1[0]))
ucRetVal = DSI_THREAD_EOTHER;
return ucRetVal;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_CondTimedWait(DSI_CONDITION_VAR *pstConditionVariable_, DSI_MUTEX *pstExternalMutex_, ULONG ulMilliseconds_)
{
DWORD dwResult;
//Make sure DSI_THREAD_INFINITE translates to INFINITE
if(ulMilliseconds_ == DSI_THREAD_INFINITE)
ulMilliseconds_ = INFINITE;
// Add a count for us when we are allowed to start waiting
EnterCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
InterlockedIncrement(&(pstConditionVariable_->iWaitersCount));
LeaveCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
//Release the variable mutex to allow whatever will signal us (which needs to acquire the mutex) to occur
if(ReleaseMutex(*pstExternalMutex_) == 0)
return DSI_THREAD_EOTHER;
//Wait for broadcast or normal signal
dwResult = WaitForMultipleObjects(2, pstConditionVariable_->ahBcastSmph0SignalEvnt1, FALSE, ulMilliseconds_);
if(dwResult - WAIT_OBJECT_0 == 1) //array index is the normal signal event
{
//Note: The waiter count is already decremented by the signal function
dwResult = WaitForSingleObject(*pstExternalMutex_, INFINITE);
}
else if(dwResult >= WAIT_ABANDONED) //If we didn't get a signal
{
//Even though we have an error, the contract states we need the mutex back before we return
//Also, since we didn't get a signal, we need to manage the waiterCount here
//Lastly, If we were in a broadcast and are the last waiter, we need to ensure the signal is fired, and
//it doesn't hurt to do it out of a broadcast
//Note: We don't handle this the same as the broadcast case, since we want to return the original failure code, not save a new one
if(InterlockedDecrement(&(pstConditionVariable_->iWaitersCount)) == 0)
SignalObjectAndWait(pstConditionVariable_->hBroadcastDoneEvent, *pstExternalMutex_, INFINITE, FALSE);
else
WaitForSingleObject(*pstExternalMutex_, INFINITE);
}
else //dwResult - WAIT_OBJECT_0 == 0 //array index is the broadcast event
{
//Decrement waiter count if we are in broadcast,
//If we are the last waiter we need to signal the broadcast is done
//Interlocked, so value is correct between all broadcast released threads
if(InterlockedDecrement(&(pstConditionVariable_->iWaitersCount)) == 0)
dwResult = SignalObjectAndWait(pstConditionVariable_->hBroadcastDoneEvent, *pstExternalMutex_, INFINITE, FALSE);
else
dwResult = WaitForSingleObject(*pstExternalMutex_, INFINITE);
}
if (dwResult == WAIT_OBJECT_0)
return DSI_THREAD_ENONE;
if (dwResult == WAIT_TIMEOUT)
return DSI_THREAD_ETIMEDOUT;
return DSI_THREAD_EOTHER;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_CondSignal(DSI_CONDITION_VAR *pstConditionVariable_)
{
//We get the 'start' mutex to ensure we aren't signalling during a broadcast
EnterCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
//CondSignal allows one current waiter through, so only open the event if we have current waiters
//We decrement waiters count here in signal to avoid race condition where signal could occur multiple
//times between last waiter thread being signaled and them decrementing their own waiter count (broadcast case is different)
if(pstConditionVariable_->iWaitersCount > 0)
{
InterlockedDecrement(&(pstConditionVariable_->iWaitersCount));
SetEvent(pstConditionVariable_->ahBcastSmph0SignalEvnt1[1]);
}
LeaveCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_CondBroadcast(DSI_CONDITION_VAR *pstConditionVariable_)
{
// We need the waiter lock to ensure the broadcast only signals the current waiters
// This also blocks CondSignal() from firing
// This lock also ensures the normal signal doesn't happen during the broadcast and mess up the count
EnterCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
if (pstConditionVariable_->iWaitersCount > 0)
{
// Release all the current waiters using the broadcast semaphore
ReleaseSemaphore(pstConditionVariable_->ahBcastSmph0SignalEvnt1[0], pstConditionVariable_->iWaitersCount, 0);
// Wait until the last one is done
WaitForSingleObject(pstConditionVariable_->hBroadcastDoneEvent, INFINITE);
}
//Release the lock to allow new waiters again
LeaveCriticalSection(&pstConditionVariable_->stStartWaiterCritSec);
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
DSI_THREAD_ID DSIThread_CreateThread(DSI_THREAD_RETURN (*fnThreadStart_)(void *), void *pvParameter_)
{
return
CreateThread(
(LPSECURITY_ATTRIBUTES) NULL, // Default security descriptor.
0, // Default stack size for exe.
(LPTHREAD_START_ROUTINE) fnThreadStart_,
pvParameter_,
0, // The thread begins execution immediately.
NULL); // No need for a thread ID.
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_DestroyThread(DSI_THREAD_ID hThreadID_)
{
if(TerminateThread(hThreadID_, 0) == 0)
return DSI_THREAD_EOTHER;
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
UCHAR DSIThread_ReleaseThreadID(DSI_THREAD_ID hThreadID)
{
if(CloseHandle(hThreadID) == 0)
return DSI_THREAD_EOTHER;
return DSI_THREAD_ENONE;
}
///////////////////////////////////////////////////////////////////////
DSI_THREAD_IDNUM DSIThread_GetCurrentThreadIDNum(void)
{
return GetCurrentThreadId();
}
///////////////////////////////////////////////////////////////////////
BOOL DSIThread_CompareThreads(DSI_THREAD_IDNUM hThreadIDNum1, DSI_THREAD_IDNUM hThreadIDNum2)
{
return (hThreadIDNum1 == hThreadIDNum2);
}
///////////////////////////////////////////////////////////////////////
ULONG DSIThread_GetSystemTime(void)
{
return GetTickCount();
}
///////////////////////////////////////////////////////////////////////
BOOL DSIThread_GetWorkingDirectory(UCHAR* pucDirectory_, USHORT usLength_)
{
if(pucDirectory_ == NULL)
return FALSE;
if(GetCurrentDirectory((DWORD)(usLength_-1), (LPSTR)pucDirectory_) == 0)
return FALSE;
SNPRINTF((char*)(&pucDirectory_[strlen((char*)pucDirectory_)]), 2, "\\");
return TRUE;
}
///////////////////////////////////////////////////////////////////////
void DSIThread_Sleep(ULONG ulMilliseconds_)
{
Sleep(ulMilliseconds_);
return;
}
#endif //defined(DSI_TYPES_WINDOWS)
|
{
"content_hash": "b82c99dfca54b8eae0774d45ca525165",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 254,
"avg_line_length": 40.00970873786408,
"alnum_prop": 0.5897435897435898,
"repo_name": "corbamico/ANT-Library",
"id": "68081545adada88ce0e3ecd65b616869e2fc9107",
"size": "12624",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ANT_LIB/software/system/dsi_thread_win32.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "104077"
},
{
"name": "C++",
"bytes": "1222636"
}
]
}
|
void Logger::WriteLine(const QString &message)
{
if (_logFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
QTextStream logStream(&_logFile);
logStream << message << "\n";
_logFile.close();
}
}
|
{
"content_hash": "156ff9d5db49703d47fd95dd2b067765",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 62,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.5948275862068966,
"repo_name": "CptMonkeyFist/ArkCharacterSelector",
"id": "6021ef986bc99b361a515db6aacb3e0d164fcc84",
"size": "253",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "logger.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "9835"
},
{
"name": "JavaScript",
"bytes": "9759"
},
{
"name": "QML",
"bytes": "56247"
},
{
"name": "QMake",
"bytes": "670"
}
]
}
|
with open("enable1.txt", "r") as file:
dictionary = set(file.read().splitlines())
def brokenkeyboard(ls):
return max([w for w in dictionary if set(w).issubset(ls)], key=lambda x: len(x))
if __name__ == "__main__":
with open("input/input2.txt", "r") as file:
lines = file.read().splitlines()
for ls in lines:
print("{}\t:\t{}".format(ls, brokenkeyboard(ls)))
|
{
"content_hash": "195bb8abfa4a069057856874e30565ce",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 35.54545454545455,
"alnum_prop": 0.6035805626598465,
"repo_name": "marcardioid/DailyProgrammer",
"id": "355c0b53a27743c54b151954dd72cc6190858da9",
"size": "391",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "solutions/237_Easy/solution.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "256"
},
{
"name": "HTML",
"bytes": "3716"
},
{
"name": "JavaScript",
"bytes": "116063"
},
{
"name": "Python",
"bytes": "59838"
}
]
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using g3;
namespace f3
{
/// <summary>
/// This element is just a spacer. It has an empty game object which allows it to be positioned/etc.
/// </summary>
public class HUDSpacer : HUDStandardItem, IBoxModelElement
{
fGameObject entry;
HUDShape shape;
public HUDShape Shape {
get { return shape; }
set { shape = value; }
}
public HUDSpacer()
{
Shape = new HUDShape(HUDShapeType.Rectangle, 10, 1);
}
// creates a button in the desired geometry shape
public void Create()
{
entry = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDSpacer"));
}
#region SceneUIElement implementation
override public fGameObject RootGameObject {
get { return entry; }
}
override public bool WantsCapture(InputEvent e)
{
return false;
}
override public bool BeginCapture(InputEvent e)
{
return true;
}
override public bool UpdateCapture(InputEvent e)
{
return true;
}
override public bool EndCapture(InputEvent e)
{
return true;
}
#endregion
#region IBoxModelElement implementation
public Vector2f Size2D {
get { return new Vector2f(Shape.Width, Shape.Height); }
}
public AxisAlignedBox2f Bounds2D {
get {
Vector2f origin2 = RootGameObject.GetLocalPosition().xy;
return new AxisAlignedBox2f(origin2, Shape.Width / 2, Shape.Height / 2);
}
}
#endregion
}
}
|
{
"content_hash": "830016bf343e1e66f313d74d5d951a87",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 104,
"avg_line_length": 21.352941176470587,
"alnum_prop": 0.5608815426997246,
"repo_name": "gradientspace/frame3Sharp",
"id": "87af2d3ecb76be59993bae59ebe0eafe27ba7a01",
"size": "1817",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UIElements/HUDSpacer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1574062"
},
{
"name": "HLSL",
"bytes": "40420"
},
{
"name": "ShaderLab",
"bytes": "44314"
}
]
}
|
[ Documents ](https://github.com/szhielelp/JekyllTheme-ProjectGaia)
## Dev
```
npm install docsify -g
docsify serve docs
```
|
{
"content_hash": "8bc4fd399c995429302bbd9d7b72f784",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 72,
"avg_line_length": 13.4,
"alnum_prop": 0.6791044776119403,
"repo_name": "szhielelp/JekyllTheme-ProjectGaia-Docs",
"id": "557d6bbf03115d570d56caa2528c9308c189dcfa",
"size": "150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": []
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_snprintf_53d.c
Label Definition File: CWE134_Uncontrolled_Format_String.label.xml
Template File: sources-sinks-53d.tmpl.c
*/
/*
* @description
* CWE: 134 Uncontrolled Format String
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Copy a fixed string into data
* Sinks: snprintf
* GoodSink: snwprintf with "%s" as the third argument and data as the fourth
* BadSink : snwprintf with data as the third argument
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
#ifdef _WIN32
#define SNPRINTF _snwprintf
#else
#define SNPRINTF snprintf
#endif
#ifndef OMITBAD
void CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_snprintf_53d_badSink(wchar_t * data)
{
{
wchar_t dest[100] = L"";
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
SNPRINTF(dest, 100-1, data);
printWLine(dest);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_snprintf_53d_goodG2BSink(wchar_t * data)
{
{
wchar_t dest[100] = L"";
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
SNPRINTF(dest, 100-1, data);
printWLine(dest);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_snprintf_53d_goodB2GSink(wchar_t * data)
{
{
wchar_t dest[100] = L"";
/* FIX: Specify the format disallowing a format string vulnerability */
SNPRINTF(dest, 100-1, L"%s", data);
printWLine(dest);
}
}
#endif /* OMITGOOD */
|
{
"content_hash": "b79f8994645e6cbf042d6730c106aa6a",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 156,
"avg_line_length": 28.56179775280899,
"alnum_prop": 0.6801730920535012,
"repo_name": "maurer/tiamat",
"id": "c68af44810ca479af96af6d9868f3c88f2e23261",
"size": "2542",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/Juliet/testcases/CWE134_Uncontrolled_Format_String/s06/CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_snprintf_53d.c",
"mode": "33188",
"license": "mit",
"language": []
}
|
'use strict';
var dot = require('dot');
dot.templateSettings.strip = false;
var betweenFilterTpl = dot.template('{{=it._column}} BETWEEN {{=it._min}} AND {{=it._max}}');
var minFilterTpl = dot.template('{{=it._column}} >= {{=it._min}}');
var maxFilterTpl = dot.template('{{=it._column}} <= {{=it._max}}');
var filterQueryTpl = dot.template('SELECT * FROM ({{=it._sql}}) _analysis_range_filter WHERE {{=it._filter}}');
function Range (column, filterParams) {
this.column = column;
if (!Number.isFinite(filterParams.min) && !Number.isFinite(filterParams.max)) {
throw new Error('Range filter expect to have at least one value in min or max numeric params');
}
this.min = filterParams.min;
this.max = filterParams.max;
this.columnType = filterParams.columnType;
}
module.exports = Range;
Range.prototype.sql = function (rawSql) {
var minMaxFilter;
if (Number.isFinite(this.min) && Number.isFinite(this.max)) {
minMaxFilter = betweenFilterTpl({
_column: this.column,
_min: this.min,
_max: this.max
});
} else if (Number.isFinite(this.min)) {
minMaxFilter = minFilterTpl({ _column: this.column, _min: this.min });
} else {
minMaxFilter = maxFilterTpl({ _column: this.column, _max: this.max });
}
return filterQueryTpl({
_sql: rawSql,
_filter: minMaxFilter
});
};
|
{
"content_hash": "df6c10bc40e0fa21cdb790394767f63c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 111,
"avg_line_length": 32.7906976744186,
"alnum_prop": 0.6212765957446809,
"repo_name": "CartoDB/Windshaft-cartodb",
"id": "71f76aea750ae17f4a2ba4ffeb445e49eae5b6c4",
"size": "1410",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/models/filter/analysis/range.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "7484"
},
{
"name": "HTML",
"bytes": "639"
},
{
"name": "JavaScript",
"bytes": "1966891"
},
{
"name": "PLpgSQL",
"bytes": "50586"
},
{
"name": "Python",
"bytes": "1051"
},
{
"name": "Shell",
"bytes": "1673"
}
]
}
|
layout: event
title: "Apache Wicket"
date: 2011-10-11 19:15:00
tags: events
speakers:
- mploed
location: uni-ka-hs101
---
Apache Wicket ist ein komponentenbasiertes Web-Framework, welches als Top-Level Projekt unter dem Dach der Apache Foundation entwickelt wird.
Im Gegensatz zu anderen Web-Frameworks verzichtet Wicket konsequent auf Konfigurationsdateien und setzt auf Objekt-Orientierung, reines HTML und Java. Des Weiteren ist es mit Wicket sehr einfach möglich fachliche und technische View-Komponenten zu erstellen, die wiederverwendbar sind. Gleiches gilt für den Einsatz von Java Script Bibliotheken und AJAX.
Im Rahmen des Vortrags wird erläutert wie Java basierte Web-Anwendungen mit Hilfe von Apache Wicket erstellt werden. Dabei geht der Vortrag primär auf die Konzepte von Wicket ein. Neben den Grundlagen werden zudem der Einsatz von AJAX, die Erstellung wiederverwendbarer UI Komponenten und die Unit-Test Bibliothek Wicket Tester erklärt. Eine kritische Betrachtung der Vor- und Nachteile des Praxis-Einsatzes von Wicket wird den Vortrag abrunden.
|
{
"content_hash": "5b5e4e8a15f97ab040cf4ce4e35e0a61",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 445,
"avg_line_length": 76.5,
"alnum_prop": 0.8225957049486461,
"repo_name": "fhopf/jugka-site",
"id": "86fb13f33ce128000d5ae9b80c20a738c199fdd2",
"size": "1080",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/events/2011-10-11-apache-wicket.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20082"
},
{
"name": "HTML",
"bytes": "11441"
},
{
"name": "JavaScript",
"bytes": "367"
},
{
"name": "Ruby",
"bytes": "6009"
}
]
}
|
========
Linotype
========
.. list-table::
:stub-columns: 1
* - docs
- |docs|
* - tests
- | |travis| |appveyor| |requires|
|
* - package
- |version| |downloads| |wheel| |supported-versions| |supported-implementations|
.. |docs| image:: https://readthedocs.org/projects/linotype/badge/?style=flat
:target: https://readthedocs.org/projects/linotype
:alt: Documentation Status
.. |travis| image:: https://travis-ci.org/techdragon/linotype.svg?branch=master
:alt: Travis-CI Build Status
:target: https://travis-ci.org/techdragon/linotype
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/techdragon/linotype?branch=master&svg=true
:alt: AppVeyor Build Status
:target: https://ci.appveyor.com/project/techdragon/linotype
.. |requires| image:: https://requires.io/github/techdragon/linotype/requirements.svg?branch=master
:alt: Requirements Status
:target: https://requires.io/github/techdragon/linotype/requirements/?branch=master
.. |version| image:: https://img.shields.io/pypi/v/linotype.svg?style=flat
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/linotype
.. |downloads| image:: https://img.shields.io/pypi/dm/linotype.svg?style=flat
:alt: PyPI Package monthly downloads
:target: https://pypi.python.org/pypi/linotype
.. |wheel| image:: https://img.shields.io/pypi/wheel/linotype.svg?style=flat
:alt: PyPI Wheel
:target: https://pypi.python.org/pypi/linotype
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/linotype.svg?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/linotype
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/linotype.svg?style=flat
:alt: Supported imlementations
:target: https://pypi.python.org/pypi/linotype
A Yet another static blog generator. Powered by both static text and RethinkDB, still just generating static HTML.
* Free software: BSD license
Installation
============
::
pip install linotype
Documentation
=============
https://linotype.readthedocs.org/
Development
===========
To run the all tests run::
tox
|
{
"content_hash": "fc49be166dd6d3fd60ed2c58662f3124",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 115,
"avg_line_length": 28.435897435897434,
"alnum_prop": 0.6965734896302975,
"repo_name": "techdragon/linotype",
"id": "616141b1222b0282422560c31aebb355c56b1cbf",
"size": "2218",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.rst",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1489"
},
{
"name": "PowerShell",
"bytes": "3053"
},
{
"name": "Python",
"bytes": "2996"
}
]
}
|
'use strict'
var React = require('react');
var {
View,
Text,
Navigator,
StyleSheet
} = require('react-native');
var system = require('../base/system-container');
var {SystemContainer} = system;
var FormView = React.createClass({
render() {
return (
<SystemContainer>
{this.props.children}
</SystemContainer>
)
}
});
module.exports = FormView;
|
{
"content_hash": "2888880f797a688f27d1e87e50cb413e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 49,
"avg_line_length": 18.217391304347824,
"alnum_prop": 0.5799522673031027,
"repo_name": "liuhong1happy/logistics-workflow",
"id": "5be5dca744d73316035d5c6b361e5763414f4d23",
"size": "419",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/common/components/form/form.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "106531"
},
{
"name": "HTML",
"bytes": "152"
},
{
"name": "Java",
"bytes": "1005"
},
{
"name": "JavaScript",
"bytes": "20494"
},
{
"name": "Objective-C",
"bytes": "4990"
},
{
"name": "Shell",
"bytes": "618"
}
]
}
|
(function() {
var _ref, _ref1,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
window.RTC || (window.RTC = {});
window.RTCPeerConnection || (window.RTCPeerConnection = window.webkitRTCPeerConnection);
window.RTC.SignalingChannel = (function() {
function SignalingChannel() {
Logger.trace('RTC.SignalingChannel->constructor');
}
SignalingChannel.prototype.send = function(message) {
Logger.trace('RTC.SignalingChannel->send');
return Logger.log(message);
};
SignalingChannel.prototype.sendJSON = function(message) {
Logger.trace('RTC.SignalingChannel->sendJSON');
Logger.log(message);
return this.send(JSON.stringify(message));
};
SignalingChannel.prototype.onMessage = function(event) {
Logger.trace('RTC.SignalingChannel->onMessage');
return this.onMessageCallback(event);
};
SignalingChannel.prototype.setOnMessageCallback = function(callback) {
return this.onMessageCallback = callback;
};
return SignalingChannel;
})();
window.RTC.PeerConnection = (function() {
function PeerConnection(servers, config, channel) {
var self;
this.servers = servers != null ? servers : null;
this.config = config != null ? config : null;
this.channel = channel != null ? channel : new RTC.SignalingChannel;
Logger.trace('RTC.PeerConnection->constructor');
this.conn = new RTCPeerConnection(servers, config);
this.conn.onicecandidate = this.onIceCandidate;
this.conn.onaddstream = this.onAddStream;
self = this;
this.channel.setOnMessageCallback(function(event) {
return self.onMessage(event);
});
}
PeerConnection.prototype.addStream = function(stream) {
var self;
Logger.trace('RTC.PeerConnection->addStream');
Logger.log(stream);
self = this;
return this.conn.addStream(stream.getStream());
};
PeerConnection.prototype.gotDescription = function(desc) {
this.conn.setLocalDescription(desc);
return this.channel.sendJSON({
sdp: desc
});
};
PeerConnection.prototype.onIceCandidate = function(event) {
Logger.trace('RTC.PeerConnection->onIceCandidate');
Logger.log(event);
return this.channel.sendJSON({
'candidate': event.candidate
});
};
PeerConnection.prototype.onAddStream = function(event) {
Logger.trace('RTC.PeerConnection->onAddStream');
Logger.log(event);
return this.streams.push(event.stream);
};
PeerConnection.prototype.onMessage = function(event) {
return Logger.trace('RTC.PeerConnection->onMessage');
};
return PeerConnection;
})();
window.RTC.LocalPeerConnection = (function(_super) {
__extends(LocalPeerConnection, _super);
function LocalPeerConnection() {
_ref = LocalPeerConnection.__super__.constructor.apply(this, arguments);
return _ref;
}
LocalPeerConnection.prototype.addStream = function(stream) {
LocalPeerConnection.__super__.addStream.call(this, stream);
return this.conn.createOffer(function(desc) {
return self.gotDescription(desc);
});
};
LocalPeerConnection.prototype.onMessage = function(event) {
var signal;
LocalPeerConnection.__super__.onMessage.call(this, event);
signal = JSON.parse(event.data);
if (signal.sdp) {
return this.conn.setRemoteDescription(new RTCSessionDescription(signal.sdp));
} else if (signal.candidate) {
return this.conn.addIceCandidate(new RTCIceCandidate(signal.candidate));
}
};
return LocalPeerConnection;
})(window.RTC.PeerConnection);
window.RTC.RemotePeerConnection = (function(_super) {
__extends(RemotePeerConnection, _super);
function RemotePeerConnection() {
_ref1 = RemotePeerConnection.__super__.constructor.apply(this, arguments);
return _ref1;
}
RemotePeerConnection.prototype.addStream = function(stream) {
RemotePeerConnection.__super__.addStream.call(this, stream);
return this.conn.createAnswer(this.remoteDescription, function(desc) {
return self.gotDescription(desc);
});
};
return RemotePeerConnection;
})(window.RTC.PeerConnection);
}).call(this);
|
{
"content_hash": "135cff2757258d959a73e5ebb6d09dc3",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 292,
"avg_line_length": 32.361702127659576,
"alnum_prop": 0.670830593907517,
"repo_name": "lsjroberts/p2p-social-network",
"id": "17880581160caa9066fa983b6351e1c42c8e5765",
"size": "4598",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "old/javascripts/RTC/PeerConnection.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5612"
},
{
"name": "CoffeeScript",
"bytes": "26194"
},
{
"name": "JavaScript",
"bytes": "6343"
}
]
}
|
package ca.carleton.gcrc.couch.onUpload.inReach;
import java.io.File;
import ca.carleton.gcrc.couch.onUpload.TestSupport;
import junit.framework.TestCase;
public class InReachSettingsFromXmlFileTest extends TestCase {
public void testLoad() throws Exception {
File xmlFile = TestSupport.findResourceFile("inreach_forms.xml");
InReachSettingsFromXmlFile settings = new InReachSettingsFromXmlFile(xmlFile);
settings.load();
}
}
|
{
"content_hash": "698a05a54783669e065a2a72ecd83299",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 80,
"avg_line_length": 29.2,
"alnum_prop": 0.8059360730593608,
"repo_name": "GCRC/nunaliit",
"id": "c24b600540240c7af03fa88f67b74d30d0a41377",
"size": "438",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nunaliit2-couch-onUpload/src/test/java/ca/carleton/gcrc/couch/onUpload/inReach/InReachSettingsFromXmlFileTest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "7006"
},
{
"name": "CSS",
"bytes": "332025"
},
{
"name": "HTML",
"bytes": "355349"
},
{
"name": "Java",
"bytes": "2727452"
},
{
"name": "JavaScript",
"bytes": "12006289"
},
{
"name": "Less",
"bytes": "8172"
},
{
"name": "Objective-C",
"bytes": "32829"
},
{
"name": "Perl",
"bytes": "7610"
},
{
"name": "Python",
"bytes": "111071"
},
{
"name": "Ruby",
"bytes": "353"
},
{
"name": "Shell",
"bytes": "12669"
},
{
"name": "Yacc",
"bytes": "36279"
}
]
}
|
/**
* WebServiceCall.java
*
* This file was generated by MapForce 2011r2sp1.
*
* YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
* OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
*
* Refer to the MapForce Documentation for further details.
* http://www.altova.com/mapforce
*/
package com.altova.xml;
import java.io.OutputStream;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
public class WebServiceCall
{
private String endpointURL;
private String soapAction;
private String encoding;
private String operationName;
private String WSDLTargetNamespace;
private String operationLocation;
private byte style;
private byte httpContentType;
private String username = "";
private String password = "";
private String soapenvUri = "http://schemas.xmlsoap.org/soap/envelope/";
private String soapencUri = "http://schemas.xmlsoap.org/soap/encoding/";
private byte soapVer;
public static final byte UNKNOWN = 0;
public static final byte SOAP_RPC_ENCODED = 1;
public static final byte SOAP_DOCUMENT_LITERAL = 2;
public static final byte HTTP_GET = 3;
public static final byte HTTP_POST= 4;
public static final byte HTTP_URL_ENCODED = 1;
public static final byte HTTP_URL_REPLACEMENT = 2;
public static final byte HTTP_XML = 3;
public static final byte SOAP_11 = 11;
public static final byte SOAP_12 = 12;
public WebServiceCall(String endpointURL, String WSDLTargetNamespace, String operationName, String soapAction, String encoding, byte style, byte soapVer)
{
this.endpointURL = endpointURL;
this.soapAction = soapAction;
this.encoding = encoding;
this.WSDLTargetNamespace = WSDLTargetNamespace;
this.operationName = operationName;
this.style = style;
this.soapVer = soapVer;
if (soapVer == SOAP_12)
{
soapenvUri = "http://www.w3.org/2003/05/soap-envelope";
soapencUri = "http://www.w3.org/2003/05/soap-encoding";
}
}
public WebServiceCall(String endpointURL, String opLocation, byte contentType, String encoding, byte style, byte soapVer)
{
this.endpointURL = endpointURL;
this.operationLocation= opLocation;
this.httpContentType = contentType;
this.encoding = encoding;
this.style = style;
this.soapVer = soapVer;
if (soapVer == SOAP_12)
{
soapenvUri = "http://www.w3.org/2003/05/soap-envelope";
soapencUri = "http://www.w3.org/2003/05/soap-encoding";
}
}
public void setCredentials( String u, String p)
{
username = u;
password = p;
}
private void fixPrefix(org.w3c.dom.Node n)
{
if (n.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
return;
String prefix = n.lookupPrefix(n.getNamespaceURI());
if (prefix != null)
n.setPrefix(prefix);
for (org.w3c.dom.Node c = n.getFirstChild(); c != null; c = c.getNextSibling())
fixPrefix(c);
}
public org.w3c.dom.Node call (org.w3c.dom.Node in) throws Exception
{
org.w3c.dom.Node node = in;
// non soap case
if (style == HTTP_GET || style == HTTP_POST)
{
node=in.getFirstChild();
HttpURLConnection conn = null;
String urlOperation = endpointURL + operationLocation;
String parameters = "";
// construct parameters from parts
if (node != null)
{
org.w3c.dom.NodeList parts = node.getChildNodes();
if (httpContentType == HTTP_XML && style == HTTP_POST)
{
if (parts.getLength() > 1)
throw new Exception ("HTTP POST with text/xml encoding can handle only one part");
if (parts.getLength() == 1)
{
javax.xml.transform.Transformer xformer = javax.xml.transform.TransformerFactory.newInstance().newTransformer();
//xformer.setOutputProperty("indent", "yes");
//xformer.setOutputProperty("omit-xml-declaration", "yes");
javax.xml.transform.Source source = new javax.xml.transform.dom.DOMSource(parts.item(0));
java.io.StringWriter swr = new java.io.StringWriter();
xformer.transform(source, new javax.xml.transform.stream.StreamResult(swr));
parameters = swr.toString();
}
}
else if (httpContentType == HTTP_URL_ENCODED )
{
for (int i = 0; i<parts.getLength(); i++)
{
if (i>0)
parameters += "&";
parameters += java.net.URLEncoder.encode(parts.item(i).getLocalName(), "UTF-8");
parameters += "=";
parameters += java.net.URLEncoder.encode(getDomNodeValue(parts.item(i)), "UTF-8");
}
}
else
throw new Exception ("Unsupported mime type for HTTP binding");
}
if (style == HTTP_GET)
{
if (parameters.length() > 0)
urlOperation += ("?" + parameters);
URL url = new URL(urlOperation);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
if (username.length() > 0 && password.length() > 0)
conn.setRequestProperty("Authorization", "Basic " + base64Encode(username + ":" + password));
conn.connect();
}
else // POST
{
URL url = new URL(urlOperation);
conn = (HttpURLConnection) url.openConnection();
byte[] buff = parameters.getBytes(encoding);
createHTTPPostHeader( conn, buff.length);
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream connectionStream = conn.getOutputStream();
connectionStream.write(buff);
connectionStream.close();
}
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)
{
org.w3c.dom.Document doc = XmlTreeOperations.getDomBuilder().parse(conn.getInputStream());
return doc;
}
else
throw new Exception ("Failed: " + conn.getResponseCode() + " " + conn.getResponseMessage());
}
else if (style == SOAP_DOCUMENT_LITERAL || style == SOAP_RPC_ENCODED)
{
// turn it into text and send it away
Transformer xformer = TransformerFactory.newInstance().newTransformer();
Source source = new DOMSource(in);
StringWriter swr = new StringWriter();
Result result = new StreamResult(swr);
xformer.transform(source, result);
String req = swr.toString();
byte[] buff = req.getBytes(encoding);
int len = buff.length;
// calculate length set headers and send it away
URL url = new URL(endpointURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
createHTTPPostHeader( conn, len);
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream connectionStream = conn.getOutputStream();
connectionStream.write(buff);
connectionStream.close();
org.w3c.dom.Document soapDoc;
if (conn.getResponseCode() == 200)
soapDoc = XmlTreeOperations.getDomBuilder().parse(conn.getInputStream());
else
soapDoc = XmlTreeOperations.getDomBuilder().parse(conn.getErrorStream());
// check mustUnderstand
org.w3c.dom.NodeList headers = soapDoc.getElementsByTagNameNS(soapenvUri, "Header");
if (headers.getLength() > 1)
throw new Exception("More than one header found");
if (headers.getLength() == 1)
{
for (org.w3c.dom.Node headerNode = headers.item(0).getFirstChild(); headerNode != null; headerNode = headerNode.getNextSibling())
if (headerNode.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE)
{
org.w3c.dom.Attr muAtt = ((org.w3c.dom.Element)headerNode).getAttributeNodeNS(soapenvUri, "mustUnderstand");
if (muAtt != null && (muAtt.getNodeValue().equals("1") || muAtt.getNodeValue().equals("true")))
throw new Exception("Cannot process messages with mustUnderstand headers");
}
}
return soapDoc;
}
else
throw new Exception ("Unsupported style");
}
public boolean call (org.w3c.dom.Node in, org.w3c.dom.Node out) throws Exception
{
org.w3c.dom.Node node = in;
// non soap case
if (style == HTTP_GET || style == HTTP_POST)
{
node=in.getFirstChild();
HttpURLConnection conn = null;
String urlOperation = endpointURL + operationLocation;
String parameters = "";
// construct parameters from parts
if (node != null)
{
org.w3c.dom.NodeList parts = node.getChildNodes();
if (httpContentType == HTTP_XML && style == HTTP_POST)
{
if (parts.getLength() > 1)
throw new Exception ("HTTP POST with text/xml encoding can handle only one part");
if (parts.getLength() == 1)
{
javax.xml.transform.Transformer xformer = javax.xml.transform.TransformerFactory.newInstance().newTransformer();
//xformer.setOutputProperty("indent", "yes");
//xformer.setOutputProperty("omit-xml-declaration", "yes");
javax.xml.transform.Source source = new javax.xml.transform.dom.DOMSource(parts.item(0));
java.io.StringWriter swr = new java.io.StringWriter();
xformer.transform(source, new javax.xml.transform.stream.StreamResult(swr));
parameters = swr.toString();
}
}
else if (httpContentType == HTTP_URL_ENCODED )
{
for (int i = 0; i<parts.getLength(); i++)
{
if (i>0)
parameters += "&";
parameters += java.net.URLEncoder.encode(parts.item(i).getLocalName(), "UTF-8");
parameters += "=";
parameters += java.net.URLEncoder.encode(getDomNodeValue(parts.item(i)), "UTF-8");
}
}
else
throw new Exception ("Unsupported mime type for HTTP binding");
}
if (style == HTTP_GET)
{
if (parameters.length() > 0)
urlOperation += ("?" + parameters);
URL url = new URL(urlOperation);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
if (username.length() > 0 && password.length() > 0)
conn.setRequestProperty("Authorization", "Basic " + base64Encode(username + ":" + password));
conn.connect();
}
else // POST
{
URL url = new URL(urlOperation);
conn = (HttpURLConnection) url.openConnection();
byte[] buff = parameters.getBytes(encoding);
createHTTPPostHeader( conn, buff.length);
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream connectionStream = conn.getOutputStream();
connectionStream.write(buff);
connectionStream.close();
}
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)
{
org.w3c.dom.Document doc = XmlTreeOperations.getDomBuilder().parse(conn.getInputStream());
out.appendChild(out.getOwnerDocument().importNode(doc.getDocumentElement(),true));
return true;
}
else
throw new Exception ("Failed: " + conn.getResponseCode() + " " + conn.getResponseMessage());
}
else if (style == SOAP_DOCUMENT_LITERAL || style == SOAP_RPC_ENCODED)
{
org.w3c.dom.Document soapDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
org.w3c.dom.Element envelope = soapDoc.createElementNS(soapenvUri, "SOAP-ENV:Envelope");
envelope.setAttribute("xmlns:SOAP-ENV", soapenvUri);
envelope.setAttribute("xmlns:SOAP-ENC", soapencUri);
envelope.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
envelope.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
org.w3c.dom.Element body = soapDoc.createElementNS(soapenvUri, "SOAP-ENV:Body");
org.w3c.dom.Element header = soapDoc.createElementNS(soapenvUri, "SOAP-ENV:Header");
if (style == SOAP_RPC_ENCODED)
{
// create rpcEnvelope
org.w3c.dom.Element rpcEnvelope = soapDoc.createElementNS(WSDLTargetNamespace, "m:"+ operationName); // don't ask
rpcEnvelope.setAttribute("xmlns:m", WSDLTargetNamespace);
rpcEnvelope.setAttribute("SOAP-ENV:encodingStyle", soapencUri);
// take all attributes from root element, insert them into rpcEnvelope (?)
org.w3c.dom.NamedNodeMap attrs = node.getFirstChild().getAttributes();
for (int i = 0; i<attrs.getLength(); i++)
{
String attrName = ((org.w3c.dom.Attr)attrs.item(i)).getName();
rpcEnvelope.setAttribute(attrName, ((org.w3c.dom.Attr)attrs.item(i)).getValue());
}
// and add children of root node to rpcEnvelope
if (node != null)
{
org.w3c.dom.NodeList parts = node.getChildNodes();
int count = parts.getLength();
// headers 0..n-1
for (int i = 0; i < count-1; i++)
header.appendChild(soapDoc.importNode(parts.item(i), true));
// message is last
org.w3c.dom.Node dummyMsgRoot = parts.item(count-1);
for (int i = 0; i< dummyMsgRoot.getChildNodes().getLength(); i++)
rpcEnvelope.appendChild(soapDoc.importNode(dummyMsgRoot.getChildNodes().item(i), true));
}
body.appendChild(rpcEnvelope);
}
else
{
if (node != null)
{
org.w3c.dom.NodeList parts = node.getChildNodes();
int count = parts.getLength();
// headers 0..n-1
for (int i = 0; i < count-1; i++)
header.appendChild(soapDoc.importNode(parts.item(i), true));
// message is last
org.w3c.dom.Node dummyMsgRoot = parts.item(count-1);
for (org.w3c.dom.Node l = dummyMsgRoot; l != null; l = l.getParentNode())
{
org.w3c.dom.NamedNodeMap nnm = l.getAttributes();
if (nnm != null)
for (int i=0; i < nnm.getLength(); i++)
body.setAttributeNodeNS((org.w3c.dom.Attr) soapDoc.importNode(nnm.item(i), true));
}
for (int i = 0; i< dummyMsgRoot.getChildNodes().getLength(); i++)
fixPrefix(body.appendChild(soapDoc.importNode(dummyMsgRoot.getChildNodes().item(i), true)));
}
}
if (header.getChildNodes().getLength() > 0)
envelope.appendChild(header);
envelope.appendChild(body);
soapDoc.appendChild(envelope);
// turn it into text and send it away
Transformer xformer = TransformerFactory.newInstance().newTransformer();
Source source = new DOMSource(soapDoc);
StringWriter swr = new StringWriter();
Result result = new StreamResult(swr);
xformer.transform(source, result);
String req = swr.toString();
byte[] buff = req.getBytes(encoding);
int len = buff.length;
// calculate length set headers and send it away
URL url = new URL(endpointURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
createHTTPPostHeader( conn, len);
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream connectionStream = conn.getOutputStream();
connectionStream.write(buff);
connectionStream.close();
if (conn.getResponseCode() == 200)
soapDoc = XmlTreeOperations.getDomBuilder().parse(conn.getInputStream());
else
soapDoc = XmlTreeOperations.getDomBuilder().parse(conn.getErrorStream());
// check mustUnderstand
org.w3c.dom.NodeList headers = soapDoc.getElementsByTagNameNS(soapenvUri, "Header");
if (headers.getLength() > 1)
throw new Exception("More than one header found");
if (headers.getLength() == 1)
{
for (org.w3c.dom.Node headerNode = headers.item(0).getFirstChild(); headerNode != null; headerNode = headerNode.getNextSibling())
if (headerNode.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE)
{
org.w3c.dom.Attr muAtt = ((org.w3c.dom.Element)headerNode).getAttributeNodeNS(soapenvUri, "mustUnderstand");
if (muAtt != null && (muAtt.getNodeValue().equals("1") || muAtt.getNodeValue().equals("true")))
throw new Exception("Cannot process messages with mustUnderstand headers");
}
}
out.appendChild(out.getOwnerDocument().importNode(soapDoc.getDocumentElement(), true));
return true;
}
else
throw new Exception ("Unsupported style");
}
private void createHTTPPostHeader(
HttpURLConnection conn,
int len) throws Exception
{
conn.setRequestMethod("POST");
switch (style)
{
case HTTP_POST:
{
if (httpContentType == HTTP_XML)
conn.setRequestProperty("Content-Type", "text/xml; charset=\"" + encoding + "\"");
else if (httpContentType == HTTP_URL_ENCODED )
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
else
throw new Exception ("Unsupported mime type for HTTP binding");
}
break;
case SOAP_DOCUMENT_LITERAL:
case SOAP_RPC_ENCODED:
default:
{
conn.setRequestProperty("Content-Length", String.valueOf(len));
if (soapVer == SOAP_12)
conn.setRequestProperty("Content-Type", "application/soap+xml; action=" + soapAction);
else
{
conn.setRequestProperty("Content-Type", "text/xml; charset=\"" + encoding + "\"");
conn.setRequestProperty("SOAPAction", "\"" + soapAction + "\"");
}
if (username.length() > 0 && password.length() > 0)
conn.setRequestProperty("Authorization", "Basic " + base64Encode(username + ":" + password));
}
}
}
private String base64Encode(String srcString)
{
String encodeArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
byte[] src = srcString.getBytes();
if (src.length == 0)
return "";
int tmpSize, i;
int buff;
tmpSize =src.length / 3 * 3;
StringWriter dstWriter = new StringWriter((src.length * 4 / 3) + 8);
for (i =0; i < tmpSize; i += 3)
{
buff = src[i] << 16 | src[i+1] << 8 | src[i+2];
dstWriter.write(encodeArray.charAt((buff >> 18) & 0x3F));
dstWriter.write(encodeArray.charAt((buff >> 12) & 0x3F));
dstWriter.write(encodeArray.charAt((buff >> 6) & 0x3F));
dstWriter.write(encodeArray.charAt((buff) & 0x3F));
}
int rest = src.length - tmpSize;
if (rest == 2)
{
buff = src[i] << 8 | src[i+1];
dstWriter.write(encodeArray.charAt((buff >> 10) & 0x3F));
dstWriter.write(encodeArray.charAt((buff >> 4) & 0x3F));
dstWriter.write(encodeArray.charAt((buff << 2) & 0x3F));
dstWriter.write("=");
}
else if (rest == 1)
{
buff = src[i];
dstWriter.write(encodeArray.charAt((buff >> 2) & 0x3F));
dstWriter.write(encodeArray.charAt((buff << 4) & 0x3F));
dstWriter.write("==");
}
return dstWriter.toString();
}
private String getDomNodeValue(org.w3c.dom.Node node)
{
if (node == null)
return null;
String value = node.getNodeValue();
if (value != null)
return value;
return getInnerText(node);
}
private String getInnerText(org.w3c.dom.Node node)
{
org.w3c.dom.NodeList elements = node.getChildNodes();
int length = elements.getLength();
StringBuffer text = new StringBuffer();
for (int i = 0; i < length; i++)
{
org.w3c.dom.Node child = elements.item(i);
if (child.getNodeType() == org.w3c.dom.Node.TEXT_NODE)
text.append(child.getNodeValue());
else if (child.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE)
text.append(getInnerText(child));
else if (child.getNodeType() == org.w3c.dom.Node.CDATA_SECTION_NODE)
text.append(child.getNodeValue());
}
return text.toString();
}
}
|
{
"content_hash": "b2ca2842639f5480ef020b15d8004929",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 154,
"avg_line_length": 32.805263157894736,
"alnum_prop": 0.6754906679501578,
"repo_name": "NCIP/national-biomedical-image-archive",
"id": "ca4ce95c33acc10aafeb7189866c582a3357d970",
"size": "18906",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/analysis_and_design/5.1/CedaraAIMMapingTo3_0/code/com/altova/xml/WebServiceCall.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "300"
},
{
"name": "CSS",
"bytes": "24518"
},
{
"name": "Groovy",
"bytes": "38152"
},
{
"name": "HTML",
"bytes": "683022"
},
{
"name": "Java",
"bytes": "4480887"
},
{
"name": "JavaScript",
"bytes": "109669"
},
{
"name": "PLSQL",
"bytes": "35795"
},
{
"name": "Perl",
"bytes": "4919"
},
{
"name": "Shell",
"bytes": "744"
},
{
"name": "XSLT",
"bytes": "215237"
}
]
}
|
//import package "threadExample"
import threadExample.*;
import utility.MathMethod;
import utility.counter;
import utility.util;
//class: public/private
public class JavaBasic {
// attributes / variable declaration
public static int intCount = 0; //static - belongs to the class, no need for instance of the class. create instance static.
private int age; //ini - integer
private String StDescribe; // String sequence of characters.
private boolean flage = false;
private char grade = 'A';
private static final double PI = 3.1415929; //constant
//constructors "JavaBasic"
public JavaBasic() {
// super constructor
//super();
// TODO Auto-generated constructor stub
System.out.println("constructor say i am the first");
}
public JavaBasic(int a, int b){
System.out.println("constructor a + b ==> " + (a + b));
}
/**
* Methods examples
*/
// method with NO parameters
public void methodCalling() {
System.out.println("this is a method without parameters");
}
// method with one parameters
public void methodCalling(int parameterOne){
System.out.println("method with a parameters , parameterOne >> " + parameterOne);
}
// method + 2 parameters
public void methodCalling(int parameterOne, int parameterTwo){
System.out.println("method with a parameters , parameterOne >> " + parameterOne + " , "+ parameterTwo);
}
/*
* Getter , Setter
*/
public static int getIntCount() {
return intCount;
}
public static void setIntCount(int intCount) {
JavaBasic.intCount = intCount;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age; //"this." refer to the current object.
}
public String getStDescribe() {
return StDescribe;
}
public void setStDescribe(String stDescribe) {
StDescribe = stDescribe;
}
/**
* /Getter , /Setter
*/
//1>> //reference type
static void methodChange (JavaBasic j, int value) {
j.age = value;
// j.setAge(333);
}
public static void BIP(){
System.out.print(" bip ");
}
//main method (function) with String Array parameters
public static void main(String[] args) {
//variable
//object of our class "jb" "jb2"
JavaBasic jb = new JavaBasic(); // we created "new object" of a "class". "jb" object of a class "JavaBasic" (constructor)
JavaBasic jb2 = new JavaBasic(11,22); //constructor with 2 parameters/arguments
jb.age = 10; //access attributes ags=10;
System.out.println("jb.age ===> " + jb.age);
//11> //before reference change
// System.out.println("reference type jb.age ===>> "+jb.age);
//1>> //reference type (with Parameters / Arguments inside: "(jb,1)" )
methodChange(jb, 1);
System.out.println("reference type jb.age ===>> "+jb.age);
//1>> //reference type (Array/String)
methodChange(jb, 221);
System.out.println("reference type jb.age ===>> "+jb.age);
intCount = 0;
intCount = intCount + 1;
System.out.println("\nStatic int intCount === " + jb.intCount);
//object to Math class example
MathMethod m = new MathMethod();
//prefix/postfix (increment/decrement)
m.methodPrePostFix();
//random number
m.GenerateRandomNumber(66);
//object to class with static
counter c1 = new counter();
counter c2 = new counter();
System.out.println("static counter total COUNT ==> " + c1.COUNT + " " + counter.COUNT);
BIP(); BIP();
System.out.println("\nPI ==> " + PI);
//package import and using class
javaThread j = new javaThread("");
j.setPuStName("nice to have");
System.out.println("import threadExample.*; >>> " + j.getPuStName());
}
}
|
{
"content_hash": "668d29d0e442753a2840d25922a5ac54",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 124,
"avg_line_length": 23.642857142857142,
"alnum_prop": 0.6613567701180995,
"repo_name": "ofekbytes/JavaNiceStuff",
"id": "d4e8a41bbd45a4b41c6bd2dcd87a60c0726ad70c",
"size": "3641",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "unsorted/JavaBasic/JavaBasic.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "18989"
}
]
}
|
package cn.varus.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import cn.varus.dao.UserDao;
import cn.varus.entity.User;
import cn.varus.service.UserService;
@Component
public class UserService {
@Autowired
private UserDao userDao;
public User getUserInfo() {
User user = userDao.getUserInfo();
return user;
}
}
|
{
"content_hash": "121d76d1156a52528a1decf2ab76177d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 62,
"avg_line_length": 21,
"alnum_prop": 0.7869674185463659,
"repo_name": "phoenix-varus/Jvarus",
"id": "0612e68ef7a7e648cc3520afdc1958382aae04c4",
"size": "399",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/cn/varus/service/UserService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "4525"
}
]
}
|
@protocol XCRefactoringModuleItem
- (BOOL)shouldHaveCheckbox;
- (BOOL)isGroupRow;
- (void)drawBackgroundInRect:(struct CGRect)arg1 rowRect:(struct CGRect)arg2;
- (id)details;
- (id)attributedName;
- (id)name;
- (id)icon;
- (id)childAtIndex:(long long)arg1;
- (unsigned long long)numberOfChildren;
- (BOOL)isExpandable;
@end
|
{
"content_hash": "7ed86f456a34c54b4e823242e11dfa96",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 77,
"avg_line_length": 21.8,
"alnum_prop": 0.746177370030581,
"repo_name": "liyong03/YLCleaner",
"id": "0b766cd64d0d304b32de30bab5713e1e3d3843ce",
"size": "467",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "YLCleaner/Xcode-RuntimeHeaders/DevToolsInterface/XCRefactoringModuleItem-Protocol.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "158958"
},
{
"name": "C++",
"bytes": "612673"
},
{
"name": "Objective-C",
"bytes": "10594281"
},
{
"name": "Ruby",
"bytes": "675"
}
]
}
|
layout: post
title: Upgrading Microk8s
subtitle: 1.18 to 1.19
date: 2020-09-28
background: /img/headers/icefields1.jpg
comments: true
published: true
---
During June, I installed [microk8s 1.18](/2020/04/21/ubuntu-microk8s), but then spent most of our warm Rockies summer in the mountains hiking and camping. After getting back to it in September, I wanted to upgrade from Kubernetes 1.18 to 1.19. However with microk8s, [upgrades are not supported](https://microk8s.io/docs/setting-snap-channel) - specifically see the "Changing channels" section.
Of course, microk8s is not intended for anything more than trial/test/lab workflows so a full re-install should be expected. First step is to remove the old install:
```
sudo snap remove microk8s
```
Then I performed the fresh install, this time to version 1.19:
```
sudo snap install microk8s --classic --channel=1.19/stable
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
tee -a ~/.bash_aliases <<<EOF
alias kubectl='microk8s kubectl'
EOF
su - $USER
microk8s status --wait-ready
kubectl cluster-info
kubectl get services
```
Then deploy the dashboard and make it available from my laptop:
```
microk8s enable dns storage dashboard ingress
kubectl label service/kubernetes-dashboard kubernetes.io/cluster-service=true --namespace kube-system
kubectl cluster-info
sudo microk8s.kubectl proxy --accept-hosts=.* --address=0.0.0.0 &
sudo microk8s.kubectl -n kube-system edit deploy kubernetes-dashboard -o yaml
> In editor, add '- --enable-skip-login' line after '- --namespace=kube-system'
```
Then browse to:
```
http://{IP_address}:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
```
and click the `Skip` button:
<img src="/img/posts/microk8s_upgrade_skip.png" class="img-fluid" />
to see the dashboard:
<img src="/img/posts/microk8s_upgrade_dashboard.png" class="img-fluid" />
Back in business with a fresh install of microk8s 1.19.
### More in this series...
* [microk8s on ubuntu](/2020/04/24/ubuntu-microk8s) - Single instance cluster
* [kubeflow setup](/2020/10/18/microk8s-kubeflow-setup) - Enabling ML workflows
* [MNIST notebook](/2020/11/14/microk8s-kubeflow-mnist) - Using Jupyter notebooks on Kubeflow
* [kubeflow pipelines](/2020/12/09/microk8s-kubeflow-pipelines) - Deploying pipelines on Kubeflow
|
{
"content_hash": "9d762fdef93706bed79cbd631b5365e1",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 397,
"avg_line_length": 36.390625,
"alnum_prop": 0.755259768140833,
"repo_name": "guydavis/guydavis.github.io",
"id": "7d62703e6c9050a3aaa67a46e13469db80088c23",
"size": "2333",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2020-09-28-microk8s-upgrade.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "92"
},
{
"name": "CSS",
"bytes": "8900"
},
{
"name": "HTML",
"bytes": "25851"
},
{
"name": "JavaScript",
"bytes": "60"
},
{
"name": "Ruby",
"bytes": "1184"
},
{
"name": "SCSS",
"bytes": "198"
},
{
"name": "Shell",
"bytes": "105"
}
]
}
|
<sokratik-canvas type="canvas" model="canvas" style="position:absolute; z-index:2"></sokratik-canvas>
<div class="full-height">
<div ng-include="templateName" class="full-height"></div>
</div>
|
{
"content_hash": "6f67227d24677b0a8d91d025ef590b43",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 101,
"avg_line_length": 51.5,
"alnum_prop": 0.6796116504854369,
"repo_name": "himangshuj/atelier",
"id": "b08f2034cbff5132202086d5cdbb5695266f87a7",
"size": "206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/record/dialogue.tpl.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "317692"
},
{
"name": "CoffeeScript",
"bytes": "1235"
},
{
"name": "JavaScript",
"bytes": "245473"
}
]
}
|
<?php
namespace cii\fields\file;
use Yii;
use cii\helpers\FileHelper;
use cii\fields\BrowserField;
class AudioField extends BrowserField {
protected function getMimeTypes() {
return FileHelper::$audioMimeTypes;
}
}
|
{
"content_hash": "73f6855f2fcd991bec09c57304448c7a",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 39,
"avg_line_length": 18.416666666666668,
"alnum_prop": 0.7737556561085973,
"repo_name": "matthieuriolo/cii",
"id": "56dc9c50fdc605fcb456c4d8163953cdf222c60e",
"size": "221",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/cii/vendor/cii/fields/file/AudioField.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "515"
},
{
"name": "CSS",
"bytes": "32233"
},
{
"name": "JavaScript",
"bytes": "4532597"
},
{
"name": "PHP",
"bytes": "510750"
}
]
}
|
using System;
#pragma warning disable 1591
// ReSharper disable UnusedMember.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable IntroduceOptionalParameters.Global
// ReSharper disable MemberCanBeProtected.Global
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
namespace AzureKeyVaultManager.UWP.Annotations
{
/// <summary>
/// Indicates that the value of the marked element could be <c>null</c> sometimes,
/// so the check for <c>null</c> is necessary before its usage.
/// </summary>
/// <example><code>
/// [CanBeNull] public object Test() { return null; }
/// public void UseTest() {
/// var p = Test();
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
public sealed class CanBeNullAttribute : Attribute { }
/// <summary>
/// Indicates that the value of the marked element could never be <c>null</c>.
/// </summary>
/// <example><code>
/// [NotNull] public object Foo() {
/// return null; // Warning: Possible 'null' assignment
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
public sealed class NotNullAttribute : Attribute { }
/// <summary>
/// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task
/// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
/// or of the Lazy.Value property can never be null.
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Delegate | AttributeTargets.Field)]
public sealed class ItemNotNullAttribute : Attribute { }
/// <summary>
/// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task
/// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
/// or of the Lazy.Value property can be null.
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Delegate | AttributeTargets.Field)]
public sealed class ItemCanBeNullAttribute : Attribute { }
/// <summary>
/// Indicates that the marked method builds string by format pattern and (optional) arguments.
/// Parameter, which contains format string, should be given in constructor. The format string
/// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form.
/// </summary>
/// <example><code>
/// [StringFormatMethod("message")]
/// public void ShowError(string message, params object[] args) { /* do something */ }
/// public void Foo() {
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Constructor | AttributeTargets.Method |
AttributeTargets.Property | AttributeTargets.Delegate)]
public sealed class StringFormatMethodAttribute : Attribute
{
/// <param name="formatParameterName">
/// Specifies which parameter of an annotated method should be treated as format-string
/// </param>
public StringFormatMethodAttribute(string formatParameterName)
{
FormatParameterName = formatParameterName;
}
public string FormatParameterName { get; private set; }
}
/// <summary>
/// For a parameter that is expected to be one of the limited set of values.
/// Specify fields of which type should be used as values for this parameter.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
public sealed class ValueProviderAttribute : Attribute
{
public ValueProviderAttribute(string name)
{
Name = name;
}
[NotNull] public string Name { get; private set; }
}
/// <summary>
/// Indicates that the function argument should be string literal and match one
/// of the parameters of the caller function. For example, ReSharper annotates
/// the parameter of <see cref="System.ArgumentNullException"/>.
/// </summary>
/// <example><code>
/// public void Foo(string param) {
/// if (param == null)
/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class InvokerParameterNameAttribute : Attribute { }
/// <summary>
/// Indicates that the method is contained in a type that implements
/// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method
/// is used to notify that some property value changed.
/// </summary>
/// <remarks>
/// The method should be non-static and conform to one of the supported signatures:
/// <list>
/// <item><c>NotifyChanged(string)</c></item>
/// <item><c>NotifyChanged(params string[])</c></item>
/// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
/// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
/// <item><c>SetProperty{T}(ref T, T, string)</c></item>
/// </list>
/// </remarks>
/// <example><code>
/// public class Foo : INotifyPropertyChanged {
/// public event PropertyChangedEventHandler PropertyChanged;
/// [NotifyPropertyChangedInvocator]
/// protected virtual void NotifyChanged(string propertyName) { ... }
///
/// private string _name;
/// public string Name {
/// get { return _name; }
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
/// }
/// }
/// </code>
/// Examples of generated notifications:
/// <list>
/// <item><c>NotifyChanged("Property")</c></item>
/// <item><c>NotifyChanged(() => Property)</c></item>
/// <item><c>NotifyChanged((VM x) => x.Property)</c></item>
/// <item><c>SetProperty(ref myField, value, "Property")</c></item>
/// </list>
/// </example>
[AttributeUsage(AttributeTargets.Method)]
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
{
public NotifyPropertyChangedInvocatorAttribute() { }
public NotifyPropertyChangedInvocatorAttribute(string parameterName)
{
ParameterName = parameterName;
}
public string ParameterName { get; private set; }
}
/// <summary>
/// Describes dependency between method input and output.
/// </summary>
/// <syntax>
/// <p>Function Definition Table syntax:</p>
/// <list>
/// <item>FDT ::= FDTRow [;FDTRow]*</item>
/// <item>FDTRow ::= Input => Output | Output <= Input</item>
/// <item>Input ::= ParameterName: Value [, Input]*</item>
/// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
/// <item>Value ::= true | false | null | notnull | canbenull</item>
/// </list>
/// If method has single input parameter, it's name could be omitted.<br/>
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
/// for method output means that the methos doesn't return normally.<br/>
/// <c>canbenull</c> annotation is only applicable for output parameters.<br/>
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
/// or use single attribute with rows separated by semicolon.<br/>
/// </syntax>
/// <examples><list>
/// <item><code>
/// [ContractAnnotation("=> halt")]
/// public void TerminationMethod()
/// </code></item>
/// <item><code>
/// [ContractAnnotation("halt <= condition: false")]
/// public void Assert(bool condition, string text) // regular assertion method
/// </code></item>
/// <item><code>
/// [ContractAnnotation("s:null => true")]
/// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
/// </code></item>
/// <item><code>
/// // A method that returns null if the parameter is null,
/// // and not null if the parameter is not null
/// [ContractAnnotation("null => null; notnull => notnull")]
/// public object Transform(object data)
/// </code></item>
/// <item><code>
/// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
/// public bool TryParse(string s, out Person result)
/// </code></item>
/// </list></examples>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class ContractAnnotationAttribute : Attribute
{
public ContractAnnotationAttribute([NotNull] string contract)
: this(contract, false) { }
public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
{
Contract = contract;
ForceFullStates = forceFullStates;
}
public string Contract { get; private set; }
public bool ForceFullStates { get; private set; }
}
/// <summary>
/// Indicates that marked element should be localized or not.
/// </summary>
/// <example><code>
/// [LocalizationRequiredAttribute(true)]
/// public class Foo {
/// private string str = "my string"; // Warning: Localizable string
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.All)]
public sealed class LocalizationRequiredAttribute : Attribute
{
public LocalizationRequiredAttribute() : this(true) { }
public LocalizationRequiredAttribute(bool required)
{
Required = required;
}
public bool Required { get; private set; }
}
/// <summary>
/// Indicates that the value of the marked type (or its derivatives)
/// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
/// should be used instead. However, using '==' or '!=' for comparison
/// with <c>null</c> is always permitted.
/// </summary>
/// <example><code>
/// [CannotApplyEqualityOperator]
/// class NoEquality { }
/// class UsesNoEquality {
/// public void Test() {
/// var ca1 = new NoEquality();
/// var ca2 = new NoEquality();
/// if (ca1 != null) { // OK
/// bool condition = ca1 == ca2; // Warning
/// }
/// }
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class CannotApplyEqualityOperatorAttribute : Attribute { }
/// <summary>
/// When applied to a target attribute, specifies a requirement for any type marked
/// with the target attribute to implement or inherit specific type or types.
/// </summary>
/// <example><code>
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
/// public class ComponentAttribute : Attribute { }
/// [Component] // ComponentAttribute requires implementing IComponent interface
/// public class MyComponent : IComponent { }
/// </code></example>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
[BaseTypeRequired(typeof(Attribute))]
public sealed class BaseTypeRequiredAttribute : Attribute
{
public BaseTypeRequiredAttribute([NotNull] Type baseType)
{
BaseType = baseType;
}
[NotNull] public Type BaseType { get; private set; }
}
/// <summary>
/// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library),
/// so this symbol will not be marked as unused (as well as by other usage inspections).
/// </summary>
[AttributeUsage(AttributeTargets.All)]
public sealed class UsedImplicitlyAttribute : Attribute
{
public UsedImplicitlyAttribute()
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
: this(ImplicitUseKindFlags.Default, targetFlags) { }
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
{
UseKindFlags = useKindFlags;
TargetFlags = targetFlags;
}
public ImplicitUseKindFlags UseKindFlags { get; private set; }
public ImplicitUseTargetFlags TargetFlags { get; private set; }
}
/// <summary>
/// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes
/// as unused (as well as by other usage inspections)
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)]
public sealed class MeansImplicitUseAttribute : Attribute
{
public MeansImplicitUseAttribute()
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
: this(ImplicitUseKindFlags.Default, targetFlags) { }
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
{
UseKindFlags = useKindFlags;
TargetFlags = targetFlags;
}
[UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
[UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
}
[Flags]
public enum ImplicitUseKindFlags
{
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
/// <summary>Only entity marked with attribute considered used.</summary>
Access = 1,
/// <summary>Indicates implicit assignment to a member.</summary>
Assign = 2,
/// <summary>
/// Indicates implicit instantiation of a type with fixed constructor signature.
/// That means any unused constructor parameters won't be reported as such.
/// </summary>
InstantiatedWithFixedConstructorSignature = 4,
/// <summary>Indicates implicit instantiation of a type.</summary>
InstantiatedNoFixedConstructorSignature = 8,
}
/// <summary>
/// Specify what is considered used implicitly when marked
/// with <see cref="MeansImplicitUseAttribute"/> or <see cref="UsedImplicitlyAttribute"/>.
/// </summary>
[Flags]
public enum ImplicitUseTargetFlags
{
Default = Itself,
Itself = 1,
/// <summary>Members of entity marked with attribute are considered used.</summary>
Members = 2,
/// <summary>Entity marked with attribute and all its members considered used.</summary>
WithMembers = Itself | Members
}
/// <summary>
/// This attribute is intended to mark publicly available API
/// which should not be removed and so is treated as used.
/// </summary>
[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
public sealed class PublicAPIAttribute : Attribute
{
public PublicAPIAttribute() { }
public PublicAPIAttribute([NotNull] string comment)
{
Comment = comment;
}
public string Comment { get; private set; }
}
/// <summary>
/// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack.
/// If the parameter is a delegate, indicates that delegate is executed while the method is executed.
/// If the parameter is an enumerable, indicates that it is enumerated while the method is executed.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class InstantHandleAttribute : Attribute { }
/// <summary>
/// Indicates that a method does not make any observable state changes.
/// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>.
/// </summary>
/// <example><code>
/// [Pure] private int Multiply(int x, int y) { return x * y; }
/// public void Foo() {
/// const int a = 2, b = 2;
/// Multiply(a, b); // Waring: Return value of pure method is not used
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Method)]
public sealed class PureAttribute : Attribute { }
/// <summary>
/// Indicates that a parameter is a path to a file or a folder within a web project.
/// Path can be relative or absolute, starting from web root (~).
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class PathReferenceAttribute : Attribute
{
public PathReferenceAttribute() { }
public PathReferenceAttribute([PathReference] string basePath)
{
BasePath = basePath;
}
public string BasePath { get; private set; }
}
/// <summary>
/// An extension method marked with this attribute is processed by ReSharper code completion
/// as a 'Source Template'. When extension method is completed over some expression, it's source code
/// is automatically expanded like a template at call site.
/// </summary>
/// <remarks>
/// Template method body can contain valid source code and/or special comments starting with '$'.
/// Text inside these comments is added as source code when the template is applied. Template parameters
/// can be used either as additional method parameters or as identifiers wrapped in two '$' signs.
/// Use the <see cref="MacroAttribute"/> attribute to specify macros for parameters.
/// </remarks>
/// <example>
/// In this example, the 'forEach' method is a source template available over all values
/// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block:
/// <code>
/// [SourceTemplate]
/// public static void forEach<T>(this IEnumerable<T> xs) {
/// foreach (var x in xs) {
/// //$ $END$
/// }
/// }
/// </code>
/// </example>
[AttributeUsage(AttributeTargets.Method)]
public sealed class SourceTemplateAttribute : Attribute { }
/// <summary>
/// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>.
/// </summary>
/// <remarks>
/// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression
/// is defined in the <see cref="MacroAttribute.Expression"/> property. When applied on a method, the target
/// template parameter is defined in the <see cref="MacroAttribute.Target"/> property. To apply the macro silently
/// for the parameter, set the <see cref="MacroAttribute.Editable"/> property value = -1.
/// </remarks>
/// <example>
/// Applying the attribute on a source template method:
/// <code>
/// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")]
/// public static void forEach<T>(this IEnumerable<T> collection) {
/// foreach (var item in collection) {
/// //$ $END$
/// }
/// }
/// </code>
/// Applying the attribute on a template method parameter:
/// <code>
/// [SourceTemplate]
/// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) {
/// /*$ var $x$Id = "$newguid$" + x.ToString();
/// x.DoSomething($x$Id); */
/// }
/// </code>
/// </example>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)]
public sealed class MacroAttribute : Attribute
{
/// <summary>
/// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see>
/// parameter when the template is expanded.
/// </summary>
public string Expression { get; set; }
/// <summary>
/// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
/// </summary>
/// <remarks>
/// If the target parameter is used several times in the template, only one occurrence becomes editable;
/// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence,
/// use values >= 0. To make the parameter non-editable when the template is expanded, use -1.
/// </remarks>>
public int Editable { get; set; }
/// <summary>
/// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the
/// <see cref="MacroAttribute"/> is applied on a template method.
/// </summary>
public string Target { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
{
public AspMvcAreaMasterLocationFormatAttribute(string format)
{
Format = format;
}
public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
{
public AspMvcAreaPartialViewLocationFormatAttribute(string format)
{
Format = format;
}
public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
{
public AspMvcAreaViewLocationFormatAttribute(string format)
{
Format = format;
}
public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcMasterLocationFormatAttribute : Attribute
{
public AspMvcMasterLocationFormatAttribute(string format)
{
Format = format;
}
public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
{
public AspMvcPartialViewLocationFormatAttribute(string format)
{
Format = format;
}
public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcViewLocationFormatAttribute : Attribute
{
public AspMvcViewLocationFormatAttribute(string format)
{
Format = format;
}
public string Format { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC action. If applied to a method, the MVC action name is calculated
/// implicitly from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcActionAttribute : Attribute
{
public AspMvcActionAttribute() { }
public AspMvcActionAttribute(string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
public string AnonymousProperty { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcAreaAttribute : Attribute
{
public AspMvcAreaAttribute() { }
public AspMvcAreaAttribute(string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
public string AnonymousProperty { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is
/// an MVC controller. If applied to a method, the MVC controller name is calculated
/// implicitly from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcControllerAttribute : Attribute
{
public AspMvcControllerAttribute() { }
public AspMvcControllerAttribute(string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
public string AnonymousProperty { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute
/// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcMasterAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute
/// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcModelTypeAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC
/// partial view. If applied to a method, the MVC partial view name is calculated implicitly
/// from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcPartialViewAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class AspMvcSupressViewErrorAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcDisplayTemplateAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcEditorTemplateAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
/// Use this attribute for custom wrappers similar to
/// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcTemplateAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
/// from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Controller.View(Object)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcViewAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. When applied to a parameter of an attribute,
/// indicates that this parameter is an MVC action name.
/// </summary>
/// <example><code>
/// [ActionName("Foo")]
/// public ActionResult Login(string returnUrl) {
/// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
/// return RedirectToAction("Bar"); // Error: Cannot resolve action
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
public sealed class AspMvcActionSelectorAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
public sealed class HtmlElementAttributesAttribute : Attribute
{
public HtmlElementAttributesAttribute() { }
public HtmlElementAttributesAttribute(string name)
{
Name = name;
}
public string Name { get; private set; }
}
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
public sealed class HtmlAttributeValueAttribute : Attribute
{
public HtmlAttributeValueAttribute([NotNull] string name)
{
Name = name;
}
[NotNull] public string Name { get; private set; }
}
/// <summary>
/// Razor attribute. Indicates that a parameter or a method is a Razor section.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class RazorSectionAttribute : Attribute { }
/// <summary>
/// Indicates how method, constructor invocation or property access
/// over collection type affects content of the collection.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)]
public sealed class CollectionAccessAttribute : Attribute
{
public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
{
CollectionAccessType = collectionAccessType;
}
public CollectionAccessType CollectionAccessType { get; private set; }
}
[Flags]
public enum CollectionAccessType
{
/// <summary>Method does not use or modify content of the collection.</summary>
None = 0,
/// <summary>Method only reads content of the collection but does not modify it.</summary>
Read = 1,
/// <summary>Method can change content of the collection but does not add new elements.</summary>
ModifyExistingContent = 2,
/// <summary>Method can add new elements to the collection.</summary>
UpdatedContent = ModifyExistingContent | 4
}
/// <summary>
/// Indicates that the marked method is assertion method, i.e. it halts control flow if
/// one of the conditions is satisfied. To set the condition, mark one of the parameters with
/// <see cref="AssertionConditionAttribute"/> attribute.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class AssertionMethodAttribute : Attribute { }
/// <summary>
/// Indicates the condition parameter of the assertion method. The method itself should be
/// marked by <see cref="AssertionMethodAttribute"/> attribute. The mandatory argument of
/// the attribute is the assertion type.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AssertionConditionAttribute : Attribute
{
public AssertionConditionAttribute(AssertionConditionType conditionType)
{
ConditionType = conditionType;
}
public AssertionConditionType ConditionType { get; private set; }
}
/// <summary>
/// Specifies assertion type. If the assertion method argument satisfies the condition,
/// then the execution continues. Otherwise, execution is assumed to be halted.
/// </summary>
public enum AssertionConditionType
{
/// <summary>Marked parameter should be evaluated to true.</summary>
IS_TRUE = 0,
/// <summary>Marked parameter should be evaluated to false.</summary>
IS_FALSE = 1,
/// <summary>Marked parameter should be evaluated to null value.</summary>
IS_NULL = 2,
/// <summary>Marked parameter should be evaluated to not null value.</summary>
IS_NOT_NULL = 3,
}
/// <summary>
/// Indicates that the marked method unconditionally terminates control flow execution.
/// For example, it could unconditionally throw exception.
/// </summary>
[Obsolete("Use [ContractAnnotation('=> halt')] instead")]
[AttributeUsage(AttributeTargets.Method)]
public sealed class TerminatesProgramAttribute : Attribute { }
/// <summary>
/// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select,
/// .Where). This annotation allows inference of [InstantHandle] annotation for parameters
/// of delegate type by analyzing LINQ method chains.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class LinqTunnelAttribute : Attribute { }
/// <summary>
/// Indicates that IEnumerable, passed as parameter, is not enumerated.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class NoEnumerationAttribute : Attribute { }
/// <summary>
/// Indicates that parameter is regular expression pattern.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class RegexPatternAttribute : Attribute { }
/// <summary>
/// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated
/// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public sealed class XamlItemsControlAttribute : Attribute { }
/// <summary>
/// XAML attibute. Indicates the property of some <c>BindingBase</c>-derived type, that
/// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will
/// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
/// </summary>
/// <remarks>
/// Property should have the tree ancestor of the <c>ItemsControl</c> type or
/// marked with the <see cref="XamlItemsControlAttribute"/> attribute.
/// </remarks>
[AttributeUsage(AttributeTargets.Property)]
public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class AspChildControlTypeAttribute : Attribute
{
public AspChildControlTypeAttribute(string tagName, Type controlType)
{
TagName = tagName;
ControlType = controlType;
}
public string TagName { get; private set; }
public Type ControlType { get; private set; }
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
public sealed class AspDataFieldAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
public sealed class AspDataFieldsAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Property)]
public sealed class AspMethodPropertyAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class AspRequiredAttributeAttribute : Attribute
{
public AspRequiredAttributeAttribute([NotNull] string attribute)
{
Attribute = attribute;
}
public string Attribute { get; private set; }
}
[AttributeUsage(AttributeTargets.Property)]
public sealed class AspTypePropertyAttribute : Attribute
{
public bool CreateConstructorReferences { get; private set; }
public AspTypePropertyAttribute(bool createConstructorReferences)
{
CreateConstructorReferences = createConstructorReferences;
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class RazorImportNamespaceAttribute : Attribute
{
public RazorImportNamespaceAttribute(string name)
{
Name = name;
}
public string Name { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class RazorInjectionAttribute : Attribute
{
public RazorInjectionAttribute(string type, string fieldName)
{
Type = type;
FieldName = fieldName;
}
public string Type { get; private set; }
public string FieldName { get; private set; }
}
[AttributeUsage(AttributeTargets.Method)]
public sealed class RazorHelperCommonAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Property)]
public sealed class RazorLayoutAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Method)]
public sealed class RazorWriteLiteralMethodAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Method)]
public sealed class RazorWriteMethodAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class RazorWriteMethodParameterAttribute : Attribute { }
/// <summary>
/// Prevents the Member Reordering feature from tossing members of the marked class.
/// </summary>
/// <remarks>
/// The attribute must be mentioned in your member reordering patterns
/// </remarks>
[AttributeUsage(AttributeTargets.All)]
public sealed class NoReorder : Attribute { }
}
|
{
"content_hash": "5a101a08607377a49177977c37e4e97c",
"timestamp": "",
"source": "github",
"line_count": 942,
"max_line_length": 119,
"avg_line_length": 38.8343949044586,
"alnum_prop": 0.7049368541905855,
"repo_name": "mzxgiant/AzureKeyVaultManager",
"id": "0cb23a34616953c48fc17a03f6bfd40a9a9ce196",
"size": "36584",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AzureKeyVaultManager.UWP/Properties/Annotations.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "230725"
}
]
}
|
<?php
class MenuItem extends DataObject
{
private static $db = array(
'Title' => 'Varchar(1000)',
'Link' => 'Varchar(100)',
'SortOrder' => 'Int',
);
private static $has_one = array(
'Parent' => 'HomePage'
);
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('SortOrder');
$fields->removeByName('ParentID');
return $fields;
}
}
|
{
"content_hash": "98551decf8211e067e11d121323eb765",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 43,
"avg_line_length": 19.25,
"alnum_prop": 0.5367965367965368,
"repo_name": "filiplikavcan/tis-zuzana",
"id": "eecab2e7c2ef9ba5592dbcb4a2b9d625b0be50ac",
"size": "462",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tis-zuzana/code/models/MenuItem.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "2961"
},
{
"name": "CSS",
"bytes": "167682"
},
{
"name": "HTML",
"bytes": "88351"
},
{
"name": "JavaScript",
"bytes": "7750"
},
{
"name": "PHP",
"bytes": "52544"
}
]
}
|
'''
Created on 1-Apr-2015
@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CustomerVault.Profile import Profile
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient
from Config import Config
from RandomTokenGenerator import RandomTokenGenerator
optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number)
profile_obj = Profile(None)
profile_obj.merchantCustomerId(RandomTokenGenerator().generateToken())
profile_obj.locale("en_US")
profile_obj.firstName("John")
profile_obj.lastName("Smith")
profile_obj.email("john.@smith@somedomain.com")
profile_obj.phone("713-444-5555")
response_object = optimal_obj.customer_vault_service_handler().create_profile(profile_obj)
print ('Content-Type: text/html')
print ()
print ('<html>')
print ('<head><title>Customer Vault - Create Customer Profile</title></head>')
print ('<body>')
print (response_object.__dict__)
print ('</body></html>')
|
{
"content_hash": "c5d8c5d9b09dd8f5edfbac20999f456a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 110,
"avg_line_length": 30.93548387096774,
"alnum_prop": 0.7653806047966631,
"repo_name": "OptimalPayments/Python_SDK",
"id": "e4987323e51bb3f026b8796f745a641e0b25b272",
"size": "982",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sample_application/CreateProfile.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "334349"
}
]
}
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="../" />
<!-- oktavia -->
<link rel="stylesheet" href="assets/searchstyle.css" type="text/css" />
<script src="search/jquery-1.9.1.min.js"></script>
<script src="search/oktavia-jquery-ui.js"></script>
<script src="search/oktavia-english-search.js"></script>
<!-- /oktavia -->
<link rel="stylesheet" href="assets/style.css" type="text/css" />
<title>Base Directives - Configure - H2O - the optimized HTTP/2 server</title>
</head>
<body>
<div id="body">
<div id="top">
<h1>
<a href="index.html">H2O</a>
</h1>
the optimized HTTP/1.x, HTTP/2 server
<!-- oktavia -->
<form id="searchform">
<input class="search" type="search" name="search" id="search" results="5" value="" placeholder="Search" />
<div id="searchresult_box">
<div id="close_search_box">×</div>
<div id="searchresult_summary"></div>
<div id="searchresult"></div>
<div id="searchresult_nav"></div>
<span class="pr">Powered by <a href="https://github.com/shibukawa/oktavia">Oktavia</a></span>
</div>
</form>
<!-- /oktavia -->
</div>
<table id="menu">
<tr>
<td><a href="index.html">Top</a></td>
<td><a href="install.html">Install</a></td>
<td class="selected">Configure</td>
<td><a href="faq.html">FAQ</a></td>
<td><a href="http://blog.kazuhooku.com/search/label/H2O" target="_blank">Blog</a></td>
<td><a href="http://github.com/h2o/h2o/" target="_blank">Source</a></td>
</tr>
</table>
<div id="main">
<h2>
<a href="configure.html">Configure</a> >
Base Directives
</h2>
<p>
This document describes the configuration directives common to all the protocols and handlers.
</p>
<div id="hosts" class="directive-head">
<h3><a href="configure/base_directives.html#hosts"><code>"hosts"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Maps <code>host:port</code> to the mappings of per-host configs.
</p>
<p>
The directive specifies the mapping between the authorities (the host or <code>host:port</code> section of an URL) and their configurations.
The directive is mandatory, and must at least contain one entry.
</p>
<p>
When <code>port</code> is omitted, the entry will match the requests targetting the default ports (i.e. port 80 for HTTP, port 443 for HTTPS) with given hostname.
Otherwise, the entry will match the requests targetting the specified port.
</p>
<p>
Since version 1.7, a wildcard character <code>*</code> can be used as the first component of the hostname.
If used, they are matched using the rule defined in <a href="https://tools.ietf.org/html/rfc2818#section-3.1" target="_blank">RFC 2818 Section 3.1</a>.
For example, <code>*.example.com</code> will match HTTP requests for both <code>foo.example.com</code> and <code>bar.example.com</code>.
Note that an exact match is preferred over host definitions using wildcard characters.
</p>
<div class="example">
<div class="caption">Example. A host redirecting all HTTP requests to HTTPS</div>
<pre><code>hosts:
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect: https://www.example.com/
"www.example.com:443":
listen:
port: 443
ssl:
key-file: /path/to/ssl-key-file
certificate-file: /path/to/ssl-certificate-file
paths:
"/":
file.dir: /path/to/doc-root
</code></pre>
</div>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="paths" class="directive-head">
<h3><a href="configure/base_directives.html#paths"><code>"paths"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Mapping of paths and their configurations.
</p>
</p>
<p>
The mapping is searched using prefix-match.
The entry with the longest path is chosen when more than one matching paths were found.
An <code>404 Not Found</code> error is returned if no matching paths were found.
</p>
<div class="example">
<div class="caption">Example. Configuration with two paths</div>
<pre><code>hosts:
"www.example.com":
listen:
port: 80
paths:
"/":
file.dir: /path/to/doc-root
"/assets":
file.dir: /path/to/assets
</code></pre>
</div>
<p>
In releases prior to version 2.0, all the path entries are considered as directories.
When H2O receives a request that exactly matches to an entry in paths that does not end with a slash, the server always returns a 301 redirect that appends a slash.
</p>
<p>
Since 2.0, it depends on the handler of the path whether if a 301 redirect that appends a slash is returned.
Server administartors can take advantage of this change to define per-path configurations (see the examples in <a href="configure/file_directives.html#file.file"><code>file.file</code></a> and the <a href="configure/fastcgi_directives.html">FastCGI handler</a>).
<a href="configure/file_directives.html#file.dir"><code>file.dir</code></a> is an exception that continues to perform the redirection; in case of the example above, access to <code>/assets</code> is redirected to <code>/assets/</code>.
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>host</dd>
</dl>
<div id="listen" class="directive-head">
<h3><a href="configure/base_directives.html#listen"><code>"listen"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Specifies the port at which the server should listen to.
</p>
</p>
<p>
In addition to specifying the port number, it is also possible to designate the bind address or the SSL configuration.
</p>
<div class="example">
<div class="caption">Example. Various ways of using the Listen Directive</div>
<pre><code># accept HTTP on port 80 on default address (both IPv4 and IPv6)
listen: 80
# accept HTTP on 127.0.0.1:8080
listen:
host: 127.0.0.1
port: 8080
# accept HTTPS on port 443
listen:
port: 443
ssl:
key-file: /path/to/key-file
certificate-file: /path/to/certificate-file
# accept HTTPS on port 443 (using PROXY protocol)
listen:
port: 443
ssl:
key-file: /path/to/key-file
certificate-file: /path/to/certificate-file
proxy-protocol: ON
</code></pre>
</div>
<h4 id="listen-configuration-levels">Configuration Levels</h4>
<p>
The directive can be used either at global-level or at host-level.
At least one <code>listen</code> directive must exist at the global level, or every <i>host</i>-level configuration must have at least one <code>listen</code> directive.
</p>
<p>
Incoming connections accepted by global-level listeners will be dispatched to one of the host-level contexts with the corresponding <code>host:port</code>, or to the first host-level context if none of the contexts were given <code>host:port</code> corresponding to the request.
</p>
<p>
Host-level listeners specify bind addresses specific to the host-level context.
However it is permitted to specify the same bind address for more than one host-level contexts, in which case hostname-based lookup will be performed between the host contexts that share the address.
The feature is useful for setting up a HTTPS virtual host using <a href="https://tools.ietf.org/html/rfc6066">Server-Name Indication (RFC 6066)</a>.
</p>
<div class="example">
<div class="caption">Example. Using host-level listeners for HTTPS virtual-hosting</div>
<pre><code>hosts:
"www.example.com:443":
listen:
port: 443
ssl:
key-file: /path/to/www_example_com.key
certificate-file: /path/to/www_example_com.crt
paths:
"/":
file.dir: /path/to/doc-root_of_www_example_com
"www.example.jp:443":
listen:
port: 443
ssl:
key-file: /path/to/www_example_jp.key
certificate-file: /path/to/www_example_jp.crt
paths:
"/":
file.dir: /path/to/doc-root_of_www_example_jp
</code></pre>
</div>
<h4 id="listen-ssl">SSL Attribute</h4>
<p>
The <code style="font-weight: bold;">ssl</code> attribute must be defined as a mapping, and recognizes the following attributes.
</p>
<dl>
<dt id="certificate-file">certificate-file:</dt>
<dd>path of the SSL certificate file (mandatory)</dd>
<dt id="key-file">key-file:</dt>
<dd>path of the SSL private key file (mandatory)</dd>
<dt id="minimum-version">minimum-version:</dt>
<dd>
minimum protocol version, should be one of: <code>SSLv2</code>, <code>SSLv3</code>, <code>TLSv1</code>, <code>TLSv1.1</code>, <code>TLSv1.2</code>.
Default is <code>TLSv1</code>
</dd>
<dt id="cipher-suite">cipher-suite:</dt>
<dd>list of cipher suites to be passed to OpenSSL via SSL_CTX_set_cipher_list (optional)</dd>
<dt id="cipher-preferences">cipher-preference:</dt>
<dd>
side of the list that should be used for selecting the cipher-suite; should be either of: <code>client</code>, <code>server</code>.
Default is <code>client</code>.
</dd>
<dt id="dh-file">dh-file:</dt>
<dd>
path of a PEM file containing the Diffie-Hellman paratemers to be used.
Use of the file is recommended for servers using Diffie-Hellman key agreement.
(optional)
</dd>
<dt id="ocsp-update-interval">ocsp-update-interval:</dt>
<dd>
interval for updating the OCSP stapling data (in seconds), or set to zero to disable OCSP stapling.
Default is <code>14400</code> (4 hours).
</dd>
<dt id="ocsp-max-failures">ocsp-max-failures:</dt>
<dd>
number of consecutive OCSP queriy failures before stopping to send OCSP stapling data to the client.
Default is 3.
</dd>
<dt id="neverbleed">neverbleed:</dt>
<dd>
unless set to <code>OFF</code>, H2O isolates RSA private key operations to an islotated process by using <a href="https://github.com/h2o/neverbleed">Neverbleed</a>.
Default is <code>ON</code>.
</dl>
<p>
<a href="configure/base_directives.html#ssl-session-resumption"><code>ssl-session-resumption</code></a> directive is provided for tuning parameters related to session resumption and session tickets.
</p>
<h4 id="listen-proxy-protocol">The Proxy-Protocol Attribute</h4>
<p>
The <code>proxy-protocol</code> attribute (i.e. the value of the attribute must be either <code>ON</code> or <code>OFF</code>) specifies if the server should recognize the information passed via <a href="http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt">"the PROXY protocol</a> in the incoming connections.
The protocol is used by L4 gateways such as <a href="http://aws.amazon.com/jp/elasticloadbalancing/">AWS Elastic Load Balancing</a> to send peer address to the servers behind the gateways.
</p>
<p>
When set to <code>ON</code>, H2O standalone server tries to parse the first octets of the incoming connections as defined in version 1 of the specification, and if successful, passes the addresses obtained from the protocol to the web applications and the logging handlers.
If the first octets do not accord with the specification, it is considered as the start of the SSL handshake or as the beginning of an HTTP request depending on whether if the <code>ssl</code> attribute has been used.
</p>
<p>
Default is <code>OFF</code>.
</p>
<h4 id="listen-unix-socket">Listening to a Unix Socket</h4>
<p>
If the <code>type</code> attribute is set to <code>unix</code>, then the <code>port</code> attribute is assumed to specify the path of the unix socket to which the standalone server should bound.
Also following attributes are recognized.
</p>
<dl>
<dt>owner</dt>
<dd>
username of the owner of the socket file.
If omitted, the socket file will be owned by the launching user.
</dd>
<dt>permission</dt>
<dd>
an octal number specifying the permission of the sokcet file.
Many operating systems require write permission for connecting to the socket file.
If omitted, the permission of the socket file will reflect the umask of the calling process.
</dd>
</dl>
<div class="example">
<div class="caption">Example. Listening to a Unix Socket accessible only by www-data</div>
<pre><code>listen:
type: unix
port: /tmp/h2o.sock
owner: www-data
permission: 600
</code></pre>
</div>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global, host</dd>
</dl>
<div id="error-log" class="directive-head">
<h3><a href="configure/base_directives.html#error-log"><code>"error-log"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Path of the file to which error logs should be appended.
</p>
<p>
Default is stderr.
</p>
<p>
If the path starts with <code>|</code>, the rest of the path is considered as a command to which the logs should be piped.
</p>
<div class="example">
<div class="caption">Example. Log errors to file</div>
<pre><code>error-log: /path/to/error-log-file
</code></pre>
</div>
<div class="example">
<div class="caption">Example. Log errors through pipe</div>
<pre><code>error-log: "| rotatelogs /path/to/error-log-file.%Y%m%d 86400"
</code></pre>
</div>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="limit-request-body" class="directive-head">
<h3><a href="configure/base_directives.html#limit-request-body"><code>"limit-request-body"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Maximum size of request body in bytes (e.g. content of POST).
</p>
<p>
Default is 1073741824 (1GB).
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="max-connections" class="directive-head">
<h3><a href="configure/base_directives.html#max-connections"><code>"max-connections"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Number of connections to handle at once at maximum.
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
<dt>Default:</dt>
<dd><code><pre>max-connections: 1024</pre></code>
</dl>
<div id="max-delegations" class="directive-head">
<h3><a href="configure/base_directives.html#max-delegations"><code>"max-delegations"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Limits the number of delegations (i.e. internal redirects using the <code>X-Reproxy-URL</code> header).
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
<dt>Default:</dt>
<dd><code><pre>max-delegations: 5</pre></code>
</dl>
<div id="num-name-resolution-threads" class="directive-head">
<h3><a href="configure/base_directives.html#num-name-resolution-threads"><code>"num-name-resolution-threads"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Number of threads to run for name resolution.
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
<dt>Default:</dt>
<dd><code><pre>num-name-resolution-threads: 32</pre></code>
</dl>
<div id="num-threads" class="directive-head">
<h3><a href="configure/base_directives.html#num-threads"><code>"num-threads"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Number of worker threads.
</p>
<p>
Default is the number of the processors connected to the system as obtained by <code>getconf NPROCESSORS_ONLN</code>.
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="pid-file" class="directive-head">
<h3><a href="configure/base_directives.html#pid-file"><code>"pid-file"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Name of the file to which the process id of the server should be written.
</p>
<p>
Default is none.
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="tcp-fastopen" class="directive-head">
<h3><a href="configure/base_directives.html#tcp-fastopen"><code>"tcp-fastopen"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Size of the queue used for TCP Fast Open.
</p>
<p>
<a href="https://en.wikipedia.org/wiki/TCP_Fast_Open">TCP Fast Open</a> is an extension to the TCP/IP protocol that reduces the time spent for establishing a connection.
On Linux that support the feature, the default value is <code>4,096</code>.
On other platforms the default value is <code>0</code> (disabled).
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="ssl-session-resumption" class="directive-head">
<h3><a href="configure/base_directives.html#ssl-session-resumption"><code>"ssl-session-resumption"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Configures cache-based and ticket-based session resumption.
</p>
<p>
To reduce the latency introduced by the TLS (SSL) handshake, two methods to resume a previous encrypted session are defined by the Internet Engineering Task Force.
H2O supports both of the methods: cache-based session resumption (defined in <a href="https://tools.ietf.org/html/rfc5246">RFC 5246</a>) and ticket-based session resumption (defined in <a href="https://tools.ietf.org/html/rfc5077">RFC 5077</a>).
</p>
<div class="example">
<div class="caption">Example. Various session-resumption configurations</div>
<pre><code># use both methods (storing data on internal memory)
ssl-session-resumption:
mode: all
# use both methods (storing data on memcached running at 192.168.0.4:11211)
ssl-session-resumption:
mode: all
cache-store: memcached
ticket-store: memcached
cache-memcached-num-threads: 8
memcached:
host: 192.168.0.4
port: 11211
# use ticket-based resumption only (with secrets used for encrypting the tickets stored in a file)
ssl-session-resumption:
mode: ticket
ticket-store: file
ticket-file: /path/to/ticket-secrets.yaml
</code></pre>
</div>
<h4 id="ssl-session-resumption-methods">Defining the Methods Used</h4>
<p>
The <code>mode</code> attribute defines which methods should be used for resuming the TLS sessions.
The value can be either of: <code>off</code>, <code>cache</code>, <code>ticket</code>, <code>all</code>.
Default is <code>all</code>.
</p>
<p>
If set to <code>off</code>, session resumption will be disabled, and all TLS connections will be established via full handshakes.
If set to <code>all</code>, both session-based and ticket-based resumptions will be used, with the preference given to the ticket-based resumption for clients supporting both the methods.
</p>
<p>
For each method, additional attributes can be used to customize their behaviors.
Attributes that modify the behavior of the disabled method are ignored.
</p>
<h4 id="ssl-session-resumption-cache-based">Attributes for Cache-based Resumption</h4>
<p>
Following attributes are recognized if the cache-based session resumption is enabled.
Note that <code>memcached</code> attribute must be defined as well in case the <code>memcached</code> cache-store is used.
</p>
<dl>
<dt>cache-store:</dt>
<dd>
defines where the cache should be stored, must be one of: <code>internal</code>, <code>memcached</code>.
Default is <code>internal</code>.
</dd>
<dt>cache-memcached-num-threads:</dt>
<dd>defines the maximum number of threads used for communicating with the memcached server.
Default is <code>1</code>.
</dd>
<dt>cache-memcached-prefix:</dt>
<dd>
for the <code>memcached</code> store specifies the key prefix used to store the secrets on memcached.
Default is <code>h2o:ssl-session-cache:</code>.
</dd>
</dl>
<h4 id="ssl-session-resumption-ticket-based">Attributes for Ticket-based Resumption</h4>
<p>
Ticket-based session resumption uses master secret(s) to encrypt the keys used for encrypting the data transmitted over TLS connections.
To achieve <a href="https://en.wikipedia.org/wiki/Forward_secrecy" target="_blank">forward-secrecy</a> (i.e. protect past communications from being decrypted in case a master secret gets obtained by a third party), it is essential to periodically change the secret and remove the old ones.
</p>
<p>
Among the three types of stores supported for ticket-based session remusption, the <code>internal</code> store and <code>memcached</code> store implement automatic roll-over of the secrets.
A new master secret is created every 1/4 of the session lifetime (defined by the <code>lifetime</code> attribute), and they expire (and gets removed) after 5/4 of the session lifetime elapse.
</p>
<p>
For the <code>file</code> store, it is the responsibility of the web-site administrator to periodically update the secrets. H2O monitors the file and reloads the secrets when the file is altered.
</p>
<p>
Following attributes are recognized if the ticket-based resumption is enabled.
</p>
<dl>
<dt>ticket-store:</dt>
<dd>defines where the secrets for ticket-based resumption should be / is stored, must be one of: <code>internal</code>, <code>file</code>, <code>memcached</code>.
Default is <code>internal</code>.
<dt>ticket-cipher:</dt>
<dd>
for stores that implement automatic roll-over, specifies the cipher used for encrypting the tickets.
The value must be one recognizable by <code>EVP_get_cipherbyname</code>.
Default is <code>aes-256-cbc</code>.
<dt>ticket-hash:</dt>
<dd>
for stores that implement automatic roll-over, specifies the cipher used for digitally-signing the tickets.
The value must be one recognizable by <code>EVP_get_digestbyname</code>.
Default is <code>sha-256</code>.
</dd>
<dt>ticket-file:</dt>
<dd>for the <code>file</code> store specifies the file in which the secrets are stored</dd>
<dt>ticket-memcached-key:</dt>
<dd>
for the <code>memcached</code> store specifies the key used to store the secrets on memcached.
Default is <code>h2o:ssl-session-ticket</code>.
</dd>
</dl>
<h4 id="ssl-session-resumption-other">Other Attributes</h4>
<p>
Following attributes are common to cache-based and ticket-based session resumption.
</p>
<dl>
<dt>lifetime:</dt>
<dd>
defines the lifetime of a TLS session; when it expires the session cache entry is purged, and establishing a new connection will require a full TLS handshake.
Default value is <code>3600</code> (in seconds).
</dd>
<dt>memcached:</dt>
<dd>
specifies the location of memcached used by the <code>memcached</code> stores.
The value must be a mapping with <code>host</code> attribute specifying the address of the memcached server, and optionally a <code>port</code> attribute specifying the port number (default is <code>11211</code>).
</dd>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
<div id="user" class="directive-head">
<h3><a href="configure/base_directives.html#user"><code>"user"</code></a></h3>
</div>
<dl class="directive-desc">
<dt>Description:</dt>
<dd>
<p>
Username under which the server should handle incoming requests.
</p>
<p>
If the directive is omitted and if the server is started under root privileges, the server will attempt to <code>setuid</code> to <code>nobody</code>.
</p>
</dd>
<dt><a href="configure/syntax_and_structure.html#config_levels">Level</a>:</dt>
<dd>global</dd>
</dl>
</div>
<div id="footer">
<p>
Copyright © 2015 <a href="http://dena.com/intl/">DeNA Co., Ltd.</a> et al.
</p>
</div>
</body>
</html>
|
{
"content_hash": "14d3215d1c540225165121d780909f43",
"timestamp": "",
"source": "github",
"line_count": 668,
"max_line_length": 316,
"avg_line_length": 34.872754491017965,
"alnum_prop": 0.7166344709165057,
"repo_name": "ntabee/h2o-tile",
"id": "0c4dd1800f0637012a358aa94c2af369b3ec3a43",
"size": "23295",
"binary": false,
"copies": "1",
"ref": "refs/heads/tile",
"path": "doc/configure/base_directives.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1334210"
},
{
"name": "C++",
"bytes": "191971"
},
{
"name": "CMake",
"bytes": "24959"
},
{
"name": "HTML",
"bytes": "6006"
},
{
"name": "JavaScript",
"bytes": "16"
},
{
"name": "Lua",
"bytes": "186"
},
{
"name": "Makefile",
"bytes": "1340"
},
{
"name": "Mathematica",
"bytes": "99633"
},
{
"name": "Nginx",
"bytes": "1629"
},
{
"name": "Objective-C",
"bytes": "13"
},
{
"name": "PHP",
"bytes": "90"
},
{
"name": "Perl",
"bytes": "236784"
},
{
"name": "Ruby",
"bytes": "4637"
},
{
"name": "Shell",
"bytes": "54697"
}
]
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>float: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.8.0 / float - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
float
<small>
8.10.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-02 13:15:31 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-02 13:15:31 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.8.0 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/float"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Float"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: floating-point arithmetic"
"category: Computer Science/Data Types and Data Structures"
"date: 2001"
]
authors: [
"Laurent Théry"
"Sylvie Boldo"
]
bug-reports: "https://github.com/coq-contribs/float/issues"
dev-repo: "git+https://github.com/coq-contribs/float.git"
synopsis: "Library for floating-point numbers"
description: """
A library for floating-point numbers."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/float/archive/v8.10.0.tar.gz"
checksum: "md5=29d80b937683f8384fb505c9a6a396db"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-float.8.10.0 coq.8.8.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.8.0).
The following dependencies couldn't be met:
- coq-float -> coq >= 8.10 -> ocaml >= 4.09.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-float.8.10.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
{
"content_hash": "7276f77cfa22d8d7bd9d3f6a552c1c91",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 159,
"avg_line_length": 39.825581395348834,
"alnum_prop": 0.5366423357664234,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "16c18967cd704577234303e0d00b19f8e42359c2",
"size": "6876",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.06.1-2.0.5/released/8.8.0/float/8.10.0.html",
"mode": "33188",
"license": "mit",
"language": []
}
|
#include <GroupsockHelper.hh> // for "gettimeofday()"
#include <stdint.h>
#include <time.h>
#include <boost/thread.hpp>
#include <boost/interprocess/containers/deque.hpp>
#include <ctime>
#include <chrono>
#include <iomanip>
#include "config.h"
#include "RawPixelSource.hpp"
namespace bc = boost::chrono;
boost::mutex RawPixelSource::triggerEventMutex;
std::vector<RawPixelSource*> RawPixelSource::sourcesReadyForDelivery;
int RawPixelSource::x2yuv(AVFrame *xFrame, AVFrame *yuvFrame, AVCodecContext *c)
{
char *err = NULL;
if (img_convert_ctx == NULL)
{
// MUST BE IMPLMENTED
int w = xFrame->width;
int h = xFrame->width;
img_convert_ctx = sws_getContext(w, h, (AVPixelFormat)xFrame->format, w, h,
c->pix_fmt, SWS_BICUBIC,
NULL, NULL, NULL);
if (img_convert_ctx == NULL)
{
sprintf(err, "Cannot initialize the conversion context!\n");
return -1;
}
}
for (int i = 0; i < 4; i++)
{
if (xFrame->linesize[i] > 0)
{
xFrame->data[i] += xFrame->linesize[i] * (c->height - 1);
xFrame->linesize[i] = -xFrame->linesize[i];
}
}
return sws_scale(img_convert_ctx, xFrame->data,
xFrame->linesize, 0, c->height,
yuvFrame->data, yuvFrame->linesize);
}
RawPixelSource* RawPixelSource::createNew(UsageEnvironment& env,
Frame* content,
int avgBitRate)
{
return new RawPixelSource(env, content, avgBitRate);
}
unsigned RawPixelSource::referenceCount = 0;
struct timeval prevtime;
RawPixelSource::RawPixelSource(UsageEnvironment& env,
Frame* content,
int avgBitRate)
:
FramedSource(env), img_convert_ctx(NULL), content(content), /*encodeBarrier(2),*/ destructing(false), lastPTS(0)
{
gettimeofday(&prevtime, NULL); // If you have a more accurate time - e.g., from an encoder - then use that instead.
if (referenceCount == 0)
{
// Any global initialization of the device would be done here:
//%%% TO BE WRITTEN %%%
}
// Any instance-specific initialization of the device would be done here:
++referenceCount;
//myfile = fopen("/Users/tiborgoldschwendt/Desktop/Logs/deviceglxgears.log", "w");
// initialize frame pool
for (int i = 0; i < 1; i++)
{
AVFrame* frame = av_frame_alloc();
if (!frame)
{
fprintf(stderr, "Could not allocate video frame\n");
exit(1);
}
frame->format = content->getFormat();
frame->width = content->getWidth();
frame->height = content->getHeight();
/* the image can be allocated by any means and av_image_alloc() is
* just the most convenient way if av_malloc() is to be used */
if (av_image_alloc(frame->data, frame->linesize, frame->width, frame->height,
content->getFormat(), 32) < 0)
{
fprintf(stderr, "Could not allocate raw picture buffer\n");
abort();
}
framePool.push(frame);
}
for (int i = 0; i < 1; i++)
{
AVPacket pkt;
av_init_packet(&pkt);
pktPool.push(pkt);
}
// Initialize codec and encoder
AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_H264);
if (!codec)
{
fprintf(stderr, "Codec not found\n");
exit(1);
}
codecContext = avcodec_alloc_context3(codec);
if (!codecContext)
{
fprintf(stderr, "could not allocate video codec context\n");
exit(1);
}
/* put sample parameters */
codecContext->bit_rate = avgBitRate;
/* resolution must be a multiple of two */
codecContext->width = content->getWidth();
codecContext->height = content->getHeight();
/* frames per second */
codecContext->time_base = av_make_q(1, FPS);
codecContext->gop_size = 20; /* emit one intra frame every ten frames */
codecContext->max_b_frames = 0;
codecContext->pix_fmt = AV_PIX_FMT_YUV420P;
//codecContext->flags |= CODEC_FLAG_GLOBAL_HEADER;
av_opt_set(codecContext->priv_data, "preset", PRESET_VAL, 0);
av_opt_set(codecContext->priv_data, "tune", TUNE_VAL, 0);
av_opt_set(codecContext->priv_data, "slice-max-size", "20000", 0);
/* open it */
if (avcodec_open2(codecContext, codec, NULL) < 0)
{
fprintf(stderr, "could not open codec\n");
exit(1);
}
// We arrange here for our "deliverFrame" member function to be called
// whenever the next frame of data becomes available from the device.
//
// If the device can be accessed as a readable socket, then one easy way to do this is using a call to
// envir().taskScheduler().turnOnBackgroundReadHandling( ... )
// (See examples of this call in the "liveMedia" directory.)
//
// If, however, the device *cannot* be accessed as a readable socket, then instead we can implement it using 'event triggers':
// Create an 'event trigger' for this device (if it hasn't already been done):
eventTriggerId = envir().taskScheduler().createEventTrigger(&deliverFrame0);
//std::cout << this << ": eventTriggerId: " << eventTriggerId << std::endl;
frameContentThread = boost::thread(boost::bind(&RawPixelSource::frameContentLoop, this));
encodeFrameThread = boost::thread(boost::bind(&RawPixelSource::encodeFrameLoop, this));
//eventThread = boost::thread(boost::bind(&RawPixelSource::eventLoop, this));
lastFrameTime = av_gettime();
}
RawPixelSource::~RawPixelSource()
{
// Any instance-specific 'destruction' (i.e., resetting) of the device would be done here:
//std::cout << this << ": deconstructing..." << std::endl;
this->destructing = true;
frameBuffer.close();
pktBuffer.close();
framePool.close();
pktPool.close();
frameContentThread.join();
encodeFrameThread.join();
--referenceCount;
if (referenceCount == 0)
{
// Any global 'destruction' (i.e., resetting) of the device would be done here:
}
// Reclaim our 'event trigger'
envir().taskScheduler().deleteEventTrigger(eventTriggerId);
eventTriggerId = 0;
//fclose(myfile);
//std::cout << this << ": deconstructed" << std::endl;
}
void RawPixelSource::setOnSentNALU(const OnSentNALU& callback)
{
onSentNALU = callback;
}
void RawPixelSource::setOnEncodedFrame(const OnEncodedFrame& callback)
{
onEncodedFrame = callback;
}
void RawPixelSource::frameContentLoop()
{
while (!destructing)
{
AVFrame* frame;
if (!framePool.wait_and_pop(frame))
{
return;
}
// End this thread when CubemapExtractionPlugin closes
while (!content->getBarrier().timedWait(boost::chrono::milliseconds(100)))
{
if (destructing)
{
return;
}
}
//content->getBarrier().wait();
AVRational microSecBase = { 1, 1000000 };
bc::microseconds presentationTimeSinceEpochMicroSec;
int_least64_t x;
{
boost::interprocess::scoped_lock<boost::interprocess::interprocess_mutex> lock(content->getMutex());
// Fill frame
avpicture_fill((AVPicture*)frame,
(uint8_t*)content->getPixels(),
content->getFormat(),
content->getWidth(),
content->getHeight());
// Set the actual presentation time
// It is in the past probably but we will try our best
presentationTimeSinceEpochMicroSec =
bc::duration_cast<bc::microseconds>(content->getPresentationTime().time_since_epoch());
x = content->getPresentationTime().time_since_epoch().count();
}
// const time_t time = bc::system_clock::to_time_t(face->getPresentationTime());
//
// // Maybe the put_time will be implemented later?
// struct tm* tm = localtime(&time);
// char timeStr[128];
// strftime (timeStr, sizeof(timeStr), "%c",tm);
//std::cout << this << " presentation time: " << timeStr << std::endl;
//std::cout << this << " frame" << std::endl;
frame->pts = presentationTimeSinceEpochMicroSec.count();// av_rescale_q(presentationTimeSinceEpochMicroSec.count(), microSecBase, codecContext->time_base);
if (x == lastPTS)
{
std::cout << "match!?" << std::endl;
}
lastPTS = frame->pts;
//std::cout << presentationTimeSinceEpochMicroSec.count() << " " << x << " " << frame->pts << std::endl;
// Make frame available to the encoder
frameBuffer.push(frame);
}
}
void RawPixelSource::doGetNextFrame()
{
// This function is called (by our 'downstream' object) when it asks for new data.
// Note: If, for some reason, the source device stops being readable (e.g., it gets closed), then you do the following:
if (0 /* the source stops being readable */ /*%%% TO BE WRITTEN %%%*/)
{
handleClosure(this);
return;
}
// If a new frame of data is immediately available to be delivered, then do this now:
if (!pktBuffer.empty())
{
deliverFrame();
}
// No new data is immediately available to be delivered. We don't do anything more here.
// Instead, our event trigger must be called (e.g., from a separate thread) when new data becomes available.
}
void RawPixelSource::deliverFrame0(void* clientData)
{
boost::mutex::scoped_lock lock(triggerEventMutex);
for (RawPixelSource* source : sourcesReadyForDelivery)
{
source->deliverFrame();
}
sourcesReadyForDelivery.clear();
//std::cout << "deliver frame: " << ((CubemapFaceSource*)clientData)->face->index << std::endl;
}
void RawPixelSource::encodeFrameLoop()
{
while (!this->destructing)
{
AVPacket pkt;
int64_t pts;
{
// Pop frame ptr from buffer
AVFrame* xFrame;
AVFrame* yuv420pFrame;
if (!frameBuffer.wait_and_pop(xFrame))
{
// queue did close
return;
}
pts = xFrame->pts;
//std::cout << this << " encode" << std::endl;
if (xFrame->format != AV_PIX_FMT_YUV420P)
{
yuv420pFrame = av_frame_alloc();
if (!yuv420pFrame)
{
fprintf(stderr, "Could not allocate video frame\n");
return;
}
yuv420pFrame->format = AV_PIX_FMT_YUV420P;
yuv420pFrame->width = xFrame->width;
yuv420pFrame->height = xFrame->height;
/* the image can be allocated by any means and av_image_alloc() is
* just the most convenient way if av_malloc() is to be used */
if (av_image_alloc(yuv420pFrame->data, yuv420pFrame->linesize, yuv420pFrame->width, yuv420pFrame->height,
AV_PIX_FMT_YUV420P, 32) < 0)
{
fprintf(stderr, "Could not allocate raw picture buffer\n");
abort();
}
x2yuv(xFrame, yuv420pFrame, codecContext);
}
else
{
yuv420pFrame = xFrame;
}
av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
int got_output = 0;
//mutex.lock();
int ret = avcodec_encode_video2(codecContext, &pkt, yuv420pFrame, &got_output);
if (ret < 0)
{
fprintf(stderr, "Error encoding frame\n");
abort();
}
if (onEncodedFrame) onEncodedFrame(this);
framePool.push(xFrame);
if (xFrame->format != AV_PIX_FMT_YUV420P)
{
av_freep(&yuv420pFrame->data[0]);
av_frame_free(&yuv420pFrame);
}
}
{
// pair.first: pos if first byte of NALU; pair.second: pos of last byte of NALU
std::queue<std::pair<size_t, size_t> > naluPoses;
// Parse package for all NALUs
size_t naluStartPos = 0;
for (size_t i = 0; i < pkt.size - 3; i++)
{
if (pkt.data[i] == 0 &&
pkt.data[i + 1] == 0)
{
if (pkt.data[i + 2] == 0 &&
pkt.data[i + 3] == 1)
{
if (i != 0)
{
naluPoses.push(std::make_pair(naluStartPos, i - 1));
}
naluStartPos = i + 4;
i += 3;
}
else if (pkt.data[i + 2] == 1)
{
if (i != 0)
{
naluPoses.push(std::make_pair(naluStartPos, i - 1));
}
naluStartPos = i + 3;
i += 2;
}
}
}
naluPoses.push(std::make_pair(naluStartPos, pkt.size - 1));
size_t naluCount = naluPoses.size();
AVPacket dummy;
if (!pktPool.wait_and_pop(dummy))
{
// queue did close
return;
}
for (size_t i = 0; i < naluCount; i++)
{
std::pair<size_t, size_t> naluPos = naluPoses.front();
naluPoses.pop();
AVPacket naluPkt;
av_new_packet(&naluPkt, naluPos.second - naluPos.first + 1);
memcpy(naluPkt.data, pkt.data + naluPos.first, naluPkt.size);
naluPkt.pts = pts;
pktBuffer.push(naluPkt);
{
boost::mutex::scoped_lock lock(triggerEventMutex);
sourcesReadyForDelivery.push_back(this);
envir().taskScheduler().triggerEvent(eventTriggerId, nullptr);
}
}
av_free_packet(&pkt);
}
}
}
void RawPixelSource::deliverFrame()
{
// This function is called when new frame data is available from the device.
// We deliver this data by copying it to the 'downstream' object, using the following parameters (class members):
// 'in' parameters (these should *not* be modified by this function):
// fTo: The frame data is copied to this address.
// (Note that the variable "fTo" is *not* modified. Instead,
// the frame data is copied to the address pointed to by "fTo".)
// fMaxSize: This is the maximum number of bytes that can be copied
// (If the actual frame is larger than this, then it should
// be truncated, and "fNumTruncatedBytes" set accordingly.)
// 'out' parameters (these are modified by this function):
// fFrameSize: Should be set to the delivered frame size (<= fMaxSize).
// fNumTruncatedBytes: Should be set iff the delivered frame would have been
// bigger than "fMaxSize", in which case it's set to the number of bytes
// that have been omitted.
// fPresentationTime: Should be set to the frame's presentation time
// (seconds, microseconds). This time must be aligned with 'wall-clock time' - i.e., the time that you would get
// by calling "gettimeofday()".
// fDurationInMicroseconds: Should be set to the frame's duration, if known.
// If, however, the device is a 'live source' (e.g., encoded from a camera or microphone), then we probably don't need
// to set this variable, because - in this case - data will never arrive 'early'.
// Note the code below.
//std::cout << "available size: " << fMaxSize << std::endl;
if (!isCurrentlyAwaitingData())
{
//std::cout << this << ": deliver skipped" << std::endl;
return; // we're not ready for the data yet
}
int64_t thisTime = av_gettime();
//fprintf(myfile, "fMaxSize at beginning of function: %i \n", fMaxSize);
//fflush(myfile);
// set the duration of this frame since we have variable frame rate
// %% Time has to be fixed
//this->fDurationInMicroseconds = 1000000 / 70;// thisTime - lastFrameTime;
//gettimeofday(&fPresentationTime, NULL); // If you have a more accurate time - e.g., from an encoder - then use that instead.
//std::cout << this << ": pktBuffer size: " << pktBuffer.size() << std::endl;
AVPacket pkt;
if (!pktBuffer.wait_and_pop(pkt))
{
// queue did close
return;
}
if (pktBuffer.size() == 0)
{
AVPacket dummy;
pktPool.push(dummy);
}
//std::cout << this << " send" << std::endl;
// Set the presentation time of this frame
AVRational secBase = { 1, 1 };
AVRational microSecBase = { 1, 1000000 };
fPresentationTime.tv_sec = pkt.pts / 1000000; //av_rescale_q(pkt.pts, codecContext->time_base, secBase);
fPresentationTime.tv_usec = pkt.pts % 1000000; // av_rescale_q(pkt.pts, codecContext->time_base, microSecBase) -
//std::cout << fPresentationTime.tv_sec << " " << fPresentationTime.tv_usec << std::endl;
// Live555 does not like start codes.
// So, we remove the start code which is there in front of every nal unit.
// the start code might be 0x00000001 or 0x000001. so detect it and remove it.
int truncateBytes = 0;
if (pkt.size >= 4 &&
pkt.data[0] == 0 &&
pkt.data[1] == 0 &&
pkt.data[2] == 0 &&
pkt.data[3] == 1)
{
truncateBytes = 4;
}
else if (pkt.size >= 3 &&
pkt.data[0] == 0 &&
pkt.data[1] == 0 &&
pkt.data[2] == 1)
{
truncateBytes = 3;
}
u_int8_t* newFrameDataStart = (u_int8_t*)(pkt.data /*+ truncateBytes*/);
unsigned newFrameSize = pkt.size/* - truncateBytes*/;
if ((int)(pkt.data[0] & 0x1F) == 5)
{
//std::cout << newFrameSize << std::endl;
}
u_int8_t nal_unit_type = newFrameDataStart[0] & 0x1F;
//std::cout << "sent NALU type " << (int)nal_unit_type << " (" << newFrameSize << ")" << std::endl;
//if (nal_unit_type == 8) // PPS
//{
// envir() << "PPS seen\n";
//}
//else if (nal_unit_type == 7) // SPS
//{
// envir() << "SPS seen; siz\n";
//}
//else
//{
// //envir() << nal_unit_type << " seen; size: " << frameSize << "\n";
//}
// Deliver the data here:
if (newFrameSize > fMaxSize)
{
fFrameSize = fMaxSize;
fNumTruncatedBytes = newFrameSize - fMaxSize;
//fprintf(myfile, "frameSize %i larger than maxSize %i\n", pkt.size, fMaxSize);
//fflush(myfile);
}
else
{
fFrameSize = newFrameSize;
/*rest =*/ fNumTruncatedBytes = 0;
//
}
memmove(fTo, newFrameDataStart, fFrameSize);
av_free_packet(&pkt);
//pktPool.push(pkt);
if (fNumTruncatedBytes > 0)
{
std::cout << this << ": truncated " << fNumTruncatedBytes << " bytes" << std::endl;
}
//std::cout << fFrameSize << std::endl;
// Tell live555 that a new frame is available
FramedSource::afterGetting(this);
//std::cout << pkt.pts << std::endl;
if (onSentNALU) onSentNALU(this, nal_unit_type, fFrameSize);
//std::cout << "sent frame" << std::endl;
lastFrameTime = thisTime;
//std::cout << this << ": delivered" << std::endl;
//boost::this_thread::sleep_for(boost::chrono::microseconds((size_t)(1 * fFrameSize)));
}
|
{
"content_hash": "388170b5b5c935ec0adcee92ed0cded9",
"timestamp": "",
"source": "github",
"line_count": 630,
"max_line_length": 157,
"avg_line_length": 27.306349206349207,
"alnum_prop": 0.6452362959948846,
"repo_name": "YunSuk/AlloUnity",
"id": "b957cddaf61afd96d45011cbcef729de9f771c4f",
"size": "17203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AlloServer/RawPixelSource.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "53975"
},
{
"name": "C#",
"bytes": "70498"
},
{
"name": "C++",
"bytes": "2731032"
},
{
"name": "CMake",
"bytes": "54804"
},
{
"name": "CoffeeScript",
"bytes": "7622"
},
{
"name": "Java",
"bytes": "30556"
},
{
"name": "Makefile",
"bytes": "8944480"
},
{
"name": "Python",
"bytes": "735"
},
{
"name": "Shell",
"bytes": "3366"
}
]
}
|
import unittest
from iobeam.endpoints import tokens
from tests.http import dummy_backend
from tests.http import request
_OLD_TOKEN = dummy_backend.TOKEN
_NEW_TOKEN = dummy_backend.NEW_TOKEN
TokenService = tokens.TokenService
DummyBackend = dummy_backend.DummyBackend
class TestDeviceService(unittest.TestCase):
def test_createService(self):
dummy = DummyBackend()
service = TokenService(requester=request.DummyRequester(dummy))
self.assertEqual(None, service.token)
self.assertTrue(service.requester() is not None)
self.assertTrue(isinstance(service.requester(), request.DummyRequester))
def test_getProjectToken(self):
dummy = DummyBackend()
service = TokenService(requester=request.DummyRequester(dummy))
opts = {"device_id": "python-test", "refreshable": False}
ret = service.getProjectToken("token", 1, duration="1d", options=opts)
self.assertTrue(ret is not None)
for o in opts:
self.assertEqual(opts[o], ret[o])
self.assertEqual("1d", ret["duration"])
self.assertEqual(1, dummy.calls)
def test_getProjectTokenWrong(self):
def check(duration, opts):
try:
ret = service.getProjectToken("token", 1, duration=duration,
options=opts)
self.assertTrue(False)
except ValueError:
pass
dummy = DummyBackend()
service = TokenService(requester=request.DummyRequester(dummy))
check("5q", None) # not a valid unit
check("aw", None) # not a valid number
check(None, "not a dict")
def test_refreshToken(self):
dummy = DummyBackend()
service = TokenService(requester=request.DummyRequester(dummy))
ret = service.refreshToken(_OLD_TOKEN)
self.assertTrue(ret is not None)
self.assertEqual(_NEW_TOKEN, ret)
self.assertEqual(1, dummy.calls)
def test_refreshTokenWrong(self):
dummy = DummyBackend()
service = TokenService(requester=request.DummyRequester(dummy))
try:
ret = service.refreshToken(_OLD_TOKEN[:2])
except request.UnknownCodeError:
self.assertEqual(1, dummy.calls)
|
{
"content_hash": "29640f029879b09d050566f973402cfa",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 80,
"avg_line_length": 34.707692307692305,
"alnum_prop": 0.6493794326241135,
"repo_name": "iobeam/iobeam-client-python",
"id": "ec9060e5755d57a112aed6d552c1aac39c9189a9",
"size": "2256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/endpoints/test_tokens.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "132044"
}
]
}
|
//initialize all of our variables
var app, base, concat, directory, gulp, gutil, hostname, path, refresh, sass, uglify, imagemin, minifyCSS, del, browserSync, autoprefixer, gulpSequence, shell, sourceMaps, plumber;
var autoPrefixBrowserList = ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'];
//load all of our dependencies
//add more here if you want to include more libraries
gulp = require('gulp');
gutil = require('gulp-util');
concat = require('gulp-concat');
uglify = require('gulp-uglify');
sass = require('gulp-sass');
sourceMaps = require('gulp-sourcemaps');
imagemin = require('gulp-imagemin');
minifyCSS = require('gulp-minify-css');
browserSync = require('browser-sync');
autoprefixer = require('gulp-autoprefixer');
gulpSequence = require('gulp-sequence').use(gulp);
shell = require('gulp-shell');
plumber = require('gulp-plumber');
gulp.task('browserSync', function() {
browserSync({
server: {
baseDir: "app/"
},
options: {
reloadDelay: 250
},
notify: false
});
});
//compressing images & handle SVG files
gulp.task('images', function(tmp) {
gulp.src(['app/images/*.jpg', 'app/images/*.png'])
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true }))
.pipe(gulp.dest('app/images'));
});
//compressing images & handle SVG files
gulp.task('images-deploy', function() {
gulp.src(['app/images/**/*', '!app/images/README'])
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(gulp.dest('dist/images'));
});
//compiling our Javascripts
gulp.task('scripts', function() {
//this is where our dev JS scripts are
return gulp.src(['app/scripts/src/_includes/**/*.js', 'app/scripts/src/**/*.js'])
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
//this is the filename of the compressed version of our JS
.pipe(concat('app.js'))
//catch errors
.on('error', gutil.log)
//where we will store our finalized, compressed script
.pipe(gulp.dest('app/scripts'))
//notify browserSync to refresh
.pipe(browserSync.reload({stream: true}));
});
//compiling our Javascripts for deployment
gulp.task('scripts-deploy', function() {
//this is where our dev JS scripts are
return gulp.src(['app/scripts/src/_includes/**/*.js', 'app/scripts/src/**/*.js'])
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
//this is the filename of the compressed version of our JS
.pipe(concat('app.js'))
//compress :D
.pipe(uglify())
//where we will store our finalized, compressed script
.pipe(gulp.dest('dist/scripts'));
});
//compiling our SASS files
gulp.task('styles', function() {
//the initializer / master SASS file, which will just be a file that imports everything
return gulp.src('app/styles/sass/init.sass')
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber({
errorHandler: function (err) {
console.log(err);
this.emit('end');
}
}))
//get sourceMaps ready
.pipe(sourceMaps.init())
//include SASS and list every "include" folder
.pipe(sass({
errLogToConsole: true,
includePaths: [
'app/styles/sass/'
]
}))
.pipe(autoprefixer({
browsers: autoPrefixBrowserList,
cascade: true
}))
//catch errors
.on('error', gutil.log)
//the final filename of our combined css file
.pipe(concat('styles.css'))
//get our sources via sourceMaps
.pipe(sourceMaps.write())
//where to save our final, compressed css file
.pipe(gulp.dest('app/styles'))
//notify browserSync to refresh
.pipe(browserSync.reload({stream: true}));
});
//compiling our SASS files for deployment
gulp.task('styles-deploy', function() {
//the initializer / master SASS file, which will just be a file that imports everything
return gulp.src('app/styles/sass/init.sass')
.pipe(plumber())
//include SASS includes folder
.pipe(sass({
includePaths: [
'app/styles/sass',
]
}))
.pipe(autoprefixer({
browsers: autoPrefixBrowserList,
cascade: true
}))
//the final filename of our combined css file
.pipe(concat('styles.css'))
.pipe(minifyCSS())
//where to save our final, compressed css file
.pipe(gulp.dest('dist/styles'));
});
//basically just keeping an eye on all HTML files
gulp.task('html', function() {
//watch any and all HTML files and refresh when something changes
return gulp.src('app/*.html')
.pipe(plumber())
.pipe(browserSync.reload({stream: true}))
//catch errors
.on('error', gutil.log);
});
//migrating over all HTML files for deployment
gulp.task('html-deploy', function() {
//grab everything, which should include htaccess, robots, etc
gulp.src('app/*')
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(gulp.dest('dist'));
//grab any hidden files too
gulp.src('app/.*')
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(gulp.dest('dist'));
gulp.src('app/fonts/**/*')
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(gulp.dest('dist/fonts'));
//grab all of the styles
gulp.src(['app/styles/*.css', '!app/styles/styles.css'])
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(gulp.dest('dist/styles'));
});
//cleans our dist directory in case things got deleted
gulp.task('clean', function() {
return shell.task([
'rm -rf dist'
]);
});
//create folders using shell
gulp.task('scaffold', function() {
return shell.task([
'mkdir dist',
'mkdir dist/fonts',
'mkdir dist/images',
'mkdir dist/scripts',
'mkdir dist/styles'
]
);
});
//this is our master task when you run `gulp` in CLI / Terminal
//this is the main watcher to use when in active development
// this will:
// startup the web server,
// start up browserSync
// compress all scripts and SASS files
gulp.task('default', ['browserSync', 'scripts', 'styles'], function() {
//a list of watchers, so it will watch all of the following files waiting for changes
gulp.watch('app/scripts/src/**', ['scripts']);
gulp.watch('app/styles/sass/**', ['styles']);
gulp.watch('app/images/**', ['images']);
gulp.watch('app/*.html', ['html']);
});
//this is our deployment task, it will set everything for deployment-ready files
gulp.task('deploy', gulpSequence('clean', 'scaffold', ['scripts-deploy', 'styles-deploy', 'images-deploy'], 'html-deploy'));
|
{
"content_hash": "c2292a993b5216dd00afb5a140c0f986",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 180,
"avg_line_length": 37.01904761904762,
"alnum_prop": 0.5715204527913558,
"repo_name": "maxigor/todolist.js",
"id": "907dedb0152eb1a91e1fa657eb619cdb72fc0318",
"size": "7774",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gulpfile.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "78028"
},
{
"name": "CSS",
"bytes": "260207"
},
{
"name": "HTML",
"bytes": "2820"
},
{
"name": "JavaScript",
"bytes": "80692"
}
]
}
|
namespace Oldmansoft.Html.WebMan.FormInputCreator.Handlers
{
class MultilineTextHandler : Handler
{
protected override bool Request(HandlerParameter input, ref Input.IFormInput result)
{
if (input.PropertyContent.DataType == System.ComponentModel.DataAnnotations.DataType.MultilineText)
{
result = new Inputs.Textarea();
input.SetInputProperty(result);
result.Init(input.PropertyContent, input.Name, input.Value, null);
return true;
}
return false;
}
}
}
|
{
"content_hash": "749d5429b9bd5109ca5a35a1c8307dda",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 111,
"avg_line_length": 35.529411764705884,
"alnum_prop": 0.609271523178808,
"repo_name": "Oldmansoft/WebMan",
"id": "e1e14d051ee0b9785f769d006d90e880896114e2",
"size": "606",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Oldmansoft.Html.WebMan/FormInputCreator/Handlers/MultilineTextHandler.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP.NET",
"bytes": "105"
},
{
"name": "C#",
"bytes": "588911"
},
{
"name": "CSS",
"bytes": "17721"
},
{
"name": "HTML",
"bytes": "5573"
},
{
"name": "JavaScript",
"bytes": "282902"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 6