text
stringlengths 2
100k
| meta
dict |
---|---|
Counter-Strike: Global Offensive
==============
Please use this repository to report bugs for CS:GO.
The language used for this tracker is English. If this is a challenge, please consider using an online translator to convert your post into English. This does not extend to system information, but rather, only to actual report text.
Conduct
-------
There are basic rules of conduct that should be followed at all times by everyone participating in the discussions. While this is generally a relaxed environment, please remember the following:
- Do not insult, harass, or demean anyone.
- Do not intentionally multi-post an issue.
- Do not use ALL CAPS when creating an issue report.
- Do not repeatedly update an open issue remarking that the issue persists.
Remember: Just because the issue you reported was reported here does not mean that it is an issue with CS:GO. As well, should your issue not be resolved immediately, it does not mean that a resolution is not being researched or tested. Patience is always appreciated.
Reporting Issues
----------------
If you encounter a bug while using CS:GO, first search the [issue list](https://github.com/ValveSoftware/Counter-Strike-Global-Offensive/issues) to see if it has already been reported. Include closed issues in your search. If your issue has been reported, please upvote the issue by clicking the "Add Reaction" button (smiley face with a plus sign) on the root post and adding a thumbs up. Voting helps us determine which issues are important to users without cluttering the bug database. Duplicate issue reports may be closed without comment.
Note: Comments do not count as votes.
If it has not been reported, create a new issue with at least the following information:
- a short, descriptive title;
- a detailed description of the issue, including any output from the command line in a [gist](https://gist.github.com);
- steps for reproducing the issue; and
- your [system information](#system-information).
Please place logs in a [gist](https://gist.github.com), and link to them from your report.
When possible, please include a differential between a working configuration and the reported issue.
If a crash is involved, please include any CrashIDs or minidumps related to the issue in an archive. Archives can be drag and dropped into the text box of github.
For tracking purposes, there should be one issue per issue report.
### System information
System information can be gathered from within steam (`Help -> System Information`).
Once your information appears: right-click within the dialog, choose `Select All`, right-click again, and then choose `Copy`.
Paste this information into a [gist](https://gist.github.com/) and include a link to it from your bug report.
Feature Requests
-------------------
This repository is not meant for CS:GO feature requests. There are forums dedicated to general CS:GO discussion at http://forums.steampowered.com/forums/forumdisplay.php?f=1188.
Linux Specific
==============
Driver Contact Information
--------------------------
Some of the issue you may be experiencing are due to the various video drivers. Here is an incomplete list of places that you might be able to file bugs or get additional help:
### AMD
AMD Steam Linux forum for reporting **compatibility and performance issues with AMD hardware**:
https://community.amd.com/community/devgurus/steam-linux
The AMD Open Source driver is a part of Mesa, so use the links under "Intel" to report issues with it.
### Intel
For discussions, there is the mesa-users email list:
http://mesa3d.org/lists.html
Bugs and feature requests should be logged in bugzilla:
http://mesa3d.org/bugs.html
### NVIDIA
NVIDIA supported drivers
- https://devtalk.nvidia.com/default/board/98
Open Source NVIDIA driver (nouveau)
- http://nouveau.freedesktop.org/wiki
If you know of any other places, please let us know.
| {
"pile_set_name": "Github"
} |
<ul class="nav nav-tabs nav-justified nav-profile">
<?php
foreach ($tabs as $tab) {
if($tab['active'] ){
$classname = 'active';
}elseif($tab['inactive']){
$classname = 'inactive'; //tab will be shown but disabled for click
}else{
$classname = '';
}
?>
<li class="<?php echo $classname; ?>">
<a <?php echo ($tab['href'] ? 'href="' . $tab['href'] . '" ' : ''); ?>><strong><?php echo $tab['text']; ?></strong></a>
</li>
<?php } ?>
</ul> | {
"pile_set_name": "Github"
} |
// The Great Computer Language Shootout
// http://shootout.alioth.debian.org
//
// Contributed by Ian Osgood
var last = 42, A = 3877, C = 29573, M = 139968;
function rand(max) {
last = (last * A + C) % M;
return max * last / M;
}
var ALU =
"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" +
"GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" +
"CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" +
"ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" +
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
var IUB = {
a:0.27, c:0.12, g:0.12, t:0.27,
B:0.02, D:0.02, H:0.02, K:0.02,
M:0.02, N:0.02, R:0.02, S:0.02,
V:0.02, W:0.02, Y:0.02
}
var HomoSap = {
a: 0.3029549426680,
c: 0.1979883004921,
g: 0.1975473066391,
t: 0.3015094502008
}
function makeCumulative(table) {
var last = null;
/* BEGIN LOOP */
for (var c in table) {
if (last) table[c] += table[last];
last = c;
}
/* END LOOP */
}
function fastaRepeat(n, seq) {
var seqi = 0, lenOut = 60;
/* BEGIN LOOP */
while (n>0) {
if (n<lenOut) lenOut = n;
if (seqi + lenOut < seq.length) {
ret = seq.substring(seqi, seqi+lenOut);
seqi += lenOut;
} else {
var s = seq.substring(seqi);
seqi = lenOut - s.length;
ret = s + seq.substring(0, seqi);
}
n -= lenOut;
}
/* END LOOP */
}
function fastaRandom(n, table) {
var line = new Array(60);
makeCumulative(table);
/* BEGIN LOOP */
while (n>0) {
if (n<line.length) line = new Array(n);
/* BEGIN LOOP */
for (var i=0; i<line.length; i++) {
var r = rand(1);
/* BEGIN LOOP */
for (var c in table) {
if (r < table[c]) {
line[i] = c;
break;
}
}
/* END LOOP */
}
/* END LOOP */
ret = line.join('');
n -= line.length;
}
/* END LOOP */
}
var ret;
var count = 7;
ret = fastaRepeat(2*count*100000, ALU);
ret = fastaRandom(3*count*1000, IUB);
ret = fastaRandom(5*count*1000, HomoSap);
| {
"pile_set_name": "Github"
} |
#import <Foundation/Foundation.h>
@interface PodsDummy_Quick_tvOS : NSObject
@end
@implementation PodsDummy_Quick_tvOS
@end
| {
"pile_set_name": "Github"
} |
/*
Package analysis defines the interface between a modular static
analysis and an analysis driver program.
Background
A static analysis is a function that inspects a package of Go code and
reports a set of diagnostics (typically mistakes in the code), and
perhaps produces other results as well, such as suggested refactorings
or other facts. An analysis that reports mistakes is informally called a
"checker". For example, the printf checker reports mistakes in
fmt.Printf format strings.
A "modular" analysis is one that inspects one package at a time but can
save information from a lower-level package and use it when inspecting a
higher-level package, analogous to separate compilation in a toolchain.
The printf checker is modular: when it discovers that a function such as
log.Fatalf delegates to fmt.Printf, it records this fact, and checks
calls to that function too, including calls made from another package.
By implementing a common interface, checkers from a variety of sources
can be easily selected, incorporated, and reused in a wide range of
driver programs including command-line tools (such as vet), text editors and
IDEs, build and test systems (such as go build, Bazel, or Buck), test
frameworks, code review tools, code-base indexers (such as SourceGraph),
documentation viewers (such as godoc), batch pipelines for large code
bases, and so on.
Analyzer
The primary type in the API is Analyzer. An Analyzer statically
describes an analysis function: its name, documentation, flags,
relationship to other analyzers, and of course, its logic.
To define an analysis, a user declares a (logically constant) variable
of type Analyzer. Here is a typical example from one of the analyzers in
the go/analysis/passes/ subdirectory:
package unusedresult
var Analyzer = &analysis.Analyzer{
Name: "unusedresult",
Doc: "check for unused results of calls to some functions",
Run: run,
...
}
func run(pass *analysis.Pass) (interface{}, error) {
...
}
An analysis driver is a program such as vet that runs a set of
analyses and prints the diagnostics that they report.
The driver program must import the list of Analyzers it needs.
Typically each Analyzer resides in a separate package.
To add a new Analyzer to an existing driver, add another item to the list:
import ( "unusedresult"; "nilness"; "printf" )
var analyses = []*analysis.Analyzer{
unusedresult.Analyzer,
nilness.Analyzer,
printf.Analyzer,
}
A driver may use the name, flags, and documentation to provide on-line
help that describes the analyses it performs.
The doc comment contains a brief one-line summary,
optionally followed by paragraphs of explanation.
The Analyzer type has more fields besides those shown above:
type Analyzer struct {
Name string
Doc string
Flags flag.FlagSet
Run func(*Pass) (interface{}, error)
RunDespiteErrors bool
ResultType reflect.Type
Requires []*Analyzer
FactTypes []Fact
}
The Flags field declares a set of named (global) flag variables that
control analysis behavior. Unlike vet, analysis flags are not declared
directly in the command line FlagSet; it is up to the driver to set the
flag variables. A driver for a single analysis, a, might expose its flag
f directly on the command line as -f, whereas a driver for multiple
analyses might prefix the flag name by the analysis name (-a.f) to avoid
ambiguity. An IDE might expose the flags through a graphical interface,
and a batch pipeline might configure them from a config file.
See the "findcall" analyzer for an example of flags in action.
The RunDespiteErrors flag indicates whether the analysis is equipped to
handle ill-typed code. If not, the driver will skip the analysis if
there were parse or type errors.
The optional ResultType field specifies the type of the result value
computed by this analysis and made available to other analyses.
The Requires field specifies a list of analyses upon which
this one depends and whose results it may access, and it constrains the
order in which a driver may run analyses.
The FactTypes field is discussed in the section on Modularity.
The analysis package provides a Validate function to perform basic
sanity checks on an Analyzer, such as that its Requires graph is
acyclic, its fact and result types are unique, and so on.
Finally, the Run field contains a function to be called by the driver to
execute the analysis on a single package. The driver passes it an
instance of the Pass type.
Pass
A Pass describes a single unit of work: the application of a particular
Analyzer to a particular package of Go code.
The Pass provides information to the Analyzer's Run function about the
package being analyzed, and provides operations to the Run function for
reporting diagnostics and other information back to the driver.
type Pass struct {
Fset *token.FileSet
Files []*ast.File
OtherFiles []string
Pkg *types.Package
TypesInfo *types.Info
ResultOf map[*Analyzer]interface{}
Report func(Diagnostic)
...
}
The Fset, Files, Pkg, and TypesInfo fields provide the syntax trees,
type information, and source positions for a single package of Go code.
The OtherFiles field provides the names, but not the contents, of non-Go
files such as assembly that are part of this package. See the "asmdecl"
or "buildtags" analyzers for examples of loading non-Go files and reporting
diagnostics against them.
The ResultOf field provides the results computed by the analyzers
required by this one, as expressed in its Analyzer.Requires field. The
driver runs the required analyzers first and makes their results
available in this map. Each Analyzer must return a value of the type
described in its Analyzer.ResultType field.
For example, the "ctrlflow" analyzer returns a *ctrlflow.CFGs, which
provides a control-flow graph for each function in the package (see
golang.org/x/tools/go/cfg); the "inspect" analyzer returns a value that
enables other Analyzers to traverse the syntax trees of the package more
efficiently; and the "buildssa" analyzer constructs an SSA-form
intermediate representation.
Each of these Analyzers extends the capabilities of later Analyzers
without adding a dependency to the core API, so an analysis tool pays
only for the extensions it needs.
The Report function emits a diagnostic, a message associated with a
source position. For most analyses, diagnostics are their primary
result.
For convenience, Pass provides a helper method, Reportf, to report a new
diagnostic by formatting a string.
Diagnostic is defined as:
type Diagnostic struct {
Pos token.Pos
Category string // optional
Message string
}
The optional Category field is a short identifier that classifies the
kind of message when an analysis produces several kinds of diagnostic.
Many analyses want to associate diagnostics with a severity level.
Because Diagnostic does not have a severity level field, an Analyzer's
diagnostics effectively all have the same severity level. To separate which
diagnostics are high severity and which are low severity, expose multiple
Analyzers instead. Analyzers should also be separated when their
diagnostics belong in different groups, or could be tagged differently
before being shown to the end user. Analyzers should document their severity
level to help downstream tools surface diagnostics properly.
Most Analyzers inspect typed Go syntax trees, but a few, such as asmdecl
and buildtag, inspect the raw text of Go source files or even non-Go
files such as assembly. To report a diagnostic against a line of a
raw text file, use the following sequence:
content, err := ioutil.ReadFile(filename)
if err != nil { ... }
tf := fset.AddFile(filename, -1, len(content))
tf.SetLinesForContent(content)
...
pass.Reportf(tf.LineStart(line), "oops")
Modular analysis with Facts
To improve efficiency and scalability, large programs are routinely
built using separate compilation: units of the program are compiled
separately, and recompiled only when one of their dependencies changes;
independent modules may be compiled in parallel. The same technique may
be applied to static analyses, for the same benefits. Such analyses are
described as "modular".
A compiler’s type checker is an example of a modular static analysis.
Many other checkers we would like to apply to Go programs can be
understood as alternative or non-standard type systems. For example,
vet's printf checker infers whether a function has the "printf wrapper"
type, and it applies stricter checks to calls of such functions. In
addition, it records which functions are printf wrappers for use by
later analysis passes to identify other printf wrappers by induction.
A result such as “f is a printf wrapper” that is not interesting by
itself but serves as a stepping stone to an interesting result (such as
a diagnostic) is called a "fact".
The analysis API allows an analysis to define new types of facts, to
associate facts of these types with objects (named entities) declared
within the current package, or with the package as a whole, and to query
for an existing fact of a given type associated with an object or
package.
An Analyzer that uses facts must declare their types:
var Analyzer = &analysis.Analyzer{
Name: "printf",
FactTypes: []analysis.Fact{new(isWrapper)},
...
}
type isWrapper struct{} // => *types.Func f “is a printf wrapper”
The driver program ensures that facts for a pass’s dependencies are
generated before analyzing the package and is responsible for propagating
facts from one package to another, possibly across address spaces.
Consequently, Facts must be serializable. The API requires that drivers
use the gob encoding, an efficient, robust, self-describing binary
protocol. A fact type may implement the GobEncoder/GobDecoder interfaces
if the default encoding is unsuitable. Facts should be stateless.
The Pass type has functions to import and export facts,
associated either with an object or with a package:
type Pass struct {
...
ExportObjectFact func(types.Object, Fact)
ImportObjectFact func(types.Object, Fact) bool
ExportPackageFact func(fact Fact)
ImportPackageFact func(*types.Package, Fact) bool
}
An Analyzer may only export facts associated with the current package or
its objects, though it may import facts from any package or object that
is an import dependency of the current package.
Conceptually, ExportObjectFact(obj, fact) inserts fact into a hidden map keyed by
the pair (obj, TypeOf(fact)), and the ImportObjectFact function
retrieves the entry from this map and copies its value into the variable
pointed to by fact. This scheme assumes that the concrete type of fact
is a pointer; this assumption is checked by the Validate function.
See the "printf" analyzer for an example of object facts in action.
Some driver implementations (such as those based on Bazel and Blaze) do
not currently apply analyzers to packages of the standard library.
Therefore, for best results, analyzer authors should not rely on
analysis facts being available for standard packages.
For example, although the printf checker is capable of deducing during
analysis of the log package that log.Printf is a printf wrapper,
this fact is built in to the analyzer so that it correctly checks
calls to log.Printf even when run in a driver that does not apply
it to standard packages. We would like to remove this limitation in future.
Testing an Analyzer
The analysistest subpackage provides utilities for testing an Analyzer.
In a few lines of code, it is possible to run an analyzer on a package
of testdata files and check that it reported all the expected
diagnostics and facts (and no more). Expectations are expressed using
"// want ..." comments in the input code.
Standalone commands
Analyzers are provided in the form of packages that a driver program is
expected to import. The vet command imports a set of several analyzers,
but users may wish to define their own analysis commands that perform
additional checks. To simplify the task of creating an analysis command,
either for a single analyzer or for a whole suite, we provide the
singlechecker and multichecker subpackages.
The singlechecker package provides the main function for a command that
runs one analyzer. By convention, each analyzer such as
go/passes/findcall should be accompanied by a singlechecker-based
command such as go/analysis/passes/findcall/cmd/findcall, defined in its
entirety as:
package main
import (
"golang.org/x/tools/go/analysis/passes/findcall"
"golang.org/x/tools/go/analysis/singlechecker"
)
func main() { singlechecker.Main(findcall.Analyzer) }
A tool that provides multiple analyzers can use multichecker in a
similar way, giving it the list of Analyzers.
*/
package analysis
| {
"pile_set_name": "Github"
} |
selector:
js_test:
roots:
- jstests/tool/*.js
# Tool tests start their own mongod's.
executor:
js_test:
config:
shell_options:
nodb: ''
readMode: commands
| {
"pile_set_name": "Github"
} |
This document explains why certain assertions were not tested.
Assertions not listed here should be covered by the tests in this directory.
Assertions Tested ? Remarks
1 NO
2 YES
3 NO Only page mapped by mmap() are tested
4 NO
5 NO Implementation-defined
6 NO
7 YES
8 YES
9 YES
10 NO
11 NO Unspecified
12 NO
13 YES
14 YES May assertion
15 YES May assertion
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef INCLUDE_PERFETTO_EXT_BASE_LOOKUP_SET_H_
#define INCLUDE_PERFETTO_EXT_BASE_LOOKUP_SET_H_
#include <set>
namespace perfetto {
namespace base {
// Set that allows lookup from const member of the object.
template <typename T, typename U, U T::*p>
class LookupSet {
public:
T* Get(const U& key) {
// This will be nicer with C++14 transparent comparators.
// Then we will be able to look up by just the key using a sutiable
// comparator.
//
// For now we need to allow to construct a T from the key.
T node(key);
auto it = set_.find(node);
if (it == set_.end())
return nullptr;
return const_cast<T*>(&(*it));
}
template <typename... P>
T* Emplace(P&&... args) {
auto r = set_.emplace(std::forward<P>(args)...);
return const_cast<T*>(&(*r.first));
}
bool Remove(const T& child) { return set_.erase(child); }
void Clear() { set_.clear(); }
static_assert(std::is_const<U>::value, "key must be const");
private:
class Comparator {
public:
bool operator()(const T& one, const T& other) const {
return (&one)->*p < (&other)->*p;
}
};
std::set<T, Comparator> set_;
};
} // namespace base
} // namespace perfetto
#endif // INCLUDE_PERFETTO_EXT_BASE_LOOKUP_SET_H_
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_initialize(t) {
t.plan(1);
var layer = new OpenLayers.Layer.PointGrid();
t.ok(layer instanceof OpenLayers.Layer.PointGrid, "instance created");
layer.destroy();
}
function test_name(t) {
t.plan(1);
var layer = new OpenLayers.Layer.PointGrid({name: "foo"});
t.eq(layer.name, "foo", "name set like every other property");
layer.destroy();
}
function test_spacing(t) {
t.plan(7);
var layer = new OpenLayers.Layer.PointGrid({
isBaseLayer: true,
resolutions: [1],
maxExtent: new OpenLayers.Bounds(-100, -50, 100, 50),
dx: 10,
dy: 10,
ratio: 1
});
var map = new OpenLayers.Map({
div: "map",
layers: [layer],
center: new OpenLayers.LonLat(0, 0),
zoom: 0
});
t.eq(layer.features.length, 200, "200 features");
// set dx/dy together
layer.setSpacing(20);
t.eq(layer.dx, 20, "dx 20");
t.eq(layer.dy, 20, "dy 20");
t.eq(layer.features.length, 50, "50 features");
// set dx/dy independently
layer.setSpacing(50, 25);
t.eq(layer.dx, 50, "dx 50");
t.eq(layer.dy, 25, "dy 25");
t.eq(layer.features.length, 16, "16 features");
map.destroy();
}
function test_ratio(t) {
t.plan(3);
var layer = new OpenLayers.Layer.PointGrid({
isBaseLayer: true,
resolutions: [1],
maxExtent: new OpenLayers.Bounds(-100, -50, 100, 50),
dx: 25,
dy: 25,
ratio: 1
});
var map = new OpenLayers.Map({
div: "map",
layers: [layer],
center: new OpenLayers.LonLat(0, 0),
zoom: 0
});
t.eq(layer.features.length, 32, "32 features");
// increase ratio (1.5 -> 300 x 150)
layer.setRatio(1.5);
t.eq(layer.ratio, 1.5, "ratio 1.5");
t.eq(layer.features.length, 72, "72 features");
map.destroy();
}
function test_maxFeatures(t) {
t.plan(3);
var layer = new OpenLayers.Layer.PointGrid({
isBaseLayer: true,
resolutions: [1],
maxExtent: new OpenLayers.Bounds(-100, -50, 100, 50),
dx: 10,
dy: 10,
ratio: 1
});
var map = new OpenLayers.Map({
div: "map",
layers: [layer],
center: new OpenLayers.LonLat(0, 0),
zoom: 0
});
t.eq(layer.features.length, 200, "200 features");
// limit maxFeatures
layer.setMaxFeatures(150);
t.eq(layer.maxFeatures, 150, "maxFeatures 150");
t.ok(layer.features.length <= 150, "<= 150 features");
map.destroy();
}
function test_rotation(t) {
t.plan(6);
var layer = new OpenLayers.Layer.PointGrid({
isBaseLayer: true,
resolutions: [1],
maxExtent: new OpenLayers.Bounds(-100, -50, 100, 50),
dx: 10,
dy: 10,
ratio: 1
});
var map = new OpenLayers.Map({
div: "map",
layers: [layer],
center: new OpenLayers.LonLat(0, 0),
zoom: 0
});
function getRotation(layer) {
// grid starts at bottom left and goes up
var g0 = layer.features[0].geometry;
var g1 = layer.features[1].geometry;
// subtract 90 to get rotation of grid
return Math.atan2(g1.y - g0.y, g1.x - g0.x) * (180 / Math.PI) - 90;
}
t.eq(layer.rotation, 0, "0 rotation");
t.eq(getRotation(layer).toFixed(3), (0).toFixed(3), "0 grid")
// rotate grid 25 degrees counter-clockwise
layer.setRotation(25);
t.eq(layer.rotation, 25, "25 rotation");
t.eq(getRotation(layer).toFixed(3), (25).toFixed(3), "25 grid");
// rotate grid 45 degrees clockwise
layer.setRotation(-45);
t.eq(layer.rotation, -45, "-45 rotation");
t.eq(getRotation(layer).toFixed(3), (-45).toFixed(3), "-45 grid");
map.destroy();
}
function test_origin(t) {
t.plan(7);
var layer = new OpenLayers.Layer.PointGrid({
isBaseLayer: true,
resolutions: [1],
maxExtent: new OpenLayers.Bounds(-100, -50, 100, 50),
dx: 10,
dy: 10,
ratio: 1
});
var map = new OpenLayers.Map({
div: "map",
layers: [layer],
center: new OpenLayers.LonLat(0, 0),
zoom: 0
});
var origin = layer.getOrigin();
t.ok(map.getExtent().getCenterLonLat().equals(origin), "default is center of map extent");
var g0 = layer.features[0].geometry;
t.eq((g0.x - origin.lon) % layer.dx, 0, "a) lattice aligned with origin x");
t.eq((g0.y - origin.lat) % layer.dy, 0, "a) lattice aligned with origin y");
// set origin
layer.setOrigin(new OpenLayers.LonLat(-5, 12));
origin = layer.getOrigin();
t.eq(origin.lon, -5, "-5 origin x");
t.eq(origin.lat, 12, "12 origin y");
g0 = layer.features[0].geometry;
t.eq((g0.x - origin.lon) % layer.dx, 0, "b) lattice aligned with origin x");
t.eq((g0.y - origin.lat) % layer.dy, 0, "b) lattice aligned with origin y");
map.destroy();
}
function test_zoom(t) {
t.plan(2);
var layer = new OpenLayers.Layer.PointGrid({
isBaseLayer: true,
resolutions: [2, 1],
maxExtent: new OpenLayers.Bounds(-200, -100, 200, 100),
dx: 20,
dy: 20,
ratio: 1
});
var map = new OpenLayers.Map({
div: "map",
layers: [layer],
center: new OpenLayers.LonLat(0, 0),
zoom: 1,
zoomMethod: null
});
t.eq(layer.features.length, 50, "50 features at zoom 1");
map.zoomTo(0);
t.eq(layer.features.length, 200, "200 features at zoom 0")
map.destroy();
}
</script>
</head>
<body>
<div id="map" style="width:200px;height:100px"></div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?php
/*************************************************************************************
* vbnet.php
* ---------
* Author: Alan Juden ([email protected])
* Copyright: (c) 2004 Alan Juden, Nigel McNie (http://qbnz.com/highlighter)
* Release Version: 1.0.8.10
* Date Started: 2004/06/04
*
* VB.NET language file for GeSHi.
*
* CHANGES
* -------
* 2004/11/27 (1.0.0)
* - Initial release
*
* TODO (updated 2004/11/27)
* -------------------------
*
*************************************************************************************
*
* This file is part of GeSHi.
*
* GeSHi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GeSHi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
************************************************************************************/
$language_data = array (
'LANG_NAME' => 'vb.net',
'COMMENT_SINGLE' => array(1 => "'"),
'COMMENT_MULTI' => array(),
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
'QUOTEMARKS' => array('"'),
'ESCAPE_CHAR' => '',
'KEYWORDS' => array(
//Keywords
1 => array(
'AddHandler', 'AddressOf', 'Alias', 'And', 'AndAlso', 'As', 'ByRef', 'ByVal',
'Call', 'Case', 'Catch', 'Char', 'Class', 'Const', 'Continue',
'Declare', 'Default',
'Delegate', 'Dim', 'DirectCast', 'Do', 'Each', 'Else', 'ElseIf', 'End', 'EndIf',
'Enum', 'Erase', 'Error', 'Event', 'Exit', 'False', 'Finally', 'For', 'Friend', 'Function',
'Get', 'GetType', 'GetXMLNamespace', 'Global', 'GoSub', 'GoTo', 'Handles', 'If', 'Implements',
'Imports', 'In', 'Inherits', 'Interface', 'Is', 'IsNot', 'Let', 'Lib', 'Like', 'Loop', 'Me',
'Mod', 'Module', 'Module Statement', 'MustInherit', 'MustOverride', 'MyBase', 'MyClass', 'Namespace',
'Narrowing', 'New', 'Next', 'Not', 'Nothing', 'NotInheritable', 'NotOverridable', 'Of', 'On',
'Operator', 'Option', 'Optional', 'Or', 'OrElse', 'Out', 'Overloads', 'Overridable', 'Overrides',
'ParamArray', 'Partial', 'Private', 'Property', 'Protected', 'Public', 'RaiseEvent', 'ReadOnly', 'ReDim',
'REM', 'RemoveHandler', 'Resume', 'Return', 'Select','Set', 'Shadows', 'Shared', 'Static', 'Step',
'Stop', 'Structure', 'Sub', 'SyncLock', 'Then', 'Throw', 'To', 'True', 'Try', 'TryCast', 'TypeOf',
'Using', 'Wend', 'When', 'While', 'Widening', 'With', 'WithEvents', 'WriteOnly', 'Xor'
),
//Data Types
2 => array(
'Boolean', 'Byte', 'Date', 'Decimal', 'Double', 'Integer', 'Long', 'Object',
'SByte', 'Short', 'Single', 'String', 'UInteger', 'ULong', 'UShort'
),
//Compiler Directives
3 => array(
'#Const', '#Else', '#ElseIf', '#End', '#If'
),
//Constants
4 => array(
'CBool', 'CByte', 'CChar', 'CChr', 'CDate', 'CDbl', 'CDec','CInt', 'CLng', 'CLng8', 'CObj', 'CSByte', 'CShort',
'CSng', 'CStr', 'CType', 'CUInt', 'CULng', 'CUShort'
),
//Linq
5 => array(
'By','From','Group','Where'
),
//Built-in functions
7 => array(
'ABS', 'ARRAY', 'ASC', 'ASCB', 'ASCW', 'CALLBYNAME', 'CHOOSE', 'CHR', 'CHR$', 'CHRB', 'CHRB$', 'CHRW',
'CLOSE', 'COMMAND', 'COMMAND$', 'CONVERSION',
'COS', 'CREATEOBJECT', 'CURDIR', 'CVDATE', 'DATEADD',
'DATEDIFF', 'DATEPART', 'DATESERIAL', 'DATEVALUE', 'DAY', 'DDB', 'DIR', 'DIR$',
'EOF', 'ERROR$', 'EXP', 'FILEATTR', 'FILECOPY', 'FILEDATATIME', 'FILELEN', 'FILTER',
'FIX', 'FORMAT', 'FORMAT$', 'FORMATCURRENCY', 'FORMATDATETIME', 'FORMATNUMBER',
'FORMATPERCENT', 'FREEFILE', 'FV', 'GETALLSETTINGS', 'GETATTRGETOBJECT', 'GETSETTING',
'HEX', 'HEX$', 'HOUR', 'IIF', 'IMESTATUS', 'INPUT$', 'INPUTB', 'INPUTB$', 'INPUTBOX',
'INSTR', 'INSTRB', 'INSTRREV', 'INT', 'IPMT', 'IRR', 'ISARRAY', 'ISDATE', 'ISEMPTY',
'ISERROR', 'ISNULL', 'ISNUMERIC', 'ISOBJECT', 'JOIN', 'LBOUND', 'LCASE', 'LCASE$',
'LEFT', 'LEFT$', 'LEFTB', 'LEFTB$', 'LENB', 'LINEINPUT', 'LOC', 'LOF', 'LOG', 'LTRIM',
'LTRIM$', 'MID$', 'MIDB', 'MIDB$', 'MINUTE', 'MIRR', 'MKDIR', 'MONTH', 'MONTHNAME',
'MSGBOX', 'NOW', 'NPER', 'NPV', 'OCT', 'OCT$', 'PARTITION', 'PMT', 'PPMT', 'PV',
'RATE', 'REPLACE', 'RIGHT', 'RIGHT$', 'RIGHTB', 'RIGHTB$', 'RMDIR', 'RND', 'RTRIM',
'RTRIM$', 'SECOND', 'SIN', 'SLN', 'SPACE', 'SPACE$', 'SPC', 'SPLIT', 'SQRT', 'STR', 'STR$',
'STRCOMP', 'STRCONV', 'STRING$', 'STRREVERSE', 'SYD', 'TAB', 'TAN', 'TIMEOFDAY',
'TIMER', 'TIMESERIAL', 'TIMEVALUE', 'TODAY', 'TRIM', 'TRIM$', 'TYPENAME', 'UBOUND',
'UCASE', 'UCASE$', 'VAL', 'WEEKDAY', 'WEEKDAYNAME', 'YEAR'
),
),
'SYMBOLS' => array(
'+', '-', '*', '?', '=', '/', '%', '&', '>', '<', '^', '!',
'(', ')', '{', '}', '.'
),
'CASE_SENSITIVE' => array(
GESHI_COMMENTS => false,
1 => false,
2 => false,
3 => false,
4 => false,
5 => false,
7 => false
),
'STYLES' => array(
'KEYWORDS' => array(
1 => 'color: #0000FF; font-weight: bold;', //Keywords
2 => 'color: #6a5acd;', //primitive Data Types
3 => 'color: #6a5acd; font-weight: bold;', //preprocessor-commands
4 => 'color: #cd6a5a;', //Constants
5 => 'color: #cd6a5a; font-weight: bold;', //LinQ
7 => 'color: #000066;', //Built-in functions
),
'COMMENTS' => array(
1 => 'color: #008000; font-style: italic;',
'MULTI' => 'color: #008000; font-style: italic;'
),
'ESCAPE_CHAR' => array(
0 => 'color: #008080; font-weight: bold;'
),
'BRACKETS' => array(
0 => 'color: #000000;'
),
'STRINGS' => array(
0 => 'color: #a52a2a; back-color: #fffacd;'
),
'NUMBERS' => array(
0 => 'color: #a52a2a; back-color: #fffacd;'
),
'METHODS' => array(
1 => 'color: #000000;'
),
'SYMBOLS' => array(
0 => 'color: #000000;'
),
'REGEXPS' => array(
),
'SCRIPT' => array(
)
),
'URLS' => array(
1 => '',
2 => '',
3 => 'http://www.google.com/search?q={FNAMEU}+site:msdn.microsoft.com',
4 => '',
5 => '',
7 => 'http://www.google.com/search?q={FNAMEU}+site:msdn.microsoft.com'
),
'OOLANG' => true,
'OBJECT_SPLITTERS' => array(
1 =>'.'
),
'REGEXPS' => array(
),
'STRICT_MODE_APPLIES' => GESHI_NEVER,
'SCRIPT_DELIMITERS' => array(
),
'HIGHLIGHT_STRICT_BLOCK' => array(
),
'PARSER_CONTROL' => array(
'KEYWORDS' => array(
7 => array(
'DISALLOWED_AFTER' => '(?!\w)(?=\s*\()'
)
)
)
);
?> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//FreeBSD//DTD XHTML 1.0 Transitional-Based Extension//EN"
"http://www.FreeBSD.org/XML/share/xml/xhtml10-freebsd.dtd" [
<!ENTITY title "Proyecto FreeBSD/alpha">
<!ENTITY email 'freebsd-alpha'>
]>
<!-- The FreeBSD Spanish Documentation Project
Original Revision: r1.6 -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&title;</title>
<cvs:keyword xmlns:cvs="http://www.FreeBSD.org/XML/CVS">$FreeBSD$</cvs:keyword>
</head>
<body class="navinclude.developers">
<p>Esta página contiene información acerca
de FreeBSD en los sistemas HP/Compaq Alpha.</p>
<p><b>Note</b>: A partir de FreeBSD 7.0 se dejará de dar
soporte a la plataforma Alpha. El fabricante ha dejado de
producir nuevos sistemas Alpha; a esto se añade la
facilidad de acceso para todo el mundo a platformas de 64 bits
como AMD64 e Intel EM64T. Debido a estos factores el interés
por Alpha ha decrecido entre usuarios y desarrolladores.
El distribuidor del hardware ha cancelado el desarrollo de
nuevos sistemas Alpha; a esto se añade el hecho de que
la enorme propagación de las plataformas de 64-bit, como
arquitecturas AMD64 e Intel EM64T, resultó en una reducción
del interés de los usuarios y desarrolladores. El soporte de
FreeBSD/alpha seguirá activo en las releases de la rama 6.X
de FreeBSD.</p>
<h3>Enlaces específicos de FreeBSD/alpha</h3>
<ul>
<li><a href="mailto:[email protected]">Lista de
correo de FreeBSD/alpha</a></li>
</ul>
<h3>Otros enlaces de interés</h3>
<h4>Hardware</h4>
<ul>
<li><a href="http://h18002.www1.hp.com/alphaserver/">HP
AlphaServer</a></li>
<li><a href="http://h18002.www1.hp.com/alphaserver/workstations.html">
HP AlphaStation</a></li>
</ul>
<h4>Proyectos</h4>
<ul>
<li><a
href="http://www.NetBSD.org/Ports/alpha">NetBSD/alpha</a></li>
<li><a
href="http://www.OpenBSD.org/alpha.html">OpenBSD/alpha</a></li>
<li><a href="http://www.alphalinux.org/">AlphaLinux</a></li>
</ul>
</body>
</html>
| {
"pile_set_name": "Github"
} |
define("ace/mode/textile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var TextileHighlightRules = function() {
this.$rules = {
"start" : [
{
token : function(value) {
if (value.charAt(0) == "h")
return "markup.heading." + value.charAt(1);
else
return "markup.heading";
},
regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre",
next : "blocktag"
},
{
token : "keyword",
regex : "[\\*]+|[#]+"
},
{
token : "text",
regex : ".+"
}
],
"blocktag" : [
{
token : "keyword",
regex : "\\. ",
next : "start"
},
{
token : "keyword",
regex : "\\(",
next : "blocktagproperties"
}
],
"blocktagproperties" : [
{
token : "keyword",
regex : "\\)",
next : "blocktag"
},
{
token : "string",
regex : "[a-zA-Z0-9\\-_]+"
},
{
token : "keyword",
regex : "#"
}
]
};
};
oop.inherits(TextileHighlightRules, TextHighlightRules);
exports.TextileHighlightRules = TextileHighlightRules;
});
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
var MatchingBraceOutdent = function() {};
(function() {
this.checkOutdent = function(line, input) {
if (! /^\s+$/.test(line))
return false;
return /^\s*\}/.test(input);
};
this.autoOutdent = function(doc, row) {
var line = doc.getLine(row);
var match = line.match(/^(\s*\})/);
if (!match) return 0;
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.$getIndent(doc.getLine(openBracePos.row));
doc.replace(new Range(row, 0, row, column-1), indent);
};
this.$getIndent = function(line) {
return line.match(/^\s*/)[0];
};
}).call(MatchingBraceOutdent.prototype);
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
define("ace/mode/textile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/textile_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() {
this.HighlightRules = TextileHighlightRules;
this.$outdent = new MatchingBraceOutdent();
};
oop.inherits(Mode, TextMode);
(function() {
this.type = "text";
this.getNextLineIndent = function(state, line, tab) {
if (state == "intag")
return tab;
return "";
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.$id = "ace/mode/textile";
}).call(Mode.prototype);
exports.Mode = Mode;
});
| {
"pile_set_name": "Github"
} |
# Running OpenVR without a headset
On Windows, you can use a mock OpenVR component to run some basic WebXR
functionality in Chrome without connecting a VR headset. This can be useful for
reproing and investigating WebXR bugs without as much setup required.
Replace `out\debug` with wherever your build output is going.
This assumes Chrome checkout is in `c:\src\chromium\src`
1. Build the mock openvr:
```shell
autoninja -C out\debug openvr_mock
```
2. Set environment variables so we use the mock openvr
```shell
set VR_OVERRIDE=C:\src\chromium\src\out\debug\mock_vr_clients\
set VR_CONFIG_PATH=C:\src\chromium\src\out\debug
set VR_LOG_PATH=C:\src\chromium\src\out\debug
```
3. Run Chrome with WebXR and OpenVR enabled, but WMR disabled.
```shell
out\debug\chrome.exe --enable-features="WebXR,OpenVR" --disable-features="WindowsMixedReality"
```
4. Navigate to a test page, by going to this [index](https://storage.googleapis.com/chromium-webxr-test/index.html)
clicking the link for the latest revision, and then navigating to the
appropriate page, such as xr-barebones.html.
5. Click "Enter XR" to start an XR session that uses the mock OpenVR component.
| {
"pile_set_name": "Github"
} |
import { World } from "../src/World.js";
export function init(benchmarks) {
benchmarks
.group("world")
.add({
name: "new World({ entityPoolSize: 100k })",
execute: () => {
new World({ entityPoolSize: 100000 });
},
iterations: 10
})
.add({
name: "World::createEntity (100k empty, recreating world)",
execute: () => {
let world = new World();
for (let i = 0; i < 100000; i++) {
world.createEntity();
}
},
iterations: 10
})
.add({
name:
"World::createEntity (100k empty, recreating world (poolSize: 100k))",
execute: () => {
let world = new World({ entityPoolSize: 100000 });
for (let i = 0; i < 100000; i++) {
world.createEntity();
}
},
iterations: 10
})
.add({
name:
"World::createEntity (100k empty, recreating world (not measured), entityPoolSize = 100k)",
prepare: ctx => {
ctx.world = new World({ entityPoolSize: 100000 });
},
execute: ctx => {
for (let i = 0; i < 100000; i++) {
ctx.world.createEntity();
}
},
iterations: 10
})
.add({
name:
"World::createEntity(name) (100k empty, recreating world (not measured), entityPoolSize = 100k)",
prepare: ctx => {
ctx.world = new World({ entityPoolSize: 100000 });
},
execute: ctx => {
for (let i = 0; i < 100000; i++) {
ctx.world.createEntity("name" + i);
}
},
iterations: 10
})
.add({
name:
"World::createEntity (100k empty, reuse world, entityPoolSize = 100k * 10)",
prepareGlobal: ctx => {
ctx.world = new World({ entityPoolSize: 100000 * 10 });
},
execute: ctx => {
for (let i = 0; i < 100000; i++) {
ctx.world.createEntity();
}
},
iterations: 10
});
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file keywords/log_name.hpp
* \author Andrey Semashev
* \date 14.03.2009
*
* The header contains the \c log_name keyword declaration.
*/
#ifndef BOOST_LOG_KEYWORDS_LOG_NAME_HPP_INCLUDED_
#define BOOST_LOG_KEYWORDS_LOG_NAME_HPP_INCLUDED_
#include <boost/parameter/keyword.hpp>
#include <boost/log/detail/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace keywords {
//! The keyword is used to pass event log name to a sink backend
BOOST_PARAMETER_KEYWORD(tag, log_name)
} // namespace keywords
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#endif // BOOST_LOG_KEYWORDS_LOG_NAME_HPP_INCLUDED_
| {
"pile_set_name": "Github"
} |
This is the ipset source tree. Follow the next steps to install ipset.
If you upgrade from an earlier 5.x release, please read the UPGRADE
instructions too.
0. You need the source tree of your kernel (version >= 2.6.34)
and it have to be configured with ip6tables support enabled,
modules compiled. Please apply the netlink.patch against your kernel
tree, which adds the new subsystem identifier for ipset.
Recompile and install the patched kernel and its modules. Please note,
you have to run the patched kernel for ipset to work.
The ipset source code depends on the libmnl library so the library
must be installed. You can download the libmnl library from
git://git.netfilter.org/libmnl.git
1. Initialize the compiling environment for ipset. The packages automake,
autoconf and libtool are required.
% ./autogen.sh
2. Run `./configure` and then compile the ipset binary and the kernel
modules.
Configure parameters can be used to to override the default path
to the kernel source tree (/lib/modules/`uname -r`/build),
the maximum number of sets (256), the default hash sizes (1024).
See `./configure --help`.
% ./configure
% make
% make modules
3. Install the binary and the kernel modules
# make install
# make modules_install
After installing the modules, you can run the testsuite as well.
Please note, several assumptions must be met for the testsuite:
- no sets defined
- iptables/ip6tables rules are not set up
- the destination for kernel logs is /var/log/kern.log
- the networks 10.255.255.0/24 and 1002:1002:1002:1002::/64
are not in use
- sendip utility is installed
# make tests
4. Cleanup the source tree
% make clean
% make modules_clean
That's it!
Read the ipset(8) and iptables(8), ip6tables(8) manpages on how to use
ipset and its match and target from iptables.
Compatibilities and incompatibilities:
- The ipset 6.x userspace utility contains a backward compatibility
interface to support the commandline syntax of ipset 4.x.
The commandline syntax of ipset 6.x is fully compatible with 5.x.
- The ipset 6.x userspace utility can't talk to the kernel part of ipset 5.x
or 4.x.
- The ipset 6.x kernel part can't talk to the userspace utility from
ipset 5.x or 4.x.
- The ipset 6.x kernel part can work together with the set match and SET
target from iptables 1.4.7 and below, however if you need the IPv6 support
from ipset 6.x, then you have to use iptables 1.4.8 or above.
The ipset 6.x can interpret the commandline syntax of ipset 4.x, however
some internal changes mean different behaviour:
- The "--matchunset" flag for the macipmap type is ignored and not used
anymore.
- The "--probes" and "--resize" parameters of the hash types are ignored
and not used anymore.
- The "--from", "--to" and "--network" parameters of the ipporthash,
ipportiphash and ipportnethash types are ignored and not used anymore.
- The hash types are not resized when new entries are added by the SET
target. If you use a set together with the SET target, create it with
the proper size because it won't be resized automatically.
- The iptree, iptreemap types are not implemented in ipset 6.x. The types
are automatically substituted with the hash:ip type.
| {
"pile_set_name": "Github"
} |
{
"name": "bundle-test-app",
"scripts": {
"start": "xvfb-maybe electron .",
"build": "webpack"
},
"main": "dist/main.js",
"dependencies": {
"electron": "^7.1.10"
},
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-plugin-replace": "^1.2.0",
"xvfb-maybe": "^0.2.1"
}
}
| {
"pile_set_name": "Github"
} |
import angular from 'angular';
export const storage = angular.module('util.storage', []);
storage.factory('storage', ['$window', function($window) {
function setJs(key, val, toSessionStorage = false) {
if (toSessionStorage) {
$window.sessionStorage.setItem(key, JSON.stringify(val));
} else {
$window.localStorage.setItem(key, JSON.stringify(val));
}
}
function getJs(key, fromSessionStorage) {
const val = fromSessionStorage ?
$window.sessionStorage.getItem(key) :
$window.localStorage.getItem(key);
try {
return JSON.parse(val);
} catch (_) {
throw new Error(`Could not parse JSON: ${val} for: ${key}`);
}
}
function clearJs(key) {
$window.sessionStorage.removeItem(key);
$window.localStorage.removeItem(key);
}
return {
setJs,
getJs,
clearJs
};
}]);
| {
"pile_set_name": "Github"
} |
#include <tommath.h>
#ifdef BN_S_MP_ADD_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://libtom.org
*/
/* low level addition, based on HAC pp.594, Algorithm 14.7 */
int
s_mp_add (mp_int * a, mp_int * b, mp_int * c)
{
mp_int *x;
int olduse, res, min, max;
/* find sizes, we let |a| <= |b| which means we have to sort
* them. "x" will point to the input with the most digits
*/
if (a->used > b->used) {
min = b->used;
max = a->used;
x = a;
} else {
min = a->used;
max = b->used;
x = b;
}
/* init result */
if (c->alloc < max + 1) {
if ((res = mp_grow (c, max + 1)) != MP_OKAY) {
return res;
}
}
/* get old used digit count and set new one */
olduse = c->used;
c->used = max + 1;
{
register mp_digit u, *tmpa, *tmpb, *tmpc;
register int i;
/* alias for digit pointers */
/* first input */
tmpa = a->dp;
/* second input */
tmpb = b->dp;
/* destination */
tmpc = c->dp;
/* zero the carry */
u = 0;
for (i = 0; i < min; i++) {
/* Compute the sum at one digit, T[i] = A[i] + B[i] + U */
*tmpc = *tmpa++ + *tmpb++ + u;
/* U = carry bit of T[i] */
u = *tmpc >> ((mp_digit)DIGIT_BIT);
/* take away carry bit from T[i] */
*tmpc++ &= MP_MASK;
}
/* now copy higher words if any, that is in A+B
* if A or B has more digits add those in
*/
if (min != max) {
for (; i < max; i++) {
/* T[i] = X[i] + U */
*tmpc = x->dp[i] + u;
/* U = carry bit of T[i] */
u = *tmpc >> ((mp_digit)DIGIT_BIT);
/* take away carry bit from T[i] */
*tmpc++ &= MP_MASK;
}
}
/* add carry */
*tmpc++ = u;
/* clear digits above oldused */
for (i = c->used; i < olduse; i++) {
*tmpc++ = 0;
}
}
mp_clamp (c);
return MP_OKAY;
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
| {
"pile_set_name": "Github"
} |
/*
PowerShell Desired State Configuration for Linux
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _CAENGINEINTERNAL_H
#define _CAENGINEINTERNAL_H
#include "MI.h"
#define INITIAL_CONTAINER_SIZE 10
#define CONTAINER_DEFAULT_EXECUTION 0
#define CONTAINER_REMAINING_EXECUTION 1
#define NODE_VISITED 1
#define NODE_RESOLVED 1
#define LOGRESOURCE_CLASSNAME MI_T("MSFT_LogResource")
#define LOGRESOURCE_MESSAGEPROPERTYNAME MI_T("Message")
#define STOP_CONFIGURATIONT_TIMEOUT 60000
/*
This is a data structure for a single linked list that contains a front pointer and a back pointer, and we'll be using it to keep track of all resources that have failed to apply, and at the end we construct a string based on entries in this data structure and free the memory allocated by it.
Example output in the CIM_Error instance that is returned is:
Failed to apply the configuration. These resources produced errors: [nxSshAuthorizedKeys]rootKey, [nxFile]MyFile1.
*/
typedef struct _ResourceError ResourceError;
typedef struct _ResourceErrorList ResourceErrorList;
struct _ResourceError
{
ResourceError * next;
char * resourceID;
};
struct _ResourceErrorList
{
ResourceError * first;
ResourceError * last;
};
MI_Result InitResourceErrorList(ResourceErrorList * resourceErrorList);
MI_Result AddToResourceErrorList(ResourceErrorList * resourceErrorList, const char * resourceID);
char * BuildStringResourceErrorList(ResourceErrorList * resourceErrorList);
MI_Result CleanupResourceErrorList(ResourceErrorList * resourceErrorList);
MI_Result DependentResourceProcessed (_In_ MI_Uint32 resourceIndex,
_In_ ExecutionOrderContainer *container,
_Inout_ MI_Boolean *bDependentFailed,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result DependentResourceFailed( _In_ MI_Uint32 index,
_In_ ExecutionOrderContainer *container,
_In_ MI_InstanceA *instanceA,
_Out_ MI_Boolean *bDependentFailed,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result ResolveDependencyInternal( _In_ MI_Uint32 index,
_In_ MI_InstanceA *instanceA,
_Inout_ ExecutionOrderContainer *container,
_Inout_count_(instanceA->size) MI_Sint32 *visitedNodes,
_Inout_count_(instanceA->size) MI_Sint32 *resolvedNodes,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result GetInstanceIndex(_In_ MI_InstanceA *instanceA,
_In_z_ MI_Char *resourceId,
int currentInstanceIndex,
_Out_ MI_Uint32 *resourceIndex,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result AddToList(_Inout_ ExecutionOrderContainer *container,
_In_ MI_Uint32 objectIndex,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result SetResourcesInOrder(_In_ LCMProviderContext *lcmContext,
_In_ ModuleManager *moduleManager,
_In_ MI_InstanceA * instanceA,
_In_ MI_Session *miSession,
_In_ ExecutionOrderContainer *executionOrder,
_In_ MI_Uint32 flags,
_In_ MI_Instance *documentIns,
_Inout_ MI_Uint32 *resultStatus,
_Outptr_result_maybenull_ ResourceErrorList *resourceErrorList,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result MoveToDesiredState(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_In_ MI_Uint32 flags,
_Inout_ MI_Uint32 *resultStatus,
_Inout_ MI_Boolean *canceled,
_Outptr_result_maybenull_ ResourceErrorList *resourceErrorList,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result GetCurrentState(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_Outptr_result_maybenull_ MI_Instance *outputInstance,
// _Outptr_result_maybenull_ MI_InstanceA *outputInstance,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result PerformInventoryState(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_Outptr_result_maybenull_ MI_InstanceA *outputInstances,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result Exec_WMIv2Provider(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_In_ MI_Uint32 flags,
_Inout_ MI_Uint32 *resultStatus,
_Inout_ MI_Boolean* canceled,
_Outptr_result_maybenull_ ResourceErrorList *resourceErrorList,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result Exec_NativeProvider(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_In_ MI_Uint32 flags,
_Inout_ MI_Uint32 *resultStatus,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result Exec_PSProvider(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_In_ MI_Uint32 flags,
_Inout_ MI_Uint32 *resultStatus,
_Inout_ MI_Boolean *canceled,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result Get_WMIv2Provider(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_Outptr_result_maybenull_ MI_Instance **outputInstance,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result Inventory_WMIv2Provider(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Session *miSession,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_Outptr_result_maybenull_ MI_InstanceA *outputInstances,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result Get_PSProvider(_In_ ProviderCallbackContext *provContext,
_In_ MI_Application *miApp,
_In_ MI_Instance *instance,
_In_ const MI_Instance *regInstance,
_Outptr_result_maybenull_ MI_Instance **outputInstance,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result StopCurrentPSProviderConfiguration(_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result GetTestMethodResult(_In_ MI_Operation *operation,
_Out_opt_ MI_Boolean *bTestResult,
_Out_opt_ MI_Uint64 *outProviderContext,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result GetSetMethodResult(_In_ MI_Operation *operation,
_Out_opt_ MI_Uint32 *returnValue,
_In_z_ const MI_Char * resourceId,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result GetGetMethodResult(_In_ MI_Operation *operation,
_Outptr_result_maybenull_ MI_Instance **outputInstance,
_Outptr_result_maybenull_ MI_Instance **extendedError);
MI_Result PerformInventoryMethodResult(_In_ MI_Operation *operation,
_Outptr_result_maybenull_ MI_InstanceA *outputInstances,
_Outptr_result_maybenull_ MI_Instance **extendedError);
void LogCAMessage(_In_ LCMProviderContext *lcmContext,
_In_ MI_Uint32 messageIndex,
_In_z_ const MI_Char *resourceId
);
void LogCAMessageTime(_In_ LCMProviderContext *lcmContext,
_In_ MI_Uint32 messageIndex,
_In_ const MI_Real64 duration,
_In_z_ const MI_Char *resourceId
);
void LogCAProgress( _In_ LCMProviderContext *lcmContext,
_In_z_ const MI_Char * currentOperation,
_In_z_ const MI_Char * statusDescription,
_In_ MI_Uint32 currentResourceIndex,
_In_ MI_Uint32 totalResource);
#endif //_CAENGINEINTERNAL_H
| {
"pile_set_name": "Github"
} |
package org.zstack.sdk;
import org.zstack.sdk.L3NetworkInventory;
public class ChangeL3NetworkStateResult {
public L3NetworkInventory inventory;
public void setInventory(L3NetworkInventory inventory) {
this.inventory = inventory;
}
public L3NetworkInventory getInventory() {
return this.inventory;
}
}
| {
"pile_set_name": "Github"
} |
---
title: No Main Search
topTitle: Layouts
icon: fa fa-building
noMainSearch: true
---
<h2>Code</h2> | {
"pile_set_name": "Github"
} |
function [ f wf zwf ] = BGf(C,b)
% Busacker-Gowan迭代算法求最小费用流
% C表示容量矩阵
% b表示弧上单位流量的费用
% f表示最小费用最大流矩阵
% wf表示最大流量
% zwf表示最小费用
n = size(C,2);
wf = 0;wf0=inf;
f = zeros(n,n);
while(1)
a = ones(n,n)*inf;
for i =1:n
a(i,i)=0;
end
for i = 1:n
for j = 1:n
if C(i,j) > 0 && f(i,j)==0
a(i,j)=b(i,j);
elseif C(i,j) > 0 && f(i,j)==C(i,j)
a(j,i) = -b(i,j);
elseif C(i,j) > 0
a(i,j)=b(i,j);
a(j,i)=-b(i,j);
end
end
end
for i = 2:n
p(i)=inf;s(i)=i;
end
for k = 1:n
pd = 1;
for i = 2:n
for j = 1:n
if p(i) > p(j) + a(j,i)
p(i) = p(j) + a(j,i);
s(i)=j;
pd = 0;
end
end
end
if pd
break;
end
end
if p(n)==inf
break;
end
dvt = inf;t = n;
while(1)
if a(s(t),t) > 0
dvtt = C(s(t),t)-f(s(t),t);
elseif a(s(t),t) < 0
dvtt=f(t,s(t));
end
if dvt > dvtt
dvt = dvtt;
end
if s(t)==1
break;
end
t = s(t);
end
pd = 0;
if wf+dvt > wf0
dvt = wf0-wf;pd=1;
end
t = n;
while(1)
if a(s(t),t) > 0
f(s(t),t)=f(s(t),t)+dvt;
elseif a(s(t),t) < 0
f(t,s(t))=f(t,s(t))-dvt;
end
if s(t)==1
break;
end
t = s(t);
end
if pd
break;
end
wf = 0;
for j = 1:n
wf = wf+f(1,j);
end
end
zwf = 0;
for i =1:n
for j = 1:n
zwf = zwf + b(i,j)*f(i,j);
end
end
end
| {
"pile_set_name": "Github"
} |
require 'after_commit/active_record'
require 'after_commit/connection_adapters'
module AfterCommit
def self.committed_records
@@committed_records ||= []
end
def self.committed_records=(committed_records)
@@committed_records = committed_records
end
def self.committed_records_on_create
@@committed_records_on_create ||= []
end
def self.committed_records_on_create=(committed_records)
@@committed_records_on_create = committed_records
end
def self.committed_records_on_update
@@committed_records_on_update ||= []
end
def self.committed_records_on_update=(committed_records)
@@committed_records_on_update = committed_records
end
def self.committed_records_on_destroy
@@committed_records_on_destroy ||= []
end
def self.committed_records_on_destroy=(committed_records)
@@committed_records_on_destroy = committed_records
end
end
ActiveRecord::Base.send(:include, AfterCommit::ActiveRecord)
Object.subclasses_of(ActiveRecord::ConnectionAdapters::AbstractAdapter).each do |klass|
klass.send(:include, AfterCommit::ConnectionAdapters)
end | {
"pile_set_name": "Github"
} |
<Workspace Version="1.0.1.1743" X="0" Y="0" zoom="1" Name="Home" Description="" RunType="Manual" RunPeriod="1000" HasRunWithoutCrash="False">
<NamespaceResolutionMap />
<Elements>
<Dynamo.Graph.Nodes.CodeBlockNodeModel guid="81f25df3-a55e-48c9-9fe8-0ce0cc17fdc3" type="Dynamo.Graph.Nodes.CodeBlockNodeModel" nickname="Code Block" x="54" y="293" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false" CodeText="c=0||1;" ShouldFocus="false" />
</Elements>
<Connectors />
<Notes />
<Annotations />
<Presets />
</Workspace> | {
"pile_set_name": "Github"
} |
<!DOCTYPE html><html class="initial"><head><title>TO-DO tutorial - server.js</title><meta property="og:title" content="TO-DO tutorial - server.js"/><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="keywords" content="server, javascript, js, node.js, library, html, html5, express"><meta name="description" content="Simple TO-DO website using jQuery for the AJAX. Define an API to create, read, update and delete items from a MongoDB database."/><meta property="og:description" content="Simple TO-DO website using jQuery for the AJAX. Define an API to create, read, update and delete items from a MongoDB database."/><link rel="shortcut icon" type="image/png" href="/img/logo.png"><meta property="og:url" content="http://serverjs.io/"><meta property="og:image" content="https://serverjs.io/img/code.png"><link href="/assets/style.min.css" rel="stylesheet"></head><body id="top"><div class="width-1100"></div><nav><a class="brand" href="/"><img class="logo" src="/img/logo.svg" alt="logo"><span class="text">server.js</span></a><input class="show" id="bmenu" type="checkbox"><label class="burger pseudo button switch" for="bmenu">menu</label><div class="menu"><a class="pseudo button" href="https://medium.com/server-for-node-js" target="_blank">Blog</a><a class="pseudo button" href="https://github.com/franciscop/server" target="_blank">Github</a><a class="pseudo button" href="/tutorials">Tutorials</a><a class="button" href="/documentation">Documentation</a></div></nav><article class="tutorial"><div class="flex"><section class="toc"><h2><a href="/tutorials/#top">Tutorials</a></h2><ul><li><label class="more"></label><a href="/tutorials/getting-started/">Getting started</a><ul><li><a href="/tutorials/getting-started/#install-node-js">Install Node.js</a></li><li><a href="/tutorials/getting-started/#create-your-project">Create your project</a></li><li><a href="/tutorials/getting-started/#initialize-git-and-npm">Initialize Git and npm</a></li><li><a href="/tutorials/getting-started/#make-awesome-things-">Make awesome things!</a></li></ul></li><li><label class="more"></label><a href="/tutorials/sessions-production/">Session in production</a><ul><li><a href="/tutorials/sessions-production/#secret">Secret</a></li><li><a href="/tutorials/sessions-production/#storage">Storage</a></li></ul></li><li><label class="more"></label><a href="/tutorials/spreadsheet/">Spreadsheet database</a><ul><li><a href="/tutorials/spreadsheet/#create-a-spreadsheet">Create a spreadsheet</a></li><li><a href="/tutorials/spreadsheet/#installation">Installation</a></li><li><a href="/tutorials/spreadsheet/#back-end-with-server-js">Back-end with server.js</a></li><li><a href="/tutorials/spreadsheet/#front-end">Front-end</a></li></ul></li><li><label class="more"></label><a href="/tutorials/todo/">TO-DO list</a><ul><li><a href="/tutorials/todo/#install-dependencies">Install dependencies</a></li><li><a href="/tutorials/todo/#code-organization">Code organization</a></li><li><a href="/tutorials/todo/#rest-api">REST API</a></li><li><a href="/tutorials/todo/#database">Database</a></li><li><a href="/tutorials/todo/#todos-logic">Todos logic</a></li><li><a href="/tutorials/todo/#testing">Testing</a></li></ul></li><li><label class="more"></label><a href="/tutorials/chat/">Real-time chat</a><ul><li><a href="/tutorials/chat/#user-interface">User Interface</a></li><li><a href="/tutorials/chat/#choose-a-username">Choose a username</a></li><li><a href="/tutorials/chat/#sending-messages">Sending messages</a></li><li><a href="/tutorials/chat/#server-handling">Server handling</a></li><li><a href="/tutorials/chat/#user-x-joined">User X joined</a></li><li><a href="/tutorials/chat/#upload-to-heroku">Upload to Heroku</a></li><li><a href="/tutorials/chat/#xss-protection">XSS Protection</a></li></ul></li></ul></section><div class="main"><div>
<strong>
<a class="button source" href="https://github.com/franciscop/server-tutorial-todo">Source code</a>
</strong>
</div>
<h1 id="to-do-list">TO-DO list</h1>
<p>In this tutorial you will learn to design a basic API to create a list of items. We store them in a MongoDB database using Mongoose and it will be for a single person.</p>
<p>Some possible uses:</p>
<ul>
<li>An actual TO-DO list. Some times you just need a simple list.</li>
<li>The beginning of Hacker News, Reddit, or similar. Those are basically four glorified CRUDs: users, stories, comments, votes.</li>
</ul>
<p>End product:</p>
<p><img src="img/todo_screenshot.png" alt="Screenshot of the final project"></p>
<h2 id="install-dependencies">Install dependencies</h2>
<p>After <a href="/tutorials/getting-started">getting your project ready</a> you'll have to make sure that you have MongoDB installed following <a href="https://docs.mongodb.com/manual/administration/install-community/">the official guide</a> and run it (will depend on your installation process). To check that you have it on Ubuntu do:</p>
<pre><code class="lang-bash">mongod --version # Should display a number
mongod
</code></pre>
<p>Then we install the two libraries that we will be using <strong>within our project folder</strong>:</p>
<pre><code class="lang-bash">npm install server mongoose jest
</code></pre>
<h2 id="code-organization">Code organization</h2>
<p>Since this is a fairly small project focused on the back-end we will have all our server files within the root folder and won't go into detail for the front-end. The project will have these files:</p>
<ul>
<li><strong>public/</strong>: the folder for public assets.</li>
<li><strong>views/</strong>: the folder for the only view.</li>
<li><strong>index.js</strong>: the entry point and routers.</li>
<li><strong>model.js</strong>: the definition of the database structure.</li>
<li><strong>package.json</strong>: npm package where the dependencies and some info is.</li>
<li><strong>test.js</strong>: integration tests to make sure everything is working.</li>
<li><strong>todo.js</strong>: interaction with the database and main logic.</li>
</ul>
<p>You can see the whole working project in the repository:</p>
<p><strong>
<a href="https://github.com/franciscop/server-tutorial-todo" class="button">
Github Repository
</a>
</strong></p>
<h2 id="rest-api">REST API</h2>
<p>Let's first of all define our API. Let's keep it simple! Within index.js we write:</p>
<pre><code class="lang-js">// index.js
const server = require('server');
const { get, post, put, del } = server.router;
const { render } = server.reply;
const todo = require('./todo.js');
// Render the homepage for `/`
const home = get('/', ctx => render('index.hbs'));
// Add some API endpoints
const api = [
get('/todo', todo.read),
post('/todo', todo.create),
put('/todo/:id', todo.update),
del('/todo/:id', todo.delete)
];
// Launch the server with those
server(home, api);
</code></pre>
<p>This first loads the needed library and functions, then defines few routes and finally launches the server with those routes. We are using the default settings so no options are needed.</p>
<p>We are using the <a href="https://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD operation names</a>, but any of those is fairly common for the method names (just keep them consistent):</p>
<ul>
<li>get(): read, retrieve, all, list, select</li>
<li>post(): create, add, insert</li>
<li>put(): edit, update, change, modify</li>
<li>del(): delete, remove, destroy</li>
</ul>
<h2 id="database">Database</h2>
<p>We are using Mongoose (a layer on top of MongoDB) to implement database access. For this, we first have to create a small <code>model.js</code> where we define how our schema and model data looks like:</p>
<pre><code class="lang-js">// model.js
const mongoose = require('mongoose');
// Configure the Mongoose plugin
mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost/todo');
// define the Todo schema
const TodoSchema = mongoose.Schema({
text: { type: String, required: true },
done: { type: Boolean, required: true, default: false },
});
module.exports = mongoose.model('Todo', TodoSchema);
</code></pre>
<p>This way, all of our TODOs will have two fields, the text and a boolean indicating whether or not it's done.</p>
<p>The mongoose configuration <code>MONGODB_URI</code> <a href="https://serverjs.io/documentation/options/#environment">comes from the environment</a>.</p>
<h2 id="todos-logic">Todos logic</h2>
<p>Now, to write this code we create the file <code>todo.js</code> with this code:</p>
<pre><code class="lang-js">// todo.js
const { json } = require('server/reply');
const model = require('./schema');
export.read = async ctx => {};
export.create = async ctx => {};
export.update = async ctx => {};
export.delete = async ctx => {};
</code></pre>
<p>These are the 4 basic CRUD operations as shown before. This file will export these asynchronous functions, that will take the context argument <a href="https://serverjs.io/documentation/#middleware">as with any server.js middleware</a> and whatever they return will be used for the response.</p>
<p>Finally, let's implement the database access logic inside each of these 4 functions:</p>
<pre><code class="lang-js">// todo.js
const { status, json } = require('server/reply');
const Todo = require('./model');
exports.read = async (ctx) => {
return Todo.find().sort('done').lean().exec();
};
exports.create = async (ctx) => {
const item = new Todo({ text: ctx.data.text });
return status(201).json(await item.save());
};
exports.update = async (ctx) => {
const set = { $set: { done: ctx.data.done } };
await Todo.findByIdAndUpdate(ctx.params.id, set).exec();
return Todo.find().sort('done').lean().exec();
};
exports.delete = async (ctx) => {
return Todo.findByIdAndRemove(ctx.params.id).exec();
};
</code></pre>
<h2 id="testing">Testing</h2>
<blockquote class="error">This section describes a future API and <strong>it is not available yet</strong>. Now please use more traditional testing method.</blockquote>
<p>We will be using <a href="https://facebook.github.io/jest/">Jest</a> for testing, but you can use any library or framework that you prefer. We have to make a small change in our main <code>index.js</code>: we export the return value from server():</p>
<pre><code class="lang-js">// ...
module.exports = server(home, api);
</code></pre>
<p>Then we can import it from the integration tests. Let's create a <code>test.js</code>:</p>
<pre><code class="lang-js">// test.js
const run = require('server/test/run');
const server = require('./index.js');
describe('Homepage', () => {
it('renders the homepage', async () => {
const res = await run(server).get('/');
expect(res.status).toBe(200);
expect(res.body).toMatch(/\<h1\>TODO list<\/h1>/i);
});
});
</code></pre>
<h2 id="keep-reading">Keep reading</h2><p>Subscribe to our Mailchimp list to receive more tutorials when released:</p><a class="button" href="http://eepurl.com/cGRggH">Get Great Tutorials</a></div></div></article><script src="https://unpkg.com/[email protected]/paperdocs.min.js"></script><script src="https://unpkg.com/[email protected]/dist/smoothscroll.js"></script><script>// Some super simple heuristics
const is = {
mobile: "ontouchstart" in document.documentElement && window.innerWidth < 900,
desktop:
!("ontouchstart" in document.documentElement) && window.innerWidth > 900,
};
// Add language tag to the code for print
const regName = /lang(uage)?\-/;
const hasName = (name) => regName.test(name);
const map = { js: "javascript", jade: "pug" };
[].slice.call(document.querySelectorAll("pre code")).forEach(function (pre) {
if (!regName.test(pre.className)) return;
let name = pre.className.split(/\s+/).filter(hasName)[0].replace(regName, "");
pre.parentNode.setAttribute("data-language", name in map ? map[name] : name);
});
// Display the proper part in the TOC
const tocLinks = u(".toc [href]");
if (is.desktop) {
tocLinks
.filter((el) => {
return u(el).attr("href").split("#")[0] === window.location.pathname;
})
.parent()
.addClass("active");
}
// Build the search
if (u("article.documentation").length) {
const base = (el) => u(el).attr("href").split("#")[0];
const unique = (value, i, all) => all.indexOf(value) === i;
const searchLinks = tocLinks.nodes.map(base).filter(unique);
const all = {};
const headings = {};
Promise.all(
searchLinks.map((link) =>
fetch(link)
.then((res) => res.text())
.then((html) => {
u("<div>")
.html(html)
.find(
"article.documentation h1, article.documentation h2, article.documentation h3, article.documentation h4"
)
.each((el) => {
if (el.id) {
if (el.nodeName === "H1") {
headings[`${link}`] = u(el).text();
} else {
headings[`${link}#${el.id}`] = u(el).text();
}
}
});
all[link] = u("<div>")
.html(html)
.find("article.documentation .main")
.text()
.toLowerCase();
})
)
).then(() => {
const search = (term) => {
if (!term) {
u(".search").removeClass("active");
u(".searchbox").html("<ul></ul>");
u(".toc > ul").removeClass("hidden");
return;
}
u(".toc > ul").addClass("hidden");
u(".search").addClass("active");
const value = term.toLowerCase();
u(".searchbox").html("<ul></ul>");
const found = [];
for (let link in headings) {
if (headings[link].toLowerCase().includes(value)) {
found.push(link.split("#")[0]);
u(".searchbox ul").append(
`<li><a href="${link}">★ ${headings[link]}</a></li>`
);
}
}
let extra = false;
for (let link in all) {
if (all[link].includes(value) && !found.includes(link)) {
if (!extra) {
u(".searchbox ul").append(
'<li class="tip">Also mentioned here:</li>'
);
}
extra = true;
u(".searchbox ul").append(`<li><a href="${link}">${link}</a></li>`);
}
}
u(".searchbox a").on("click", (e) => {
u(".search").removeClass("active");
u(".search").first().value = "";
u(".searchbox").html("<ul></ul>");
u(".toc > ul").removeClass("hidden");
});
};
const initial = u(".search").first().value;
if (initial) {
search(initial);
}
// Autofocus only on desktop
if (is.desktop) {
u(".search").first().focus();
}
u(".search").on("input", (e) => {
search(e.target.value);
});
u(".searchform").handle("submit", (e) => {
search(u(".search").first().value);
u(".searchbox a").first().click();
});
});
}
u(".main h2, .main h3, .main h4, .main h5").each((el) => {
const path = `${window.location.pathname.split("#")[0]}#${el.id}`;
u(el).html(
`<a href="${path}"><span class="self">#</span>${u(el).html()}</a>`
);
});
// Remove an incorrect "get" that there was highlighted
Prism.hooks.add("after-highlight", function (env) {
u("span.token.keyword").each((el) => {
if (el.innerHTML === "get") {
if (el.nextElementSibling && el.nextElementSibling.innerHTML === "(") {
u(el).replace('<span class="token function">get</span>');
} else {
u(el).replace("get");
}
}
if (el.innerHTML === "delete") {
if (
el.previousElementSibling &&
el.previousElementSibling.innerHTML === "."
) {
u(el).replace("delete");
}
}
if (el.innerHTML === "public") u(el).replace("public");
});
});
// Syntax highlighting changes vertical align. This makes it to scroll back
// to the current hash (if any) after page load+highlight
const hash = window.location.hash;
if (hash && u(hash).length) {
u(hash).scroll();
}
// Show more/less when clicking the chevron
u(".toc .more").handle("click", (e) => {
const container = u(e.currentTarget).closest("li");
const child = container.find("ul").nodes[0];
const height = container.hasClass("active") ? 0 : child.scrollHeight;
child.style.maxHeight = height + "px";
container.toggleClass("active");
});
// Go to the appropriate part of the page when clicking an internal link
// Manual event delegation
u("article").on("click", (e) => {
if (e.target.nodeName !== "A") return;
const href = u(e.target).attr("href");
if (!href) return;
const [url, hash] = href.split("#");
// If it is the current URL just go to the top
if (url === window.location.pathname && !hash) {
e.preventDefault();
u("body").scroll();
history.replaceState(null, null, window.location.pathname);
return;
}
// If it is an internal link go to that part
if ((!url || url === window.location.pathname) && u("#" + hash).length) {
e.preventDefault();
u("#" + hash).scroll();
history.replaceState(null, null, "#" + hash);
}
});
// Google analytics
(function (i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(
window,
document,
"script",
"https://www.google-analytics.com/analytics.js",
"ga"
);
ga("create", "UA-63739359-2", "auto");
ga("send", "pageview");
// Hopefully avoid email scrapping
setTimeout(function () {
u("a.email").attr(
"href",
"mailto:public" + "@francisco.i" + "o?subject=server.js"
);
}, 2000);
</script></body></html> | {
"pile_set_name": "Github"
} |
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) 2019, the University of Queensland
* Author: Alex Wilson <[email protected]>
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <stdint.h>
#include <stddef.h>
#include <errno.h>
#include <strings.h>
#include <limits.h>
#include <err.h>
#include <fcntl.h>
#if defined(__APPLE__)
#include <PCSC/wintypes.h>
#include <PCSC/winscard.h>
#else
#include <wintypes.h>
#include <winscard.h>
#endif
#include <sys/types.h>
#include <sys/errno.h>
#include "debug.h"
#if defined(__sun)
#include <sys/fork.h>
#endif
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/un.h>
#include <sys/socket.h>
#include "libssh/sshkey.h"
#include "libssh/sshbuf.h"
#include "libssh/digest.h"
#include "libssh/ssherr.h"
#include "libssh/authfd.h"
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include "tlv.h"
#include "errf.h"
#include "ebox.h"
#include "piv.h"
#include "bunyan.h"
#include <pwd.h>
#include <dirent.h>
#define PAM_SM_AUTH
#include <security/pam_modules.h>
#define PIVY_AGENT_ENV_DIR "%s/.config/pivy-agent"
#define PIVY_AGENT_ENV_FILE "%s/.config/pivy-agent/%s"
#define PIVY_AGENT_SOCKET "%s/piv-ssh-%s.socket"
#define SSH_AUTH_KEYS "%s/.ssh/authorized_keys"
struct keylist {
struct sshkey *kl_key;
char *kl_comment;
struct keylist *kl_next;
};
struct tkconfig {
struct tkconfig *tkc_next;
char *tkc_source;
char *tkc_sockpath;
char *tkc_guidhex;
struct sshkey *tkc_cak;
};
static const char *
pin_type_to_name(enum piv_pin type)
{
switch (type) {
case PIV_PIN:
return ("PIV PIN");
case PIV_GLOBAL_PIN:
return ("Global PIN");
case PIV_PUK:
return ("PUK");
default:
return ("Password");
}
}
static char *
piv_token_shortid(struct piv_token *pk)
{
char *guid;
if (piv_token_has_chuid(pk)) {
guid = strdup(piv_token_guid_hex(pk));
} else {
guid = strdup("0000000000");
}
guid[8] = '\0';
return (guid);
}
static int
get_agent_socket(const char *authsocket, int *fdp)
{
int sock, oerrno;
struct sockaddr_un sunaddr;
if (fdp != NULL)
*fdp = -1;
memset(&sunaddr, 0, sizeof(sunaddr));
sunaddr.sun_family = AF_UNIX;
strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
return SSH_ERR_SYSTEM_ERROR;
/* close on exec */
if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1 ||
connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) {
oerrno = errno;
close(sock);
errno = oerrno;
return SSH_ERR_SYSTEM_ERROR;
}
if (fdp != NULL)
*fdp = sock;
else
close(sock);
return 0;
}
PAM_EXTERN int
pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv)
{
const char *user, *env;
const struct passwd *pwent;
int res = PAM_AUTHINFO_UNAVAIL;
int rc;
SCARDCONTEXT ctx;
struct piv_token *tokens = NULL, *token;
struct keylist *keys = NULL, *keyle, *nkeyle;
struct tkconfig *tkcs = NULL, *tkc, *ntkc;
char *akpath = NULL, *lbuf = NULL, *cp, *spath = NULL, *rdir = NULL;
char *pin = NULL;
size_t lsz;
struct dirent *de;
struct piv_slot *slot;
DIR *d = NULL;
FILE *f = NULL;
errf_t *err = NULL;
int fd;
if ((res = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS)
return (res);
pwent = getpwnam(user);
if (pwent == NULL)
return (PAM_AUTHINFO_UNAVAIL);
res = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &ctx);
if (res != SCARD_S_SUCCESS)
return (PAM_AUTHINFO_UNAVAIL);
akpath = malloc(PATH_MAX);
if (akpath == NULL) {
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
snprintf(akpath, PATH_MAX, SSH_AUTH_KEYS, pwent->pw_dir);
f = fopen(akpath, "r");
if (f == NULL) {
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
while (getline(&lbuf, &lsz, f) != -1) {
cp = lbuf;
while (*cp == ' ' || *cp == '\t')
++cp;
if (!*cp || *cp == '\n' || *cp == '#')
continue;
keyle = calloc(1, sizeof (struct keylist));
if (keyle == NULL) {
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
keyle->kl_next = keys;
keyle->kl_key = sshkey_new(KEY_UNSPEC);
if (sshkey_read(keyle->kl_key, &cp) != 0) {
sshkey_free(keyle->kl_key);
free(keyle);
continue;
}
while (*cp == ' ' || *cp == '\t')
++cp;
cp[strlen(cp) - 1] = '\0';
keyle->kl_comment = strdup(cp);
keys = keyle;
}
fclose(f);
f = NULL;
if (keys == NULL) {
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
spath = malloc(PATH_MAX);
if (spath == NULL) {
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
env = getenv("XDG_RUNTIME_DIR");
if (env != NULL) {
rdir = strdup(env);
} else {
rdir = malloc(PATH_MAX);
snprintf(rdir, PATH_MAX, "/run/user/%d", pwent->pw_uid);
}
snprintf(akpath, PATH_MAX, PIVY_AGENT_ENV_DIR, pwent->pw_dir);
d = opendir(akpath);
if (d != NULL) {
while ((de = readdir(d)) != NULL) {
snprintf(akpath, PATH_MAX, PIVY_AGENT_ENV_FILE,
pwent->pw_dir, de->d_name);
f = fopen(akpath, "r");
if (f == NULL)
continue;
tkc = calloc(1, sizeof (struct tkconfig));
if (tkc == NULL) {
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
tkc->tkc_next = tkcs;
tkc->tkc_source = strdup(akpath);
snprintf(spath, PATH_MAX, PIVY_AGENT_SOCKET,
rdir, de->d_name);
tkc->tkc_sockpath = strdup(spath);
while (getline(&lbuf, &lsz, f) != -1) {
if (strncmp(lbuf, "PIV_AGENT_GUID=", 15) == 0) {
cp = lbuf + 15;
cp[strlen(cp) - 1] = '\0';
tkc->tkc_guidhex = strdup(cp);
} else if (strncmp(lbuf, "PIV_AGENT_CAK=", 14)
== 0) {
tkc->tkc_cak = sshkey_new(KEY_UNSPEC);
cp = lbuf + 14;
while (*cp == ' ' || *cp == '"')
++cp;
while (cp[strlen(cp) - 1] == '\n')
cp[strlen(cp) - 1] = '\0';
while (cp[strlen(cp) - 1] == '"')
cp[strlen(cp) - 1] = '\0';
if (sshkey_read(tkc->tkc_cak, &cp) != 0) {
sshkey_free(tkc->tkc_cak);
tkc->tkc_cak = NULL;
continue;
}
}
}
if (tkc->tkc_guidhex == NULL || tkc->tkc_cak == NULL) {
sshkey_free(tkc->tkc_cak);
free(tkc->tkc_guidhex);
free(tkc->tkc_source);
free(tkc);
continue;
}
tkcs = tkc;
fclose(f);
f = NULL;
}
closedir(d);
d = NULL;
}
err = piv_enumerate(ctx, &tokens);
if (err) {
errf_free(err);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
for (token = tokens; token != NULL; token = piv_token_next(token)) {
int found = 0;
for (tkc = tkcs; tkc != NULL; tkc = tkc->tkc_next) {
const int cmp = strncasecmp(tkc->tkc_guidhex,
piv_token_guid_hex(token),
strlen(tkc->tkc_guidhex));
if (cmp == 0) {
err = piv_txn_begin(token);
if (err) {
errf_free(err);
continue;
}
err = piv_select(token);
if (err == NULL)
err = piv_read_all_certs(token);
slot = piv_get_slot(token, PIV_SLOT_CARD_AUTH);
if (err == NULL && slot != NULL) {
err = piv_auth_key(token, slot,
tkc->tkc_cak);
}
if (err) {
piv_txn_end(token);
errf_free(err);
continue;
}
slot = NULL;
while ((slot = piv_slot_next(token, slot))) {
const struct sshkey *pubk =
piv_slot_pubkey(slot);
for (keyle = keys; keyle != NULL;
keyle = keyle->kl_next) {
if (sshkey_equal_public(
keyle->kl_key,
pubk)) {
found = 1;
break;
}
}
if (found)
break;
}
if (found)
break;
piv_txn_end(token);
}
}
if (!found)
continue;
again:
err = piv_auth_key(token, slot, piv_slot_pubkey(slot));
if (errf_caused_by(err, "PermissionError")) {
uint retries = 1;
enum piv_pin auth = piv_token_default_auth(token);
char *prompt, *shortid;
struct pam_conv *conv;
struct pam_message msg;
const struct pam_message *pmsg[1];
struct pam_response *resp;
errf_free(err);
res = pam_get_item(pamh, PAM_CONV,
(const void **)&conv);
if (res != PAM_SUCCESS || !conv || !conv->conv) {
piv_txn_end(token);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
prompt = malloc(PATH_MAX);
if (prompt == NULL) {
piv_txn_end(token);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
shortid = piv_token_shortid(token);
snprintf(prompt, PATH_MAX, "%s for token %s: ",
pin_type_to_name(auth), shortid);
free(shortid);
pmsg[0] = &msg;
msg.msg = prompt;
msg.msg_style = PAM_PROMPT_ECHO_OFF;
res = conv->conv(1, pmsg, &resp, conv->appdata_ptr);
free(prompt);
if (res != PAM_SUCCESS) {
piv_txn_end(token);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
if (!resp || !resp->resp) {
piv_txn_end(token);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
err = piv_verify_pin(token, auth, resp->resp, &retries,
B_FALSE);
if (err) {
piv_txn_end(token);
res = PAM_AUTH_ERR;
goto out;
}
if (pin != NULL) {
explicit_bzero(pin, strlen(pin));
free(pin);
}
pin = strdup(resp->resp);
explicit_bzero(resp->resp, strlen(resp->resp));
free(resp->resp);
free(resp);
goto again;
}
piv_txn_end(token);
if (err != NULL) {
errf_free(err);
continue;
}
if (pin != NULL &&
get_agent_socket(tkc->tkc_sockpath, &fd) == 0) {
struct sshbuf *req;
uint8_t code;
req = sshbuf_new();
if (req == NULL) {
close(fd);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
if ((rc = sshbuf_put_u8(req,
SSH_AGENTC_UNLOCK))) {
sshbuf_free(req);
close(fd);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
if ((rc = sshbuf_put_cstring(req, pin))) {
sshbuf_free(req);
close(fd);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
rc = ssh_request_reply(fd, req, req);
close(fd);
if (rc) {
sshbuf_free(req);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
if ((rc = sshbuf_get_u8(req, &code))) {
sshbuf_free(req);
res = PAM_AUTHINFO_UNAVAIL;
goto out;
}
sshbuf_free(req);
}
res = PAM_SUCCESS;
goto out;
}
res = PAM_AUTHINFO_UNAVAIL;
out:
if (f != NULL)
fclose(f);
if (d != NULL)
closedir(d);
for (keyle = keys; keyle != NULL; keyle = nkeyle) {
nkeyle = keyle->kl_next;
free(keyle->kl_comment);
sshkey_free(keyle->kl_key);
free(keyle);
}
for (tkc = tkcs; tkc != NULL; tkc = ntkc) {
ntkc = tkc->tkc_next;
free(tkc->tkc_source);
free(tkc->tkc_guidhex);
free(tkc->tkc_sockpath);
sshkey_free(tkc->tkc_cak);
free(tkc);
}
free(akpath);
free(spath);
free(lbuf);
free(rdir);
if (pin != NULL) {
explicit_bzero(pin, strlen(pin));
free(pin);
pin = NULL;
}
piv_release(tokens);
SCardReleaseContext(ctx);
return (res);
}
PAM_EXTERN int
pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv)
{
if (flags & PAM_DELETE_CRED)
return (PAM_SUCCESS);
if (flags & PAM_REFRESH_CRED)
return (PAM_SUCCESS);
if (flags & PAM_REINITIALIZE_CRED)
return (PAM_SUCCESS);
if (!(flags & PAM_ESTABLISH_CRED))
return (PAM_SERVICE_ERR);
/* We don't do anything else currently. */
return (PAM_SUCCESS);
}
| {
"pile_set_name": "Github"
} |
//
// CRC32AppDelegate.h
// CRC32
//
// Created by Pichaya Srifar on 11/8/11.
// Copyright Vervata 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
@class CRC32ViewController;
@interface CRC32AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
CRC32ViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet CRC32ViewController *viewController;
@end
| {
"pile_set_name": "Github"
} |
/* metaflac - Command-line FLAC metadata editor
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "options.h"
#include "utils.h"
#include "FLAC/assert.h"
#include "FLAC/metadata.h"
#include "share/compat.h"
#include <string.h>
#include "operations_shorthand.h"
FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write)
{
unsigned i;
FLAC__bool ok = true;
FLAC__StreamMetadata *block;
FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new();
if(0 == iterator)
die("out of memory allocating iterator");
FLAC__metadata_iterator_init(iterator, chain);
block = FLAC__metadata_iterator_get_block(iterator);
FLAC__ASSERT(0 != block);
FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO);
if(prefix_with_filename)
flac_printf("%s:", filename);
switch(operation->type) {
case OP__SHOW_MD5SUM:
for(i = 0; i < 16; i++)
printf("%02x", block->data.stream_info.md5sum[i]);
printf("\n");
break;
case OP__SHOW_MIN_BLOCKSIZE:
printf("%u\n", block->data.stream_info.min_blocksize);
break;
case OP__SHOW_MAX_BLOCKSIZE:
printf("%u\n", block->data.stream_info.max_blocksize);
break;
case OP__SHOW_MIN_FRAMESIZE:
printf("%u\n", block->data.stream_info.min_framesize);
break;
case OP__SHOW_MAX_FRAMESIZE:
printf("%u\n", block->data.stream_info.max_framesize);
break;
case OP__SHOW_SAMPLE_RATE:
printf("%u\n", block->data.stream_info.sample_rate);
break;
case OP__SHOW_CHANNELS:
printf("%u\n", block->data.stream_info.channels);
break;
case OP__SHOW_BPS:
printf("%u\n", block->data.stream_info.bits_per_sample);
break;
case OP__SHOW_TOTAL_SAMPLES:
printf("%" PRIu64 "\n", block->data.stream_info.total_samples);
break;
case OP__SET_MD5SUM:
memcpy(block->data.stream_info.md5sum, operation->argument.streaminfo_md5.value, 16);
*needs_write = true;
break;
case OP__SET_MIN_BLOCKSIZE:
block->data.stream_info.min_blocksize = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_MAX_BLOCKSIZE:
block->data.stream_info.max_blocksize = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_MIN_FRAMESIZE:
block->data.stream_info.min_framesize = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_MAX_FRAMESIZE:
block->data.stream_info.max_framesize = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_SAMPLE_RATE:
block->data.stream_info.sample_rate = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_CHANNELS:
block->data.stream_info.channels = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_BPS:
block->data.stream_info.bits_per_sample = operation->argument.streaminfo_uint32.value;
*needs_write = true;
break;
case OP__SET_TOTAL_SAMPLES:
block->data.stream_info.total_samples = operation->argument.streaminfo_uint64.value;
*needs_write = true;
break;
default:
ok = false;
FLAC__ASSERT(0);
break;
};
FLAC__metadata_iterator_delete(iterator);
return ok;
}
| {
"pile_set_name": "Github"
} |
//
// Wells
// --------------------------------------------------
// Base class
.well {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background-color: @wellBackground;
border: 1px solid darken(@wellBackground, 7%);
.border-radius(@baseBorderRadius);
.box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
blockquote {
border-color: #ddd;
border-color: rgba(0,0,0,.15);
}
}
// Sizes
.well-large {
padding: 24px;
.border-radius(@borderRadiusLarge);
}
.well-small {
padding: 9px;
.border-radius(@borderRadiusSmall);
}
| {
"pile_set_name": "Github"
} |
# RTRootNavigationController
[](https://travis-ci.org/rickytan/RTRootNavigationController)
[](http://cocoapods.org/pods/RTRootNavigationController)
[](http://cocoapods.org/pods/RTRootNavigationController)
[](http://cocoapods.org/pods/RTRootNavigationController)
## iPhone X
How many lines of code should I write to fit in iPhone X? Zero.
我需要写多少代码来适配 **iPhone X**?0。

## Introduction
More and more apps use custom navigation bar for each different view controller, instead of one common, global navigation bar.
This project just help develops to solve this problem in a tricky way, develops use this navigation controller in a farmilar way just like you used to be, and you can have each view controller a individual navigation bar.
越来越多的应用为每一个 **VC** 设置单独的导航条,而不是之前那样使用一个全局统一的导航条,因为不同的 **VC** 有不同的视觉样式,前一个是蓝色的,后一个也许要做成红色、透明,或者干脆没有导航条。
虽然开发者可以在每个 **VC** 的 `- (void)viewWillAppear` (想想为什么不是 `- (void)viewDidLoad`) 方法中设置自己所需的样式,但是在同一个导航条上来回修改,稍不注意就会导致样式混乱。另一种实现方式,是隐藏全局那个导航条,每个 **VC** 自己通过 `addSubview:(UIView *)view` 的方式自己设置导航条。这种实现是可行的,但是使用不方便了,如:
- 无法使用 `self.navigationItem.rightBarButtonItem` 等来设置导航按钮,而必须自己手动往 `navigationBar` 上加;
- 无法使用 `self.title` 来修改导航标题,而必须自己添加监听;
- 无法方便地设置 `navigationBarHidden`;
- 无法方便地自动调整 `contentInsets`。
等等。
本项目提供一种透明的方式,让开发者像以前一样使用导航器,同时,每个 `push` 进来的 **VC** 有自己独立的导航条。
## Features
* Custom navigation bar class support
* Unwind support
* Rotation support
* Interactive pop enable and disable support
* `Interface Builder` support
* 每个 **VC** 支持自定义的 `navigationBarClass`
* 支持 `unwind`(不知道什么是 `unwind`?请参考:[这里](https://developer.apple.com/library/ios/technotes/tn2298/_index.html))
* 支持转屏
* 支持禁用交互式返回
* 支持 `Interface Builder`


## Usage
As an advise, please set `RTRootNavigationController` as your rootViewController:
```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIViewController *yourController = ...;
self.window.rootViewController = [[RTRootNavigationController alloc] initWithRootViewController:yourController];
return YES;
}
```
you can implement following method to customize back bar button item (**Recommended**):
```objective-c
- (UIBarButtonItem *)rt_customBackItemWithTarget:(id)target
action:(SEL)action
{
return [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil)
style:UIBarButtonItemStylePlain
target:target
action:action];
}
```
or just set `useSystemBackBarButtonItem` to **YES** and use the default one.
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## __Notice__(Only for below v0.6)
Your **ViewController** hierarchy will change to:
```
RTRootNavigationController
`- RTContainerViewController
| `- RTContainerNavigationController
| `- YourViewController1
`- RTContainerViewController
`- RTContainerNavigationController
`- YourViewController2
```
So, if you access `self.navigationController` it returns a container navigation controller, and its `viewControllers` will always be **1**, i.e. `self`. Instead, your have to use `self.rt_navigationController.rt_viewController` to get all siblings, as metioned **[Here](https://github.com/rickytan/RTRootNavigationController/blob/master/RTRootNavigationController/Classes/UIViewController%2BRTRootNavigationController.h#L36)** and **[Here](https://github.com/rickytan/RTRootNavigationController/blob/master/RTRootNavigationController/Classes/RTRootNavigationController.h#L81)**.
## Requirements
* **iOS 7** and up
* **Xcode 7** and up
## Installation
RTRootNavigationController is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "RTRootNavigationController"
```
## Author
rickytan, [email protected]
## Alternatives
- [**JTNavigationController**](https://github.com/JNTian/JTNavigationController)
- 支持全屏返回
- [**FDFullscreenPopGesture**](https://github.com/forkingdog/FDFullscreenPopGesture)
- 使用原生的 *UINavigationController*,在 `- (void)viewWillAppear` 中做处理
- 支持全屏返回
## Apps Integrated
* [网易美学](https://itunes.apple.com/cn/app/%E7%BD%91%E6%98%93%E7%BE%8E%E5%AD%A6-%E9%A2%9C%E5%80%BC%E6%9C%80%E9%AB%98%E7%9A%84%E7%BE%8E%E5%A6%86%E7%A4%BE%E5%8C%BA/id1147533466?mt=8)
## License
RTRootNavigationController is available under the MIT license. See the LICENSE file for more info.
| {
"pile_set_name": "Github"
} |
--- a/arch/arm/boot/dts/armada-388-rd.dts
+++ b/arch/arm/boot/dts/armada-388-rd.dts
@@ -77,6 +77,16 @@
compatible = "st,m25p128";
reg = <0>; /* Chip select 0 */
spi-max-frequency = <108000000>;
+
+ partition@0 {
+ label = "uboot";
+ reg = <0 0x400000>;
+ };
+
+ partition@1 {
+ label = "firmware";
+ reg = <0x400000 0xc00000>;
+ };
};
};
| {
"pile_set_name": "Github"
} |
const child_process = require('child_process')
const result = child_process.execFileSync("src/test/testscript.py")
console.log(result.toString())
| {
"pile_set_name": "Github"
} |
// Import module from source
import Phenomenon from '../../dist/phenomenon';
// Import optional utils
import { getRandom, rgbToHsl, rotateY } from './utils';
// Material colors in HSL
const colors = [[255, 108, 0], [83, 109, 254], [29, 233, 182], [253, 216, 53]].map(color =>
rgbToHsl(color)
);
// Boolean to toggle dynamic attributes
const dynamicAttributes = true;
// Update value for every frame
const step = 0.01;
// Multiplier of the canvas resolution
const devicePixelRatio = 1;
// Create the renderer
const phenomenon = new Phenomenon({
settings: {
devicePixelRatio,
position: { x: 0, y: 0, z: 3 },
onRender: r => {
rotateY(r.uniforms.uModelMatrix.value, step * 2);
},
},
});
let count = 0;
function addInstance() {
count += 1;
// The amount of particles that will be created
const multiplier = 4000;
// Percentage of how long every particle will move
const duration = 0.6;
// Base start position (center of the cube)
const start = {
x: getRandom(1),
y: getRandom(1),
z: getRandom(1),
};
// Base end position (center of the cube)
const end = {
x: getRandom(1),
y: getRandom(1),
z: getRandom(1),
};
// Every attribute must have:
// - Name (used in the shader)
// - Data (returns data for every particle)
// - Size (amount of variables in the data)
const attributes = [
{
name: 'aPositionStart',
data: () => [start.x + getRandom(0.1), start.y + getRandom(0.1), start.z + getRandom(0.1)],
size: 3,
},
{
name: 'aPositionEnd',
data: () => [end.x + getRandom(0.1), end.y + getRandom(0.1), end.z + getRandom(0.1)],
size: 3,
},
{
name: 'aColor',
data: () => colors[count % 4],
size: 3,
},
{
name: 'aOffset',
data: i => [i * ((1 - duration) / (multiplier - 1))],
size: 1,
},
];
// Every uniform must have:
// - Key (used in the shader)
// - Type (what kind of value)
// - Value (based on the type)
const uniforms = {
uProgress: {
type: 'float',
value: 0.0,
},
};
// Vertex shader used to calculate the position
const vertex = `
attribute vec3 aPositionStart;
attribute vec3 aPositionEnd;
attribute vec3 aPosition;
attribute vec3 aColor;
attribute float aOffset;
uniform float uProgress;
uniform mat4 uProjectionMatrix;
uniform mat4 uModelMatrix;
uniform mat4 uViewMatrix;
varying vec3 vColor;
float easeInOutQuint(float t){
return t < 0.5 ? 16.0 * t * t * t * t * t : 1.0 + 16.0 * (--t) * t * t * t * t;
}
void main(){
float tProgress = easeInOutQuint(min(1.0, max(0.0, (uProgress - aOffset)) / ${duration}));
vec3 newPosition = mix(aPositionStart, aPositionEnd, tProgress);
gl_Position = uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(newPosition + aPosition, 1.0);
gl_PointSize = ${devicePixelRatio.toFixed(1)};
vColor = aColor;
}
`;
// Fragment shader to draw the colored pixels to the canvas
const fragment = `
precision mediump float;
varying vec3 vColor;
void main(){
gl_FragColor = vec4(vColor, 1.0);
}
`;
// Boolean to switch transition direction
let forward = true;
// Add an instance to the renderer
phenomenon.add(count, {
attributes,
multiplier,
vertex,
fragment,
uniforms,
onRender: r => {
const { uProgress } = r.uniforms;
uProgress.value += forward ? step : -step;
if (uProgress.value >= 1) {
if (dynamicAttributes) {
const newEnd = {
x: getRandom(1),
y: getRandom(1),
z: getRandom(1),
};
r.prepareBuffer({
name: 'aPositionStart',
data: r.attributes[1].data,
size: 3,
});
r.prepareAttribute({
name: 'aPositionEnd',
data: () => [
newEnd.x + getRandom(0.1),
newEnd.y + getRandom(0.1),
newEnd.z + getRandom(0.1),
],
size: 3,
});
uProgress.value = 0;
} else {
forward = false;
}
} else if (uProgress.value <= 0) forward = true;
},
});
}
for (let i = 0; i < 10; i += 1) {
addInstance();
}
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// <functional>
// negate
#include <functional>
#include <type_traits>
#include <cassert>
#include "test_macros.h"
int main(int, char**)
{
typedef std::negate<int> F;
const F f = F();
static_assert((std::is_same<F::argument_type, int>::value), "" );
static_assert((std::is_same<F::result_type, int>::value), "" );
assert(f(36) == -36);
#if TEST_STD_VER > 11
typedef std::negate<> F2;
const F2 f2 = F2();
assert(f2(36) == -36);
assert(f2(36L) == -36);
assert(f2(36.0) == -36);
constexpr int foo = std::negate<int> () (3);
static_assert ( foo == -3, "" );
constexpr double bar = std::negate<> () (3.0);
static_assert ( bar == -3.0, "" );
#endif
return 0;
}
| {
"pile_set_name": "Github"
} |
/*
This file is part of Warzone 2100.
Copyright (C) 1999-2004 Eidos Interactive
Copyright (C) 2005-2020 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Feature.c
*
* Load feature stats
*/
#include "lib/framework/frame.h"
#include "lib/gamelib/gtime.h"
#include "lib/sound/audio.h"
#include "lib/sound/audio_id.h"
#include "lib/netplay/netplay.h"
#include "lib/ivis_opengl/imd.h"
#include "lib/ivis_opengl/ivisdef.h"
#include "feature.h"
#include "map.h"
#include "hci.h"
#include "power.h"
#include "objects.h"
#include "display.h"
#include "order.h"
#include "structure.h"
#include "miscimd.h"
#include "visibility.h"
#include "effects.h"
#include "scores.h"
#include "combat.h"
#include "multiplay.h"
#include "mapgrid.h"
#include "display3d.h"
#include "random.h"
/* The statistics for the features */
FEATURE_STATS *asFeatureStats;
UDWORD numFeatureStats;
//Value is stored for easy access to this feature in destroyDroid()/destroyStruct()
FEATURE_STATS *oilResFeature = nullptr;
void featureInitVars()
{
asFeatureStats = nullptr;
numFeatureStats = 0;
oilResFeature = nullptr;
}
/* Load the feature stats */
bool loadFeatureStats(WzConfig &ini)
{
ASSERT(ini.isAtDocumentRoot(), "WzConfig instance is in the middle of traversal");
std::vector<WzString> list = ini.childGroups();
asFeatureStats = new FEATURE_STATS[list.size()];
numFeatureStats = list.size();
for (int i = 0; i < list.size(); ++i)
{
ini.beginGroup(list[i]);
asFeatureStats[i] = FEATURE_STATS(STAT_FEATURE + i);
FEATURE_STATS *p = &asFeatureStats[i];
p->name = ini.string(WzString::fromUtf8("name"));
p->id = list[i];
WzString subType = ini.value("type").toWzString();
if (subType == "TANK WRECK")
{
p->subType = FEAT_TANK;
}
else if (subType == "GENERIC ARTEFACT")
{
p->subType = FEAT_GEN_ARTE;
}
else if (subType == "OIL RESOURCE")
{
p->subType = FEAT_OIL_RESOURCE;
}
else if (subType == "BOULDER")
{
p->subType = FEAT_BOULDER;
}
else if (subType == "VEHICLE")
{
p->subType = FEAT_VEHICLE;
}
else if (subType == "BUILDING")
{
p->subType = FEAT_BUILDING;
}
else if (subType == "OIL DRUM")
{
p->subType = FEAT_OIL_DRUM;
}
else if (subType == "TREE")
{
p->subType = FEAT_TREE;
}
else if (subType == "SKYSCRAPER")
{
p->subType = FEAT_SKYSCRAPER;
}
else
{
ASSERT(false, "Unknown feature type: %s", subType.toUtf8().c_str());
}
p->psImd = modelGet(ini.value("model").toWzString());
p->baseWidth = ini.value("width", 1).toInt();
p->baseBreadth = ini.value("breadth", 1).toInt();
p->tileDraw = ini.value("tileDraw", 1).toInt();
p->allowLOS = ini.value("lineOfSight", 1).toInt();
p->visibleAtStart = ini.value("startVisible", 1).toInt();
p->damageable = ini.value("damageable", 1).toInt();
p->body = ini.value("hitpoints", 1).toInt();
p->armourValue = ini.value("armour", 1).toInt();
//and the oil resource - assumes only one!
if (asFeatureStats[i].subType == FEAT_OIL_RESOURCE)
{
oilResFeature = &asFeatureStats[i];
}
ini.endGroup();
}
return true;
}
/* Release the feature stats memory */
void featureStatsShutDown()
{
delete[] asFeatureStats;
asFeatureStats = nullptr;
numFeatureStats = 0;
}
/** Deals with damage to a feature
* \param psFeature feature to deal damage to
* \param damage amount of damage to deal
* \param weaponClass,weaponSubClass the class and subclass of the weapon that deals the damage
* \return < 0 never, >= 0 always
*/
int32_t featureDamage(FEATURE *psFeature, unsigned damage, WEAPON_CLASS weaponClass, WEAPON_SUBCLASS weaponSubClass, unsigned impactTime, bool isDamagePerSecond, int minDamage)
{
int32_t relativeDamage;
ASSERT_OR_RETURN(0, psFeature != nullptr, "Invalid feature pointer");
debug(LOG_ATTACK, "feature (id %d): body %d armour %d damage: %d",
psFeature->id, psFeature->body, psFeature->psStats->armourValue, damage);
relativeDamage = objDamage(psFeature, damage, psFeature->psStats->body, weaponClass, weaponSubClass, isDamagePerSecond, minDamage);
// If the shell did sufficient damage to destroy the feature
if (relativeDamage < 0)
{
debug(LOG_ATTACK, "feature (id %d) DESTROYED", psFeature->id);
destroyFeature(psFeature, impactTime);
return relativeDamage * -1;
}
else
{
return relativeDamage;
}
}
/* Create a feature on the map */
FEATURE *buildFeature(FEATURE_STATS *psStats, UDWORD x, UDWORD y, bool FromSave)
{
//try and create the Feature
FEATURE *psFeature = new FEATURE(generateSynchronisedObjectId(), psStats);
if (psFeature == nullptr)
{
debug(LOG_WARNING, "Feature couldn't be built.");
return nullptr;
}
//add the feature to the list - this enables it to be drawn whilst being built
addFeature(psFeature);
// snap the coords to a tile
if (!FromSave)
{
x = (x & ~TILE_MASK) + psStats->baseWidth % 2 * TILE_UNITS / 2;
y = (y & ~TILE_MASK) + psStats->baseBreadth % 2 * TILE_UNITS / 2;
}
else
{
if ((x & TILE_MASK) != psStats->baseWidth % 2 * TILE_UNITS / 2 ||
(y & TILE_MASK) != psStats->baseBreadth % 2 * TILE_UNITS / 2)
{
debug(LOG_WARNING, "Feature not aligned. position (%d,%d), size (%d,%d)", x, y, psStats->baseWidth, psStats->baseBreadth);
}
}
psFeature->pos.x = x;
psFeature->pos.y = y;
StructureBounds b = getStructureBounds(psFeature);
// get the terrain average height
int foundationMin = INT32_MAX;
int foundationMax = INT32_MIN;
for (int breadth = 0; breadth <= b.size.y; ++breadth)
{
for (int width = 0; width <= b.size.x; ++width)
{
int h = map_TileHeight(b.map.x + width, b.map.y + breadth);
foundationMin = std::min(foundationMin, h);
foundationMax = std::max(foundationMax, h);
}
}
//return the average of max/min height
int height = (foundationMin + foundationMax) / 2;
if (psStats->subType == FEAT_TREE)
{
psFeature->rot.direction = gameRand(DEG_360);
}
else
{
psFeature->rot.direction = 0;
}
psFeature->body = psStats->body;
psFeature->periodicalDamageStart = 0;
psFeature->periodicalDamage = 0;
// it has never been drawn
psFeature->sDisplay.frameNumber = 0;
memset(psFeature->seenThisTick, 0, sizeof(psFeature->seenThisTick));
memset(psFeature->visible, 0, sizeof(psFeature->visible));
// set up the imd for the feature
psFeature->sDisplay.imd = psStats->psImd;
ASSERT_OR_RETURN(nullptr, psFeature->sDisplay.imd, "No IMD for feature"); // make sure we have an imd.
for (int breadth = 0; breadth < b.size.y; ++breadth)
{
for (int width = 0; width < b.size.x; ++width)
{
MAPTILE *psTile = mapTile(b.map.x + width, b.map.y + breadth);
//check not outside of map - for load save game
ASSERT_OR_RETURN(nullptr, b.map.x + width < mapWidth, "x coord bigger than map width - %s, id = %d", getName(psFeature->psStats), psFeature->id);
ASSERT_OR_RETURN(nullptr, b.map.y + breadth < mapHeight, "y coord bigger than map height - %s, id = %d", getName(psFeature->psStats), psFeature->id);
if (width != psStats->baseWidth && breadth != psStats->baseBreadth)
{
if (TileHasFeature(psTile))
{
FEATURE *psBlock = (FEATURE *)psTile->psObject;
debug(LOG_ERROR, "%s(%d) already placed at (%d+%d, %d+%d) when trying to place %s(%d) at (%d+%d, %d+%d) - removing it",
getName(psBlock->psStats), psBlock->id, map_coord(psBlock->pos.x), psBlock->psStats->baseWidth, map_coord(psBlock->pos.y),
psBlock->psStats->baseBreadth, getName(psFeature->psStats), psFeature->id, b.map.x, b.size.x, b.map.y, b.size.y);
removeFeature(psBlock);
}
psTile->psObject = (BASE_OBJECT *)psFeature;
// if it's a tall feature then flag it in the map.
if (psFeature->sDisplay.imd->max.y > TALLOBJECT_YMAX)
{
auxSetBlocking(b.map.x + width, b.map.y + breadth, AIR_BLOCKED);
}
if (psStats->subType != FEAT_GEN_ARTE && psStats->subType != FEAT_OIL_DRUM)
{
auxSetBlocking(b.map.x + width, b.map.y + breadth, FEATURE_BLOCKED);
}
}
if ((!psStats->tileDraw) && (FromSave == false))
{
psTile->height = height;
}
}
}
psFeature->pos.z = map_TileHeight(b.map.x, b.map.y);//jps 18july97
return psFeature;
}
FEATURE::FEATURE(uint32_t id, FEATURE_STATS const *psStats)
: BASE_OBJECT(OBJ_FEATURE, id, PLAYER_FEATURE) // Set the default player out of range to avoid targeting confusions
, psStats(psStats)
{}
/* Release the resources associated with a feature */
FEATURE::~FEATURE()
{
// Make sure to get rid of some final references in the sound code to this object first
audio_RemoveObj(this);
}
void _syncDebugFeature(const char *function, FEATURE const *psFeature, char ch)
{
if (psFeature->type != OBJ_FEATURE) {
ASSERT(false, "%c Broken psFeature->type %u!", ch, psFeature->type);
syncDebug("Broken psFeature->type %u!", psFeature->type);
}
int list[] =
{
ch,
(int)psFeature->id,
psFeature->player,
psFeature->pos.x, psFeature->pos.y, psFeature->pos.z,
(int)psFeature->psStats->subType,
psFeature->psStats->damageable,
(int)psFeature->body,
};
_syncDebugIntList(function, "%c feature%d = p%d;pos(%d,%d,%d),subtype%d,damageable%d,body%d", list, ARRAY_SIZE(list));
}
/* Update routine for features */
void featureUpdate(FEATURE *psFeat)
{
syncDebugFeature(psFeat, '<');
/* Update the periodical damage data */
if (psFeat->periodicalDamageStart != 0 && psFeat->periodicalDamageStart != gameTime - deltaGameTime) // -deltaGameTime, since projectiles are updated after features.
{
// The periodicalDamageStart has been set, but is not from the previous tick, so we must be out of the periodical damage.
psFeat->periodicalDamage = 0; // Reset periodical damage done this tick.
// Finished periodical damaging
psFeat->periodicalDamageStart = 0;
}
syncDebugFeature(psFeat, '>');
}
// free up a feature with no visual effects
bool removeFeature(FEATURE *psDel)
{
MESSAGE *psMessage;
Vector3i pos;
ASSERT_OR_RETURN(false, psDel != nullptr, "Invalid feature pointer");
ASSERT_OR_RETURN(false, !psDel->died, "Feature already dead");
//remove from the map data
StructureBounds b = getStructureBounds(psDel);
for (int breadth = 0; breadth < b.size.y; ++breadth)
{
for (int width = 0; width < b.size.x; ++width)
{
if (tileOnMap(b.map.x + width, b.map.y + breadth))
{
MAPTILE *psTile = mapTile(b.map.x + width, b.map.y + breadth);
if (psTile->psObject == psDel)
{
psTile->psObject = nullptr;
auxClearBlocking(b.map.x + width, b.map.y + breadth, FEATURE_BLOCKED | AIR_BLOCKED);
}
}
}
}
if (psDel->psStats->subType == FEAT_GEN_ARTE || psDel->psStats->subType == FEAT_OIL_DRUM)
{
pos.x = psDel->pos.x;
pos.z = psDel->pos.y;
pos.y = map_Height(pos.x, pos.z) + 30;
addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, nullptr, 0, gameTime - deltaGameTime + 1);
if (psDel->psStats->subType == FEAT_GEN_ARTE)
{
scoreUpdateVar(WD_ARTEFACTS_FOUND);
intRefreshScreen();
}
}
if (psDel->psStats->subType == FEAT_GEN_ARTE || psDel->psStats->subType == FEAT_OIL_RESOURCE)
{
for (unsigned player = 0; player < MAX_PLAYERS; ++player)
{
psMessage = findMessage(psDel, MSG_PROXIMITY, player);
while (psMessage)
{
removeMessage(psMessage, player);
psMessage = findMessage(psDel, MSG_PROXIMITY, player);
}
}
}
debug(LOG_DEATH, "Killing off feature %s id %d (%p)", objInfo(psDel), psDel->id, static_cast<void *>(psDel));
killFeature(psDel);
return true;
}
/* Remove a Feature and free it's memory */
bool destroyFeature(FEATURE *psDel, unsigned impactTime)
{
UDWORD widthScatter, breadthScatter, heightScatter, i;
EFFECT_TYPE explosionSize;
Vector3i pos;
ASSERT_OR_RETURN(false, psDel != nullptr, "Invalid feature pointer");
ASSERT(gameTime - deltaGameTime < impactTime, "Expected %u < %u, gameTime = %u, bad impactTime", gameTime - deltaGameTime, impactTime, gameTime);
/* Only add if visible and damageable*/
if (psDel->visible[selectedPlayer] && psDel->psStats->damageable)
{
/* Set off a destruction effect */
/* First Explosions */
widthScatter = TILE_UNITS / 2;
breadthScatter = TILE_UNITS / 2;
heightScatter = TILE_UNITS / 4;
//set which explosion to use based on size of feature
if (psDel->psStats->baseWidth < 2 && psDel->psStats->baseBreadth < 2)
{
explosionSize = EXPLOSION_TYPE_SMALL;
}
else if (psDel->psStats->baseWidth < 3 && psDel->psStats->baseBreadth < 3)
{
explosionSize = EXPLOSION_TYPE_MEDIUM;
}
else
{
explosionSize = EXPLOSION_TYPE_LARGE;
}
for (i = 0; i < 4; i++)
{
pos.x = psDel->pos.x + widthScatter - rand() % (2 * widthScatter);
pos.z = psDel->pos.y + breadthScatter - rand() % (2 * breadthScatter);
pos.y = psDel->pos.z + 32 + rand() % heightScatter;
addEffect(&pos, EFFECT_EXPLOSION, explosionSize, false, nullptr, 0, impactTime);
}
if (psDel->psStats->subType == FEAT_SKYSCRAPER)
{
pos.x = psDel->pos.x;
pos.z = psDel->pos.y;
pos.y = psDel->pos.z;
addEffect(&pos, EFFECT_DESTRUCTION, DESTRUCTION_TYPE_SKYSCRAPER, true, psDel->sDisplay.imd, 0, impactTime);
initPerimeterSmoke(psDel->sDisplay.imd, pos);
}
/* Then a sequence of effects */
pos.x = psDel->pos.x;
pos.z = psDel->pos.y;
pos.y = map_Height(pos.x, pos.z);
addEffect(&pos, EFFECT_DESTRUCTION, DESTRUCTION_TYPE_FEATURE, false, nullptr, 0, impactTime);
//play sound
// ffs gj
if (psDel->psStats->subType == FEAT_SKYSCRAPER)
{
audio_PlayStaticTrack(psDel->pos.x, psDel->pos.y, ID_SOUND_BUILDING_FALL);
}
else
{
audio_PlayStaticTrack(psDel->pos.x, psDel->pos.y, ID_SOUND_EXPLOSION);
}
}
if (psDel->psStats->subType == FEAT_SKYSCRAPER)
{
// ----- Flip all the tiles under the skyscraper to a rubble tile
// smoke effect should disguise this happening
StructureBounds b = getStructureBounds(psDel);
for (int breadth = 0; breadth < b.size.y; ++breadth)
{
for (int width = 0; width < b.size.x; ++width)
{
MAPTILE *psTile = mapTile(b.map.x + width, b.map.y + breadth);
// stops water texture changing for underwater features
if (terrainType(psTile) != TER_WATER)
{
if (terrainType(psTile) != TER_CLIFFFACE)
{
/* Clear feature bits */
psTile->texture = TileNumber_texture(psTile->texture) | RUBBLE_TILE;
auxClearBlocking(b.map.x + width, b.map.y + breadth, AUXBITS_ALL);
}
else
{
/* This remains a blocking tile */
psTile->psObject = nullptr;
auxClearBlocking(b.map.x + width, b.map.y + breadth, AIR_BLOCKED); // Shouldn't remain blocking for air units, however.
psTile->texture = TileNumber_texture(psTile->texture) | BLOCKING_RUBBLE_TILE;
}
}
}
}
}
removeFeature(psDel);
psDel->died = impactTime;
return true;
}
SDWORD getFeatureStatFromName(const WzString &name)
{
FEATURE_STATS *psStat;
for (unsigned inc = 0; inc < numFeatureStats; inc++)
{
psStat = &asFeatureStats[inc];
if (psStat->id.compare(name) == 0)
{
return inc;
}
}
return -1;
}
StructureBounds getStructureBounds(FEATURE const *object)
{
return getStructureBounds(object->psStats, object->pos.xy());
}
StructureBounds getStructureBounds(FEATURE_STATS const *stats, Vector2i pos)
{
const Vector2i size = stats->size();
const Vector2i map = map_coord(pos) - size / 2;
return StructureBounds(map, size);
}
| {
"pile_set_name": "Github"
} |
/* eslint-env browser */
var utils = require('../../utils/index.js');
var setOverlayVisible = function() {};
var initOverlayEl = function() {};
var enterClass = utils.genUID();
var overlayEl = null;
var timer;
if (typeof document !== 'undefined') {
initOverlayEl = function() {
if (overlayEl === null) {
var circleClass = utils.genUID();
var overlayClass = utils.genUID();
overlayEl = document.createElement('div');
overlayEl.setAttribute('style', 'position:fixed;z-index:1e10;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,.9);text-align:center;font:12px arial;opacity:1;transition:opacity .5s');
overlayEl.className = overlayClass;
overlayEl.innerHTML =
'<style>' +
'body>:not(.' + overlayClass + '){-webkit-filter:grayscale();filter:grayscale()}' +
'.' + overlayClass + '.' + enterClass + '{opacity:0!important}' +
'.' + circleClass + '{background-color:#5096fa;display:inline-block;vertical-align:middle;height:6px;width:6px;margin:3px;opacity:0;animation-name:' + circleClass + ';animation-duration:.65s;animation-iteration-count:infinite;animation-direction:normal;border-radius:50%}.' + circleClass + ':nth-child(1){animation-delay:.1s}.' + circleClass + ':nth-child(2){animation-delay:.175s}.' + circleClass + ':nth-child(3){animation-delay:.25s}@keyframes ' + circleClass + '{50%{opacity:1}}' +
'</style>' +
'<span style="margin:30px 0 5px;display:inline-block;padding:4px;background:white">Publisher connection is lost</span>' +
'<div>' +
'<div class="' + circleClass + '"></div>' +
'<div class="' + circleClass + '"></div>' +
'<div class="' + circleClass + '"></div>' +
'</div>';
}
};
setOverlayVisible = function(visible) {
if (visible) {
timer = setTimeout(function() {
initOverlayEl();
overlayEl.classList.add(enterClass);
document.body.appendChild(overlayEl);
setTimeout(function() {
overlayEl.classList.remove(enterClass);
}, 16);
}, 300);
} else {
clearTimeout(timer);
if (overlayEl !== null && overlayEl.parentNode) {
overlayEl.parentNode.removeChild(overlayEl);
}
}
};
}
module.exports = setOverlayVisible;
| {
"pile_set_name": "Github"
} |
; RUN: opt < %s -store-to-load-forwarding-conflict-detection=false -loop-accesses -analyze | FileCheck %s
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -store-to-load-forwarding-conflict-detection=false -disable-output < %s 2>&1 | FileCheck %s
; This test checks that we prove the strided accesses to be independent before
; concluding that there is a forward dependence.
; struct pair {
; int x;
; int y;
; };
;
; int independent_interleaved(struct pair *p, int z, int n) {
; int s = 0;
; for (int i = 0; i < n; i++) {
; p[i].y = z;
; s += p[i].x;
; }
; return s;
; }
; CHECK: for.body:
; CHECK-NOT: Forward:
; CHECK-NOT: store i32 %z, i32* %p_i.y, align 8 ->
; CHECK-NOT: %0 = load i32, i32* %p_i.x, align 8
%pair = type { i32, i32 }
define i32 @independent_interleaved(%pair *%p, i64 %n, i32 %z) {
entry:
br label %for.body
for.body:
%i = phi i64 [ %i.next, %for.body ], [ 0, %entry ]
%s = phi i32 [ %1, %for.body ], [ 0, %entry ]
%p_i.x = getelementptr inbounds %pair, %pair* %p, i64 %i, i32 0
%p_i.y = getelementptr inbounds %pair, %pair* %p, i64 %i, i32 1
store i32 %z, i32* %p_i.y, align 8
%0 = load i32, i32* %p_i.x, align 8
%1 = add nsw i32 %0, %s
%i.next = add nuw nsw i64 %i, 1
%cond = icmp slt i64 %i.next, %n
br i1 %cond, label %for.body, label %for.end
for.end:
%2 = phi i32 [ %1, %for.body ]
ret i32 %2
}
| {
"pile_set_name": "Github"
} |
package org.tribbloid.ispark.display.dsl
import java.net.URL
import org.apache.spark.sql.DataFrame
import org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl
import org.pegdown.{Extensions, PegDownProcessor}
import org.tribbloid.ispark.display.{HTMLDisplayObject, LatexDisplayObject}
import scala.xml._
object Display {
case class Math(math: String) extends LatexDisplayObject {
override val toLatex = "$$" + math + "$$"
}
case class Latex(latex: String) extends LatexDisplayObject {
override val toLatex = latex
}
case class HTML(code: String) extends HTMLDisplayObject {
override val toHTML: String = code
}
object MarkdownProcessor extends PegDownProcessor(Extensions.ALL)
case class Markdown(code: String) extends HTMLDisplayObject {
override val toHTML: String = {
MarkdownProcessor.markdownToHtml(code)
}
}
val TagSoupParser = new SAXFactoryImpl().newSAXParser()
case class Table(
df: DataFrame,
limit:Int = 1000,
parse: Boolean = true,
random: Boolean = true
) extends HTMLDisplayObject {
assert(limit<=1000) //or parsing timeout
override val toHTML: String = {
val thead: Elem =
<thead>
<tr>{df.schema.fieldNames.map(str => <td>{str}</td>)}</tr>
</thead>
df.persist()
val size = df.count()
val rows = if (random) df.rdd.takeSample(withReplacement = false, num = limit)
else df.rdd.take(limit)
df.unpersist()
val info: Elem =
if (size < limit) <h5>returned {size} row(s) in total:</h5>
else <h5>returned {size} rows in total but only {limit} of them are displayed:</h5>
val body: Array[Elem] = rows.map{
row =>
val rowXml = row.toSeq.map{
cell =>
if (parse) {
cell match {
case cell: NodeSeq => <td>{cell}</td>
case cell: NodeBuffer => <td>{cell}</td>
case cell: Any =>
try {
val cellXml = XML.loadXML(Source.fromString(cell.toString), TagSoupParser)
<td>{cellXml}</td>
}
catch {
case e: Throwable => <td>{cell}</td>
}
case _ => <td>{cell}</td>
}
}
else {
<td>{cell}</td>
}
}
<tr>{rowXml}</tr>
}
val tbody: Elem =
<tbody>
{body}
</tbody>
val table: Elem =
<table>
{thead}
{tbody}
</table>
(info ++ table).toString()
}
}
class IFrame(src: URL, width: Int, height: Int) extends HTMLDisplayObject {
override val toHTML: String =
<iframe width={width.toString}
height={height.toString}
src={src.toString}
frameborder="0"
allowfullscreen="allowfullscreen"></iframe> toString()
}
object IFrame {
def apply(src: URL, width: Int, height: Int): IFrame = new IFrame(src, width, height)
def apply(src: String, width: Int, height: Int): IFrame = new IFrame(new URL(src), width, height)
}
case class YouTubeVideo(id: String, width: Int = 400, height: Int = 300)
extends IFrame(new URL("https", "www.youtube.com", s"/embed/$id"), width, height)
case class VimeoVideo(id: String, width: Int = 400, height: Int = 300)
extends IFrame(new URL("https", "player.vimeo.com", s"/video/$id"), width, height)
case class ScribdDocument(id: String, width: Int = 400, height: Int = 300)
extends IFrame(new URL("https", "www.scribd.com", s"/embeds/$id/content"), width, height)
case class ImageURL(url: URL, width: Option[Int], height: Option[Int]) extends HTMLDisplayObject {
override val toHTML: String = <img src={url.toString}
width={width.map(w => xml.Text(w.toString))}
height={height.map(h => xml.Text(h.toString))}></img> toString()
}
object ImageURL {
def apply(url: URL): ImageURL = ImageURL(url, None, None)
def apply(url: String): ImageURL = ImageURL(new URL(url))
def apply(url: URL, width: Int, height: Int): ImageURL = ImageURL(url, Some(width), Some(height))
def apply(url: String, width: Int, height: Int): ImageURL = ImageURL(new URL(url), width, height)
}
//disabled because Json display is only supported in extension
// case class Json[T <: AnyRef](obj: T) extends JSONDisplayObject {
//
// implicit val formats = DefaultFormats
// import org.json4s.jackson.Serialization
//
// override val toJSON: String = {
// Serialization.write(obj) //TODO: Cannot serialize class created in interpreter
// }
// }
} | {
"pile_set_name": "Github"
} |
author: Tatsuhiko Miyagawa
follow_selector: .title>a
# support thumbnail!
| {
"pile_set_name": "Github"
} |
{
"pip": [
"{{artifact-dir}}/bin_wrapper-0.0.1-py2.py3-none-any.whl"
]
}
| {
"pile_set_name": "Github"
} |
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*/
#include "test.h"
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <curl/mprintf.h>
#include "memdebug.h"
/* build request url */
static char *suburl(const char *base, int i)
{
return curl_maprintf("%s%.4d", base, i);
}
/*
* Test GET_PARAMETER: PUT, HEARTBEAT, and POST
*/
int test(char *URL)
{
int res;
CURL *curl;
int params;
FILE *paramsf = NULL;
struct_stat file_info;
char *stream_uri = NULL;
int request=1;
struct curl_slist *custom_headers=NULL;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
if ((curl = curl_easy_init()) == NULL) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
test_setopt(curl, CURLOPT_HEADERDATA, stdout);
test_setopt(curl, CURLOPT_WRITEDATA, stdout);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_URL, URL);
/* SETUP */
if((stream_uri = suburl(URL, request++)) == NULL) {
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
free(stream_uri);
stream_uri = NULL;
test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "Planes/Trains/Automobiles");
test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
if((stream_uri = suburl(URL, request++)) == NULL) {
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
free(stream_uri);
stream_uri = NULL;
/* PUT style GET_PARAMETERS */
params = open("log/file572.txt", O_RDONLY);
fstat(params, &file_info);
close(params);
paramsf = fopen("log/file572.txt", "rb");
if(paramsf == NULL) {
fprintf(stderr, "can't open log/file572.txt\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_GET_PARAMETER);
test_setopt(curl, CURLOPT_READDATA, paramsf);
test_setopt(curl, CURLOPT_UPLOAD, 1L);
test_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t) file_info.st_size);
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
test_setopt(curl, CURLOPT_UPLOAD, 0L);
fclose(paramsf);
paramsf = NULL;
/* Heartbeat GET_PARAMETERS */
if((stream_uri = suburl(URL, request++)) == NULL) {
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
free(stream_uri);
stream_uri = NULL;
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
/* POST GET_PARAMETERS */
if((stream_uri = suburl(URL, request++)) == NULL) {
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
free(stream_uri);
stream_uri = NULL;
test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_GET_PARAMETER);
test_setopt(curl, CURLOPT_POSTFIELDS, "packets_received\njitter\n");
res = curl_easy_perform(curl);
if(res)
goto test_cleanup;
test_setopt(curl, CURLOPT_POSTFIELDS, NULL);
/* Make sure we can do a normal request now */
if((stream_uri = suburl(URL, request++)) == NULL) {
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
free(stream_uri);
stream_uri = NULL;
test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
res = curl_easy_perform(curl);
test_cleanup:
if(paramsf)
fclose(paramsf);
if(stream_uri)
free(stream_uri);
if(custom_headers)
curl_slist_free_all(custom_headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return res;
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:key="@string/gross_sales_key"
android:title="@string/gross_sales"
android:defaultValue="true" />
<CheckBoxPreference
android:key="@string/net_sales_key"
android:title="@string/net_sales"
android:defaultValue="false" />
</PreferenceScreen>
| {
"pile_set_name": "Github"
} |
Manifest-Version: 1.0
Private-Package: org.openhab.binding.samsungac.internal
Ignore-Package: org.openhab.binding.samsungac.internal
Bundle-License: http://www.eclipse.org/legal/epl-2.0
Bundle-Name: openHAB Samsung AC Binding
Bundle-SymbolicName: org.openhab.binding.samsungac
Bundle-Vendor: openHAB.org
Bundle-Version: 1.15.0.qualifier
Bundle-Activator: org.openhab.binding.samsungac.internal.SamsungAcActivator
Bundle-ManifestVersion: 2
Bundle-Description: This is the Samsung AC binding of the open Home Aut
omation Bus (openHAB)
Import-Package: org.apache.commons.codec.binary;version="1.3.0",
org.apache.commons.lang,
org.openhab.core.binding,
org.openhab.core.events,
org.openhab.core.items,
org.openhab.core.library.items,
org.openhab.core.library.types,
org.openhab.core.types,
org.openhab.model.item.binding,
org.osgi.framework,
org.osgi.service.cm,
org.osgi.service.component,
org.osgi.service.event,
org.slf4j
Export-Package: org.openhab.binding.samsungac
Bundle-DocURL: http://www.openhab.org
Service-Component: OSGI-INF/binding.xml, OSGI-INF/genericbindingprovider.xml
Bundle-ClassPath: .,
lib/bcprov-jdk16-1.45-mini.jar,
lib/not-yet-commons-ssl-0.3.16.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
| {
"pile_set_name": "Github"
} |
# MvvmCross site changelog
## Mvxtheme 1.6 (2017-08-10)
* Jekyll 3.5.0 rename `gem` to `plugins`.
* Update Jekyll and plugins version.
* Fix RSVP button in the middle.
* Add speakers section.
* Remove Gemfile.lock from .gitignore.
## Mvxtheme 1.5 (2017-08-03)
* Add XABLU and Microsoft logo.
* Fix button styles and add logo styles.
* Fix some tag bug, add logos, remove unused javascript
## Mvxtheme 1.4 (2017-07-29)
* Add member list table.
* Make mobile friendly.
## Mvxtheme 1.3 (2017-07-28)
* Add Hackfest page
## Mvxtheme 1.2 (2017-05-26)
New features:
* Add 404 page.
Fixed bugs:
* Fix landing height.
* Fix opencollective width on 2k and 4k resolution.
## Mvxtheme 1.1 (2017-05-25)
Fixed bugs:
* Fix images width.
* Fix footer urls.
* Fix background-image url.
* Update Gemfiles.
* Fix some footer links to stay inside the page.
* On mobile: Products and Organization lists on visible.
* Homepage title is bold.
* On Mobile: documentation menu like the normal menu items.
* Fix logo link is relative url.
* Fix section padding.
## Mvxtheme 1.0 (2017-05-24)
I am honored to announce that the Jekyll theme for MvvmCross has been officially completed today.
Starting with this release, MvvmCross can completely abandon the dependency on the Minima theme.
All changes will be listed below.
* Theme engine no longer use Jekyll, now use "GitHub Pages Ruby Gem".
* Add new plugin "jekyll-github-metadata".
* Enable the compressed scss style to reduce the file size.
* Move all static files to the `/assets` folder.
* Classify image files.
* Remove the minima theme.
* Delete the `_data` folder and move the `menu` settings to `_config.yml`.
* Rewrite all layouts.
* Newly designed header and footer.
* Using responsive design.
* Add scrolling to the top button.
* Move some JavaScript files.
* Add copyright information.
* Optimize the code font.
* Use "richleland-pygments-css code" highlighting. | {
"pile_set_name": "Github"
} |
vcl 4.0;
backend default {
.host = "{{ servers.exampleapp.ip }}";
.port = "{{ servers.exampleapp.port }}";
}
sub vcl_recv {
return (pass);
}
sub vcl_backend_response {
}
sub vcl_deliver {
} | {
"pile_set_name": "Github"
} |
如何访问App内的开发菜单:
1. 在iOS中晃动设备或者在模拟器上按下`control + ⌘ + z`。
2. 在Android中晃动设备或者按下硬件菜单键(一般只有老设备或者大多数模拟器还有这个键。比如,在[genymotion](https://www.genymotion.com) 中你可以通过按下`⌘ + m`来模拟点击硬件菜单)。PC键盘上也有这个键,一般在标准键盘右边的Ctrl和右Windows键之间,即模拟鼠标右键的键。
> 提示
> 如何在成品(production builds)中关掉开发者菜单:
> 1. 对于iOS来说,在Xcode中打开你的项目,选择`Product → Scheme → Edit Scheme...` (或者按下 `⌘ + <`)。接着选择菜单上左边的`Run`,然后将构建设置(Build Configuration)更改为`Release`.
> 2. 在Android中,默认情况下gradle的release版本(比如使用gradle的`assembleRelease`任务来构建)就会关闭开发者菜单。你也可以通过给`ReactInstanceManager#setUseDeveloperSupport`传递需要的参数来定制这一行为。
## 刷新
选择开发者菜单中的`Reload`选项(或者在iOS模拟器上按下`⌘ + r`)即可重新加载应用的js代码。但如果你增加了新的资源(比如给iOS的`Images.xcassets`或是Andorid的`res/drawable`文件夹添加了图片)或者更改了任何的原生代码(objective-c/swift/java),那么就需要通过重新编译才能生效。
## YellowBox(黄屏警告)与RedBox(红屏报错)
调用console.warn方法会在屏幕上产生一个黄色背景的信息。点击这行信息会转入全屏的警告页面。
而调用console.error方法则会直接产生一个全屏的红色背景报错页面。
在默认情况下,开发模式中启用了黄屏警告。可以通过以下代码关闭:
```js
console.disableYellowBox = true;
console.warn('YellowBox is disabled.');
```
你也可以通过代码屏蔽指定的警告,像下面这样设置一个数组:
```js
console.ignoredYellowBox = ['Warning: ...'];
```
数组中的字符串就是要屏蔽的警告的开头的内容。(例如上面的代码会屏蔽掉所有以Warning开头的警告内容)
## Chrome开发者工具
在Chrome上调试js代码,需要在开发菜单中选择`Debug JS Remotely`,这会打开一个新的[http://localhost:8081/debugger-ui](http://localhost:8081/debugger-ui)tab页。
在Chrome中,按下`⌘ + option + i`或者选择`视图(View) -> 开发者(Developer) -> 开发工具(Developer Tools)`来打开开发工具控制台。打开[有异常时暂停(Pause On Caught Exceptions)](http://stackoverflow.com/questions/2233339/javascript-is-there-a-way-to-get-chrome-to-break-on-all-errors/17324511#17324511)选项,能够获得更好的开发体验。
__译注__:Chrome中并不能直接看到App的用户界面,而只能提供console的输出,以及在sources项中断点调试js脚本。
在真机上调试:
1. 在iOS上 —— 打开`RCTWebSocketExecutor.m`文件,将其中的`localhost`替换为你电脑的ip地址。然后晃动设备打开开发菜单,即可开始调试。
2. 对于Android设备 —— 如果你通过usb连接了一个Android 5.0或更高版本的设备,则可以通过`adb`命令建立一个从设备向电脑转发的端口:`adb reverse tcp:8081 tcp:8081`(点击[这里](http://developer.android.com/tools/help/adb.html)查看`adb`命令的帮助)。或者,你可以通过摇晃打开开发者菜单,选择`Dev Settings`,然后在`Debug server host for device`中设置你电脑的`ip地址:端口号`。
### React开发工具(可选的)
[React开发工具](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)`在目前版本无法使用,并且此工具与代码调试并无关系`。
## 实时刷新
这个选项可以在你的js代码变更了之后,自动触发所连设备或者模拟器自动刷新。以下是开启方法:
1. iOS平台上选择开发菜单中的`Enable Live Reload`即可开启js代码自动刷新。
2. Android平台上,先打开开发菜单,选择`Dev Settings`,然后选择`Auto reload on JS change`选项。
## FPS(每秒帧数)监视器
从`0.5.0-rc`及以上版本开始,你可以打开开发者选项中的FPS覆盖层来帮助你调试性能问题。
| {
"pile_set_name": "Github"
} |
StartChar: aKaf.init_KafLam
Encoding: 65798 -1 356
Width: 587
Flags: HW
AnchorPoint: "TwoDotsBelow" 57 -156 basechar 0
AnchorPoint: "DotBelow" 111 -156 basechar 0
AnchorPoint: "TashkilBelow" 140 -327 basechar 0
AnchorPoint: "TwoDotsAbove" -38 674 basechar 0
AnchorPoint: "DotAbove" 16 674 basechar 0
AnchorPoint: "RingBelow" 244 622 basechar 0
AnchorPoint: "TashkilAbove" 199 801 basechar 0
AnchorPoint: "Dash" 211 738 basechar 0
LayerCount: 3
Fore
SplineSet
-41 401 m 1
66 372 136 335 170 291 c 0
202 249 218 206 218 164 c 0
217 60 181 -1 110 -19 c 0
80 -26 43 -28 -1 -25 c 1
-18 -23 -30 -12 -37 8 c 128
-44 28 -45 48 -38 69 c 0
-29 98 -16 111 2 108 c 1
66 99 126 115 179 155 c 1
134 216 49 267 -78 305 c 0
-92 309 -100 327 -100 361 c 0
-100 389 -98 410 -92 423 c 0
-66 486 14 557 148 636 c 0
284 716 385 769 450 792 c 0
485 805 499 794 491 759 c 2
477 695 l 2
473 681 465 672 452 667 c 0
370 633 276 587 172 531 c 128
68 475 -4 431 -41 401 c 1
EndSplineSet
Layer: 2
SplineSet
-55.6640625 394.53125 m 1
51.4326171875 364.909179688 124.51171875 326.66015625 163.57421875 279.78515625 c 0
196.452148438 240.071289062 212.890625 201.497070312 212.890625 164.0625 c 16
212.565429688 34.1796875 141.764648438 -24.0888671875 0.48828125 -10.7421875 c 0
-9.9287109375 -9.765625 -17.578125 -2.6044921875 -22.4609375 10.7421875 c 0
-28.9716796875 28.6455078125 -29.9482421875 45.0849609375 -25.390625 60.05859375 c 0
-17.9033203125 84.1474609375 -9.4404296875 95.3779296875 0 93.75 c 0
70.3125 82.6826171875 131.184570312 100.5859375 182.6171875 147.4609375 c 0
186.198242188 150.715820312 187.174804688 153.645507812 185.546875 156.25 c 0
139.6484375 227.5390625 53.0595703125 280.110351562 -74.21875 313.96484375 c 0
-87.890625 316.89453125 -94.7265625 333.984375 -94.7265625 365.234375 c 0
-95.0517578125 390.299804688 -91.796875 410.64453125 -84.9609375 426.26953125 c 24
-62.1748046875 479.00390625 18.06640625 544.758789062 155.76171875 623.53515625 c 0
266.11328125 686.686523438 370.930664062 738.118164062 470.21484375 777.83203125 c 24
488.76953125 785.319335938 495.930664062 780.110351562 491.69921875 762.20703125 c 2
477.05078125 698.73046875 l 2
474.772460938 689.290039062 469.563476562 683.10546875 461.42578125 680.17578125 c 0
387.858398438 653.483398438 290.852539062 607.014648438 170.41015625 540.771484375 c 128
49.9677734375 474.528320312 -25.390625 425.78125 -55.6640625 394.53125 c 1
EndSplineSet
EndChar
| {
"pile_set_name": "Github"
} |
CREATE FUNCTION func_with_overload() RETURNS integer
LANGUAGE plpgsql
AS '
BEGIN
RETURN 1;
END;
';
GO
CREATE FUNCTION func_with_overload(var1 integer) RETURNS integer
LANGUAGE plpgsql
AS '
BEGIN
RETURN 1;
END;
';
GO
CREATE FUNCTION func_with_overload(var1 integer, invalstr character varying) RETURNS integer
LANGUAGE plpgsql
AS '
BEGIN
RETURN 1;
END;
';
GO | {
"pile_set_name": "Github"
} |
/* libunwind - a platform-independent unwind library
Copyright (C) 2001-2005 Hewlett-Packard Co
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef IA64_LIBUNWIND_I_H
#define IA64_LIBUNWIND_I_H
/* Target-dependent definitions that are internal to libunwind but need
to be shared with target-independent code. */
#include "elf64.h"
#include "mempool.h"
#include <stdatomic.h>
typedef struct
{
/* no ia64-specific fast trace */
}
unw_tdep_frame_t;
enum ia64_pregnum
{
/* primary unat: */
IA64_REG_PRI_UNAT_GR,
IA64_REG_PRI_UNAT_MEM,
/* memory stack (order matters: see build_script() */
IA64_REG_PSP, /* previous memory stack pointer */
/* register stack */
IA64_REG_BSP, /* register stack pointer */
IA64_REG_BSPSTORE,
IA64_REG_PFS, /* previous function state */
IA64_REG_RNAT,
/* instruction pointer: */
IA64_REG_IP,
/* preserved registers: */
IA64_REG_R4, IA64_REG_R5, IA64_REG_R6, IA64_REG_R7,
IA64_REG_NAT4, IA64_REG_NAT5, IA64_REG_NAT6, IA64_REG_NAT7,
IA64_REG_UNAT, IA64_REG_PR, IA64_REG_LC, IA64_REG_FPSR,
IA64_REG_B1, IA64_REG_B2, IA64_REG_B3, IA64_REG_B4, IA64_REG_B5,
IA64_REG_F2, IA64_REG_F3, IA64_REG_F4, IA64_REG_F5,
IA64_REG_F16, IA64_REG_F17, IA64_REG_F18, IA64_REG_F19,
IA64_REG_F20, IA64_REG_F21, IA64_REG_F22, IA64_REG_F23,
IA64_REG_F24, IA64_REG_F25, IA64_REG_F26, IA64_REG_F27,
IA64_REG_F28, IA64_REG_F29, IA64_REG_F30, IA64_REG_F31,
IA64_NUM_PREGS
};
#ifdef UNW_LOCAL_ONLY
typedef unw_word_t ia64_loc_t;
#else /* !UNW_LOCAL_ONLY */
typedef struct ia64_loc
{
unw_word_t w0, w1;
}
ia64_loc_t;
#endif /* !UNW_LOCAL_ONLY */
#include "script.h"
#define ABI_UNKNOWN 0
#define ABI_LINUX 1
#define ABI_HPUX 2
#define ABI_FREEBSD 3
#define ABI_OPENVMS 4
#define ABI_NSK 5 /* Tandem/HP Non-Stop Kernel */
#define ABI_WINDOWS 6
struct unw_addr_space
{
struct unw_accessors acc;
int big_endian;
int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */
unw_caching_policy_t caching_policy;
_Atomic uint32_t cache_generation;
unw_word_t dyn_generation;
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
#ifndef UNW_REMOTE_ONLY
unsigned long long shared_object_removals;
#endif
struct ia64_script_cache global_cache;
};
/* Note: The ABI numbers in the ABI-markers (.unwabi directive) are
not the same as the above ABI numbers. */
#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's')
#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i')
#define ABI_MARKER_HP_UX_SIGTRAMP ((1 << 8) | 1)
#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's')
#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i')
struct cursor
{
void *as_arg; /* argument to address-space callbacks */
unw_addr_space_t as; /* reference to per-address-space info */
/* IP, CFM, and predicate cache (these are always equal to the
values stored in ip_loc, cfm_loc, and pr_loc,
respectively). */
unw_word_t ip; /* instruction pointer value */
unw_word_t cfm; /* current frame mask */
unw_word_t pr; /* current predicate values */
/* current frame info: */
unw_word_t bsp; /* backing store pointer value */
unw_word_t sp; /* stack pointer value */
unw_word_t psp; /* previous sp value */
ia64_loc_t cfm_loc; /* cfm save location (or NULL) */
ia64_loc_t ec_loc; /* ar.ec save location (usually cfm_loc) */
ia64_loc_t loc[IA64_NUM_PREGS];
unw_word_t eh_args[4]; /* exception handler arguments */
unw_word_t sigcontext_addr; /* address of sigcontext or 0 */
unw_word_t sigcontext_off; /* sigcontext-offset relative to signal sp */
short hint;
short prev_script;
uint8_t nat_bitnr[4]; /* NaT bit numbers for r4-r7 */
uint16_t abi_marker; /* abi_marker for current frame (if any) */
uint16_t last_abi_marker; /* last abi_marker encountered so far */
uint8_t eh_valid_mask;
unsigned int pi_valid :1; /* is proc_info valid? */
unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */
unw_proc_info_t pi; /* info about current procedure */
/* In case of stack-discontiguities, such as those introduced by
signal-delivery on an alternate signal-stack (see
sigaltstack(2)), we use the following data-structure to keep
track of the register-backing-store areas across on which the
current frame may be backed up. Since there are at most 96
stacked registers and since we only have to track the current
frame and only areas that are not empty, this puts an upper
limit on the # of backing-store areas we have to track.
Note that the rbs-area indexed by rbs_curr identifies the
rbs-area that was in effect at the time AR.BSP had the value
c->bsp. However, this rbs area may not actually contain the
value in the register that c->bsp corresponds to because that
register may not have gotten spilled until much later, when a
possibly different rbs-area might have been in effect
already. */
uint8_t rbs_curr; /* index of curr. rbs-area (contains c->bsp) */
uint8_t rbs_left_edge; /* index of inner-most valid rbs-area */
struct rbs_area
{
unw_word_t end;
unw_word_t size;
ia64_loc_t rnat_loc;
}
rbs_area[96 + 2]; /* 96 stacked regs + 1 extra stack on each side... */
};
struct ia64_global_unwind_state
{
pthread_mutex_t lock; /* global data lock */
volatile char init_done;
/* Table of registers that prologues can save (and order in which
they're saved). */
const unsigned char save_order[8];
/*
* uc_addr() may return pointers to these variables. We need to
* make sure they don't get written via ia64_put() or
* ia64_putfp(). To make it possible to test for these variables
* quickly, we collect them in a single sub-structure.
*/
struct
{
unw_word_t r0; /* r0 is byte-order neutral */
unw_fpreg_t f0; /* f0 is byte-order neutral */
unw_fpreg_t f1_le, f1_be; /* f1 is byte-order dependent */
}
read_only;
unw_fpreg_t nat_val_le, nat_val_be;
unw_fpreg_t int_val_le, int_val_be;
struct mempool reg_state_pool;
struct mempool labeled_state_pool;
# if UNW_DEBUG
const char *preg_name[IA64_NUM_PREGS];
# endif
};
#define tdep_getcontext_trace unw_getcontext
#define tdep_init_done unw.init_done
#define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */
#define tdep_search_unwind_table unw_search_ia64_unwind_table
#define tdep_find_unwind_table ia64_find_unwind_table
#define tdep_find_proc_info UNW_OBJ(find_proc_info)
#define tdep_uc_addr UNW_OBJ(uc_addr)
#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
#define tdep_access_reg UNW_OBJ(access_reg)
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
#define tdep_get_as(c) ((c)->as)
#define tdep_get_as_arg(c) ((c)->as_arg)
#define tdep_get_ip(c) ((c)->ip)
#define tdep_big_endian(as) ((c)->as->big_endian != 0)
#ifndef UNW_LOCAL_ONLY
# define tdep_put_unwind_info UNW_OBJ(put_unwind_info)
#endif
/* This can't be an UNW_ARCH_OBJ() because we need separate
unw.initialized flags for the local-only and generic versions of
the library. Also, if we wanted to have a single, shared global
data structure, we couldn't declare "unw" as HIDDEN. */
#define unw UNW_OBJ(data)
extern void tdep_init (void);
extern int tdep_find_unwind_table (struct elf_dyn_info *edi,
unw_addr_space_t as, char *path,
unw_word_t segbase, unw_word_t mapoff,
unw_word_t ip);
extern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip,
unw_proc_info_t *pi, int need_unwind_info,
void *arg);
extern void tdep_put_unwind_info (unw_addr_space_t as,
unw_proc_info_t *pi, void *arg);
extern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum,
uint8_t *nat_bitnr);
extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
unsigned long *segbase, unsigned long *mapoff,
char *path, size_t pathlen);
extern void tdep_get_exe_image_path (char *path);
extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
unw_word_t *valp, int write);
extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
unw_fpreg_t *valp, int write);
extern struct ia64_global_unwind_state unw;
/* In user-level, we have no reasonable way of determining the base of
an arbitrary backing-store. We default to half the
address-space. */
#define rbs_get_base(c,bspstore,rbs_basep) \
(*(rbs_basep) = (bspstore) - (((unw_word_t) 1) << 63), 0)
#endif /* IA64_LIBUNWIND_I_H */
| {
"pile_set_name": "Github"
} |
// stylelint-disable selector-max-id, selector-max-compound-selectors
body {
padding-top: 120px;
}
pre {
background: #f7f7f9;
}
iframe {
overflow: hidden;
border: none;
}
@media (min-width: 768px) {
body > .navbar-transparent {
box-shadow: none;
.navbar-nav > .open > a {
box-shadow: none;
}
}
}
#home,
#help {
font-size: .9rem;
.navbar {
background: #349aed;
background: linear-gradient(145deg, rgba(52, 154, 237, 1) 50%, rgba(52, 216, 237, 1) 100%);
transition: box-shadow 200ms ease-in;
}
.navbar-transparent {
background: none !important;
box-shadow: none;
}
.navbar-brand {
.nav-link {
display: inline-block;
margin-right: -30px;
}
}
.nav-link {
text-transform: uppercase;
font-weight: 500;
color: #fff;
}
}
#home {
padding-top: 0;
.btn {
padding: .6rem .55rem .5rem;
box-shadow: none;
font-size: .7rem;
font-weight: 500;
}
}
.bs-docs-section {
margin-top: 4em;
.page-header h1 {
padding: 2rem 0;
font-size: 3rem;
}
}
.dropdown-menu.show[aria-labelledby="themes"] {
display: flex;
width: 420px;
flex-wrap: wrap;
.dropdown-item {
width: 33.333%;
&:first-child {
width: 100%;
}
}
}
.bs-component {
position: relative;
+ .bs-component {
margin-top: 1rem;
}
.card {
margin-bottom: 1rem;
}
.modal {
position: relative;
top: auto;
right: auto;
left: auto;
bottom: auto;
z-index: 1;
display: block;
}
.modal-dialog {
width: 90%;
}
.popover {
position: relative;
display: inline-block;
width: 220px;
margin: 20px;
}
}
.source-button {
display: none;
position: absolute;
top: 0;
right: 0;
z-index: 100;
font-weight: 700;
}
.source-button:hover {
cursor: pointer;
}
.bs-component:hover .source-button {
display: block;
}
#source-modal {
pre {
max-height: calc(100vh - 11rem);
background-color: rgba(0, 0, 0, .7);
color: rgba(255, 255, 255, .7);
}
}
.nav-tabs {
margin-bottom: 15px;
}
.progress {
margin-bottom: 10px;
}
#footer {
margin: 5em 0;
li {
float: left;
margin-right: 1.5em;
margin-bottom: 1.5em;
}
p {
clear: left;
margin-bottom: 0;
}
}
.splash {
padding: 12em 0 6em;
background: #349aed;
background: linear-gradient(145deg, rgba(52, 154, 237, 1) 50%, rgba(52, 216, 237, 1) 100%);
color: #fff;
text-align: center;
.logo {
width: 160px;
}
h1 {
font-size: 3em;
color: #fff;
}
#social {
margin: 2em 0 3em;
}
.alert {
margin: 2em 0;
border: none;
}
.sponsor a {
color: #fff;
}
}
.section-tout {
padding: 6em 0 1em;
border-bottom: 1px solid rgba(0, 0, 0, .05);
background-color: #eaf1f1;
text-align: center;
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 80px;
height: 80px;
margin: 0 auto 1rem;
background: #349aed;
background: linear-gradient(145deg, rgba(59, 156, 234, 1) 50%, rgba(61, 184, 235, 1) 100%);
border-radius: 50%;
font-size: 2rem;
color: rgba(0, 0, 0, .5);
}
p {
margin-bottom: 5em;
}
}
.section-preview {
padding: 4em 0;
.preview {
margin-bottom: 4em;
background-color: #eaf1f1;
.image {
position: relative;
&::before {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
content: "";
pointer-events: none;
}
}
.options {
padding: 2em;
border: 1px solid rgba(0, 0, 0, .05);
border-top: none;
text-align: center;
p {
margin-bottom: 2em;
}
}
}
.dropdown-menu {
text-align: left;
}
.lead {
margin-bottom: 2em;
}
}
.sponsor {
#carbonads {
max-width: 240px;
margin: 0 auto;
}
.carbon-text {
display: block;
margin-top: 1em;
font-size: 12px;
}
.carbon-poweredby {
float: right;
margin-top: 1em;
font-size: 10px;
}
}
@media (max-width: 767px) {
.splash {
padding-top: 8em;
.logo {
width: 100px;
}
h1 {
font-size: 2em;
}
}
#banner {
margin-bottom: 2em;
text-align: center;
}
}
| {
"pile_set_name": "Github"
} |
#ifdef TEST_COMPILE_ALL_HEADERS_SEPARATELY
// #include "AudioVULEDs.hpp" // TODO
#endif | {
"pile_set_name": "Github"
} |
from flask import Blueprint, render_template
admin = Blueprint('admin', __name__, url_prefix='/admin',
template_folder='templates',
static_folder='static')
@admin.route('/')
def index():
return render_template('admin/index.html')
@admin.route('/index2')
def index2():
return render_template('./admin/index.html')
| {
"pile_set_name": "Github"
} |
#pragma once
#include <Eigen/Dense>
#include <unsupported/Eigen/KroneckerProduct>
#include <ceres/ceres.h>
namespace aliceVision {
namespace SO3 {
using Matrix = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>;
/**
Compute the skew symmetric matrix of the given vector 3d
@param int the 3d vector
@return a skew symmetric matrix
*/
inline Eigen::Matrix3d skew(const Eigen::Vector3d & in) {
Eigen::Matrix3d ret;
ret.fill(0);
ret(0, 1) = -in(2);
ret(1, 0) = in(2);
ret(0, 2) = in(1);
ret(2, 0) = -in(1);
ret(1, 2) = -in(0);
ret(2, 1) = in(0);
return ret;
}
/**
Compute the exponential map of the given algebra on the group
@param algebra the 3d vector
@return a 3*3 SO(3) matrix
*/
inline Eigen::Matrix3d expm(const Eigen::Vector3d & algebra) {
double angle = algebra.norm();
if (angle < std::numeric_limits<double>::epsilon()) {
return Eigen::Matrix3d::Identity();
}
Eigen::Matrix3d omega = skew(algebra);
Eigen::Matrix3d ret;
ret = Eigen::Matrix3d::Identity() + (sin(angle) / angle) * omega + ((1.0 - cos(angle)) / (angle * angle)) * omega * omega;
return ret;
}
/**
Compute the algebra related to a given rotation matrix
@param R the input rotation matrix
@return the algebra
*/
inline Eigen::Vector3d logm(const Eigen::Matrix3d & R) {
Eigen::Vector3d ret;
double p1 = R(2, 1) - R(1, 2);
double p2 = R(0, 2) - R(2, 0);
double p3 = R(1, 0) - R(0, 1);
double costheta = (R.trace() - 1.0) / 2.0;
if (costheta < -1.0) {
costheta = -1.0;
}
if (costheta > 1.0) {
costheta = 1.0;
}
if (1.0 - costheta < 1e-24) {
ret.fill(0);
return ret;
}
double theta = acos(costheta);
double scale = theta / (2.0 * sin(theta));
ret(0) = scale * p1;
ret(1) = scale * p2;
ret(2) = scale * p3;
return ret;
}
/**
Compute the jacobian of the logarithm wrt changes in the rotation matrix values
@param R the input rotation matrix
@return the jacobian matrix (3*9 matrix)
*/
inline Eigen::Matrix<double, 3, 9, Eigen::RowMajor> dlogmdr(const Eigen::Matrix3d & R) {
double p1 = R(2, 1) - R(1, 2);
double p2 = R(0, 2) - R(2, 0);
double p3 = R(1, 0) - R(0, 1);
double costheta = (R.trace() - 1.0) / 2.0;
if (costheta > 1.0) costheta = 1.0;
else if (costheta < -1.0) costheta = -1.0;
double theta = acos(costheta);
if (fabs(theta) < std::numeric_limits<float>::epsilon()) {
Eigen::Matrix<double, 3, 9> J;
J.fill(0);
J(0, 5) = 1;
J(0, 7) = -1;
J(1, 2) = -1;
J(1, 6) = 1;
J(2, 1) = 1;
J(2, 3) = -1;
return J;
}
double scale = theta / (2.0 * sin(theta));
Eigen::Vector3d resnoscale;
resnoscale(0) = p1;
resnoscale(1) = p2;
resnoscale(2) = p3;
Eigen::Matrix<double, 3, 3> dresdp = Eigen::Matrix3d::Identity() * scale;
Eigen::Matrix<double, 3, 9> dpdmat;
dpdmat.fill(0);
dpdmat(0, 5) = 1;
dpdmat(0, 7) = -1;
dpdmat(1, 2) = -1;
dpdmat(1, 6) = 1;
dpdmat(2, 1) = 1;
dpdmat(2, 3) = -1;
double dscaledtheta = -0.5 * theta * cos(theta) / (sin(theta)*sin(theta)) + 0.5 / sin(theta);
double dthetadcostheta = -1.0 / sqrt(-costheta*costheta + 1.0);
Eigen::Matrix<double, 1, 9> dcosthetadmat;
dcosthetadmat << 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5;
Eigen::Matrix<double, 1, 9> dscaledmat = dscaledtheta * dthetadcostheta * dcosthetadmat;
return dpdmat * scale + resnoscale * dscaledmat;
}
class LocalParameterization : public ceres::LocalParameterization {
public:
~LocalParameterization() override = default;
bool Plus(const double* x, const double* delta, double* x_plus_delta) const override {
double* ptrBase = (double*)x;
double* ptrResult = (double*)x_plus_delta;
Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor> > rotation(ptrBase);
Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor> > rotationResult(ptrResult);
Eigen::Vector3d axis;
axis(0) = delta[0];
axis(1) = delta[1];
axis(2) = delta[2];
double angle = axis.norm();
axis.normalize();
Eigen::AngleAxisd aa(angle, axis);
Eigen::Matrix3d Rupdate;
Rupdate = aa.toRotationMatrix();
rotationResult = Rupdate * rotation;
return true;
}
bool ComputeJacobian(const double* /*x*/, double* jacobian) const override {
Eigen::Map<Eigen::Matrix<double, 9, 3, Eigen::RowMajor>> J(jacobian);
//Eigen::Map<const Eigen::Matrix<double, 3, 3, Eigen::RowMajor>> R(x);
J.fill(0);
J(1, 2) = 1;
J(2, 1) = -1;
J(3, 2) = -1;
J(5, 0) = 1;
J(6, 1) = 1;
J(7, 0) = -1;
return true;
}
int GlobalSize() const override { return 9; }
int LocalSize() const override { return 3; }
};
}
namespace SE3 {
using Matrix = Eigen::Matrix<double, 4, 4, Eigen::RowMajor>;
/**
Compute the exponential map of the given algebra on the group
@param algebra the 6d vector
@return a 4*4 SE(3) matrix
*/
inline Eigen::Matrix4d expm(const Eigen::Matrix<double, 6, 1> & algebra){
Eigen::Matrix4d ret;
ret.setIdentity();
Eigen::Vector3d vecR = algebra.block<3, 1>(0, 0);
Eigen::Vector3d vecT = algebra.block<3, 1>(3, 0);
double angle = vecR.norm();
if (angle < std::numeric_limits<double>::epsilon()) {
ret.setIdentity();
ret.block<3, 1>(0, 3) = vecT;
return ret;
}
Eigen::Matrix3d omega = SO3::skew(vecR);
Eigen::Matrix3d V = Eigen::Matrix3d::Identity() + ((1.0 - cos(angle)) / (angle*angle)) * omega + ((angle - sin(angle)) / (angle*angle*angle)) * omega * omega;
ret.block<3, 3>(0, 0) = SO3::expm(vecR);
ret.block<3, 1>(0, 3) = V * vecT;
return ret;
}
class LocalParameterization : public ceres::LocalParameterization {
public:
bool Plus(const double* x, const double* delta, double* x_plus_delta) const override {
Eigen::Map<const Eigen::Matrix<double, 4, 4, Eigen::RowMajor>> T(x);
Eigen::Map<Eigen::Matrix<double, 4, 4, Eigen::RowMajor>> T_result(x_plus_delta);
Eigen::Map<const Eigen::Matrix<double, 6, 1>> vec_update(delta);
Eigen::Matrix4d T_update = Eigen::Matrix4d::Identity();
T_update = expm(vec_update);
T_result = T_update * T;
return true;
}
bool ComputeJacobian(const double * x, double* jacobian) const override {
Eigen::Map<Eigen::Matrix<double, 16, 6, Eigen::RowMajor>> J(jacobian);
Eigen::Map<const Eigen::Matrix<double, 4, 4, Eigen::RowMajor>> T(x);
J.fill(0);
J(1, 2) = 1;
J(2, 1) = -1;
J(4, 2) = -1;
J(6, 0) = 1;
J(8, 1) = 1;
J(9, 0) = -1;
J(12, 3) = 1;
J(13, 4) = 1;
J(14, 5) = 1;
return true;
}
int GlobalSize() const override {
return 16;
}
int LocalSize() const override {
return 6;
}
};
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2014-2020 Lukas Krejci
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class Excluded {
}
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math4.fitting.leastsquares;
import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
import org.apache.commons.math4.linear.RealMatrix;
import org.apache.commons.math4.linear.RealVector;
/**
* A pedantic implementation of {@link Optimum}.
*
* @since 3.3
*/
class OptimumImpl implements Optimum {
/** abscissa and ordinate */
private final Evaluation value;
/** number of evaluations to compute this optimum */
private final int evaluations;
/** number of iterations to compute this optimum */
private final int iterations;
/**
* Construct an optimum from an evaluation and the values of the counters.
*
* @param value the function value
* @param evaluations number of times the function was evaluated
* @param iterations number of iterations of the algorithm
*/
OptimumImpl(final Evaluation value, final int evaluations, final int iterations) {
this.value = value;
this.evaluations = evaluations;
this.iterations = iterations;
}
/* auto-generated implementations */
/** {@inheritDoc} */
@Override
public int getEvaluations() {
return evaluations;
}
/** {@inheritDoc} */
@Override
public int getIterations() {
return iterations;
}
/** {@inheritDoc} */
@Override
public RealMatrix getCovariances(double threshold) {
return value.getCovariances(threshold);
}
/** {@inheritDoc} */
@Override
public RealVector getSigma(double covarianceSingularityThreshold) {
return value.getSigma(covarianceSingularityThreshold);
}
/** {@inheritDoc} */
@Override
public double getRMS() {
return value.getRMS();
}
/** {@inheritDoc} */
@Override
public RealMatrix getJacobian() {
return value.getJacobian();
}
/** {@inheritDoc} */
@Override
public double getCost() {
return value.getCost();
}
/** {@inheritDoc} */
@Override
public double getChiSquare() {
return value.getChiSquare();
}
/** {@inheritDoc} */
@Override
public double getReducedChiSquare(int n) {
return value.getReducedChiSquare(n);
}
/** {@inheritDoc} */
@Override
public RealVector getResiduals() {
return value.getResiduals();
}
/** {@inheritDoc} */
@Override
public RealVector getPoint() {
return value.getPoint();
}
}
| {
"pile_set_name": "Github"
} |
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') == -1
" Compiler: powershell
" Run ps1 scripts in powershell and process their output. Quickly jump through
" stack traces and see script output in the quickfix.
if exists("current_compiler")
finish
endif
let current_compiler = "powershell"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
if !exists("g:ps1_makeprg_cmd")
if executable('pwsh')
" pwsh is the future
let g:ps1_makeprg_cmd = 'pwsh'
elseif executable('pwsh.exe')
let g:ps1_makeprg_cmd = 'pwsh.exe'
elseif executable('powershell.exe')
let g:ps1_makeprg_cmd = 'powershell.exe'
else
let g:ps1_makeprg_cmd = ''
endif
endif
if !executable(g:ps1_makeprg_cmd)
echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!"
endif
" Show CategoryInfo, FullyQualifiedErrorId, etc?
let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0)
" Use absolute path because powershell requires explicit relative paths
" (./file.ps1 is okay, but # expands to file.ps1)
let &l:makeprg = g:ps1_makeprg_cmd .' %:p:S'
" Parse file, line, char from callstacks:
" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a
" cmdlet, function, script file, or operable program. Check the spelling
" of the name, or if a path was included, verify that the path is correct
" and try again.
" At C:\script.ps1:11 char:5
" + Write-Ouput $content
" + ~~~~~~~~~~~
" + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException
" + FullyQualifiedErrorId : CommandNotFoundException
" Showing error in context with underlining.
CompilerSet errorformat=%+G+%m
" Error summary.
CompilerSet errorformat+=%E%*\\S\ :\ %m
" Error location.
CompilerSet errorformat+=%CAt\ %f:%l\ char:%c
" Errors that span multiple lines (may be wrapped to width of terminal).
CompilerSet errorformat+=%C%m
" Ignore blank/whitespace-only lines.
CompilerSet errorformat+=%Z\\s%#
if g:ps1_efm_show_error_categories
CompilerSet errorformat^=%+G\ \ \ \ +\ %.%#\\s%#:\ %m
else
CompilerSet errorformat^=%-G\ \ \ \ +\ %.%#\\s%#:\ %m
endif
" Parse file, line, char from of parse errors:
" At C:\script.ps1:22 char:16
" + Stop-Process -Name "invalidprocess
" + ~~~~~~~~~~~~~~~
" The string is missing the terminator: ".
" + CategoryInfo : ParserError: (:) [], ParseException
" + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
CompilerSet errorformat+=At\ %f:%l\ char:%c
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2:
endif
| {
"pile_set_name": "Github"
} |
- [sbt 0.13.13](https://github.com/sbt/sbt-protobuf/commit/3bbf2599002dafe7c82bafc102eb7985019587b5)
- [update protobuf-java 3.1.0](https://github.com/sbt/sbt-protobuf/commit/ac7ed5127e6303c3eb770a342f0a56988233acb7)
- [Include scalaBinaryVersion to the cache.](https://github.com/sbt/sbt-protobuf/commit/4eca548b44290423089d48156a5703b6a5b960dc)
- [Failing test case](https://github.com/sbt/sbt-protobuf/commit/3a675c85afd20cbdf21be40cb04deeaa0cf0f1e6)
- [fix typo](https://github.com/sbt/sbt-protobuf/commit/624bb850c94b31cb74ca5d4e2a4a915a3a1971dd)
- [avoid deprecated methods since sbt 0.13.13](https://github.com/sbt/sbt-protobuf/commit/f5b806a4ddfb241244502e8d74e7f1b2fe6a9465)
| {
"pile_set_name": "Github"
} |
export interface SingletonResolverOptions {
cacheable?: boolean;
}
/**
* SingletonResolver is a cached loader for a single result.
*/
export class SingletonResolver<T> {
private cache: Promise<T> | null = null;
private resolver: () => Promise<T>;
private cacheable: boolean;
constructor(
resolver: () => Promise<T>,
{ cacheable = true }: SingletonResolverOptions = {}
) {
this.resolver = resolver;
this.cacheable = cacheable;
}
public load() {
if (!this.cacheable) {
return this.resolver();
}
if (this.cache) {
return this.cache;
}
const promise = this.resolver().then((result) => {
return result;
});
// Set the promise on the cache.
this.cache = promise;
return promise;
}
}
export function createManyBatchLoadFn<U, V>(
batchLoadFn: (input: U) => Promise<V>
) {
return (inputs: U[]) =>
Promise.all(inputs.map((input) => batchLoadFn(input)));
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace System.Web.Http.Metadata.Providers
{
public class DataAnnotationsModelMetadataProvider : AssociatedMetadataProvider<CachedDataAnnotationsModelMetadata>
{
protected override CachedDataAnnotationsModelMetadata CreateMetadataPrototype(IEnumerable<Attribute> attributes, Type containerType, Type modelType, string propertyName)
{
return new CachedDataAnnotationsModelMetadata(this, containerType, modelType, propertyName, attributes);
}
protected override CachedDataAnnotationsModelMetadata CreateMetadataFromPrototype(CachedDataAnnotationsModelMetadata prototype, Func<object> modelAccessor)
{
return new CachedDataAnnotationsModelMetadata(prototype, modelAccessor);
}
}
}
| {
"pile_set_name": "Github"
} |
These images are from the silk icon set, and are licensed under the
Creative Commons Attribution 2.5 License.
See:
http://famfamfam.com/lab/icons/silk/
| {
"pile_set_name": "Github"
} |
{
"af": "afrikans",
"agq": "aghem",
"ak": "akan",
"sq": "albanski",
"am": "amharski",
"ar": "arapski",
"hy": "armenski",
"as": "asamski",
"ast": "asturijski",
"asa": "asu",
"az": "azerbejdžanski",
"ksf": "bafia",
"bm": "bambara",
"bas": "basa",
"eu": "baskijski",
"bem": "bemba",
"bez": "bena",
"bn": "bengalski",
"be": "bjeloruski",
"brx": "bodo",
"bs": "bosanski",
"br": "bretonski",
"bg": "bugarski",
"my": "burmanski",
"ceb": "cebuano",
"tzm": "centralnoatlaski tamazigt",
"ckb": "centralnokurdski",
"ce": "čečenski",
"chr": "čeroki",
"cs": "češki",
"cgg": "čiga",
"da": "danski",
"dsb": "donjolužičkosrpski",
"nds": "donjonjemački",
"nds-NL": "donjosaksonski",
"dua": "duala",
"dz": "džonga",
"ebu": "embu",
"en": "engleski",
"en-AU": "engleski (Australija)",
"en-CA": "engleski (Kanada)",
"en-GB": "engleski (Ujedinjeno Kraljevstvo)",
"et": "estonski",
"ee": "eve",
"ewo": "evondo",
"fo": "farski",
"fil": "filipino",
"fi": "finski",
"nl-BE": "flamanski",
"fr": "francuski",
"fr-CA": "francuski (Kanada)",
"fr-CH": "francuski (Švicarska)",
"fur": "friulijski",
"ff": "fulah",
"gl": "galicijski",
"lg": "ganda",
"hsb": "gornjolužičkosrpski",
"el": "grčki",
"ka": "gruzijski",
"gu": "gudžarati",
"guz": "gusi",
"ha": "hausa",
"haw": "havajski",
"he": "hebrejski",
"hi": "hindi",
"nl": "holandski",
"xh": "hosa",
"hr": "hrvatski",
"ig": "igbo",
"smn": "inari sami",
"id": "indonezijski",
"ga": "irski",
"is": "islandski",
"it": "italijanski",
"sah": "jakutski",
"yav": "jangben",
"ja": "japanski",
"jv": "javanski",
"yi": "jidiš",
"dyo": "jola-foni",
"yo": "jorubanski",
"kab": "kabile",
"kkj": "kako",
"kl": "kalalisutski",
"kln": "kalenjin",
"kam": "kamba",
"kn": "kanada",
"yue": "kantonski",
"ks": "kašmirski",
"ca": "katalonski",
"kk": "kazaški",
"qu": "kečua",
"ksh": "kelnski",
"ki": "kikuju",
"zh": "kineski",
"zh-Hans": "kineski (pojednostavljeni)",
"zh-Hant": "kineski (tradicionalni)",
"rw": "kinjaruanda",
"ky": "kirgiški",
"km": "kmerski",
"khq": "kojra čini",
"ses": "kojraboro seni",
"kok": "konkani",
"ko": "korejski",
"kw": "kornski",
"ku": "kurdski",
"nmg": "kvasio",
"lkt": "lakota",
"lag": "langi",
"lo": "laoski",
"lv": "latvijski",
"ln": "lingala",
"lt": "litvanski",
"lu": "luba-katanga",
"luy": "luhija",
"lb": "luksemburški",
"luo": "Luo",
"hu": "mađarski",
"jmc": "makame",
"mk": "makedonski",
"kde": "makonde",
"mgh": "makuva-meto",
"ml": "malajalam",
"ms": "malajski",
"mg": "malgaški",
"mt": "malteški",
"mi": "maorski",
"mr": "marati",
"mas": "masai",
"mfe": "mauricijski kreolski",
"mzn": "mazanderanski",
"mer": "meru",
"mgo": "meta",
"ro-MD": "moldavski",
"mn": "mongolski",
"mua": "mundang",
"naq": "nama",
"ne": "nepalski",
"nnh": "ngiembon",
"jgo": "ngomba",
"nb": "norveški (Bokmal)",
"nn": "norveški (Nynorsk)",
"nus": "nuer",
"nyn": "njankole",
"de": "njemački",
"de-AT": "njemački (Austrija)",
"gsw": "njemački (Švicarska)",
"or": "odija",
"om": "oromo",
"os": "osetski",
"pa": "pandžapski",
"ps": "paštu",
"fa": "perzijski",
"pl": "poljski",
"pt": "portugalski",
"pt-PT": "portugalski (Portugal)",
"rm": "retoromanski",
"rof": "rombo",
"rwk": "rua",
"ro": "rumunski",
"rn": "rundi",
"ru": "ruski",
"saq": "samburu",
"sg": "sango",
"sbp": "sangu",
"seh": "sena",
"ii": "sičuan ji",
"sd": "sindi",
"si": "sinhaleški",
"lrc": "sjeverni luri",
"nd": "sjeverni ndebele",
"se": "sjeverni sami",
"sk": "slovački",
"sl": "slovenski",
"xog": "soga",
"so": "somalski",
"sr": "srpski",
"zgh": "standardni marokanski tamazigt",
"sw": "svahili",
"sw-CD": "svahili (Demokratska Republika Kongo)",
"ksb": "šambala",
"gd": "škotski galski",
"sn": "šona",
"es": "španski",
"es-419": "španski (Latinska Amerika)",
"es-MX": "španski (Meksiko)",
"sv": "švedski",
"tg": "tadžički",
"shi": "tahelhit",
"dav": "taita",
"th": "tajlandski",
"ta": "tamilski",
"twq": "tasavak",
"tt": "tatarski",
"te": "telugu",
"teo": "teso",
"bo": "tibetanski",
"ti": "tigrinja",
"to": "tonganski",
"tk": "turkmenski",
"tr": "turski",
"ug": "ujgurski",
"uk": "ukrajinski",
"ur": "urdu",
"uz": "uzbečki",
"vai": "Vai",
"wae": "valser",
"wa": "valun",
"cy": "velški",
"vi": "vijetnamski",
"de-CH": "visoki njemački (Švicarska)",
"wo": "volof",
"vun": "vunjo",
"fy": "zapadni frizijski",
"dje": "zarma",
"kea": "zelenortski",
"zu": "zulu"
} | {
"pile_set_name": "Github"
} |
/* Synopsys DesignWare Core Enterprise Ethernet (XLGMAC) Driver
*
* Copyright (c) 2017 Synopsys, Inc. (www.synopsys.com)
*
* This program is dual-licensed; you may select either version 2 of
* the GNU General Public License ("GPL") or BSD license ("BSD").
*
* This Synopsys DWC XLGMAC software driver and associated documentation
* (hereinafter the "Software") is an unsupported proprietary work of
* Synopsys, Inc. unless otherwise expressly agreed to in writing between
* Synopsys and you. The Software IS NOT an item of Licensed Software or a
* Licensed Product under any End User Software License Agreement or
* Agreement for Licensed Products with Synopsys or any supplement thereto.
* Synopsys is a registered trademark of Synopsys, Inc. Other names included
* in the SOFTWARE may be the trademarks of their respective owners.
*/
#ifndef __DWC_XLGMAC_H__
#define __DWC_XLGMAC_H__
#include <linux/dma-mapping.h>
#include <linux/netdevice.h>
#include <linux/workqueue.h>
#include <linux/phy.h>
#include <linux/if_vlan.h>
#include <linux/bitops.h>
#include <linux/timecounter.h>
#define XLGMAC_DRV_NAME "dwc-xlgmac"
#define XLGMAC_DRV_VERSION "1.0.0"
#define XLGMAC_DRV_DESC "Synopsys DWC XLGMAC Driver"
/* Descriptor related parameters */
#define XLGMAC_TX_DESC_CNT 1024
#define XLGMAC_TX_DESC_MIN_FREE (XLGMAC_TX_DESC_CNT >> 3)
#define XLGMAC_TX_DESC_MAX_PROC (XLGMAC_TX_DESC_CNT >> 1)
#define XLGMAC_RX_DESC_CNT 1024
#define XLGMAC_RX_DESC_MAX_DIRTY (XLGMAC_RX_DESC_CNT >> 3)
/* Descriptors required for maximum contiguous TSO/GSO packet */
#define XLGMAC_TX_MAX_SPLIT ((GSO_MAX_SIZE / XLGMAC_TX_MAX_BUF_SIZE) + 1)
/* Maximum possible descriptors needed for a SKB */
#define XLGMAC_TX_MAX_DESC_NR (MAX_SKB_FRAGS + XLGMAC_TX_MAX_SPLIT + 2)
#define XLGMAC_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1))
#define XLGMAC_RX_MIN_BUF_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
#define XLGMAC_RX_BUF_ALIGN 64
/* Maximum Size for Splitting the Header Data
* Keep in sync with SKB_ALLOC_SIZE
* 3'b000: 64 bytes, 3'b001: 128 bytes
* 3'b010: 256 bytes, 3'b011: 512 bytes
* 3'b100: 1023 bytes , 3'b101'3'b111: Reserved
*/
#define XLGMAC_SPH_HDSMS_SIZE 3
#define XLGMAC_SKB_ALLOC_SIZE 512
#define XLGMAC_MAX_FIFO 81920
#define XLGMAC_MAX_DMA_CHANNELS 16
#define XLGMAC_DMA_STOP_TIMEOUT 5
#define XLGMAC_DMA_INTERRUPT_MASK 0x31c7
/* Default coalescing parameters */
#define XLGMAC_INIT_DMA_TX_USECS 1000
#define XLGMAC_INIT_DMA_TX_FRAMES 25
#define XLGMAC_INIT_DMA_RX_USECS 30
#define XLGMAC_INIT_DMA_RX_FRAMES 25
#define XLGMAC_MAX_DMA_RIWT 0xff
#define XLGMAC_MIN_DMA_RIWT 0x01
/* Flow control queue count */
#define XLGMAC_MAX_FLOW_CONTROL_QUEUES 8
/* System clock is 125 MHz */
#define XLGMAC_SYSCLOCK 125000000
/* Maximum MAC address hash table size (256 bits = 8 bytes) */
#define XLGMAC_MAC_HASH_TABLE_SIZE 8
/* Receive Side Scaling */
#define XLGMAC_RSS_HASH_KEY_SIZE 40
#define XLGMAC_RSS_MAX_TABLE_SIZE 256
#define XLGMAC_RSS_LOOKUP_TABLE_TYPE 0
#define XLGMAC_RSS_HASH_KEY_TYPE 1
#define XLGMAC_STD_PACKET_MTU 1500
#define XLGMAC_JUMBO_PACKET_MTU 9000
/* Helper macro for descriptor handling
* Always use XLGMAC_GET_DESC_DATA to access the descriptor data
*/
#define XLGMAC_GET_DESC_DATA(ring, idx) ({ \
typeof(ring) _ring = (ring); \
((_ring)->desc_data_head + \
((idx) & ((_ring)->dma_desc_count - 1))); \
})
#define XLGMAC_GET_REG_BITS(var, pos, len) ({ \
typeof(pos) _pos = (pos); \
typeof(len) _len = (len); \
((var) & GENMASK(_pos + _len - 1, _pos)) >> (_pos); \
})
#define XLGMAC_GET_REG_BITS_LE(var, pos, len) ({ \
typeof(pos) _pos = (pos); \
typeof(len) _len = (len); \
typeof(var) _var = le32_to_cpu((var)); \
((_var) & GENMASK(_pos + _len - 1, _pos)) >> (_pos); \
})
#define XLGMAC_SET_REG_BITS(var, pos, len, val) ({ \
typeof(var) _var = (var); \
typeof(pos) _pos = (pos); \
typeof(len) _len = (len); \
typeof(val) _val = (val); \
_val = (_val << _pos) & GENMASK(_pos + _len - 1, _pos); \
_var = (_var & ~GENMASK(_pos + _len - 1, _pos)) | _val; \
})
#define XLGMAC_SET_REG_BITS_LE(var, pos, len, val) ({ \
typeof(var) _var = (var); \
typeof(pos) _pos = (pos); \
typeof(len) _len = (len); \
typeof(val) _val = (val); \
_val = (_val << _pos) & GENMASK(_pos + _len - 1, _pos); \
_var = (_var & ~GENMASK(_pos + _len - 1, _pos)) | _val; \
cpu_to_le32(_var); \
})
struct xlgmac_pdata;
enum xlgmac_int {
XLGMAC_INT_DMA_CH_SR_TI,
XLGMAC_INT_DMA_CH_SR_TPS,
XLGMAC_INT_DMA_CH_SR_TBU,
XLGMAC_INT_DMA_CH_SR_RI,
XLGMAC_INT_DMA_CH_SR_RBU,
XLGMAC_INT_DMA_CH_SR_RPS,
XLGMAC_INT_DMA_CH_SR_TI_RI,
XLGMAC_INT_DMA_CH_SR_FBE,
XLGMAC_INT_DMA_ALL,
};
struct xlgmac_stats {
/* MMC TX counters */
u64 txoctetcount_gb;
u64 txframecount_gb;
u64 txbroadcastframes_g;
u64 txmulticastframes_g;
u64 tx64octets_gb;
u64 tx65to127octets_gb;
u64 tx128to255octets_gb;
u64 tx256to511octets_gb;
u64 tx512to1023octets_gb;
u64 tx1024tomaxoctets_gb;
u64 txunicastframes_gb;
u64 txmulticastframes_gb;
u64 txbroadcastframes_gb;
u64 txunderflowerror;
u64 txoctetcount_g;
u64 txframecount_g;
u64 txpauseframes;
u64 txvlanframes_g;
/* MMC RX counters */
u64 rxframecount_gb;
u64 rxoctetcount_gb;
u64 rxoctetcount_g;
u64 rxbroadcastframes_g;
u64 rxmulticastframes_g;
u64 rxcrcerror;
u64 rxrunterror;
u64 rxjabbererror;
u64 rxundersize_g;
u64 rxoversize_g;
u64 rx64octets_gb;
u64 rx65to127octets_gb;
u64 rx128to255octets_gb;
u64 rx256to511octets_gb;
u64 rx512to1023octets_gb;
u64 rx1024tomaxoctets_gb;
u64 rxunicastframes_g;
u64 rxlengtherror;
u64 rxoutofrangetype;
u64 rxpauseframes;
u64 rxfifooverflow;
u64 rxvlanframes_gb;
u64 rxwatchdogerror;
/* Extra counters */
u64 tx_tso_packets;
u64 rx_split_header_packets;
u64 tx_process_stopped;
u64 rx_process_stopped;
u64 tx_buffer_unavailable;
u64 rx_buffer_unavailable;
u64 fatal_bus_error;
u64 tx_vlan_packets;
u64 rx_vlan_packets;
u64 napi_poll_isr;
u64 napi_poll_txtimer;
};
struct xlgmac_ring_buf {
struct sk_buff *skb;
dma_addr_t skb_dma;
unsigned int skb_len;
};
/* Common Tx and Rx DMA hardware descriptor */
struct xlgmac_dma_desc {
__le32 desc0;
__le32 desc1;
__le32 desc2;
__le32 desc3;
};
/* Page allocation related values */
struct xlgmac_page_alloc {
struct page *pages;
unsigned int pages_len;
unsigned int pages_offset;
dma_addr_t pages_dma;
};
/* Ring entry buffer data */
struct xlgmac_buffer_data {
struct xlgmac_page_alloc pa;
struct xlgmac_page_alloc pa_unmap;
dma_addr_t dma_base;
unsigned long dma_off;
unsigned int dma_len;
};
/* Tx-related desc data */
struct xlgmac_tx_desc_data {
unsigned int packets; /* BQL packet count */
unsigned int bytes; /* BQL byte count */
};
/* Rx-related desc data */
struct xlgmac_rx_desc_data {
struct xlgmac_buffer_data hdr; /* Header locations */
struct xlgmac_buffer_data buf; /* Payload locations */
unsigned short hdr_len; /* Length of received header */
unsigned short len; /* Length of received packet */
};
struct xlgmac_pkt_info {
struct sk_buff *skb;
unsigned int attributes;
unsigned int errors;
/* descriptors needed for this packet */
unsigned int desc_count;
unsigned int length;
unsigned int tx_packets;
unsigned int tx_bytes;
unsigned int header_len;
unsigned int tcp_header_len;
unsigned int tcp_payload_len;
unsigned short mss;
unsigned short vlan_ctag;
u64 rx_tstamp;
u32 rss_hash;
enum pkt_hash_types rss_hash_type;
};
struct xlgmac_desc_data {
/* dma_desc: Virtual address of descriptor
* dma_desc_addr: DMA address of descriptor
*/
struct xlgmac_dma_desc *dma_desc;
dma_addr_t dma_desc_addr;
/* skb: Virtual address of SKB
* skb_dma: DMA address of SKB data
* skb_dma_len: Length of SKB DMA area
*/
struct sk_buff *skb;
dma_addr_t skb_dma;
unsigned int skb_dma_len;
/* Tx/Rx -related data */
struct xlgmac_tx_desc_data tx;
struct xlgmac_rx_desc_data rx;
unsigned int mapped_as_page;
/* Incomplete receive save location. If the budget is exhausted
* or the last descriptor (last normal descriptor or a following
* context descriptor) has not been DMA'd yet the current state
* of the receive processing needs to be saved.
*/
unsigned int state_saved;
struct {
struct sk_buff *skb;
unsigned int len;
unsigned int error;
} state;
};
struct xlgmac_ring {
/* Per packet related information */
struct xlgmac_pkt_info pkt_info;
/* Virtual/DMA addresses of DMA descriptor list and the total count */
struct xlgmac_dma_desc *dma_desc_head;
dma_addr_t dma_desc_head_addr;
unsigned int dma_desc_count;
/* Array of descriptor data corresponding the DMA descriptor
* (always use the XLGMAC_GET_DESC_DATA macro to access this data)
*/
struct xlgmac_desc_data *desc_data_head;
/* Page allocation for RX buffers */
struct xlgmac_page_alloc rx_hdr_pa;
struct xlgmac_page_alloc rx_buf_pa;
/* Ring index values
* cur - Tx: index of descriptor to be used for current transfer
* Rx: index of descriptor to check for packet availability
* dirty - Tx: index of descriptor to check for transfer complete
* Rx: index of descriptor to check for buffer reallocation
*/
unsigned int cur;
unsigned int dirty;
/* Coalesce frame count used for interrupt bit setting */
unsigned int coalesce_count;
union {
struct {
unsigned int xmit_more;
unsigned int queue_stopped;
unsigned short cur_mss;
unsigned short cur_vlan_ctag;
} tx;
};
} ____cacheline_aligned;
struct xlgmac_channel {
char name[16];
/* Address of private data area for device */
struct xlgmac_pdata *pdata;
/* Queue index and base address of queue's DMA registers */
unsigned int queue_index;
void __iomem *dma_regs;
/* Per channel interrupt irq number */
int dma_irq;
char dma_irq_name[IFNAMSIZ + 32];
/* Netdev related settings */
struct napi_struct napi;
unsigned int saved_ier;
unsigned int tx_timer_active;
struct timer_list tx_timer;
struct xlgmac_ring *tx_ring;
struct xlgmac_ring *rx_ring;
} ____cacheline_aligned;
struct xlgmac_desc_ops {
int (*alloc_channles_and_rings)(struct xlgmac_pdata *pdata);
void (*free_channels_and_rings)(struct xlgmac_pdata *pdata);
int (*map_tx_skb)(struct xlgmac_channel *channel,
struct sk_buff *skb);
int (*map_rx_buffer)(struct xlgmac_pdata *pdata,
struct xlgmac_ring *ring,
struct xlgmac_desc_data *desc_data);
void (*unmap_desc_data)(struct xlgmac_pdata *pdata,
struct xlgmac_desc_data *desc_data);
void (*tx_desc_init)(struct xlgmac_pdata *pdata);
void (*rx_desc_init)(struct xlgmac_pdata *pdata);
};
struct xlgmac_hw_ops {
int (*init)(struct xlgmac_pdata *pdata);
int (*exit)(struct xlgmac_pdata *pdata);
int (*tx_complete)(struct xlgmac_dma_desc *dma_desc);
void (*enable_tx)(struct xlgmac_pdata *pdata);
void (*disable_tx)(struct xlgmac_pdata *pdata);
void (*enable_rx)(struct xlgmac_pdata *pdata);
void (*disable_rx)(struct xlgmac_pdata *pdata);
int (*enable_int)(struct xlgmac_channel *channel,
enum xlgmac_int int_id);
int (*disable_int)(struct xlgmac_channel *channel,
enum xlgmac_int int_id);
void (*dev_xmit)(struct xlgmac_channel *channel);
int (*dev_read)(struct xlgmac_channel *channel);
int (*set_mac_address)(struct xlgmac_pdata *pdata, u8 *addr);
int (*config_rx_mode)(struct xlgmac_pdata *pdata);
int (*enable_rx_csum)(struct xlgmac_pdata *pdata);
int (*disable_rx_csum)(struct xlgmac_pdata *pdata);
/* For MII speed configuration */
int (*set_xlgmii_25000_speed)(struct xlgmac_pdata *pdata);
int (*set_xlgmii_40000_speed)(struct xlgmac_pdata *pdata);
int (*set_xlgmii_50000_speed)(struct xlgmac_pdata *pdata);
int (*set_xlgmii_100000_speed)(struct xlgmac_pdata *pdata);
/* For descriptor related operation */
void (*tx_desc_init)(struct xlgmac_channel *channel);
void (*rx_desc_init)(struct xlgmac_channel *channel);
void (*tx_desc_reset)(struct xlgmac_desc_data *desc_data);
void (*rx_desc_reset)(struct xlgmac_pdata *pdata,
struct xlgmac_desc_data *desc_data,
unsigned int index);
int (*is_last_desc)(struct xlgmac_dma_desc *dma_desc);
int (*is_context_desc)(struct xlgmac_dma_desc *dma_desc);
void (*tx_start_xmit)(struct xlgmac_channel *channel,
struct xlgmac_ring *ring);
/* For Flow Control */
int (*config_tx_flow_control)(struct xlgmac_pdata *pdata);
int (*config_rx_flow_control)(struct xlgmac_pdata *pdata);
/* For Vlan related config */
int (*enable_rx_vlan_stripping)(struct xlgmac_pdata *pdata);
int (*disable_rx_vlan_stripping)(struct xlgmac_pdata *pdata);
int (*enable_rx_vlan_filtering)(struct xlgmac_pdata *pdata);
int (*disable_rx_vlan_filtering)(struct xlgmac_pdata *pdata);
int (*update_vlan_hash_table)(struct xlgmac_pdata *pdata);
/* For RX coalescing */
int (*config_rx_coalesce)(struct xlgmac_pdata *pdata);
int (*config_tx_coalesce)(struct xlgmac_pdata *pdata);
unsigned int (*usec_to_riwt)(struct xlgmac_pdata *pdata,
unsigned int usec);
unsigned int (*riwt_to_usec)(struct xlgmac_pdata *pdata,
unsigned int riwt);
/* For RX and TX threshold config */
int (*config_rx_threshold)(struct xlgmac_pdata *pdata,
unsigned int val);
int (*config_tx_threshold)(struct xlgmac_pdata *pdata,
unsigned int val);
/* For RX and TX Store and Forward Mode config */
int (*config_rsf_mode)(struct xlgmac_pdata *pdata,
unsigned int val);
int (*config_tsf_mode)(struct xlgmac_pdata *pdata,
unsigned int val);
/* For TX DMA Operate on Second Frame config */
int (*config_osp_mode)(struct xlgmac_pdata *pdata);
/* For RX and TX PBL config */
int (*config_rx_pbl_val)(struct xlgmac_pdata *pdata);
int (*get_rx_pbl_val)(struct xlgmac_pdata *pdata);
int (*config_tx_pbl_val)(struct xlgmac_pdata *pdata);
int (*get_tx_pbl_val)(struct xlgmac_pdata *pdata);
int (*config_pblx8)(struct xlgmac_pdata *pdata);
/* For MMC statistics */
void (*rx_mmc_int)(struct xlgmac_pdata *pdata);
void (*tx_mmc_int)(struct xlgmac_pdata *pdata);
void (*read_mmc_stats)(struct xlgmac_pdata *pdata);
/* For Receive Side Scaling */
int (*enable_rss)(struct xlgmac_pdata *pdata);
int (*disable_rss)(struct xlgmac_pdata *pdata);
int (*set_rss_hash_key)(struct xlgmac_pdata *pdata,
const u8 *key);
int (*set_rss_lookup_table)(struct xlgmac_pdata *pdata,
const u32 *table);
};
/* This structure contains flags that indicate what hardware features
* or configurations are present in the device.
*/
struct xlgmac_hw_features {
/* HW Version */
unsigned int version;
/* HW Feature Register0 */
unsigned int phyifsel; /* PHY interface support */
unsigned int vlhash; /* VLAN Hash Filter */
unsigned int sma; /* SMA(MDIO) Interface */
unsigned int rwk; /* PMT remote wake-up packet */
unsigned int mgk; /* PMT magic packet */
unsigned int mmc; /* RMON module */
unsigned int aoe; /* ARP Offload */
unsigned int ts; /* IEEE 1588-2008 Advanced Timestamp */
unsigned int eee; /* Energy Efficient Ethernet */
unsigned int tx_coe; /* Tx Checksum Offload */
unsigned int rx_coe; /* Rx Checksum Offload */
unsigned int addn_mac; /* Additional MAC Addresses */
unsigned int ts_src; /* Timestamp Source */
unsigned int sa_vlan_ins; /* Source Address or VLAN Insertion */
/* HW Feature Register1 */
unsigned int rx_fifo_size; /* MTL Receive FIFO Size */
unsigned int tx_fifo_size; /* MTL Transmit FIFO Size */
unsigned int adv_ts_hi; /* Advance Timestamping High Word */
unsigned int dma_width; /* DMA width */
unsigned int dcb; /* DCB Feature */
unsigned int sph; /* Split Header Feature */
unsigned int tso; /* TCP Segmentation Offload */
unsigned int dma_debug; /* DMA Debug Registers */
unsigned int rss; /* Receive Side Scaling */
unsigned int tc_cnt; /* Number of Traffic Classes */
unsigned int hash_table_size; /* Hash Table Size */
unsigned int l3l4_filter_num; /* Number of L3-L4 Filters */
/* HW Feature Register2 */
unsigned int rx_q_cnt; /* Number of MTL Receive Queues */
unsigned int tx_q_cnt; /* Number of MTL Transmit Queues */
unsigned int rx_ch_cnt; /* Number of DMA Receive Channels */
unsigned int tx_ch_cnt; /* Number of DMA Transmit Channels */
unsigned int pps_out_num; /* Number of PPS outputs */
unsigned int aux_snap_num; /* Number of Aux snapshot inputs */
};
struct xlgmac_resources {
void __iomem *addr;
int irq;
};
struct xlgmac_pdata {
struct net_device *netdev;
struct device *dev;
struct xlgmac_hw_ops hw_ops;
struct xlgmac_desc_ops desc_ops;
/* Device statistics */
struct xlgmac_stats stats;
u32 msg_enable;
/* MAC registers base */
void __iomem *mac_regs;
/* Hardware features of the device */
struct xlgmac_hw_features hw_feat;
struct work_struct restart_work;
/* Rings for Tx/Rx on a DMA channel */
struct xlgmac_channel *channel_head;
unsigned int channel_count;
unsigned int tx_ring_count;
unsigned int rx_ring_count;
unsigned int tx_desc_count;
unsigned int rx_desc_count;
unsigned int tx_q_count;
unsigned int rx_q_count;
/* Tx/Rx common settings */
unsigned int pblx8;
/* Tx settings */
unsigned int tx_sf_mode;
unsigned int tx_threshold;
unsigned int tx_pbl;
unsigned int tx_osp_mode;
/* Rx settings */
unsigned int rx_sf_mode;
unsigned int rx_threshold;
unsigned int rx_pbl;
/* Tx coalescing settings */
unsigned int tx_usecs;
unsigned int tx_frames;
/* Rx coalescing settings */
unsigned int rx_riwt;
unsigned int rx_usecs;
unsigned int rx_frames;
/* Current Rx buffer size */
unsigned int rx_buf_size;
/* Flow control settings */
unsigned int tx_pause;
unsigned int rx_pause;
/* Device interrupt number */
int dev_irq;
unsigned int per_channel_irq;
int channel_irq[XLGMAC_MAX_DMA_CHANNELS];
/* Netdev related settings */
unsigned char mac_addr[ETH_ALEN];
netdev_features_t netdev_features;
struct napi_struct napi;
/* Filtering support */
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
/* Device clocks */
unsigned long sysclk_rate;
/* RSS addressing mutex */
struct mutex rss_mutex;
/* Receive Side Scaling settings */
u8 rss_key[XLGMAC_RSS_HASH_KEY_SIZE];
u32 rss_table[XLGMAC_RSS_MAX_TABLE_SIZE];
u32 rss_options;
int phy_speed;
char drv_name[32];
char drv_ver[32];
};
void xlgmac_init_desc_ops(struct xlgmac_desc_ops *desc_ops);
void xlgmac_init_hw_ops(struct xlgmac_hw_ops *hw_ops);
const struct net_device_ops *xlgmac_get_netdev_ops(void);
const struct ethtool_ops *xlgmac_get_ethtool_ops(void);
void xlgmac_dump_tx_desc(struct xlgmac_pdata *pdata,
struct xlgmac_ring *ring,
unsigned int idx,
unsigned int count,
unsigned int flag);
void xlgmac_dump_rx_desc(struct xlgmac_pdata *pdata,
struct xlgmac_ring *ring,
unsigned int idx);
void xlgmac_print_pkt(struct net_device *netdev,
struct sk_buff *skb, bool tx_rx);
void xlgmac_get_all_hw_features(struct xlgmac_pdata *pdata);
void xlgmac_print_all_hw_features(struct xlgmac_pdata *pdata);
int xlgmac_drv_probe(struct device *dev,
struct xlgmac_resources *res);
int xlgmac_drv_remove(struct device *dev);
/* For debug prints */
#ifdef XLGMAC_DEBUG
#define XLGMAC_PR(fmt, args...) \
pr_alert("[%s,%d]:" fmt, __func__, __LINE__, ## args)
#else
#define XLGMAC_PR(x...) do { } while (0)
#endif
#endif /* __DWC_XLGMAC_H__ */
| {
"pile_set_name": "Github"
} |
---
name: Xamarin.Android - Android Beam Demo
description: "Demonstrates new Android Beam NFC feature (Android Ice Cream Sandwich)"
page_type: sample
languages:
- csharp
products:
- xamarin
extensions:
tags:
- androidicecreamsandwich
urlFragment: androidbeamdemo
---
# Android Beam Demo fpr Xamarin.Android
This is a port of Android SDK samples.
It demonstrates new Android Beam (new NFC feature) in Ice Cream Sandwich.
| {
"pile_set_name": "Github"
} |
//
// Prefix header for all source files of the 'CocoaTouchStaticLibrary' target in the 'CocoaTouchStaticLibrary' project.
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import "DebugStatus.h"
#if TARGET_OS_IPHONE
#import <UIKit/UIDevice.h>
#endif
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/player_image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:civ_border="false"
app:civ_shadow="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription,UnusedAttribute"
tools:srcCompat="@tools:sample/backgrounds/scenic[4]" />
</androidx.constraintlayout.widget.ConstraintLayout> | {
"pile_set_name": "Github"
} |
const express = require("express")
const crypto = require('crypto')
const router = express()
const { createWebAPIRequest } = require("../util/util")
router.get("/", (req, res) => {
const phone = req.query.phone
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
const md5sum = crypto.createHash('md5')
md5sum.update(req.query.password)
const data = {
'phone': phone,
'password': md5sum.digest('hex'),
'rememberLogin': 'true'
}
createWebAPIRequest(
'music.163.com',
'/weapi/login/cellphone',
'POST',
data,
cookie,
(music_req, cookie) => {
console.log(music_req)
res.set({
'Set-Cookie': cookie,
})
res.send(music_req)
},
err => res.status(502).send('fetch error')
)
})
module.exports = router | {
"pile_set_name": "Github"
} |
1
00:00:01:14 --> 00:00:06:08
I liked how open-ended it was and how everyone was just sort of
2
00:00:06:11 --> 00:00:10:18
searching for a project to work on together, and
3
00:00:11:12 --> 00:00:16:15
I don’t know, it was so great to walk around and see what everyone is doing, kind of glance over their computer screens
4
00:00:16:18 --> 00:00:22:10
and every time someone had a breakthrough, we all got up and ran over their computer screen and watched their demo
5
00:00:22:13 --> 00:00:27:17
and that was really great and I can’t even think of like another experience that I have had like that
6
00:00:27:20 --> 00:00:31:24
just like everyone was in peak creative mood for days at a time
7
00:00:31:27 --> 00:00:35:20
and that everything is open and sharing with one another.
| {
"pile_set_name": "Github"
} |
#define SUSBCRequest_SetBaudRateParityAndStopBits 1
#define SUSBCR_SBR_MASK 0xFF00
#define SUSBCR_SBR_1200 0x0100
#define SUSBCR_SBR_9600 0x0200
#define SUSBCR_SBR_19200 0x0400
#define SUSBCR_SBR_28800 0x0800
#define SUSBCR_SBR_38400 0x1000
#define SUSBCR_SBR_57600 0x2000
#define SUSBCR_SBR_115200 0x4000
#define SUSBCR_SPASB_MASK 0x0070
#define SUSBCR_SPASB_NoParity 0x0010
#define SUSBCR_SPASB_OddParity 0x0020
#define SUSBCR_SPASB_EvenParity 0x0040
#define SUSBCR_SPASB_STPMASK 0x0003
#define SUSBCR_SPASB_1StopBit 0x0001
#define SUSBCR_SPASB_2StopBits 0x0002
#define SUSBCRequest_SetStatusLinesOrQueues 2
#define SUSBCR_SSL_SETRTS 0x0001
#define SUSBCR_SSL_CLRRTS 0x0002
#define SUSBCR_SSL_SETDTR 0x0004
#define SUSBCR_SSL_CLRDTR 0x0010
/* Kill the pending/current writes to the comm port. */
#define SUSBCR_SSL_PURGE_TXABORT 0x0100
/* Kill the pending/current reads to the comm port. */
#define SUSBCR_SSL_PURGE_RXABORT 0x0200
/* Kill the transmit queue if there. */
#define SUSBCR_SSL_PURGE_TXCLEAR 0x0400
/* Kill the typeahead buffer if there. */
#define SUSBCR_SSL_PURGE_RXCLEAR 0x0800
#define SUSBCRequest_GetStatusLineState 4
/* Any Character received */
#define SUSBCR_GSL_RXCHAR 0x0001
/* Transmitt Queue Empty */
#define SUSBCR_GSL_TXEMPTY 0x0004
/* CTS changed state */
#define SUSBCR_GSL_CTS 0x0008
/* DSR changed state */
#define SUSBCR_GSL_DSR 0x0010
/* RLSD changed state */
#define SUSBCR_GSL_RLSD 0x0020
/* BREAK received */
#define SUSBCR_GSL_BREAK 0x0040
/* Line status error occurred */
#define SUSBCR_GSL_ERR 0x0080
/* Ring signal detected */
#define SUSBCR_GSL_RING 0x0100
#define SUSBCRequest_Misc 8
/* use a predefined reset sequence */
#define SUSBCR_MSC_ResetReader 0x0001
/* use a predefined sequence to reset the internal queues */
#define SUSBCR_MSC_ResetAllQueues 0x0002
#define SUSBCRequest_GetMisc 0x10
/*
* get the firmware version from device, coded like this 0xHHLLBBPP with
* HH = Firmware Version High Byte
* LL = Firmware Version Low Byte
* BB = Build Number
* PP = Further Attributes
*/
#define SUSBCR_MSC_GetFWVersion 0x0001
/*
* get the hardware version from device coded like this 0xHHLLPPRR with
* HH = Software Version High Byte
* LL = Software Version Low Byte
* PP = Further Attributes
* RR = Reserved for the hardware ID
*/
#define SUSBCR_MSC_GetHWVersion 0x0002
| {
"pile_set_name": "Github"
} |
---
title: image_ocr
type: docs
repo: https://github.com/rstudio/keras
---
<div class="source-ref">
<span class="caption">Source: </span>`r sprintf("https://github.com/rstudio/keras/blob/master/vignettes/examples/%s.R", rmarkdown::metadata$title)`
</div>
```{r, echo = FALSE}
knitr::opts_chunk$set(eval = FALSE)
knitr::spin_child(paste0(rmarkdown::metadata$title, ".R"))
```
| {
"pile_set_name": "Github"
} |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: github.com/getamis/alice/crypto/tss/addshare/message.proto
package addshare
import (
fmt "fmt"
birkhoffinterpolation "github.com/getamis/alice/crypto/birkhoffinterpolation"
ecpointgrouplaw "github.com/getamis/alice/crypto/ecpointgrouplaw"
zkproof "github.com/getamis/alice/crypto/zkproof"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Type int32
const (
Type_OldPeer Type = 0
Type_NewBk Type = 1
Type_Compute Type = 2
Type_Result Type = 3
Type_Verify Type = 4
)
var Type_name = map[int32]string{
0: "OldPeer",
1: "NewBk",
2: "Compute",
3: "Result",
4: "Verify",
}
var Type_value = map[string]int32{
"OldPeer": 0,
"NewBk": 1,
"Compute": 2,
"Result": 3,
"Verify": 4,
}
func (x Type) String() string {
return proto.EnumName(Type_name, int32(x))
}
func (Type) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{0}
}
type Message struct {
Type Type `protobuf:"varint,1,opt,name=type,proto3,enum=addshare.Type" json:"type,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
// Types that are valid to be assigned to Body:
// *Message_OldPeer
// *Message_NewBk
// *Message_Compute
// *Message_Result
// *Message_Verify
Body isMessage_Body `protobuf_oneof:"body"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{0}
}
func (m *Message) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Message.Unmarshal(m, b)
}
func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Message.Marshal(b, m, deterministic)
}
func (m *Message) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message.Merge(m, src)
}
func (m *Message) XXX_Size() int {
return xxx_messageInfo_Message.Size(m)
}
func (m *Message) XXX_DiscardUnknown() {
xxx_messageInfo_Message.DiscardUnknown(m)
}
var xxx_messageInfo_Message proto.InternalMessageInfo
func (m *Message) GetType() Type {
if m != nil {
return m.Type
}
return Type_OldPeer
}
func (m *Message) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type isMessage_Body interface {
isMessage_Body()
}
type Message_OldPeer struct {
OldPeer *BodyOldPeer `protobuf:"bytes,3,opt,name=old_peer,json=oldPeer,proto3,oneof"`
}
type Message_NewBk struct {
NewBk *BodyNewBk `protobuf:"bytes,4,opt,name=new_bk,json=newBk,proto3,oneof"`
}
type Message_Compute struct {
Compute *BodyCompute `protobuf:"bytes,5,opt,name=compute,proto3,oneof"`
}
type Message_Result struct {
Result *BodyResult `protobuf:"bytes,6,opt,name=result,proto3,oneof"`
}
type Message_Verify struct {
Verify *BodyVerify `protobuf:"bytes,7,opt,name=verify,proto3,oneof"`
}
func (*Message_OldPeer) isMessage_Body() {}
func (*Message_NewBk) isMessage_Body() {}
func (*Message_Compute) isMessage_Body() {}
func (*Message_Result) isMessage_Body() {}
func (*Message_Verify) isMessage_Body() {}
func (m *Message) GetBody() isMessage_Body {
if m != nil {
return m.Body
}
return nil
}
func (m *Message) GetOldPeer() *BodyOldPeer {
if x, ok := m.GetBody().(*Message_OldPeer); ok {
return x.OldPeer
}
return nil
}
func (m *Message) GetNewBk() *BodyNewBk {
if x, ok := m.GetBody().(*Message_NewBk); ok {
return x.NewBk
}
return nil
}
func (m *Message) GetCompute() *BodyCompute {
if x, ok := m.GetBody().(*Message_Compute); ok {
return x.Compute
}
return nil
}
func (m *Message) GetResult() *BodyResult {
if x, ok := m.GetBody().(*Message_Result); ok {
return x.Result
}
return nil
}
func (m *Message) GetVerify() *BodyVerify {
if x, ok := m.GetBody().(*Message_Verify); ok {
return x.Verify
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Message) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Message_OldPeer)(nil),
(*Message_NewBk)(nil),
(*Message_Compute)(nil),
(*Message_Result)(nil),
(*Message_Verify)(nil),
}
}
type BodyOldPeer struct {
Bk *birkhoffinterpolation.BkParameterMessage `protobuf:"bytes,1,opt,name=bk,proto3" json:"bk,omitempty"`
SiGProofMsg *zkproof.SchnorrProofMessage `protobuf:"bytes,2,opt,name=siGProofMsg,proto3" json:"siGProofMsg,omitempty"`
Pubkey *ecpointgrouplaw.EcPointMessage `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Threshold uint32 `protobuf:"varint,4,opt,name=threshold,proto3" json:"threshold,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BodyOldPeer) Reset() { *m = BodyOldPeer{} }
func (m *BodyOldPeer) String() string { return proto.CompactTextString(m) }
func (*BodyOldPeer) ProtoMessage() {}
func (*BodyOldPeer) Descriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{1}
}
func (m *BodyOldPeer) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BodyOldPeer.Unmarshal(m, b)
}
func (m *BodyOldPeer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BodyOldPeer.Marshal(b, m, deterministic)
}
func (m *BodyOldPeer) XXX_Merge(src proto.Message) {
xxx_messageInfo_BodyOldPeer.Merge(m, src)
}
func (m *BodyOldPeer) XXX_Size() int {
return xxx_messageInfo_BodyOldPeer.Size(m)
}
func (m *BodyOldPeer) XXX_DiscardUnknown() {
xxx_messageInfo_BodyOldPeer.DiscardUnknown(m)
}
var xxx_messageInfo_BodyOldPeer proto.InternalMessageInfo
func (m *BodyOldPeer) GetBk() *birkhoffinterpolation.BkParameterMessage {
if m != nil {
return m.Bk
}
return nil
}
func (m *BodyOldPeer) GetSiGProofMsg() *zkproof.SchnorrProofMessage {
if m != nil {
return m.SiGProofMsg
}
return nil
}
func (m *BodyOldPeer) GetPubkey() *ecpointgrouplaw.EcPointMessage {
if m != nil {
return m.Pubkey
}
return nil
}
func (m *BodyOldPeer) GetThreshold() uint32 {
if m != nil {
return m.Threshold
}
return 0
}
type BodyNewBk struct {
Bk *birkhoffinterpolation.BkParameterMessage `protobuf:"bytes,1,opt,name=bk,proto3" json:"bk,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BodyNewBk) Reset() { *m = BodyNewBk{} }
func (m *BodyNewBk) String() string { return proto.CompactTextString(m) }
func (*BodyNewBk) ProtoMessage() {}
func (*BodyNewBk) Descriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{2}
}
func (m *BodyNewBk) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BodyNewBk.Unmarshal(m, b)
}
func (m *BodyNewBk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BodyNewBk.Marshal(b, m, deterministic)
}
func (m *BodyNewBk) XXX_Merge(src proto.Message) {
xxx_messageInfo_BodyNewBk.Merge(m, src)
}
func (m *BodyNewBk) XXX_Size() int {
return xxx_messageInfo_BodyNewBk.Size(m)
}
func (m *BodyNewBk) XXX_DiscardUnknown() {
xxx_messageInfo_BodyNewBk.DiscardUnknown(m)
}
var xxx_messageInfo_BodyNewBk proto.InternalMessageInfo
func (m *BodyNewBk) GetBk() *birkhoffinterpolation.BkParameterMessage {
if m != nil {
return m.Bk
}
return nil
}
type BodyCompute struct {
Delta []byte `protobuf:"bytes,1,opt,name=delta,proto3" json:"delta,omitempty"`
SiGProofMsg *zkproof.SchnorrProofMessage `protobuf:"bytes,2,opt,name=siGProofMsg,proto3" json:"siGProofMsg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BodyCompute) Reset() { *m = BodyCompute{} }
func (m *BodyCompute) String() string { return proto.CompactTextString(m) }
func (*BodyCompute) ProtoMessage() {}
func (*BodyCompute) Descriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{3}
}
func (m *BodyCompute) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BodyCompute.Unmarshal(m, b)
}
func (m *BodyCompute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BodyCompute.Marshal(b, m, deterministic)
}
func (m *BodyCompute) XXX_Merge(src proto.Message) {
xxx_messageInfo_BodyCompute.Merge(m, src)
}
func (m *BodyCompute) XXX_Size() int {
return xxx_messageInfo_BodyCompute.Size(m)
}
func (m *BodyCompute) XXX_DiscardUnknown() {
xxx_messageInfo_BodyCompute.DiscardUnknown(m)
}
var xxx_messageInfo_BodyCompute proto.InternalMessageInfo
func (m *BodyCompute) GetDelta() []byte {
if m != nil {
return m.Delta
}
return nil
}
func (m *BodyCompute) GetSiGProofMsg() *zkproof.SchnorrProofMessage {
if m != nil {
return m.SiGProofMsg
}
return nil
}
type BodyResult struct {
Delta []byte `protobuf:"bytes,1,opt,name=delta,proto3" json:"delta,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BodyResult) Reset() { *m = BodyResult{} }
func (m *BodyResult) String() string { return proto.CompactTextString(m) }
func (*BodyResult) ProtoMessage() {}
func (*BodyResult) Descriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{4}
}
func (m *BodyResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BodyResult.Unmarshal(m, b)
}
func (m *BodyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BodyResult.Marshal(b, m, deterministic)
}
func (m *BodyResult) XXX_Merge(src proto.Message) {
xxx_messageInfo_BodyResult.Merge(m, src)
}
func (m *BodyResult) XXX_Size() int {
return xxx_messageInfo_BodyResult.Size(m)
}
func (m *BodyResult) XXX_DiscardUnknown() {
xxx_messageInfo_BodyResult.DiscardUnknown(m)
}
var xxx_messageInfo_BodyResult proto.InternalMessageInfo
func (m *BodyResult) GetDelta() []byte {
if m != nil {
return m.Delta
}
return nil
}
type BodyVerify struct {
SiGProofMsg *zkproof.SchnorrProofMessage `protobuf:"bytes,1,opt,name=siGProofMsg,proto3" json:"siGProofMsg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BodyVerify) Reset() { *m = BodyVerify{} }
func (m *BodyVerify) String() string { return proto.CompactTextString(m) }
func (*BodyVerify) ProtoMessage() {}
func (*BodyVerify) Descriptor() ([]byte, []int) {
return fileDescriptor_3fbc6fdd3de40a9f, []int{5}
}
func (m *BodyVerify) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BodyVerify.Unmarshal(m, b)
}
func (m *BodyVerify) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BodyVerify.Marshal(b, m, deterministic)
}
func (m *BodyVerify) XXX_Merge(src proto.Message) {
xxx_messageInfo_BodyVerify.Merge(m, src)
}
func (m *BodyVerify) XXX_Size() int {
return xxx_messageInfo_BodyVerify.Size(m)
}
func (m *BodyVerify) XXX_DiscardUnknown() {
xxx_messageInfo_BodyVerify.DiscardUnknown(m)
}
var xxx_messageInfo_BodyVerify proto.InternalMessageInfo
func (m *BodyVerify) GetSiGProofMsg() *zkproof.SchnorrProofMessage {
if m != nil {
return m.SiGProofMsg
}
return nil
}
func init() {
proto.RegisterEnum("addshare.Type", Type_name, Type_value)
proto.RegisterType((*Message)(nil), "addshare.Message")
proto.RegisterType((*BodyOldPeer)(nil), "addshare.BodyOldPeer")
proto.RegisterType((*BodyNewBk)(nil), "addshare.BodyNewBk")
proto.RegisterType((*BodyCompute)(nil), "addshare.BodyCompute")
proto.RegisterType((*BodyResult)(nil), "addshare.BodyResult")
proto.RegisterType((*BodyVerify)(nil), "addshare.BodyVerify")
}
func init() {
proto.RegisterFile("github.com/getamis/alice/crypto/tss/addshare/message.proto", fileDescriptor_3fbc6fdd3de40a9f)
}
var fileDescriptor_3fbc6fdd3de40a9f = []byte{
// 526 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x5f, 0x8b, 0xd3, 0x4e,
0x14, 0x6d, 0xb2, 0x6d, 0xba, 0xbd, 0xf9, 0xfd, 0x96, 0x32, 0xae, 0x10, 0x96, 0x05, 0x4b, 0x9e,
0xaa, 0x48, 0x82, 0x15, 0x11, 0x15, 0xf6, 0xa1, 0x8b, 0xda, 0x07, 0x57, 0x4b, 0x14, 0x5f, 0x97,
0xfc, 0xb9, 0x6d, 0x86, 0xa4, 0x99, 0x61, 0x32, 0xb5, 0xc4, 0x8f, 0xe6, 0x97, 0xf1, 0xab, 0x48,
0x66, 0xa6, 0x76, 0xbb, 0x14, 0x8a, 0xec, 0xdb, 0xcc, 0xbd, 0xe7, 0xdc, 0x3f, 0xe7, 0xcc, 0xc0,
0xdb, 0x25, 0x95, 0xf9, 0x3a, 0x09, 0x52, 0xb6, 0x0a, 0x97, 0x28, 0xe3, 0x15, 0xad, 0xc3, 0xb8,
0xa4, 0x29, 0x86, 0xa9, 0x68, 0xb8, 0x64, 0xa1, 0xac, 0xeb, 0x30, 0xce, 0xb2, 0x3a, 0x8f, 0x05,
0x86, 0x2b, 0xac, 0xeb, 0x78, 0x89, 0x01, 0x17, 0x4c, 0x32, 0x72, 0xba, 0x8d, 0x5f, 0x5c, 0x1d,
0xab, 0x92, 0x50, 0x51, 0xe4, 0x6c, 0xb1, 0xa0, 0x95, 0x44, 0xc1, 0x59, 0x19, 0x4b, 0xca, 0xaa,
0x30, 0x29, 0x74, 0xa5, 0x8b, 0x77, 0xc7, 0xf8, 0x98, 0x72, 0x46, 0x2b, 0xb9, 0x14, 0x6c, 0xcd,
0xcb, 0x78, 0x13, 0xaa, 0x9b, 0x21, 0xbf, 0x3a, 0x46, 0xfe, 0x59, 0x70, 0xc1, 0xd8, 0x62, 0x7f,
0x7a, 0xff, 0x97, 0x0d, 0xfd, 0x1b, 0x1d, 0x21, 0x3e, 0x74, 0x65, 0xc3, 0xd1, 0xb3, 0x46, 0xd6,
0xf8, 0x6c, 0x72, 0x16, 0x6c, 0x17, 0x0b, 0xbe, 0x35, 0x1c, 0x23, 0x95, 0x23, 0x67, 0x60, 0xd3,
0xcc, 0xb3, 0x47, 0xd6, 0x78, 0x10, 0xd9, 0x34, 0x23, 0x13, 0x38, 0x65, 0x65, 0x76, 0xcb, 0x11,
0x85, 0x77, 0x32, 0xb2, 0xc6, 0xee, 0xe4, 0xf1, 0x8e, 0x37, 0x65, 0x59, 0xf3, 0xa5, 0xcc, 0xe6,
0x88, 0x62, 0xd6, 0x89, 0xfa, 0x4c, 0x1f, 0xc9, 0x73, 0x70, 0x2a, 0xdc, 0xdc, 0x26, 0x85, 0xd7,
0x55, 0x8c, 0x47, 0xfb, 0x8c, 0xcf, 0xb8, 0x99, 0x16, 0xb3, 0x4e, 0xd4, 0xab, 0xda, 0x03, 0x79,
0x01, 0xfd, 0x94, 0xad, 0xf8, 0x5a, 0xa2, 0xd7, 0x3b, 0xd4, 0xe0, 0x5a, 0x27, 0xdb, 0x06, 0x06,
0x47, 0x02, 0x70, 0x04, 0xd6, 0xeb, 0x52, 0x7a, 0x8e, 0x62, 0x9c, 0xef, 0x33, 0x22, 0x95, 0x9b,
0x75, 0x22, 0x83, 0x6a, 0xf1, 0x3f, 0x50, 0xd0, 0x45, 0xe3, 0xf5, 0x0f, 0xe1, 0xbf, 0xab, 0x5c,
0x8b, 0xd7, 0xa8, 0xa9, 0x03, 0xdd, 0x84, 0x65, 0x8d, 0xff, 0xdb, 0x02, 0xf7, 0xce, 0x8e, 0xe4,
0x0d, 0xd8, 0x49, 0xa1, 0xe4, 0x73, 0x27, 0x4f, 0x83, 0x83, 0x6e, 0x07, 0xd3, 0x62, 0x1e, 0x8b,
0x78, 0x85, 0x12, 0x85, 0xd1, 0x3d, 0xb2, 0x93, 0x82, 0x5c, 0x81, 0x5b, 0xd3, 0x8f, 0xf3, 0xd6,
0xa1, 0x9b, 0x7a, 0xa9, 0x04, 0x76, 0x27, 0x97, 0x81, 0x31, 0x2d, 0xf8, 0x9a, 0xe6, 0x15, 0x13,
0x42, 0xe7, 0x0d, 0xed, 0x2e, 0x81, 0xbc, 0x06, 0x87, 0xaf, 0x93, 0x02, 0x1b, 0xe3, 0xc2, 0x93,
0xe0, 0xde, 0x63, 0x09, 0xde, 0xa7, 0xf3, 0xf6, 0xbe, 0x65, 0x1b, 0x38, 0xb9, 0x84, 0x81, 0xcc,
0x05, 0xd6, 0x39, 0x2b, 0x33, 0xe5, 0xc7, 0xff, 0xd1, 0x2e, 0xe0, 0x7f, 0x80, 0xc1, 0x5f, 0x4b,
0x1e, 0xb0, 0x9e, 0x9f, 0x6a, 0xa1, 0x8c, 0x57, 0xe4, 0x1c, 0x7a, 0x19, 0x96, 0x32, 0x56, 0xc5,
0xfe, 0x8b, 0xf4, 0xe5, 0xa1, 0x1a, 0xf8, 0x3e, 0xc0, 0xce, 0xde, 0xc3, 0x3d, 0xfc, 0x4f, 0x1a,
0xa3, 0x2d, 0xbd, 0xdf, 0xd1, 0xfa, 0xc7, 0x8e, 0xcf, 0xae, 0xa1, 0xdb, 0xfe, 0x0d, 0xe2, 0x42,
0xdf, 0xbc, 0x81, 0x61, 0x87, 0x0c, 0xa0, 0xa7, 0xf4, 0x1a, 0x5a, 0x6d, 0xdc, 0xac, 0x3c, 0xb4,
0x09, 0x80, 0xa3, 0x47, 0x1b, 0x9e, 0xb4, 0x67, 0x3d, 0xc2, 0xb0, 0x9b, 0x38, 0xea, 0x27, 0xbe,
0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x81, 0x4a, 0x19, 0x4a, 0x85, 0x04, 0x00, 0x00,
}
| {
"pile_set_name": "Github"
} |
#if (defined(USE_UIKIT_PUBLIC_HEADERS) && USE_UIKIT_PUBLIC_HEADERS) || !__has_include(<UIKitCore/UILargeContentViewer.h>)
//
// UILargeContentViewer.h
// UIKit
//
// Copyright © 2019 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIImage.h>
#import <UIKit/UIInteraction.h>
#import <UIKit/UIView.h>
#if TARGET_OS_IOS
NS_ASSUME_NONNULL_BEGIN
@protocol UILargeContentViewerInteractionDelegate;
// The large content viewer allow users with relevant settings to view content at a larger size.
// For example, users with an accessibility content size category can long press on a tab bar button to view a larger version.
// The viewer should not be used as a replacement for proper Dynamic Type support in general.
// It is intended only for use with items that must remain small due to unavoidable design constraints.
// For example, buttons in a tab bar remain small to leave more room for the main content.
API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos) @protocol UILargeContentViewerItem <NSObject>
/// Returns whether the item shows the large content viewer.
/// In general, only views that cannot scale for the full range of Dynamic Type sizes should return YES.
/// For this property to take effect, the item or an ancestor view must have a UILargeContentViewerInteraction.
@property (nonatomic, assign, readonly) BOOL showsLargeContentViewer;
/// Returns a title that should be shown in the large content viewer.
@property (nullable, nonatomic, copy, readonly) NSString *largeContentTitle;
/// Returns an image that should be shown in the large content viewer.
@property (nullable, nonatomic, strong, readonly) UIImage *largeContentImage;
/// Returns whether the image should be scaled to a larger size appropriate for the viewer.
/// If not, the image will be shown at its intrinsic size.
/// For best results when scaling, use a PDF asset with its "Preserve Vector Data" checkbox checked.
@property (nonatomic, assign, readonly) BOOL scalesLargeContentImage;
/// Returns insets appropriate for positioning the image in the viewer so that it appears visually centered.
@property (nonatomic, assign, readonly) UIEdgeInsets largeContentImageInsets;
@end
@interface UIView (UILargeContentViewer) <UILargeContentViewerItem>
// Defaults to NO.
@property (nonatomic, assign, readwrite) BOOL showsLargeContentViewer API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos);
// Defaults to nil, or an appropriate default value for UIKit classes.
@property (nullable, nonatomic, copy, readwrite) NSString *largeContentTitle API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos);
// Defaults to nil, or an appropriate default value for UIKit classes.
@property (nullable, nonatomic, strong, readwrite) UIImage *largeContentImage API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos);
// Defaults to NO, or an appropriate default value for UIKit classes.
@property (nonatomic, assign, readwrite) BOOL scalesLargeContentImage API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos);
// Defaults to UIEdgeInsetsZero.
@property (nonatomic, assign, readwrite) UIEdgeInsets largeContentImageInsets API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos);
@end
/// UILargeContentViewerInteraction enables a gesture to present and dismiss the large content viewer on a device with relevant settings.
/// Use methods in <UIKit/UIInteraction.h> to add the interaction to an appropriate view, such as a custom tab bar.
UIKIT_EXTERN API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos) @interface UILargeContentViewerInteraction : NSObject <UIInteraction>
- (instancetype)initWithDelegate:(nullable id<UILargeContentViewerInteractionDelegate>)delegate NS_DESIGNATED_INITIALIZER;
@property (nonatomic, nullable, weak, readonly) id<UILargeContentViewerInteractionDelegate> delegate;
/// Returns a gesture recognizer that can be used to set up simultaneous recognition or failure relationships with other gesture recognizers.
@property (nonatomic, strong, readonly) UIGestureRecognizer *gestureRecognizerForExclusionRelationship;
/// Returns whether the large content viewer is enabled on the device.
/// It is not necessary to check this value before adding a UILargeContentViewerInteraction to a view,
/// but it may be helpful if you need to adjust the behavior of coexisting gesture handlers.
/// For example, a button with a long press handler might increase its long press duration,
/// so that a user can read text in the large content viewer first.
@property (class, nonatomic, readonly, getter=isEnabled) BOOL enabled;
@end
API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos) @protocol UILargeContentViewerInteractionDelegate <NSObject>
@optional
/// Performs an action when the large content viewer gesture ends at the location of the given item.
/// (The point in the interaction's view's coordinate system is also provided.)
/// For example, you may wish to perform the action that would have occurred if the user had tapped on that item.
/// If this is not implemented and the gesture ends at the location of a UIControl object, it will send a UIControlEventTouchUpInside event.
/// This method is called only if the gesture ends successfully (not if it fails or gets canceled).
- (void)largeContentViewerInteraction:(UILargeContentViewerInteraction *)interaction didEndOnItem:(nullable id<UILargeContentViewerItem>)item atPoint:(CGPoint)point;
/// Returns the item at a given point in the interaction's view's coordinate system.
/// If this is not implemented, -[UIView pointInside:withEvent:] will be called recursively on the interaction's view to find an appropriate view.
- (nullable id<UILargeContentViewerItem>)largeContentViewerInteraction:(UILargeContentViewerInteraction *)interaction itemAtPoint:(CGPoint)point;
/// Returns the view controller whose region of the screen should be used to display the large content viewer.
/// If this is not implemented, a view controller that contains the interaction's view will be chosen.
- (UIViewController *)viewControllerForLargeContentViewerInteraction:(UILargeContentViewerInteraction *)interaction;
@end
/// Posted when the large content viewer gets enabled or disabled on the device.
UIKIT_EXTERN NSNotificationName const UILargeContentViewerInteractionEnabledStatusDidChangeNotification API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos);
NS_ASSUME_NONNULL_END
#endif
#else
#import <UIKitCore/UILargeContentViewer.h>
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<cesHeader xmlns="http://www.xces.org/ns/GrAF/1.0/" creator="KBS" date.created="2010-02-17"
date.updated="2010-03-09"
version="1.0.4">
<fileDesc>
<titleStmt>
<title>112C-L014</title>
</titleStmt>
<extent wordCount="248"/>
<sourceDesc>
<title>ICIC Corpus of Philanthropic Fundraising Discourse</title>
<publisher>ICIC</publisher>
<pubAddress>620 Union Drive, Room 407, Indianapolis, Indiana 46202, U.S.A.</pubAddress>
<email>[email protected]</email>
<url>www.iupui.edu/~icic</url>
<pubDate>September, 2003</pubDate>
</sourceDesc>
</fileDesc>
<profileDesc>
<langUsage>
<language iso639="en-us">English (United States)</language>
</langUsage>
<wsdUsage>
<writingSystem id="UTF-8">8-bit UCS/Unicode Transformation Format</writingSystem>
</wsdUsage>
<!-- catRef types DEFINED IN MAIN HEADER --><textClass catRef="WR LT">
<domain type="philanthropic fundraising discourse"/>
<factuality type="nonfiction"/>
<preparedness type="prepared"/>
<purpose type="fundraising"/>
</textClass>
<!-- MEDIUM DEFINED IN MAIN HEADER --><primaryData loc="112C-L014.txt" medium="text"/>
<annotations>
<annotation ann.loc="112C-L014-logical.xml" type="logical">Document structure</annotation>
<annotation ann.loc="112C-L014-mpqa.xml" type="mpqa">Multi-Perspective Question Answering opinion corpus</annotation>
<annotation ann.loc="112C-L014-nc.xml" type="nc">Noun chunks</annotation>
<annotation ann.loc="112C-L014-ne.xml" type="ne">Named Entities</annotation>
<annotation ann.loc="112C-L014-penn.xml" type="penn">Penn part of speech tags</annotation>
<annotation ann.loc="112C-L014-ptb.xml" type="ptb">Penn Tree Bank</annotation>
<annotation ann.loc="112C-L014-ptbtok.xml" type="ptbtok">Penn Tree Bank tokens and part of speech tags</annotation>
<annotation ann.loc="112C-L014-s.xml" type="s">Sentence boundaries</annotation>
<annotation ann.loc="112C-L014-seg.xml" type="seg">Base segmentation (quarks)</annotation>
<annotation ann.loc="112C-L014-vc.xml" type="vc">Verb chunks</annotation>
<annotation ann.loc="112C-L014.txt" type="content">Document content</annotation>
</annotations>
</profileDesc>
<revisionDesc>
<change>
<changeDate>2010-02-17</changeDate>
<respName>KBS</respName>
<item>Added nc, NE, ptb, ptbtok, seg, vc annotations.</item>
</change>
<change>
<changeDate value="2010-04-17"/>
<respName>Nancy Ide</respName>
<item>Added fileDesc information to the header</item>
</change>
<change>
<changeDate>2010-09-19</changeDate>
<respName>KBS</respName>
<item>Added logical, mpqa, nc, ne, penn, ptb, ptbtok, s, seg, vc, content annotations.</item>
</change>
</revisionDesc>
</cesHeader> | {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "FormattingContext.h"
#include "MarginTypes.h"
#include <wtf/HashMap.h>
#include <wtf/IsoMalloc.h>
namespace WebCore {
class LayoutUnit;
namespace Layout {
class BlockFormattingState;
class Box;
class FloatingContext;
// This class implements the layout logic for block formatting contexts.
// https://www.w3.org/TR/CSS22/visuren.html#block-formatting
class BlockFormattingContext : public FormattingContext {
WTF_MAKE_ISO_ALLOCATED(BlockFormattingContext);
public:
BlockFormattingContext(const Box& formattingContextRoot, BlockFormattingState&);
void layout() const override;
private:
void layoutFormattingContextRoot(FloatingContext&, const Box&) const;
void placeInFlowPositionedChildren(const Box&) const;
void computeWidthAndMargin(const Box&, Optional<LayoutUnit> usedAvailableWidth = { }) const;
void computeHeightAndMargin(const Box&) const;
void computeStaticHorizontalPosition(const Box&) const;
void computeStaticVerticalPosition(const FloatingContext&, const Box&) const;
void computeStaticPosition(const FloatingContext&, const Box&) const;
void computeFloatingPosition(const FloatingContext&, const Box&) const;
void computePositionToAvoidFloats(const FloatingContext&, const Box&) const;
void computeEstimatedVerticalPosition(const Box&) const;
void computeEstimatedVerticalPositionForAncestors(const Box&) const;
void computeEstimatedVerticalPositionForFormattingRoot(const Box&) const;
void computeEstimatedVerticalPositionForFloatClear(const FloatingContext&, const Box&) const;
void computeIntrinsicWidthConstraints() const override;
LayoutUnit verticalPositionWithMargin(const Box&, const UsedVerticalMargin&) const;
// This class implements positioning and sizing for boxes participating in a block formatting context.
class Geometry : public FormattingContext::Geometry {
public:
static HeightAndMargin inFlowHeightAndMargin(const LayoutState&, const Box&, UsedVerticalValues);
static WidthAndMargin inFlowWidthAndMargin(const LayoutState&, const Box&, UsedHorizontalValues);
static Point staticPosition(const LayoutState&, const Box&);
static LayoutUnit staticVerticalPosition(const LayoutState&, const Box&);
static LayoutUnit staticHorizontalPosition(const LayoutState&, const Box&);
static bool intrinsicWidthConstraintsNeedChildrenWidth(const Box&);
static IntrinsicWidthConstraints intrinsicWidthConstraints(const LayoutState&, const Box&);
private:
static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutState&, const Box&, UsedVerticalValues);
static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutState&, const Box&, UsedHorizontalValues);
static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutState&, const Box&, UsedHorizontalValues);
static Point staticPositionForOutOfFlowPositioned(const LayoutState&, const Box&);
};
// This class implements margin collapsing for block formatting context.
class MarginCollapse {
public:
static UsedVerticalMargin::CollapsedValues collapsedVerticalValues(const LayoutState&, const Box&, const UsedVerticalMargin::NonCollapsedValues&);
static EstimatedMarginBefore estimatedMarginBefore(const LayoutState&, const Box&);
static LayoutUnit marginBeforeIgnoringCollapsingThrough(const LayoutState&, const Box&, const UsedVerticalMargin::NonCollapsedValues&);
static void updateMarginAfterForPreviousSibling(const LayoutState&, const Box&);
static void updatePositiveNegativeMarginValues(const LayoutState&, const Box&);
static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&);
static bool marginBeforeCollapsesWithFirstInFlowChildMarginBefore(const LayoutState&, const Box&);
static bool marginBeforeCollapsesWithParentMarginAfter(const LayoutState&, const Box&);
static bool marginBeforeCollapsesWithPreviousSiblingMarginAfter(const LayoutState&, const Box&);
static bool marginAfterCollapsesWithParentMarginAfter(const LayoutState&, const Box&);
static bool marginAfterCollapsesWithLastInFlowChildMarginAfter(const LayoutState&, const Box&);
static bool marginAfterCollapsesWithParentMarginBefore(const LayoutState&, const Box&);
static bool marginAfterCollapsesWithNextSiblingMarginBefore(const LayoutState&, const Box&);
static bool marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const LayoutState&, const Box&);
static bool marginsCollapseThrough(const LayoutState&, const Box&);
private:
enum class MarginType { Before, After };
static PositiveAndNegativeVerticalMargin::Values positiveNegativeValues(const LayoutState&, const Box&, MarginType);
static PositiveAndNegativeVerticalMargin::Values positiveNegativeMarginBefore(const LayoutState&, const Box&, const UsedVerticalMargin::NonCollapsedValues&);
static PositiveAndNegativeVerticalMargin::Values positiveNegativeMarginAfter(const LayoutState&, const Box&, const UsedVerticalMargin::NonCollapsedValues&);
};
class Quirks {
public:
static bool needsStretching(const LayoutState&, const Box&);
static HeightAndMargin stretchedInFlowHeight(const LayoutState&, const Box&, HeightAndMargin);
static bool shouldIgnoreCollapsedQuirkMargin(const LayoutState&, const Box&);
static bool shouldIgnoreMarginBefore(const LayoutState&, const Box&);
static bool shouldIgnoreMarginAfter(const LayoutState&, const Box&);
};
void setEstimatedMarginBefore(const Box&, const EstimatedMarginBefore&) const;
void removeEstimatedMarginBefore(const Box& layoutBox) const { m_estimatedMarginBeforeList.remove(&layoutBox); }
bool hasEstimatedMarginBefore(const Box&) const;
Optional<LayoutUnit> usedAvailableWidthForFloatAvoider(const FloatingContext&, const Box&) const;
#ifndef NDEBUG
EstimatedMarginBefore estimatedMarginBefore(const Box& layoutBox) const { return m_estimatedMarginBeforeList.get(&layoutBox); }
bool hasPrecomputedMarginBefore(const Box&) const;
#endif
BlockFormattingState& formattingState() const { return downcast<BlockFormattingState>(FormattingContext::formattingState()); }
private:
mutable HashMap<const Box*, EstimatedMarginBefore> m_estimatedMarginBeforeList;
};
}
}
#endif
| {
"pile_set_name": "Github"
} |
import QtQuick 2.12
import QtQuick.Controls 2.12
import TaoQuick 1.0
import "qrc:/TaoQuick"
Item {
anchors.fill: parent
Image {
id: src
source: imgPath + "Effect/Girls/girl1.jpeg"
visible: false
}
Grid {
anchors.centerIn: parent
columns: 2
spacing: 40
ACircle {
id: s1
width: 250
height: 375
dir: ASquare.Direct.FromInner
effectSource.sourceItem: src
}
ACircle {
id: s2
width: 250
height: 375
dir: ASquare.Direct.FromOuter
effectSource.sourceItem: src
}
}
Component.onCompleted: {
ani.start()
}
SequentialAnimation {
id: ani
ScriptAction {script: {s1.restart() } }
PauseAnimation {duration: 1200}
ScriptAction {script: {s2.restart() } }
}
Button {
anchors.right: parent.right
anchors.bottom: parent.bottom
text: "replay"
onClicked: {
ani.restart()
}
}
}
| {
"pile_set_name": "Github"
} |
mmpformat 050502 required; 050706 preferred
kelvin 300
group (View Data)
info opengroup open = True
csys (HomeView) (1.000000, 0.000000, 0.000000, 0.000000) (10.000000) (0.000000, 0.000000, 0.000000) (1.000000)
csys (LastView) (1.000000, 0.000000, 0.000000, 0.000000) (4.022129) (0.420500, -0.405500, -0.000000) (1.000000)
egroup (View Data)
group (Cl_OH_cs)
info opengroup open = True
mol (Cl_OH_cs.pdb) def
atom 1 (8) (-1158, -64, 0) def
atom 2 (17) (570, 4, 0) def
bond1 1
atom 3 (1) (-1411, 875, 0) def
bond1 1
egroup (Cl_OH_cs)
end1
group (Clipboard)
info opengroup open = False
egroup (Clipboard)
end molecular machine part Cl_OH_cs
| {
"pile_set_name": "Github"
} |
var path = require('path'),
fs = require('fs');
try {
global.Gently = require('gently');
} catch (e) {
throw new Error('this test suite requires node-gently');
}
exports.lib = path.join(__dirname, '../../lib');
global.GENTLY = new Gently();
global.assert = require('assert');
global.TEST_PORT = 13532;
global.TEST_FIXTURES = path.join(__dirname, '../fixture');
global.TEST_TMP = path.join(__dirname, '../tmp');
// Stupid new feature in node that complains about gently attaching too many
// listeners to process 'exit'. This is a workaround until I can think of a
// better way to deal with this.
if (process.setMaxListeners) {
process.setMaxListeners(10000);
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2018 The Ripple Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MYSQL_RIPPLE_PLUGIN_H
#define MYSQL_RIPPLE_PLUGIN_H
namespace mysql_ripple {
namespace plugin {
struct Plugin {
bool (* Init)();
};
bool InitPlugins();
} // namespace plugin
} // namespace mysql_ripple
#define DECLARE_PLUGIN(x) \
static bool plugin_ ## x ## _Init(); \
Plugin plugin_ ## x = { &plugin_ ## x ## _Init }; \
static bool plugin_ ## x ## _Init()
#endif // MYSQL_RIPPLE_PLUGIN_H
| {
"pile_set_name": "Github"
} |
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
using Microsoft.Python.Core.Text;
using Microsoft.Python.Parsing.Ast;
namespace Microsoft.Python.Analysis.Types {
public readonly struct Location {
public Location(IPythonModule module, IndexSpan indexSpan = default) {
Module = module;
IndexSpan = indexSpan;
}
public IPythonModule Module { get; }
public IndexSpan IndexSpan { get; }
public LocationInfo LocationInfo {
get {
if (Module is ILocationConverter lc && !string.IsNullOrEmpty(Module?.FilePath) && Module?.Uri != null) {
return new LocationInfo(Module.FilePath, Module.Uri, IndexSpan.ToSourceSpan(lc));
}
return LocationInfo.Empty;
}
}
public bool IsValid => Module != null && IndexSpan != default;
public override bool Equals(object obj)
=> obj is Location other && other.Module == Module && other.IndexSpan == IndexSpan;
public override int GetHashCode() => (IndexSpan.GetHashCode() * 397) ^ Module?.GetHashCode() ?? 0;
}
}
| {
"pile_set_name": "Github"
} |
'use strict';
var through = require('through2');
var sourcemap = require('vinyl-sourcemap');
function sourcemapStream(optResolver) {
function saveSourcemap(file, enc, callback) {
var self = this;
var srcMap = optResolver.resolve('sourcemaps', file);
if (!srcMap) {
return callback(null, file);
}
var srcMapLocation = (typeof srcMap === 'string' ? srcMap : undefined);
sourcemap.write(file, srcMapLocation, onWrite);
function onWrite(sourcemapErr, updatedFile, sourcemapFile) {
if (sourcemapErr) {
return callback(sourcemapErr);
}
self.push(updatedFile);
if (sourcemapFile) {
self.push(sourcemapFile);
}
callback();
}
}
return through.obj(saveSourcemap);
}
module.exports = sourcemapStream;
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
Document Title
=============================================
-->
<title>Titan | Multipurpose HTML5 Template</title>
<!--
Favicons
=============================================
-->
<link rel="apple-touch-icon" sizes="57x57" href="assets/images/favicons/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/images/favicons/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/images/favicons/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/images/favicons/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/images/favicons/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="assets/images/favicons/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/images/favicons/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/images/favicons/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/favicons/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="assets/images/favicons/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicons/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="assets/images/favicons/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<!--
Stylesheets
=============================================
-->
<!-- Default stylesheets-->
<link href="assets/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Template specific stylesheets-->
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Volkhov:400i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet">
<link href="assets/lib/animate.css/animate.css" rel="stylesheet">
<link href="assets/lib/components-font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/lib/et-line-font/et-line-font.css" rel="stylesheet">
<link href="assets/lib/flexslider/flexslider.css" rel="stylesheet">
<link href="assets/lib/owl.carousel/dist/assets/owl.carousel.min.css" rel="stylesheet">
<link href="assets/lib/owl.carousel/dist/assets/owl.theme.default.min.css" rel="stylesheet">
<link href="assets/lib/magnific-popup/dist/magnific-popup.css" rel="stylesheet">
<link href="assets/lib/simple-text-rotator/simpletextrotator.css" rel="stylesheet">
<!-- Main stylesheet and color file-->
<link href="assets/css/style.css" rel="stylesheet">
<link id="color-scheme" href="assets/css/colors/default.css" rel="stylesheet">
</head>
<body data-spy="scroll" data-target=".onpage-navigation" data-offset="60">
<main>
<div class="page-loader">
<div class="loader">Loading...</div>
</div>
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#custom-collapse"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="index.html">Titan</a>
</div>
<div class="collapse navbar-collapse" id="custom-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Home</a>
<ul class="dropdown-menu">
<li><a href="index_mp_fullscreen_video_background.html">Default</a></li>
<li><a href="index_op_fullscreen_gradient_overlay.html">One Page</a></li>
<li><a href="index_agency.html">Agency</a></li>
<li><a href="index_portfolio.html">Portfolio</a></li>
<li><a href="index_restaurant.html">Restaurant</a></li>
<li><a href="index_finance.html">Finance</a></li>
<li><a href="index_landing.html">Landing Page</a></li>
<li><a href="index_photography.html">Photography</a></li>
<li><a href="index_shop.html">Shop</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Headers</a>
<ul class="dropdown-menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Static Image Header</a>
<ul class="dropdown-menu">
<li><a href="index_mp_fullscreen_static.html">Fulscreen</a></li>
<li><a href="index_mp_classic_static.html">Classic</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Flexslider Header</a>
<ul class="dropdown-menu">
<li><a href="index_mp_fullscreen_flexslider.html">Fulscreen</a></li>
<li><a href="index_mp_classic_flexslider.html">Classic</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Video Background Header</a>
<ul class="dropdown-menu">
<li><a href="index_mp_fullscreen_video_background.html">Fulscreen</a></li>
<li><a href="index_mp_classic_video_background.html">Classic</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Text Rotator Header</a>
<ul class="dropdown-menu">
<li><a href="index_mp_fullscreen_text_rotator.html">Fulscreen</a></li>
<li><a href="index_mp_classic_text_rotator.html">Classic</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Gradient Overlay Header</a>
<ul class="dropdown-menu">
<li><a href="index_mp_fullscreen_gradient_overlay.html">Fulscreen</a></li>
<li><a href="index_mp_classic_gradient_overlay.html">Classic</a></li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Pages</a>
<ul class="dropdown-menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">About</a>
<ul class="dropdown-menu">
<li><a href="about1.html">About 1</a></li>
<li><a href="about2.html">About 2</a></li>
<li><a href="about3.html">About 3</a></li>
<li><a href="about4.html">About 4</a></li>
<li><a href="about5.html">About 5</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Services</a>
<ul class="dropdown-menu">
<li><a href="service1.html">Service 1</a></li>
<li><a href="service2.html">Service 2</a></li>
<li><a href="service3.html">Service 3</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Pricing</a>
<ul class="dropdown-menu">
<li><a href="pricing1.html">Pricing 1</a></li>
<li><a href="pricing2.html">Pricing 2</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Gallery</a>
<ul class="dropdown-menu">
<li><a href="gallery_col_2.html">2 Columns</a></li>
<li><a href="gallery_col_3.html">3 Columns</a></li>
<li><a href="gallery_col_4.html">4 Columns</a></li>
<li><a href="gallery_col_6.html">6 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Contact</a>
<ul class="dropdown-menu">
<li><a href="contact1.html">Contact 1</a></li>
<li><a href="contact2.html">Contact 2</a></li>
<li><a href="contact3.html">Contact 3</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Restaurant menu</a>
<ul class="dropdown-menu">
<li><a href="restaurant_menu1.html">Menu 2 Columns</a></li>
<li><a href="restaurant_menu2.html">Menu 3 Columns</a></li>
</ul>
</li>
<li><a href="login_register.html">Login / Register</a></li>
<li><a href="faq.html">FAQ</a></li>
<li><a href="404.html">Page 404</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Portfolio</a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Boxed</a>
<ul class="dropdown-menu">
<li><a href="portfolio_boxed_col_2.html">2 Columns</a></li>
<li><a href="portfolio_boxed_col_3.html">3 Columns</a></li>
<li><a href="portfolio_boxed_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Boxed - Gutter</a>
<ul class="dropdown-menu">
<li><a href="portfolio_boxed_gutter_col_2.html">2 Columns</a></li>
<li><a href="portfolio_boxed_gutter_col_3.html">3 Columns</a></li>
<li><a href="portfolio_boxed_gutter_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Full Width</a>
<ul class="dropdown-menu">
<li><a href="portfolio_full_width_col_2.html">2 Columns</a></li>
<li><a href="portfolio_full_width_col_3.html">3 Columns</a></li>
<li><a href="portfolio_full_width_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Full Width - Gutter</a>
<ul class="dropdown-menu">
<li><a href="portfolio_full_width_gutter_col_2.html">2 Columns</a></li>
<li><a href="portfolio_full_width_gutter_col_3.html">3 Columns</a></li>
<li><a href="portfolio_full_width_gutter_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Masonry</a>
<ul class="dropdown-menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Boxed</a>
<ul class="dropdown-menu">
<li><a href="portfolio_masonry_boxed_col_2.html">2 Columns</a></li>
<li><a href="portfolio_masonry_boxed_col_3.html">3 Columns</a></li>
<li><a href="portfolio_masonry_boxed_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Full Width</a>
<ul class="dropdown-menu">
<li><a href="portfolio_masonry_full_width_col_2.html">2 Columns</a></li>
<li><a href="portfolio_masonry_full_width_col_3.html">3 Columns</a></li>
<li><a href="portfolio_masonry_full_width_col_4.html">4 Columns</a></li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Hover Style</a>
<ul class="dropdown-menu">
<li><a href="portfolio_hover_black.html">Black</a></li>
<li><a href="portfolio_hover_gradient.html">Gradient</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Single</a>
<ul class="dropdown-menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Featured Image</a>
<ul class="dropdown-menu">
<li><a href="portfolio_single_featured_image1.html">Style 1</a></li>
<li><a href="portfolio_single_featured_image2.html">Style 2</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Featured Slider</a>
<ul class="dropdown-menu">
<li><a href="portfolio_single_featured_slider1.html">Style 1</a></li>
<li><a href="portfolio_single_featured_slider2.html">Style 2</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Featured Video</a>
<ul class="dropdown-menu">
<li><a href="portfolio_single_featured_video1.html">Style 1</a></li>
<li><a href="portfolio_single_featured_video2.html">Style 2</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Blog</a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Standard</a>
<ul class="dropdown-menu">
<li><a href="blog_standard_left_sidebar.html">Left Sidebar</a></li>
<li><a href="blog_standard_right_sidebar.html">Right Sidebar</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Grid</a>
<ul class="dropdown-menu">
<li><a href="blog_grid_col_2.html">2 Columns</a></li>
<li><a href="blog_grid_col_3.html">3 Columns</a></li>
<li><a href="blog_grid_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Masonry</a>
<ul class="dropdown-menu">
<li><a href="blog_grid_masonry_col_2.html">2 Columns</a></li>
<li><a href="blog_grid_masonry_col_3.html">3 Columns</a></li>
<li><a href="blog_grid_masonry_col_4.html">4 Columns</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Single</a>
<ul class="dropdown-menu">
<li><a href="blog_single_left_sidebar.html">Left Sidebar</a></li>
<li><a href="blog_single_right_sidebar.html">Right Sidebar</a></li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Features</a>
<ul class="dropdown-menu" role="menu">
<li><a href="alerts-and-wells.html"><i class="fa fa-bolt"></i> Alerts and Wells</a></li>
<li><a href="buttons.html"><i class="fa fa-link fa-sm"></i> Buttons</a></li>
<li><a href="tabs_and_accordions.html"><i class="fa fa-tasks"></i> Tabs & Accordions</a></li>
<li><a href="content_box.html"><i class="fa fa-list-alt"></i> Contents Box</a></li>
<li><a href="forms.html"><i class="fa fa-check-square-o"></i> Forms</a></li>
<li><a href="icons.html"><i class="fa fa-star"></i> Icons</a></li>
<li><a href="progress-bars.html"><i class="fa fa-server"></i> Progress Bars</a></li>
<li><a href="typography.html"><i class="fa fa-font"></i> Typography</a></li>
</ul>
</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Shop</a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Product</a>
<ul class="dropdown-menu">
<li><a href="shop_product_col_3.html">3 columns</a></li>
<li><a href="shop_product_col_4.html">4 columns</a></li>
</ul>
</li>
<li><a href="shop_single_product.html">Single Product</a></li>
<li><a href="shop_checkout.html">Checkout</a></li>
</ul>
</li>
<!--li.dropdown.navbar-cart-->
<!-- a.dropdown-toggle(href='#', data-toggle='dropdown')-->
<!-- span.icon-basket-->
<!-- |-->
<!-- span.cart-item-number 2-->
<!-- ul.dropdown-menu.cart-list(role='menu')-->
<!-- li-->
<!-- .navbar-cart-item.clearfix-->
<!-- .navbar-cart-img-->
<!-- a(href='#')-->
<!-- img(src='assets/images/shop/product-9.jpg', alt='')-->
<!-- .navbar-cart-title-->
<!-- a(href='#') Short striped sweater-->
<!-- |-->
<!-- span.cart-amount 2 × $119.00-->
<!-- br-->
<!-- |-->
<!-- strong.cart-amount $238.00-->
<!-- li-->
<!-- .navbar-cart-item.clearfix-->
<!-- .navbar-cart-img-->
<!-- a(href='#')-->
<!-- img(src='assets/images/shop/product-10.jpg', alt='')-->
<!-- .navbar-cart-title-->
<!-- a(href='#') Colored jewel rings-->
<!-- |-->
<!-- span.cart-amount 2 × $119.00-->
<!-- br-->
<!-- |-->
<!-- strong.cart-amount $238.00-->
<!-- li-->
<!-- .clearfix-->
<!-- .cart-sub-totle-->
<!-- strong Total: $476.00-->
<!-- li-->
<!-- .clearfix-->
<!-- a.btn.btn-block.btn-round.btn-font-w(type='submit') Checkout-->
<!--li.dropdown-->
<!-- a.dropdown-toggle(href='#', data-toggle='dropdown') Search-->
<!-- ul.dropdown-menu(role='menu')-->
<!-- li-->
<!-- .dropdown-search-->
<!-- form(role='form')-->
<!-- input.form-control(type='text', placeholder='Search...')-->
<!-- |-->
<!-- button.search-btn(type='submit')-->
<!-- i.fa.fa-search-->
<li class="dropdown"><a class="dropdown-toggle" href="documentation.html" data-toggle="dropdown">Documentation</a>
<ul class="dropdown-menu">
<li><a href="documentation.html#contact">Contact Form</a></li>
<li><a href="documentation.html#reservation">Reservation Form</a></li>
<li><a href="documentation.html#mailchimp">Mailchimp</a></li>
<li><a href="documentation.html#gmap">Google Map</a></li>
<li><a href="documentation.html#plugin">Plugins</a></li>
<li><a href="documentation.html#changelog">Changelog</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="main">
<section class="module bg-dark-60 portfolio-page-header" data-background="assets/images/portfolio/portfolio_header_bg.jpg">
<div class="container">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<h2 class="module-title font-alt">Portfolio Full Width</h2>
<div class="module-subtitle font-serif">A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</div>
</div>
</div>
</div>
</section>
<section class="module pb-0">
<div class="container">
<div class="row">
<div class="col-sm-12">
<ul class="filter font-alt" id="filters">
<li><a class="current wow fadeInUp" href="#" data-filter="*">All</a></li>
<li><a class="wow fadeInUp" href="#" data-filter=".illustration" data-wow-delay="0.2s">Illustration</a></li>
<li><a class="wow fadeInUp" href="#" data-filter=".marketing" data-wow-delay="0.4s">Marketing</a></li>
<li><a class="wow fadeInUp" href="#" data-filter=".photography" data-wow-delay="0.6s">Photography</a></li>
<li><a class="wow fadeInUp" href="#" data-filter=".webdesign" data-wow-delay="0.6s">Web Design</a></li>
</ul>
</div>
</div>
</div>
<ul class="works-grid works-grid-gut works-hover-w works-grid-3" id="works-grid">
<li class="work-item illustration webdesign"><a href="portfolio_single_featured_image1.html">
<div class="work-image"><img src="assets/images/portfolio/grid-portfolio1.jpg" alt="Portfolio Item"/></div>
<div class="work-caption font-alt">
<h3 class="work-title">Corporate Identity</h3>
<div class="work-descr">Illustration</div>
</div></a></li>
<li class="work-item marketing photography"><a href="portfolio_single_featured_image2.html">
<div class="work-image"><img src="assets/images/portfolio/grid-portfolio2.jpg" alt="Portfolio Item"/></div>
<div class="work-caption font-alt">
<h3 class="work-title">Bag MockUp</h3>
<div class="work-descr">Marketing</div>
</div></a></li>
<li class="work-item illustration photography"><a href="portfolio_single_featured_slider1.html">
<div class="work-image"><img src="assets/images/portfolio/grid-portfolio3.jpg" alt="Portfolio Item"/></div>
<div class="work-caption font-alt">
<h3 class="work-title">Disk Cover</h3>
<div class="work-descr">Illustration</div>
</div></a></li>
<li class="work-item marketing photography"><a href="portfolio_single_featured_slider2.htmll">
<div class="work-image"><img src="assets/images/portfolio/grid-portfolio4.jpg" alt="Portfolio Item"/></div>
<div class="work-caption font-alt">
<h3 class="work-title">Business Card</h3>
<div class="work-descr">Photography</div>
</div></a></li>
<li class="work-item illustration webdesign"><a href="portfolio_single_featured_video1.html">
<div class="work-image"><img src="assets/images/portfolio/grid-portfolio5.jpg" alt="Portfolio Item"/></div>
<div class="work-caption font-alt">
<h3 class="work-title">Web Design</h3>
<div class="work-descr">Webdesign</div>
</div></a></li>
<li class="work-item marketing webdesign"><a href="portfolio_single_featured_video2.html">
<div class="work-image"><img src="assets/images/portfolio/grid-portfolio6.jpg" alt="Portfolio Item"/></div>
<div class="work-caption font-alt">
<h3 class="work-title">Paper clip</h3>
<div class="work-descr">Marketing</div>
</div></a></li>
</ul>
</section>
<div class="module-small bg-dark">
<div class="container">
<div class="row">
<div class="col-sm-3">
<div class="widget">
<h5 class="widget-title font-alt">About Titan</h5>
<p>The languages only differ in their grammar, their pronunciation and their most common words.</p>
<p>Phone: +1 234 567 89 10</p>Fax: +1 234 567 89 10
<p>Email:<a href="#">[email protected]</a></p>
</div>
</div>
<div class="col-sm-3">
<div class="widget">
<h5 class="widget-title font-alt">Recent Comments</h5>
<ul class="icon-list">
<li>Maria on <a href="#">Designer Desk Essentials</a></li>
<li>John on <a href="#">Realistic Business Card Mockup</a></li>
<li>Andy on <a href="#">Eco bag Mockup</a></li>
<li>Jack on <a href="#">Bottle Mockup</a></li>
<li>Mark on <a href="#">Our trip to the Alps</a></li>
</ul>
</div>
</div>
<div class="col-sm-3">
<div class="widget">
<h5 class="widget-title font-alt">Blog Categories</h5>
<ul class="icon-list">
<li><a href="#">Photography - 7</a></li>
<li><a href="#">Web Design - 3</a></li>
<li><a href="#">Illustration - 12</a></li>
<li><a href="#">Marketing - 1</a></li>
<li><a href="#">Wordpress - 16</a></li>
</ul>
</div>
</div>
<div class="col-sm-3">
<div class="widget">
<h5 class="widget-title font-alt">Popular Posts</h5>
<ul class="widget-posts">
<li class="clearfix">
<div class="widget-posts-image"><a href="#"><img src="assets/images/rp-1.jpg" alt="Post Thumbnail"/></a></div>
<div class="widget-posts-body">
<div class="widget-posts-title"><a href="#">Designer Desk Essentials</a></div>
<div class="widget-posts-meta">23 january</div>
</div>
</li>
<li class="clearfix">
<div class="widget-posts-image"><a href="#"><img src="assets/images/rp-2.jpg" alt="Post Thumbnail"/></a></div>
<div class="widget-posts-body">
<div class="widget-posts-title"><a href="#">Realistic Business Card Mockup</a></div>
<div class="widget-posts-meta">15 February</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<hr class="divider-d">
<footer class="footer bg-dark">
<div class="container">
<div class="row">
<div class="col-sm-6">
<p class="copyright font-alt">© 2017 <a href="index.html">TitaN</a>, All Rights Reserved</p>
</div>
<div class="col-sm-6">
<div class="footer-social-links"><a href="#"><i class="fa fa-facebook"></i></a><a href="#"><i class="fa fa-twitter"></i></a><a href="#"><i class="fa fa-dribbble"></i></a><a href="#"><i class="fa fa-skype"></i></a>
</div>
</div>
</div>
</div>
</footer>
<div class="scroll-up"><a href="#totop"><i class="fa fa-angle-double-up"></i></a></div>
</div>
</main>
<!--
JavaScripts
=============================================
-->
<script src="assets/lib/jquery/dist/jquery.js"></script>
<script src="assets/lib/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="assets/lib/wow/dist/wow.js"></script>
<script src="assets/lib/jquery.mb.ytplayer/dist/jquery.mb.YTPlayer.js"></script>
<script src="assets/lib/isotope/dist/isotope.pkgd.js"></script>
<script src="assets/lib/imagesloaded/imagesloaded.pkgd.js"></script>
<script src="assets/lib/flexslider/jquery.flexslider.js"></script>
<script src="assets/lib/owl.carousel/dist/owl.carousel.min.js"></script>
<script src="assets/lib/smoothscroll.js"></script>
<script src="assets/lib/magnific-popup/dist/jquery.magnific-popup.js"></script>
<script src="assets/lib/simple-text-rotator/jquery.simple-text-rotator.min.js"></script>
<script src="assets/js/plugins.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html> | {
"pile_set_name": "Github"
} |
# meetup57-Availability and monitoring/alerting
| {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Material_56
m_Shader: {fileID: 4800000, guid: 5bdea20278144b11916d77503ba1467a, type: 3}
m_ShaderKeywords: _DIRECTIONAL_LIGHT _DISABLE_ALBEDO_MAP _SPECULAR_HIGHLIGHTS
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ChannelMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescentSpectrumMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlbedoAlphaMode: 0
- _AlbedoAssignedAtRuntime: 0
- _BlendOp: 0
- _BlendedClippingWidth: 1
- _BorderLight: 0
- _BorderLightOpaque: 0
- _BorderLightOpaqueAlpha: 1
- _BorderLightReplacesAlbedo: 0
- _BorderLightUsesHoverColor: 0
- _BorderMinValue: 0.1
- _BorderWidth: 0.1
- _BumpScale: 1
- _ClippingBorder: 0
- _ClippingBorderWidth: 0.025
- _ColorWriteMask: 15
- _CullMode: 2
- _CustomMode: 0
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DirectionalLight: 1
- _DstBlend: 0
- _EdgeSmoothingValue: 0.002
- _EnableChannelMap: 0
- _EnableEmission: 0
- _EnableHoverColorOverride: 0
- _EnableLocalSpaceTriplanarMapping: 0
- _EnableNormalMap: 0
- _EnableProximityLightColorOverride: 0
- _EnableTriplanarMapping: 0
- _EnvironmentColorIntensity: 0.5
- _EnvironmentColorThreshold: 1.5
- _EnvironmentColoring: 0
- _FadeBeginDistance: 0.85
- _FadeCompleteDistance: 0.5
- _FadeMinValue: 0
- _FluentLightIntensity: 1
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _HoverLight: 0
- _InnerGlow: 0
- _InnerGlowPower: 4
- _InstancedColor: 0
- _Iridescence: 0
- _IridescenceAngle: -0.78
- _IridescenceIntensity: 0.5
- _IridescenceThreshold: 0.05
- _Metallic: 0
- _Mode: 0
- _NearLightFade: 0
- _NearPlaneFade: 0
- _NormalMapScale: 1
- _OcclusionStrength: 1
- _Parallax: 0.02
- _ProximityLight: 0
- _ProximityLightSubtractive: 0
- _ProximityLightTwoSided: 0
- _Reflections: 0
- _Refraction: 0
- _RefractiveIndex: 0
- _RenderQueueOverride: -1
- _RimLight: 0
- _RimPower: 0.25
- _RoundCornerMargin: 0.01
- _RoundCornerRadius: 0.25
- _RoundCorners: 0
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SphericalHarmonics: 0
- _SrcBlend: 1
- _Stencil: 0
- _StencilComparison: 0
- _StencilOperation: 0
- _StencilReference: 0
- _TriplanarMappingBlendSharpness: 4
- _UVSec: 0
- _VertexColors: 0
- _VertexExtrusion: 0
- _VertexExtrusionValue: 0
- _ZOffsetFactor: 0
- _ZOffsetUnits: 0
- _ZTest: 4
- _ZWrite: 1
m_Colors:
- _ClippingBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
- _Color: {r: 0.6392157, g: 0.6392157, b: 0.6392157, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 0}
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
- _ProximityLightCenterColorOverride: {r: 1, g: 0, b: 0, a: 0}
- _ProximityLightMiddleColorOverride: {r: 0, g: 1, b: 0, a: 0.5}
- _ProximityLightOuterColorOverride: {r: 0, g: 0, b: 1, a: 1}
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
| {
"pile_set_name": "Github"
} |
<?php
// This file was auto-generated from sdk-root/src/data/cognito-idp/2016-04-18/smoke.json
return [ 'version' => 1, 'defaultRegion' => 'us-west-2', 'testCases' => [ [ 'operationName' => 'ListUserPools', 'input' => [ 'MaxResults' => 10, ], 'errorExpectedFromService' => false, ], [ 'operationName' => 'DescribeUserPool', 'input' => [ 'UserPoolId' => 'us-east-1:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', ], 'errorExpectedFromService' => true, ], ],];
| {
"pile_set_name": "Github"
} |
<a href="https://duck.co/translate/po">
Please review <: $upload_filename :> here (Admin login required)
</a>
| {
"pile_set_name": "Github"
} |
################################################################################
#
# xapp_xkbevd
#
################################################################################
XAPP_XKBEVD_VERSION = 1.1.3
XAPP_XKBEVD_SOURCE = xkbevd-$(XAPP_XKBEVD_VERSION).tar.bz2
XAPP_XKBEVD_SITE = http://xorg.freedesktop.org/releases/individual/app
XAPP_XKBEVD_LICENSE = MIT
XAPP_XKBEVD_LICENSE_FILES = COPYING
XAPP_XKBEVD_DEPENDENCIES = xlib_libxkbfile
$(eval $(autotools-package))
| {
"pile_set_name": "Github"
} |
--- Makefile.am.orig 2011-03-03 07:44:59.000000000 -0600
+++ Makefile.am 2011-11-12 23:33:32.000000000 -0600
@@ -67,9 +67,7 @@
NTOPDATA = ntop-cert.pem \
$(ETTER_PASSIVE) \
oui.txt.gz \
- specialMAC.txt.gz \
- GeoIPASNum.dat \
- GeoLiteCity.dat
+ specialMAC.txt.gz
NTOPHTML = html html/*.js html/*.html html/*.gif html/*.jpg html/*.ico html/*.png \
html/*.css html/*.dtd \
| {
"pile_set_name": "Github"
} |
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/apply_fwd.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename F
>
struct apply0;
template<
typename F, typename T1
>
struct apply1;
template<
typename F, typename T1, typename T2
>
struct apply2;
template<
typename F, typename T1, typename T2, typename T3
>
struct apply3;
template<
typename F, typename T1, typename T2, typename T3, typename T4
>
struct apply4;
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct apply5;
}}
| {
"pile_set_name": "Github"
} |
{
"name": "Cyn_in",
"author": "Brendan Coles <[email protected]>",
"version": "0.1",
"description": "Cyn.in is a collaboration software that inter-connects your people with each other and their collective knowledge, seamlessly.",
"website": "http://www.cynapse.com/cynin",
"matches": [
{
"text": "<meta name=\"generator\" content=\"cyn.in - http://cyn.in\" />"
},
{
"md5": "3640b38549e4eeb872f66ec53ee27842",
"url": "/favicon.ico"
},
{
"regexp": "(?-mix:<a href=\"http:\\/\\/www\\.cynapse\\.com\\/cynin\" target=\"_blank\" class=\"smallcolophonmainlink\">Powered by cyn\\.in v([^\\s]+) - free open source edition<\\/a>)",
"offset": 1
}
]
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package btcec
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"crypto/sha512"
"errors"
"io"
)
var (
// ErrInvalidMAC occurs when Message Authentication Check (MAC) fails
// during decryption. This happens because of either invalid private key or
// corrupt ciphertext.
ErrInvalidMAC = errors.New("invalid mac hash")
// errInputTooShort occurs when the input ciphertext to the Decrypt
// function is less than 134 bytes long.
errInputTooShort = errors.New("ciphertext too short")
// errUnsupportedCurve occurs when the first two bytes of the encrypted
// text aren't 0x02CA (= 712 = secp256k1, from OpenSSL).
errUnsupportedCurve = errors.New("unsupported curve")
errInvalidXLength = errors.New("invalid X length, must be 32")
errInvalidYLength = errors.New("invalid Y length, must be 32")
errInvalidPadding = errors.New("invalid PKCS#7 padding")
// 0x02CA = 714
ciphCurveBytes = [2]byte{0x02, 0xCA}
// 0x20 = 32
ciphCoordLength = [2]byte{0x00, 0x20}
)
// GenerateSharedSecret generates a shared secret based on a private key and a
// public key using Diffie-Hellman key exchange (ECDH) (RFC 4753).
// RFC5903 Section 9 states we should only return x.
func GenerateSharedSecret(privkey *PrivateKey, pubkey *PublicKey) []byte {
x, _ := pubkey.Curve.ScalarMult(pubkey.X, pubkey.Y, privkey.D.Bytes())
return x.Bytes()
}
// Encrypt encrypts data for the target public key using AES-256-CBC. It also
// generates a private key (the pubkey of which is also in the output). The only
// supported curve is secp256k1. The `structure' that it encodes everything into
// is:
//
// struct {
// // Initialization Vector used for AES-256-CBC
// IV [16]byte
// // Public Key: curve(2) + len_of_pubkeyX(2) + pubkeyX +
// // len_of_pubkeyY(2) + pubkeyY (curve = 714)
// PublicKey [70]byte
// // Cipher text
// Data []byte
// // HMAC-SHA-256 Message Authentication Code
// HMAC [32]byte
// }
//
// The primary aim is to ensure byte compatibility with Pyelliptic. Also, refer
// to section 5.8.1 of ANSI X9.63 for rationale on this format.
func Encrypt(pubkey *PublicKey, in []byte) ([]byte, error) {
ephemeral, err := NewPrivateKey(S256())
if err != nil {
return nil, err
}
ecdhKey := GenerateSharedSecret(ephemeral, pubkey)
derivedKey := sha512.Sum512(ecdhKey)
keyE := derivedKey[:32]
keyM := derivedKey[32:]
paddedIn := addPKCSPadding(in)
// IV + Curve params/X/Y + padded plaintext/ciphertext + HMAC-256
out := make([]byte, aes.BlockSize+70+len(paddedIn)+sha256.Size)
iv := out[:aes.BlockSize]
if _, err = io.ReadFull(rand.Reader, iv); err != nil {
return nil, err
}
// start writing public key
pb := ephemeral.PubKey().SerializeUncompressed()
offset := aes.BlockSize
// curve and X length
copy(out[offset:offset+4], append(ciphCurveBytes[:], ciphCoordLength[:]...))
offset += 4
// X
copy(out[offset:offset+32], pb[1:33])
offset += 32
// Y length
copy(out[offset:offset+2], ciphCoordLength[:])
offset += 2
// Y
copy(out[offset:offset+32], pb[33:])
offset += 32
// start encryption
block, err := aes.NewCipher(keyE)
if err != nil {
return nil, err
}
mode := cipher.NewCBCEncrypter(block, iv)
mode.CryptBlocks(out[offset:len(out)-sha256.Size], paddedIn)
// start HMAC-SHA-256
hm := hmac.New(sha256.New, keyM)
hm.Write(out[:len(out)-sha256.Size]) // everything is hashed
copy(out[len(out)-sha256.Size:], hm.Sum(nil)) // write checksum
return out, nil
}
// Decrypt decrypts data that was encrypted using the Encrypt function.
func Decrypt(priv *PrivateKey, in []byte) ([]byte, error) {
// IV + Curve params/X/Y + 1 block + HMAC-256
if len(in) < aes.BlockSize+70+aes.BlockSize+sha256.Size {
return nil, errInputTooShort
}
// read iv
iv := in[:aes.BlockSize]
offset := aes.BlockSize
// start reading pubkey
if !bytes.Equal(in[offset:offset+2], ciphCurveBytes[:]) {
return nil, errUnsupportedCurve
}
offset += 2
if !bytes.Equal(in[offset:offset+2], ciphCoordLength[:]) {
return nil, errInvalidXLength
}
offset += 2
xBytes := in[offset : offset+32]
offset += 32
if !bytes.Equal(in[offset:offset+2], ciphCoordLength[:]) {
return nil, errInvalidYLength
}
offset += 2
yBytes := in[offset : offset+32]
offset += 32
pb := make([]byte, 65)
pb[0] = byte(0x04) // uncompressed
copy(pb[1:33], xBytes)
copy(pb[33:], yBytes)
// check if (X, Y) lies on the curve and create a Pubkey if it does
pubkey, err := ParsePubKey(pb, S256())
if err != nil {
return nil, err
}
// check for cipher text length
if (len(in)-aes.BlockSize-offset-sha256.Size)%aes.BlockSize != 0 {
return nil, errInvalidPadding // not padded to 16 bytes
}
// read hmac
messageMAC := in[len(in)-sha256.Size:]
// generate shared secret
ecdhKey := GenerateSharedSecret(priv, pubkey)
derivedKey := sha512.Sum512(ecdhKey)
keyE := derivedKey[:32]
keyM := derivedKey[32:]
// verify mac
hm := hmac.New(sha256.New, keyM)
hm.Write(in[:len(in)-sha256.Size]) // everything is hashed
expectedMAC := hm.Sum(nil)
if !hmac.Equal(messageMAC, expectedMAC) {
return nil, ErrInvalidMAC
}
// start decryption
block, err := aes.NewCipher(keyE)
if err != nil {
return nil, err
}
mode := cipher.NewCBCDecrypter(block, iv)
// same length as ciphertext
plaintext := make([]byte, len(in)-offset-sha256.Size)
mode.CryptBlocks(plaintext, in[offset:len(in)-sha256.Size])
return removePKCSPadding(plaintext)
}
// Implement PKCS#7 padding with block size of 16 (AES block size).
// addPKCSPadding adds padding to a block of data
func addPKCSPadding(src []byte) []byte {
padding := aes.BlockSize - len(src)%aes.BlockSize
padtext := bytes.Repeat([]byte{byte(padding)}, padding)
return append(src, padtext...)
}
// removePKCSPadding removes padding from data that was added with addPKCSPadding
func removePKCSPadding(src []byte) ([]byte, error) {
length := len(src)
padLength := int(src[length-1])
if padLength > aes.BlockSize || length < aes.BlockSize {
return nil, errInvalidPadding
}
return src[:length-padLength], nil
}
| {
"pile_set_name": "Github"
} |
interactions:
- request:
body: '{}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
User-Agent:
- python-requests/2.21.0
method: GET
uri: http://127.0.0.1:8081/api/v1/servers/localhost/zones/sometestdomain.com.
response:
body:
string: '{"account": "", "api_rectify": false, "dnssec": false, "id": "sometestdomain.com.",
"kind": "Master", "last_check": 0, "masters": [], "name": "sometestdomain.com.",
"notified_serial": 0, "nsec3narrow": false, "nsec3param": "", "rrsets": [{"comments":
[], "name": "localhost.sometestdomain.com.", "records": [{"content": "127.0.0.1",
"disabled": false}], "ttl": 3600, "type": "A"}, {"comments": [], "name": "_acme-challenge.test.sometestdomain.com.",
"records": [{"content": "\"challengetoken\"", "disabled": false}], "ttl":
3600, "type": "TXT"}, {"comments": [], "name": "_acme-challenge.deleterecordinset.sometestdomain.com.",
"records": [{"content": "\"challengetoken2\"", "disabled": false}], "ttl":
3600, "type": "TXT"}, {"comments": [], "name": "_acme-challenge.createrecordset.sometestdomain.com.",
"records": [{"content": "\"challengetoken1\"", "disabled": false}, {"content":
"\"challengetoken2\"", "disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments":
[], "name": "docs.sometestdomain.com.", "records": [{"content": "docs.example.com.sometestdomain.com.",
"disabled": false}], "ttl": 3600, "type": "CNAME"}, {"comments": [], "name":
"_acme-challenge.noop.sometestdomain.com.", "records": [{"content": "\"challengetoken\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments": [], "name":
"_acme-challenge.fqdn.sometestdomain.com.", "records": [{"content": "\"challengetoken\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments": [], "name":
"_acme-challenge.full.sometestdomain.com.", "records": [{"content": "\"challengetoken\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}], "serial": 0, "soa_edit":
"", "soa_edit_api": "", "url": "/api/v1/servers/localhost/zones/sometestdomain.com."}'
headers:
Access-Control-Allow-Origin:
- '*'
Connection:
- close
Content-Length:
- '1732'
Content-Security-Policy:
- default-src 'self'; style-src 'self' 'unsafe-inline'
Content-Type:
- application/json
Server:
- PowerDNS/4.1.5
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- deny
X-Permitted-Cross-Domain-Policies:
- none
X-Xss-Protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: '{"rrsets": [{"name": "ttl.fqdn.sometestdomain.com.", "type": "TXT", "records":
[{"content": "\"ttlshouldbe3600\"", "disabled": false}], "ttl": 3600, "changetype":
"REPLACE"}]}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '175'
Content-Type:
- application/json
User-Agent:
- python-requests/2.21.0
method: PATCH
uri: http://127.0.0.1:8081/api/v1/servers/localhost/zones/sometestdomain.com.
response:
body:
string: ''
headers:
Access-Control-Allow-Origin:
- '*'
Connection:
- close
Content-Length:
- '0'
Content-Security-Policy:
- default-src 'self'; style-src 'self' 'unsafe-inline'
Server:
- PowerDNS/4.1.5
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- deny
X-Permitted-Cross-Domain-Policies:
- none
X-Xss-Protection:
- 1; mode=block
status:
code: 204
message: No Content
- request:
body: '{}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
User-Agent:
- python-requests/2.21.0
method: GET
uri: http://127.0.0.1:8081/api/v1/servers/localhost/zones/sometestdomain.com.
response:
body:
string: '{"account": "", "api_rectify": false, "dnssec": false, "id": "sometestdomain.com.",
"kind": "Master", "last_check": 0, "masters": [], "name": "sometestdomain.com.",
"notified_serial": 0, "nsec3narrow": false, "nsec3param": "", "rrsets": [{"comments":
[], "name": "localhost.sometestdomain.com.", "records": [{"content": "127.0.0.1",
"disabled": false}], "ttl": 3600, "type": "A"}, {"comments": [], "name": "_acme-challenge.test.sometestdomain.com.",
"records": [{"content": "\"challengetoken\"", "disabled": false}], "ttl":
3600, "type": "TXT"}, {"comments": [], "name": "_acme-challenge.deleterecordinset.sometestdomain.com.",
"records": [{"content": "\"challengetoken2\"", "disabled": false}], "ttl":
3600, "type": "TXT"}, {"comments": [], "name": "_acme-challenge.createrecordset.sometestdomain.com.",
"records": [{"content": "\"challengetoken1\"", "disabled": false}, {"content":
"\"challengetoken2\"", "disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments":
[], "name": "docs.sometestdomain.com.", "records": [{"content": "docs.example.com.sometestdomain.com.",
"disabled": false}], "ttl": 3600, "type": "CNAME"}, {"comments": [], "name":
"_acme-challenge.noop.sometestdomain.com.", "records": [{"content": "\"challengetoken\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments": [], "name":
"ttl.fqdn.sometestdomain.com.", "records": [{"content": "\"ttlshouldbe3600\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments": [], "name":
"_acme-challenge.fqdn.sometestdomain.com.", "records": [{"content": "\"challengetoken\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}, {"comments": [], "name":
"_acme-challenge.full.sometestdomain.com.", "records": [{"content": "\"challengetoken\"",
"disabled": false}], "ttl": 3600, "type": "TXT"}], "serial": 0, "soa_edit":
"", "soa_edit_api": "", "url": "/api/v1/servers/localhost/zones/sometestdomain.com."}'
headers:
Access-Control-Allow-Origin:
- '*'
Connection:
- close
Content-Length:
- '1886'
Content-Security-Policy:
- default-src 'self'; style-src 'self' 'unsafe-inline'
Content-Type:
- application/json
Server:
- PowerDNS/4.1.5
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- deny
X-Permitted-Cross-Domain-Policies:
- none
X-Xss-Protection:
- 1; mode=block
status:
code: 200
message: OK
version: 1
| {
"pile_set_name": "Github"
} |
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixTest
{
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
/// <summary>
/// Dark tool class.
/// </summary>
public partial class Dark : WixTool
{
public static string Decompile(
string inputFile,
string binaryPath = null,
WixMessage[] expectedWixMessages = null,
string[] extensions = null,
bool noTidy = false,
bool noLogo = false,
string otherArguments = null,
bool setOutputFileIfNotSpecified = true,
bool suppressDroppingEmptyTables = false,
bool suppressRelativeActionSequences = false,
bool suppressUITables = false,
int[] suppressWarnings = null,
bool treatWarningsAsErrors = false,
bool verbose = false,
bool xmlOutput = false)
{
Dark dark = new Dark();
// set the passed arrguments
dark.InputFile = inputFile;
dark.BinaryPath = binaryPath;
if (null != expectedWixMessages)
{
dark.ExpectedWixMessages.AddRange(expectedWixMessages);
}
if (null != extensions)
{
dark.Extensions.AddRange(extensions);
}
dark.NoTidy = noTidy;
dark.NoLogo = noLogo;
dark.OtherArguments = otherArguments;
dark.SetOutputFileIfNotSpecified = setOutputFileIfNotSpecified;
dark.SuppressDroppingEmptyTables = suppressDroppingEmptyTables;
dark.SuppressRelativeActionSequences = suppressRelativeActionSequences;
dark.SuppressUITables = suppressUITables;
if (null != suppressWarnings)
{
dark.SuppressWarnings.AddRange(suppressWarnings);
}
dark.TreatWarningsAsErrors = treatWarningsAsErrors;
dark.Verbose = verbose;
dark.XmlOutput = xmlOutput;
dark.Run();
return dark.OutputFile;
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Razor;
namespace Microsoft.CodeAnalysis.Host
{
internal class TestWorkspaceServices : HostWorkspaceServices
{
private static readonly Workspace DefaultWorkspace = TestWorkspace.Create();
private readonly HostServices _hostServices;
private readonly HostLanguageServices _razorLanguageServices;
private readonly IEnumerable<IWorkspaceService> _workspaceServices;
private readonly Workspace _workspace;
public TestWorkspaceServices(
HostServices hostServices,
IEnumerable<IWorkspaceService> workspaceServices,
IEnumerable<ILanguageService> languageServices,
Workspace workspace)
{
if (hostServices == null)
{
throw new ArgumentNullException(nameof(hostServices));
}
if (workspaceServices == null)
{
throw new ArgumentNullException(nameof(workspaceServices));
}
if (languageServices == null)
{
throw new ArgumentNullException(nameof(languageServices));
}
if (workspace == null)
{
throw new ArgumentNullException(nameof(workspace));
}
_hostServices = hostServices;
_workspaceServices = workspaceServices;
_workspace = workspace;
_razorLanguageServices = new TestLanguageServices(this, languageServices);
}
public override HostServices HostServices => _hostServices;
public override Workspace Workspace => _workspace;
public override TWorkspaceService GetService<TWorkspaceService>()
{
var service = _workspaceServices.OfType<TWorkspaceService>().FirstOrDefault();
if (service == null)
{
// Fallback to default host services to resolve roslyn specific features.
service = DefaultWorkspace.Services.GetService<TWorkspaceService>();
}
return service;
}
public override HostLanguageServices GetLanguageServices(string languageName)
{
if (languageName == RazorLanguage.Name)
{
return _razorLanguageServices;
}
// Fallback to default host services to resolve roslyn specific features.
return DefaultWorkspace.Services.GetLanguageServices(languageName);
}
public override IEnumerable<string> SupportedLanguages => new[] { RazorLanguage.Name };
public override bool IsSupported(string languageName) => languageName == RazorLanguage.Name;
public override IEnumerable<TLanguageService> FindLanguageServices<TLanguageService>(MetadataFilter filter) => throw new NotImplementedException();
}
}
| {
"pile_set_name": "Github"
} |
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security;
using System.Security.Permissions;
namespace MyLibrary
{
[Serializable]
public class Foo : ISerializable
{
private int n;
[FileIOPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
public Foo()
{
n = -1;
}
protected Foo(SerializationInfo info, StreamingContext context) // Compliant (no partial trust assembly attribute)
{
n = (int)info.GetValue("n", typeof(int));
}
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("n", n);
}
}
[Serializable]
public class Foo_ok : ISerializable
{
[FileIOPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
public Foo_ok() { }
[FileIOPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
protected Foo_ok(SerializationInfo info, StreamingContext context) { } // Compliant
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { }
}
}
| {
"pile_set_name": "Github"
} |
42--Car_Racing/42_Car_Racing_Car_Racing_42_263.jpg
5
398.148834229 181.313598633 47.1844482422 62.610824585 0.998607337475
956.238769531 191.598373413 44.6973876953 56.265411377 0.998009026051
797.336730957 125.35370636 47.8201293945 58.0654678345 0.997814536095
31.6264438629 138.207443237 66.5474147797 89.1628875732 0.975470781326
592.306335449 172.461868286 43.4611816406 59.5250701904 0.969629466534
| {
"pile_set_name": "Github"
} |
; REQUIRES: object-emission
; RUN: llvm-as < %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
; RUN: llc -mtriple=%triple -O0 -filetype=obj < %t.ll > %t
; RUN: llvm-dwarfdump %t | FileCheck %s
; Also test that the null streamer doesn't crash with debug info.
; RUN: llc -mtriple=%triple -O0 -filetype=null < %t.ll
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
target triple = "spir64-unknown-unknown"
; generated from the following source compiled to bitcode with clang -g -O1
; static int i;
; int main() {
; (void)&i;
; }
; CHECK: debug_info contents
; CHECK: DW_TAG_variable
source_filename = "test/DebugInfo/Generic/global.ll"
; Function Attrs: nounwind readnone uwtable
define i32 @main() #0 !dbg !9 {
entry:
ret i32 0, !dbg !12
}
attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.4 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !3, imports: !2)
!1 = !DIFile(filename: "global.cpp", directory: "/tmp")
!2 = !{}
!3 = !{!4}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = !DIGlobalVariable(name: "i", linkageName: "_ZL1i", scope: null, file: !1, line: 1, type: !6, isLocal: true, isDefinition: true)
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 3}
!8 = !{i32 1, !"Debug Info Version", i32 3}
!9 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !10, isLocal: false, isDefinition: true, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
!10 = !DISubroutineType(types: !11)
!11 = !{!6}
!12 = !DILocation(line: 4, scope: !9)
| {
"pile_set_name": "Github"
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>react-kickstart</title>
<meta name="description" content="just another react + webpack boilerplate">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
#root {
height: 100%;
}
</style>
</head>
<body>
<div id="root"></div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
define(
"dijit/form/nls/uk/validate", ({
invalidMessage: "Введено невірне значення.",
missingMessage: "Це значення є обов'язковим.",
rangeMessage: "Це значення за межами діапазону."
})
);
| {
"pile_set_name": "Github"
} |
#include "matrix.h"
#include "utils.h"
#include "blas.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
void free_matrix(matrix m)
{
int i;
for(i = 0; i < m.rows; ++i) free(m.vals[i]);
free(m.vals);
}
float matrix_topk_accuracy(matrix truth, matrix guess, int k)
{
int *indexes = calloc(k, sizeof(int));
int n = truth.cols;
int i,j;
int correct = 0;
for(i = 0; i < truth.rows; ++i){
top_k(guess.vals[i], n, k, indexes);
for(j = 0; j < k; ++j){
int class = indexes[j];
if(truth.vals[i][class]){
++correct;
break;
}
}
}
free(indexes);
return (float)correct/truth.rows;
}
void scale_matrix(matrix m, float scale)
{
int i,j;
for(i = 0; i < m.rows; ++i){
for(j = 0; j < m.cols; ++j){
m.vals[i][j] *= scale;
}
}
}
matrix resize_matrix(matrix m, int size)
{
int i;
if (m.rows == size) return m;
if (m.rows < size) {
m.vals = realloc(m.vals, size*sizeof(float*));
for (i = m.rows; i < size; ++i) {
m.vals[i] = calloc(m.cols, sizeof(float));
}
} else if (m.rows > size) {
for (i = size; i < m.rows; ++i) {
free(m.vals[i]);
}
m.vals = realloc(m.vals, size*sizeof(float*));
}
m.rows = size;
return m;
}
void matrix_add_matrix(matrix from, matrix to)
{
assert(from.rows == to.rows && from.cols == to.cols);
int i,j;
for(i = 0; i < from.rows; ++i){
for(j = 0; j < from.cols; ++j){
to.vals[i][j] += from.vals[i][j];
}
}
}
matrix copy_matrix(matrix m)
{
matrix c = {0};
c.rows = m.rows;
c.cols = m.cols;
c.vals = calloc(c.rows, sizeof(float *));
int i;
for(i = 0; i < c.rows; ++i){
c.vals[i] = calloc(c.cols, sizeof(float));
copy_cpu(c.cols, m.vals[i], 1, c.vals[i], 1);
}
return c;
}
matrix make_matrix(int rows, int cols)
{
int i;
matrix m;
m.rows = rows;
m.cols = cols;
m.vals = calloc(m.rows, sizeof(float *));
for(i = 0; i < m.rows; ++i){
m.vals[i] = calloc(m.cols, sizeof(float));
}
return m;
}
matrix hold_out_matrix(matrix *m, int n)
{
int i;
matrix h;
h.rows = n;
h.cols = m->cols;
h.vals = calloc(h.rows, sizeof(float *));
for(i = 0; i < n; ++i){
int index = rand()%m->rows;
h.vals[i] = m->vals[index];
m->vals[index] = m->vals[--(m->rows)];
}
return h;
}
float *pop_column(matrix *m, int c)
{
float *col = calloc(m->rows, sizeof(float));
int i, j;
for(i = 0; i < m->rows; ++i){
col[i] = m->vals[i][c];
for(j = c; j < m->cols-1; ++j){
m->vals[i][j] = m->vals[i][j+1];
}
}
--m->cols;
return col;
}
matrix csv_to_matrix(char *filename)
{
FILE *fp = fopen(filename, "r");
if(!fp) file_error(filename);
matrix m;
m.cols = -1;
char *line;
int n = 0;
int size = 1024;
m.vals = calloc(size, sizeof(float*));
while((line = fgetl(fp))){
if(m.cols == -1) m.cols = count_fields(line);
if(n == size){
size *= 2;
m.vals = realloc(m.vals, size*sizeof(float*));
}
m.vals[n] = parse_fields(line, m.cols);
free(line);
++n;
}
m.vals = realloc(m.vals, n*sizeof(float*));
m.rows = n;
return m;
}
void matrix_to_csv(matrix m)
{
int i, j;
for(i = 0; i < m.rows; ++i){
for(j = 0; j < m.cols; ++j){
if(j > 0) printf(",");
printf("%.17g", m.vals[i][j]);
}
printf("\n");
}
}
void print_matrix(matrix m)
{
int i, j;
printf("%d X %d Matrix:\n",m.rows, m.cols);
printf(" __");
for(j = 0; j < 16*m.cols-1; ++j) printf(" ");
printf("__ \n");
printf("| ");
for(j = 0; j < 16*m.cols-1; ++j) printf(" ");
printf(" |\n");
for(i = 0; i < m.rows; ++i){
printf("| ");
for(j = 0; j < m.cols; ++j){
printf("%15.7f ", m.vals[i][j]);
}
printf(" |\n");
}
printf("|__");
for(j = 0; j < 16*m.cols-1; ++j) printf(" ");
printf("__|\n");
}
| {
"pile_set_name": "Github"
} |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package trace
import (
"math"
"testing"
)
type sumTest struct {
value int64
sum int64
sumOfSquares float64
total int64
}
var sumTests = []sumTest{
{100, 100, 10000, 1},
{50, 150, 12500, 2},
{50, 200, 15000, 3},
{50, 250, 17500, 4},
}
type bucketingTest struct {
in int64
log int
bucket int
}
var bucketingTests = []bucketingTest{
{0, 0, 0},
{1, 1, 0},
{2, 2, 1},
{3, 2, 1},
{4, 3, 2},
{1000, 10, 9},
{1023, 10, 9},
{1024, 11, 10},
{1000000, 20, 19},
}
type multiplyTest struct {
in int64
ratio float64
expectedSum int64
expectedTotal int64
expectedSumOfSquares float64
}
var multiplyTests = []multiplyTest{
{15, 2.5, 37, 2, 562.5},
{128, 4.6, 758, 13, 77953.9},
}
type percentileTest struct {
fraction float64
expected int64
}
var percentileTests = []percentileTest{
{0.25, 48},
{0.5, 96},
{0.6, 109},
{0.75, 128},
{0.90, 205},
{0.95, 230},
{0.99, 256},
}
func TestSum(t *testing.T) {
var h histogram
for _, test := range sumTests {
h.addMeasurement(test.value)
sum := h.sum
if sum != test.sum {
t.Errorf("h.Sum = %v WANT: %v", sum, test.sum)
}
sumOfSquares := h.sumOfSquares
if sumOfSquares != test.sumOfSquares {
t.Errorf("h.SumOfSquares = %v WANT: %v", sumOfSquares, test.sumOfSquares)
}
total := h.total()
if total != test.total {
t.Errorf("h.Total = %v WANT: %v", total, test.total)
}
}
}
func TestMultiply(t *testing.T) {
var h histogram
for i, test := range multiplyTests {
h.addMeasurement(test.in)
h.Multiply(test.ratio)
if h.sum != test.expectedSum {
t.Errorf("#%v: h.sum = %v WANT: %v", i, h.sum, test.expectedSum)
}
if h.total() != test.expectedTotal {
t.Errorf("#%v: h.total = %v WANT: %v", i, h.total(), test.expectedTotal)
}
if h.sumOfSquares != test.expectedSumOfSquares {
t.Errorf("#%v: h.SumOfSquares = %v WANT: %v", i, test.expectedSumOfSquares, h.sumOfSquares)
}
}
}
func TestBucketingFunctions(t *testing.T) {
for _, test := range bucketingTests {
log := log2(test.in)
if log != test.log {
t.Errorf("log2 = %v WANT: %v", log, test.log)
}
bucket := getBucket(test.in)
if bucket != test.bucket {
t.Errorf("getBucket = %v WANT: %v", bucket, test.bucket)
}
}
}
func TestAverage(t *testing.T) {
a := new(histogram)
average := a.average()
if average != 0 {
t.Errorf("Average of empty histogram was %v WANT: 0", average)
}
a.addMeasurement(1)
a.addMeasurement(1)
a.addMeasurement(3)
const expected = float64(5) / float64(3)
average = a.average()
if !isApproximate(average, expected) {
t.Errorf("Average = %g WANT: %v", average, expected)
}
}
func TestStandardDeviation(t *testing.T) {
a := new(histogram)
add(a, 10, 1<<4)
add(a, 10, 1<<5)
add(a, 10, 1<<6)
stdDev := a.standardDeviation()
const expected = 19.95
if !isApproximate(stdDev, expected) {
t.Errorf("StandardDeviation = %v WANT: %v", stdDev, expected)
}
// No values
a = new(histogram)
stdDev = a.standardDeviation()
if !isApproximate(stdDev, 0) {
t.Errorf("StandardDeviation = %v WANT: 0", stdDev)
}
add(a, 1, 1<<4)
if !isApproximate(stdDev, 0) {
t.Errorf("StandardDeviation = %v WANT: 0", stdDev)
}
add(a, 10, 1<<4)
if !isApproximate(stdDev, 0) {
t.Errorf("StandardDeviation = %v WANT: 0", stdDev)
}
}
func TestPercentileBoundary(t *testing.T) {
a := new(histogram)
add(a, 5, 1<<4)
add(a, 10, 1<<6)
add(a, 5, 1<<7)
for _, test := range percentileTests {
percentile := a.percentileBoundary(test.fraction)
if percentile != test.expected {
t.Errorf("h.PercentileBoundary (fraction=%v) = %v WANT: %v", test.fraction, percentile, test.expected)
}
}
}
func TestCopyFrom(t *testing.T) {
a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
b := histogram{6, 36, []int64{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}, 5, -1}
a.CopyFrom(&b)
if a.String() != b.String() {
t.Errorf("a.String = %s WANT: %s", a.String(), b.String())
}
}
func TestClear(t *testing.T) {
a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
a.Clear()
expected := "0, 0.000000, 0, 0, []"
if a.String() != expected {
t.Errorf("a.String = %s WANT %s", a.String(), expected)
}
}
func TestNew(t *testing.T) {
a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
b := a.New()
expected := "0, 0.000000, 0, 0, []"
if b.(*histogram).String() != expected {
t.Errorf("b.(*histogram).String = %s WANT: %s", b.(*histogram).String(), expected)
}
}
func TestAdd(t *testing.T) {
// The tests here depend on the associativity of addMeasurement and Add.
// Add empty observation
a := histogram{5, 25, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, 4, -1}
b := a.New()
expected := a.String()
a.Add(b)
if a.String() != expected {
t.Errorf("a.String = %s WANT: %s", a.String(), expected)
}
// Add same bucketed value, no new buckets
c := new(histogram)
d := new(histogram)
e := new(histogram)
c.addMeasurement(12)
d.addMeasurement(11)
e.addMeasurement(12)
e.addMeasurement(11)
c.Add(d)
if c.String() != e.String() {
t.Errorf("c.String = %s WANT: %s", c.String(), e.String())
}
// Add bucketed values
f := new(histogram)
g := new(histogram)
h := new(histogram)
f.addMeasurement(4)
f.addMeasurement(12)
f.addMeasurement(100)
g.addMeasurement(18)
g.addMeasurement(36)
g.addMeasurement(255)
h.addMeasurement(4)
h.addMeasurement(12)
h.addMeasurement(100)
h.addMeasurement(18)
h.addMeasurement(36)
h.addMeasurement(255)
f.Add(g)
if f.String() != h.String() {
t.Errorf("f.String = %q WANT: %q", f.String(), h.String())
}
// add buckets to no buckets
i := new(histogram)
j := new(histogram)
k := new(histogram)
j.addMeasurement(18)
j.addMeasurement(36)
j.addMeasurement(255)
k.addMeasurement(18)
k.addMeasurement(36)
k.addMeasurement(255)
i.Add(j)
if i.String() != k.String() {
t.Errorf("i.String = %q WANT: %q", i.String(), k.String())
}
// add buckets to single value (no overlap)
l := new(histogram)
m := new(histogram)
n := new(histogram)
l.addMeasurement(0)
m.addMeasurement(18)
m.addMeasurement(36)
m.addMeasurement(255)
n.addMeasurement(0)
n.addMeasurement(18)
n.addMeasurement(36)
n.addMeasurement(255)
l.Add(m)
if l.String() != n.String() {
t.Errorf("l.String = %q WANT: %q", l.String(), n.String())
}
// mixed order
o := new(histogram)
p := new(histogram)
o.addMeasurement(0)
o.addMeasurement(2)
o.addMeasurement(0)
p.addMeasurement(0)
p.addMeasurement(0)
p.addMeasurement(2)
if o.String() != p.String() {
t.Errorf("o.String = %q WANT: %q", o.String(), p.String())
}
}
func add(h *histogram, times int, val int64) {
for i := 0; i < times; i++ {
h.addMeasurement(val)
}
}
func isApproximate(x, y float64) bool {
return math.Abs(x-y) < 1e-2
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.