code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
---
title: സ്വസ്ഥതയുടെ വില
date: 17/07/2021
---
### ഈ ആഴ്ചയിലെ പഠനത്തിന്
2 ശമൂ. 11:1-27; 12:1-23; 1 യോഹ. 1:9; ഉല്പത്തി 3:1-8.
> <p>മനഃപാഠവാക്യം</p>
> “ദൈവമേ, നിർമ്മലമായൊരു ഹൃദയം എന്നിൽ സൃഷ്ടിച്ചു സ്ഥിരമായോരാത്മാവിനെ എന്നിൽ പുതുക്കണമേ” (സങ്കീ. 51:10).
ഒരല്പം ആശ്വാസത്തിനും സമാധാനത്തിനുമായി അനേകർ അലഞ്ഞുനടക്കുന്നു. അതിനായി അവർ പണവും മുടക്കാൻ ഒരുക്കമാണ്. പല വൻനഗരങ്ങളിലും ഇന്റർനെറ്റ് സൗകര്യമില്ലാത്ത മുറികൾ ഇതിനായി ഒരുക്കിയിട്ടുണ്ട്. മണിക്കൂറിന് ഇത്രയെന്ന കണക്കിൽ അതു വാടകയ്ക്കു കൊടുക്കുന്നു. നിയമങ്ങൾ വളരെ കർക്ക ശമാണ്. ശബ്ദവും സന്ദർശകരും പാടില്ല. അതിനുവേണ്ടി പണം മുടക്കി അല്പസ മയം സ്വസ്ഥമായിരിക്കുന്നതിനോ ചെറിയ ഉറക്കത്തിനോ മനുഷ്യർ ഒരുക്കമാണ്. വിമാനത്താവളങ്ങളിൽ വാടകയ്ക്കു നല്കപ്പെടുന്ന ഉറക്ക അറകളുമുണ്ട്. ശബ്ദം ബഹിർഗമിക്കാത്ത ശ്രവണ സഹായികളും സാധാരണയാണ്. ക്യാൻവാസ് കൊണ്ടുള്ള ശിരോമൂടികൾ, പൊളിച്ചുമാറ്റാവുന്ന തരം ഏകാന്തവാസ ഒളിവിടങ്ങൾ (ഇവ നിങ്ങൾക്കു വിലയ്ക്കുവാങ്ങി ജോലി സ്ഥലത്തു അല്പസമയത്തെ വിശ്രമ ത്തിനുപയോഗിക്കാം) എന്നിവയൊക്കെ ലഭ്യമാണ്.
യഥാർത്ഥ സ്വസ്ഥതയ്ക്കും വില നൽകേണ്ടതുണ്ട്. മാധ്യമലോകത്തിൽ ഭ്രമണ വിദഗ്ദ്ധർ നമ്മെ വിശ്വസിപ്പിക്കാൻ ശ്രമിക്കുന്നതു നമ്മുടെ ഭാഗധേയം നമ്മൾത്തന്നെ നിർണയിക്കുന്നു എന്നാണ്. വിശ്രമമെന്നത് ഒരു തിരഞ്ഞെടുപ്പും ആസൂത്രണവും മാത്രം. പക്ഷേ ഇതു സൂക്ഷ്മമായി നാം വിശകലനം ചെയ്താൽ മനസ്സിലാക്കാൻ സാധിക്കുന്നത് നമ്മുടെ സ്വന്തകഴിവുകൾ കൊണ്ടു നമുക്കു സ്വസ്ഥത പ്രാപിപ്പാനാ കയില്ലായെന്നാണ്. നാലാം നൂറ്റാണ്ടിൽ ജീവിച്ചിരുന്ന അഗസ്റ്റിൻ തന്റെ കൃതിയായ "കൺഫെൻഷൻസ്” എന്ന പുസ്തകത്തിൽ പറയുന്നത് ദൈവത്തിന്റെ കൃപയെ പ്പറ്റി, “ദൈവമേ അങ്ങു ഞങ്ങളെ അങ്ങേക്കായി സൃഷ്ടിച്ചു; ഞങ്ങളുടെ ഹൃദയ ങ്ങൾ അങ്ങയിൽ സ്വസ്ഥത പ്രാപിക്കുംവരെ ഞങ്ങൾ അസ്വസ്ഥരാണ്."
ദൈവഹൃദയത്തിന് അനുരൂപമായ മനസ്സുള്ള ഒരു മനുഷ്യൻ ദൈവത്തിൽ സ്വസ്ഥത പ്രാപിക്കുന്നതിനുള്ള തന്റെ കണ്ടെത്തലിനു മുടക്കേണ്ടിവന്ന വിലയെ സംബന്ധിച്ച് ഈ ആഴ്ചയിൽ നാം പഠിക്കുന്നതാണ്.
_ഈ ആഴ്ചയിലെ പാഠം പഠിച്ച് ജൂലൈ 24 ശബ്ബത്തിനുവേണ്ടി നമുക്ക് ഒരുങ്ങാം..._
|
imasaru/sabbath-school-lessons
|
src/ml/2021-03/04/01.md
|
Markdown
|
mit
| 4,723
|
function ssh-tunnel {
remote_host=$1
remote_port=$2
local_port=$3
ssh -L ${local_port}:localhost:${remote_port} ${remote_host}
}
# ~/.ssh/config
######
# Host *
# IdentityFile ~/.ssh/id_rsa+%r@%h
# Host *
# IdentityFile ~/.ssh/id_rsa
######
#
# e.g. ~/.ssh/id_rsa+<REMOTE_USER>@<REMOTE_HOST>
#
# ln -s <KEY_NAME>.pub <TARGET_KEY_NAME>.pub
# ln -s <KEY_NAME> <TARGET_KEY_NAME>
function ssh-key-set {
ssh-add -D
ssh-add ~"/.ssh/$1"
}
function ssh-key-info {
ssh-keygen -l -f ~"/.ssh/$1"
}
|
scheleaap/zsh-config
|
old/modules/ssh.zsh
|
Shell
|
mit
| 518
|
<?php
/**
* (c) Vincent Patry
* This file is part of the Rebond package
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Rebond\Models\Core;
class Folder extends BaseFolder
{
public function __construct($setDefault = true)
{
parent::__construct();
if ($setDefault) {
$this->setDefault();
}
}
public function setDefault()
{
$this->setDefaultBase();
// set your defaults values here
}
}
|
vincium/rebond-framework
|
src/Rebond/Models/Core/Folder.php
|
PHP
|
mit
| 561
|
---
permalink: /blog/
profile: false
layout: list
---
<ul id="post-list">
{% for post in site.posts %}
<li>
<a href="/{{ post.url | remove_first: '/' }}"><aside class="dates">{{ post.date | date:"%b %d, %Y" }}</aside></a>
<a href="/{{ post.url | remove_first: '/' }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
|
aqafiam/aqafiam.github.io
|
blog.md
|
Markdown
|
mit
| 366
|
win = windows.getAll()[0]
test(function() {
g[0] = groups.create(
[
{ url: "data:text/plain,1" },
{ url: "data:text/plain,2" },
{ url: "data:text/plain,yay" },
])
assert_equals(g[0].tabs.getAll().length, 3)
var tab = g[0].tabs.getAll()[2]
g[1] = groups.create(
[
tab, // <-- throws
{ url: "data:text/plain,9" }
])
assert_equals( g[0].tabs.getAll().length, 2)
assert_equals( g[1].tabs.getAll().length, 2)
}, "Create group in default window")
|
1974kpkpkp/operaextensions.js
|
tests/WindowsTabs/adhock/groups.create-shouldnt-throw/oex/test.js
|
JavaScript
|
mit
| 474
|
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" HREF="favicon.ico">
<title>graph3d - vis.js - A dynamic, browser based visualization library.</title>
<!-- Bootstrap core CSS -->
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="../js/googleAnalytics.js"></script>
<script type="text/javascript" src="../js/prettify/prettify.js"></script>
<script src="../js/smooth-scroll.min.js"></script>
<script language="JavaScript">
smoothScroll.init();
</script>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<body onload="prettyPrint();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<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 hidden-sm" href="./index.html">vis.js</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>
<a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
<div class="container full">
<h1>Graph3d</h1>
<h2 id="Overview">Overview</h2>
<p>
Graph3d is an interactive visualization chart to draw data in a three dimensional
graph. You can freely move and zoom in the graph by dragging and scrolling in the
window. Graph3d also supports animation of a graph.
</p>
<p>
Graph3d uses <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Canvas">HTML canvas</a>
to render graphs, and can render up to a few thousands of data points smoothly.
</p>
<h2 id="Contents">Contents</h2>
<ul>
<li><a href="#Overview">Overview</a></li>
<li><a href="#Loading">Loading</a></li>
<li><a href="#Data_Format">Data Format</a></li>
<li><a href="#Configuration_Options">Configuration Options</a></li>
<li><a href="#Methods">Methods</a></li>
<li><a href="#Events">Events</a></li>
<li><a href="#Data_Policy">Data Policy</a></li>
</ul>
<h2 id="Example">Example</h2>
<p>
The following code shows how to create a Graph3d and provide it with data.
More examples can be found in the <a href="../examples">examples</a> directory.
</p>
<pre class="prettyprint lang-html">
<!DOCTYPE HTML>
<html>
<head>
<title>Graph 3D demo</title>
<style>
body {font: 10pt arial;}
</style>
<script type="text/javascript" src="../../dist/vis.js"></script>
<script type="text/javascript">
var data = null;
var graph = null;
function custom(x, y) {
return (Math.sin(x/50) * Math.cos(y/50) * 50 + 50);
}
// Called when the Visualization API is loaded.
function drawVisualization() {
// Create and populate a data table.
var data = new vis.DataSet();
// create some nice looking data with sin/cos
var steps = 50; // number of datapoints will be steps*steps
var axisMax = 314;
var axisStep = axisMax / steps;
for (var x = 0; x < axisMax; x+=axisStep) {
for (var y = 0; y < axisMax; y+=axisStep) {
var value = custom(x, y);
data.add({
x: x,
y: y,
z: value,
style: value
});
}
}
// specify options
var options = {
width: '600px',
height: '600px',
style: 'surface',
showPerspective: true,
showGrid: true,
showShadow: false,
keepAspectRatio: true,
verticalRatio: 0.5
};
// create a graph3d
var container = document.getElementById('mygraph');
graph3d = new vis.Graph3d(container, data, options);
}
</script>
</head>
<body onload="drawVisualization();">
<div id="mygraph"></div>
</body>
</html>
</pre>
<h2 id="Loading">Loading</h2>
<p>
The class name of the Graph3d is <code>vis.Graph3d</code>.
When constructing a Graph3d, an HTML DOM container must be provided to attach
the graph to. Optionally, data an options can be provided.
Data is a vis <code>DataSet</code> or an <code>Array</code>, described in
section <a href="#Data_Format">Data Format</a>.
Options is a name-value map in the JSON format. The available options
are described in section <a href="#Configuration_Options">Configuration Options</a>.
</p>
<pre class="prettyprint lang-js">var graph = new vis.Graph3d(container [, data] [, options]);</pre>
<p>
Data and options can be set or changed later on using the functions
<code>Graph3d.setData(data)</code> and <code>Graph3d.setOptions(options)</code>.
</p>
<h2 id="Data_Format">Data Format</h2>
<p>
Graph3d can load data from an <code>Array</code>, a <code>DataSet</code> or a <code>DataView</code>.
JSON objects are added to this DataSet by using the <code>add()</code> function.
Data points must have properties <code>x</code>, <code>y</code>, and <code>z</code>,
and can optionally have a property <code>style</code> and <code>filter</code>.
<h3>Definition</h3>
<p>
The DataSet JSON objects are defined as:
</p>
<table class="properties">
<tr>
<th>Name</th>
<th>Type</th>
<th>Required</th>
<th>Description</th>
</tr>
<tr>
<td>x</td>
<td>number</td>
<td>yes</td>
<td>Location on the x-axis.</td>
</tr>
<tr>
<td>y</td>
<td>number</td>
<td>yes</td>
<td>Location on the y-axis.</td>
</tr>
<tr>
<td>z</td>
<td>number</td>
<td>yes</td>
<td>Location on the z-axis.</td>
</tr>
<tr>
<td>style</td>
<td>number</td>
<td>no</td>
<td>The data value, required for graph styles <code>dot-color</code> and
<code>dot-size</code>.
</td>
</tr>
<tr>
<td>filter</td>
<td>*</td>
<td>no</td>
<td>Filter values used for the animation.
This column may have any type, such as a number, string, or Date.</td>
</tr>
</table>
<h2 id="Configuration_Options">Configuration Options</h2>
<p>
Options can be used to customize the graph. Options are defined as a JSON object.
All options are optional.
</p>
<pre class="prettyprint lang-js">
var options = {
width: '100%',
height: '400px',
style: 'surface'
};
</pre>
<p>
The following options are available.
</p>
<table class="options">
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>animationInterval</td>
<td>number</td>
<td>1000</td>
<td>The animation interval in milliseconds. This determines how fast
the animation runs.</td>
</tr>
<tr>
<td>animationPreload</td>
<td>boolean</td>
<td>false</td>
<td>If false, the animation frames are loaded as soon as they are requested.
if <code>animationPreload</code> is true, the graph will automatically load
all frames in the background, resulting in a smoother animation as soon as
all frames are loaded. The load progress is shown on screen.</td>
</tr>
<tr>
<td>animationAutoStart</td>
<td>boolean</td>
<td>false</td>
<td>If true, the animation starts playing automatically after the graph
is created.</td>
</tr>
<tr>
<td>axisColor</td>
<td>string</td>
<td>'#4D4D4D'</td>
<td>The color of the axis lines and the text along the axis.</td>
</tr>
<tr>
<td>backgroundColor</td>
<td>string or Object</td>
<td>{fill: 'white', stroke: 'gray', strokeWidth: 1}</td>
<td>The background color for the main area of the chart.
Can be either a simple HTML color string, for example: 'red' or '#00cc00',
or an object with the following properties.</td>
</tr>
<tr>
<td>backgroundColor.fill</td>
<td>string</td>
<td>'white'</td>
<td>The chart fill color, as an HTML color string.</td>
</tr>
<tr>
<td>backgroundColor.stroke</td>
<td>string</td>
<td>'gray'</td>
<td>The color of the chart border, as an HTML color string.</td>
</tr>
<tr>
<td>backgroundColor.strokeWidth</td>
<td>number</td>
<td>1</td>
<td>The border width, in pixels.</td>
</tr>
<tr>
<td>cameraPosition</td>
<td>Object</td>
<td>{horizontal: 1.0, vertical: 0.5, distance: 1.7}</td>
<td>Set the initial rotation and position of the camera.
The object <code>cameraPosition</code> contains three parameters:
<code>horizontal</code>, <code>vertical</code>, and <code>distance</code>.
Parameter <code>horizontal</code> is a value in radians and can have any
value (but normally in the range of 0 and 2*Pi).
Parameter <code>vertical</code> is a value in radians between 0 and 0.5*Pi.
Parameter <code>distance</code> is the (normalized) distance from the
camera to the center of the graph, in the range of 0.71 to 5.0. A
larger distance puts the graph further away, making it smaller.
All parameters are optional.
</tr>
<tr>
<td>dataColor</td>
<td>string or object</td>
<td>{fill: '#7DC1FF', stroke: '#3267D2', strokeWidth: 1}</td>
<td>When <code>dataColor</code> is a string, it will set the color for both border and fill color of dots and bars. Applicable for styles <code>dot-size</code>, <code>bar-size</code>, and <code>line</code>. When an object, it can contain the properties descibed below.</td>
</tr>
<tr>
<td>dataColor.fill</td>
<td>string</td>
<td>'#7DC1FF'</td>
<td>The border color of the dots or bars. Applicable when using styles <code>dot-size</code> or <code>bar-size</code>.</td>
</tr>
<tr>
<td>dataColor.stroke</td>
<td>string</td>
<td>'#3267D2'</td>
<td>The fill color of the dots or bars. Applicable when using styles <code>dot-size</code>, <code>bar-size</code>, or <code>line</code>.</td>
</tr>
<tr>
<td>dataColor.strokeWidth</td>
<td>number</td>
<td>1</td>
<td>The line width of dots, bars and lines. Applicable for all styles.</td>
</tr>
<tr>
<td>gridColor</td>
<td>string</td>
<td>'#D3D3D3'</td>
<td>The color of the grid lines.</td>
</tr>
<tr>
<td>height</td>
<td>string</td>
<td>'400px'</td>
<td>The height of the graph in pixels or as a percentage.</td>
</tr>
<tr>
<td>keepAspectRatio</td>
<td>boolean</td>
<td>true</td>
<td>If <code>keepAspectRatio</code> is true, the x-axis and the y-axis
keep their aspect ratio. If false, the axes are scaled such that they
both have the same, maximum with.</td>
</tr>
<tr>
<td>showAnimationControls</td>
<td>boolean</td>
<td>true</td>
<td>If true, animation controls are created at the bottom of the Graph.
The animation controls consists of buttons previous, start/stop, next,
and a slider showing the current frame.
Only applicable when the provided data contains an animation.</td>
</tr>
<tr>
<td>showGrid</td>
<td>boolean</td>
<td>true</td>
<td>If true, grid lines are draw in the x-y surface (the bottom of the 3d
graph).</td>
</tr>
<tr>
<td>showPerspective</td>
<td>boolean</td>
<td>true</td>
<td>If true, the graph is drawn in perspective: points and lines which
are further away are drawn smaller.
Note that the graph currently does not support a gray colored bottom side
when drawn in perspective.
</td>
</tr>
<tr>
<td>showShadow</td>
<td>boolean</td>
<td>false</td>
<td>Show shadow on the graph.</td>
</tr>
<tr>
<td>style</td>
<td>string</td>
<td>'dot'</td>
<td>The style of the 3d graph. Available styles:
<code>bar</code>,
<code>bar-color</code>,
<code>bar-size</code>,
<code>dot</code>,
<code>dot-line</code>,
<code>dot-color</code>,
<code>dot-size</code>,
<code>line</code>,
<code>grid</code>,
or <code>surface</code></td>
</tr>
<tr>
<td>tooltip</td>
<td>boolean | function</td>
<td>false</td>
<td>Show a tooltip showing the values of the hovered data point.
The contents of the tooltip can be customized by providing a callback
function as <code>tooltip</code>. In this case the function is called
with an object containing parameters <code>x</code>,
<code>y</code>, and <code>z</code> argument,
and must return a string which may contain HTML.
</td>
</tr>
<tr>
<td>valueMax</td>
<td>number</td>
<td>none</td>
<td>The maximum value for the value-axis. Only available in combination
with the styles <code>dot-color</code> and <code>dot-size</code>.</td>
</tr>
<tr>
<td>valueMin</td>
<td>number</td>
<td>none</td>
<td>The minimum value for the value-axis. Only available in combination
with the styles <code>dot-color</code> and <code>dot-size</code>.</td>
</tr>
<tr>
<td>verticalRatio</td>
<td>number</td>
<td>0.5</td>
<td>A value between 0.1 and 1.0. This scales the vertical size of the graph
When keepAspectRatio is set to false, and verticalRatio is set to 1.0,
the graph will be a cube.</td>
</tr>
<tr>
<td>width</td>
<td>string</td>
<td>'400px'</td>
<td>The width of the graph in pixels or as a percentage.</td>
</tr>
<tr>
<td>xBarWidth</td>
<td>number</td>
<td>none</td>
<td>The width of bars in x direction. By default, the width is equal to the distance
between the data points, such that bars adjoin each other.
Only applicable for styles <code>'bar'</code> and <code>'bar-color'</code>.</td>
</tr>
<tr>
<td>xCenter</td>
<td>string</td>
<td>'55%'</td>
<td>The horizontal center position of the graph, as a percentage or in
pixels.</td>
</tr>
<tr>
<td>xMax</td>
<td>number</td>
<td>none</td>
<td>The maximum value for the x-axis.</td>
</tr>
<tr>
<td>xMin</td>
<td>number</td>
<td>none</td>
<td>The minimum value for the x-axis.</td>
</tr>
<tr>
<td>xStep</td>
<td>number</td>
<td>none</td>
<td>Step size for the grid on the x-axis.</td>
</tr>
<tr>
<td>xValueLabel</td>
<td>function</td>
<td>none</td>
<td>A function for custom formatting of the labels along the x-axis,
for example <code>function (x) {return (x * 100) + '%'}</code>.
</td>
</tr>
<tr>
<td>yBarWidth</td>
<td>number</td>
<td>none</td>
<td>The width of bars in y direction. By default, the width is equal to the distance
between the data points, such that bars adjoin each other.
Only applicable for styles <code>'bar'</code> and <code>'bar-color'</code>.</td>
</tr>
<tr>
<td>yCenter</td>
<td>string</td>
<td>'45%'</td>
<td>The vertical center position of the graph, as a percentage or in
pixels.</td>
</tr>
<tr>
<td>yMax</td>
<td>number</td>
<td>none</td>
<td>The maximum value for the y-axis.</td>
</tr>
<tr>
<td>yMin</td>
<td>number</td>
<td>none</td>
<td>The minimum value for the y-axis.</td>
</tr>
<tr>
<td>yStep</td>
<td>number</td>
<td>none</td>
<td>Step size for the grid on the y-axis.</td>
</tr>
<tr>
<td>yValueLabel</td>
<td>function</td>
<td>none</td>
<td>A function for custom formatting of the labels along the y-axis,
for example <code>function (y) {return (y * 100) + '%'}</code>.
</td>
</tr>
<tr>
<td>zMin</td>
<td>number</td>
<td>none</td>
<td>The minimum value for the z-axis.</td>
</tr>
<tr>
<td>zMax</td>
<td>number</td>
<td>none</td>
<td>The maximum value for the z-axis.</td>
</tr>
<tr>
<td>zStep</td>
<td>number</td>
<td>none</td>
<td>Step size for the grid on the z-axis.</td>
</tr>
<tr>
<td>zValueLabel</td>
<td>function</td>
<td>none</td>
<td>A function for custom formatting of the labels along the z-axis,
for example <code>function (z) {return (z * 100) + '%'}</code>.
</td>
</tr>
<tr>
<td>xLabel</td>
<td>String</td>
<td>x</td>
<td>Label on the X axis.</td>
</tr>
<tr>
<td>yLabel</td>
<td>String</td>
<td>y</td>
<td>Label on the Y axis.</td>
</tr>
<tr>
<td>zLabel</td>
<td>String</td>
<td>z</td>
<td>Label on the Z axis.</td>
</tr>
<tr>
<td>filterLabel</td>
<td>String</td>
<td>time</td>
<td>Label for the filter column.</td>
</tr>
<tr>
<td>legendLabel</td>
<td>String</td>
<td>value</td>
<td>Label for the style description.</td>
</tr>
</table>
<h2 id="Methods">Methods</h2>
<p>
Graph3d supports the following methods.
</p>
<table class="methods">
<tr>
<th>Method</th>
<th>Return Type</th>
<th>Description</th>
</tr>
<tr>
<td>animationStart()</td>
<td>none</td>
<td>Start playing the animation.
Only applicable when animation data is available.</td>
</tr>
<tr>
<td>animationStop()</td>
<td>none</td>
<td>Stop playing the animation.
Only applicable when animation data is available.</td>
</tr>
<tr>
<td>getCameraPosition()</td>
<td>An object with parameters <code>horizontal</code>,
<code>vertical</code> and <code>distance</code></td>
<td>Returns an object with parameters <code>horizontal</code>,
<code>vertical</code> and <code>distance</code>,
which each one of them is a number, representing the rotation and position
of the camera.</td>
</tr>
<tr>
<td>redraw()</td>
<td>none</td>
<td>Redraw the graph. Useful after the camera position is changed externally,
when data is changed, or when the layout of the webpage changed.</td>
</tr>
<tr>
<td>setData(data)</td>
<td>none</td>
<td>Replace the data in the Graph3d.</td>
</tr>
<tr>
<td>setOptions(options)</td>
<td>none</td>
<td>Update options of Graph3d.
The provided options will be merged with current options.</td>
</tr>
<tr>
<td>setSize(width, height)</td>
<td>none</td>
<td>Parameters <code>width</code> and <code>height</code> are strings,
containing a new size for the graph. Size can be provided in pixels
or in percentages.</td>
</tr>
<tr>
<td>setCameraPosition (pos)</td>
<td>{horizontal: 1.0, vertical: 0.5, distance: 1.7}</td>
<td>Set the rotation and position of the camera. Parameter <code>pos</code>
is an object which contains three parameters: <code>horizontal</code>,
<code>vertical</code>, and <code>distance</code>.
Parameter <code>horizontal</code> is a value in radians and can have any
value (but normally in the range of 0 and 2*Pi).
Parameter <code>vertical</code> is a value in radians between 0 and 0.5*Pi.
Parameter <code>distance</code> is the (normalized) distance from the
camera to the center of the graph, in the range of 0.71 to 5.0. A
larger distance puts the graph further away, making it smaller.
All parameters are optional.
</td>
</tr>
</table>
<h2 id="Events">Events</h2>
<p>
Graph3d fires events after the camera position has been changed.
The event can be catched by creating a listener.
Here an example on how to catch a <code>cameraPositionChange</code> event.
</p>
<pre class="prettyprint lang-js">
function onCameraPositionChange(event) {
alert('The camera position changed to:\n' +
'Horizontal: ' + event.horizontal + '\n' +
'Vertical: ' + event.vertical + '\n' +
'Distance: ' + event.distance);
}
// assuming var graph3d = new vis.Graph3d(document.getElementById('mygraph'));
graph3d.on('cameraPositionChange', onCameraPositionChange);
</pre>
<p>
The following events are available.
</p>
<table class="events">
<tr>
<th>name</th>
<th>Properties</th>
<th>Description</th>
</tr>
<tr>
<td>cameraPositionChange</td>
<td>
<ul>
<li><code>horizontal</code>: Number. The horizontal angle of the camera.</li>
<li><code>vertical</code>: Number. The vertical angle of the camera.</li>
<li><code>distance</code>: Number. The distance of the camera to the center of the graph.</li>
</ul>
</td>
<td>The camera position changed. Fired after the user modified the camera position
by moving (dragging) the graph, or by zooming (scrolling),
but not after a call to <code>setCameraPosition</code> method.
The new camera position can be retrieved by calling the method
<code>getCameraPosition</code>.</td>
</tr>
</table>
<h2 id="Data_Policy">Data Policy</h2>
<p>
All code and data are processed and rendered in the browser. No data is sent to any server.
</p>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../js/ie10-viewport-bug-workaround.js"></script>
<!-- controller -->
<script src="../js/main.js"></script>
|
reshak/angular-dashboard-framework
|
sample/widgets/topology/sample/components/vis/docs/graph3d/index.html
|
HTML
|
mit
| 24,262
|
require File.expand_path('../../lib/mac_bacon', __FILE__)
$false_is_not_true = false.should.not.be.true
$nil_is_not_true = nil.should.not.be.true
describe 'A non-true value' do
it 'should pass negated tests inside specs' do
false.should.not.be.true
nil.should.not.be.true
end
it 'should pass negated tests outside specs' do
$false_is_not_true.should.be.true
$nil_is_not_true.should.be.true
end
end
|
alloy/MacBacon
|
test/spec_nontrue.rb
|
Ruby
|
mit
| 427
|
<h1 class="ui top attached header">Add new Test Case</h1>
<div class="ui attached segment">
<div class='ui form' id="new-testcase-form" data-parsley-validate>
<div class="field">
<label>Name</label>
<input name="name" id="testcase-name-input" placeholder="Name" type="text" value="" data-parsley-required="true" data-parsley-length="[1,255]">
</div>
<div class="field">
<label>Description</label>
<textarea name="description" placeholder="Description" id="testcase-description-input" data-parsley-required="false" data-parsley-length="[1,1000]"></textarea>
</div>
<div class="field">
<label>Prerequisite</label>
<textarea name="prerequisite" placeholder="Prerequisite" id="testcase-prerequisite-input" data-parsley-required="false" data-parsley-length="[1,1000]"></textarea>
</div>
<div class="field">
<label>Execution type</label>
<select name='executiontype_id' id='testcase-executiontype_id-input' data-parsley-required="true" data-parsley-min="1">
<% _.each(execution_types, function(execution_type) { %>
<option value='<%= execution_type.id %>'><%= execution_type.get('name') %></option>
<% }); %>
</select>
</div>
<button class="positive ui left floated button" id="new-testcase-btn">
Okay
</button>
<a href="javascript: window.history.back();" class="ui left floated button">
Cancel
</a>
<br class='clearfix' />
<br/>
</div>
</div>
|
kinow/nestor
|
public/templates/testcases/newTestCaseTemplate.html
|
HTML
|
mit
| 1,553
|
class OriginalDatabaseMigration < ActiveRecord::Migration
def self.up
create_table "articles", :force => true do |t|
t.string "title"
t.string "hypertitle"
t.text "html"
t.string "author"
t.boolean "published"
t.integer "category_id"
t.integer "issue_id"
t.date "date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "photo_file_name"
t.string "photo_content_type"
t.integer "photo_file_size"
t.datetime "photo_updated_at"
end
add_index :articles, [:category_id, :date]
add_index :articles, [:issue_id, :category_id, :published]
add_index :articles, "date"
add_index :articles, "created_at"
create_table "banners", :force => true do |t|
t.string "describe"
t.integer "block_id"
t.string "photo_file_name"
t.string "photo_content_type"
t.integer "photo_file_size"
t.datetime "photo_updated_at"
t.datetime "created_at"
t.datetime "updated_at"
t.string "url"
t.integer "position"
end
add_index :banners, ["block_id", "position"]
create_table "blocks", :force => true do |t|
t.integer "position"
t.string "name"
t.string "mode"
t.string "placement"
t.datetime "created_at"
t.datetime "updated_at"
t.string "partial"
end
add_index :blocks, [:placement, :position]
create_table "categories", :force => true do |t|
t.string "name"
t.string "permalink"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "issued"
end
add_index :categories, [:permalink, :id], unique: true
create_table "ckeditor_assets", :force => true do |t|
t.string "data_file_name", :null => false
t.string "data_content_type"
t.integer "data_file_size"
t.integer "assetable_id"
t.string "assetable_type", :limit => 30
t.string "type", :limit => 30
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
create_table "issues", :force => true do |t|
t.integer "number"
t.date "date"
t.boolean "published"
t.datetime "created_at"
t.datetime "updated_at"
t.string "cover_file_name"
t.string "cover_content_type"
t.integer "cover_file_size"
t.datetime "cover_updated_at"
t.string "pdf_file_name"
t.string "pdf_content_type"
t.integer "pdf_file_size"
t.datetime "pdf_updated_at"
end
add_index :issues, [:number, :id], unique: true
create_table "navigators", :force => true do |t|
t.string "name"
t.integer "block_id"
t.integer "position"
t.integer "navigatable_id"
t.string "navigatable_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index :navigators, ["block_id", "position"]
add_index :navigators, ["navigatable_type", "navigatable_id"]
create_table "orderings", :force => true do |t|
t.integer "article_id"
t.integer "issue_pos"
t.integer "cat_pos"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index :orderings, ["article_id", "issue_pos"]
add_index :orderings, ["article_id", "cat_pos"]
create_table "pages", :force => true do |t|
t.string "name"
t.string "title"
t.string "meta_description"
t.text "content"
t.string "permalink"
t.boolean "published"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index :pages, :permalink, unique: true
create_table "settings", :force => true do |t|
t.string "meta_key"
t.string "meta_value"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "taggings", :force => true do |t|
t.integer "article_id"
t.integer "tag_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index :taggings, ["article_id", "tag_id"]
create_table "tags", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "roles_mask"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
end
def self.down
drop_table :users
drop_table :orderings
drop_table :navigators
drop_table :issues
drop_table :current_issues
drop_table :ckeditor_assets
drop_table :categories
drop_table :blocks
drop_table :banners
drop_table :articles
drop_table :tags
drop_table :taggings
drop_table :pages
end
end
|
mikezaby/lamepress_legacy
|
db/migrate/20111004235243_original_database_migration.rb
|
Ruby
|
mit
| 5,659
|
// @flow
import Bluebird from 'bluebird';
import type { Disposable } from 'bluebird';
const defer: Bluebird.Defer = Bluebird.defer();
const promise: Bluebird<*> = defer.promise;
(promise.isFulfilled(): bool);
promise.reflect().then(inspection => {
(inspection.isCancelled(): bool);
(inspection.pending(): bool);
});
// $FlowExpectedError
new Bluebird();
Bluebird.all([
new Bluebird(() => {}),
]);
Bluebird.map([1], (x: number) => new Bluebird(() => {})).all();
Bluebird.map(Bluebird.resolve([1]), (x: number) => new Bluebird(() => {})).all();
Bluebird.reject('test');
Bluebird.all([
1
]);
function mapper(x: number): Promise<number> {
return Bluebird.resolve(x);
}
let mapResult: Promise<number[]> = Bluebird.map([1], mapper);
let mapSeriesResult: Promise<number[]> = Bluebird.mapSeries([1], mapper);
Bluebird.resolve([1,2,3]).then(function(arr) {
let l = arr.length;
// $FlowExpectedError Property not found in Array
arr.then(r => r);
});
let response = fetch('/').then(r => r.text())
Bluebird.resolve(response).then(function(responseBody) {
let length: number = responseBody.length;
// $FlowExpectedError Property not found in string
responseBody.then(r => r);
});
Bluebird.all([1, Bluebird.resolve(1), Promise.resolve(1)]).then(function(r: Array<number>) { });
Bluebird.all(['hello', Bluebird.resolve('world'), Promise.resolve('!')]).then(function(r: Array<string>) { });
Bluebird.join(1, Bluebird.resolve(2), function (a, b) { return a + b }).then(function (s) { return s + 1 })
Bluebird.join(
1,
Bluebird.resolve(2),
Promise.resolve(3),
function (a, b) { return a + b }).then(function (s) { return s + 1 })
Bluebird.join(1, Bluebird.resolve(2),
function (a, b) { return Bluebird.resolve(a + b) }).then(function (s) { return s + 1 })
// $FlowExpectedError
Bluebird.all([1, Bluebird.resolve(1), Promise.resolve(1)]).then(function(r: Array<string>) { });
function foo(a: number, b: string) {
throw new Error('oh no');
}
let fooPromise = Bluebird.method(foo);
fooPromise(1, 'b').catch(function(e: Error) {
let m: string = e.message;
});
function fooPlain (a: number, b: string) {
return 1;
}
let fooPlainPromise = Bluebird.method(fooPlain);
fooPlainPromise(1, 'a').then(function (n: number) {
let n2 = n;
});
function fooNative (a: number, b: string) {
return Promise.resolve(2);
}
let fooNativePromise = Bluebird.method(fooNative);
fooNativePromise(1, 'a').then(function (n: number) {
let n2 = n;
});
function fooBluebird (a: number, b: string) {
return Bluebird.resolve(3);
}
let fooBluebirdPromise = Bluebird.method(fooBluebird);
fooBluebirdPromise(1, 'a').then(function (n: number) {
let n2 = n;
});
// $FlowExpectedError
fooPromise('a', 1)
// $FlowExpectedError
fooPromise()
Bluebird.resolve(['arr', { some: 'value' }, 42])
.spread((someString: string, map: Object, answer: number) => answer)
.then(answer => answer * 2);
Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next);
Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next, 1);
Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next, Bluebird.resolve(1));
Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next, Promise.resolve(1));
Bluebird.reduce(Promise.resolve([5, Bluebird.resolve(6), Promise.resolve(7)]), (memo, next) => memo + next);
Bluebird.reduce(Bluebird.resolve([5, Bluebird.resolve(6), Promise.resolve(7)]), (memo, next) => memo + next, 1);
Bluebird.reduce([1, Bluebird.resolve(2), Promise.resolve(3)], (prev, num) => Promise.resolve(prev * num));
Bluebird.reduce([1, Bluebird.resolve(2), Promise.resolve(3)], (prev, num) => Bluebird.resolve(prev * num));
//$FlowExpectedError
Bluebird.reduce([1, Bluebird.resolve(2), Promise.resolve(3)], (prev, num) => Bluebird.resolve(prev * num), 'hello');
type PromiseOutput<T> = () => Promise<T>;
let givePromise1: PromiseOutput<number> = () => Promise.resolve(1);
let givePromise2: PromiseOutput<number> = () => Bluebird.resolve(2);
// $FlowExpectedError
let givePromise3: PromiseOutput<number> = () => Bluebird.resolve('hello');
type PromiseInput<T> = (input: Promise<T>) => Function
let takePromise: PromiseInput<number> = (promise) => promise.then
takePromise(Promise.resolve(1));
takePromise(Bluebird.resolve(1));
// $FlowExpectedError
takePromise(Bluebird.resolve('hello'));
Bluebird.delay(500);
// $FlowExpectedError
Bluebird.delay('500');
Bluebird.delay(500, 1);
Bluebird.delay(500, Promise.resolve(5));
Bluebird.delay(500, Bluebird.resolve(5));
Bluebird.resolve().return(5).then((result: number) => {});
Bluebird.resolve().thenReturn(5).then((result: number) => {});
// $FlowExpectedError
Bluebird.resolve().return(5).then((result: string) => {});
// $FlowExpectedError
Bluebird.resolve().thenReturn(5).then((result: string) => {});
let disposable: Disposable<boolean> = Bluebird.resolve(true).disposer((value: boolean) => {});
Bluebird.using(disposable, (value: boolean) => 9).then((result: number) => {});
// $FlowExpectedError
Bluebird.using(disposable, (value: number) => 9);
// $FlowExpectedError
Bluebird.using(disposable, (value: boolean) => 9).then((result: boolean) => {});
|
splodingsocks/FlowTyped
|
definitions/npm/bluebird_v3.x.x/flow_v0.32.x-v0.32.x/test_bluebird_v3.x.x.js
|
JavaScript
|
mit
| 5,228
|
---
title: About
permalink: about/
layout: page
---
# About
culinary.af is a site by [Soroush Khanlou](http://khanlou.com). It's where he keeps his recipes. It's powered by an open-source JavaScript ingredient parsing library called `pepin`, which you can find on [Github](http://github.com/khanlou/pepin).
|
khanlou/cookbook
|
about.md
|
Markdown
|
mit
| 310
|
"use strict";
input.map(function (item) {
return item + 1;
});
(function (a) {
return a + 1;
});
|
yuzexia/learn-365
|
learn/ES6-learn/ECMAScript6-intro/ES5/test.js
|
JavaScript
|
mit
| 102
|
Fabricator(:mutation_type) do
name { sequence(:name) { |i| "Mutation Type ##{i}" } }
end
|
bainscou/docm
|
spec/fabricators/mutation_type_fabricator.rb
|
Ruby
|
mit
| 91
|
package com.aspose.imaging.api.imagingapi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
|
aspose-imaging/Aspose.Imaging-for-Cloud
|
Examples/Android/app/src/main/java/com/aspose/imaging/api/imagingapi/MainActivity.java
|
Java
|
mit
| 346
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers
// Copyright (c) 2013 The Sifcoin developers
// Copyright (c) 2013 The Quarkcoin developers
// Copyright (c) 2013-2014 The BitQuark Developers
// Copyright (c) 2014 The BitCrystal Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <math.h>
#include "alert.h"
#include "checkpoints.h"
#include "db.h"
#include "txdb.h"
#include "net.h"
#include "init.h"
#include "ui_interface.h"
#include "checkqueue.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
using namespace std;
using namespace boost;
//
// Global state
//
CCriticalSection cs_setpwalletRegistered;
set<CWallet*> setpwalletRegistered;
CCriticalSection cs_main;
CTxMemPool mempool;
unsigned int nTransactionsUpdated = 0;
map<uint256, CBlockIndex*> mapBlockIndex;
uint256 hashGenesisBlock("0x000001743a22ba983d054d07b92d95acd5fb8639cd18a4774668c149b5c6bd35");
static const unsigned int timeGenesisBlock = 1419250578;
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1;
uint256 nBestChainWork = 0;
uint256 nBestInvalidWork = 0;
uint256 hashBestChain = 0;
CBlockIndex* pindexBest = NULL;
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed
int64 nTimeBestReceived = 0;
int nScriptCheckThreads = 0;
bool fImporting = false;
bool fReindex = false;
bool fBenchmark = false;
bool fTxIndex = false;
unsigned int nCoinCacheSize = 5000;
/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
int64 CTransaction::nMinTxFee = 10; // Override with -mintxfee
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
int64 CTransaction::nMinRelayTxFee = 100;
CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have
map<uint256, CBlock*> mapOrphanBlocks;
multimap<uint256, CBlock*> mapOrphanBlocksByPrev;
map<uint256, CDataStream*> mapOrphanTransactions;
map<uint256, map<uint256, CDataStream*> > mapOrphanTransactionsByPrev;
// Constant stuff for coinbase transactions we create:
CScript COINBASE_FLAGS;
const string strMessageMagic = "BitCrystal Signed Message:\n";
double dHashesPerSec = 0.0;
int64 nHPSTimerStart = 0;
// Settings
int64 nTransactionFee = 0;
//////////////////////////////////////////////////////////////////////////////
//
// dispatching functions
//
// These functions dispatch to one or all registered wallets
void RegisterWallet(CWallet* pwalletIn)
{
{
LOCK(cs_setpwalletRegistered);
setpwalletRegistered.insert(pwalletIn);
}
}
void UnregisterWallet(CWallet* pwalletIn)
{
{
LOCK(cs_setpwalletRegistered);
setpwalletRegistered.erase(pwalletIn);
}
}
// get the wallet transaction with the given hash (if it exists)
bool static GetTransaction(const uint256& hashTx, CWalletTx& wtx)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
if (pwallet->GetTransaction(hashTx,wtx))
return true;
return false;
}
// erases transaction with the given hash from all wallets
void static EraseFromWallets(uint256 hash)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->EraseFromWallet(hash);
}
// make sure all wallets know about the given transaction, in the given block
void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->AddToWalletIfInvolvingMe(hash, tx, pblock, fUpdate);
}
// notify wallets about a new best chain
void static SetBestChain(const CBlockLocator& loc)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->SetBestChain(loc);
}
// notify wallets about an updated transaction
void static UpdatedTransaction(const uint256& hashTx)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->UpdatedTransaction(hashTx);
}
// dump all wallets
void static PrintWallets(const CBlock& block)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->PrintWallet(block);
}
// notify wallets about an incoming inventory (for request counts)
void static Inventory(const uint256& hash)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->Inventory(hash);
}
// ask wallets to resend their transactions
void static ResendWalletTransactions()
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->ResendWalletTransactions();
}
//////////////////////////////////////////////////////////////////////////////
//
// CCoinsView implementations
//
bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) { return false; }
bool CCoinsView::SetCoins(const uint256 &txid, const CCoins &coins) { return false; }
bool CCoinsView::HaveCoins(const uint256 &txid) { return false; }
CBlockIndex *CCoinsView::GetBestBlock() { return NULL; }
bool CCoinsView::SetBestBlock(CBlockIndex *pindex) { return false; }
bool CCoinsView::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex) { return false; }
bool CCoinsView::GetStats(CCoinsStats &stats) { return false; }
CCoinsViewBacked::CCoinsViewBacked(CCoinsView &viewIn) : base(&viewIn) { }
bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) { return base->GetCoins(txid, coins); }
bool CCoinsViewBacked::SetCoins(const uint256 &txid, const CCoins &coins) { return base->SetCoins(txid, coins); }
bool CCoinsViewBacked::HaveCoins(const uint256 &txid) { return base->HaveCoins(txid); }
CBlockIndex *CCoinsViewBacked::GetBestBlock() { return base->GetBestBlock(); }
bool CCoinsViewBacked::SetBestBlock(CBlockIndex *pindex) { return base->SetBestBlock(pindex); }
void CCoinsViewBacked::SetBackend(CCoinsView &viewIn) { base = &viewIn; }
bool CCoinsViewBacked::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex) { return base->BatchWrite(mapCoins, pindex); }
bool CCoinsViewBacked::GetStats(CCoinsStats &stats) { return base->GetStats(stats); }
CCoinsViewCache::CCoinsViewCache(CCoinsView &baseIn, bool fDummy) : CCoinsViewBacked(baseIn), pindexTip(NULL) { }
bool CCoinsViewCache::GetCoins(const uint256 &txid, CCoins &coins) {
if (cacheCoins.count(txid)) {
coins = cacheCoins[txid];
return true;
}
if (base->GetCoins(txid, coins)) {
cacheCoins[txid] = coins;
return true;
}
return false;
}
std::map<uint256,CCoins>::iterator CCoinsViewCache::FetchCoins(const uint256 &txid) {
std::map<uint256,CCoins>::iterator it = cacheCoins.lower_bound(txid);
if (it != cacheCoins.end() && it->first == txid)
return it;
CCoins tmp;
if (!base->GetCoins(txid,tmp))
return cacheCoins.end();
std::map<uint256,CCoins>::iterator ret = cacheCoins.insert(it, std::make_pair(txid, CCoins()));
tmp.swap(ret->second);
return ret;
}
CCoins &CCoinsViewCache::GetCoins(const uint256 &txid) {
std::map<uint256,CCoins>::iterator it = FetchCoins(txid);
assert(it != cacheCoins.end());
return it->second;
}
bool CCoinsViewCache::SetCoins(const uint256 &txid, const CCoins &coins) {
cacheCoins[txid] = coins;
return true;
}
bool CCoinsViewCache::HaveCoins(const uint256 &txid) {
return FetchCoins(txid) != cacheCoins.end();
}
CBlockIndex *CCoinsViewCache::GetBestBlock() {
if (pindexTip == NULL)
pindexTip = base->GetBestBlock();
return pindexTip;
}
bool CCoinsViewCache::SetBestBlock(CBlockIndex *pindex) {
pindexTip = pindex;
return true;
}
bool CCoinsViewCache::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex) {
for (std::map<uint256, CCoins>::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++)
cacheCoins[it->first] = it->second;
pindexTip = pindex;
return true;
}
bool CCoinsViewCache::Flush() {
bool fOk = base->BatchWrite(cacheCoins, pindexTip);
if (fOk)
cacheCoins.clear();
return fOk;
}
unsigned int CCoinsViewCache::GetCacheSize() {
return cacheCoins.size();
}
/** CCoinsView that brings transactions from a memorypool into view.
It does not check for spendings by memory pool transactions. */
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) {
if (base->GetCoins(txid, coins))
return true;
if (mempool.exists(txid)) {
const CTransaction &tx = mempool.lookup(txid);
coins = CCoins(tx, MEMPOOL_HEIGHT);
return true;
}
return false;
}
bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) {
return mempool.exists(txid) || base->HaveCoins(txid);
}
CCoinsViewCache *pcoinsTip = NULL;
CBlockTreeDB *pblocktree = NULL;
//////////////////////////////////////////////////////////////////////////////
//
// mapOrphanTransactions
//
bool AddOrphanTx(const CDataStream& vMsg)
{
CTransaction tx;
CDataStream(vMsg) >> tx;
uint256 hash = tx.GetHash();
if (mapOrphanTransactions.count(hash))
return false;
CDataStream* pvMsg = new CDataStream(vMsg);
// Ignore big transactions, to avoid a
// send-big-orphans memory exhaustion attack. If a peer has a legitimate
// large transaction with a missing parent then we assume
// it will rebroadcast it later, after the parent transaction(s)
// have been mined or received.
// 10,000 orphans, each of which is at most 5,000 bytes big is
// at most 500 megabytes of orphans:
if (pvMsg->size() > 5000)
{
printf("ignoring large orphan tx (size: %"PRIszu", hash: %s)\n", pvMsg->size(), hash.ToString().c_str());
delete pvMsg;
return false;
}
mapOrphanTransactions[hash] = pvMsg;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapOrphanTransactionsByPrev[txin.prevout.hash].insert(make_pair(hash, pvMsg));
printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(),
mapOrphanTransactions.size());
return true;
}
void static EraseOrphanTx(uint256 hash)
{
if (!mapOrphanTransactions.count(hash))
return;
const CDataStream* pvMsg = mapOrphanTransactions[hash];
CTransaction tx;
CDataStream(*pvMsg) >> tx;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
mapOrphanTransactionsByPrev[txin.prevout.hash].erase(hash);
if (mapOrphanTransactionsByPrev[txin.prevout.hash].empty())
mapOrphanTransactionsByPrev.erase(txin.prevout.hash);
}
delete pvMsg;
mapOrphanTransactions.erase(hash);
}
unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
{
unsigned int nEvicted = 0;
while (mapOrphanTransactions.size() > nMaxOrphans)
{
// Evict a random orphan:
uint256 randomhash = GetRandHash();
map<uint256, CDataStream*>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
if (it == mapOrphanTransactions.end())
it = mapOrphanTransactions.begin();
EraseOrphanTx(it->first);
++nEvicted;
}
return nEvicted;
}
//////////////////////////////////////////////////////////////////////////////
//
// CTransaction / CTxOut
//
bool CTxOut::IsDust() const
{
// "Dust" is defined in terms of CTransaction::nMinRelayTxFee,
// which has units satoshis-per-kilobyte.
// If you'd pay more than 1/3 in fees
// to spend something, then we consider it dust.
// A typical txout is 33 bytes big, and will
// need a CTxIn of at least 148 bytes to spend,
// so dust is a txout less than 54 uBTC
// (5430 satoshis) with default nMinRelayTxFee
return ((nValue*1000)/(3*((int)GetSerializeSize(SER_DISK,0)+148)) < CTransaction::nMinRelayTxFee);
}
bool CTransaction::IsStandard() const
{
if (nVersion > CTransaction::TXCOMMENT_VERSION)
return false;
if (!IsFinal())
return false;
// Disallow large transaction comments
if (strTxComment.length() > MAX_TX_COMMENT_LEN)
return false;
// Extremely large transactions with lots of inputs can cost the network
// almost as much to process as they cost the sender in fees, because
// computing signature hashes is O(ninputs*txsize). Limiting transactions
// to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks.
unsigned int sz = this->GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION);
if (sz >= MAX_STANDARD_TX_SIZE)
return false;
BOOST_FOREACH(const CTxIn& txin, vin)
{
// Biggest 'standard' txin is a 3-signature 3-of-3 CHECKMULTISIG
// pay-to-script-hash, which is 3 ~80-byte signatures, 3
// ~65-byte public keys, plus a few script ops.
if (txin.scriptSig.size() > 500)
return false;
if (!txin.scriptSig.IsPushOnly())
return false;
}
BOOST_FOREACH(const CTxOut& txout, vout) {
if (!::IsStandard(txout.scriptPubKey))
return false;
if (txout.IsDust())
return false;
}
return true;
}
//
// Check transaction inputs, and make sure any
// pay-to-script-hash transactions are evaluating IsStandard scripts
//
// Why bother? To avoid denial-of-service attacks; an attacker
// can submit a standard HASH... OP_EQUAL transaction,
// which will get accepted into blocks. The redemption
// script can be anything; an attacker could use a very
// expensive-to-check-upon-redemption script like:
// DUP CHECKSIG DROP ... repeated 100 times... OP_1
//
bool CTransaction::AreInputsStandard(CCoinsViewCache& mapInputs) const
{
if (IsCoinBase())
return true; // Coinbases don't use vin normally
for (unsigned int i = 0; i < vin.size(); i++)
{
const CTxOut& prev = GetOutputFor(vin[i], mapInputs);
vector<vector<unsigned char> > vSolutions;
txnouttype whichType;
// get the scriptPubKey corresponding to this input:
const CScript& prevScript = prev.scriptPubKey;
if (!Solver(prevScript, whichType, vSolutions))
return false;
int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions);
if (nArgsExpected < 0)
return false;
// Transactions with extra stuff in their scriptSigs are
// non-standard. Note that this EvalScript() call will
// be quick, because if there are any operations
// beside "push data" in the scriptSig the
// IsStandard() call returns false
vector<vector<unsigned char> > stack;
if (!EvalScript(stack, vin[i].scriptSig, *this, i, false, 0))
return false;
if (whichType == TX_SCRIPTHASH)
{
if (stack.empty())
return false;
CScript subscript(stack.back().begin(), stack.back().end());
vector<vector<unsigned char> > vSolutions2;
txnouttype whichType2;
if (!Solver(subscript, whichType2, vSolutions2))
return false;
if (whichType2 == TX_SCRIPTHASH)
return false;
int tmpExpected;
tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2);
if (tmpExpected < 0)
return false;
nArgsExpected += tmpExpected;
}
if (stack.size() != (unsigned int)nArgsExpected)
return false;
}
return true;
}
unsigned int CTransaction::GetLegacySigOpCount() const
{
unsigned int nSigOps = 0;
BOOST_FOREACH(const CTxIn& txin, vin)
{
nSigOps += txin.scriptSig.GetSigOpCount(false);
}
BOOST_FOREACH(const CTxOut& txout, vout)
{
nSigOps += txout.scriptPubKey.GetSigOpCount(false);
}
return nSigOps;
}
int CMerkleTx::SetMerkleBranch(const CBlock* pblock)
{
CBlock blockTmp;
if (pblock == NULL) {
CCoins coins;
if (pcoinsTip->GetCoins(GetHash(), coins)) {
CBlockIndex *pindex = FindBlockByHeight(coins.nHeight);
if (pindex) {
if (!blockTmp.ReadFromDisk(pindex))
return 0;
pblock = &blockTmp;
}
}
}
if (pblock) {
// Update the tx's hashBlock
hashBlock = pblock->GetHash();
// Locate the transaction
for (nIndex = 0; nIndex < (int)pblock->vtx.size(); nIndex++)
if (pblock->vtx[nIndex] == *(CTransaction*)this)
break;
if (nIndex == (int)pblock->vtx.size())
{
vMerkleBranch.clear();
nIndex = -1;
printf("ERROR: SetMerkleBranch() : couldn't find tx in block\n");
return 0;
}
// Fill in merkle branch
vMerkleBranch = pblock->GetMerkleBranch(nIndex);
}
// Is the tx in a block that's in the main chain
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi == mapBlockIndex.end())
return 0;
CBlockIndex* pindex = (*mi).second;
if (!pindex || !pindex->IsInMainChain())
return 0;
return pindexBest->nHeight - pindex->nHeight + 1;
}
bool CTransaction::CheckTransaction(CValidationState &state) const
{
// Basic checks that don't depend on any context
if (vin.empty())
return state.DoS(10, error("CTransaction::CheckTransaction() : vin empty"));
if (vout.empty())
return state.DoS(10, error("CTransaction::CheckTransaction() : vout empty"));
// Size limits
if (::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE)
return state.DoS(100, error("CTransaction::CheckTransaction() : size limits failed"));
// Check for negative or overflow output values
int64 nValueOut = 0;
BOOST_FOREACH(const CTxOut& txout, vout)
{
if (txout.nValue < 0)
return state.DoS(100, error("CTransaction::CheckTransaction() : txout.nValue negative"));
if (txout.nValue > MAX_MONEY)
return state.DoS(100, error("CTransaction::CheckTransaction() : txout.nValue too high"));
nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
return state.DoS(100, error("CTransaction::CheckTransaction() : txout total out of range"));
}
// Check for duplicate inputs
set<COutPoint> vInOutPoints;
BOOST_FOREACH(const CTxIn& txin, vin)
{
if (vInOutPoints.count(txin.prevout))
return state.DoS(100, error("CTransaction::CheckTransaction() : duplicate inputs"));
vInOutPoints.insert(txin.prevout);
}
if (IsCoinBase())
{
if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)
return state.DoS(100, error("CTransaction::CheckTransaction() : coinbase script size"));
}
else
{
BOOST_FOREACH(const CTxIn& txin, vin)
if (txin.prevout.IsNull())
return state.DoS(10, error("CTransaction::CheckTransaction() : prevout is null"));
}
return true;
}
int64 CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree,
enum GetMinFee_mode mode) const
{
// Base fee is either nMinTxFee or nMinRelayTxFee
int64 nBaseFee = (mode == GMF_RELAY) ? nMinRelayTxFee : nMinTxFee;
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
unsigned int nNewBlockSize = nBlockSize + nBytes;
int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee;
if (fAllowFree)
{
if (nBlockSize == 1)
{
// Transactions under 10K are free
// (about 4500 BTC if made of 50 BTC inputs)
if (nBytes < 10000)
nMinFee = 0;
}
else
{
// Free transaction area
if (nNewBlockSize < 27000)
nMinFee = 0;
}
}
// To limit dust spam, require base fee if any output is less than 0.01
if (nMinFee < nBaseFee)
{
BOOST_FOREACH(const CTxOut& txout, vout)
if (txout.nValue < CENT)
nMinFee = nBaseFee;
}
// Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
{
if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
return uint64(-1);
nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);
}
if (!MoneyRange(nMinFee))
nMinFee = uint64(-1);
return nMinFee;
}
void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins)
{
LOCK(cs);
std::map<COutPoint, CInPoint>::iterator it = mapNextTx.lower_bound(COutPoint(hashTx, 0));
// iterate over all COutPoints in mapNextTx whose hash equals the provided hashTx
while (it != mapNextTx.end() && it->first.hash == hashTx) {
coins.Spend(it->first.n); // and remove those outputs from coins
it++;
}
}
bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckInputs, bool fLimitFree,
bool* pfMissingInputs)
{
if (pfMissingInputs)
*pfMissingInputs = false;
if (!tx.CheckTransaction(state))
return error("CTxMemPool::accept() : CheckTransaction failed");
// Coinbase is only valid in a block, not as a loose transaction
if (tx.IsCoinBase())
return state.DoS(100, error("CTxMemPool::accept() : coinbase as individual tx"));
// To help v0.1.5 clients who would see it as a negative number
if ((int64)tx.nLockTime > std::numeric_limits<int>::max())
return error("CTxMemPool::accept() : not accepting nLockTime beyond 2038 yet");
// Rather not work on nonstandard transactions (unless -testnet)
if (!fTestNet && !tx.IsStandard())
return error("CTxMemPool::accept() : nonstandard transaction type");
// is it already in the memory pool?
uint256 hash = tx.GetHash();
{
LOCK(cs);
if (mapTx.count(hash))
return false;
}
// Check for conflicts with in-memory transactions
CTransaction* ptxOld = NULL;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
if (mapNextTx.count(outpoint))
{
// Disable replacement feature for now
return false;
// Allow replacing with a newer version of the same transaction
if (i != 0)
return false;
ptxOld = mapNextTx[outpoint].ptx;
if (ptxOld->IsFinal())
return false;
if (!tx.IsNewerThan(*ptxOld))
return false;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
if (!mapNextTx.count(outpoint) || mapNextTx[outpoint].ptx != ptxOld)
return false;
}
break;
}
}
if (fCheckInputs)
{
CCoinsView dummy;
CCoinsViewCache view(dummy);
{
LOCK(cs);
CCoinsViewMemPool viewMemPool(*pcoinsTip, *this);
view.SetBackend(viewMemPool);
// do we already have it?
if (view.HaveCoins(hash))
return false;
// do all inputs exist?
// Note that this does not check for the presence of actual outputs (see the next check for that),
// only helps filling in pfMissingInputs (to determine missing vs spent).
BOOST_FOREACH(const CTxIn txin, tx.vin) {
if (!view.HaveCoins(txin.prevout.hash)) {
if (pfMissingInputs)
*pfMissingInputs = true;
return false;
}
}
// are the actual inputs available?
if (!tx.HaveInputs(view))
return state.Invalid(error("CTxMemPool::accept() : inputs already spent"));
// Bring the best block into scope
view.GetBestBlock();
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
view.SetBackend(dummy);
}
// Check for non-standard pay-to-script-hash in inputs
if (!tx.AreInputsStandard(view) && !fTestNet)
return error("CTxMemPool::accept() : nonstandard transaction input");
// Note: if you modify this code to accept non-standard transactions, then
// you should add code here to check that the transaction does a
// reasonable number of ECDSA signature verifications.
int64 nFees = tx.GetValueIn(view)-tx.GetValueOut();
unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
// Don't accept it if it can't get into a block
int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY);
if (fLimitFree && nFees < txMinFee)
return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d,
hash.ToString().c_str(),
nFees, txMinFee);
// Continuously rate-limit free transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make others' transactions take longer to confirm.
if (fLimitFree && nFees < CTransaction::nMinRelayTxFee)
{
static double dFreeCount;
static int64 nLastTime;
int64 nNow = GetTime();
LOCK(cs);
// Use an exponentially decaying ~10-minute window:
dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
nLastTime = nNow;
// -limitfreerelay unit is thousand-bytes-per-minute
// At default rate it would take over a month to fill 1GB
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
return error("CTxMemPool::accept() : free transaction rejected by rate limiter");
if (fDebug)
printf("Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;
}
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC))
{
return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().c_str());
}
}
// Store transaction in memory
{
LOCK(cs);
if (ptxOld)
{
printf("CTxMemPool::accept() : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
remove(*ptxOld);
}
addUnchecked(hash, tx);
}
///// are we sure this is ok when loading transactions or restoring block txes
// If updated, erase old tx from wallet
if (ptxOld)
EraseFromWallets(ptxOld->GetHash());
SyncWithWallets(hash, tx, NULL, true);
printf("CTxMemPool::accept() : accepted %s (poolsz %"PRIszu")\n",
hash.ToString().c_str(),
mapTx.size());
return true;
}
bool CTransaction::AcceptToMemoryPool(CValidationState &state, bool fCheckInputs, bool fLimitFree, bool* pfMissingInputs)
{
try {
return mempool.accept(state, *this, fCheckInputs, fLimitFree, pfMissingInputs);
} catch(std::runtime_error &e) {
return state.Abort(_("System error: ") + e.what());
}
}
bool CTxMemPool::addUnchecked(const uint256& hash, CTransaction &tx)
{
// Add to memory pool without checking anything. Don't call this directly,
// call CTxMemPool::accept to properly check the transaction first.
{
mapTx[hash] = tx;
for (unsigned int i = 0; i < tx.vin.size(); i++)
mapNextTx[tx.vin[i].prevout] = CInPoint(&mapTx[hash], i);
nTransactionsUpdated++;
}
return true;
}
bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive)
{
// Remove transaction from memory pool
{
LOCK(cs);
uint256 hash = tx.GetHash();
if (mapTx.count(hash))
{
if (fRecursive) {
for (unsigned int i = 0; i < tx.vout.size(); i++) {
std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i));
if (it != mapNextTx.end())
remove(*it->second.ptx, true);
}
}
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapNextTx.erase(txin.prevout);
mapTx.erase(hash);
nTransactionsUpdated++;
}
}
return true;
}
bool CTxMemPool::removeConflicts(const CTransaction &tx)
{
// Remove transactions which depend on inputs of tx, recursively
LOCK(cs);
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(txin.prevout);
if (it != mapNextTx.end()) {
const CTransaction &txConflict = *it->second.ptx;
if (txConflict != tx)
remove(txConflict, true);
}
}
return true;
}
void CTxMemPool::clear()
{
LOCK(cs);
mapTx.clear();
mapNextTx.clear();
++nTransactionsUpdated;
}
void CTxMemPool::queryHashes(std::vector<uint256>& vtxid)
{
vtxid.clear();
LOCK(cs);
vtxid.reserve(mapTx.size());
for (map<uint256, CTransaction>::iterator mi = mapTx.begin(); mi != mapTx.end(); ++mi)
vtxid.push_back((*mi).first);
}
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
{
if (hashBlock == 0 || nIndex == -1)
return 0;
// Find the block it claims to be in
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi == mapBlockIndex.end())
return 0;
CBlockIndex* pindex = (*mi).second;
if (!pindex || !pindex->IsInMainChain())
return 0;
// Make sure the merkle branch connects to this block
if (!fMerkleVerified)
{
if (CBlock::CheckMerkleBranch(GetHash(), vMerkleBranch, nIndex) != pindex->hashMerkleRoot)
return 0;
fMerkleVerified = true;
}
pindexRet = pindex;
return pindexBest->nHeight - pindex->nHeight + 1;
}
int CMerkleTx::GetBlocksToMaturity() const
{
if (!IsCoinBase())
return 0;
return max(0, (COINBASE_MATURITY+20) - GetDepthInMainChain());
}
bool CMerkleTx::AcceptToMemoryPool(bool fCheckInputs, bool fLimitFree)
{
CValidationState state;
return CTransaction::AcceptToMemoryPool(state, fCheckInputs, fLimitFree);
}
bool CWalletTx::AcceptWalletTransaction(bool fCheckInputs)
{
{
LOCK(mempool.cs);
// Add previous supporting transactions first
BOOST_FOREACH(CMerkleTx& tx, vtxPrev)
{
if (!tx.IsCoinBase())
{
uint256 hash = tx.GetHash();
if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash))
tx.AcceptToMemoryPool(fCheckInputs, false);
}
}
return AcceptToMemoryPool(fCheckInputs, false);
}
return false;
}
// Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock
bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow)
{
CBlockIndex *pindexSlow = NULL;
{
LOCK(cs_main);
{
LOCK(mempool.cs);
if (mempool.exists(hash))
{
txOut = mempool.lookup(hash);
return true;
}
}
if (fTxIndex) {
CDiskTxPos postx;
if (pblocktree->ReadTxIndex(hash, postx)) {
CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION);
CBlockHeader header;
try {
file >> header;
fseek(file, postx.nTxOffset, SEEK_CUR);
file >> txOut;
} catch (std::exception &e) {
return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
}
hashBlock = header.GetHash();
if (txOut.GetHash() != hash)
return error("%s() : txid mismatch", __PRETTY_FUNCTION__);
return true;
}
}
if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it
int nHeight = -1;
{
CCoinsViewCache &view = *pcoinsTip;
CCoins coins;
if (view.GetCoins(hash, coins))
nHeight = coins.nHeight;
}
if (nHeight > 0)
pindexSlow = FindBlockByHeight(nHeight);
}
}
if (pindexSlow) {
CBlock block;
if (block.ReadFromDisk(pindexSlow)) {
BOOST_FOREACH(const CTransaction &tx, block.vtx) {
if (tx.GetHash() == hash) {
txOut = tx;
hashBlock = pindexSlow->GetBlockHash();
return true;
}
}
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////////
//
// CBlock and CBlockIndex
//
static CBlockIndex* pblockindexFBBHLast;
CBlockIndex* FindBlockByHeight(int nHeight)
{
CBlockIndex *pblockindex;
if (nHeight < nBestHeight / 2)
pblockindex = pindexGenesisBlock;
else
pblockindex = pindexBest;
if (pblockindexFBBHLast && abs(nHeight - pblockindex->nHeight) > abs(nHeight - pblockindexFBBHLast->nHeight))
pblockindex = pblockindexFBBHLast;
while (pblockindex->nHeight > nHeight)
pblockindex = pblockindex->pprev;
while (pblockindex->nHeight < nHeight)
pblockindex = pblockindex->pnext;
pblockindexFBBHLast = pblockindex;
return pblockindex;
}
bool CBlock::ReadFromDisk(const CBlockIndex* pindex)
{
if (!ReadFromDisk(pindex->GetBlockPos()))
return false;
if (GetHash() != pindex->GetBlockHash())
return error("CBlock::ReadFromDisk() : GetHash() doesn't match index");
return true;
}
uint256 static GetOrphanRoot(const CBlockHeader* pblock)
{
// Work back to the first block in the orphan chain
while (mapOrphanBlocks.count(pblock->hashPrevBlock))
pblock = mapOrphanBlocks[pblock->hashPrevBlock];
return pblock->GetHash();
}
#define BLOCKS_MINING_VIA_MINUTE 4
static const int64 nGenesisBlockRewardCoin = 5000000 * COIN;
static const int64 nBlockRewardStartCoin = 5000000 * COIN;
static const int64 nBlockRewardMinimumCoin = 50000 * COIN;
static const int64 nTargetTimespan = 60*60*3; // 60*60 //60 minutes
static const int64 nTargetSpacing = 60; // 60 //60 seconds
static const int64 nInterval = nTargetTimespan / nTargetSpacing; // 20 blocks
static const int64 blocksMiningViaMinute=60/nTargetSpacing;
int64 static GetBlockValue(int nHeight, int64 nFees, unsigned int nBits)
{
if (nHeight == 0)
{
return nGenesisBlockRewardCoin;
}
int64 nSubsidy = nBlockRewardStartCoin;
// Subsidy is cut in half every 80640 blocks (14 days)
nSubsidy >>= (nHeight / 10080);
// Minimum subsidy
if (nSubsidy < nBlockRewardMinimumCoin)
{
nSubsidy = nBlockRewardMinimumCoin;
}
return nSubsidy + nFees;
}
//
// minimum amount of work that could possibly be required nTime after
// minimum work required was nBase
//
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
{
// Testnet has min-difficulty blocks
// after nTargetSpacing*2 time between blocks:
if (fTestNet && nTime > nTargetSpacing*2)
return bnProofOfWorkLimit.GetCompact();
CBigNum bnResult;
bnResult.SetCompact(nBase);
while (nTime > 0 && bnResult < bnProofOfWorkLimit)
{
// Maximum 400% adjustment...
bnResult *= 4;
// ... in best-case exactly 4-times-normal target time
nTime -= nTargetTimespan*4;
}
if (bnResult > bnProofOfWorkLimit)
bnResult = bnProofOfWorkLimit;
return bnResult.GetCompact();
}
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
{
unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
/*int64 lastHeight = pindexLast->nHeight+1;
if(lastHeight>=nInterval)
{
int64 * _nTargetTimespan = (int64 *)&nTargetTimespan;
int64 * _nInterval = (int64 *)&nInterval;
*_nTargetTimespan = 60*9.5;
*_nInterval = *_nTargetTimespan / nTargetSpacing;
}*/
// Genesis block
if (pindexLast == NULL)
return nProofOfWorkLimit;
// Only change once per interval
if ((pindexLast->nHeight+1) % nInterval != 0)
{
// Special difficulty rule for testnet:
if (fTestNet)
{
// If the new block's timestamp is more than 2 * nTargetSpacing
// then allow mining of a min-difficulty block.
if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
return nProofOfWorkLimit;
else
{
// Return the last non-special-min-difficulty-rules-block
const CBlockIndex* pindex = pindexLast;
while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
pindex = pindex->pprev;
return pindex->nBits;
}
}
return pindexLast->nBits;
}
// Go back by what we want to be nInterval blocks
const CBlockIndex* pindexFirst = pindexLast;
for (int i = 0; pindexFirst && i < nInterval-1; i++)
pindexFirst = pindexFirst->pprev;
assert(pindexFirst);
// Limit adjustment step
int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan);
// int64 LimUp = nTargetTimespan * 100 / 110; // 110% up
// int64 LimDown = nTargetTimespan * 2; // 200% down
if (nActualTimespan < nTargetTimespan/4)
nActualTimespan = nTargetTimespan/4;
if (nActualTimespan > nTargetTimespan*4)
nActualTimespan = nTargetTimespan*4;
// Retarget
CBigNum bnNew;
bnNew.SetCompact(pindexLast->nBits);
bnNew *= nActualTimespan;
bnNew /= nTargetTimespan;
if (bnNew > bnProofOfWorkLimit)
bnNew = bnProofOfWorkLimit;
/// debug print
printf("GetNextWorkRequired RETARGET\n");
printf("nTargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan);
printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
return bnNew.GetCompact();
}
bool CheckProofOfWork(uint256 hash, unsigned int nBits)
{
CBigNum bnTarget;
bnTarget.SetCompact(nBits);
// Check range
if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit)
return error("CheckProofOfWork() : nBits below minimum work");
// Check proof of work matches claimed amount
if (hash > bnTarget.getuint256())
return error("CheckProofOfWork() : hash doesn't match nBits");
return true;
}
// Return maximum amount of blocks that other nodes claim to have
int GetNumBlocksOfPeers()
{
return std::max(cPeerBlockCounts.median(), Checkpoints::GetTotalBlocksEstimate());
}
bool IsInitialBlockDownload()
{
if (pindexBest == NULL || fImporting || fReindex || nBestHeight < Checkpoints::GetTotalBlocksEstimate())
return true;
static int64 nLastUpdate;
static CBlockIndex* pindexLastBest;
if (pindexBest != pindexLastBest)
{
pindexLastBest = pindexBest;
nLastUpdate = GetTime();
}
return (GetTime() - nLastUpdate < 10 &&
pindexBest->GetBlockTime() < GetTime() - 24 * 60 * 60);
}
void static InvalidChainFound(CBlockIndex* pindexNew)
{
if (pindexNew->nChainWork > nBestInvalidWork)
{
nBestInvalidWork = pindexNew->nChainWork;
pblocktree->WriteBestInvalidWork(CBigNum(nBestInvalidWork));
uiInterface.NotifyBlocksChanged();
}
printf("InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s\n",
pindexNew->GetBlockHash().ToString().c_str(), pindexNew->nHeight,
log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S",
pindexNew->GetBlockTime()).c_str());
printf("InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s\n",
hashBestChain.ToString().c_str(), nBestHeight, log(nBestChainWork.getdouble())/log(2.0),
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str());
if (pindexBest && nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256())
printf("InvalidChainFound: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n");
}
void static InvalidBlockFound(CBlockIndex *pindex) {
pindex->nStatus |= BLOCK_FAILED_VALID;
pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex));
setBlockIndexValid.erase(pindex);
InvalidChainFound(pindex);
if (pindex->pnext) {
CValidationState stateDummy;
ConnectBestBlock(stateDummy); // reorganise away from the failed block
}
}
bool ConnectBestBlock(CValidationState &state) {
do {
CBlockIndex *pindexNewBest;
{
std::set<CBlockIndex*,CBlockIndexWorkComparator>::reverse_iterator it = setBlockIndexValid.rbegin();
if (it == setBlockIndexValid.rend())
return true;
pindexNewBest = *it;
}
if (pindexNewBest == pindexBest || (pindexBest && pindexNewBest->nChainWork == pindexBest->nChainWork))
return true; // nothing to do
// check ancestry
CBlockIndex *pindexTest = pindexNewBest;
std::vector<CBlockIndex*> vAttach;
do {
if (pindexTest->nStatus & BLOCK_FAILED_MASK) {
// mark descendants failed
CBlockIndex *pindexFailed = pindexNewBest;
while (pindexTest != pindexFailed) {
pindexFailed->nStatus |= BLOCK_FAILED_CHILD;
setBlockIndexValid.erase(pindexFailed);
pblocktree->WriteBlockIndex(CDiskBlockIndex(pindexFailed));
pindexFailed = pindexFailed->pprev;
}
InvalidChainFound(pindexNewBest);
break;
}
if (pindexBest == NULL || pindexTest->nChainWork > pindexBest->nChainWork)
vAttach.push_back(pindexTest);
if (pindexTest->pprev == NULL || pindexTest->pnext != NULL) {
reverse(vAttach.begin(), vAttach.end());
BOOST_FOREACH(CBlockIndex *pindexSwitch, vAttach) {
boost::this_thread::interruption_point();
try {
if (!SetBestChain(state, pindexSwitch))
return false;
} catch(std::runtime_error &e) {
return state.Abort(_("System error: ") + e.what());
}
}
return true;
}
pindexTest = pindexTest->pprev;
} while(true);
} while(true);
}
void CBlockHeader::UpdateTime(const CBlockIndex* pindexPrev)
{
nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
// Updating time can change work required on testnet:
if (fTestNet)
nBits = GetNextWorkRequired(pindexPrev, this);
}
const CTxOut &CTransaction::GetOutputFor(const CTxIn& input, CCoinsViewCache& view)
{
const CCoins &coins = view.GetCoins(input.prevout.hash);
assert(coins.IsAvailable(input.prevout.n));
return coins.vout[input.prevout.n];
}
int64 CTransaction::GetValueIn(CCoinsViewCache& inputs) const
{
if (IsCoinBase())
return 0;
int64 nResult = 0;
for (unsigned int i = 0; i < vin.size(); i++)
nResult += GetOutputFor(vin[i], inputs).nValue;
return nResult;
}
unsigned int CTransaction::GetP2SHSigOpCount(CCoinsViewCache& inputs) const
{
if (IsCoinBase())
return 0;
unsigned int nSigOps = 0;
for (unsigned int i = 0; i < vin.size(); i++)
{
const CTxOut &prevout = GetOutputFor(vin[i], inputs);
if (prevout.scriptPubKey.IsPayToScriptHash())
nSigOps += prevout.scriptPubKey.GetSigOpCount(vin[i].scriptSig);
}
return nSigOps;
}
void CTransaction::UpdateCoins(CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash) const
{
// mark inputs spent
if (!IsCoinBase()) {
BOOST_FOREACH(const CTxIn &txin, vin) {
CCoins &coins = inputs.GetCoins(txin.prevout.hash);
CTxInUndo undo;
assert(coins.Spend(txin.prevout, undo));
txundo.vprevout.push_back(undo);
}
}
// add outputs
assert(inputs.SetCoins(txhash, CCoins(*this, nHeight)));
}
bool CTransaction::HaveInputs(CCoinsViewCache &inputs) const
{
if (!IsCoinBase()) {
// first check whether information about the prevout hash is available
for (unsigned int i = 0; i < vin.size(); i++) {
const COutPoint &prevout = vin[i].prevout;
if (!inputs.HaveCoins(prevout.hash))
return false;
}
// then check whether the actual outputs are available
for (unsigned int i = 0; i < vin.size(); i++) {
const COutPoint &prevout = vin[i].prevout;
const CCoins &coins = inputs.GetCoins(prevout.hash);
if (!coins.IsAvailable(prevout.n))
return false;
}
}
return true;
}
bool CScriptCheck::operator()() const {
const CScript &scriptSig = ptxTo->vin[nIn].scriptSig;
if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags, nHashType))
return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString().c_str());
return true;
}
bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType)
{
return CScriptCheck(txFrom, txTo, nIn, flags, nHashType)();
}
bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, std::vector<CScriptCheck> *pvChecks) const
{
if (!IsCoinBase())
{
if (pvChecks)
pvChecks->reserve(vin.size());
// This doesn't trigger the DoS code on purpose; if it did, it would make it easier
// for an attacker to attempt to split the network.
if (!HaveInputs(inputs))
return state.Invalid(error("CheckInputs() : %s inputs unavailable", GetHash().ToString().c_str()));
// While checking, GetBestBlock() refers to the parent block.
// This is also true for mempool checks.
int nSpendHeight = inputs.GetBestBlock()->nHeight + 1;
int64 nValueIn = 0;
int64 nFees = 0;
for (unsigned int i = 0; i < vin.size(); i++)
{
const COutPoint &prevout = vin[i].prevout;
const CCoins &coins = inputs.GetCoins(prevout.hash);
// If prev is coinbase, check that it's matured
if (coins.IsCoinBase()) {
if (nSpendHeight - coins.nHeight < COINBASE_MATURITY)
return state.Invalid(error("CheckInputs() : tried to spend coinbase at depth %d", nSpendHeight - coins.nHeight));
}
// Check for negative or overflow input values
nValueIn += coins.vout[prevout.n].nValue;
if (!MoneyRange(coins.vout[prevout.n].nValue) || !MoneyRange(nValueIn))
return state.DoS(100, error("CheckInputs() : txin values out of range"));
}
if (nValueIn < GetValueOut())
return state.DoS(100, error("CheckInputs() : %s value in < value out", GetHash().ToString().c_str()));
// Tally transaction fees
int64 nTxFee = nValueIn - GetValueOut();
if (nTxFee < 0)
return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", GetHash().ToString().c_str()));
nFees += nTxFee;
if (!MoneyRange(nFees))
return state.DoS(100, error("CheckInputs() : nFees out of range"));
// The first loop above does all the inexpensive checks.
// Only if ALL inputs pass do we perform expensive ECDSA signature checks.
// Helps prevent CPU exhaustion attacks.
// Skip ECDSA signature verification when connecting blocks
// before the last block chain checkpoint. This is safe because block merkle hashes are
// still computed and checked, and any change will be caught at the next checkpoint.
if (fScriptChecks) {
for (unsigned int i = 0; i < vin.size(); i++) {
const COutPoint &prevout = vin[i].prevout;
const CCoins &coins = inputs.GetCoins(prevout.hash);
// Verify signature
CScriptCheck check(coins, *this, i, flags, 0);
if (pvChecks) {
pvChecks->push_back(CScriptCheck());
check.swap(pvChecks->back());
} else if (!check()) {
if (flags & SCRIPT_VERIFY_STRICTENC) {
// For now, check whether the failure was caused by non-canonical
// encodings or not; if so, don't trigger DoS protection.
CScriptCheck check(coins, *this, i, flags & (~SCRIPT_VERIFY_STRICTENC), 0);
if (check())
return state.Invalid();
}
return state.DoS(100,false);
}
}
}
}
return true;
}
bool CBlock::DisconnectBlock(CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool *pfClean)
{
assert(pindex == view.GetBestBlock());
if (pfClean)
*pfClean = false;
bool fClean = true;
CBlockUndo blockUndo;
CDiskBlockPos pos = pindex->GetUndoPos();
if (pos.IsNull())
return error("DisconnectBlock() : no undo data available");
if (!blockUndo.ReadFromDisk(pos, pindex->pprev->GetBlockHash()))
return error("DisconnectBlock() : failure reading undo data");
if (blockUndo.vtxundo.size() + 1 != vtx.size())
return error("DisconnectBlock() : block and undo data inconsistent");
// undo transactions in reverse order
for (int i = vtx.size() - 1; i >= 0; i--) {
const CTransaction &tx = vtx[i];
uint256 hash = tx.GetHash();
// check that all outputs are available
if (!view.HaveCoins(hash)) {
fClean = fClean && error("DisconnectBlock() : outputs still spent? database corrupted");
view.SetCoins(hash, CCoins());
}
CCoins &outs = view.GetCoins(hash);
CCoins outsBlock = CCoins(tx, pindex->nHeight);
if (outs != outsBlock)
fClean = fClean && error("DisconnectBlock() : added transaction mismatch? database corrupted");
// remove outputs
outs = CCoins();
// restore inputs
if (i > 0) { // not coinbases
const CTxUndo &txundo = blockUndo.vtxundo[i-1];
if (txundo.vprevout.size() != tx.vin.size())
return error("DisconnectBlock() : transaction and undo data inconsistent");
for (unsigned int j = tx.vin.size(); j-- > 0;) {
const COutPoint &out = tx.vin[j].prevout;
const CTxInUndo &undo = txundo.vprevout[j];
CCoins coins;
view.GetCoins(out.hash, coins); // this can fail if the prevout was already entirely spent
if (undo.nHeight != 0) {
// undo data contains height: this is the last output of the prevout tx being spent
if (!coins.IsPruned())
fClean = fClean && error("DisconnectBlock() : undo data overwriting existing transaction");
coins = CCoins();
coins.fCoinBase = undo.fCoinBase;
coins.nHeight = undo.nHeight;
coins.nVersion = undo.nVersion;
} else {
if (coins.IsPruned())
fClean = fClean && error("DisconnectBlock() : undo data adding output to missing transaction");
}
if (coins.IsAvailable(out.n))
fClean = fClean && error("DisconnectBlock() : undo data overwriting existing output");
if (coins.vout.size() < out.n+1)
coins.vout.resize(out.n+1);
coins.vout[out.n] = undo.txout;
if (!view.SetCoins(out.hash, coins))
return error("DisconnectBlock() : cannot restore coin inputs");
}
}
}
// move best block pointer to prevout block
view.SetBestBlock(pindex->pprev);
if (pfClean) {
*pfClean = fClean;
return true;
} else {
return fClean;
}
}
void static FlushBlockFile(bool fFinalize = false)
{
LOCK(cs_LastBlockFile);
CDiskBlockPos posOld(nLastBlockFile, 0);
FILE *fileOld = OpenBlockFile(posOld);
if (fileOld) {
if (fFinalize)
TruncateFile(fileOld, infoLastBlockFile.nSize);
FileCommit(fileOld);
fclose(fileOld);
}
fileOld = OpenUndoFile(posOld);
if (fileOld) {
if (fFinalize)
TruncateFile(fileOld, infoLastBlockFile.nUndoSize);
FileCommit(fileOld);
fclose(fileOld);
}
}
bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
static CCheckQueue<CScriptCheck> scriptcheckqueue(128);
void ThreadScriptCheck() {
RenameThread("bitcoin-scriptch");
scriptcheckqueue.Thread();
}
bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsViewCache &view, bool fJustCheck)
{
// Check it again in case a previous version let a bad block in
if (!CheckBlock(state, !fJustCheck, !fJustCheck))
return false;
// verify that the view's current state corresponds to the previous block
assert(pindex->pprev == view.GetBestBlock());
// Special case for the genesis block, skipping connection of its transactions
// (its coinbase is unspendable)
if (GetHash() == hashGenesisBlock) {
view.SetBestBlock(pindex);
pindexGenesisBlock = pindex;
return true;
}
bool fScriptChecks = pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate();
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
// unless those are already completely spent.
// If such overwrites are allowed, coinbases and transactions depending upon those
// can be duplicated to remove the ability to spend the first instance -- even after
// being sent to another address.
// See BIP30 and http://r6.ca/blog/20120206T005236Z.html for more information.
// This logic is not necessary for memory pool transactions, as AcceptToMemoryPool
// already refuses previously-known transaction ids entirely.
// This rule was originally applied all blocks whose timestamp was after March 15, 2012, 0:00 UTC.
// Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the
// two in the chain that violate it. This prevents exploiting the issue against nodes in their
// initial block download.
bool fEnforceBIP30 = !pindex->phashBlock;
// bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash.
// !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
// (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
if (fEnforceBIP30) {
for (unsigned int i=0; i<vtx.size(); i++) {
uint256 hash = GetTxHash(i);
if (view.HaveCoins(hash) && !view.GetCoins(hash).IsPruned())
return state.DoS(100, error("ConnectBlock() : tried to overwrite transaction"));
}
}
// BIP16 didn't become active until Apr 1 2012
int64 nBIP16SwitchTime = 1333238400;
bool fStrictPayToScriptHash = (pindex->nTime >= nBIP16SwitchTime);
unsigned int flags = SCRIPT_VERIFY_NOCACHE |
(fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE);
CBlockUndo blockundo;
CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL);
int64 nStart = GetTimeMicros();
int64 nFees = 0;
int nInputs = 0;
unsigned int nSigOps = 0;
CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(vtx.size()));
std::vector<std::pair<uint256, CDiskTxPos> > vPos;
vPos.reserve(vtx.size());
for (unsigned int i=0; i<vtx.size(); i++)
{
const CTransaction &tx = vtx[i];
nInputs += tx.vin.size();
nSigOps += tx.GetLegacySigOpCount();
if (nSigOps > MAX_BLOCK_SIGOPS)
return state.DoS(100, error("ConnectBlock() : too many sigops"));
if (!tx.IsCoinBase())
{
if (!tx.HaveInputs(view))
return state.DoS(100, error("ConnectBlock() : inputs missing/spent"));
if (fStrictPayToScriptHash)
{
// Add in sigops done by pay-to-script-hash inputs;
// this is to prevent a "rogue miner" from creating
// an incredibly-expensive-to-validate block.
nSigOps += tx.GetP2SHSigOpCount(view);
if (nSigOps > MAX_BLOCK_SIGOPS)
return state.DoS(100, error("ConnectBlock() : too many sigops"));
}
nFees += tx.GetValueIn(view)-tx.GetValueOut();
std::vector<CScriptCheck> vChecks;
if (!tx.CheckInputs(state, view, fScriptChecks, flags, nScriptCheckThreads ? &vChecks : NULL))
return false;
control.Add(vChecks);
}
CTxUndo txundo;
tx.UpdateCoins(state, view, txundo, pindex->nHeight, GetTxHash(i));
if (!tx.IsCoinBase())
blockundo.vtxundo.push_back(txundo);
vPos.push_back(std::make_pair(GetTxHash(i), pos));
pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION);
}
int64 nTime = GetTimeMicros() - nStart;
if (fBenchmark)
printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1));
if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees, pindex->nBits))
return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees, pindex->nBits)));
if (!control.Wait())
return state.DoS(100, false);
int64 nTime2 = GetTimeMicros() - nStart;
if (fBenchmark)
printf("- Verify %u txins: %.2fms (%.3fms/txin)\n", nInputs - 1, 0.001 * nTime2, nInputs <= 1 ? 0 : 0.001 * nTime2 / (nInputs-1));
if (fJustCheck)
return true;
// Write undo information to disk
if (pindex->GetUndoPos().IsNull() || (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS)
{
if (pindex->GetUndoPos().IsNull()) {
CDiskBlockPos pos;
if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40))
return error("ConnectBlock() : FindUndoPos failed");
if (!blockundo.WriteToDisk(pos, pindex->pprev->GetBlockHash()))
return state.Abort(_("Failed to write undo data"));
// update nUndoPos in block index
pindex->nUndoPos = pos.nPos;
pindex->nStatus |= BLOCK_HAVE_UNDO;
}
pindex->nStatus = (pindex->nStatus & ~BLOCK_VALID_MASK) | BLOCK_VALID_SCRIPTS;
CDiskBlockIndex blockindex(pindex);
if (!pblocktree->WriteBlockIndex(blockindex))
return state.Abort(_("Failed to write block index"));
}
if (fTxIndex)
if (!pblocktree->WriteTxIndex(vPos))
return state.Abort(_("Failed to write transaction index"));
// add this block to the view's block chain
assert(view.SetBestBlock(pindex));
// Watch for transactions paying to me
for (unsigned int i=0; i<vtx.size(); i++)
SyncWithWallets(GetTxHash(i), vtx[i], this, true);
return true;
}
bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
{
// All modifications to the coin state will be done in this cache.
// Only when all have succeeded, we push it to pcoinsTip.
CCoinsViewCache view(*pcoinsTip, true);
// Find the fork (typically, there is none)
CBlockIndex* pfork = view.GetBestBlock();
CBlockIndex* plonger = pindexNew;
while (pfork && pfork != plonger)
{
while (plonger->nHeight > pfork->nHeight) {
plonger = plonger->pprev;
assert(plonger != NULL);
}
if (pfork == plonger)
break;
pfork = pfork->pprev;
assert(pfork != NULL);
}
// List of what to disconnect (typically nothing)
vector<CBlockIndex*> vDisconnect;
for (CBlockIndex* pindex = view.GetBestBlock(); pindex != pfork; pindex = pindex->pprev)
vDisconnect.push_back(pindex);
// List of what to connect (typically only pindexNew)
vector<CBlockIndex*> vConnect;
for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev)
vConnect.push_back(pindex);
reverse(vConnect.begin(), vConnect.end());
if (vDisconnect.size() > 0) {
printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str());
printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str());
}
// Disconnect shorter branch
vector<CTransaction> vResurrect;
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) {
CBlock block;
if (!block.ReadFromDisk(pindex))
return state.Abort(_("Failed to read block"));
int64 nStart = GetTimeMicros();
if (!block.DisconnectBlock(state, pindex, view))
return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str());
if (fBenchmark)
printf("- Disconnect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001);
// Queue memory transactions to resurrect.
// We only do this for blocks after the last checkpoint (reorganisation before that
// point should only happen with -reindex/-loadblock, or a misbehaving peer.
BOOST_FOREACH(const CTransaction& tx, block.vtx)
if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate())
vResurrect.push_back(tx);
}
// Connect longer branch
vector<CTransaction> vDelete;
BOOST_FOREACH(CBlockIndex *pindex, vConnect) {
CBlock block;
if (!block.ReadFromDisk(pindex))
return state.Abort(_("Failed to read block"));
int64 nStart = GetTimeMicros();
if (!block.ConnectBlock(state, pindex, view)) {
if (state.IsInvalid()) {
InvalidChainFound(pindexNew);
InvalidBlockFound(pindex);
}
return error("SetBestBlock() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().c_str());
}
if (fBenchmark)
printf("- Connect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001);
// Queue memory transactions to delete
BOOST_FOREACH(const CTransaction& tx, block.vtx)
vDelete.push_back(tx);
}
// Flush changes to global coin state
int64 nStart = GetTimeMicros();
int nModified = view.GetCacheSize();
assert(view.Flush());
int64 nTime = GetTimeMicros() - nStart;
if (fBenchmark)
printf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified);
// Make sure it's successfully written to disk before changing memory structure
bool fIsInitialDownload = IsInitialBlockDownload();
if (!fIsInitialDownload || pcoinsTip->GetCacheSize() > nCoinCacheSize) {
// Typical CCoins structures on disk are around 100 bytes in size.
// Pushing a new one to the database can cause it to be written
// twice (once in the log, and once in the tables). This is already
// an overestimation, as most will delete an existing entry or
// overwrite one. Still, use a conservative safety factor of 2.
if (!CheckDiskSpace(100 * 2 * 2 * pcoinsTip->GetCacheSize()))
return state.Error();
FlushBlockFile();
pblocktree->Sync();
if (!pcoinsTip->Flush())
return state.Abort(_("Failed to write to coin database"));
}
// At this point, all changes have been done to the database.
// Proceed by updating the memory structures.
// Disconnect shorter branch
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
if (pindex->pprev)
pindex->pprev->pnext = NULL;
// Connect longer branch
BOOST_FOREACH(CBlockIndex* pindex, vConnect)
if (pindex->pprev)
pindex->pprev->pnext = pindex;
// Resurrect memory transactions that were in the disconnected branch
BOOST_FOREACH(CTransaction& tx, vResurrect) {
// ignore validation errors in resurrected transactions
CValidationState stateDummy;
tx.AcceptToMemoryPool(stateDummy, true, false);
}
// Delete redundant memory transactions that are in the connected branch
BOOST_FOREACH(CTransaction& tx, vDelete) {
mempool.remove(tx);
mempool.removeConflicts(tx);
}
// Update best block in wallet (so we can detect restored wallets)
if ((pindexNew->nHeight % 9600) == 0 || (!fIsInitialDownload && (pindexNew->nHeight % 240) == 0))
{
const CBlockLocator locator(pindexNew);
::SetBestChain(locator);
}
// New best block
hashBestChain = pindexNew->GetBlockHash();
pindexBest = pindexNew;
pblockindexFBBHLast = NULL;
nBestHeight = pindexBest->nHeight;
nBestChainWork = pindexNew->nChainWork;
nTimeBestReceived = GetTime();
nTransactionsUpdated++;
printf("SetBestChain: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f\n",
hashBestChain.ToString().c_str(), nBestHeight, log(nBestChainWork.getdouble())/log(2.0), (unsigned long)pindexNew->nChainTx,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str(),
Checkpoints::GuessVerificationProgress(pindexBest));
// Check the version of the last 100 blocks to see if we need to upgrade:
if (!fIsInitialDownload)
{
int nUpgraded = 0;
const CBlockIndex* pindex = pindexBest;
for (int i = 0; i < 100 && pindex != NULL; i++)
{
if (pindex->nVersion > CBlock::CURRENT_VERSION)
++nUpgraded;
pindex = pindex->pprev;
}
if (nUpgraded > 0)
printf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, CBlock::CURRENT_VERSION);
if (nUpgraded > 100/2)
// strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
strMiscWarning = _("Warning: This version is obsolete, upgrade required!");
}
std::string strCmd = GetArg("-blocknotify", "");
if (!fIsInitialDownload && !strCmd.empty())
{
boost::replace_all(strCmd, "%s", hashBestChain.GetHex());
boost::thread t(runCommand, strCmd); // thread runs free
}
return true;
}
bool CBlock::AddToBlockIndex(CValidationState &state, const CDiskBlockPos &pos)
{
// Check for duplicate
uint256 hash = GetHash();
if (mapBlockIndex.count(hash))
return state.Invalid(error("AddToBlockIndex() : %s already exists", hash.ToString().c_str()));
// Construct new block index object
CBlockIndex* pindexNew = new CBlockIndex(*this);
assert(pindexNew);
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
pindexNew->phashBlock = &((*mi).first);
map<uint256, CBlockIndex*>::iterator miPrev = mapBlockIndex.find(hashPrevBlock);
if (miPrev != mapBlockIndex.end())
{
pindexNew->pprev = (*miPrev).second;
pindexNew->nHeight = pindexNew->pprev->nHeight + 1;
}
pindexNew->nTx = vtx.size();
pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + pindexNew->GetBlockWork().getuint256();
pindexNew->nChainTx = (pindexNew->pprev ? pindexNew->pprev->nChainTx : 0) + pindexNew->nTx;
pindexNew->nFile = pos.nFile;
pindexNew->nDataPos = pos.nPos;
pindexNew->nUndoPos = 0;
pindexNew->nStatus = BLOCK_VALID_TRANSACTIONS | BLOCK_HAVE_DATA;
setBlockIndexValid.insert(pindexNew);
if (!pblocktree->WriteBlockIndex(CDiskBlockIndex(pindexNew)))
return state.Abort(_("Failed to write block index"));
// New best?
if (!ConnectBestBlock(state))
return false;
if (pindexNew == pindexBest)
{
// Notify UI to display prev block's coinbase if it was ours
static uint256 hashPrevBestCoinBase;
UpdatedTransaction(hashPrevBestCoinBase);
hashPrevBestCoinBase = GetTxHash(0);
}
if (!pblocktree->Flush())
return state.Abort(_("Failed to sync block index"));
uiInterface.NotifyBlocksChanged();
return true;
}
bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64 nTime, bool fKnown = false)
{
bool fUpdatedLast = false;
LOCK(cs_LastBlockFile);
if (fKnown) {
if (nLastBlockFile != pos.nFile) {
nLastBlockFile = pos.nFile;
infoLastBlockFile.SetNull();
pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile);
fUpdatedLast = true;
}
} else {
while (infoLastBlockFile.nSize + nAddSize >= MAX_BLOCKFILE_SIZE) {
printf("Leaving block file %i: %s\n", nLastBlockFile, infoLastBlockFile.ToString().c_str());
FlushBlockFile(true);
nLastBlockFile++;
infoLastBlockFile.SetNull();
pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile); // check whether data for the new file somehow already exist; can fail just fine
fUpdatedLast = true;
}
pos.nFile = nLastBlockFile;
pos.nPos = infoLastBlockFile.nSize;
}
infoLastBlockFile.nSize += nAddSize;
infoLastBlockFile.AddBlock(nHeight, nTime);
if (!fKnown) {
unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE;
unsigned int nNewChunks = (infoLastBlockFile.nSize + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE;
if (nNewChunks > nOldChunks) {
if (CheckDiskSpace(nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos)) {
FILE *file = OpenBlockFile(pos);
if (file) {
printf("Pre-allocating up to position 0x%x in blk%05u.dat\n", nNewChunks * BLOCKFILE_CHUNK_SIZE, pos.nFile);
AllocateFileRange(file, pos.nPos, nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos);
fclose(file);
}
}
else
return state.Error();
}
}
if (!pblocktree->WriteBlockFileInfo(nLastBlockFile, infoLastBlockFile))
return state.Abort(_("Failed to write file info"));
if (fUpdatedLast)
pblocktree->WriteLastBlockFile(nLastBlockFile);
return true;
}
bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize)
{
pos.nFile = nFile;
LOCK(cs_LastBlockFile);
unsigned int nNewSize;
if (nFile == nLastBlockFile) {
pos.nPos = infoLastBlockFile.nUndoSize;
nNewSize = (infoLastBlockFile.nUndoSize += nAddSize);
if (!pblocktree->WriteBlockFileInfo(nLastBlockFile, infoLastBlockFile))
return state.Abort(_("Failed to write block info"));
} else {
CBlockFileInfo info;
if (!pblocktree->ReadBlockFileInfo(nFile, info))
return state.Abort(_("Failed to read block info"));
pos.nPos = info.nUndoSize;
nNewSize = (info.nUndoSize += nAddSize);
if (!pblocktree->WriteBlockFileInfo(nFile, info))
return state.Abort(_("Failed to write block info"));
}
unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE;
unsigned int nNewChunks = (nNewSize + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE;
if (nNewChunks > nOldChunks) {
if (CheckDiskSpace(nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos)) {
FILE *file = OpenUndoFile(pos);
if (file) {
printf("Pre-allocating up to position 0x%x in rev%05u.dat\n", nNewChunks * UNDOFILE_CHUNK_SIZE, pos.nFile);
AllocateFileRange(file, pos.nPos, nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos);
fclose(file);
}
}
else
return state.Error();
}
return true;
}
bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot) const
{
// These are checks that are independent of context
// that can be verified before saving an orphan block.
// Size limits
if (vtx.empty() || vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE)
return state.DoS(100, error("CheckBlock() : size limits failed"));
// Special short-term limits to avoid 10,000 BDB lock limit:
/* if (GetBlockTime() >= 1363867200 && // start enforcing 21 March 2013, noon GMT
GetBlockTime() < 1368576000) // stop enforcing 15 May 2013 00:00:00
{
// Rule is: #unique txids referenced <= 4,500
// ... to prevent 10,000 BDB lock exhaustion on old clients
set<uint256> setTxIn;
for (size_t i = 0; i < vtx.size(); i++)
{
setTxIn.insert(vtx[i].GetHash());
if (i == 0) continue; // skip coinbase txin
BOOST_FOREACH(const CTxIn& txin, vtx[i].vin)
setTxIn.insert(txin.prevout.hash);
}
size_t nTxids = setTxIn.size();
if (nTxids > 4500)
return error("CheckBlock() : 15 May maxlocks violation");
}
*/
// Check proof of work matches claimed amount
if (fCheckPOW && !CheckProofOfWork(GetHash(), nBits))
return state.DoS(50, error("CheckBlock() : proof of work failed"));
// Check timestamp
if (GetBlockTime() > GetAdjustedTime() + 1 * 60 * 60)
return state.Invalid(error("CheckBlock() : block timestamp too far in the future"));
// First transaction must be coinbase, the rest must not be
if (vtx.empty() || !vtx[0].IsCoinBase())
return state.DoS(100, error("CheckBlock() : first tx is not coinbase"));
for (unsigned int i = 1; i < vtx.size(); i++)
if (vtx[i].IsCoinBase())
return state.DoS(100, error("CheckBlock() : more than one coinbase"));
// Check transactions
BOOST_FOREACH(const CTransaction& tx, vtx)
if (!tx.CheckTransaction(state))
return error("CheckBlock() : CheckTransaction failed");
// Build the merkle tree already. We need it anyway later, and it makes the
// block cache the transaction hashes, which means they don't need to be
// recalculated many times during this block's validation.
BuildMerkleTree();
// Check for duplicate txids. This is caught by ConnectInputs(),
// but catching it earlier avoids a potential DoS attack:
set<uint256> uniqueTx;
for (unsigned int i=0; i<vtx.size(); i++) {
uniqueTx.insert(GetTxHash(i));
}
if (uniqueTx.size() != vtx.size())
return state.DoS(100, error("CheckBlock() : duplicate transaction"));
unsigned int nSigOps = 0;
BOOST_FOREACH(const CTransaction& tx, vtx)
{
nSigOps += tx.GetLegacySigOpCount();
}
if (nSigOps > MAX_BLOCK_SIGOPS)
return state.DoS(100, error("CheckBlock() : out-of-bounds SigOpCount"));
// Check merkle root
if (fCheckMerkleRoot && hashMerkleRoot != BuildMerkleTree())
return state.DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
return true;
}
bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp)
{
// Check for duplicate
uint256 hash = GetHash();
if (mapBlockIndex.count(hash))
return state.Invalid(error("AcceptBlock() : block already in mapBlockIndex"));
// Get prev block index
CBlockIndex* pindexPrev = NULL;
int nHeight = 0;
if (hash != hashGenesisBlock) {
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrevBlock);
if (mi == mapBlockIndex.end())
return state.DoS(10, error("AcceptBlock() : prev block not found"));
pindexPrev = (*mi).second;
nHeight = pindexPrev->nHeight+1;
// Check proof of work
if (nBits != GetNextWorkRequired(pindexPrev, this))
return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));
// Check timestamp against prev
if (GetBlockTime() <= pindexPrev->GetMedianTimePast())
return state.Invalid(error("AcceptBlock() : block's timestamp is too early"));
// Check that all transactions are finalized
BOOST_FOREACH(const CTransaction& tx, vtx)
if (!tx.IsFinal(nHeight, GetBlockTime()))
return state.DoS(10, error("AcceptBlock() : contains a non-final transaction"));
// Check that the block chain matches the known block chain up to a checkpoint
if (!Checkpoints::CheckBlock(nHeight, hash))
return state.DoS(100, error("AcceptBlock() : rejected by checkpoint lock-in at %d", nHeight));
// Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded:
// if (nVersion < 2)
// {
// if ((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 950, 1000)) ||
// (fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 75, 100)))
// {
// return state.Invalid(error("AcceptBlock() : rejected nVersion=1 block"));
// }
// }
// Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
if (nVersion >= 2)
{
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
if ((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 750, 1000)) ||
(fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 51, 100)))
{
CScript expect = CScript() << nHeight;
if (!std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin()))
return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
}
}
}
// Write block to history file
try {
unsigned int nBlockSize = ::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION);
CDiskBlockPos blockPos;
if (dbp != NULL)
blockPos = *dbp;
if (!FindBlockPos(state, blockPos, nBlockSize+8, nHeight, nTime, dbp != NULL))
return error("AcceptBlock() : FindBlockPos failed");
if (dbp == NULL)
if (!WriteToDisk(blockPos))
return state.Abort(_("Failed to write block"));
if (!AddToBlockIndex(state, blockPos))
return error("AcceptBlock() : AddToBlockIndex failed");
} catch(std::runtime_error &e) {
return state.Abort(_("System error: ") + e.what());
}
// Relay inventory, but don't relay old inventory during initial block download
int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate();
if (hashBestChain == hash)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
pnode->PushInventory(CInv(MSG_BLOCK, hash));
}
return true;
}
bool CBlockIndex::IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned int nRequired, unsigned int nToCheck)
{
unsigned int nFound = 0;
for (unsigned int i = 0; i < nToCheck && nFound < nRequired && pstart != NULL; i++)
{
if (pstart->nVersion >= minVersion)
++nFound;
pstart = pstart->pprev;
}
return (nFound >= nRequired);
}
bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBlockPos *dbp)
{
// Check for duplicate
uint256 hash = pblock->GetHash();
if (mapBlockIndex.count(hash))
return state.Invalid(error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString().c_str()));
if (mapOrphanBlocks.count(hash))
return state.Invalid(error("ProcessBlock() : already have block (orphan) %s", hash.ToString().c_str()));
// Preliminary checks
if (!pblock->CheckBlock(state))
return error("ProcessBlock() : CheckBlock FAILED");
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex);
if (pcheckpoint && pblock->hashPrevBlock != hashBestChain)
{
// Extra checks to prevent "fill up memory by spamming with bogus blocks"
int64 deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime;
if (deltaTime < 0)
{
return state.DoS(100, error("ProcessBlock() : block with timestamp before last checkpoint"));
}
CBigNum bnNewBlock;
bnNewBlock.SetCompact(pblock->nBits);
CBigNum bnRequired;
bnRequired.SetCompact(ComputeMinWork(pcheckpoint->nBits, deltaTime));
if (bnNewBlock > bnRequired)
{
return state.DoS(100, error("ProcessBlock() : block with too little proof-of-work"));
}
}
// If we don't already have its previous block, shunt it off to holding area until we get it
if (pblock->hashPrevBlock != 0 && !mapBlockIndex.count(pblock->hashPrevBlock))
{
printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", pblock->hashPrevBlock.ToString().c_str());
// Accept orphans as long as there is a node to request its parents from
if (pfrom) {
CBlock* pblock2 = new CBlock(*pblock);
mapOrphanBlocks.insert(make_pair(hash, pblock2));
mapOrphanBlocksByPrev.insert(make_pair(pblock2->hashPrevBlock, pblock2));
// Ask this guy to fill in what we're missing
pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2));
}
return true;
}
// Store to disk
if (!pblock->AcceptBlock(state, dbp))
return error("ProcessBlock() : AcceptBlock FAILED");
// Recursively process any orphan blocks that depended on this one
vector<uint256> vWorkQueue;
vWorkQueue.push_back(hash);
for (unsigned int i = 0; i < vWorkQueue.size(); i++)
{
uint256 hashPrev = vWorkQueue[i];
for (multimap<uint256, CBlock*>::iterator mi = mapOrphanBlocksByPrev.lower_bound(hashPrev);
mi != mapOrphanBlocksByPrev.upper_bound(hashPrev);
++mi)
{
CBlock* pblockOrphan = (*mi).second;
// Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan resolution (that is, feeding people an invalid block based on LegitBlockX in order to get anyone relaying LegitBlockX banned)
CValidationState stateDummy;
if (pblockOrphan->AcceptBlock(stateDummy))
vWorkQueue.push_back(pblockOrphan->GetHash());
mapOrphanBlocks.erase(pblockOrphan->GetHash());
delete pblockOrphan;
}
mapOrphanBlocksByPrev.erase(hashPrev);
}
printf("ProcessBlock: ACCEPTED\n");
return true;
}
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
{
header = block.GetBlockHeader();
vector<bool> vMatch;
vector<uint256> vHashes;
vMatch.reserve(block.vtx.size());
vHashes.reserve(block.vtx.size());
for (unsigned int i = 0; i < block.vtx.size(); i++)
{
uint256 hash = block.vtx[i].GetHash();
if (filter.IsRelevantAndUpdate(block.vtx[i], hash))
{
vMatch.push_back(true);
vMatchedTxn.push_back(make_pair(i, hash));
}
else
vMatch.push_back(false);
vHashes.push_back(hash);
}
txn = CPartialMerkleTree(vHashes, vMatch);
}
uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::vector<uint256> &vTxid) {
if (height == 0) {
// hash at height 0 is the txids themself
return vTxid[pos];
} else {
// calculate left hash
uint256 left = CalcHash(height-1, pos*2, vTxid), right;
// calculate right hash if not beyong the end of the array - copy left hash otherwise1
if (pos*2+1 < CalcTreeWidth(height-1))
right = CalcHash(height-1, pos*2+1, vTxid);
else
right = left;
// combine subhashes
return Hash(BEGIN(left), END(left), BEGIN(right), END(right));
}
}
void CPartialMerkleTree::TraverseAndBuild(int height, unsigned int pos, const std::vector<uint256> &vTxid, const std::vector<bool> &vMatch) {
// determine whether this node is the parent of at least one matched txid
bool fParentOfMatch = false;
for (unsigned int p = pos << height; p < (pos+1) << height && p < nTransactions; p++)
fParentOfMatch |= vMatch[p];
// store as flag bit
vBits.push_back(fParentOfMatch);
if (height==0 || !fParentOfMatch) {
// if at height 0, or nothing interesting below, store hash and stop
vHash.push_back(CalcHash(height, pos, vTxid));
} else {
// otherwise, don't store any hash, but descend into the subtrees
TraverseAndBuild(height-1, pos*2, vTxid, vMatch);
if (pos*2+1 < CalcTreeWidth(height-1))
TraverseAndBuild(height-1, pos*2+1, vTxid, vMatch);
}
}
uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, unsigned int &nBitsUsed, unsigned int &nHashUsed, std::vector<uint256> &vMatch) {
if (nBitsUsed >= vBits.size()) {
// overflowed the bits array - failure
fBad = true;
return 0;
}
bool fParentOfMatch = vBits[nBitsUsed++];
if (height==0 || !fParentOfMatch) {
// if at height 0, or nothing interesting below, use stored hash and do not descend
if (nHashUsed >= vHash.size()) {
// overflowed the hash array - failure
fBad = true;
return 0;
}
const uint256 &hash = vHash[nHashUsed++];
if (height==0 && fParentOfMatch) // in case of height 0, we have a matched txid
vMatch.push_back(hash);
return hash;
} else {
// otherwise, descend into the subtrees to extract matched txids and hashes
uint256 left = TraverseAndExtract(height-1, pos*2, nBitsUsed, nHashUsed, vMatch), right;
if (pos*2+1 < CalcTreeWidth(height-1))
right = TraverseAndExtract(height-1, pos*2+1, nBitsUsed, nHashUsed, vMatch);
else
right = left;
// and combine them before returning
return Hash(BEGIN(left), END(left), BEGIN(right), END(right));
}
}
CPartialMerkleTree::CPartialMerkleTree(const std::vector<uint256> &vTxid, const std::vector<bool> &vMatch) : nTransactions(vTxid.size()), fBad(false) {
// reset state
vBits.clear();
vHash.clear();
// calculate height of tree
int nHeight = 0;
while (CalcTreeWidth(nHeight) > 1)
nHeight++;
// traverse the partial tree
TraverseAndBuild(nHeight, 0, vTxid, vMatch);
}
CPartialMerkleTree::CPartialMerkleTree() : nTransactions(0), fBad(true) {}
uint256 CPartialMerkleTree::ExtractMatches(std::vector<uint256> &vMatch) {
vMatch.clear();
// An empty set will not work
if (nTransactions == 0)
return 0;
// check for excessively high numbers of transactions
if (nTransactions > MAX_BLOCK_SIZE / 60) // 60 is the lower bound for the size of a serialized CTransaction
return 0;
// there can never be more hashes provided than one for every txid
if (vHash.size() > nTransactions)
return 0;
// there must be at least one bit per node in the partial tree, and at least one node per hash
if (vBits.size() < vHash.size())
return 0;
// calculate height of tree
int nHeight = 0;
while (CalcTreeWidth(nHeight) > 1)
nHeight++;
// traverse the partial tree
unsigned int nBitsUsed = 0, nHashUsed = 0;
uint256 hashMerkleRoot = TraverseAndExtract(nHeight, 0, nBitsUsed, nHashUsed, vMatch);
// verify that no problems occured during the tree traversal
if (fBad)
return 0;
// verify that all bits were consumed (except for the padding caused by serializing it as a byte sequence)
if ((nBitsUsed+7)/8 != (vBits.size()+7)/8)
return 0;
// verify that all hashes were consumed
if (nHashUsed != vHash.size())
return 0;
return hashMerkleRoot;
}
bool AbortNode(const std::string &strMessage) {
strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_ERROR);
StartShutdown();
return false;
}
bool CheckDiskSpace(uint64 nAdditionalBytes)
{
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
// Check for nMinDiskSpace bytes (currently 50MB)
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
return AbortNode(_("Error: Disk space is low!"));
return true;
}
CCriticalSection cs_LastBlockFile;
CBlockFileInfo infoLastBlockFile;
int nLastBlockFile = 0;
FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
{
if (pos.IsNull())
return NULL;
boost::filesystem::path path = GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
boost::filesystem::create_directories(path.parent_path());
FILE* file = fopen(path.string().c_str(), "rb+");
if (!file && !fReadOnly)
file = fopen(path.string().c_str(), "wb+");
if (!file) {
printf("Unable to open file %s\n", path.string().c_str());
return NULL;
}
if (pos.nPos) {
if (fseek(file, pos.nPos, SEEK_SET)) {
printf("Unable to seek to position %u of %s\n", pos.nPos, path.string().c_str());
fclose(file);
return NULL;
}
}
return file;
}
FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly) {
return OpenDiskFile(pos, "blk", fReadOnly);
}
FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) {
return OpenDiskFile(pos, "rev", fReadOnly);
}
CBlockIndex * InsertBlockIndex(uint256 hash)
{
if (hash == 0)
return NULL;
// Return existing
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end())
return (*mi).second;
// Create new
CBlockIndex* pindexNew = new CBlockIndex();
if (!pindexNew)
throw runtime_error("LoadBlockIndex() : new CBlockIndex failed");
mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
pindexNew->phashBlock = &((*mi).first);
return pindexNew;
}
bool static LoadBlockIndexDB()
{
if (!pblocktree->LoadBlockIndexGuts())
return false;
boost::this_thread::interruption_point();
// Calculate nChainWork
vector<pair<int, CBlockIndex*> > vSortedByHeight;
vSortedByHeight.reserve(mapBlockIndex.size());
BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
{
CBlockIndex* pindex = item.second;
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
}
sort(vSortedByHeight.begin(), vSortedByHeight.end());
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
{
CBlockIndex* pindex = item.second;
pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + pindex->GetBlockWork().getuint256();
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS && !(pindex->nStatus & BLOCK_FAILED_MASK))
setBlockIndexValid.insert(pindex);
}
// Load block file info
pblocktree->ReadLastBlockFile(nLastBlockFile);
printf("LoadBlockIndexDB(): last block file = %i\n", nLastBlockFile);
if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
printf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString().c_str());
// Load nBestInvalidWork, OK if it doesn't exist
CBigNum bnBestInvalidWork;
pblocktree->ReadBestInvalidWork(bnBestInvalidWork);
nBestInvalidWork = bnBestInvalidWork.getuint256();
// Check whether we need to continue reindexing
bool fReindexing = false;
pblocktree->ReadReindexing(fReindexing);
fReindex |= fReindexing;
// Check whether we have a transaction index
pblocktree->ReadFlag("txindex", fTxIndex);
printf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled");
// Load hashBestChain pointer to end of best chain
pindexBest = pcoinsTip->GetBestBlock();
if (pindexBest == NULL)
return true;
hashBestChain = pindexBest->GetBlockHash();
nBestHeight = pindexBest->nHeight;
nBestChainWork = pindexBest->nChainWork;
// set 'next' pointers in best chain
CBlockIndex *pindex = pindexBest;
while(pindex != NULL && pindex->pprev != NULL) {
CBlockIndex *pindexPrev = pindex->pprev;
pindexPrev->pnext = pindex;
pindex = pindexPrev;
}
printf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s\n",
hashBestChain.ToString().c_str(), nBestHeight,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str());
return true;
}
bool VerifyDB() {
if (pindexBest == NULL || pindexBest->pprev == NULL)
return true;
// Verify blocks in the best chain
int nCheckLevel = GetArg("-checklevel", 3);
int nCheckDepth = GetArg( "-checkblocks", 288);
if (nCheckDepth == 0)
nCheckDepth = 1000000000; // suffices until the year 19000
if (nCheckDepth > nBestHeight)
nCheckDepth = nBestHeight;
nCheckLevel = std::max(0, std::min(4, nCheckLevel));
printf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);
CCoinsViewCache coins(*pcoinsTip, true);
CBlockIndex* pindexState = pindexBest;
CBlockIndex* pindexFailure = NULL;
int nGoodTransactions = 0;
CValidationState state;
for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev)
{
boost::this_thread::interruption_point();
if (pindex->nHeight < nBestHeight-nCheckDepth)
break;
CBlock block;
// check level 0: read from disk
if (!block.ReadFromDisk(pindex))
return error("VerifyDB() : *** block.ReadFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
// check level 1: verify block validity
if (nCheckLevel >= 1 && !block.CheckBlock(state))
return error("VerifyDB() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
// check level 2: verify undo validity
if (nCheckLevel >= 2 && pindex) {
CBlockUndo undo;
CDiskBlockPos pos = pindex->GetUndoPos();
if (!pos.IsNull()) {
if (!undo.ReadFromDisk(pos, pindex->pprev->GetBlockHash()))
return error("VerifyDB() : *** found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
}
}
// check level 3: check for inconsistencies during memory-only disconnect of tip blocks
if (nCheckLevel >= 3 && pindex == pindexState && (coins.GetCacheSize() + pcoinsTip->GetCacheSize()) <= 2*nCoinCacheSize + 32000) {
bool fClean = true;
if (!block.DisconnectBlock(state, pindex, coins, &fClean))
return error("VerifyDB() : *** irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
pindexState = pindex->pprev;
if (!fClean) {
nGoodTransactions = 0;
pindexFailure = pindex;
} else
nGoodTransactions += block.vtx.size();
}
}
if (pindexFailure)
return error("VerifyDB() : *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", pindexBest->nHeight - pindexFailure->nHeight + 1, nGoodTransactions);
// check level 4: try reconnecting blocks
if (nCheckLevel >= 4) {
CBlockIndex *pindex = pindexState;
while (pindex != pindexBest) {
boost::this_thread::interruption_point();
pindex = pindex->pnext;
CBlock block;
if (!block.ReadFromDisk(pindex))
return error("VerifyDB() : *** block.ReadFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
if (!block.ConnectBlock(state, pindex, coins))
return error("VerifyDB() : *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
}
}
printf("No coin database inconsistencies in last %i blocks (%i transactions)\n", pindexBest->nHeight - pindexState->nHeight, nGoodTransactions);
return true;
}
void UnloadBlockIndex()
{
mapBlockIndex.clear();
setBlockIndexValid.clear();
pindexGenesisBlock = NULL;
nBestHeight = 0;
nBestChainWork = 0;
nBestInvalidWork = 0;
hashBestChain = 0;
pindexBest = NULL;
}
bool LoadBlockIndex()
{
if (fTestNet)
{
pchMessageStart[0] = 0x01;
pchMessageStart[1] = 0x1A;
pchMessageStart[2] = 0x39;
pchMessageStart[3] = 0xF8;
hashGenesisBlock = uint256("0x000001743a22ba983d054d07b92d95acd5fb8639cd18a4774668c149b5c6bd35");
}
//
// Load block index from databases
//
if (!fReindex && !LoadBlockIndexDB())
return false;
return true;
}
bool InitBlockIndex() {
// Check whether we're already initialized
if (pindexGenesisBlock != NULL)
return true;
// Use the provided setting for -txindex in the new database
fTxIndex = GetBoolArg("-txindex", false);
pblocktree->WriteFlag("txindex", fTxIndex);
printf("Initializing databases...\n");
// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
if (!fReindex) {
// Genesis Block:
/*
00000c257b93a36e9a4318a64398d661866341331a984e2b486414fc5bb16ccd
000002ad378e6403ff83488eb33f36402f838993d8e2aaf2849f30f0c6994c50
868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776
CBlock(hash=00000c257b93a36e9a4318a64398d661866341331a984e2b486414fc5bb16ccd, ver=112, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776, nTime=1374408079, nBits=1e0fffff, nNonce=12058113, vtx=1)
CTransaction(hash=868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776, ver=1, vin.size=1, vout.size=1, nLockTime=0, strTxComment=)
CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 04ffff001d0104423231204a756c7920323031332c2054686520477561726469616e2c20546573636f20626f7373207361797320636865617020666f6f6420657261206973206f766572)
CTxOut(nValue=1.00000, scriptPubKey=04678afdb0fe5548271967f1a67130)
vMerkleTree: 868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776
testnet:
00000e5e37c42d6b67d0934399adfb0fa48b59138abb1a8842c88f4ca3d4ec96
000007e82a36afe58a204aa75b8d6d7d1661a1216dc631927857726f8624c5ab
868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776
CBlock(hash=00000e5e37c42d6b67d0934399adfb0fa48b59138abb1a8842c88f4ca3d4ec96, ver=112, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776, nTime=1373481000, nBits=1e0fffff, nNonce=905523645, vtx=1)
CTransaction(hash=868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776, ver=1, vin.size=1, vout.size=1, nLockTime=0, strTxComment=)
CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 04ffff001d0104423231204a756c7920323031332c2054686520477561726469616e2c20546573636f20626f7373207361797320636865617020666f6f6420657261206973206f766572)
CTxOut(nValue=1.00000, scriptPubKey=04678afdb0fe5548271967f1a67130)
vMerkleTree: 868b2fb28cb1a0b881480cc85eb207e29e6ae75cdd6d26688ed34c2d2d23c776
*/
// Genesis block
const char* oldpszTimestamp = "Jan 3th 2014. NSA developing code-cracking quantum computer. Fck!";
const char* pszTimestamp = "Dec 22th 2014. Sony hack: North Korea threatens US as row deepens. Fck!";
CTransaction txNew;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = nGenesisBlockRewardCoin;
txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
CBlock block;
block.vtx.push_back(txNew);
block.hashPrevBlock = 0;
block.hashMerkleRoot = block.BuildMerkleTree();
block.nVersion = 112;
block.nTime = timeGenesisBlock;
block.nBits = bnProofOfWorkLimit.GetCompact();
block.nNonce = 14190578;
if (fTestNet)
{
block.nTime = 1419250578;
block.nNonce = 14190578;
}
//// debug print
uint256 hash = block.GetHash();
while (hash > bnProofOfWorkLimit.getuint256()){
if (++block.nNonce==0) break;
hash = block.GetHash();
}
printf("%s\n", hash.ToString().c_str());
printf("%s\n", hashGenesisBlock.ToString().c_str());
printf("%s\n", block.hashMerkleRoot.ToString().c_str());
block.print();
assert(block.hashMerkleRoot == uint256("0xe3916cc096ccb15833de1efb205ad7d53de8bcd8ecfc16ebb5c038a4e144c4f6"));
assert(hash == hashGenesisBlock);
// Start new block file
try {
unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
CDiskBlockPos blockPos;
CValidationState state;
if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
return error("LoadBlockIndex() : FindBlockPos failed");
if (!block.WriteToDisk(blockPos))
return error("LoadBlockIndex() : writing genesis block to disk failed");
if (!block.AddToBlockIndex(state, blockPos))
return error("LoadBlockIndex() : genesis block not accepted");
} catch(std::runtime_error &e) {
return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
}
}
return true;
}
void PrintBlockTree()
{
// pre-compute tree structure
map<CBlockIndex*, vector<CBlockIndex*> > mapNext;
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
{
CBlockIndex* pindex = (*mi).second;
mapNext[pindex->pprev].push_back(pindex);
// test
//while (rand() % 3 == 0)
// mapNext[pindex->pprev].push_back(pindex);
}
vector<pair<int, CBlockIndex*> > vStack;
vStack.push_back(make_pair(0, pindexGenesisBlock));
int nPrevCol = 0;
while (!vStack.empty())
{
int nCol = vStack.back().first;
CBlockIndex* pindex = vStack.back().second;
vStack.pop_back();
// print split or gap
if (nCol > nPrevCol)
{
for (int i = 0; i < nCol-1; i++)
printf("| ");
printf("|\\\n");
}
else if (nCol < nPrevCol)
{
for (int i = 0; i < nCol; i++)
printf("| ");
printf("|\n");
}
nPrevCol = nCol;
// print columns
for (int i = 0; i < nCol; i++)
printf("| ");
// print item
CBlock block;
block.ReadFromDisk(pindex);
printf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"",
pindex->nHeight,
pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(),
block.vtx.size());
PrintWallets(block);
// put the main time-chain first
vector<CBlockIndex*>& vNext = mapNext[pindex];
for (unsigned int i = 0; i < vNext.size(); i++)
{
if (vNext[i]->pnext)
{
swap(vNext[0], vNext[i]);
break;
}
}
// iterate children
for (unsigned int i = 0; i < vNext.size(); i++)
vStack.push_back(make_pair(nCol+i, vNext[i]));
}
}
bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
{
int64 nStart = GetTimeMillis();
int nLoaded = 0;
try {
CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SIZE, MAX_BLOCK_SIZE+8, SER_DISK, CLIENT_VERSION);
uint64 nStartByte = 0;
if (dbp) {
// (try to) skip already indexed part
CBlockFileInfo info;
if (pblocktree->ReadBlockFileInfo(dbp->nFile, info)) {
nStartByte = info.nSize;
blkdat.Seek(info.nSize);
}
}
uint64 nRewind = blkdat.GetPos();
while (blkdat.good() && !blkdat.eof()) {
boost::this_thread::interruption_point();
blkdat.SetPos(nRewind);
nRewind++; // start one byte further next time, in case of failure
blkdat.SetLimit(); // remove former limit
unsigned int nSize = 0;
try {
// locate a header
unsigned char buf[4];
blkdat.FindByte(pchMessageStart[0]);
nRewind = blkdat.GetPos()+1;
blkdat >> FLATDATA(buf);
if (memcmp(buf, pchMessageStart, 4))
continue;
// read size
blkdat >> nSize;
if (nSize < 80 || nSize > MAX_BLOCK_SIZE)
continue;
} catch (std::exception &e) {
// no valid block header found; don't complain
break;
}
try {
// read block
uint64 nBlockPos = blkdat.GetPos();
blkdat.SetLimit(nBlockPos + nSize);
CBlock block;
blkdat >> block;
nRewind = blkdat.GetPos();
// process block
if (nBlockPos >= nStartByte) {
LOCK(cs_main);
if (dbp)
dbp->nPos = nBlockPos;
CValidationState state;
if (ProcessBlock(state, NULL, &block, dbp))
nLoaded++;
if (state.IsError())
break;
}
} catch (std::exception &e) {
printf("%s() : Deserialize or I/O error caught during load\n", __PRETTY_FUNCTION__);
}
}
fclose(fileIn);
} catch(std::runtime_error &e) {
AbortNode(_("Error: system error: ") + e.what());
}
if (nLoaded > 0)
printf("Loaded %i blocks from external file in %"PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart);
return nLoaded > 0;
}
//////////////////////////////////////////////////////////////////////////////
//
// CAlert
//
extern map<uint256, CAlert> mapAlerts;
extern CCriticalSection cs_mapAlerts;
string GetWarnings(string strFor)
{
int nPriority = 0;
string strStatusBar;
string strRPC;
if (GetBoolArg("-testsafemode"))
strRPC = "test";
if (!CLIENT_VERSION_IS_RELEASE)
strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");
// Misc warnings like out of disk space and clock is wrong
if (strMiscWarning != "")
{
nPriority = 1000;
strStatusBar = strMiscWarning;
}
// Longer invalid proof-of-work chain
if (pindexBest && nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256())
{
nPriority = 2000;
strStatusBar = strRPC = _("Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.");
}
// Alerts
{
LOCK(cs_mapAlerts);
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
{
const CAlert& alert = item.second;
if (alert.AppliesToMe() && alert.nPriority > nPriority)
{
nPriority = alert.nPriority;
strStatusBar = alert.strStatusBar;
}
}
}
if (strFor == "statusbar")
return strStatusBar;
else if (strFor == "rpc")
return strRPC;
assert(!"GetWarnings() : invalid parameter");
return "error";
}
//////////////////////////////////////////////////////////////////////////////
//
// Messages
//
bool static AlreadyHave(const CInv& inv)
{
switch (inv.type)
{
case MSG_TX:
{
bool txInMap = false;
{
LOCK(mempool.cs);
txInMap = mempool.exists(inv.hash);
}
return txInMap || mapOrphanTransactions.count(inv.hash) ||
pcoinsTip->HaveCoins(inv.hash);
}
case MSG_BLOCK:
return mapBlockIndex.count(inv.hash) ||
mapOrphanBlocks.count(inv.hash);
}
// Don't know what it is, just say we already got one
return true;
}
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
unsigned char pchMessageStart[4] = { 0xfe, 0xa5, 0x03, 0xda };
void static ProcessGetData(CNode* pfrom)
{
std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin();
vector<CInv> vNotFound;
while (it != pfrom->vRecvGetData.end()) {
// Don't bother if send buffer is too full to respond anyway
if (pfrom->nSendSize >= SendBufferSize())
break;
const CInv &inv = *it;
{
boost::this_thread::interruption_point();
it++;
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
{
// Send block from disk
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(inv.hash);
if (mi != mapBlockIndex.end())
{
CBlock block;
block.ReadFromDisk((*mi).second);
if (inv.type == MSG_BLOCK)
pfrom->PushMessage("block", block);
else // MSG_FILTERED_BLOCK)
{
LOCK(pfrom->cs_filter);
if (pfrom->pfilter)
{
CMerkleBlock merkleBlock(block, *pfrom->pfilter);
pfrom->PushMessage("merkleblock", merkleBlock);
// CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see
// This avoids hurting performance by pointlessly requiring a round-trip
// Note that there is currently no way for a node to request any single transactions we didnt send here -
// they must either disconnect and retry or request the full block.
// Thus, the protocol spec specified allows for us to provide duplicate txn here,
// however we MUST always provide at least what the remote peer needs
typedef std::pair<unsigned int, uint256> PairType;
BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn)
if (!pfrom->setInventoryKnown.count(CInv(MSG_TX, pair.second)))
pfrom->PushMessage("tx", block.vtx[pair.first]);
}
// else
// no response
}
// Trigger them to send a getblocks request for the next batch of inventory
if (inv.hash == pfrom->hashContinue)
{
// Bypass PushInventory, this must send even if redundant,
// and we want it right after the last block so they don't
// wait for other stuff first.
vector<CInv> vInv;
vInv.push_back(CInv(MSG_BLOCK, hashBestChain));
pfrom->PushMessage("inv", vInv);
pfrom->hashContinue = 0;
}
}
}
else if (inv.IsKnownType())
{
// Send stream from relay memory
bool pushed = false;
{
LOCK(cs_mapRelay);
map<CInv, CDataStream>::iterator mi = mapRelay.find(inv);
if (mi != mapRelay.end()) {
pfrom->PushMessage(inv.GetCommand(), (*mi).second);
pushed = true;
}
}
if (!pushed && inv.type == MSG_TX) {
LOCK(mempool.cs);
if (mempool.exists(inv.hash)) {
CTransaction tx = mempool.lookup(inv.hash);
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << tx;
pfrom->PushMessage("tx", ss);
pushed = true;
}
}
if (!pushed) {
vNotFound.push_back(inv);
}
}
// Track requests for our stuff.
Inventory(inv.hash);
}
}
pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);
if (!vNotFound.empty()) {
// Let the peer know that we didn't find what it asked for, so it doesn't
// have to wait around forever. Currently only SPV clients actually care
// about this message: it's needed when they are recursively walking the
// dependencies of relevant unconfirmed transactions. SPV clients want to
// do that because they want to know about (and store and rebroadcast and
// risk analyze) the dependencies of transactions relevant to them, without
// having to download the entire memory pool.
pfrom->PushMessage("notfound", vNotFound);
}
}
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
RandAddSeedPerfmon();
if (fDebug)
printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{
printf("dropmessagestest DROPPING RECV MESSAGE\n");
return true;
}
if (strCommand == "version")
{
// Each connection can only send one version message
if (pfrom->nVersion != 0)
{
pfrom->Misbehaving(1);
return false;
}
int64 nTime;
CAddress addrMe;
CAddress addrFrom;
uint64 nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
if (pfrom->nVersion < MIN_PROTO_VERSION)
{
// Since February 20, 2012, the protocol is initiated at version 209,
// and earlier versions are no longer supported
printf("partner %s using obsolete version %i; disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion);
pfrom->fDisconnect = true;
return false;
}
if (pfrom->nVersion == 10300)
pfrom->nVersion = 300;
if (!vRecv.empty())
vRecv >> addrFrom >> nNonce;
if (!vRecv.empty())
vRecv >> pfrom->strSubVer;
if (!vRecv.empty())
vRecv >> pfrom->nStartingHeight;
if (!vRecv.empty())
vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message
else
pfrom->fRelayTxes = true;
if (pfrom->fInbound && addrMe.IsRoutable())
{
pfrom->addrLocal = addrMe;
SeenLocal(addrMe);
}
// Disconnect if we connected to ourself
if (nNonce == nLocalHostNonce && nNonce > 1)
{
printf("connected to self at %s, disconnecting\n", pfrom->addr.ToString().c_str());
pfrom->fDisconnect = true;
return true;
}
// Be shy and don't send version until we hear
if (pfrom->fInbound)
pfrom->PushVersion();
pfrom->fClient = !(pfrom->nServices & NODE_NETWORK);
AddTimeData(pfrom->addr, nTime);
// Change version
pfrom->PushMessage("verack");
pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
if (!pfrom->fInbound)
{
// Advertise our address
if (!fNoListen && !IsInitialBlockDownload())
{
CAddress addr = GetLocalAddress(&pfrom->addr);
if (addr.IsRoutable())
pfrom->PushAddress(addr);
}
// Get recent addresses
if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || addrman.size() < 1000)
{
pfrom->PushMessage("getaddr");
pfrom->fGetAddr = true;
}
addrman.Good(pfrom->addr);
} else {
if (((CNetAddr)pfrom->addr) == (CNetAddr)addrFrom)
{
addrman.Add(addrFrom, addrFrom);
addrman.Good(addrFrom);
}
}
// Relay alerts
{
LOCK(cs_mapAlerts);
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
item.second.RelayTo(pfrom);
}
pfrom->fSuccessfullyConnected = true;
printf("receive version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString().c_str(), addrFrom.ToString().c_str(), pfrom->addr.ToString().c_str());
cPeerBlockCounts.input(pfrom->nStartingHeight);
}
else if (pfrom->nVersion == 0)
{
// Must have a version message before anything else
pfrom->Misbehaving(1);
return false;
}
else if (strCommand == "verack")
{
pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
}
else if (strCommand == "addr")
{
vector<CAddress> vAddr;
vRecv >> vAddr;
// Don't want addr from older versions unless seeding
if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000)
return true;
if (vAddr.size() > 1000)
{
pfrom->Misbehaving(20);
return error("message addr size() = %"PRIszu"", vAddr.size());
}
// Store the new addresses
vector<CAddress> vAddrOk;
int64 nNow = GetAdjustedTime();
int64 nSince = nNow - 10 * 60;
BOOST_FOREACH(CAddress& addr, vAddr)
{
boost::this_thread::interruption_point();
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
addr.nTime = nNow - 5 * 24 * 60 * 60;
pfrom->AddAddressKnown(addr);
bool fReachable = IsReachable(addr);
if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable())
{
// Relay to a limited number of other nodes
{
LOCK(cs_vNodes);
// Use deterministic randomness to send to the same nodes for 24 hours
// at a time so the setAddrKnowns of the chosen nodes prevent repeats
static uint256 hashSalt;
if (hashSalt == 0)
hashSalt = GetRandHash();
uint64 hashAddr = addr.GetHash();
uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60));
hashRand = Hash2(BEGIN(hashRand), END(hashRand));
multimap<uint256, CNode*> mapMix;
BOOST_FOREACH(CNode* pnode, vNodes)
{
if (pnode->nVersion < CADDR_TIME_VERSION)
continue;
unsigned int nPointer;
memcpy(&nPointer, &pnode, sizeof(nPointer));
uint256 hashKey = hashRand ^ nPointer;
hashKey = Hash2(BEGIN(hashKey), END(hashKey));
mapMix.insert(make_pair(hashKey, pnode));
}
int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s)
for (multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi)
((*mi).second)->PushAddress(addr);
}
}
// Do not store addresses outside our network
if (fReachable)
vAddrOk.push_back(addr);
}
addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60);
if (vAddr.size() < 1000)
pfrom->fGetAddr = false;
if (pfrom->fOneShot)
pfrom->fDisconnect = true;
}
else if (strCommand == "inv")
{
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > MAX_INV_SZ)
{
pfrom->Misbehaving(20);
return error("message inv size() = %"PRIszu"", vInv.size());
}
// find last block in inv vector
unsigned int nLastBlock = (unsigned int)(-1);
for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) {
if (vInv[vInv.size() - 1 - nInv].type == MSG_BLOCK) {
nLastBlock = vInv.size() - 1 - nInv;
break;
}
}
for (unsigned int nInv = 0; nInv < vInv.size(); nInv++)
{
const CInv &inv = vInv[nInv];
boost::this_thread::interruption_point();
pfrom->AddInventoryKnown(inv);
bool fAlreadyHave = AlreadyHave(inv);
if (fDebug)
printf(" got inventory: %s %s\n", inv.ToString().c_str(), fAlreadyHave ? "have" : "new");
if (!fAlreadyHave) {
if (!fImporting && !fReindex)
pfrom->AskFor(inv);
} else if (inv.type == MSG_BLOCK && mapOrphanBlocks.count(inv.hash)) {
pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(mapOrphanBlocks[inv.hash]));
} else if (nInv == nLastBlock) {
// In case we are on a very long side-chain, it is possible that we already have
// the last block in an inv bundle sent in response to getblocks. Try to detect
// this situation and push another getblocks to continue.
pfrom->PushGetBlocks(mapBlockIndex[inv.hash], uint256(0));
if (fDebug)
printf("force request: %s\n", inv.ToString().c_str());
}
// Track requests for our stuff
Inventory(inv.hash);
}
}
else if (strCommand == "getdata")
{
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > MAX_INV_SZ)
{
pfrom->Misbehaving(20);
return error("message getdata size() = %"PRIszu"", vInv.size());
}
if (fDebugNet || (vInv.size() != 1))
printf("received getdata (%"PRIszu" invsz)\n", vInv.size());
if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1))
printf("received getdata for: %s\n", vInv[0].ToString().c_str());
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
ProcessGetData(pfrom);
}
else if (strCommand == "getblocks")
{
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;
// Find the last block the caller has in the main chain
CBlockIndex* pindex = locator.GetBlockIndex();
// Send the rest of the chain
if (pindex)
pindex = pindex->pnext;
int nLimit = 500;
printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().c_str(), nLimit);
for (; pindex; pindex = pindex->pnext)
{
if (pindex->GetBlockHash() == hashStop)
{
printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
break;
}
pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash()));
if (--nLimit <= 0)
{
// When this block is requested, we'll send an inv that'll make them
// getblocks the next batch of inventory.
printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
pfrom->hashContinue = pindex->GetBlockHash();
break;
}
}
}
else if (strCommand == "getheaders")
{
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;
CBlockIndex* pindex = NULL;
if (locator.IsNull())
{
// If locator is null, return the hashStop block
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashStop);
if (mi == mapBlockIndex.end())
return true;
pindex = (*mi).second;
}
else
{
// Find the last block the caller has in the main chain
pindex = locator.GetBlockIndex();
if (pindex)
pindex = pindex->pnext;
}
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
vector<CBlock> vHeaders;
int nLimit = 2000;
printf("getheaders %d to %s\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().c_str());
for (; pindex; pindex = pindex->pnext)
{
vHeaders.push_back(pindex->GetBlockHeader());
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
break;
}
pfrom->PushMessage("headers", vHeaders);
}
else if (strCommand == "tx")
{
vector<uint256> vWorkQueue;
vector<uint256> vEraseQueue;
CDataStream vMsg(vRecv);
CTransaction tx;
vRecv >> tx;
CInv inv(MSG_TX, tx.GetHash());
pfrom->AddInventoryKnown(inv);
// Truncate messages to the size of the tx in them
unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
unsigned int oldSize = vMsg.size();
if (nSize < oldSize) {
vMsg.resize(nSize);
printf("truncating oversized TX %s (%u -> %u)\n",
tx.GetHash().ToString().c_str(),
oldSize, nSize);
}
bool fMissingInputs = false;
CValidationState state;
if (tx.AcceptToMemoryPool(state, true, true, &fMissingInputs))
{
RelayTransaction(tx, inv.hash, vMsg);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
vEraseQueue.push_back(inv.hash);
// Recursively process any orphan transactions that depended on this one
for (unsigned int i = 0; i < vWorkQueue.size(); i++)
{
uint256 hashPrev = vWorkQueue[i];
for (map<uint256, CDataStream*>::iterator mi = mapOrphanTransactionsByPrev[hashPrev].begin();
mi != mapOrphanTransactionsByPrev[hashPrev].end();
++mi)
{
const CDataStream& vMsg = *((*mi).second);
CTransaction tx;
CDataStream(vMsg) >> tx;
CInv inv(MSG_TX, tx.GetHash());
bool fMissingInputs2 = false;
// Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get anyone relaying LegitTxX banned)
CValidationState stateDummy;
if (tx.AcceptToMemoryPool(stateDummy, true, true, &fMissingInputs2))
{
printf(" accepted orphan tx %s\n", inv.hash.ToString().c_str());
RelayTransaction(tx, inv.hash, vMsg);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
vEraseQueue.push_back(inv.hash);
}
else if (!fMissingInputs2)
{
// invalid or too-little-fee orphan
vEraseQueue.push_back(inv.hash);
printf(" removed orphan tx %s\n", inv.hash.ToString().c_str());
}
}
}
BOOST_FOREACH(uint256 hash, vEraseQueue)
EraseOrphanTx(hash);
}
else if (fMissingInputs)
{
AddOrphanTx(vMsg);
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded
unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS);
if (nEvicted > 0)
printf("mapOrphan overflow, removed %u tx\n", nEvicted);
}
int nDoS;
if (state.IsInvalid(nDoS))
pfrom->Misbehaving(nDoS);
}
else if (strCommand == "block" && !fImporting && !fReindex) // Ignore blocks received while importing
{
CBlock block;
vRecv >> block;
printf("received block %s\n", block.GetHash().ToString().c_str());
// block.print();
CInv inv(MSG_BLOCK, block.GetHash());
pfrom->AddInventoryKnown(inv);
CValidationState state;
if (ProcessBlock(state, pfrom, &block))
mapAlreadyAskedFor.erase(inv);
int nDoS;
if (state.IsInvalid(nDoS))
pfrom->Misbehaving(nDoS);
}
else if (strCommand == "getaddr")
{
pfrom->vAddrToSend.clear();
vector<CAddress> vAddr = addrman.GetAddr();
BOOST_FOREACH(const CAddress &addr, vAddr)
pfrom->PushAddress(addr);
}
else if (strCommand == "mempool")
{
std::vector<uint256> vtxid;
LOCK2(mempool.cs, pfrom->cs_filter);
mempool.queryHashes(vtxid);
vector<CInv> vInv;
BOOST_FOREACH(uint256& hash, vtxid) {
CInv inv(MSG_TX, hash);
if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(mempool.lookup(hash), hash)) ||
(!pfrom->pfilter))
vInv.push_back(inv);
if (vInv.size() == MAX_INV_SZ)
break;
}
if (vInv.size() > 0)
pfrom->PushMessage("inv", vInv);
}
else if (strCommand == "ping")
{
if (pfrom->nVersion > BIP0031_VERSION)
{
uint64 nonce = 0;
vRecv >> nonce;
// Echo the message back with the nonce. This allows for two useful features:
//
// 1) A remote node can quickly check if the connection is operational
// 2) Remote nodes can measure the latency of the network thread. If this node
// is overloaded it won't respond to pings quickly and the remote node can
// avoid sending us more work, like chain download requests.
//
// The nonce stops the remote getting confused between different pings: without
// it, if the remote node sends a ping once per second and this node takes 5
// seconds to respond to each, the 5th ping the remote sends would appear to
// return very quickly.
pfrom->PushMessage("pong", nonce);
}
}
else if (strCommand == "alert")
{
CAlert alert;
vRecv >> alert;
uint256 alertHash = alert.GetHash();
if (pfrom->setKnown.count(alertHash) == 0)
{
if (alert.ProcessAlert())
{
// Relay
pfrom->setKnown.insert(alertHash);
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
alert.RelayTo(pnode);
}
}
else {
// Small DoS penalty so peers that send us lots of
// duplicate/expired/invalid-signature/whatever alerts
// eventually get banned.
// This isn't a Misbehaving(100) (immediate ban) because the
// peer might be an older or different implementation with
// a different signature key, etc.
pfrom->Misbehaving(10);
}
}
}
else if (strCommand == "filterload")
{
CBloomFilter filter;
vRecv >> filter;
if (!filter.IsWithinSizeConstraints())
// There is no excuse for sending a too-large filter
pfrom->Misbehaving(100);
else
{
LOCK(pfrom->cs_filter);
delete pfrom->pfilter;
pfrom->pfilter = new CBloomFilter(filter);
}
pfrom->fRelayTxes = true;
}
else if (strCommand == "filteradd")
{
vector<unsigned char> vData;
vRecv >> vData;
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
// and thus, the maximum size any matched object can have) in a filteradd message
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE)
{
pfrom->Misbehaving(100);
} else {
LOCK(pfrom->cs_filter);
if (pfrom->pfilter)
pfrom->pfilter->insert(vData);
else
pfrom->Misbehaving(100);
}
}
else if (strCommand == "filterclear")
{
LOCK(pfrom->cs_filter);
delete pfrom->pfilter;
pfrom->pfilter = NULL;
pfrom->fRelayTxes = true;
}
else
{
// Ignore unknown commands for extensibility
}
// Update the last seen time for this node's address
if (pfrom->fNetworkNode)
if (strCommand == "version" || strCommand == "addr" || strCommand == "inv" || strCommand == "getdata" || strCommand == "ping")
AddressCurrentlyConnected(pfrom->addr);
return true;
}
// requires LOCK(cs_vRecvMsg)
bool ProcessMessages(CNode* pfrom)
{
//if (fDebug)
// printf("ProcessMessages(%zu messages)\n", pfrom->vRecvMsg.size());
//
// Message format
// (4) message start
// (12) command
// (4) size
// (4) checksum
// (x) data
//
bool fOk = true;
if (!pfrom->vRecvGetData.empty())
ProcessGetData(pfrom);
std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin();
while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) {
// Don't bother if send buffer is too full to respond anyway
if (pfrom->nSendSize >= SendBufferSize())
break;
// get next message
CNetMessage& msg = *it;
//if (fDebug)
// printf("ProcessMessages(message %u msgsz, %zu bytes, complete:%s)\n",
// msg.hdr.nMessageSize, msg.vRecv.size(),
// msg.complete() ? "Y" : "N");
// end, if an incomplete message is found
if (!msg.complete())
break;
// at this point, any failure means we can delete the current message
it++;
// Scan for message start
if (memcmp(msg.hdr.pchMessageStart, pchMessageStart, sizeof(pchMessageStart)) != 0) {
printf("\n\nPROCESSMESSAGE: INVALID MESSAGESTART\n\n");
fOk = false;
break;
}
// Read header
CMessageHeader& hdr = msg.hdr;
if (!hdr.IsValid())
{
printf("\n\nPROCESSMESSAGE: ERRORS IN HEADER %s\n\n\n", hdr.GetCommand().c_str());
continue;
}
string strCommand = hdr.GetCommand();
// Message size
unsigned int nMessageSize = hdr.nMessageSize;
// Checksum
CDataStream& vRecv = msg.vRecv;
uint256 hash = Hash2(vRecv.begin(), vRecv.begin() + nMessageSize);
unsigned int nChecksum = 0;
memcpy(&nChecksum, &hash, sizeof(nChecksum));
if (nChecksum != hdr.nChecksum)
{
printf("ProcessMessages(%s, %u bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n",
strCommand.c_str(), nMessageSize, nChecksum, hdr.nChecksum);
continue;
}
// Process message
bool fRet = false;
try
{
{
LOCK(cs_main);
fRet = ProcessMessage(pfrom, strCommand, vRecv);
}
boost::this_thread::interruption_point();
}
catch (std::ios_base::failure& e)
{
if (strstr(e.what(), "end of data"))
{
// Allow exceptions from under-length message on vRecv
printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length\n", strCommand.c_str(), nMessageSize, e.what());
}
else if (strstr(e.what(), "size too large"))
{
// Allow exceptions from over-long size
printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught\n", strCommand.c_str(), nMessageSize, e.what());
}
else
{
PrintExceptionContinue(&e, "ProcessMessages()");
}
}
catch (boost::thread_interrupted) {
throw;
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "ProcessMessages()");
} catch (...) {
PrintExceptionContinue(NULL, "ProcessMessages()");
}
if (!fRet)
printf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize);
}
// In case the connection got shut down, its receive buffer was wiped
if (!pfrom->fDisconnect)
pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin(), it);
return fOk;
}
bool SendMessages(CNode* pto, bool fSendTrickle)
{
TRY_LOCK(cs_main, lockMain);
if (lockMain) {
// Don't send anything until we get their version message
if (pto->nVersion == 0)
return true;
// Keep-alive ping. We send a nonce of zero because we don't use it anywhere
// right now.
if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSendMsg.empty()) {
uint64 nonce = 0;
if (pto->nVersion > BIP0031_VERSION)
pto->PushMessage("ping", nonce);
else
pto->PushMessage("ping");
}
// Start block sync
if (pto->fStartSync && !fImporting && !fReindex) {
pto->fStartSync = false;
pto->PushGetBlocks(pindexBest, uint256(0));
}
// Resend wallet transactions that haven't gotten in a block yet
// Except during reindex, importing and IBD, when old wallet
// transactions become unconfirmed and spams other nodes.
if (!fReindex && !fImporting && !IsInitialBlockDownload())
{
ResendWalletTransactions();
}
// Address refresh broadcast
static int64 nLastRebroadcast;
if (!IsInitialBlockDownload() && (GetTime() - nLastRebroadcast > 24 * 60 * 60))
{
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
// Periodically clear setAddrKnown to allow refresh broadcasts
if (nLastRebroadcast)
pnode->setAddrKnown.clear();
// Rebroadcast our address
if (!fNoListen)
{
CAddress addr = GetLocalAddress(&pnode->addr);
if (addr.IsRoutable())
pnode->PushAddress(addr);
}
}
}
nLastRebroadcast = GetTime();
}
//
// Message: addr
//
if (fSendTrickle)
{
vector<CAddress> vAddr;
vAddr.reserve(pto->vAddrToSend.size());
BOOST_FOREACH(const CAddress& addr, pto->vAddrToSend)
{
// returns true if wasn't already contained in the set
if (pto->setAddrKnown.insert(addr).second)
{
vAddr.push_back(addr);
// receiver rejects addr messages larger than 1000
if (vAddr.size() >= 1000)
{
pto->PushMessage("addr", vAddr);
vAddr.clear();
}
}
}
pto->vAddrToSend.clear();
if (!vAddr.empty())
pto->PushMessage("addr", vAddr);
}
//
// Message: inventory
//
vector<CInv> vInv;
vector<CInv> vInvWait;
{
LOCK(pto->cs_inventory);
vInv.reserve(pto->vInventoryToSend.size());
vInvWait.reserve(pto->vInventoryToSend.size());
BOOST_FOREACH(const CInv& inv, pto->vInventoryToSend)
{
if (pto->setInventoryKnown.count(inv))
continue;
// trickle out tx inv to protect privacy
if (inv.type == MSG_TX && !fSendTrickle)
{
// 1/4 of tx invs blast to all immediately
static uint256 hashSalt;
if (hashSalt == 0)
hashSalt = GetRandHash();
uint256 hashRand = inv.hash ^ hashSalt;
hashRand = Hash2(BEGIN(hashRand), END(hashRand));
bool fTrickleWait = ((hashRand & 3) != 0);
// always trickle our own transactions
if (!fTrickleWait)
{
CWalletTx wtx;
if (GetTransaction(inv.hash, wtx))
if (wtx.fFromMe)
fTrickleWait = true;
}
if (fTrickleWait)
{
vInvWait.push_back(inv);
continue;
}
}
// returns true if wasn't already contained in the set
if (pto->setInventoryKnown.insert(inv).second)
{
vInv.push_back(inv);
if (vInv.size() >= 1000)
{
pto->PushMessage("inv", vInv);
vInv.clear();
}
}
}
pto->vInventoryToSend = vInvWait;
}
if (!vInv.empty())
pto->PushMessage("inv", vInv);
//
// Message: getdata
//
vector<CInv> vGetData;
int64 nNow = GetTime() * 1000000;
while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow)
{
const CInv& inv = (*pto->mapAskFor.begin()).second;
if (!AlreadyHave(inv))
{
if (fDebugNet)
printf("sending getdata: %s\n", inv.ToString().c_str());
vGetData.push_back(inv);
if (vGetData.size() >= 1000)
{
pto->PushMessage("getdata", vGetData);
vGetData.clear();
}
}
pto->mapAskFor.erase(pto->mapAskFor.begin());
}
if (!vGetData.empty())
pto->PushMessage("getdata", vGetData);
}
return true;
}
//////////////////////////////////////////////////////////////////////////////
//
// BitcoinMiner
//
int static FormatHashBlocks(void* pbuffer, unsigned int len)
{
unsigned char* pdata = (unsigned char*)pbuffer;
unsigned int blocks = 1 + ((len + 8) / 64);
unsigned char* pend = pdata + 64 * blocks;
memset(pdata + len, 0, 64 * blocks - len);
pdata[len] = 0x80;
unsigned int bits = len * 8;
pend[-1] = (bits >> 0) & 0xff;
pend[-2] = (bits >> 8) & 0xff;
pend[-3] = (bits >> 16) & 0xff;
pend[-4] = (bits >> 24) & 0xff;
return blocks;
}
static const unsigned int pSHA256InitState[8] =
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
void SHA256Transform(void* pstate, void* pinput, const void* pinit)
{
SHA256_CTX ctx;
unsigned char data[64];
SHA256_Init(&ctx);
for (int i = 0; i < 16; i++)
((uint32_t*)data)[i] = ByteReverse(((uint32_t*)pinput)[i]);
for (int i = 0; i < 8; i++)
ctx.h[i] = ((uint32_t*)pinit)[i];
SHA256_Update(&ctx, data, sizeof(data));
for (int i = 0; i < 8; i++)
((uint32_t*)pstate)[i] = ctx.h[i];
}
//
// ScanHash scans nonces looking for a hash with at least some zero bits.
// It operates on big endian data. Caller does the byte reversing.
// All input buffers are 16-byte aligned. nNonce is usually preserved
// between calls, but periodically or if nNonce is 0xffff0000 or above,
// the block is rebuilt and nNonce starts over at zero.
//
/*
unsigned int static ScanHash_CryptoPP(char* pmidstate, char* pdata, char* phash1, char* phash, unsigned int& nHashesDone)
{
unsigned int& nNonce = *(unsigned int*)(pdata + 12);
for (;;)
{
// Crypto++ SHA256
// Hash pdata using pmidstate as the starting state into
// pre-formatted buffer phash1, then hash phash1 into phash
nNonce++;
SHA256Transform(phash1, pdata, pmidstate);
SHA256Transform(phash, phash1, pSHA256InitState);
// Return the nonce if the hash has at least some zero bits,
// caller will check if it has enough to reach the target
if (((unsigned short*)phash)[14] == 0)
return nNonce;
// If nothing found after trying for a while, return -1
if ((nNonce & 0xffff) == 0)
{
nHashesDone = 0xffff+1;
return (unsigned int) -1;
}
if ((nNonce & 0xfff) == 0)
boost::this_thread::interruption_point();
}
}
*/
// Some explaining would be appreciated
class COrphan
{
public:
CTransaction* ptx;
set<uint256> setDependsOn;
double dPriority;
double dFeePerKb;
COrphan(CTransaction* ptxIn)
{
ptx = ptxIn;
dPriority = dFeePerKb = 0;
}
void print() const
{
printf("COrphan(hash=%s, dPriority=%.1f, dFeePerKb=%.1f)\n",
ptx->GetHash().ToString().c_str(), dPriority, dFeePerKb);
BOOST_FOREACH(uint256 hash, setDependsOn)
printf(" setDependsOn %s\n", hash.ToString().c_str());
}
};
uint64 nLastBlockTx = 0;
uint64 nLastBlockSize = 0;
// We want to sort transactions by priority and fee, so:
typedef boost::tuple<double, double, CTransaction*> TxPriority;
class TxPriorityCompare
{
bool byFee;
public:
TxPriorityCompare(bool _byFee) : byFee(_byFee) { }
bool operator()(const TxPriority& a, const TxPriority& b)
{
if (byFee)
{
if (a.get<1>() == b.get<1>())
return a.get<0>() < b.get<0>();
return a.get<1>() < b.get<1>();
}
else
{
if (a.get<0>() == b.get<0>())
return a.get<1>() < b.get<1>();
return a.get<0>() < b.get<0>();
}
}
};
CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
{
// Create new block
auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
if(!pblocktemplate.get())
return NULL;
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
// Create coinbase tx
CTransaction txNew;
txNew.vin.resize(1);
txNew.vin[0].prevout.SetNull();
txNew.vout.resize(1);
CPubKey pubkey;
if (!reservekey.GetReservedKey(pubkey))
return NULL;
txNew.vout[0].scriptPubKey << pubkey << OP_CHECKSIG;
// Add our coinbase tx as first transaction
pblock->vtx.push_back(txNew);
pblocktemplate->vTxFees.push_back(-1); // updated at end
pblocktemplate->vTxSigOps.push_back(-1); // updated at end
// Largest block you're willing to create:
unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE_GEN/2);
// Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity:
nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(MAX_BLOCK_SIZE-1000), nBlockMaxSize));
// Special compatibility rule before 15 May: limit size to 500,000 bytes:
// if (GetAdjustedTime() < 1368576000)
// nBlockMaxSize = std::min(nBlockMaxSize, (unsigned int)(MAX_BLOCK_SIZE_GEN));
// How much of the block should be dedicated to high-priority transactions,
// included regardless of the fees they pay
unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", 27000);
nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize);
// Minimum block size you want to create; block will be filled with free transactions
// until there are no more or the block reaches this size:
unsigned int nBlockMinSize = GetArg("-blockminsize", 0);
nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
// Collect memory pool transactions into the block
int64 nFees = 0;
{
LOCK2(cs_main, mempool.cs);
CBlockIndex* pindexPrev = pindexBest;
CCoinsViewCache view(*pcoinsTip, true);
// Priority order to process transactions
list<COrphan> vOrphan; // list memory doesn't move
map<uint256, vector<COrphan*> > mapDependers;
bool fPrintPriority = GetBoolArg("-printpriority");
// This vector will be sorted into a priority queue:
vector<TxPriority> vecPriority;
vecPriority.reserve(mempool.mapTx.size());
for (map<uint256, CTransaction>::iterator mi = mempool.mapTx.begin(); mi != mempool.mapTx.end(); ++mi)
{
CTransaction& tx = (*mi).second;
if (tx.IsCoinBase() || !tx.IsFinal())
continue;
COrphan* porphan = NULL;
double dPriority = 0;
int64 nTotalIn = 0;
bool fMissingInputs = false;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
// Read prev transaction
if (!view.HaveCoins(txin.prevout.hash))
{
// This should never happen; all transactions in the memory
// pool should connect to either transactions in the chain
// or other transactions in the memory pool.
if (!mempool.mapTx.count(txin.prevout.hash))
{
printf("ERROR: mempool transaction missing input\n");
if (fDebug) assert("mempool transaction missing input" == 0);
fMissingInputs = true;
if (porphan)
vOrphan.pop_back();
break;
}
// Has to wait for dependencies
if (!porphan)
{
// Use list for automatic deletion
vOrphan.push_back(COrphan(&tx));
porphan = &vOrphan.back();
}
mapDependers[txin.prevout.hash].push_back(porphan);
porphan->setDependsOn.insert(txin.prevout.hash);
nTotalIn += mempool.mapTx[txin.prevout.hash].vout[txin.prevout.n].nValue;
continue;
}
const CCoins &coins = view.GetCoins(txin.prevout.hash);
int64 nValueIn = coins.vout[txin.prevout.n].nValue;
nTotalIn += nValueIn;
int nConf = pindexPrev->nHeight - coins.nHeight + 1;
dPriority += (double)nValueIn * nConf;
}
if (fMissingInputs) continue;
// Priority is sum(valuein * age) / txsize
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
dPriority /= nTxSize;
// This is a more accurate fee-per-kilobyte than is used by the client code, because the
// client code rounds up the size to the nearest 1K. That's good, because it gives an
// incentive to create smaller transactions.
double dFeePerKb = double(nTotalIn-tx.GetValueOut()) / (double(nTxSize)/1000.0);
if (porphan)
{
porphan->dPriority = dPriority;
porphan->dFeePerKb = dFeePerKb;
}
else
vecPriority.push_back(TxPriority(dPriority, dFeePerKb, &(*mi).second));
}
// Collect transactions into block
uint64 nBlockSize = 1000;
uint64 nBlockTx = 0;
int nBlockSigOps = 100;
bool fSortedByFee = (nBlockPrioritySize <= 0);
TxPriorityCompare comparer(fSortedByFee);
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
while (!vecPriority.empty())
{
// Take highest priority transaction off the priority queue:
double dPriority = vecPriority.front().get<0>();
double dFeePerKb = vecPriority.front().get<1>();
CTransaction& tx = *(vecPriority.front().get<2>());
std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer);
vecPriority.pop_back();
// Size limits
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
if (nBlockSize + nTxSize >= nBlockMaxSize)
continue;
// Legacy limits on sigOps:
unsigned int nTxSigOps = tx.GetLegacySigOpCount();
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
continue;
// Skip free transactions if we're past the minimum block size:
if (fSortedByFee && (dFeePerKb < CTransaction::nMinTxFee) && (nBlockSize + nTxSize >= nBlockMinSize))
continue;
// Prioritize by fee once past the priority size or we run out of high-priority
// transactions:
if (!fSortedByFee &&
((nBlockSize + nTxSize >= nBlockPrioritySize) || (dPriority < COIN * 144 / 250)))
{
fSortedByFee = true;
comparer = TxPriorityCompare(fSortedByFee);
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
}
if (!tx.HaveInputs(view))
continue;
int64 nTxFees = tx.GetValueIn(view)-tx.GetValueOut();
nTxSigOps += tx.GetP2SHSigOpCount(view);
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
continue;
CValidationState state;
if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH))
continue;
CTxUndo txundo;
uint256 hash = tx.GetHash();
tx.UpdateCoins(state, view, txundo, pindexPrev->nHeight+1, hash);
// Added
pblock->vtx.push_back(tx);
pblocktemplate->vTxFees.push_back(nTxFees);
pblocktemplate->vTxSigOps.push_back(nTxSigOps);
nBlockSize += nTxSize;
++nBlockTx;
nBlockSigOps += nTxSigOps;
nFees += nTxFees;
if (fPrintPriority)
{
printf("priority %.1f feeperkb %.1f txid %s\n",
dPriority, dFeePerKb, tx.GetHash().ToString().c_str());
}
// Add transactions that depend on this one to the priority queue
if (mapDependers.count(hash))
{
BOOST_FOREACH(COrphan* porphan, mapDependers[hash])
{
if (!porphan->setDependsOn.empty())
{
porphan->setDependsOn.erase(hash);
if (porphan->setDependsOn.empty())
{
vecPriority.push_back(TxPriority(porphan->dPriority, porphan->dFeePerKb, porphan->ptx));
std::push_heap(vecPriority.begin(), vecPriority.end(), comparer);
}
}
}
}
}
nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize;
printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize);
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
pblock->UpdateTime(pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock);
pblock->nNonce = 0;
// Calculate nVvalue dependet nBits
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees, pblock->nBits);
pblocktemplate->vTxFees[0] = -nFees;
pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
pblocktemplate->vTxSigOps[0] = pblock->vtx[0].GetLegacySigOpCount();
CBlockIndex indexDummy(*pblock);
indexDummy.pprev = pindexPrev;
indexDummy.nHeight = pindexPrev->nHeight + 1;
CCoinsViewCache viewNew(*pcoinsTip, true);
CValidationState state;
if (!pblock->ConnectBlock(state, &indexDummy, viewNew, true))
throw std::runtime_error("CreateNewBlock() : ConnectBlock failed");
}
return pblocktemplate.release();
}
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce)
{
// Update nExtraNonce
static uint256 hashPrevBlock;
if (hashPrevBlock != pblock->hashPrevBlock)
{
nExtraNonce = 0;
hashPrevBlock = pblock->hashPrevBlock;
}
++nExtraNonce;
unsigned int nHeight = pindexPrev->nHeight+1; // Height first in coinbase required for block.version=2
pblock->vtx[0].vin[0].scriptSig = (CScript() << nHeight << CBigNum(nExtraNonce)) + COINBASE_FLAGS;
assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100);
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
}
void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1)
{
//
// Pre-build hash buffers
//
struct
{
struct unnamed2
{
int nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
unsigned int nTime;
unsigned int nBits;
unsigned int nNonce;
}
block;
unsigned char pchPadding0[64];
uint256 hash1;
unsigned char pchPadding1[64];
}
tmp;
memset(&tmp, 0, sizeof(tmp));
tmp.block.nVersion = pblock->nVersion;
tmp.block.hashPrevBlock = pblock->hashPrevBlock;
tmp.block.hashMerkleRoot = pblock->hashMerkleRoot;
tmp.block.nTime = pblock->nTime;
tmp.block.nBits = pblock->nBits;
tmp.block.nNonce = pblock->nNonce;
FormatHashBlocks(&tmp.block, sizeof(tmp.block));
FormatHashBlocks(&tmp.hash1, sizeof(tmp.hash1));
// Byte swap all the input buffer
for (unsigned int i = 0; i < sizeof(tmp)/4; i++)
((unsigned int*)&tmp)[i] = ByteReverse(((unsigned int*)&tmp)[i]);
// Precalc the first half of the first hash, which stays constant
SHA256Transform(pmidstate, &tmp.block, pSHA256InitState);
memcpy(pdata, &tmp.block, 128);
memcpy(phash1, &tmp.hash1, 64);
}
bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
{
uint256 hash = pblock->GetHash();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
if (hash > hashTarget)
return false;
//// debug print
printf("BitCrystalMiner:\n");
printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());
pblock->print();
printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str());
// Found a solution
{
LOCK(cs_main);
if (pblock->hashPrevBlock != hashBestChain)
return error("BitCrystalMiner : generated block is stale");
// Remove key from key pool
reservekey.KeepKey();
// Track how many getdata requests this block gets
{
LOCK(wallet.cs_wallet);
wallet.mapRequestCount[pblock->GetHash()] = 0;
}
// Process this block the same as if we had received it from another node
CValidationState state;
if (!ProcessBlock(state, NULL, pblock))
return error("BitCrystalMiner : ProcessBlock, block not accepted");
}
return true;
}
void static BitcoinMiner(CWallet *pwallet)
{
printf("BitCrystalMiner started\n");
SetThreadPriority(THREAD_PRIORITY_LOWEST);
RenameThread("bitcrystal-miner");
// Each thread has its own key and counter
CReserveKey reservekey(pwallet);
unsigned int nExtraNonce = 0;
try { loop {
// disable in testing
while (vNodes.empty())
MilliSleep(1000);
//printf("Step after sleep\n");
// wait for chain to download
while (pindexBest->nHeight + 1000 < Checkpoints::GetTotalBlocksEstimate())
{
boost::this_thread::interruption_point();
MilliSleep(50);
}
printf("Step after sleep\n");
//
// Create new block
//
unsigned int nTransactionsUpdatedLast = nTransactionsUpdated;
CBlockIndex* pindexPrev = pindexBest;
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(reservekey));
if (!pblocktemplate.get())
return;
CBlock *pblock = &pblocktemplate->block;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
printf("Running BitCrystalMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
//
// Pre-build hash buffers
//
/*
char pmidstatebuf[32+16]; char* pmidstate = alignup<16>(pmidstatebuf);
char pdatabuf[128+16]; char* pdata = alignup<16>(pdatabuf);
char phash1buf[64+16]; char* phash1 = alignup<16>(phash1buf);
FormatHashBuffers(pblock, pmidstate, pdata, phash1);
unsigned int& nBlockTime = *(unsigned int*)(pdata + 64 + 4);
unsigned int& nBlockBits = *(unsigned int*)(pdata + 64 + 8);
unsigned int& nBlockNonce = *(unsigned int*)(pdata + 64 + 12);
*/
//
// Search
//
/*
int64 nStart = GetTime();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hashbuf[2];
uint256& hash = *alignup<16>(hashbuf);
*/
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
int64 nStart = GetTime();
uint256 hash;
// unsigned int nHashesDone = 0;
loop
{
// unsigned int nNonceFound;
hash = pblock->GetHash();
if (hash <= hashTarget){
// nHashesDone += pblock->nNonce;
SetThreadPriority(THREAD_PRIORITY_NORMAL);
printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());
pblock->print();
CheckWork(pblock, *pwalletMain, reservekey);
SetThreadPriority(THREAD_PRIORITY_LOWEST);
break;
}
++pblock->nNonce;
// Meter hashes/sec
static int64 nHashCounter;
if (nHPSTimerStart == 0)
{
nHPSTimerStart = GetTimeMillis();
nHashCounter = 0;
}
else
// nHashCounter += nHashesDone;
nHashCounter += 1;
if (GetTimeMillis() - nHPSTimerStart > 4000)
{
static CCriticalSection cs;
{
LOCK(cs);
if (GetTimeMillis() - nHPSTimerStart > 4000)
{
dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nHPSTimerStart);
nHPSTimerStart = GetTimeMillis();
nHashCounter = 0;
//static int64 nLogTime;
//if (GetTime() - nLogTime > 30 * 60)
//{
// nLogTime = GetTime();
printf("hashmeter %6.0f khash/s\n", dHashesPerSec/1000.0);
//}
}
}
}
// Check for stop or if block needs to be rebuilt
boost::this_thread::interruption_point();
// disable in testing
if (vNodes.empty())
break;
if (++pblock->nNonce >= 0xffff0000)
break;
if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
break;
if (pindexPrev != pindexBest)
break;
// Update nTime every few seconds
pblock->UpdateTime(pindexPrev);
//nBlockTime = ByteReverse(pblock->nTime);
if (fTestNet)
{
// Changing pblock->nTime can change work required on testnet:
//nBlockBits = ByteReverse(pblock->nBits);
hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
}
}
} }
catch (boost::thread_interrupted)
{
printf("BitCrystalMiner terminated\n");
throw;
}
}
void GenerateBitcoins(bool fGenerate, int nThreads, CWallet* pwallet)
{
static boost::thread_group* minerThreads = NULL;
//int nThreads = GetArg("-genproclimit", -1);
if (nThreads < 0)
nThreads = boost::thread::hardware_concurrency();
if (minerThreads != NULL)
{
minerThreads->interrupt_all();
delete minerThreads;
minerThreads = NULL;
}
if (nThreads == 0 || !fGenerate)
return;
minerThreads = new boost::thread_group();
for (int i = 0; i < nThreads; i++)
minerThreads->create_thread(boost::bind(&BitcoinMiner, pwallet));
}
void GenerateBitcoins(bool fGenerate, CWallet* pwallet)
{
int nThreads = GetArg("-genproclimit", -1);
GenerateBitcoins(fGenerate, nThreads, pwallet);
}
// Amount compression:
// * If the amount is 0, output 0
// * first, divide the amount (in base units) by the largest power of 10 possible; call the exponent e (e is max 9)
// * if e<9, the last digit of the resulting number cannot be 0; store it as d, and drop it (divide by 10)
// * call the result n
// * output 1 + 10*(9*n + d - 1) + e
// * if e==9, we only know the resulting number is not zero, so output 1 + 10*(n - 1) + 9
// (this is decodable, as d is in [1-9] and e is in [0-9])
uint64 CTxOutCompressor::CompressAmount(uint64 n)
{
if (n == 0)
return 0;
int e = 0;
while (((n % 10) == 0) && e < 9) {
n /= 10;
e++;
}
if (e < 9) {
int d = (n % 10);
assert(d >= 1 && d <= 9);
n /= 10;
return 1 + (n*9 + d - 1)*10 + e;
} else {
return 1 + (n - 1)*10 + 9;
}
}
uint64 CTxOutCompressor::DecompressAmount(uint64 x)
{
// x = 0 OR x = 1+10*(9*n + d - 1) + e OR x = 1+10*(n - 1) + 9
if (x == 0)
return 0;
x--;
// x = 10*(9*n + d - 1) + e
int e = x % 10;
x /= 10;
uint64 n = 0;
if (e < 9) {
// x = 9*n + d - 1
int d = (x % 9) + 1;
x /= 9;
// x = n
n = x*10 + d;
} else {
n = x+1;
}
while (e) {
n *= 10;
e--;
}
return n;
}
class CMainCleanup
{
public:
CMainCleanup() {}
~CMainCleanup() {
// block headers
std::map<uint256, CBlockIndex*>::iterator it1 = mapBlockIndex.begin();
for (; it1 != mapBlockIndex.end(); it1++)
delete (*it1).second;
mapBlockIndex.clear();
// orphan blocks
std::map<uint256, CBlock*>::iterator it2 = mapOrphanBlocks.begin();
for (; it2 != mapOrphanBlocks.end(); it2++)
delete (*it2).second;
mapOrphanBlocks.clear();
// orphan transactions
std::map<uint256, CDataStream*>::iterator it3 = mapOrphanTransactions.begin();
for (; it3 != mapOrphanTransactions.end(); it3++)
delete (*it3).second;
mapOrphanTransactions.clear();
}
} instance_of_cmaincleanup;
|
bitcrystal/bitcrystal_v20
|
src/main.cpp
|
C++
|
mit
| 171,871
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// Scope for analyzer execution.
/// This scope could either be the entire compilation for all analyzers (command line build) or
/// could be scoped to a specific tree/span and/or a subset of analyzers (CompilationWithAnalyzers).
/// </summary>
internal class AnalysisScope
{
private readonly Lazy<ImmutableHashSet<DiagnosticAnalyzer>> _lazyAnalyzersSet;
public SourceOrAdditionalFile? FilterFileOpt { get; }
public TextSpan? FilterSpanOpt { get; }
public ImmutableArray<DiagnosticAnalyzer> Analyzers { get; }
/// <summary>
/// Syntax trees on which we need to perform syntax analysis.
/// </summary>
public IEnumerable<SyntaxTree> SyntaxTrees { get; }
/// <summary>
/// Non-source files on which we need to perform analysis.
/// </summary>
public IEnumerable<AdditionalText> AdditionalFiles { get; }
public bool ConcurrentAnalysis { get; }
/// <summary>
/// True if we need to categorize diagnostics into local and non-local diagnostics and track the analyzer reporting each diagnostic.
/// </summary>
public bool CategorizeDiagnostics { get; }
/// <summary>
/// True if we need to perform only syntax analysis for a single source or additional file.
/// </summary>
public bool IsSyntacticSingleFileAnalysis { get; }
/// <summary>
/// True if we need to perform analysis for a single source or additional file.
/// </summary>
public bool IsSingleFileAnalysis => FilterFileOpt != null;
/// <summary>
/// Flag indicating if this is a partial analysis for the corresponding <see cref="CompilationWithAnalyzers"/>,
/// i.e. <see cref="IsSingleFileAnalysis"/> is true and/or <see cref="Analyzers"/> is a subset of <see cref="CompilationWithAnalyzers.Analyzers"/>.
/// </summary>
public bool IsPartialAnalysis { get; }
public AnalysisScope(Compilation compilation, AnalyzerOptions? analyzerOptions, ImmutableArray<DiagnosticAnalyzer> analyzers, bool hasAllAnalyzers, bool concurrentAnalysis, bool categorizeDiagnostics)
: this(compilation.SyntaxTrees, analyzerOptions?.AdditionalFiles ?? ImmutableArray<AdditionalText>.Empty,
analyzers, isPartialAnalysis: !hasAllAnalyzers, filterFile: null, filterSpanOpt: null, isSyntacticSingleFileAnalysis: false, concurrentAnalysis: concurrentAnalysis, categorizeDiagnostics: categorizeDiagnostics)
{
}
public AnalysisScope(ImmutableArray<DiagnosticAnalyzer> analyzers, SourceOrAdditionalFile filterFile, TextSpan? filterSpan, bool isSyntacticSingleFileAnalysis, bool concurrentAnalysis, bool categorizeDiagnostics)
: this(filterFile.SourceTree != null ? SpecializedCollections.SingletonEnumerable(filterFile.SourceTree) : SpecializedCollections.EmptyEnumerable<SyntaxTree>(),
filterFile.AdditionalFile != null ? SpecializedCollections.SingletonEnumerable(filterFile.AdditionalFile) : SpecializedCollections.EmptyEnumerable<AdditionalText>(),
analyzers, isPartialAnalysis: true, filterFile, filterSpan, isSyntacticSingleFileAnalysis, concurrentAnalysis, categorizeDiagnostics)
{
}
private AnalysisScope(IEnumerable<SyntaxTree> trees, IEnumerable<AdditionalText> additionalFiles, ImmutableArray<DiagnosticAnalyzer> analyzers, bool isPartialAnalysis, SourceOrAdditionalFile? filterFile, TextSpan? filterSpanOpt, bool isSyntacticSingleFileAnalysis, bool concurrentAnalysis, bool categorizeDiagnostics)
{
Debug.Assert(isPartialAnalysis || FilterFileOpt == null);
Debug.Assert(isPartialAnalysis || FilterSpanOpt == null);
Debug.Assert(isPartialAnalysis || !isSyntacticSingleFileAnalysis);
SyntaxTrees = trees;
AdditionalFiles = additionalFiles;
Analyzers = analyzers;
IsPartialAnalysis = isPartialAnalysis;
FilterFileOpt = filterFile;
FilterSpanOpt = filterSpanOpt;
IsSyntacticSingleFileAnalysis = isSyntacticSingleFileAnalysis;
ConcurrentAnalysis = concurrentAnalysis;
CategorizeDiagnostics = categorizeDiagnostics;
_lazyAnalyzersSet = new Lazy<ImmutableHashSet<DiagnosticAnalyzer>>(CreateAnalyzersSet);
}
private ImmutableHashSet<DiagnosticAnalyzer> CreateAnalyzersSet() => Analyzers.ToImmutableHashSet();
public bool Contains(DiagnosticAnalyzer analyzer)
{
if (!IsPartialAnalysis)
{
Debug.Assert(_lazyAnalyzersSet.Value.Contains(analyzer));
return true;
}
return _lazyAnalyzersSet.Value.Contains(analyzer);
}
public AnalysisScope WithAnalyzers(ImmutableArray<DiagnosticAnalyzer> analyzers, bool hasAllAnalyzers)
{
var isPartialAnalysis = IsSingleFileAnalysis || !hasAllAnalyzers;
return new AnalysisScope(SyntaxTrees, AdditionalFiles, analyzers, isPartialAnalysis, FilterFileOpt, FilterSpanOpt, IsSyntacticSingleFileAnalysis, ConcurrentAnalysis, CategorizeDiagnostics);
}
public static bool ShouldSkipSymbolAnalysis(SymbolDeclaredCompilationEvent symbolEvent)
{
// Skip symbol actions for implicitly declared symbols and non-source symbols.
return symbolEvent.Symbol.IsImplicitlyDeclared || symbolEvent.DeclaringSyntaxReferences.All(s => s.SyntaxTree == null);
}
public static bool ShouldSkipDeclarationAnalysis(ISymbol symbol)
{
// Skip syntax actions for implicitly declared symbols, except for implicitly declared global namespace symbols.
return symbol.IsImplicitlyDeclared &&
!((symbol.Kind == SymbolKind.Namespace && ((INamespaceSymbol)symbol).IsGlobalNamespace));
}
public bool ShouldAnalyze(SyntaxTree tree)
{
return !FilterFileOpt.HasValue || FilterFileOpt.Value.SourceTree == tree;
}
public bool ShouldAnalyze(AdditionalText file)
{
return !FilterFileOpt.HasValue || FilterFileOpt.Value.AdditionalFile == file;
}
public bool ShouldAnalyze(ISymbol symbol)
{
if (!FilterFileOpt.HasValue)
{
return true;
}
if (FilterFileOpt.Value.SourceTree == null)
{
return false;
}
foreach (var location in symbol.Locations)
{
if (FilterFileOpt.Value.SourceTree == location.SourceTree && ShouldInclude(location.SourceSpan))
{
return true;
}
}
return false;
}
public bool ShouldAnalyze(SyntaxNode node)
{
if (!FilterFileOpt.HasValue)
{
return true;
}
if (FilterFileOpt.Value.SourceTree == null)
{
return false;
}
return ShouldInclude(node.FullSpan);
}
private bool ShouldInclude(TextSpan filterSpan)
{
return !FilterSpanOpt.HasValue || FilterSpanOpt.Value.IntersectsWith(filterSpan);
}
public bool ContainsSpan(TextSpan filterSpan)
{
return !FilterSpanOpt.HasValue || FilterSpanOpt.Value.Contains(filterSpan);
}
public bool ShouldInclude(Diagnostic diagnostic)
{
if (!FilterFileOpt.HasValue)
{
return true;
}
if (diagnostic.Location.IsInSource)
{
if (diagnostic.Location.SourceTree != FilterFileOpt.Value.SourceTree)
{
return false;
}
}
else if (diagnostic.Location is ExternalFileLocation externalFileLocation)
{
if (FilterFileOpt.Value.AdditionalFile == null ||
!PathUtilities.Comparer.Equals(externalFileLocation.FilePath, FilterFileOpt.Value.AdditionalFile.Path))
{
return false;
}
}
return ShouldInclude(diagnostic.Location.SourceSpan);
}
}
}
|
jmarolf/roslyn
|
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisScope.cs
|
C#
|
mit
| 8,878
|
import * as React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="m12 17.27l4.15 2.51c.76.46 1.69-.22 1.49-1.08l-1.1-4.72 3.67-3.18c.67-.58.31-1.68-.57-1.75l-4.83-.41-1.89-4.46c-.34-.81-1.5-.81-1.84 0L9.19 8.63l-4.83.41c-.88.07-1.24 1.17-.57 1.75l3.67 3.18-1.1 4.72c-.2.86.73 1.54 1.49 1.08l4.15-2.5z" />
, 'StarRounded');
|
callemall/material-ui
|
packages/material-ui-icons/fixtures/material-design-icons/expected/StarRounded.js
|
JavaScript
|
mit
| 382
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MIMWebClient.Core.Item;
using MIMWebClient.Core.World.Items.MiscEQ.Light;
namespace MIMWebClient.Core.Player.Skills
{
using MIMWebClient.Core.Events;
using MIMWebClient.Core.PlayerSetup;
using MIMWebClient.Core.Room;
public class ContinualLight : Skill
{
private static bool _taskRunnning = false;
private static Item.Item _target = new Item.Item();
private static string _color = "white";
public static Skill ContinualLightSkill { get; set; }
public static void StarContinualLight(Player player, Room room, string commandOptions = "")
{
//Check if player has spell
var hasSpell = Skill.CheckPlayerHasSkill(player, ContinualLightAb().Name);
if (hasSpell == false)
{
HubContext.Instance.SendToClient("You don't know that spell.", player.HubGuid);
return;
}
var canDoSkill = Skill.CanDoSkill(player);
if (!canDoSkill)
{
return;
}
#region refactor
string[] options = commandOptions.Split(' ');
int nth = -1;
string getNth = string.Empty;
string objectToFind = String.Empty;
if (options.Length == 3)
{
objectToFind = options[2];
if (objectToFind.IndexOf('.') != -1)
{
getNth = objectToFind.Substring(0, objectToFind.IndexOf('.'));
int.TryParse(getNth, out nth);
}
}
else if (options.Length > 3)
{
objectToFind = options[2];
if (objectToFind.IndexOf('.') != -1)
{
getNth = objectToFind.Substring(0, objectToFind.IndexOf('.'));
int.TryParse(getNth, out nth);
}
_color = options[3];
}
#endregion
if (nth == 0) { nth = -1; }
_target = FindItem.Item(player.Inventory, nth, objectToFind, Item.Item.ItemLocation.Inventory);
if (_target == null && options.Length == 3)
{
_color = options[2];
}
if (ReturnColor(_color) == null)
{
HubContext.Instance.SendToClient($"{_color} is not valid, you can choose from: Blue, Red, Green, Yellow, Purple, Orange and White", player.HubGuid);
return;
}
if (!_taskRunnning && _target != null)
{
if (player.ManaPoints < ContinualLightAb().ManaCost)
{
HubContext.Instance.SendToClient("You clasp your hands together attempting to draw energy between your hands but fail", player.HubGuid);
return;
}
//TODO REfactor
player.ManaPoints -= ContinualLightAb().ManaCost;
Score.UpdateUiPrompt(player);
if (_target.itemFlags == null)
{
_target.itemFlags = new List<Item.Item.ItemFlags>();
}
if (_target.itemFlags.Contains(Item.Item.ItemFlags.glow))
{
HubContext.Instance.SendToClient("This item is already illuminated", player.HubGuid);
return;
}
var result = AvsAnLib.AvsAn.Query(_target.name);
string article = result.Article;
HubContext.Instance.SendToClient($"You grasp {article} {_target.name} between your hands which starts to shimmer a slight {_color} colour", player.HubGuid);
foreach (var character in room.players)
{
if (character != player)
{
var hisOrHer = Helpers.ReturnHisOrHers(player, character);
var roomMessage = $"{ Helpers.ReturnName(player, character, string.Empty)} grasps {article} {_target.name} between {hisOrHer} hands which starts to shimmer a slight {_color} colour";
HubContext.Instance.SendToClient(roomMessage, character.HubGuid);
}
}
Task.Run(() => DoContinualLight(player, room));
}
else
{
if (_target == null)
{
if (player.ManaPoints < ContinualLightAb().ManaCost)
{
HubContext.Instance.SendToClient("You attempt to draw energy but fail", player.HubGuid);
return;
}
//TODO REfactor
player.ManaPoints -= ContinualLightAb().ManaCost;
Score.UpdateUiPrompt(player);
HubContext.Instance.SendToClient($"You clasp your hands together forming a bright {_color} ball between them", player.HubGuid);
foreach (var character in room.players)
{
if (character != player)
{
var roomMessage = $"{ Helpers.ReturnName(player, character, string.Empty)} 's hands start to glow as they begin chanting the Continual light spell";
HubContext.Instance.SendToClient(roomMessage, character.HubGuid);
}
}
Task.Run(() => DoContinualLight(player, room));
}
}
}
private static async Task DoContinualLight(Player attacker, Room room)
{
_taskRunnning = true;
attacker.Status = Player.PlayerStatus.Busy;
await Task.Delay(500);
if (_target == null)
{
var castingTextAttacker = $"A bright {_color} ball of light is released by your hands and hovers in the air.";
HubContext.Instance.SendToClient(castingTextAttacker, attacker.HubGuid);
foreach (var character in room.players)
{
if (character != attacker)
{
var roomMessage = $"{ Helpers.ReturnName(attacker, character, string.Empty)} releases a {_color} bright ball of light which hovers in the air.";
HubContext.Instance.SendToClient(roomMessage, character.HubGuid);
}
}
var ballOfLight = Light.BallOfLight();
ballOfLight.description = new Description()
{
exam = $"A bright {_color} ball of light hovers here.",
look = $"A bright {_color} ball of light hovers here.",
room = $"A bright {_color} ball of light hovers here."
};
ballOfLight.name = $"A bright {_color} ball of light";
ballOfLight.location = Item.Item.ItemLocation.Room;
room.items.Add(ballOfLight);
}
else
{
var castingTextAttacker = $"The {_target.name} glows a bright {_color} colour.";
var castingTextRoom = $"The {_target.name} glows a bright {_color} colour.";
HubContext.Instance.SendToClient(castingTextAttacker, attacker.HubGuid);
HubContext.Instance.BroadcastToRoom(castingTextRoom, room.players, attacker.HubGuid, true);
_target.itemFlags.Add(Item.Item.ItemFlags.glow);
}
Player.SetState(attacker);
_target = null;
_taskRunnning = false;
}
private static string ReturnColor(string color)
{
var allowedColours = new List<string> { "Blue", "Red", "Green", "Yellow", "Purple", "Orange", "White" };
foreach (var allowedColor in allowedColours)
{
if (allowedColor.Equals(color, StringComparison.CurrentCultureIgnoreCase))
{
return allowedColor;
}
}
return null;
}
public static Skill ContinualLightAb()
{
var skill = new Skill
{
Name = "Continual light",
SpellGroup = SpellGroupType.Abjuration,
SkillType = Type.Spell,
CoolDown = 0,
Delay = 0,
LevelObtained = 2,
ManaCost = 10,
Passive = false,
Proficiency = 1,
MaxProficiency = 95,
UsableFromStatus = "Standing",
Syntax = " cast 'continual light' <object> / <colour>"
};
var help = new Help
{
Syntax = skill.Syntax,
HelpText = "This spell creates a white ball of light, which you can hold as a light source." +
" The ball of light will last indefinitely. It may also be used on an object" +
" to give it an enchanted glow. You may also cast a certain colour of light too. See help colour",
DateUpdated = "05/04/2017"
};
skill.HelpText = help;
return skill;
}
}
}
|
LiamKenneth/MIM
|
MIMWebClient/Core/Player/Spells/ContinualLight.cs
|
C#
|
mit
| 9,537
|
---
layout: post
title: ''
date: 2016-03-02 09:02:20.000000000 -06:00
type: post
published: true
status: publish
categories: []
tags: []
meta:
tumblr_the-travels-of-we_permalink: http://the-travels-of-we.tumblr.com/post/140323353661/teaching-today-at-the-university-of-western-cape
tumblr_the-travels-of-we_id: '140323353661'
_mk_post_love: '0'
_theme_options_build: ''
_dynamic_styles: Tjs=
author:
login: wlftn
email: laurenhaldeman@yahoo.com
display_name: lauren
first_name: Lauren
last_name: ''
---
<p>[gallery]</p>
<p>Teaching today at the University of Western Cape #IWPtoSA #IAtoSA @usconscapetown</p>
|
wlftn/wlftn.github.io
|
_posts/2016-03-02-teaching-today-at-the-university-of-western-cape.html
|
HTML
|
mit
| 629
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript" src="../../../require_config.js" id="require_config"></script>
<script type="text/javascript" src="spec_runner.js"></script>
<script type="text/javascript">
( function() {
var s = '/';
function dirname( f ) {
return f.substr( 0, f.lastIndexOf( s ) );
}
require.baseUrl = dirname( document.getElementById( 'require_config' ).src ) + s + require.baseUrl;
(laxarSpec.requireConfig = laxarSpec.requireConfig || {}).baseUrl = require.baseUrl;
var requirePath = require.baseUrl + s + require.paths.requirejs;
var jasminePath = require.baseUrl + s + require.paths.jasmine;
document.writeln( '<link type="text/css" rel="stylesheet" href="' + jasminePath + '.css"></link>' );
document.writeln( '<link type="image/png" rel="shortcut icon" href="' + jasminePath + '_favicon.png"></link>' );
document.writeln( '<script type="text/javascript" src="' + jasminePath + '.js"><' + '/script>' );
document.writeln( '<script type="text/javascript" src="' + jasminePath + '-html.js"><' + '/script>' );
document.writeln( '<script type="text/javascript" src="' + requirePath + '.js"><' + '/script>' );
} )();
</script>
<script type="text/javascript">
require.config( laxarSpec.requireConfig );
require( [
'laxar/lib/testing/testing'
], function( testing ) {
testing.runSpec( laxarSpec );
} );
</script>
</head>
<body></body>
</html>
|
jpommerening/laxar
|
lib/profiling/spec/spec_runner.html
|
HTML
|
mit
| 1,654
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GAPPSF.Utils;
namespace GAPPSF.OKAPI
{
public class Convert
{
public static Core.Data.Geocache AddGeocache(Core.Storage.Database db, OKAPIService.Geocache gc)
{
Core.Data.Geocache result = null;
if (gc != null)
{
result = db.GeocacheCollection.GetGeocache(gc.code);
Core.Data.IGeocacheData gcData;
if (result == null)
{
gcData = new Core.Data.GeocacheData();
gcData.Code = gc.code;
}
else
{
gcData = result;
}
gcData.Archived = gc.status == "Archived";
gcData.Available = gc.status == "Available";
if (result == null || !result.Locked)
{
gcData.DataFromDate = DateTime.Now;
List<int> attris = new List<int>();
foreach (string at in gc.attr_acodes)
{
int code = OKAPIService.MapAttributeACodeToAttributeID(at);
if (code > 0)
{
attris.Add(code);
}
}
gcData.AttributeIds = attris;
// 'none', 'nano', 'micro', 'small', 'regular', 'large', 'xlarge', 'other'
// we chose to map the containers
if (gc.size2 == "none")
{
gcData.Container = Utils.DataAccess.GetGeocacheContainer(5);
}
else if (gc.size2 == "micro" || gc.size2 == "nano")
{
gcData.Container = Utils.DataAccess.GetGeocacheContainer(2);
}
else if (gc.size2 == "small")
{
gcData.Container = Utils.DataAccess.GetGeocacheContainer(8);
}
else if (gc.size2 == "regular")
{
gcData.Container = Utils.DataAccess.GetGeocacheContainer(3);
}
else if (gc.size2 == "large" || gc.size2 == "xlarge")
{
gcData.Container = Utils.DataAccess.GetGeocacheContainer(4);
}
else
{
gcData.Container = Utils.DataAccess.GetGeocacheContainer(6);
}
gcData.Country = gc.country ?? "";
gcData.Difficulty = gc.difficulty;
gcData.EncodedHints = gc.hint2;
gcData.Found = gc.is_found;
if (gc.type.ToLower().Contains("traditional"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96001);
}
else if (gc.type.ToLower().Contains("multi"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96002);
}
else if (gc.type.ToLower().Contains("quiz") || gc.type.ToLower().Contains("puzzle"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96008);
}
else if (gc.type.ToLower().Contains("virtual"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96003);
}
else if (gc.type.ToLower().Contains("event"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96004);
}
else if (gc.type.ToLower().Contains("webcam"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96006);
}
else if (gc.type.ToLower().Contains("location") || gc.type.Contains("moving"))
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96007);
}
else
{
gcData.GeocacheType = Utils.DataAccess.GetGeocacheType(96005);
}
gcData.Lat = Utils.Conversion.StringToDouble(gc.location.Substring(0, gc.location.IndexOf('|')));
gcData.Lon = Utils.Conversion.StringToDouble(gc.location.Substring(gc.location.IndexOf('|') + 1));
gcData.LongDescription = gc.description;
gcData.LongDescriptionInHtml = true;
gcData.Name = gc.name;
gcData.Owner = gc.owner.username;
gcData.OwnerId = gc.owner.uuid;
gcData.PlacedBy = gc.owner.username;
gcData.PublishedTime = DateTime.Parse(gc.date_hidden);
gcData.ShortDescription = "";
gcData.ShortDescriptionInHtml = true;
gcData.State = gc.state ?? "";
gcData.Terrain = gc.terrain;
gcData.Url = gc.url ?? "";
if (gcData is Core.Data.GeocacheData)
{
if (Utils.DataAccess.AddGeocache(db, gcData as Core.Data.GeocacheData))
{
result = db.GeocacheCollection.GetGeocache(gcData.Code);
}
else
{
result = null;
}
}
if (result != null)
{
Calculus.SetDistanceAndAngleGeocacheFromLocation(result, Core.ApplicationData.Instance.CenterLocation);
}
}
}
return result;
}
public static Core.Data.Log AddLog(Core.Storage.Database db, OKAPIService.Log lg, string finder, string finderId)
{
Core.Data.Log result = null;
if (lg != null)
{
result = db.LogCollection.GetLog(lg.uuid);
Core.Data.ILogData lgData;
if (result == null)
{
lgData = new Core.Data.LogData();
lgData.ID = lg.uuid;
}
else
{
lgData = result;
}
lgData.DataFromDate = DateTime.Now;
lgData.Date = DateTime.Parse(lg.date);
lgData.Encoded = false;
if (lg.user == null)
{
lgData.Finder = finder;
lgData.FinderId = finderId;
}
else
{
lgData.Finder = lg.user.username;
lgData.FinderId = lg.user.uuid;
}
lgData.GeocacheCode = lg.cache_code;
lgData.Text = lg.comment;
lgData.LogType = Utils.DataAccess.GetLogType(lg.type);
if (lgData is Core.Data.LogData)
{
if (Utils.DataAccess.AddLog(db, lgData as Core.Data.LogData))
{
result = db.LogCollection.GetLog(lgData.ID);
}
}
}
return result;
}
public static Core.Data.Waypoint AddWaypoint(Core.Storage.Database db, OKAPIService.Waypoint wp)
{
Core.Data.Waypoint result = null;
if (wp != null)
{
result = db.WaypointCollection.GetWaypoint(wp.name);
Core.Data.IWaypointData wpd;
if (result == null)
{
wpd = new Core.Data.WaypointData();
wpd.Code = wp.name;
wpd.ID = wp.name;
}
else
{
wpd = result;
}
wpd.DataFromDate = DateTime.Now;
//for now map: parking, path, stage, physical-stage, virtual-stage, final, poi, other
if (wp.sym == "parking")
{
wpd.WPType = DataAccess.GetWaypointType(217);
}
else if (wp.sym == "path")
{
wpd.WPType = DataAccess.GetWaypointType(452);
}
else if (wp.sym == "stage" || wp.sym == "physical-stage" || wp.sym == "virtual-stage")
{
wpd.WPType = DataAccess.GetWaypointType(219);
}
else if (wp.sym == "final")
{
wpd.WPType = DataAccess.GetWaypointType(220);
}
else if (wp.sym == "poi")
{
wpd.WPType = DataAccess.GetWaypointType(452);
}
else
{
wpd.WPType = DataAccess.GetWaypointType(452);
}
wpd.Comment = wp.description;
wpd.Description = wp.description;
wpd.GeocacheCode = wp.cache_code;
wpd.Lat = Utils.Conversion.StringToDouble(wp.location.Substring(0, wp.location.IndexOf('|')));
wpd.Lon = Utils.Conversion.StringToDouble(wp.location.Substring(wp.location.IndexOf('|') + 1));
wpd.Name = wp.type_name;
wpd.Time = DateTime.Now;
wpd.Url = "";
wpd.UrlName = wp.type_name;
if (wpd is Core.Data.WaypointData)
{
if (Utils.DataAccess.AddWaypoint(db, wpd as Core.Data.WaypointData))
{
result = db.WaypointCollection.GetWaypoint(wpd.Code);
}
}
}
return result;
}
public static Core.Data.GeocacheImage AddGeocacheImage(Core.Storage.Database db, OKAPIService.GeocacheImage img, string GeocacheCode)
{
Core.Data.GeocacheImage result = null;
if (img != null)
{
result = db.GeocacheImageCollection.GetGeocacheImage(img.uuid);
Core.Data.IGeocacheImageData wpd;
if (result == null)
{
wpd = new Core.Data.GeocacheImageData();
wpd.ID = img.uuid;
}
else
{
wpd = result;
}
wpd.DataFromDate = DateTime.Now;
wpd.GeocacheCode = GeocacheCode;
wpd.Name = img.caption;
wpd.Url = img.url;
wpd.ThumbUrl = img.thumb_url;
wpd.MobileUrl = img.thumb_url;
wpd.Description = "";
if (wpd is Core.Data.GeocacheImageData)
{
if (Utils.DataAccess.AddGeocacheImage(db, wpd as Core.Data.GeocacheImageData))
{
result = db.GeocacheImageCollection.GetGeocacheImage(img.uuid);
}
}
}
return result;
}
}
}
|
RH-Code/GAPP
|
GAPPSF/OKAPI/Convert.cs
|
C#
|
mit
| 11,565
|
<?php return unserialize('a:3:{i:0;O:26:"Doctrine\\ORM\\Mapping\\Table":5:{s:4:"name";s:8:"mtx_news";s:6:"schema";N;s:7:"indexes";N;s:17:"uniqueConstraints";N;s:7:"options";a:0:{}}i:1;O:27:"Doctrine\\ORM\\Mapping\\Entity":2:{s:15:"repositoryClass";s:47:"SM\\Bundle\\AdminBundle\\Repository\\NewsRepository";s:8:"readOnly";b:0;}i:2;O:42:"Doctrine\\ORM\\Mapping\\HasLifecycleCallbacks":0:{}}');
|
githubsvn/jovial
|
app/cache/prod/annotations/SM-Bundle-AdminBundle-Entity-News.cache.php
|
PHP
|
mit
| 392
|
/**
MIT License
Copyright (c) 2017 Kola Oyewumi
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.
*/
package com.sugaronrest.restapicalls.methodcalls;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.sugaronrest.ErrorResponse;
import com.sugaronrest.restapicalls.responses.InsertEntriesResponse;
import com.sugaronrest.utils.JsonObjectMapper;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import java.util.*;
public class InsertEntries {
/**
* Creates entries [SugarCRM REST method - set_entries].
*
* @param url REST API Url.
* @param sessionId Session identifier.
* @param moduleName SugarCRM module name.
* @param entities The entity objects collection to create.
* @param selectFields Selected field list.
* @return InsertEntriesResponse object.
*/
public static InsertEntriesResponse run(String url, String sessionId, String moduleName, List<Object> entities, List<String> selectFields) {
InsertEntriesResponse insertEntriesResponse = null;
ErrorResponse errorResponse = null;
String jsonRequest = new String();
String jsonResponse = new String();
ObjectMapper mapper = JsonObjectMapper.getMapper();
try {
Map<String, Object> requestData = new LinkedHashMap<String, Object>();
requestData.put("session", sessionId);
requestData.put("module_name", moduleName);
requestData.put("name_value_list", EntitiesToNameValueList(entities, selectFields));
String jsonRequestData = mapper.writeValueAsString(requestData);
Map<String, Object> request = new LinkedHashMap<String, Object>();
request.put("method", "set_entries");
request.put("input_type", "json");
request.put("response_type", "json");
request.put("rest_data", requestData);
jsonRequest = mapper.writeValueAsString(request);
request.put("rest_data", jsonRequestData);
HttpResponse response = Unirest.post(url)
.fields(request)
.asString();
if (response == null) {
insertEntriesResponse = new InsertEntriesResponse();
errorResponse = ErrorResponse.format("An error has occurred!", "No data returned.");
insertEntriesResponse.setStatusCode(HttpStatus.SC_BAD_REQUEST);
insertEntriesResponse.setError(errorResponse);
} else {
jsonResponse = response.getBody().toString();
if (StringUtils.isNotBlank(jsonResponse)) {
// First check if we have an error
errorResponse = ErrorResponse.fromJson(jsonResponse);
if (errorResponse == null) {
insertEntriesResponse = mapper.readValue(jsonResponse, InsertEntriesResponse.class);
}
}
if (insertEntriesResponse == null) {
insertEntriesResponse = new InsertEntriesResponse();
insertEntriesResponse.setError(errorResponse);
insertEntriesResponse.setStatusCode(HttpStatus.SC_OK);
if (errorResponse != null) {
insertEntriesResponse.setStatusCode(errorResponse.getStatusCode());
}
} else {
insertEntriesResponse.setStatusCode(HttpStatus.SC_OK);
}
}
}
catch (Exception exception) {
insertEntriesResponse = new InsertEntriesResponse();
errorResponse = ErrorResponse.format(exception, exception.getMessage());
insertEntriesResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
errorResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
insertEntriesResponse.setError(errorResponse);
}
insertEntriesResponse.setJsonRawRequest(jsonRequest);
insertEntriesResponse.setJsonRawResponse(jsonResponse);
return insertEntriesResponse;
}
/**
* Formats and return selected fields.
*
* @param entities List of Java objects to update.
* @param selectFields Selected fields.
* @return Formatted selected fields.
*/
private static List<Map<String, Object>> EntitiesToNameValueList(List<Object> entities, List<String> selectFields) {
if (entities == null) {
return null;
}
List<Map<String, Object>> mappedEntities = new ArrayList<Map<String, Object>>();
boolean useSelectedFields = (selectFields != null) && (selectFields.size() > 0);
ObjectMapper mapper = JsonObjectMapper.getMapper();
for (Object entity : entities) {
Map<String, Object> tempEntity = mapper.convertValue(entity, Map.class);
Map<String, Object> mappedEntity = new HashMap<String, Object>();
for (Map.Entry<String, Object> mapEntry : tempEntity.entrySet()) {
String key = mapEntry.getKey();
if (useSelectedFields) {
if (!selectFields.contains(key)) {
continue;
}
}
if (key.equalsIgnoreCase("id")) {
continue;
}
Map<String, Object> namevalueDic = new HashMap<String, Object>();
namevalueDic.put("name", key);
namevalueDic.put("value", mapEntry.getValue());
mappedEntity.put(key, namevalueDic);
}
mappedEntities.add(mappedEntity);
}
return mappedEntities;
}
}
|
mattkol/SugarOnRest
|
sugaronrest/src/main/java/com/sugaronrest/restapicalls/methodcalls/InsertEntries.java
|
Java
|
mit
| 6,829
|
#!/usr/bin/env ruby
require 'csv'
require 'nokogiri'
require 'open-uri'
#require 'awesome_print'
require 'pg'
conn = PGconn.open(:dbname => 'baseball')
ncaa_team_schedules = conn.exec('select ts.* from ncaa_pbp.team_schedules ts left join ncaa_pbp.periods p on (ts.game_id,ts.team_id)=(p.game_id,p.team_id) where ts.team_score is not null and p.game_id is null;')
class String
def to_nil
self.empty? ? nil : self
end
end
#events = ["Leaves Game","Enters Game","Defensive Rebound","Commits Foul","made Free Throw","Assist","Turnover","missed Three Point Jumper","Offensive Rebound","missed Two Point Jumper","made Layup","missed Layup","Steal","made Two Point Jumper","made Three Point Jumper","missed Free Throw","Blocked Shot","Deadball Rebound","30 Second Timeout","Media Timeout","Team Timeout","made Dunk","20 Second Timeout","Timeout","made Tip In","missed Tip In","missed Dunk","made","missed","missed Deadball"]
base_url = 'http://stats.ncaa.org'
#base_url = 'http://anonymouse.org/cgi-bin/anon-www.cgi/stats.ncaa.org'
play_xpath = '//table[position()>1 and @class="mytable"]/tr[position()>1]'
periods_xpath = '//table[position()=1 and @class="mytable"]/tr[position()>1]'
nthreads = 10
base_sleep = 0
sleep_increment = 3
retries = 4
#ncaa_team_schedules = CSV.open("csv/ncaa_team_schedules.csv","r",{:col_sep => "\t", :headers => TRUE})
if (File.file?("csv/ncaa_games_play_by_play_mt_update.csv"))
ncaa_play_by_play = CSV.open("csv/ncaa_games_play_by_play_mt_update.csv","a",{:col_sep => "\t"})
else
ncaa_play_by_play = CSV.open("csv/ncaa_games_play_by_play_mt_update.csv","w",{:col_sep => "\t"})
ncaa_play_by_play << ["game_id","period_id","event_id","time","team_player","team_event","team_text","team_score","opponent_score","score","opponent_player","opponent_event","opponent_text"]
end
if (File.file?("csv/ncaa_games_periods_mt_update.csv"))
ncaa_periods = CSV.open("csv/ncaa_games_periods_mt_update.csv","a",{:col_sep => "\t"})
else
ncaa_periods = CSV.open("csv/ncaa_games_periods_mt_update.csv","w",{:col_sep => "\t"})
ncaa_periods << ["game_id", "section_id", "team_id", "team_name", "team_url", "period_scores"]
end
# Get game IDs
game_ids = []
ncaa_team_schedules.each do |game|
game_ids << game["game_id"]
end
# Pull each game only once
# Modify in-place, so don't chain
game_ids.compact!
game_ids.sort!
game_ids.uniq!
#game_ids = game_ids[0..199]
n = game_ids.size
gpt = (n.to_f/nthreads.to_f).ceil
threads = []
game_ids.each_slice(gpt).with_index do |ids,i|
threads << Thread.new(ids) do |t_ids|
found = 0
n_t = t_ids.size
t_ids.each_with_index do |game_id,j|
sleep_time = base_sleep
# game_url = 'http://stats.ncaa.org/game/play_by_play/%d' % [game_id]
game_url = 'http://anonymouse.org/cgi-bin/anon-www.cgi/http://stats.ncaa.org/game/play_by_play/%d' % [game_id]
print "Thread #{i}, sleep #{sleep_time} ... "
# sleep sleep_time
tries = 0
begin
page = Nokogiri::HTML(open(game_url))
rescue
sleep_time += sleep_increment
print "sleep #{sleep_time} ... "
sleep sleep_time
tries += 1
if (tries > retries)
next
else
retry
end
end
sleep_time = base_sleep
found += 1
print "#{i}, #{game_id} : #{j+1}/#{n_t}; found #{found}/#{n_t}\n"
page.xpath(play_xpath).each_with_index do |row,event_id|
table = row.parent
period_id = table.parent.xpath('table[position()>1 and @class="mytable"]').index(table)
time = row.at_xpath('td[1]').text.strip.to_nil rescue nil
team_text = row.at_xpath('td[2]').text.strip.to_nil rescue nil
score = row.at_xpath('td[3]').text.strip.to_nil rescue nil
opponent_text = row.at_xpath('td[4]').text.strip.to_nil rescue nil
team_event = nil
if not(team_text.nil?)
events.each do |e|
if (team_text =~ /#{e}$/)
team_event = e
break
end
end
end
team_player = team_text.gsub(team_event,"").strip rescue nil
opponent_event = nil
if not(opponent_text.nil?)
events.each do |e|
if (opponent_text =~ /#{e}$/)
opponent_event = e
break
end
end
end
opponent_player = opponent_text.gsub(opponent_event,"").strip rescue nil
scores = score.split('-') rescue nil
team_score = scores[0].strip rescue nil
opponent_score = scores[1].strip rescue nil
# ap [period_id,event_id,time,team_player,team_event,team_text,team_score,opponent_score,score,opponent_player,opponent_event,opponent_text]
if (time.include?('End'))
team_player = 'TEAM'
team_event = time
opponent_player = 'TEAM'
opponent_event = time
time = '00:00'
end
ncaa_play_by_play << [game_id,period_id,event_id,time,team_player,team_event,team_text,team_score,opponent_score,score,opponent_player,opponent_event,opponent_text]
end
page.xpath(periods_xpath).each_with_index do |row,section_id|
team_period_scores = []
# section = [game_id,section_id]
team_name = nil
link_url = nil
team_url = nil
team_id = nil
row.xpath('td').each_with_index do |element,i|
case i
when 0
team_name = element.text.strip rescue nil
link = element.search("a").first
if not(link.nil?)
link_url = link.attributes["href"].text
team_url = link_url.split("cgi/")[1]
parameters = link_url.split("/")[-1]
team_id = parameters.split("=")[1]
end
# section += [team_id, team_name, team_url]
else
team_period_scores += [element.text.strip.to_i]
end
end
ncaa_periods << [game_id,section_id,team_id,team_name,team_url,team_period_scores]
end
end
end
end
threads.each(&:join)
#parts.flatten(1).each { |row| ncaa_play_by_play << row }
ncaa_play_by_play.close
|
JakeRuss/baseball-public
|
ncaa_pbp/scrapers/ncaa_play_by_play_mt_update.rb
|
Ruby
|
mit
| 6,174
|
/*!
* Bootstrap v4.0.0-alpha.2 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%
}
body {
margin: 0
}
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
display: block
}
audio, canvas, progress, video {
display: inline-block;
vertical-align: baseline
}
audio:not([controls]) {
display: none;
height: 0
}
[hidden], template {
display: none
}
a {
background-color: transparent
}
a:active {
outline: 0
}
a:hover {
outline: 0
}
abbr[title] {
border-bottom: 1px dotted
}
b, strong {
font-weight: 700
}
dfn {
font-style: italic
}
h1 {
margin: .67em 0;
font-size: 2em
}
mark {
color: #000;
background: #ff0
}
small {
font-size: 80%
}
sub, sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline
}
sup {
top: -.5em
}
sub {
bottom: -.25em
}
img {
border: 0
}
svg:not(:root) {
overflow: hidden
}
figure {
margin: 1em 40px
}
hr {
height: 0;
-webkit-box-sizing: content-box;
box-sizing: content-box
}
pre {
overflow: auto
}
code, kbd, pre, samp {
font-family: monospace, monospace;
font-size: 1em
}
button, input, optgroup, select, textarea {
margin: 0;
font: inherit;
color: inherit
}
button {
overflow: visible
}
button, select {
text-transform: none
}
button, html input[type=button], input[type=reset], input[type=submit] {
-webkit-appearance: button;
cursor: pointer
}
button[disabled], html input[disabled] {
cursor: default
}
button::-moz-focus-inner, input::-moz-focus-inner {
padding: 0;
border: 0
}
input {
line-height: normal
}
input[type=checkbox], input[type=radio] {
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0
}
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
height: auto
}
input[type=search] {
-webkit-box-sizing: content-box;
box-sizing: content-box;
-webkit-appearance: textfield
}
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration {
-webkit-appearance: none
}
fieldset {
padding: .35em .625em .75em;
margin: 0 2px;
border: 1px solid silver
}
legend {
padding: 0;
border: 0
}
textarea {
overflow: auto
}
optgroup {
font-weight: 700
}
table {
border-spacing: 0;
border-collapse: collapse
}
td, th {
padding: 0
}
@media print {
*, ::after, ::before {
text-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important
}
a, a:visited {
text-decoration: underline
}
abbr[title]::after {
content: " (" attr(title) ")"
}
blockquote, pre {
border: 1px solid #999;
page-break-inside: avoid
}
thead {
display: table-header-group
}
img, tr {
page-break-inside: avoid
}
img {
max-width: 100% !important
}
h2, h3, p {
orphans: 3;
widows: 3
}
h2, h3 {
page-break-after: avoid
}
.navbar {
display: none
}
.btn > .caret, .dropup > .btn > .caret {
border-top-color: #000 !important
}
.label {
border: 1px solid #000
}
.table {
border-collapse: collapse !important
}
.table td, .table th {
background-color: #fff !important
}
.table-bordered td, .table-bordered th {
border: 1px solid #ddd !important
}
}
html {
-webkit-box-sizing: border-box;
box-sizing: border-box
}
*, ::after, ::before {
-webkit-box-sizing: inherit;
box-sizing: inherit
}
@-ms-viewport {
width: device-width
}
@viewport {
width: device-width
}
html {
font-size: 16px;
-webkit-tap-highlight-color: transparent
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 1rem;
line-height: 1.5;
color: #373a3c;
background-color: #fff
}
[tabindex="-1"]:focus {
outline: 0 !important
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: .5rem
}
p {
margin-top: 0;
margin-bottom: 1rem
}
abbr[data-original-title], abbr[title] {
cursor: help;
border-bottom: 1px dotted #818a91
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit
}
dl, ol, ul {
margin-top: 0;
margin-bottom: 1rem
}
ol ol, ol ul, ul ol, ul ul {
margin-bottom: 0
}
dt {
font-weight: 700
}
dd {
margin-bottom: .5rem;
margin-left: 0
}
blockquote {
margin: 0 0 1rem
}
a {
color: #0275d8;
text-decoration: none
}
a:focus, a:hover {
color: #014c8c;
text-decoration: underline
}
a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px
}
pre {
margin-top: 0;
margin-bottom: 1rem
}
figure {
margin: 0 0 1rem
}
img {
vertical-align: middle
}
[role=button] {
cursor: pointer
}
[role=button], a, area, button, input, label, select, summary, textarea {
-ms-touch-action: manipulation;
touch-action: manipulation
}
table {
background-color: transparent
}
caption {
padding-top: .75rem;
padding-bottom: .75rem;
color: #818a91;
text-align: left;
caption-side: bottom
}
th {
text-align: left
}
label {
display: inline-block;
margin-bottom: .5rem
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color
}
button, input, select, textarea {
margin: 0;
line-height: inherit;
border-radius: 0
}
textarea {
resize: vertical
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0
}
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit
}
input[type=search] {
-webkit-box-sizing: inherit;
box-sizing: inherit;
-webkit-appearance: none
}
output {
display: inline-block
}
[hidden] {
display: none !important
}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
margin-bottom: .5rem;
font-family: inherit;
font-weight: 500;
line-height: 1.1;
color: inherit
}
h1 {
font-size: 2.5rem
}
h2 {
font-size: 2rem
}
h3 {
font-size: 1.75rem
}
h4 {
font-size: 1.5rem
}
h5 {
font-size: 1.25rem
}
h6 {
font-size: 1rem
}
.h1 {
font-size: 2.5rem
}
.h2 {
font-size: 2rem
}
.h3 {
font-size: 1.75rem
}
.h4 {
font-size: 1.5rem
}
.h5 {
font-size: 1.25rem
}
.h6 {
font-size: 1rem
}
.lead {
font-size: 1.25rem;
font-weight: 300
}
.display-1 {
font-size: 6rem;
font-weight: 300
}
.display-2 {
font-size: 5.5rem;
font-weight: 300
}
.display-3 {
font-size: 4.5rem;
font-weight: 300
}
.display-4 {
font-size: 3.5rem;
font-weight: 300
}
hr {
margin-top: 1rem;
margin-bottom: 1rem;
border: 0;
border-top: 1px solid rgba(0, 0, 0, .1)
}
.small, small {
font-size: 80%;
font-weight: 400
}
.mark, mark {
padding: .2em;
background-color: #fcf8e3
}
.list-unstyled {
padding-left: 0;
list-style: none
}
.list-inline {
padding-left: 0;
list-style: none
}
.list-inline-item {
display: inline-block
}
.list-inline-item:not(:last-child) {
margin-right: 5px
}
.dl-horizontal {
margin-right: -1.875rem;
margin-left: -1.875rem
}
.dl-horizontal::after {
display: table;
clear: both;
content: ""
}
.initialism {
font-size: 90%;
text-transform: uppercase
}
.blockquote {
padding: .5rem 1rem;
margin-bottom: 1rem;
font-size: 1.25rem;
border-left: .25rem solid #eceeef
}
.blockquote-footer {
display: block;
font-size: 80%;
line-height: 1.5;
color: #818a91
}
.blockquote-footer::before {
content: "\2014 \00A0"
}
.blockquote-reverse {
padding-right: 1rem;
padding-left: 0;
text-align: right;
border-right: .25rem solid #eceeef;
border-left: 0
}
.blockquote-reverse .blockquote-footer::before {
content: ""
}
.blockquote-reverse .blockquote-footer::after {
content: "\00A0 \2014"
}
.carousel-inner > .carousel-item > a > img, .carousel-inner > .carousel-item > img, .img-fluid {
display: block;
max-width: 100%;
height: auto
}
.img-rounded {
border-radius: .3rem
}
.img-thumbnail {
display: inline-block;
max-width: 100%;
height: auto;
padding: .25rem;
line-height: 1.5;
background-color: #fff;
border: 1px solid #ddd;
border-radius: .25rem;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out
}
.img-circle {
border-radius: 50%
}
.figure {
display: inline-block
}
.figure-img {
margin-bottom: .5rem;
line-height: 1
}
.figure-caption {
font-size: 90%;
color: #818a91
}
code, kbd, pre, samp {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace
}
code {
padding: .2rem .4rem;
font-size: 90%;
color: #bd4147;
background-color: #f7f7f9;
border-radius: .25rem
}
kbd {
padding: .2rem .4rem;
font-size: 90%;
color: #fff;
background-color: #333;
border-radius: .2rem
}
kbd kbd {
padding: 0;
font-size: 100%;
font-weight: 700
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
font-size: 90%;
line-height: 1.5;
color: #373a3c
}
pre code {
padding: 0;
font-size: inherit;
color: inherit;
background-color: transparent;
border-radius: 0
}
.pre-scrollable {
max-height: 340px;
overflow-y: scroll
}
.container {
padding-right: .9375rem;
padding-left: .9375rem;
margin-right: auto;
margin-left: auto
}
.container::after {
display: table;
clear: both;
content: ""
}
@media (min-width: 544px) {
.container {
max-width: 576px
}
}
@media (min-width: 768px) {
.container {
max-width: 720px
}
}
@media (min-width: 992px) {
.container {
max-width: 940px
}
}
@media (min-width: 1200px) {
.container {
max-width: 1140px
}
}
.container-fluid {
padding-right: .9375rem;
padding-left: .9375rem;
margin-right: auto;
margin-left: auto
}
.container-fluid::after {
display: table;
clear: both;
content: ""
}
.row {
margin-right: -.9375rem;
margin-left: -.9375rem
}
.row::after {
display: table;
clear: both;
content: ""
}
.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
position: relative;
min-height: 1px;
padding-right: .9375rem;
padding-left: .9375rem
}
.col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
float: left
}
.col-xs-1 {
width: 8.333333%
}
.col-xs-2 {
width: 16.666667%
}
.col-xs-3 {
width: 25%
}
.col-xs-4 {
width: 33.333333%
}
.col-xs-5 {
width: 41.666667%
}
.col-xs-6 {
width: 50%
}
.col-xs-7 {
width: 58.333333%
}
.col-xs-8 {
width: 66.666667%
}
.col-xs-9 {
width: 75%
}
.col-xs-10 {
width: 83.333333%
}
.col-xs-11 {
width: 91.666667%
}
.col-xs-12 {
width: 100%
}
.col-xs-pull-0 {
right: auto
}
.col-xs-pull-1 {
right: 8.333333%
}
.col-xs-pull-2 {
right: 16.666667%
}
.col-xs-pull-3 {
right: 25%
}
.col-xs-pull-4 {
right: 33.333333%
}
.col-xs-pull-5 {
right: 41.666667%
}
.col-xs-pull-6 {
right: 50%
}
.col-xs-pull-7 {
right: 58.333333%
}
.col-xs-pull-8 {
right: 66.666667%
}
.col-xs-pull-9 {
right: 75%
}
.col-xs-pull-10 {
right: 83.333333%
}
.col-xs-pull-11 {
right: 91.666667%
}
.col-xs-pull-12 {
right: 100%
}
.col-xs-push-0 {
left: auto
}
.col-xs-push-1 {
left: 8.333333%
}
.col-xs-push-2 {
left: 16.666667%
}
.col-xs-push-3 {
left: 25%
}
.col-xs-push-4 {
left: 33.333333%
}
.col-xs-push-5 {
left: 41.666667%
}
.col-xs-push-6 {
left: 50%
}
.col-xs-push-7 {
left: 58.333333%
}
.col-xs-push-8 {
left: 66.666667%
}
.col-xs-push-9 {
left: 75%
}
.col-xs-push-10 {
left: 83.333333%
}
.col-xs-push-11 {
left: 91.666667%
}
.col-xs-push-12 {
left: 100%
}
.col-xs-offset-0 {
margin-left: 0
}
.col-xs-offset-1 {
margin-left: 8.333333%
}
.col-xs-offset-2 {
margin-left: 16.666667%
}
.col-xs-offset-3 {
margin-left: 25%
}
.col-xs-offset-4 {
margin-left: 33.333333%
}
.col-xs-offset-5 {
margin-left: 41.666667%
}
.col-xs-offset-6 {
margin-left: 50%
}
.col-xs-offset-7 {
margin-left: 58.333333%
}
.col-xs-offset-8 {
margin-left: 66.666667%
}
.col-xs-offset-9 {
margin-left: 75%
}
.col-xs-offset-10 {
margin-left: 83.333333%
}
.col-xs-offset-11 {
margin-left: 91.666667%
}
.col-xs-offset-12 {
margin-left: 100%
}
@media (min-width: 544px) {
.col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9 {
float: left
}
.col-sm-1 {
width: 8.333333%
}
.col-sm-2 {
width: 16.666667%
}
.col-sm-3 {
width: 25%
}
.col-sm-4 {
width: 33.333333%
}
.col-sm-5 {
width: 41.666667%
}
.col-sm-6 {
width: 50%
}
.col-sm-7 {
width: 58.333333%
}
.col-sm-8 {
width: 66.666667%
}
.col-sm-9 {
width: 75%
}
.col-sm-10 {
width: 83.333333%
}
.col-sm-11 {
width: 91.666667%
}
.col-sm-12 {
width: 100%
}
.col-sm-pull-0 {
right: auto
}
.col-sm-pull-1 {
right: 8.333333%
}
.col-sm-pull-2 {
right: 16.666667%
}
.col-sm-pull-3 {
right: 25%
}
.col-sm-pull-4 {
right: 33.333333%
}
.col-sm-pull-5 {
right: 41.666667%
}
.col-sm-pull-6 {
right: 50%
}
.col-sm-pull-7 {
right: 58.333333%
}
.col-sm-pull-8 {
right: 66.666667%
}
.col-sm-pull-9 {
right: 75%
}
.col-sm-pull-10 {
right: 83.333333%
}
.col-sm-pull-11 {
right: 91.666667%
}
.col-sm-pull-12 {
right: 100%
}
.col-sm-push-0 {
left: auto
}
.col-sm-push-1 {
left: 8.333333%
}
.col-sm-push-2 {
left: 16.666667%
}
.col-sm-push-3 {
left: 25%
}
.col-sm-push-4 {
left: 33.333333%
}
.col-sm-push-5 {
left: 41.666667%
}
.col-sm-push-6 {
left: 50%
}
.col-sm-push-7 {
left: 58.333333%
}
.col-sm-push-8 {
left: 66.666667%
}
.col-sm-push-9 {
left: 75%
}
.col-sm-push-10 {
left: 83.333333%
}
.col-sm-push-11 {
left: 91.666667%
}
.col-sm-push-12 {
left: 100%
}
.col-sm-offset-0 {
margin-left: 0
}
.col-sm-offset-1 {
margin-left: 8.333333%
}
.col-sm-offset-2 {
margin-left: 16.666667%
}
.col-sm-offset-3 {
margin-left: 25%
}
.col-sm-offset-4 {
margin-left: 33.333333%
}
.col-sm-offset-5 {
margin-left: 41.666667%
}
.col-sm-offset-6 {
margin-left: 50%
}
.col-sm-offset-7 {
margin-left: 58.333333%
}
.col-sm-offset-8 {
margin-left: 66.666667%
}
.col-sm-offset-9 {
margin-left: 75%
}
.col-sm-offset-10 {
margin-left: 83.333333%
}
.col-sm-offset-11 {
margin-left: 91.666667%
}
.col-sm-offset-12 {
margin-left: 100%
}
}
@media (min-width: 768px) {
.col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9 {
float: left
}
.col-md-1 {
width: 8.333333%
}
.col-md-2 {
width: 16.666667%
}
.col-md-3 {
width: 25%
}
.col-md-4 {
width: 33.333333%
}
.col-md-5 {
width: 41.666667%
}
.col-md-6 {
width: 50%
}
.col-md-7 {
width: 58.333333%
}
.col-md-8 {
width: 66.666667%
}
.col-md-9 {
width: 75%
}
.col-md-10 {
width: 83.333333%
}
.col-md-11 {
width: 91.666667%
}
.col-md-12 {
width: 100%
}
.col-md-pull-0 {
right: auto
}
.col-md-pull-1 {
right: 8.333333%
}
.col-md-pull-2 {
right: 16.666667%
}
.col-md-pull-3 {
right: 25%
}
.col-md-pull-4 {
right: 33.333333%
}
.col-md-pull-5 {
right: 41.666667%
}
.col-md-pull-6 {
right: 50%
}
.col-md-pull-7 {
right: 58.333333%
}
.col-md-pull-8 {
right: 66.666667%
}
.col-md-pull-9 {
right: 75%
}
.col-md-pull-10 {
right: 83.333333%
}
.col-md-pull-11 {
right: 91.666667%
}
.col-md-pull-12 {
right: 100%
}
.col-md-push-0 {
left: auto
}
.col-md-push-1 {
left: 8.333333%
}
.col-md-push-2 {
left: 16.666667%
}
.col-md-push-3 {
left: 25%
}
.col-md-push-4 {
left: 33.333333%
}
.col-md-push-5 {
left: 41.666667%
}
.col-md-push-6 {
left: 50%
}
.col-md-push-7 {
left: 58.333333%
}
.col-md-push-8 {
left: 66.666667%
}
.col-md-push-9 {
left: 75%
}
.col-md-push-10 {
left: 83.333333%
}
.col-md-push-11 {
left: 91.666667%
}
.col-md-push-12 {
left: 100%
}
.col-md-offset-0 {
margin-left: 0
}
.col-md-offset-1 {
margin-left: 8.333333%
}
.col-md-offset-2 {
margin-left: 16.666667%
}
.col-md-offset-3 {
margin-left: 25%
}
.col-md-offset-4 {
margin-left: 33.333333%
}
.col-md-offset-5 {
margin-left: 41.666667%
}
.col-md-offset-6 {
margin-left: 50%
}
.col-md-offset-7 {
margin-left: 58.333333%
}
.col-md-offset-8 {
margin-left: 66.666667%
}
.col-md-offset-9 {
margin-left: 75%
}
.col-md-offset-10 {
margin-left: 83.333333%
}
.col-md-offset-11 {
margin-left: 91.666667%
}
.col-md-offset-12 {
margin-left: 100%
}
}
@media (min-width: 992px) {
.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9 {
float: left
}
.col-lg-1 {
width: 8.333333%
}
.col-lg-2 {
width: 16.666667%
}
.col-lg-3 {
width: 25%
}
.col-lg-4 {
width: 33.333333%
}
.col-lg-5 {
width: 41.666667%
}
.col-lg-6 {
width: 50%
}
.col-lg-7 {
width: 58.333333%
}
.col-lg-8 {
width: 66.666667%
}
.col-lg-9 {
width: 75%
}
.col-lg-10 {
width: 83.333333%
}
.col-lg-11 {
width: 91.666667%
}
.col-lg-12 {
width: 100%
}
.col-lg-pull-0 {
right: auto
}
.col-lg-pull-1 {
right: 8.333333%
}
.col-lg-pull-2 {
right: 16.666667%
}
.col-lg-pull-3 {
right: 25%
}
.col-lg-pull-4 {
right: 33.333333%
}
.col-lg-pull-5 {
right: 41.666667%
}
.col-lg-pull-6 {
right: 50%
}
.col-lg-pull-7 {
right: 58.333333%
}
.col-lg-pull-8 {
right: 66.666667%
}
.col-lg-pull-9 {
right: 75%
}
.col-lg-pull-10 {
right: 83.333333%
}
.col-lg-pull-11 {
right: 91.666667%
}
.col-lg-pull-12 {
right: 100%
}
.col-lg-push-0 {
left: auto
}
.col-lg-push-1 {
left: 8.333333%
}
.col-lg-push-2 {
left: 16.666667%
}
.col-lg-push-3 {
left: 25%
}
.col-lg-push-4 {
left: 33.333333%
}
.col-lg-push-5 {
left: 41.666667%
}
.col-lg-push-6 {
left: 50%
}
.col-lg-push-7 {
left: 58.333333%
}
.col-lg-push-8 {
left: 66.666667%
}
.col-lg-push-9 {
left: 75%
}
.col-lg-push-10 {
left: 83.333333%
}
.col-lg-push-11 {
left: 91.666667%
}
.col-lg-push-12 {
left: 100%
}
.col-lg-offset-0 {
margin-left: 0
}
.col-lg-offset-1 {
margin-left: 8.333333%
}
.col-lg-offset-2 {
margin-left: 16.666667%
}
.col-lg-offset-3 {
margin-left: 25%
}
.col-lg-offset-4 {
margin-left: 33.333333%
}
.col-lg-offset-5 {
margin-left: 41.666667%
}
.col-lg-offset-6 {
margin-left: 50%
}
.col-lg-offset-7 {
margin-left: 58.333333%
}
.col-lg-offset-8 {
margin-left: 66.666667%
}
.col-lg-offset-9 {
margin-left: 75%
}
.col-lg-offset-10 {
margin-left: 83.333333%
}
.col-lg-offset-11 {
margin-left: 91.666667%
}
.col-lg-offset-12 {
margin-left: 100%
}
}
@media (min-width: 1200px) {
.col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9 {
float: left
}
.col-xl-1 {
width: 8.333333%
}
.col-xl-2 {
width: 16.666667%
}
.col-xl-3 {
width: 25%
}
.col-xl-4 {
width: 33.333333%
}
.col-xl-5 {
width: 41.666667%
}
.col-xl-6 {
width: 50%
}
.col-xl-7 {
width: 58.333333%
}
.col-xl-8 {
width: 66.666667%
}
.col-xl-9 {
width: 75%
}
.col-xl-10 {
width: 83.333333%
}
.col-xl-11 {
width: 91.666667%
}
.col-xl-12 {
width: 100%
}
.col-xl-pull-0 {
right: auto
}
.col-xl-pull-1 {
right: 8.333333%
}
.col-xl-pull-2 {
right: 16.666667%
}
.col-xl-pull-3 {
right: 25%
}
.col-xl-pull-4 {
right: 33.333333%
}
.col-xl-pull-5 {
right: 41.666667%
}
.col-xl-pull-6 {
right: 50%
}
.col-xl-pull-7 {
right: 58.333333%
}
.col-xl-pull-8 {
right: 66.666667%
}
.col-xl-pull-9 {
right: 75%
}
.col-xl-pull-10 {
right: 83.333333%
}
.col-xl-pull-11 {
right: 91.666667%
}
.col-xl-pull-12 {
right: 100%
}
.col-xl-push-0 {
left: auto
}
.col-xl-push-1 {
left: 8.333333%
}
.col-xl-push-2 {
left: 16.666667%
}
.col-xl-push-3 {
left: 25%
}
.col-xl-push-4 {
left: 33.333333%
}
.col-xl-push-5 {
left: 41.666667%
}
.col-xl-push-6 {
left: 50%
}
.col-xl-push-7 {
left: 58.333333%
}
.col-xl-push-8 {
left: 66.666667%
}
.col-xl-push-9 {
left: 75%
}
.col-xl-push-10 {
left: 83.333333%
}
.col-xl-push-11 {
left: 91.666667%
}
.col-xl-push-12 {
left: 100%
}
.col-xl-offset-0 {
margin-left: 0
}
.col-xl-offset-1 {
margin-left: 8.333333%
}
.col-xl-offset-2 {
margin-left: 16.666667%
}
.col-xl-offset-3 {
margin-left: 25%
}
.col-xl-offset-4 {
margin-left: 33.333333%
}
.col-xl-offset-5 {
margin-left: 41.666667%
}
.col-xl-offset-6 {
margin-left: 50%
}
.col-xl-offset-7 {
margin-left: 58.333333%
}
.col-xl-offset-8 {
margin-left: 66.666667%
}
.col-xl-offset-9 {
margin-left: 75%
}
.col-xl-offset-10 {
margin-left: 83.333333%
}
.col-xl-offset-11 {
margin-left: 91.666667%
}
.col-xl-offset-12 {
margin-left: 100%
}
}
.table {
width: 100%;
max-width: 100%;
margin-bottom: 1rem
}
.table td, .table th {
padding: .75rem;
line-height: 1.5;
vertical-align: top;
border-top: 1px solid #eceeef
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #eceeef
}
.table tbody + tbody {
border-top: 2px solid #eceeef
}
.table .table {
background-color: #fff
}
.table-sm td, .table-sm th {
padding: .3rem
}
.table-bordered {
border: 1px solid #eceeef
}
.table-bordered td, .table-bordered th {
border: 1px solid #eceeef
}
.table-bordered thead td, .table-bordered thead th {
border-bottom-width: 2px
}
.table-striped tbody tr:nth-of-type(odd) {
background-color: #f9f9f9
}
.table-hover tbody tr:hover {
background-color: #f5f5f5
}
.table-active, .table-active > td, .table-active > th {
background-color: #f5f5f5
}
.table-hover .table-active:hover {
background-color: #e8e8e8
}
.table-hover .table-active:hover > td, .table-hover .table-active:hover > th {
background-color: #e8e8e8
}
.table-success, .table-success > td, .table-success > th {
background-color: #dff0d8
}
.table-hover .table-success:hover {
background-color: #d0e9c6
}
.table-hover .table-success:hover > td, .table-hover .table-success:hover > th {
background-color: #d0e9c6
}
.table-info, .table-info > td, .table-info > th {
background-color: #d9edf7
}
.table-hover .table-info:hover {
background-color: #c4e3f3
}
.table-hover .table-info:hover > td, .table-hover .table-info:hover > th {
background-color: #c4e3f3
}
.table-warning, .table-warning > td, .table-warning > th {
background-color: #fcf8e3
}
.table-hover .table-warning:hover {
background-color: #faf2cc
}
.table-hover .table-warning:hover > td, .table-hover .table-warning:hover > th {
background-color: #faf2cc
}
.table-danger, .table-danger > td, .table-danger > th {
background-color: #f2dede
}
.table-hover .table-danger:hover {
background-color: #ebcccc
}
.table-hover .table-danger:hover > td, .table-hover .table-danger:hover > th {
background-color: #ebcccc
}
.table-responsive {
display: block;
width: 100%;
min-height: .01%;
overflow-x: auto
}
.thead-inverse th {
color: #fff;
background-color: #373a3c
}
.thead-default th {
color: #55595c;
background-color: #eceeef
}
.table-inverse {
color: #eceeef;
background-color: #373a3c
}
.table-inverse.table-bordered {
border: 0
}
.table-inverse td, .table-inverse th, .table-inverse thead th {
border-color: #55595c
}
.table-reflow thead {
float: left
}
.table-reflow tbody {
display: block;
white-space: nowrap
}
.table-reflow td, .table-reflow th {
border-top: 1px solid #eceeef;
border-left: 1px solid #eceeef
}
.table-reflow td:last-child, .table-reflow th:last-child {
border-right: 1px solid #eceeef
}
.table-reflow tbody:last-child tr:last-child td, .table-reflow tbody:last-child tr:last-child th, .table-reflow tfoot:last-child tr:last-child td, .table-reflow tfoot:last-child tr:last-child th, .table-reflow thead:last-child tr:last-child td, .table-reflow thead:last-child tr:last-child th {
border-bottom: 1px solid #eceeef
}
.table-reflow tr {
float: left
}
.table-reflow tr td, .table-reflow tr th {
display: block !important;
border: 1px solid #eceeef
}
.form-control {
display: block;
width: 100%;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #55595c;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: .25rem
}
.form-control::-ms-expand {
background-color: transparent;
border: 0
}
.form-control:focus {
border-color: #66afe9;
outline: 0
}
.form-control::-webkit-input-placeholder {
color: #999;
opacity: 1
}
.form-control::-moz-placeholder {
color: #999;
opacity: 1
}
.form-control:-ms-input-placeholder {
color: #999;
opacity: 1
}
.form-control::placeholder {
color: #999;
opacity: 1
}
.form-control:disabled, .form-control[readonly] {
background-color: #eceeef;
opacity: 1
}
.form-control:disabled {
cursor: not-allowed
}
.form-control-file, .form-control-range {
display: block
}
.form-control-label {
padding: .375rem .75rem;
margin-bottom: 0
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
input[type=date].form-control, input[type=time].form-control, input[type=datetime-local].form-control, input[type=month].form-control {
line-height: 2.25rem
}
.input-group-sm input[type=date].form-control, .input-group-sm input[type=time].form-control, .input-group-sm input[type=datetime-local].form-control, .input-group-sm input[type=month].form-control, input[type=date].input-sm, input[type=time].input-sm, input[type=datetime-local].input-sm, input[type=month].input-sm {
line-height: 1.8625rem
}
.input-group-lg input[type=date].form-control, .input-group-lg input[type=time].form-control, .input-group-lg input[type=datetime-local].form-control, .input-group-lg input[type=month].form-control, input[type=date].input-lg, input[type=time].input-lg, input[type=datetime-local].input-lg, input[type=month].input-lg {
line-height: 3.166667rem
}
}
.form-control-static {
min-height: 2.25rem;
padding-top: .375rem;
padding-bottom: .375rem;
margin-bottom: 0
}
.form-control-static.form-control-lg, .form-control-static.form-control-sm, .input-group-lg > .form-control-static.form-control, .input-group-lg > .form-control-static.input-group-addon, .input-group-lg > .input-group-btn > .form-control-static.btn, .input-group-sm > .form-control-static.form-control, .input-group-sm > .form-control-static.input-group-addon, .input-group-sm > .input-group-btn > .form-control-static.btn {
padding-right: 0;
padding-left: 0
}
.form-control-sm, .input-group-sm > .form-control, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .btn {
padding: .275rem .75rem;
font-size: .875rem;
line-height: 1.5;
border-radius: .2rem
}
.form-control-lg, .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn {
padding: .75rem 1.25rem;
font-size: 1.25rem;
line-height: 1.333333;
border-radius: .3rem
}
.form-group {
margin-bottom: 1rem
}
.checkbox, .radio {
position: relative;
display: block;
margin-bottom: .75rem
}
.checkbox label, .radio label {
padding-left: 1.25rem;
margin-bottom: 0;
font-weight: 400;
cursor: pointer
}
.checkbox label input:only-child, .radio label input:only-child {
position: static
}
.checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {
position: absolute;
margin-top: .25rem;
margin-left: -1.25rem
}
.checkbox + .checkbox, .radio + .radio {
margin-top: -.25rem
}
.checkbox-inline, .radio-inline {
position: relative;
display: inline-block;
padding-left: 1.25rem;
margin-bottom: 0;
font-weight: 400;
vertical-align: middle;
cursor: pointer
}
.checkbox-inline + .checkbox-inline, .radio-inline + .radio-inline {
margin-top: 0;
margin-left: .75rem
}
input[type=checkbox].disabled, input[type=checkbox]:disabled, input[type=radio].disabled, input[type=radio]:disabled {
cursor: not-allowed
}
.checkbox-inline.disabled, .radio-inline.disabled {
cursor: not-allowed
}
.checkbox.disabled label, .radio.disabled label {
cursor: not-allowed
}
.form-control-danger, .form-control-success, .form-control-warning {
padding-right: 2.25rem;
background-repeat: no-repeat;
background-position: center right .5625rem;
-webkit-background-size: 1.4625rem 1.4625rem;
background-size: 1.4625rem 1.4625rem
}
.has-success .checkbox, .has-success .checkbox-inline, .has-success .form-control-label, .has-success .radio, .has-success .radio-inline, .has-success .text-help, .has-success.checkbox label, .has-success.checkbox-inline label, .has-success.radio label, .has-success.radio-inline label {
color: #5cb85c
}
.has-success .form-control {
border-color: #5cb85c
}
.has-success .input-group-addon {
color: #5cb85c;
background-color: #eaf6ea;
border-color: #5cb85c
}
.has-success .form-control-feedback {
color: #5cb85c
}
.has-success .form-control-success {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MTIgNzkyIj48cGF0aCBmaWxsPSIjNWNiODVjIiBkPSJNMjMzLjggNjEwYy0xMy4zIDAtMjYtNi0zNC0xNi44TDkwLjUgNDQ4LjhDNzYuMyA0MzAgODAgNDAzLjMgOTguOCAzODljMTguOC0xNC4yIDQ1LjUtMTAuNCA1OS44IDguNGw3MiA5NUw0NTEuMyAyNDJjMTIuNS0yMCAzOC44LTI2LjIgNTguOC0xMy43IDIwIDEyLjQgMjYgMzguNyAxMy43IDU4LjhMMjcwIDU5MGMtNy40IDEyLTIwLjIgMTkuNC0zNC4zIDIwaC0yeiIvPjwvc3ZnPg==)
}
.has-warning .checkbox, .has-warning .checkbox-inline, .has-warning .form-control-label, .has-warning .radio, .has-warning .radio-inline, .has-warning .text-help, .has-warning.checkbox label, .has-warning.checkbox-inline label, .has-warning.radio label, .has-warning.radio-inline label {
color: #f0ad4e
}
.has-warning .form-control {
border-color: #f0ad4e
}
.has-warning .input-group-addon {
color: #f0ad4e;
background-color: #fff;
border-color: #f0ad4e
}
.has-warning .form-control-feedback {
color: #f0ad4e
}
.has-warning .form-control-warning {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MTIgNzkyIj48cGF0aCBmaWxsPSIjZjBhZDRlIiBkPSJNNjAzIDY0MC4ybC0yNzguNS01MDljLTMuOC02LjYtMTAuOC0xMC42LTE4LjUtMTAuNnMtMTQuNyA0LTE4LjUgMTAuNkw5IDY0MC4yYy0zLjcgNi41LTMuNiAxNC40LjIgMjAuOCAzLjggNi41IDEwLjggMTAuNCAxOC4zIDEwLjRoNTU3YzcuNiAwIDE0LjYtNCAxOC40LTEwLjQgMy41LTYuNCAzLjYtMTQuNCAwLTIwLjh6bS0yNjYuNC0zMGgtNjEuMlY1NDloNjEuMnY2MS4yem0wLTEwN2gtNjEuMlYzMDRoNjEuMnYxOTl6Ii8+PC9zdmc+)
}
.has-danger .checkbox, .has-danger .checkbox-inline, .has-danger .form-control-label, .has-danger .radio, .has-danger .radio-inline, .has-danger .text-help, .has-danger.checkbox label, .has-danger.checkbox-inline label, .has-danger.radio label, .has-danger.radio-inline label {
color: #d9534f
}
.has-danger .form-control {
border-color: #d9534f
}
.has-danger .input-group-addon {
color: #d9534f;
background-color: #fdf7f7;
border-color: #d9534f
}
.has-danger .form-control-feedback {
color: #d9534f
}
.has-danger .form-control-danger {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MTIgNzkyIj48cGF0aCBmaWxsPSIjZDk1MzRmIiBkPSJNNDQ3IDU0NC40Yy0xNC40IDE0LjQtMzcuNiAxNC40LTUyIDBsLTg5LTkyLjctODkgOTIuN2MtMTQuNSAxNC40LTM3LjcgMTQuNC01MiAwLTE0LjQtMTQuNC0xNC40LTM3LjYgMC01Mmw5Mi40LTk2LjMtOTIuNC05Ni4zYy0xNC40LTE0LjQtMTQuNC0zNy42IDAtNTJzMzcuNi0xNC4zIDUyIDBsODkgOTIuOCA4OS4yLTkyLjdjMTQuNC0xNC40IDM3LjYtMTQuNCA1MiAwIDE0LjMgMTQuNCAxNC4zIDM3LjYgMCA1MkwzNTQuNiAzOTZsOTIuNCA5Ni40YzE0LjQgMTQuNCAxNC40IDM3LjYgMCA1MnoiLz48L3N2Zz4=)
}
@media (min-width: 544px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle
}
.form-inline .form-control {
display: inline-block;
width: auto;
vertical-align: middle
}
.form-inline .form-control-static {
display: inline-block
}
.form-inline .input-group {
display: inline-table;
vertical-align: middle
}
.form-inline .input-group .form-control, .form-inline .input-group .input-group-addon, .form-inline .input-group .input-group-btn {
width: auto
}
.form-inline .input-group > .form-control {
width: 100%
}
.form-inline .form-control-label {
margin-bottom: 0;
vertical-align: middle
}
.form-inline .checkbox, .form-inline .radio {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle
}
.form-inline .checkbox label, .form-inline .radio label {
padding-left: 0
}
.form-inline .checkbox input[type=checkbox], .form-inline .radio input[type=radio] {
position: relative;
margin-left: 0
}
.form-inline .has-feedback .form-control-feedback {
top: 0
}
}
.btn {
display: inline-block;
padding: .375rem 1rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
border-radius: .25rem
}
.btn.active.focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn:active:focus, .btn:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px
}
.btn:focus, .btn:hover {
text-decoration: none
}
.btn.focus {
text-decoration: none
}
.btn.active, .btn:active {
background-image: none;
outline: 0
}
.btn.disabled, .btn:disabled {
cursor: not-allowed;
opacity: .65
}
a.btn.disabled, fieldset[disabled] a.btn {
pointer-events: none
}
.btn-primary {
color: #fff;
background-color: #0275d8;
border-color: #0275d8
}
.btn-primary:hover {
color: #fff;
background-color: #025aa5;
border-color: #01549b
}
.btn-primary.focus, .btn-primary:focus {
color: #fff;
background-color: #025aa5;
border-color: #01549b
}
.btn-primary.active, .btn-primary:active, .open > .btn-primary.dropdown-toggle {
color: #fff;
background-color: #025aa5;
background-image: none;
border-color: #01549b
}
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .open > .btn-primary.dropdown-toggle.focus, .open > .btn-primary.dropdown-toggle:focus, .open > .btn-primary.dropdown-toggle:hover {
color: #fff;
background-color: #014682;
border-color: #01315a
}
.btn-primary.disabled.focus, .btn-primary.disabled:focus, .btn-primary:disabled.focus, .btn-primary:disabled:focus {
background-color: #0275d8;
border-color: #0275d8
}
.btn-primary.disabled:hover, .btn-primary:disabled:hover {
background-color: #0275d8;
border-color: #0275d8
}
.btn-secondary {
color: #373a3c;
background-color: #fff;
border-color: #ccc
}
.btn-secondary:hover {
color: #373a3c;
background-color: #e6e6e6;
border-color: #adadad
}
.btn-secondary.focus, .btn-secondary:focus {
color: #373a3c;
background-color: #e6e6e6;
border-color: #adadad
}
.btn-secondary.active, .btn-secondary:active, .open > .btn-secondary.dropdown-toggle {
color: #373a3c;
background-color: #e6e6e6;
background-image: none;
border-color: #adadad
}
.btn-secondary.active.focus, .btn-secondary.active:focus, .btn-secondary.active:hover, .btn-secondary:active.focus, .btn-secondary:active:focus, .btn-secondary:active:hover, .open > .btn-secondary.dropdown-toggle.focus, .open > .btn-secondary.dropdown-toggle:focus, .open > .btn-secondary.dropdown-toggle:hover {
color: #373a3c;
background-color: #d4d4d4;
border-color: #8c8c8c
}
.btn-secondary.disabled.focus, .btn-secondary.disabled:focus, .btn-secondary:disabled.focus, .btn-secondary:disabled:focus {
background-color: #fff;
border-color: #ccc
}
.btn-secondary.disabled:hover, .btn-secondary:disabled:hover {
background-color: #fff;
border-color: #ccc
}
.btn-info {
color: #fff;
background-color: #5bc0de;
border-color: #5bc0de
}
.btn-info:hover {
color: #fff;
background-color: #31b0d5;
border-color: #2aabd2
}
.btn-info.focus, .btn-info:focus {
color: #fff;
background-color: #31b0d5;
border-color: #2aabd2
}
.btn-info.active, .btn-info:active, .open > .btn-info.dropdown-toggle {
color: #fff;
background-color: #31b0d5;
background-image: none;
border-color: #2aabd2
}
.btn-info.active.focus, .btn-info.active:focus, .btn-info.active:hover, .btn-info:active.focus, .btn-info:active:focus, .btn-info:active:hover, .open > .btn-info.dropdown-toggle.focus, .open > .btn-info.dropdown-toggle:focus, .open > .btn-info.dropdown-toggle:hover {
color: #fff;
background-color: #269abc;
border-color: #1f7e9a
}
.btn-info.disabled.focus, .btn-info.disabled:focus, .btn-info:disabled.focus, .btn-info:disabled:focus {
background-color: #5bc0de;
border-color: #5bc0de
}
.btn-info.disabled:hover, .btn-info:disabled:hover {
background-color: #5bc0de;
border-color: #5bc0de
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #5cb85c
}
.btn-success:hover {
color: #fff;
background-color: #449d44;
border-color: #419641
}
.btn-success.focus, .btn-success:focus {
color: #fff;
background-color: #449d44;
border-color: #419641
}
.btn-success.active, .btn-success:active, .open > .btn-success.dropdown-toggle {
color: #fff;
background-color: #449d44;
background-image: none;
border-color: #419641
}
.btn-success.active.focus, .btn-success.active:focus, .btn-success.active:hover, .btn-success:active.focus, .btn-success:active:focus, .btn-success:active:hover, .open > .btn-success.dropdown-toggle.focus, .open > .btn-success.dropdown-toggle:focus, .open > .btn-success.dropdown-toggle:hover {
color: #fff;
background-color: #398439;
border-color: #2d672d
}
.btn-success.disabled.focus, .btn-success.disabled:focus, .btn-success:disabled.focus, .btn-success:disabled:focus {
background-color: #5cb85c;
border-color: #5cb85c
}
.btn-success.disabled:hover, .btn-success:disabled:hover {
background-color: #5cb85c;
border-color: #5cb85c
}
.btn-warning {
color: #fff;
background-color: #f0ad4e;
border-color: #f0ad4e
}
.btn-warning:hover {
color: #fff;
background-color: #ec971f;
border-color: #eb9316
}
.btn-warning.focus, .btn-warning:focus {
color: #fff;
background-color: #ec971f;
border-color: #eb9316
}
.btn-warning.active, .btn-warning:active, .open > .btn-warning.dropdown-toggle {
color: #fff;
background-color: #ec971f;
background-image: none;
border-color: #eb9316
}
.btn-warning.active.focus, .btn-warning.active:focus, .btn-warning.active:hover, .btn-warning:active.focus, .btn-warning:active:focus, .btn-warning:active:hover, .open > .btn-warning.dropdown-toggle.focus, .open > .btn-warning.dropdown-toggle:focus, .open > .btn-warning.dropdown-toggle:hover {
color: #fff;
background-color: #d58512;
border-color: #b06d0f
}
.btn-warning.disabled.focus, .btn-warning.disabled:focus, .btn-warning:disabled.focus, .btn-warning:disabled:focus {
background-color: #f0ad4e;
border-color: #f0ad4e
}
.btn-warning.disabled:hover, .btn-warning:disabled:hover {
background-color: #f0ad4e;
border-color: #f0ad4e
}
.btn-danger {
color: #fff;
background-color: #d9534f;
border-color: #d9534f
}
.btn-danger:hover {
color: #fff;
background-color: #c9302c;
border-color: #c12e2a
}
.btn-danger.focus, .btn-danger:focus {
color: #fff;
background-color: #c9302c;
border-color: #c12e2a
}
.btn-danger.active, .btn-danger:active, .open > .btn-danger.dropdown-toggle {
color: #fff;
background-color: #c9302c;
background-image: none;
border-color: #c12e2a
}
.btn-danger.active.focus, .btn-danger.active:focus, .btn-danger.active:hover, .btn-danger:active.focus, .btn-danger:active:focus, .btn-danger:active:hover, .open > .btn-danger.dropdown-toggle.focus, .open > .btn-danger.dropdown-toggle:focus, .open > .btn-danger.dropdown-toggle:hover {
color: #fff;
background-color: #ac2925;
border-color: #8b211e
}
.btn-danger.disabled.focus, .btn-danger.disabled:focus, .btn-danger:disabled.focus, .btn-danger:disabled:focus {
background-color: #d9534f;
border-color: #d9534f
}
.btn-danger.disabled:hover, .btn-danger:disabled:hover {
background-color: #d9534f;
border-color: #d9534f
}
.btn-primary-outline {
color: #0275d8;
background-color: transparent;
background-image: none;
border-color: #0275d8
}
.btn-primary-outline.active, .btn-primary-outline.focus, .btn-primary-outline:active, .btn-primary-outline:focus, .open > .btn-primary-outline.dropdown-toggle {
color: #fff;
background-color: #0275d8;
border-color: #0275d8
}
.btn-primary-outline:hover {
color: #fff;
background-color: #0275d8;
border-color: #0275d8
}
.btn-primary-outline.disabled.focus, .btn-primary-outline.disabled:focus, .btn-primary-outline:disabled.focus, .btn-primary-outline:disabled:focus {
border-color: #43a7fd
}
.btn-primary-outline.disabled:hover, .btn-primary-outline:disabled:hover {
border-color: #43a7fd
}
.btn-secondary-outline {
color: #ccc;
background-color: transparent;
background-image: none;
border-color: #ccc
}
.btn-secondary-outline.active, .btn-secondary-outline.focus, .btn-secondary-outline:active, .btn-secondary-outline:focus, .open > .btn-secondary-outline.dropdown-toggle {
color: #fff;
background-color: #ccc;
border-color: #ccc
}
.btn-secondary-outline:hover {
color: #fff;
background-color: #ccc;
border-color: #ccc
}
.btn-secondary-outline.disabled.focus, .btn-secondary-outline.disabled:focus, .btn-secondary-outline:disabled.focus, .btn-secondary-outline:disabled:focus {
border-color: #fff
}
.btn-secondary-outline.disabled:hover, .btn-secondary-outline:disabled:hover {
border-color: #fff
}
.btn-info-outline {
color: #5bc0de;
background-color: transparent;
background-image: none;
border-color: #5bc0de
}
.btn-info-outline.active, .btn-info-outline.focus, .btn-info-outline:active, .btn-info-outline:focus, .open > .btn-info-outline.dropdown-toggle {
color: #fff;
background-color: #5bc0de;
border-color: #5bc0de
}
.btn-info-outline:hover {
color: #fff;
background-color: #5bc0de;
border-color: #5bc0de
}
.btn-info-outline.disabled.focus, .btn-info-outline.disabled:focus, .btn-info-outline:disabled.focus, .btn-info-outline:disabled:focus {
border-color: #b0e1ef
}
.btn-info-outline.disabled:hover, .btn-info-outline:disabled:hover {
border-color: #b0e1ef
}
.btn-success-outline {
color: #5cb85c;
background-color: transparent;
background-image: none;
border-color: #5cb85c
}
.btn-success-outline.active, .btn-success-outline.focus, .btn-success-outline:active, .btn-success-outline:focus, .open > .btn-success-outline.dropdown-toggle {
color: #fff;
background-color: #5cb85c;
border-color: #5cb85c
}
.btn-success-outline:hover {
color: #fff;
background-color: #5cb85c;
border-color: #5cb85c
}
.btn-success-outline.disabled.focus, .btn-success-outline.disabled:focus, .btn-success-outline:disabled.focus, .btn-success-outline:disabled:focus {
border-color: #a3d7a3
}
.btn-success-outline.disabled:hover, .btn-success-outline:disabled:hover {
border-color: #a3d7a3
}
.btn-warning-outline {
color: #f0ad4e;
background-color: transparent;
background-image: none;
border-color: #f0ad4e
}
.btn-warning-outline.active, .btn-warning-outline.focus, .btn-warning-outline:active, .btn-warning-outline:focus, .open > .btn-warning-outline.dropdown-toggle {
color: #fff;
background-color: #f0ad4e;
border-color: #f0ad4e
}
.btn-warning-outline:hover {
color: #fff;
background-color: #f0ad4e;
border-color: #f0ad4e
}
.btn-warning-outline.disabled.focus, .btn-warning-outline.disabled:focus, .btn-warning-outline:disabled.focus, .btn-warning-outline:disabled:focus {
border-color: #f8d9ac
}
.btn-warning-outline.disabled:hover, .btn-warning-outline:disabled:hover {
border-color: #f8d9ac
}
.btn-danger-outline {
color: #d9534f;
background-color: transparent;
background-image: none;
border-color: #d9534f
}
.btn-danger-outline.active, .btn-danger-outline.focus, .btn-danger-outline:active, .btn-danger-outline:focus, .open > .btn-danger-outline.dropdown-toggle {
color: #fff;
background-color: #d9534f;
border-color: #d9534f
}
.btn-danger-outline:hover {
color: #fff;
background-color: #d9534f;
border-color: #d9534f
}
.btn-danger-outline.disabled.focus, .btn-danger-outline.disabled:focus, .btn-danger-outline:disabled.focus, .btn-danger-outline:disabled:focus {
border-color: #eba5a3
}
.btn-danger-outline.disabled:hover, .btn-danger-outline:disabled:hover {
border-color: #eba5a3
}
.btn-link {
font-weight: 400;
color: #0275d8;
border-radius: 0
}
.btn-link, .btn-link.active, .btn-link:active, .btn-link:disabled {
background-color: transparent
}
.btn-link, .btn-link:active, .btn-link:focus {
border-color: transparent
}
.btn-link:hover {
border-color: transparent
}
.btn-link:focus, .btn-link:hover {
color: #014c8c;
text-decoration: underline;
background-color: transparent
}
.btn-link:disabled:focus, .btn-link:disabled:hover {
color: #818a91;
text-decoration: none
}
.btn-group-lg > .btn, .btn-lg {
padding: .75rem 1.25rem;
font-size: 1.25rem;
line-height: 1.333333;
border-radius: .3rem
}
.btn-group-sm > .btn, .btn-sm {
padding: .25rem .75rem;
font-size: .875rem;
line-height: 1.5;
border-radius: .2rem
}
.btn-block {
display: block;
width: 100%
}
.btn-block + .btn-block {
margin-top: 5px
}
input[type=button].btn-block, input[type=reset].btn-block, input[type=submit].btn-block {
width: 100%
}
.fade {
opacity: 0;
-webkit-transition: opacity .15s linear;
-o-transition: opacity .15s linear;
transition: opacity .15s linear
}
.fade.in {
opacity: 1
}
.collapse {
display: none
}
.collapse.in {
display: block
}
.collapsing {
position: relative;
height: 0;
overflow: hidden;
-webkit-transition-timing-function: ease;
-o-transition-timing-function: ease;
transition-timing-function: ease;
-webkit-transition-duration: .35s;
-o-transition-duration: .35s;
transition-duration: .35s;
-webkit-transition-property: height;
-o-transition-property: height;
transition-property: height
}
.dropdown, .dropup {
position: relative
}
.dropdown-toggle::after {
display: inline-block;
width: 0;
height: 0;
margin-right: .25rem;
margin-left: .25rem;
vertical-align: middle;
content: "";
border-top: .3em solid;
border-right: .3em solid transparent;
border-left: .3em solid transparent
}
.dropdown-toggle:focus {
outline: 0
}
.dropup .dropdown-toggle::after {
border-top: 0;
border-bottom: .3em solid
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 1rem;
color: #373a3c;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: .25rem
}
.dropdown-divider {
height: 1px;
margin: .5rem 0;
overflow: hidden;
background-color: #e5e5e5
}
.dropdown-item {
display: block;
width: 100%;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.5;
color: #373a3c;
text-align: inherit;
white-space: nowrap;
background: 0 0;
border: 0
}
.dropdown-item:focus, .dropdown-item:hover {
color: #2b2d2f;
text-decoration: none;
background-color: #f5f5f5
}
.dropdown-item.active, .dropdown-item.active:focus, .dropdown-item.active:hover {
color: #fff;
text-decoration: none;
background-color: #0275d8;
outline: 0
}
.dropdown-item.disabled, .dropdown-item.disabled:focus, .dropdown-item.disabled:hover {
color: #818a91
}
.dropdown-item.disabled:focus, .dropdown-item.disabled:hover {
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
background-image: none;
filter: "progid:DXImageTransform.Microsoft.gradient(enabled = false)"
}
.open > .dropdown-menu {
display: block
}
.open > a {
outline: 0
}
.dropdown-menu-right {
right: 0;
left: auto
}
.dropdown-menu-left {
right: auto;
left: 0
}
.dropdown-header {
display: block;
padding: 3px 20px;
font-size: .875rem;
line-height: 1.5;
color: #818a91;
white-space: nowrap
}
.dropdown-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 990
}
.pull-right > .dropdown-menu {
right: 0;
left: auto
}
.dropup .caret, .navbar-fixed-bottom .dropdown .caret {
content: "";
border-top: 0;
border-bottom: .3em solid
}
.dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 2px
}
.btn-group, .btn-group-vertical {
position: relative;
display: inline-block;
vertical-align: middle
}
.btn-group-vertical > .btn, .btn-group > .btn {
position: relative;
float: left
}
.btn-group-vertical > .btn.active, .btn-group-vertical > .btn:active, .btn-group-vertical > .btn:focus, .btn-group > .btn.active, .btn-group > .btn:active, .btn-group > .btn:focus {
z-index: 2
}
.btn-group-vertical > .btn:hover, .btn-group > .btn:hover {
z-index: 2
}
.btn-group .btn + .btn, .btn-group .btn + .btn-group, .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group {
margin-left: -1px
}
.btn-toolbar {
margin-left: -5px
}
.btn-toolbar::after {
display: table;
clear: both;
content: ""
}
.btn-toolbar .btn-group, .btn-toolbar .input-group {
float: left
}
.btn-toolbar > .btn, .btn-toolbar > .btn-group, .btn-toolbar > .input-group {
margin-left: 5px
}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0
}
.btn-group > .btn:first-child {
margin-left: 0
}
.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0
}
.btn-group > .btn:last-child:not(:first-child), .btn-group > .dropdown-toggle:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0
}
.btn-group > .btn-group {
float: left
}
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0
}
.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-top-right-radius: 0;
border-bottom-right-radius: 0
}
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0
}
.btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle {
outline: 0
}
.btn-group > .btn + .dropdown-toggle {
padding-right: 8px;
padding-left: 8px
}
.btn-group-lg.btn-group > .btn + .dropdown-toggle, .btn-group > .btn-lg + .dropdown-toggle {
padding-right: 12px;
padding-left: 12px
}
.btn .caret {
margin-left: 0
}
.btn-group-lg > .btn .caret, .btn-lg .caret {
border-width: .3em .3em 0;
border-bottom-width: 0
}
.dropup .btn-group-lg > .btn .caret, .dropup .btn-lg .caret {
border-width: 0 .3em .3em
}
.btn-group-vertical > .btn, .btn-group-vertical > .btn-group, .btn-group-vertical > .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%
}
.btn-group-vertical > .btn-group::after {
display: table;
clear: both;
content: ""
}
.btn-group-vertical > .btn-group > .btn {
float: none
}
.btn-group-vertical > .btn + .btn, .btn-group-vertical > .btn + .btn-group, .btn-group-vertical > .btn-group + .btn, .btn-group-vertical > .btn-group + .btn-group {
margin-top: -1px;
margin-left: 0
}
.btn-group-vertical > .btn:not(:first-child):not(:last-child) {
border-radius: 0
}
.btn-group-vertical > .btn:first-child:not(:last-child) {
border-top-right-radius: .25rem;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0
}
.btn-group-vertical > .btn:last-child:not(:first-child) {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: .25rem
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0
}
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0
}
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0
}
[data-toggle=buttons] > .btn input[type=checkbox], [data-toggle=buttons] > .btn input[type=radio], [data-toggle=buttons] > .btn-group > .btn input[type=checkbox], [data-toggle=buttons] > .btn-group > .btn input[type=radio] {
position: absolute;
clip: rect(0, 0, 0, 0);
pointer-events: none
}
.input-group {
position: relative;
display: table;
border-collapse: separate
}
.input-group .form-control {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0
}
.input-group .form-control:active, .input-group .form-control:focus, .input-group .form-control:hover {
z-index: 3
}
.input-group .form-control, .input-group-addon, .input-group-btn {
display: table-cell
}
.input-group .form-control:not(:first-child):not(:last-child), .input-group-addon:not(:first-child):not(:last-child), .input-group-btn:not(:first-child):not(:last-child) {
border-radius: 0
}
.input-group-addon, .input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle
}
.input-group-addon {
padding: .375rem .75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1;
color: #55595c;
text-align: center;
background-color: #eceeef;
border: 1px solid #ccc;
border-radius: .25rem
}
.input-group-addon.form-control-sm, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .input-group-addon.btn {
padding: .275rem .75rem;
font-size: .875rem;
border-radius: .2rem
}
.input-group-addon.form-control-lg, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .input-group-addon.btn {
padding: .75rem 1.25rem;
font-size: 1.25rem;
border-radius: .3rem
}
.input-group-addon input[type=checkbox], .input-group-addon input[type=radio] {
margin-top: 0
}
.input-group .form-control:first-child, .input-group-addon:first-child, .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group > .btn, .input-group-btn:first-child > .dropdown-toggle, .input-group-btn:last-child > .btn-group:not(:last-child) > .btn, .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0
}
.input-group-addon:first-child {
border-right: 0
}
.input-group .form-control:last-child, .input-group-addon:last-child, .input-group-btn:first-child > .btn-group:not(:first-child) > .btn, .input-group-btn:first-child > .btn:not(:first-child), .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group > .btn, .input-group-btn:last-child > .dropdown-toggle {
border-top-left-radius: 0;
border-bottom-left-radius: 0
}
.input-group-addon:last-child {
border-left: 0
}
.input-group-btn {
position: relative;
font-size: 0;
white-space: nowrap
}
.input-group-btn > .btn {
position: relative
}
.input-group-btn > .btn + .btn {
margin-left: -1px
}
.input-group-btn > .btn:active, .input-group-btn > .btn:focus, .input-group-btn > .btn:hover {
z-index: 3
}
.input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group {
margin-right: -1px
}
.input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group {
z-index: 2;
margin-left: -1px
}
.input-group-btn:last-child > .btn-group:active, .input-group-btn:last-child > .btn-group:focus, .input-group-btn:last-child > .btn-group:hover, .input-group-btn:last-child > .btn:active, .input-group-btn:last-child > .btn:focus, .input-group-btn:last-child > .btn:hover {
z-index: 3
}
.c-input {
position: relative;
display: inline;
padding-left: 1.5rem;
color: #555;
cursor: pointer
}
.c-input > input {
position: absolute;
z-index: -1;
opacity: 0
}
.c-input > input:checked ~ .c-indicator {
color: #fff;
background-color: #0074d9
}
.c-input > input:focus ~ .c-indicator {
-webkit-box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9
}
.c-input > input:active ~ .c-indicator {
color: #fff;
background-color: #84c6ff
}
.c-input + .c-input {
margin-left: 1rem
}
.c-indicator {
position: absolute;
top: 0;
left: 0;
display: block;
width: 1rem;
height: 1rem;
font-size: 65%;
line-height: 1rem;
color: #eee;
text-align: center;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #eee;
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: 50% 50%;
background-size: 50% 50%
}
.c-checkbox .c-indicator {
border-radius: .25rem
}
.c-checkbox input:checked ~ .c-indicator {
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgOCA4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA4IDgiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTYuNCwxTDUuNywxLjdMMi45LDQuNUwyLjEsMy43TDEuNCwzTDAsNC40bDAuNywwLjdsMS41LDEuNWwwLjcsMC43bDAuNy0wLjdsMy41LTMuNWwwLjctMC43TDYuNCwxTDYuNCwxeiINCgkvPg0KPC9zdmc+DQo=)
}
.c-checkbox input:indeterminate ~ .c-indicator {
background-color: #0074d9;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iOHB4IiBoZWlnaHQ9IjhweCIgdmlld0JveD0iMCAwIDggOCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgOCA4IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0wLDN2Mmg4VjNIMHoiLz4NCjwvc3ZnPg0K)
}
.c-radio .c-indicator {
border-radius: 50%
}
.c-radio input:checked ~ .c-indicator {
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgOCA4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA4IDgiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTQsMUMyLjMsMSwxLDIuMywxLDRzMS4zLDMsMywzczMtMS4zLDMtM1M1LjcsMSw0LDF6Ii8+DQo8L3N2Zz4NCg==)
}
.c-inputs-stacked .c-input {
display: inline
}
.c-inputs-stacked .c-input::after {
display: block;
margin-bottom: .25rem;
content: ""
}
.c-inputs-stacked .c-input + .c-input {
margin-left: 0
}
.c-select {
display: inline-block;
max-width: 100%;
-webkit-appearance: none;
padding: .375rem 1.75rem .375rem .75rem;
padding-right: .75rem \9;
color: #55595c;
vertical-align: middle;
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAUCAMAAACzvE1FAAAADFBMVEUzMzMzMzMzMzMzMzMKAG/3AAAAA3RSTlMAf4C/aSLHAAAAPElEQVR42q3NMQ4AIAgEQTn//2cLdRKppSGzBYwzVXvznNWs8C58CiussPJj8h6NwgorrKRdTvuV9v16Afn0AYFOB7aYAAAAAElFTkSuQmCC) no-repeat right .75rem center;
background-image: none \9;
-webkit-background-size: 8px 10px;
background-size: 8px 10px;
border: 1px solid #ccc;
-moz-appearance: none
}
.c-select:focus {
border-color: #51a7e8;
outline: 0
}
.c-select::-ms-expand {
opacity: 0
}
.c-select-sm {
padding-top: 3px;
padding-bottom: 3px;
font-size: 12px
}
.c-select-sm:not([multiple]) {
height: 26px;
min-height: 26px
}
.file {
position: relative;
display: inline-block;
height: 2.5rem;
cursor: pointer
}
.file input {
min-width: 14rem;
margin: 0;
filter: alpha(opacity=0);
opacity: 0
}
.file-custom {
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 5;
height: 2.5rem;
padding: .5rem 1rem;
line-height: 1.5;
color: #555;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #fff;
border: 1px solid #ddd;
border-radius: .25rem
}
.file-custom::after {
content: "Choose file..."
}
.file-custom::before {
position: absolute;
top: -.075rem;
right: -.075rem;
bottom: -.075rem;
z-index: 6;
display: block;
height: 2.5rem;
padding: .5rem 1rem;
line-height: 1.5;
color: #555;
content: "Browse";
background-color: #eee;
border: 1px solid #ddd;
border-radius: 0 .25rem .25rem 0
}
.nav {
padding-left: 0;
margin-bottom: 0;
list-style: none
}
.nav-link {
display: inline-block
}
.nav-link:focus, .nav-link:hover {
text-decoration: none
}
.nav-link.disabled {
color: #818a91
}
.nav-link.disabled, .nav-link.disabled:focus, .nav-link.disabled:hover {
color: #818a91;
cursor: not-allowed;
background-color: transparent
}
.nav-inline .nav-item {
display: inline-block
}
.nav-inline .nav-item + .nav-item, .nav-inline .nav-link + .nav-link {
margin-left: 1rem
}
.nav-tabs {
border-bottom: 1px solid #ddd
}
.nav-tabs::after {
display: table;
clear: both;
content: ""
}
.nav-tabs .nav-item {
float: left;
margin-bottom: -1px
}
.nav-tabs .nav-item + .nav-item {
margin-left: .2rem
}
.nav-tabs .nav-link {
display: block;
padding: .5em 1em;
border: 1px solid transparent;
border-radius: .25rem .25rem 0 0
}
.nav-tabs .nav-link:focus, .nav-tabs .nav-link:hover {
border-color: #eceeef #eceeef #ddd
}
.nav-tabs .nav-link.disabled, .nav-tabs .nav-link.disabled:focus, .nav-tabs .nav-link.disabled:hover {
color: #818a91;
background-color: transparent;
border-color: transparent
}
.nav-tabs .nav-item.open .nav-link, .nav-tabs .nav-item.open .nav-link:focus, .nav-tabs .nav-item.open .nav-link:hover, .nav-tabs .nav-link.active, .nav-tabs .nav-link.active:focus, .nav-tabs .nav-link.active:hover {
color: #55595c;
background-color: #fff;
border-color: #ddd #ddd transparent
}
.nav-pills::after {
display: table;
clear: both;
content: ""
}
.nav-pills .nav-item {
float: left
}
.nav-pills .nav-item + .nav-item {
margin-left: .2rem
}
.nav-pills .nav-link {
display: block;
padding: .5em 1em;
border-radius: .25rem
}
.nav-pills .nav-item.open .nav-link, .nav-pills .nav-item.open .nav-link:focus, .nav-pills .nav-item.open .nav-link:hover, .nav-pills .nav-link.active, .nav-pills .nav-link.active:focus, .nav-pills .nav-link.active:hover {
color: #fff;
cursor: default;
background-color: #0275d8
}
.nav-stacked .nav-item {
display: block;
float: none
}
.nav-stacked .nav-item + .nav-item {
margin-top: .2rem;
margin-left: 0
}
.tab-content > .tab-pane {
display: none
}
.tab-content > .active {
display: block
}
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0
}
.navbar {
position: relative;
padding: .5rem 1rem
}
.navbar::after {
display: table;
clear: both;
content: ""
}
@media (min-width: 544px) {
.navbar {
border-radius: .25rem
}
}
.navbar-full {
z-index: 1000
}
@media (min-width: 544px) {
.navbar-full {
border-radius: 0
}
}
.navbar-fixed-bottom, .navbar-fixed-top {
position: fixed;
right: 0;
left: 0;
z-index: 1030
}
@media (min-width: 544px) {
.navbar-fixed-bottom, .navbar-fixed-top {
border-radius: 0
}
}
.navbar-fixed-top {
top: 0
}
.navbar-fixed-bottom {
bottom: 0
}
.navbar-sticky-top {
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 1030;
width: 100%
}
@media (min-width: 544px) {
.navbar-sticky-top {
border-radius: 0
}
}
.navbar-brand {
float: left;
padding-top: .25rem;
padding-bottom: .25rem;
margin-right: 1rem;
font-size: 1.25rem
}
.navbar-brand:focus, .navbar-brand:hover {
text-decoration: none
}
.navbar-brand > img {
display: block
}
.navbar-divider {
float: left;
width: 1px;
padding-top: .425rem;
padding-bottom: .425rem;
margin-right: 1rem;
margin-left: 1rem;
overflow: hidden
}
.navbar-divider::before {
content: "\00a0"
}
.navbar-toggler {
padding: .5rem .75rem;
font-size: 1.25rem;
line-height: 1;
background: 0 0;
border: 1px solid transparent;
border-radius: .25rem
}
.navbar-toggler:focus, .navbar-toggler:hover {
text-decoration: none
}
@media (min-width: 544px) {
.navbar-toggleable-xs {
display: block !important
}
}
@media (min-width: 768px) {
.navbar-toggleable-sm {
display: block !important
}
}
@media (min-width: 992px) {
.navbar-toggleable-md {
display: block !important
}
}
.navbar-nav .nav-item {
float: left
}
.navbar-nav .nav-link {
display: block;
padding-top: .425rem;
padding-bottom: .425rem
}
.navbar-nav .nav-link + .nav-link {
margin-left: 1rem
}
.navbar-nav .nav-item + .nav-item {
margin-left: 1rem
}
.navbar-light .navbar-brand {
color: rgba(0, 0, 0, .8)
}
.navbar-light .navbar-brand:focus, .navbar-light .navbar-brand:hover {
color: rgba(0, 0, 0, .8)
}
.navbar-light .navbar-nav .nav-link {
color: rgba(0, 0, 0, .3)
}
.navbar-light .navbar-nav .nav-link:focus, .navbar-light .navbar-nav .nav-link:hover {
color: rgba(0, 0, 0, .6)
}
.navbar-light .navbar-nav .active > .nav-link, .navbar-light .navbar-nav .active > .nav-link:focus, .navbar-light .navbar-nav .active > .nav-link:hover, .navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .nav-link.active:focus, .navbar-light .navbar-nav .nav-link.active:hover, .navbar-light .navbar-nav .nav-link.open, .navbar-light .navbar-nav .nav-link.open:focus, .navbar-light .navbar-nav .nav-link.open:hover, .navbar-light .navbar-nav .open > .nav-link, .navbar-light .navbar-nav .open > .nav-link:focus, .navbar-light .navbar-nav .open > .nav-link:hover {
color: rgba(0, 0, 0, .8)
}
.navbar-light .navbar-divider {
background-color: rgba(0, 0, 0, .075)
}
.navbar-dark .navbar-brand {
color: #fff
}
.navbar-dark .navbar-brand:focus, .navbar-dark .navbar-brand:hover {
color: #fff
}
.navbar-dark .navbar-nav .nav-link {
color: rgba(255, 255, 255, .5)
}
.navbar-dark .navbar-nav .nav-link:focus, .navbar-dark .navbar-nav .nav-link:hover {
color: rgba(255, 255, 255, .75)
}
.navbar-dark .navbar-nav .active > .nav-link, .navbar-dark .navbar-nav .active > .nav-link:focus, .navbar-dark .navbar-nav .active > .nav-link:hover, .navbar-dark .navbar-nav .nav-link.active, .navbar-dark .navbar-nav .nav-link.active:focus, .navbar-dark .navbar-nav .nav-link.active:hover, .navbar-dark .navbar-nav .nav-link.open, .navbar-dark .navbar-nav .nav-link.open:focus, .navbar-dark .navbar-nav .nav-link.open:hover, .navbar-dark .navbar-nav .open > .nav-link, .navbar-dark .navbar-nav .open > .nav-link:focus, .navbar-dark .navbar-nav .open > .nav-link:hover {
color: #fff
}
.navbar-dark .navbar-divider {
background-color: rgba(255, 255, 255, .075)
}
.card {
position: relative;
display: block;
margin-bottom: .75rem;
background-color: #fff;
border: 1px solid #e5e5e5;
border-radius: .25rem
}
.card-block {
padding: 1.25rem
}
.card-title {
margin-bottom: .75rem
}
.card-subtitle {
margin-top: -.375rem;
margin-bottom: 0
}
.card-text:last-child {
margin-bottom: 0
}
.card-link:hover {
text-decoration: none
}
.card-link + .card-link {
margin-left: 1.25rem
}
.card > .list-group:first-child .list-group-item:first-child {
border-radius: .25rem .25rem 0 0
}
.card > .list-group:last-child .list-group-item:last-child {
border-radius: 0 0 .25rem .25rem
}
.card-header {
padding: .75rem 1.25rem;
background-color: #f5f5f5;
border-bottom: 1px solid #e5e5e5
}
.card-header:first-child {
border-radius: .25rem .25rem 0 0
}
.card-footer {
padding: .75rem 1.25rem;
background-color: #f5f5f5;
border-top: 1px solid #e5e5e5
}
.card-footer:last-child {
border-radius: 0 0 .25rem .25rem
}
.card-primary {
background-color: #0275d8;
border-color: #0275d8
}
.card-success {
background-color: #5cb85c;
border-color: #5cb85c
}
.card-info {
background-color: #5bc0de;
border-color: #5bc0de
}
.card-warning {
background-color: #f0ad4e;
border-color: #f0ad4e
}
.card-danger {
background-color: #d9534f;
border-color: #d9534f
}
.card-primary-outline {
background-color: transparent;
border-color: #0275d8
}
.card-secondary-outline {
background-color: transparent;
border-color: #ccc
}
.card-info-outline {
background-color: transparent;
border-color: #5bc0de
}
.card-success-outline {
background-color: transparent;
border-color: #5cb85c
}
.card-warning-outline {
background-color: transparent;
border-color: #f0ad4e
}
.card-danger-outline {
background-color: transparent;
border-color: #d9534f
}
.card-inverse .card-footer, .card-inverse .card-header {
border-bottom: 1px solid rgba(255, 255, 255, .2)
}
.card-inverse .card-blockquote, .card-inverse .card-footer, .card-inverse .card-header, .card-inverse .card-title {
color: #fff
}
.card-inverse .card-blockquote > footer, .card-inverse .card-link, .card-inverse .card-text {
color: rgba(255, 255, 255, .65)
}
.card-inverse .card-link:focus, .card-inverse .card-link:hover {
color: #fff
}
.card-blockquote {
padding: 0;
margin-bottom: 0;
border-left: 0
}
.card-img {
border-radius: .25rem
}
.card-img-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 1.25rem
}
.card-img-top {
border-radius: .25rem .25rem 0 0
}
.card-img-bottom {
border-radius: 0 0 .25rem .25rem
}
@media (min-width: 544px) {
.card-deck {
display: table;
table-layout: fixed;
border-spacing: 1.25rem 0
}
.card-deck .card {
display: table-cell;
width: 1%;
vertical-align: top
}
.card-deck-wrapper {
margin-right: -1.25rem;
margin-left: -1.25rem
}
}
@media (min-width: 544px) {
.card-group {
display: table;
width: 100%;
table-layout: fixed
}
.card-group .card {
display: table-cell;
vertical-align: top
}
.card-group .card + .card {
margin-left: 0;
border-left: 0
}
.card-group .card:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0
}
.card-group .card:first-child .card-img-top {
border-top-right-radius: 0
}
.card-group .card:first-child .card-img-bottom {
border-bottom-right-radius: 0
}
.card-group .card:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0
}
.card-group .card:last-child .card-img-top {
border-top-left-radius: 0
}
.card-group .card:last-child .card-img-bottom {
border-bottom-left-radius: 0
}
.card-group .card:not(:first-child):not(:last-child) {
border-radius: 0
}
.card-group .card:not(:first-child):not(:last-child) .card-img-bottom, .card-group .card:not(:first-child):not(:last-child) .card-img-top {
border-radius: 0
}
}
@media (min-width: 544px) {
.card-columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
-webkit-column-gap: 1.25rem;
-moz-column-gap: 1.25rem;
column-gap: 1.25rem
}
.card-columns .card {
display: inline-block;
width: 100%
}
}
.breadcrumb {
padding: .75rem 1rem;
margin-bottom: 1rem;
list-style: none;
background-color: #eceeef;
border-radius: .25rem
}
.breadcrumb::after {
display: table;
clear: both;
content: ""
}
.breadcrumb > li {
float: left
}
.breadcrumb > li + li::before {
padding-right: .5rem;
padding-left: .5rem;
color: #818a91;
content: "/"
}
.breadcrumb > .active {
color: #818a91
}
.pagination {
display: inline-block;
padding-left: 0;
margin-top: 1rem;
margin-bottom: 1rem;
border-radius: .25rem
}
.page-item {
display: inline
}
.page-item:first-child .page-link {
margin-left: 0;
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem
}
.page-item:last-child .page-link {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem
}
.page-item.active .page-link, .page-item.active .page-link:focus, .page-item.active .page-link:hover {
z-index: 2;
color: #fff;
cursor: default;
background-color: #0275d8;
border-color: #0275d8
}
.page-item.disabled .page-link, .page-item.disabled .page-link:focus, .page-item.disabled .page-link:hover {
color: #818a91;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd
}
.page-link {
position: relative;
float: left;
padding: .5rem .75rem;
margin-left: -1px;
line-height: 1.5;
color: #0275d8;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd
}
.page-link:focus, .page-link:hover {
color: #014c8c;
background-color: #eceeef;
border-color: #ddd
}
.pagination-lg .page-link {
padding: .75rem 1.5rem;
font-size: 1.25rem;
line-height: 1.333333
}
.pagination-lg .page-item:first-child .page-link {
border-top-left-radius: .3rem;
border-bottom-left-radius: .3rem
}
.pagination-lg .page-item:last-child .page-link {
border-top-right-radius: .3rem;
border-bottom-right-radius: .3rem
}
.pagination-sm .page-link {
padding: .275rem .75rem;
font-size: .875rem;
line-height: 1.5
}
.pagination-sm .page-item:first-child .page-link {
border-top-left-radius: .2rem;
border-bottom-left-radius: .2rem
}
.pagination-sm .page-item:last-child .page-link {
border-top-right-radius: .2rem;
border-bottom-right-radius: .2rem
}
.pager {
padding-left: 0;
margin-top: 1rem;
margin-bottom: 1rem;
text-align: center;
list-style: none
}
.pager::after {
display: table;
clear: both;
content: ""
}
.pager li {
display: inline
}
.pager li > a, .pager li > span {
display: inline-block;
padding: 5px 14px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 15px
}
.pager li > a:focus, .pager li > a:hover {
text-decoration: none;
background-color: #eceeef
}
.pager .disabled > a, .pager .disabled > a:focus, .pager .disabled > a:hover {
color: #818a91;
cursor: not-allowed;
background-color: #fff
}
.pager .disabled > span {
color: #818a91;
cursor: not-allowed;
background-color: #fff
}
.pager-next > a, .pager-next > span {
float: right
}
.pager-prev > a, .pager-prev > span {
float: left
}
.label {
display: inline-block;
padding: .25em .4em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem
}
.label:empty {
display: none
}
.btn .label {
position: relative;
top: -1px
}
a.label:focus, a.label:hover {
color: #fff;
text-decoration: none;
cursor: pointer
}
.label-pill {
padding-right: .6em;
padding-left: .6em;
border-radius: 10rem
}
.label-default {
background-color: #818a91
}
.label-default[href]:focus, .label-default[href]:hover {
background-color: #687077
}
.label-primary {
background-color: #0275d8
}
.label-primary[href]:focus, .label-primary[href]:hover {
background-color: #025aa5
}
.label-success {
background-color: #5cb85c
}
.label-success[href]:focus, .label-success[href]:hover {
background-color: #449d44
}
.label-info {
background-color: #5bc0de
}
.label-info[href]:focus, .label-info[href]:hover {
background-color: #31b0d5
}
.label-warning {
background-color: #f0ad4e
}
.label-warning[href]:focus, .label-warning[href]:hover {
background-color: #ec971f
}
.label-danger {
background-color: #d9534f
}
.label-danger[href]:focus, .label-danger[href]:hover {
background-color: #c9302c
}
.jumbotron {
padding: 2rem 1rem;
margin-bottom: 2rem;
background-color: #eceeef;
border-radius: .3rem
}
@media (min-width: 544px) {
.jumbotron {
padding: 4rem 2rem
}
}
.jumbotron-hr {
border-top-color: #d0d5d8
}
.jumbotron-fluid {
padding-right: 0;
padding-left: 0;
border-radius: 0
}
.alert {
padding: 15px;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: .25rem
}
.alert > p, .alert > ul {
margin-bottom: 0
}
.alert > p + p {
margin-top: 5px
}
.alert-heading {
color: inherit
}
.alert-link {
font-weight: 700
}
.alert-dismissible {
padding-right: 35px
}
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
color: inherit
}
.alert-success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d0e9c6
}
.alert-success hr {
border-top-color: #c1e2b3
}
.alert-success .alert-link {
color: #2b542c
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bcdff1
}
.alert-info hr {
border-top-color: #a6d5ec
}
.alert-info .alert-link {
color: #245269
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faf2cc
}
.alert-warning hr {
border-top-color: #f7ecb5
}
.alert-warning .alert-link {
color: #66512c
}
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebcccc
}
.alert-danger hr {
border-top-color: #e4b9b9
}
.alert-danger .alert-link {
color: #843534
}
@-webkit-keyframes progress-bar-stripes {
from {
background-position: 1rem 0
}
to {
background-position: 0 0
}
}
@-o-keyframes progress-bar-stripes {
from {
background-position: 1rem 0
}
to {
background-position: 0 0
}
}
@keyframes progress-bar-stripes {
from {
background-position: 1rem 0
}
to {
background-position: 0 0
}
}
.progress {
display: block;
width: 100%;
height: 1rem;
margin-bottom: 1rem
}
.progress[value] {
-webkit-appearance: none;
color: #0074d9;
border: 0;
-moz-appearance: none;
appearance: none
}
.progress[value]::-webkit-progress-bar {
background-color: #eee;
border-radius: .25rem
}
.progress[value]::-webkit-progress-value::before {
content: attr(value)
}
.progress[value]::-webkit-progress-value {
background-color: #0074d9;
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem
}
.progress[value="100"]::-webkit-progress-value {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem
}
@media screen and (min-width: 0\0
) {
.progress {
background-color: #eee;
border-radius: .25rem
}
.progress-bar {
display: inline-block;
height: 1rem;
text-indent: -999rem;
background-color: #0074d9;
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem
}
.progress[width^="0"] {
min-width: 2rem;
color: #818a91;
background-color: transparent;
background-image: none
}
.progress[width="100%"] {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem
}
}
.progress-striped[value]::-webkit-progress-value {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
-webkit-background-size: 1rem 1rem;
background-size: 1rem 1rem
}
.progress-striped[value]::-moz-progress-bar {
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-size: 1rem 1rem
}
@media screen and (min-width: 0\0
) {
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
-webkit-background-size: 1rem 1rem;
background-size: 1rem 1rem
}
}
.progress-animated[value]::-webkit-progress-value {
-webkit-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite
}
.progress-animated[value]::-moz-progress-bar {
animation: progress-bar-stripes 2s linear infinite
}
@media screen and (min-width: 0\0
) {
.progress-animated .progress-bar-striped {
-webkit-animation: progress-bar-stripes 2s linear infinite;
-o-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite
}
}
.progress-success[value]::-webkit-progress-value {
background-color: #5cb85c
}
.progress-success[value]::-moz-progress-bar {
background-color: #5cb85c
}
@media screen and (min-width: 0\0
) {
.progress-success .progress-bar {
background-color: #5cb85c
}
}
.progress-info[value]::-webkit-progress-value {
background-color: #5bc0de
}
.progress-info[value]::-moz-progress-bar {
background-color: #5bc0de
}
@media screen and (min-width: 0\0
) {
.progress-info .progress-bar {
background-color: #5bc0de
}
}
.progress-warning[value]::-webkit-progress-value {
background-color: #f0ad4e
}
.progress-warning[value]::-moz-progress-bar {
background-color: #f0ad4e
}
@media screen and (min-width: 0\0
) {
.progress-warning .progress-bar {
background-color: #f0ad4e
}
}
.progress-danger[value]::-webkit-progress-value {
background-color: #d9534f
}
.progress-danger[value]::-moz-progress-bar {
background-color: #d9534f
}
@media screen and (min-width: 0\0
) {
.progress-danger .progress-bar {
background-color: #d9534f
}
}
.media {
margin-top: 15px
}
.media:first-child {
margin-top: 0
}
.media, .media-body {
overflow: hidden;
zoom: 1
}
.media-body {
width: 10000px
}
.media-body, .media-left, .media-right {
display: table-cell;
vertical-align: top
}
.media-middle {
vertical-align: middle
}
.media-bottom {
vertical-align: bottom
}
.media-object {
display: block
}
.media-object.img-thumbnail {
max-width: none
}
.media-right {
padding-left: 10px
}
.media-left {
padding-right: 10px
}
.media-heading {
margin-top: 0;
margin-bottom: 5px
}
.media-list {
padding-left: 0;
list-style: none
}
.list-group {
padding-left: 0;
margin-bottom: 0
}
.list-group-item {
position: relative;
display: block;
padding: .75rem 1.25rem;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid #ddd
}
.list-group-item:first-child {
border-top-left-radius: .25rem;
border-top-right-radius: .25rem
}
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: .25rem;
border-bottom-left-radius: .25rem
}
.list-group-flush .list-group-item {
border-width: 1px 0;
border-radius: 0
}
.list-group-flush:first-child .list-group-item:first-child {
border-top: 0
}
.list-group-flush:last-child .list-group-item:last-child {
border-bottom: 0
}
a.list-group-item, button.list-group-item {
width: 100%;
color: #555;
text-align: inherit
}
a.list-group-item .list-group-item-heading, button.list-group-item .list-group-item-heading {
color: #333
}
a.list-group-item:focus, a.list-group-item:hover, button.list-group-item:focus, button.list-group-item:hover {
color: #555;
text-decoration: none;
background-color: #f5f5f5
}
.list-group-item.disabled, .list-group-item.disabled:focus, .list-group-item.disabled:hover {
color: #818a91;
cursor: not-allowed;
background-color: #eceeef
}
.list-group-item.disabled .list-group-item-heading, .list-group-item.disabled:focus .list-group-item-heading, .list-group-item.disabled:hover .list-group-item-heading {
color: inherit
}
.list-group-item.disabled .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text {
color: #818a91
}
.list-group-item.active, .list-group-item.active:focus, .list-group-item.active:hover {
z-index: 2;
color: #fff;
background-color: #0275d8;
border-color: #0275d8
}
.list-group-item.active .list-group-item-heading, .list-group-item.active .list-group-item-heading > .small, .list-group-item.active .list-group-item-heading > small, .list-group-item.active:focus .list-group-item-heading, .list-group-item.active:focus .list-group-item-heading > .small, .list-group-item.active:focus .list-group-item-heading > small, .list-group-item.active:hover .list-group-item-heading, .list-group-item.active:hover .list-group-item-heading > .small, .list-group-item.active:hover .list-group-item-heading > small {
color: inherit
}
.list-group-item.active .list-group-item-text, .list-group-item.active:focus .list-group-item-text, .list-group-item.active:hover .list-group-item-text {
color: #a8d6fe
}
.list-group-item-success {
color: #3c763d;
background-color: #dff0d8
}
a.list-group-item-success, button.list-group-item-success {
color: #3c763d
}
a.list-group-item-success .list-group-item-heading, button.list-group-item-success .list-group-item-heading {
color: inherit
}
a.list-group-item-success:focus, a.list-group-item-success:hover, button.list-group-item-success:focus, button.list-group-item-success:hover {
color: #3c763d;
background-color: #d0e9c6
}
a.list-group-item-success.active, a.list-group-item-success.active:focus, a.list-group-item-success.active:hover, button.list-group-item-success.active, button.list-group-item-success.active:focus, button.list-group-item-success.active:hover {
color: #fff;
background-color: #3c763d;
border-color: #3c763d
}
.list-group-item-info {
color: #31708f;
background-color: #d9edf7
}
a.list-group-item-info, button.list-group-item-info {
color: #31708f
}
a.list-group-item-info .list-group-item-heading, button.list-group-item-info .list-group-item-heading {
color: inherit
}
a.list-group-item-info:focus, a.list-group-item-info:hover, button.list-group-item-info:focus, button.list-group-item-info:hover {
color: #31708f;
background-color: #c4e3f3
}
a.list-group-item-info.active, a.list-group-item-info.active:focus, a.list-group-item-info.active:hover, button.list-group-item-info.active, button.list-group-item-info.active:focus, button.list-group-item-info.active:hover {
color: #fff;
background-color: #31708f;
border-color: #31708f
}
.list-group-item-warning {
color: #8a6d3b;
background-color: #fcf8e3
}
a.list-group-item-warning, button.list-group-item-warning {
color: #8a6d3b
}
a.list-group-item-warning .list-group-item-heading, button.list-group-item-warning .list-group-item-heading {
color: inherit
}
a.list-group-item-warning:focus, a.list-group-item-warning:hover, button.list-group-item-warning:focus, button.list-group-item-warning:hover {
color: #8a6d3b;
background-color: #faf2cc
}
a.list-group-item-warning.active, a.list-group-item-warning.active:focus, a.list-group-item-warning.active:hover, button.list-group-item-warning.active, button.list-group-item-warning.active:focus, button.list-group-item-warning.active:hover {
color: #fff;
background-color: #8a6d3b;
border-color: #8a6d3b
}
.list-group-item-danger {
color: #a94442;
background-color: #f2dede
}
a.list-group-item-danger, button.list-group-item-danger {
color: #a94442
}
a.list-group-item-danger .list-group-item-heading, button.list-group-item-danger .list-group-item-heading {
color: inherit
}
a.list-group-item-danger:focus, a.list-group-item-danger:hover, button.list-group-item-danger:focus, button.list-group-item-danger:hover {
color: #a94442;
background-color: #ebcccc
}
a.list-group-item-danger.active, a.list-group-item-danger.active:focus, a.list-group-item-danger.active:hover, button.list-group-item-danger.active, button.list-group-item-danger.active:focus, button.list-group-item-danger.active:hover {
color: #fff;
background-color: #a94442;
border-color: #a94442
}
.list-group-item-heading {
margin-top: 0;
margin-bottom: 5px
}
.list-group-item-text {
margin-bottom: 0;
line-height: 1.3
}
.embed-responsive {
position: relative;
display: block;
height: 0;
padding: 0;
overflow: hidden
}
.embed-responsive .embed-responsive-item, .embed-responsive embed, .embed-responsive iframe, .embed-responsive object, .embed-responsive video {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
border: 0
}
.embed-responsive-21by9 {
padding-bottom: 42.857143%
}
.embed-responsive-16by9 {
padding-bottom: 56.25%
}
.embed-responsive-4by3 {
padding-bottom: 75%
}
.embed-responsive-1by1 {
padding-bottom: 100%
}
.close {
float: right;
font-size: 1.5rem;
font-weight: 700;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
opacity: .2
}
.close:focus, .close:hover {
color: #000;
text-decoration: none;
cursor: pointer;
opacity: .5
}
button.close {
-webkit-appearance: none;
padding: 0;
cursor: pointer;
background: 0 0;
border: 0
}
.modal-open {
overflow: hidden
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-overflow-scrolling: touch;
outline: 0
}
.modal.fade .modal-dialog {
-webkit-transition: -webkit-transform .3s ease-out;
-o-transition: transform .3s ease-out, -o-transform .3s ease-out;
transition: -webkit-transform .3s ease-out;
transition: transform .3s ease-out;
transition: transform .3s ease-out, -webkit-transform .3s ease-out, -o-transform .3s ease-out;
-webkit-transform: translate(0, -25%);
-ms-transform: translate(0, -25%);
-o-transform: translate(0, -25%);
transform: translate(0, -25%)
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0)
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto
}
.modal-dialog {
position: relative;
width: auto;
margin: 10px
}
.modal-content {
position: relative;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .2);
border-radius: .3rem;
outline: 0
}
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000
}
.modal-backdrop.fade {
opacity: 0
}
.modal-backdrop.in {
opacity: .5
}
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5
}
.modal-header::after {
display: table;
clear: both;
content: ""
}
.modal-header .close {
margin-top: -2px
}
.modal-title {
margin: 0;
line-height: 1.5
}
.modal-body {
position: relative;
padding: 15px
}
.modal-footer {
padding: 15px;
text-align: right;
border-top: 1px solid #e5e5e5
}
.modal-footer::after {
display: table;
clear: both;
content: ""
}
.modal-footer .btn + .btn {
margin-bottom: 0;
margin-left: 5px
}
.modal-footer .btn-group .btn + .btn {
margin-left: -1px
}
.modal-footer .btn-block + .btn-block {
margin-left: 0
}
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll
}
@media (min-width: 544px) {
.modal-dialog {
width: 600px;
margin: 30px auto
}
.modal-sm {
width: 300px
}
}
@media (min-width: 768px) {
.modal-lg {
width: 900px
}
}
.tooltip {
position: absolute;
z-index: 1070;
display: block;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: .875rem;
font-style: normal;
font-weight: 400;
line-height: 1.5;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
white-space: normal;
opacity: 0;
line-break: auto
}
.tooltip.in {
opacity: .9
}
.tooltip.bs-tether-element-attached-bottom, .tooltip.tooltip-top {
padding: 5px 0;
margin-top: -3px
}
.tooltip.bs-tether-element-attached-bottom .tooltip-arrow, .tooltip.tooltip-top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #000
}
.tooltip.bs-tether-element-attached-left, .tooltip.tooltip-right {
padding: 0 5px;
margin-left: 3px
}
.tooltip.bs-tether-element-attached-left .tooltip-arrow, .tooltip.tooltip-right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #000
}
.tooltip.bs-tether-element-attached-top, .tooltip.tooltip-bottom {
padding: 5px 0;
margin-top: 3px
}
.tooltip.bs-tether-element-attached-top .tooltip-arrow, .tooltip.tooltip-bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000
}
.tooltip.bs-tether-element-attached-right, .tooltip.tooltip-left {
padding: 0 5px;
margin-left: -3px
}
.tooltip.bs-tether-element-attached-right .tooltip-arrow, .tooltip.tooltip-left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-width: 5px 0 5px 5px;
border-left-color: #000
}
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #fff;
text-align: center;
background-color: #000;
border-radius: .25rem
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid
}
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1060;
display: block;
max-width: 276px;
padding: 1px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: .875rem;
font-style: normal;
font-weight: 400;
line-height: 1.5;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
white-space: normal;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .2);
border-radius: .3rem;
line-break: auto
}
.popover.bs-tether-element-attached-bottom, .popover.popover-top {
margin-top: -10px
}
.popover.bs-tether-element-attached-bottom .popover-arrow, .popover.popover-top .popover-arrow {
bottom: -11px;
left: 50%;
margin-left: -11px;
border-top-color: rgba(0, 0, 0, .25);
border-bottom-width: 0
}
.popover.bs-tether-element-attached-bottom .popover-arrow::after, .popover.popover-top .popover-arrow::after {
bottom: 1px;
margin-left: -10px;
content: "";
border-top-color: #fff;
border-bottom-width: 0
}
.popover.bs-tether-element-attached-left, .popover.popover-right {
margin-left: 10px
}
.popover.bs-tether-element-attached-left .popover-arrow, .popover.popover-right .popover-arrow {
top: 50%;
left: -11px;
margin-top: -11px;
border-right-color: rgba(0, 0, 0, .25);
border-left-width: 0
}
.popover.bs-tether-element-attached-left .popover-arrow::after, .popover.popover-right .popover-arrow::after {
bottom: -10px;
left: 1px;
content: "";
border-right-color: #fff;
border-left-width: 0
}
.popover.bs-tether-element-attached-top, .popover.popover-bottom {
margin-top: 10px
}
.popover.bs-tether-element-attached-top .popover-arrow, .popover.popover-bottom .popover-arrow {
top: -11px;
left: 50%;
margin-left: -11px;
border-top-width: 0;
border-bottom-color: rgba(0, 0, 0, .25)
}
.popover.bs-tether-element-attached-top .popover-arrow::after, .popover.popover-bottom .popover-arrow::after {
top: 1px;
margin-left: -10px;
content: "";
border-top-width: 0;
border-bottom-color: #fff
}
.popover.bs-tether-element-attached-right, .popover.popover-left {
margin-left: -10px
}
.popover.bs-tether-element-attached-right .popover-arrow, .popover.popover-left .popover-arrow {
top: 50%;
right: -11px;
margin-top: -11px;
border-right-width: 0;
border-left-color: rgba(0, 0, 0, .25)
}
.popover.bs-tether-element-attached-right .popover-arrow::after, .popover.popover-left .popover-arrow::after {
right: 1px;
bottom: -10px;
content: "";
border-right-width: 0;
border-left-color: #fff
}
.popover-title {
padding: 8px 14px;
margin: 0;
font-size: 1rem;
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
border-radius: -.7rem -.7rem 0 0
}
.popover-content {
padding: 9px 14px
}
.popover-arrow, .popover-arrow::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid
}
.popover-arrow {
border-width: 11px
}
.popover-arrow::after {
content: "";
border-width: 10px
}
.carousel {
position: relative
}
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden
}
.carousel-inner > .carousel-item {
position: relative;
display: none;
-webkit-transition: .6s ease-in-out left;
-o-transition: .6s ease-in-out left;
transition: .6s ease-in-out left
}
.carousel-inner > .carousel-item > a > img, .carousel-inner > .carousel-item > img {
line-height: 1
}
@media all and (transform-3d),(-webkit-transform-3d) {
.carousel-inner > .carousel-item {
-webkit-transition: -webkit-transform .6s ease-in-out;
-o-transition: transform .6s ease-in-out, -o-transform .6s ease-in-out;
transition: -webkit-transform .6s ease-in-out;
transition: transform .6s ease-in-out;
transition: transform .6s ease-in-out, -webkit-transform .6s ease-in-out, -o-transform .6s ease-in-out;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000px;
perspective: 1000px
}
.carousel-inner > .carousel-item.active.right, .carousel-inner > .carousel-item.next {
left: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0)
}
.carousel-inner > .carousel-item.active.left, .carousel-inner > .carousel-item.prev {
left: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0)
}
.carousel-inner > .carousel-item.active, .carousel-inner > .carousel-item.next.left, .carousel-inner > .carousel-item.prev.right {
left: 0;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
}
.carousel-inner > .active, .carousel-inner > .next, .carousel-inner > .prev {
display: block
}
.carousel-inner > .active {
left: 0
}
.carousel-inner > .next, .carousel-inner > .prev {
position: absolute;
top: 0;
width: 100%
}
.carousel-inner > .next {
left: 100%
}
.carousel-inner > .prev {
left: -100%
}
.carousel-inner > .next.left, .carousel-inner > .prev.right {
left: 0
}
.carousel-inner > .active.left {
left: -100%
}
.carousel-inner > .active.right {
left: 100%
}
.carousel-control {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 15%;
font-size: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
opacity: .5
}
.carousel-control.left {
background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001)));
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%);
background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
background-repeat: repeat-x
}
.carousel-control.right {
right: 0;
left: auto;
background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5)));
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%);
background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
background-repeat: repeat-x
}
.carousel-control:focus, .carousel-control:hover {
color: #fff;
text-decoration: none;
outline: 0;
opacity: .9
}
.carousel-control .icon-next, .carousel-control .icon-prev {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
width: 20px;
height: 20px;
margin-top: -10px;
font-family: serif;
line-height: 1
}
.carousel-control .icon-prev {
left: 50%;
margin-left: -10px
}
.carousel-control .icon-next {
right: 50%;
margin-right: -10px
}
.carousel-control .icon-prev::before {
content: "\2039"
}
.carousel-control .icon-next::before {
content: "\203a"
}
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -30%;
text-align: center;
list-style: none
}
.carousel-indicators li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
cursor: pointer;
background-color: transparent;
border: 1px solid #fff;
border-radius: 10px
}
.carousel-indicators .active {
width: 12px;
height: 12px;
margin: 0;
background-color: #fff
}
.carousel-caption {
position: absolute;
right: 15%;
bottom: 20px;
left: 15%;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, .6)
}
.carousel-caption .btn {
text-shadow: none
}
@media (min-width: 544px) {
.carousel-control .icon-next, .carousel-control .icon-prev {
width: 30px;
height: 30px;
margin-top: -15px;
font-size: 30px
}
.carousel-control .icon-prev {
margin-left: -15px
}
.carousel-control .icon-next {
margin-right: -15px
}
.carousel-caption {
right: 20%;
left: 20%;
padding-bottom: 30px
}
.carousel-indicators {
bottom: 20px
}
}
.clearfix::after {
display: table;
clear: both;
content: ""
}
.center-block {
display: block;
margin-right: auto;
margin-left: auto
}
.pull-xs-left {
float: left !important
}
.pull-xs-right {
float: right !important
}
.pull-xs-none {
float: none !important
}
@media (min-width: 544px) {
.pull-sm-left {
float: left !important
}
.pull-sm-right {
float: right !important
}
.pull-sm-none {
float: none !important
}
}
@media (min-width: 768px) {
.pull-md-left {
float: left !important
}
.pull-md-right {
float: right !important
}
.pull-md-none {
float: none !important
}
}
@media (min-width: 992px) {
.pull-lg-left {
float: left !important
}
.pull-lg-right {
float: right !important
}
.pull-lg-none {
float: none !important
}
}
@media (min-width: 1200px) {
.pull-xl-left {
float: left !important
}
.pull-xl-right {
float: right !important
}
.pull-xl-none {
float: none !important
}
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0
}
.sr-only-focusable:active, .sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto
}
.invisible {
visibility: hidden !important
}
.text-hide {
font: "0/0" a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0
}
.text-justify {
text-align: justify !important
}
.text-nowrap {
white-space: nowrap !important
}
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap
}
.text-xs-left {
text-align: left !important
}
.text-xs-right {
text-align: right !important
}
.text-xs-center {
text-align: center !important
}
@media (min-width: 544px) {
.text-sm-left {
text-align: left !important
}
.text-sm-right {
text-align: right !important
}
.text-sm-center {
text-align: center !important
}
}
@media (min-width: 768px) {
.text-md-left {
text-align: left !important
}
.text-md-right {
text-align: right !important
}
.text-md-center {
text-align: center !important
}
}
@media (min-width: 992px) {
.text-lg-left {
text-align: left !important
}
.text-lg-right {
text-align: right !important
}
.text-lg-center {
text-align: center !important
}
}
@media (min-width: 1200px) {
.text-xl-left {
text-align: left !important
}
.text-xl-right {
text-align: right !important
}
.text-xl-center {
text-align: center !important
}
}
.text-lowercase {
text-transform: lowercase !important
}
.text-uppercase {
text-transform: uppercase !important
}
.text-capitalize {
text-transform: capitalize !important
}
.font-weight-normal {
font-weight: 400
}
.font-weight-bold {
font-weight: 700
}
.font-italic {
font-style: italic
}
.text-muted {
color: #818a91
}
.text-primary {
color: #0275d8 !important
}
a.text-primary:focus, a.text-primary:hover {
color: #025aa5
}
.text-success {
color: #5cb85c !important
}
a.text-success:focus, a.text-success:hover {
color: #449d44
}
.text-info {
color: #5bc0de !important
}
a.text-info:focus, a.text-info:hover {
color: #31b0d5
}
.text-warning {
color: #f0ad4e !important
}
a.text-warning:focus, a.text-warning:hover {
color: #ec971f
}
.text-danger {
color: #d9534f !important
}
a.text-danger:focus, a.text-danger:hover {
color: #c9302c
}
.bg-inverse {
color: #eceeef;
background-color: #373a3c
}
.bg-faded {
background-color: #f7f7f9
}
.bg-primary {
color: #fff !important;
background-color: #0275d8 !important
}
a.bg-primary:focus, a.bg-primary:hover {
background-color: #025aa5
}
.bg-success {
color: #fff !important;
background-color: #5cb85c !important
}
a.bg-success:focus, a.bg-success:hover {
background-color: #449d44
}
.bg-info {
color: #fff !important;
background-color: #5bc0de !important
}
a.bg-info:focus, a.bg-info:hover {
background-color: #31b0d5
}
.bg-warning {
color: #fff !important;
background-color: #f0ad4e !important
}
a.bg-warning:focus, a.bg-warning:hover {
background-color: #ec971f
}
.bg-danger {
color: #fff !important;
background-color: #d9534f !important
}
a.bg-danger:focus, a.bg-danger:hover {
background-color: #c9302c
}
.m-x-auto {
margin-right: auto !important;
margin-left: auto !important
}
.m-a-0 {
margin: 0 0 !important
}
.m-t-0 {
margin-top: 0 !important
}
.m-r-0 {
margin-right: 0 !important
}
.m-b-0 {
margin-bottom: 0 !important
}
.m-l-0 {
margin-left: 0 !important
}
.m-x-0 {
margin-right: 0 !important;
margin-left: 0 !important
}
.m-y-0 {
margin-top: 0 !important;
margin-bottom: 0 !important
}
.m-a-1 {
margin: 1rem 1rem !important
}
.m-t-1 {
margin-top: 1rem !important
}
.m-r-1 {
margin-right: 1rem !important
}
.m-b-1 {
margin-bottom: 1rem !important
}
.m-l-1 {
margin-left: 1rem !important
}
.m-x-1 {
margin-right: 1rem !important;
margin-left: 1rem !important
}
.m-y-1 {
margin-top: 1rem !important;
margin-bottom: 1rem !important
}
.m-a-2 {
margin: 1.5rem 1.5rem !important
}
.m-t-2 {
margin-top: 1.5rem !important
}
.m-r-2 {
margin-right: 1.5rem !important
}
.m-b-2 {
margin-bottom: 1.5rem !important
}
.m-l-2 {
margin-left: 1.5rem !important
}
.m-x-2 {
margin-right: 1.5rem !important;
margin-left: 1.5rem !important
}
.m-y-2 {
margin-top: 1.5rem !important;
margin-bottom: 1.5rem !important
}
.m-a-3 {
margin: 3rem 3rem !important
}
.m-t-3 {
margin-top: 3rem !important
}
.m-r-3 {
margin-right: 3rem !important
}
.m-b-3 {
margin-bottom: 3rem !important
}
.m-l-3 {
margin-left: 3rem !important
}
.m-x-3 {
margin-right: 3rem !important;
margin-left: 3rem !important
}
.m-y-3 {
margin-top: 3rem !important;
margin-bottom: 3rem !important
}
.p-a-0 {
padding: 0 0 !important
}
.p-t-0 {
padding-top: 0 !important
}
.p-r-0 {
padding-right: 0 !important
}
.p-b-0 {
padding-bottom: 0 !important
}
.p-l-0 {
padding-left: 0 !important
}
.p-x-0 {
padding-right: 0 !important;
padding-left: 0 !important
}
.p-y-0 {
padding-top: 0 !important;
padding-bottom: 0 !important
}
.p-a-1 {
padding: 1rem 1rem !important
}
.p-t-1 {
padding-top: 1rem !important
}
.p-r-1 {
padding-right: 1rem !important
}
.p-b-1 {
padding-bottom: 1rem !important
}
.p-l-1 {
padding-left: 1rem !important
}
.p-x-1 {
padding-right: 1rem !important;
padding-left: 1rem !important
}
.p-y-1 {
padding-top: 1rem !important;
padding-bottom: 1rem !important
}
.p-a-2 {
padding: 1.5rem 1.5rem !important
}
.p-t-2 {
padding-top: 1.5rem !important
}
.p-r-2 {
padding-right: 1.5rem !important
}
.p-b-2 {
padding-bottom: 1.5rem !important
}
.p-l-2 {
padding-left: 1.5rem !important
}
.p-x-2 {
padding-right: 1.5rem !important;
padding-left: 1.5rem !important
}
.p-y-2 {
padding-top: 1.5rem !important;
padding-bottom: 1.5rem !important
}
.p-a-3 {
padding: 3rem 3rem !important
}
.p-t-3 {
padding-top: 3rem !important
}
.p-r-3 {
padding-right: 3rem !important
}
.p-b-3 {
padding-bottom: 3rem !important
}
.p-l-3 {
padding-left: 3rem !important
}
.p-x-3 {
padding-right: 3rem !important;
padding-left: 3rem !important
}
.p-y-3 {
padding-top: 3rem !important;
padding-bottom: 3rem !important
}
.pos-f-t {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030
}
.hidden-xs-up {
display: none !important
}
@media (max-width: 543px) {
.hidden-xs-down {
display: none !important
}
}
@media (min-width: 544px) {
.hidden-sm-up {
display: none !important
}
}
@media (max-width: 767px) {
.hidden-sm-down {
display: none !important
}
}
@media (min-width: 768px) {
.hidden-md-up {
display: none !important
}
}
@media (max-width: 991px) {
.hidden-md-down {
display: none !important
}
}
@media (min-width: 992px) {
.hidden-lg-up {
display: none !important
}
}
@media (max-width: 1199px) {
.hidden-lg-down {
display: none !important
}
}
@media (min-width: 1200px) {
.hidden-xl-up {
display: none !important
}
}
.hidden-xl-down {
display: none !important
}
.visible-print-block {
display: none !important
}
@media print {
.visible-print-block {
display: block !important
}
}
.visible-print-inline {
display: none !important
}
@media print {
.visible-print-inline {
display: inline !important
}
}
.visible-print-inline-block {
display: none !important
}
@media print {
.visible-print-inline-block {
display: inline-block !important
}
}
@media print {
.hidden-print {
display: none !important
}
}
/*# sourceMappingURL=bootstrap.min.css.map */
|
peninquen/peninquen.github.io
|
_sass/bootstrap/dist/css/bootstrap.min.css
|
CSS
|
mit
| 120,815
|
<template name="dockingHistoryRejected">
{{> dockingHistoryNav}}
{{#if Template.subscriptionsReady}}
{{> dockingHistoryRejectedForbid}}
<h3 class='text-xs-center m-t-3'>Rejected Dockings</h3>
<div class="col-md-10 offset-md-1">
<p class='text-xs-center text-muted'>
These dockings were rejected by the landlord or due to invalid payment.
Click on the docking for more details and submit a new docking request.
</p>
</div>
<div id="rejectedDockingsAccordion" role="tablist"
aria-multiselectable="false" class='m-t-2'>
{{#if notEmpty rejectedDockings}}
<div class='row'>
{{#each rejectedDockings}}
{{> dockingCollapse docking=(docking "rejectedDockingsAccordion")}}
{{/each}}
</div>
{{else}}
<h5 class='text-xs-center'>You have no rejected Dockings.</h5>
{{/if}}
</div>
{{else}}
{{> loading}}
{{/if}}
</template>
<template name="dockingHistoryRejectedForbid">
</template>
|
gospacecadet/mart-vibe-spacecadet
|
packages/mart-vibe-spacecadet/templates/dockings/docking-history/docking-history-rejected.html
|
HTML
|
mit
| 1,019
|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'sqlite:'.APPPATH.'models/db/vocabulary',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'pdo',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
|
vihoangson/learning_english
|
application/config/database.php
|
PHP
|
mit
| 4,540
|
<?xml version="1.0" ?><!DOCTYPE TS><TS language="it" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>NavajoCoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The NavajoCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>
Questo è un software sperimentale.
Distribuito sotto la licenza software MIT/X11, vedi il file COPYING incluso oppure su http://www.opensource.org/licenses/mit-license.php.
Questo prodotto include software sviluppato dal progetto OpenSSL per l'uso del Toolkit OpenSSL (http://www.openssl.org/), software crittografico scritto da Eric Young (eay@cryptsoft.com) e software UPnP scritto da Thomas Bernard.</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Fai doppio click per modificare o cancellare l'etichetta</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Crea un nuovo indirizzo</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copia l'indirizzo attualmente selezionato nella clipboard</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-46"/>
<source>These are your NavajoCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation>&Copia l'indirizzo</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a NavajoCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Cancella l'indirizzo attualmente selezionato dalla lista</translation>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified NavajoCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Cancella</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation>Copia &l'etichetta</translation>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation>&Modifica</translation>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Testo CSV (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Etichetta</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Indirizzo</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(nessuna etichetta)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Finestra passphrase</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Inserisci la passphrase</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nuova passphrase</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Ripeti la passphrase</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Inserisci la passphrase per il portamonete.<br/>Per piacere usare unapassphrase di <b>10 o più caratteri casuali</b>, o <b>otto o più parole</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Cifra il portamonete</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Quest'operazione necessita della passphrase per sbloccare il portamonete.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Sblocca il portamonete</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Quest'operazione necessita della passphrase per decifrare il portamonete,</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Decifra il portamonete</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Cambia la passphrase</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Inserisci la vecchia e la nuova passphrase per il portamonete.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Conferma la cifratura del portamonete</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Si è sicuri di voler cifrare il portamonete?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>IMPORTANTE: qualsiasi backup del portafoglio effettuato precedentemente dovrebbe essere sostituito con il file del portafoglio criptato appena generato. Per ragioni di sicurezza, i backup precedenti del file del portafoglio non criptato diventeranno inservibili non appena si inizi ad usare il nuovo portafoglio criptato.</translation>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Attenzione: tasto Blocco maiuscole attivo.</translation>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Portamonete cifrato</translation>
</message>
<message>
<location line="-58"/>
<source>NavajoCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Cifratura del portamonete fallita</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Cifratura del portamonete fallita a causa di un errore interno. Il portamonete non è stato cifrato.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>Le passphrase inserite non corrispondono.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>Sblocco del portamonete fallito</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>La passphrase inserita per la decifrazione del portamonete è errata.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Decifrazione del portamonete fallita</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Passphrase del portamonete modificata con successo.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+282"/>
<source>Sign &message...</source>
<translation>Firma il &messaggio...</translation>
</message>
<message>
<location line="+251"/>
<source>Synchronizing with network...</source>
<translation>Sto sincronizzando con la rete...</translation>
</message>
<message>
<location line="-319"/>
<source>&Overview</source>
<translation>&Sintesi</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Mostra lo stato generale del portamonete</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transazioni</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Cerca nelle transazioni</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation>&Esci</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Chiudi applicazione</translation>
</message>
<message>
<location line="+6"/>
<source>Show information about NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Informazioni su &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Mostra informazioni su Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opzioni...</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation>&Cifra il portamonete...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Backup Portamonete...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Cambia la passphrase...</translation>
</message>
<message numerus="yes">
<location line="+259"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-256"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Send coins to a NavajoCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Modify configuration options for NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation>Backup portamonete in un'altra locazione</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Cambia la passphrase per la cifratura del portamonete</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation>Finestra &Debug</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Apri la console di degugging e diagnostica</translation>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation>&Verifica messaggio...</translation>
</message>
<message>
<location line="-202"/>
<source>NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation>Portamonete</translation>
</message>
<message>
<location line="+180"/>
<source>&About NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Mostra/Nascondi</translation>
</message>
<message>
<location line="+9"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>&File</source>
<translation>&File</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>&Impostazioni</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&Aiuto</translation>
</message>
<message>
<location line="+12"/>
<source>Tabs toolbar</source>
<translation>Barra degli strumenti "Tabs"</translation>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>NavajoCoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+75"/>
<source>%n active connection(s) to NavajoCoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="-312"/>
<source>About NavajoCoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about NavajoCoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+297"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation>Aggiornato</translation>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation>In aggiornamento...</translation>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Transazione inviata</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Transazione ricevuta</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Data: %1
Quantità: %2
Tipo: %3
Indirizzo: %4
</translation>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid NavajoCoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Il portamonete è <b>cifrato</b> e attualmente <b>sbloccato</b></translation>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Il portamonete è <b>cifrato</b> e attualmente <b>bloccato</b></translation>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation><numerusform>%n ora</numerusform><numerusform>%n ore</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n giorno</numerusform><numerusform>%n giorni</numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. NavajoCoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation>Avviso di rete</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>Quantità:</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>Byte:</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>Importo:</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>Priorità:</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>Commissione:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Low Output:</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation>no</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>Dopo Commissione:</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>Resto:</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>(de)seleziona tutto</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>Modalità Albero</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>Modalità Lista</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Importo</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Indirizzo</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>Conferme:</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>Confermato</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>Priorità</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation>Copia l'indirizzo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copia l'etichetta</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>Copia l'importo</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>Copia l'ID transazione</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>Copia quantità</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>Copia commissione</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Copia dopo commissione</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copia byte</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Copia priorità</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copia low output</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copia resto</translation>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>massima</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>alta</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>medio-alta</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>media</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>medio-bassa</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>bassa</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>infima</translation>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation>si</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(nessuna etichetta)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>resto da %1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(resto)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Modifica l'indirizzo</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etichetta</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Indirizzo</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation>Nuovo indirizzo di ricezione</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Nuovo indirizzo d'invio</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Modifica indirizzo di ricezione</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Modifica indirizzo d'invio</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>L'indirizzo inserito "%1" è già in rubrica.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid NavajoCoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Impossibile sbloccare il portamonete.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Generazione della nuova chiave non riuscita.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>NavajoCoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opzioni</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Principale</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Paga la &commissione</translation>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start NavajoCoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start NavajoCoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation>Rete</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the NavajoCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Mappa le porte tramite l'&UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the NavajoCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>&IP del proxy:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Porta:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Porta del proxy (es. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &Version:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Versione SOCKS del proxy (es. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Finestra</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Mostra solo un'icona nel tray quando si minimizza la finestra</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimizza sul tray invece che sulla barra delle applicazioni</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Riduci ad icona, invece di uscire dall'applicazione quando la finestra viene chiusa. Quando questa opzione è attivata, l'applicazione verrà chiusa solo dopo aver selezionato Esci nel menu.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimizza alla chiusura</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Mostra</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>&Lingua Interfaccia Utente:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting NavajoCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Unità di misura degli importi in:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Scegli l'unità di suddivisione predefinita per l'interfaccia e per l'invio di monete</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show NavajoCoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Mostra gli indirizzi nella lista delle transazioni</translation>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation>Mostrare/non mostrare le funzionalita' di controllo della moneta.</translation>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Cancella</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation>predefinito</translation>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting NavajoCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>L'indirizzo proxy che hai fornito è invalido.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Modulo</translation>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the NavajoCoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation>Portamonete</translation>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation>Saldo spendibile attuale</translation>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation>Immaturo:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Importo scavato che non è ancora maturato</translation>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation>Totale:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>Saldo totale attuale</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Transazioni recenti</b></translation>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation>fuori sincrono</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Nome del client</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation>N/D</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Versione client</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informazione</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Versione OpenSSL in uso</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Tempo di avvio</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Rete</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Numero connessioni</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Block chain</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Numero attuale di blocchi</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Numero totale stimato di blocchi</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Ora dell blocco piu recente</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Apri</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the NavajoCoin-Qt help message to get a list with possible NavajoCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Console</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Data di creazione</translation>
</message>
<message>
<location line="-104"/>
<source>NavajoCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>NavajoCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>File log del Debug</translation>
</message>
<message>
<location line="+7"/>
<source>Open the NavajoCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Svuota console</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the NavajoCoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Usa le frecce direzionali per navigare la cronologia, and <b>Ctrl-L</b> per cancellarla.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Scrivi <b>help</b> per un riassunto dei comandi disponibili</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Spedisci Bitcoin</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation>Funzionalità di Coin Control</translation>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation>Input...</translation>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation>selezionato automaticamente</translation>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation>Fondi insufficienti!</translation>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation>Quantità:</translation>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation>Byte:</translation>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation>Importo:</translation>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 NAV</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation>Priorità:</translation>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation>Commissione:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Low Output:</translation>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation>Dopo Commissione:</translation>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Spedisci a diversi beneficiari in una volta sola</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&Aggiungi beneficiario</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Cancella &tutto</translation>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+16"/>
<source>123.456 NAV</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Conferma la spedizione</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Spedisci</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter a NavajoCoin/NavajoCoin address (e.g. sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation>Copia quantità</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copia l'importo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation>Copia commissione</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Copia dopo commissione</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copia byte</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Copia priorità</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copia low output</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copia resto</translation>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Conferma la spedizione di bitcoin</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>L'indirizzo del beneficiario non è valido, per cortesia controlla.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>L'importo da pagare dev'essere maggiore di 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>L'importo è superiore al saldo attuale</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Il totale è superiore al saldo attuale includendo la commissione %1.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Trovato un indirizzo doppio, si può spedire solo una volta a ciascun indirizzo in una singola operazione.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid NavajoCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(nessuna etichetta)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Importo:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Paga &a:</translation>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Inserisci un'etichetta per questo indirizzo, per aggiungerlo nella rubrica</translation>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation>&Etichetta</translation>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Incollare l'indirizzo dagli appunti</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a NavajoCoin/NavajoCoin address (e.g. sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Firme - Firma / Verifica un messaggio</translation>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation>&Firma il messaggio</translation>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Puoi firmare messeggi con i tuoi indirizzi per dimostrare che sono tuoi. Fai attenzione a non firmare niente di vago, visto che gli attacchi di phishing potrebbero cercare di spingerti a mettere la tua firma su di loro. Firma solo dichiarazioni completamente dettagliate con cui sei d'accordo.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Incollare l'indirizzo dagli appunti</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Inserisci qui il messaggio che vuoi firmare</translation>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Copia la firma corrente nella clipboard</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this NavajoCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation>Reimposta tutti i campi della firma</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Cancella &tutto</translation>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation>&Verifica Messaggio</translation>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Inserisci l'indirizzo per la firma, il messaggio (verifica di copiare esattamente anche i ritorni a capo, gli spazi, le tabulazioni, etc) e la firma qui sotto, per verificare il messaggio. Verifica che il contenuto della firma non sia più grande di quello del messaggio per evitare attacchi di tipo man-in-the-middle.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified NavajoCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation>Reimposta tutti i campi della verifica messaggio</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a NavajoCoin/NavajoCoin address (e.g. sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Clicca "Firma il messaggio" per ottenere la firma</translation>
</message>
<message>
<location line="+3"/>
<source>Enter NavajoCoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>L'indirizzo inserito non è valido.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Per favore controlla l'indirizzo e prova ancora</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>L'indirizzo bitcoin inserito non è associato a nessuna chiave.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Sblocco del portafoglio annullato.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>La chiave privata per l'indirizzo inserito non è disponibile.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Firma messaggio fallita.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Messaggio firmato.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Non è stato possibile decodificare la firma.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Per favore controlla la firma e prova ancora.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>La firma non corrisponde al sunto del messaggio.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Verifica messaggio fallita.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Messaggio verificato.</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation>Aperto fino a %1</translation>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation>in conflitto</translation>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/non confermato</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 conferme</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Stato</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, trasmesso attraverso %n nodo</numerusform><numerusform>, trasmesso attraverso %n nodi</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Sorgente</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generato</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Da</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>A</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>proprio indirizzo</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>etichetta</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Credito</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>matura in %n ulteriore blocco</numerusform><numerusform>matura in altri %n blocchi</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>non accettate</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debito</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Commissione transazione</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Importo netto</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Messaggio</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Commento</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>ID della transazione</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 60 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Informazione di debug</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transazione</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>Input</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Importo</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>vero</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>falso</translation>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation>, non è stato ancora trasmesso con successo</translation>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation>sconosciuto</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Dettagli sulla transazione</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Questo pannello mostra una descrizione dettagliata della transazione</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Indirizzo</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Importo</translation>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation>Aperto fino a %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Confermato (%1 conferme)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Aperto per %n altro blocco</numerusform><numerusform>Aperto per altri %n blocchi</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation>Offline</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation>Non confermato:</translation>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation>In conferma (%1 di %2 conferme raccomandate)</translation>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation>In conflitto</translation>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation>Immaturo (%1 conferme, sarà disponibile fra %2)</translation>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Questo blocco non è stato ricevuto da altri nodi e probabilmente non sarà accettato!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generati, ma non accettati</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Ricevuto tramite</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Ricevuto da</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Spedito a</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pagamento a te stesso</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Ottenuto dal mining</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(N / a)</translation>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Stato della transazione. Passare con il mouse su questo campo per vedere il numero di conferme.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Data e ora in cui la transazione è stata ricevuta.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Tipo di transazione.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Indirizzo di destinazione della transazione.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Importo rimosso o aggiunto al saldo.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation>Tutti</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Oggi</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Questa settimana</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Questo mese</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Il mese scorso</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Quest'anno</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Intervallo...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Ricevuto tramite</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Spedito a</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>A te</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Ottenuto dal mining</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Altro</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Inserisci un indirizzo o un'etichetta da cercare</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Importo minimo</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Copia l'indirizzo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copia l'etichetta</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copia l'importo</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Copia l'ID transazione</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Modifica l'etichetta</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Mostra i dettagli della transazione</translation>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Testo CSV (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Confermato</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etichetta</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Indirizzo</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Importo</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Intervallo:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>a</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>NavajoCoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>Utilizzo:</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or navajocoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>Lista comandi
</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>Aiuto su un comando
</translation>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation>Opzioni:
</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: navajocoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: navajocoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation>Specifica il file portafoglio (nella cartella dati)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Specifica la cartella dati
</translation>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Imposta la dimensione cache del database in megabyte (predefinita: 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Mantieni al massimo <n> connessioni ai peer (predefinite: 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Connessione ad un nodo per ricevere l'indirizzo del peer, e disconnessione</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>Specifica il tuo indirizzo pubblico</translation>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Soglia di disconnessione dei peer di cattiva qualità (predefinita: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Numero di secondi di sospensione che i peer di cattiva qualità devono trascorrere prima di riconnettersi (predefiniti: 86400)</translation>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Errore riscontrato durante l'impostazione della porta RPC %u per l'ascolto su IPv4: %s</translation>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Accetta da linea di comando e da comandi JSON-RPC
</translation>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Esegui in background come demone e accetta i comandi
</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>Utilizza la rete di prova
</translation>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Accetta connessioni dall'esterno (predefinito: 1 se no -proxy o -connect)</translation>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Errore riscontrato durante l'impostazione della porta RPC %u per l'ascolto su IPv6, tornando su IPv4: %s</translation>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Attenzione: -paytxfee è molto alta. Questa è la commissione che si paga quando si invia una transazione.</translation>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong NavajoCoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Attenzione: errore di lettura di wallet.dat! Tutte le chiave lette correttamente, ma i dati delle transazioni o le voci in rubrica potrebbero mancare o non essere corretti.</translation>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Attenzione: wallet.dat corrotto, dati salvati! Il wallet.dat originale salvato come wallet.{timestamp}.bak in %s; se il tuo bilancio o le transazioni non sono corrette dovresti ripristinare da un backup.</translation>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Tenta di recuperare le chiavi private da un wallet.dat corrotto</translation>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation>Opzioni creazione blocco:</translation>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation>Connetti solo al nodo specificato</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Scopri proprio indirizzo IP (predefinito: 1 se in ascolto e no -externalip)</translation>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Impossibile mettersi in ascolto su una porta. Usa -listen=0 se vuoi usare questa opzione.</translation>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Buffer di ricezione massimo per connessione, <n>*1000 byte (predefinito: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Buffer di invio massimo per connessione, <n>*1000 byte (predefinito: 1000)</translation>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Connetti solo a nodi nella rete <net> (IPv4, IPv6 o Tor)</translation>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>Opzioni SSL: (vedi il wiki di Bitcoin per le istruzioni di configurazione SSL)</translation>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Invia le informazioni di trace/debug alla console invece che al file debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Imposta dimensione minima del blocco in bytes (predefinita: 0)</translation>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Riduci il file debug.log all'avvio del client (predefinito: 1 se non impostato -debug)</translation>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Specifica il timeout di connessione in millisecondi (predefinito: 5000)</translation>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Usa UPnP per mappare la porta in ascolto (predefinito: 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Usa UPnP per mappare la porta in ascolto (predefinito: 1 when listening)</translation>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation>Nome utente per connessioni JSON-RPC
</translation>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Attenzione: questa versione è obsoleta, aggiornamento necessario!</translation>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrotto, salvataggio fallito</translation>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation>Password per connessioni JSON-RPC
</translation>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=navajocoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "NavajoCoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Consenti connessioni JSON-RPC dall'indirizzo IP specificato
</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Inviare comandi al nodo in esecuzione su <ip> (predefinito: 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Esegui il comando quando il miglior block cambia(%s nel cmd è sostituito dall'hash del blocco)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Esegui comando quando una transazione del portafoglio cambia (%s in cmd è sostituito da TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>Aggiorna il wallet all'ultimo formato</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Impostare la quantità di chiavi di riserva a <n> (predefinita: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Ripeti analisi della catena dei blocchi per cercare le transazioni mancanti dal portamonete
</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Utilizzare OpenSSL (https) per le connessioni JSON-RPC
</translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>File certificato del server (predefinito: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Chiave privata del server (predefinito: server.pem)</translation>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation>Questo messaggio di aiuto
</translation>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. NavajoCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-98"/>
<source>NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Impossibile collegarsi alla %s su questo computer (bind returned error %d, %s)</translation>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Consenti ricerche DNS per aggiungere nodi e collegare
</translation>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation>Caricamento indirizzi...</translation>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Errore caricamento wallet.dat: Wallet corrotto</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of NavajoCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart NavajoCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>Errore caricamento wallet.dat</translation>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Indirizzo -proxy non valido: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Rete sconosciuta specificata in -onlynet: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Versione -socks proxy sconosciuta richiesta: %i</translation>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Impossibile risolvere -bind address: '%s'</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Impossibile risolvere indirizzo -externalip: '%s'</translation>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Importo non valido per -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>Importo non valido</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>Fondi insufficienti</translation>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation>Caricamento dell'indice del blocco...</translation>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Elérendő csomópont megadása and attempt to keep the connection open</translation>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. NavajoCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation>Caricamento portamonete...</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>Non è possibile retrocedere il wallet</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>Non è possibile scrivere l'indirizzo predefinito</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>Ripetere la scansione...</translation>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation>Caricamento completato</translation>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation>Per usare la opzione %s</translation>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation>Errore</translation>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Devi settare rpcpassword=<password> nel file di configurazione: %s Se il file non esiste, crealo con i permessi di amministratore</translation>
</message>
</context>
</TS>
|
sherlockcoin/navbetatest2
|
src/qt/locale/bitcoin_it.ts
|
TypeScript
|
mit
| 119,607
|
using System;
class Bad
{
class Range
{
private int[] rarray = new int[2];
public Range(int min, int max)
{
if (min <= max)
{
rarray[0] = min;
rarray[1] = max;
}
}
public int[] Get() => rarray;
}
public static void Main(string[] args)
{
var r = new Range(1, 10);
var r_range = r.Get();
r_range[0] = 500;
Console.WriteLine("Min: " + r.Get()[0] + " Max: " + r.Get()[1]);
// prints "Min: 500 Max: 10"
}
}
|
github/codeql
|
csharp/ql/test/query-tests/Bad Practices/Implementation Hiding/ExposeRepresentation/ExposeRepresentationBad.cs
|
C#
|
mit
| 578
|
package devopsdistilled.operp.client.main;
import devopsdistilled.operp.client.abstracts.Controller;
public abstract class TaskPaneController extends Controller {
}
|
njmube/OpERP
|
OpERP/src/main/java/devopsdistilled/operp/client/main/TaskPaneController.java
|
Java
|
mit
| 168
|
#!/usr/bin/env node
'use strict'
var fs = require('fs')
var Promise = require('promise')
var colors = require('colors')
var _ = require('underscore')
const areaNameRegex = new RegExp('^[a-zA-Z]+$')
const templatesDir = process.cwd() + '/_scripts/.templates'
const areasDir = process.cwd() + '/src/app/areas'
var areasToCreate = _.uniq(process.argv.slice(2))
var areasPromises = []
areasToCreate.forEach(function (areaName) {
if (canCreateArea(areasDir + '/' + areaName)) {
areasPromises.push(createAreaDirStructure(areaName))
} else {
areasToCreate = _.without(areasToCreate, areaName)
}
})
Promise.all(areasPromises).then(function (results) {
results.forEach(function (result, i) {
console.log(colors.cyan.bold('✔ Created area: ', areasToCreate[i]))
result.forEach(function (file) {
console.log(colors.green(' +'), file)
})
})
})
function dirExists (filePath) {
try {
return fs.statSync(filePath).isDirectory()
} catch (err) {
return false
}
}
function canCreateArea (areaName) {
if (areaNameRegex.test(areaName.split('/').pop())) {
if (dirExists(areaName)) {
console.log(colors.yellow('! Skipping', colors.bold(areaName.split('/').pop()), ', area already exists'))
return false
}
return true
} else {
console.log(colors.red('! Skipping', colors.bold(areaName.split('/').pop()), ', wrong name, you can use letters only'))
return false
}
}
function createAreaDirStructure (areaName) {
try {
const areaDir = areasDir + '/' + areaName
const areaTestsDir = areasDir + '/' + areaName + '/' + 'test'
var filePromises = []
process.chdir(areasDir)
fs.mkdirSync(areaName)
fs.mkdirSync(areaName + '/test')
filePromises.push(createFileFromTemplate(areaDir, 'actions.js', 'actions.tmpl.js', { areaName: areaName }))
filePromises.push(createFileFromTemplate(areaDir, 'reducer.js', 'reducer.tmpl.js', { areaName: areaName }))
filePromises.push(createFileFromTemplate(areaTestsDir, 'reducer.spec.js', 'reducer.spec.tmpl.js', { areaName: areaName }))
process.chdir(areasDir)
return Promise.all(filePromises)
} catch (e) {
return false
}
}
function createFileFromTemplate (dir, filename, templateName, templateData) {
return new Promise(function (resolve, reject) {
fs.readFile(templatesDir + '/' + templateName, function (err, data) {
var fileContent = new Buffer((_.template(data.toString()))(templateData))
process.chdir(dir)
fs.open(filename, 'w', function (err, fd) {
if (err) {
throw 'Error opening file: ' + err
}
fs.write(fd, fileContent, 0, fileContent.length, null, function (err) {
if (err) {
throw 'Error writing file: ' + err
}
fs.close(fd, function () {
process.chdir(areasDir)
resolve(dir + '/' + filename)
})
})
})
})
})
}
|
dprokop/r-kit
|
_scripts/createArea.js
|
JavaScript
|
mit
| 3,147
|
using System;
using System.Collections;
using System.IO;
using System.Text;
using GostCryptography.Properties;
namespace GostCryptography.Asn1.Ber
{
static class Asn1Util
{
private static readonly byte[] Base64DecodeTable =
{
0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
60, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10, 0x11, 0x12, 0x13, 20, 0x15, 0x16,
0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 30, 0x1f, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 40, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 50, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff
};
private static readonly byte[] Base64EncodeTable =
{
0x41, 0x42, 0x43, 0x44, 0x45, 70, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 80,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 90, 0x61, 0x62, 0x63, 100, 0x65, 0x66,
0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 110, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
0x77, 120, 0x79, 0x7a, 0x30, 0x31, 50, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f
};
public static string BcdToString(byte[] bcd)
{
var index = 0;
var builder = new StringBuilder(bcd.Length * 2);
for (var i = 0; i < (bcd.Length * 2); i++)
{
byte num3;
if ((i % 2) == 0)
{
num3 = (byte)(bcd[index] & 15);
}
else
{
num3 = (byte)UrShift(bcd[index++], 4);
}
if (num3 == 15)
{
break;
}
builder.Append((num3 < 10) ? ((char)(num3 + 0x30)) : ((char)((num3 + 0x41) - 10)));
}
return builder.ToString();
}
public static byte[] DecodeBase64Array(byte[] srcArray)
{
var num = srcArray.Length / 4;
if ((4 * num) != srcArray.Length)
{
throw ExceptionUtility.Argument("srcArray", Resources.Asn1InvalidEncodedDataLength);
}
var num2 = 0;
var num3 = num;
if (srcArray.Length != 0)
{
if (srcArray[srcArray.Length - 1] == 0x3d)
{
num2++;
num3--;
}
if (srcArray[srcArray.Length - 2] == 0x3d)
{
num2++;
}
}
var buffer = new byte[(3 * num) - num2];
var num4 = 0;
var num5 = 0;
for (var i = 0; i < num3; i++)
{
var num7 = DecodeBase64Char(srcArray[num4++]);
var num8 = DecodeBase64Char(srcArray[num4++]);
var num9 = DecodeBase64Char(srcArray[num4++]);
var num10 = DecodeBase64Char(srcArray[num4++]);
buffer[num5++] = (byte)((num7 << 2) | (num8 >> 4));
buffer[num5++] = (byte)((num8 << 4) | (num9 >> 2));
buffer[num5++] = (byte)((num9 << 6) | num10);
}
if (num2 != 0)
{
var num11 = DecodeBase64Char(srcArray[num4++]);
var num12 = DecodeBase64Char(srcArray[num4++]);
buffer[num5++] = (byte)((num11 << 2) | (num12 >> 4));
if (num2 == 1)
{
var num13 = DecodeBase64Char(srcArray[num4++]);
buffer[num5++] = (byte)((num12 << 4) | (num13 >> 2));
}
}
return buffer;
}
private static int DecodeBase64Char(byte c)
{
var num = (c < 0x80) ? Base64DecodeTable[c - 40] : -1;
if (num < 0)
{
throw ExceptionUtility.Argument("c", Resources.Asn1IllegalCharacter, c);
}
return num;
}
public static byte[] EncodeBase64Array(byte[] srcArray)
{
var num = srcArray.Length / 3;
var num2 = srcArray.Length - (3 * num);
var num3 = 4 * ((srcArray.Length + 2) / 3);
var buffer = new byte[num3];
var num4 = 0;
var num5 = 0;
for (var i = 0; i < num; i++)
{
var num7 = srcArray[num4++] & 0xff;
var num8 = srcArray[num4++] & 0xff;
var num9 = srcArray[num4++] & 0xff;
buffer[num5++] = Base64EncodeTable[num7 >> 2];
buffer[num5++] = Base64EncodeTable[((num7 << 4) & 0x3f) | (num8 >> 4)];
buffer[num5++] = Base64EncodeTable[((num8 << 2) & 0x3f) | (num9 >> 6)];
buffer[num5++] = Base64EncodeTable[num9 & 0x3f];
}
if (num2 != 0)
{
var num10 = srcArray[num4++] & 0xff;
buffer[num5++] = Base64EncodeTable[num10 >> 2];
if (num2 == 1)
{
buffer[num5++] = Base64EncodeTable[(num10 << 4) & 0x3f];
buffer[num5++] = 0x3d;
buffer[num5++] = 0x3d;
return buffer;
}
var num11 = srcArray[num4++] & 0xff;
buffer[num5++] = Base64EncodeTable[((num10 << 4) & 0x3f) | (num11 >> 4)];
buffer[num5++] = Base64EncodeTable[(num11 << 2) & 0x3f];
buffer[num5++] = 0x3d;
}
return buffer;
}
public static byte[] GetAddressBytes(string ipaddress)
{
var index = 0;
var buffer = new byte[4];
var tokenizer = new Tokenizer(ipaddress, ".");
try
{
while (tokenizer.HasMoreTokens())
{
buffer[index] = Convert.ToByte(tokenizer.NextToken());
index++;
}
}
catch (Exception)
{
}
return buffer;
}
public static int GetBytesCount(long val)
{
return Asn1RunTime.GetLongBytesCount(val);
}
public static int GetUlongBytesCount(long val)
{
return Asn1RunTime.GetUlongBytesCount(val);
}
public static byte[] StringToBcd(string str)
{
int num2;
var buffer = new byte[(str.Length + 1) / 2];
byte num = 0;
var num3 = num2 = 0;
while (num3 < str.Length)
{
var c = char.ToUpper(str[num3]);
var flag = char.IsDigit(c);
if (!flag && ((c < 'A') || (c >= 'F')))
{
throw ExceptionUtility.CryptographicException(Resources.Asn1ValueParseException, str, num3);
}
if ((num3 % 2) != 0)
{
num = (byte)(num | ((byte)(((byte)((flag != null) ? (c - 0x30) : ((c - 0x41) + 10))) << 4)));
buffer[num2++] = num;
}
else
{
num = flag ? ((byte)(c - '0')) : ((byte)((c - 'A') + 10));
}
num3++;
}
if ((num3 % 2) != 0)
{
buffer[num2++] = (byte)(num | 240);
}
return buffer;
}
public static void ToArray(ICollection c, object[] objects)
{
var num = 0;
var enumerator = c.GetEnumerator();
while (enumerator.MoveNext())
{
objects[num++] = enumerator.Current;
}
}
public static byte[] ToByteArray(string sourceString)
{
return Encoding.UTF8.GetBytes(sourceString);
}
public static char[] ToCharArray(byte[] byteArray)
{
return Encoding.UTF8.GetChars(byteArray);
}
public static string ToHexString(byte b)
{
var builder = new StringBuilder(4);
var str = Convert.ToString(b, 0x10);
var length = str.Length;
if (length < 2)
{
builder.Append('0');
builder.Append(str);
}
else if (length > 2)
{
builder.Append(str[length - 2]);
builder.Append(str[length - 1]);
}
else
{
builder.Append(str);
}
return builder.ToString();
}
public static string ToHexString(byte[] b, int offset, int nbytes)
{
var builder = new StringBuilder(nbytes * 4);
for (var i = 0; i < nbytes; i++)
{
builder.Append(ToHexString(b[offset + i]));
builder.Append(" ");
}
return builder.ToString();
}
public static int UrShift(int number, int bits)
{
if (number >= 0)
{
return (number >> bits);
}
return ((number >> bits) + (2 << ~bits));
}
public static int UrShift(int number, long bits)
{
return UrShift(number, (int)bits);
}
public static long UrShift(long number, int bits)
{
if (number >= 0L)
{
return (number >> bits);
}
return ((number >> bits) + (2L << ~bits));
}
public static long UrShift(long number, long bits)
{
return UrShift(number, (int)bits);
}
public static void WriteStackTrace(Exception throwable, TextWriter stream)
{
stream.Write(throwable.StackTrace);
stream.Flush();
}
}
}
|
BenderRodrigez/GostCryptography
|
Source/GostCryptography/Asn1/Ber/Asn1Util.cs
|
C#
|
mit
| 7,576
|
"""
Experiment for XGBoost + CF
Aim: To find the best tc(max_depth), mb(min_child_weight), mf(colsample_bytree * 93), ntree
tc: [13, 15, 17]
mb: [5, 7, 9]
mf: [40, 45, 50, 55, 60]
ntree: [160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360]
Averaging 20 models
Summary
Best
loss ntree
mf 40 45 50 55 60 40 45 50 55 60
tc mb
13 5 0.4471 0.4471 0.4473 0.4471 0.4476 300 300 280 280 260
7 0.4477 0.4475 0.4469 0.4472 0.4481 340 320 300 300 300
9 0.4485 0.4484 0.4487 0.4488 0.4487 360 360 340 340 340
15 5 0.4471 *0.4465* 0.4471 0.4476 0.4478 260 *260* 240 240 240
7 0.4473 0.4468 0.4473 0.4474 0.4478 300 280 260 260 260
9 0.4483 0.4480 0.4483 0.4484 0.4492 340 320 300 300 280
17 5 0.4471 0.4472 0.4474 0.4476 0.4478 240 240 220 220 200
7 0.4474 0.4470 0.4468 0.4475 0.4473 280 260 260 240 240
9 0.4481 0.4480 0.4476 0.4480 0.4486 320 300 280 260 260
Time: 1 day, 7:37:21 on i7-4790k 32G MEM GTX660
"""
import numpy as np
import scipy as sp
import pandas as pd
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import log_loss
from datetime import datetime
import os
from sklearn.grid_search import ParameterGrid
import xgboost as xgb
from utility import *
path = os.getcwd() + '/'
path_log = path + 'logs/'
file_train = path + 'train.csv'
training = pd.read_csv(file_train, index_col = 0)
num_train = training.shape[0]
y = training['target'].values
yMat = pd.get_dummies(training['target']).values
X = training.iloc[:,:93].values
kf = StratifiedKFold(y, n_folds=5, shuffle = True, random_state = 345)
for train_idx, valid_idx in kf:
break
y_train_1 = yMat[train_idx].argmax(1)
y_train = yMat[train_idx]
y_valid = yMat[valid_idx]
X2, ignore = count_feature(X)
dtrain , dvalid= xgb.DMatrix(X2[train_idx], label = y_train_1), xgb.DMatrix(X2[valid_idx])
#
nIter = 20
nt = 360
nt_lst = range(160, 370, 20)
nt_len = len(nt_lst)
bf = .8 # subsample
sh = .1 # eta
# tc:max_depth, mb:min_child_weight, mf(max features):colsample_bytree * 93
param_grid = {'tc':[13, 15, 17], 'mb':[5, 7, 9], 'mf':[40, 45, 50, 55, 60]}
scores = []
t0 = datetime.now()
for params in ParameterGrid(param_grid):
tc = params['tc']
mb = params['mb']
mf = params['mf']
cs = float(mf) / X.shape[1]
print tc, mb, mf
predAll = [np.zeros(y_valid.shape) for k in range(nt_len)]
for i in range(nIter):
seed = 112233 + i
param = {'bst:max_depth':tc, 'bst:eta':sh,'objective':'multi:softprob','num_class':9,
'min_child_weight':mb, 'subsample':bf, 'colsample_bytree':cs,
'silent':1, 'nthread':8, 'seed':seed}
plst = param.items()
bst = xgb.train(plst, dtrain, nt)
for s in range(nt_len):
ntree = nt_lst[s]
pred = bst.predict(dvalid, ntree_limit = ntree).reshape(y_valid.shape)
predAll[s] += pred
scores.append({'tc':tc, 'mb':mb, 'mf':mf, 'ntree':ntree, 'nModels':i+1, 'seed':seed,
'valid':log_loss(y_valid, pred),
'valid_avg':log_loss(y_valid, predAll[s] / (i+1))})
print scores[-4], datetime.now() - t0
df = pd.DataFrame(scores)
if os.path.exists(path_log) is False:
print 'mkdir', path_log
os.mkdir(path_log)
df.to_csv(path_log + 'exp_XGB_CF_tc_mb_mf_ntree.csv')
keys = ['tc', 'mb', 'mf', 'ntree']
grouped = df.groupby(keys)
pd.set_option('display.precision', 5)
print pd.DataFrame({'loss':grouped['valid_avg'].last().unstack().min(1),
'ntree':grouped['valid_avg'].last().unstack().idxmin(1)}).unstack()
# loss ntree
# mf 40 45 50 55 60 40 45 50 55 60
# tc mb
# 13 5 0.4471 0.4471 0.4473 0.4471 0.4476 300 300 280 280 260
# 7 0.4477 0.4475 0.4469 0.4472 0.4481 340 320 300 300 300
# 9 0.4485 0.4484 0.4487 0.4488 0.4487 360 360 340 340 340
# 15 5 0.4471 0.4465 0.4471 0.4476 0.4478 260 260 240 240 240
# 7 0.4473 0.4468 0.4473 0.4474 0.4478 300 280 260 260 260
# 9 0.4483 0.4480 0.4483 0.4484 0.4492 340 320 300 300 280
# 17 5 0.4471 0.4472 0.4474 0.4476 0.4478 240 240 220 220 200
# 7 0.4474 0.4470 0.4468 0.4475 0.4473 280 260 260 240 240
# 9 0.4481 0.4480 0.4476 0.4480 0.4486 320 300 280 260 260
print pd.DataFrame({'loss':grouped['valid'].mean().unstack().min(1),
'ntree':grouped['valid'].mean().unstack().idxmin(1)}).unstack()
# loss ntree
# mf 40 45 50 55 60 40 45 50 55 60
# tc mb
# 13 5 0.4563 0.4564 0.4564 0.4561 0.4566 280 260 260 260 240
# 7 0.4565 0.4563 0.4557 0.4561 0.4569 320 300 300 300 280
# 9 0.4571 0.4569 0.4571 0.4573 0.4570 340 340 320 300 300
# 15 5 0.4567 0.4559 0.4565 0.4571 0.4571 260 240 240 220 220
# 7 0.4565 0.4558 0.4562 0.4564 0.4568 280 260 260 260 240
# 9 0.4570 0.4567 0.4570 0.4570 0.4577 300 300 280 280 260
# 17 5 0.4568 0.4569 0.4570 0.4572 0.4574 220 220 200 200 200
# 7 0.4567 0.4563 0.4559 0.4567 0.4564 260 240 240 220 220
# 9 0.4571 0.4569 0.4565 0.4567 0.4573 280 280 260 260 240
#
criterion = df.apply(lambda x: x['tc']==15 and x['mb']==5 and x['mf']==45, axis = 1)
grouped = df[criterion].groupby('ntree')
g = grouped[['valid']].mean()
g['valid_avg'] = grouped['valid_avg'].last()
print g
# valid valid_avg
# ntree
# 160 0.461023 0.452912
# 180 0.458513 0.450111
# 200 0.456939 0.448232
# 220 0.456147 0.447141
# 240 0.455870 0.446598
# 260 0.456097 0.446525
# 280 0.456657 0.446827
# 300 0.457434 0.447327
# 320 0.458462 0.448101
# 340 0.459635 0.449036
# 360 0.460977 0.450160
ax = g.plot()
ax.set_title('XGB+CF max_depth=15\n min_child_weight=5, colsample_bytree=45/93.')
ax.set_ylabel('Logloss')
fig = ax.get_figure()
fig.savefig(path_log + 'exp_XGB_CF_tc_mb_mf_ntree.png')
|
tks0123456789/kaggle-Otto
|
exp_XGB_CF_tc_mb_mf_ntree.py
|
Python
|
mit
| 6,574
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon([/*#__PURE__*/_jsx("path", {
d: "m14 16.64-4-1.45V17h4zM6 8.5c.15 0 .3-.03.44-.1.49-.24.7-.84.46-1.34-.19-.41-.59-.56-.9-.56-.15 0-.3.03-.44.1-.32.16-.45.42-.5.56-.05.15-.12.44.04.77.2.42.59.57.9.57zm13.16 2.52-6.69-2.41-.7 1.91 8.59 3.11.01-.02c.19-.51.17-1.05-.06-1.53-.23-.5-.63-.87-1.15-1.06z",
opacity: ".3"
}, "0"), /*#__PURE__*/_jsx("path", {
d: "M1.5 12.14 8 14.48V19h8v-1.63L20.52 19l.69-1.89-19.02-6.86-.69 1.89zm8.5 3.05 4 1.44V17h-4v-1.81zm9.84-6.05-8.56-3.09-2.08 5.66 12.36 4.47.69-1.89c.77-2.09-.31-4.39-2.41-5.15zm.53 4.46-.01.02-8.59-3.11.7-1.91 6.69 2.41c.52.19.93.56 1.15 1.05.23.49.25 1.04.06 1.54zM6 10.5c.44 0 .88-.1 1.3-.3 1.49-.72 2.12-2.51 1.41-4C8.19 5.13 7.12 4.5 6 4.5c-.44 0-.88.1-1.3.3-1.49.71-2.12 2.5-1.4 4 .51 1.07 1.58 1.7 2.7 1.7zm-.94-3.34c.05-.14.18-.4.51-.56.14-.06.28-.1.43-.1.31 0 .7.15.9.56.24.5.02 1.1-.47 1.34-.14.06-.28.1-.43.1-.3 0-.7-.15-.89-.56-.17-.34-.1-.63-.05-.78z"
}, "1")], 'AirlineSeatFlatAngledTwoTone');
|
oliviertassinari/material-ui
|
packages/mui-icons-material/lib/esm/AirlineSeatFlatAngledTwoTone.js
|
JavaScript
|
mit
| 1,094
|
module Tungsten
class Role
def initialize(name)
@name = name
@libraries = {}
end
def libraries
@libraries
end
def uses(library_name, args={})
@libraries[library_name] = args unless @libraries.keys.include?(library_name)
end
end
end
|
appmeup/tungsten
|
lib/tungsten/role.rb
|
Ruby
|
mit
| 286
|
var b2Vec2 = Box2D.Common.Math.b2Vec2;
var b2Body = Box2D.Dynamics.b2Body;
var b2BodyDef = Box2D.Dynamics.b2BodyDef;
var b2FixtureDef = Box2D.Dynamics.b2FixtureDef;
var b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape;
var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape;
var b2Math = Box2D.Common.Math.b2Math;
function parseQueryString(str){
var dec = decodeURIComponent;
var arr = [];
var item;
if (typeof(str) == 'undefined') { return arr; }
if (str.indexOf('?', 0) > -1) { str = str.split('?')[1]; }
str = str.split('&');
for (var i = 0; i < str.length; ++i){
item = str[i].split("=");
if(item[0] != ''){
arr[item[0]] = typeof(item[1]) == 'undefined' ? true : dec(item[1]);
}
}
return arr;
}
function inspect(dict) {
var str = '';
for (var key in dict){
str += key + "=" + dict[key] + "\n";
}
alert(str);
}
function randomPM() { return Math.random() * 2 - 1; }
function color(r, g, b) {
var f = function(g) {
return ('0' + Math.floor(g()).toString(16)).slice(-2);
};
return "#" + f(r) + f(g) + f(b);
}
function whitish() { return Math.random() * 64 + 192; }
function light() { return Math.random() * 128 + 128; }
function middle() { return Math.random() * 128 + 64; }
function dark() { return Math.random() * 128 ; }
function blackish() { return Math.random() * 64 ; }
function updateShape(evt) {
evt.body.shape.x = evt.body.GetPosition().x * ppm;
evt.body.shape.y = evt.body.GetPosition().y * ppm;
evt.body.shape.rotation = evt.body.GetAngle() * 360.0 / (2.0 * Math.PI)
}
function smooth(times, interval, func) {
var i = interval;
var j = times;
var tick = function() {
if (0 < i) {
--i;
} else {
i = interval;
if (0 < j) {
--j;
func();
} else {
createjs.Ticker.removeEventListener("tick", tick);
}
}
}
createjs.Ticker.addEventListener("tick", tick);
}
|
kmyk/singlepong
|
lib.js
|
JavaScript
|
mit
| 2,078
|
<h3>Do you want to learn more about frameworks or move on to deployment?</h3>
<div class="row">
<div class="c4">
<div class="well select-next">
{% include "choices/buttons/web-frameworks.html" %}
</div>
</div>
<div class="c4">
<div class="well select-next">
{% include "choices/buttons/deployment.html" %}
</div>
</div>
<div class="c4">
<div class="well select-next">
{% include "choices/buttons/application-programming-interfaces.html" %}
</div>
</div>
</div>
|
mattmakai/fullstackpython.com
|
theme/templates/choices/morepath.html
|
HTML
|
mit
| 569
|
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2014 Simone Carletti <weppos@weppos.net>
#++
require 'whois/record/parser/base_cocca'
module Whois
class Record
class Parser
# Parser for the whois.netcom.cm server.
class WhoisNetcomCm < BaseCocca
end
end
end
end
|
sheldonh/whois
|
lib/whois/record/parser/whois.netcom.cm.rb
|
Ruby
|
mit
| 344
|
---
title: Untitled document
layout: post
author: joseph.o'brien
permalink: /untitled-document/
source-id: 1-fJRhooVAMe2ejEApfDwW5Ab0SFfFG_KCHa_SQvVASY
published: true
---
<table>
<tr>
<td>Title</td>
<td>first lesson </td>
<td>Date</td>
<td>01/01/01</td>
</tr>
</table>
<table>
<tr>
<td>Starting point:</td>
<td>nothing</td>
</tr>
<tr>
<td>Target for this lesson?</td>
<td>make a blog</td>
</tr>
<tr>
<td>Did I reach my target?
(add details to "Lesson Review")</td>
<td>yes</td>
</tr>
</table>
<table>
<tr>
<td>Lesson Review</td>
</tr>
<tr>
<td>How did I learn? What strategies were effective? </td>
</tr>
<tr>
<td>I learnt by sticking to the criteria Mr Keen set us and then adding a few extra details and advancing on points.</td>
</tr>
<tr>
<td>What limited my learning? Which habits do I need to work on? </td>
</tr>
<tr>
<td>What limited my learning was the fact that i didn't do to many extras as well as the must do’s more extras would've given me a higher mark.</td>
</tr>
<tr>
<td>What will I change for next time? How will I improve
my learning?</td>
</tr>
<tr>
<td>Next time i will go more than the extra mile to make a better blog get an avatar for my blog and get a better background for the blog to make it more appealing to read.</td>
</tr>
</table>
|
theMCdjJOE/TheMCdjJoe.github.io
|
_includes/2017-09-13-Untitled-document.md
|
Markdown
|
mit
| 1,387
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: Record_RX
# Author: Justin Ried
# GNU Radio version: 3.8.1.0
from distutils.version import StrictVersion
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print("Warning: failed to XInitThreads()")
from PyQt5 import Qt
from gnuradio import qtgui
from gnuradio.filter import firdes
import sip
from gnuradio import blocks
from gnuradio import gr
import sys
import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
import osmosdr
import time
from gnuradio import qtgui
class Record_RX(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Record_RX")
Qt.QWidget.__init__(self)
self.setWindowTitle("Record_RX")
qtgui.util.check_set_qss()
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "Record_RX")
try:
if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
self.restoreGeometry(self.settings.value("geometry").toByteArray())
else:
self.restoreGeometry(self.settings.value("geometry"))
except:
pass
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 2e6
##################################################
# Blocks
##################################################
self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
1024, #size
firdes.WIN_BLACKMAN_hARRIS, #wintype
0, #fc
samp_rate, #bw
"", #name
1
)
self.qtgui_freq_sink_x_0.set_update_time(0.10)
self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
self.qtgui_freq_sink_x_0.enable_autoscale(False)
self.qtgui_freq_sink_x_0.enable_grid(False)
self.qtgui_freq_sink_x_0.set_fft_average(1.0)
self.qtgui_freq_sink_x_0.enable_axis_labels(True)
self.qtgui_freq_sink_x_0.enable_control_panel(False)
labels = ['', '', '', '', '',
'', '', '', '', '']
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
colors = ["blue", "red", "green", "black", "cyan",
"magenta", "yellow", "dark red", "dark green", "dark blue"]
alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0]
for i in range(1):
if len(labels[i]) == 0:
self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
else:
self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + ''
)
self.osmosdr_source_0.set_sample_rate(samp_rate)
self.osmosdr_source_0.set_center_freq(462725000, 0)
self.osmosdr_source_0.set_freq_corr(0, 0)
self.osmosdr_source_0.set_gain(10, 0)
self.osmosdr_source_0.set_if_gain(25, 0)
self.osmosdr_source_0.set_bb_gain(16, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(0, 0)
self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, '/root/Desktop/CV', False)
self.blocks_file_sink_0.set_unbuffered(False)
##################################################
# Connections
##################################################
self.connect((self.osmosdr_source_0, 0), (self.blocks_file_sink_0, 0))
self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "Record_RX")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.osmosdr_source_0.set_sample_rate(self.samp_rate)
self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate)
def main(top_block_cls=Record_RX, options=None):
if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
tb.show()
def sig_handler(sig=None, frame=None):
Qt.QApplication.quit()
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)
timer = Qt.QTimer()
timer.start(500)
timer.timeout.connect(lambda: None)
def quitting():
tb.stop()
tb.wait()
qapp.aboutToQuit.connect(quitting)
qapp.exec_()
if __name__ == '__main__':
main()
|
CyberVines/Universal-Quantum-Cymatics
|
Record_RX.py
|
Python
|
mit
| 6,310
|
package de.d4k.tinkerforge.stromui.main.spannunggraph;
import com.airhacks.afterburner.views.FXMLView;
import de.d4k.tinkerforge.stromui.main.BackgroundTaskView;
/**
* @author Oliver Milke
*/
public class SpannunggraphView extends FXMLView implements BackgroundTaskView {
@Override
public void cancelBackgroundTask() {
SpannunggraphPresenter presenter = (SpannunggraphPresenter) this.getPresenter();
presenter.cancelTask();
}
}
|
omilke/tinkerforge-strom-ui
|
src/main/java/de/d4k/tinkerforge/stromui/main/spannunggraph/SpannunggraphView.java
|
Java
|
mit
| 444
|
package mobilita;
public class Canotto {
}
|
andrea-colleoni/EmitJava2k17
|
eclipse/EsercizioVeicoli/src/mobilita/Canotto.java
|
Java
|
mit
| 50
|
<?php
class Admin_model extends CI_Model {
public function upload_file($fileName = NULL)
{
if($fileName == NULL)
{
return array('status' => false, 'error' => 'Filename not specified');
}
else if($fileName == 'persons.csv')
{
$query = "load data infile '/srv/www/htdocs/uploads/".$fileName."' into table persons fields terminated by ',' (f_name, l_name, nationality, dob, photo_url)";
}
else
{
$query = "load data infile '/srv/www/htdocs/uploads/".$fileName."' into table venues fields terminated by ',' (name, location, capacity)";
}
$query = $this->db->query($query);
}
}
?>
|
shivinbhogal/IPL
|
application/models/admin_model.php
|
PHP
|
mit
| 614
|
///////////////////////////////////////////////////////////////////////////////
//
//
// (C) Copyright 2005-2007 by Autodesk, Inc. All rights reserved.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef RGBMODEL_H
#include "RgbModel.h"
#endif
#ifndef DATAMODELATTRIBUTES_H
#include "DataModelAttributes.h"
#endif
#ifndef RGBCOLOR_H
#include "RgbColor.h"
#endif
#ifndef ATILEXCEPTION_H
#include "ATILException.h"
#endif
#ifndef RGBPALETTEMODEL_H
#define RGBPALETTEMODEL_H
namespace Atil
{
/// <summary>
/// Represents an eight-bit indexed color space. It is used to construct eight-bit color
/// images. The DataModel holds an array of colors, called a palette, such that the indexes of the
/// data refer to the entries in the palette of colors. Each entry in the palette is an instance of
/// the structure RgbColor. The pixel values in the image represent indexes into the palette array
/// held by the RgbPaletteModel.
/// </summary>
///
class RgbPaletteModel : public RgbModel
{
public:
/// <summary>
/// Blank palette constructor.
/// </summary>
///
/// <param name='nPaletteEntries'> The number of entries that will be in the palette.
/// </param>
///
RgbPaletteModel (int nPaletteEntries = 256);
/// <summary>
/// Palette initializing constructor.
/// </summary>
///
/// <param name='nEntries'> The number of entries that in the palette.
/// </param>
///
/// <param name='colors'> A constant point to an array of <c>RgbColor</c> instances
/// with at least <c>nEntries</c> members. The colors will be used to initialize the palette.
/// </param>
///
RgbPaletteModel (int nEntries, const RgbColor* colors);
/// <summary>
/// Palette initializing constructor.
/// </summary>
///
/// <param name='nBitsUsedPerPixel'> The number of bits used by indexes in the image. Setting
/// this number puts a cap on the number of color in the palette. The number of bits must be
/// between 2 and 8.
/// </param>
///
/// <param name='nEntries'> The number of entries that in the palette.
/// </param>
///
/// <param name='colors'> A constant point to an array of <c>RgbColor</c> instances
/// with at least <c>nEntries</c> members. The colors will be used to initialize the palette.
/// </param>
///
RgbPaletteModel (int nBitsUsedPerPixel, int nEntries, const RgbColor* colors);
/// <summary>
/// virtual destructor
/// </summary>
///
virtual ~RgbPaletteModel ();
/// <summary>
/// This method creates a full copy of the <c>RgbPaletteModel</c>.
/// </summary>
///
/// <returns>
/// This will return an initialized copy of <c>*this</c>.
/// </returns>
///
virtual DataModel* clone () const;
/// <summary>
/// This query returns an entry of the DataModelType enum that indicating
/// <c>DataModelAttributes::kPalettedRgbModel</c>
/// </summary>
///
/// <returns>
/// This returns <c>DataModelAttributes::kPalettedRgbModel</c>.
/// </returns>
///
virtual DataModelAttributes::DataModelType dataModelType () const;
/// <summary>
/// Query the pixel type of the data represented by this datamodel.
/// </summary>
///
/// <returns>
/// This returns <c>DataModelAttributes::kPalettedRgb</c>.
/// </returns>
///
virtual DataModelAttributes::PixelType pixelType () const;
/// <summary>
/// This method test for convertibility to <c>RgbPaletteModel</c>.
/// </summary>
///
/// <param name='colorModel'> A constant instance of a another <c>ColorModelInterface</c>
/// that is to be tested to see if this instance can convert into it.
/// </param>
///
/// <returns>
/// This should return if this class can supply a conversion filter.
/// </returns>
///
virtual bool canConvertTo (const ColorModelInterface* colorModel) const;
/// <summary>
/// This method asks for the conversion to <c>RgbPaletteModel</c>. The <c>canConvertTo</c>
/// method will be called first to confirm that at a conversion is available.
/// </summary>
///
/// <param name='colorModel'> A constant instance of a another <c>ColorModelInterface</c>
/// that is to be convert into it.
/// </param>
///
/// <param name='pInput'> An instance of a <c>RowProviderInterface</c>
/// that represents the source of the data to be converted.
/// </param>
///
/// <returns>
/// This returns a new filter that has the conversion hooked into it. See the
/// <c>ImageFilter</c> base class for more information on creating and linking
/// together filters.
/// </returns>
///
virtual RowProviderInterface* getModelConversionTo (
const ColorModelInterface* colorModel, RowProviderInterface* pConvert) const;
/// <summary>
/// This method test for convertibility into a given <c>ColorModelInterface</c>.
/// </summary>
///
/// <param name='colorModel'> A constant instance of a another <c>ColorModelInterface</c>
/// that is to be tested to see if this instance can convert from it.
/// </param>
///
/// <returns>
/// This should return if this class can supply a conversion filter that will
/// change the data into this instances color model.
/// </returns>
///
virtual bool canConvertFrom (const ColorModelInterface* colorModel) const;
/// <summary>
/// This method asks for the conversion. The <c>canConvertTo</c> method will
/// be called first to confirm that at a conversion is available.
/// </summary>
///
/// <param name='colorModel'> A constant instance of a another <c>ColorModelInterface</c>
/// that is to be converted from.
/// </param>
///
/// <param name='pInput'> An instance of a <c>RowProviderInterface</c>
/// that represents the source of the data to be converted.
/// </param>
///
/// <returns>
/// This returns a new filter that has the conversion hooked into it. See the
/// <c>ImageFilter</c> base class for more information on creating and linking
/// together filters.
/// </returns>
///
virtual RowProviderInterface* getModelConversionFrom (
const ColorModelInterface* colorModel, RowProviderInterface* pConvert) const;
/// <summary>
/// Simply returns the number of valid entries in the palette.
/// </summary>
///
/// <returns>
/// The integer number of palette entries.
/// </returns>
virtual int numEntries () const;
/// <summary>
/// This method will set the desired entries of the palette to the passed values.
/// </summary>
///
/// <param name='nStartAt'> The starting index to be set.
/// </param>
///
/// <param name='numEntries'> The number of entries to be set into the palette.
/// </param>
///
/// <param name='colors'> A constant pointer to an array of <c>RgbColor</c> instances
/// with at least <c>nEntries</c> members. The colors will be used to initialize the palette.
/// </param>
///
/// <exception cref="RgbPaletteModelException">An exception will be thrown
/// if an invalid palette index is specified. <see cref="ATILException"/>.
/// </exception>
///
virtual void setEntries (int startAt, int numEntries, const RgbColor* colors);
//
/// <summary>
/// This method will copy the colors in the palette to the specified array.
/// </summary>
///
/// <param name='nStartAt'> The starting index to be set.
/// </param>
///
/// <param name='numEntries'> The number of entries to be copied from the palette.
/// </param>
///
/// <param name='colors'> A pointer to an array of <c>RgbColor</c> instances
/// with at least <c>nEntries</c> members. The colors will be set to those in the palette.
/// </param>
///
/// <exception cref="RgbPaletteModelException">An exception will be thrown
/// if an invalid palette index is specified. <see cref="ATILException"/>.
/// </exception>
///
virtual void getEntries (int startAt, int numEntries, RgbColor* colors) const;
/// <summary>
/// This constant method tests whether the value at the specified index is set
/// to transparent where transparent is defined as an alpha value that has been set to zero.
/// </summary>
///
/// <param name='index'> The index within the range of valid palette entries to be tested.
/// </param>
///
/// <returns>
/// This will return true if the alpha at the index is zero.
/// </returns>
///
bool isTransparent (int index) const;
/// <summary>
/// This constant method sets the value at the specified index is to transparent where
/// transparent is defined as an alpha value that has been set to zero.
/// </summary>
///
/// <param name='index'> The index within the range of valid palette entries to be set.
/// </param>
///
/// <remarks>
/// This method does modify the alpha of the palette even though the method is
/// declared to be const. A contradiction introduced by a flaw in the API.
/// </remarks>
///
void setTransparent (int index) const;
/// <summary>
/// This constant method tests whether the value at the specified index is set
/// to opaque where transparent is defined as an alpha value that has been set to 255.
/// </summary>
///
/// <param name='index'> The index within the range of valid palette entries to be tested.
/// </param>
///
/// <returns>
/// This will return true if the alpha at the index is 255.
/// </returns>
///
bool isOpaque (int index) const;
/// <summary>
/// This constant method sets the value at the specified index is to opaque where
/// opaque is defined as an alpha value that has been set to 255.
/// </summary>
///
/// <param name='index'> The index within the range of valid palette entries to be set.
/// </param>
///
/// <remarks>
/// This method does modify the alpha of the palette even though the method is
/// declared to be const. A contradiction introduced by a flaw in the API.
/// </remarks>
///
void setOpaque (int index) const;
/// <summary>
/// This constant method returns the value of alpha at the specified index.
/// </summary>
///
/// <param name='index'> The index within the range of valid palette entries to be returned.
/// </param>
///
/// <returns>
/// This will return the alpha at the index.
/// </returns>
///
Data8 alpha (int index) const;
/// <summary>
/// This constant method sets the alpha at the specified index to passed value.
/// </summary>
///
/// <param name='index'> The index within the range of valid palette entries to be set.
/// </param>
///
/// <param name='alpha'> The value (0 to 255) to set the alpha to.
/// </param>
///
/// <remarks>
/// This method does modify the alpha of the palette even though the method is
/// declared to be const. A contradiction introduced by a flaw in the API.
/// </remarks>
///
void setAlpha (int index, Data8 alpha) const;
/// <summary>
/// The equality operator.
/// </summary>
///
/// <param name='rhs'> A constant reference to a <c>RgbPaletteModel</c> to be tested.
/// </param>
///
/// <returns>
/// This will return true if the tested objects are considered equal.
/// </returns>
///
virtual bool operator==(const DataModel& rhs) const;
/// <summary>
/// The inequality operator.
/// </summary>
///
/// <param name='rhs'> A constant reference to a <c>RgbPaletteModel</c> to be tested.
/// </param>
///
/// <returns>
/// This will return true if the tested objects are considered not equal.
/// </returns>
///
virtual bool operator!=(const DataModel& rhs) const;
/// <summary>
/// This method will return the index of the palette entry color that most closely
/// matches the passed in color where the closest is determined by minimum euclidean distance
/// in the RGB cube.
/// </summary>
///
/// <param name='color'> A <c>RgbColor</c> instance to be matched.
/// </param>
///
/// <returns>
/// This will return the index of the closest color match in the palette for the argument.
/// </returns>
///
Atil::UInt8 nearestColorIndex (Atil::RgbColor color ) const;
protected:
/// <summary>
/// (Protected) Constructor that allows derived classes to create specialized
/// implementations that implement sub-types of the RGB space such as a
/// gray ramp (a vector through the RGB cube).
/// </summary>
///
/// <param name="dm">
/// A constant enum described in <c>DataModelAttributes</c> that declares
/// the type of the datamodel to be constructed.
/// </param>
///
/// <param name="bpp">
/// A constant enum described in <c>DataModelAttributes</c> that declares
/// the number of bits used in a pixel.
/// </param>
///
/// <param name='nEntries'> The number of entries that in the palette.
/// </param>
///
RgbPaletteModel (DataModelAttributes::DataModelType dm,
DataModelAttributes::BitsPerPixel bpp, int nEntries );
/// <summary>
/// (Protected) The palette of colors used by the datamodel.
/// </summary>
///
mutable RgbColor maPalette[256];
/// <summary>
/// (Protected) The number of entries int he palette.
/// </summary>
///
int mnEntries;
};
/// <summary>
/// A specialization of the <c>ATILException</c> class for use by <c>RgbPaletteModel</c>
/// </summary>
///
class RgbPaletteModelException : public ATILException
{
public:
/// <summary>
/// This enum uses it's entries to indicate a general reason for the exception.
/// </summary>
///
enum ExceptionType {
/// <summary> An invalid palette index was used or referenced.
/// </summary>
kInvalidPaletteIndex
};
public:
/// <summary>
/// Constructor for the exception.
/// </summary>
///
/// <param name='sbMessage'> A message for the developer that may indicate the reason
/// the exception was thrown. These are untranslated strings not intend for the end-user.
/// </param>
///
/// <param name='eType'> The enum entry indicating the reason or class of exception.
/// </param>
///
RgbPaletteModelException (const StringBuffer& sbMessage,
ExceptionType eType = kInvalidPaletteIndex );
/// <summary>
/// Cloning or copy constructor.
/// </summary>
///
/// <param name='x'> A constant reference to the exception to be copied.
/// </param>
///
RgbPaletteModelException (const RgbPaletteModelException& x);
/// <summary>
/// Virtual destructor.
/// </summary>
///
virtual ~RgbPaletteModelException ();
/// <summary>
/// This access method returns the enum entry indicating the reason for the exception.
/// </summary>
///
/// <returns>
/// This method returns an entry from the enum of exception types.
/// </returns>
///
virtual ExceptionType getExceptionType ();
private:
ExceptionType eType;
};
} //end of namespace
#endif
//#ifndef RGBCOLOR_H
//#include <RgbColor.h>
//#endif
|
kevinzhwl/ObjectARXCore
|
2008/utils-x64/Atil/Inc/RgbPaletteModel.h
|
C
|
mit
| 17,008
|
# -*- encoding: utf-8 -*-
module Brcobranca
VERSION = '6.8.0'
end
|
zaeznet/brcobranca
|
lib/brcobranca/version.rb
|
Ruby
|
mit
| 69
|
getent passwd alertmanager 2>&1 > /dev/null || useradd -r -d /var/lib/alertmanager alertmanager
mkdir -p /var/lib/alertmanager/
chown alertmanager:alertmanager -R /var/lib/alertmanager/
systemctl daemon-reload 2>&1 > /dev/null || true
|
nkts/packaging
|
alertmanager/post.sh
|
Shell
|
mit
| 237
|
<?php
/**
* The contents of this file was generated using the WSDLs as provided by eBay.
*
* DO NOT EDIT THIS FILE!
*/
namespace DTS\eBaySDK\Trading\Types;
/**
*
*/
class ISBNEnabledDefinitionType extends \DTS\eBaySDK\Types\BaseType
{
/**
* @var array Properties belonging to objects of this class.
*/
private static $propertyTypes = [
];
/**
* @param array $values Optional properties and values to assign to the object.
*/
public function __construct(array $values = [])
{
list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
parent::__construct($parentValues);
if (!array_key_exists(__CLASS__, self::$properties)) {
self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
}
if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
self::$xmlNamespaces[__CLASS__] = 'xmlns="urn:ebay:apis:eBLBaseComponents"';
}
$this->setValues(__CLASS__, $childValues);
}
}
|
chain24/ebayprocess-lumen
|
vendor/dts/ebay-sdk-php/src/Trading/Types/ISBNEnabledDefinitionType.php
|
PHP
|
mit
| 1,088
|
import * as React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M10 6.35V4.26c-.66.17-1.29.43-1.88.75l1.5 1.5c.13-.05.25-.11.38-.16zM20 12c0-2.21-.91-4.2-2.36-5.64L20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 .85-.19 1.65-.51 2.38l1.5 1.5C19.63 14.74 20 13.41 20 12zM4.27 4L2.86 5.41l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.24-.76.34v2.09c.8-.21 1.55-.54 2.23-.96l2.58 2.58 1.41-1.41L4.27 4z" />
, 'SyncDisabledTwoTone');
|
callemall/material-ui
|
packages/material-ui-icons/src/SyncDisabledTwoTone.js
|
JavaScript
|
mit
| 590
|
package com.common.example;
/**
* @author Y@$!n
*
*/
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;
import com.common.utils.Common;
import com.common.utils.R;
public class GetPrefAct extends Activity {
private Context mContext;
private CheckBox cb_GetBoolean;
private EditText et_GetStringPref;
private EditText et_GetIntegerPref;
private EditText et_GetLongPref;
private EditText et_GetFloatPref;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.get_pref_act);
mContext = GetPrefAct.this;
init();
}
private void init() {
// TODO Auto-generated method stub
cb_GetBoolean = (CheckBox) findViewById(R.id.cb_GetBoolean);
et_GetStringPref = (EditText) findViewById(R.id.et_GetStringPref);
et_GetIntegerPref = (EditText) findViewById(R.id.et_GetIntegerPref);
et_GetLongPref = (EditText) findViewById(R.id.et_GetLongPref);
et_GetFloatPref = (EditText) findViewById(R.id.et_GetFloatPref);
Button btn_GetPref = (Button) findViewById(R.id.btn_GetPref);
btn_GetPref.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Common.getStringPrefrences(mContext, "strPref");
// Common.getIntPrefrences(mContext, "intPref");
// Common.getLongPrefrences(mContext, "longPref");
// Common.getBooleanPrefrences(mContext, "booleanPref");
// Common.getFloatPrefrences(mContext, "floatPref");
if (Common.getStringPrefrences(mContext, "Yes", getString(R.string.app_name)).equals(
"Yes")) {
et_GetStringPref.setText(Common.getStringPrefrences(mContext, "strPref", getString(R.string.app_name)));
et_GetIntegerPref.setText(String.valueOf(Common.getIntPrefrences(mContext, "intPref", getString(R.string.app_name))));
et_GetLongPref.setText(String.valueOf(Common.getLongPrefrences(mContext, "longPref", getString(R.string.app_name))));
et_GetFloatPref.setText(String.valueOf(Common.getFloatPrefrences(mContext, "floatPref", getString(R.string.app_name))));
if (Common.getBooleanPrefrences(mContext, "booleanPref", getString(R.string.app_name))) {
cb_GetBoolean.setText("True");
// Toast.makeText(mContext, "Selected true" + Common.getBooleanPrefrences(mContext, "booleanPref", getString(R.string.app_name)), Toast.LENGTH_LONG).show();
cb_GetBoolean.setChecked(true);
} else {
cb_GetBoolean.setText("False");
// Toast.makeText(mContext, "Selected" + Common.getBooleanPrefrences(mContext, "booleanPref", getString(R.string.app_name)), Toast.LENGTH_LONG).show();
cb_GetBoolean.setChecked(false);
}
} else {
Toast.makeText(mContext, "Please set preferences.", Toast.LENGTH_LONG).show();
}
}
});
Button btn_RemoveAllPref = (Button) findViewById(R.id.btn_RemoveAllPref);
btn_RemoveAllPref.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Common.removeAllPrefrences(mContext, getString(R.string.app_name));
Common.setStringPrefrences(mContext, "Yes", "No", getString(R.string.app_name));
cb_GetBoolean.setText("False");
cb_GetBoolean.setChecked(false);
et_GetStringPref.setText("");
et_GetIntegerPref.setText("");
et_GetLongPref.setText("");
et_GetFloatPref.setText("");
}
});
}
}
|
androidroadies/AndroidUtils
|
app/src/main/java/com/common/example/GetPrefAct.java
|
Java
|
mit
| 4,214
|
---
title: थकित र पेलान
date: 27/06/2021
---
`कोही मानिस थाक्नुभन्दा पहिले परमेश्वरले किन विश्रामको दिन सृजना गर्नुभयो?`
मानिस तनावपूर्ण वातावरणमा अस्तव्यस्त हुनुभन्दा अघि नै परमेश्वरले एउटा आधारस्तम्भ खडा गर्नुभएको थियो। यो स्तम्भ मानिसको दिमागमा जीवित राखिराख्न परमेश्वरले सृष्टि गर्नुभएको थियो। यो दिन हामीले गरिरहेका सबै कामलाई रोक्दछौँ र जानाजानी जीवनलाई रमाइलो बाटोमा हिँडाउँछौँ। यो दिन के गर्नुपर्छ वा के गर्नुपर्छ भन्ने मनस्थितिले दिमागलाई तान्ने होइन तर के हुनुपर्छ भन्ने कुरालाई दिमागमा घुसार्ने हो। यो दिनमा परमेश्वरले दिनुभएको घाँस, हावा, जीवजन्तु, पानी, इष्टमित्र, विश्वासी वा अरू मानिसहरूको उपहारलाई आभारित भएर त्यसको उत्सब मनाउनु हो। तर सबभन्दा ठूलो त प्रत्येक असल उपहार दिनुहुने परमपिता परमेश्वर सृष्टिकर्तासँग गर्न पाइने आदानप्रदानमा रमाइलो गर्न पाइने त्यो विश्राम हो।
परमेश्वरले गर्नभएको विश्रामको निम्तो अदनको बगैँचाबाट आदम र हवाको निष्काशन भएपछि समाप्त भएको थिएन (न त सिनै पहाडमा सुरू भएको हो जसरी अधिकाँश इसाइहरूले सिकाउँदछन)। परमेश्वरले आह्वान गर्नुभएको विश्राम दिन मनाइरहने निम्तो कुनै पनि समय वा युगको आक्रमणले ढलाउन नसकोस् भन्ने हेतुले संसारको सृष्टिको समयभित्रै त्यो दिनको सृष्टि गर्नुभएको थियो। समयकै संरचनामा साबथ विश्राम बुनिएको थियो। (यदि विश्राम नचाहिनेभए छ दिनमै सृष्टिको काम सकिन्दा परमेश्वरको सिद्धियो भन्न सक्नुहुन्थ्यो, तर मानिसलाई चाहिने विश्रामको आवश्यकतालाई नै महसुस गर्नुभएर परमेश्वरले थप सातौँ दिन थप्नुभएको थियो-अनुवादकको धारणा)। यस युगको सुरूदेखि अन्त्यसम्मै (अझ नयाँ पृथ्वीमा पनि) सृष्टिलाई उत्सबको रूपमा लिइ विश्रामको अनुभूति पाउन प्रत्येक सातौँ दिन निरन्तररूपमा दोहोरिएको छ र त्यो क्रम जारि नै रहनेछ।
आज भोलि विभिन्न उपकरणहरूको आविष्कारद्वारा शारीरिक बलको प्रयोग गर्नु नपर्ने भएकोले मानिसहरूले धेरै आराम पाउन सक्छ भनेर कतिपयले सोच्दछन् होला। दुईसय वर्ष अघिको संसारमा विभिन्न आधुनिक औजारहरू थिएन। जेपनि मानिसकै परिश्रमले काम गर्नुपर्थ्यो। (अहिले बुलडोजरबाट सयौँ मानिसहरूको पसिनाको आवश्यक नभइकन पहाडलाई सम्म पार्न सक्छ। खेतबारी, धान काट्ने आदि सबै मेशिनबाटै गर्न सकिन्छ। ती बाहेक सबै उकरणहरू मानिसको परिश्रमलाई राहत दिन र आराम दिन आविष्कार गरिएका थिए-अनुवादकको थप)। तर ती सबै आविष्कारहरूको बाबजुद पनि मानिसलाई चाहिने विश्राम वा आराममा कमि भएको पाइन्छ। हामी पसिना बगाउने काममानै नलागेतापनि कुनै कुनै व्यस्तताको क्रियाकलापमा लागिरहेका हुन्छौँ। त्यसले गर्दा जहिले पनि काम नसिद्धिएको अनुभव वा पछाडि परिरहेको अनुभव गर्दछौँ; जतिसुकै काममा खटिएतापनि जहिले पनि अझ धेरै गर्नुपर्ने हामी महसुस गरिरहेका हुन्छौँ।
हाम्रो निन्द्रामा कमी आएको र धेरै मानिसहरू जागा रहन कफीमा धेरै भरपरिरहेको वैज्ञानिक खोज अनसुन्धानले देखाएको छ। हामीलाई अब तुरन्तै संचार गर्न सकिने मोबाइलहरू छन्, द्रुतगतिमा चल्ने कम्प्युटरहरू छन्, छिटो चल्ने इन्टरनेट जडान छन् तैपनि हामीसँग पर्याप्त समय वा फुर्सद नभएको महसुस गरिनै रहेका हुन्छौँ।
`हाम्रो दैनिक जीवनको गतिलाई रोक्न विश्रामको आवश्यकता महत्त्वपूर्ण भएको देहायका पदहरूले कसरी हामीलाई सिकाउँछन्? हेर्नुहोस्, मर्कूस ६:३१, भजन ४:८, प्रस्थान २३:१२, व्यवस्था ५:१४`
हामीलाई सृष्टि गर्नुहुने परमेश्वरलाई थाहा थियो कि हामीलाई शारीरिक आराम, विश्रामको आवश्यक छ। उहाँले समय चक्रलाई निर्माण गर्नुभएको थियो जसमा दिन, रात र साबथ समावेश भएको छ। साबथले हाम्रो शरीरलाई विश्राम चाहिन्छ भन्ने जानकारीले हामीलाई घचघच्याइरहेको हुन्छ। साबथको विश्राम अवसर हो। यदि येशूलाई हाम्रो जीवनको प्रभु वा स्वामी भनेर स्वीकार गर्छौँ भने हाम्रो शरीरलाई दिनुपर्ने विश्रामको उत्तरदायित्वलाई गम्भिररूपमा लिनुपर्ने आवश्यक ठान्नुपर्दछ। साबथ आज्ञा कुनै अर्ति, दर्शन, सल्लाह होइन यो त परमेश्वरको निर्देशन नै हो-छ दिन काम गर्नुपर्ने निर्देशन र सातौँ दिनमा विश्राम लिनुपर्ने निर्देशनलाई हामीले खेलाँची गर्दा परमेश्वरकै आज्ञालाई नकारिरहेका हुन्छौँ।
`तपाईँको आफ्नै बेफुर्सदी जीवन कस्तो छ? परमेश्वरले हामीमा चाहनुभएको उत्तम अनुभव जसमा शारीरिक र आत्मिक विश्राम हुन् त्यसलाई अर्थमूलक बनाउन हामी के गर्नुपर्छ?`
|
imasaru/sabbath-school-lessons
|
src/ne/2021-03/01/02.md
|
Markdown
|
mit
| 9,682
|
# Assign a built-in policy to an existing resource group






[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-azurepolicy-assign-builtinpolicy-resourcegroup%2Fazuredeploy.json)
[](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-azurepolicy-assign-builtinpolicy-resourcegroup%2Fazuredeploy.json)
[](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-azurepolicy-assign-builtinpolicy-resourcegroup%2Fazuredeploy.json)
This template assigns a built-in policy to an existing resource group. You must be an owner of the scope (subscription, resourceGroup) to apply a policy. Inputs to this template are the following fields:
- `policyDefinitionID`
- `policyAssignmentName`
The following PowerShell script shows how to get the policy definition ID and the policy display name of a built-in policy called _Audit resource location matches resource group location_.
```powershell
$policyDefinitionId = $(Get-AzPolicyDefinition | Where-Object { $_.Properties.DisplayName -eq 'Audit resource location matches resource group location' }).PolicyDefinitionId
```
To learn more about how to deploy the template, see the [quickstart](https://docs.microsoft.com/azure/governance/policy/assign-policy-template) article.
|
daltskin/azure-quickstart-templates
|
101-azurepolicy-assign-builtinpolicy-resourcegroup/README.md
|
Markdown
|
mit
| 2,910
|
import {ColumnView} from '../scene/view';
import {ColumnModel} from './column.model';
import {TemplatePath} from '../template';
TemplatePath.register('row-number-cell', (template, column) => {
return {
model: template.for,
resource: column.key
};
});
export class RowNumberColumnModel extends ColumnModel {
constructor() {
super('row-number');
this.pin = 'left';
this.key = '$row.number';
this.title = 'No.';
this.canEdit = false;
this.canResize = true;
this.canFocus = false;
this.canMove = false;
this.canHighlight = false;
this.canSort = false;
this.canFilter = false;
this.class = 'control';
}
}
export class RowNumberColumn extends ColumnView {
constructor(model) {
super(model);
}
static model(model) {
return model ? RowNumberColumn.assign(model) : new RowNumberColumnModel();
}
}
|
klumba12/qgrid
|
core/column-type/row.number.column.js
|
JavaScript
|
mit
| 832
|
Dir[File.join(File.dirname(__FILE__), 'cap_recipes/tasks/*.rb')].sort.each { |lib| require lib }
|
donnoman/cap-recipes
|
lib/cap_recipes.rb
|
Ruby
|
mit
| 96
|
module Test.Pos.Crypto.Gen
(
-- Protocol Magic Generator
genProtocolMagic
, genProtocolMagicId
, genRequiresNetworkMagic
-- Sign Tag Generator
, genSignTag
-- Key Generators
, genKeypair
, genPublicKey
, genSecretKey
, genEncryptedSecretKey
-- Redeem Key Generators
, genRedeemKeypair
, genRedeemPublicKey
, genRedeemSecretKey
, genUnitRedeemSignature
-- VSS Key Generators
, genVssKeyPair
, genVssPublicKey
-- Proxy Cert and Key Generators
, genProxyCert
, genProxySecretKey
, genProxySignature
, genUnitProxyCert
, genUnitProxySecretKey
, genUnitProxySignature
-- Signature Generators
, genSignature
, genSignatureEncoded
, genSigned
, genRedeemSignature
, genUnitSignature
-- Secret Generators
, genDecShare
, genEncShare
, genSharedSecretData
, genSecret
, genSecretProof
-- Hash Generators
, genAbstractHash
, genWithHash
, genUnitAbstractHash
-- SafeSigner Generators
, genSafeSigner
-- PassPhrase Generators
, genPassPhrase
-- HD Generators
, genHDPassphrase
, genHDAddressPayload
) where
import Universum
import qualified Data.ByteArray as ByteArray
import Data.List.NonEmpty (fromList)
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import Crypto.Hash (Blake2b_256)
import Pos.Binary.Class (Bi)
import Pos.Crypto (PassPhrase)
import Pos.Crypto.Configuration (ProtocolMagic (..),
ProtocolMagicId (..), RequiresNetworkMagic (..))
import Pos.Crypto.Hashing (AbstractHash (..), HashAlgorithm, WithHash,
abstractHash, withHash)
import Pos.Crypto.HD (HDAddressPayload (..), HDPassphrase (..))
import Pos.Crypto.Random (deterministic)
import Pos.Crypto.SecretSharing (DecShare, EncShare, Secret,
SecretProof, VssKeyPair, VssPublicKey, decryptShare,
deterministicVssKeyGen, genSharedSecret, toVssPublicKey)
import Pos.Crypto.Signing (EncryptedSecretKey, ProxyCert,
ProxySecretKey, ProxySignature, PublicKey,
SafeSigner (..), SecretKey, SignTag (..), Signature,
Signed, createPsk, deterministicKeyGen, mkSigned,
noPassEncrypt, proxySign, safeCreateProxyCert,
safeCreatePsk, sign, signEncoded, toPublic)
import Pos.Crypto.Signing.Redeem (RedeemPublicKey, RedeemSecretKey,
RedeemSignature, redeemDeterministicKeyGen, redeemSign)
----------------------------------------------------------------------------
-- Protocol Magic Generator
----------------------------------------------------------------------------
genProtocolMagic :: Gen ProtocolMagic
genProtocolMagic = ProtocolMagic <$> genProtocolMagicId
<*> genRequiresNetworkMagic
genProtocolMagicId :: Gen ProtocolMagicId
genProtocolMagicId = ProtocolMagicId <$> Gen.int32 Range.constantBounded
genRequiresNetworkMagic :: Gen RequiresNetworkMagic
genRequiresNetworkMagic = Gen.element [RequiresNoMagic, RequiresMagic]
----------------------------------------------------------------------------
-- Sign Tag Generator
----------------------------------------------------------------------------
genSignTag :: Gen SignTag
genSignTag = Gen.element
[ SignForTestingOnly
, SignTx
, SignRedeemTx
, SignVssCert
, SignUSProposal
, SignCommitment
, SignUSVote
, SignMainBlock
, SignMainBlockLight
, SignMainBlockHeavy
, SignProxySK
]
----------------------------------------------------------------------------
-- Key Generators
----------------------------------------------------------------------------
genKeypair :: Gen (PublicKey, SecretKey)
genKeypair = deterministicKeyGen <$> gen32Bytes
genPublicKey :: Gen PublicKey
genPublicKey = fst <$> genKeypair
genSecretKey :: Gen SecretKey
genSecretKey = snd <$> genKeypair
genEncryptedSecretKey :: Gen EncryptedSecretKey
genEncryptedSecretKey = noPassEncrypt <$> genSecretKey
----------------------------------------------------------------------------
-- Redeem Key Generators
----------------------------------------------------------------------------
genRedeemKeypair :: Gen (Maybe (RedeemPublicKey, RedeemSecretKey))
genRedeemKeypair = redeemDeterministicKeyGen <$> gen32Bytes
genRedeemPublicKey :: Gen (RedeemPublicKey)
genRedeemPublicKey = do
rkp <- genRedeemKeypair
case rkp of
Nothing -> error "Error generating a RedeemPublicKey."
Just (pk, _) -> return pk
genRedeemSecretKey :: Gen (RedeemSecretKey)
genRedeemSecretKey = do
rkp <- genRedeemKeypair
case rkp of
Nothing -> error "Error generating a RedeemSecretKey."
Just (_, sk) -> return sk
genUnitRedeemSignature :: Gen (RedeemSignature ())
genUnitRedeemSignature = do pm <- genProtocolMagic
genRedeemSignature pm (pure ())
----------------------------------------------------------------------------
-- VSS Key Generators
----------------------------------------------------------------------------
genVssKeyPair :: Gen VssKeyPair
genVssKeyPair = deterministicVssKeyGen <$> gen32Bytes
genVssPublicKey :: Gen VssPublicKey
genVssPublicKey = toVssPublicKey <$> genVssKeyPair
----------------------------------------------------------------------------
-- Proxy Cert and Key Generators
----------------------------------------------------------------------------
genProxyCert :: Bi w => ProtocolMagic -> Gen w -> Gen (ProxyCert w)
genProxyCert pm genW =
safeCreateProxyCert pm <$> genSafeSigner <*> genPublicKey <*> genW
genProxySecretKey :: Bi w => ProtocolMagic -> Gen w -> Gen (ProxySecretKey w)
genProxySecretKey pm genW =
safeCreatePsk pm <$> genSafeSigner <*> genPublicKey <*> genW
genProxySignature
:: (Bi w, Bi a)
=> ProtocolMagic
-> Gen a
-> Gen w
-> Gen (ProxySignature w a)
genProxySignature pm genA genW = do
delegateSk <- genSecretKey
issuerSk <- genSecretKey
w <- genW
a <- genA
let psk = createPsk pm issuerSk (toPublic delegateSk) w
return $ proxySign pm SignProxySK delegateSk psk a
genUnitProxyCert :: Gen (ProxyCert ())
genUnitProxyCert = do pm <- genProtocolMagic
genProxyCert pm $ pure ()
genUnitProxySecretKey :: Gen (ProxySecretKey ())
genUnitProxySecretKey = do pm <- genProtocolMagic
genProxySecretKey pm $ pure ()
genUnitProxySignature :: Gen (ProxySignature () ())
genUnitProxySignature = do
pm <- genProtocolMagic
genProxySignature pm (pure ()) (pure ())
----------------------------------------------------------------------------
-- Signature Generators
----------------------------------------------------------------------------
genSignature :: Bi a => ProtocolMagic -> Gen a -> Gen (Signature a)
genSignature pm genA =
sign pm <$> genSignTag <*> genSecretKey <*> genA
genSignatureEncoded :: Gen ByteString -> Gen (Signature a)
genSignatureEncoded genB =
signEncoded <$> genProtocolMagic <*> genSignTag <*> genSecretKey <*> genB
genSigned :: Bi a => Gen a -> Gen (Signed a)
genSigned genA =
mkSigned <$> genProtocolMagic <*> genSignTag <*> genSecretKey <*> genA
genRedeemSignature
:: Bi a
=> ProtocolMagic
-> Gen a
-> Gen (RedeemSignature a)
genRedeemSignature pm genA =
redeemSign pm <$> gst <*> grsk <*> genA
where
gst = genSignTag
grsk = genRedeemSecretKey
genUnitSignature :: Gen (Signature ())
genUnitSignature = do pm <- genProtocolMagic
genSignature pm (pure ())
----------------------------------------------------------------------------
-- Secret Generators
----------------------------------------------------------------------------
genDecShare :: Gen DecShare
genDecShare = do
(_, _, xs) <- genSharedSecretData
case fmap fst (uncons xs) of
Just (vkp, es) -> return $ deterministic "ds" $ decryptShare vkp es
Nothing -> error "Error generating a DecShare."
genEncShare :: Gen EncShare
genEncShare = do
(_, _, xs) <- genSharedSecretData
case fmap fst (uncons xs) of
Just (_, es) -> return es
Nothing -> error "Error generating an EncShare."
genSharedSecretData :: Gen (Secret, SecretProof, [(VssKeyPair, EncShare)])
genSharedSecretData = do
let numKeys = 128 :: Int
parties <- Gen.integral (Range.constant 4 (fromIntegral numKeys)) :: Gen Integer
threshold <- Gen.integral (Range.constant 2 (parties - 2)) :: Gen Integer
vssKeyPairs <- replicateM numKeys genVssKeyPair
let vssPublicKeys = map toVssPublicKey vssKeyPairs
(s, sp, xs) = deterministic "ss" $ genSharedSecret threshold (fromList vssPublicKeys)
ys = zipWith (\(_, y) x -> (x, y)) xs vssKeyPairs
return (s, sp, ys)
genSecret :: Gen Secret
genSecret = do
(s, _, _) <- genSharedSecretData
return s
genSecretProof :: Gen SecretProof
genSecretProof = do
(_, sp, _) <- genSharedSecretData
return sp
----------------------------------------------------------------------------
-- Hash Generators
----------------------------------------------------------------------------
genAbstractHash
:: (Bi a, HashAlgorithm algo)
=> Gen a
-> Gen (AbstractHash algo a)
genAbstractHash genA = abstractHash <$> genA
genUnitAbstractHash :: Gen (AbstractHash Blake2b_256 ())
genUnitAbstractHash = genAbstractHash $ pure ()
genWithHash :: Bi a => Gen a -> Gen (WithHash a)
genWithHash genA = withHash <$> genA
----------------------------------------------------------------------------
-- PassPhrase Generators
----------------------------------------------------------------------------
genPassPhrase :: Gen PassPhrase
genPassPhrase = ByteArray.pack <$> genWord8List
where
genWord8List :: Gen [Word8]
genWord8List =
Gen.list (Range.singleton 32) (Gen.word8 Range.constantBounded)
----------------------------------------------------------------------------
-- SafeSigner Generators
----------------------------------------------------------------------------
genSafeSigner :: Gen SafeSigner
genSafeSigner = Gen.choice gens
where
gens = [ SafeSigner <$> genEncryptedSecretKey <*> genPassPhrase
, FakeSigner <$> genSecretKey
]
----------------------------------------------------------------------------
-- HD Generators
----------------------------------------------------------------------------
genHDPassphrase :: Gen HDPassphrase
genHDPassphrase = HDPassphrase <$> gen32Bytes
genHDAddressPayload :: Gen HDAddressPayload
genHDAddressPayload = HDAddressPayload <$> gen32Bytes
----------------------------------------------------------------------------
-- Helper Generators
----------------------------------------------------------------------------
genBytes :: Int -> Gen ByteString
genBytes n = Gen.bytes (Range.singleton n)
gen32Bytes :: Gen ByteString
gen32Bytes = genBytes 32
|
input-output-hk/pos-haskell-prototype
|
crypto/test/Test/Pos/Crypto/Gen.hs
|
Haskell
|
mit
| 11,486
|
# yappy [](https://travis-ci.org/richardschneider/yappy) [](https://ci.appveyor.com/project/richardschneider/yappy) [](http://yappy.readthedocs.org/en/latest/?badge=latest)
Yet another REST API server. Yappy is about howling at the moon with JSON.
The latest documentation can be read at [Read the Docs](http://yappy.readthedocs.org/en/latest/)
## Getting started [](https://badge.fury.io/js/yappy)
Install with [npm](http://blog.npmjs.org/post/85484771375/how-to-install-npm)
> npm install yappy
# License
The [MIT license](LICENSE)
Copyright © 2015 Richard Schneider (makaretu@gmail.com)
|
richardschneider/ecom
|
README.md
|
Markdown
|
mit
| 909
|
//
// UIAView.h
// FoundationExtension
//
// Created by Jeong YunWon on 13. 5. 24..
// Copyright (c) 2013 youknowone.org. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <UIKitExtension/UIAViewController.h>
/*!
* @brief UIView with refined lifecycle. (testing)
*/
@interface UIAView : UIView<UIAViewLifeCycle>
@end
|
LQSForum/LQSForum
|
Pods/FoundationExtension/UIKitExtension/UIAView.h
|
C
|
mit
| 333
|
<?php
namespace Gopro\UserBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class GoproUserExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
//$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
//$loader->load('services.xml');
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
|
jorgelive/Oweb
|
src/Gopro/UserBundle/DependencyInjection/GoproUserExtension.php
|
PHP
|
mit
| 1,026
|
<?php
namespace Mc\ModuleBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DashboardControllerTest extends WebTestCase
{
public function testShow()
{
$client = static::createClient();
$crawler = $client->request('GET', '/dashboard_show');
}
}
|
seekmas/wujiayao
|
src/Mc/ModuleBundle/Tests/Controller/DashboardControllerTest.php
|
PHP
|
mit
| 310
|
/*!
* Bootstrap Responsive v2.3.2
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
*/
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
line-height: 0;
content: "";
}
.clearfix:after {
clear: both;
}
.hide-text {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@-ms-viewport {
width: device-width;
}
.hidden {
display: none;
visibility: hidden;
}
.visible-phone {
display: none !important;
}
.visible-tablet {
display: none !important;
}
.hidden-desktop {
display: none !important;
}
.visible-desktop {
display: inherit !important;
}
@media (min-width: 768px) and (max-width: 979px) {
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important ;
}
.visible-tablet {
display: inherit !important;
}
.hidden-tablet {
display: none !important;
}
}
@media (max-width: 767px) {
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important;
}
.visible-phone {
display: inherit !important;
}
.hidden-phone {
display: none !important;
}
}
.visible-print {
display: none !important;
}
@media print {
.visible-print {
display: inherit !important;
}
.hidden-print {
display: none !important;
}
}
@media (min-width: 1200px) {
.row {
margin-left: -30px;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
line-height: 0;
content: "";
}
.row:after {
clear: both;
}
[class*="span"] {
float: left;
min-height: 1px;
margin-left: 30px;
}
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 1170px;
}
.span12 {
width: 1170px;
}
.span11 {
width: 1070px;
}
.span10 {
width: 970px;
}
.span9 {
width: 870px;
}
.span8 {
width: 770px;
}
.span7 {
width: 670px;
}
.span6 {
width: 570px;
}
.span5 {
width: 470px;
}
.span4 {
width: 370px;
}
.span3 {
width: 270px;
}
.span2 {
width: 170px;
}
.span1 {
width: 70px;
}
.offset12 {
margin-left: 1230px;
}
.offset11 {
margin-left: 1130px;
}
.offset10 {
margin-left: 1030px;
}
.offset9 {
margin-left: 930px;
}
.offset8 {
margin-left: 830px;
}
.offset7 {
margin-left: 730px;
}
.offset6 {
margin-left: 630px;
}
.offset5 {
margin-left: 530px;
}
.offset4 {
margin-left: 430px;
}
.offset3 {
margin-left: 330px;
}
.offset2 {
margin-left: 230px;
}
.offset1 {
margin-left: 130px;
}
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before,
.row-fluid:after {
display: table;
line-height: 0;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 30px;
margin-left: 2.564102564102564%;
*margin-left: 2.5109110747408616%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .controls-row [class*="span"] + [class*="span"] {
margin-left: 2.564102564102564%;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
}
.row-fluid .span11 {
width: 91.45299145299145%;
*width: 91.39979996362975%;
}
.row-fluid .span10 {
width: 82.90598290598291%;
*width: 82.8527914166212%;
}
.row-fluid .span9 {
width: 74.35897435897436%;
*width: 74.30578286961266%;
}
.row-fluid .span8 {
width: 65.81196581196582%;
*width: 65.75877432260411%;
}
.row-fluid .span7 {
width: 57.26495726495726%;
*width: 57.21176577559556%;
}
.row-fluid .span6 {
width: 48.717948717948715%;
*width: 48.664757228587014%;
}
.row-fluid .span5 {
width: 40.17094017094017%;
*width: 40.11774868157847%;
margin: 0;
}
.row-fluid .span4 {
width: 31.623931623931625%;
*width: 31.570740134569924%;
}
.row-fluid .span3 {
width: 23.076923076923077%;
*width: 23.023731587561375%;
}
.row-fluid .span2 {
width: 14.52991452991453%;
*width: 14.476723040552828%;
}
.row-fluid .span1 {
width: 5.982905982905983%;
*width: 5.929714493544281%;
}
.row-fluid .offset12 {
margin-left: 105.12820512820512%;
*margin-left: 105.02182214948171%;
}
.row-fluid .offset12:first-child {
margin-left: 102.56410256410257%;
*margin-left: 102.45771958537915%;
}
.row-fluid .offset11 {
margin-left: 96.58119658119658%;
*margin-left: 96.47481360247316%;
}
.row-fluid .offset11:first-child {
margin-left: 94.01709401709402%;
*margin-left: 93.91071103837061%;
}
.row-fluid .offset10 {
margin-left: 88.03418803418803%;
*margin-left: 87.92780505546462%;
}
.row-fluid .offset10:first-child {
margin-left: 85.47008547008548%;
*margin-left: 85.36370249136206%;
}
.row-fluid .offset9 {
margin-left: 79.48717948717949%;
*margin-left: 79.38079650845607%;
}
.row-fluid .offset9:first-child {
margin-left: 76.92307692307693%;
*margin-left: 76.81669394435352%;
}
.row-fluid .offset8 {
margin-left: 70.94017094017094%;
*margin-left: 70.83378796144753%;
}
.row-fluid .offset8:first-child {
margin-left: 68.37606837606839%;
*margin-left: 68.26968539734497%;
}
.row-fluid .offset7 {
margin-left: 62.393162393162385%;
*margin-left: 62.28677941443899%;
}
.row-fluid .offset7:first-child {
margin-left: 59.82905982905982%;
*margin-left: 59.72267685033642%;
}
.row-fluid .offset6 {
margin-left: 53.84615384615384%;
*margin-left: 53.739770867430444%;
}
.row-fluid .offset6:first-child {
margin-left: 51.28205128205128%;
*margin-left: 51.175668303327875%;
}
.row-fluid .offset5 {
margin-left: 45.299145299145295%;
*margin-left: 45.1927623204219%;
}
.row-fluid .offset5:first-child {
margin-left: 42.73504273504273%;
*margin-left: 42.62865975631933%;
}
.row-fluid .offset4 {
margin-left: 36.75213675213675%;
*margin-left: 36.645753773413354%;
}
.row-fluid .offset4:first-child {
margin-left: 34.18803418803419%;
*margin-left: 34.081651209310785%;
}
.row-fluid .offset3 {
margin-left: 28.205128205128204%;
*margin-left: 28.0987452264048%;
}
.row-fluid .offset3:first-child {
margin-left: 25.641025641025642%;
*margin-left: 25.53464266230224%;
}
.row-fluid .offset2 {
margin-left: 19.65811965811966%;
*margin-left: 19.551736679396257%;
}
.row-fluid .offset2:first-child {
margin-left: 17.094017094017094%;
*margin-left: 16.98763411529369%;
}
.row-fluid .offset1 {
margin-left: 11.11111111111111%;
*margin-left: 11.004728132387708%;
}
.row-fluid .offset1:first-child {
margin-left: 8.547008547008547%;
*margin-left: 8.440625568285142%;
}
input,
textarea,
.uneditable-input {
margin-left: 0;
}
.controls-row [class*="span"] + [class*="span"] {
margin-left: 30px;
}
input.span12,
textarea.span12,
.uneditable-input.span12 {
width: 1156px;
}
input.span11,
textarea.span11,
.uneditable-input.span11 {
width: 1056px;
}
input.span10,
textarea.span10,
.uneditable-input.span10 {
width: 956px;
}
input.span9,
textarea.span9,
.uneditable-input.span9 {
width: 856px;
}
input.span8,
textarea.span8,
.uneditable-input.span8 {
width: 756px;
}
input.span7,
textarea.span7,
.uneditable-input.span7 {
width: 656px;
}
input.span6,
textarea.span6,
.uneditable-input.span6 {
width: 556px;
}
input.span5,
textarea.span5,
.uneditable-input.span5 {
width: 456px;
}
input.span4,
textarea.span4,
.uneditable-input.span4 {
width: 356px;
}
input.span3,
textarea.span3,
.uneditable-input.span3 {
width: 256px;
}
input.span2,
textarea.span2,
.uneditable-input.span2 {
width: 156px;
}
input.span1,
textarea.span1,
.uneditable-input.span1 {
width: 56px;
}
.thumbnails {
margin-left: -30px;
}
.thumbnails > li {
margin-left: 30px;
}
.row-fluid .thumbnails {
margin-left: 0;
}
}
@media (min-width: 768px) and (max-width: 979px) {
.row {
margin-left: -20px;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
line-height: 0;
content: "";
}
.row:after {
clear: both;
}
[class*="span"] {
float: left;
min-height: 1px;
margin-left: 20px;
}
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 724px;
}
.span12 {
width: 724px;
}
.span11 {
width: 662px;
}
.span10 {
width: 600px;
}
.span9 {
width: 538px;
}
.span8 {
width: 476px;
}
.span7 {
width: 414px;
}
.span6 {
width: 352px;
}
.span5 {
width: 290px;
}
.span4 {
width: 228px;
}
.span3 {
width: 166px;
}
.span2 {
width: 104px;
}
.span1 {
width: 42px;
}
.offset12 {
margin-left: 764px;
}
.offset11 {
margin-left: 702px;
}
.offset10 {
margin-left: 640px;
}
.offset9 {
margin-left: 578px;
}
.offset8 {
margin-left: 516px;
}
.offset7 {
margin-left: 454px;
}
.offset6 {
margin-left: 392px;
}
.offset5 {
margin-left: 330px;
}
.offset4 {
margin-left: 268px;
}
.offset3 {
margin-left: 206px;
}
.offset2 {
margin-left: 144px;
}
.offset1 {
margin-left: 82px;
}
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before,
.row-fluid:after {
display: table;
line-height: 0;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 30px;
margin-left: 2.7624309392265194%;
*margin-left: 2.709239449864817%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .controls-row [class*="span"] + [class*="span"] {
margin-left: 2.7624309392265194%;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
}
.row-fluid .span11 {
width: 91.43646408839778%;
*width: 91.38327259903608%;
}
.row-fluid .span10 {
width: 82.87292817679558%;
*width: 82.81973668743387%;
}
.row-fluid .span9 {
width: 74.30939226519337%;
*width: 74.25620077583166%;
}
.row-fluid .span8 {
width: 65.74585635359117%;
*width: 65.69266486422946%;
}
.row-fluid .span7 {
width: 57.18232044198895%;
*width: 57.12912895262725%;
}
.row-fluid .span6 {
width: 48.61878453038674%;
*width: 48.56559304102504%;
}
.row-fluid .span5 {
width: 40.05524861878453%;
*width: 40.00205712942283%;
}
.row-fluid .span4 {
width: 31.491712707182323%;
*width: 31.43852121782062%;
}
.row-fluid .span3 {
width: 22.92817679558011%;
*width: 22.87498530621841%;
}
.row-fluid .span2 {
width: 14.3646408839779%;
*width: 14.311449394616199%;
}
.row-fluid .span1 {
width: 5.801104972375691%;
*width: 5.747913483013988%;
}
.row-fluid .offset12 {
margin-left: 105.52486187845304%;
*margin-left: 105.41847889972962%;
}
.row-fluid .offset12:first-child {
margin-left: 102.76243093922652%;
*margin-left: 102.6560479605031%;
}
.row-fluid .offset11 {
margin-left: 96.96132596685082%;
*margin-left: 96.8549429881274%;
}
.row-fluid .offset11:first-child {
margin-left: 94.1988950276243%;
*margin-left: 94.09251204890089%;
}
.row-fluid .offset10 {
margin-left: 88.39779005524862%;
*margin-left: 88.2914070765252%;
}
.row-fluid .offset10:first-child {
margin-left: 85.6353591160221%;
*margin-left: 85.52897613729868%;
}
.row-fluid .offset9 {
margin-left: 79.8342541436464%;
*margin-left: 79.72787116492299%;
}
.row-fluid .offset9:first-child {
margin-left: 77.07182320441989%;
*margin-left: 76.96544022569647%;
}
.row-fluid .offset8 {
margin-left: 71.2707182320442%;
*margin-left: 71.16433525332079%;
}
.row-fluid .offset8:first-child {
margin-left: 68.50828729281768%;
*margin-left: 68.40190431409427%;
}
.row-fluid .offset7 {
margin-left: 62.70718232044199%;
*margin-left: 62.600799341718584%;
}
.row-fluid .offset7:first-child {
margin-left: 59.94475138121547%;
*margin-left: 59.838368402492065%;
}
.row-fluid .offset6 {
margin-left: 54.14364640883978%;
*margin-left: 54.037263430116376%;
}
.row-fluid .offset6:first-child {
margin-left: 51.38121546961326%;
*margin-left: 51.27483249088986%;
}
.row-fluid .offset5 {
margin-left: 45.58011049723757%;
*margin-left: 45.47372751851417%;
}
.row-fluid .offset5:first-child {
margin-left: 42.81767955801105%;
*margin-left: 42.71129657928765%;
}
.row-fluid .offset4 {
margin-left: 37.01657458563536%;
*margin-left: 36.91019160691196%;
}
.row-fluid .offset4:first-child {
margin-left: 34.25414364640884%;
*margin-left: 34.14776066768544%;
}
.row-fluid .offset3 {
margin-left: 28.45303867403315%;
*margin-left: 28.346655695309746%;
}
.row-fluid .offset3:first-child {
margin-left: 25.69060773480663%;
*margin-left: 25.584224756083227%;
}
.row-fluid .offset2 {
margin-left: 19.88950276243094%;
*margin-left: 19.783119783707537%;
}
.row-fluid .offset2:first-child {
margin-left: 17.12707182320442%;
*margin-left: 17.02068884448102%;
}
.row-fluid .offset1 {
margin-left: 11.32596685082873%;
*margin-left: 11.219583872105325%;
}
.row-fluid .offset1:first-child {
margin-left: 8.56353591160221%;
*margin-left: 8.457152932878806%;
}
input,
textarea,
.uneditable-input {
margin-left: 0;
}
.controls-row [class*="span"] + [class*="span"] {
margin-left: 20px;
}
input.span12,
textarea.span12,
.uneditable-input.span12 {
width: 710px;
}
input.span11,
textarea.span11,
.uneditable-input.span11 {
width: 648px;
}
input.span10,
textarea.span10,
.uneditable-input.span10 {
width: 586px;
}
input.span9,
textarea.span9,
.uneditable-input.span9 {
width: 524px;
}
input.span8,
textarea.span8,
.uneditable-input.span8 {
width: 462px;
}
input.span7,
textarea.span7,
.uneditable-input.span7 {
width: 400px;
}
input.span6,
textarea.span6,
.uneditable-input.span6 {
width: 338px;
}
input.span5,
textarea.span5,
.uneditable-input.span5 {
width: 276px;
}
input.span4,
textarea.span4,
.uneditable-input.span4 {
width: 214px;
}
input.span3,
textarea.span3,
.uneditable-input.span3 {
width: 152px;
}
input.span2,
textarea.span2,
.uneditable-input.span2 {
width: 90px;
}
input.span1,
textarea.span1,
.uneditable-input.span1 {
width: 28px;
}
}
@media (max-width: 767px) {
body {
padding-right: 20px;
padding-left: 20px;
}
.navbar-fixed-top,
.navbar-fixed-bottom,
.navbar-static-top {
margin-right: -20px;
margin-left: -20px;
}
.container-fluid {
padding: 0;
}
.dl-horizontal dt {
float: none;
width: auto;
clear: none;
text-align: left;
}
.dl-horizontal dd {
margin-left: 0;
}
.container {
width: auto;
}
.row-fluid {
width: 100%;
}
.row,
.thumbnails {
margin-left: 0;
}
.thumbnails > li {
float: none;
margin-left: 0;
}
[class*="span"],
.uneditable-input[class*="span"],
.row-fluid [class*="span"] {
display: block;
float: none;
width: 100%;
margin-left: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.span12,
.row-fluid .span12 {
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="offset"]:first-child {
margin-left: 0;
}
.input-large,
.input-xlarge,
.input-xxlarge,
input[class*="span"],
select[class*="span"],
textarea[class*="span"],
.uneditable-input {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.input-prepend input,
.input-append input,
.input-prepend input[class*="span"],
.input-append input[class*="span"] {
display: inline-block;
width: auto;
}
.controls-row [class*="span"] + [class*="span"] {
margin-left: 0;
}
.modal {
position: fixed;
top: 20px;
right: 20px;
left: 20px;
width: auto;
margin: 0;
}
.modal.fade {
top: -100px;
}
.modal.fade.in {
top: 20px;
}
}
@media (max-width: 480px) {
.nav-collapse {
-webkit-transform: translate3d(0, 0, 0);
}
.page-header h1 small {
display: block;
line-height: 20px;
}
input[type="checkbox"],
input[type="radio"] {
border: 1px solid #ccc;
}
.form-horizontal .control-label {
float: none;
width: auto;
padding-top: 0;
text-align: left;
}
.form-horizontal .controls {
margin-left: 0;
}
.form-horizontal .control-list {
padding-top: 0;
}
.form-horizontal .form-actions {
padding-right: 10px;
padding-left: 10px;
}
.media .pull-left,
.media .pull-right {
display: block;
float: none;
margin-bottom: 10px;
}
.media-object {
margin-right: 0;
margin-left: 0;
}
.modal {
top: 10px;
right: 10px;
left: 10px;
}
.modal-header .close {
padding: 10px;
margin: -10px;
}
.carousel-caption {
position: static;
}
}
@media (max-width: 979px) {
body {
padding-top: 0;
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: static;
}
.navbar-fixed-top {
margin-bottom: 20px;
}
.navbar-fixed-bottom {
margin-top: 20px;
}
.navbar-fixed-top .navbar-inner,
.navbar-fixed-bottom .navbar-inner {
padding: 5px;
}
.navbar .container {
width: auto;
padding: 0;
}
.navbar .brand {
padding-right: 10px;
padding-left: 10px;
margin: 0 0 0 -5px;
}
.nav-collapse {
clear: both;
}
.nav-collapse .nav {
float: none;
margin: 0 0 10px;
}
.nav-collapse .nav > li {
float: none;
}
.nav-collapse .nav > li > a {
margin-bottom: 2px;
}
.nav-collapse .nav > .divider-vertical {
display: none;
}
.nav-collapse .nav .nav-header {
color: #777777;
text-shadow: none;
}
.nav-collapse .nav > li > a,
.nav-collapse .dropdown-menu a {
padding: 9px 15px;
font-weight: bold;
color: #777777;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.nav-collapse .btn {
padding: 4px 10px 4px;
font-weight: normal;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.nav-collapse .dropdown-menu li + li a {
margin-bottom: 2px;
}
.nav-collapse .nav > li > a:hover,
.nav-collapse .nav > li > a:focus,
.nav-collapse .dropdown-menu a:hover,
.nav-collapse .dropdown-menu a:focus {
background-color: #f2f2f2;
}
.navbar-inverse .nav-collapse .nav > li > a,
.navbar-inverse .nav-collapse .dropdown-menu a {
color: #999999;
}
.navbar-inverse .nav-collapse .nav > li > a:hover,
.navbar-inverse .nav-collapse .nav > li > a:focus,
.navbar-inverse .nav-collapse .dropdown-menu a:hover,
.navbar-inverse .nav-collapse .dropdown-menu a:focus {
background-color: #111111;
}
.nav-collapse.in .btn-group {
padding: 0;
margin-top: 5px;
}
.nav-collapse .dropdown-menu {
position: static;
top: auto;
left: auto;
display: none;
float: none;
max-width: none;
padding: 0;
margin: 0 15px;
background-color: transparent;
border: none;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.nav-collapse .open > .dropdown-menu {
display: block;
}
.nav-collapse .dropdown-menu:before,
.nav-collapse .dropdown-menu:after {
display: none;
}
.nav-collapse .dropdown-menu .divider {
display: none;
}
.nav-collapse .nav > li > .dropdown-menu:before,
.nav-collapse .nav > li > .dropdown-menu:after {
display: none;
}
.nav-collapse .navbar-form,
.nav-collapse .navbar-search {
float: none;
padding: 10px 15px;
margin: 10px 0;
border-top: 1px solid #f2f2f2;
border-bottom: 1px solid #f2f2f2;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar-inverse .nav-collapse .navbar-form,
.navbar-inverse .nav-collapse .navbar-search {
border-top-color: #111111;
border-bottom-color: #111111;
}
.navbar .nav-collapse .nav.pull-right {
float: none;
margin-left: 0;
}
.nav-collapse,
.nav-collapse.collapse {
height: 0;
overflow: hidden;
}
.navbar .btn-navbar {
display: block;
}
.navbar-static .navbar-inner {
padding-right: 10px;
padding-left: 10px;
}
}
@media (min-width: 980px) {
.nav-collapse.collapse {
height: auto !important;
overflow: visible !important;
}
}
|
sjamartucheli/smartucheli
|
packages/system/public/views/css/bootstrap-responsive.css
|
CSS
|
mit
| 22,114
|
$(function (){
location.hash = "#welcome.html";
loader("welcome.html");
});
var loader = function (s) {
// load content from server
$.get(s, function (data){
var result = $(data);
$("#content").html(result);
// send event to Google Analytics
ga('send', 'event', 'content', 'load', s);
// process math
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "content"]);
});
}
window.onhashchange = function () {
console.log(location.hash);
loader(location.hash.substring(1));
}
|
tscholl2/125_online_notes
|
js-src/loader.js
|
JavaScript
|
mit
| 521
|
using System;
using System.Collections.Generic;
public class Book: IComparable<Book>
{
public Book(string title, int year, params string[] authors)
{
this.Title = title;
this.Year = year;
this.Authors = authors;
}
public string Title { get; private set; }
public int Year { get; private set; }
public IReadOnlyList<string> Authors { get; private set; }
public int CompareTo(Book other)
{
var result = this.Year.CompareTo(other.Year); // ASC
if (result == 0)
{
result = this.Title.CompareTo(other.Title); // ASC
}
return result;
}
public override string ToString()
{
return $"{this.Title} - {this.Year}";
}
}
|
Rusev12/Software-University-SoftUni
|
C# OOP Advanced/03-Iterators-and-Comparators/L04-BookComparator/Models/Book.cs
|
C#
|
mit
| 750
|
module JsonMatchers
class Parser
def initialize(schema_path)
@schema_path = schema_path
end
def parse
JsonSchema.parse!(schema_data)
rescue JSON::ParserError, JsonSchema::SchemaError => error
raise InvalidSchemaError.new(error)
end
private
attr_reader :schema_path
def schema_data
JSON.parse(schema_path.read)
end
end
end
|
thoughtbot/json_matchers
|
lib/json_matchers/parser.rb
|
Ruby
|
mit
| 390
|
namespace Mist {
/**
* @class Component
*/
export class Component {
static responses: any = {};
/**
* @param {} component
* @param {} o
* @returns {}
* @summary for all components
*/
static create<T>(component: any, ...o: any[]): T {
var m = ser([component]);
var n = ser(o);
// initialize
this.responses[m] || (this.responses[m] = {});
// inher response
if (!this.responses[m][n]) {
this.responses[m][n] = new (
component.bind.apply(
component, [component].concat([].slice.apply(o))));
}
// lasting response
return this.responses[m][n];
}
}
/**
* @access private
* @static
*/
var sessions = 0;
/**
* @access private
* @static
*/
function ser(conv: any[]) {
return JSON.stringify(
conv.map(
function(v) {
return v instanceof Object ?
v.sessid || (v.sessid = sessions++) :
v;
}));
}
}
|
AI428/mist
|
src/mist/component.ts
|
TypeScript
|
mit
| 1,223
|
---
layout: project
lab: OK Lab Heilbronn #needed for Aggregation on Lab-Page
imgname: heilbronn/kastanien-app.png
title: Kastanienapp
links:
- url: http://blog.opendatalab.de/opendata/2014/11/19/kastanien-app-mit-baumkataster
name: Blogpost
- url: https://github.com/opendata-heilbronn/kastanien-app
name: Page on Github
collaborators:
- name: Adrian Stabiszewski
links:
- url: https://twitter.com/nitegate
url-name: twitter
- url: https://github.com/grundid
url-name: github
- name: Tom Görner
links:
- url: https://github.com/masterX244
url-name: github
- name: Christian
links:
- url: https://twitter.com/AppProjectX
url-name: twitter
- url: https://github.com/Nachtfux
url-name: github
---
Vor ein paar Monaten hat die Stadt Hamburg auf ihrem Transparenzportal das Baumkataster als Open Data veröffentlicht. Passend zur Zeit der Herbstsparziergänge drängte sich uns bei einem Code For Heilbronn Treff die Idee einer Baum App auf, die einem ermöglicht, unterwegs leicht Kastanienbäume zu finden und deren Früchte zu sammeln.
Die App ermöglicht aber auch allgemein, für jeden Baum in Heilbronn Informationen wie Art, lateinischer Name und Alter abzufragen. Somit kann unterwegs die Frage, was für ein Baum vor einem steht, dank Standorterkennung mit dem Smartphone ganz leicht beantwortet werden.
Alles weitere im [Blogpost auf opendatalab.de](http://blog.opendatalab.de/opendata/2014/11/19/kastanien-app-mit-baumkataster)
|
marcel12bell/codefor.de
|
projekte/2014-11-29-hn-kastanienapp.html
|
HTML
|
mit
| 1,482
|
//===-- XCoreMCTargetDesc.h - XCore Target Descriptions ---------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides XCore specific target descriptions.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_XCORE_MCTARGETDESC_XCOREMCTARGETDESC_H
#define LLVM_LIB_TARGET_XCORE_MCTARGETDESC_XCOREMCTARGETDESC_H
#include "llvm/Support/DataTypes.h"
namespace llvm {
class Target;
Target &getTheXCoreTarget();
} // End llvm namespace
// Defines symbolic names for XCore registers. This defines a mapping from
// register name to register number.
//
#define GET_REGINFO_ENUM
#include "XCoreGenRegisterInfo.inc"
// Defines symbolic names for the XCore instructions.
//
#define GET_INSTRINFO_ENUM
#include "XCoreGenInstrInfo.inc"
#define GET_SUBTARGETINFO_ENUM
#include "XCoreGenSubtargetInfo.inc"
#endif
|
ensemblr/llvm-project-boilerplate
|
include/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h
|
C
|
mit
| 1,109
|
#pragma once
#include "types.h"
#include "rtmp/client.h"
#include "rtmp/messages.h"
#include "flex/messages.h"
#include <iostream>
#include <vector>
#include <functional>
namespace flex {
namespace messaging {
class Consumer {
typedef std::function<void(const amf::Variant&)> MessageListener;
public:
Consumer(){
}
std::string destination(){
return mDestination;
}
std::string clientId(){
return mClientId;
}
void setDestination(const std::string& value){
mDestination = value;
}
void subscribe(const std::string& clientid){
mClientId = clientid;
rtmp::Client::instance().registerConsumer(this);
flex::messaging::messages::CommandMessage* msg = new flex::messaging::messages::CommandMessage();
msg->setClientId(mClientId);
msg->setDestination(mDestination);
msg->setOperation(flex::messaging::messages::CommandMessage::SUBSCRIBE);
msg->headers()->set("DSSubtopic", mClientId);
rtmp::Client::instance().send(&rtmp::messages::Amf3Command(amf::Variant((amf::Object*)msg)), std::bind(&Consumer::onSubscribe, this, std::placeholders::_1));
}
void addListener(const MessageListener& listener){
mListeners.push_back(listener);
}
void onMessage(const amf::Variant& message){
for(auto itr = mListeners.begin(); itr != mListeners.end(); ++itr)
(*itr)(message);
}
private:
void onSubscribe(const amf::Variant& result){
std::cout << "Consumer " << mClientId << " acknowledged" << std::endl;
}
private:
std::string mClientId;
std::string mDestination;
std::vector<MessageListener> mListeners;
};
};
};
|
exjam/OpenPvP.net
|
rtmp/flex/consumer.h
|
C
|
mit
| 1,706
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import "NSWindowController.h"
@class DVTBorderedView, IDEAssistant, IDEAssistantContext, IDEFilterControlBar, NSBox, NSButton, NSMutableArray, NSString, NSTextField, NSView;
@interface IDEAssistantWindowController : NSWindowController
{
NSBox *_box;
DVTBorderedView *_outerBorderedView;
DVTBorderedView *_borderedView;
DVTBorderedView *_sourceListBorderedView;
NSButton *_nextButton;
NSButton *_backButton;
NSButton *_cancelButton;
NSTextField *_titleField;
IDEFilterControlBar *_filterControlBar;
IDEAssistant *_installedAssistant;
IDEAssistantContext *_assistantContext;
id _currentCompletionBlock;
NSMutableArray *_assistantHistory;
NSMutableArray *_allAnimations;
NSView *_nextKeyView;
double _lastAnimationDirection;
_Bool _backtrackingFromOverlayAssistant;
_Bool _closing;
IDEAssistant *_currentAssistant;
NSString *_nextButtonTitle;
NSString *_finishButtonTitle;
NSMutableArray *_completionPreprocessors;
NSMutableArray *_completionPreprocessorExecutionStack;
}
+ (id)keyPathsForValuesAffectingAssistantTitle;
+ (id)keyPathsForValuesAffectingCanCancel;
+ (id)keyPathsForValuesAffectingCanGoForwardOrFinish;
+ (id)keyPathsForValuesAffectingForwardOrFinishButtonTitle;
+ (id)keyPathsForValuesAffectingOnFirstAssistant;
- (void).cxx_destruct;
- (void)_clearAssistantHistoryStack;
- (void)_finishWithAction:(id)arg1;
- (id)_popAssistantHistoryStack;
- (id)_popAssistantHistoryStackToIdentifier:(id)arg1;
- (void)_pushAssistantOntoHistoryStack:(id)arg1;
- (void)addAnimationForKey:(id)arg1 toView:(id)arg2;
- (void)addGoForwardPreprocessor:(id)arg1;
- (id)assistantTitle;
- (id)assistantWithIdentifier:(id)arg1;
- (void)beginSessionForWorkspaceWindow:(id)arg1;
- (void)beginSessionWithAssistantIdentifier:(id)arg1 context:(id)arg2 completionBlock:(id)arg3;
- (BOOL)canCancel;
- (BOOL)canGoBack;
- (BOOL)canGoForwardOrFinish;
- (void)cancelSession;
- (void)close;
@property(retain, nonatomic) NSMutableArray *completionPreprocessorExecutionStack; // @synthesize completionPreprocessorExecutionStack=_completionPreprocessorExecutionStack;
@property(retain, nonatomic) NSMutableArray *completionPreprocessors; // @synthesize completionPreprocessors=_completionPreprocessors;
- (void)configureAnimationImageViewWithDirection:(double)arg1 actionBlock:(id)arg2;
@property(readonly, nonatomic) IDEAssistant *currentAssistant; // @synthesize currentAssistant=_currentAssistant;
- (void)didInstallViewController:(id)arg1;
- (void)drainPreprocessorOrContinueWithSender:(id)arg1;
- (void)endAssistantSessionWithResult:(int)arg1 error:(id)arg2;
@property(retain, nonatomic) NSString *finishButtonTitle; // @synthesize finishButtonTitle=_finishButtonTitle;
- (id)forwardOrFinishButtonTitle;
- (void)goBack:(id)arg1;
- (void)goNextOrFinish:(id)arg1;
- (id)init;
@property(retain, nonatomic) NSString *nextButtonTitle; // @synthesize nextButtonTitle=_nextButtonTitle;
- (BOOL)onFirstAssistant;
- (void)setAnimationDuration;
- (void)setCurrentAssistant:(id)arg1;
- (void)setCurrentAssistant:(id)arg1 andInstallView:(BOOL)arg2;
- (void)setupAccessoriesForAssistant:(id)arg1 animated:(BOOL)arg2;
- (id)skipAheadIfPossibleAndReturnAssistantIdentifier;
- (void)willInstallViewController:(id)arg1;
- (void)windowDidLoad;
@end
|
orta/AxeMode
|
XcodeHeaders/IDEKit/IDEAssistantWindowController.h
|
C
|
mit
| 3,445
|
## Flot 0.8.3 ##
### Changes ###
- Updated example code to avoid encouraging unnecessary re-plots.
(patch by soenter, pull request #1221)
### Bug fixes ###
- Added a work-around to disable the allocation of extra space for first and
last axis ticks, allowing plots to span the full width of their container.
A proper solution for this bug will be implemented in the 0.9 release.
(reported by Josh Pigford and andig, issue #1212, pull request #1290)
- Fixed a regression introduced in 0.8.1, where the last tick label would
sometimes wrap rather than extending the plot's offset to create space.
(reported by Elite Gamer, issue #1283)
- Fixed a regression introduced in 0.8.2, where the resize plugin would use
unexpectedly high amounts of CPU even when idle.
(reported by tommie, issue #1277, pull request #1289)
- Fixed the selection example to work with jQuery 1.9.x and later.
(reported by EGLadona and dmfalke, issue #1250, pull request #1285)
- Added a detach shim to fix support for jQuery versions earlier than 1.4.x.
(reported by ngavard, issue #1240, pull request #1286)
- Fixed a rare 'Uncaught TypeError' when using the resize plugin in IE 7/8.
(reported by tleish, issue #1265, pull request #1289)
- Fixed zoom constraints to apply only in the direction of the zoom.
(patch by Neil Katin, issue #1204, pull request #1205)
- Markings lines are no longer blurry when drawn on pixel boundaries.
(reported by btccointicker and Rouillard, issue #1210)
- Don't discard original pie data-series values when combining slices.
(patch by Phil Tsarik, pull request #1238)
- Fixed broken auto-scale behavior when using deprecated [x|y]2axis options.
(reported by jorese, issue #1228, pull request #1284)
- Exposed the dateGenerator function on the plot object, as it used to be
before time-mode was moved into a separate plugin.
(patch by Paolo Valleri, pull request #1028)
## Flot 0.8.2 ##
### Changes ###
- Added a plot.destroy method as a way to free memory when emptying the plot
placeholder and then re-using it for some other purpose.
(patch by Thodoris Greasidis, issue #1129, pull request #1130)
- Added a table of contents and PLUGINS link to the API documentation.
(patches by Brian Peiris, pull requests #1064 and #1127)
- Added Ruby code examples for time conversion.
(patch by Mike Połtyn, pull request #1182)
- Minor improvements to API.md and README.md.
(patches by Patrik Ragnarsson, pull requests #1085 and #1086)
- Updated inlined jQuery Resize to the latest version to fix errors.
(reported by Matthew Sabol and sloker, issues #997 ad #1081)
### Bug fixes ###
- Fixed an unexpected change in behavior that resulted in duplicate tick
labels when using a plugin, like flot-tickrotor, that overrode tick labels.
(patch by Mark Cote, pull request #1091)
- Fixed a regression from 0.7 where axis labels were given the wrong width,
causing them to overlap at certain scales and ignore the labelWidth option.
(patch by Benjamin Gram, pull request #1177)
- Fixed a bug where the second axis in an xaxes/yaxes array incorrectly had
its 'innermost' property set to false or undefined, even if it was on the
other side of the plot from the first axis. This resulted in the axis bar
being visible when it shouldn't have been, which was especially obvious
when the grid had a left/right border width of zero.
(reported by Teq1, fix researched by ryleyb, issue #1056)
- Fixed an error when using a placeholder that has no font-size property.
(patch by Craig Oldford, pull request #1135)
- Fixed a regression from 0.7 where nulls at the end of a series were ignored
for purposes of determing the range of the x-axis.
(reported by Munsifali Rashid, issue #1095)
- If a font size is provided, base the default lineHeight on that size rather
that the font size of the plot placeholder, which may be very different.
(reported by Daniel Hoffmann Bernardes, issue #1131, pull request #1199)
- Fix broken highlighting for right-aligned bars.
(reported by BeWiBu and Mihai Stanciu, issues #975 and #1093, with further
assistance by Eric Byers, pull request #1120)
- Prevent white circles from sometimes showing up inside of pie charts.
(reported by Pierre Dubois and Jack Klink, issues #1128 and #1073)
- Label formatting no longer breaks when a page contains multiple pie charts.
(reported by Brend Wanders, issue #1055)
- When using multiple axes on opposite sides of the plot, the innermost axis
coming later in the list no longer has its bar drawn incorrectly.
(reported by ryleyb, issue #1056)
- When removing series labels and redrawing the plot, the legend now updates
correctly even when using an external container.
(patch by Luis Silva, issue #1159, pull request #1160)
- The pie plugin no longer ignores the value of the left offset option.
(reported by melanker, issue #1136)
- Fixed a regression from 0.7, where extra padding was added unnecessarily to
sides of the plot where there was no last tick label.
(reported by sknob001, issue #1048, pull request #1200)
- Fixed incorrect tooltip behavior in the interacting example.
(patch by cleroux, issue #686, pull request #1074)
- Fixed an error in CSS color extraction with elements outside the DOM.
(patch by execjosh, pull request #1084)
- Fixed :not selector error when using jQuery without Sizzle.
(patch by Anthony Ryan, pull request #1180)
- Worked around a browser issue that caused bars to appear un-filled.
(reported by irbian, issue #915)
## Flot 0.8.1 ##
### Bug fixes ###
- Fixed a regression in the time plugin, introduced in 0.8, that caused dates
to align to the minute rather than to the highest appropriate unit. This
caused many x-axes in 0.8 to have different ticks than they did in 0.7.
(reported by Tom Sheppard, patch by Daniel Shapiro, issue #1017, pull
request #1023)
- Fixed a regression in text rendering, introduced in 0.8, that caused axis
labels with the same text as another label on the same axis to disappear.
More generally, it's again possible to have the same text in two locations.
(issue #1032)
- Fixed a regression in text rendering, introduced in 0.8, where axis labels
were no longer assigned an explicit width, and their text could not wrap.
(reported by sabregreen, issue #1019)
- Fixed a regression in the pie plugin, introduced in 0.8, that prevented it
from accepting data in the format '[[x, y]]'.
(patch by Nicolas Morel, pull request #1024)
- The 'zero' series option and 'autoscale' format option are no longer
ignored when the series contains a null value.
(reported by Daniel Shapiro, issue #1033)
- Avoid triggering the time-mode plugin exception when there are zero series.
(reported by Daniel Rothig, patch by Mark Raymond, issue #1016)
- When a custom color palette has fewer colors than the default palette, Flot
no longer fills out the colors with the remainder of the default.
(patch by goorpy, issue #1031, pull request #1034)
- Fixed missing update for bar highlights after a zoom or other redraw.
(reported by Paolo Valleri, issue #1030)
- Fixed compatibility with jQuery versions earlier than 1.7.
(patch by Lee Willis, issue #1027, pull request #1027)
- The mouse wheel no longer scrolls the page when using the navigate plugin.
(patch by vird, pull request #1020)
- Fixed missing semicolons in the core library.
(reported by Michal Zglinski)
## Flot 0.8.0 ##
### API changes ###
Support for time series has been moved into a plugin, jquery.flot.time.js.
This results in less code if time series are not used. The functionality
remains the same (plus timezone support, as described below); however, the
plugin must be included if axis.mode is set to "time".
When the axis mode is "time", the axis option "timezone" can be set to null,
"browser", or a particular timezone (e.g. "America/New_York") to control how
the dates are displayed. If null, the dates are displayed as UTC. If
"browser", the dates are displayed in the time zone of the user's browser.
Date/time formatting has changed and now follows a proper subset of the
standard strftime specifiers, plus one nonstandard specifier for quarters.
Additionally, if a strftime function is found in the Date object's prototype,
it will be used instead of the built-in formatter.
Axis tick labels now use the class 'flot-tick-label' instead of 'tickLabel'.
The text containers for each axis now use the classes 'flot-[x|y]-axis' and
'flot-[x|y]#-axis' instead of '[x|y]Axis' and '[x|y]#Axis'. For compatibility
with Flot 0.7 and earlier text will continue to use the old classes as well,
but they are considered deprecated and will be removed in a future version.
In previous versions the axis 'color' option was used to set the color of tick
marks and their label text. It now controls the color of the axis line, which
previously could not be changed separately, and continues to act as a default
for the tick-mark color. The color of tick label text is now set either by
overriding the 'flot-tick-label' CSS rule or via the axis 'font' option.
A new plugin, jquery.flot.canvas.js, allows axis tick labels to be rendered
directly to the canvas, rather than using HTML elements. This feature can be
toggled with a simple option, making it easy to create interactive plots in the
browser using HTML, then re-render them to canvas for export as an image.
The plugin tries to remain as faithful as possible to the original HTML render,
and goes so far as to automatically extract styles from CSS, to avoid having to
provide a separate set of styles when rendering to canvas. Due to limitations
of the canvas text API, the plugin cannot reproduce certain features, including
HTML markup embedded in labels, and advanced text styles such as 'em' units.
The plugin requires support for canvas text, which may not be present in some
older browsers, even if they support the canvas tag itself. To use the plugin
with these browsers try using a shim such as canvas-text or FlashCanvas.
The base and overlay canvas are now using the CSS classes "flot-base" and
"flot-overlay" to prevent accidental clashes (issue 540).
### Changes ###
- Addition of nonstandard %q specifier to date/time formatting. (patch
by risicle, issue 49)
- Date/time formatting follows proper subset of strftime specifiers, and
support added for Date.prototype.strftime, if found. (patch by Mark Cote,
issues 419 and 558)
- Fixed display of year ticks. (patch by Mark Cote, issue 195)
- Support for time series moved to plugin. (patch by Mark Cote)
- Display time series in different time zones. (patch by Knut Forkalsrud,
issue 141)
- Added a canvas plugin to enable rendering axis tick labels to the canvas.
(sponsored by YCharts.com, implementation by Ole Laursen and David Schnur)
- Support for setting the interval between redraws of the overlay canvas with
redrawOverlayInterval. (suggested in issue 185)
- Support for multiple thresholds in thresholds plugin. (patch by Arnaud
Bellec, issue 523)
- Support for plotting categories/textual data directly with new categories
plugin.
- Tick generators now get the whole axis rather than just min/max.
- Added processOffset and drawBackground hooks. (suggested in issue 639)
- Added a grid "margin" option to set the space between the canvas edge and
the grid.
- Prevent the pie example page from generating single-slice pies. (patch by
Shane Reustle)
- In addition to "left" and "center", bars now recognize "right" as an
alignment option. (patch by Michael Mayer, issue 520)
- Switched from toFixed to a much faster default tickFormatter. (patch by
Clemens Stolle)
- Added to a more helpful error when using a time-mode axis without including
the flot.time plugin. (patch by Yael Elmatad)
- Added a legend "sorted" option to control sorting of legend entries
independent of their series order. (patch by Tom Cleaveland)
- Added a series "highlightColor" option to control the color of the
translucent overlay that identifies the dataset when the mouse hovers over
it. (patch by Eric Wendelin and Nate Abele, issues 168 and 299)
- Added a plugin jquery.flot.errorbars, with an accompanying example, that
adds the ability to plot error bars, commonly used in many kinds of
statistical data visualizations. (patch by Rui Pereira, issue 215)
- The legend now omits entries whose labelFormatter returns null. (patch by
Tom Cleaveland, Christopher Lambert, and Simon Strandgaard)
- Added support for high pixel density (retina) displays, resulting in much
crisper charts on such devices. (patch by Olivier Guerriat, additional
fixes by Julien Thomas, maimairel, and Lau Bech Lauritzen)
- Added the ability to control pie shadow position and alpha via a new pie
'shadow' option. (patch by Julien Thomas, pull request #78)
- Added the ability to set width and color for individual sides of the grid.
(patch by Ara Anjargolian, additional fixes by Karl Swedberg, pull requests #855
and #880)
- The selection plugin's getSelection now returns null when the selection
has been cleared. (patch by Nick Campbell, pull request #852)
- Added a new option called 'zero' to bars and filled lines series, to control
whether the y-axis minimum is scaled to fit the data or set to zero.
(patch by David Schnur, issues #316, #529, and #856, pull request #911)
- The plot function is now also a jQuery chainable property.
(patch by David Schnur, issues #734 and #816, pull request #953)
- When only a single pie slice is beneath the combine threshold it is no longer
replaced by an 'other' slice. (suggested by Devin Bayer, issue #638)
- Added lineJoin and minSize options to the selection plugin to control the
corner style and minimum size of the selection, respectively.
(patch by Ruth Linehan, pull request #963)
### Bug fixes ###
- Fix problem with null values and pie plugin. (patch by gcruxifix,
issue 500)
- Fix problem with threshold plugin and bars. (based on patch by
kaarlenkaski, issue 348)
- Fix axis box calculations so the boxes include the outermost part of the
labels too.
- Fix problem with event clicking and hovering in IE 8 by updating Excanvas
and removing previous work-around. (test case by Ara Anjargolian)
- Fix issues with blurry 1px border when some measures aren't integer.
(reported by Ara Anjargolian)
- Fix bug with formats in the data processor. (reported by Peter Hull,
issue 534)
- Prevent i from being declared global in extractRange. (reported by
Alexander Obukhov, issue 627)
- Throw errors in a more cross-browser-compatible manner. (patch by
Eddie Kay)
- Prevent pie slice outlines from being drawn when the stroke width is zero.
(reported by Chris Minett, issue 585)
- Updated the navigate plugin's inline copy of jquery.mousewheel to fix
Webkit zoom problems. (reported by Hau Nguyen, issue 685)
- Axis labels no longer appear as decimals rather than integers in certain
cases. (patch by Clemens Stolle, issue 541)
- Automatic color generation no longer produces only whites and blacks when
there are many series. (patch by David Schnur and Tom Cleaveland)
- Fixed an error when custom tick labels weren't provided as strings. (patch
by Shad Downey)
- Prevented the local insertSteps and fmt variables from becoming global.
(first reported by Marc Bennewitz and Szymon Barglowski, patch by Nick
Campbell, issues #825 and #831, pull request #851)
- Prevented several threshold plugin variables from becoming global. (patch
by Lasse Dahl Ebert)
- Fixed various jQuery 1.8 compatibility issues. (issues #814 and #819,
pull request #877)
- Pie charts with a slice equal to or approaching 100% of the pie no longer
appear invisible. (patch by David Schnur, issues #444, #658, #726, #824
and #850, pull request #879)
- Prevented several local variables from becoming global. (patch by aaa707)
- Ensure that the overlay and primary canvases remain aligned. (issue #670,
pull request #901)
- Added support for jQuery 1.9 by removing and replacing uses of $.browser.
(analysis and patch by Anthony Ryan, pull request #905)
- Pie charts no longer disappear when redrawn during a resize or update.
(reported by Julien Bec, issue #656, pull request #910)
- Avoided floating-point precision errors when calculating pie percentages.
(patch by James Ward, pull request #918)
- Fixed compatibility with jQuery 1.2.6, which has no 'mouseleave' shortcut.
(reported by Bevan, original pull request #920, replaced by direct patch)
- Fixed sub-pixel rendering issues with crosshair and selection lines.
(patches by alanayoub and Daniel Shapiro, pull requests #17 and #925)
- Fixed rendering issues when using the threshold plugin with several series.
(patch by Ivan Novikov, pull request #934)
- Pie charts no longer disappear when redrawn after calling setData().
(reported by zengge1984 and pareeohnos, issues #810 and #945)
- Added a work-around for the problem where points with a lineWidth of zero
still showed up with a visible line. (reported by SalvoSav, issue #842,
patch by Jamie Hamel-Smith, pull request #937)
- Pie charts now accept values in string form, like other plot types.
(reported by laerdal.no, issue #534)
- Avoid rounding errors in the threshold plugin.
(reported by jerikojerk, issue #895)
- Fixed an error when using the navigate plugin with jQuery 1.9.x or later.
(reported by Paolo Valleri, issue #964)
- Fixed inconsistencies between the highlight and unhighlight functions.
(reported by djamshed, issue #987)
- Fixed recalculation of tickSize and tickDecimals on calls to setupGrid.
(patch by thecountofzero, pull request #861, issues #860, #1000)
## Flot 0.7 ##
### API changes ###
Multiple axes support. Code using dual axes should be changed from using
x2axis/y2axis in the options to using an array (although backwards-
compatibility hooks are in place). For instance,
```js
{
xaxis: { ... }, x2axis: { ... },
yaxis: { ... }, y2axis: { ... }
}
```
becomes
```js
{
xaxes: [ { ... }, { ... } ],
yaxes: [ { ... }, { ... } ]
}
```
Note that if you're just using one axis, continue to use the xaxis/yaxis
directly (it now sets the default settings for the arrays). Plugins touching
the axes must be ported to take the extra axes into account, check the source
to see some examples.
A related change is that the visibility of axes is now auto-detected. So if
you were relying on an axis to show up even without any data in the chart, you
now need to set the axis "show" option explicitly.
"tickColor" on the grid options is now deprecated in favour of a corresponding
option on the axes, so:
```js
{ grid: { tickColor: "#000" }}
```
becomes
```js
{ xaxis: { tickColor: "#000"}, yaxis: { tickColor: "#000"} }
```
But if you just configure a base color Flot will now autogenerate a tick color
by adding transparency. Backwards-compatibility hooks are in place.
Final note: now that IE 9 is coming out with canvas support, you may want to
adapt the excanvas include to skip loading it in IE 9 (the examples have been
adapted thanks to Ryley Breiddal). An alternative to excanvas using Flash has
also surfaced, if your graphs are slow in IE, you may want to give it a spin:
https://code.google.com/p/flashcanvas/
### Changes ###
- Support for specifying a bottom for each point for line charts when filling
them, this means that an arbitrary bottom can be used instead of just the x
axis. (based on patches patiently provided by Roman V. Prikhodchenko)
- New fillbetween plugin that can compute a bottom for a series from another
series, useful for filling areas between lines.
See new example percentiles.html for a use case.
- More predictable handling of gaps for the stacking plugin, now all
undefined ranges are skipped.
- Stacking plugin can stack horizontal bar charts.
- Navigate plugin now redraws the plot while panning instead of only after
the fact. (raised by lastthemy, issue 235)
Can be disabled by setting the pan.frameRate option to null.
- Date formatter now accepts %0m and %0d to get a zero-padded month or day.
(issue raised by Maximillian Dornseif)
- Revamped internals to support an unlimited number of axes, not just dual.
(sponsored by Flight Data Services, www.flightdataservices.com)
- New setting on axes, "tickLength", to control the size of ticks or turn
them off without turning off the labels.
- Axis labels are now put in container divs with classes, for instance labels
in the x axes can be reached via ".xAxis .tickLabel".
- Support for setting the color of an axis. (sponsored by Flight Data
Services, www.flightdataservices.com)
- Tick color is now auto-generated as the base color with some transparency,
unless you override it.
- Support for aligning ticks in the axes with "alignTicksWithAxis" to ensure
that they appear next to each other rather than in between, at the expense
of possibly awkward tick steps. (sponsored by Flight Data Services,
www.flightdataservices.com)
- Support for customizing the point type through a callback when plotting
points and new symbol plugin with some predefined point types. (sponsored
by Utility Data Corporation)
- Resize plugin for automatically redrawing when the placeholder changes
size, e.g. on window resizes. (sponsored by Novus Partners)
A resize() method has been added to plot object facilitate this.
- Support Infinity/-Infinity for plotting asymptotes by hacking it into
+/-Number.MAX_VALUE. (reported by rabaea.mircea)
- Support for restricting navigate plugin to not pan/zoom an axis. (based on
patch by kkaefer)
- Support for providing the drag cursor for the navigate plugin as an option.
(based on patch by Kelly T. Moore)
- Options for controlling whether an axis is shown or not (suggestion by Timo
Tuominen) and whether to reserve space for it even if it isn't shown.
- New attribute $.plot.version with the Flot version as a string.
- The version comment is now included in the minified jquery.flot.min.js.
- New options.grid.minBorderMargin for adjusting the minimum margin provided
around the border (based on patch by corani, issue 188).
- Refactor replot behaviour so Flot tries to reuse the existing canvas,
adding shutdown() methods to the plot. (based on patch by Ryley Breiddal,
issue 269)
This prevents a memory leak in Chrome and hopefully makes replotting faster
for those who are using $.plot instead of .setData()/.draw(). Also update
jQuery to 1.5.1 to prevent IE leaks fixed in jQuery.
- New real-time line chart example.
- New hooks: drawSeries, shutdown.
### Bug fixes ###
- Fixed problem with findNearbyItem and bars on top of each other. (reported
by ragingchikn, issue 242)
- Fixed problem with ticks and the border. (based on patch from
ultimatehustler69, issue 236)
- Fixed problem with plugins adding options to the series objects.
- Fixed a problem introduced in 0.6 with specifying a gradient with:
```{brightness: x, opacity: y }```
- Don't use $.browser.msie, check for getContext on the created canvas element
instead and try to use excanvas if it's not found.
Fixes IE 9 compatibility.
- highlight(s, index) was looking up the point in the original s.data instead
of in the computed datapoints array, which breaks with plugins that modify
the datapoints, such as the stacking plugin. (reported by curlypaul924,
issue 316)
- More robust handling of axis from data passed in from getData(). (reported)
by Morgan)
- Fixed problem with turning off bar outline. (fix by Jordi Castells,
issue 253)
- Check the selection passed into setSelection in the selection
plugin, to guard against errors when synchronizing plots (fix by Lau
Bech Lauritzen).
- Fix bug in crosshair code with mouseout resetting the crosshair even
if it is locked (fix by Lau Bech Lauritzen and Banko Adam).
- Fix bug with points plotting using line width from lines rather than
points.
- Fix bug with passing non-array 0 data (for plugins that don't expect
arrays, patch by vpapp1).
- Fix errors in JSON in examples so they work with jQuery 1.4.2
(fix reported by honestbleeps, issue 357).
- Fix bug with tooltip in interacting.html, this makes the tooltip
much smoother (fix by bdkahn). Fix related bug inside highlighting
handler in Flot.
- Use closure trick to make inline colorhelpers plugin respect
jQuery.noConflict(true), renaming the global jQuery object (reported
by Nick Stielau).
- Listen for mouseleave events and fire a plothover event with empty
item when it occurs to drop highlights when the mouse leaves the
plot (reported by by outspirit).
- Fix bug with using aboveData with a background (reported by
amitayd).
- Fix possible excanvas leak (report and suggested fix by tom9729).
- Fix bug with backwards compatibility for shadowSize = 0 (report and
suggested fix by aspinak).
- Adapt examples to skip loading excanvas (fix by Ryley Breiddal).
- Fix bug that prevent a simple f(x) = -x transform from working
correctly (fix by Mike, issue 263).
- Fix bug in restoring cursor in navigate plugin (reported by Matteo
Gattanini, issue 395).
- Fix bug in picking items when transform/inverseTransform is in use
(reported by Ofri Raviv, and patches and analysis by Jan and Tom
Paton, issue 334 and 467).
- Fix problem with unaligned ticks and hover/click events caused by
padding on the placeholder by hardcoding the placeholder padding to
0 (reported by adityadineshsaxena, Matt Sommer, Daniel Atos and some
other people, issue 301).
- Update colorhelpers plugin to avoid dying when trying to parse an
invalid string (reported by cadavor, issue 483).
## Flot 0.6 ##
### API changes ###
Selection support has been moved to a plugin. Thus if you're passing
selection: { mode: something }, you MUST include the file
jquery.flot.selection.js after jquery.flot.js. This reduces the size of
base Flot and makes it easier to customize the selection as well as
improving code clarity. The change is based on a patch from andershol.
In the global options specified in the $.plot command, "lines", "points",
"bars" and "shadowSize" have been moved to a sub-object called "series":
```js
$.plot(placeholder, data, { lines: { show: true }})
```
should be changed to
```js
$.plot(placeholder, data, { series: { lines: { show: true }}})
```
All future series-specific options will go into this sub-object to
simplify plugin writing. Backward-compatibility code is in place, so
old code should not break.
"plothover" no longer provides the original data point, but instead a
normalized one, since there may be no corresponding original point.
Due to a bug in previous versions of jQuery, you now need at least
jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some improvements
in event handling speed.
## Changes ##
- Added support for disabling interactivity for specific data series.
(request from Ronald Schouten and Steve Upton)
- Flot now calls $() on the placeholder and optional legend container passed
in so you can specify DOM elements or CSS expressions to make it easier to
use Flot with libraries like Prototype or Mootools or through raw JSON from
Ajax responses.
- A new "plotselecting" event is now emitted while the user is making a
selection.
- The "plothover" event is now emitted immediately instead of at most 10
times per second, you'll have to put in a setTimeout yourself if you're
doing something really expensive on this event.
- The built-in date formatter can now be accessed as $.plot.formatDate(...)
(suggestion by Matt Manela) and even replaced.
- Added "borderColor" option to the grid. (patches from Amaury Chamayou and
Mike R. Williamson)
- Added support for gradient backgrounds for the grid. (based on patch from
Amaury Chamayou, issue 90)
The "setting options" example provides a demonstration.
- Gradient bars. (suggestion by stefpet)
- Added a "plotunselected" event which is triggered when the selection is
removed, see "selection" example. (suggestion by Meda Ugo)
- The option legend.margin can now specify horizontal and vertical margins
independently. (suggestion by someone who's annoyed)
- Data passed into Flot is now copied to a new canonical format to enable
further processing before it hits the drawing routines. As a side-effect,
this should make Flot more robust in the face of bad data. (issue 112)
- Step-wise charting: line charts have a new option "steps" that when set to
true connects the points with horizontal/vertical steps instead of diagonal
lines.
- The legend labelFormatter now passes the series in addition to just the
label. (suggestion by Vincent Lemeltier)
- Horizontal bars (based on patch by Jason LeBrun).
- Support for partial bars by specifying a third coordinate, i.e. they don't
have to start from the axis. This can be used to make stacked bars.
- New option to disable the (grid.show).
- Added pointOffset method for converting a point in data space to an offset
within the placeholder.
- Plugin system: register an init method in the $.flot.plugins array to get
started, see PLUGINS.txt for details on how to write plugins (it's easy).
There are also some extra methods to enable access to internal state.
- Hooks: you can register functions that are called while Flot is crunching
the data and doing the plot. This can be used to modify Flot without
changing the source, useful for writing plugins. Some hooks are defined,
more are likely to come.
- Threshold plugin: you can set a threshold and a color, and the data points
below that threshold will then get the color. Useful for marking data
below 0, for instance.
- Stack plugin: you can specify a stack key for each series to have them
summed. This is useful for drawing additive/cumulative graphs with bars and
(currently unfilled) lines.
- Crosshairs plugin: trace the mouse position on the axes, enable with
crosshair: { mode: "x"} (see the new tracking example for a use).
- Image plugin: plot prerendered images.
- Navigation plugin for panning and zooming a plot.
- More configurable grid.
- Axis transformation support, useful for non-linear plots, e.g. log axes and
compressed time axes (like omitting weekends).
- Support for twelve-hour date formatting (patch by Forrest Aldridge).
- The color parsing code in Flot has been cleaned up and split out so it's
now available as a separate jQuery plugin. It's included inline in the Flot
source to make dependency managing easier. This also makes it really easy
to use the color helpers in Flot plugins.
## Bug fixes ##
- Fixed two corner-case bugs when drawing filled curves. (report and analysis
by Joshua Varner)
- Fix auto-adjustment code when setting min to 0 for an axis where the
dataset is completely flat on that axis. (report by chovy)
- Fixed a bug with passing in data from getData to setData when the secondary
axes are used. (reported by nperelman, issue 65)
- Fixed so that it is possible to turn lines off when no other chart type is
shown (based on problem reported by Glenn Vanderburg), and fixed so that
setting lineWidth to 0 also hides the shadow. (based on problem reported by
Sergio Nunes)
- Updated mousemove position expression to the latest from jQuery. (reported
by meyuchas)
- Use CSS borders instead of background in legend. (issues 25 and 45)
- Explicitly convert axis min/max to numbers.
- Fixed a bug with drawing marking lines with different colors. (reported by
Khurram)
- Fixed a bug with returning y2 values in the selection event. (fix by
exists, issue 75)
- Only set position relative on placeholder if it hasn't already a position
different from static. (reported by kyberneticist, issue 95)
- Don't round markings to prevent sub-pixel problems. (reported by
Dan Lipsitt)
- Make the grid border act similarly to a regular CSS border, i.e. prevent
it from overlapping the plot itself. This also fixes a problem with anti-
aliasing when the width is 1 pixel. (reported by Anthony Ettinger)
- Imported version 3 of excanvas and fixed two issues with the newer version.
Hopefully, this will make Flot work with IE8. (nudge by Fabien Menager,
further analysis by Booink, issue 133)
- Changed the shadow code for lines to hopefully look a bit better with
vertical lines.
- Round tick positions to avoid possible problems with fractions. (suggestion
by Fred, issue 130)
- Made the heuristic for determining how many ticks to aim for a bit smarter.
- Fix for uneven axis margins (report and patch by Paul Kienzle) and snapping
to ticks. (report and patch by lifthrasiir)
- Fixed bug with slicing in findNearbyItems. (patch by zollman)
- Make heuristic for x axis label widths more dynamic. (patch by
rickinhethuis)
- Make sure points on top take precedence when finding nearby points when
hovering. (reported by didroe, issue 224)
## Flot 0.5 ##
Timestamps are now in UTC. Also "selected" event -> becomes "plotselected"
with new data, the parameters for setSelection are now different (but
backwards compatibility hooks are in place), coloredAreas becomes markings
with a new interface (but backwards compatibility hooks are in place).
### API changes ###
Timestamps in time mode are now displayed according to UTC instead of the time
zone of the visitor. This affects the way the timestamps should be input;
you'll probably have to offset the timestamps according to your local time
zone. It also affects any custom date handling code (which basically now
should use the equivalent UTC date mehods, e.g. .setUTCMonth() instead of
.setMonth().
Markings, previously coloredAreas, are now specified as ranges on the axes,
like ```{ xaxis: { from: 0, to: 10 }}```. Furthermore with markings you can
now draw horizontal/vertical lines by setting from and to to the same
coordinate. (idea from line support patch by by Ryan Funduk)
Interactivity: added a new "plothover" event and this and the "plotclick"
event now returns the closest data item (based on patch by /david, patch by
Mark Byers for bar support). See the revamped "interacting with the data"
example for some hints on what you can do.
Highlighting: you can now highlight points and datapoints are autohighlighted
when you hover over them (if hovering is turned on).
Support for dual axis has been added (based on patch by someone who's annoyed
and /david). For each data series you can specify which axes it belongs to,
and there are two more axes, x2axis and y2axis, to customize. This affects the
"selected" event which has been renamed to "plotselected" and spews out
```{ xaxis: { from: -10, to: 20 } ... },``` setSelection in which the
parameters are on a new form (backwards compatible hooks are in place so old
code shouldn't break) and markings (formerly coloredAreas).
## Changes ##
- Added support for specifying the size of tick labels (axis.labelWidth,
axis.labelHeight). Useful for specifying a max label size to keep multiple
plots aligned.
- The "fill" option can now be a number that specifies the opacity of the
fill.
- You can now specify a coordinate as null (like [2, null]) and Flot will
take the other coordinate into account when scaling the axes. (based on
patch by joebno)
- New option for bars "align". Set it to "center" to center the bars on the
value they represent.
- setSelection now takes a second parameter which you can use to prevent the
method from firing the "plotselected" handler.
- Improved the handling of axis auto-scaling with bars.
## Bug fixes ##
- Fixed a bug in calculating spacing around the plot. (reported by
timothytoe)
- Fixed a bug in finding max values for all-negative data sets.
- Prevent the possibility of eternal looping in tick calculations.
- Fixed a bug when borderWidth is set to 0. (reported by Rob/sanchothefat)
- Fixed a bug with drawing bars extending below 0. (reported by James Hewitt,
patch by Ryan Funduk).
- Fixed a bug with line widths of bars. (reported by MikeM)
- Fixed a bug with 'nw' and 'sw' legend positions.
- Fixed a bug with multi-line x-axis tick labels. (reported by Luca Ciano,
IE-fix help by Savage Zhang)
- Using the "container" option in legend now overwrites the container element
instead of just appending to it, fixing the infinite legend bug. (reported
by several people, fix by Brad Dewey)
## Flot 0.4 ##
### API changes ###
Deprecated axis.noTicks in favor of just specifying the number as axis.ticks.
So ```xaxis: { noTicks: 10 }``` becomes ```xaxis: { ticks: 10 }```.
Time series support. Specify axis.mode: "time", put in Javascript timestamps
as data, and Flot will automatically spit out sensible ticks. Take a look at
the two new examples. The format can be customized with axis.timeformat and
axis.monthNames, or if that fails with axis.tickFormatter.
Support for colored background areas via grid.coloredAreas. Specify an array
of { x1, y1, x2, y2 } objects or a function that returns these given
{ xmin, xmax, ymin, ymax }.
More members on the plot object (report by Chris Davies and others).
"getData" for inspecting the assigned settings on data series (e.g. color) and
"setData", "setupGrid" and "draw" for updating the contents without a total
replot.
The default number of ticks to aim for is now dependent on the size of the
plot in pixels. Support for customizing tick interval sizes directly with
axis.minTickSize and axis.tickSize.
Cleaned up the automatic axis scaling algorithm and fixed how it interacts
with ticks. Also fixed a couple of tick-related corner case bugs (one reported
by mainstreetmark, another reported by timothytoe).
The option axis.tickFormatter now takes a function with two parameters, the
second parameter is an optional object with information about the axis. It has
min, max, tickDecimals, tickSize.
## Changes ##
- Added support for segmented lines. (based on patch from Michael MacDonald)
- Added support for ignoring null and bad values. (suggestion from Nick
Konidaris and joshwaihi)
- Added support for changing the border width. (thanks to joebno and safoo)
- Label colors can be changed via CSS by selecting the tickLabel class.
## Bug fixes ##
- Fixed a bug in handling single-item bar series. (reported by Emil Filipov)
- Fixed erratic behaviour when interacting with the plot with IE 7. (reported
by Lau Bech Lauritzen).
- Prevent IE/Safari text selection when selecting stuff on the canvas.
## Flot 0.3 ##
This is mostly a quick-fix release because jquery.js wasn't included in the
previous zip/tarball.
## Changes ##
- Include jquery.js in the zip/tarball.
- Support clicking on the plot. Turn it on with grid: { clickable: true },
then you get a "plotclick" event on the graph placeholder with the position
in units of the plot.
## Bug fixes ##
- Fixed a bug in dealing with data where min = max. (thanks to Michael
Messinides)
## Flot 0.2 ##
The API should now be fully documented.
### API changes ###
Moved labelMargin option to grid from x/yaxis.
## Changes ##
- Added support for putting a background behind the default legend. The
default is the partly transparent background color. Added backgroundColor
and backgroundOpacity to the legend options to control this.
- The ticks options can now be a callback function that takes one parameter,
an object with the attributes min and max. The function should return a
ticks array.
- Added labelFormatter option in legend, useful for turning the legend
labels into links.
- Reduced the size of the code. (patch by Guy Fraser)
## Flot 0.1 ##
First public release.
|
eflowbeach/MobileEDD
|
source/resource/mobileedd/libs/flot/NEWS.md
|
Markdown
|
mit
| 40,291
|
(function() {
'use strict';
angular.module('civic.events.evidence')
.config(evidenceEditConfig)
.factory('EvidenceEditViewOptions', EvidenceEditViewOptions)
.controller('EvidenceEditController', EvidenceEditController);
// @ngInject
function evidenceEditConfig($stateProvider) {
$stateProvider
.state('events.genes.summary.variants.summary.evidence.edit', {
abstract: true,
url: '/edit',
templateUrl: 'app/views/events/evidence/edit/EvidenceEditView.tpl.html',
controller: 'EvidenceEditController',
controllerAs: 'vm',
resolve: {
EvidenceRevisions: 'EvidenceRevisions',
initEvidenceEdit: function(Evidence, EvidenceRevisions, EvidenceHistory, $stateParams, $q) {
var evidenceId = $stateParams.evidenceId;
return $q.all([
EvidenceRevisions.initRevisions(evidenceId),
EvidenceRevisions.getPendingFields(evidenceId),
EvidenceHistory.initBase(evidenceId)
]);
}
},
deepStateRedirect: [ 'evidenceId' ],
data: {
titleExp: '"Evidence " + evidence.name + " Edit"',
navMode: 'sub'
}
})
.state('events.genes.summary.variants.summary.evidence.edit.basic', {
url: '/basic',
template: '<evidence-edit-basic></evidence-edit-basic>',
data: {
titleExp: '"Evidence " + evidence.name + " Edit"',
navMode: 'sub'
}
});
}
// @ngInject
function EvidenceEditViewOptions($state, $stateParams) {
var baseUrl = '';
var baseState = '';
var styles = {};
function init() {
baseState = 'events.genes.summary.evidence.edit';
baseUrl = $state.href(baseUrl, $stateParams);
angular.copy({
view: {
summaryBackgroundColor: 'pageBackground2',
editBackgroundColor: 'pageBackground',
talkBackgroundColor: 'pageBackground'
},
tabs: {
tabRowBackground: 'pageBackground2Gradient'
}
}, styles);
}
return {
init: init,
state: {
baseParams: $stateParams,
baseState: baseState,
baseUrl: baseUrl
},
styles: styles
};
}
// @ngInject
function EvidenceEditController(Evidence, EvidenceRevisions, EvidenceEditViewOptions) {
console.log('EvidenceEditController called.');
EvidenceEditViewOptions.init();
this.EvidenceEditViewModel = Evidence; // we're re-using the Evidence model here but could in the future have a EvidenceEdit model if warranted
this.EvidenceRevisionsModel = EvidenceRevisions;
this.EvidenceEditViewOptions = EvidenceEditViewOptions;
}
})();
|
genome/civic-client
|
src/app/views/events/evidence/edit/EvidenceEditController.js
|
JavaScript
|
mit
| 2,729
|
---
layout: post
category: "android"
title: "背景为shape selector的drawable的问题"
tags: [Android,selector]
---
背景为selector(item state_pressed="false" shape)时,里面的条目只能为selector(item state_pressed="true" shape),否则选中无效果。
边框背景:
{% highlight xml %}
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item><shape>
<stroke android:width="0.8dp" android:color="#d4d3d3" />
<solid android:color="#f3f4f4"></solid>
<corners android:radius="0.5dp"/>
</shape></item>
</selector>
{% endhighlight %}
条目背景:
{% highlight xml %}
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape>
<solid android:color="#e6e6e6" />
</shape></item>
</selector>
{% endhighlight %}
源文:<http://blog.chinaunix.net/uid-22985736-id-3521498.html>
|
panzj/panzj.github.io
|
_posts/2013-03-14-shape-drawable.markdown
|
Markdown
|
mit
| 1,018
|
<?php
// SunMailer autoload file
require_once('../../autoload.php');
use SunMailer\Mailer;
use SunMailer\View;
use SunMailer\MailerException;
$email = 'iftekhersunny@gmail.com';
$name = 'Iftekher Sunny';
$subject = 'Test Mail';
$data = [
'user' => 'Iftekher Sunny',
'user-info' => [
'website' => 'http://iftekhersunny.com',
'facebook' => 'http://iftekhersunny.com/fb'
]
];
//'view-directory' => 'SunMailer/examples/email-using-view-render-with-data/'
$body = View::render('email.test2', $data);
try
{
if(Mailer::send($email, $name, $subject, $body))
{
echo 'Email has been sent successfully.';
}
}
catch (MailerException $e)
{
echo 'Oops!!! Something goes to wrong. '. $e->getMessage();
}
|
IftekherSunny/SunMailer
|
examples/email-using-view-render-with-data/index2.php
|
PHP
|
mit
| 932
|
# Getting Started
> 教程中的案例代码将使用 [ES2015](https://github.com/lukehoban/es6features) 来编写。
用 Vue.js + vue-router 创建单页应用,是非常简单的。使用 Vue.js ,我们已经可以通过组合组件来组成应用程序,当你要把 vue-router 添加进来,我们需要做的是,将组件(components)映射到路由(routes),然后告诉 vue-router 在哪里渲染它们。下面是个基本例子:
### HTML
``` html
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<div id="app">
<h1>Hello App!</h1>
<p>
<!-- 使用 router-link 组件来导航. -->
<!-- 通过传入 `to` 属性指定链接. -->
<!-- <router-link> 默认会被渲染成一个 `<a>` 标签 -->
<router-link to="/foo">Go to Foo</router-link>
<router-link to="/bar">Go to Bar</router-link>
</p>
<!-- 路由出口 -->
<!-- 路由匹配到的组件将渲染在这里 -->
<router-view></router-view>
</div>
```
### JavaScript
``` js
// 0. 如果使用模块化机制编程,導入Vue和VueRouter,要调用 Vue.use(VueRouter)
// 1. 定义(路由)组件。
// 可以从其他文件 import 进来
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
// 2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是
// 通过 Vue.extend() 创建的组件构造器,
// 或者,只是一个组件配置对象。
// 我们晚点再讨论嵌套路由。
const routes = [
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar }
]
// 3. 创建 router 实例,然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
routes // (缩写)相当于 routes: routes
})
// 4. 创建和挂载根实例。
// 记得要通过 router 配置参数注入路由,
// 从而让整个应用都有路由功能
const app = new Vue({
router
}).$mount('#app')
// 现在,应用已经启动了!
```
你可以看看这个例子
[live](http://jsfiddle.net/yyx990803/xgrjzsup/)。
要注意,当 `<router-link>` 对应的路由匹配成功,将自动设置 class 属性值 `.router-link-active`。查看 [API 文档](../api/router-link.md) 学习更多相关内容。
|
Alex-Sokolov/ru.vue-router
|
docs/zh-cn/essentials/getting-started.md
|
Markdown
|
mit
| 2,338
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
fib = 0
for num in it:
fib += num
self.assertEqual(__ , fib)
def test_iterating_with_next(self):
stages = iter(['alpha','beta','gamma'])
try:
self.assertEqual(__, next(stages))
next(stages)
self.assertEqual(__, next(stages))
next(stages)
except StopIteration as ex:
err_msg = 'Ran out of iterations'
self.assertRegexpMatches(err_msg, __)
# ------------------------------------------------------------------
def add_ten(self, item):
return item + 10
def test_map_transforms_elements_of_a_list(self):
seq = [1, 2, 3]
mapped_seq = list()
mapping = map(self.add_ten, seq)
self.assertNotEqual(list, type(mapping).__name__)
self.assertEqual(__, type(mapping).__name__)
# In Python 3 built in iterator funcs return iteratable view objects
# instead of lists
for item in mapping:
mapped_seq.append(item)
self.assertEqual(__, mapped_seq)
# None, iterator methods actually return objects of iter type in
# python 3. In python 2 map() would give you a list.
def test_filter_selects_certain_items_from_a_list(self):
def is_even(item):
return (item % 2) == 0
seq = [1, 2, 3, 4, 5, 6]
even_numbers = list()
for item in filter(is_even, seq):
even_numbers.append(item)
self.assertEqual(__, even_numbers)
def test_just_return_first_item_found(self):
def is_big_name(item):
return len(item) > 4
names = ["Jim", "Bill", "Clarence", "Doug", "Eli"]
name = None
iterator = filter(is_big_name, names)
try:
name = next(iterator)
except StopIteration:
msg = 'Ran out of big names'
self.assertEqual(__, name)
# ------------------------------------------------------------------
def add(self,accum,item):
return accum + item
def multiply(self,accum,item):
return accum * item
def test_reduce_will_blow_your_mind(self):
import functools
# As of Python 3 reduce() has been demoted from a builtin function
# to the functools module.
result = functools.reduce(self.add, [2, 3, 4])
self.assertEqual(__, type(result).__name__)
# Reduce() syntax is same as Python 2
self.assertEqual(__, result)
result2 = functools.reduce(self.multiply, [2, 3, 4], 1)
self.assertEqual(__, result2)
# Extra Credit:
# Describe in your own words what reduce does.
# ------------------------------------------------------------------
def test_creating_lists_with_list_comprehensions(self):
feast = ['lambs', 'sloths', 'orangutans', 'breakfast cereals', 'fruit bats']
comprehension = [delicacy.capitalize() for delicacy in feast]
self.assertEqual(__, comprehension[0])
self.assertEqual(__, comprehension[2])
def test_use_pass_for_iterations_with_no_body(self):
for num in range(1,5):
pass
self.assertEqual(__, num)
# ------------------------------------------------------------------
def test_all_iteration_methods_work_on_any_sequence_not_just_lists(self):
# Ranges are an iteratable sequence
result = map(self.add_ten, range(1,4))
self.assertEqual(__, list(result))
try:
# Files act like a collection of lines
file = open("example_file.txt")
def make_upcase(line):
return line.strip().upper()
upcase_lines = map(make_upcase, file.readlines())
self.assertEqual(__, list(upcase_lines))
# NOTE: You can create your own collections that work with each,
# map, select, etc.
finally:
# Arg, this is ugly.
# We will figure out how to fix this later.
if file:
file.close()
|
caalle/Python-koans
|
python 3/koans/about_iteration.py
|
Python
|
mit
| 4,469
|
//
// MSColorSelectionView.h
//
// Created by Maksym Shcheglov on 2015-04-12.
//
// The MIT License (MIT)
// Copyright (c) 2015 Maksym Shcheglov
//
// 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.
#import <UIKit/UIKit.h>
#import "MSColorView.h"
/**
* The enum to define the MSColorView's types.
*/
typedef NS_ENUM(NSUInteger, MSSelectedColorView) {
/**
* The RGB color view type.
*/
MSSelectedColorViewRGB,
/**
* The HSB color view type.
*/
MSSelectedColorViewHSB
};
/**
* The MSColorSelectionView aggregates views that should be used to edit color components.
*/
@interface MSColorSelectionView : UIView <MSColorView>
/**
* The selected color view
*/
@property (nonatomic, assign, readonly) MSSelectedColorView selectedIndex;
/**
* Makes a color component view (rgb or hsb) visible according to the index.
*
* @param index This index define a view to show.
* @param animated If YES, the view is being appeared using an animation.
*/
- (void)setSelectedIndex:(MSSelectedColorView)index animated:(BOOL)animated;
@end
|
sgl0v/MSColorPicker
|
MSColorPicker/MSColorSelectionView.h
|
C
|
mit
| 2,104
|
workshop
========
18.10.2013
|
djemeljanovs/as3-workshop
|
README.md
|
Markdown
|
mit
| 30
|
<!---头部------>
<div class="header">
<div class="logo">
<a href="{url app=store&id=$store.store_id}"><img src="{$store.store_logo}" /></a>
</div>
<!---搜索框------>
<div class="searchBar">
<form id="" name="" method="get" action="index.php">
<input type="hidden" name="app" value="store" />
<input type="hidden" name="act" value="search" />
<input type="hidden" name="id" value="{$store.store_id}" />
<input type="text" name="keyword" placeholder="搜搜看吧" class="search_text" /><div class="search_btn_img"><img src="{res file=images/search_btn.png}" style="width:30px"></div><input type="submit" value="" class="search_btn" />
</form>
</div>
<!----------下拉二级菜单--------------->
<div class="sub_menu">
<ul>
<!--{if $store.radio_new eq '1'}-->
<li>
<a href="index.php?app=store&act=search&id={$store.store_id}&order=add_time"><h2>最新商品</h2></a>
</li>
<!--{/if}-->
<!--{if $store.radio_recommend eq '1'}-->
<li>
<a href="index.php?app=store&act=search&id={$store.store_id}&recommended=1"><h2>推荐商品</h2></a>
</li>
<!--{/if}-->
<!--{if $store.radio_hot eq '1'}-->
<li>
<a href="index.php?app=store&act=search&id={$store.store_id}&order=views"><h2>热门商品</h2></a>
</li>
<!--{/if}-->
<!--{foreach from=$store.store_gcates item=gcategory}-->
<li>
<!--{if $gcategory.children}-->
<h2>{$gcategory.value|escape}</h2>
<ol class="sub_menu_list">
<!--{foreach from=$gcategory.children item=child_gcategory}-->
<a href="{url app=store&id=$store.store_id&act=search&cate_id=$child_gcategory.id}"> <li>{$child_gcategory.value|escape}</li></a>
<!--{/foreach}-->
</ol>
<!--{else}-->
<a href="{url app=store&id=$store.store_id&act=search&cate_id=$gcategory.id}"><h2>{$gcategory.value|escape}</h2></a>
<!--{/if}-->
</li>
<!--{/foreach}-->
</ul>
<div class="fun">
<a href="javascript:;" class="code"><img src="{res file=images/code.png}"/>店铺二维码</a>
<a href="javascript:collect_store({$store.store_id});" class="fav"><img src="{res file=images/favorite.png}"/>收藏本店</a>
</div>
</div>
<!----------二维码、店铺信息--------------->
<div class="shop_info">
<img src="<!--{if $store.store_code}-->{$store.store_code}<!--{else}-->{res file=images/code.jpg}<!--{/if}-->" class="shop_code"/>
<p class="shop_name">店铺ID:{$store.store_name|escape}</p>
<p class="shop_detail">
<span>信用度:<strong> <!--{if $store.credit_value ge 0}--><img src="{$store.credit_image}" alt="" /><!--{/if}--></strong></span><br />
<span>{$lang.goods_count}:{$store.goods_count}</span>
</p>
<a href="javascript:;" class="back">返回上一页</a>
</div>
<!--------显示收藏信息------------->
<div class="fav_msg">
<img src="{res file=images/favorite.png}" /><span id='collect'>收藏成功!</span>
</div>
</div>
|
guotao2000/ecmall
|
themes/wapstore/default17/header.html
|
HTML
|
mit
| 3,501
|
'use strict';
const applySourceMap = require('vinyl-sourcemaps-apply');
const CleanCSS = require('clean-css');
const path = require('path');
const PluginError = require('gulp-util').PluginError;
const through = require('through2');
module.exports = function gulpCleanCSS(options, callback) {
options = options || {};
if (arguments.length === 1 && Object.prototype.toString.call(arguments[0]) === '[object Function]')
callback = arguments[0];
let transform = function (file, enc, cb) {
if (!file || !file.contents)
return cb(null, file);
if (file.isStream()) {
this.emit('error', new PluginError('gulp-clean-css', 'Streaming not supported!'));
return cb(null, file);
}
if (file.sourceMap)
options.sourceMap = JSON.parse(JSON.stringify(file.sourceMap));
if(!options.rebaseTo)
options.rebase = false;
let style = {
[file.path]: {
styles: file.contents ? file.contents.toString() : ''
}
};
new CleanCSS(options).minify(style, function (errors, css) {
if (errors)
return cb(errors.join(' '));
if (typeof callback === 'function') {
let details = {
'stats': css.stats,
'errors': css.errors,
'warnings': css.warnings,
'path': file.path,
'name': file.path.split(file.base)[1]
};
if (css.sourceMap)
details['sourceMap'] = css.sourceMap;
callback(details);
}
file.contents = new Buffer(css.styles);
if (css.sourceMap) {
let map = JSON.parse(css.sourceMap);
map.file = path.relative(file.base, file.path);
map.sources = map.sources.map(function (src) {
return path.relative(file.base, file.path)
});
applySourceMap(file, map);
}
cb(null, file);
});
};
return through.obj(transform);
};
|
easy-templates/koa2-demo
|
node_modules/gulp-clean-css/index.js
|
JavaScript
|
mit
| 1,961
|
var anchor;
while (anchor = schema.nextAnchor()) {
if(anchor.hasMoreAttributes()) { // only do perspectives if there are attributes
var knot, attribute;
/*~
-- Point-in-time perspective ------------------------------------------------------------------------------------------
-- p$anchor.name viewed as it was on the given timepoint
-----------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION $anchor.capsule\.p$anchor.name (
changingTimepoint $schema.metadata.chronon
)
RETURNS TABLE (
$anchor.identityColumnName $anchor.identity,
$(schema.METADATA)? $anchor.metadataColumnName $schema.metadata.metadataType,~*/
while (attribute = anchor.nextAttribute()) {
/*~
$(schema.IMPROVED)? $attribute.anchorReferenceName $anchor.identity,
$(schema.METADATA)? $attribute.metadataColumnName $schema.metadata.metadataType,
$(attribute.timeRange)? $attribute.changingColumnName $attribute.timeRange,
$(attribute.isEquivalent())? $attribute.equivalentColumnName $schema.metadata.equivalentRange,
~*/
if(attribute.isKnotted()) {
knot = attribute.knot;
/*~
$(knot.hasChecksum())? $attribute.knotChecksumColumnName bytea,
$(knot.isEquivalent())? $attribute.knotEquivalentColumnName $schema.metadata.equivalentRange,
$attribute.knotValueColumnName $knot.dataRange,
$(schema.METADATA)? $attribute.knotMetadataColumnName $schema.metadata.metadataType,
~*/
}
/*~
$(attribute.hasChecksum())? $attribute.checksumColumnName bytea,
$attribute.valueColumnName $(attribute.isKnotted())? $knot.identity: $attribute.dataRange~*/
/*~$(anchor.hasMoreAttributes())?,
~*/
}
/*~
) AS '
SELECT
$anchor.mnemonic\.$anchor.identityColumnName,
$(schema.METADATA)? $anchor.mnemonic\.$anchor.metadataColumnName,
~*/
while (attribute = anchor.nextAttribute()) {
/*~
$(schema.IMPROVED)? $attribute.mnemonic\.$attribute.anchorReferenceName,
$(schema.METADATA)? $attribute.mnemonic\.$attribute.metadataColumnName,
$(attribute.timeRange)? $attribute.mnemonic\.$attribute.changingColumnName,
$(attribute.isEquivalent())? $attribute.mnemonic\.$attribute.equivalentColumnName,
~*/
if(attribute.isKnotted()) {
knot = attribute.knot;
/*~
$(knot.hasChecksum())? k$attribute.mnemonic\.$knot.checksumColumnName AS $attribute.knotChecksumColumnName,
$(knot.isEquivalent())? k$attribute.mnemonic\.$knot.equivalentColumnName AS $attribute.knotEquivalentColumnName,
k$attribute.mnemonic\.$knot.valueColumnName AS $attribute.knotValueColumnName,
$(schema.METADATA)? k$attribute.mnemonic\.$knot.metadataColumnName AS $attribute.knotMetadataColumnName,
~*/
}
/*~
$(attribute.hasChecksum())? $attribute.mnemonic\.$attribute.checksumColumnName,
$attribute.mnemonic\.$attribute.valueColumnName$(anchor.hasMoreAttributes())?,
~*/
}
/*~
FROM
$anchor.capsule\.$anchor.name $anchor.mnemonic
~*/
while (attribute = anchor.nextAttribute()) {
if(attribute.isHistorized()) {
if(attribute.isEquivalent()) {
/*~
LEFT JOIN
$attribute.capsule\.r$attribute.name(0, CAST(changingTimepoint AS $attribute.timeRange)) $attribute.mnemonic
~*/
}
else {
/*~
LEFT JOIN
$attribute.capsule\.r$attribute.name(CAST(changingTimepoint AS $attribute.timeRange)) $attribute.mnemonic
~*/
}
/*~
ON
$attribute.mnemonic\.$attribute.anchorReferenceName = $anchor.mnemonic\.$anchor.identityColumnName
AND
$attribute.mnemonic\.$attribute.changingColumnName = (
SELECT
max(sub.$attribute.changingColumnName)
FROM
$(attribute.isEquivalent())? $attribute.capsule\.r$attribute.name(0, CAST(changingTimepoint AS $attribute.timeRange)) sub : $attribute.capsule\.r$attribute.name(CAST(changingTimepoint AS $attribute.timeRange)) sub
WHERE
sub.$attribute.anchorReferenceName = $anchor.mnemonic\.$anchor.identityColumnName
)~*/
}
else {
if(attribute.isEquivalent()) {
/*~
LEFT JOIN
$attribute.capsule\.e$attribute.name(0) $attribute.mnemonic
~*/
}
else {
/*~
LEFT JOIN
$attribute.capsule\.$attribute.name $attribute.mnemonic
~*/
}
/*~
ON
$attribute.mnemonic\.$attribute.anchorReferenceName = $anchor.mnemonic\.$anchor.identityColumnName~*/
}
if(attribute.isKnotted()) {
knot = attribute.knot;
if(knot.isEquivalent()) {
/*~
LEFT JOIN
$knot.capsule\.e$knot.name(0) k$attribute.mnemonic
~*/
}
else {
/*~
LEFT JOIN
$knot.capsule\.$knot.name k$attribute.mnemonic
~*/
}
/*~
ON
k$attribute.mnemonic\.$knot.identityColumnName = $attribute.mnemonic\.$attribute.knotReferenceName~*/
}
if(!anchor.hasMoreAttributes()) {
/*~;~*/
}
}
/*~
' LANGUAGE SQL;~*/
}
}
|
mwidmeyer/anchor
|
SQL/PostgreSQL/uni/CreateAnchorPerspectivePointInTime.js
|
JavaScript
|
mit
| 5,079
|
<div class="container pull-left" id="WhosModule">
<div class="row">
<div class="col-xs-11">
<h4>Instructions</h4>
</div>
<div class="col-xs-1">
<button type="button" class="btn btn-success pull-right glyphicon glyphicon-refresh" id="refresh"></button>
</div>
</div>
<div class="row">
<div class="col-md-4">
<dl>
<dt>""</dt>
<dd>- bottom left</dd>
<dt>Blank</dt>
<dd>- center right</dd>
<dt>C</dt>
<dd>- top right</dd>
<dt>Cee</dt>
<dd>- bottom right</dd>
<dt>Display</dt>
<dd>- bottom right</dd>
<dt>First</dt>
<dd>- top right</dd>
<dt>Hold On</dt>
<dd>- bottom right</dd>
<dt>LED</dt>
<dd>- center left</dd>
<dt>Lead</dt>
<dd>- bottom right</dd>
<dt>Leed</dt>
<dd>- bottom left</dd>
<dt>No</dt>
<dd>- bottom right</dd>
<dt>Nothing</dt>
<dd>- center left</dd>
<dt>Okay</dt>
<dd>- top right</dd>
<dt>Read</dt>
<dd>- center right</dd>
</dl>
</div>
<div class="col-md-8">
<dl>
<dt>Red</dt>
<dd>- center right</dd>
<dt>Reed</dt>
<dd>- bottom left</dd>
<dt>Says</dt>
<dd>- bottom right</dd>
<dt>See</dt>
<dd>- bottom right</dd>
<dt>Their</dt>
<dd>- middle right</dd>
<dt>There</dt>
<dd>- bottom right</dd>
<dt>They Are</dt>
<dd>- center left</dd>
<dt>They're</dt>
<dd>- bottom left</dd>
<dt>UR</dt>
<dd>- top left</dd>
<dt>Yes</dt>
<dd>- center left</dd>
<dt>You</dt>
<dd>- center right</dd>
<dt>Your</dt>
<dd>- center right</dd>
<dt>You're</dt>
<dd>- center right</dd>
<dt>You Are</dt>
<dd>- bottom right</dd>
</dl>
</div>
</div>
<div id="whosSolutionTe">
<h3 id="whosSolutionText"></h3>
</div>
<div class="container">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group btn-group-lg btn-group-justified btn-group-fill-height">
<a href="#" id="1"class="btn btn-default" role="button">
<strong>Blank</strong><br>
</a>
<a href="#" id="2" class="btn btn-default" role="button">
<strong>Done</strong><br>
</a>
<a href="#" id="3" class="btn btn-default" role="button">
<strong>First</strong><br>
</a>
<a href="#" id="4" class="btn btn-default" role="button">
<strong>Hold</strong><br>
</a>
<a href="#" id="5" class="btn btn-default" role="button">
<strong>Left</strong><br>
</a>
<a href="#" id="6" class="btn btn-default" role="button">
<strong>Like</strong><br>
</a>
</div>
<div class="btn-group btn-group-lg btn-group-justified btn-group-fill-height">
<a href="#" id="7" class="btn btn-default" role="button">
<strong>Middle</strong><br>
</a>
<a href="#" id="8" class="btn btn-default" role="button">
<strong>Next</strong><br>
</a>
<a href="#" id="9" class="btn btn-default" role="button">
<strong>No</strong><br>
</a>
<a href="#" id="10" class="btn btn-default" role="button">
<strong>Nothing</strong><br>
</a>
<a href="#" id="11" class="btn btn-default" role="button">
<strong>Okay</strong><br>
</a>
<a href="#" id="12" class="btn btn-default" role="button">
<strong>Press</strong><br>
</a>
</div>
<div class="btn-group btn-group-lg btn-group-justified btn-group-fill-height">
<a href="#" id="13" class="btn btn-default" role="button">
<strong>Ready</strong><br>
</a>
<a href="#" id="14" class="btn btn-default" role="button">
<strong>Right</strong><br>
</a>
<a href="#" id="15" class="btn btn-default" role="button">
<strong>Sure</strong><br>
</a>
<a href="#" id="16" class="btn btn-default" role="button">
<strong>U</strong><br>
</a>
<a href="#" id="17" class="btn btn-default" role="button">
<strong>Uhhh</strong><br>
</a>
<a href="#" id="18" class="btn btn-default" role="button">
<strong>Uh Huh</strong><br>
</a>
</div>
<div class="btn-group btn-group-lg btn-group-justified btn-group-fill-height">
<a href="#" id="19" class="btn btn-default" role="button">
<strong>Uh Uh</strong><br>
</a>
<a href="#" id="20" class="btn btn-default" role="button">
<strong>UR</strong><br>
<a href="#" id="21" class="btn btn-default" role="button">
<strong>What</strong><br>
</a>
<a href="#" id="22" class="btn btn-default" role="button">
<strong>What?</strong><br>
</a>
<a href="#" id="23" class="btn btn-default" role="button">
<strong>Wait</strong><br>
</a>
<a href="#" id="24" class="btn btn-default" role="button">
<strong>Yes</strong><br>
</a>
</div>
<div class="btn-group btn-group-lg btn-group-justified btn-group-fill-height">
<a href="#" id="25" class="btn btn-default" role="button">
<strong>You</strong><br>
</a>
<a href="#" id="26" class="btn btn-default" role="button">
<strong>Your</strong><br>
</a>
<a href="#" id="27" class="btn btn-default" role="button">
<strong>You're</strong><br>
</a>
<a href="#" id="28" class="btn btn-default" role="button">
<strong>You Are</strong><br>
</a>
<a href="#" class="btn btn-default" role="button">
<strong></strong><br>
</a>
<a href="#" class="btn btn-default" role="button">
<strong></strong><br>
</a>
</div>
<br>
</div>
</div>
</div>
|
rachaeltesting/rachaeltesting.github.io
|
htmlModules/WhosModule.html
|
HTML
|
mit
| 5,882
|
# <Canvas/>
Pixelbots Canvas
## Usage
|
danleavitt0/artbot
|
lib/components/Canvas/Readme.md
|
Markdown
|
mit
| 41
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>IconFont</title>
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
</head>
<body>
<div class="main markdown">
<h1>IconFont 图标</h1>
<ul class="icon_lists clear">
<li>
<i class="icon iconfont icon-qq"></i>
<div class="name">qq</div>
<div class="fontclass">.icon-qq</div>
</li>
<li>
<i class="icon iconfont icon-link"></i>
<div class="name">链接</div>
<div class="fontclass">.icon-link</div>
</li>
<li>
<i class="icon iconfont icon-coordinate"></i>
<div class="name">坐标</div>
<div class="fontclass">.icon-coordinate</div>
</li>
<li>
<i class="icon iconfont icon-experience"></i>
<div class="name">工作经验</div>
<div class="fontclass">.icon-experience</div>
</li>
<li>
<i class="icon iconfont icon-english1"></i>
<div class="name">新歌_英语</div>
<div class="fontclass">.icon-english1</div>
</li>
<li>
<i class="icon iconfont icon-jianli"></i>
<div class="name">简历</div>
<div class="fontclass">.icon-jianli</div>
</li>
<li>
<i class="icon iconfont icon-index"></i>
<div class="name">首页</div>
<div class="fontclass">.icon-index</div>
</li>
<li>
<i class="icon iconfont icon-github"></i>
<div class="name">github</div>
<div class="fontclass">.icon-github</div>
</li>
<li>
<i class="icon iconfont icon-state"></i>
<div class="name">状态</div>
<div class="fontclass">.icon-state</div>
</li>
<li>
<i class="icon iconfont icon-weixin"></i>
<div class="name">微信</div>
<div class="fontclass">.icon-weixin</div>
</li>
<li>
<i class="icon iconfont icon-weibo"></i>
<div class="name">微博</div>
<div class="fontclass">.icon-weibo</div>
</li>
<li>
<i class="icon iconfont icon-Programming"></i>
<div class="name">编程</div>
<div class="fontclass">.icon-Programming</div>
</li>
<li>
<i class="icon iconfont icon-project"></i>
<div class="name">项目</div>
<div class="fontclass">.icon-project</div>
</li>
<li>
<i class="icon iconfont icon-contact"></i>
<div class="name">联系</div>
<div class="fontclass">.icon-contact</div>
</li>
<li>
<i class="icon iconfont icon-html"></i>
<div class="name">html</div>
<div class="fontclass">.icon-html</div>
</li>
<li>
<i class="icon iconfont icon-jquery"></i>
<div class="name">jquery</div>
<div class="fontclass">.icon-jquery</div>
</li>
<li>
<i class="icon iconfont icon-about"></i>
<div class="name">我的信息</div>
<div class="fontclass">.icon-about</div>
</li>
<li>
<i class="icon iconfont icon-intention"></i>
<div class="name">模板13-求职意向</div>
<div class="fontclass">.icon-intention</div>
</li>
<li>
<i class="icon iconfont icon-education"></i>
<div class="name">学历认证1</div>
<div class="fontclass">.icon-education</div>
</li>
<li>
<i class="icon iconfont icon-email"></i>
<div class="name">邮箱</div>
<div class="fontclass">.icon-email</div>
</li>
<li>
<i class="icon iconfont icon-javascript"></i>
<div class="name">javascript</div>
<div class="fontclass">.icon-javascript</div>
</li>
<li>
<i class="icon iconfont icon-skill"></i>
<div class="name">技能</div>
<div class="fontclass">.icon-skill</div>
</li>
<li>
<i class="icon iconfont icon-tools"></i>
<div class="name">工具</div>
<div class="fontclass">.icon-tools</div>
</li>
<li>
<i class="icon iconfont icon-University"></i>
<div class="name">院校</div>
<div class="fontclass">.icon-University</div>
</li>
<li>
<i class="icon iconfont icon-sex"></i>
<div class="name">性别</div>
<div class="fontclass">.icon-sex</div>
</li>
<li>
<i class="icon iconfont icon-age"></i>
<div class="name">年龄</div>
<div class="fontclass">.icon-age</div>
</li>
<li>
<i class="icon iconfont icon-english"></i>
<div class="name">英语</div>
<div class="fontclass">.icon-english</div>
</li>
<li>
<i class="icon iconfont icon-zhihu"></i>
<div class="name">知乎</div>
<div class="fontclass">.icon-zhihu</div>
</li>
<li>
<i class="icon iconfont icon-css"></i>
<div class="name">css3</div>
<div class="fontclass">.icon-css</div>
</li>
<li>
<i class="icon iconfont icon-sass"></i>
<div class="name">sass</div>
<div class="fontclass">.icon-sass</div>
</li>
<li>
<i class="icon iconfont icon-xiaochengxu"></i>
<div class="name">小程序</div>
<div class="fontclass">.icon-xiaochengxu</div>
</li>
<li>
<i class="icon iconfont icon-react"></i>
<div class="name">react</div>
<div class="fontclass">.icon-react</div>
</li>
<li>
<i class="icon iconfont icon-frame"></i>
<div class="name">前端框架</div>
<div class="fontclass">.icon-frame</div>
</li>
</ul>
<h2 id="font-class-">font-class引用</h2>
<hr>
<p>font-class是unicode使用方式的一种变种,主要是解决unicode书写不直观,语意不明确的问题。</p>
<p>与unicode使用方式相比,具有如下特点:</p>
<ul>
<li>兼容性良好,支持ie8+,及所有现代浏览器。</li>
<li>相比于unicode语意明确,书写更直观。可以很容易分辨这个icon是什么。</li>
<li>因为使用class来定义图标,所以当要替换图标时,只需要修改class里面的unicode引用。</li>
<li>不过因为本质上还是使用的字体,所以多色图标还是不支持的。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的fontclass代码:</h3>
<pre><code class="lang-js hljs javascript"><span class="hljs-comment"><link rel="stylesheet" type="text/css" href="./iconfont.css"></span></code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="lang-css hljs"><<span class="hljs-selector-tag">i</span> <span class="hljs-selector-tag">class</span>="<span class="hljs-selector-tag">iconfont</span> <span class="hljs-selector-tag">icon-xxx</span>"></<span class="hljs-selector-tag">i</span>></code></pre>
<blockquote>
<p>"iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。</p>
</blockquote>
</div>
</body>
</html>
|
GuoYongfeng/react-resume
|
src/assets/fonts/demo_fontclass.html
|
HTML
|
mit
| 9,450
|
<?php
//$conecta = mysql_connect("mywallbooks.cwhvgsv4s9ry.us-west-2.rds.amazonaws.com", "wallroot", "wall123!#") or print (mysql_error());
//print "Conexão OK!";
//mysql_close($conecta);
function conecta(){
$conecta = mysql_connect("mywallbooks.cwhvgsv4s9ry.us-west-2.rds.amazonaws.com", "wallroot", "wall123!#") or print (mysql_error());
mysql_select_db("wallbooks", $conecta) or print(mysql_error());
return $conecta;
}
function desconecta ($conecta){
mysql_close($conecta);
}
?>
|
wallminho/wallbooksWeb
|
Documents/NetBeansProjects/WallBooks 1.0/conexao.php
|
PHP
|
mit
| 505
|
#!/bin/bash -e
################################################################################################
## @copyright 2016 DennyZhang.com
## Licensed under MIT
## https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v1/LICENSE
##
## File : tail_file.sh
## Author : Denny <contact@dennyzhang.com>
## Description : collect the files across servers, and transfer to specific destination
## --
## Created : <2016-04-14>
## Updated: Time-stamp: <2017-09-04 18:54:38>
##-------------------------------------------------------------------
################################################################################################
## env variables:
## ssh_server: 172.17.0.2:22:root
##
## file_list:
## # Jenkins backup
## eval: find $HOME/jobs -name config.xml
## # Confluence backup
## eval: find /var/atlassian/application-data/confluence/backups/ -name *.zip | head -n 1
## # JIRA backup
## eval: find /var/atlassian/application-data/jira/export/ -name *.zip | head -n 1
## # Gitlab backup
## eval: find /var/opt/gitlab/backups -name *.tar | head -n 1
##
## env_parameters:
## export TAIL_LINE_COUNT=200
## export ssh_key_file="$HOME/.ssh/id_rsa"
################################################################################################
. /etc/profile
[ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v6"
export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
if [ ! -f /var/lib/devops/refresh_common_library.sh ]; then
[ -d /var/lib/devops/ ] || (sudo mkdir -p /var/lib/devops/ && sudo chmod 777 /var/lib/devops)
wget -O /var/lib/devops/refresh_common_library.sh "$DOWNLOAD_PREFIX/common_library/refresh_common_library.sh"
chmod 777 /var/lib/devops/refresh_common_library.sh
fi
bash /var/lib/devops/refresh_common_library.sh "3536991806" "/var/lib/devops/devops_common_library.sh" \
"${DOWNLOAD_PREFIX}/common_library/devops_common_library.sh"
. /var/lib/devops/devops_common_library.sh
################################################################################################
function tail_files() {
local ssh_server_ip=${1?}
local ssh_port=${2?}
local ssh_username=${3?}
local file_list=${4?}
local ssh_connect="ssh -i $ssh_key_file -p $ssh_port -o StrictHostKeyChecking=no $ssh_username@$ssh_server_ip"
# loop file_list
IFS=$'\n'
for t_file in ${file_list[*]}; do
unset IFS
if [[ "$t_file" = "eval: "* ]]; then
echo "Evaluate file list: $t_file"
local eval_command=${t_file#"eval: "}
# TODO: better way for temporarily disable "set -e"
set +e
ssh_result=$($ssh_connect "$eval_command")
errcode=$?
if [ $errcode -ne 0 ] || [ -z "$ssh_result" ]; then
echo "Warning: Fail to run $eval_command"
else
tail_files "$ssh_server_ip" "$ssh_port" "$ssh_username" "$ssh_result"
fi
set -e
else
# remove tailing /: /opt/devops/ --> /opt/devops
t_file=${t_file%/}
echo -e "\n========= tail -n $TAIL_LINE_COUNT $t_file"
ssh_result=$($ssh_connect test -r "$t_file" && echo yes || echo no)
if [ "x$ssh_result" == "xno" ]; then
echo "Warning: file [$t_file] not readable"
continue
fi
$ssh_connect "tail -n $TAIL_LINE_COUNT $t_file"
fi
done
}
########################################################################
source_string "$env_parameters"
ensure_variable_isset "ERROR wrong parameter: ssh_server can't be empty" "$ssh_server"
ensure_variable_isset "ERROR wrong parameter: file_list can't be empty" "$file_list"
[ -n "$ssh_key_file" ] || export ssh_key_file="$HOME/.ssh/id_rsa"
export EXIT_NODE_CONNECT_FAIL=true
ssh_server=$(string_strip_comments "$ssh_server")
ssh_server=$(string_strip_whitespace "$ssh_server")
file_list=$(string_strip_comments "$file_list")
file_list=$(string_strip_whitespace "$file_list")
# Input Parameters check
verify_comon_jenkins_parameters
# Set default value
[ -n "$TAIL_LINE_COUNT" ] || export TAIL_LINE_COUNT="200"
# TODO: whitelist for security concern
server_split=(${ssh_server//:/ })
ssh_server_ip=${server_split[0]}
ssh_port=${server_split[1]}
ssh_username=${server_split[2]}
[ -n "$ssh_username" ] || ssh_username="root"
ssh_connect="ssh -i $ssh_key_file -p $ssh_port -o StrictHostKeyChecking=no $ssh_username@$ssh_server_ip"
tail_files "$ssh_server_ip" "$ssh_port" "$ssh_username" "$file_list"
## File : tail_file.sh ends
|
DennyZhang/devops_public
|
jenkins_scripts/jenkins/tail_file.sh
|
Shell
|
mit
| 4,727
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CotC C# SDK for Unity: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="OutputCustomization.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="xtralife-logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">CotC C# SDK for Unity
 <span id="projectnumber">v1.4.0.1</span>
</div>
<div id="projectbrief">Making social games is easy !</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_cotc_sdk.html">CotcSdk</a></li><li class="navelem"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">PropertiesObject</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">CotcSdk.PropertiesObject Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html#aacdfc8f0edc93f3611d4c40f12be9073">AsBundle</a>()</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html#a16242913dd8dc6aae516f97fc6cbff9d">GetEnumerator</a>()</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html#a3e6a4b30fa74bc0e763e961d9fdfad3b">Keys</a>()</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>PropertiesObject</b>(Bundle baseData) (defined in <a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a>)</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Props</b> (defined in <a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a>)</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html#a49c7c96cfe7245e23a766b08a2e89a71">this[string key]</a></td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html#af3dfde134398c0d738f27e94e5614434">ToJson</a>()</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html#a6f9860c398a665da8643f18dada7d30a">ToString</a>()</td><td class="entry"><a class="el" href="class_cotc_sdk_1_1_properties_object.html">CotcSdk.PropertiesObject</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 12 2019 17:41:04 for CotC C# SDK for Unity by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
|
xtralifecloud/unity-sdk
|
Docs/DoxygenGenerated/html/class_cotc_sdk_1_1_properties_object-members.html
|
HTML
|
mit
| 6,105
|
'use strict';
// Use local.env.js for environment variables that grunt will set when the server starts locally.
// Use for your api keys, secrets, etc. This file should not be tracked by git.
//
// You will need to set these on the server you deploy to.
module.exports = {
DOMAIN: 'http://localhost:9000',
SESSION_SECRET: "jogging-secret",
FACEBOOK_ID: 'app-id',
FACEBOOK_SECRET: 'secret',
TWITTER_ID: 'app-id',
TWITTER_SECRET: 'secret',
GOOGLE_ID: 'app-id',
GOOGLE_SECRET: 'secret',
// Control debug level for modules using visionmedia/debug
DEBUG: ''
};
|
budacode/jogging-app
|
server/config/local.env.js
|
JavaScript
|
mit
| 582
|
using CommonMarkSharp.Inlines;
namespace CommonMarkSharp.Blocks
{
public class LinkDefinition : LeafBlock
{
public LinkDefinition(Link link)
{
Link = link;
}
public Link Link { get; private set; }
public string Id { get { return Link.Label.Literal; } }
}
}
|
MortenHoustonLudvigsen/CommonMarkSharp
|
CommonMarkSharp/Blocks/LinkDefinition.cs
|
C#
|
mit
| 341
|
<?php
/**
* Event Grid
*
* @author tmannherz
*/
class Grommet_ApiLog_Block_Adminhtml_Event_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
protected function _construct ()
{
parent::_construct();
$this->setId('apilogEvents');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
$this->setDefaultSort('time');
$this->setDefaultDir('DESC');
//$this->setNoFilterMassactionColumn(true);
}
/**
* @return Grommet_ApiLog_Block_Adminhtml_Event_Grid
*/
protected function _prepareCollection ()
{
$collection = Mage::getResourceModel('apilog/event_collection');
/* @var $collection Grommet_ApiLog_Model_Resource_Event_Collection */
$this->setCollection($collection);
return parent::_prepareCollection();
}
/**
* @return Grommet_ApiLog_Block_Adminhtml_Event_Grid
*/
protected function _prepareColumns ()
{
$this->addColumn('time', array(
'header' => $this->__('Time'),
'index' => 'time',
'type' => 'datetime',
'width' => 160,
));
$this->addColumn('adapter', array(
'header' => $this->__('API Adapter'),
'index' => 'adapter',
'type' => 'options',
'width' => '100px',
'options' => Mage::getSingleton('apilog/source')->toOptionArray('event_adapter')
));
$this->addColumn('user', array(
'header' => $this->__('Username'),
'index' => 'user',
'type' => 'text',
'escape' => true,
'sortable' => false,
'filter' => 'apilog/adminhtml_grid_filter_user',
'width' => 150,
));
$this->addColumn('path', array(
'header' => $this->__('API Path'),
'index' => 'path',
'type' => 'text'
));
$this->addColumn('status', array(
'header' => $this->__('Status'),
'index' => 'status',
'type' => 'options',
'width' => '100px',
'options' => Mage::getSingleton('apilog/source')->toOptionArray('event_status')
));
$this->addColumn('fault_message', array(
'header' => $this->__('Fault Message'),
'index' => 'fault_message',
'type' => 'text'
));
if (!$this->_isExport) {
$this->addColumn('view', array(
'header' => $this->__('Details'),
'width' => 50,
'type' => 'action',
'getter' => 'getId',
'actions' => array(array(
'caption' => $this->__('View'),
'url' => array(
'base' => '*/apilog/view',
),
'field' => 'id'
)),
'filter' => false,
'sortable' => false,
));
}
else {
$this->addColumn('fault_code', array(
'header' => $this->__('Fault Code'),
'index' => 'fault_code',
'type' => 'text'
));
$this->addColumn('arguments', array(
'header' => $this->__('Arguments'),
'index' => 'arguments',
'type' => 'text'
));
}
$this->addExportType('*/apilog/exportCsv', Mage::helper('apilog')->__('CSV'));
$this->addExportType('*/apilog/exportXml', Mage::helper('apilog')->__('XML'));
return parent::_prepareColumns();
}
/**
* @param Varien_Object $item
* @return string
*/
public function getRowUrl ($item)
{
return $this->getUrl('*/apilog/view', array('id' => $item->getId()));
}
/**
* @return string
*/
public function getGridUrl ()
{
return $this->getUrl('*/apilog/grid');
}
}
|
grommet/apilog
|
app/code/community/Grommet/ApiLog/Block/Adminhtml/Event/Grid.php
|
PHP
|
mit
| 3,146
|
"""Control switches."""
from datetime import timedelta
import logging
from ProgettiHWSW.relay import Relay
import async_timeout
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from . import setup_switch
from .const import DEFAULT_POLLING_INTERVAL_SEC, DOMAIN
_LOGGER = logging.getLogger(DOMAIN)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the switches from a config entry."""
board_api = hass.data[DOMAIN][config_entry.entry_id]
relay_count = config_entry.data["relay_count"]
switches = []
async def async_update_data():
"""Fetch data from API endpoint of board."""
async with async_timeout.timeout(5):
return await board_api.get_switches()
coordinator = DataUpdateCoordinator(
hass,
_LOGGER,
name="switch",
update_method=async_update_data,
update_interval=timedelta(seconds=DEFAULT_POLLING_INTERVAL_SEC),
)
await coordinator.async_refresh()
for i in range(1, int(relay_count) + 1):
switches.append(
ProgettihwswSwitch(
coordinator,
f"Relay #{i}",
setup_switch(board_api, i, config_entry.data[f"relay_{str(i)}"]),
)
)
async_add_entities(switches)
class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity):
"""Represent a switch entity."""
def __init__(self, coordinator, name, switch: Relay):
"""Initialize the values."""
super().__init__(coordinator)
self._switch = switch
self._name = name
async def async_turn_on(self, **kwargs):
"""Turn the switch on."""
await self._switch.control(True)
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs):
"""Turn the switch off."""
await self._switch.control(False)
await self.coordinator.async_request_refresh()
async def async_toggle(self, **kwargs):
"""Toggle the state of switch."""
await self._switch.toggle()
await self.coordinator.async_request_refresh()
@property
def name(self):
"""Return the switch name."""
return self._name
@property
def is_on(self):
"""Get switch state."""
return self.coordinator.data[self._switch.id]
|
rohitranjan1991/home-assistant
|
homeassistant/components/progettihwsw/switch.py
|
Python
|
mit
| 2,686
|
require "test_helper"
<% module_namespacing do -%>
class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest
<% if mountable_engine? -%>
include Engine.routes.url_helpers
<% end -%>
<% if actions.empty? -%>
# def test_sanity
# flunk "Need real tests"
# end
<% else -%>
<% actions.each do |action| -%>
def test_<%= action %>
get <%= url_helper_prefix %>_<%= action %>_url
assert_response :success
end
<% end -%>
<% end -%>
end
<% end -%>
|
lrosskamp/makealist-public
|
vendor/cache/ruby/2.3.0/gems/minitest-rails-3.0.0/lib/generators/minitest/controller/templates/controller_test.rb
|
Ruby
|
mit
| 476
|
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* abc
*/
package com.microsoft.azure.management.mediaservices.v2018_03_30_preview.implementation;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.mediaservices.v2018_03_30_preview.Locations;
import rx.functions.Func1;
import rx.Observable;
import com.microsoft.azure.management.mediaservices.v2018_03_30_preview.EntityNameAvailabilityCheckOutput;
import com.microsoft.azure.management.mediaservices.v2018_03_30_preview.CheckNameAvailabilityInput;
class LocationsImpl extends WrapperImpl<LocationsInner> implements Locations {
private final MediaManager manager;
LocationsImpl(MediaManager manager) {
super(manager.inner().locations());
this.manager = manager;
}
public MediaManager manager() {
return this.manager;
}
@Override
public Observable<EntityNameAvailabilityCheckOutput> checkNameAvailabilityAsync(String locationName, CheckNameAvailabilityInput parameters) {
LocationsInner client = this.inner();
return client.checkNameAvailabilityAsync(locationName, parameters)
.map(new Func1<EntityNameAvailabilityCheckOutputInner, EntityNameAvailabilityCheckOutput>() {
@Override
public EntityNameAvailabilityCheckOutput call(EntityNameAvailabilityCheckOutputInner inner) {
return new EntityNameAvailabilityCheckOutputImpl(inner, manager());
}
});
}
}
|
selvasingh/azure-sdk-for-java
|
sdk/mediaservices/mgmt-v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LocationsImpl.java
|
Java
|
mit
| 1,681
|
"use strict";
module.exports = MapField;
// extends Field
var Field = require("./field");
((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField";
var types = require("./types"),
util = require("./util");
/**
* Constructs a new map field instance.
* @classdesc Reflected map field.
* @extends FieldBase
* @constructor
* @param {string} name Unique name within its namespace
* @param {number} id Unique id within its namespace
* @param {string} keyType Key type
* @param {string} type Value type
* @param {Object.<string,*>} [options] Declared options
*/
function MapField(name, id, keyType, type, options) {
Field.call(this, name, id, type, options);
/* istanbul ignore if */
if (!util.isString(keyType))
throw TypeError("keyType must be a string");
/**
* Key type.
* @type {string}
*/
this.keyType = keyType; // toJSON, marker
/**
* Resolved key type if not a basic type.
* @type {ReflectionObject|null}
*/
this.resolvedKeyType = null;
// Overrides Field#map
this.map = true;
}
/**
* Map field descriptor.
* @interface IMapField
* @extends {IField}
* @property {string} keyType Key type
*/
/**
* Extension map field descriptor.
* @interface IExtensionMapField
* @extends IMapField
* @property {string} extend Extended type
*/
/**
* Constructs a map field from a map field descriptor.
* @param {string} name Field name
* @param {IMapField} json Map field descriptor
* @returns {MapField} Created map field
* @throws {TypeError} If arguments are invalid
*/
MapField.fromJSON = function fromJSON(name, json) {
return new MapField(name, json.id, json.keyType, json.type, json.options);
};
/**
* Converts this map field to a map field descriptor.
* @returns {IMapField} Map field descriptor
*/
MapField.prototype.toJSON = function toJSON() {
return util.toObject([
"keyType" , this.keyType,
"type" , this.type,
"id" , this.id,
"extend" , this.extend,
"options" , this.options
]);
};
/**
* @override
*/
MapField.prototype.resolve = function resolve() {
if (this.resolved)
return this;
// Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes"
if (types.mapKey[this.keyType] === undefined)
throw Error("invalid key type: " + this.keyType);
return Field.prototype.resolve.call(this);
};
/**
* Map field decorator (TypeScript).
* @name MapField.d
* @function
* @param {number} fieldId Field id
* @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type
* @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type
* @returns {FieldDecorator} Decorator function
* @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }
*/
MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {
// submessage value: decorate the submessage and use its name as the type
if (typeof fieldValueType === "function")
fieldValueType = util.decorateType(fieldValueType).name;
// enum reference value: create a reflected copy of the enum and keep reuseing it
else if (fieldValueType && typeof fieldValueType === "object")
fieldValueType = util.decorateEnum(fieldValueType).name;
return function mapFieldDecorator(prototype, fieldName) {
util.decorateType(prototype.constructor)
.add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));
};
};
|
kevkruemp/HRI_Plant_Monitor
|
lambda/node_modules/google-gax/node_modules/protobufjs/src/mapfield.js
|
JavaScript
|
mit
| 3,843
|
#!/usr/bin/python
#
# Copyright 2016 Canonical Ltd
#
# 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.
from keystoneclient.v2_0 import client
from keystoneclient.v3 import client as keystoneclient_v3
from keystoneclient.auth import token_endpoint
from keystoneclient import session, exceptions
from charmhelpers.core.decorators import retry_on_exception
# Early versions of keystoneclient lib do not have an explicit
# ConnectionRefused
if hasattr(exceptions, 'ConnectionRefused'):
econnrefused = exceptions.ConnectionRefused
else:
econnrefused = exceptions.ConnectionError
def _get_keystone_manager_class(endpoint, token, api_version):
"""Return KeystoneManager class for the given API version
@param endpoint: the keystone endpoint to point client at
@param token: the keystone admin_token
@param api_version: version of the keystone api the client should use
@returns keystonemanager class used for interrogating keystone
"""
if api_version == 2:
return KeystoneManager2(endpoint, token)
if api_version == 3:
return KeystoneManager3(endpoint, token)
raise ValueError('No manager found for api version {}'.format(api_version))
@retry_on_exception(5, base_delay=3, exc_type=econnrefused)
def get_keystone_manager(endpoint, token, api_version=None):
"""Return a keystonemanager for the correct API version
If api_version has not been set then create a manager based on the endpoint
Use this manager to query the catalogue and determine which api version
should actually be being used. Return the correct client based on that.
Function is wrapped in a retry_on_exception to catch the case where the
keystone service is still initialising and not responding to requests yet.
XXX I think the keystone client should be able to do version
detection automatically so the code below could be greatly
simplified
@param endpoint: the keystone endpoint to point client at
@param token: the keystone admin_token
@param api_version: version of the keystone api the client should use
@returns keystonemanager class used for interrogating keystone
"""
if api_version:
return _get_keystone_manager_class(endpoint, token, api_version)
else:
if 'v2.0' in endpoint.split('/'):
manager = _get_keystone_manager_class(endpoint, token, 2)
else:
manager = _get_keystone_manager_class(endpoint, token, 3)
if endpoint.endswith('/'):
base_ep = endpoint.rsplit('/', 2)[0]
else:
base_ep = endpoint.rsplit('/', 1)[0]
svc_id = None
for svc in manager.api.services.list():
if svc.type == 'identity':
svc_id = svc.id
version = None
for ep in manager.api.endpoints.list():
if ep.service_id == svc_id and hasattr(ep, 'adminurl'):
version = ep.adminurl.split('/')[-1]
if version and version == 'v2.0':
new_ep = base_ep + "/" + 'v2.0'
return _get_keystone_manager_class(new_ep, token, 2)
elif version and version == 'v3':
new_ep = base_ep + "/" + 'v3'
return _get_keystone_manager_class(new_ep, token, 3)
else:
return manager
class KeystoneManager(object):
def resolve_domain_id(self, name):
pass
def resolve_role_id(self, name):
"""Find the role_id of a given role"""
roles = [r._info for r in self.api.roles.list()]
for r in roles:
if name.lower() == r['name'].lower():
return r['id']
def resolve_service_id(self, name, service_type=None):
"""Find the service_id of a given service"""
services = [s._info for s in self.api.services.list()]
for s in services:
if service_type:
if (name.lower() == s['name'].lower() and
service_type == s['type']):
return s['id']
else:
if name.lower() == s['name'].lower():
return s['id']
def resolve_service_id_by_type(self, type):
"""Find the service_id of a given service"""
services = [s._info for s in self.api.services.list()]
for s in services:
if type == s['type']:
return s['id']
class KeystoneManager2(KeystoneManager):
def __init__(self, endpoint, token):
self.api_version = 2
self.api = client.Client(endpoint=endpoint, token=token)
def resolve_user_id(self, name, user_domain=None):
"""Find the user_id of a given user"""
users = [u._info for u in self.api.users.list()]
for u in users:
if name.lower() == u['name'].lower():
return u['id']
def create_endpoints(self, region, service_id, publicurl, adminurl,
internalurl):
self.api.endpoints.create(region=region, service_id=service_id,
publicurl=publicurl, adminurl=adminurl,
internalurl=internalurl)
def tenants_list(self):
return self.api.tenants.list()
def resolve_tenant_id(self, name, domain=None):
"""Find the tenant_id of a given tenant"""
tenants = [t._info for t in self.api.tenants.list()]
for t in tenants:
if name.lower() == t['name'].lower():
return t['id']
def create_tenant(self, tenant_name, description, domain='default'):
self.api.tenants.create(tenant_name=tenant_name,
description=description)
def delete_tenant(self, tenant_id):
self.api.tenants.delete(tenant_id)
def create_user(self, name, password, email, tenant_id=None,
domain_id=None):
self.api.users.create(name=name,
password=password,
email=email,
tenant_id=tenant_id)
def update_password(self, user, password):
self.api.users.update_password(user=user, password=password)
def roles_for_user(self, user_id, tenant_id=None, domain_id=None):
return self.api.roles.roles_for_user(user_id, tenant_id)
def add_user_role(self, user, role, tenant, domain):
self.api.roles.add_user_role(user=user, role=role, tenant=tenant)
class KeystoneManager3(KeystoneManager):
def __init__(self, endpoint, token):
self.api_version = 3
keystone_auth_v3 = token_endpoint.Token(endpoint=endpoint, token=token)
keystone_session_v3 = session.Session(auth=keystone_auth_v3)
self.api = keystoneclient_v3.Client(session=keystone_session_v3)
def resolve_tenant_id(self, name, domain=None):
"""Find the tenant_id of a given tenant"""
if domain:
domain_id = self.resolve_domain_id(domain)
tenants = [t._info for t in self.api.projects.list()]
for t in tenants:
if name.lower() == t['name'].lower() and \
(domain is None or t['domain_id'] == domain_id):
return t['id']
def resolve_domain_id(self, name):
"""Find the domain_id of a given domain"""
domains = [d._info for d in self.api.domains.list()]
for d in domains:
if name.lower() == d['name'].lower():
return d['id']
def resolve_user_id(self, name, user_domain=None):
"""Find the user_id of a given user"""
domain_id = None
if user_domain:
domain_id = self.resolve_domain_id(user_domain)
for user in self.api.users.list(domain=domain_id):
if name.lower() == user.name.lower():
if user_domain:
if domain_id == user.domain_id:
return user.id
else:
return user.id
def create_endpoints(self, region, service_id, publicurl, adminurl,
internalurl):
self.api.endpoints.create(service_id, publicurl, interface='public',
region=region)
self.api.endpoints.create(service_id, adminurl, interface='admin',
region=region)
self.api.endpoints.create(service_id, internalurl,
interface='internal', region=region)
def tenants_list(self):
return self.api.projects.list()
def create_domain(self, domain_name, description):
self.api.domains.create(domain_name, description=description)
def create_tenant(self, tenant_name, description, domain='default'):
domain_id = self.resolve_domain_id(domain)
self.api.projects.create(tenant_name, domain_id,
description=description)
def delete_tenant(self, tenant_id):
self.api.projects.delete(tenant_id)
def create_user(self, name, password, email, tenant_id=None,
domain_id=None):
if not domain_id:
domain_id = self.resolve_domain_id('default')
if tenant_id:
self.api.users.create(name,
domain=domain_id,
password=password,
email=email,
project=tenant_id)
else:
self.api.users.create(name,
domain=domain_id,
password=password,
email=email)
def update_password(self, user, password):
self.api.users.update(user, password=password)
def roles_for_user(self, user_id, tenant_id=None, domain_id=None):
# Specify either a domain or project, not both
if domain_id:
return self.api.roles.list(user_id, domain=domain_id)
else:
return self.api.roles.list(user_id, project=tenant_id)
def add_user_role(self, user, role, tenant, domain):
# Specify either a domain or project, not both
if domain:
self.api.roles.grant(role, user=user, domain=domain)
if tenant:
self.api.roles.grant(role, user=user, project=tenant)
def find_endpoint_v3(self, interface, service_id, region):
found_eps = []
for ep in self.api.endpoints.list():
if ep.service_id == service_id and ep.region == region and \
ep.interface == interface:
found_eps.append(ep)
return found_eps
def delete_old_endpoint_v3(self, interface, service_id, region, url):
eps = self.find_endpoint_v3(interface, service_id, region)
for ep in eps:
if getattr(ep, 'url') != url:
self.api.endpoints.delete(ep.id)
return True
return False
|
konono/equlipse
|
openstack-install/charm/trusty/charm-keystone/hooks/manager.py
|
Python
|
mit
| 11,385
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
* @emails oncall+relay
*/
// flowlint ambiguous-object-type:error
'use strict';
const RelayModernEnvironment = require('../RelayModernEnvironment');
const RelayModernStore = require('../RelayModernStore');
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const RelayRecordSource = require('../RelayRecordSource');
const nullthrows = require('nullthrows');
const {
createOperationDescriptor,
} = require('../RelayModernOperationDescriptor');
const {
getSingularSelector,
createReaderSelector,
} = require('../RelayModernSelector');
const {generateAndCompile} = require('relay-test-utils-internal');
describe('executeMutation() with @match', () => {
let callbacks;
let commentFragment;
let commentID;
let complete;
let dataSource;
let environment;
let error;
let fetch;
let fragmentCallback;
let markdownRendererFragment;
let markdownRendererNormalizationFragment;
let mutation;
let next;
let operation;
let commentQuery;
let queryOperation;
let operationCallback;
let operationLoader;
let resolveFragment;
let source;
let store;
let variables;
let queryVariables;
beforeEach(() => {
jest.resetModules();
commentID = '1';
({
CommentFragment: commentFragment,
CommentQuery: commentQuery,
CreateCommentMutation: mutation,
MarkdownUserNameRenderer_name: markdownRendererFragment,
MarkdownUserNameRenderer_name$normalization: markdownRendererNormalizationFragment,
} = generateAndCompile(`
mutation CreateCommentMutation($input: CommentCreateInput!) {
commentCreate(input: $input) {
comment {
actor {
name
nameRenderer @match {
...PlainUserNameRenderer_name
@module(name: "PlainUserNameRenderer.react")
...MarkdownUserNameRenderer_name
@module(name: "MarkdownUserNameRenderer.react")
}
}
}
}
}
fragment PlainUserNameRenderer_name on PlainUserNameRenderer {
plaintext
data {
text
}
}
fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer {
__typename
markdown
data {
markup @__clientField(handle: "markup_handler")
}
}
fragment CommentFragment on Comment {
id
actor {
name
nameRenderer @match {
...PlainUserNameRenderer_name
@module(name: "PlainUserNameRenderer.react")
...MarkdownUserNameRenderer_name
@module(name: "MarkdownUserNameRenderer.react")
}
}
}
query CommentQuery($id: ID!) {
node(id: $id) {
id
...CommentFragment
}
}
`));
variables = {
input: {
clientMutationId: '0',
feedbackId: '1',
},
};
queryVariables = {
id: commentID,
};
operation = createOperationDescriptor(mutation, variables);
queryOperation = createOperationDescriptor(commentQuery, queryVariables);
const MarkupHandler = {
update(storeProxy, payload) {
const record = storeProxy.get(payload.dataID);
if (record != null) {
const markup = record.getValue(payload.fieldKey);
record.setValue(
typeof markup === 'string' ? markup.toUpperCase() : null,
payload.handleKey,
);
}
},
};
complete = jest.fn();
error = jest.fn();
next = jest.fn();
callbacks = {complete, error, next};
fetch = (_query, _variables, _cacheConfig) => {
return RelayObservable.create(sink => {
dataSource = sink;
});
};
operationLoader = {
load: jest.fn(moduleName => {
return new Promise(resolve => {
resolveFragment = resolve;
});
}),
get: jest.fn(),
};
source = RelayRecordSource.create();
store = new RelayModernStore(source);
environment = new RelayModernEnvironment({
network: RelayNetwork.create(fetch),
store,
operationLoader,
handlerProvider: name => {
switch (name) {
case 'markup_handler':
return MarkupHandler;
}
},
});
const selector = createReaderSelector(
commentFragment,
commentID,
{},
queryOperation.request,
);
const fragmentSnapshot = environment.lookup(selector);
fragmentCallback = jest.fn();
environment.subscribe(fragmentSnapshot, fragmentCallback);
const operationSnapshot = environment.lookup(operation.fragment);
operationCallback = jest.fn();
environment.subscribe(operationSnapshot, operationCallback);
});
it('executes the optimistic updater immediately, does not mark the mutation as being in flight in the operation tracker', () => {
environment
.executeMutation({
operation,
optimisticUpdater: _store => {
const comment = _store.create(commentID, 'Comment');
comment.setValue(commentID, 'id');
const actor = _store.create('4', 'User');
comment.setLinkedRecord(actor, 'actor');
actor.setValue('optimistic-name', 'name');
},
})
.subscribe(callbacks);
expect(complete).not.toBeCalled();
expect(error).not.toBeCalled();
expect(fragmentCallback.mock.calls.length).toBe(1);
expect(fragmentCallback.mock.calls[0][0].data).toEqual({
id: commentID,
actor: {
name: 'optimistic-name',
nameRenderer: undefined,
},
});
// The mutation affecting the query should not be marked as in flight yet
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).toBe(null);
});
it('calls next() and publishes the initial payload to the store', () => {
environment.executeMutation({operation}).subscribe(callbacks);
const payload = {
data: {
commentCreate: {
comment: {
id: commentID,
actor: {
id: '4',
name: 'actor-name',
__typename: 'User',
nameRenderer: {
__typename: 'MarkdownUserNameRenderer',
__module_component_CreateCommentMutation:
'MarkdownUserNameRenderer.react',
__module_operation_CreateCommentMutation:
'MarkdownUserNameRenderer_name$normalization.graphql',
markdown: 'markdown payload',
data: {
markup: '<markup/>', // server data is lowercase
},
},
},
},
},
},
};
dataSource.next(payload);
jest.runAllTimers();
expect(next.mock.calls.length).toBe(1);
expect(complete).not.toBeCalled();
expect(error).not.toBeCalled();
expect(operationCallback).toBeCalledTimes(1);
const operationSnapshot = operationCallback.mock.calls[0][0];
expect(operationSnapshot.isMissingData).toBe(false);
expect(operationSnapshot.data).toEqual({
commentCreate: {
comment: {
actor: {
name: 'actor-name',
nameRenderer: {
__id:
'client:4:nameRenderer(supported:["PlainUserNameRenderer","MarkdownUserNameRenderer"])',
__fragmentPropName: 'name',
__fragments: {
MarkdownUserNameRenderer_name: {},
},
__fragmentOwner: operation.request,
__module_component: 'MarkdownUserNameRenderer.react',
},
},
},
},
});
expect(fragmentCallback).toBeCalledTimes(1);
const fragmentSnapshot = fragmentCallback.mock.calls[0][0];
// data is missing since match field data hasn't been processed yet
expect(fragmentSnapshot.isMissingData).toBe(true);
expect(fragmentSnapshot.data).toEqual({
id: commentID,
actor: {
name: 'actor-name',
nameRenderer: {},
},
});
const matchSelector = nullthrows(
getSingularSelector(
markdownRendererFragment,
(operationSnapshot.data: any)?.commentCreate?.comment?.actor
?.nameRenderer,
),
);
const matchSnapshot = environment.lookup(matchSelector);
// ref exists but match field data hasn't been processed yet
expect(matchSnapshot.isMissingData).toBe(true);
expect(matchSnapshot.data).toEqual({
__typename: 'MarkdownUserNameRenderer',
data: undefined,
markdown: undefined,
});
// The mutation affecting the query should be marked as in flight now
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).not.toBe(null);
});
it('loads the @match fragment and normalizes/publishes the field payload', () => {
environment.executeMutation({operation}).subscribe(callbacks);
const payload = {
data: {
commentCreate: {
comment: {
id: commentID,
actor: {
id: '4',
name: 'actor-name',
__typename: 'User',
nameRenderer: {
__typename: 'MarkdownUserNameRenderer',
__module_component_CreateCommentMutation:
'MarkdownUserNameRenderer.react',
__module_operation_CreateCommentMutation:
'MarkdownUserNameRenderer_name$normalization.graphql',
markdown: 'markdown payload',
data: {
markup: '<markup/>', // server data is lowercase
},
},
},
},
},
},
};
dataSource.next(payload);
jest.runAllTimers();
next.mockClear();
expect(operationLoader.load).toBeCalledTimes(1);
expect(operationLoader.load.mock.calls[0][0]).toEqual(
'MarkdownUserNameRenderer_name$normalization.graphql',
);
expect(operationCallback).toBeCalledTimes(1);
// result tested above
const operationSnapshot = operationCallback.mock.calls[0][0];
operationCallback.mockClear();
const matchSelector = nullthrows(
getSingularSelector(
markdownRendererFragment,
(operationSnapshot.data: any)?.commentCreate?.comment?.actor
?.nameRenderer,
),
);
const initialMatchSnapshot = environment.lookup(matchSelector);
expect(initialMatchSnapshot.isMissingData).toBe(true);
const matchCallback = jest.fn();
environment.subscribe(initialMatchSnapshot, matchCallback);
resolveFragment(markdownRendererNormalizationFragment);
jest.runAllTimers();
// next() should not be called when @match resolves, no new GraphQLResponse
// was received for this case
expect(next).toBeCalledTimes(0);
expect(operationCallback).toBeCalledTimes(0);
expect(matchCallback).toBeCalledTimes(1);
const matchSnapshot = matchCallback.mock.calls[0][0];
expect(matchSnapshot.isMissingData).toBe(false);
expect(matchSnapshot.data).toEqual({
__typename: 'MarkdownUserNameRenderer',
data: {
// NOTE: should be uppercased by the MarkupHandler
markup: '<MARKUP/>',
},
markdown: 'markdown payload',
});
// The mutation affecting the query should still be marked as in flight
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).not.toBe(null);
});
it('calls complete() only after match payloads are processed (network completes first)', () => {
environment.executeMutation({operation}).subscribe(callbacks);
const payload = {
data: {
commentCreate: {
comment: {
id: commentID,
actor: {
id: '4',
name: 'actor-name',
__typename: 'User',
nameRenderer: {
__typename: 'MarkdownUserNameRenderer',
__module_component_CreateCommentMutation:
'MarkdownUserNameRenderer.react',
__module_operation_CreateCommentMutation:
'MarkdownUserNameRenderer_name$normalization.graphql',
markdown: 'markdown payload',
data: {
markup: '<markup/>', // server data is lowercase
},
},
},
},
},
},
};
dataSource.next(payload);
dataSource.complete();
jest.runAllTimers();
expect(complete).toBeCalledTimes(0);
expect(error).toBeCalledTimes(0);
expect(next).toBeCalledTimes(1);
// The mutation affecting the query should still be in flight
// even if the network completed, since we're waiting for a 3d payload
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).not.toBe(null);
expect(operationLoader.load).toBeCalledTimes(1);
expect(operationLoader.load.mock.calls[0][0]).toEqual(
'MarkdownUserNameRenderer_name$normalization.graphql',
);
resolveFragment(markdownRendererNormalizationFragment);
jest.runAllTimers();
expect(complete).toBeCalledTimes(1);
expect(error).toBeCalledTimes(0);
expect(next).toBeCalledTimes(1);
// The mutation affecting the query should no longer be in flight
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).toBe(null);
});
it('calls complete() only after match payloads are processed (network completes last)', () => {
environment.executeMutation({operation}).subscribe(callbacks);
const payload = {
data: {
commentCreate: {
comment: {
id: commentID,
actor: {
id: '4',
name: 'actor-name',
__typename: 'User',
nameRenderer: {
__typename: 'MarkdownUserNameRenderer',
__module_component_CreateCommentMutation:
'MarkdownUserNameRenderer.react',
__module_operation_CreateCommentMutation:
'MarkdownUserNameRenderer_name$normalization.graphql',
markdown: 'markdown payload',
data: {
markup: '<markup/>', // server data is lowercase
},
},
},
},
},
},
};
dataSource.next(payload);
jest.runAllTimers();
expect(operationLoader.load).toBeCalledTimes(1);
expect(operationLoader.load.mock.calls[0][0]).toEqual(
'MarkdownUserNameRenderer_name$normalization.graphql',
);
resolveFragment(markdownRendererNormalizationFragment);
jest.runAllTimers();
// The mutation affecting the query should still be in flight
// since the network hasn't completed
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).not.toBe(null);
expect(complete).toBeCalledTimes(0);
expect(error).toBeCalledTimes(0);
expect(next).toBeCalledTimes(1);
dataSource.complete();
expect(complete).toBeCalledTimes(1);
expect(error).toBeCalledTimes(0);
expect(next).toBeCalledTimes(1);
// The mutation affecting the query should no longer be in flight
expect(
environment
.getOperationTracker()
.getPromiseForPendingOperationsAffectingOwner(queryOperation.request),
).toBe(null);
});
describe('optimistic updates', () => {
const optimisticResponse = {
commentCreate: {
comment: {
id: commentID,
actor: {
id: '4',
name: 'optimisitc-actor-name',
__typename: 'User',
nameRenderer: {
__typename: 'MarkdownUserNameRenderer',
__module_component_CreateCommentMutation:
'MarkdownUserNameRenderer.react',
__module_operation_CreateCommentMutation:
'MarkdownUserNameRenderer_name$normalization.graphql',
markdown: 'markdown payload',
data: {
markup: '<optimistic_markup/>', // server data is lowercase
},
},
},
},
},
};
it('optimistically creates @match fields', () => {
operationLoader.get.mockImplementationOnce(name => {
return markdownRendererNormalizationFragment;
});
environment
.executeMutation({operation, optimisticResponse})
.subscribe(callbacks);
jest.runAllTimers();
expect(next.mock.calls.length).toBe(0);
expect(complete).not.toBeCalled();
expect(error.mock.calls.map(call => call[0].message)).toEqual([]);
expect(operationCallback).toBeCalledTimes(1);
const operationSnapshot = operationCallback.mock.calls[0][0];
expect(operationSnapshot.isMissingData).toBe(false);
expect(operationSnapshot.data).toEqual({
commentCreate: {
comment: {
actor: {
name: 'optimisitc-actor-name',
nameRenderer: {
__id:
'client:4:nameRenderer(supported:["PlainUserNameRenderer","MarkdownUserNameRenderer"])',
__fragmentPropName: 'name',
__fragments: {
MarkdownUserNameRenderer_name: {},
},
__fragmentOwner: operation.request,
__module_component: 'MarkdownUserNameRenderer.react',
},
},
},
},
});
operationCallback.mockClear();
const matchSelector = nullthrows(
getSingularSelector(
markdownRendererFragment,
(operationSnapshot.data: any)?.commentCreate?.comment?.actor
?.nameRenderer,
),
);
const initialMatchSnapshot = environment.lookup(matchSelector);
expect(initialMatchSnapshot.isMissingData).toBe(false);
expect(initialMatchSnapshot.data).toEqual({
__typename: 'MarkdownUserNameRenderer',
data: {
// NOTE: should be uppercased by the MarkupHandler
markup: '<OPTIMISTIC_MARKUP/>',
},
markdown: 'markdown payload',
});
});
it('optimistically creates @match fields and loads resources', () => {
operationLoader.load.mockImplementationOnce(() => {
return new Promise(resolve => {
setImmediate(() => {
resolve(markdownRendererNormalizationFragment);
});
});
});
environment
.executeMutation({operation, optimisticResponse})
.subscribe(callbacks);
jest.runAllTimers();
expect(next.mock.calls.length).toBe(0);
expect(complete).not.toBeCalled();
expect(error.mock.calls.map(call => call[0].message)).toEqual([]);
expect(operationCallback).toBeCalledTimes(1);
const operationSnapshot = operationCallback.mock.calls[0][0];
expect(operationSnapshot.isMissingData).toBe(false);
expect(operationSnapshot.data).toEqual({
commentCreate: {
comment: {
actor: {
name: 'optimisitc-actor-name',
nameRenderer: {
__id:
'client:4:nameRenderer(supported:["PlainUserNameRenderer","MarkdownUserNameRenderer"])',
__fragmentPropName: 'name',
__fragments: {
MarkdownUserNameRenderer_name: {},
},
__fragmentOwner: operation.request,
__module_component: 'MarkdownUserNameRenderer.react',
},
},
},
},
});
operationCallback.mockClear();
const matchSelector = nullthrows(
getSingularSelector(
markdownRendererFragment,
(operationSnapshot.data: any)?.commentCreate?.comment?.actor
?.nameRenderer,
),
);
const initialMatchSnapshot = environment.lookup(matchSelector);
expect(initialMatchSnapshot.isMissingData).toBe(false);
expect(initialMatchSnapshot.data).toEqual({
__typename: 'MarkdownUserNameRenderer',
data: {
// NOTE: should be uppercased by the MarkupHandler
markup: '<OPTIMISTIC_MARKUP/>',
},
markdown: 'markdown payload',
});
});
it('does not apply aysnc 3D optimistic updates if the server response arrives first', () => {
operationLoader.load.mockImplementationOnce(() => {
return new Promise(resolve => {
setTimeout(() => {
resolve(markdownRendererNormalizationFragment);
}, 1000);
});
});
environment
.executeMutation({operation, optimisticResponse})
.subscribe(callbacks);
const serverPayload = {
data: {
commentCreate: {
comment: {
id: commentID,
actor: {
id: '4',
name: 'actor-name',
__typename: 'User',
nameRenderer: {
__typename: 'MarkdownUserNameRenderer',
__module_component_CreateCommentMutation:
'MarkdownUserNameRenderer.react',
__module_operation_CreateCommentMutation:
'MarkdownUserNameRenderer_name$normalization.graphql',
markdown: 'markdown payload',
data: {
markup: '<markup/>', // server data is lowercase
},
},
},
},
},
},
};
dataSource.next(serverPayload);
jest.runAllTimers();
expect(next.mock.calls.length).toBe(1);
expect(complete).not.toBeCalled();
expect(error).not.toBeCalled();
expect(operationCallback).toBeCalledTimes(2);
const operationSnapshot = operationCallback.mock.calls[1][0];
expect(operationSnapshot.isMissingData).toBe(false);
expect(operationSnapshot.data).toEqual({
commentCreate: {
comment: {
actor: {
name: 'actor-name',
nameRenderer: {
__id:
'client:4:nameRenderer(supported:["PlainUserNameRenderer","MarkdownUserNameRenderer"])',
__fragmentPropName: 'name',
__fragments: {
MarkdownUserNameRenderer_name: {},
},
__fragmentOwner: operation.request,
__module_component: 'MarkdownUserNameRenderer.react',
},
},
},
},
});
const matchSelector = nullthrows(
getSingularSelector(
markdownRendererFragment,
(operationSnapshot.data: any)?.commentCreate?.comment?.actor
?.nameRenderer,
),
);
const matchSnapshot = environment.lookup(matchSelector);
// optimistic update should not be applied
expect(matchSnapshot.isMissingData).toBe(true);
expect(matchSnapshot.data).toEqual({
__typename: 'MarkdownUserNameRenderer',
data: undefined,
markdown: undefined,
});
});
it('does not apply async 3D optimistic updates if the operation is cancelled', () => {
operationLoader.load.mockImplementationOnce(() => {
return new Promise(resolve => {
setTimeout(() => {
resolve(markdownRendererNormalizationFragment);
}, 1000);
});
});
const disposable = environment
.executeMutation({operation, optimisticResponse})
.subscribe(callbacks);
disposable.unsubscribe();
jest.runAllImmediates();
jest.runAllTimers();
expect(next).not.toBeCalled();
expect(complete).not.toBeCalled();
expect(error).not.toBeCalled();
expect(operationCallback).toBeCalledTimes(2);
// get the match snapshot from sync optimistic response
const operationSnapshot = operationCallback.mock.calls[0][0];
expect(operationSnapshot.isMissingData).toBe(false);
const matchSelector = nullthrows(
getSingularSelector(
markdownRendererFragment,
(operationSnapshot.data: any)?.commentCreate?.comment?.actor
?.nameRenderer,
),
);
const matchSnapshot = environment.lookup(matchSelector);
// optimistic update should not be applied
expect(matchSnapshot.isMissingData).toBe(true);
expect(matchSnapshot.data).toEqual(undefined);
});
it('catches error when opeartionLoader.load fails synchoronously', () => {
operationLoader.load.mockImplementationOnce(() => {
throw new Error('<user-error>');
});
environment
.executeMutation({operation, optimisticResponse})
.subscribe(callbacks);
jest.runAllTimers();
expect(error.mock.calls.length).toBe(1);
expect(error.mock.calls[0][0]).toEqual(new Error('<user-error>'));
});
});
});
|
iamchenxin/relay
|
packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithMatch-test.js
|
JavaScript
|
mit
| 25,618
|
<?php
/**
* This file is part of the authbucket/oauth2-symfony-bundle package.
*
* (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AuthBucket\Bundle\OAuth2Bundle\Tests\TestBundle\Entity;
use AuthBucket\Bundle\OAuth2Bundle\Entity\ClientRepository as AbstractClientRepository;
/**
* ClientRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ClientRepository extends AbstractClientRepository
{
}
|
authbucket/oauth2-symfony-bundle
|
tests/TestBundle/Entity/ClientRepository.php
|
PHP
|
mit
| 624
|
The MIT License (MIT)
Copyright (c) 2015 mercoglianoisidoro
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.
|
mercoglianoisidoro/jstree
|
demoUsing_divTOjstree/bower_components/divTOjstree/LICENSE.md
|
Markdown
|
mit
| 1,086
|
<!doctype html>
<html lang="lv">
<head
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# profile: http://ogp.me/ns/profile#"
itemscope itemtype="http://schema.org/WebSite"
>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KSXCLLZ');</script>
<!-- End Google Tag Manager -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="fb:app_id" content="1236171016488428" />
<meta property="og:type" content="profile" />
<meta property="og:url" content="https://lvdb.lv/vaditaji/cf5ab964-1d0d-0fab-0fc7-7767cf507cb7" />
<meta property="og:title" content="Nadīna Neimane-Gardoviča" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@lvdb_lv" />
<meta name="msvalidate.01" content="CD405DAD5EA4CF65237EAB3E933C6C74" />
<title>Nadīna Neimane-Gardoviča</title>
<meta itemprop='name' content="lvdb.lv">
<link rel="canonical" href="https://lvdb.lv" itemprop="url">
<link rel="alternate" hreflang="lv-LV" href="https://lvdb.lv">
<meta name="theme-color" content="#f4c671">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700&subset=latin-ext" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css" />
<link rel="stylesheet" href="/static/style.css" />
<link rel="icon" href="images/favicon.png">
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KSXCLLZ"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '1236171016488428',
cookie : true,
xfbml : true,
version : 'v2.8'
});
FB.AppEvents.logPageView();
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="background">
<div class="header-background"></div>
</div>
<div class="main-section" itemscope itemtype="http://schema.org/Person">
<!-- <header>
<div class="header__hero"></div>
<div class="header__main-info-holder">
<div class="header__main-info">
<div class="image"></div>
<span class="name-row">
<h1 class="group-name" itemprop="name">Nadīna Neimane-Gardoviča</h1>
</span>
</div>
</div> -->
</header>
<main>
<h1 itemprop="name">Nadīna Neimane-Gardoviča</h1>
<section>
<h2>Kolektīvi</h2>
<ul class="property-list">
<li class="property" itemprop="affiliation brand memberOf worksFor" itemscope itemtype="http://schema.org/DanceGroup">
<a href="/kolektivi/Auda" itemprop="url sameAs mainEntityOfPage" title="Rīgas pašvaldības Kultūras iestāžu apvienības Kultūras pils "Ziemeļblāzma" vidējās paaudzes deju kolektīvs "Auda"">
<span itemprop="name">Auda</span>
</a>
</li>
</ul>
</section>
</main>
</div>
</body>
</html>
|
klavs/db-lv
|
docs/vaditaji/cf5ab964-1d0d-0fab-0fc7-7767cf507cb7.html
|
HTML
|
mit
| 4,458
|
#region Copyright
// DotNetNuke® - https://www.dnnsoftware.com
// Copyright (c) 2002-2018
// by DotNetNuke Corporation
// All Rights Reserved
#endregion
using System;
using System.Collections;
using System.Linq;
using System.Web.UI.WebControls;
using DotNetNuke.Instrumentation;
using DotNetNuke.Services.FileSystem;
using DotNetNuke.Services.Localization;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
namespace DotNetNuke.Providers.FolderProviders.AzureFolderProvider
{
///<summary>
/// Windows Azure Storage Settings Control
///</summary>
public partial class Settings : FolderMappingSettingsControlBase
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof (Settings));
#region Overrided Methods
/// <summary>
/// Loads concrete settings.
/// </summary>
/// <param name="folderMappingSettings">The Hashtable containing the folder mapping settings.</param>
public override void LoadSettings(Hashtable folderMappingSettings)
{
var folderProvider = FolderProvider.Instance(Constants.FolderProviderType);
if (folderMappingSettings.ContainsKey(Constants.AccountName))
{
tbAccountName.Text = folderProvider.GetEncryptedSetting(folderMappingSettings, Constants.AccountName);
}
if (folderMappingSettings.ContainsKey(Constants.AccountKey))
{
tbAccountKey.Text = folderProvider.GetEncryptedSetting(folderMappingSettings, Constants.AccountKey);
}
if (tbAccountName.Text.Length > 0 && tbAccountKey.Text.Length > 0)
{
var bucketName = "";
if (folderMappingSettings.ContainsKey(Constants.Container))
{
bucketName = folderMappingSettings[Constants.Container].ToString();
}
LoadContainers();
var bucket = ddlContainers.Items.FindByText(bucketName);
if (bucket != null)
{
ddlContainers.SelectedIndex = ddlContainers.Items.IndexOf(bucket);
}
}
if (folderMappingSettings.ContainsKey(Constants.UseHttps))
{
chkUseHttps.Checked = bool.Parse(folderMappingSettings[Constants.UseHttps].ToString());
}
chkDirectLink.Checked = !folderMappingSettings.ContainsKey(Constants.DirectLink) || folderMappingSettings[Constants.DirectLink].ToString().ToLowerInvariant() == "true";
if (folderMappingSettings.ContainsKey(Constants.CustomDomain))
{
tbCustomDomain.Text = folderProvider.GetEncryptedSetting(folderMappingSettings, Constants.CustomDomain);
}
if (folderMappingSettings.ContainsKey(Constants.SyncBatchSize) && folderMappingSettings[Constants.SyncBatchSize] != null)
{
tbSyncBatchSize.Text = folderMappingSettings[Constants.SyncBatchSize].ToString();
}
else
{
tbSyncBatchSize.Text = Constants.DefaultSyncBatchSize.ToString();
}
}
/// <summary>
/// Updates concrete settings for the specified folder mapping.
/// </summary>
/// <param name="folderMappingID">The folder mapping identifier.</param>
public override void UpdateSettings(int folderMappingID)
{
Page.Validate();
if (!Page.IsValid)
{
throw new Exception();
}
var folderMappingController = FolderMappingController.Instance;
var folderMapping = folderMappingController.GetFolderMapping(folderMappingID);
var accountName = GetAccountName();
var accountKey = GetAccountKey();
var container = GetContainer();
var useHttps = GetUseHttps();
var customDomain = GetCustomDomain();
var synchBatchSize = GetSynchBatchSize();
if (AreThereFolderMappingsWithSameSettings(folderMapping, accountName, container))
{
valContainerName.ErrorMessage = Localization.GetString("MultipleFolderMappingsWithSameSettings.ErrorMessage", LocalResourceFile);
valContainerName.IsValid = false;
throw new Exception();
}
folderMapping.FolderMappingSettings[Constants.AccountName] = accountName;
folderMapping.FolderMappingSettings[Constants.AccountKey] = accountKey;
folderMapping.FolderMappingSettings[Constants.Container] = container;
folderMapping.FolderMappingSettings[Constants.UseHttps] = useHttps;
folderMapping.FolderMappingSettings[Constants.DirectLink] = chkDirectLink.Checked;
folderMapping.FolderMappingSettings[Constants.CustomDomain] = customDomain;
folderMapping.FolderMappingSettings[Constants.SyncBatchSize] = synchBatchSize;
folderMappingController.UpdateFolderMapping(folderMapping);
}
#endregion
#region Private Methods
private static bool AreThereFolderMappingsWithSameSettings(FolderMappingInfo folderMapping, string accountName, string container)
{
var folderMappingController = FolderMappingController.Instance;
var folderMappings = folderMappingController.GetFolderMappings(folderMapping.PortalID);
return folderMappings
.Where(fm => fm.FolderMappingID != folderMapping.FolderMappingID && fm.FolderProviderType == folderMapping.FolderProviderType)
.Any(fm => fm.FolderMappingSettings[Constants.AccountName].ToString().Equals(accountName, StringComparison.InvariantCulture) &&
fm.FolderMappingSettings[Constants.Container].ToString().Equals(container, StringComparison.InvariantCultureIgnoreCase));
}
private string GetUseHttps()
{
return chkUseHttps.Checked.ToString();
}
private string GetContainer()
{
string container;
if (SelectContainerPanel.Visible)
{
container = ddlContainers.SelectedValue;
}
else
{
container = tbContainerName.Text.Trim().ToLowerInvariant();
if (!CreateContainer(container)) throw new Exception();
}
return container;
}
private bool CreateContainer(string containerName)
{
var accountName = tbAccountName.Text.Trim();
var accountKey = tbAccountKey.Text.Trim();
var useHttps = chkUseHttps.Checked;
StorageCredentials sc;
try
{
sc = new StorageCredentials(accountName, accountKey);
}
catch (Exception ex)
{
Logger.Error(ex);
valContainerName.ErrorMessage = Localization.GetString("AuthenticationFailure.ErrorMessage", LocalResourceFile);
valContainerName.IsValid = false;
return false;
}
var csa = new CloudStorageAccount(sc, useHttps);
var blobClient = csa.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
try
{
if (container.CreateIfNotExists())
{
var permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);
}
return true;
}
catch (StorageException ex)
{
if (ex.RequestInformation.ExtendedErrorInformation != null)
{
switch (ex.RequestInformation.ExtendedErrorInformation.ErrorCode)
{
case "AccountNotFound":
valContainerName.ErrorMessage = Localization.GetString("AccountNotFound.ErrorMessage",
LocalResourceFile);
break;
case "AuthenticationFailure":
valContainerName.ErrorMessage = Localization.GetString(
"AuthenticationFailure.ErrorMessage", LocalResourceFile);
break;
case "AccessDenied":
valContainerName.ErrorMessage = Localization.GetString("AccessDenied.ErrorMessage",
LocalResourceFile);
break;
case "ContainerAlreadyExists":
return true;
default:
Logger.Error(ex);
valContainerName.ErrorMessage = Localization.GetString("NewContainer.ErrorMessage",
LocalResourceFile);
break;
}
}
else
{
valContainerName.ErrorMessage = ex.RequestInformation.HttpStatusMessage ?? ex.Message;
}
}
catch (Exception ex)
{
Logger.Error(ex);
valContainerName.ErrorMessage = Localization.GetString("NewContainer.ErrorMessage", LocalResourceFile);
}
valContainerName.IsValid = false;
return false;
}
private string GetAccountKey()
{
return FolderProvider.Instance(Constants.FolderProviderType).EncryptValue(tbAccountKey.Text);
}
private string GetAccountName()
{
return FolderProvider.Instance(Constants.FolderProviderType).EncryptValue(tbAccountName.Text);
}
private string GetCustomDomain()
{
return FolderProvider.Instance(Constants.FolderProviderType).EncryptValue(tbCustomDomain.Text);
}
private string GetSynchBatchSize()
{
return tbSyncBatchSize.Text;
}
private void LoadContainers()
{
var accountName = tbAccountName.Text.Trim();
var accountKey = tbAccountKey.Text.Trim();
var useHttps = chkUseHttps.Checked;
StorageCredentials sc;
try
{
sc = new StorageCredentials(accountName, accountKey);
}
catch (Exception ex)
{
Logger.Error(ex);
valContainerName.ErrorMessage = Localization.GetString("AuthenticationFailure.ErrorMessage", LocalResourceFile);
valContainerName.IsValid = false;
return;
}
var csa = new CloudStorageAccount(sc, useHttps);
var blobClient = csa.CreateCloudBlobClient();
try
{
foreach (var container in blobClient.ListContainers())
{
ddlContainers.Items.Add(container.Name);
}
}
catch (StorageException ex)
{
if(ex.RequestInformation.ExtendedErrorInformation != null)
{
switch (ex.RequestInformation.ExtendedErrorInformation.ErrorCode)
{
case "AuthenticationFailure":
valContainerName.ErrorMessage = Localization.GetString("AuthenticationFailure.ErrorMessage", LocalResourceFile);
break;
default:
Logger.Error(ex);
valContainerName.ErrorMessage = Localization.GetString("ListContainers.ErrorMessage", LocalResourceFile);
break;
}
}
else
{
valContainerName.ErrorMessage = ex.RequestInformation.HttpStatusMessage ?? ex.Message;
}
valContainerName.IsValid = false;
}
catch (Exception ex)
{
Logger.Error(ex);
valContainerName.ErrorMessage = Localization.GetString("ListContainers.ErrorMessage", LocalResourceFile);
valContainerName.IsValid = false;
}
}
#endregion
#region Event Handlers
/// <summary>
/// </summary>
protected void ddlContainers_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlContainers.SelectedIndex != 1) return;
if (tbAccountName.Text.Trim().Length > 0 && tbAccountKey.Text.Trim().Length > 0)
{
ddlContainers.Items.Clear();
ddlContainers.Items.Add(Localization.GetString("SelectContainer", LocalResourceFile));
ddlContainers.Items.Add(Localization.GetString("RefreshContainerList", LocalResourceFile));
LoadContainers();
if (ddlContainers.Items.Count == 3)
{
// If there is only one container, then select it
ddlContainers.SelectedValue = ddlContainers.Items[2].Value;
}
}
else
{
valContainerName.ErrorMessage = Localization.GetString("CredentialsRequired.ErrorMessage", LocalResourceFile);
valContainerName.IsValid = false;
}
}
/// <summary>
/// </summary>
protected void btnNewContainer_Click(object sender, EventArgs e)
{
SelectContainerPanel.Visible = false;
CreateContainerPanel.Visible = true;
}
/// <summary>
/// </summary>
protected void btnSelectExistingContainer_Click(object sender, EventArgs e)
{
SelectContainerPanel.Visible = true;
CreateContainerPanel.Visible = false;
}
/// <summary>
/// </summary>
protected void valContainerName_ServerValidate(object source, ServerValidateEventArgs args)
{
if (SelectContainerPanel.Visible)
{
if (ddlContainers.SelectedIndex > 1)
{
args.IsValid = true;
return;
}
}
else
{
if (tbContainerName.Text.Trim().Length > 0)
{
args.IsValid = true;
return;
}
}
valContainerName.ErrorMessage = Localization.GetString("valContainerName.ErrorMessage", LocalResourceFile);
args.IsValid = false;
}
#endregion
}
}
|
RichardHowells/Dnn.Platform
|
DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs
|
C#
|
mit
| 15,129
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import <IDEKit/IDETemplateInstantiationAssistant.h>
#import "NSComboBoxDataSource.h"
@class NSArray, NSMutableDictionary, NSString, NSTextField, NSView;
@interface IDETemplateOptionsAssistant : IDETemplateInstantiationAssistant <NSComboBoxDataSource>
{
NSView *_mainView;
NSArray *_classNames;
NSMutableDictionary *_controlsForOptionIds;
BOOL _canGoForward;
NSTextField *_firstTextField;
NSArray *_allSortedOptions;
}
- (void).cxx_destruct;
- (void)_setAccessibilityForCell:(id)arg1 withOption:(id)arg2 prefix:(id)arg3;
- (void)_setControl:(id)arg1 forOptionIdentifier:(id)arg2;
- (id)additionalOptions;
@property(readonly) NSArray *allSortedOptions; // @synthesize allSortedOptions=_allSortedOptions;
- (id)assistantTitle;
@property BOOL canGoForward; // @synthesize canGoForward=_canGoForward;
- (id)classNamesForComboBox:(id)arg1;
- (id)comboBox:(id)arg1 completedString:(id)arg2;
- (unsigned long long)comboBox:(id)arg1 indexOfItemWithStringValue:(id)arg2;
- (id)comboBox:(id)arg1 objectValueForItemAtIndex:(long long)arg2;
- (id)controlForOptionIdentifier:(id)arg1;
- (id)createControlForOption:(id)arg1;
- (id)createLabelForOption:(id)arg1;
@property(retain) NSTextField *firstTextField; // @synthesize firstTextField=_firstTextField;
- (void)loadView;
- (id)nextAssistantIdentifier;
- (long long)numberOfItemsInComboBox:(id)arg1;
- (double)requiredViewSpacingForOption:(id)arg1;
- (void)restoreSelectionFromUserDefaults;
- (void)setAssistantContext:(id)arg1;
- (void)setupOptionViews;
- (void)updateOptions:(id)arg1;
- (void)viewDidInstall;
- (void)viewWillUninstall;
- (void)writeStateToUserDefaults;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
|
orta/AxeMode
|
XcodeHeaders/IDEKit/IDETemplateOptionsAssistant.h
|
C
|
mit
| 1,996
|
/* eslint no-sync: 0 */
const fs = require("fs");
const path = require("path");
const Logger = require("./Log");
const Plugin = require("./Plugin");
// A small utility functor to find a plugin with a given name
const nameMatches = targetName => pl => pl.plugin.name.toLowerCase() === targetName.toLowerCase();
const SYNC_INTERVAL = 5000;
function messageIsCommand(message) {
if (!message.entities) return;
const entity = message.entities[0];
return entity.offset === 0 && entity.type === "bot_command";
}
// Note: we only parse commands at the start of the message,
// therefore we suppose entity.offset = 0
function parseCommand(message) {
const entity = message.entities[0];
const rawCommand = message.text.substring(1, entity.length);
let command;
if (rawCommand.search("@") === -1)
command = rawCommand;
else
command = rawCommand.substring(0, rawCommand.search("@"));
let args = [];
if (message.text.length > entity.length) {
args = message.text.slice(entity.length + 1).split(" ");
}
return {args, command};
}
module.exports = class PluginManager {
constructor(bot, config, auth) {
this.bot = bot;
this.log = new Logger("PluginManager", config);
this.auth = auth;
this.plugins = [];
this.config = config;
const events = Object.keys(Plugin.handlerNames)
// We handle the message event by ourselves.
.filter(prop => prop !== "message")
// Events beginning with an underscore (eg. _command) are internal.
.filter(prop => prop[0] !== "_");
// Registers a handler for every Telegram event.
// It runs the message through the proxy and forwards it to the plugin manager.
for (const eventName of events) {
bot.on(
eventName,
async message => {
// const messageID = message.message_id + '@' + message.chat.id;
// console.time(messageID);
this.parseHardcoded(message);
try {
await Promise.all(this.plugins
.filter(plugin => plugin.plugin.isProxy)
.map(plugin => plugin.proxy(eventName, message))
);
} catch (err) {
if (err)
this.log.error("Message rejected with error", err);
}
try {
await this.emit("message", message);
await this.emit(eventName, message);
this.log.debug("Message chain completed.");
} catch (e) {
if (!e) {
this.log.error("Message chain failed with no error message.");
this.bot.sendMessage(message.chat.id, "An error occurred.");
return;
}
this.log.error(e);
this.bot.sendMessage(message.chat.id, e.stack.split("\n").slice(0, 2).join("\n"));
}
// console.timeEnd(messageID);
}
);
}
}
parseHardcoded(message) {
// Hardcoded commands
if (!messageIsCommand(message)) return;
const {command, args: [pluginName, targetChat]} = parseCommand(message);
// Skip everything if we're not interested in this command
if (command !== "help"
&& command !== "start"
&& command !== "plugins"
&& command !== "enable"
&& command !== "disable") return;
const response = this.processHardcoded(command, pluginName, targetChat, message);
this.bot.sendMessage(message.chat.id, response, {
parse_mode: "markdown",
disable_web_page_preview: true
});
}
processHardcoded(command, pluginName, targetChat, message) {
if (command === "start") {
let text = `*Nikoro* v${require("../package.json").version}
Nikoro is a plugin-based Telegram bot. To get started, use /help to find out how to use the currently active plugins.`;
if (this.auth.isOwner(message.from.id))
text += `\n\nYou can also use /plugins for a list of available plugins, or browse the [user guide](https://telegram-bot-node.github.io/Nikoro/user.html) for more information on this bot's features.`;
return text;
}
if (command === "help") {
const availablePlugins = this.plugins
.map(pl => pl.plugin)
.filter(pl => !pl.isHidden);
if (!pluginName)
return "The following plugins are enabled:\n\n" + availablePlugins
.map(pl => `*${pl.name}*`)
.join("\n") + "\n\nFor help about a specific plugin, use /help PluginName.";
const plugin = availablePlugins
.find(pl => pl.name.toLowerCase() === pluginName.toLowerCase());
if (!plugin)
return "No such plugin.";
return `*${plugin.name}* - ${plugin.description}\n\n${plugin.help}`;
}
if (command === "plugins") {
const pluginPath = path.join(__dirname, "plugins");
const files = fs.readdirSync(pluginPath).map(filename => filename.replace(/\.js$/, ""));
const plugins = files.map(filename => {
try {
const plugin = require(path.join(pluginPath, filename), false).plugin;
return {
name: filename,
description: plugin.description
};
} catch (e) {
let message = e.message;
message = message.replace(/^Cannot find module '([^']+)'$/, "Must install `$1` first");
return {
name: `${filename}`,
disabled: message
};
}
});
// Does the list of plugins contain the given name?
const isEnabled = pl => this.plugins.some(nameMatches(pl.name))
const enabled = plugins
.filter(pl => isEnabled(pl))
.map(pl => `*${pl.name}*: ${pl.description}`)
.join("\n");
const available = plugins
.filter(pl => !isEnabled(pl))
.map(pl => `*${pl.name}*` + (pl.disabled ? ` (${pl.disabled})` : `: ${pl.description}`))
.join("\n");
return "Enabled:\n" + enabled + "\n\nAvailable:\n" + available + "\n\nUse \"/enable PluginName\" to load a plugin.";
}
if (!this.auth.isOwner(message.from.id, message.chat.id))
return "Insufficient privileges (owner required).";
// Syntax: /("enable"|"disable") pluginName [targetChat|"chat"]
// The string "chat" will enable the plugin in the current chat.
if (targetChat === "chat") targetChat = message.chat.id;
targetChat = Number(targetChat);
// Checks if it is already in this.plugins
const isGloballyEnabled = this.plugins.some(nameMatches(pluginName));
switch (command) {
case "enable":
if (targetChat) {
try {
this.loadAndAdd(pluginName);
const plugin = this.plugins.find(nameMatches(pluginName));
plugin.blacklist.delete(targetChat);
return `Plugin enabled successfully for chat ${targetChat}.`;
} catch (e) {
this.log.warn(e);
if (e.message === "No such file.")
return "No such plugin.\n\nIf you can't find the plugin you want, try running /plugins.";
return "Couldn't load plugin: " + e.message;
}
}
if (isGloballyEnabled)
return "Plugin already enabled.";
this.log.info(`Enabling ${pluginName} from message interface`);
try {
this.loadAndAdd(pluginName);
return "Plugin enabled successfully.";
} catch (e) {
this.log.warn(e);
if (e.message === "No such file.")
return "No such plugin.\n\nIf you can't find the plugin you want, try running /plugins.";
if (!/^Cannot find module/.test(e.message))
return "Couldn't load plugin, check console for errors.";
return e.message.replace(/Cannot find module '([^']+)'/, "The plugin has a missing dependency: `$1`");
}
case "disable":
if (targetChat) {
if (!isGloballyEnabled)
return "Plugin isn't enabled.";
const plugin = this.plugins.find(nameMatches(pluginName));
plugin.blacklist.add(targetChat);
return `Plugin disabled successfully for chat ${targetChat}.`;
}
if (isGloballyEnabled) {
const outcome = this.removePlugin(pluginName);
return outcome ? "Plugin disabled successfully." : "An error occurred.";
}
return "Plugin already disabled.";
}
}
// Instantiates the plugin.
// Case-insensitive.
// Returns the plugin itself.
loadPlugin(_pluginName) {
// Find a matching filename, case-insensitively
const files = fs.readdirSync(path.join(__dirname, "plugins")).map(filename => filename.replace(/\.js$/, ""));
const pluginName = files.find(filename => filename.toLowerCase() === _pluginName.toLowerCase());
if (!pluginName)
throw new Error("No such file.");
const pluginPath = path.join(__dirname, "plugins", pluginName);
/* Invalidates the require() cache.
* This allows for "hot fixes" to plugins: just /disable it, make the
* required changes, and /enable it again.
* If the cache wasn't invalidated, the plugin would be loaded from
* cache rather than from disk, meaning that your changes wouldn't apply.
* Method: https://stackoverflow.com/a/16060619
*/
delete require.cache[require.resolve(pluginPath)];
const ThisPlugin = require(pluginPath);
this.log.debug(`Required ${pluginName}`);
// Load the blacklist and database from disk
const databasePath = PluginManager.getDatabasePath(pluginName);
let db = {};
let blacklist = [];
if (fs.existsSync(databasePath)) {
const data = JSON.parse(fs.readFileSync(databasePath, "utf8"));
db = data.db;
blacklist = data.blacklist;
}
const loadedPlugin = new ThisPlugin({
db,
blacklist,
bot: this.bot,
config: this.config,
auth: this.auth
});
// Bind all the methods from the bot API
for (const method of Object.getOwnPropertyNames(Object.getPrototypeOf(this.bot))) {
if (typeof this.bot[method] !== "function") continue;
if (method === "constructor" || method === "on" || method === "onText") continue;
if (/^_/.test(method)) continue; // Do not expose internal methods
this.log.debug(`Binding ${method}`);
loadedPlugin[method] = this.bot[method].bind(this.bot);
}
this.log.debug(`Created ${pluginName}.`);
return loadedPlugin;
}
// Adds the plugin to the list of active plugins
addPlugin(loadedPlugin) {
this.plugins.push(loadedPlugin);
this.log.verbose(`Added ${loadedPlugin.plugin.name}.`);
}
// Returns true if the plugin was added successfully, false otherwise.
loadAndAdd(pluginName, persist = true) {
try {
const plugin = this.loadPlugin(pluginName);
this.log.debug(pluginName + " loaded correctly.");
this.addPlugin(plugin);
if (persist) {
this.config.activePlugins.push(pluginName);
fs.writeFileSync("config.json", JSON.stringify(this.config, null, 4));
}
} catch (e) {
this.log.warn(`Failed to initialize plugin ${pluginName}.`);
throw e;
}
}
// Load and add every plugin in the list.
loadPlugins(pluginNames, persist = true) {
this.log.verbose(`Loading and adding ${pluginNames.length} plugins...`);
Error.stackTraceLimit = 5; // Avoid printing useless data in stack traces
const log = pluginNames.map(name => {
try {
this.loadAndAdd(name, persist);
return true;
} catch (e) {
this.log.warn(e);
return false;
}
});
if (log.some(result => result !== true)) {
this.log.warn("Some plugins couldn't be loaded.");
}
Error.stackTraceLimit = 10; // Reset to default value
}
// Returns true if at least one plugin was removed
removePlugin(pluginName, persist = true) {
this.log.verbose(`Removing plugin ${pluginName}`);
if (persist) {
this.config.activePlugins = this.config.activePlugins.filter(name => !nameMatches(name));
fs.writeFileSync("config.json", JSON.stringify(this.config, null, 4));
}
const prevPluginNum = this.plugins.length;
const isCurrentPlugin = nameMatches(pluginName);
this.plugins.filter(isCurrentPlugin).forEach(pl => pl.stop());
this.plugins = this.plugins.filter(pl => !isCurrentPlugin(pl));
const curPluginNum = this.plugins.length;
return (prevPluginNum - curPluginNum) > 0;
}
stopPlugins() {
return Promise.all(this.plugins.map(pl => pl.stop()));
}
static getDatabasePath(pluginName) {
return path.join(__dirname, "..", "db", "plugin_" + pluginName + ".json");
}
startSynchronization() {
this.synchronizationInterval = setInterval(() => {
this.log.debug("Starting synchronization");
this.auth.synchronize();
this.plugins.forEach(plugin => {
fs.writeFile(
PluginManager.getDatabasePath(plugin.plugin.name),
JSON.stringify({
db: plugin.db,
blacklist: Array.from(plugin.blacklist)
}),
err => {
if (err) {
this.log.error("Error synchronizing the database", err);
}
}
);
});
}, SYNC_INTERVAL);
}
stopSynchronization() {
if (this.synchronizationInterval) {
clearInterval(this.synchronizationInterval);
}
}
emit(event, message) {
this.log.debug(`Triggered event ${event}`);
let cmdPromise;
if (event !== "message") {
// Command emitter
if (messageIsCommand(message)) {
const {command, args} = parseCommand(message);
cmdPromise = this._emit("_command", {message, command, args});
} else if (message.query !== undefined) {
const parts = message.query.split(" ");
const command = parts[0].toLowerCase();
const args = parts.length > 1 ? parts.slice(1) : [];
cmdPromise = this._emit("_inline_command", {message, command, args});
}
}
const msgPromise = this._emit(event, {message});
return Promise.all([cmdPromise, msgPromise]);
}
_emit(event, data) {
const handlerName = Plugin.handlerNames[event];
return Promise.all(this.plugins
// If the plugin exposes a listener
.filter(pl => handlerName in pl)
// If the plugin is disabled in this chat
.filter(pl => ("chat" in data.message) && !pl.blacklist.has(data.message.chat.id))
.map(pl => {
try {
const ret = pl[handlerName](data)
const smartReply = pl.smartReply.bind(pl);
if (ret && ret.then)
return ret.then(x => smartReply(x, data.message));
return smartReply(ret, data.message);
} catch (e) {
return Promise.reject(e);
}
})
);
}
};
|
crisbal/Telegram-Bot-Node
|
src/PluginManager.js
|
JavaScript
|
mit
| 16,897
|
---
title: இழந்ததைத் திரும்பப்பெறுதல்
date: 07/10/2020
---
சர்ப்பம் சொன்னதின்படி செய்ய ஆதாமும் ஏவாளும் தீர்மானித்த போது, அதன் விளைவுகளை அவர்கள் சந்தித்தார்கள். தேவனுடைய வகுப்பறையை விட்டு அவர்கள் வெளியேற வேண்டியதாயிற்று. பாவத்தால் ஆதாமும் ஏவா ளும் இழந்துபோனவை என்ன? விழுகையைப் புரிந்துகொண்டால், இன்றைய காலத்தில் கல்வியின்நோக்கம் என்ன என்பதையும் புரிந்துகொள்ளலாம். குறை யுள்ள உலகில் மனிதர் வாழ்வதால், கல்வியின் நோக்கம் இன்னமும் முக்கிய மாக உள்ளது.
விழுகைக்குமுன் ஆதாமும் ஏவாளும் தம்மோடு நெருக்கமாகி, தம் குணத்தைப் புரிந்துகொள்ளவே, கல்வியை தேவன் ஏற்படுத்தியிருந்தார். அது இப்போதும் கல்வியின் நோக்கமாக நீடிக்கிறது; மேலும் தேவசாயலை அது மீண் டும் மனிதரில் உருவாக்கவேண்டும். சரீரப்பிரகாரமாக அவர்கள் தேவனுடைய பிரசன்னத்தைவிட்டு விலகினாலும், அவர்கள் இன்னமும் அவருடைய அன் பைப் புரிந்துகொள்ள முடியும். ஜெபம், ஆராதனை, வேத ஆராய்ச்சிமூலம் இப் போது நாமும் நம் தேவனிடம் நெருங்கிச் சேரமுடியும்.
எல்லாம் கைவிட்டுச் சென்றுவிடவில்லை என்கிற நற்செய்தியைத்தான் மீட் பின் திட்டம் காட்டுகிறது. இரட்சிப்பின் நம்பிக்கையும், புதுப்பித்தலின் நம்பிக் கையும் நமக்கு உண்டு. கிறிஸ்தவக் கல்வியானது இயேசுவையும், அவர் நமக் காகச் செய்ததையும், அவர் தருகிற புதுப் பித்தலையும் நமக்குக் காட்டவேண்டும்.
`ஏதேன் தோட்டத்தைவிட்டு மனிதர் வெளியேற்றப்பட்டபோது, அவர்கள் இழந்த வற்றில் எவற்றை நாம் மீண்டும் பெறமுடியும்? 2பேதுரு 1:3–11. நம் வாழ்வில் தேவ சாயல் புதுப்பிக்கப்படுவதற்கு நாம் என்ன செய்யவேண்டும் என்று பேதுரு எழுது கிறார்?`
இயேசுவின்மூலம் ‘ஜீவனுக்கும் தேவபக்திக்கும் வேண்டிய யாவும்’ நமக் குக் கொடுக்கப்பட்டுள்ளது. என்ன ஒரு வாக்குறுதி! அவற்றில் விசுவாசம், தைரியம், ஞானம், இச்சையடக்கம், பொறுமை போன்றவை உள்ளன. ஞானமும் அவற்றில் ஒன்று. இது கல்வியைச் சுட்டிக்காட்டுகிற ஒரு சொல். மெய்யான கல்வி மெய்யான ஞானத்திற்கு, அதாவது கிறிஸ்துவைக் குறித்த ஞானத்திற்கு வழிநடத்துகிறது. அதனால் நாம் அவரைப்போல மாறி, அவரைப்பற்றிய ஞானத்தை மற்றவர்களோடும் பகிர்ந்துகொள்ளலாம்.
`விலக்கப்பட்ட விருட்சமானது ‘நன்மைதீமை அறியத்தக்க’ விருட்சம் என்று அழைக்கப்பட்டதுபற்றிச் சிந்தியுங்கள். ஆதி 2:17. எல்லா ஞானமும் நல்லவை அல்ல என்பதுபற்றி என்ன தெரிகிறது? நல்ல ஞானத்திற்கும் கெட்ட ஞானத் திற்கும் இடையேயுள்ள வித்தியாசத்தை நாம் எவ்வாறு அறிந்துகொள்ளலாம்?`
|
imasaru/sabbath-school-lessons
|
src/ta/2020-04/02/05.md
|
Markdown
|
mit
| 5,604
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.