code stringlengths 3 1.05M | repo_name stringlengths 4 116 | path stringlengths 4 991 | language stringclasses 9
values | license stringclasses 15
values | size int32 3 1.05M |
|---|---|---|---|---|---|
<?php
/* TwigBundle:Exception:exception.xml.twig */
class __TwigTemplate_c061faeee9972f62acf4e273a452348269cc8ddb828f259c5646b0d6695496f7 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "<?xml version=\"1.0\" encoding=\"";
echo twig_escape_filter($this->env, $this->env->getCharset(), "html", null, true);
echo "\" ?>
<error code=\"";
// line 3
echo twig_escape_filter($this->env, (isset($context["status_code"]) ? $context["status_code"] : $this->getContext($context, "status_code")), "html", null, true);
echo "\" message=\"";
echo twig_escape_filter($this->env, (isset($context["status_text"]) ? $context["status_text"] : $this->getContext($context, "status_text")), "html", null, true);
echo "\">
";
// line 4
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "toarray", array()));
foreach ($context['_seq'] as $context["_key"] => $context["e"]) {
// line 5
echo " <exception class=\"";
echo twig_escape_filter($this->env, $this->getAttribute($context["e"], "class", array()), "html", null, true);
echo "\" message=\"";
echo twig_escape_filter($this->env, $this->getAttribute($context["e"], "message", array()), "html", null, true);
echo "\">
";
// line 6
$this->env->loadTemplate("TwigBundle:Exception:traces.xml.twig")->display(array("exception" => $context["e"]));
// line 7
echo " </exception>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['e'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 9
echo "</error>
";
}
public function getTemplateName()
{
return "TwigBundle:Exception:exception.xml.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 51 => 9, 44 => 7, 42 => 6, 35 => 5, 31 => 4, 25 => 3, 19 => 1,);
}
}
| sachin-agarwal-aws/master | app/cache/dev/twig/c0/61/faeee9972f62acf4e273a452348269cc8ddb828f259c5646b0d6695496f7.php | PHP | mit | 2,560 |
pinion.backend.renderer.CommentRenderer = (function($) {
var constr;
// public API -- constructor
constr = function(settings, backend) {
var _this = this,
data = settings.data;
this.$element = $("<div class='pinion-backend-renderer-CommentRenderer'></div>");
// TEXTWRAPPER
var $textWrapper = $("<div class='pinion-textWrapper'></div>")
.appendTo(this.$element);
// INFOS
$("<div class='pinion-comment-info'></div>")
// USER
.append("<div class='pinion-name'><span class='pinion-backend-icon-user'></span><span class='pinion-username'>"+data.name+"</span></div>")
// TIME
.append("<div class='pinion-time'><span class='pinion-backend-icon-clock'></span><span class='pinion-time-text'>"+data.created+"</span></div>")
.append("<div class='pinion-mail'><span class='pinion-backend-icon-mail'></span><a href='mailto:"+data.email+"' class='pinion-mail-adress'>"+data.email+"</a></div>")
.appendTo(this.$element);
// COMMENT
$("<div class='pinion-commentWrapper'><div class='pinion-comment-text'>"+data.text+"</div></div>")
.appendTo(this.$element);
var $activate = $("<div class='pinion-activate'><div class='pinion-icon'></div><div class='pinion-text'>"+pinion.translate("activate comment")+"</div></div>")
.click(function() {
if(_this.$element.hasClass("pinion-activated")) {
_this.setClean();
} else {
_this.setDirty();
}
_this.$element.toggleClass("pinion-activated")
});
// RENDERER BAR
var bar = [];
if(pinion.hasPermission("comment", "approve comment")) {
bar.push($activate);
}
if(pinion.hasPermission("comment", "delete comment")) {
bar.push(pinion.data.Delete.call(this, data, function() {
_this.info.deleted = true;
_this.fadeOut(300, function() {
_this.setDirty();
});
}));
}
if(!pinion.isEmpty(bar)) {
pinion.data.Bar.call(this, bar);
}
// INFO
pinion.data.Info.call(this, ["Time"], data);
// group events
settings.groupEvents = true;
}
// public API -- prototype
constr.prototype = {
constructor: pinion.backend.renderer.CommentRenderer,
init: function() {
this.info.id = this.settings.data.id;
},
reset: function() {
this.$element.removeClass("pinion-activated");
}
}
return constr;
}(jQuery));
| friedolinfoerder/pinion | modules/comment/backend/js/CommentRenderer.js | JavaScript | mit | 2,871 |
<?php
namespace Headoo\DropboxHelper\AbstractClass;
use Alorel\Dropbox\Response\ResponseAttribute;
use Headoo\DropboxHelper\Exception\NotFoundException;
/**
* Class DropboxHelper
* @package Headoo\CoreBundle\Helper
*/
class AbstractDropboxHelper extends AbstractExceptionMode
{
/**
* @param array $aObject
* @return string
*/
public static function getPath(array $aObject)
{
return isset($aObject[ResponseAttribute::PATH_LOWERCASE])
? $aObject[ResponseAttribute::PATH_LOWERCASE]
: '';
}
/**
* @param array $aObject
* @return bool
*/
public static function isFolder(array $aObject)
{
return (
isset($aObject[ResponseAttribute::DOT_TAG])
&& $aObject[ResponseAttribute::DOT_TAG] == 'folder'
);
}
/**
* @param array $aObject
* @return bool
*/
public static function isFile(array $aObject)
{
return (
isset($aObject[ResponseAttribute::DOT_TAG])
&& $aObject[ResponseAttribute::DOT_TAG] == 'file'
);
}
/**
* @param array $aObject
* @return bool
*/
public static function isDeleted(array $aObject)
{
return (
isset($aObject[ResponseAttribute::DOT_TAG])
&& $aObject[ResponseAttribute::DOT_TAG] == 'deleted'
);
}
/**
* @param string $sPath
* @return string
*/
protected static function normalizePath($sPath)
{
$sPath = trim($sPath, '/');
return ($sPath === '')
? ''
: '/' . $sPath;
}
/**
* @param \GuzzleHttp\Promise\PromiseInterface|\Psr\Http\Message\ResponseInterface
* @return bool
*/
protected static function getBoolResult($result = null)
{
/**
* In case of async is set to true:
* @var \GuzzleHttp\Promise\PromiseInterface $result
*/
if ($result instanceof \GuzzleHttp\Promise\PromiseInterface) {
return ($result->getState() !== 'REJECTED');
}
/**
* In case of async is set to false
* @var \Psr\Http\Message\ResponseInterface $result
*/
if ($result instanceof \Psr\Http\Message\ResponseInterface) {
return ($result->getStatusCode() === 200);
}
return false;
}
/**
* @param \Exception $e
* @param bool $exceptionMode
* @throws NotFoundException
*/
protected static function handlerException(\Exception $e, $exceptionMode = self::MODE_STRICT)
{
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
switch ($e->getCode()) {
# Folder/file not found with the given path
case 409:
if ($exceptionMode === self::MODE_SILENCE) {
return;
}
throw new NotFoundException('Folder not found: ' . $e->getMessage());
}
}
throw $e;
}
}
| Headoo/DropboxHelper | src/AbstractClass/AbstractDropboxHelper.php | PHP | mit | 3,049 |
namespace Company.App.Core.Controllers
{
using AutoMapper;
using Company.App.Core.Contracts;
using Company.App.Core.DTOs;
using Company.Data;
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
public class ManagerController : IManagerController
{
private readonly CompanyContext context;
private readonly IMapper mapper;
public ManagerController(CompanyContext context, IMapper mapper)
{
this.context = context;
this.mapper = mapper;
}
public ManagerDto GetManagerInfo(int employeeId)
{
var employee = context.Employees
.Include(x => x.ManagerEmployees)
.Where(e => e.Id == employeeId)
.SingleOrDefault();
if (employee == null)
{
throw new ArgumentException("Invalid Employee Id");
}
var managerDto = mapper.Map<ManagerDto>(employee);
return managerDto;
}
public void SetManager(int employeeId, int managerId)
{
var employee = context.Employees.Find(employeeId);
if (employee == null)
{
throw new ArgumentException("Provided Employee Id is invalid!");
}
var manager = context.Employees.Find(managerId);
if (manager == null)
{
throw new ArgumentException("Provided Manager Id is invalid!");
}
employee.Manager = manager;
context.SaveChanges();
}
}
}
| radoikoff/SoftUni | DB Advanced/Company/Company.App/Core/Controllers/ManagerController.cs | C# | mit | 1,676 |
/*
Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["dojox.lang.functional.scan"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojox.lang.functional.scan"] = true;
dojo.provide("dojox.lang.functional.scan");
dojo.require("dojox.lang.functional.lambda");
// This module adds high-level functions and related constructs:
// - "scan" family of functions
// Notes:
// - missing high-level functions are provided with the compatible API:
// scanl, scanl1, scanr, scanr1
// Defined methods:
// - take any valid lambda argument as the functional argument
// - operate on dense arrays
// - take a string as the array argument
// - take an iterator objects as the array argument (only scanl, and scanl1)
(function(){
var d = dojo, df = dojox.lang.functional, empty = {};
d.mixin(df, {
// classic reduce-class functions
scanl: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
// summary: repeatedly applies a binary function to an array from left
// to right using a seed value as a starting point; returns an array
// of values produced by foldl() at that point.
if(typeof a == "string"){ a = a.split(""); }
o = o || d.global; f = df.lambda(f);
var t, n, i;
if(d.isArray(a)){
// array
t = new Array((n = a.length) + 1);
t[0] = z;
for(i = 0; i < n; z = f.call(o, z, a[i], i, a), t[++i] = z);
}else if(typeof a.hasNext == "function" && typeof a.next == "function"){
// iterator
t = [z];
for(i = 0; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a)));
}else{
// object/dictionary
t = [z];
for(i in a){
if(!(i in empty)){
t.push(z = f.call(o, z, a[i], i, a));
}
}
}
return t; // Array
},
scanl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
// summary: repeatedly applies a binary function to an array from left
// to right; returns an array of values produced by foldl1() at that
// point.
if(typeof a == "string"){ a = a.split(""); }
o = o || d.global; f = df.lambda(f);
var t, n, z, first = true;
if(d.isArray(a)){
// array
t = new Array(n = a.length);
t[0] = z = a[0];
for(var i = 1; i < n; t[i] = z = f.call(o, z, a[i], i, a), ++i);
}else if(typeof a.hasNext == "function" && typeof a.next == "function"){
// iterator
if(a.hasNext()){
t = [z = a.next()];
for(var i = 1; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a)));
}
}else{
// object/dictionary
for(var i in a){
if(!(i in empty)){
if(first){
t = [z = a[i]];
first = false;
}else{
t.push(z = f.call(o, z, a[i], i, a));
}
}
}
}
return t; // Array
},
scanr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
// summary: repeatedly applies a binary function to an array from right
// to left using a seed value as a starting point; returns an array
// of values produced by foldr() at that point.
if(typeof a == "string"){ a = a.split(""); }
o = o || d.global; f = df.lambda(f);
var n = a.length, t = new Array(n + 1), i = n;
t[n] = z;
for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z);
return t; // Array
},
scanr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
// summary: repeatedly applies a binary function to an array from right
// to left; returns an array of values produced by foldr1() at that
// point.
if(typeof a == "string"){ a = a.split(""); }
o = o || d.global; f = df.lambda(f);
var n = a.length, t = new Array(n), z = a[n - 1], i = n - 1;
t[i] = z;
for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z);
return t; // Array
}
});
})();
}
| henry-gobiernoabierto/geomoose | htdocs/libs/dojo/release/geomoose2.6/dojox/lang/functional/scan.js | JavaScript | mit | 4,006 |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2013-2014 Bongger Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
using namespace std;
using namespace boost;
#include "script.h"
#include "keystore.h"
#include "bignum.h"
#include "key.h"
#include "main.h"
#include "sync.h"
#include "util.h"
bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubKey, const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType, int flags);
typedef vector<unsigned char> valtype;
static const valtype vchFalse(0);
static const valtype vchZero(0);
static const valtype vchTrue(1, 1);
static const CBigNum bnZero(0);
static const CBigNum bnOne(1);
static const CBigNum bnFalse(0);
static const CBigNum bnTrue(1);
static const size_t nMaxNumSize = 4;
CBigNum CastToBigNum(const valtype& vch)
{
if (vch.size() > nMaxNumSize)
throw runtime_error("CastToBigNum() : overflow");
// Get rid of extra leading zeros
return CBigNum(CBigNum(vch).getvch());
}
bool CastToBool(const valtype& vch)
{
for (unsigned int i = 0; i < vch.size(); i++)
{
if (vch[i] != 0)
{
// Can be negative zero
if (i == vch.size()-1 && vch[i] == 0x80)
return false;
return true;
}
}
return false;
}
//
// Script is a stack machine (like Forth) that evaluates a predicate
// returning a bool indicating valid or not. There are no loops.
//
#define stacktop(i) (stack.at(stack.size()+(i)))
#define altstacktop(i) (altstack.at(altstack.size()+(i)))
static inline void popstack(vector<valtype>& stack)
{
if (stack.empty())
throw runtime_error("popstack() : stack empty");
stack.pop_back();
}
const char* GetTxnOutputType(txnouttype t)
{
switch (t)
{
case TX_NONSTANDARD: return "nonstandard";
case TX_PUBKEY: return "pubkey";
case TX_PUBKEYHASH: return "pubkeyhash";
case TX_SCRIPTHASH: return "scripthash";
case TX_MULTISIG: return "multisig";
}
return NULL;
}
const char* GetOpName(opcodetype opcode)
{
switch (opcode)
{
// push value
case OP_0 : return "0";
case OP_PUSHDATA1 : return "OP_PUSHDATA1";
case OP_PUSHDATA2 : return "OP_PUSHDATA2";
case OP_PUSHDATA4 : return "OP_PUSHDATA4";
case OP_1NEGATE : return "-1";
case OP_RESERVED : return "OP_RESERVED";
case OP_1 : return "1";
case OP_2 : return "2";
case OP_3 : return "3";
case OP_4 : return "4";
case OP_5 : return "5";
case OP_6 : return "6";
case OP_7 : return "7";
case OP_8 : return "8";
case OP_9 : return "9";
case OP_10 : return "10";
case OP_11 : return "11";
case OP_12 : return "12";
case OP_13 : return "13";
case OP_14 : return "14";
case OP_15 : return "15";
case OP_16 : return "16";
// control
case OP_NOP : return "OP_NOP";
case OP_VER : return "OP_VER";
case OP_IF : return "OP_IF";
case OP_NOTIF : return "OP_NOTIF";
case OP_VERIF : return "OP_VERIF";
case OP_VERNOTIF : return "OP_VERNOTIF";
case OP_ELSE : return "OP_ELSE";
case OP_ENDIF : return "OP_ENDIF";
case OP_VERIFY : return "OP_VERIFY";
case OP_RETURN : return "OP_RETURN";
// stack ops
case OP_TOALTSTACK : return "OP_TOALTSTACK";
case OP_FROMALTSTACK : return "OP_FROMALTSTACK";
case OP_2DROP : return "OP_2DROP";
case OP_2DUP : return "OP_2DUP";
case OP_3DUP : return "OP_3DUP";
case OP_2OVER : return "OP_2OVER";
case OP_2ROT : return "OP_2ROT";
case OP_2SWAP : return "OP_2SWAP";
case OP_IFDUP : return "OP_IFDUP";
case OP_DEPTH : return "OP_DEPTH";
case OP_DROP : return "OP_DROP";
case OP_DUP : return "OP_DUP";
case OP_NIP : return "OP_NIP";
case OP_OVER : return "OP_OVER";
case OP_PICK : return "OP_PICK";
case OP_ROLL : return "OP_ROLL";
case OP_ROT : return "OP_ROT";
case OP_SWAP : return "OP_SWAP";
case OP_TUCK : return "OP_TUCK";
// splice ops
case OP_CAT : return "OP_CAT";
case OP_SUBSTR : return "OP_SUBSTR";
case OP_LEFT : return "OP_LEFT";
case OP_RIGHT : return "OP_RIGHT";
case OP_SIZE : return "OP_SIZE";
// bit logic
case OP_INVERT : return "OP_INVERT";
case OP_AND : return "OP_AND";
case OP_OR : return "OP_OR";
case OP_XOR : return "OP_XOR";
case OP_EQUAL : return "OP_EQUAL";
case OP_EQUALVERIFY : return "OP_EQUALVERIFY";
case OP_RESERVED1 : return "OP_RESERVED1";
case OP_RESERVED2 : return "OP_RESERVED2";
// numeric
case OP_1ADD : return "OP_1ADD";
case OP_1SUB : return "OP_1SUB";
case OP_2MUL : return "OP_2MUL";
case OP_2DIV : return "OP_2DIV";
case OP_NEGATE : return "OP_NEGATE";
case OP_ABS : return "OP_ABS";
case OP_NOT : return "OP_NOT";
case OP_0NOTEQUAL : return "OP_0NOTEQUAL";
case OP_ADD : return "OP_ADD";
case OP_SUB : return "OP_SUB";
case OP_MUL : return "OP_MUL";
case OP_DIV : return "OP_DIV";
case OP_MOD : return "OP_MOD";
case OP_LSHIFT : return "OP_LSHIFT";
case OP_RSHIFT : return "OP_RSHIFT";
case OP_BOOLAND : return "OP_BOOLAND";
case OP_BOOLOR : return "OP_BOOLOR";
case OP_NUMEQUAL : return "OP_NUMEQUAL";
case OP_NUMEQUALVERIFY : return "OP_NUMEQUALVERIFY";
case OP_NUMNOTEQUAL : return "OP_NUMNOTEQUAL";
case OP_LESSTHAN : return "OP_LESSTHAN";
case OP_GREATERTHAN : return "OP_GREATERTHAN";
case OP_LESSTHANOREQUAL : return "OP_LESSTHANOREQUAL";
case OP_GREATERTHANOREQUAL : return "OP_GREATERTHANOREQUAL";
case OP_MIN : return "OP_MIN";
case OP_MAX : return "OP_MAX";
case OP_WITHIN : return "OP_WITHIN";
// crypto
case OP_RIPEMD160 : return "OP_RIPEMD160";
case OP_SHA1 : return "OP_SHA1";
case OP_SHA256 : return "OP_SHA256";
case OP_HASH160 : return "OP_HASH160";
case OP_HASH256 : return "OP_HASH256";
case OP_CODESEPARATOR : return "OP_CODESEPARATOR";
case OP_CHECKSIG : return "OP_CHECKSIG";
case OP_CHECKSIGVERIFY : return "OP_CHECKSIGVERIFY";
case OP_CHECKMULTISIG : return "OP_CHECKMULTISIG";
case OP_CHECKMULTISIGVERIFY : return "OP_CHECKMULTISIGVERIFY";
// expanson
case OP_NOP1 : return "OP_NOP1";
case OP_NOP2 : return "OP_NOP2";
case OP_NOP3 : return "OP_NOP3";
case OP_NOP4 : return "OP_NOP4";
case OP_NOP5 : return "OP_NOP5";
case OP_NOP6 : return "OP_NOP6";
case OP_NOP7 : return "OP_NOP7";
case OP_NOP8 : return "OP_NOP8";
case OP_NOP9 : return "OP_NOP9";
case OP_NOP10 : return "OP_NOP10";
// template matching params
case OP_PUBKEYHASH : return "OP_PUBKEYHASH";
case OP_PUBKEY : return "OP_PUBKEY";
case OP_INVALIDOPCODE : return "OP_INVALIDOPCODE";
default:
return "OP_UNKNOWN";
}
}
bool IsCanonicalPubKey(const valtype &vchPubKey) {
if (vchPubKey.size() < 33)
return error("Non-canonical public key: too short");
if (vchPubKey[0] == 0x04) {
if (vchPubKey.size() != 65)
return error("Non-canonical public key: invalid length for uncompressed key");
} else if (vchPubKey[0] == 0x02 || vchPubKey[0] == 0x03) {
if (vchPubKey.size() != 33)
return error("Non-canonical public key: invalid length for compressed key");
} else {
return error("Non-canonical public key: compressed nor uncompressed");
}
return true;
}
bool IsCanonicalSignature(const valtype &vchSig) {
// See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
// A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
// Where R and S are not negative (their first byte has its highest bit not set), and not
// excessively padded (do not start with a 0 byte, unless an otherwise negative number follows,
// in which case a single 0 byte is necessary and even required).
if (vchSig.size() < 9)
return error("Non-canonical signature: too short");
if (vchSig.size() > 73)
return error("Non-canonical signature: too long");
unsigned char nHashType = vchSig[vchSig.size() - 1] & (~(SIGHASH_ANYONECANPAY));
if (nHashType < SIGHASH_ALL || nHashType > SIGHASH_SINGLE)
return error("Non-canonical signature: unknown hashtype byte");
if (vchSig[0] != 0x30)
return error("Non-canonical signature: wrong type");
if (vchSig[1] != vchSig.size()-3)
return error("Non-canonical signature: wrong length marker");
unsigned int nLenR = vchSig[3];
if (5 + nLenR >= vchSig.size())
return error("Non-canonical signature: S length misplaced");
unsigned int nLenS = vchSig[5+nLenR];
if ((unsigned long)(nLenR+nLenS+7) != vchSig.size())
return error("Non-canonical signature: R+S length mismatch");
const unsigned char *R = &vchSig[4];
if (R[-2] != 0x02)
return error("Non-canonical signature: R value type mismatch");
if (nLenR == 0)
return error("Non-canonical signature: R length is zero");
if (R[0] & 0x80)
return error("Non-canonical signature: R value negative");
if (nLenR > 1 && (R[0] == 0x00) && !(R[1] & 0x80))
return error("Non-canonical signature: R value excessively padded");
const unsigned char *S = &vchSig[6+nLenR];
if (S[-2] != 0x02)
return error("Non-canonical signature: S value type mismatch");
if (nLenS == 0)
return error("Non-canonical signature: S length is zero");
if (S[0] & 0x80)
return error("Non-canonical signature: S value negative");
if (nLenS > 1 && (S[0] == 0x00) && !(S[1] & 0x80))
return error("Non-canonical signature: S value excessively padded");
return true;
}
bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType)
{
CAutoBN_CTX pctx;
CScript::const_iterator pc = script.begin();
CScript::const_iterator pend = script.end();
CScript::const_iterator pbegincodehash = script.begin();
opcodetype opcode;
valtype vchPushValue;
vector<bool> vfExec;
vector<valtype> altstack;
if (script.size() > 10000)
return false;
int nOpCount = 0;
bool fStrictEncodings = flags & SCRIPT_VERIFY_STRICTENC;
try
{
while (pc < pend)
{
bool fExec = !count(vfExec.begin(), vfExec.end(), false);
//
// Read instruction
//
if (!script.GetOp(pc, opcode, vchPushValue))
return false;
if (vchPushValue.size() > MAX_SCRIPT_ELEMENT_SIZE)
return false;
if (opcode > OP_16 && ++nOpCount > 201)
return false;
if (opcode == OP_CAT ||
opcode == OP_SUBSTR ||
opcode == OP_LEFT ||
opcode == OP_RIGHT ||
opcode == OP_INVERT ||
opcode == OP_AND ||
opcode == OP_OR ||
opcode == OP_XOR ||
opcode == OP_2MUL ||
opcode == OP_2DIV ||
opcode == OP_MUL ||
opcode == OP_DIV ||
opcode == OP_MOD ||
opcode == OP_LSHIFT ||
opcode == OP_RSHIFT)
return false; // Disabled opcodes.
if (fExec && 0 <= opcode && opcode <= OP_PUSHDATA4)
stack.push_back(vchPushValue);
else if (fExec || (OP_IF <= opcode && opcode <= OP_ENDIF))
switch (opcode)
{
//
// Push value
//
case OP_1NEGATE:
case OP_1:
case OP_2:
case OP_3:
case OP_4:
case OP_5:
case OP_6:
case OP_7:
case OP_8:
case OP_9:
case OP_10:
case OP_11:
case OP_12:
case OP_13:
case OP_14:
case OP_15:
case OP_16:
{
// ( -- value)
CBigNum bn((int)opcode - (int)(OP_1 - 1));
stack.push_back(bn.getvch());
}
break;
//
// Control
//
case OP_NOP:
case OP_NOP1: case OP_NOP2: case OP_NOP3: case OP_NOP4: case OP_NOP5:
case OP_NOP6: case OP_NOP7: case OP_NOP8: case OP_NOP9: case OP_NOP10:
break;
case OP_IF:
case OP_NOTIF:
{
// <expression> if [statements] [else [statements]] endif
bool fValue = false;
if (fExec)
{
if (stack.size() < 1)
return false;
valtype& vch = stacktop(-1);
fValue = CastToBool(vch);
if (opcode == OP_NOTIF)
fValue = !fValue;
popstack(stack);
}
vfExec.push_back(fValue);
}
break;
case OP_ELSE:
{
if (vfExec.empty())
return false;
vfExec.back() = !vfExec.back();
}
break;
case OP_ENDIF:
{
if (vfExec.empty())
return false;
vfExec.pop_back();
}
break;
case OP_VERIFY:
{
// (true -- ) or
// (false -- false) and return
if (stack.size() < 1)
return false;
bool fValue = CastToBool(stacktop(-1));
if (fValue)
popstack(stack);
else
return false;
}
break;
case OP_RETURN:
{
return false;
}
break;
//
// Stack ops
//
case OP_TOALTSTACK:
{
if (stack.size() < 1)
return false;
altstack.push_back(stacktop(-1));
popstack(stack);
}
break;
case OP_FROMALTSTACK:
{
if (altstack.size() < 1)
return false;
stack.push_back(altstacktop(-1));
popstack(altstack);
}
break;
case OP_2DROP:
{
// (x1 x2 -- )
if (stack.size() < 2)
return false;
popstack(stack);
popstack(stack);
}
break;
case OP_2DUP:
{
// (x1 x2 -- x1 x2 x1 x2)
if (stack.size() < 2)
return false;
valtype vch1 = stacktop(-2);
valtype vch2 = stacktop(-1);
stack.push_back(vch1);
stack.push_back(vch2);
}
break;
case OP_3DUP:
{
// (x1 x2 x3 -- x1 x2 x3 x1 x2 x3)
if (stack.size() < 3)
return false;
valtype vch1 = stacktop(-3);
valtype vch2 = stacktop(-2);
valtype vch3 = stacktop(-1);
stack.push_back(vch1);
stack.push_back(vch2);
stack.push_back(vch3);
}
break;
case OP_2OVER:
{
// (x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2)
if (stack.size() < 4)
return false;
valtype vch1 = stacktop(-4);
valtype vch2 = stacktop(-3);
stack.push_back(vch1);
stack.push_back(vch2);
}
break;
case OP_2ROT:
{
// (x1 x2 x3 x4 x5 x6 -- x3 x4 x5 x6 x1 x2)
if (stack.size() < 6)
return false;
valtype vch1 = stacktop(-6);
valtype vch2 = stacktop(-5);
stack.erase(stack.end()-6, stack.end()-4);
stack.push_back(vch1);
stack.push_back(vch2);
}
break;
case OP_2SWAP:
{
// (x1 x2 x3 x4 -- x3 x4 x1 x2)
if (stack.size() < 4)
return false;
swap(stacktop(-4), stacktop(-2));
swap(stacktop(-3), stacktop(-1));
}
break;
case OP_IFDUP:
{
// (x - 0 | x x)
if (stack.size() < 1)
return false;
valtype vch = stacktop(-1);
if (CastToBool(vch))
stack.push_back(vch);
}
break;
case OP_DEPTH:
{
// -- stacksize
CBigNum bn(stack.size());
stack.push_back(bn.getvch());
}
break;
case OP_DROP:
{
// (x -- )
if (stack.size() < 1)
return false;
popstack(stack);
}
break;
case OP_DUP:
{
// (x -- x x)
if (stack.size() < 1)
return false;
valtype vch = stacktop(-1);
stack.push_back(vch);
}
break;
case OP_NIP:
{
// (x1 x2 -- x2)
if (stack.size() < 2)
return false;
stack.erase(stack.end() - 2);
}
break;
case OP_OVER:
{
// (x1 x2 -- x1 x2 x1)
if (stack.size() < 2)
return false;
valtype vch = stacktop(-2);
stack.push_back(vch);
}
break;
case OP_PICK:
case OP_ROLL:
{
// (xn ... x2 x1 x0 n - xn ... x2 x1 x0 xn)
// (xn ... x2 x1 x0 n - ... x2 x1 x0 xn)
if (stack.size() < 2)
return false;
int n = CastToBigNum(stacktop(-1)).getint();
popstack(stack);
if (n < 0 || n >= (int)stack.size())
return false;
valtype vch = stacktop(-n-1);
if (opcode == OP_ROLL)
stack.erase(stack.end()-n-1);
stack.push_back(vch);
}
break;
case OP_ROT:
{
// (x1 x2 x3 -- x2 x3 x1)
// x2 x1 x3 after first swap
// x2 x3 x1 after second swap
if (stack.size() < 3)
return false;
swap(stacktop(-3), stacktop(-2));
swap(stacktop(-2), stacktop(-1));
}
break;
case OP_SWAP:
{
// (x1 x2 -- x2 x1)
if (stack.size() < 2)
return false;
swap(stacktop(-2), stacktop(-1));
}
break;
case OP_TUCK:
{
// (x1 x2 -- x2 x1 x2)
if (stack.size() < 2)
return false;
valtype vch = stacktop(-1);
stack.insert(stack.end()-2, vch);
}
break;
case OP_SIZE:
{
// (in -- in size)
if (stack.size() < 1)
return false;
CBigNum bn(stacktop(-1).size());
stack.push_back(bn.getvch());
}
break;
//
// Bitwise logic
//
case OP_EQUAL:
case OP_EQUALVERIFY:
//case OP_NOTEQUAL: // use OP_NUMNOTEQUAL
{
// (x1 x2 - bool)
if (stack.size() < 2)
return false;
valtype& vch1 = stacktop(-2);
valtype& vch2 = stacktop(-1);
bool fEqual = (vch1 == vch2);
// OP_NOTEQUAL is disabled because it would be too easy to say
// something like n != 1 and have some wiseguy pass in 1 with extra
// zero bytes after it (numerically, 0x01 == 0x0001 == 0x000001)
//if (opcode == OP_NOTEQUAL)
// fEqual = !fEqual;
popstack(stack);
popstack(stack);
stack.push_back(fEqual ? vchTrue : vchFalse);
if (opcode == OP_EQUALVERIFY)
{
if (fEqual)
popstack(stack);
else
return false;
}
}
break;
//
// Numeric
//
case OP_1ADD:
case OP_1SUB:
case OP_NEGATE:
case OP_ABS:
case OP_NOT:
case OP_0NOTEQUAL:
{
// (in -- out)
if (stack.size() < 1)
return false;
CBigNum bn = CastToBigNum(stacktop(-1));
switch (opcode)
{
case OP_1ADD: bn += bnOne; break;
case OP_1SUB: bn -= bnOne; break;
case OP_NEGATE: bn = -bn; break;
case OP_ABS: if (bn < bnZero) bn = -bn; break;
case OP_NOT: bn = (bn == bnZero); break;
case OP_0NOTEQUAL: bn = (bn != bnZero); break;
default: assert(!"invalid opcode"); break;
}
popstack(stack);
stack.push_back(bn.getvch());
}
break;
case OP_ADD:
case OP_SUB:
case OP_BOOLAND:
case OP_BOOLOR:
case OP_NUMEQUAL:
case OP_NUMEQUALVERIFY:
case OP_NUMNOTEQUAL:
case OP_LESSTHAN:
case OP_GREATERTHAN:
case OP_LESSTHANOREQUAL:
case OP_GREATERTHANOREQUAL:
case OP_MIN:
case OP_MAX:
{
// (x1 x2 -- out)
if (stack.size() < 2)
return false;
CBigNum bn1 = CastToBigNum(stacktop(-2));
CBigNum bn2 = CastToBigNum(stacktop(-1));
CBigNum bn;
switch (opcode)
{
case OP_ADD:
bn = bn1 + bn2;
break;
case OP_SUB:
bn = bn1 - bn2;
break;
case OP_BOOLAND: bn = (bn1 != bnZero && bn2 != bnZero); break;
case OP_BOOLOR: bn = (bn1 != bnZero || bn2 != bnZero); break;
case OP_NUMEQUAL: bn = (bn1 == bn2); break;
case OP_NUMEQUALVERIFY: bn = (bn1 == bn2); break;
case OP_NUMNOTEQUAL: bn = (bn1 != bn2); break;
case OP_LESSTHAN: bn = (bn1 < bn2); break;
case OP_GREATERTHAN: bn = (bn1 > bn2); break;
case OP_LESSTHANOREQUAL: bn = (bn1 <= bn2); break;
case OP_GREATERTHANOREQUAL: bn = (bn1 >= bn2); break;
case OP_MIN: bn = (bn1 < bn2 ? bn1 : bn2); break;
case OP_MAX: bn = (bn1 > bn2 ? bn1 : bn2); break;
default: assert(!"invalid opcode"); break;
}
popstack(stack);
popstack(stack);
stack.push_back(bn.getvch());
if (opcode == OP_NUMEQUALVERIFY)
{
if (CastToBool(stacktop(-1)))
popstack(stack);
else
return false;
}
}
break;
case OP_WITHIN:
{
// (x min max -- out)
if (stack.size() < 3)
return false;
CBigNum bn1 = CastToBigNum(stacktop(-3));
CBigNum bn2 = CastToBigNum(stacktop(-2));
CBigNum bn3 = CastToBigNum(stacktop(-1));
bool fValue = (bn2 <= bn1 && bn1 < bn3);
popstack(stack);
popstack(stack);
popstack(stack);
stack.push_back(fValue ? vchTrue : vchFalse);
}
break;
//
// Crypto
//
case OP_RIPEMD160:
case OP_SHA1:
case OP_SHA256:
case OP_HASH160:
case OP_HASH256:
{
// (in -- hash)
if (stack.size() < 1)
return false;
valtype& vch = stacktop(-1);
valtype vchHash((opcode == OP_RIPEMD160 || opcode == OP_SHA1 || opcode == OP_HASH160) ? 20 : 32);
if (opcode == OP_RIPEMD160)
RIPEMD160(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_SHA1)
SHA1(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_SHA256)
SHA256(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_HASH160)
{
uint160 hash160 = Hash160(vch);
memcpy(&vchHash[0], &hash160, sizeof(hash160));
}
else if (opcode == OP_HASH256)
{
uint256 hash = Hash(vch.begin(), vch.end());
memcpy(&vchHash[0], &hash, sizeof(hash));
}
popstack(stack);
stack.push_back(vchHash);
}
break;
case OP_CODESEPARATOR:
{
// Hash starts after the code separator
pbegincodehash = pc;
}
break;
case OP_CHECKSIG:
case OP_CHECKSIGVERIFY:
{
// (sig pubkey -- bool)
if (stack.size() < 2)
return false;
valtype& vchSig = stacktop(-2);
valtype& vchPubKey = stacktop(-1);
////// debug print
//PrintHex(vchSig.begin(), vchSig.end(), "sig: %s\n");
//PrintHex(vchPubKey.begin(), vchPubKey.end(), "pubkey: %s\n");
// Subset of script starting at the most recent codeseparator
CScript scriptCode(pbegincodehash, pend);
// Drop the signature, since there's no way for a signature to sign itself
scriptCode.FindAndDelete(CScript(vchSig));
bool fSuccess = (!fStrictEncodings || (IsCanonicalSignature(vchSig) && IsCanonicalPubKey(vchPubKey)));
if (fSuccess)
fSuccess = CheckSig(vchSig, vchPubKey, scriptCode, txTo, nIn, nHashType, flags);
popstack(stack);
popstack(stack);
stack.push_back(fSuccess ? vchTrue : vchFalse);
if (opcode == OP_CHECKSIGVERIFY)
{
if (fSuccess)
popstack(stack);
else
return false;
}
}
break;
case OP_CHECKMULTISIG:
case OP_CHECKMULTISIGVERIFY:
{
// ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)
int i = 1;
if ((int)stack.size() < i)
return false;
int nKeysCount = CastToBigNum(stacktop(-i)).getint();
if (nKeysCount < 0 || nKeysCount > 20)
return false;
nOpCount += nKeysCount;
if (nOpCount > 201)
return false;
int ikey = ++i;
i += nKeysCount;
if ((int)stack.size() < i)
return false;
int nSigsCount = CastToBigNum(stacktop(-i)).getint();
if (nSigsCount < 0 || nSigsCount > nKeysCount)
return false;
int isig = ++i;
i += nSigsCount;
if ((int)stack.size() < i)
return false;
// Subset of script starting at the most recent codeseparator
CScript scriptCode(pbegincodehash, pend);
// Drop the signatures, since there's no way for a signature to sign itself
for (int k = 0; k < nSigsCount; k++)
{
valtype& vchSig = stacktop(-isig-k);
scriptCode.FindAndDelete(CScript(vchSig));
}
bool fSuccess = true;
while (fSuccess && nSigsCount > 0)
{
valtype& vchSig = stacktop(-isig);
valtype& vchPubKey = stacktop(-ikey);
// Check signature
bool fOk = (!fStrictEncodings || (IsCanonicalSignature(vchSig) && IsCanonicalPubKey(vchPubKey)));
if (fOk)
fOk = CheckSig(vchSig, vchPubKey, scriptCode, txTo, nIn, nHashType, flags);
if (fOk) {
isig++;
nSigsCount--;
}
ikey++;
nKeysCount--;
// If there are more signatures left than keys left,
// then too many signatures have failed
if (nSigsCount > nKeysCount)
fSuccess = false;
}
while (i-- > 0)
popstack(stack);
stack.push_back(fSuccess ? vchTrue : vchFalse);
if (opcode == OP_CHECKMULTISIGVERIFY)
{
if (fSuccess)
popstack(stack);
else
return false;
}
}
break;
default:
return false;
}
// Size limits
if (stack.size() + altstack.size() > 1000)
return false;
}
}
catch (...)
{
return false;
}
if (!vfExec.empty())
return false;
return true;
}
uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType)
{
if (nIn >= txTo.vin.size())
{
printf("ERROR: SignatureHash() : nIn=%d out of range\n", nIn);
return 1;
}
CTransaction txTmp(txTo);
// In case concatenating two scripts ends up with two codeseparators,
// or an extra one at the end, this prevents all those possible incompatibilities.
scriptCode.FindAndDelete(CScript(OP_CODESEPARATOR));
// Blank out other inputs' signatures
for (unsigned int i = 0; i < txTmp.vin.size(); i++)
txTmp.vin[i].scriptSig = CScript();
txTmp.vin[nIn].scriptSig = scriptCode;
// Blank out some of the outputs
if ((nHashType & 0x1f) == SIGHASH_NONE)
{
// Wildcard payee
txTmp.vout.clear();
// Let the others update at will
for (unsigned int i = 0; i < txTmp.vin.size(); i++)
if (i != nIn)
txTmp.vin[i].nSequence = 0;
}
else if ((nHashType & 0x1f) == SIGHASH_SINGLE)
{
// Only lock-in the txout payee at same index as txin
unsigned int nOut = nIn;
if (nOut >= txTmp.vout.size())
{
printf("ERROR: SignatureHash() : nOut=%d out of range\n", nOut);
return 1;
}
txTmp.vout.resize(nOut+1);
for (unsigned int i = 0; i < nOut; i++)
txTmp.vout[i].SetNull();
// Let the others update at will
for (unsigned int i = 0; i < txTmp.vin.size(); i++)
if (i != nIn)
txTmp.vin[i].nSequence = 0;
}
// Blank out other inputs completely, not recommended for open transactions
if (nHashType & SIGHASH_ANYONECANPAY)
{
txTmp.vin[0] = txTmp.vin[nIn];
txTmp.vin.resize(1);
}
// Serialize and hash
CHashWriter ss(SER_GETHASH, 0);
ss << txTmp << nHashType;
return ss.GetHash();
}
// Valid signature cache, to avoid doing expensive ECDSA signature checking
// twice for every transaction (once when accepted into memory pool, and
// again when accepted into the block chain)
class CSignatureCache
{
private:
// sigdata_type is (signature hash, signature, public key):
typedef boost::tuple<uint256, std::vector<unsigned char>, CPubKey> sigdata_type;
std::set< sigdata_type> setValid;
boost::shared_mutex cs_sigcache;
public:
bool
Get(const uint256 &hash, const std::vector<unsigned char>& vchSig, const CPubKey& pubKey)
{
boost::shared_lock<boost::shared_mutex> lock(cs_sigcache);
sigdata_type k(hash, vchSig, pubKey);
std::set<sigdata_type>::iterator mi = setValid.find(k);
if (mi != setValid.end())
return true;
return false;
}
void Set(const uint256 &hash, const std::vector<unsigned char>& vchSig, const CPubKey& pubKey)
{
// DoS prevention: limit cache size to less than 10MB
// (~200 bytes per cache entry times 50,000 entries)
// Since there are a maximum of 20,000 signature operations per block
// 50,000 is a reasonable default.
int64 nMaxCacheSize = GetArg("-maxsigcachesize", 50000);
if (nMaxCacheSize <= 0) return;
boost::unique_lock<boost::shared_mutex> lock(cs_sigcache);
while (static_cast<int64>(setValid.size()) > nMaxCacheSize)
{
// Evict a random entry. Random because that helps
// foil would-be DoS attackers who might try to pre-generate
// and re-use a set of valid signatures just-slightly-greater
// than our cache size.
uint256 randomHash = GetRandHash();
std::vector<unsigned char> unused;
std::set<sigdata_type>::iterator it =
setValid.lower_bound(sigdata_type(randomHash, unused, unused));
if (it == setValid.end())
it = setValid.begin();
setValid.erase(*it);
}
sigdata_type k(hash, vchSig, pubKey);
setValid.insert(k);
}
};
bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubKey, const CScript &scriptCode,
const CTransaction& txTo, unsigned int nIn, int nHashType, int flags)
{
static CSignatureCache signatureCache;
CPubKey pubkey(vchPubKey);
if (!pubkey.IsValid())
return false;
// Hash type is one byte tacked on to the end of the signature
if (vchSig.empty())
return false;
if (nHashType == 0)
nHashType = vchSig.back();
else if (nHashType != vchSig.back())
return false;
vchSig.pop_back();
uint256 sighash = SignatureHash(scriptCode, txTo, nIn, nHashType);
if (signatureCache.Get(sighash, vchSig, pubkey))
return true;
if (!pubkey.Verify(sighash, vchSig))
return false;
if (!(flags & SCRIPT_VERIFY_NOCACHE))
signatureCache.Set(sighash, vchSig, pubkey);
return true;
}
typedef struct {
txnouttype txType;
CScript *tScript;
} SScriptPairRec;
bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsigned char> >& vSolutionsRet)
{
static SScriptPairRec *sTemplates = NULL;
SScriptPairRec *curTemplate;
if (sTemplates == NULL) {
CScript *tScript;
sTemplates = (SScriptPairRec *)malloc(sizeof(SScriptPairRec) * 4);
// order templates such that most common transaction types are checked first
tScript = new CScript();
*tScript << OP_DUP << OP_HASH160 << OP_PUBKEYHASH << OP_EQUALVERIFY << OP_CHECKSIG;
sTemplates[0].txType = TX_PUBKEYHASH;
sTemplates[0].tScript = tScript;
tScript = new CScript();
*tScript << OP_PUBKEY << OP_CHECKSIG;
sTemplates[1].txType = TX_PUBKEY;
sTemplates[1].tScript = tScript;
tScript = new CScript();
*tScript << OP_SMALLINTEGER << OP_PUBKEYS << OP_SMALLINTEGER << OP_CHECKMULTISIG;
sTemplates[2].txType = TX_MULTISIG;
sTemplates[2].tScript = tScript;
sTemplates[3].txType = (txnouttype)-1;
sTemplates[3].tScript = NULL;
}
// Shortcut for pay-to-script-hash, which are more constrained than the other types:
// it is always OP_HASH160 20 [20 byte hash] OP_EQUAL
if (scriptPubKey.IsPayToScriptHash())
{
typeRet = TX_SCRIPTHASH;
vector<unsigned char> hashBytes(scriptPubKey.begin()+2, scriptPubKey.begin()+22);
vSolutionsRet.push_back(hashBytes);
return true;
}
// Scan templates
const CScript& script1 = scriptPubKey;
curTemplate = &sTemplates[0];
while (curTemplate->tScript != NULL) {
const CScript *testScript = curTemplate->tScript;
opcodetype opcode1, opcode2;
vector<unsigned char> vch1;
vSolutionsRet.clear();
// Compare
CScript::const_iterator pc1 = script1.begin();
CScript::const_iterator pc2 = testScript->begin();
CScript::const_iterator end1 = script1.end();
CScript::const_iterator end2 = testScript->end();
loop
{
if (pc1 == end1 && pc2 == end2)
{
// Found a match
typeRet = curTemplate->txType;
if (typeRet == TX_MULTISIG)
{
// Additional checks for TX_MULTISIG:
unsigned char m = vSolutionsRet.front()[0];
unsigned char n = vSolutionsRet.back()[0];
if (m < 1 || n < 1 || m > n || vSolutionsRet.size()-2 != n)
return false;
}
return true;
}
if (!script1.GetOp2(pc1, opcode1, &vch1))
break;
if (!testScript->GetOp2(pc2, opcode2, NULL)) // templates push no data, no need to get vch
break;
// Template matching opcodes:
if (opcode2 == OP_PUBKEYS)
{
while (vch1.size() >= 33 && vch1.size() <= 120)
{
vSolutionsRet.push_back(vch1);
if (!script1.GetOp2(pc1, opcode1, &vch1))
break;
}
if (!testScript->GetOp2(pc2, opcode2, NULL))
break;
// Normal situation is to fall through
// to other if/else statements
}
if (opcode2 == OP_PUBKEY)
{
if (vch1.size() < 33 || vch1.size() > 120)
break;
vSolutionsRet.push_back(vch1);
}
else if (opcode2 == OP_PUBKEYHASH)
{
if (vch1.size() != sizeof(uint160))
break;
vSolutionsRet.push_back(vch1);
}
else if (opcode2 == OP_SMALLINTEGER)
{ // Single-byte small integer pushed onto vSolutions
if (opcode1 == OP_0 ||
(opcode1 >= OP_1 && opcode1 <= OP_16))
{
char n = (char)CScript::DecodeOP_N(opcode1);
vSolutionsRet.push_back(valtype(1, n));
}
else
break;
}
else if (opcode1 != opcode2)
{
// Others must match exactly
break;
}
}
curTemplate++;
}
vSolutionsRet.clear();
typeRet = TX_NONSTANDARD;
return false;
}
bool Sign1(const CKeyID& address, const CKeyStore& keystore, uint256 hash, int nHashType, CScript& scriptSigRet)
{
CKey key;
if (!keystore.GetKey(address, key))
return false;
vector<unsigned char> vchSig;
if (!key.Sign(hash, vchSig))
return false;
vchSig.push_back((unsigned char)nHashType);
scriptSigRet << vchSig;
return true;
}
bool SignN(const vector<valtype>& multisigdata, const CKeyStore& keystore, uint256 hash, int nHashType, CScript& scriptSigRet)
{
int nSigned = 0;
int nRequired = multisigdata.front()[0];
for (unsigned int i = 1; i < multisigdata.size()-1 && nSigned < nRequired; i++)
{
const valtype& pubkey = multisigdata[i];
CKeyID keyID = CPubKey(pubkey).GetID();
if (Sign1(keyID, keystore, hash, nHashType, scriptSigRet))
++nSigned;
}
return nSigned==nRequired;
}
//
// Sign scriptPubKey with private keys stored in keystore, given transaction hash and hash type.
// Signatures are returned in scriptSigRet (or returns false if scriptPubKey can't be signed),
// unless whichTypeRet is TX_SCRIPTHASH, in which case scriptSigRet is the redemption script.
// Returns false if scriptPubKey could not be completely satisfied.
//
bool Solver(const CKeyStore& keystore, const CScript& scriptPubKey, uint256 hash, int nHashType,
CScript& scriptSigRet, txnouttype& whichTypeRet)
{
scriptSigRet.clear();
vector<valtype> vSolutions;
if (!Solver(scriptPubKey, whichTypeRet, vSolutions))
return false;
CKeyID keyID;
switch (whichTypeRet)
{
case TX_NONSTANDARD:
return false;
case TX_PUBKEY:
keyID = CPubKey(vSolutions[0]).GetID();
return Sign1(keyID, keystore, hash, nHashType, scriptSigRet);
case TX_PUBKEYHASH:
keyID = CKeyID(uint160(vSolutions[0]));
if (!Sign1(keyID, keystore, hash, nHashType, scriptSigRet))
return false;
else
{
CPubKey vch;
keystore.GetPubKey(keyID, vch);
scriptSigRet << vch;
}
return true;
case TX_SCRIPTHASH:
return keystore.GetCScript(uint160(vSolutions[0]), scriptSigRet);
case TX_MULTISIG:
scriptSigRet << OP_0; // workaround CHECKMULTISIG bug
return (SignN(vSolutions, keystore, hash, nHashType, scriptSigRet));
}
return false;
}
int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned char> >& vSolutions)
{
switch (t)
{
case TX_NONSTANDARD:
return -1;
case TX_PUBKEY:
return 1;
case TX_PUBKEYHASH:
return 2;
case TX_MULTISIG:
if (vSolutions.size() < 1 || vSolutions[0].size() < 1)
return -1;
return vSolutions[0][0] + 1;
case TX_SCRIPTHASH:
return 1; // doesn't include args needed by the script
}
return -1;
}
bool IsStandard(const CScript& scriptPubKey)
{
vector<valtype> vSolutions;
txnouttype whichType;
if (!Solver(scriptPubKey, whichType, vSolutions))
return false;
if (whichType == TX_MULTISIG)
{
unsigned char m = vSolutions.front()[0];
unsigned char n = vSolutions.back()[0];
// Support up to x-of-3 multisig txns as standard
if (n < 1 || n > 3)
return false;
if (m < 1 || m > n)
return false;
}
return whichType != TX_NONSTANDARD;
}
unsigned int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore)
{
unsigned int nResult = 0;
BOOST_FOREACH(const valtype& pubkey, pubkeys)
{
CKeyID keyID = CPubKey(pubkey).GetID();
if (keystore.HaveKey(keyID))
++nResult;
}
return nResult;
}
class CKeyStoreIsMineVisitor : public boost::static_visitor<bool>
{
private:
const CKeyStore *keystore;
public:
CKeyStoreIsMineVisitor(const CKeyStore *keystoreIn) : keystore(keystoreIn) { }
bool operator()(const CNoDestination &dest) const { return false; }
bool operator()(const CKeyID &keyID) const { return keystore->HaveKey(keyID); }
bool operator()(const CScriptID &scriptID) const { return keystore->HaveCScript(scriptID); }
};
bool IsMine(const CKeyStore &keystore, const CTxDestination &dest)
{
return boost::apply_visitor(CKeyStoreIsMineVisitor(&keystore), dest);
}
bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
{
vector<valtype> vSolutions;
txnouttype whichType;
if (!Solver(scriptPubKey, whichType, vSolutions))
return false;
CKeyID keyID;
switch (whichType)
{
case TX_NONSTANDARD:
return false;
case TX_PUBKEY:
keyID = CPubKey(vSolutions[0]).GetID();
return keystore.HaveKey(keyID);
case TX_PUBKEYHASH:
keyID = CKeyID(uint160(vSolutions[0]));
return keystore.HaveKey(keyID);
case TX_SCRIPTHASH:
{
CScript subscript;
if (!keystore.GetCScript(CScriptID(uint160(vSolutions[0])), subscript))
return false;
return IsMine(keystore, subscript);
}
case TX_MULTISIG:
{
// Only consider transactions "mine" if we own ALL the
// keys involved. multi-signature transactions that are
// partially owned (somebody else has a key that can spend
// them) enable spend-out-from-under-you attacks, especially
// in shared-wallet situations.
vector<valtype> keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1);
return HaveKeys(keys, keystore) == keys.size();
}
}
return false;
}
bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
{
vector<valtype> vSolutions;
txnouttype whichType;
if (!Solver(scriptPubKey, whichType, vSolutions))
return false;
if (whichType == TX_PUBKEY)
{
addressRet = CPubKey(vSolutions[0]).GetID();
return true;
}
else if (whichType == TX_PUBKEYHASH)
{
addressRet = CKeyID(uint160(vSolutions[0]));
return true;
}
else if (whichType == TX_SCRIPTHASH)
{
addressRet = CScriptID(uint160(vSolutions[0]));
return true;
}
// Multisig txns have more than one address...
return false;
}
// ExtractDestinationAndMine is an amalgam of ExtractDestination and IsMine. Since they do very
// similar work and are both called from CWalletTx::GetAmounts we can reduce kill two birds with
// one stone by combining them and speed CWalletTx::GetAmounts considerably.
bool ExtractDestinationAndMine(const CKeyStore &keystore, const CScript& scriptPubKey, CTxDestination& addressRet, bool *outIsMine)
{
vector<valtype> vSolutions;
txnouttype whichType;
bool hasDestination = false;
*outIsMine = false;
if (Solver(scriptPubKey, whichType, vSolutions)) {
CKeyID keyID;
switch (whichType) {
case TX_NONSTANDARD:
break;
case TX_PUBKEY:
keyID = CPubKey(vSolutions[0]).GetID();
addressRet = keyID;
*outIsMine = keystore.HaveKey(keyID);
hasDestination = true;
break;
case TX_PUBKEYHASH:
keyID = CKeyID(uint160(vSolutions[0]));
addressRet = keyID;
*outIsMine = keystore.HaveKey(keyID);
hasDestination = true;
break;
case TX_SCRIPTHASH: {
CScript subscript;
CScriptID scriptID = CScriptID(uint160(vSolutions[0]));
addressRet = scriptID;
hasDestination = true;
if (keystore.GetCScript(scriptID, subscript))
*outIsMine = IsMine(keystore, subscript);
}
break;
case TX_MULTISIG:
{
// Only consider transactions "mine" if we own ALL the
// keys involved. multi-signature transactions that are
// partially owned (somebody else has a key that can spend
// them) enable spend-out-from-under-you attacks, especially
// in shared-wallet situations.
vector<valtype> keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1);
*outIsMine = HaveKeys(keys, keystore) == keys.size();
}
}
}
return hasDestination;
}
bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vector<CTxDestination>& addressRet, int& nRequiredRet)
{
addressRet.clear();
typeRet = TX_NONSTANDARD;
vector<valtype> vSolutions;
if (!Solver(scriptPubKey, typeRet, vSolutions))
return false;
if (typeRet == TX_MULTISIG)
{
nRequiredRet = vSolutions.front()[0];
for (unsigned int i = 1; i < vSolutions.size()-1; i++)
{
CTxDestination address = CPubKey(vSolutions[i]).GetID();
addressRet.push_back(address);
}
}
else
{
nRequiredRet = 1;
CTxDestination address;
if (!ExtractDestination(scriptPubKey, address))
return false;
addressRet.push_back(address);
}
return true;
}
bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn,
unsigned int flags, int nHashType)
{
vector<vector<unsigned char> > stack, stackCopy;
if (!EvalScript(stack, scriptSig, txTo, nIn, flags, nHashType))
return false;
if (flags & SCRIPT_VERIFY_P2SH)
stackCopy = stack;
if (!EvalScript(stack, scriptPubKey, txTo, nIn, flags, nHashType))
return false;
if (stack.empty())
return false;
if (CastToBool(stack.back()) == false)
return false;
// Additional validation for spend-to-script-hash transactions:
if ((flags & SCRIPT_VERIFY_P2SH) && scriptPubKey.IsPayToScriptHash())
{
if (!scriptSig.IsPushOnly()) // scriptSig must be literals-only
return false; // or validation fails
// stackCopy cannot be empty here, because if it was the
// P2SH HASH <> EQUAL scriptPubKey would be evaluated with
// an empty stack and the EvalScript above would return false.
assert(!stackCopy.empty());
const valtype& pubKeySerialized = stackCopy.back();
CScript pubKey2(pubKeySerialized.begin(), pubKeySerialized.end());
popstack(stackCopy);
if (!EvalScript(stackCopy, pubKey2, txTo, nIn, flags, nHashType))
return false;
if (stackCopy.empty())
return false;
return CastToBool(stackCopy.back());
}
return true;
}
bool SignSignature(const CKeyStore &keystore, const CScript& fromPubKey, CTransaction& txTo, unsigned int nIn, int nHashType)
{
assert(nIn < txTo.vin.size());
CTxIn& txin = txTo.vin[nIn];
// Leave out the signature from the hash, since a signature can't sign itself.
// The checksig op will also drop the signatures from its hash.
uint256 hash = SignatureHash(fromPubKey, txTo, nIn, nHashType);
txnouttype whichType;
if (!Solver(keystore, fromPubKey, hash, nHashType, txin.scriptSig, whichType))
return false;
if (whichType == TX_SCRIPTHASH)
{
// Solver returns the subscript that need to be evaluated;
// the final scriptSig is the signatures from that
// and then the serialized subscript:
CScript subscript = txin.scriptSig;
// Recompute txn hash using subscript in place of scriptPubKey:
uint256 hash2 = SignatureHash(subscript, txTo, nIn, nHashType);
txnouttype subType;
bool fSolved =
Solver(keystore, subscript, hash2, nHashType, txin.scriptSig, subType) && subType != TX_SCRIPTHASH;
// Append serialized subscript whether or not it is completely signed:
txin.scriptSig << static_cast<valtype>(subscript);
if (!fSolved) return false;
}
// Test solution
return VerifyScript(txin.scriptSig, fromPubKey, txTo, nIn, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0);
}
bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType)
{
assert(nIn < txTo.vin.size());
CTxIn& txin = txTo.vin[nIn];
assert(txin.prevout.n < txFrom.vout.size());
const CTxOut& txout = txFrom.vout[txin.prevout.n];
return SignSignature(keystore, txout.scriptPubKey, txTo, nIn, nHashType);
}
static CScript PushAll(const vector<valtype>& values)
{
CScript result;
BOOST_FOREACH(const valtype& v, values)
result << v;
return result;
}
static CScript CombineMultisig(CScript scriptPubKey, const CTransaction& txTo, unsigned int nIn,
const vector<valtype>& vSolutions,
vector<valtype>& sigs1, vector<valtype>& sigs2)
{
// Combine all the signatures we've got:
set<valtype> allsigs;
BOOST_FOREACH(const valtype& v, sigs1)
{
if (!v.empty())
allsigs.insert(v);
}
BOOST_FOREACH(const valtype& v, sigs2)
{
if (!v.empty())
allsigs.insert(v);
}
// Build a map of pubkey -> signature by matching sigs to pubkeys:
assert(vSolutions.size() > 1);
unsigned int nSigsRequired = vSolutions.front()[0];
unsigned int nPubKeys = vSolutions.size()-2;
map<valtype, valtype> sigs;
BOOST_FOREACH(const valtype& sig, allsigs)
{
for (unsigned int i = 0; i < nPubKeys; i++)
{
const valtype& pubkey = vSolutions[i+1];
if (sigs.count(pubkey))
continue; // Already got a sig for this pubkey
if (CheckSig(sig, pubkey, scriptPubKey, txTo, nIn, 0, 0))
{
sigs[pubkey] = sig;
break;
}
}
}
// Now build a merged CScript:
unsigned int nSigsHave = 0;
CScript result; result << OP_0; // pop-one-too-many workaround
for (unsigned int i = 0; i < nPubKeys && nSigsHave < nSigsRequired; i++)
{
if (sigs.count(vSolutions[i+1]))
{
result << sigs[vSolutions[i+1]];
++nSigsHave;
}
}
// Fill any missing with OP_0:
for (unsigned int i = nSigsHave; i < nSigsRequired; i++)
result << OP_0;
return result;
}
static CScript CombineSignatures(CScript scriptPubKey, const CTransaction& txTo, unsigned int nIn,
const txnouttype txType, const vector<valtype>& vSolutions,
vector<valtype>& sigs1, vector<valtype>& sigs2)
{
switch (txType)
{
case TX_NONSTANDARD:
// Don't know anything about this, assume bigger one is correct:
if (sigs1.size() >= sigs2.size())
return PushAll(sigs1);
return PushAll(sigs2);
case TX_PUBKEY:
case TX_PUBKEYHASH:
// Signatures are bigger than placeholders or empty scripts:
if (sigs1.empty() || sigs1[0].empty())
return PushAll(sigs2);
return PushAll(sigs1);
case TX_SCRIPTHASH:
if (sigs1.empty() || sigs1.back().empty())
return PushAll(sigs2);
else if (sigs2.empty() || sigs2.back().empty())
return PushAll(sigs1);
else
{
// Recur to combine:
valtype spk = sigs1.back();
CScript pubKey2(spk.begin(), spk.end());
txnouttype txType2;
vector<vector<unsigned char> > vSolutions2;
Solver(pubKey2, txType2, vSolutions2);
sigs1.pop_back();
sigs2.pop_back();
CScript result = CombineSignatures(pubKey2, txTo, nIn, txType2, vSolutions2, sigs1, sigs2);
result << spk;
return result;
}
case TX_MULTISIG:
return CombineMultisig(scriptPubKey, txTo, nIn, vSolutions, sigs1, sigs2);
}
return CScript();
}
CScript CombineSignatures(CScript scriptPubKey, const CTransaction& txTo, unsigned int nIn,
const CScript& scriptSig1, const CScript& scriptSig2)
{
txnouttype txType;
vector<vector<unsigned char> > vSolutions;
Solver(scriptPubKey, txType, vSolutions);
vector<valtype> stack1;
EvalScript(stack1, scriptSig1, CTransaction(), 0, SCRIPT_VERIFY_STRICTENC, 0);
vector<valtype> stack2;
EvalScript(stack2, scriptSig2, CTransaction(), 0, SCRIPT_VERIFY_STRICTENC, 0);
return CombineSignatures(scriptPubKey, txTo, nIn, txType, vSolutions, stack1, stack2);
}
unsigned int CScript::GetSigOpCount(bool fAccurate) const
{
unsigned int n = 0;
const_iterator pc = begin();
opcodetype lastOpcode = OP_INVALIDOPCODE;
while (pc < end())
{
opcodetype opcode;
if (!GetOp(pc, opcode))
break;
if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY)
n++;
else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
{
if (fAccurate && lastOpcode >= OP_1 && lastOpcode <= OP_16)
n += DecodeOP_N(lastOpcode);
else
n += 20;
}
lastOpcode = opcode;
}
return n;
}
unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const
{
if (!IsPayToScriptHash())
return GetSigOpCount(true);
// This is a pay-to-script-hash scriptPubKey;
// get the last item that the scriptSig
// pushes onto the stack:
const_iterator pc = scriptSig.begin();
vector<unsigned char> data;
while (pc < scriptSig.end())
{
opcodetype opcode;
if (!scriptSig.GetOp(pc, opcode, data))
return 0;
if (opcode > OP_16)
return 0;
}
/// ... and return its opcount:
CScript subscript(data.begin(), data.end());
return subscript.GetSigOpCount(true);
}
bool CScript::IsPayToScriptHash() const
{
// Extra-fast test for pay-to-script-hash CScripts:
return (this->size() == 23 &&
this->at(0) == OP_HASH160 &&
this->at(1) == 0x14 &&
this->at(22) == OP_EQUAL);
}
class CScriptVisitor : public boost::static_visitor<bool>
{
private:
CScript *script;
public:
CScriptVisitor(CScript *scriptin) { script = scriptin; }
bool operator()(const CNoDestination &dest) const {
script->clear();
return false;
}
bool operator()(const CKeyID &keyID) const {
script->clear();
*script << OP_DUP << OP_HASH160 << keyID << OP_EQUALVERIFY << OP_CHECKSIG;
return true;
}
bool operator()(const CScriptID &scriptID) const {
script->clear();
*script << OP_HASH160 << scriptID << OP_EQUAL;
return true;
}
};
void CScript::SetDestination(const CTxDestination& dest)
{
boost::apply_visitor(CScriptVisitor(this), dest);
}
void CScript::SetMultisig(int nRequired, const std::vector<CPubKey>& keys)
{
this->clear();
*this << EncodeOP_N(nRequired);
BOOST_FOREACH(const CPubKey& key, keys)
*this << key;
*this << EncodeOP_N(keys.size()) << OP_CHECKMULTISIG;
}
bool CScriptCompressor::IsToKeyID(CKeyID &hash) const
{
if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160
&& script[2] == 20 && script[23] == OP_EQUALVERIFY
&& script[24] == OP_CHECKSIG) {
memcpy(&hash, &script[3], 20);
return true;
}
return false;
}
bool CScriptCompressor::IsToScriptID(CScriptID &hash) const
{
if (script.size() == 23 && script[0] == OP_HASH160 && script[1] == 20
&& script[22] == OP_EQUAL) {
memcpy(&hash, &script[2], 20);
return true;
}
return false;
}
bool CScriptCompressor::IsToPubKey(CPubKey &pubkey) const
{
if (script.size() == 35 && script[0] == 33 && script[34] == OP_CHECKSIG
&& (script[1] == 0x02 || script[1] == 0x03)) {
pubkey.Set(&script[1], &script[34]);
return true;
}
if (script.size() == 67 && script[0] == 65 && script[66] == OP_CHECKSIG
&& script[1] == 0x04) {
pubkey.Set(&script[1], &script[66]);
return pubkey.IsFullyValid(); // if not fully valid, a case that would not be compressible
}
return false;
}
bool CScriptCompressor::Compress(std::vector<unsigned char> &out) const
{
CKeyID keyID;
if (IsToKeyID(keyID)) {
out.resize(21);
out[0] = 0x00;
memcpy(&out[1], &keyID, 20);
return true;
}
CScriptID scriptID;
if (IsToScriptID(scriptID)) {
out.resize(21);
out[0] = 0x01;
memcpy(&out[1], &scriptID, 20);
return true;
}
CPubKey pubkey;
if (IsToPubKey(pubkey)) {
out.resize(33);
memcpy(&out[1], &pubkey[1], 32);
if (pubkey[0] == 0x02 || pubkey[0] == 0x03) {
out[0] = pubkey[0];
return true;
} else if (pubkey[0] == 0x04) {
out[0] = 0x04 | (pubkey[64] & 0x01);
return true;
}
}
return false;
}
unsigned int CScriptCompressor::GetSpecialSize(unsigned int nSize) const
{
if (nSize == 0 || nSize == 1)
return 20;
if (nSize == 2 || nSize == 3 || nSize == 4 || nSize == 5)
return 32;
return 0;
}
bool CScriptCompressor::Decompress(unsigned int nSize, const std::vector<unsigned char> &in)
{
switch(nSize) {
case 0x00:
script.resize(25);
script[0] = OP_DUP;
script[1] = OP_HASH160;
script[2] = 20;
memcpy(&script[3], &in[0], 20);
script[23] = OP_EQUALVERIFY;
script[24] = OP_CHECKSIG;
return true;
case 0x01:
script.resize(23);
script[0] = OP_HASH160;
script[1] = 20;
memcpy(&script[2], &in[0], 20);
script[22] = OP_EQUAL;
return true;
case 0x02:
case 0x03:
script.resize(35);
script[0] = 33;
script[1] = nSize;
memcpy(&script[2], &in[0], 32);
script[34] = OP_CHECKSIG;
return true;
case 0x04:
case 0x05:
unsigned char vch[33] = {};
vch[0] = nSize - 2;
memcpy(&vch[1], &in[0], 32);
CPubKey pubkey(&vch[0], &vch[33]);
if (!pubkey.Decompress())
return false;
assert(pubkey.size() == 65);
script.resize(67);
script[0] = 65;
memcpy(&script[1], pubkey.begin(), 65);
script[66] = OP_CHECKSIG;
return true;
}
return false;
}
| bongger-project/bongger | src/script.cpp | C++ | mit | 66,774 |
'''
author Lama Hamadeh
'''
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import assignment2_helper as helper
# Look pretty...
matplotlib.style.use('ggplot')
# Do * NOT * alter this line, until instructed!
scaleFeatures = True #Features scaling (if it's false no scaling appears and that affects the 2D plot and the variance values)
# TODO: Load up the dataset and remove any and all
# Rows that have a nan. You should be a pro at this
# by now ;-)
#
# .. your code here ..
df=pd.read_csv('/Users/ADB3HAMADL/Desktop/Anaconda_Packages/DAT210x-master/Module4/Datasets/kidney_disease.csv',index_col = 0)
df = df.reset_index(drop=True) #remove the index column
df=df.dropna(axis=0) #remove any and all Rows that have a nan
#print(df)
# Create some color coded labels; the actual label feature
# will be removed prior to executing PCA, since it's unsupervised.
# You're only labeling by color so you can see the effects of PCA
labels = ['red' if i=='ckd' else 'green' for i in df.classification]
# TODO: Use an indexer to select only the following columns:
# ['bgr','wc','rc']
#
# .. your code here ..
df=df[['bgr', 'rc','wc']] #select only the following columns: bgr, rc, and wc
# TODO: Print out and check your dataframe's dtypes. You'll probably
# want to call 'exit()' after you print it out so you can stop the
# program's execution.
#
# You can either take a look at the dataset webpage in the attribute info
# section: https://archive.ics.uci.edu/ml/datasets/Chronic_Kidney_Disease
# or you can actually peek through the dataframe by printing a few rows.
# What kind of data type should these three columns be? If Pandas didn't
# properly detect and convert them to that data type for you, then use
# an appropriate command to coerce these features into the right type.
#
# .. your code here ..
print(df.dtypes) #
df.rc = pd.to_numeric(df.rc, errors='coerce') #
df.wc = pd.to_numeric(df.wc, errors='coerce') #
# TODO: PCA Operates based on variance. The variable with the greatest
# variance will dominate. Go ahead and peek into your data using a
# command that will check the variance of every feature in your dataset.
# Print out the results. Also print out the results of running .describe
# on your dataset.
#
# Hint: If you don't see all three variables: 'bgr','wc' and 'rc', then
# you probably didn't complete the previous step properly.
#
# .. your code here ..
print(df.var()) #
print(df.describe()) #
# TODO: This method assumes your dataframe is called df. If it isn't,
# make the appropriate changes. Don't alter the code in scaleFeatures()
# just yet though!
#
# .. your code adjustment here ..
if scaleFeatures: df = helper.scaleFeatures(df)
# TODO: Run PCA on your dataset and reduce it to 2 components
# Ensure your PCA instance is saved in a variable called 'pca',
# and that the results of your transformation are saved in 'T'.
#
# .. your code here ..
from sklearn import decomposition
pca = decomposition.PCA(n_components=2)
pca.fit(df)
decomposition.PCA(copy=True, n_components=2, whiten=False)
T= pca.transform(df)
# Plot the transformed data as a scatter plot. Recall that transforming
# the data will result in a NumPy NDArray. You can either use MatPlotLib
# to graph it directly, or you can convert it to DataFrame and have pandas
# do it for you.
#
# Since we've already demonstrated how to plot directly with MatPlotLib in
# Module4/assignment1.py, this time we'll convert to a Pandas Dataframe.
#
# Since we transformed via PCA, we no longer have column names. We know we
# are in P.C. space, so we'll just define the coordinates accordingly:
ax = helper.drawVectors(T, pca.components_, df.columns.values, plt, scaleFeatures)
T = pd.DataFrame(T)
T.columns = ['component1', 'component2']
T.plot.scatter(x='component1', y='component2', marker='o', c=labels, alpha=0.75, ax=ax)
plt.show()
| LamaHamadeh/Microsoft-DAT210x | Module-4/assignment2.py | Python | mit | 3,877 |
'use strict';
/* jasmine specs for directives go here */
describe('directives', function () {
beforeEach(module('myApp.directives'));
describe('app-version', function () {
it('should print current version', function () {
module(function ($provide) {
$provide.value('version', 'TEST_VER');
});
inject(function ($compile, $rootScope) {
var element = $compile('<span app-version></span>')($rootScope);
expect(element.text()).toEqual('TEST_VER');
});
});
});
describe('Button directive', function(){
var $compile, $rootScope;
beforeEach(inject(function (_$rootScope_, _$compile_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
}));
it('should have "btn" class to the button element', function(){
var element = $compile('<button></button>')($rootScope);
expect(element.hasClass('btn')).toBeTruthy();
})
});
describe('Pagination directive', function () {
var element, $scope, lis;
beforeEach(inject(function ($compile, $rootScope) {
$scope = $rootScope;
$scope.numPage = 5;
$scope.currentPage = 2;
element = $compile('<pagination num-pages="numPages" current-page="currentPage"></pagination>')($scope);
$scope.$digest();
lis = function () {
return element.find('li');
};
}));
it('has the number of the page as text in each page item', function () {
for (var i = 0;i < $scope.numPage; i++) {
expect(lis.eq(i).text()).toEqual('' + i);
}
});
});
});
| reverocean/draggable | test/unit/directivesSpec.js | JavaScript | mit | 1,766 |
<?php
namespace LimeTrail\Bundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use LimeTrail\Bundle\Command\QuickBase\QuickBaseWeb;
use LimeTrail\Bundle\Entity\ChangeInitiation;
use LimeTrail\Bundle\Entity\ProjectChangeInitiation;
use LimeTrail\Bundle\Entity\ChangeScope;
class ScrapeChangesCommand extends ContainerAwareCommand
{
protected $em;
protected $logger;
protected function configure()
{
$this->setName('limetrail:scrapechanges')
->setDescription('QuickBase CI web scraper')
->addOption('user', null, InputOption::VALUE_REQUIRED, 'Sets username for web login', '')
->addOption('login-pass', null, InputOption::VALUE_REQUIRED, 'Sets login password for web login', '');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->logger = $this->getContainer()->get('logger');
$username = $input->getOption('user');
$dbhost = $this->getContainer()->getParameter('database_host');
$dbuser = $this->getContainer()->getParameter('database_user');
$webPass = $input->getOption('login-pass');
//quickbase web
$quickbase = new QuickBaseWeb($username, $webPass, 'wmt', $this->getContainer()->getParameter('database_password'), $dbhost, $dbuser);
// first pass - get cookies
$result = $quickbase->Login();
while (!false === stripos($result, 'Operation timed out')) {
$quickbase->Login();
}
//second pass - log in
$quickbase->Login();//'qb-'.urlencode($url).'.html'
$storeList = $this->getContainer()->get('lime_trail_store.provider')->findCurrentProjects(new \DateTime(date('Y-m-d')));
$storeCount = 0;
foreach ($storeList as $store) {
$storeNumber = $store->getStoreNumber();
$storeProjects = $store->getProjects();
foreach ($storeProjects as $project) {
/*
* Inorder to get CI's for a particular project we need to do a GET request to
* curl "https://wmt.quickbase.com/db/bcqqdvttp
* where the query string should look like this:
* a:q
* qt:tab
* opts:nos
* query:{'252'.EX.'4204.000'}
* ^store number and sequence
*/
$format = "{'252'.EX.'%d.%03d'}";
$sequence = $project->getSequence();
$query = sprintf($format, $storeNumber, $sequence);
$queryString = array(
'a' => 'q',
'qt' => 'tab',
'opts' => 'nos',
'query' => $query,
);
$escapedQuery = http_build_query($queryString);
$url = "https://wmt.quickbase.com/db/bcqqdvttp?".$escapedQuery;
$tableHTML = $quickbase->GetTable($url);
// table to get as CSV link https://wmt.quickbase.com/db/bfngn7tvg?a=q&qid=1002789&dlta=xs~
$result = $quickbase->ParseHTML($tableHTML);
//$this->getContainer()->get('doctrine')->resetManager();
$this->em = $this->getContainer()->get('doctrine')->getManager('limetrail');
echo "Processing changes for: ".$storeNumber.".".$project->getSequence()."\n";
$this->ProcessStoreChanges($result, $quickbase, $project);
try {
$this->em->flush();
} catch (\Symfony\Component\Debug\Exception\ContextErrorException $e) {
$this->logger->error("failed to synchronize ".$storeNumber.".".$project->getSequence());
$this->logger->debug(\Doctrine\Common\Util\Debug::dump($e->getContext()));
throw $e;
}
//$this->em->clear();
gc_collect_cycles();
++$storeCount;
}
}
$this->logger->warning(sprintf("Checked %d stores for Change Initiations\n", $storeCount));
}
private function ProcessStoreChanges($result, $quickbase, $project)
{
//now to check to see if this project already has the CI and add it if not
$provider = $this->getContainer()->get('lime_trail_store.provider');
foreach ($result as $entry) {
$this->logger->notice(sprintf("looking up change %s\n", $entry['ci #']));
$this->logger->debug(print_r($entry, true));
if (empty($entry['ci #']) OR strlen(trim($entry['ci #'])) === 0) {
continue;
}
$change = $this->GetChangeInitiation($entry['ci #'], $quickbase);
$this->logger->info(sprintf("finding change with number %s\n", $change->getNumber()));
$projectChange = $provider->findProjectChangesByProjectAndChange($project, $change);
if (empty($projectChange)) {
//create a new project change
//echo "creating a new ProjectChangeInitiation\n";
$projectChange = new ProjectChangeInitiation();
$projectChange->addProject($project)
->addChange($change)
->setDateAssigned(new \DateTime(date('Y-m-d')));
$this->em->persist($project);
$this->em->persist($change);
$this->UpdateAndPersistProjectChange($entry, $projectChange);
} else {
//update existing project change
foreach ($projectChange as $theChange) {
$this->UpdateAndPersistProjectChange($entry, $theChange);
}
}
}
}
private function UpdateAndPersistProjectChange($data, $projectChange)
{
$decline = $data['accept_decline'];
$implementDate = $data['implementation_act'];
$drawingChange = $data['change_type'];
$drawingChangeNumber = $data['revision_addendum_ccd#'];
if (stripos($decline, 'accept') !== false) {
$projectChange->setAccepted(true)
->setDrawingChangeNumber($drawingChangeNumber)
->setDrawingChange($drawingChange);
$date = $this->TryConvertDate($implementDate);
if ($date) {
$projectChange->setDateImplemented($date);
}
} elseif (stripos($decline, 'decline') !== false) {
$projectChange->setDeclined(true);
}
$this->em->persist($projectChange);
}
private function GetChangeInitiation($ciNumber, $quickbase)
{
$ci = $this->em->getRepository('LimeTrailBundle:ChangeInitiation')->findOneByNumber($ciNumber);
if (!$ci or $ci === null) {
//make new CI
$ci = new ChangeInitiation();
$ci->setNumber($ciNumber);
$query = "{'288'.EX.'".$ciNumber."'}";
$queryString = array(
'a' => 'q',
'qt' => 'tab',
'opts' => 'nos',
'query' => $query,
);
$escapedQuery = http_build_query($queryString);
$url = "https://wmt.quickbase.com/db/bcqqdvttv?".$escapedQuery;
$ciTablePage = $quickbase->GetTable($url);
$ciInfo = $quickbase->parseCiTable($ciTablePage);
/*$resource = fopen("ci-$ciNumber.txt", 'w');
fwrite($resource, print_r($ciInfo, true));
fclose($resource);*/
$ci->setReleaseDate($this->TryConvertDate($ciInfo['release_date']))
->setComment($ciInfo['comments'])
->setTitle($ciInfo['ci_title']);
$scope = $this->GetScopes($ciInfo['scope_of_implementation']);
$ci->setScopes($scope);
//echo "Persisting CI $ciNumber\n";
$this->em->persist($ci);
$this->em->flush();
}
return $ci;
}
private function GetScopes($list)
{
if (!is_string($list)) {
throw new UnexpectedTypeException();
}
//replace places where they use ' - ' as a separator
$list = preg_replace('~\s-\s~', ', ', $list);
//explode list by separator
$parts = explode(', ', $list);
$assoc = array();
//iterate parts, scope names will be keys and values will be DateTimes or empty strings
foreach ($parts as $part) {
$new = explode(': ', $part);
if (count($new) > 1) {
$assoc[$new[0]] = $this->TryConvertDate($new[1]);
} else {
$assoc[$new[0]] = "";
}
}
//create an array of scope objects
$scopes = array();
foreach ($assoc as $key => $value) {
$scope = new ChangeScope();
$scope->setName($key);
if ($value instanceof \DateTime) {
$scope->setDate($value);
}
$this->em->persist($scope);
$scopes[] = $scope;
}
return $scopes;
}
protected function TryConvertDate($dateString)
{
if (preg_match('/(?:(?P<month>\d{1,2})-(?P<day>\d{1,2})-(?P<year>\d{4}))/', $dateString, $matches) === 1) {
if (checkdate($matches["month"], $matches["day"], $matches["year"])) {
return new \DateTime($matches["month"]."/".$matches["day"]."/".$matches["year"]);
}
}
return;
}
}
| RhaLabs/ProjectManagement | src/LimeTrail/Bundle/Command/ScrapeChangesCommand.php | PHP | mit | 9,680 |
const https = require('https')
const cookie = require('cookie');
var exports = module.exports = {}
exports.getResponseHeaders = function(httpOptions, formData) {
if (formData) {
httpOptions.headers = formData.getHeaders()
}
return new Promise((resolve, reject) => {
const request = https.request(httpOptions, (response) => {
// handle http errors
if (response.statusCode < 200 || response.statusCode > 299) {
reject(new Error('Failed to load page, status code: ' + response.statusCode));
}
// temporary data holder
const body = [];
// on every content chunk, push it to the data array
response.on('data', () => {});
// we are done, resolve promise with those joined chunks
response.on('end', () => resolve(response.headers));
});
// handle connection errors of the request
request.on('error', (err) => reject(err))
request.end()
})
}
exports.getCookies = function(headers) {
cookies = {}
headers['set-cookie'].forEach((element) => {
cookies = Object.assign(cookies, cookie.parse(element))
})
return cookies
}
| mathieupouedras/booker | services.js | JavaScript | mit | 1,128 |
'use strict';
/**
* Developed by Engagement Lab, 2019
* ==============
* Route to retrieve data by url
* @class api
* @author Johnny Richardson
*
* ==========
*/
const keystone = global.keystone,
mongoose = require('mongoose'),
Bluebird = require('bluebird');
mongoose.Promise = require('bluebird');
let list = keystone.list('Story').model;
var getAdjacent = (results, res, lang) => {
let fields = 'key photo.public_id ';
if (lang === 'en')
fields += 'name';
else if (lang === 'tm')
fields += 'nameTm';
else if (lang === 'hi')
fields += 'nameHi';
// Get one next/prev person from selected person's sortorder
let nextPerson = list.findOne({
sortOrder: {
$gt: results.jsonData.sortOrder
}
}, fields).limit(1);
let prevPerson = list.findOne({
sortOrder: {
$lt: results.jsonData.sortOrder
}
}, fields).sort({
sortOrder: -1
}).limit(1);
// Poplulate next/prev and output response
Bluebird.props({
next: nextPerson,
prev: prevPerson
}).then(nextPrevResults => {
let output = Object.assign(nextPrevResults, {
person: results.jsonData
});
return res.status(200).json({
status: 200,
data: output
});
}).catch(err => {
console.log(err);
});
};
var buildData = (storyId, res, lang) => {
let data = null;
let fields = 'key photo.public_id ';
if (lang === 'en')
fields += 'name subtitle';
else if (lang === 'tm')
fields += 'nameTm subtitleTm';
else if (lang === 'hi')
fields += 'nameHi subtitleHi';
if (storyId) {
let subFields = ' description.html ';
if (lang === 'tm')
subFields = ' descriptionTm.html ';
else if (lang === 'hi')
subFields = ' descriptionHi.html ';
data = list.findOne({
key: storyId
}, fields + subFields + 'sortOrder -_id');
} else
data = list.find({}, fields + ' -_id').sort([
['sortOrder', 'descending']
]);
Bluebird.props({
jsonData: data
})
.then(results => {
// When retrieving one story, also get next/prev ones
if (storyId)
getAdjacent(results, res, lang);
else {
return res.status(200).json({
status: 200,
data: results.jsonData
});
}
}).catch(err => {
console.log(err);
})
}
/*
* Get data
*/
exports.get = function (req, res) {
let id = null;
if (req.query.id)
id = req.query.id;
let lang = null;
if (req.params.lang)
lang = req.params.lang;
return buildData(id, res, lang);
} | engagementgamelab/hygiene-with-chhota-bheem | website/server/routes/api/stories.js | JavaScript | mit | 2,859 |
import React from 'react';
import Sortable from '../../src/';
import DemoItem from '../components/DemoItem';
export default class Dynamic extends React.Component {
constructor() {
super();
this.state = {
arr: [998, 225, 13]
};
}
handleSort(sortedArray) {
this.setState({
arr: sortedArray
});
}
handleAddElement() {
this.setState({
arr: this.state.arr.concat(Math.round(Math.random() * 1000))
});
}
handleRemoveElement(index) {
const newArr = this.state.arr.slice();
newArr.splice(index, 1);
this.setState({
arr: newArr
});
}
render() {
function renderItem(num, index) {
return (
<DemoItem key={num} className="dynamic-item" sortData={num}>
{num}
<span className="delete"
onClick={this.handleRemoveElement.bind(this, index)}
>×</span>
</DemoItem>
);
}
return (
<div className="demo-container">
<h4 className="demo-title">
Dynamically adding/removing children
<a href="https://github.com/jasonslyvia/react-anything-sortable/tree/master/demo/pages/dynamic.js" target="_blank">source</a>
</h4>
<div className="dynamic-demo">
<button onClick={::this.handleAddElement}>Add 1 element</button>
<Sortable onSort={::this.handleSort} dynamic>
{this.state.arr.map(renderItem, this)}
</Sortable>
</div>
</div>
);
}
}
| jasonslyvia/react-anything-sortable | demo/pages/dynamic.js | JavaScript | mit | 1,497 |
//
// AKPeakingParametricEqualizerFilterDSPKernel.hpp
// AudioKit
//
// Created by Aurelius Prochazka, revision history on Github.
// Copyright (c) 2016 Aurelius Prochazka. All rights reserved.
//
#ifndef AKPeakingParametricEqualizerFilterDSPKernel_hpp
#define AKPeakingParametricEqualizerFilterDSPKernel_hpp
#import "DSPKernel.hpp"
#import "ParameterRamper.hpp"
#import <AudioKit/AudioKit-Swift.h>
extern "C" {
#include "soundpipe.h"
}
enum {
centerFrequencyAddress = 0,
gainAddress = 1,
qAddress = 2
};
class AKPeakingParametricEqualizerFilterDSPKernel : public DSPKernel {
public:
// MARK: Member Functions
AKPeakingParametricEqualizerFilterDSPKernel() {}
void init(int channelCount, double inSampleRate) {
channels = channelCount;
sampleRate = float(inSampleRate);
sp_create(&sp);
sp->sr = sampleRate;
sp->nchan = channels;
sp_pareq_create(&pareq);
sp_pareq_init(sp, pareq);
pareq->fc = 1000;
pareq->v = 1.0;
pareq->q = 0.707;
pareq->mode = 0;
}
void start() {
started = true;
}
void stop() {
started = false;
}
void destroy() {
sp_pareq_destroy(&pareq);
sp_destroy(&sp);
}
void reset() {
resetted = true;
}
void setCenterFrequency(float fc) {
centerFrequency = fc;
centerFrequencyRamper.setImmediate(fc);
}
void setGain(float v) {
gain = v;
gainRamper.setImmediate(v);
}
void setQ(float q) {
q = q;
qRamper.setImmediate(q);
}
void setParameter(AUParameterAddress address, AUValue value) {
switch (address) {
case centerFrequencyAddress:
centerFrequencyRamper.setUIValue(clamp(value, (float)12.0, (float)20000.0));
break;
case gainAddress:
gainRamper.setUIValue(clamp(value, (float)0.0, (float)10.0));
break;
case qAddress:
qRamper.setUIValue(clamp(value, (float)0.0, (float)2.0));
break;
}
}
AUValue getParameter(AUParameterAddress address) {
switch (address) {
case centerFrequencyAddress:
return centerFrequencyRamper.getUIValue();
case gainAddress:
return gainRamper.getUIValue();
case qAddress:
return qRamper.getUIValue();
default: return 0.0f;
}
}
void startRamp(AUParameterAddress address, AUValue value, AUAudioFrameCount duration) override {
switch (address) {
case centerFrequencyAddress:
centerFrequencyRamper.startRamp(clamp(value, (float)12.0, (float)20000.0), duration);
break;
case gainAddress:
gainRamper.startRamp(clamp(value, (float)0.0, (float)10.0), duration);
break;
case qAddress:
qRamper.startRamp(clamp(value, (float)0.0, (float)2.0), duration);
break;
}
}
void setBuffers(AudioBufferList *inBufferList, AudioBufferList *outBufferList) {
inBufferListPtr = inBufferList;
outBufferListPtr = outBufferList;
}
void process(AUAudioFrameCount frameCount, AUAudioFrameCount bufferOffset) override {
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
int frameOffset = int(frameIndex + bufferOffset);
centerFrequency = centerFrequencyRamper.getAndStep();
pareq->fc = (float)centerFrequency;
gain = gainRamper.getAndStep();
pareq->v = (float)gain;
q = qRamper.getAndStep();
pareq->q = (float)q;
for (int channel = 0; channel < channels; ++channel) {
float *in = (float *)inBufferListPtr->mBuffers[channel].mData + frameOffset;
float *out = (float *)outBufferListPtr->mBuffers[channel].mData + frameOffset;
if (started) {
sp_pareq_compute(sp, pareq, in, out);
} else {
*out = *in;
}
}
}
}
// MARK: Member Variables
private:
int channels = AKSettings.numberOfChannels;
float sampleRate = AKSettings.sampleRate;
AudioBufferList *inBufferListPtr = nullptr;
AudioBufferList *outBufferListPtr = nullptr;
sp_data *sp;
sp_pareq *pareq;
float centerFrequency = 1000;
float gain = 1.0;
float q = 0.707;
public:
bool started = true;
bool resetted = false;
ParameterRamper centerFrequencyRamper = 1000;
ParameterRamper gainRamper = 1.0;
ParameterRamper qRamper = 0.707;
};
#endif /* AKPeakingParametricEqualizerFilterDSPKernel_hpp */
| dclelland/AudioKit | AudioKit/Common/Nodes/Effects/Filters/Peaking Parametric Equalizer Filter/AKPeakingParametricEqualizerFilterDSPKernel.hpp | C++ | mit | 4,836 |
import expect from "expect";
import { Collection } from "./Collection";
import { Server } from "./Server";
describe("Collection", () => {
describe("constructor", () => {
it("should set the initial set of data", () => {
const collection = new Collection([
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
]);
expect(collection.getAll()).toEqual([
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
]);
});
it("should set identifier name to id by default", () => {
const collection = new Collection();
expect(collection.identifierName).toEqual("id");
});
});
describe("getCount", () => {
it("should return an integer", () => {
expect(new Collection().getCount()).toEqual(0);
});
it("should return the collection size", () => {
expect(new Collection([{}, {}]).getCount()).toEqual(2);
});
it("should return the correct collection size, even when items were removed", () => {
const collection = new Collection([{}, {}, {}]);
collection.removeOne(1);
expect(collection.getCount()).toEqual(2);
});
it("should accept a query object", () => {
const collection = new Collection([{}, { name: "a" }, { name: "b" }]);
function filter(item) {
return item.name == "a" || item.name == "b";
}
expect(collection.getCount({ filter: filter })).toEqual(2);
});
});
describe("getAll", () => {
it("should return an array", () => {
expect(new Collection().getAll()).toEqual([]);
});
it("should return all collections", () => {
const collection = new Collection([
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
]);
expect(collection.getAll()).toEqual([
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
]);
});
describe("sort query", () => {
it("should throw an error if passed an unsupported sort argument", () => {
const collection = new Collection();
expect(() => {
collection.getAll({ sort: 23 });
}).toThrow(new Error("Unsupported sort type"));
});
it("should sort by sort function", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
const expected = [
{ name: "a", id: 1 },
{ name: "b", id: 2 },
{ name: "c", id: 0 },
];
function sort(a, b) {
if (a.name > b.name) {
return 1;
}
if (a.name < b.name) {
return -1;
}
// a must be equal to b
return 0;
}
expect(collection.getAll({ sort: sort })).toEqual(expected);
});
it("should sort by sort name", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
const expected = [
{ name: "a", id: 1 },
{ name: "b", id: 2 },
{ name: "c", id: 0 },
];
expect(collection.getAll({ sort: "name" })).toEqual(expected);
});
it("should sort by sort name and direction", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
let expected;
expected = [
{ name: "a", id: 1 },
{ name: "b", id: 2 },
{ name: "c", id: 0 },
];
expect(collection.getAll({ sort: ["name", "asc"] })).toEqual(expected);
expected = [
{ name: "c", id: 0 },
{ name: "b", id: 2 },
{ name: "a", id: 1 },
];
expect(collection.getAll({ sort: ["name", "desc"] })).toEqual(expected);
});
it("should not affect further requests", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
collection.getAll({ sort: "name" });
const expected = [
{ name: "c", id: 0 },
{ name: "a", id: 1 },
{ name: "b", id: 2 },
];
expect(collection.getAll()).toEqual(expected);
});
});
describe("filter query", () => {
it("should throw an error if passed an unsupported filter argument", () => {
const collection = new Collection();
expect(() => {
collection.getAll({ filter: 23 });
}).toThrow(new Error("Unsupported filter type"));
});
it("should filter by filter function", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
const expected = [
{ name: "c", id: 0 },
{ name: "b", id: 2 },
];
function filter(item) {
return item.name !== "a";
}
expect(collection.getAll({ filter: filter })).toEqual(expected);
});
it("should filter by filter object", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
const expected = [{ name: "b", id: 2 }];
expect(collection.getAll({ filter: { name: "b" } })).toEqual(expected);
});
it("should filter values with deep paths", () => {
const collection = new Collection([
{ name: "c", deep: { value: "c" } },
{ name: "a", deep: { value: "a" } },
{ name: "b", deep: { value: "b" } },
]);
const expected = [{ name: "b", deep: { value: "b" }, id: 2 }];
expect(collection.getAll({ filter: { "deep.value": "b" } })).toEqual(expected);
});
it("should filter values with objects", () => {
const collection = new Collection([
{ name: "c", deep: { value: "c" } },
{ name: "a", deep: { value: "a" } },
{ name: "b", deep: { value: "b" } },
]);
const expected = [{ name: "b", deep: { value: "b" }, id: 2 }];
expect(collection.getAll({ filter: { deep: { value: "b" } } })).toEqual(expected);
});
it("should filter boolean values properly", () => {
const collection = new Collection([
{ name: "a", is: true },
{ name: "b", is: false },
{ name: "c", is: true },
]);
const expectedFalse = [{ name: "b", id: 1, is: false }];
const expectedTrue = [
{ name: "a", id: 0, is: true },
{ name: "c", id: 2, is: true },
];
expect(collection.getAll({ filter: { is: "false" } })).toEqual(
expectedFalse
);
expect(collection.getAll({ filter: { is: false } })).toEqual(
expectedFalse
);
expect(collection.getAll({ filter: { is: "true" } })).toEqual(
expectedTrue
);
expect(collection.getAll({ filter: { is: true } })).toEqual(
expectedTrue
);
});
it("should filter array values properly", () => {
const collection = new Collection([
{ tags: ["a", "b", "c"] },
{ tags: ["b", "c", "d"] },
{ tags: ["c", "d", "e"] },
]);
const expected = [
{ id: 0, tags: ["a", "b", "c"] },
{ id: 1, tags: ["b", "c", "d"] },
];
expect(collection.getAll({ filter: { tags: "b" } })).toEqual(expected);
expect(collection.getAll({ filter: { tags: "f" } })).toEqual([]);
});
it("should filter array values properly within deep paths", () => {
const collection = new Collection([
{ deep: { tags: ["a", "b", "c"] } },
{ deep: { tags: ["b", "c", "d"] } },
{ deep: { tags: ["c", "d", "e"] } },
]);
const expected = [
{ id: 0, deep: { tags: ["a", "b", "c"] } },
{ id: 1, deep: { tags: ["b", "c", "d"] } },
];
expect(collection.getAll({ filter: { 'deep.tags': "b" } })).toEqual(expected);
expect(collection.getAll({ filter: { 'deep.tags': "f" } })).toEqual([]);
});
it("should filter array values properly inside deep paths", () => {
const collection = new Collection([
{ tags: { deep: ["a", "b", "c"] } },
{ tags: { deep: ["b", "c", "d"] } },
{ tags: { deep: ["c", "d", "e"] } },
]);
const expected = [
{ id: 0, tags: { deep: ["a", "b", "c"] } },
{ id: 1, tags: { deep: ["b", "c", "d"] } },
];
expect(collection.getAll({ filter: { 'tags.deep': "b" } })).toEqual(expected);
expect(collection.getAll({ filter: { 'tags.deep': "f" } })).toEqual([]);
});
it("should filter array values properly with deep paths", () => {
const collection = new Collection([
{ tags: [{ name: "a" }, { name: "b" }, { name: "c" }] },
{ tags: [{ name: "b" }, { name: "c" }, { name: "d" }] },
{ tags: [{ name: "c" }, { name: "d" }, { name: "e" }] },
]);
const expected = [
{ id: 0, tags: [{ name: "a" }, { name: "b" }, { name: "c" }] },
{ id: 1, tags: [{ name: "b" }, { name: "c" }, { name: "d" }] },
];
expect(collection.getAll({ filter: { 'tags.name': "b" } })).toEqual(expected);
expect(collection.getAll({ filter: { 'tags.name': "f" } })).toEqual([]);
});
it("should filter array values properly when receiving several values within deep paths", () => {
const collection = new Collection([
{ deep: { tags: ["a", "b", "c"] } },
{ deep: { tags: ["b", "c", "d"] } },
{ deep: { tags: ["c", "d", "e"] } },
]);
const expected = [{ id: 1, deep: { tags: ["b", "c", "d"] } }];
expect(collection.getAll({ filter: { 'deep.tags': ["b", "d"] } })).toEqual(
expected
);
expect(
collection.getAll({ filter: { 'deep.tags': ["a", "b", "e"] } })
).toEqual([]);
});
it("should filter array values properly when receiving several values with deep paths", () => {
const collection = new Collection([
{ tags: [{ name: "a" }, { name: "b" }, { name: "c" }] },
{ tags: [{ name: "c" }, { name: "d" }, { name: "e" }] },
{ tags: [{ name: "e" }, { name: "f" }, { name: "g" }] },
]);
const expected = [
{ id: 0, tags: [{ name: "a" }, { name: "b" }, { name: "c" }] },
{ id: 1, tags: [{ name: "c" }, { name: "d" }, { name: "e" }] }
];
expect(collection.getAll({ filter: { 'tags.name': ["c"] } })).toEqual(
expected
);
expect(
collection.getAll({ filter: { 'tags.name': ["h", "i"] } })
).toEqual([]);
});
it("should filter array values properly when receiving several values", () => {
const collection = new Collection([
{ tags: ["a", "b", "c"] },
{ tags: ["b", "c", "d"] },
{ tags: ["c", "d", "e"] },
]);
const expected = [{ id: 1, tags: ["b", "c", "d"] }];
expect(collection.getAll({ filter: { tags: ["b", "d"] } })).toEqual(
expected
);
expect(
collection.getAll({ filter: { tags: ["a", "b", "e"] } })
).toEqual([]);
});
it("should filter by the special q full-text filter", () => {
const collection = new Collection([
{ a: "Hello", b: "world" },
{ a: "helloworld", b: "bunny" },
{ a: "foo", b: "bar" },
{ a: { b: "bar" } },
{ a: "", b: "" },
{ a: null, b: null },
{},
]);
expect(collection.getAll({ filter: { q: "hello" } })).toEqual([
{ id: 0, a: "Hello", b: "world" },
{ id: 1, a: "helloworld", b: "bunny" },
]);
expect(collection.getAll({ filter: { q: "bar" } })).toEqual([
{ id: 2, a: "foo", b: "bar" },
{ id: 3, a: { b: "bar" } },
]);
});
it("should filter by range using _gte, _gt, _lte, and _lt", () => {
const collection = new Collection([{ v: 1 }, { v: 2 }, { v: 3 }]);
expect(collection.getAll({ filter: { v_gte: 2 } })).toEqual([
{ v: 2, id: 1 },
{ v: 3, id: 2 },
]);
expect(collection.getAll({ filter: { v_gt: 2 } })).toEqual([
{ v: 3, id: 2 },
]);
expect(collection.getAll({ filter: { v_gte: 4 } })).toEqual([]);
expect(collection.getAll({ filter: { v_lte: 2 } })).toEqual([
{ v: 1, id: 0 },
{ v: 2, id: 1 },
]);
expect(collection.getAll({ filter: { v_lt: 2 } })).toEqual([
{ v: 1, id: 0 },
]);
expect(collection.getAll({ filter: { v_lte: 0 } })).toEqual([]);
});
it("should filter by inequality using _neq", () => {
const collection = new Collection([{ v: 1 }, { v: 2 }, { v: 3 }]);
expect(collection.getAll({ filter: { v_neq: 2 } })).toEqual([
{ v: 1, id: 0 },
{ v: 3, id: 2 },
]);
});
it("should filter by text search using _q", () => {
const collection = new Collection([{ v: 'abCd' }, { v: 'cDef' }, { v: 'EFgh' }]);
expect(collection.getAll({ filter: { v_q: 'cd' } })).toEqual([
{ id: 0, v: 'abCd' }, { id: 1, v: 'cDef' }
]);
expect(collection.getAll({ filter: { v_q: 'ef' } })).toEqual([
{ id: 1, v: 'cDef' }, { id: 2, v: 'EFgh' }
]);
});
it("should filter by array", () => {
const collection = new Collection([
{ a: "H" },
{ a: "e" },
{ a: "l" },
{ a: "l" },
{ a: "o" },
]);
expect(collection.getAll({ filter: { id: [] } })).toEqual([]);
expect(collection.getAll({ filter: { id: [1, 2, 3] } })).toEqual([
{ id: 1, a: "e" },
{ id: 2, a: "l" },
{ id: 3, a: "l" },
]);
expect(collection.getAll({ filter: { id: ["1", "2", "3"] } })).toEqual([
{ id: 1, a: "e" },
{ id: 2, a: "l" },
{ id: 3, a: "l" },
]);
});
it("should combine all filters with an AND logic", () => {
const collection = new Collection([{ v: 1 }, { v: 2 }, { v: 3 }]);
expect(collection.getAll({ filter: { v_gte: 2, v_lte: 2 } })).toEqual([
{ v: 2, id: 1 },
]);
});
it("should not affect further requests", () => {
const collection = new Collection([
{ name: "c" },
{ name: "a" },
{ name: "b" },
]);
function filter(item) {
return item.name !== "a";
}
collection.getAll({ filter: filter });
const expected = [
{ name: "c", id: 0 },
{ name: "a", id: 1 },
{ name: "b", id: 2 },
];
expect(collection.getAll()).toEqual(expected);
});
});
describe("range query", () => {
it("should throw an error if passed an unsupported range argument", () => {
const collection = new Collection();
expect(() => {
collection.getAll({ range: 23 });
}).toThrow(new Error("Unsupported range type"));
});
const collection = new Collection([
{ id: 0, name: "a" },
{ id: 1, name: "b" },
{ id: 2, name: "c" },
{ id: 3, name: "d" },
{ id: 4, name: "e" },
]);
it("should return a range in the collection", () => {
let expected;
expected = [{ id: 0, name: "a" }];
expect(collection.getAll({ range: [0, 0] })).toEqual(expected);
expected = [
{ id: 1, name: "b" },
{ id: 2, name: "c" },
{ id: 3, name: "d" },
{ id: 4, name: "e" },
];
expect(collection.getAll({ range: [1] })).toEqual(expected);
expected = [
{ id: 2, name: "c" },
{ id: 3, name: "d" },
];
expect(collection.getAll({ range: [2, 3] })).toEqual(expected);
});
it("should not affect further requests", () => {
const collection = new Collection([
{ id: 0, name: "a" },
{ id: 1, name: "b" },
{ id: 2, name: "c" },
]);
collection.getAll({ range: [1] });
const expected = [
{ id: 0, name: "a" },
{ id: 1, name: "b" },
{ id: 2, name: "c" },
];
expect(collection.getAll()).toEqual(expected);
});
});
describe("embed query", () => {
it("should throw an error when trying to embed a non-existing collection", () => {
const foos = new Collection([{ name: "John", bar_id: 123 }]);
const server = new Server();
server.addCollection("foos", foos);
expect(() => {
foos.getAll({ embed: ["bar"] });
}).toThrow(new Error("Can't embed a non-existing collection bar"));
});
it("should return the original object for missing embed one", () => {
const foos = new Collection([{ name: "John", bar_id: 123 }]);
const bars = new Collection([]);
const server = new Server();
server.addCollection("foos", foos);
server.addCollection("bars", bars);
const expected = [{ id: 0, name: "John", bar_id: 123 }];
expect(foos.getAll({ embed: ["bar"] })).toEqual(expected);
});
it("should return the object with the reference object for embed one", () => {
const foos = new Collection([
{ name: "John", bar_id: 123 },
{ name: "Jane", bar_id: 456 },
]);
const bars = new Collection([
{ id: 1, bar: "nobody wants me" },
{ id: 123, bar: "baz" },
{ id: 456, bar: "bazz" },
]);
const server = new Server();
server.addCollection("foos", foos);
server.addCollection("bars", bars);
const expected = [
{ id: 0, name: "John", bar_id: 123, bar: { id: 123, bar: "baz" } },
{ id: 1, name: "Jane", bar_id: 456, bar: { id: 456, bar: "bazz" } },
];
expect(foos.getAll({ embed: ["bar"] })).toEqual(expected);
});
it("should throw an error when trying to embed many a non-existing collection", () => {
const foos = new Collection([{ name: "John", bar_id: 123 }]);
const server = new Server();
server.addCollection("foos", foos);
expect(() => {
foos.getAll({ embed: ["bars"] });
}).toThrow(new Error("Can't embed a non-existing collection bars"));
});
it("should return the object with an empty array for missing embed many", () => {
const foos = new Collection([{ name: "John", bar_id: 123 }]);
const bars = new Collection([{ id: 1, bar: "nobody wants me" }]);
const server = new Server();
server.addCollection("foos", foos);
server.addCollection("bars", bars);
const expected = [{ id: 1, bar: "nobody wants me", foos: [] }];
expect(bars.getAll({ embed: ["foos"] })).toEqual(expected);
});
it("should return the object with an array of references for embed many", () => {
const foos = new Collection([
{ id: 1, name: "John", bar_id: 123 },
{ id: 2, name: "Jane", bar_id: 456 },
{ id: 3, name: "Jules", bar_id: 456 },
]);
const bars = new Collection([
{ id: 1, bar: "nobody wants me" },
{ id: 123, bar: "baz" },
{ id: 456, bar: "bazz" },
]);
const server = new Server();
server.addCollection("foos", foos);
server.addCollection("bars", bars);
const expected = [
{ id: 1, bar: "nobody wants me", foos: [] },
{ id: 123, bar: "baz", foos: [{ id: 1, name: "John", bar_id: 123 }] },
{
id: 456,
bar: "bazz",
foos: [
{ id: 2, name: "Jane", bar_id: 456 },
{ id: 3, name: "Jules", bar_id: 456 },
],
},
];
expect(bars.getAll({ embed: ["foos"] })).toEqual(expected);
});
it("should return the object with an array of references for embed many using inner array", () => {
const foos = new Collection([
{ id: 1, name: "John" },
{ id: 2, name: "Jane" },
{ id: 3, name: "Jules" },
]);
const bars = new Collection([
{ id: 1, bar: "nobody wants me" },
{ id: 123, bar: "baz", foos: [1] },
{ id: 456, bar: "bazz", foos: [2, 3] },
]);
const server = new Server();
server.addCollection("foos", foos);
server.addCollection("bars", bars);
const expected = [
{ id: 1, bar: "nobody wants me", foos: [] },
{ id: 123, bar: "baz", foos: [{ id: 1, name: "John" }] },
{
id: 456,
bar: "bazz",
foos: [
{ id: 2, name: "Jane" },
{ id: 3, name: "Jules" },
],
},
];
expect(bars.getAll({ embed: ["foos"] })).toEqual(expected);
});
it("should allow multiple embeds", () => {
const books = new Collection([
{ id: 1, title: "Pride and Prejudice", author_id: 1 },
{ id: 2, title: "Sense and Sensibility", author_id: 1 },
{ id: 3, title: "War and Preace", author_id: 2 },
]);
const authors = new Collection([
{ id: 1, firstName: "Jane", lastName: "Austen", country_id: 1 },
{ id: 2, firstName: "Leo", lastName: "Tosltoi", country_id: 2 },
]);
const countries = new Collection([
{ id: 1, name: "England" },
{ id: 2, name: "Russia" },
]);
const server = new Server();
server.addCollection("books", books);
server.addCollection("authors", authors);
server.addCollection("countrys", countries); // nevermind the plural
const expected = [
{
id: 1,
firstName: "Jane",
lastName: "Austen",
country_id: 1,
books: [
{ id: 1, title: "Pride and Prejudice", author_id: 1 },
{ id: 2, title: "Sense and Sensibility", author_id: 1 },
],
country: { id: 1, name: "England" },
},
{
id: 2,
firstName: "Leo",
lastName: "Tosltoi",
country_id: 2,
books: [{ id: 3, title: "War and Preace", author_id: 2 }],
country: { id: 2, name: "Russia" },
},
];
expect(authors.getAll({ embed: ["books", "country"] })).toEqual(
expected
);
});
});
describe("composite query", () => {
it("should execute all commands of the query object", () => {
const collection = new Collection([
{ id: 0, name: "c", arg: false },
{ id: 1, name: "b", arg: true },
{ id: 2, name: "a", arg: true },
]);
const query = {
filter: { arg: true },
sort: "name",
};
const expected = [
{ id: 2, name: "a", arg: true },
{ id: 1, name: "b", arg: true },
];
expect(collection.getAll(query)).toEqual(expected);
});
});
});
describe("getOne", () => {
it("should throw an exception when trying to get a non-existing item", () => {
const collection = new Collection();
expect(() => {
collection.getOne(0);
}).toThrow(new Error("No item with identifier 0"));
});
it("should return the first collection matching the identifier", () => {
const collection = new Collection([
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
]);
expect(collection.getOne(1)).toEqual({ id: 1, name: "foo" });
expect(collection.getOne(2)).toEqual({ id: 2, name: "bar" });
});
it("should use the identifierName", () => {
const collection = new Collection(
[
{ _id: 1, name: "foo" },
{ _id: 2, name: "bar" },
],
"_id"
);
expect(collection.getOne(1)).toEqual({ _id: 1, name: "foo" });
expect(collection.getOne(2)).toEqual({ _id: 2, name: "bar" });
});
});
describe("addOne", () => {
it("should return the item inserted", () => {
const collection = new Collection();
const r = collection.addOne({ name: "foo" });
expect(r.name).toEqual("foo");
});
it("should add the item", () => {
const collection = new Collection();
collection.addOne({ name: "foo" });
expect(collection.getOne(0)).toEqual({ id: 0, name: "foo" });
});
it("should incement the sequence at each insertion", () => {
const collection = new Collection();
expect(collection.sequence).toEqual(0);
collection.addOne({ name: "foo" });
expect(collection.sequence).toEqual(1);
collection.addOne({ name: "foo" });
expect(collection.sequence).toEqual(2);
});
it("should set identifier if not provided", () => {
const collection = new Collection();
const r1 = collection.addOne({ name: "foo" });
expect(r1.id).toEqual(0);
const r2 = collection.addOne({ name: "bar" });
expect(r2.id).toEqual(1);
});
it("should refuse insertion with existing identifier", () => {
const collection = new Collection([{ name: "foo" }]);
expect(() => {
collection.addOne({ id: 0, name: "bar" });
}).toThrow(new Error("An item with the identifier 0 already exists"));
});
it("should accept insertion with non-existing identifier and move sequence accordingly", () => {
const collection = new Collection();
collection.addOne({ name: "foo" });
collection.addOne({ id: 12, name: "bar" });
expect(collection.sequence).toEqual(13);
const r = collection.addOne({ name: "bar" });
expect(r.id).toEqual(13);
});
});
describe("updateOne", () => {
it("should throw an exception when trying to update a non-existing item", () => {
const collection = new Collection();
expect(() => {
collection.updateOne(0, { id: 0, name: "bar" });
}).toThrow(new Error("No item with identifier 0"));
});
it("should return the updated item", () => {
const collection = new Collection([{ name: "foo" }]);
expect(collection.updateOne(0, { id: 0, name: "bar" })).toEqual({
id: 0,
name: "bar",
});
});
it("should update the item", () => {
const collection = new Collection([{ name: "foo" }, { name: "baz" }]);
collection.updateOne(0, { id: 0, name: "bar" });
expect(collection.getOne(0)).toEqual({ id: 0, name: "bar" });
expect(collection.getOne(1)).toEqual({ id: 1, name: "baz" });
});
});
describe("removeOne", () => {
it("should throw an exception when trying to remove a non-existing item", () => {
const collection = new Collection();
expect(() => {
collection.removeOne(0);
}).toThrow(new Error("No item with identifier 0"));
});
it("should remove the item", () => {
const collection = new Collection();
const item = collection.addOne({ name: "foo" });
collection.removeOne(item.id);
expect(collection.getAll()).toEqual([]);
});
it("should return the removed item", () => {
const collection = new Collection();
const item = collection.addOne({});
const r = collection.removeOne(item.id);
expect(r).toEqual(item);
});
it("should decrement the sequence only if the removed item is the last", () => {
const collection = new Collection([{ id: 0 }, { id: 1 }, { id: 2 }]);
expect(collection.sequence).toEqual(3);
collection.removeOne(2);
expect(collection.sequence).toEqual(2);
collection.removeOne(0);
expect(collection.sequence).toEqual(2);
const r = collection.addOne({});
expect(r.id).toEqual(2);
});
});
});
| marmelab/FakeRest | src/Collection.spec.js | JavaScript | mit | 28,068 |
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Deployment.Common.Actions;
using Microsoft.Deployment.Common.ActionModel;
using Microsoft.Deployment.Common.Helpers;
using Microsoft.Deployment.Common.ErrorCode;
namespace Microsoft.Deployment.Actions.Salesforce
{
[Export(typeof(IAction))]
class ADFSliceStatus : BaseAction
{
private string apiVersion = "2015-10-01";
private string getDatasetRelativeUrl = "providers/Microsoft.DataFactory/datafactories/{0}/datasets";
public override async Task<ActionResponse> ExecuteActionAsync(ActionRequest request)
{
var token = request.DataStore.GetJson("AzureToken", "access_token");
var subscription = request.DataStore.GetJson("SelectedSubscription", "SubscriptionId");
var resourceGroup = request.DataStore.GetValue("SelectedResourceGroup");
var dataFactory = resourceGroup.Replace("_", string.Empty) + "SalesforceCopyFactory";
string coreObjects = request.DataStore.GetValue("ObjectTables");
var url = string.Format(getDatasetRelativeUrl, dataFactory);
DataTable table = new DataTable();
table.Columns.Add("Dataset");
table.Columns.Add("Start");
table.Columns.Add("End");
table.Columns.Add("Status");
var client = new AzureHttpClient(token, subscription, resourceGroup);
var connection = await client.ExecuteWithSubscriptionAndResourceGroupAsync(HttpMethod.Get,
url, apiVersion, string.Empty);
if (!connection.IsSuccessStatusCode)
{
var result = connection.Content.ReadAsStringAsync().Result;
return new ActionResponse(ActionStatus.FailureExpected,
JsonUtility.GetJObjectFromJsonString(result), null, DefaultErrorCodes.DefaultErrorCode,
result);
}
var connectionData = JsonUtility.GetJObjectFromJsonString(connection.Content.ReadAsStringAsync().Result);
if (connectionData != null)
{
foreach (var dataset in connectionData["value"])
{
var nameParts = dataset["name"].ToString().Split('_');
if (nameParts[0] == "PreDeployment" && nameParts[2] == "Output" && coreObjects.Contains(nameParts[1]))
{
Dictionary<string, string> queryParameters = new Dictionary<string, string>();
queryParameters.Add("start", DateTime.UtcNow.AddYears(-3).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture));
queryParameters.Add("end", DateTime.UtcNow.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture));
var sliceRelativeUrl = string.Concat(url, '/', dataset["name"].ToString());
sliceRelativeUrl.Remove(0, 1);
var sliceConnection = await client.ExecuteWithSubscriptionAndResourceGroupAsync(HttpMethod.Get,
sliceRelativeUrl + "/slices/",
apiVersion,
string.Empty,
queryParameters
);
if (!sliceConnection.IsSuccessStatusCode)
{
var result = connection.Content.ReadAsStringAsync().Result;
return new ActionResponse(ActionStatus.FailureExpected,
JsonUtility.GetJObjectFromJsonString(result), null, DefaultErrorCodes.DefaultErrorCode,
result);
}
var data = JsonUtility.GetJObjectFromJsonString(sliceConnection.Content.ReadAsStringAsync().Result);
if (data["value"].Count() > 2)
{
int numberOfSlices = data["value"].Count() - 2;
var lastSlice = data["value"][numberOfSlices];
table.Rows.Add(new[] { dataset["name"].ToString().Split('_')[1], lastSlice["start"].ToString(), lastSlice["end"].ToString(), lastSlice["status"].ToString() });
}
else
{
table.Rows.Add(new[] { dataset["name"].ToString().Split('_')[1], string.Empty, string.Empty, data["value"][0]["status"].ToString() });
}
}
}
}
var ready = from DataRow row in table.Rows
where (string)row["Status"] != "Ready"
select (string)row["Dataset"];
var response = JsonUtility.CreateJObjectWithValueFromObject(table);
if (ready.Count() > 0)
{
return new ActionResponse(ActionStatus.InProgress, response);
}
else
{
return new ActionResponse(ActionStatus.Success, response);
}
}
}
} | MattFarm/BusinessPlatformApps | Source/Actions/Microsoft.Deployment.Actions.Salesforce/ADFSliceStatus.cs | C# | mit | 5,350 |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"path"
"strconv"
"strings"
"time"
)
const (
COURSE_BASEURL = "http://www.pluralsight.com/courses/"
COURSEDATA_BASEURL = "http://www.pluralsight.com/data/course/content/%s"
)
/* Individual course modules */
type CourseModule struct {
ModuleRef string `json: "moduleRef"`
Title string `json: "title"`
Description string `json: "description"`
Duration string `json: "duration"`
FragmentId string `json: "fragmentIdentifier"`
}
type DurationParts struct {
Hours uint64
Minutes uint64
Seconds uint64
}
func SaveCourseChapters(url string, verbose bool) {
// Parse the course name from the url
courseName := strings.Replace(url, COURSE_BASEURL, "", 1)
courseName = strings.TrimSpace(courseName)
// Set the output name
outputName := path.Join(*basePath, fmt.Sprintf("%s.txt", courseName))
// For a given course name, get the chapter information
chapters, err := getCourseChapters(courseName)
if err != nil {
log.Panicf("Error getting course chapters: %v", err)
}
// If we have chapters ...
if len(chapters) > 0 {
// Write them to the output file
fmt.Printf("Writing %d chapters to %s\n", len(chapters), outputName)
f, err := os.Create(outputName)
if err != nil {
log.Panicf("There was a problem opening the output file %s: %v", outputName, err)
}
defer f.Close()
// For our cumulative duration calculations:
now := time.Now()
marker := now
for _, chapter := range chapters {
// Example of what this needs to look like:
// 00:00:00.000 Introduction to Puppet
// 00:24:54.000 Installing and Configuring the Puppet Master
// 01:26:09.000 Installing and Configuring the Puppet Agent
// 02:13:19.000 Creating Manifests
// Chapter time marker starts at 00:00:00 and is cumulative for each
// module after the first.
// Get the difference between the start
// and the current marker position
markerinfo := marker.Sub(now)
durparts := toDurationParts(markerinfo)
line := fmt.Sprintf("%#02d:%#02d:%#02d.000 %s\r\n", durparts.Hours, durparts.Minutes, durparts.Seconds, chapter.Title)
f.WriteString(line)
if verbose {
fmt.Print(line)
}
// Parse the current chapter duration and
// move the marker position forward
durationInfo := strings.Split(chapter.Duration, ":")
secondsToAdd, _ := strconv.Atoi(durationInfo[2])
newmarkerinfo, err := time.ParseDuration(fmt.Sprintf("%sh%sm%ds", durationInfo[0], durationInfo[1], secondsToAdd+1))
if err != nil {
log.Panicf("What a nightmare. Bad things happened while parsing duration: %v", err)
}
marker = marker.Add(newmarkerinfo)
}
// Make sure all writes are sync'd
f.Sync()
} else {
// Otherwise, indicate that something might be wrong
fmt.Println("It looks like we didn't find any chapters. Are you sure your url is correct?")
}
}
func getCourseChapters(courseName string) ([]CourseModule, error) {
// Construct the complete url
// url := COURSEDATA_BASEURL + courseName
coursedata_url := fmt.Sprintf(COURSEDATA_BASEURL, courseName)
// Go fetch the response from the server:
res, err := http.Get(coursedata_url)
if err != nil {
return []CourseModule{}, err
}
defer res.Body.Close()
// Read the body of the response if we have one:
body, err := ioutil.ReadAll(res.Body)
if err != nil {
return []CourseModule{}, err
}
// Unmarshall from JSON into our struct:
courseinfo := &[]CourseModule{}
if err := json.Unmarshal(body, &courseinfo); err != nil {
return []CourseModule{}, err
}
// Return the slice of course modules
return *courseinfo, nil
}
// ToDurationParts returns a DurationParts
func toDurationParts(d time.Duration) DurationParts {
retval := DurationParts{}
seconds := d.Seconds()
seconds -= float64(d / time.Minute * 60)
retval.Hours = uint64(d / time.Hour)
retval.Minutes = uint64(d / time.Minute % 60)
retval.Seconds = uint64(seconds)
return retval
}
| danesparza/psproxy | courseinfo.go | GO | mit | 3,987 |
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
$console = new Application('My Silex Application', 'n/a');
$console->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
$console->setDispatcher($app['dispatcher']);
/**
* RabbitMQ Consumer
*/
$console
->register('rabbitmq:consumer')
->setDefinition(array(
new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Message type'),
))
->setDescription('Consumes a queue message')
->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
$connections = array(
'default' => new \PhpAmqpLib\Connection\AMQPLazyConnection('localhost', 5672, 'guest', 'guest', '/')
);
$type = $input->getOption('type');
/** Exercice : Create a consumer and use it! */
})
;
return $console;
| oriolgm/rabbitmq-training | src/console.php | PHP | mit | 1,134 |
import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response";
import { flushPromises, startTimeline } from "../utils";
describe("jsPsych.run()", () => {
beforeEach(() => {
document.body.innerHTML = "";
});
function setReadyState(targetState: "loading" | "complete") {
jest.spyOn(document, "readyState", "get").mockImplementation(() => targetState);
}
function getBodyHTML() {
return document.body.innerHTML;
}
async function init() {
await startTimeline([
{
type: htmlKeyboardResponse,
stimulus: "foo",
},
]);
}
// Currently not implemented – we need a way to await promises
it("should delay execution until the document is ready", async () => {
expect(getBodyHTML()).toBe("");
setReadyState("loading");
await init();
expect(getBodyHTML()).toBe("");
// Simulate the document getting ready
setReadyState("complete");
window.dispatchEvent(new Event("load"));
await flushPromises();
expect(getBodyHTML()).not.toBe("");
});
it("should execute immediately when the document is ready", async () => {
// The document is ready by default in jsdom
await init();
expect(getBodyHTML()).not.toBe("");
});
});
| jodeleeuw/jsPsych | packages/jspsych/tests/core/run.test.ts | TypeScript | mit | 1,243 |
class CreateManifestationReserveStats < ActiveRecord::Migration[5.2]
def self.up
create_table :manifestation_reserve_stats do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note
t.timestamps
end
end
def self.down
drop_table :manifestation_reserve_stats
end
end
| next-l/enju_inventory | spec/dummy/db/migrate/20081216190724_create_manifestation_reserve_stats.rb | Ruby | mit | 316 |
/* *******************************************************
* Released under the MIT License (MIT) --- see LICENSE
* Copyright (c) 2014 Ankit Singla, Sangeetha Abdu Jyothi,
* Chi-Yao Hong, Lucian Popa, P. Brighten Godfrey,
* Alexandra Kolla, Simon Kassing
* ******************************************************** */
package ch.ethz.topobench.graph.patheval.generators;
import ch.ethz.topobench.graph.SelectorResult;
import ch.ethz.topobench.graph.patheval.NeighborPathEvaluator;
import ch.ethz.topobench.graph.Graph;
import ch.ethz.topobench.graph.patheval.PathEvaluator;
import ch.ethz.topobench.graph.utility.CmdAssistant;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
public class NeighborPathEvaluatorGenerator implements PathEvaluatorGenerator {
@Override
public SelectorResult<PathEvaluator> generate(Graph graph, String[] args) {
// Parse the options
CommandLine cmd = CmdAssistant.parseOptions(new Options(), args, true);
// Return path evaluator
return new SelectorResult<>(new NeighborPathEvaluator(graph), cmd.getArgs());
}
}
| ndal-eth/topobench | src/main/java/ch/ethz/topobench/graph/patheval/generators/NeighborPathEvaluatorGenerator.java | Java | mit | 1,132 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
namespace Joe.Business
{
public interface IManyToMany
{
[Required(ErrorMessage = "A Valid Entry is Required for this Field, Please Select from the Prompted List.")]
[Range(1, 9999999999999, ErrorMessage = "A Valid Entry is Required for this Field, Please Select from the Prompted List.")]
int ID1 { get; set; }
[Required(ErrorMessage = "A Valid Entry is Required for this Field, Please Select from the Prompted List.")]
[Range(1, 9999999999999, ErrorMessage = "A Valid Entry is Required for this Field, Please Select from the Prompted List.")]
int ID2 { get; set; }
String Name1 { get; set; }
String Name2 { get; set; }
Boolean Included { get; set; }
}
}
| jtstriker3/Joe.Business | IManyToMany.cs | C# | mit | 895 |
import * as React from 'react'
const invariant = require('invariant');
import {ListMainInfoLeft} from "./ListMainInfoLeft";
import {ListMainInfoDescription} from "./ListMainInfoDescription";
import {ListAdditionalInfo} from "./ListAdditionalInfo";
import {ListAdditionalInfoStacked} from "./ListAdditionalInfoStacked";
interface ItemsDto {
left?: React.ReactElement<any>
description?: React.ReactElement<any>
additional: React.ReactElement<any>[]
}
export class ListMainInfo extends React.Component<any, any> {
static get Left(): typeof ListMainInfoLeft {
return ListMainInfoLeft;
}
static get Description(): typeof ListMainInfoDescription {
return ListMainInfoDescription;
}
static get Additional(): typeof ListAdditionalInfo {
return ListAdditionalInfo;
}
static get AdditionalStacked(): typeof ListAdditionalInfoStacked {
return ListAdditionalInfoStacked;
}
private findItems(children: React.ReactNode): ItemsDto {
let left = null;
let description = null;
let additional = [];
const allChildren = React.Children.toArray(children);
allChildren.forEach(child => {
if(React.isValidElement(child)) {
switch (child.type) {
case ListMainInfoLeft:
invariant(left == null, 'Only one Left element allowed.');
left = child;
break;
case ListMainInfoDescription:
invariant(description == null, 'Only one Description element allowed.');
description = child;
break;
case ListAdditionalInfo:
additional.push(child);
break;
case ListAdditionalInfoStacked:
additional.push(child);
break;
default:
invariant(false, 'Only Left, Description and Additional elements allowed as child for ListMainInfo')
}
}
});
return {left, description, additional}
}
render(): React.ReactElement<any> {
const items = this.findItems(this.props.children);
return <div className="list-view-pf-main-info">
{items.left}
<div className="list-view-pf-body">
{items.description}
<div className="list-view-pf-additional-info">
{items.additional}
</div>
</div>
</div>
}
} | idimaster/patternfly-react | src/view/list/ListMainInfo.tsx | TypeScript | mit | 2,631 |
<?php
namespace WSL\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DemoController extends Controller
{
public function __construct($templating) {
$this->templating = $templating;
}
public function indexAction($name)
{
return $this->templating->renderResponse('WSLDemoBundle:Demo:index.html.twig',
array('name' => $name)
);
}
}
| agilemedialab/AmlStandard | src/WSL/DemoBundle/Controller/DemoController.php | PHP | mit | 428 |
require 'base64'
require 'encryptor'
require 'sidekiq-field-encryptor/version'
module SidekiqFieldEncryptor
class Base
def initialize(options = {})
@encryption_key = options[:encryption_key]
@encrypted_fields = options[:encrypted_fields] || {}
end
def assert_key_configured
fail 'Encryption key not configured' if @encryption_key.nil?
end
def encrypt(value)
plaintext = Marshal.dump(value)
iv = OpenSSL::Cipher::Cipher.new('aes-256-cbc').random_iv
args = { key: @encryption_key, iv: iv }
ciphertext = ::Encryptor.encrypt(plaintext, **args)
[::Base64.encode64(ciphertext), ::Base64.encode64(iv)]
end
def decrypt(encrypted)
ciphertext, iv = encrypted.map { |value| ::Base64.decode64(value) }
args = { key: @encryption_key, iv: iv }
plaintext = ::Encryptor.decrypt(ciphertext, **args)
Marshal.load(plaintext)
end
def process_message(message)
fields = @encrypted_fields[message['class']]
return unless fields
assert_key_configured
message['args'].size.times.each do |arg_index|
to_encrypt = fields[arg_index]
next unless to_encrypt
raw_value = message['args'][arg_index]
if to_encrypt == true
message['args'][arg_index] = yield(raw_value)
elsif to_encrypt.is_a?(Array) && raw_value.is_a?(Hash)
message['args'][arg_index] = Hash[raw_value.map do |key, value|
value = yield(value) if to_encrypt.member?(key.to_s)
[key, value]
end]
end
end
end
end
class Client < Base
def call(_, message, _, _)
process_message(message) { |value| encrypt(value) }
yield
end
end
class Server < Base
def call(_, message, _)
process_message(message) { |value| decrypt(value) }
yield
end
end
end
| blakepettersson/sidekiq-field-encryptor | lib/sidekiq-field-encryptor/encryptor.rb | Ruby | mit | 1,871 |
<?php
namespace Freifunk\StatisticBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Freifunk\StatisticBundle\Entity\Node;
use Freifunk\StatisticBundle\Entity\Link;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* LinkRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class LinkRepository extends EntityRepository
{
/**
* @param Link $link
*
* @return Link
*/
public function findExistingLink(Link $link)
{
$qb = $this->createQueryBuilder('l');
$qb->andWhere($qb->expr()->eq('l.source', $qb->expr()->literal($link->getSource()->getId())));
$qb->andWhere($qb->expr()->eq('l.target', $qb->expr()->literal($link->getTarget()->getId())));
$qb->andWhere($qb->expr()->eq('l.type', $qb->expr()->literal($link->getType())));
$qb->andWhere($qb->expr()->isNull('l.closeTime'));
return $qb->getQuery()->getOneOrNullResult();
}
/**
* Returns the number of links for a node between 2 dates
*
* @param Node $node
* @param \DateTime $start
* @param \DateTime $end
*
* @return mixed
*/
public function countLinksForNodeBetween(Node $node, \DateTime $start, \DateTime $end)
{
$query = $this->getEntityManager()
->createQuery('SELECT COUNT(l.source)
FROM FreifunkStatisticBundle:Link l
WHERE
l.source = ?1
AND l.openTime <= ?2
AND (l.closeTime >= ?3 OR l.closeTime IS NULL)
AND l.type = ?4')
->setParameters(array(
1 => $node->getId(),
2 => $end,
3 => $start,
4 => Link::CLIENT
));
return (int) $query->getSingleScalarResult();
}
/**
* Returns the number of unique links for a node between 2 dates
*
* @param Node $node
* @param \DateTime $start
* @param \DateTime $end
*
* @return mixed
*/
public function countUniqueLinksForNodeBetween(Node $node, \DateTime $start, \DateTime $end)
{
$query = $this->getEntityManager()
->createQuery('SELECT COUNT(DISTINCT l.source)
FROM FreifunkStatisticBundle:Link l
WHERE
l.source = ?1
AND l.openTime <= ?2
AND (l.closeTime >= ?3 OR l.closeTime IS NULL)
AND l.type = ?4')
->setParameters(array(
1 => $node->getId(),
2 => $end,
3 => $start,
4 => Link::CLIENT
));
return (int) $query->getSingleScalarResult();
}
/**
* Computes all links for a timeline widget:
*
* @param Node|Node[] $nodes
* @param string $steps
* @param string $format
*
* @return array
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function computeLinkTimeline($nodes, $steps = '1 hour', $format = 'Y-m-d H:00:00')
{
if (!is_array($nodes) && !($nodes instanceof \Traversable)) {
$nodes = array($nodes);
}
if (empty($nodes)) {
throw new NotFoundHttpException("No node selected");
}
$nodeIdList = array();
foreach ($nodes as $node) {
$nodeIdList = $node->getId();
}
// first we need all dates
$qb = $this->createQueryBuilder('l');
$qb->andWhere($qb->expr()->eq('l.type', $qb->expr()->literal(Link::CLIENT)));
$qb->andWhere($qb->expr()->in('l.source', $nodeIdList));
$qb->join('l.target', 'lt');
$qb->select('l.openTime, l.closeTime, lt.id as targetId');
$qb->orderBy('l.openTime', 'ASC');
$links = $qb->getQuery()->getArrayResult();
/** @var \DateTime $oldestDate */
$oldestDate = !empty($links) ? $links[0]['openTime'] : new \DateTime();
$now = new \DateTime(date($format));
// now create a massive list of times since then in hours
$times = array();
$stats = array();
while ($now->getTimestamp() >= $oldestDate->getTimestamp()) {
$times[] = $now->format('Y-m-d H:i:s');
$stats[$now->format($format)] = array();
$now = clone $now;
$now->modify('-' . $steps);
}
// iterate the times and create the stats
$now = new \DateTime();
foreach ($links as $link) {
$linkTime = new \DateTime($link['openTime']->format($format));
$linkEnd = $link['closeTime'];
while (($linkEnd == null && $linkTime->getTimestamp() <= $now->getTimestamp())
|| ($linkEnd != null && $linkTime->getTimestamp() <= $linkEnd->getTimestamp())) {
$stats[$linkTime->format($format)][$link['targetId']] = true;
$linkTime->modify($steps);
}
}
// now clean our steps array
foreach ($stats as &$stat) {
$stat = count($stat);
}
ksort($stats);
return $stats;
}
}
| hauptsacheNet/Freifunk-Stats | src/Freifunk/StatisticBundle/Entity/LinkRepository.php | PHP | mit | 5,240 |
#!/usr/bin/env python
# --------------------------------------------------------
# Test regression propagation on ImageNet VID video
# Modified by Kai KANG (myfavouritekk@gmail.com)
# --------------------------------------------------------
"""Test a Fast R-CNN network on an image database."""
import argparse
import pprint
import time
import os
import os.path as osp
import sys
import cPickle
import numpy as np
this_dir = osp.dirname(__file__)
# add py-faster-rcnn paths
sys.path.insert(0, osp.join(this_dir, '../../external/py-faster-rcnn/lib'))
from fast_rcnn.config import cfg, cfg_from_file, cfg_from_list
# add external libs
sys.path.insert(0, osp.join(this_dir, '../../external'))
from vdetlib.utils.protocol import proto_load, proto_dump
# add src libs
sys.path.insert(0, osp.join(this_dir, '../../src'))
from tpn.propagate import gt_motion_propagation
from tpn.target import add_track_targets
from tpn.data_io import save_track_proto_to_zip
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Test a Fast R-CNN network')
parser.add_argument('vid_file')
parser.add_argument('box_file')
parser.add_argument('annot_file', default=None,
help='Ground truth annotation file. [None]')
parser.add_argument('save_file', help='Save zip file')
parser.add_argument('--job', dest='job_id', help='Job slot, GPU ID + 1. [1]',
default=1, type=int)
parser.add_argument('--length', type=int, default=20,
help='Propagation length. [20]')
parser.add_argument('--window', type=int, default=5,
help='Prediction window. [5]')
parser.add_argument('--sample_rate', type=int, default=1,
help='Temporal subsampling rate. [1]')
parser.add_argument('--offset', type=int, default=0,
help='Offset of sampling. [0]')
parser.add_argument('--overlap', type=float, default=0.5,
help='GT overlap threshold for tracking. [0.5]')
parser.add_argument('--wait', dest='wait',
help='wait until net file exists',
default=True, type=bool)
parser.set_defaults(vis=False, zip=False, keep_feat=False)
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
print 'Called with args:'
print args
if osp.isfile(args.save_file):
print "{} already exists.".format(args.save_file)
sys.exit(1)
vid_proto = proto_load(args.vid_file)
box_proto = proto_load(args.box_file)
annot_proto = proto_load(args.annot_file)
track_proto = gt_motion_propagation(vid_proto, box_proto, annot_proto,
window=args.window, length=args.length,
sample_rate=args.sample_rate, overlap_thres=args.overlap)
# add ground truth targets if annotation file is given
add_track_targets(track_proto, annot_proto)
if args.zip:
save_track_proto_to_zip(track_proto, args.save_file)
else:
proto_dump(track_proto, args.save_file)
| myfavouritekk/TPN | tools/propagate/sequence_roi_gt_propagation.py | Python | mit | 3,197 |
package io.trydent.stp.item;
public interface ImportedItem extends Item {
static ImportedItem of(final Price price) {
return new ImportedItemImpl(new ItemImpl(price.value()));
}
static <I extends TaxedItem & Item> ImportedItem fromTaxed(final I item) {
return new ImportedItemImpl(item);
}
}
| trydent-io/sales-taxes-problem | src/main/java/io/trydent/stp/item/ImportedItem.java | Java | mit | 310 |
$(function() {
var FADE_TIME = 150; // ms
var TYPING_TIMER_LENGTH = 400; // ms
var COLORS = [
'#e21400', '#91580f', '#f8a700', '#f78b00',
'#58dc00', '#287b00', '#a8f07a', '#4ae8c4',
'#3b88eb', '#3824aa', '#a700ff', '#d300e7'
];
// Initialize variables
var $window = $(window);
var $usernameInput = $('.usernameInput'); // Input for username
var $messages = $('.messages'); // Messages area
var $inputMessage = $('.inputMessage'); // Input message input box
var $loginPage = $('.login.page'); // The login page
var $chatPage = $('.chat.page'); // The chatroom page
// Prompt for setting a username
var username;
var connected = false;
var typing = false;
var lastTypingTime;
var $currentInput = $usernameInput.focus();
var socket = io();
function addParticipantsMessage (data) {
var message = '';
if (data.numUsers === 1) {
message += "there's 1 participant";
} else {
message += "there are " + data.numUsers + " participants";
}
log(message);
}
// Sets the client's username
function setUsername () {
username = cleanInput($usernameInput.val().trim());
// If the username is valid
if (username) {
$loginPage.fadeOut();
$chatPage.show();
$loginPage.off('click');
$currentInput = $inputMessage.focus();
// Tell the server your username
socket.emit('add user', username);
}
}
// Sends a chat message
function sendMessage () {
var message = $inputMessage.val();
// Prevent markup from being injected into the message
message = cleanInput(message);
// if there is a non-empty message and a socket connection
if (message && connected) {
$inputMessage.val('');
addChatMessage({
username: username,
message: message
});
// tell server to execute 'new message' and send along one parameter
socket.emit('new message', message);
}
}
// Log a message
function log (message, options) {
var $el = $('<li>').addClass('log').text(message);
addMessageElement($el, options);
}
// Adds the visual chat message to the message list
function addChatMessage (data, options) {
// Don't fade the message in if there is an 'X was typing'
var $typingMessages = getTypingMessages(data);
options = options || {};
if ($typingMessages.length !== 0) {
options.fade = false;
$typingMessages.remove();
}
var $usernameDiv = $('<span class="username"/>')
.text(data.username)
.css('color', getUsernameColor(data.username));
var $messageBodyDiv = $('<span class="messageBody">')
.text(data.message);
var typingClass = data.typing ? 'typing' : '';
var $messageDiv = $('<li class="message"/>')
.data('username', data.username)
.addClass(typingClass)
.append($usernameDiv, $messageBodyDiv);
addMessageElement($messageDiv, options);
}
// Adds the visual chat typing message
function addChatTyping (data) {
data.typing = true;
data.message = 'is typing';
addChatMessage(data);
}
// Removes the visual chat typing message
function removeChatTyping (data) {
getTypingMessages(data).fadeOut(function () {
$(this).remove();
});
}
// Adds a message element to the messages and scrolls to the bottom
// el - The element to add as a message
// options.fade - If the element should fade-in (default = true)
// options.prepend - If the element should prepend
// all other messages (default = false)
function addMessageElement (el, options) {
var $el = $(el);
// Setup default options
if (!options) {
options = {};
}
if (typeof options.fade === 'undefined') {
options.fade = true;
}
if (typeof options.prepend === 'undefined') {
options.prepend = false;
}
// Apply options
if (options.fade) {
$el.hide().fadeIn(FADE_TIME);
}
if (options.prepend) {
$messages.prepend($el);
} else {
$messages.append($el);
}
$messages[0].scrollTop = $messages[0].scrollHeight;
}
// Prevents input from having injected markup
function cleanInput (input) {
return $('<div/>').text(input).text();
}
// Updates the typing event
function updateTyping () {
if (connected) {
if (!typing) {
typing = true;
socket.emit('typing');
}
lastTypingTime = (new Date()).getTime();
setTimeout(function () {
var typingTimer = (new Date()).getTime();
var timeDiff = typingTimer - lastTypingTime;
if (timeDiff >= TYPING_TIMER_LENGTH && typing) {
socket.emit('stop typing');
typing = false;
}
}, TYPING_TIMER_LENGTH);
}
}
// Gets the 'X is typing' messages of a user
function getTypingMessages (data) {
return $('.typing.message').filter(function (i) {
return $(this).data('username') === data.username;
});
}
// Gets the color of a username through our hash function
function getUsernameColor (username) {
// Compute hash code
var hash = 7;
for (var i = 0; i < username.length; i++) {
hash = username.charCodeAt(i) + (hash << 5) - hash;
}
// Calculate color
var index = Math.abs(hash % COLORS.length);
return COLORS[index];
}
// Keyboard events
$window.keydown(function (event) {
// Auto-focus the current input when a key is typed
if (!(event.ctrlKey || event.metaKey || event.altKey)) {
$currentInput.focus();
}
// When the client hits ENTER on their keyboard
if (event.which === 13) {
if (username) {
sendMessage();
socket.emit('stop typing');
typing = false;
} else {
setUsername();
}
}
});
$inputMessage.on('input', function() {
updateTyping();
});
// Click events
// Focus input when clicking anywhere on login page
$loginPage.click(function () {
$currentInput.focus();
});
// Focus input when clicking on the message input's border
$inputMessage.click(function () {
$inputMessage.focus();
});
// Socket events
// Whenever the server emits 'login', log the login message
socket.on('login', function (data) {
connected = true;
// Display the welcome message
var message = "Welcome to Socket.IO Chat – ";
log(message, {
prepend: true
});
addParticipantsMessage(data);
});
// Whenever the server emits 'new message', update the chat body
socket.on('new message', function (data) {
addChatMessage(data);
});
// Whenever the server emits 'user joined', log it in the chat body
socket.on('user joined', function (data) {
log(data.username + ' joined');
addParticipantsMessage(data);
});
// Whenever the server emits 'user left', log it in the chat body
socket.on('user left', function (data) {
log(data.username + ' left');
addParticipantsMessage(data);
removeChatTyping(data);
});
// Whenever the server emits 'typing', show the typing message
socket.on('typing', function (data) {
addChatTyping(data);
});
// Whenever the server emits 'stop typing', kill the typing message
socket.on('stop typing', function (data) {
removeChatTyping(data);
});
socket.on('disconnect', function () {
log('you have been disconnected');
});
socket.on('reconnect', function () {
log('you have been reconnected');
if (username) {
socket.emit('add user', username);
}
});
socket.on('reconnect_error', function () {
log('attempt to reconnect has failed');
});
});
| garrulous-gorillas/garrulous-gorillas | client/src/components/chatview/mainSocket.js | JavaScript | mit | 7,606 |
////////////////////////////////////////////////////////////////////
//
// GENERATED CLASS
//
// DO NOT EDIT
//
// See sequelize-auto-ts for edits
//
////////////////////////////////////////////////////////////////////
var Sequelize = require('sequelize');
exports.initialized = false;
exports.SEQUELIZE;
/*__each__ tables */ exports.__tableName__;
/*__each__ tables */ exports.__tableNameCamel__;
/*__ignore__*/ var __defineFieldType__;
/*__ignore__*/ var __primaryTableName__;
/*__ignore__*/ var __foreignTableName__;
/*__ignore__*/ var __firstTableName__;
/*__ignore__*/ var __secondTableName__;
/*__ignore__*/ var __associationNameQuoted__;
function initialize(database, username, password, options) {
if (exports.initialized) {
return;
}
exports.SEQUELIZE = new Sequelize(database, username, password, options);
/*__startEach__ tables */
exports.__tableName__ = exports.__tableNameCamel__ = exports.SEQUELIZE.define('__tableNameSingular__', {
/*__each__ realDbFields, */ '__fieldName__': __defineFieldType__
}, {
timestamps: false,
classMethods: {
get__tableNameSingular__: function (__tableNameSingularCamel__) {
var where = {};
var id = parseInt(__tableNameSingularCamel__);
if (isNaN(id)) {
/*__each__ realDbFields */ if (__tableNameSingularCamel__['__fieldName__'] !== undefined) {
where['__fieldName__'] = __tableNameSingularCamel__['__fieldName__'];
}
}
else {
where['__idFieldName__'] = id;
}
return exports.__tableName__.find({ where: where });
}
}
});
/*__endEach__*/
/*__startEach__ references */
__primaryTableName__.hasMany(__foreignTableName__, { foreignKey: '__foreignKey__' });
__foreignTableName__.belongsTo(__primaryTableName__, { as: __associationNameQuoted__, foreignKey: '__foreignKey__' });
/*__endEach__*/
/*__startEach__ xrefs */
__firstTableName__.hasMany(__secondTableName__, { through: '__xrefTableName__' });
__secondTableName__.hasMany(__firstTableName__, { through: '__xrefTableName__' });
/*__endEach__*/
return exports;
}
exports.initialize = initialize;
//# sourceMappingURL=sequelize-models.js.map | samuelneff/sequelize-auto-ts | lib/sequelize-models.js | JavaScript | mit | 2,421 |
module StandardTasks
class PaperEditorTaskSerializer < TaskSerializer
embed :ids
has_one :editor, serializer: UserSerializer, include: true, root: :users
def editor
object.paper.editor
end
end
end
| johan--/tahi | engines/standard_tasks/app/serializers/standard_tasks/paper_editor_task_serializer.rb | Ruby | mit | 224 |
import Vue from 'vue';
import Electron from 'vue-electron';
import Resource from 'vue-resource';
import Router from 'vue-router';
import KeenUI from 'keen-ui';
import 'keen-ui/dist/keen-ui.css';
import App from './App';
import routes from './routes';
Vue.use(Electron);
Vue.use(Resource);
Vue.use(Router);
Vue.use(KeenUI);
Vue.config.debug = true;
const router = new Router({
scrollBehavior: () => ({ y: 0 }),
routes,
});
/* eslint-disable no-new */
new Vue({
router,
...App,
}).$mount('#app');
| Jack-Q/messenger | desktop/app/src/renderer/main.js | JavaScript | mit | 508 |
'use strict'
import Tea from './modules/tea.core.js'
global.app = () => {
return Tea;
} | sologeek/tea | src/main.js | JavaScript | mit | 91 |
export interface CategoryInterface {
id?: number,
name: string,
created: Date
}
export class CategoriesModel implements CategoryInterface {
id?: number;
name: string;
created: Date;
}
| Robophil/xpenses | app/models/category.model.ts | TypeScript | mit | 197 |
version https://git-lfs.github.com/spec/v1
oid sha256:b7405262706997cffc865837cffd6bd9eb92a8f12c3da71795815fb2da9be9f6
size 2483
| yogeshsaroya/new-cdnjs | ajax/libs/angular.js/1.4.0-beta.6/i18n/angular-locale_ss-za.js | JavaScript | mit | 129 |
var Imap = require('imap'),
MailParser = require('mailparser').MailParser,
moment = require('moment')
util = require('util'),
events = require('events');
var SimpleImap = function(options) {
this.options = options;
this.imap = null;
this.start = function() {
if (this.imap === null) {
this.imap = new Imap(this.options);
var selfImap = this.imap,
self = this;
selfImap.on('ready', function() {
self.emit('ready');
selfImap.openBox(self.options.mailbox, false, function() {
self.emit('open');
});
});
selfImap.on('mail', function(num) {
selfImap.search(['UNSEEN'], function(err, result) {
if (result.length) {
var f = selfImap.fetch(result, {
markSeen: true,
struct: true,
bodies: ''
});
f.on('message', function(msg, seqNo) {
msg.on('body', function(stream, info) {
var buffer = '';
stream.on('data', function(chunk) {
buffer += chunk.toString('utf8');
});
stream.on('end', function() {
var mailParser = new MailParser();
mailParser.on('end', function(mailObject) {
self.emit('mail', {
from: mailObject.from,
subject: mailObject.subject,
text: mailObject.text,
html: mailObject.html,
date: moment(mailObject.date).format('YYYY-MM-DD HH:mm:ss')
});
});
mailParser.write(buffer);
mailParser.end();
});
});
});
}
});
});
selfImap.on('end', function() {
self.emit('end');
});
selfImap.on('error', function(err) {
self.emit('error', err);
});
selfImap.on('close', function(hadError) {
self.emit('close', hadError);
});
}
this.imap.connect();
}
this.stop = function() {
this.imap.destroy();
}
this.restart = function() {
this.stop();
if (arguments.length >= 1)
this.options = arguments[0];
this.start();
}
this.getImap = function() {
return this.imap;
}
};
util.inherits(SimpleImap, events.EventEmitter);
module.exports = SimpleImap
| iwanjunaid/simple-imap | simple-imap.js | JavaScript | mit | 2,114 |
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.lang['nl'] = {
"editor": "Tekstverwerker",
"editorPanel": "Tekstverwerker beheerpaneel",
"common": {
"editorHelp": "Druk ALT 0 voor hulp",
"browseServer": "Bladeren op server",
"url": "URL",
"protocol": "Protocol",
"upload": "Upload",
"uploadSubmit": "Naar server verzenden",
"image": "Afbeelding",
"flash": "Flash",
"form": "Formulier",
"checkbox": "Selectievinkje",
"radio": "Keuzerondje",
"textField": "Tekstveld",
"textarea": "Tekstvak",
"hiddenField": "Verborgen veld",
"button": "Knop",
"select": "Selectieveld",
"imageButton": "Afbeeldingsknop",
"notSet": "<niet ingevuld>",
"id": "Id",
"name": "Naam",
"langDir": "Schrijfrichting",
"langDirLtr": "Links naar rechts (LTR)",
"langDirRtl": "Rechts naar links (RTL)",
"langCode": "Taalcode",
"longDescr": "Lange URL-omschrijving",
"cssClass": "Stylesheet-klassen",
"advisoryTitle": "Adviserende titel",
"cssStyle": "Stijl",
"ok": "OK",
"cancel": "Annuleren",
"close": "Sluiten",
"preview": "Voorbeeld",
"resize": "Sleep om te herschalen",
"generalTab": "Algemeen",
"advancedTab": "Geavanceerd",
"validateNumberFailed": "Deze waarde is geen geldig getal.",
"confirmNewPage": "Alle aangebrachte wijzigingen gaan verloren. Weet u zeker dat u een nieuwe pagina wilt openen?",
"confirmCancel": "Enkele opties zijn gewijzigd. Weet u zeker dat u dit dialoogvenster wilt sluiten?",
"options": "Opties",
"target": "Doelvenster",
"targetNew": "Nieuw venster (_blank)",
"targetTop": "Hele venster (_top)",
"targetSelf": "Zelfde venster (_self)",
"targetParent": "Origineel venster (_parent)",
"langDirLTR": "Links naar rechts (LTR)",
"langDirRTL": "Rechts naar links (RTL)",
"styles": "Stijl",
"cssClasses": "Stylesheet-klassen",
"width": "Breedte",
"height": "Hoogte",
"align": "Uitlijning",
"alignLeft": "Links",
"alignRight": "Rechts",
"alignCenter": "Centreren",
"alignJustify": "Uitvullen",
"alignTop": "Boven",
"alignMiddle": "Midden",
"alignBottom": "Onder",
"alignNone": "Geen",
"invalidValue": "Ongeldige waarde.",
"invalidHeight": "De hoogte moet een getal zijn.",
"invalidWidth": "De breedte moet een getal zijn.",
"invalidCssLength": "Waarde in veld \"%1\" moet een positief nummer zijn, met of zonder een geldige CSS meeteenheid (px, %, in, cm, mm, em, ex, pt of pc).",
"invalidHtmlLength": "Waarde in veld \"%1\" moet een positief nummer zijn, met of zonder een geldige HTML meeteenheid (px of %).",
"invalidInlineStyle": "Waarde voor de online stijl moet bestaan uit een of meerdere tupels met het formaat \"naam : waarde\", gescheiden door puntkomma's.",
"cssLengthTooltip": "Geef een nummer in voor een waarde in pixels of geef een nummer in met een geldige CSS eenheid (px, %, in, cm, mm, em, ex, pt, of pc).",
"unavailable": "%1<span class=\"cke_accessibility\">, niet beschikbaar</span>"
},
"about": {
"copy": "Copyright © $1. Alle rechten voorbehouden.",
"dlgTitle": "Over CKEditor",
"help": "Bekijk de $1 voor hulp.",
"moreInfo": "Bezoek onze website voor licentieinformatie:",
"title": "Over CKEditor",
"userGuide": "CKEditor gebruiksaanwijzing"
},
"basicstyles": {
"bold": "Vet",
"italic": "Cursief",
"strike": "Doorhalen",
"subscript": "Subscript",
"superscript": "Superscript",
"underline": "Onderstrepen"
},
"bidi": {"ltr": "Schrijfrichting van links naar rechts", "rtl": "Schrijfrichting van rechts naar links"},
"blockquote": {"toolbar": "Citaatblok"},
"clipboard": {
"copy": "Kopiëren",
"copyError": "De beveiligingsinstelling van de browser verhinderen het automatisch kopiëren. Gebruik de sneltoets Ctrl/Cmd+C van het toetsenbord.",
"cut": "Knippen",
"cutError": "De beveiligingsinstelling van de browser verhinderen het automatisch knippen. Gebruik de sneltoets Ctrl/Cmd+X van het toetsenbord.",
"paste": "Plakken",
"pasteArea": "Plakgebied",
"pasteMsg": "Plak de tekst in het volgende vak gebruikmakend van uw toetsenbord (<strong>Ctrl/Cmd+V</strong>) en klik op OK.",
"securityMsg": "Door de beveiligingsinstellingen van uw browser is het niet mogelijk om direct vanuit het klembord in de editor te plakken. Middels opnieuw plakken in dit venster kunt u de tekst alsnog plakken in de editor.",
"title": "Plakken"
},
"button": {"selectedLabel": "%1 (Geselecteerd)"},
"colorbutton": {
"auto": "Automatisch",
"bgColorTitle": "Achtergrondkleur",
"colors": {
"000": "Zwart",
"800000": "Kastanjebruin",
"8B4513": "Chocoladebruin",
"2F4F4F": "Donkerleigrijs",
"008080": "Blauwgroen",
"000080": "Marine",
"4B0082": "Indigo",
"696969": "Donkergrijs",
"B22222": "Baksteen",
"A52A2A": "Bruin",
"DAA520": "Donkergeel",
"006400": "Donkergroen",
"40E0D0": "Turquoise",
"0000CD": "Middenblauw",
"800080": "Paars",
"808080": "Grijs",
"F00": "Rood",
"FF8C00": "Donkeroranje",
"FFD700": "Goud",
"008000": "Groen",
"0FF": "Cyaan",
"00F": "Blauw",
"EE82EE": "Violet",
"A9A9A9": "Donkergrijs",
"FFA07A": "Lichtzalm",
"FFA500": "Oranje",
"FFFF00": "Geel",
"00FF00": "Felgroen",
"AFEEEE": "Lichtturquoise",
"ADD8E6": "Lichtblauw",
"DDA0DD": "Pruim",
"D3D3D3": "Lichtgrijs",
"FFF0F5": "Linnen",
"FAEBD7": "Ivoor",
"FFFFE0": "Lichtgeel",
"F0FFF0": "Honingdauw",
"F0FFFF": "Azuur",
"F0F8FF": "Licht hemelsblauw",
"E6E6FA": "Lavendel",
"FFF": "Wit"
},
"more": "Meer kleuren...",
"panelTitle": "Kleuren",
"textColorTitle": "Tekstkleur"
},
"colordialog": {
"clear": "Wissen",
"highlight": "Actief",
"options": "Kleuropties",
"selected": "Geselecteerde kleur",
"title": "Selecteer kleur"
},
"templates": {
"button": "Sjablonen",
"emptyListMsg": "(Geen sjablonen gedefinieerd)",
"insertOption": "Vervang de huidige inhoud",
"options": "Template opties",
"selectPromptMsg": "Selecteer het sjabloon dat in de editor geopend moet worden (de actuele inhoud gaat verloren):",
"title": "Inhoud sjablonen"
},
"contextmenu": {"options": "Contextmenu opties"},
"div": {
"IdInputLabel": "Id",
"advisoryTitleInputLabel": "Adviserende titel",
"cssClassInputLabel": "Stylesheet klassen",
"edit": "Div wijzigen",
"inlineStyleInputLabel": "Inline stijl",
"langDirLTRLabel": "Links naar rechts (LTR)",
"langDirLabel": "Schrijfrichting",
"langDirRTLLabel": "Rechts naar links (RTL)",
"languageCodeInputLabel": " Taalcode",
"remove": "Div verwijderen",
"styleSelectLabel": "Stijl",
"title": "Div aanmaken",
"toolbar": "Div aanmaken"
},
"toolbar": {
"toolbarCollapse": "Werkbalk inklappen",
"toolbarExpand": "Werkbalk uitklappen",
"toolbarGroups": {
"document": "Document",
"clipboard": "Klembord/Ongedaan maken",
"editing": "Bewerken",
"forms": "Formulieren",
"basicstyles": "Basisstijlen",
"paragraph": "Paragraaf",
"links": "Links",
"insert": "Invoegen",
"styles": "Stijlen",
"colors": "Kleuren",
"tools": "Toepassingen"
},
"toolbars": "Werkbalken"
},
"elementspath": {"eleLabel": "Elementenpad", "eleTitle": "%1 element"},
"find": {
"find": "Zoeken",
"findOptions": "Zoekopties",
"findWhat": "Zoeken naar:",
"matchCase": "Hoofdlettergevoelig",
"matchCyclic": "Doorlopend zoeken",
"matchWord": "Hele woord moet voorkomen",
"notFoundMsg": "De opgegeven tekst is niet gevonden.",
"replace": "Vervangen",
"replaceAll": "Alles vervangen",
"replaceSuccessMsg": "%1 resultaten vervangen.",
"replaceWith": "Vervangen met:",
"title": "Zoeken en vervangen"
},
"fakeobjects": {
"anchor": "Interne link",
"flash": "Flash animatie",
"hiddenfield": "Verborgen veld",
"iframe": "IFrame",
"unknown": "Onbekend object"
},
"flash": {
"access": "Script toegang",
"accessAlways": "Altijd",
"accessNever": "Nooit",
"accessSameDomain": "Zelfde domeinnaam",
"alignAbsBottom": "Absoluut-onder",
"alignAbsMiddle": "Absoluut-midden",
"alignBaseline": "Basislijn",
"alignTextTop": "Boven tekst",
"bgcolor": "Achtergrondkleur",
"chkFull": "Schermvullend toestaan",
"chkLoop": "Herhalen",
"chkMenu": "Flashmenu's inschakelen",
"chkPlay": "Automatisch afspelen",
"flashvars": "Variabelen voor Flash",
"hSpace": "HSpace",
"properties": "Eigenschappen Flash",
"propertiesTab": "Eigenschappen",
"quality": "Kwaliteit",
"qualityAutoHigh": "Automatisch hoog",
"qualityAutoLow": "Automatisch laag",
"qualityBest": "Beste",
"qualityHigh": "Hoog",
"qualityLow": "Laag",
"qualityMedium": "Gemiddeld",
"scale": "Schaal",
"scaleAll": "Alles tonen",
"scaleFit": "Precies passend",
"scaleNoBorder": "Geen rand",
"title": "Eigenschappen Flash",
"vSpace": "VSpace",
"validateHSpace": "De HSpace moet een getal zijn.",
"validateSrc": "De URL mag niet leeg zijn.",
"validateVSpace": "De VSpace moet een getal zijn.",
"windowMode": "Venster modus",
"windowModeOpaque": "Ondoorzichtig",
"windowModeTransparent": "Doorzichtig",
"windowModeWindow": "Venster"
},
"font": {
"fontSize": {"label": "Lettergrootte", "voiceLabel": "Lettergrootte", "panelTitle": "Lettergrootte"},
"label": "Lettertype",
"panelTitle": "Lettertype",
"voiceLabel": "Lettertype"
},
"forms": {
"button": {
"title": "Eigenschappen knop",
"text": "Tekst (waarde)",
"type": "Soort",
"typeBtn": "Knop",
"typeSbm": "Versturen",
"typeRst": "Leegmaken"
},
"checkboxAndRadio": {
"checkboxTitle": "Eigenschappen aanvinkvakje",
"radioTitle": "Eigenschappen selectievakje",
"value": "Waarde",
"selected": "Geselecteerd",
"required": "Vereist"
},
"form": {
"title": "Eigenschappen formulier",
"menu": "Eigenschappen formulier",
"action": "Actie",
"method": "Methode",
"encoding": "Codering"
},
"hidden": {"title": "Eigenschappen verborgen veld", "name": "Naam", "value": "Waarde"},
"select": {
"title": "Eigenschappen selectieveld",
"selectInfo": "Informatie",
"opAvail": "Beschikbare opties",
"value": "Waarde",
"size": "Grootte",
"lines": "Regels",
"chkMulti": "Gecombineerde selecties toestaan",
"required": "Vereist",
"opText": "Tekst",
"opValue": "Waarde",
"btnAdd": "Toevoegen",
"btnModify": "Wijzigen",
"btnUp": "Omhoog",
"btnDown": "Omlaag",
"btnSetValue": "Als geselecteerde waarde instellen",
"btnDelete": "Verwijderen"
},
"textarea": {"title": "Eigenschappen tekstvak", "cols": "Kolommen", "rows": "Rijen"},
"textfield": {
"title": "Eigenschappen tekstveld",
"name": "Naam",
"value": "Waarde",
"charWidth": "Breedte (tekens)",
"maxChars": "Maximum aantal tekens",
"required": "Vereist",
"type": "Soort",
"typeText": "Tekst",
"typePass": "Wachtwoord",
"typeEmail": "E-mail",
"typeSearch": "Zoeken",
"typeTel": "Telefoonnummer",
"typeUrl": "URL"
}
},
"format": {
"label": "Opmaak",
"panelTitle": "Opmaak",
"tag_address": "Adres",
"tag_div": "Normaal (DIV)",
"tag_h1": "Kop 1",
"tag_h2": "Kop 2",
"tag_h3": "Kop 3",
"tag_h4": "Kop 4",
"tag_h5": "Kop 5",
"tag_h6": "Kop 6",
"tag_p": "Normaal",
"tag_pre": "Met opmaak"
},
"horizontalrule": {"toolbar": "Horizontale lijn invoegen"},
"iframe": {
"border": "Framerand tonen",
"noUrl": "Vul de IFrame URL in",
"scrolling": "Scrollbalken inschakelen",
"title": "IFrame-eigenschappen",
"toolbar": "IFrame"
},
"image": {
"alt": "Alternatieve tekst",
"border": "Rand",
"btnUpload": "Naar server verzenden",
"button2Img": "Wilt u de geselecteerde afbeeldingsknop vervangen door een eenvoudige afbeelding?",
"hSpace": "HSpace",
"img2Button": "Wilt u de geselecteerde afbeelding vervangen door een afbeeldingsknop?",
"infoTab": "Informatie afbeelding",
"linkTab": "Link",
"lockRatio": "Afmetingen vergrendelen",
"menu": "Eigenschappen afbeelding",
"resetSize": "Afmetingen resetten",
"title": "Eigenschappen afbeelding",
"titleButton": "Eigenschappen afbeeldingsknop",
"upload": "Upload",
"urlMissing": "De URL naar de afbeelding ontbreekt.",
"vSpace": "VSpace",
"validateBorder": "Rand moet een heel nummer zijn.",
"validateHSpace": "HSpace moet een heel nummer zijn.",
"validateVSpace": "VSpace moet een heel nummer zijn."
},
"indent": {"indent": "Inspringing vergroten", "outdent": "Inspringing verkleinen"},
"smiley": {"options": "Smiley opties", "title": "Smiley invoegen", "toolbar": "Smiley"},
"justify": {"block": "Uitvullen", "center": "Centreren", "left": "Links uitlijnen", "right": "Rechts uitlijnen"},
"language": {"button": "Taal instellen", "remove": "Taal verwijderen"},
"link": {
"acccessKey": "Toegangstoets",
"advanced": "Geavanceerd",
"advisoryContentType": "Aanbevolen content-type",
"advisoryTitle": "Adviserende titel",
"anchor": {
"toolbar": "Interne link",
"menu": "Eigenschappen interne link",
"title": "Eigenschappen interne link",
"name": "Naam interne link",
"errorName": "Geef de naam van de interne link op",
"remove": "Interne link verwijderen"
},
"anchorId": "Op kenmerk interne link",
"anchorName": "Op naam interne link",
"charset": "Karakterset van gelinkte bron",
"cssClasses": "Stylesheet-klassen",
"emailAddress": "E-mailadres",
"emailBody": "Inhoud bericht",
"emailSubject": "Onderwerp bericht",
"id": "Id",
"info": "Linkomschrijving",
"langCode": "Taalcode",
"langDir": "Schrijfrichting",
"langDirLTR": "Links naar rechts (LTR)",
"langDirRTL": "Rechts naar links (RTL)",
"menu": "Link wijzigen",
"name": "Naam",
"noAnchors": "(Geen interne links in document gevonden)",
"noEmail": "Geef een e-mailadres",
"noUrl": "Geef de link van de URL",
"other": "<ander>",
"popupDependent": "Afhankelijk (Netscape)",
"popupFeatures": "Instellingen popupvenster",
"popupFullScreen": "Volledig scherm (IE)",
"popupLeft": "Positie links",
"popupLocationBar": "Locatiemenu",
"popupMenuBar": "Menubalk",
"popupResizable": "Herschaalbaar",
"popupScrollBars": "Schuifbalken",
"popupStatusBar": "Statusbalk",
"popupToolbar": "Werkbalk",
"popupTop": "Positie boven",
"rel": "Relatie",
"selectAnchor": "Kies een interne link",
"styles": "Stijl",
"tabIndex": "Tabvolgorde",
"target": "Doelvenster",
"targetFrame": "<frame>",
"targetFrameName": "Naam doelframe",
"targetPopup": "<popupvenster>",
"targetPopupName": "Naam popupvenster",
"title": "Link",
"toAnchor": "Interne link in pagina",
"toEmail": "E-mail",
"toUrl": "URL",
"toolbar": "Link invoegen/wijzigen",
"type": "Linktype",
"unlink": "Link verwijderen",
"upload": "Upload"
},
"list": {"bulletedlist": "Opsomming invoegen", "numberedlist": "Genummerde lijst invoegen"},
"liststyle": {
"armenian": "Armeense nummering",
"bulletedTitle": "Eigenschappen lijst met opsommingstekens",
"circle": "Cirkel",
"decimal": "Cijfers (1, 2, 3, etc.)",
"decimalLeadingZero": "Cijfers beginnen met nul (01, 02, 03, etc.)",
"disc": "Schijf",
"georgian": "Georgische nummering (an, ban, gan, etc.)",
"lowerAlpha": "Kleine letters (a, b, c, d, e, etc.)",
"lowerGreek": "Grieks kleine letters (alpha, beta, gamma, etc.)",
"lowerRoman": "Romeins kleine letters (i, ii, iii, iv, v, etc.)",
"none": "Geen",
"notset": "<niet gezet>",
"numberedTitle": "Eigenschappen genummerde lijst",
"square": "Vierkant",
"start": "Start",
"type": "Type",
"upperAlpha": "Hoofdletters (A, B, C, D, E, etc.)",
"upperRoman": "Romeinse hoofdletters (I, II, III, IV, V, etc.)",
"validateStartNumber": "Startnummer van de lijst moet een heel nummer zijn."
},
"magicline": {"title": "Hier paragraaf invoeren"},
"maximize": {"maximize": "Maximaliseren", "minimize": "Minimaliseren"},
"newpage": {"toolbar": "Nieuwe pagina"},
"pagebreak": {"alt": "Pagina-einde", "toolbar": "Pagina-einde invoegen"},
"pastetext": {"button": "Plakken als platte tekst", "title": "Plakken als platte tekst"},
"pastefromword": {
"confirmCleanup": "De tekst die u wilt plakken lijkt gekopieerd te zijn vanuit Word. Wilt u de tekst opschonen voordat deze geplakt wordt?",
"error": "Het was niet mogelijk om de geplakte tekst op te schonen door een interne fout",
"title": "Plakken vanuit Word",
"toolbar": "Plakken vanuit Word"
},
"preview": {"preview": "Voorbeeld"},
"print": {"toolbar": "Afdrukken"},
"removeformat": {"toolbar": "Opmaak verwijderen"},
"save": {"toolbar": "Opslaan"},
"selectall": {"toolbar": "Alles selecteren"},
"showblocks": {"toolbar": "Toon blokken"},
"sourcearea": {"toolbar": "Broncode"},
"specialchar": {
"options": "Speciale tekens opties",
"title": "Selecteer speciaal teken",
"toolbar": "Speciaal teken invoegen"
},
"scayt": {
"btn_about": "Over SCAYT",
"btn_dictionaries": "Woordenboeken",
"btn_disable": "SCAYT uitschakelen",
"btn_enable": "SCAYT inschakelen",
"btn_langs": "Talen",
"btn_options": "Opties",
"text_title": "Controleer de spelling tijdens het typen"
},
"stylescombo": {
"label": "Stijl",
"panelTitle": "Opmaakstijlen",
"panelTitle1": "Blok stijlen",
"panelTitle2": "Inline stijlen",
"panelTitle3": "Object stijlen"
},
"table": {
"border": "Randdikte",
"caption": "Onderschrift",
"cell": {
"menu": "Cel",
"insertBefore": "Voeg cel in voor",
"insertAfter": "Voeg cel in na",
"deleteCell": "Cellen verwijderen",
"merge": "Cellen samenvoegen",
"mergeRight": "Voeg samen naar rechts",
"mergeDown": "Voeg samen naar beneden",
"splitHorizontal": "Splits cel horizontaal",
"splitVertical": "Splits cel vertikaal",
"title": "Celeigenschappen",
"cellType": "Celtype",
"rowSpan": "Rijen samenvoegen",
"colSpan": "Kolommen samenvoegen",
"wordWrap": "Automatische terugloop",
"hAlign": "Horizontale uitlijning",
"vAlign": "Verticale uitlijning",
"alignBaseline": "Tekstregel",
"bgColor": "Achtergrondkleur",
"borderColor": "Randkleur",
"data": "Gegevens",
"header": "Kop",
"yes": "Ja",
"no": "Nee",
"invalidWidth": "De celbreedte moet een getal zijn.",
"invalidHeight": "De celhoogte moet een getal zijn.",
"invalidRowSpan": "Rijen samenvoegen moet een heel getal zijn.",
"invalidColSpan": "Kolommen samenvoegen moet een heel getal zijn.",
"chooseColor": "Kies"
},
"cellPad": "Celopvulling",
"cellSpace": "Celafstand",
"column": {
"menu": "Kolom",
"insertBefore": "Voeg kolom in voor",
"insertAfter": "Voeg kolom in na",
"deleteColumn": "Kolommen verwijderen"
},
"columns": "Kolommen",
"deleteTable": "Tabel verwijderen",
"headers": "Koppen",
"headersBoth": "Beide",
"headersColumn": "Eerste kolom",
"headersNone": "Geen",
"headersRow": "Eerste rij",
"invalidBorder": "De randdikte moet een getal zijn.",
"invalidCellPadding": "Celopvulling moet een getal zijn.",
"invalidCellSpacing": "Celafstand moet een getal zijn.",
"invalidCols": "Het aantal kolommen moet een getal zijn groter dan 0.",
"invalidHeight": "De tabelhoogte moet een getal zijn.",
"invalidRows": "Het aantal rijen moet een getal zijn groter dan 0.",
"invalidWidth": "De tabelbreedte moet een getal zijn.",
"menu": "Tabeleigenschappen",
"row": {
"menu": "Rij",
"insertBefore": "Voeg rij in voor",
"insertAfter": "Voeg rij in na",
"deleteRow": "Rijen verwijderen"
},
"rows": "Rijen",
"summary": "Samenvatting",
"title": "Tabeleigenschappen",
"toolbar": "Tabel",
"widthPc": "procent",
"widthPx": "pixels",
"widthUnit": "eenheid breedte"
},
"undo": {"redo": "Opnieuw uitvoeren", "undo": "Ongedaan maken"},
"wsc": {
"btnIgnore": "Negeren",
"btnIgnoreAll": "Alles negeren",
"btnReplace": "Vervangen",
"btnReplaceAll": "Alles vervangen",
"btnUndo": "Ongedaan maken",
"changeTo": "Wijzig in",
"errorLoading": "Er is een fout opgetreden bij het laden van de dienst: %s.",
"ieSpellDownload": "De spellingscontrole is niet geïnstalleerd. Wilt u deze nu downloaden?",
"manyChanges": "Klaar met spellingscontrole: %1 woorden aangepast",
"noChanges": "Klaar met spellingscontrole: geen woorden aangepast",
"noMispell": "Klaar met spellingscontrole: geen fouten gevonden",
"noSuggestions": "- Geen suggesties -",
"notAvailable": "Excuses, deze dienst is momenteel niet beschikbaar.",
"notInDic": "Niet in het woordenboek",
"oneChange": "Klaar met spellingscontrole: één woord aangepast",
"progress": "Bezig met spellingscontrole...",
"title": "Spellingscontrole",
"toolbar": "Spellingscontrole"
}
}; | sejen/abssh | web/static/js/ckeditor/lang/nl.js | JavaScript | mit | 24,274 |
/**
* Connections
*
* `Connections` are like "saved settings" for your adapters. What's the difference between
* a connection and an adapter, you might ask? An adapter (e.g. `sails-mysql`) is generic--
* it needs some additional information to work (e.g. your database host, password, user, etc.)
* A `connection` is that additional information.
*
* Each model must have a `connection` property (a string) which is references the name of one
* of these connections. If it doesn't, the default `connection` configured in `config/models.js`
* will be applied. Of course, a connection can (and usually is) shared by multiple models.
* .
* Note: If you're using version control, you should put your passwords/api keys
* in `config/local.js`, environment variables, or use another strategy.
* (this is to prevent you inadvertently sensitive credentials up to your repository.)
*
* For more information on configuration, check out:
* http://links.sailsjs.org/docs/config/connections
*/
module.exports.connections = {
// Local disk storage for DEVELOPMENT ONLY
//
// Installed by default.
//
localDiskDb: {
adapter: 'sails-disk'
},
// MySQL is the world's most popular relational database.
// http://en.wikipedia.org/wiki/MySQL
//
// Run:
// npm install sails-mysql
//
someMysqlServer: {
adapter: 'sails-mysql',
host: 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS',
user: 'YOUR_MYSQL_USER',
password: 'YOUR_MYSQL_PASSWORD',
database: 'YOUR_MYSQL_DB'
},
// MongoDB is the leading NoSQL database.
// http://en.wikipedia.org/wiki/MongoDB
//
// Run:
// npm install sails-mongo
//
mongodb: {
adapter: 'sails-mongo',
host: 'localhost',
port: 27017,
user: '',
password: '',
database: 'nhop'
},
// PostgreSQL is another officially supported relational database.
// http://en.wikipedia.org/wiki/PostgreSQL
//
// Run:
// npm install sails-postgresql
//
somePostgresqlServer: {
adapter: 'sails-postgresql',
host: 'YOUR_POSTGRES_SERVER_HOSTNAME_OR_IP_ADDRESS',
user: 'YOUR_POSTGRES_USER',
password: 'YOUR_POSTGRES_PASSWORD',
database: 'YOUR_POSTGRES_DB'
}
// More adapters:
// https://github.com/balderdashy/sails
}; | durgesh-priyaranjan/nhop | config/connections.js | JavaScript | mit | 2,190 |
'use strict';
var Axes = require('../../plots/cartesian/axes');
module.exports = function formatLabels(cdi, trace, fullLayout) {
var labels = {};
var mockGd = {_fullLayout: fullLayout};
var xa = Axes.getFromTrace(mockGd, trace, 'x');
var ya = Axes.getFromTrace(mockGd, trace, 'y');
labels.xLabel = Axes.tickText(xa, xa.c2l(cdi.x), true).text;
labels.yLabel = Axes.tickText(ya, ya.c2l(cdi.y), true).text;
return labels;
};
| plotly/plotly.js | src/traces/scatter/format_labels.js | JavaScript | mit | 455 |
<?php
namespace App\Http\Controllers\Admin;
use GuzzleHttp\Psr7\Response;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Models\Review;
use App\Http\Requests\Review\UpdateRequest;
use Auth;
use App\Models\Product;
class ReviewsController extends AdminController
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return view('admin.reviews.index')
->withReviews(Review::with('product','user')
->orderBy('active')
->orderBy('created_at','desc')->paginate());
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$messages = [
'required' => "Поле :attribute обязательно к заполнению.",
'max' => "Поле :attribute ",
'min' => "Поле :attribute "
];
$rules = [
'name' => 'required|max:60|min:3',
'body' => 'required'
];
$this->validate($request, $rules, $messages);
$data = array_map('strip_tags', $request->only(['product_id', 'body']));
if(Auth::check())
{
$data = array_merge($data, ['user_id' => Auth::user()->id, 'active' => 0]);
}else{
$data = array_merge($data, ['user_id' => '292', 'active' => 0]);
}
Review::create($data);
return response('<h3 align="center">Ваш отзыв будет опубликован после модерации</h3>');
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$review = Review::with('user','product')->findOrFail($id);
return view('admin.reviews.edit',compact('review'));
}
/**
* Update the specified resource in storage.
*
* @param UpdateRequest $request
* @param int $id
* @return Response
*/
public function update(UpdateRequest $request, Product $product, $id)
{
//dd($request->all());
Review::findOrFail($id)->update($request->all());
if((int)$request->get('button')) {
return redirect()->route('reviews.index');
}
$date = new \DateTime('NOW');
$product->where('id', $request->product_id)->update(['updated_at' => $date->format("Y-m-d H:i:s")]);
return redirect()->route('reviews.edit',$id);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Review::findOrFail($id)->delete();
return redirect()->route('reviews.index')->withMessage("Review with id {$id} successfully deleted!");
}
/**
* @param Request $request
* @return \Illuminate\View\View
*/
public function search(Request $request)
{
try{
$query = $this->prepareSearchQuery($request->get('q'));
$reviews = Review::where('body', 'like', $query)->with('user','product')->paginate();
return view('admin.reviews.index')->withReviews($reviews)->withQ($request->get('q'));
} catch(\Exception $e) {
return redirect()->route('reviews.index')->withMessage($e->getMessage());
}
}
}
| radar-tov/radar.com.ua-5.4 | app/Http/Controllers/Admin/ReviewsController.php | PHP | mit | 3,777 |
var app = angular.module('AtWork', [
'atwork.system',
'atwork.users',
'atwork.posts',
'atwork.streams',
'atwork.chats',
'atwork.activities',
'atwork.notifications',
'atwork.settings',
'ngMaterial']);
app.controller('AppCtrl', [
'$scope',
'$route',
'$rootScope',
'$mdSidenav',
'$mdBottomSheet',
'$location',
'$timeout',
'appLocation',
'appAuth',
'appWebSocket',
'appSettings',
'appSettingsValid',
'appToast',
function($scope, $route, $rootScope, $mdSidenav, $mdBottomSheet, $location, $timeout, appLocation, appAuth, appWebSocket, appSettings, appSettingsValid, appToast) {
$scope.barTitle = '';
$scope.search = '';
$scope.toggleSidenav = function(menuId) {
$mdSidenav(menuId).toggle();
};
$scope.updateLoginStatus = function() {
$scope.isLoggedIn = appAuth.isLoggedIn();
$scope.user = appAuth.getUser();
};
$scope.goHome = function() {
appLocation.url('/');
};
$scope.showUserActions = function($event) {
$mdBottomSheet.show({
templateUrl: '/modules/users/views/user-list.html',
controller: 'UserSheet',
targetEvent: $event
}).then(function(clickedItem) {
$scope.alert = clickedItem.name + ' clicked!';
});
};
var initiateSettings = function(cb) {
appSettings.fetch(function(settings) {
$rootScope.systemSettings = settings;
if (cb) {
cb();
}
});
};
/**
* Scroll the view to top on route change
*/
$scope.$on('$routeChangeSuccess', function() {
angular.element('*[md-scroll-y]').animate({scrollTop: 0}, 300);
$mdSidenav('left').close();
});
$scope.$on('loggedIn', function() {
$scope.updateLoginStatus();
$scope.barTitle = '';
$scope.$broadcast('updateNotifications');
appWebSocket.conn.emit('online', {token: appAuth.getToken()});
appAuth.refreshUser(function(user) {
$scope.user = user;
});
/**
* Fetch settings and get the app ready
*/
initiateSettings(function() {
$scope.$on('$routeChangeStart', function (event, toState) {
var valid = appSettingsValid();
if (!valid) {
appToast('Please complete the setup first.');
}
});
$scope.appReady = true;
$scope.barTitle = $rootScope.systemSettings.tagline;
$timeout(appSettingsValid);
});
});
$scope.$on('loggedOut', function() {
$scope.updateLoginStatus();
appWebSocket.conn.emit('logout', {token: appAuth.getToken()});
});
appWebSocket.conn.on('connect', function() {
if (appAuth.isLoggedIn()) {
appWebSocket.conn.emit('online', {token: appAuth.getToken()});
}
});
$scope.updateLoginStatus();
$timeout(function() {
if (!appAuth.isLoggedIn()) {
if (window.location.href.indexOf('/activate/') == -1 && window.location.href.indexOf('/changePassword/') == -1) {
appLocation.url('/login');
}
initiateSettings();
$scope.appReady = true;
} else {
$scope.barTitle = '';
$scope.$broadcast('loggedIn');
}
});
}
]); | richh93/atwork | public/app.js | JavaScript | mit | 3,244 |
# coding: utf-8
import django_filters
from django import forms
from django.utils.translation import ugettext_lazy as _
from courses.models import Course
from issues.models import Issue
from issues.model_issue_status import IssueStatus
class IssueFilterStudent(django_filters.FilterSet):
is_active = django_filters.ChoiceFilter(label=_('tip_kursa'), name='task__course__is_active')
years = django_filters.MultipleChoiceFilter(
label=_('god_kursa'),
name='task__course__year',
widget=forms.CheckboxSelectMultiple
)
courses = django_filters.MultipleChoiceFilter(label=_('kurs'), name='task__course', widget=forms.SelectMultiple)
responsible = django_filters.MultipleChoiceFilter(label=_('prepodavateli'), widget=forms.SelectMultiple)
status_field = django_filters.MultipleChoiceFilter(label=_('status'), widget=forms.SelectMultiple)
update_time = django_filters.DateRangeFilter(label=_('data_poslednego_izmenenija'))
def set_user(self, user):
for field in self.filters:
self.filters[field].field.label = u'<strong>{0}</strong>'.format(self.filters[field].field.label)
groups = user.group_set.all()
courses = Course.objects.filter(groups__in=groups)
course_choices = set()
year_choices = set()
teacher_set = set()
status_set = set()
for course in courses:
course_choices.add((course.id, course.name))
year_choices.add((course.year.id, unicode(course.year)))
for teacher in course.get_teachers():
teacher_set.add(teacher)
for status in course.issue_status_system.statuses.all():
status_set.add(status)
self.filters['is_active'].field.choices = ((u'', _(u'luboj')),
(1, _(u'aktivnyj')),
(0, _(u'arhiv')))
self.filters['years'].field.choices = tuple(year_choices)
self.filters['courses'].field.choices = tuple(course_choices)
teacher_choices = [(teacher.id, teacher.get_full_name()) for teacher in teacher_set]
self.filters['responsible'].field.choices = tuple(teacher_choices)
lang = user.profile.language
status_choices = [(status.id, status.get_name(lang)) for status in status_set]
for status_id in sorted(IssueStatus.HIDDEN_STATUSES.values(), reverse=True):
status_field = IssueStatus.objects.get(pk=status_id)
status_choices.insert(0, (status_field.id, status_field.get_name(lang)))
self.filters['status_field'].field.choices = tuple(status_choices)
class Meta:
model = Issue
fields = ['is_active', 'years', 'courses', 'responsible', 'status_field', 'update_time']
| znick/anytask | anytask/issues/model_issue_student_filter.py | Python | mit | 2,807 |
using System;
namespace LionFire.Structures
{
[System.AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
public sealed class MultiplicityAttribute : Attribute
{
public MultiplicityAttribute(Multiplicity multiplicity)
{
Multiplicity = multiplicity;
}
public Multiplicity Multiplicity { get; }
}
}
| lionfire/Core | src/LionFire.Structures/Ontology/MultiplicityAttribute.cs | C# | mit | 475 |
package net.magli143.exo;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
/**
* <i>native declaration : exo_helper.h:919</i><br>
* This file was autogenerated by <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br>
* a tool written by <a href="http://ochafik.com/">Olivier Chafik</a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br>
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> , <a href="http://rococoa.dev.java.net/">Rococoa</a>, or <a href="http://jna.dev.java.net/">JNA</a>.
*/
public class crunch_options extends Structure {
/** C type : const char* */
public Pointer exported_encoding;
public int max_passes;
public int max_len;
public int max_offset;
public int use_literal_sequences;
public int use_imprecise_rle;
public crunch_options() {
super();
}
@Override
protected List<String> getFieldOrder() {
return Arrays.asList("exported_encoding", "max_passes", "max_len", "max_offset", "use_literal_sequences", "use_imprecise_rle");
}
/** @param exported_encoding C type : const char* */
public crunch_options(Pointer exported_encoding, int max_passes, int max_len, int max_offset, int use_literal_sequences, int use_imprecise_rle) {
super();
this.exported_encoding = exported_encoding;
this.max_passes = max_passes;
this.max_len = max_len;
this.max_offset = max_offset;
this.use_literal_sequences = use_literal_sequences;
this.use_imprecise_rle = use_imprecise_rle;
}
public static class ByReference extends crunch_options implements Structure.ByReference {
};
public static class ByValue extends crunch_options implements Structure.ByValue {
};
}
| p-a/kickass-cruncher-plugins | src/main/java/net/magli143/exo/crunch_options.java | Java | mit | 1,783 |
version https://git-lfs.github.com/spec/v1
oid sha256:ad911cfe35ed2702a6023f24dac7e20b7b1d64e5583cd53411e87b5c10fa0c35
size 16080
| yogeshsaroya/new-cdnjs | ajax/libs/yui/3.16.0/series-column/series-column-coverage.js | JavaScript | mit | 130 |
using System.Linq;
using Bloggy.Domain.Entities;
using Raven.Abstractions.Indexing;
using Raven.Client.Indexes;
namespace Bloggy.Domain.Indexes
{
// ref: http://stackoverflow.com/questions/11900478/ravendb-map-reduce-with-grouping-by-date
public class BlogPostArchiveIndex : AbstractIndexCreationTask<BlogPost, BlogPostArchiveIndex.ArchiveItem>
{
public class ArchiveItem
{
public int Year { get; set; }
public int Month { get; set; }
public int Count { get; set; }
}
public BlogPostArchiveIndex()
{
Map = blogPosts => from blogPost in blogPosts
select new
{
Year = blogPost.CreatedOn.Year,
Month = blogPost.CreatedOn.Month,
Count = 1
};
Reduce = items => from result in items
group result by new
{
result.Year,
result.Month
} into agg
select new
{
Year = agg.Key.Year,
Month = agg.Key.Month,
Count = agg.Sum(x => x.Count)
};
Sort(x => x.Year, SortOptions.Int);
Sort(x => x.Month, SortOptions.Int);
Sort(x => x.Count, SortOptions.Int);
}
}
} | tugberkugurlu/Bloggy | src/Bloggy.Domain/Indexes/BlogPostArchiveIndex.cs | C# | mit | 1,701 |
function render(node){
console.log(node);
};
export default render; | song940/vxapp | packages/render/index.js | JavaScript | mit | 72 |
(function ($, _, Backbone, models) {
"use strict";
models.Widget = Backbone.Model.extend({
defaults: {
"name" : "Undefined name",
"range" : '30-minutes',
"update_interval": '10'
},
url: function() {
var tmp = "/api/dashboards/" + this.get("dashboard_id") + "/widgets";
if (this.isNew()) {
return tmp;
} else {
return tmp + "/" + this.get("id");
}
},
targetsString: function() {
return (this.get("targets") || "").split(';');
}
});
})($, _, Backbone, app.models);
| mdkarp/team_dashboard_plugin | app/assets/javascripts/team_dashboard/models/widget.js | JavaScript | mit | 576 |
from django.db import models
import datetime
def get_choices(lst):
return [(i, i) for i in lst]
#
# Person
#
pprint_pan = lambda pan: "%s %s %s" % (pan[:5], pan[5:9], pan[9:])
class Person(models.Model):
name = models.CharField(max_length=255, db_index=True)
fathers_name = models.CharField(max_length=255, null=True, blank=True, db_index=True)
status = models.CharField(max_length=32, choices=get_choices([
'Individual',
'HUF',
'Partnership Firm',
'Domestic Company',
'LLP',
'Trust(ITR 7)',
]), default='Individual Salaried')
employer = models.CharField(max_length=64, null=True, blank=True)
self_occupied = models.BooleanField()
pan_number = models.CharField(max_length=32, unique=True)
user_id = models.CharField(max_length=32, null=True, blank=True)
password = models.CharField(max_length=32, null=True, blank=True)
bank_name = models.CharField(max_length=255, null=True, blank=True)
bank_branch = models.CharField(max_length=255, null=True, blank=True)
account_number = models.CharField(max_length=32, null=True, blank=True)
micr = models.CharField(max_length=32, blank=True, null=True)
ifsc_code = models.CharField(max_length=32, null=True, blank=True)
account_type = models.CharField(max_length=32, choices=get_choices(['SB', 'CA', 'CC']), default='SB')
contact_number = models.CharField(max_length=13, null=True, blank=True, db_index=True)
email = models.EmailField(null=True, blank=True, db_index=True)
address = models.TextField(max_length=32, null=True, blank=True)
city = models.CharField(max_length=64, null=True, blank=True, db_index=True)
pincode = models.CharField(max_length=10, null=True, blank=True, db_index=True)
date_of_birth_or_incarnation = models.DateField(null=True, blank=True)
def pan_number_pprint(self):
return pprint_pan(self.pan_number)
pan_number_pprint.admin_order_field = 'pan_number_pprint'
pan_number_pprint.short_description = 'Pan Number'
def _trim(self, *args):
for field in args:
value = getattr(self, field)
setattr(self, field, value.replace(' ', ''))
def save(self):
self._trim('pan_number')
super(Person, self).save()
def __unicode__(self):
return u'%s (%s)' % (self.name, self.pan_number)
class MetadataPerson(models.Model):
person = models.ForeignKey(Person)
key = models.CharField(max_length=250)
value = models.CharField(max_length=250)
#
# Report
#
class Report(models.Model):
finanyr = lambda yr: "%s - %s" % (yr, yr+1)
years = [(finanyr(i), finanyr(i)) for i in xrange(1980, 2020)]
person = models.ForeignKey(Person)
financial_year = models.CharField(max_length=11, choices=years, default=finanyr(datetime.datetime.now().year - 1))
assessment_year = models.CharField(max_length=11, choices=years, default=finanyr(datetime.datetime.now().year))
return_filed_on = models.DateField()
returned_income = models.DecimalField(max_digits=12, decimal_places=2)
#Advanced Tax
july = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
september = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
december = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
march = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
#Interest Detail
interest_234_a = models.DecimalField("Interest 234(a)", max_digits=12, decimal_places=2, null=True, blank=True)
interest_234_b = models.DecimalField("Interest 234(b)", max_digits=12, decimal_places=2, null=True, blank=True)
interest_234_c = models.DecimalField("Interest 234(c)", max_digits=12, decimal_places=2, null=True, blank=True)
#Tax detail
tds = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
self_assessment_tax = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
acknowledgement_number = models.CharField("Ack no.", max_length=64, null=True, blank=True)
#Bill Detail
bill_raised_on = models.DateField(null=True, blank=True)
bill_amount = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
bill_received = models.BooleanField("Bill received ?")
mode_of_payment = models.CharField(max_length=16, choices=get_choices(['Cash', 'Cheque', 'DD', 'Bank Transfer']), null=True, blank=True)
payment_detail = models.CharField(max_length=16, null=True, blank=True)
#Order 143(1)
order_received_on_143_1 = models.DateField("143(1) Order received on", null=True, blank=True)
assessed_income_143_1 = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_143_1 = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
refund_amount_143_1 = models.DecimalField("Refund amount", max_digits=12, decimal_places=2, null=True, blank=True)
demand_raised_amount_143_1 = models.DecimalField("Demand raised for ", max_digits=12, decimal_places=2, null=True, blank=True)
refund_received_on_143_1 = models.DateField("Refund received on", null=True, blank=True)
#Order 143(2)
order_received_on_143_2 = models.DateField("Notice received on", null=True, blank=True)
#Order 143(3)
order_received_on_143_3 = models.DateField("Order received on", null=True, blank=True)
assessed_income_143_3 = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_143_3 = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
refund_amount_143_3 = models.DecimalField("Refund amount", max_digits=12, decimal_places=2, null=True, blank=True)
demand_raised_amount_143_3 = models.DecimalField("Demand raised for", max_digits=12, decimal_places=2, null=True, blank=True)
refund_received_on_143_3 = models.DateField("Refund received on", null=True, blank=True)
#Appeal before cit
filed_on_cit = models.DateField("Filed on", null=True, blank=True)
order_received_on_cit = models.DateField("Order received on", null=True, blank=True)
assessed_income_cit = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_cit = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
#Appeal before tribunal
filed_on_tribunal = models.DateField("Filed on", null=True, blank=True)
order_received_on_tribunal = models.DateField("Order received on", null=True, blank=True)
filed_by_tribunal = models.CharField("Filed by", max_length=16, choices=get_choices(['assessee', 'department']), null=True, blank=True)
assessed_income_tribunal = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_tribunal = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
def got_reimbursement(self):
return self.refund_amount_143_1 > 0
got_reimbursement.admin_order_field = 'got_reimbursement'
got_reimbursement.boolean = True
got_reimbursement.short_description = 'Got reimbursement ?'
def tax_paid(self):
tax = sum([i for i in (self.march, self.september, self.december, self.july) if i is not None])
if tax == 0 and self.tds is not None:
tax = self.tds
return tax
tax_paid.admin_order_field = 'tax_paid'
tax_paid.boolean = False
tax_paid.short_description = 'Tax Paid'
class Meta:
unique_together = ('person', 'financial_year')
def __unicode__(self):
return u'%s - %s' % (self.person, self.financial_year)
class MetadataReport(models.Model):
report = models.ForeignKey(Report)
key = models.CharField(max_length=250)
value = models.CharField(max_length=250)
| annual-client-report/Annual-Report | report/models.py | Python | mit | 8,050 |
using System;
using Microsoft.Kinect;
using System.Diagnostics;
namespace RippleFloorApp.Utilities.KinectGestures.Segments
{
/// <summary>
/// The first part of the swipe down gesture with the right hand
/// </summary>
public class SwipeDownSegment1 : IRelativeGestureSegment
{
/// <summary>
/// Checks the gesture.
/// </summary>
/// <param name="skeleton">The skeleton.</param>
/// <returns>GesturePartResult based on if the gesture part has been completed</returns>
public GesturePartResult CheckGesture(Skeleton skeleton)
{
// right hand in front of right shoulder
if (skeleton.Joints[JointType.HandRight].Position.Z < skeleton.Joints[JointType.ElbowRight].Position.Z && skeleton.Joints[JointType.HandRight].Position.Y < skeleton.Joints[JointType.ShoulderCenter].Position.Y)
{
// right hand below head height and hand higher than elbow
if (skeleton.Joints[JointType.HandRight].Position.Y < skeleton.Joints[JointType.ShoulderRight].Position.Y && skeleton.Joints[JointType.HandRight].Position.Y > skeleton.Joints[JointType.ElbowRight].Position.Y)
{
// right hand right of right shoulder
if (skeleton.Joints[JointType.HandRight].Position.X > skeleton.Joints[JointType.ShoulderRight].Position.X)
{
return GesturePartResult.Succeed;
}
return GesturePartResult.Pausing;
}
return GesturePartResult.Fail;
}
return GesturePartResult.Fail;
}
}
}
| Microsoft/kinect-ripple | Ripple/RippleFloorApp/Utilities/KinectGestures/Segments/SwipeDown/SwipeDownSegment1.cs | C# | mit | 1,697 |
package edu.washington.cs.figer.ml;
import edu.washington.cs.figer.data.Instance;
import edu.washington.cs.figer.util.V;
import java.util.ArrayList;
/**
*
* @author Xiao Ling
*
*/
public class LRInference extends Inference {
/**
*
*/
private static final long serialVersionUID = 5056369182261762614L;
public LRInference() {
super();
}
public static double sigma = 1;
@Override
public Prediction findBestLabel(Instance x, Model m) {
LogisticRegression lr = (LogisticRegression) m;
LRParameter para = (LRParameter) lr.para;
int[] predictions = new int[lr.labelFactory.allLabels.size()];
double[] probs = new double[lr.labelFactory.allLabels.size()];
double[] origLambda = para.lambda;
{
int L = lr.labelFactory.allLabels.size();
int maxL = -1;
double max = -Double.MAX_VALUE;
ArrayList<Double> scores = new ArrayList<Double>();
for (int j = 0; j < L; j++) {
double score = 0;
int startpoint = lr.featureFactory.allFeatures.size() * j;
score += V.sumprod(x, para.lambda, startpoint);
scores.add(score);
if (score > max) {
maxL = j;
max = score;
}
}
double part = 0;
for (int i = 0; i < L; i++) {
part += Math.exp((scores.get(i) - max) / sigma);
}
predictions[maxL]++;
probs[maxL] += 1 / part;
}
int maxL = -1;
int max = -1;
for (int k = 0; k < predictions.length; k++) {
if (predictions[k] > max) {
maxL = k;
max = predictions[k];
} else if (predictions[k] == max && probs[k] > probs[maxL]) {
maxL = k;
max = predictions[k];
}
}
if (lr.voted) {
para.lambda = origLambda;
}
return new Prediction(lr.labelFactory.allLabels.get(maxL), probs[maxL]
/ max);
}
/**
* return predictions with scores
*/
@Override
public ArrayList<Prediction> findPredictions(Instance x, Model m) {
LogisticRegression lr = (LogisticRegression) m;
LRParameter para = (LRParameter) lr.para;
ArrayList<Prediction> preds = null;
int L = lr.labelFactory.allLabels.size();
int F = lr.featureFactory.allFeatures.size();
preds = new ArrayList<Prediction>();
for (int j = 0; j < L; j++) {
int startpoint = F * j;
double score = V.sumprod(x, para.lambda, startpoint);
preds.add(new Prediction(lr.labelFactory.allLabels.get(j), score));
}
return preds;
}
}
| infsci2560fa16/full-stack-web-project-usernameoliver | src/main/java/edu/washington/cs/figer/ml/LRInference.java | Java | mit | 2,410 |
// 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.
namespace System.Runtime.Serialization
{
[System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited=false, AllowMultiple=false)]
public sealed partial class CollectionDataContractAttribute : System.Attribute
{
public CollectionDataContractAttribute() { }
public bool IsItemNameSetExplicitly { get { throw null; } }
public bool IsKeyNameSetExplicitly { get { throw null; } }
public bool IsNameSetExplicitly { get { throw null; } }
public bool IsNamespaceSetExplicitly { get { throw null; } }
public bool IsReference { get { throw null; } set { } }
public bool IsReferenceSetExplicitly { get { throw null; } }
public bool IsValueNameSetExplicitly { get { throw null; } }
public string ItemName { get { throw null; } set { } }
public string KeyName { get { throw null; } set { } }
public string Name { get { throw null; } set { } }
public string Namespace { get { throw null; } set { } }
public string ValueName { get { throw null; } set { } }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(3), Inherited=false, AllowMultiple=true)]
public sealed partial class ContractNamespaceAttribute : System.Attribute
{
public ContractNamespaceAttribute(string contractNamespace) { }
public string ClrNamespace { get { throw null; } set { } }
public string ContractNamespace { get { throw null; } }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(28), Inherited=false, AllowMultiple=false)]
public sealed partial class DataContractAttribute : System.Attribute
{
public DataContractAttribute() { }
public bool IsNameSetExplicitly { get { throw null; } }
public bool IsNamespaceSetExplicitly { get { throw null; } }
public bool IsReference { get { throw null; } set { } }
public bool IsReferenceSetExplicitly { get { throw null; } }
public string Name { get { throw null; } set { } }
public string Namespace { get { throw null; } set { } }
}
public abstract partial class DataContractResolver
{
protected DataContractResolver() { }
public abstract System.Type ResolveName(string typeName, string typeNamespace, System.Type declaredType, System.Runtime.Serialization.DataContractResolver knownTypeResolver);
public abstract bool TryResolveType(System.Type type, System.Type declaredType, System.Runtime.Serialization.DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace);
}
public sealed partial class DataContractSerializer : System.Runtime.Serialization.XmlObjectSerializer
{
public DataContractSerializer(System.Type type) { }
public DataContractSerializer(System.Type type, System.Collections.Generic.IEnumerable<System.Type> knownTypes) { }
//CODEDOM public DataContractSerializer(System.Type type, System.Collections.Generic.IEnumerable<System.Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate) { }
//CODEDOM public DataContractSerializer(System.Type type, System.Collections.Generic.IEnumerable<System.Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver) { }
public DataContractSerializer(System.Type type, System.Runtime.Serialization.DataContractSerializerSettings settings) { }
public DataContractSerializer(System.Type type, string rootName, string rootNamespace) { }
public DataContractSerializer(System.Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<System.Type> knownTypes) { }
//CODEDOM public DataContractSerializer(System.Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<System.Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate) { }
//CODEDOM public DataContractSerializer(System.Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<System.Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver) { }
public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace) { }
public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<System.Type> knownTypes) { }
//CODEDOM public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<System.Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate) { }
//CODEDOM public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<System.Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver) { }
public System.Runtime.Serialization.DataContractResolver DataContractResolver { get { throw null; } }
//CODEDOM public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } }
public bool IgnoreExtensionDataObject { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyCollection<System.Type> KnownTypes { get { throw null; } }
public int MaxItemsInObjectGraph { get { throw null; } }
public bool PreserveObjectReferences { get { throw null; } }
public bool SerializeReadOnlyTypes { get { throw null; } }
public override bool IsStartObject(System.Xml.XmlDictionaryReader reader) { throw null; }
public override bool IsStartObject(System.Xml.XmlReader reader) { throw null; }
public override object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName) { throw null; }
public object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName, System.Runtime.Serialization.DataContractResolver dataContractResolver) { throw null; }
public override object ReadObject(System.Xml.XmlReader reader) { throw null; }
public override object ReadObject(System.Xml.XmlReader reader, bool verifyObjectName) { throw null; }
public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer) { }
public override void WriteEndObject(System.Xml.XmlWriter writer) { }
public void WriteObject(System.Xml.XmlDictionaryWriter writer, object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver) { }
public override void WriteObject(System.Xml.XmlWriter writer, object graph) { }
public override void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph) { }
public override void WriteObjectContent(System.Xml.XmlWriter writer, object graph) { }
public override void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph) { }
public override void WriteStartObject(System.Xml.XmlWriter writer, object graph) { }
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static partial class DataContractSerializerExtensions
{
public static System.Runtime.Serialization.ISerializationSurrogateProvider GetSerializationSurrogateProvider(this System.Runtime.Serialization.DataContractSerializer serializer) { throw null; }
public static void SetSerializationSurrogateProvider(this System.Runtime.Serialization.DataContractSerializer serializer, System.Runtime.Serialization.ISerializationSurrogateProvider provider) { }
}
public partial class DataContractSerializerSettings
{
public DataContractSerializerSettings() { }
public System.Runtime.Serialization.DataContractResolver DataContractResolver { get { throw null; } set { } }
//CODEDOM public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } set { } }
public bool IgnoreExtensionDataObject { get { throw null; } set { } }
public System.Collections.Generic.IEnumerable<System.Type> KnownTypes { get { throw null; } set { } }
public int MaxItemsInObjectGraph { get { throw null; } set { } }
public bool PreserveObjectReferences { get { throw null; } set { } }
public System.Xml.XmlDictionaryString RootName { get { throw null; } set { } }
public System.Xml.XmlDictionaryString RootNamespace { get { throw null; } set { } }
public bool SerializeReadOnlyTypes { get { throw null; } set { } }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(384), Inherited=false, AllowMultiple=false)]
public sealed partial class DataMemberAttribute : System.Attribute
{
public DataMemberAttribute() { }
public bool EmitDefaultValue { get { throw null; } set { } }
public bool IsNameSetExplicitly { get { throw null; } }
public bool IsRequired { get { throw null; } set { } }
public string Name { get { throw null; } set { } }
public int Order { get { throw null; } set { } }
}
public partial class DateTimeFormat
{
public DateTimeFormat(string formatString) { }
public DateTimeFormat(string formatString, System.IFormatProvider formatProvider) { }
public System.Globalization.DateTimeStyles DateTimeStyles { get { throw null; } set { } }
public System.IFormatProvider FormatProvider { get { throw null; } }
public string FormatString { get { throw null; } }
}
public enum EmitTypeInformation
{
Always = 1,
AsNeeded = 0,
Never = 2,
}
[System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false, AllowMultiple=false)]
public sealed partial class EnumMemberAttribute : System.Attribute
{
public EnumMemberAttribute() { }
public bool IsValueSetExplicitly { get { throw null; } }
public string Value { get { throw null; } set { } }
}
public partial class ExportOptions
{
public ExportOptions() { }
//CODEDOM public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } set { } }
public System.Collections.ObjectModel.Collection<System.Type> KnownTypes { get { throw null; } }
}
public sealed partial class ExtensionDataObject
{
internal ExtensionDataObject() { }
}
[System.CLSCompliantAttribute(false)]
public abstract partial class Formatter : System.Runtime.Serialization.IFormatter
{
protected System.Runtime.Serialization.ObjectIDGenerator m_idGenerator;
protected System.Collections.Queue m_objectQueue;
protected Formatter() { }
public abstract System.Runtime.Serialization.SerializationBinder Binder { get; set; }
public abstract System.Runtime.Serialization.StreamingContext Context { get; set; }
public abstract System.Runtime.Serialization.ISurrogateSelector SurrogateSelector { get; set; }
public abstract object Deserialize(System.IO.Stream serializationStream);
protected virtual object GetNext(out long objID) { objID = default(long); throw null; }
protected virtual long Schedule(object obj) { throw null; }
public abstract void Serialize(System.IO.Stream serializationStream, object graph);
protected abstract void WriteArray(object obj, string name, System.Type memberType);
protected abstract void WriteBoolean(bool val, string name);
protected abstract void WriteByte(byte val, string name);
protected abstract void WriteChar(char val, string name);
protected abstract void WriteDateTime(System.DateTime val, string name);
protected abstract void WriteDecimal(decimal val, string name);
protected abstract void WriteDouble(double val, string name);
protected abstract void WriteInt16(short val, string name);
protected abstract void WriteInt32(int val, string name);
protected abstract void WriteInt64(long val, string name);
protected virtual void WriteMember(string memberName, object data) { }
protected abstract void WriteObjectRef(object obj, string name, System.Type memberType);
[System.CLSCompliantAttribute(false)]
protected abstract void WriteSByte(sbyte val, string name);
protected abstract void WriteSingle(float val, string name);
protected abstract void WriteTimeSpan(System.TimeSpan val, string name);
[System.CLSCompliantAttribute(false)]
protected abstract void WriteUInt16(ushort val, string name);
[System.CLSCompliantAttribute(false)]
protected abstract void WriteUInt32(uint val, string name);
[System.CLSCompliantAttribute(false)]
protected abstract void WriteUInt64(ulong val, string name);
protected abstract void WriteValueType(object obj, string name, System.Type memberType);
}
public partial class FormatterConverter : System.Runtime.Serialization.IFormatterConverter
{
public FormatterConverter() { }
public object Convert(object value, System.Type type) { throw null; }
public object Convert(object value, System.TypeCode typeCode) { throw null; }
public bool ToBoolean(object value) { throw null; }
public byte ToByte(object value) { throw null; }
public char ToChar(object value) { throw null; }
public System.DateTime ToDateTime(object value) { throw null; }
public decimal ToDecimal(object value) { throw null; }
public double ToDouble(object value) { throw null; }
public short ToInt16(object value) { throw null; }
public int ToInt32(object value) { throw null; }
public long ToInt64(object value) { throw null; }
[System.CLSCompliantAttribute(false)]
public sbyte ToSByte(object value) { throw null; }
public float ToSingle(object value) { throw null; }
public string ToString(object value) { throw null; }
[System.CLSCompliantAttribute(false)]
public ushort ToUInt16(object value) { throw null; }
[System.CLSCompliantAttribute(false)]
public uint ToUInt32(object value) { throw null; }
[System.CLSCompliantAttribute(false)]
public ulong ToUInt64(object value) { throw null; }
}
public static partial class FormatterServices
{
public static void CheckTypeSecurity(System.Type t, System.Runtime.Serialization.Formatters.TypeFilterLevel securityLevel) { }
public static object[] GetObjectData(object obj, System.Reflection.MemberInfo[] members) { throw null; }
public static object GetSafeUninitializedObject(System.Type type) { throw null; }
public static System.Reflection.MemberInfo[] GetSerializableMembers(System.Type type) { throw null; }
public static System.Reflection.MemberInfo[] GetSerializableMembers(System.Type type, System.Runtime.Serialization.StreamingContext context) { throw null; }
public static System.Runtime.Serialization.ISerializationSurrogate GetSurrogateForCyclicalReference(System.Runtime.Serialization.ISerializationSurrogate innerSurrogate) { throw null; }
public static System.Type GetTypeFromAssembly(System.Reflection.Assembly assem, string name) { throw null; }
public static object GetUninitializedObject(System.Type type) { throw null; }
public static object PopulateObjectMembers(object obj, System.Reflection.MemberInfo[] members, object[] data) { throw null; }
}
public partial interface IDeserializationCallback
{
void OnDeserialization(object sender);
}
public partial interface IExtensibleDataObject
{
System.Runtime.Serialization.ExtensionDataObject ExtensionData { get; set; }
}
public partial interface IFormatter
{
System.Runtime.Serialization.SerializationBinder Binder { get; set; }
System.Runtime.Serialization.StreamingContext Context { get; set; }
System.Runtime.Serialization.ISurrogateSelector SurrogateSelector { get; set; }
object Deserialize(System.IO.Stream serializationStream);
void Serialize(System.IO.Stream serializationStream, object graph);
}
[System.CLSCompliantAttribute(false)]
public partial interface IFormatterConverter
{
object Convert(object value, System.Type type);
object Convert(object value, System.TypeCode typeCode);
bool ToBoolean(object value);
byte ToByte(object value);
char ToChar(object value);
System.DateTime ToDateTime(object value);
decimal ToDecimal(object value);
double ToDouble(object value);
short ToInt16(object value);
int ToInt32(object value);
long ToInt64(object value);
sbyte ToSByte(object value);
float ToSingle(object value);
string ToString(object value);
ushort ToUInt16(object value);
uint ToUInt32(object value);
ulong ToUInt64(object value);
}
[System.AttributeUsageAttribute((System.AttributeTargets)(384), Inherited=false, AllowMultiple=false)]
public sealed partial class IgnoreDataMemberAttribute : System.Attribute
{
public IgnoreDataMemberAttribute() { }
}
public partial class InvalidDataContractException : System.Exception
{
public InvalidDataContractException() { }
protected InvalidDataContractException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidDataContractException(string message) { }
public InvalidDataContractException(string message, System.Exception innerException) { }
}
public partial interface IObjectReference
{
object GetRealObject(System.Runtime.Serialization.StreamingContext context);
}
public partial interface ISafeSerializationData
{
void CompleteDeserialization(object deserialized);
}
public partial interface ISerializable
{
void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
}
public partial interface ISerializationSurrogate
{
void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector);
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public partial interface ISerializationSurrogateProvider
{
object GetDeserializedObject(object obj, System.Type targetType);
object GetObjectToSerialize(object obj, System.Type targetType);
System.Type GetSurrogateType(System.Type type);
}
public partial interface ISurrogateSelector
{
void ChainSelector(System.Runtime.Serialization.ISurrogateSelector selector);
System.Runtime.Serialization.ISurrogateSelector GetNextSelector();
System.Runtime.Serialization.ISerializationSurrogate GetSurrogate(System.Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector);
}
[System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited=true, AllowMultiple=true)]
public sealed partial class KnownTypeAttribute : System.Attribute
{
public KnownTypeAttribute(string methodName) { }
public KnownTypeAttribute(System.Type type) { }
public string MethodName { get { throw null; } }
public System.Type Type { get { throw null; } }
}
public partial class ObjectIDGenerator
{
public ObjectIDGenerator() { }
public virtual long GetId(object obj, out bool firstTime) { firstTime = default(bool); throw null; }
public virtual long HasId(object obj, out bool firstTime) { firstTime = default(bool); throw null; }
}
public partial class ObjectManager
{
public ObjectManager(System.Runtime.Serialization.ISurrogateSelector selector, System.Runtime.Serialization.StreamingContext context) { }
public virtual void DoFixups() { }
public virtual object GetObject(long objectID) { throw null; }
public virtual void RaiseDeserializationEvent() { }
public void RaiseOnDeserializingEvent(object obj) { }
public virtual void RecordArrayElementFixup(long arrayToBeFixed, int index, long objectRequired) { }
public virtual void RecordArrayElementFixup(long arrayToBeFixed, int[] indices, long objectRequired) { }
public virtual void RecordDelayedFixup(long objectToBeFixed, string memberName, long objectRequired) { }
public virtual void RecordFixup(long objectToBeFixed, System.Reflection.MemberInfo member, long objectRequired) { }
public virtual void RegisterObject(object obj, long objectID) { }
public void RegisterObject(object obj, long objectID, System.Runtime.Serialization.SerializationInfo info) { }
public void RegisterObject(object obj, long objectID, System.Runtime.Serialization.SerializationInfo info, long idOfContainingObj, System.Reflection.MemberInfo member) { }
public void RegisterObject(object obj, long objectID, System.Runtime.Serialization.SerializationInfo info, long idOfContainingObj, System.Reflection.MemberInfo member, int[] arrayIndex) { }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
public sealed partial class OnDeserializedAttribute : System.Attribute
{
public OnDeserializedAttribute() { }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
public sealed partial class OnDeserializingAttribute : System.Attribute
{
public OnDeserializingAttribute() { }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
public sealed partial class OnSerializedAttribute : System.Attribute
{
public OnSerializedAttribute() { }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
public sealed partial class OnSerializingAttribute : System.Attribute
{
public OnSerializingAttribute() { }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false)]
public sealed partial class OptionalFieldAttribute : System.Attribute
{
public OptionalFieldAttribute() { }
public int VersionAdded { get { throw null; } set { } }
}
public sealed partial class SafeSerializationEventArgs : System.EventArgs
{
internal SafeSerializationEventArgs() { }
public System.Runtime.Serialization.StreamingContext StreamingContext { get { throw null; } }
public void AddSerializedState(System.Runtime.Serialization.ISafeSerializationData serializedState) { }
}
public abstract partial class SerializationBinder
{
protected SerializationBinder() { }
public virtual void BindToName(System.Type serializedType, out string assemblyName, out string typeName) { assemblyName = default(string); typeName = default(string); }
public abstract System.Type BindToType(string assemblyName, string typeName);
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct SerializationEntry
{
public string Name { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
public object Value { get { throw null; } }
}
public partial class SerializationException : System.SystemException
{
public SerializationException() { }
protected SerializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SerializationException(string message) { }
public SerializationException(string message, System.Exception innerException) { }
}
public sealed partial class SerializationInfo
{
[System.CLSCompliantAttribute(false)]
public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter) { }
[System.CLSCompliantAttribute(false)]
public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter, bool requireSameTokenInPartialTrust) { }
public string AssemblyName { get { throw null; } set { } }
public string FullTypeName { get { throw null; } set { } }
public bool IsAssemblyNameSetExplicit { get { throw null; } }
public bool IsFullTypeNameSetExplicit { get { throw null; } }
public int MemberCount { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
public void AddValue(string name, bool value) { }
public void AddValue(string name, byte value) { }
public void AddValue(string name, char value) { }
public void AddValue(string name, System.DateTime value) { }
public void AddValue(string name, decimal value) { }
public void AddValue(string name, double value) { }
public void AddValue(string name, short value) { }
public void AddValue(string name, int value) { }
public void AddValue(string name, long value) { }
public void AddValue(string name, object value) { }
public void AddValue(string name, object value, System.Type type) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, sbyte value) { }
public void AddValue(string name, float value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, ushort value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, uint value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, ulong value) { }
public bool GetBoolean(string name) { throw null; }
public byte GetByte(string name) { throw null; }
public char GetChar(string name) { throw null; }
public System.DateTime GetDateTime(string name) { throw null; }
public decimal GetDecimal(string name) { throw null; }
public double GetDouble(string name) { throw null; }
public System.Runtime.Serialization.SerializationInfoEnumerator GetEnumerator() { throw null; }
public short GetInt16(string name) { throw null; }
public int GetInt32(string name) { throw null; }
public long GetInt64(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public sbyte GetSByte(string name) { throw null; }
public float GetSingle(string name) { throw null; }
public string GetString(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public ushort GetUInt16(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public uint GetUInt32(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public ulong GetUInt64(string name) { throw null; }
public object GetValue(string name, System.Type type) { throw null; }
public void SetType(System.Type type) { }
}
public sealed partial class SerializationInfoEnumerator : System.Collections.IEnumerator
{
internal SerializationInfoEnumerator() { }
public System.Runtime.Serialization.SerializationEntry Current { get { throw null; } }
public string Name { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public object Value { get { throw null; } }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public sealed partial class SerializationObjectManager
{
public SerializationObjectManager(System.Runtime.Serialization.StreamingContext context) { }
public void RaiseOnSerializedEvent() { }
public void RegisterObject(object obj) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct StreamingContext
{
public StreamingContext(System.Runtime.Serialization.StreamingContextStates state) { throw null;}
public StreamingContext(System.Runtime.Serialization.StreamingContextStates state, object additional) { throw null;}
public object Context { get { throw null; } }
public System.Runtime.Serialization.StreamingContextStates State { get { throw null; } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
}
[System.FlagsAttribute]
public enum StreamingContextStates
{
All = 255,
Clone = 64,
CrossAppDomain = 128,
CrossMachine = 2,
CrossProcess = 1,
File = 4,
Other = 32,
Persistence = 8,
Remoting = 16,
}
public partial class SurrogateSelector : System.Runtime.Serialization.ISurrogateSelector
{
public SurrogateSelector() { }
public virtual void AddSurrogate(System.Type type, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISerializationSurrogate surrogate) { }
public virtual void ChainSelector(System.Runtime.Serialization.ISurrogateSelector selector) { }
public virtual System.Runtime.Serialization.ISurrogateSelector GetNextSelector() { throw null; }
public virtual System.Runtime.Serialization.ISerializationSurrogate GetSurrogate(System.Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector) { selector = default(System.Runtime.Serialization.ISurrogateSelector); throw null; }
public virtual void RemoveSurrogate(System.Type type, System.Runtime.Serialization.StreamingContext context) { }
}
public abstract partial class XmlObjectSerializer
{
protected XmlObjectSerializer() { }
public abstract bool IsStartObject(System.Xml.XmlDictionaryReader reader);
public virtual bool IsStartObject(System.Xml.XmlReader reader) { throw null; }
public virtual object ReadObject(System.IO.Stream stream) { throw null; }
public virtual object ReadObject(System.Xml.XmlDictionaryReader reader) { throw null; }
public abstract object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName);
public virtual object ReadObject(System.Xml.XmlReader reader) { throw null; }
public virtual object ReadObject(System.Xml.XmlReader reader, bool verifyObjectName) { throw null; }
public abstract void WriteEndObject(System.Xml.XmlDictionaryWriter writer);
public virtual void WriteEndObject(System.Xml.XmlWriter writer) { }
public virtual void WriteObject(System.IO.Stream stream, object graph) { }
public virtual void WriteObject(System.Xml.XmlDictionaryWriter writer, object graph) { }
public virtual void WriteObject(System.Xml.XmlWriter writer, object graph) { }
public abstract void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph);
public virtual void WriteObjectContent(System.Xml.XmlWriter writer, object graph) { }
public abstract void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph);
public virtual void WriteStartObject(System.Xml.XmlWriter writer, object graph) { }
}
public static partial class XmlSerializableServices
{
public static void AddDefaultSchema(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeQName) { }
public static System.Xml.XmlNode[] ReadNodes(System.Xml.XmlReader xmlReader) { throw null; }
public static void WriteNodes(System.Xml.XmlWriter xmlWriter, System.Xml.XmlNode[] nodes) { }
}
public static partial class XPathQueryGenerator
{
public static string CreateFromDataContractSerializer(System.Type type, System.Reflection.MemberInfo[] pathToMember, System.Text.StringBuilder rootElementXpath, out System.Xml.XmlNamespaceManager namespaces) { namespaces = default(System.Xml.XmlNamespaceManager); throw null; }
public static string CreateFromDataContractSerializer(System.Type type, System.Reflection.MemberInfo[] pathToMember, out System.Xml.XmlNamespaceManager namespaces) { namespaces = default(System.Xml.XmlNamespaceManager); throw null; }
}
public partial class XsdDataContractExporter
{
public XsdDataContractExporter() { }
public XsdDataContractExporter(System.Xml.Schema.XmlSchemaSet schemas) { }
public System.Runtime.Serialization.ExportOptions Options { get { throw null; } set { } }
public System.Xml.Schema.XmlSchemaSet Schemas { get { throw null; } }
public bool CanExport(System.Collections.Generic.ICollection<System.Reflection.Assembly> assemblies) { throw null; }
public bool CanExport(System.Collections.Generic.ICollection<System.Type> types) { throw null; }
public bool CanExport(System.Type type) { throw null; }
public void Export(System.Collections.Generic.ICollection<System.Reflection.Assembly> assemblies) { }
public void Export(System.Collections.Generic.ICollection<System.Type> types) { }
public void Export(System.Type type) { }
public System.Xml.XmlQualifiedName GetRootElementName(System.Type type) { throw null; }
public System.Xml.Schema.XmlSchemaType GetSchemaType(System.Type type) { throw null; }
public System.Xml.XmlQualifiedName GetSchemaTypeName(System.Type type) { throw null; }
}
}
| weshaggard/standard | netstandard/ref/System.Runtime.Serialization.cs | C# | mit | 35,348 |
class Post < ActiveRecord::Base
belongs_to :author, :class_name => "User"
record_activity_of :author, :if => Proc.new { |post| post.private == false }
end
class Membership < ActiveRecord::Base
belongs_to :user
belongs_to :group
record_activity_of :user
end
class Group < ActiveRecord::Base
has_many :users, :through => :memberships
end
class User < ActiveRecord::Base
has_many :groups, :through => :memberships
end
| pacoguzman/tog_activity | spec/models.rb | Ruby | mit | 434 |
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually
#pragma once
#include <common/common.h>
#include <CashDbWorker.hpp>
#include <_param_cash_update.hpp>
START_ATF_NAMESPACE
struct CCashDbWorkerTH : CashDbWorker
{
public:
CCashDbWorkerTH();
void ctor_CCashDbWorkerTH();
void GetUseCashQueryStr(struct _param_cash_update* rParam, int nIdx, char* wszQuery, uint64_t tBufferSize);
~CCashDbWorkerTH();
void dtor_CCashDbWorkerTH();
};
END_ATF_NAMESPACE
| goodwinxp/Yorozuya | library/ATF/CCashDbWorkerTH.hpp | C++ | mit | 565 |
XO.View.define({
pid:'home',
vid:'page2',
version:'20131209',
cssHost:'body',
init:function(){
XO.warn('View inited:'+this.id);
}
}); | xsin/xo | demo/helloword/js/views/home/page2.js | JavaScript | mit | 165 |
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
/** @var $this \Illuminate\Routing\Router */
$this->get('/', ['as' => 'home', 'uses' => 'HomeController@index']);
$this->get('Flag', ['uses' => 'FlagController@index', 'as' => 'flag', 'middleware' => 'auth']);
$this->post('Flag', ['uses' => 'FlagController@save', 'middleware' => 'auth']);
$this->post('Flag/Delete/{flag}', ['uses' => 'FlagController@delete', 'middleware' => 'auth', 'as' => 'flag.delete']);
$this->get('Flag/Delete/{flag}', ['uses' => 'FlagController@modal', 'middleware' => 'auth', 'as' => 'flag.modal']);
$this->get('sitemap/{sitemap?}', ['uses' => 'SitemapController@index', 'as' => 'sitemap']);
$this->get('Search', ['uses' => 'SearchController@index', 'as' => 'search']);
$this->get('mailing/unsubscribe/{uuid}', 'MailingController@unsubscribe')->name('mailing.unsubscribe');
$this->post('mailgun/permanent-failure', 'MailgunController@permanentFailure');
$this->post('github/sponsorship', 'GithubController@sponsorship');
$this->post('assets', 'AssetsController@upload');
$this->get('assets/opg', 'AssetsController@opengraph');
$this->get('assets/{asset}/{name}', ['uses' => 'AssetsController@download', 'as' => 'assets.download']);
$this->get('campaign/{banner}', ['uses' => 'CampaignController@redirect', 'as' => 'campaign.redirect']);
| adam-boduch/coyote | routes/misc.php | PHP | mit | 1,663 |
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.net.InetAddress;
public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n");
out.write("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
out.write("\r\n");
out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:wicket=\"http://wicket.apache.org\">\n");
out.write(" ");
org.dcm4chee.web.common.login.LoginResources login = null;
synchronized (request) {
login = (org.dcm4chee.web.common.login.LoginResources) _jspx_page_context.getAttribute("login", PageContext.REQUEST_SCOPE);
if (login == null){
login = new org.dcm4chee.web.common.login.LoginResources();
_jspx_page_context.setAttribute("login", login, PageContext.REQUEST_SCOPE);
}
}
out.write("\r\n");
out.write(" ");
String nodeInfo = System.getProperty("dcm4che.archive.nodename", InetAddress.getLocalHost().getHostName() );
Cookie[] cookies = request.getCookies();
String userName = "";
String focus = "self.focus();document.login.j_username.focus()";
if (cookies != null) {
int count = 0;
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equals("WEB3LOCALE")) {
login.setLocale(cookies[i].getValue());
count++;
if (count==2)
break;
}
if (cookies[i].getName().equals("signInPanel.signInForm.username")) {
userName = cookies[i].getValue();
if (userName!=null && userName.length()>0)
focus = "self.focus();document.login.j_username.value='"+userName+
"';document.login.j_password.focus()";
count++;
if (count==2)
break;
}
}
}
out.write("\r\n");
out.write(" <head>\n");
out.write("\t <title>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.browser_title}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write(' ');
out.write('(');
out.print( nodeInfo );
out.write(")</title>\n");
out.write("\t <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n");
out.write(" <link rel=\"stylesheet\" type=\"text/css\" href=\"resources/org.dcm4chee.web.common.base.BaseWicketPage/base-style.css\" />\n");
out.write(" <script>\n");
out.write(" function login_init() {\n");
out.write(" \t");
out.print( focus );
out.write("\n");
out.write(" window.setTimeout(\"location.reload(true);\", ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.session.maxInactiveInterval * 1000 - 5000}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write(");\n");
out.write(" }\n");
out.write(" </script>\n");
out.write(" </head>\n");
out.write(" <body onload=\"login_init();\">\n");
out.write(" <div class=\"tabpanel\">\n");
out.write(" <div class=\"module-selector\">\n");
out.write(" <div class=\"tab-row\">\n");
out.write("\t\t\t <ul>\n");
out.write("\t\t </ul>\n");
out.write(" </div>\n");
out.write("\t\t <div class=\"tab-logo\" style=\"float: right; margin-top: 15px; height: 43px; padding-right: 15px; padding-left: 15px;\">\n");
out.write("\t\t <img alt=\"dcm4che.org\" src=\"resources/org.dcm4chee.web.common.base.BaseWicketPage/images/logo.gif\" /><br/>\n");
out.write("\t\t </div>\n");
out.write("\t </div>\n");
out.write("\t <div class=\"module-panel\"></div>\n");
out.write(" </div>\n");
out.write(" <div class=\"signin\" style=\"padding-top: 160px;\">\n");
out.write(" ");
if (request.getParameter("loginFailed") == null) {
out.write("\n");
out.write("\t <span class=\"login-desc\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.loginLabel}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write(' ');
out.print( nodeInfo );
out.write("</span>\n");
out.write(" ");
} else {
out.write("\n");
out.write(" \t <span class=\"login-desc\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.loginFailed}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write(' ');
out.print( nodeInfo );
out.write("</span>\n");
out.write(" \t ");
}
out.write("\n");
out.write(" <div>\n");
out.write("\t\t <form action=\"j_security_check\" method=\"POST\" name=\"login\" >\r\n");
out.write("\t\t <table style=\"padding-top: 60px; padding-right: 90px; padding-bottom: 10px;\">\n");
out.write(" <tbody>\n");
out.write("\t\t\t <tr style=\"text-align: left;\">\n");
out.write("\t\t\t <td align=\"right\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.username}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("</td>\n");
out.write("\t\t\t <td>\n");
out.write("\t\t\t <input type=\"text\" name=\"j_username\" size=\"30\" />\n");
out.write("\t\t\t </td>\n");
out.write("\t\t\t </tr>\n");
out.write("\t\t\t <tr style=\"text-align: left;\">\n");
out.write("\t\t\t <td align=\"right\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.password}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("</td>\n");
out.write("\t\t\t <td>\n");
out.write("\t\t\t <input type=\"password\" name=\"j_password\" size=\"30\" />\n");
out.write("\t\t\t </td>\n");
out.write("\t\t\t </tr>\n");
out.write("\t\t\t <tr style=\"text-align: left;\">\n");
out.write("\t\t\t <td></td>\n");
out.write("\t\t\t <td>\n");
out.write("\t\t\t <input type=\"submit\" name=\"submit\" value=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.submit}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\" />\n");
out.write("\t\t\t <input type=\"reset\" value=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${login.reset}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\" onclick=\"document.login.j_username.focus()\"/>\n");
out.write("\t\t\t </td>\n");
out.write("\t\t\t </tr>\n");
out.write(" </tbody>\n");
out.write(" </table>\n");
out.write("\t\t </form>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| alcir/mibe-dcm4chee | copy/var/tmp/dcm4chee-2.17.3-mysql/server/default/work/jboss.web/localhost/dcm4chee-web3/org/apache/jsp/login_jsp.java | Java | mit | 9,975 |
using System;
using System.Xml.Serialization;
namespace HoloXPLOR.Data.DataForge
{
[XmlRoot(ElementName = "TransformationInterpolatorParams")]
public partial class TransformationInterpolatorParams
{
[XmlElement(ElementName = "startOffsetValues")]
public Vec3 StartOffsetValues { get; set; }
[XmlElement(ElementName = "endOffsetValues")]
public Vec3 EndOffsetValues { get; set; }
[XmlArray(ElementName = "offsetInterpolationModes")]
[XmlArrayItem(ElementName = "Enum", Type=typeof(_InterpolationMode))]
public _InterpolationMode[] OffsetInterpolationModes { get; set; }
[XmlElement(ElementName = "startRotationValues")]
public Ang3 StartRotationValues { get; set; }
[XmlElement(ElementName = "endRotationValues")]
public Ang3 EndRotationValues { get; set; }
[XmlArray(ElementName = "rotationInterpolationModes")]
[XmlArrayItem(ElementName = "Enum", Type=typeof(_InterpolationMode))]
public _InterpolationMode[] RotationInterpolationModes { get; set; }
[XmlAttribute(AttributeName = "startScaleValue")]
public Single StartScaleValue { get; set; }
[XmlAttribute(AttributeName = "endScaleValue")]
public Single EndScaleValue { get; set; }
[XmlAttribute(AttributeName = "scaleInterpolationMode")]
public InterpolationMode ScaleInterpolationMode { get; set; }
}
}
| dolkensp/HoloXPLOR | HoloXPLOR.Data/DataForge/AutoGen/TransformationInterpolatorParams.cs | C# | mit | 1,444 |
module.exports = function (app) {
var colaboradorCtrl = app.controllers.colaborador;
app.get('/colaborador', colaboradorCtrl.index);
app.post('/buscar_colaborador', colaboradorCtrl.find);
app.get('/buscar_colaborador_id/:id', colaboradorCtrl.buscarId);
app.post('/editar_colaborador/:id', colaboradorCtrl.update);
app.get('/remover_colaborador/:id', colaboradorCtrl.remove);
app.post('/cadastrar_colaborador', colaboradorCtrl.insert);
} | nathalialanzendorf/scalapp | routes/colaborador.js | JavaScript | mit | 465 |
package city.restaurant.yixin;
import java.util.*;
public class Menu {
public List<Food> menu = new ArrayList<Food>();
Menu(){
menu.add(new Food("Steak", 15.99));
menu.add(new Food("Chicken", 10.99));
menu.add(new Food("Salad", 5.99));
menu.add(new Food("Pizza", 8.99));
}
public void remove(String s){
for (int i=0; i<menu.size(); i++){
if (menu.get(i).name.equals(s)){
menu.remove(i);
return;
}
}
}
public double getPrice(String s){
for (int i=0; i<menu.size(); i++){
if (menu.get(i).name.compareTo(s) == 0){
return menu.get(i).price;
}
}
return 0;
}
public class Food{
public String name;
public double price;
Food(String name, double price){
this.name = name;
this.price = price;
}
}
}
| yixincai/CS201_FinalProject_SimCity | source/city/restaurant/yixin/Menu.java | Java | mit | 769 |
'use strict';
//dts
import {IGlobalSumanObj} from "../../../suman-types/dts/global";
//polyfills
const process = require('suman-browser-polyfills/modules/process');
const global = require('suman-browser-polyfills/modules/global');
//core
import fs = require('fs');
import path = require('path');
import EE = require('events');
//npm
import chalk from 'chalk';
const {events} = require('suman-events');
import su = require('suman-utils');
//project
const _suman: IGlobalSumanObj = global.__suman = global.__suman || {};
const resultBroadcaster = _suman.resultBroadcaster = _suman.resultBroadcaster || new EE();
////////////////////////////////////////////////////////////////////////////////////////
export const onExit = function (code: number) {
if (code > 0) {
//make a beep noise if a failing run
resultBroadcaster.emit(String(events.RUNNER_EXIT_CODE_GREATER_THAN_ZERO), code);
}
else {
resultBroadcaster.emit(String(events.RUNNER_EXIT_CODE_IS_ZERO));
}
if (code > 0) {
const logsDir = _suman.sumanConfig.logsDir || _suman.sumanHelperDirRoot + '/logs';
const sumanCPLogs = path.resolve(logsDir + '/runs/');
const logsPath = path.resolve(sumanCPLogs + '/' + _suman.timestamp + '-' + _suman.runId);
console.log('\n', ' => At least one test experienced an error => View the test logs => ',
'\n', chalk.yellow.bold(logsPath), '\n');
}
resultBroadcaster.emit(String(events.RUNNER_EXIT_CODE), code);
//write synchronously to ensure it gets written
fs.appendFileSync(_suman.sumanRunnerStderrStreamPath, '\n\n### Suman runner end ###\n\n');
};
| sumanjs/suman | src/runner-helpers/on-exit.ts | TypeScript | mit | 1,605 |
import arrayToObject from './array-to-object'
describe('array to object', () => {
it('takes an array of object and returns an object', () => {
expect(arrayToObject([
{
name: 'A', age: 30, food: 'pizza'
}, {
name: 'B', age: 40, food: 'pasta'
}
], 'name')).toEqual({
A: { age: 30, food: 'pizza' },
B: { age: 40, food: 'pasta' }
})
})
}) | FranckCo/Operation-Explorer | src/utils/array-to-object.test.js | JavaScript | mit | 397 |
package org.schertel.friederike.ecliphistory.model;
/**
* The POJO describing the entries for the history table.
*/
public class ClipboardHistoryEntry {
public int position;
public String content;
public ClipboardHistoryEntry(int pos, String txt) {
position = pos;
content = txt;
}
}
| frie321984/eClipHistory | org.schertel.friederike.ecliphistory.application/src/org/schertel/friederike/ecliphistory/model/ClipboardHistoryEntry.java | Java | mit | 297 |
namespace KSL.Gestures.Classifier
{
using System.Collections.Generic;
public class SentenceStructure
{
public int ID { set; get; }
public List<int> Codes { set; get; }
public string Text { set; get; }
}
}
| svil4ok/kinect-sign-language | KSL.Gestures/Classifier/SentenceStructure.cs | C# | mit | 264 |
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'sqxKNumber',
pure: true,
})
export class KNumberPipe implements PipeTransform {
public transform(value: number) {
if (value > 1000) {
value /= 1000;
if (value < 10) {
value = Math.round(value * 10) / 10;
} else {
value = Math.round(value);
}
return `${value}k`;
} else if (value < 0) {
return '';
} else {
return value.toString();
}
}
}
@Pipe({
name: 'sqxFileSize',
pure: true,
})
export class FileSizePipe implements PipeTransform {
public transform(value: number) {
return calculateFileSize(value);
}
}
export function calculateFileSize(value: number, factor = 1024) {
let u = 0;
while (value >= factor || -value >= factor) {
value /= factor;
u++;
}
// eslint-disable-next-line prefer-template
return (u ? `${value.toFixed(1)} ` : value) + ' kMGTPEZY'[u] + 'B';
}
| Squidex/squidex | frontend/src/app/framework/angular/pipes/numbers.pipes.ts | TypeScript | mit | 1,184 |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="serverless-wsgi",
version="3.0.0",
python_requires=">3.6",
author="Logan Raarup",
author_email="logan@logan.dk",
description="Amazon AWS API Gateway WSGI wrapper",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/logandk/serverless-wsgi",
py_modules=["serverless_wsgi"],
install_requires=["werkzeug>2"],
classifiers=(
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
),
keywords="wsgi serverless aws lambda api gateway apigw flask django pyramid",
)
| logandk/serverless-wsgi | setup.py | Python | mit | 867 |
namespace YKToolkit.Sample.ViewModels
{
using System.Linq;
using YKToolkit.Bindings;
using YKToolkit.Helpers;
public class FourierViewModel : ViewModelBase
{
private int _dataNum = 512;
/// <summary>
/// フーリエ変換対象のデータ点数を取得または設定します。
/// </summary>
public int DataNum
{
get { return this._dataNum; }
set { SetProperty(ref this._dataNum, value); }
}
private string _source;
/// <summary>
/// 元データを取得または設定します。
/// </summary>
public string Source
{
get { return this._source; }
set { SetProperty(ref this._source, value); }
}
private string _result;
/// <summary>
/// フーリエ変換結果を取得します。
/// </summary>
public string Result
{
get { return this._result; }
private set { SetProperty(ref this._result, value); }
}
private string _amplitude;
/// <summary>
/// フーリエ変換結果の振幅を取得します。
/// </summary>
public string Amplitude
{
get { return this._amplitude; }
private set { SetProperty(ref this._amplitude, value); }
}
private int _length;
/// <summary>
/// データ長を取得します。
/// </summary>
public int Length
{
get { return this._length; }
private set { SetProperty(ref this._length, value); }
}
private DelegateCommand _fftCommand;
/// <summary>
/// フーリエ変換コマンドを取得します。
/// </summary>
public DelegateCommand FFTCommand
{
get
{
return this._fftCommand ?? (this._fftCommand = new DelegateCommand(FftProc, _ => !string.IsNullOrWhiteSpace(this.Source)));
}
}
/// <summary>
/// フーリエ変換をおこないます。
/// </summary>
/// <param name="_">ダミー</param>
private void FftProc(object _)
{
var data = this.Source.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries)
.Take(this.DataNum)
.Select(x => double.Parse(x));
var data_minus_ave = data.Select(x => x - data.Average())
.ToArray()
.FFT();
this.Length = data.ToArray().Length;
this.Result = string.Join("\r\n", data_minus_ave);
this.Amplitude = string.Join("\r\n", data_minus_ave.Select(x => x.Abs));
}
}
}
| YKSoftware/YKToolkit.Controls | YKToolkit.Sample/ViewModels/Helpers/FourierViewModel.cs | C# | mit | 2,874 |
#ifndef COUNT_VISITS_TO_SUBDOMAINS_HPP
#define COUNT_VISITS_TO_SUBDOMAINS_HPP
/*
https://leetcode.com/problems/subdomain-visit-count/
A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level,
we have "com", at the next level, we have "leetcode.com", and at the lowest level,
"discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit
the parent domains "leetcode.com" and "com" implicitly.
Now, call a "count-paired domain" to be a count (representing the number of visits this domain
received), followed by a space, followed by the address. An example of a count-paired domain might
be "9001 discuss.leetcode.com".
We are given a list cpdomains of count-paired domains. We would like a list of count-paired domains,
(in the same format as the input, and in any order), that explicitly counts the number of visits
to each subdomain.
Example 1:
Input:
["9001 discuss.leetcode.com"]
Output:
["9001 discuss.leetcode.com", "9001 leetcode.com", "9001 com"]
Explanation:
We only have one website domain: "discuss.leetcode.com". As discussed above, the subdomain
"leetcode.com" and "com" will also be visited. So they will all be visited 9001 times.
Example 2:
Input:
["900 google.mail.com", "50 yahoo.com", "1 intel.mail.com", "5 wiki.org"]
Output:
["901 mail.com","50 yahoo.com","900 google.mail.com","5 wiki.org","5 org","1 intel.mail.com","951 com"]
Explanation:
We will visit "google.mail.com" 900 times, "yahoo.com" 50 times, "intel.mail.com" once and
"wiki.org" 5 times. For the subdomains, we will visit "mail.com" 900 + 1 = 901 times,
"com" 900 + 50 + 1 = 951 times, and "org" 5 times.
Notes:
The length of cpdomains will not exceed 100.
The length of each domain name will not exceed 100.
Each address will have either 1 or 2 "." characters.
The input count in any count-paired domain will not exceed 10000.
The answer output can be returned in any order.
*/
#include <string>
#include <string_view>
#include <vector>
#include <unordered_map>
#include <limits>
namespace Algo::DS::HashMap {
class CountVisitsToSubdomains {
static bool convert_to_num(const std::string_view& str, size_t& num) {
char** end = nullptr;
const auto result = std::strtoull(str.data(), end, 10);
if (result == std::numeric_limits<unsigned long long>::max()) {
return false;
}
num = result;
return true;
}
static std::tuple<bool, size_t, std::vector<std::string_view>> split_count_domains_string(
const std::string_view& str) {
const auto space_pos = str.find(' ');
if (space_pos == std::string::npos) { return {false, 0, {}}; }
size_t count = 0;
if (!convert_to_num(str.substr(0, space_pos), count) || count == 0) {
return {false, 0, {}};
}
std::vector<std::string_view> domains;
for (size_t i = space_pos + 1; i < str.size(); ++i) {
const auto pos = str.find('.', i);
const auto dot_pos = pos == std::string_view::npos ? str.size() : pos;
domains.push_back(str.substr(i));
i = dot_pos;
}
if (domains.empty()) { return {false, 0, {}}; }
return {true, count, domains};
}
public:
static std::vector<std::string> count(const std::vector<std::string>& count_domains) {
std::unordered_map<std::string_view, size_t> count_map;
for (const auto& str : count_domains) {
const auto [is_ok, count, domains] = split_count_domains_string(str);
if (!is_ok) { continue; }
for (const auto& domain : domains) {
count_map[domain] += count;
}
}
std::vector<std::string> result;
for (const auto& [str, count] : count_map) {
result.push_back(std::to_string(count) + ' ' + std::string(str));
}
return result;
}
};
}
#endif //COUNT_VISITS_TO_SUBDOMAINS_HPP
| iamantony/CppNotes | src/algorithms/data_structures/hashmap/count_visits_to_subdomains.hpp | C++ | mit | 4,149 |
package gk.nickles.ndimes.services;
import com.google.inject.Inject;
import java.util.LinkedList;
import java.util.List;
import gk.nickles.ndimes.dataaccess.AttendeeStore;
import gk.nickles.ndimes.dataaccess.ExpenseStore;
import gk.nickles.ndimes.dataaccess.ParticipantStore;
import gk.nickles.ndimes.dataaccess.UserStore;
import gk.nickles.ndimes.model.Debt;
import gk.nickles.ndimes.model.Event;
import gk.nickles.ndimes.model.Expense;
import gk.nickles.ndimes.model.Participant;
import gk.nickles.ndimes.model.User;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;
public class DebtCalculator {
@Inject
private ExpenseStore expenseStore;
@Inject
private UserStore userStore;
@Inject
private ParticipantStore participantStore;
@Inject
private AttendeeStore attendeeStore;
@Inject
private DebtOptimizer debtOptimizer;
public List<Debt> calculateDebts(Event event) {
checkNotNull(event);
List<Debt> debts = getDebts(event);
return debtOptimizer.optimize(debts, event.getCurrency());
}
private List<Debt> getDebts(Event event) {
List<Debt> debts = new LinkedList<Debt>();
List<Expense> expenses = expenseStore.getExpensesOfEvent(event.getId());
for (Expense expense : expenses) {
Participant toParticipant = participantStore.getById(expense.getPayerId());
List<Participant> fromParticipants = attendeeStore.getAttendingParticipants(expense.getId());
int amount = expense.getAmount() / fromParticipants.size();
for (Participant fromParticipant : fromParticipants) {
User fromUser = userStore.getById(fromParticipant.getUserId());
User toUser = userStore.getById(toParticipant.getUserId());
if (fromUser.equals(toUser)) continue;
debts.add(new Debt(fromUser, toUser, amount, event.getCurrency()));
}
}
return debts;
}
}
| Gchorba/NickleAndDimed | app/src/main/java/gk/nickles/ndimes/services/DebtCalculator.java | Java | mit | 2,002 |
import React from 'react';
import { storiesOf } from '@storybook/react';
import { linkTo, hrefTo } from '@storybook/addon-links';
import LinkTo from '@storybook/addon-links/react';
import { action } from '@storybook/addon-actions';
storiesOf('Addons|Links.Link', module)
.add('First', () => <LinkTo story="Second">Go to Second</LinkTo>)
.add('Second', () => <LinkTo story="First">Go to First</LinkTo>);
storiesOf('Addons|Links.Button', module)
.add('First', () => (
<button onClick={linkTo('Addons|Links.Button', 'Second')}>Go to "Second"</button>
))
.add('Second', () => (
<button onClick={linkTo('Addons|Links.Button', 'First')}>Go to "First"</button>
));
storiesOf('Addons|Links.Select', module)
.add('Index', () => (
<select value="Index" onChange={linkTo('Addons|Links.Select', e => e.currentTarget.value)}>
<option>Index</option>
<option>First</option>
<option>Second</option>
<option>Third</option>
</select>
))
.add('First', () => <LinkTo story="Index">Go back</LinkTo>)
.add('Second', () => <LinkTo story="Index">Go back</LinkTo>)
.add('Third', () => <LinkTo story="Index">Go back</LinkTo>);
storiesOf('Addons|Links.Href', module).add('log', () => {
hrefTo('Addons|Links.Href', 'log').then(href => action('URL of this story')({ href }));
return <span>See action logger</span>;
});
storiesOf('Addons|Links.Scroll position', module)
.addDecorator(story => (
<React.Fragment>
<div style={{ marginBottom: '100vh' }}>Scroll down to see the link</div>
{story()}
</React.Fragment>
))
.add('First', () => <LinkTo story="Second">Go to Second</LinkTo>)
.add('Second', () => <LinkTo story="First">Go to First</LinkTo>);
| rhalff/storybook | examples/official-storybook/stories/addon-links.stories.js | JavaScript | mit | 1,718 |
module DisableAssetsLogger
class Middleware
def initialize(app)
@app = app
Rails.application.assets.logger = Logger.new('/dev/null')
end
def call(env)
original_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
@app.call(env)
ensure
Rails.logger.level = original_level
end
end
end
| ndbroadbent/disable_assets_logger | lib/disable_assets_logger/middleware.rb | Ruby | mit | 396 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="tr" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Litecoin</source>
<translation>Licoin hakkında</translation>
</message>
<message>
<location line="+39"/>
<source><b>Litecoin</b> version</source>
<translation><b>Licoin</b> sürüm</translation>
</message>
<message>
<location line="+57"/>
<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>
Bu yazılım deneme safhasındadır.
MIT/X11 yazılım lisansı kapsamında yayınlanmıştır, COPYING dosyasına ya da http://www.opensource.org/licenses/mit-license.php sayfasına bakınız.
Bu ürün OpenSSL projesi tarafından OpenSSL araç takımı (http://www.openssl.org/) için geliştirilen yazılımlar, Eric Young (eay@cryptsoft.com) tarafından hazırlanmış şifreleme yazılımları ve Thomas Bernard tarafından programlanmış UPnP yazılımı içerir.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Telif hakkı</translation>
</message>
<message>
<location line="+0"/>
<source>The Litecoin developers</source>
<translation>Licoin geliştiricileri</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adres defteri</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Adresi ya da etiketi düzenlemek için çift tıklayınız</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Yeni bir adres oluştur</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Şu anda seçili olan adresi panoya kopyala</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Yeni adres</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Litecoin 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>Bunlar, ödeme almak için Licoin adresleridir. Kimin ödeme yaptığını izleyebilmek için her ödeme yollaması gereken kişiye değişik bir adres verebilirsiniz.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>Adresi &kopyala</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>&QR kodunu göster</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Litecoin address</source>
<translation>Bir Licoin adresinin sizin olduğunu ispatlamak için mesaj imzalayın</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>&Mesaj imzala</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Seçili adresi listeden sil</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Güncel sekmedeki verileri bir dosyaya aktar</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation>&Dışa aktar</translation>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Litecoin address</source>
<translation>Belirtilen Licoin adresi ile imzalandığını doğrulamak için bir mesajı kontrol et</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>Mesaj &kontrol et</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Sil</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Litecoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>Bunlar ödeme yapmak için kullanacağınız Licoin adreslerinizdir. Licoin yollamadan önce meblağı ve alıcı adresini daima kontrol ediniz.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>&Etiketi kopyala</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Düzenle</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Bit&coin Gönder</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Adres defteri verilerini dışa aktar</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Virgülle ayrılmış değerler dosyası (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Dışa aktarımda hata oluştu</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>%1 dosyasına yazılamadı.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Etiket</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(boş etiket)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Parola diyaloğu</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Parolayı giriniz</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Yeni parola</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Yeni parolayı tekrarlayınız</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<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>Cüzdanınız için yeni parolayı giriniz.<br/>Lütfen <b>10 ya da daha fazla rastgele karakter</b> veya <b>sekiz ya da daha fazla kelime</b> içeren bir parola seçiniz.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Cüzdanı şifrele</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Bu işlem cüzdan kilidini açmak için cüzdan parolanızı gerektirir.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Cüzdan kilidini aç</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Bu işlem, cüzdan şifresini açmak için cüzdan parolasını gerektirir.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Cüzdan şifresini aç</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Parolayı değiştir</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Cüzdan için eski ve yeni parolaları giriniz.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Cüzdan şifrelenmesini teyit eder</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR LITECOINS</b>!</source>
<translation>Uyarı: Eğer cüzdanınızı şifrelerseniz ve parolanızı kaybederseniz, <b>TÜM BİTCOİNLERİNİZİ KAYBEDERSİNİZ</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Cüzdanınızı şifrelemek istediğinizden emin misiniz?</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>ÖNEMLİ: Önceden yapmış olduğunuz cüzdan dosyası yedeklemelerinin yeni oluşturulan şifrelenmiş cüzdan dosyası ile değiştirilmeleri gerekir. Güvenlik nedenleriyle yeni, şifrelenmiş cüzdanı kullanmaya başladığınızda eski şifrelenmemiş cüzdan dosyaları işe yaramaz hale gelecektir.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Uyarı: Caps Lock tuşu faal durumda!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Cüzdan şifrelendi</translation>
</message>
<message>
<location line="-56"/>
<source>Litecoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your litecoins from being stolen by malware infecting your computer.</source>
<translation>Şifreleme işlemini tamamlamak için Licoin şimdi kapanacaktır. Cüzdanınızı şifrelemenin, Licoinlerinizin bilgisayara bulaşan kötücül bir yazılım tarafından çalınmaya karşı tamamen koruyamayacağını unutmayınız.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Cüzdan şifrelemesi başarısız oldu</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Dahili bir hata sebebiyle cüzdan şifrelemesi başarısız oldu. Cüzdanınız şifrelenmedi.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Girilen parolalar birbirleriyle uyumlu değil.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Cüzdan kilidinin açılması başarısız oldu</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Cüzdan şifresinin açılması için girilen parola yanlıştı.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Cüzdan şifresinin açılması başarısız oldu</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Cüzdan parolası başarılı bir şekilde değiştirildi.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>&Mesaj imzala...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Şebeke ile senkronizasyon...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Genel bakış</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Cüzdana genel bakışı göster</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Muameleler</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Muamele tarihçesini tara</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Saklanan adres ve etiket listesini düzenle</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Ödeme alma adreslerinin listesini göster</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Çık</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Uygulamadan çık</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Litecoin</source>
<translation>Licoin hakkında bilgi göster</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>&Qt hakkında</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Qt hakkında bilgi görüntü</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Seçenekler...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>Cüzdanı &şifrele...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>Cüzdanı &yedekle...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>Parolayı &değiştir...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Bloklar diskten içe aktarılıyor...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Diskteki bloklar yeniden endeksleniyor...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Litecoin address</source>
<translation>Bir Licoin adresine Licoin yolla</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Litecoin</source>
<translation>Licoin seçeneklerinin yapılandırmasını değiştir</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Cüzdanı diğer bir konumda yedekle</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Cüzdan şifrelemesi için kullanılan parolayı değiştir</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Hata ayıklama penceresi</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Hata ayıklama ve teşhis penceresini aç</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>Mesaj &kontrol et...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Litecoin</source>
<translation>Licoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Cüzdan</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>&Gönder</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>&Al</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>&Adresler</translation>
</message>
<message>
<location line="+22"/>
<source>&About Litecoin</source>
<translation>Licoin &Hakkında</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Göster / Sakla</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Ana pencereyi görüntüle ya da sakla</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Cüzdanınızın özel anahtarlarını şifrele</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Litecoin addresses to prove you own them</source>
<translation>Mesajları adreslerin size ait olduğunu ispatlamak için Licoin adresleri ile imzala</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Litecoin addresses</source>
<translation>Belirtilen Licoin adresleri ile imzalandıklarından emin olmak için mesajları kontrol et</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Dosya</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Ayarlar</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Yardım</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Sekme araç çubuğu</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Litecoin client</source>
<translation>Licoin istemcisi</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Litecoin network</source>
<translation><numerusform>Licoin şebekesine %n faal bağlantı</numerusform><numerusform>Licoin şebekesine %n faal bağlantı</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation>Hiçbir blok kaynağı mevcut değil...</translation>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation>Muamele tarihçesinin toplam (tahmini) %2 blokundan %1 blok işlendi.</translation>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>Muamele tarihçesinde %1 blok işlendi.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n saat</numerusform><numerusform>%n saat</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n gün</numerusform><numerusform>%n gün</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n hafta</numerusform><numerusform>%n hafta</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation>%1 geride</translation>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>Son alınan blok %1 evvel oluşturulmuştu.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation>Bundan sonraki muameleler henüz görüntülenemez.</translation>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Hata</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Uyarı</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Bilgi</translation>
</message>
<message>
<location line="+70"/>
<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>Bu muamele boyut sınırlarını aşmıştır. Gene de %1 ücret ödeyerek gönderebilirsiniz, ki bu ücret muamelenizi işleyen ve şebekeye yardım eden düğümlere ödenecektir. Ücreti ödemek istiyor musunuz?</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Güncel</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Aralık kapatılıyor...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Muamele ücretini teyit et</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Muamele yollandı</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Gelen muamele</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Tarih: %1
Miktar: %2
Tür: %3
Adres: %4
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI yönetimi</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Litecoin address or malformed URI parameters.</source>
<translation>URI okunamadı! Sebebi geçersiz bir Licoin adresi veya hatalı URI parametreleri olabilir.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Cüzdan <b>şifrelenmiştir</b> ve şu anda <b>kilidi açıktır</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Cüzdan <b>şifrelenmiştir</b> ve şu anda <b>kilitlidir</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Litecoin can no longer continue safely and will quit.</source>
<translation>Ciddi bir hata oluştu. Licoin artık güvenli bir şekilde işlemeye devam edemez ve kapanacaktır.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Şebeke hakkında uyarı</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Adresi düzenle</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etiket</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Bu adres defteri unsuru ile ilişkili etiket</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adres</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>Bu adres defteri unsuru ile ilişkili adres. Bu, sadece gönderi adresi için değiştirilebilir.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Yeni alım adresi</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Yeni gönderi adresi</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Alım adresini düzenle</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Gönderi adresini düzenle</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Girilen "%1" adresi hâlihazırda adres defterinde mevcuttur.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Litecoin address.</source>
<translation>Girilen "%1" adresi geçerli bir Licoin adresi değildir.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Cüzdan kilidi açılamadı.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Yeni anahtar oluşturulması başarısız oldu.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Litecoin-Qt</source>
<translation>Licoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>sürüm</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Kullanım:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>komut satırı seçenekleri</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Kullanıcı arayüzü seçenekleri</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Lisan belirt, mesela "de_De" (varsayılan: sistem dili)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Küçültülmüş olarak başlat</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Başlatıldığında başlangıç ekranını göster (varsayılan: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Seçenekler</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Esas ayarlar</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.</source>
<translation>Muamelelerin hızlı işlenmesini garantilemeye yardım eden, seçime dayalı kB başı muamele ücreti. Muamelelerin çoğunluğunun boyutu 1 kB'dir.</translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Muamele ücreti &öde</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Litecoin after logging in to the system.</source>
<translation>Sistemde oturum açıldığında Licoin'i otomatik olarak başlat.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Litecoin on system login</source>
<translation>Licoin'i sistem oturumuyla &başlat</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>İstemcinin tüm seçeneklerini varsayılan değerlere geri al.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>Seçenekleri &sıfırla</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Şebeke</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Litecoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Yönlendiricide Licoin istemci portlarını otomatik olarak açar. Bu, sadece yönlendiricinizin UPnP desteği bulunuyorsa ve etkinse çalışabilir.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Portları &UPnP kullanarak haritala</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Litecoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Licoin şebekesine SOCKS vekil sunucusu vasıtasıyla bağlan (mesela Tor ile bağlanıldığında).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>SOCKS vekil sunucusu vasıtasıyla ba&ğlan:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Vekil &İP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Vekil sunucunun İP adresi (mesela 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Port:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Vekil sunucunun portu (mesela 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &sürümü:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Vekil sunucunun SOCKS sürümü (mesela 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Pencere</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Küçültüldükten sonra sadece çekmece ikonu göster.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>İşlem çubuğu yerine sistem çekmecesine &küçült</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>Pencere kapatıldığında uygulamadan çıkmak yerine uygulamayı küçültür. Bu seçenek etkinleştirildiğinde, uygulama sadece menüden çıkış seçildiğinde kapanacaktır.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>Kapatma sırasında k&üçült</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Görünüm</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Kullanıcı arayüzü &lisanı:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Litecoin.</source>
<translation>Kullanıcı arayüzünün dili burada belirtilebilir. Bu ayar Licoin tekrar başlatıldığında etkinleşecektir.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>Miktarı göstermek için &birim:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Licoin gönderildiğinde arayüzde gösterilecek varsayılan alt birimi seçiniz.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Litecoin addresses in the transaction list or not.</source>
<translation>Muamele listesinde Licoin adreslerinin gösterilip gösterilmeyeceklerini belirler.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>Muamele listesinde adresleri &göster</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&Tamam</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&İptal</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Uygula</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>varsayılan</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>Seçeneklerin sıfırlanmasını teyit et</translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>Bazı ayarların dikkate alınması istemcinin tekrar başlatılmasını gerektirebilir.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>Devam etmek istiyor musunuz?</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Uyarı</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Litecoin.</source>
<translation>Bu ayarlar Licoin tekrar başlatıldığında etkinleşecektir.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Girilen vekil sunucu adresi geçersizdir.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Form</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Litecoin network after a connection is established, but this process has not completed yet.</source>
<translation>Görüntülenen veriler zaman aşımına uğramış olabilir. Bağlantı kurulduğunda cüzdanınız otomatik olarak şebeke ile eşleşir ancak bu işlem henüz tamamlanmamıştır.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Bakiye:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Doğrulanmamış:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Cüzdan</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Olgunlaşmamış:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Oluşturulan bakiye henüz olgunlaşmamıştır</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Son muameleler</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Güncel bakiyeniz</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Doğrulanması beklenen ve henüz güncel bakiyeye ilâve edilmemiş muamelelerin toplamı</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>eşleşme dışı</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start litecoin: click-to-pay handler</source>
<translation>Licoin başlatılamadı: tıkla-ve-öde yöneticisi</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR kodu diyaloğu</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Ödeme talebi</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Miktar:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Etiket:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Mesaj:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Farklı kaydet...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>URI'nin QR koduna kodlanmasında hata oluştu.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Girilen miktar geçersizdir, kontrol ediniz.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Sonuç URI çok uzun, etiket ya da mesaj metnini kısaltmayı deneyiniz.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>QR kodu kaydet</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG resimleri (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>İstemci ismi</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="+339"/>
<source>N/A</source>
<translation>Mevcut değil</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>İstemci sürümü</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Malumat</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Kullanılan OpenSSL sürümü</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Başlama zamanı</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Şebeke</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Bağlantı sayısı</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Testnet üzerinde</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blok zinciri</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Güncel blok sayısı</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Tahmini toplam blok sayısı</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Son blok zamanı</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Aç</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Komut satırı seçenekleri</translation>
</message>
<message>
<location line="+7"/>
<source>Show the Litecoin-Qt help message to get a list with possible Litecoin command-line options.</source>
<translation>Mevcut Licoin komut satırı seçeneklerinin listesini içeren Licoin-Qt yardımını göster.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Göster</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsol</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Derleme tarihi</translation>
</message>
<message>
<location line="-104"/>
<source>Litecoin - Debug window</source>
<translation>Licoin - Hata ayıklama penceresi</translation>
</message>
<message>
<location line="+25"/>
<source>Litecoin Core</source>
<translation>Licoin Çekirdeği</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Hata ayıklama kütük dosyası</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Litecoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Güncel veri klasöründen Licoin hata ayıklama kütük dosyasını açar. Büyük kütük dosyaları için bu birkaç saniye alabilir.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Konsolu temizle</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Litecoin RPC console.</source>
<translation>Licoin RPC konsoluna hoş geldiniz.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Tarihçede gezinmek için imleç tuşlarını kullanınız, <b>Ctrl-L</b> ile de ekranı temizleyebilirsiniz.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Mevcut komutların listesi için <b>help</b> yazınız.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Licoin yolla</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Birçok alıcıya aynı anda gönder</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&Alıcı ekle</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Bütün muamele alanlarını kaldır</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Tümünü &temizle</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Bakiye:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Yollama etkinliğini teyit ediniz</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>G&önder</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> şu adrese: %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Gönderiyi teyit ediniz</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>%1 göndermek istediğinizden emin misiniz?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> ve </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Alıcı adresi geçerli değildir, lütfen denetleyiniz.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Ödeyeceğiniz tutarın sıfırdan yüksek olması gerekir.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Tutar bakiyenizden yüksektir.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Toplam, %1 muamele ücreti ilâve edildiğinde bakiyenizi geçmektedir.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Çift adres bulundu, belli bir gönderi sırasında her adrese sadece tek bir gönderide bulunulabilir.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Hata: Muamele oluşturması başarısız oldu!</translation>
</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>Hata: Muamele reddedildi. Cüzdanınızdaki madenî paraların bazıları zaten harcanmış olduğunda bu meydana gelebilir. Örneğin wallet.dat dosyasının bir kopyasını kullandıysanız ve kopyada para harcandığında ancak burada harcandığı işaretlenmediğinde.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Form</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>M&iktar:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>&Şu kişiye öde:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Ödemenin gönderileceği adres (mesela Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Adres defterinize eklemek için bu adrese ilişik bir etiket giriniz</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Etiket:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Adres defterinden adres seç</translation>
</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>Panodan adres yapıştır</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>Bu alıcıyı kaldır</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Licoin adresi giriniz (mesela Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>İmzalar - Mesaj İmzala / Kontrol et</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>Mesaj &imzala</translation>
</message>
<message>
<location line="+6"/>
<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>Bir adresin sizin olduğunu ispatlamak için adresinizle mesaj imzalayabilirsiniz. Oltalama saldırılarının kimliğinizi imzanızla elde etmeyi deneyebilecekleri için belirsiz hiçbir şey imzalamamaya dikkat ediniz. Sadece ayrıntılı açıklaması olan ve tümüne katıldığınız ifadeleri imzalayınız.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Mesajın imzalanmasında kullanılacak adres (mesela Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Adres defterinden bir adres seç</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Panodan adres yapıştır</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>İmzalamak istediğiniz mesajı burada giriniz</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>İmza</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Güncel imzayı sistem panosuna kopyala</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Litecoin address</source>
<translation>Bu Licoin adresinin sizin olduğunu ispatlamak için mesajı imzalayın</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>&Mesajı imzala</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Tüm mesaj alanlarını sıfırla</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Tümünü &temizle</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>Mesaj &kontrol et</translation>
</message>
<message>
<location line="+6"/>
<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>İmza için kullanılan adresi, mesajı (satır sonları, boşluklar, sekmeler vs. karakterleri tam olarak kopyaladığınızdan emin olunuz) ve imzayı aşağıda giriniz. Bir ortadaki adam saldırısı tarafından kandırılmaya mâni olmak için imzadan, imzalı mesajın içeriğini aşan bir anlam çıkarmamaya dikkat ediniz.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Mesajı imzalamak için kullanılmış olan adres (mesela Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Litecoin address</source>
<translation>Belirtilen Licoin adresi ile imzalandığını doğrulamak için mesajı kontrol et</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>&Mesaj kontrol et</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Tüm mesaj kontrolü alanlarını sıfırla</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Licoin adresi giriniz (mesela Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>İmzayı oluşturmak için "Mesaj İmzala" unsurunu tıklayın</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Litecoin signature</source>
<translation>Licoin imzası gir</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Girilen adres geçersizdir.</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>Adresi kontrol edip tekrar deneyiniz.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Girilen adres herhangi bir anahtara işaret etmemektedir.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Cüzdan kilidinin açılması iptal edildi.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Girilen adres için özel anahtar mevcut değildir.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Mesajın imzalanması başarısız oldu.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Mesaj imzalandı.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>İmzanın kodu çözülemedi.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>İmzayı kontrol edip tekrar deneyiniz.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>İmza mesajın hash değeri ile eşleşmedi.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Mesaj doğrulaması başarısız oldu.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Mesaj doğrulandı.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Litecoin developers</source>
<translation>Licoin geliştiricileri</translation>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>%1 değerine dek açık</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/çevrim dışı</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/doğrulanmadı</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 teyit</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Durum</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, %n düğüm vasıtasıyla yayınlandı</numerusform><numerusform>, %n düğüm vasıtasıyla yayınlandı</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Tarih</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Kaynak</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Oluşturuldu</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Gönderen</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Alıcı</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>kendi adresiniz</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>etiket</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Gider</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>%n ek blok sonrasında olgunlaşacak</numerusform><numerusform>%n ek blok sonrasında olgunlaşacak</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>kabul edilmedi</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Gelir</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Muamele ücreti</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Net miktar</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Mesaj</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Yorum</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Muamele tanımlayıcı</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 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>Oluşturulan Licoin'lerin harcanabilmelerinden önce 120 blok beklemeleri gerekmektedir. Bu blok, oluşturduğunuzda blok zincirine eklenmesi için ağda yayınlandı. Zincire eklenmesi başarısız olursa, durumu "kabul edilmedi" olarak değiştirilecek ve harcanamayacaktır. Bu, bazen başka bir düğüm sizden birkaç saniye önce ya da sonra blok oluşturursa meydana gelebilir.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Hata ayıklama verileri</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Muamele</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>Girdiler</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Miktar</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>doğru</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>yanlış</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, henüz başarılı bir şekilde yayınlanmadı</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>%n ilâve blok için açık</numerusform><numerusform>%n ilâve blok için açık</numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>bilinmiyor</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Muamele detayları</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Bu pano muamelenin ayrıntılı açıklamasını gösterir</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Tarih</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tür</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Miktar</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>%n ilâve blok için açık</numerusform><numerusform>%n ilâve blok için açık</numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>%1 değerine dek açık</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Çevrimdışı (%1 teyit)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Doğrulanmadı (%1 (toplam %2 üzerinden) teyit)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Doğrulandı (%1 teyit)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>Madenden çıkarılan bakiye %n ek blok sonrasında olgunlaştığında kullanılabilecektir</numerusform><numerusform>Madenden çıkarılan bakiye %n ek blok sonrasında olgunlaştığında kullanılabilecektir</numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Bu blok başka hiçbir düğüm tarafından alınmamıştır ve muhtemelen kabul edilmeyecektir!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Oluşturuldu ama kabul edilmedi</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Şununla alındı</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Alındığı kişi</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Gönderildiği adres</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Kendinize ödeme</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Madenden çıkarılan</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(mevcut değil)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Muamele durumu. Doğrulama sayısını görüntülemek için imleci bu alanda tutunuz.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Muamelenin alındığı tarih ve zaman.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Muamele türü.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Muamelenin alıcı adresi.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Bakiyeden alınan ya da bakiyeye eklenen miktar.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Hepsi</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Bugün</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Bu hafta</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Bu ay</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Geçen ay</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Bu sene</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Aralık...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Şununla alınan</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Gönderildiği adres</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Kendinize</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Oluşturulan</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Diğer</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Aranacak adres ya da etiket giriniz</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Asgari miktar</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Adresi kopyala</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Etiketi kopyala</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Miktarı kopyala</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Muamele kimliğini kopyala</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Etiketi düzenle</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Muamele detaylarını göster</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Muamele verilerini dışa aktar</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Virgülle ayrılmış değerler dosyası (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Doğrulandı</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Tarih</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tür</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etiket</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Miktar</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>Tanımlayıcı</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Dışa aktarımda hata oluştu</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>%1 dosyasına yazılamadı.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Aralık:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>ilâ</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Licoin yolla</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation>&Dışa aktar</translation>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Güncel sekmedeki verileri bir dosyaya aktar</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Cüzdanı yedekle</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Cüzdan verileri (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Yedekleme başarısız oldu</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Cüzdanı değişik bir konuma kaydetmek denenirken bir hata meydana geldi.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Yedekleme başarılı</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Cüzdan verileri başarılı bir şekilde yeni konuma kaydedildi.</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Litecoin version</source>
<translation>Licoin sürümü</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Kullanım:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or litecoind</source>
<translation>-server ya da Licoind'ye komut gönder</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Komutları listele</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Bir komut için yardım al</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Seçenekler:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: litecoin.conf)</source>
<translation>Yapılandırma dosyası belirt (varsayılan: Licoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: litecoind.pid)</source>
<translation>Pid dosyası belirt (varsayılan: Licoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Veri dizinini belirt</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Veritabanı önbellek boyutunu megabayt olarak belirt (varsayılan: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation>Bağlantılar için dinlenecek <port> (varsayılan: 9333 ya da testnet: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Eşler ile en çok <n> adet bağlantı kur (varsayılan: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Eş adresleri elde etmek için bir düğüme bağlan ve ardından bağlantıyı kes</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Kendi genel adresinizi tanımlayın</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Aksaklık gösteren eşlerle bağlantıyı kesme sınırı (varsayılan: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Aksaklık gösteren eşlerle yeni bağlantıları engelleme süresi, saniye olarak (varsayılan: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>IPv4 üzerinde dinlemek için %u numaralı RPC portunun kurulumu sırasında hata meydana geldi: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation>JSON-RPC bağlantılarını <port> üzerinde dinle (varsayılan: 9332 veya tesnet: 19332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Konut satırı ve JSON-RPC komutlarını kabul et</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Arka planda daemon (servis) olarak çalış ve komutları kabul et</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Deneme şebekesini kullan</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Dışarıdan gelen bağlantıları kabul et (varsayılan: -proxy veya -connect yoksa 1)</translation>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=litecoinrpc
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 "Litecoin Alert" admin@foo.com
</source>
<translation>%s, şu yapılandırma dosyasında rpc parolası belirtmeniz gerekir:
%s
Aşağıdaki rastgele oluşturulan parolayı kullanmanız tavsiye edilir:
rpcuser=litecoinrpc
rpcpassword=%s
(bu parolayı hatırlamanız gerekli değildir)
Kullanıcı ismi ile parolanın FARKLI olmaları gerekir.
Dosya mevcut değilse, sadece sahibi için okumayla sınırlı izin ile oluşturunuz.
Sorunlar hakkında bildiri almak için alertnotify unsurunu ayarlamanız tavsiye edilir;
mesela: alertnotify=echo %%s | mail -s "Litecoin Alert" admin@foo.com
</translation>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>IPv6 üzerinde dinlemek için %u numaralı RPC portu kurulurken bir hata meydana geldi, IPv4'e dönülüyor: %s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation>Belirtilen adrese bağlan ve daima ondan dinle. IPv6 için [makine]:port yazımını kullanınız</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Litecoin is probably already running.</source>
<translation>%s veri dizininde kilit elde edilemedi. Licoin muhtemelen hâlihazırda çalışmaktadır.</translation>
</message>
<message>
<location line="+3"/>
<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>Hata: Muamele reddedildi! Cüzdanınızdaki madenî paraların bazıları zaten harcanmış olduğunda bu meydana gelebilir. Örneğin wallet.dat dosyasının bir kopyasını kullandıysanız ve kopyada para harcandığında ancak burada harcandığı işaretlenmediğinde.</translation>
</message>
<message>
<location line="+4"/>
<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>Hata: Muamelenin miktarı, karmaşıklığı ya da yakın geçmişte alınan fonların kullanılması nedeniyle bu muamele en az %s tutarında ücret gerektirmektedir!</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>İlgili bir uyarı alındığında komut çalıştır (komuttaki %s mesaj ile değiştirilecektir)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Bir cüzdan muamelesi değiştiğinde komutu çalıştır (komuttaki %s TxID ile değiştirilecektir)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Yüksek öncelikli/düşük ücretli muamelelerin boyutunu bayt olarak tanımla (varsayılan: 27000)</translation>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation>Bu yayın öncesi bir deneme sürümüdür - tüm riski siz üstlenmiş olursunuz - Licoin oluşturmak ya da ticari uygulamalar için kullanmayınız</translation>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Uyarı: -paytxfee çok yüksek bir değere ayarlanmış! Bu, muamele gönderirseniz ödeyeceğiniz muamele ücretidir.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation>Uyarı: Görüntülenen muameleler doğru olmayabilir! Sizin ya da diğer düğümlerin güncelleme yapması gerekebilir.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Litecoin will not work properly.</source>
<translation>Uyarı: Lütfen bilgisayarınızın tarih ve saatinin doğru olup olmadığını kontrol ediniz! Saatiniz doğru değilse Licoin gerektiği gibi çalışamaz.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Uyarı: wallet.dat dosyasının okunması sırasında bir hata meydana geldi! Tüm anahtarlar doğru bir şekilde okundu, ancak muamele verileri ya da adres defteri unsurları hatalı veya eksik olabilir.</translation>
</message>
<message>
<location line="+3"/>
<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>Uyarı: wallet.dat bozuk, veriler geri kazanıldı! Özgün wallet.dat, wallet.{zamandamgası}.bak olarak %s klasörüne kaydedildi; bakiyeniz ya da muameleleriniz yanlışsa bir yedeklemeden tekrar yüklemeniz gerekir.</translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Bozuk bir wallet.dat dosyasından özel anahtarları geri kazanmayı dene</translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Blok oluşturma seçenekleri:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Sadece belirtilen düğüme veya düğümlere bağlan</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>Bozuk blok veritabanı tespit edildi</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Kendi IP adresini keşfet (varsayılan: dinlenildiğinde ve -externalip yoksa 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>Blok veritabanını şimdi yeniden inşa etmek istiyor musunuz?</translation>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>Blok veritabanını başlatılırken bir hata meydana geldi</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation>%s cüzdan veritabanı ortamının başlatılmasında hata meydana geldi!</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>Blok veritabanının yüklenmesinde hata</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>Blok veritabanının açılışı sırasında hata</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Hata: Disk alanı düşük!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>Hata: Cüzdan kilitli, muamele oluşturulamadı!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Hata: sistem hatası:</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Herhangi bir portun dinlenmesi başarısız oldu. Bunu istiyorsanız -listen=0 seçeneğini kullanınız.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>Blok verileri okunamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation>Blok okunamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation>Blok indeksi eşleştirilemedi</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation>Blok indeksi yazılamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation>Blok verileri yazılamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>Blok yazılamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation>Dosya verileri yazılamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation>Madenî para veritabanına yazılamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation>Muamele indeksi yazılamadı</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation>Geri alma verilerinin yazılamadı</translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>Eşleri DNS araması vasıtasıyla bul (varsayılan: 1, eğer -connect kullanılmadıysa)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation>Licoin oluştur (varsayılan: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>Başlangıçta kontrol edilecek blok sayısı (varsayılan: 288, 0 = hepsi)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation>Blok kontrolünün ne kadar derin olacağı (0 ilâ 4, varsayılan: 3)</translation>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation>Kafi derecede dosya tanımlayıcıları mevcut değil.</translation>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation>Blok zinciri indeksini güncel blk000??.dat dosyalarından tekrar inşa et</translation>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>RPC aramaları için iş parçacığı sayısını belirle (varsayılan: 4)</translation>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation>Bloklar kontrol ediliyor...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>Cüzdan kontrol ediliyor...</translation>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Harici blk000??.dat dosyasından blokları içe aktarır</translation>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation>Betik kontrolü iş parçacığı sayısını belirt (azami 16, 0 = otomatik, <0 = bu sayıda çekirdeği boş bırak, varsayılan: 0)</translation>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Bilgi</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Geçersiz -tor adresi: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation>-minrelaytxfee=<amount> için geçersiz meblağ: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation>-mintxfee=<amount> için geçersiz meblağ: '%s'</translation>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation>Muamelelerin tamamının indeksini tut (varsayılan: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Bağlantı başına azami alım tamponu, <n>*1000 bayt (varsayılan: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Bağlantı başına azami yollama tamponu, <n>*1000 bayt (varsayılan: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation>Sadece yerleşik kontrol noktalarıyla eşleşen blok zincirini kabul et (varsayılan: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Sadece <net> şebekesindeki düğümlere bağlan (IPv4, IPv6 ya da Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>İlâve hata ayıklama verileri çıkart. Diğer tüm -debug* seçeneklerini ima eder</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>İlâve şebeke hata ayıklama verileri çıkart</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Hata ayıklama çıktısına tarih ön ekleri ilâve et</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Litecoin Wiki for SSL setup instructions)</source>
<translation> SSL seçenekleri: (SSL kurulum bilgisi için Licoin vikisine bakınız)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Kullanılacak socks vekil sunucu sürümünü seç (4-5, varsayılan: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Trace/hata ayıklama verilerini debug.log dosyası yerine konsola gönder</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Hata ayıklayıcıya -debugger- trace/hata ayıklama verileri gönder</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Bayt olarak azami blok boyutunu tanımla (varsayılan: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Bayt olarak asgari blok boyutunu tanımla (varsayılan: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>İstemci başlatıldığında debug.log dosyasını küçült (varsayılan: -debug bulunmadığında 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation>Muamelenin imzalanması başarısız oldu</translation>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Bağlantı zaman aşım süresini milisaniye olarak belirt (varsayılan: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Sistem hatası:</translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation>Muamele meblağı çok düşük</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation>Muamele tutarının pozitif olması lazımdır</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation>Muamele çok büyük</translation>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Dinlenecek portu haritalamak için UPnP kullan (varsayılan: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Dinlenecek portu haritalamak için UPnP kullan (varsayılan: dinlenildiğinde 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Gizli tor servislerine erişmek için vekil sunucu kullan (varsayılan: -proxy ile aynısı)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>JSON-RPC bağlantıları için kullanıcı ismi</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Uyarı</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Uyarı: Bu sürüm çok eskidir, güncellemeniz gerekir!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation>-txindex'i değiştirmek için veritabanlarını -reindex kullanarak yeniden inşa etmeniz gerekir.</translation>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat bozuk, geri kazanım başarısız oldu</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>JSON-RPC bağlantıları için parola</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Belirtilen İP adresinden JSON-RPC bağlantılarını kabul et</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Şu <ip> adresinde (varsayılan: 127.0.0.1) çalışan düğüme komut yolla</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>En iyi blok değiştiğinde komutu çalıştır (komut için %s parametresi blok hash değeri ile değiştirilecektir)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Cüzdanı en yeni biçime güncelle</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Anahtar alan boyutunu <n> değerine ayarla (varsayılan: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Blok zincirini eksik cüzdan muameleleri için tekrar tara</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>JSON-RPC bağlantıları için OpenSSL (https) kullan</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Sunucu sertifika dosyası (varsayılan: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Sunucu özel anahtarı (varsayılan: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Kabul edilebilir şifreler (varsayılan: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Bu yardım mesajı</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Bu bilgisayarda %s unsuruna bağlanılamadı. (bind şu hatayı iletti: %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Socks vekil sunucusu vasıtasıyla bağlan</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>-addnode, -seednode ve -connect için DNS aramalarına izin ver</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Adresler yükleniyor...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>wallet.dat dosyasının yüklenmesinde hata oluştu: bozuk cüzdan</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Litecoin</source>
<translation>wallet.dat dosyasının yüklenmesinde hata oluştu: cüzdanın daha yeni bir Licoin sürümüne ihtiyacı var</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Litecoin to complete</source>
<translation>Cüzdanın tekrar yazılması gerekiyordu: işlemi tamamlamak için Licoin'i yeniden başlatınız</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>wallet.dat dosyasının yüklenmesinde hata oluştu</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Geçersiz -proxy adresi: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>-onlynet için bilinmeyen bir şebeke belirtildi: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Bilinmeyen bir -socks vekil sürümü talep edildi: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>-bind adresi çözümlenemedi: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>-externalip adresi çözümlenemedi: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>-paytxfee=<miktar> için geçersiz miktar: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Geçersiz miktar</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Yetersiz bakiye</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Blok indeksi yükleniyor...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Bağlanılacak düğüm ekle ve bağlantıyı zinde tutmaya çalış</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Litecoin is probably already running.</source>
<translation>Bu bilgisayarda %s unsuruna bağlanılamadı. Licoin muhtemelen hâlihazırda çalışmaktadır.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Yolladığınız muameleler için eklenecek KB başı ücret</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Cüzdan yükleniyor...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Cüzdan eski biçime geri alınamaz</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Varsayılan adres yazılamadı</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Yeniden tarama...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Yükleme tamamlandı</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>%s seçeneğini kullanmak için</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Hata</translation>
</message>
<message>
<location line="-31"/>
<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>rpcpassword=<parola> şu yapılandırma dosyasında belirtilmelidir:
%s
Dosya mevcut değilse, sadece sahibi için okumayla sınırlı izin ile oluşturunuz.</translation>
</message>
</context>
</TS> | creath/goodcoin | src/qt/locale/bitcoin_tr.ts | TypeScript | mit | 119,085 |
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\DoctrineORMAdminBundle\Filter;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Form\Type\Filter\DefaultType;
use Sonata\Form\Type\EqualType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormTypeInterface;
class ClassFilter extends Filter
{
public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $data): void
{
if (!$data || !\is_array($data) || !\array_key_exists('value', $data)) {
return;
}
if (0 === \strlen($data['value'])) {
return;
}
$data['type'] = !isset($data['type']) ? EqualType::TYPE_IS_EQUAL : $data['type'];
$operator = $this->getOperator((int) $data['type']);
if (!$operator) {
$operator = 'INSTANCE OF';
}
$this->applyWhere($queryBuilder, sprintf('%s %s %s', $alias, $operator, $data['value']));
}
public function getDefaultOptions()
{
return [];
}
public function getFieldType()
{
return $this->getOption('field_type', ChoiceType::class);
}
public function getFieldOptions()
{
$choiceOptions = [
'required' => false,
'choices' => $this->getOption('sub_classes'),
];
if (method_exists(FormTypeInterface::class, 'setDefaultOptions')) {
$choiceOptions['choices_as_values'] = true;
}
return $this->getOption('choices', $choiceOptions);
}
public function getRenderSettings()
{
return [DefaultType::class, [
'operator_type' => EqualType::class,
'field_type' => $this->getFieldType(),
'field_options' => $this->getFieldOptions(),
'label' => $this->getLabel(),
]];
}
/**
* @param int $type
*
* @return mixed
*/
private function getOperator($type)
{
$choices = [
EqualType::TYPE_IS_EQUAL => 'INSTANCE OF',
EqualType::TYPE_IS_NOT_EQUAL => 'NOT INSTANCE OF',
];
return $choices[$type] ?? false;
}
}
| pulzarraider/SonataDoctrineORMAdminBundle | src/Filter/ClassFilter.php | PHP | mit | 2,415 |
'use strict';
var app = angular.module('Fablab');
app.controller('GlobalConfigurationEditController', function ($scope,$route, $location,
ConfigurationService, NotificationService) {
$scope.selected = {configuration: undefined};
$scope.loadConfiguration = function (id) {
ConfigurationService.get(id, function (data) {
$scope.configuration = data;
});
};
$scope.save = function () {
var configurationCurrent = angular.copy($scope.configuration);
ConfigurationService.save(configurationCurrent, function (data) {
$scope.configuration = data;
NotificationService.notify("success", "configuration.notification.saved");
$route.reload();
$location.path("configurations");
});
};
}
);
app.controller('ConfigurationEditController', function ($scope, $routeParams, $controller) {
$controller('GlobalConfigurationEditController', {$scope: $scope});
$scope.newConfiguration = false;
$scope.loadConfiguration($routeParams.id);
}
);
| fabienvuilleumier/fb | src/main/webapp/components/configuration/configuration-edit-ctrl.js | JavaScript | mit | 1,062 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='order',
name='paid',
field=models.BooleanField(default=False),
),
]
| spectrumone/online-shop-template | myshop/orders/migrations/0002_auto_20160213_1225.py | Python | mit | 390 |
using System;
using Conejo.Extensions;
using RabbitMQ.Client;
namespace Conejo
{
public class Connection : IDisposable
{
private readonly Lazy<IConnection> _connection;
public Connection(ConnectionConfiguration configuration)
{
_connection = new Lazy<IConnection>(() => CreateConnectionFactory(configuration).CreateConnection());
Configuration = configuration;
}
public static Connection Create()
{
return new Connection(new ConnectionConfiguration());
}
public static Connection Create(Action<ConnectionConfigurationDsl> config)
{
return new Connection(ConnectionConfiguration.Create(config));
}
public static Connection Create(ConnectionConfiguration channelConfiguration, Action<ConnectionConfigurationDsl> config)
{
config(new ConnectionConfigurationDsl(channelConfiguration));
return new Connection(channelConfiguration);
}
public ConnectionConfiguration Configuration { get; private set; }
public IModel CreateChannel()
{
return _connection.Value.CreateModel();
}
public void Close()
{
if (!_connection.IsValueCreated) return;
_connection.Value.Close();
_connection.Value.Dispose();
}
public void Dispose()
{
Close();
}
private static ConnectionFactory CreateConnectionFactory(ConnectionConfiguration configuration)
{
var connectionFactory = new ConnectionFactory();
if (configuration.Host.IsNotNullOrEmpty())
connectionFactory.HostName = configuration.Host;
if (configuration.Port.HasValue)
connectionFactory.Port = configuration.Port.Value;
if (configuration.VirtualHost.IsNotNullOrEmpty())
connectionFactory.VirtualHost = configuration.VirtualHost;
if (configuration.Username.IsNotNullOrEmpty())
connectionFactory.UserName = configuration.Username;
if (configuration.Password.IsNotNullOrEmpty())
connectionFactory.Password = configuration.Password;
if (configuration.Uri.IsNotNullOrEmpty())
connectionFactory.Uri = configuration.Uri;
return connectionFactory;
}
}
}
| mikeobrien/Conejo | src/Conejo/Connection.cs | C# | mit | 2,502 |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; desc = parent = getter = undefined; _again = false; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }
var _ResourceDecoratorJs = require("./ResourceDecorator.js");
var _ResourceDecoratorJs2 = _interopRequireDefault(_ResourceDecoratorJs);
var _endpointsLoadedDataEndpointJs = require("../endpoints/LoadedDataEndpoint.js");
var _endpointsLoadedDataEndpointJs2 = _interopRequireDefault(_endpointsLoadedDataEndpointJs);
var _transformersEmbeddedPropertyTransformerJs = require("../transformers/EmbeddedPropertyTransformer.js");
var _transformersEmbeddedPropertyTransformerJs2 = _interopRequireDefault(_transformersEmbeddedPropertyTransformerJs);
var _endpointsPromiseEndpointJs = require("../endpoints/PromiseEndpoint.js");
var _endpointsPromiseEndpointJs2 = _interopRequireDefault(_endpointsPromiseEndpointJs);
var _injectorJs = require("../injector.js");
var JsonPropertyDecorator = (function (_ResourceDecorator) {
function JsonPropertyDecorator(loadedDataEndpointFactory, embeddedPropertyTransformerFactory, promiseEndpointFactory, name, path, value, options) {
_classCallCheck(this, JsonPropertyDecorator);
_get(Object.getPrototypeOf(JsonPropertyDecorator.prototype), "constructor", this).call(this, name);
this.path = path;
this.options = options || {};
this.loadedDataEndpointFactory = loadedDataEndpointFactory;
this.embeddedPropertyTransformerFactory = embeddedPropertyTransformerFactory;
this.promiseEndpointFactory = promiseEndpointFactory;
this.value = value;
}
_inherits(JsonPropertyDecorator, _ResourceDecorator);
_createClass(JsonPropertyDecorator, [{
key: "recordApply",
value: function recordApply(target) {
target.constructor.properties[this.name] = this.path;
if (!target.hasOwnProperty(this.name)) {
var afterSet = this.options.afterSet;
var path = this.path;
Object.defineProperty(target, this.name, {
enumerable: true,
configurable: true,
get: function get() {
return this.pathGet(path);
},
set: function set(value) {
var result = this.pathSet(path, value);
if (afterSet) {
afterSet.call(this);
}
return result;
}
});
}
}
}, {
key: "resourceApply",
value: function resourceApply(resource) {
if (this.value !== undefined) {
resource.setInitialValue(this.path, this.value);
}
this.recordApply(resource);
}
}, {
key: "errorsApply",
value: function errorsApply(errors) {
this.recordApply(errors);
}
}, {
key: "endpointFn",
get: function () {
if (!this._endpointFn) {
var path = this.path;
var promiseEndpointFactory = this.promiseEndpointFactory;
var loadedDataEndpointFactory = this.loadedDataEndpointFactory;
var embeddedPropertyTransformerFactory = this.embeddedPropertyTransformerFactory;
this._endpointFn = function () {
var _this = this;
var uriParams = arguments[0] === undefined ? {} : arguments[0];
// 'this' in here = Endpoint
var newPromise = function newPromise() {
return _this.load().then(function (resource) {
return loadedDataEndpointFactory(resource.self(), resource, [embeddedPropertyTransformerFactory(path)]);
});
};
var newEndpoint = promiseEndpointFactory(newPromise);
return newEndpoint;
};
}
return this._endpointFn;
}
}, {
key: "endpointApply",
value: function endpointApply(target) {
this.addFunction(target, this.endpointFn);
}
}]);
return JsonPropertyDecorator;
})(_ResourceDecoratorJs2["default"]);
exports["default"] = JsonPropertyDecorator;
(0, _injectorJs.Inject)((0, _injectorJs.factory)(_endpointsLoadedDataEndpointJs2["default"]), (0, _injectorJs.factory)(_transformersEmbeddedPropertyTransformerJs2["default"]), (0, _injectorJs.factory)(_endpointsPromiseEndpointJs2["default"]))(JsonPropertyDecorator);
module.exports = exports["default"]; | XingFramework/Relayer | dist/cjs/relayer/decorators/JsonPropertyDecorator.js | JavaScript | mit | 5,971 |
/**
* 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.
*/
package com.microsoft.azure.management.network.v2019_11_01;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Allow to exclude some variable satisfy the condition for the WAF check.
*/
public class OwaspCrsExclusionEntry {
/**
* The variable to be excluded. Possible values include:
* 'RequestHeaderNames', 'RequestCookieNames', 'RequestArgNames'.
*/
@JsonProperty(value = "matchVariable", required = true)
private OwaspCrsExclusionEntryMatchVariable matchVariable;
/**
* When matchVariable is a collection, operate on the selector to specify
* which elements in the collection this exclusion applies to. Possible
* values include: 'Equals', 'Contains', 'StartsWith', 'EndsWith',
* 'EqualsAny'.
*/
@JsonProperty(value = "selectorMatchOperator", required = true)
private OwaspCrsExclusionEntrySelectorMatchOperator selectorMatchOperator;
/**
* When matchVariable is a collection, operator used to specify which
* elements in the collection this exclusion applies to.
*/
@JsonProperty(value = "selector", required = true)
private String selector;
/**
* Get the variable to be excluded. Possible values include: 'RequestHeaderNames', 'RequestCookieNames', 'RequestArgNames'.
*
* @return the matchVariable value
*/
public OwaspCrsExclusionEntryMatchVariable matchVariable() {
return this.matchVariable;
}
/**
* Set the variable to be excluded. Possible values include: 'RequestHeaderNames', 'RequestCookieNames', 'RequestArgNames'.
*
* @param matchVariable the matchVariable value to set
* @return the OwaspCrsExclusionEntry object itself.
*/
public OwaspCrsExclusionEntry withMatchVariable(OwaspCrsExclusionEntryMatchVariable matchVariable) {
this.matchVariable = matchVariable;
return this;
}
/**
* Get when matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. Possible values include: 'Equals', 'Contains', 'StartsWith', 'EndsWith', 'EqualsAny'.
*
* @return the selectorMatchOperator value
*/
public OwaspCrsExclusionEntrySelectorMatchOperator selectorMatchOperator() {
return this.selectorMatchOperator;
}
/**
* Set when matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. Possible values include: 'Equals', 'Contains', 'StartsWith', 'EndsWith', 'EqualsAny'.
*
* @param selectorMatchOperator the selectorMatchOperator value to set
* @return the OwaspCrsExclusionEntry object itself.
*/
public OwaspCrsExclusionEntry withSelectorMatchOperator(OwaspCrsExclusionEntrySelectorMatchOperator selectorMatchOperator) {
this.selectorMatchOperator = selectorMatchOperator;
return this;
}
/**
* Get when matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to.
*
* @return the selector value
*/
public String selector() {
return this.selector;
}
/**
* Set when matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to.
*
* @param selector the selector value to set
* @return the OwaspCrsExclusionEntry object itself.
*/
public OwaspCrsExclusionEntry withSelector(String selector) {
this.selector = selector;
return this;
}
}
| selvasingh/azure-sdk-for-java | sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/OwaspCrsExclusionEntry.java | Java | mit | 3,803 |
#include "ResourceData.h"
ResourceData::ResourceData()
{
}
ResourceData::~ResourceData()
{
}
| AshwinKumarVijay/ECS-Development | ECS/Project/Project/Resources/ResourceData/ResourceData.cpp | C++ | mit | 99 |
#include <iostream>
int main(int argc, char const *argv[])
{
int i = 5, i2 = 20;
int *ptr1 = &i, *ptr2 = &i;
ptr1 = &i2;
*ptr2 = 10;
std::cout << i << " " << i2 << std::endl;
std::cout << *ptr1 << " " << *ptr2 << std::endl;
return 0;
} | guojing0/cpp-primer | chapter2/ex2-18.cc | C++ | mit | 264 |
Dummy::Application.routes.draw do
root :to => 'echo#echo', :as => :echo
mount HttpLog::Engine => '/logs'
end
| ahawkins/http_log | test/dummy/config/routes.rb | Ruby | mit | 113 |
/* =================================================== */
var treeData = [
{
"name": "Top Level",
"parent": "null",
"children": [
{
"name": "Level 2: A",
"parent": "Top Level",
"children": [
{
"name": "Son of A",
"parent": "Level 2: A"
},
{
"name": "Daughter of A",
"parent": "Level 2: A"
}
]
},
{
"name": "Level 2: B",
"parent": "Top Level",
"children": [
{
"name": "Son of B",
"parent": "Level 2: B"
},
{
"name": "Daughter of B",
"parent": "Level 2: B"
}
]
}
]
}
];
/* =================================================== */
var boxHeight = 60;//
var boxWidth = 130;//
var fontSize = 10;
var lineSpace = 2;
var renderOut = "tree";
var treeOrientation = "vertical";//
var goZoo = true;
var el = "div#myTree";//
var margin = {top: -5, right: -5, bottom: -5, left: -5};//
var width = 500, height = 500;//
/* =================================================== */
/*
Creates a new tree layout with the default settings:
the default sort order is null;
the default children accessor assumes each input data is an object with a children array;
the default separation function uses one node width for siblings, and two node widths for non-siblings;
the default size is 1×1.
*/
var hierarchy = '';
if ( renderOut == "tree") {
hierarchy = d3.layout.tree();
} else {
hierarchy = d3.layout.cluster();
}
hierarchy.nodeSize([boxWidth*1.5, boxHeight*2]);
//hierarchy.size([height, width - 160]);
/** The default comparator is null, which disables sorting and uses tree traversal order.
* Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic
* function comparator(a, b) { return a.name < b.name ? -1 : a.name > b.name ? 1 : 0; }
*
* The current default separation function
* function separation(a, b) { return (a.parent == b.parent ? 1 : 2); }
*//* TREE.sort(comparator).separation(separation); */
var svg = d3.select(el).append("svg")
.attr("width", width)//+ margin.left + margin.right)
.attr("height", height)//+ margin.top + margin.bottom)
.append("g");
/*
svg.append("rect")
.attr("width", width)
.attr("height", height)
.style("fill", "grey")
.style("pointer-events", "all");
*/
var zoom = d3.behavior.zoom().scaleExtent([1, 10]).on("zoom", zoomed);
function zoomed() {
svg.append("g").attr("transform", "translate("+ d3.event.translate +") scale("+ d3.event.scale + ")");
}
if (treeOrientation == "vertical") {
svg.attr("transform", "translate("+ (0+margin.left)+","+(0+margin.right)+")"+" rotate(90) scale(1)")
.call(zoom);
} else {
svg.attr("transform", "translate(1500,50) rotate(0) scale(0.5)")
.call(zoom);
}
if ( renderOut == "tree" ) {
} else {}
var drag = d3.behavior.drag()
.origin(function(d) { return d; })
.on("dragstart", dragstarted)
.on("drag", dragged)
.on("dragend", dragended);
function dragstarted(d) {
d3.event.sourceEvent.stopPropagation();
d3.select(this).classed("dragging", true);
}
function dragged(d) {
d3.select(this).attr("x", d.x = d3.event.x).attr("y", d.y = d3.event.y);
}
function dragended(d) {
d3.select(this).classed("dragging", false);
}
d3.json("./flare.json", function(error, json) {
if (error) throw error;
/* https://github.com/mbostock/d3/wiki/Tree-Layout
Runs the tree layout, returning the array of nodes associated with the specified root node.
The tree layout is part of D3's family of hierarchical layouts.
*/
root = treeData[0];
var nodes = hierarchy.nodes(root), // nodes(json)
/* Given the specified array of nodes, such as those returned by nodes,
returns an array of objects representing the links from parent to child for each node.
*/ links = hierarchy.links(nodes);
/* https://www.dashingd3js.com/svg-paths-and-d3js */
var link = svg.selectAll("path.link").data(links).enter().append("path")
.attr("class", "link");
var diagonal = d3.svg.diagonal();
if ( renderOut == "tree") {
diagonal = function() {
var mprojection = function(d) { return [d.y, d.x]; };
var mpath = function(pathData) { return "M" + pathData[0] + ' ' + pathData[1] + " " + pathData[2]+ " " + pathData[3]; };
// link.attr("d", function(d) { return "M" + (d.source.y/2) + "," + (d.source.x) + "H" + (d.target.y/2)+ "V" + (d.target.x);});
function mdiagonal(diagonalPath, i) {
var source = diagonalPath.source,
target = diagonalPath.target,
turnPointY = target.y/2,
pathData = [source, {x: source.x, y: turnPointY}, {x: target.x, y: turnPointY}, target];
pathData = pathData.map(mprojection);
return mpath(pathData);
}
return mdiagonal;
};
} else {
// Straitgh curve!
diagonal.projection(function(d) { return [d.y, d.x]; });
}
link.attr("d", diagonal());
/* g is a container element
http://www.w3.org/TR/SVG/shapes.html#InterfaceSVGRectElement
*/
var node = svg.selectAll("g.node").data(nodes).enter().append("g");
node.attr("class", "node")
.attr("transform", function(d) { return "translate("+ d.y +","+ d.x +")"+ "rotate("+ -90 +")"; })
.on("mouseover", mouseover)
.on("mouseout", mouseout);
node.append("rect")
.attr('class', "recBox")
.attr("x", -boxWidth/2).attr("y", -boxHeight/2)
.attr("width", boxWidth).attr("height", boxHeight)
.attr("rx", 50);
node.append("text")
.attr("id", "nodetitle")
.attr("class", "nodeTitle")
.attr("y", -boxHeight/2 + fontSize + 2*lineSpace)
.attr("text-anchor", "middle")
.text( 'd.name' );
node.append("text")
.attr("id", "nodetext")
.attr("class", "nodeText")
.attr("y", -boxHeight/2 + 2*fontSize + 4*lineSpace)
.attr("text-anchor", "middle").text('Score: 00')
.call(drag);
//.style("fill", "none").style("stroke", "purple").style("stroke-width", "2.5px");
// mouseover event handler
function mouseover() {
d3.select(this).select("rect").transition().duration(750)
.attr("width", boxWidth*1.5).attr("height", boxHeight*1.5)
.style("opacity", 1)
.style("fill", "#c8e4f8").style("stroke", "orange").style("stroke-width", "5px");
d3.select(this).select("text#nodetitle").transition().duration(750)
.attr("y", -boxHeight/2 + fontSize + 2*lineSpace)
.style("font-weight", "bold")
.style("font-size", "18px");
// displayInfoBox(thisNode)
}
// mouseout event handler
function mouseout() {
d3.select(this).select("rect").transition(0.5).duration(750)
.attr("width", boxWidth).attr("height", boxHeight)
.style("opacity", 1)
.style("fill", "white").style("stroke", "purple").style("stroke-width", "2.5px");
d3.select(this).select("text#nodetitle").transition().duration(750)
.attr("y", -boxHeight/2 + fontSize + 2*lineSpace)
.style("font-weight", "normal")
.style("font-size", "12px");
}
/*
// Display up the info box (for mouse overs)
function displayInfoBox(node) {
var nodeName = node.attr("id")
var infoX = infoBoxWidth/2*0.6
var infoY = infoBoxHeight/2*1.05
var infoBox = svg.append("g")
infoBox
.attr("class", "popup")
.attr("transform", function(d) {return "translate(" + infoX + "," + infoY + ")";})
infoBox
.append("text")
.attr("y", -infoBoxHeight/2 + fontSize + 2*lineSpace)
.attr("text-anchor", "middle")
.text(nodeName)
.attr("font-size", fontSize + 8 + "px")
var imgOffsetX = -infoBoxWidth/2 * 0.95
var imgOffsetY = -infoBoxHeight/2 + fontSize+8 + 2*lineSpace
infoBox
.append("svg:image")
.attr("xlink:href", "sample_patches/"+nodeName+".png")
.attr("width", infoBoxWidth*0.99)
.attr("height", infoBoxHeight*0.99)
.attr("transform", function(d) {return "translate(" + imgOffsetX + "," + imgOffsetY + ")";})
}
*/
});
d3.select(self.frameElement).style("height", height + "px");
| readycyr/dashahp_caseStudy0 | www/cartesian.js | JavaScript | mit | 8,417 |
using Contracts;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terrain;
using Color = System.Drawing.Color;
namespace TestNoise
{
class Program
{
static void Main(string[] args)
{
//RenderTerrain();
//RenderDensityMap();
EvaluateTerrain();
//SaveNoise();
}
private static void SaveNoise()
{
const int maxHeight = 100;
const int maxDepth = 100;
const int seaLevel = 80;
var generator = new Generator(maxDepth, maxHeight, seaLevel, 0);
//var samples = IronOreLevels(generator);
var samples = SeabedTerrain();
//var samples = BedrockTerrain();
//var samples = SampleNoise(generator.DirtLevel);
var content = "x,y" + Environment.NewLine +
string.Join(Environment.NewLine, samples.Select(s => s.Item1 + "," + s.Item2));
File.WriteAllText("noise.csv", content);
}
private static void RenderTerrain()
{
const int maxHeight = 100;
const int maxDepth = 100;
const int seaLevel = 80;
var generator = new TerrainInverter(new Generator(maxDepth, maxHeight, seaLevel, 0));
const double scale = 10.0;
const int sizeX = 1600;
//const int sizeY = (int)(2 * maxHeight / scale);
const int sizeY = (int) (maxDepth + maxHeight);
var bitmap = new Bitmap(sizeX, sizeY);
for (var y = 0; y < sizeY; y++)
{
for (var x = 0; x < sizeX; x++)
{
var coord = new Coordinate((int)(x * scale), y - sizeY / 2);
//var py = y; // * scale;
var c = Color.Black;
var block = generator[coord, new Plane(0)];
switch (block.Type)
{
case TerrainType.Bedrock:
c = Color.Gray;
break;
case TerrainType.Rock:
c = Color.DarkGray;
//var red = Math.Max(0, Math.Min(255, (int)(block.OreDensity * 255)));
//c = Color.FromArgb(red, 0, 0);
break;
case TerrainType.Dirt:
c = Color.SandyBrown;
break;
case TerrainType.Sea:
c = Color.Aqua;
break;
}
bitmap.SetPixel(x, y, c);
}
}
bitmap.Save("map.bmp");
}
private static void RenderDensityMap()
{
const int maxHeight = 100;
const int maxDepth = 100;
const int seaLevel = 80;
var generator = new Generator(maxDepth, maxHeight, seaLevel, 0);
//var generator = new OctaveNoise(new PerlinNoise(0), 4, 0.1);
//var generator = new PerlinNoise(0);
const int sizeX = 1000;
const int sizeY = maxHeight + maxDepth;
const int scale = 1;
var bitmap = new Bitmap(sizeX, sizeY);
for (var y = 0; y < sizeY; y++)
{
for (var x = 0; x < sizeX; x++)
{
var c = Color.Black;
//var value = Perlin.perlin(x + 0.5, y + 0.5, 0);
//var value = generator.Noise(x + 0.5, y + 0.5, 1.0, 1f / 100f, 0f, 1f);
//var value = generator.IronOreDensity(x, y, 0);
var value = generator.GoldOreDensity(x * scale, y - maxDepth, 0);
//var value = generator.DiamondOreDensity(x * scale, y * scale, 0);
var colorTone = Math.Max(0, Math.Min(255, (int)(value * 255)));
c = Color.FromArgb(colorTone, colorTone, colorTone);
bitmap.SetPixel(x, y, c);
}
}
bitmap.Save("density.bmp");
}
private static void EvaluateTerrain()
{
const int maxHeight = 100;
const int maxDepth = 100;
const int seaLevel = 80;
var generator = new Generator(maxDepth, maxHeight, seaLevel, 1050);
var total = 0.0;
var numberRock = 0.0;
var numberIron = 0.0;
var numberGold = 0.0;
var numberDiamond = 0.0;
// Evaluate statistics for the generated terrain
const int maxX = 10000;
var plane = new Plane(0);
for(int x = 0; x < maxX; x++)
{
for (int y = -maxDepth; y <= 0; y++)
{
var block = generator[new Coordinate(x, y), plane];
total++;
// If dirt or water then we can skip the rest of the slice
if (block.Type == TerrainType.Dirt || block.Type == TerrainType.Sea)
{
total += 0 - y;
break;
}
if (block.Type == TerrainType.Rock)
numberRock++;
if (block.Ore == OreType.Iron)
numberIron++;
if (block.Ore == OreType.Gold)
numberGold++;
if (block.Ore == OreType.Diamond)
numberDiamond++;
}
}
// Print statistics
Console.WriteLine("Total blocks evaluated: {0}", total);
Console.WriteLine("Rock %: {0}", numberRock / total);
Console.WriteLine("Densities:");
Console.WriteLine("Iron: {0} ({1})", numberIron / numberRock, numberIron);
Console.WriteLine("Gold: {0} ({1})", numberGold / numberRock, numberGold);
Console.WriteLine("Diamond: {0} ({1})", numberDiamond / numberRock, numberDiamond);
}
private static Tuple<double, double>[] SampleNoise(Func<double, double, double> noiseFunc)
{
// Sample area
const double intervalLength = 1000.0;
const int numberOfSamples = 500;
var samples = new Tuple<double, double>[numberOfSamples];
for (int sample = 0; sample < numberOfSamples; sample++)
{
var x = intervalLength / numberOfSamples * sample;
var value = noiseFunc(x, 0.5);
samples[sample] = new Tuple<double, double>(x, value);
}
return samples;
}
private static Tuple<double, double>[] SeabedTerrain()
{
// Noise parameters
const double frequency = 1.0 / 4096.0;
const double amplitude = 1.0;
const double exponent = 7.0;
const int octaves = 4;
const double persistence = 0.08;
const double damping = 1.0;
// Sample area
const double intervalStart = 10.0; // Phase shift
const double intervalLength = 20000.0;
const int numberOfSamples = 500;
var generator = new OctaveNoise(new PerlinNoise(0), octaves, persistence);
var samples = new Tuple<double, double>[numberOfSamples];
for (int sample = 0; sample < numberOfSamples; sample++)
{
var x = intervalLength / numberOfSamples * sample;
/* var value =
100.0 * Math.Pow(generator.Noise(x, 0.5, amplitude, frequency, intervalStart, damping), exponent) /
Math.Pow(amplitude, exponent);*/
var value =
10.0 * Math.Pow(generator.Noise(x, 0.5, amplitude, frequency, intervalStart, damping), exponent) - 0.5;
value = (1.0 - Softmax(10.0*value));
samples[sample] = new Tuple<double, double>(x, value);
}
return samples;
}
private static double Softmax(double x)
{
return 1.0 / (1 + Math.Exp(-x));
}
private static Tuple<double, double>[] BedrockTerrain()
{
// Noise parameters
const double frequency = 1.0 / 512.0;
const double amplitude = 1.0;
const double exponent = 2.0;
const int octaves = 4;
const double persistence = 0.8;
const double damping = 6.0;
// Sample area
const double intervalStart = 10.0; // Phase shift
const double intervalLength = 1000.0;
const int numberOfSamples = 500;
var generator = new OctaveNoise(new PerlinNoise(0), octaves, persistence);
var samples = new Tuple<double, double>[numberOfSamples];
for (int sample = 0; sample < numberOfSamples; sample++)
{
var x = intervalLength / numberOfSamples * sample;
var value = Clamp(Math.Pow(generator.Noise(x, 0.5, amplitude, frequency, intervalStart, damping), exponent) /
Math.Pow(amplitude, exponent) - 0.2, 0.0, 1.0);
samples[sample] = new Tuple<double, double>(x, value);
}
return samples;
}
private static Tuple<double, double>[] HillTerrain()
{
// Noise parameters
const double frequency = 1.0 / 512.0;
const double amplitude = 1.0;
const double exponent = 1.0;
const int octaves = 4;
const double persistence = 0.8;
// Sample area
const double intervalStart = 10.0; // Phase shift
const double intervalLength = 1000.0;
const int numberOfSamples = 500;
var generator = new OctaveNoise(new PerlinNoise(0), octaves, persistence);
var samples = new Tuple<double, double>[numberOfSamples];
for (int sample = 0; sample < numberOfSamples; sample++)
{
var x = intervalLength / numberOfSamples * sample;
var value = Math.Pow(generator.Noise(x, 0.5, amplitude, frequency, intervalStart, 8.0), exponent) /
Math.Pow(amplitude, exponent);
samples[sample] = new Tuple<double, double>(x, value);
}
return samples;
}
private static Tuple<double, double>[] MountainTerrain()
{
// Noise parameters
const double frequency = 1.0/256.0;
const double amplitude = 1.0;
const double exponent = 7.0;
const int octaves = 4;
const double persistence = 0.5;
const double scale = 8.0;
// Sample area
const double intervalStart = 10.0; // Phase shift
const double intervalLength = 1000.0;
const int numberOfSamples = 500;
var generator = new OctaveNoise(new PerlinNoise(0), octaves, persistence);
var samples = new Tuple<double, double>[numberOfSamples];
for (int sample = 0; sample < numberOfSamples; sample++)
{
var x = intervalLength/numberOfSamples*sample;
var value = Clamp(scale * Math.Pow(generator.Noise(x, 0.5, amplitude, frequency, intervalStart, 1.0), exponent)/
Math.Pow(amplitude, exponent), 0.0, 1.0);
samples[sample] = new Tuple<double, double>(x, value);
}
return samples;
}
private static double Clamp(double value, double min, double max)
{
if (value < min)
return min;
if (value > max)
return max;
return value;
}
}
}
| simonejsing/Prerelease | TestNoise/Program.cs | C# | mit | 12,075 |
var fs = require('fs');
fs.stat('/tmp', function(err, stats) {
if (err) {
console.error(err);
return;
}
console.log(stats);
});
| Rukeith/node-n2-example | stats.js | JavaScript | mit | 158 |
package com.kitchen_ehhd.Models;
/**
* Created by yisen_000 on 2015-09-19.
*/
public class DrawerItem {
private String name;
private int drawerNum;
public DrawerItem(String name, int drawerNum) {
this.name = name;
this.drawerNum = drawerNum;
}
public String getName() {
return name;
}
public int getDrawerNum() {
return drawerNum;
}
}
| vishalkuo/Kitchen-Ehhd | Android/Kitchen-Ehhd/app/src/main/java/com/kitchen_ehhd/Models/DrawerItem.java | Java | mit | 405 |
var path = require('path');
var cmd = require('cmd-util');
var ast = cmd.ast;
var iduri = cmd.iduri;
exports.init = function(grunt) {
var exports = {};
exports.jsConcat = function(fileObj, options) {
var data = grunt.file.read(fileObj.src);
var meta = ast.parseFirst(data);
var records = grunt.option('concat-records');
if (grunt.util._.contains(records, meta.id)) {
return '';
}
records.push(meta.id);
if (options.include === 'self') {
return data;
}
var rv = meta.dependencies.map(function(dep) {
if (dep.charAt(0) === '.') {
var id = iduri.absolute(meta.id, dep);
if (grunt.util._.contains(records, id)) {
return '';
}
records.push(id);
var fpath = path.join(path.dirname(fileObj.src), dep);
console.log('###', fpath);
if (!/\.js$/.test(fpath)) fpath += '.js';
if (!grunt.file.exists(fpath)) {
grunt.log.warn('##=>file ' + fpath + ' not found');
return '';
}
return grunt.file.read(fpath);
} else if ((/\.css$/.test(dep) && options.css2js) || options.include === 'all') {
var fileInPaths;
options.paths.some(function(basedir) {
var fpath = path.join(basedir, dep);
console.log('@@@', fpath);
if (!/\.css$/.test(dep)) {
fpath += '.js';
}
if (grunt.file.exists(fpath)) {
fileInPaths = fpath;
return true;
}
});
if (!fileInPaths) {
grunt.log.warn('@@=>file ' + dep + ' not found\n'+ fileInPaths +'\n');
} else {
var data = grunt.file.read(fileInPaths);
if (/\.css$/.test(dep)) {
return options.css2js(data, dep);
}
return data;
}
}
return '';
}).join(grunt.util.normalizelf(options.separator));
return [data, rv].join(grunt.util.normalizelf(options.separator));
};
return exports;
};
| immissile/Shock-resume | node_modules/grunt-cmd-concat/tasks/lib/script.js | JavaScript | mit | 1,999 |
$("#btnAddButton").on('click', addButton);
$("#btnRemoveButton").on('click', removeButton);
$('#btnAddTrail').on('click', loadFiles);
$(document).ready(function() {
});
var counter = 0;
function addButton(event) {
if(counter >= 10){
alert("Only 10 textboxes are allowed");
return false;
}
var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter);
var str =
'<input id="inputPicture" type="file" name="addpic">' +
'<input id="inputPictureLon" type="text" placeholder="lon" size="8">' +
'<input id="inputPictureLat" type="text" placeholder="lat" size="8">' +
'<input id="inputPictureAlt" type="text" placeholder="alt" size="8">' +
'<input id="inputPictureTimestamp" type="text" placeholder="timestamp" size="8">' +
'<input id="inputPictureName" type="text" placeholder="picturename" size="8">' +
'<input id="inputPictureDescription" type="text" placeholder="description" size="8">';
newTextBoxDiv.after().html(str);
newTextBoxDiv.appendTo("#TextBoxesGroup");
counter++;
}
function removeButton(event) {
if (counter == 0) {
alert("No more textbox to remove");
return false;
}
counter--;
$("#TextBoxDiv" + counter).remove();
}
var log = function(text) {
var elem = document.getElementsByTagName('span')[1];
elem.innerHTML = text;
elem.style.backgroundColor="yellow";
elem.style.color="black";
setTimeout(function() {
document.getElementsByTagName('span')[1].innerHTML = "";
}, 60000);
};
var picDataArray = [];
var readers = [];
var readerInd = 0;
function loadFiles(event) {
var elem;
var file;
picDataArray = [];
readers = [];
readerInd = 0;
event.preventDefault();
if (window.File && window.FileReader && window.FileList && window.Blob) {
//alert("File API supported.!");
for (var i=0; i<counter; i++) {
readers[i] = new FileReader();
readers[i].onload = function(e) {
if (e.target.error) {
log("couldn't read file");
return;
}
picDataArray.push(btoa(e.target.result));
readerInd++;
if (readerInd == counter) {
sendTrail();
}
};
var elem = document.getElementById('TextBoxDiv' + (i).toString());
var file = elem.children[0].files[0];
readers[i].readAsBinaryString(file);
}
if (counter == 0) {
sendTrail();
}
}
else {
alert('The File APIs are not fully supported in this browser.\nI will not send pictures');
sendTrail();
}
}
function sendTrail() {
var obj;
var locArray = [];
var picArray = [];
var coords = [];
var lines = $('#textareaCoordinates').val().split('\n');
for (var i=0; i<lines.length; i++) {
var words = lines[i].split(',');
if (words.length == 4) {
coords = [];
for (var j=0; j<3; j++) {
coords.push(parseFloat(words[j]));
}
obj = { 'timestamp': words[3],
'loc': { 'type': 'Point', 'coordinates': coords }
};
locArray.push(obj);
}
}
for (var i=0; i<counter; i++) {
coords = [];
coords.push($('#TextBoxDiv' + i + ' #inputPictureLon').val());
coords.push($('#TextBoxDiv' + i + ' #inputPictureLat').val());
coords.push($('#TextBoxDiv' + i + ' #inputPictureAlt').val());
obj = { 'timestamp': $('#TextBoxDiv' + i + ' #inputPictureTimestamp').val(),
'picturename': $('#TextBoxDiv' + i + ' #inputPictureName').val(),
'description': $('#TextBoxDiv' + i + ' #inputPictureDescription').val(),
'filename': $('#TextBoxDiv' + i + ' #inputPicture').val(),
'file': picDataArray[i],
'loc': { 'type': 'Point', 'coordinates': coords }
};
picArray.push(obj);
}
var data = { 'newtrail' : [
{ 'type': 'LocationCollection',
'locations': locArray
},
{ 'type': 'PictureCollection',
'pictures': picArray
},
{ 'type': 'TrailInfo',
'access': $('#inputAccess').val(),
'trailname': $('#inputTrailName').val(),
'description': $('#inputDescription').val(),
'date': $('#inputDate').val(),
'locationname': $('#inputLocationName').val()
},
{ 'type': 'UserInfo',
'username': $('#inputUsername').val(),
'password': $('#inputPassword').val(),
}
] };
$.ajax({
type: 'POST',
data: data,
url: '/addtrail',
dataType: 'JSON',
success: function(res) {
if (res.status == 'ok') {
var elem = document.getElementsByTagName('span')[0];
elem.innerHTML = res.msg;
elem.style.backgroundColor="blue";
elem.style.color="white";
setTimeout(function() {
document.getElementsByTagName('span')[0].innerHTML = "";
}, 5000);
}
else {
var elem = document.getElementsByTagName('span')[0];
elem.innerHTML = res.msg;
elem.style.backgroundColor="red";
elem.style.color="white";
setTimeout(function() {
document.getElementsByTagName('span')[0].innerHTML = "";
}, 5000);
}
},
error: function(xhr, textStatus) {
alert("HTTP error code: " + xhr.status + " response:\n" + xhr.responseText);
},
complete: function(xhr, textstatus) {
}
});
}
| vesapehkonen/jatrailmap | nodejs/public/js/cli-trailbuilder.js | JavaScript | mit | 5,082 |
(function (window, document, angular, jQuery, undefined) {
'use strict';
angular.module('vissensePlayground')
.controller('TrackSectionsDemoCtrl', [
'$window',
'$document',
'$scope',
'VisSense',
function ($window, $document, $scope, VisSense) {
$scope.scrollToElement = function (elementId) {
jQuery('html, body').animate({
scrollTop: jQuery('#' + elementId).offset().top
}, 500);
};
var changeOpacityOnPercentageChangeOfElementWithId = function (elementId) {
var sectionElement = jQuery('#' + elementId);
var onChange = function (state) {
var newValue = state.percentage;
var oldValue = (state.previous.percentage || 0);
var difference = newValue - oldValue;
var duration = 500 * Math.max(difference, 0.25);
// set the opacity to the actual visibility percentage
var opacity = Math.max(newValue, 0.25);
sectionElement.fadeTo(duration, opacity);
};
var sectionMonitor = new VisSense(sectionElement[0]).monitor({
// update when user scrolls or resizes the page
strategy: VisSense.VisMon.Strategy.EventStrategy({debounce: 50}),
percentagechange: function (monitor) {
onChange(monitor.state());
}
}).start();
$scope.$on('$destroy', function () {
sectionMonitor.stop();
});
};
changeOpacityOnPercentageChangeOfElementWithId('examples-section');
changeOpacityOnPercentageChangeOfElementWithId('demo-section');
changeOpacityOnPercentageChangeOfElementWithId('plugins-section');
}]);
})(window, document, angular, jQuery);
| vissense/vissense-demo | app/scripts/demos/track-sections-demo-ctrl.js | JavaScript | mit | 1,788 |
"use strict";
const commonOptions = require("../common/common-options");
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
module.exports = {
bracketSpacing: commonOptions.bracketSpacing,
singleQuote: commonOptions.singleQuote,
proseWrap: commonOptions.proseWrap
};
| existentialism/prettier | src/language-yaml/options.js | JavaScript | mit | 317 |
<?php
namespace AppBundle\Controller;
use AppBundle\Form\NodoType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use AppBundle\Controller\BaseController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Ivory\GoogleMap\Map;
use Ivory\GoogleMap\Overlays\Animation;
use Ivory\GoogleMap\Overlays\Marker;
use Ivory\GoogleMap\Helper\MapHelper;
class NodoController extends BaseController
{
protected $entity = "Nodo";
/**
* @Route( "crea", name="create_nodo" )
* @Template()
*/
public function createAction(Request $request)
{
return $this->postForm($request, new NodoType());
}
/**
* @Route( "modifica/{id}", name="modifica_nodo" )
* @Template()
*/
public function patchAction(Request $request, $id)
{
return $this->patchForm($request, new NodoType(), $id, "Nodo");
}
/**
* @Route( "list", name="list_nodo" )
* @Template()
*/
public function listAction(Request $request)
{
return $this->cGet();
}
/**
* @Route( "elimina/{id}", name="delete_nodo" )
* @Template()
*/
public function eliminaAction(Request $request, $id)
{
return $this->delete($id);
}
/**
* @Route("/", name="nodi")
*/
public function nodiAction()
{
$nodi = $this->getDoctrine()
->getRepository('AppBundle:Nodo')->findBy(array(), array(), 3, 0);
return $this->render('AppBundle:Nodo:nodi.html.twig', array("nodi" => $nodi));
}
/**
* @Route("/jsondata", name="nodi_jsondata")
*/
public function nodiJsonAction()
{
$porti = $this->getDoctrine()
->getRepository('AppBundle:Nodo')->findAll();
$arrayJson = [];
foreach ($porti as $porto) {
$arrayJson[] = array("permalink" => $porto->getPermalink(), "name" => $porto->getNome());
}
return new JsonResponse($arrayJson);
}
/**
* @Route("/json", name="nodi_json")
*/
public function getNodiJsonAction(Request $r)
{
$categorie = $this->getDoctrine()
->getRepository('AppBundle:Nodo')->findBy(
array(),
array(),
3,
$r->get('offset')
);
return $this->render(
'AppBundle:Nodo:ajax.html.twig',
array("nodi" => $categorie)
);
}
/**
* @Route("/{permalink}", name="dettaglio_nodo")
*/
public function dettagliNodoAction($permalink)
{
$nodo = $this->getDoctrine()
->getRepository('AppBundle:Nodo')->findOneByPermalink($permalink);
if (!$nodo) {
throw $this->createNotFoundException('Unable to find Articolo.');
}
return $this->render(
'AppBundle:Nodo:dettagliNodo.html.twig',
array(
"nodo" => $nodo,
"nodi" => array_slice(
$this->getDoctrine()
->getRepository('AppBundle:Nodo')->findAll(),
0,
3
)
)
);
}
}
| christiancannata/velaforfun | src/AppBundle/Controller/NodoController.php | PHP | mit | 3,288 |
let prop, value, i, len;
for (i = 0, len = myDiv.style.length; i < len; i++) {
prop = myDiv.style[i]; // alternately, myDiv.style.item(i)
value = myDiv.style.getPropertyCSSValue(prop);
console.log(`prop: ${value.cssText} (${value.cssValueType})`);
}
| msfrisbie/pjwd-src | Chapter16DOMLevels2And3/Styles/AccessingElementStyles/DOMStylePropertiesAndMethods/DOMStylePropertiesAndMethodsExample04.js | JavaScript | mit | 258 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="zh_TW" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Litecoin</source>
<translation>關於莱特幣</translation>
</message>
<message>
<location line="+39"/>
<source><b>Litecoin</b> version</source>
<translation><b>莱特幣</b>版本</translation>
</message>
<message>
<location line="+57"/>
<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>
這是一套實驗性的軟體.
此軟體是依據 MIT/X11 軟體授權條款散布, 詳情請見附帶的 COPYING 檔案, 或是以下網站: http://www.opensource.org/licenses/mit-license.php.
此產品也包含了由 OpenSSL Project 所開發的 OpenSSL Toolkit (http://www.openssl.org/) 軟體, 由 Eric Young (eay@cryptsoft.com) 撰寫的加解密軟體, 以及由 Thomas Bernard 所撰寫的 UPnP 軟體.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>版權</translation>
</message>
<message>
<location line="+0"/>
<source>The Litecoin developers</source>
<translation>莱特幣開發人員</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>位址簿</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>點兩下來修改位址或標記</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>產生新位址</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>複製目前選取的位址到系統剪貼簿</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>新增位址</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Litecoin 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>這些是你用來收款的莱特幣位址. 你可以提供不同的位址給不同的付款人, 來追蹤是誰支付給你.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>複製位址</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>顯示 &QR 條碼</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Litecoin address</source>
<translation>簽署訊息是用來證明莱特幣位址是你的</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>訊息簽署</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>從列表中刪除目前選取的位址</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>將目前分頁的資料匯出存成檔案</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation>匯出</translation>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Litecoin address</source>
<translation>驗證訊息是用來確認訊息是用指定的莱特幣位址簽署的</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>訊息驗證</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>刪除</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Litecoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>這是你用來付款的莱特幣位址. 在付錢之前, 務必要檢查金額和收款位址是否正確.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>複製標記</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>編輯</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>付錢</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>匯出位址簿資料</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>逗號區隔資料檔 (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>匯出失敗</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>無法寫入檔案 %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>標記</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>位址</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(沒有標記)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>密碼對話視窗</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>輸入密碼</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>新的密碼</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>重複新密碼</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<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>輸入錢包的新密碼.<br/>請用<b>10個以上的字元</b>, 或是<b>8個以上的單字</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>錢包加密</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>這個動作需要用你的錢包密碼來解鎖</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>錢包解鎖</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>這個動作需要用你的錢包密碼來解密</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>錢包解密</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>變更密碼</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>輸入錢包的新舊密碼.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>錢包加密確認</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR LITECOINS</b>!</source>
<translation>警告: 如果將錢包加密後忘記密碼, 你會<b>失去其中所有的莱特幣</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>你確定要將錢包加密嗎?</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>重要: 請改用新產生有加密的錢包檔, 來取代之前錢包檔的備份. 為了安全性的理由, 當你開始使用新的有加密的錢包時, 舊錢包的備份就不能再使用了.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>警告: 大寫字母鎖定作用中!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>錢包已加密</translation>
</message>
<message>
<location line="-56"/>
<source>Litecoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your litecoins from being stolen by malware infecting your computer.</source>
<translation>莱特幣現在要關閉以完成加密程序. 請記住, 加密錢包無法完全防止入侵電腦的惡意程式偷取你的莱特幣.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>錢包加密失敗</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>錢包加密因程式內部錯誤而失敗. 你的錢包還是沒有加密.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>提供的密碼不符.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>錢包解鎖失敗</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>用來解密錢包的密碼輸入錯誤.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>錢包解密失敗</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>錢包密碼變更成功.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>訊息簽署...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>網路同步中...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>總覽</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>顯示錢包一般總覽</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>交易</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>瀏覽交易紀錄</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>編輯位址與標記的儲存列表</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>顯示收款位址的列表</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>結束</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>結束應用程式</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Litecoin</source>
<translation>顯示莱特幣相關資訊</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>關於 &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>顯示有關於 Qt 的資訊</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>選項...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>錢包加密...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>錢包備份...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>密碼變更...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>從磁碟匯入區塊中...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>重建磁碟區塊索引中...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Litecoin address</source>
<translation>付錢到莱特幣位址</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Litecoin</source>
<translation>修改莱特幣的設定選項</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>將錢包備份到其它地方</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>變更錢包加密用的密碼</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>除錯視窗</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>開啓除錯與診斷主控台</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>驗證訊息...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Litecoin</source>
<translation>莱特幣</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>錢包</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>付出</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>收受</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>位址</translation>
</message>
<message>
<location line="+22"/>
<source>&About Litecoin</source>
<translation>關於莱特幣</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>顯示或隱藏</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>顯示或隱藏主視窗</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>將屬於你的錢包的密鑰加密</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Litecoin addresses to prove you own them</source>
<translation>用莱特幣位址簽署訊息來證明那是你的</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Litecoin addresses</source>
<translation>驗證訊息來確認是用指定的莱特幣位址簽署的</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>檔案</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>設定</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>求助</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>分頁工具列</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Litecoin client</source>
<translation>莱特幣客戶端軟體</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Litecoin network</source>
<translation><numerusform>與莱特幣網路有 %n 個連線在使用中</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation>目前沒有區塊來源...</translation>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation>已處理了估計全部 %2 個中的 %1 個區塊的交易紀錄.</translation>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>已處理了 %1 個區塊的交易紀錄.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n 個小時</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n 天</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n 個星期</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation>落後 %1</translation>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>最近收到的區塊是在 %1 之前生產出來.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation>會看不見在這之後的交易.</translation>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>錯誤</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>警告</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>資訊</translation>
</message>
<message>
<location line="+70"/>
<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>這筆交易的資料大小超過限制了. 你還是可以付出 %1 的費用來傳送, 這筆費用會付給處理你的交易的節點, 並幫助維持整個網路. 你願意支付這項費用嗎?</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>最新狀態</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>進度追趕中...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>確認交易手續費</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>付款交易</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>收款交易</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>日期: %1
金額: %2
類別: %3
位址: %4</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI 處理</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Litecoin address or malformed URI parameters.</source>
<translation>無法解析 URI! 也許莱特幣位址無效或 URI 參數有誤.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>錢包<b>已加密</b>並且正<b>解鎖中</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>錢包<b>已加密</b>並且正<b>上鎖中</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Litecoin can no longer continue safely and will quit.</source>
<translation>發生了致命的錯誤. 莱特幣程式無法再繼續安全執行, 只好結束.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>網路警報</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>編輯位址</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>標記</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>與這個位址簿項目關聯的標記</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>位址</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>與這個位址簿項目關聯的位址. 付款位址才能被更改.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>新收款位址</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>新增付款位址</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>編輯收款位址</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>編輯付款位址</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>輸入的位址"%1"已存在於位址簿中.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Litecoin address.</source>
<translation>輸入的位址 "%1" 並不是有效的莱特幣位址.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>無法將錢包解鎖.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>新密鑰產生失敗.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Litecoin-Qt</source>
<translation>莱特幣-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>版本</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>用法:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>命令列選項</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>使用界面選項</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>設定語言, 比如說 "de_DE" (預設: 系統語系)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>啓動時最小化
</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>顯示啓動畫面 (預設: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>選項</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>主要</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.</source>
<translation>非必要的交易手續費, 以 kB 為計費單位, 且有助於縮短你的交易處理時間. 大部份交易資料的大小是 1 kB.</translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>付交易手續費</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Litecoin after logging in to the system.</source>
<translation>在登入系統後自動啓動莱特幣.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Litecoin on system login</source>
<translation>系統登入時啟動莱特幣</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>回復所有客戶端軟體選項成預設值.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>選項回復</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>網路</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Litecoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>自動在路由器上開啟 InstaMineNuggets 的客戶端通訊埠. 只有在你的路由器支援 UPnP 且開啟時才有作用.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>用 &UPnP 設定通訊埠對應</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Litecoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>透過 SOCKS 代理伺服器連線至莱特幣網路 (比如說要透過 Tor 連線).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>透過 SOCKS 代理伺服器連線:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>代理伺服器位址:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>代理伺服器的網際網路位址 (比如說 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>通訊埠:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>代理伺服器的通訊埠 (比如說 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS 協定版本:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>代理伺服器的 SOCKS 協定版本 (比如說 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>視窗</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>最小化視窗後只在通知區域顯示圖示</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>最小化至通知區域而非工作列</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>當視窗關閉時將其最小化, 而非結束應用程式. 當勾選這個選項時, 應用程式只能用選單中的結束來停止執行.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>關閉時最小化</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>顯示</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>使用界面語言</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Litecoin.</source>
<translation>可以在這裡設定使用者介面的語言. 這個設定在莱特幣程式重啓後才會生效.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>金額顯示單位:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>選擇操作界面與付錢時預設顯示的細分單位.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Litecoin addresses in the transaction list or not.</source>
<translation>是否要在交易列表中顯示莱特幣位址.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>在交易列表顯示位址</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>好</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>取消</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>套用</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>預設</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>確認回復選項</translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>有些設定可能需要重新啓動客戶端軟體才會生效.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>你想要就做下去嗎?</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>警告</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Litecoin.</source>
<translation>這個設定會在莱特幣程式重啓後生效.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>提供的代理伺服器位址無效</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>表單</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Litecoin network after a connection is established, but this process has not completed yet.</source>
<translation>顯示的資訊可能是過期的. 與莱特幣網路的連線建立後, 你的錢包會自動和網路同步, 但這個步驟還沒完成.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>餘額:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>未確認額:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>錢包</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>未熟成</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>尚未熟成的開採金額</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>最近交易</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>目前餘額</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>尚未確認之交易的總額, 不包含在目前餘額中</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>沒同步</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start litecoin: click-to-pay handler</source>
<translation>無法啟動 InstaMineNuggets 隨按隨付處理器</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR 條碼對話視窗</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>付款單</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>金額:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>標記:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>訊息:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>儲存為...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>將 URI 編碼成 QR 條碼失敗</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>輸入的金額無效, 請檢查看看.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>造出的網址太長了,請把標籤或訊息的文字縮短再試看看.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>儲存 QR 條碼</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG 圖檔 (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>客戶端軟體名稱</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="+339"/>
<source>N/A</source>
<translation>無</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>客戶端軟體版本</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>資訊</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>使用 OpenSSL 版本</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>啓動時間</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>網路</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>連線數</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>位於測試網路</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>區塊鎖鏈</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>目前區塊數</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>估計總區塊數</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>最近區塊時間</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>開啓</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>命令列選項</translation>
</message>
<message>
<location line="+7"/>
<source>Show the Litecoin-Qt help message to get a list with possible Litecoin command-line options.</source>
<translation>顯示莱特幣-Qt的求助訊息, 來取得可用的命令列選項列表.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>顯示</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>主控台</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>建置日期</translation>
</message>
<message>
<location line="-104"/>
<source>Litecoin - Debug window</source>
<translation>莱特幣 - 除錯視窗</translation>
</message>
<message>
<location line="+25"/>
<source>Litecoin Core</source>
<translation>莱特幣核心</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>除錯紀錄檔</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Litecoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>從目前的資料目錄下開啓莱特幣的除錯紀錄檔. 當紀錄檔很大時可能要花好幾秒的時間.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>清主控台</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Litecoin RPC console.</source>
<translation>歡迎使用莱特幣 RPC 主控台.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>請用上下游標鍵來瀏覽歷史指令, 且可用 <b>Ctrl-L</b> 來清理畫面.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>請打 <b>help</b> 來看可用指令的簡介.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>付錢</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>一次付給多個人</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>加收款人</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>移除所有交易欄位</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>全部清掉</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>餘額:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>確認付款動作</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>付出</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> 給 %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>確認要付錢</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>確定要付出 %1 嗎?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>和</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>無效的收款位址, 請再檢查看看.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>付款金額必須大於 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>金額超過餘額了.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>包含 %1 的交易手續費後, 總金額超過你的餘額了.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>發現有重複的位址. 每個付款動作中, 只能付給個別的位址一次.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>錯誤: 交易產生失敗!</translation>
</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>錯誤: 交易被拒絕. 有時候會發生這種錯誤, 是因為你錢包中的一些錢已經被花掉了. 比如說你複製了錢包檔 wallet.dat, 然後用複製的錢包花掉了錢, 你現在所用的原來的錢包中卻沒有該筆交易紀錄.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>表單</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>金額:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>付給:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>付款的目標位址 (比如說 Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>輸入一個標記給這個位址, 並加到位址簿中</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>標記:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>從位址簿中選一個位址</translation>
</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>從剪貼簿貼上位址</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>去掉這個收款人</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>輸入莱特幣位址 (比如說 Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>簽章 - 簽署或驗證訊息</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>訊息簽署</translation>
</message>
<message>
<location line="+6"/>
<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>你可以用自己的位址來簽署訊息, 以證明你對它的所有權. 但是請小心, 不要簽署語意含糊不清的內容, 因為釣魚式詐騙可能會用騙你簽署的手法來冒充是你. 只有在語句中的細節你都同意時才簽署.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>用來簽署訊息的位址 (比如說 Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>從位址簿選一個位址</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>從剪貼簿貼上位址</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>在這裡輸入你想簽署的訊息</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>簽章</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>複製目前的簽章到系統剪貼簿</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Litecoin address</source>
<translation>簽署訊息是用來證明這個莱特幣位址是你的</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>訊息簽署</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>重置所有訊息簽署欄位</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>全部清掉</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>訊息驗證</translation>
</message>
<message>
<location line="+6"/>
<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>請在下面輸入簽署的位址, 訊息(請確認完整複製了所包含的換行, 空格, 跳位符號等等), 與簽章, 以驗證該訊息. 請小心, 除了訊息內容外, 不要對簽章本身過度解讀, 以避免被用"中間人攻擊法"詐騙.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>簽署該訊息的位址 (比如說 Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Litecoin address</source>
<translation>驗證訊息是用來確認訊息是用指定的莱特幣位址簽署的</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>訊息驗證</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>重置所有訊息驗證欄位</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>輸入莱特幣位址 (比如說 Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>按"訊息簽署"來產生簽章</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Litecoin signature</source>
<translation>輸入莱特幣簽章</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>輸入的位址無效.</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>請檢查位址是否正確後再試一次.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>輸入的位址沒有指到任何密鑰.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>錢包解鎖已取消.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>沒有所輸入位址的密鑰.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>訊息簽署失敗.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>訊息已簽署.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>無法將這個簽章解碼.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>請檢查簽章是否正確後再試一次.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>這個簽章與訊息的數位摘要不符.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>訊息驗證失敗.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>訊息已驗證.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Litecoin developers</source>
<translation>莱特幣開發人員</translation>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>在 %1 前未定</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/離線中</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/未確認</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>經確認 %1 次</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>狀態</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, 已公告至 %n 個節點</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>日期</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>來源</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>生產出</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>來處</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>目的</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>自己的位址</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>標籤</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>入帳</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>將在 %n 個區塊產出後熟成</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>不被接受</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>出帳</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>交易手續費</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>淨額</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>訊息</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>附註</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>交易識別碼</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 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>生產出來的錢要再等 120 個區塊熟成之後, 才能夠花用. 當你產出區塊時, 它會被公布到網路上, 以被串連至區塊鎖鏈. 如果串連失敗了, 它的狀態就會變成"不被接受", 且不能被花用. 當你產出區塊的幾秒鐘內, 也有其他節點產出區塊的話, 有時候就會發生這種情形.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>除錯資訊</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>交易</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>輸入</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>金額</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>是</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>否</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, 尚未成功公告出去</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>在接下來 %n 個區塊產出前未定</numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>未知</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>交易明細</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>此版面顯示交易的詳細說明</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>日期</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>種類</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>位址</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>金額</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>在接下來 %n 個區塊產出前未定</numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>在 %1 前未定</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>離線中 (經確認 %1 次)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>未確認 (經確認 %1 次, 應確認 %2 次)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>已確認 (經確認 %1 次)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>開採金額將可在 %n 個區塊熟成後可用</numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>沒有其他節點收到這個區塊, 也許它不被接受!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>生產出但不被接受</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>收受於</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>收受自</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>付出至</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>付給自己</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>開採所得</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(不適用)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>交易狀態. 移動游標至欄位上方來顯示確認次數.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>收到交易的日期與時間.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>交易的種類.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>交易的目標位址.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>減去或加入至餘額的金額</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>全部</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>今天</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>這週</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>這個月</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>上個月</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>今年</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>指定範圍...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>收受於</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>付出至</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>給自己</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>開採所得</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>其他</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>輸入位址或標記來搜尋</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>最小金額</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>複製位址</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>複製標記</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>複製金額</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>複製交易識別碼</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>編輯標記</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>顯示交易明細</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>匯出交易資料</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>逗號分隔資料檔 (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>已確認</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>日期</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>種類</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>標記</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>位址</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>金額</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>識別碼</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>匯出失敗</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>無法寫入至 %1 檔案.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>範圍:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>至</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>付錢</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation>匯出</translation>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>將目前分頁的資料匯出存成檔案</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>錢包備份</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>錢包資料檔 (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>備份失敗</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>儲存錢包資料到新的地方失敗</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>備份成功</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>錢包的資料已經成功儲存到新的地方了.</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Litecoin version</source>
<translation>莱特幣版本</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>用法:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or litecoind</source>
<translation>送指令給 -server 或 litecoind
</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>列出指令
</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>取得指令說明
</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>選項:
</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: litecoin.conf)</source>
<translation>指定設定檔 (預設: litecoin.conf)
</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: litecoind.pid)</source>
<translation>指定行程識別碼檔案 (預設: litecoind.pid)
</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>指定資料目錄
</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>設定資料庫快取大小為多少百萬位元組(MB, 預設: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation>在通訊埠 <port> 聽候連線 (預設: 9333, 或若為測試網路: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>維持與節點連線數的上限為 <n> 個 (預設: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>連線到某個節點以取得其它節點的位址, 然後斷線</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>指定自己公開的位址</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>與亂搞的節點斷線的臨界值 (預設: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>避免與亂搞的節點連線的秒數 (預設: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>在 IPv4 網路上以通訊埠 %u 聽取 RPC 連線時發生錯誤: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation>在通訊埠 <port> 聽候 JSON-RPC 連線 (預設: 9332, 或若為測試網路: 19332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>接受命令列與 JSON-RPC 指令
</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>以背景程式執行並接受指令</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>使用測試網路
</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>是否接受外來連線 (預設: 當沒有 -proxy 或 -connect 時預設為 1)</translation>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=litecoinrpc
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 "Litecoin Alert" admin@foo.com
</source>
<translation>%s, 你必須要在以下設定檔中設定 RPC 密碼(rpcpassword):
%s
建議你使用以下隨機產生的密碼:
rpcuser=litecoinrpc
rpcpassword=%s
(你不用記住這個密碼)
使用者名稱(rpcuser)和密碼(rpcpassword)不可以相同!
如果設定檔還不存在, 請在新增時, 設定檔案權限為"只有主人才能讀取".
也建議你設定警示通知, 發生問題時你才會被通知到;
比如說設定為:
alertnotify=echo %%s | mail -s "Litecoin Alert" admin@foo.com
</translation>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>設定在 IPv6 網路的通訊埠 %u 上聽候 RPC 連線失敗, 退而改用 IPv4 網路: %s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation>和指定的位址繫結, 並總是在該位址聽候連線. IPv6 請用 "[主機]:通訊埠" 這種格式</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Litecoin is probably already running.</source>
<translation>無法鎖定資料目錄 %s. 也許莱特幣已經在執行了.</translation>
</message>
<message>
<location line="+3"/>
<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>錯誤: 交易被拒絕了! 有時候會發生這種錯誤, 是因為你錢包中的一些錢已經被花掉了. 比如說你複製了錢包檔 wallet.dat, 然後用複製的錢包花掉了錢, 你現在所用的原來的錢包中卻沒有該筆交易紀錄.</translation>
</message>
<message>
<location line="+4"/>
<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>錯誤: 這筆交易需要至少 %s 的手續費! 因為它的金額太大, 或複雜度太高, 或是使用了最近才剛收到的款項.</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>當收到相關警示時所要執行的指令 (指令中的 %s 會被取代為警示訊息)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>當錢包有交易改變時所要執行的指令 (指令中的 %s 會被取代為交易識別碼)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>設定高優先權或低手續費的交易資料大小上限為多少位元組 (預設: 27000)</translation>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation>這是尚未發表的測試版本 - 使用請自負風險 - 請不要用於開採或商業應用</translation>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>警告: -paytxfee 設定了很高的金額! 這可是你交易付款所要付的手續費.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation>警告: 顯示的交易可能不正確! 你可能需要升級, 或者需要等其它的節點升級.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Litecoin will not work properly.</source>
<translation>警告: 請檢查電腦時間與日期是否正確! 莱特幣無法在時鐘不準的情況下正常運作.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>警告: 讀取錢包檔 wallet.dat 失敗了! 所有的密鑰都正確讀取了, 但是交易資料或位址簿資料可能會缺少或不正確.</translation>
</message>
<message>
<location line="+3"/>
<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>警告: 錢包檔 wallet.dat 壞掉, 但資料被拯救回來了! 原來的 wallet.dat 會改儲存在 %s, 檔名為 wallet.{timestamp}.bak. 如果餘額或交易資料有誤, 你應該要用備份資料復原回來.</translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>嘗試從壞掉的錢包檔 wallet.dat 復原密鑰</translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>區塊產生選項:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>只連線至指定節點(可多個)</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>發現區塊資料庫壞掉了</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>找出自己的網際網路位址 (預設: 當有聽候連線且沒有 -externalip 時為 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>你要現在重建區塊資料庫嗎?</translation>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>初始化區塊資料庫失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation>錢包資料庫環境 %s 初始化錯誤!</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>載入區塊資料庫失敗</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>打開區塊資料庫檔案失敗</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>錯誤: 磁碟空間很少!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>錯誤: 錢包被上鎖了, 無法產生新的交易!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>錯誤: 系統錯誤:</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>在任意的通訊埠聽候失敗. 如果你想的話可以用 -listen=0.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>讀取區塊資訊失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation>讀取區塊失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation>同步區塊索引失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation>寫入區塊索引失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation>寫入區塊資訊失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>寫入區塊失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation>寫入檔案資訊失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation>寫入莱特幣資料庫失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation>寫入交易索引失敗</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation>寫入回復資料失敗</translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>是否允許在找節點時使用域名查詢 (預設: 當沒用 -connect 時為 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation>生產莱特幣 (預設值: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>啓動時檢查的區塊數 (預設: 288, 指定 0 表示全部)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation>區塊檢查的仔細程度 (0 至 4, 預設: 3)</translation>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation>檔案描述器不足.</translation>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation>從目前的區塊檔 blk000??.dat 重建鎖鏈索引</translation>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>設定處理 RPC 服務請求的執行緒數目 (預設為 4)</translation>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation>驗證區塊資料中...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>驗證錢包資料中...</translation>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>從其它來源的 blk000??.dat 檔匯入區塊</translation>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation>設定指令碼驗證的執行緒數目 (最多為 16, 若為 0 表示程式自動決定, 小於 0 表示保留不用的處理器核心數目, 預設為 0)</translation>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>資訊</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>無效的 -tor 位址: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation>設定 -minrelaytxfee=<金額> 的金額無效: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation>設定 -mintxfee=<amount> 的金額無效: '%s'</translation>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation>維護全部交易的索引 (預設為 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>每個連線的接收緩衝區大小上限為 <n>*1000 個位元組 (預設: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>每個連線的傳送緩衝區大小上限為 <n>*1000 位元組 (預設: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation>只接受與內建的檢查段點吻合的區塊鎖鏈 (預設: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>只和 <net> 網路上的節點連線 (IPv4, IPv6, 或 Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>輸出額外的除錯資訊. 包含了其它所有的 -debug* 選項</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>輸出額外的網路除錯資訊</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>在除錯輸出內容前附加時間</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Litecoin Wiki for SSL setup instructions)</source>
<translation>SSL 選項: (SSL 設定程序請見 InstaMineNuggets Wiki)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>選擇 SOCKS 代理伺服器的協定版本(4 或 5, 預設: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>在終端機顯示追蹤或除錯資訊, 而非寫到 debug.log 檔</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>輸出追蹤或除錯資訊給除錯器</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>設定區塊大小上限為多少位元組 (預設: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>設定區塊大小下限為多少位元組 (預設: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>客戶端軟體啓動時將 debug.log 檔縮小 (預設: 當沒有 -debug 時為 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation>簽署交易失敗</translation>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>指定連線在幾毫秒後逾時 (預設: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>系統錯誤:</translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation>交易金額太小</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation>交易金額必須是正的</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation>交易位元量太大</translation>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>是否使用通用即插即用(UPnP)協定來設定聽候連線的通訊埠 (預設: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>是否使用通用即插即用(UPnP)協定來設定聽候連線的通訊埠 (預設: 當有聽候連線為 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>透過代理伺服器來使用 Tor 隱藏服務 (預設: 同 -proxy)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>JSON-RPC 連線使用者名稱</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>警告</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>警告: 這個版本已經被淘汰掉了, 必須要升級!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation>改變 -txindex 參數後, 必須要用 -reindex 參數來重建資料庫</translation>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>錢包檔 weallet.dat 壞掉了, 拯救失敗</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>JSON-RPC 連線密碼</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>只允許從指定網路位址來的 JSON-RPC 連線</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>送指令給在 <ip> 的節點 (預設: 127.0.0.1)
</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>當最新區塊改變時所要執行的指令 (指令中的 %s 會被取代為區塊的雜湊值)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>將錢包升級成最新的格式</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>設定密鑰池大小為 <n> (預設: 100)
</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>重新掃描區塊鎖鏈, 以尋找錢包所遺漏的交易.</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>於 JSON-RPC 連線使用 OpenSSL (https)
</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>伺服器憑證檔 (預設: server.cert)
</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>伺服器密鑰檔 (預設: server.pem)
</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>可以接受的加密法 (預設: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)
</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>此協助訊息
</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>無法和這台電腦上的 %s 繫結 (繫結回傳錯誤 %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>透過 SOCKS 代理伺服器連線</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>允許對 -addnode, -seednode, -connect 的參數使用域名查詢 </translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>載入位址中...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>載入檔案 wallet.dat 失敗: 錢包壞掉了</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Litecoin</source>
<translation>載入檔案 wallet.dat 失敗: 此錢包需要新版的 InstaMineNuggets</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Litecoin to complete</source>
<translation>錢包需要重寫: 請重啟莱特幣來完成</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>載入檔案 wallet.dat 失敗</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>無效的 -proxy 位址: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>在 -onlynet 指定了不明的網路別: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>在 -socks 指定了不明的代理協定版本: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>無法解析 -bind 位址: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>無法解析 -externalip 位址: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>設定 -paytxfee=<金額> 的金額無效: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>無效的金額</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>累積金額不足</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>載入區塊索引中...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>加入一個要連線的節線, 並試著保持對它的連線暢通</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Litecoin is probably already running.</source>
<translation>無法和這台電腦上的 %s 繫結. 也許莱特幣已經在執行了.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>交易付款時每 KB 的交易手續費</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>載入錢包中...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>無法將錢包格式降級</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>無法寫入預設位址</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>重新掃描中...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>載入完成</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>為了要使用 %s 選項</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>錯誤</translation>
</message>
<message>
<location line="-31"/>
<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>你必須在下列設定檔中設定 RPC 密碼(rpcpassword=<password>):
%s
如果這個檔案還不存在, 請在新增時, 設定檔案權限為"只有主人才能讀取".</translation>
</message>
</context>
</TS> | InstaMineNuggets/InstaMineNuggets | src/qt/locale/bitcoin_zh_TW.ts | TypeScript | mit | 113,417 |
<?
/***********************************************************************
* froshims8.php
*
* Computer Science 50
* David J. Malan
*
* Implements a registration form for Frosh IMs. Submits to
* register8.php.
**********************************************************************/
?>
<!DOCTYPE html>
<html>
<head>
<title>Frosh IMs</title>
</head>
<body>
<div style="text-align: center">
<h1>Register for Frosh IMs</h1>
<br><br>
<form action="register8.php" method="post">
<table style="border: 0; margin-left: auto; margin-right: auto; text-align: left">
<tr>
<td>Name:</td>
<td><input name="name" type="text"></td>
</tr>
<tr>
<td>Captain:</td>
<td><input name="captain" type="checkbox"></td>
</tr>
<tr>
<td>Gender:</td>
<td><input name="gender" type="radio" value="F"> F <input name="gender" type="radio" value="M"> M</td>
</tr>
<tr>
<td>Dorm:</td>
<td>
<select name="dorm" size="1">
<option value=""></option>
<option value="Apley Court">Apley Court</option>
<option value="Canaday">Canaday</option>
<option value="Grays">Grays</option>
<option value="Greenough">Greenough</option>
<option value="Hollis">Hollis</option>
<option value="Holworthy">Holworthy</option>
<option value="Hurlbut">Hurlbut</option>
<option value="Lionel">Lionel</option>
<option value="Matthews">Matthews</option>
<option value="Mower">Mower</option>
<option value="Pennypacker">Pennypacker</option>
<option value="Stoughton">Stoughton</option>
<option value="Straus">Straus</option>
<option value="Thayer">Thayer</option>
<option value="Weld">Weld</option>
<option value="Wigglesworth">Wigglesworth</option>
</select>
</td>
</tr>
</table>
<br><br>
<input type="submit" value="Register!">
</form>
</div>
</body>
</html>
| feliposz/learning-stuff | harvard-cs50/src8/froshims/froshims8.php | PHP | mit | 2,313 |
# Patchless XMLRPC Service for Django
# Kind of hacky, and stolen from Crast on irc.freenode.net:#django
# Self documents as well, so if you call it from outside of an XML-RPC Client
# it tells you about itself and its methods
#
# Brendan W. McAdams <brendan.mcadams@thewintergrp.com>
# SimpleXMLRPCDispatcher lets us register xml-rpc calls w/o
# running a full XMLRPC Server. It's up to us to dispatch data
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from buildfarm.models import Package, Queue
from repository.models import Repository, PisiPackage
from source.models import SourcePackage
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
import xmlrpclib
from django.template.loader import render_to_string
from django.utils import simplejson
from django.template import Context, Template
from django import forms
from django.utils import simplejson
from django.db import transaction
from django.shortcuts import redirect
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib import messages
from buildfarm.tasks import build_all_in_queue
class NewQueueForm (forms.ModelForm):
class Meta:
model = Queue
fields = ( 'name', 'builder', 'source_repo', 'binman', 'sandboxed')
def site_index (request):
queues = Queue.objects.all ()
context = { 'queues': queues, 'navhint': 'queue', 'not_reload': 'true', 'form' : NewQueueForm() }
return render (request, "buildfarm/site_index.html", context)
def package_progress_json (request, queue_id):
rdict = {}
q = Queue.objects.get(id=queue_id)
packages = Package.objects.filter(queue=q)
pct =float ( float(q.current) / q.length ) * 100
rdict = { 'percent' : pct, 'total': q.length, 'current': q.current, 'name_current': q.current_package_name }
json = simplejson.dumps(rdict, ensure_ascii=False)
return HttpResponse( json, content_type='application/json')
@staff_member_required
def delete_from_queue (request, package_id):
pkg = get_object_or_404 (Package, id=package_id)
q_id = pkg.queue.id
pkg.delete ()
return redirect ('/buildfarm/queue/%d/' % q_id)
@staff_member_required
def delete_queue (request, queue_id):
queue = get_object_or_404 (Queue, id=queue_id)
queue.delete ()
return redirect ('/manage/')
@staff_member_required
def new_queue (request):
if request.method == 'POST':
# New submission
form = NewQueueForm (request.POST)
rdict = { 'html': "<b>Fail</b>", 'tags': 'fail' }
context = Context ({'form': form})
if form.is_valid ():
rdict = { 'html': "The new queue has been set up", 'tags': 'success' }
model = form.save (commit=False)
model.current = 0
model.length = 0
model.current_package_name = ""
model.save ()
else:
html = render_to_string ('buildfarm/new_queue.html', {'form_queue': form})
rdict = { 'html': html, 'tags': 'fail' }
json = simplejson.dumps(rdict, ensure_ascii=False)
print json
# And send it off.
return HttpResponse( json, content_type='application/json')
else:
form = NewQueueForm ()
context = {'form': form }
return render (request, 'buildfarm/new_queue.html', context)
def queue_index(request, queue_id=None):
q = get_object_or_404 (Queue, id=queue_id)
packages = Package.objects.filter(queue=q).order_by('build_status')
paginator = Paginator (packages, 15)
pkg_count = q.length
if (pkg_count > 0):
pct =float ( float(q.current) / q.length ) * 100
else:
pct = 0
page = request.GET.get("page")
try:
packages = paginator.page(page)
except PageNotAnInteger:
packages = paginator.page (1)
except EmptyPage:
packages = paginator.page (paginator.num_pages)
context = {'navhint': 'queue', 'queue': q, 'package_list': packages, 'total_packages': q.length, 'current_package': q.current, 'total_pct': pct, 'current_package_name': q.current_package_name}
return render (request, "buildfarm/index.html", context)
@staff_member_required
def build_queue (request, queue_id):
queue = Queue.objects.get (id=queue_id)
messages.info (request, "Starting build of \"%s\" queue" % queue.name)
build_all_in_queue.delay (queue_id)
return redirect ('/manage/')
@staff_member_required
def populate_queue (request, queue_id):
q = Queue.objects.get(id=queue_id)
packages = SourcePackage.objects.filter (repository=q.source_repo)
failList = list ()
for package in packages:
binaries = PisiPackage.objects.filter(source_name=package.name)
if len(binaries) == 0:
# We have no binaries
print "New package for source: %s" % (package.name)
failList.append (package)
else:
for package2 in binaries:
if package2.release != package.release:
print "Newer release for: %s" % package2.name
failList.append (package)
break
try:
binary = Package.objects.get(queue=q, name=package.name)
failList.remove (package)
except:
pass
with transaction.commit_on_success():
for fail in failList:
pkg = Package ()
pkg.name = fail.name
pkg.version = fail.version
pkg.build_status = "pending"
pkg.queue = q
pkg.spec_uri = fail.source_uri
pkg.save ()
return redirect ("/buildfarm/queue/%d" % q.id)
| SolusOS-discontinued/RepoHub | buildfarm/views.py | Python | mit | 5,488 |
var albumId;
var addPictures = function (result) {
UserFBAlbums.update({id: albumId}, {$set: {'paging': result.paging}});
for (var i = 0; i < result.data.length; i++) {
UserFBAlbums.update({id: albumId}, {$addToSet: {'pictures': result.data[i]}});
}
IonLoading.hide();
};
Template.gallery.events({
'click .loadNext': function () {
IonLoading.show();
var next = UserFBAlbums.findOne({id: albumId}).paging.next;
facebookApi.getNext(next, addPictures)
},
'click .thumb': function (e) {
Meteor.call('TogglePicture', this.id, function (error, result) {
if (error) {
console.log(error.reason);
}
else if (!result) {
IonPopup.alert({
title: 'Too many images!',
template: 'You can only select up to five images.\n Please review your "Selected Photos" album, and remove some before adding more.',
okText: 'Got It.'
});
}
});
}
});
var pictures = [];
Template.gallery.helpers({
pictures: function () {
if (albumId) {
pictures = UserFBAlbums.findOne({id: albumId}).pictures;
}
return pictures;
},
photosSelected: function () {
var selected = 0;
if (Meteor.user()) {
selected = Meteor.user().profile.facebookImageIds.length;
}
return '(' + selected + '/5)';
},
hasNext: function () {
var album = UserFBAlbums.findOne({id: albumId});
if (album && album.paging) {
return album.paging.next;
}
return false;
}
});
Template.gallery.rendered = function () {
if (albumId) {
if (!UserFBAlbums.findOne({id: albumId}).pictures) {
IonLoading.show();
}
this.autorun(function () {
if (UserFBAlbums.findOne({id: albumId}).pictures) {
IonLoading.hide();
}
else if (Session.get('fbLoaded') && Meteor.userId()) {
facebookApi.getPhotos({identifier: albumId}, function (result) {
addPictures(result);
});
}
}.bind(this));
}
};
Template.gallery.created = function () {
albumId = Router.current().params._albumId;
this.autorun(function () {
this.subscription = Meteor.subscribe('user', Meteor.userId());
}.bind(this));
if (!albumId) {
var images = Meteor.user().profile.facebookImageIds;
for (var i = 0; i < images.length; i++) {
pictures.push({id: images[i]});
}
}
};
| DavidFishman/dfishman | client/templates/facebookPhotos/gallery/gallery.js | JavaScript | mit | 2,657 |
<?php
namespace AMQPAL\Adapter\PhpAmqpLib;
use PhpAmqpLib\Message\AMQPMessage;
use Prophecy\Argument;
use AMQPAL\Adapter\Message;
class MessageMapperTest extends \PHPUnit_Framework_TestCase
{
public function testGetMessagePrototype()
{
$mapper = new MessageMapper();
static::assertInstanceOf(Message::class, $mapper->getMessagePrototype());
$message = $this->prophesize(Message::class);
$mapper->setMessagePrototype($message->reveal());
static::assertSame($message->reveal(), $mapper->getMessagePrototype());
}
public function testToMessage()
{
$libMessage = $this->prophesize(AMQPMessage::class);
$message = $this->prophesize(Message::class);
$mapper = new MessageMapper();
$mapper->setMessagePrototype($message->reveal());
$libMessage->has(Argument::any())->shouldBeCalled()->willReturn(true);
$libMessage->getBody()->shouldBeCalled()->willReturn('body');
$libMessage->get('routing_key')->shouldBeCalled()->willReturn('routingKey');
$libMessage->get('delivery_tag')->shouldBeCalled()->willReturn('deliveryTag');
$libMessage->get('delivery_mode')->shouldBeCalled()->willReturn(2);
$libMessage->get('exchange')->shouldBeCalled()->willReturn('exchangeName');
$libMessage->get('redelivered')->shouldBeCalled()->willReturn(true);
$libMessage->get('content_type')->shouldBeCalled()->willReturn('contentType');
$libMessage->get('content_encoding')->shouldBeCalled()->willReturn('contentEncoding');
$libMessage->get('type')->shouldBeCalled()->willReturn('type');
$libMessage->get('timestamp')->shouldBeCalled()->willReturn(10101010);
$libMessage->get('priority')->shouldBeCalled()->willReturn(5);
$libMessage->get('expiration')->shouldBeCalled()->willReturn('2015-01-01 23:59:59');
$libMessage->get('user_id')->shouldBeCalled()->willReturn('userId');
$libMessage->get('app_id')->shouldBeCalled()->willReturn('appId');
$libMessage->get('message_id')->shouldBeCalled()->willReturn('messageId');
$libMessage->get('reply_to')->shouldBeCalled()->willReturn('replyTo');
$libMessage->get('correlation_id')->shouldBeCalled()->willReturn('correlationId');
$libMessage->get('application_headers')->shouldBeCalled()->willReturn(['header1' => 'foo']);
$ret = $mapper->toMessage($libMessage->reveal());
static::assertInstanceOf(Message::class, $ret);
$message->setBody('body')->shouldBeCalled();
$message->setRoutingKey('routingKey')->shouldBeCalled();
$message->setDeliveryTag('deliveryTag')->shouldBeCalled();
$message->setDeliveryMode(2)->shouldBeCalled();
$message->setExchangeName('exchangeName')->shouldBeCalled();
$message->setRedelivered(true)->shouldBeCalled();
$message->setContentType('contentType')->shouldBeCalled();
$message->setContentEncoding('contentEncoding')->shouldBeCalled();
$message->setType('type')->shouldBeCalled();
$message->setDateTime((new \DateTime())->setTimestamp(10101010))->shouldBeCalled();
$message->setPriority(5)->shouldBeCalled();
$message->setExpiration(new \DateTime('2015-01-01 23:59:59'))->shouldBeCalled();
$message->setUserId('userId')->shouldBeCalled();
$message->setAppId('appId')->shouldBeCalled();
$message->setMessageId('messageId')->shouldBeCalled();
$message->setReplyTo('replyTo')->shouldBeCalled();
$message->setCorrelationId('correlationId')->shouldBeCalled();
$message->setHeaders(['header1' => 'foo'])->shouldBeCalled();
}
}
| thomasvargiu/AMQPAL | tests/unit/Adapter/PhpAmqpLib/MessageMapperTest.php | PHP | mit | 3,685 |
using UIKit;
namespace Phoneword
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
| Kethsar/CS235IM | lab1/Phoneword/Phoneword/Main.cs | C# | mit | 335 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace LiveProcessInspector
{
/// <summary>
/// Interaction logic for GeneralView.xaml
/// </summary>
public partial class GeneralScreenView : UserControl
{
private Window window;
public GeneralScreenView()
{
InitializeComponent();
}
private void Button_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
window = Window.GetWindow(this);
//Task.Delay(TimeSpan.FromMilliseconds(100))
Delay(100).ContinueWith(res =>
{
window.WindowState = WindowState.Normal;
}, TaskScheduler.FromCurrentSynchronizationContext());
}
private void Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
window = Window.GetWindow(this);
window.WindowState = WindowState.Minimized;
}
private static Task Delay(int milliseconds) // Asynchronous NON-BLOCKING method
{
var tcs = new TaskCompletionSource<object>();
new Timer(_ => tcs.SetResult(null)).Change(milliseconds, -1);
return tcs.Task;
}
}
}
| lookuper/LiveProcessInspector | LiveProcessInspector/LiveProcessInspector/GeneralScreenView.xaml.cs | C# | mit | 1,431 |
package mockgen;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
public class TemplateEngine {
public static void main(String[] args) throws Exception {
Map<String, String> map = new HashMap<String, String>();
map.put("name", "JJJJJ");
String res = new TemplateEngine().merge(map, "template/mytemplate.vm");
System.out.println(res);
}
public String merge(Map<String, String> map, String templatePath)
throws Exception {
Properties prop = new Properties();
prop.setProperty("input.encoding", "UTF-8");
prop.setProperty("output.encoding", "UTF-8");
Velocity.init(prop);
VelocityContext context = new VelocityContext();
for (Entry<String, String> entry : map.entrySet()) {
context.put(entry.getKey(), entry.getValue());
}
Template template = Velocity.getTemplate(templatePath);
StringWriter sw = new StringWriter();
template.merge(context, sw);
return sw.toString();
}
} | tnog2014/MockTemplateGenerator | src/mockgen/TemplateEngine.java | Java | mit | 1,123 |
#
# Cookbook Name:: my-base
# Recipe:: _packages
# Purpose:: Manages utilities and yum packages
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Steve Jansen
#
# 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.
include_recipe 'yum'
include_recipe 'yum-epel'
node.set['build-essential']['compile_time'] = true
include_recipe 'build-essential'
# install sysadmin utilities missing from centos-6.5
# and keep them up-to-date for security patches
%w(
bash
lsof
man
nc
redhat-lsb-core
screen
telnet
tree
wget
vim
).each do |pkg|
package pkg do
action :upgrade
end
end
| MeanFlow/my-base-cookbook | recipes/_packages.rb | Ruby | mit | 1,597 |
<?php
/**
* SimplePie
*
* A PHP-Based RSS and Atom Feed Framework.
* Takes the hard work out of managing a complete RSS/Atom solution.
*
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* * Neither the name of the SimplePie Team nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
* AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @package SimplePie
* @version 1.3.2-dev
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
* @author Ryan Parman
* @author Geoffrey Sneddon
* @author Ryan McCue
* @link http://simplepie.org/ SimplePie
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
*/
/**
* IRI parser/serialiser/normaliser
*
* @package SimplePie
* @subpackage HTTP
* @author Geoffrey Sneddon
* @author Steve Minutillo
* @author Ryan McCue
* @copyright 2007-2012 Geoffrey Sneddon, Steve Minutillo, Ryan McCue
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class SimplePie_IRI
{
/**
* Scheme
*
* @var string
*/
protected $scheme = null;
/**
* User Information
*
* @var string
*/
protected $iuserinfo = null;
/**
* ihost
*
* @var string
*/
protected $ihost = null;
/**
* Port
*
* @var string
*/
protected $port = null;
/**
* ipath
*
* @var string
*/
protected $ipath = '';
/**
* iquery
*
* @var string
*/
protected $iquery = null;
/**
* ifragment
*
* @var string
*/
protected $ifragment = null;
/**
* Normalization database
*
* Each key is the scheme, each value is an array with each key as the IRI
* part and value as the default value for that part.
*/
protected $normalization = array(
'acap' => array(
'port' => 674
),
'dict' => array(
'port' => 2628
),
'file' => array(
'ihost' => 'localhost'
),
'http' => array(
'port' => 80,
'ipath' => '/'
),
'https' => array(
'port' => 443,
'ipath' => '/'
),
);
/**
* Return the entire IRI when you try and read the object as a string
*
* @return string
*/
public function __toString()
{
return $this->get_iri();
}
/**
* Overload __set() to provide access via properties
*
* @param string $name Property name
* @param mixed $value Property value
*/
public function __set($name, $value)
{
if (method_exists($this, 'set_' . $name))
{
call_user_func(array($this, 'set_' . $name), $value);
}
elseif (
$name === 'iauthority'
|| $name === 'iuserinfo'
|| $name === 'ihost'
|| $name === 'ipath'
|| $name === 'iquery'
|| $name === 'ifragment'
)
{
call_user_func(array($this, 'set_' . substr($name, 1)), $value);
}
}
/**
* Overload __get() to provide access via properties
*
* @param string $name Property name
* @return mixed
*/
public function __get($name)
{
// isset() returns false for null, we don't want to do that
// Also why we use array_key_exists below instead of isset()
$props = get_object_vars($this);
if (
$name === 'iri' ||
$name === 'uri' ||
$name === 'iauthority' ||
$name === 'authority'
)
{
$return = $this->{"get_$name"}();
}
elseif (array_key_exists($name, $props))
{
$return = $this->$name;
}
// host -> ihost
elseif (($prop = 'i' . $name) && array_key_exists($prop, $props))
{
$name = $prop;
$return = $this->$prop;
}
// ischeme -> scheme
elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props))
{
$name = $prop;
$return = $this->$prop;
}
else
{
trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
$return = null;
}
if ($return === null && isset($this->normalization[$this->scheme][$name]))
{
return $this->normalization[$this->scheme][$name];
}
else
{
return $return;
}
}
/**
* Overload __isset() to provide access via properties
*
* @param string $name Property name
* @return bool
*/
public function __isset($name)
{
if (method_exists($this, 'get_' . $name) || isset($this->$name))
{
return true;
}
else
{
return false;
}
}
/**
* Overload __unset() to provide access via properties
*
* @param string $name Property name
*/
public function __unset($name)
{
if (method_exists($this, 'set_' . $name))
{
call_user_func(array($this, 'set_' . $name), '');
}
}
/**
* Create a new IRI object, from a specified string
*
* @param string $iri
*/
public function __construct($iri = null)
{
$this->set_iri($iri);
}
/**
* Create a new IRI object by resolving a relative IRI
*
* Returns false if $base is not absolute, otherwise an IRI.
*
* @param IRI|string $base (Absolute) Base IRI
* @param IRI|string $relative Relative IRI
* @return IRI|false
*/
public static function absolutize($base, $relative)
{
if (!($relative instanceof SimplePie_IRI))
{
$relative = new SimplePie_IRI($relative);
}
if (!$relative->is_valid())
{
return false;
}
elseif ($relative->scheme !== null)
{
return clone $relative;
}
else
{
if (!($base instanceof SimplePie_IRI))
{
$base = new SimplePie_IRI($base);
}
if ($base->scheme !== null && $base->is_valid())
{
if ($relative->get_iri() !== '')
{
if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null)
{
$target = clone $relative;
$target->scheme = $base->scheme;
}
else
{
$target = new SimplePie_IRI;
$target->scheme = $base->scheme;
$target->iuserinfo = $base->iuserinfo;
$target->ihost = $base->ihost;
$target->port = $base->port;
if ($relative->ipath !== '')
{
if ($relative->ipath[0] === '/')
{
$target->ipath = $relative->ipath;
}
elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
{
$target->ipath = '/' . $relative->ipath;
}
elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
{
$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
}
else
{
$target->ipath = $relative->ipath;
}
$target->ipath = $target->remove_dot_segments($target->ipath);
$target->iquery = $relative->iquery;
}
else
{
$target->ipath = $base->ipath;
if ($relative->iquery !== null)
{
$target->iquery = $relative->iquery;
}
elseif ($base->iquery !== null)
{
$target->iquery = $base->iquery;
}
}
$target->ifragment = $relative->ifragment;
}
}
else
{
$target = clone $base;
$target->ifragment = null;
}
$target->scheme_normalization();
return $target;
}
else
{
return false;
}
}
}
/**
* Parse an IRI into scheme/authority/path/query/fragment segments
*
* @param string $iri
* @return array
*/
protected function parse_iri($iri)
{
$iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match))
{
if ($match[1] === '')
{
$match['scheme'] = null;
}
if (!isset($match[3]) || $match[3] === '')
{
$match['authority'] = null;
}
if (!isset($match[5]))
{
$match['path'] = '';
}
if (!isset($match[6]) || $match[6] === '')
{
$match['query'] = null;
}
if (!isset($match[8]) || $match[8] === '')
{
$match['fragment'] = null;
}
return $match;
}
else
{
// This can occur when a paragraph is accidentally parsed as a URI
return false;
}
}
/**
* Remove dot segments from a path
*
* @param string $input
* @return string
*/
protected function remove_dot_segments($input)
{
$output = '';
while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
{
// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
if (strpos($input, '../') === 0)
{
$input = substr($input, 3);
}
elseif (strpos($input, './') === 0)
{
$input = substr($input, 2);
}
// B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
elseif (strpos($input, '/./') === 0)
{
$input = substr($input, 2);
}
elseif ($input === '/.')
{
$input = '/';
}
// C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
elseif (strpos($input, '/../') === 0)
{
$input = substr($input, 3);
$output = substr_replace($output, '', strrpos($output, '/'));
}
elseif ($input === '/..')
{
$input = '/';
$output = substr_replace($output, '', strrpos($output, '/'));
}
// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
elseif ($input === '.' || $input === '..')
{
$input = '';
}
// E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
elseif (($pos = strpos($input, '/', 1)) !== false)
{
$output .= substr($input, 0, $pos);
$input = substr_replace($input, '', 0, $pos);
}
else
{
$output .= $input;
$input = '';
}
}
return $output . $input;
}
/**
* Replace invalid character with percent encoding
*
* @param string $string Input string
* @param string $extra_chars Valid characters not in iunreserved or
* iprivate (this is ASCII-only)
* @param bool $iprivate Allow iprivate
* @return string
*/
protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false)
{
// Normalize as many pct-encoded sections as possible
$string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string);
// Replace invalid percent characters
$string = preg_replace('/%(?![A-Fa-f0-9]{2})/', '%25', $string);
// Add unreserved and % to $extra_chars (the latter is safe because all
// pct-encoded sections are now valid).
$extra_chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~%';
// Now replace any bytes that aren't allowed with their pct-encoded versions
$position = 0;
$strlen = strlen($string);
while (($position += strspn($string, $extra_chars, $position)) < $strlen)
{
$value = ord($string[$position]);
// Start position
$start = $position;
// By default we are valid
$valid = true;
// No one byte sequences are valid due to the while.
// Two byte sequence:
if (($value & 0xE0) === 0xC0)
{
$character = ($value & 0x1F) << 6;
$length = 2;
$remaining = 1;
}
// Three byte sequence:
elseif (($value & 0xF0) === 0xE0)
{
$character = ($value & 0x0F) << 12;
$length = 3;
$remaining = 2;
}
// Four byte sequence:
elseif (($value & 0xF8) === 0xF0)
{
$character = ($value & 0x07) << 18;
$length = 4;
$remaining = 3;
}
// Invalid byte:
else
{
$valid = false;
$length = 1;
$remaining = 0;
}
if ($remaining)
{
if ($position + $length <= $strlen)
{
for ($position++; $remaining; $position++)
{
$value = ord($string[$position]);
// Check that the byte is valid, then add it to the character:
if (($value & 0xC0) === 0x80)
{
$character |= ($value & 0x3F) << (--$remaining * 6);
}
// If it is invalid, count the sequence as invalid and reprocess the current byte:
else
{
$valid = false;
$position--;
break;
}
}
}
else
{
$position = $strlen - 1;
$valid = false;
}
}
// Percent encode anything invalid or not in ucschar
if (
// Invalid sequences
!$valid
// Non-shortest form sequences are invalid
|| $length > 1 && $character <= 0x7F
|| $length > 2 && $character <= 0x7FF
|| $length > 3 && $character <= 0xFFFF
// Outside of range of ucschar codepoints
// Noncharacters
|| ($character & 0xFFFE) === 0xFFFE
|| $character >= 0xFDD0 && $character <= 0xFDEF
|| (
// Everything else not in ucschar
$character > 0xD7FF && $character < 0xF900
|| $character < 0xA0
|| $character > 0xEFFFD
)
&& (
// Everything not in iprivate, if it applies
!$iprivate
|| $character < 0xE000
|| $character > 0x10FFFD
)
)
{
// If we were a character, pretend we weren't, but rather an error.
if ($valid)
$position--;
for ($j = $start; $j <= $position; $j++)
{
$string = substr_replace($string, sprintf('%%%02X', ord($string[$j])), $j, 1);
$j += 2;
$position += 2;
$strlen += 2;
}
}
}
return $string;
}
/**
* Callback function for preg_replace_callback.
*
* Removes sequences of percent encoded bytes that represent UTF-8
* encoded characters in iunreserved
*
* @param array $match PCRE match
* @return string Replacement
*/
protected function remove_iunreserved_percent_encoded($match)
{
// As we just have valid percent encoded sequences we can just explode
// and ignore the first member of the returned array (an empty string).
$bytes = explode('%', $match[0]);
// Initialize the new string (this is what will be returned) and that
// there are no bytes remaining in the current sequence (unsurprising
// at the first byte!).
$string = '';
$remaining = 0;
// Loop over each and every byte, and set $value to its value
for ($i = 1, $len = count($bytes); $i < $len; $i++)
{
$value = hexdec($bytes[$i]);
// If we're the first byte of sequence:
if (!$remaining)
{
// Start position
$start = $i;
// By default we are valid
$valid = true;
// One byte sequence:
if ($value <= 0x7F)
{
$character = $value;
$length = 1;
}
// Two byte sequence:
elseif (($value & 0xE0) === 0xC0)
{
$character = ($value & 0x1F) << 6;
$length = 2;
$remaining = 1;
}
// Three byte sequence:
elseif (($value & 0xF0) === 0xE0)
{
$character = ($value & 0x0F) << 12;
$length = 3;
$remaining = 2;
}
// Four byte sequence:
elseif (($value & 0xF8) === 0xF0)
{
$character = ($value & 0x07) << 18;
$length = 4;
$remaining = 3;
}
// Invalid byte:
else
{
$valid = false;
$remaining = 0;
}
}
// Continuation byte:
else
{
// Check that the byte is valid, then add it to the character:
if (($value & 0xC0) === 0x80)
{
$remaining--;
$character |= ($value & 0x3F) << ($remaining * 6);
}
// If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence:
else
{
$valid = false;
$remaining = 0;
$i--;
}
}
// If we've reached the end of the current byte sequence, append it to Unicode::$data
if (!$remaining)
{
// Percent encode anything invalid or not in iunreserved
if (
// Invalid sequences
!$valid
// Non-shortest form sequences are invalid
|| $length > 1 && $character <= 0x7F
|| $length > 2 && $character <= 0x7FF
|| $length > 3 && $character <= 0xFFFF
// Outside of range of iunreserved codepoints
|| $character < 0x2D
|| $character > 0xEFFFD
// Noncharacters
|| ($character & 0xFFFE) === 0xFFFE
|| $character >= 0xFDD0 && $character <= 0xFDEF
// Everything else not in iunreserved (this is all BMP)
|| $character === 0x2F
|| $character > 0x39 && $character < 0x41
|| $character > 0x5A && $character < 0x61
|| $character > 0x7A && $character < 0x7E
|| $character > 0x7E && $character < 0xA0
|| $character > 0xD7FF && $character < 0xF900
)
{
for ($j = $start; $j <= $i; $j++)
{
$string .= '%' . strtoupper($bytes[$j]);
}
}
else
{
for ($j = $start; $j <= $i; $j++)
{
$string .= chr(hexdec($bytes[$j]));
}
}
}
}
// If we have any bytes left over they are invalid (i.e., we are
// mid-way through a multi-byte sequence)
if ($remaining)
{
for ($j = $start; $j < $len; $j++)
{
$string .= '%' . strtoupper($bytes[$j]);
}
}
return $string;
}
protected function scheme_normalization()
{
if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo'])
{
$this->iuserinfo = null;
}
if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost'])
{
$this->ihost = null;
}
if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port'])
{
$this->port = null;
}
if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath'])
{
$this->ipath = '';
}
if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery'])
{
$this->iquery = null;
}
if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment'])
{
$this->ifragment = null;
}
}
/**
* Check if the object represents a valid IRI. This needs to be done on each
* call as some things change depending on another part of the IRI.
*
* @return bool
*/
public function is_valid()
{
$isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
if ($this->ipath !== '' &&
(
$isauthority && (
$this->ipath[0] !== '/' ||
substr($this->ipath, 0, 2) === '//'
) ||
(
$this->scheme === null &&
!$isauthority &&
strpos($this->ipath, ':') !== false &&
(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
)
)
)
{
return false;
}
return true;
}
/**
* Set the entire IRI. Returns true on success, false on failure (if there
* are any invalid characters).
*
* @param string $iri
* @return bool
*/
public function set_iri($iri)
{
static $cache;
if (!$cache)
{
$cache = array();
}
if ($iri === null)
{
return true;
}
elseif (isset($cache[$iri]))
{
list($this->scheme,
$this->iuserinfo,
$this->ihost,
$this->port,
$this->ipath,
$this->iquery,
$this->ifragment,
$return) = $cache[$iri];
return $return;
}
else
{
$parsed = $this->parse_iri((string) $iri);
if (!$parsed)
{
return false;
}
$return = $this->set_scheme($parsed['scheme'])
&& $this->set_authority($parsed['authority'])
&& $this->set_path($parsed['path'])
&& $this->set_query($parsed['query'])
&& $this->set_fragment($parsed['fragment']);
$cache[$iri] = array($this->scheme,
$this->iuserinfo,
$this->ihost,
$this->port,
$this->ipath,
$this->iquery,
$this->ifragment,
$return);
return $return;
}
}
/**
* Set the scheme. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @param string $scheme
* @return bool
*/
public function set_scheme($scheme)
{
if ($scheme === null)
{
$this->scheme = null;
}
elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
{
$this->scheme = null;
return false;
}
else
{
$this->scheme = strtolower($scheme);
}
return true;
}
/**
* Set the authority. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @param string $authority
* @return bool
*/
public function set_authority($authority)
{
static $cache;
if (!$cache)
$cache = array();
if ($authority === null)
{
$this->iuserinfo = null;
$this->ihost = null;
$this->port = null;
return true;
}
elseif (isset($cache[$authority]))
{
list($this->iuserinfo,
$this->ihost,
$this->port,
$return) = $cache[$authority];
return $return;
}
else
{
$remaining = $authority;
if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
{
$iuserinfo = substr($remaining, 0, $iuserinfo_end);
$remaining = substr($remaining, $iuserinfo_end + 1);
}
else
{
$iuserinfo = null;
}
if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
{
if (($port = substr($remaining, $port_start + 1)) === false)
{
$port = null;
}
$remaining = substr($remaining, 0, $port_start);
}
else
{
$port = null;
}
$return = $this->set_userinfo($iuserinfo) &&
$this->set_host($remaining) &&
$this->set_port($port);
$cache[$authority] = array($this->iuserinfo,
$this->ihost,
$this->port,
$return);
return $return;
}
}
/**
* Set the iuserinfo.
*
* @param string $iuserinfo
* @return bool
*/
public function set_userinfo($iuserinfo)
{
if ($iuserinfo === null)
{
$this->iuserinfo = null;
}
else
{
$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
$this->scheme_normalization();
}
return true;
}
/**
* Set the ihost. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @param string $ihost
* @return bool
*/
public function set_host($ihost)
{
if ($ihost === null)
{
$this->ihost = null;
return true;
}
elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
{
if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
{
$this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
}
else
{
$this->ihost = null;
return false;
}
}
else
{
$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
// Lowercase, but ignore pct-encoded sections (as they should
// remain uppercase). This must be done after the previous step
// as that can add unescaped characters.
$position = 0;
$strlen = strlen($ihost);
while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen)
{
if ($ihost[$position] === '%')
{
$position += 3;
}
else
{
$ihost[$position] = strtolower($ihost[$position]);
$position++;
}
}
$this->ihost = $ihost;
}
$this->scheme_normalization();
return true;
}
/**
* Set the port. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @param string $port
* @return bool
*/
public function set_port($port)
{
if ($port === null)
{
$this->port = null;
return true;
}
elseif (strspn($port, '0123456789') === strlen($port))
{
$this->port = (int) $port;
$this->scheme_normalization();
return true;
}
else
{
$this->port = null;
return false;
}
}
/**
* Set the ipath.
*
* @param string $ipath
* @return bool
*/
public function set_path($ipath)
{
static $cache;
if (!$cache)
{
$cache = array();
}
$ipath = (string) $ipath;
if (isset($cache[$ipath]))
{
$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
}
else
{
$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
$removed = $this->remove_dot_segments($valid);
$cache[$ipath] = array($valid, $removed);
$this->ipath = ($this->scheme !== null) ? $removed : $valid;
}
$this->scheme_normalization();
return true;
}
/**
* Set the iquery.
*
* @param string $iquery
* @return bool
*/
public function set_query($iquery)
{
if ($iquery === null)
{
$this->iquery = null;
}
else
{
$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
$this->scheme_normalization();
}
return true;
}
/**
* Set the ifragment.
*
* @param string $ifragment
* @return bool
*/
public function set_fragment($ifragment)
{
if ($ifragment === null)
{
$this->ifragment = null;
}
else
{
$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
$this->scheme_normalization();
}
return true;
}
/**
* Convert an IRI to a URI (or parts thereof)
*
* @return string
*/
public function to_uri($string)
{
static $non_ascii;
if (!$non_ascii)
{
$non_ascii = implode('', range("\x80", "\xFF"));
}
$position = 0;
$strlen = strlen($string);
while (($position += strcspn($string, $non_ascii, $position)) < $strlen)
{
$string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1);
$position += 3;
$strlen += 2;
}
return $string;
}
/**
* Get the complete IRI
*
* @return string
*/
public function get_iri()
{
if (!$this->is_valid())
{
return false;
}
$iri = '';
if ($this->scheme !== null)
{
$iri .= $this->scheme . ':';
}
if (($iauthority = $this->get_iauthority()) !== null)
{
$iri .= '//' . $iauthority;
}
if ($this->ipath !== '')
{
$iri .= $this->ipath;
}
elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
{
$iri .= $this->normalization[$this->scheme]['ipath'];
}
if ($this->iquery !== null)
{
$iri .= '?' . $this->iquery;
}
if ($this->ifragment !== null)
{
$iri .= '#' . $this->ifragment;
}
return $iri;
}
/**
* Get the complete URI
*
* @return string
*/
public function get_uri()
{
return $this->to_uri($this->get_iri());
}
/**
* Get the complete iauthority
*
* @return string
*/
protected function get_iauthority()
{
if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null)
{
$iauthority = '';
if ($this->iuserinfo !== null)
{
$iauthority .= $this->iuserinfo . '@';
}
if ($this->ihost !== null)
{
$iauthority .= $this->ihost;
}
if ($this->port !== null)
{
$iauthority .= ':' . $this->port;
}
return $iauthority;
}
else
{
return null;
}
}
/**
* Get the complete authority
*
* @return string
*/
protected function get_authority()
{
$iauthority = $this->get_iauthority();
if (is_string($iauthority))
return $this->to_uri($iauthority);
else
return $iauthority;
}
}
| b13/t3ext-newsfeedimport | Classes/SimplePie/library/SimplePie/IRI.php | PHP | mit | 28,363 |