repo_name stringlengths 4 116 | path stringlengths 4 379 | size stringlengths 1 7 | content stringlengths 3 1.05M | license stringclasses 15
values |
|---|---|---|---|---|
drypot/rapixel | server/express/express-base-test.js | 8130 | var init = require('../base/init');
var error = require('../base/error');
var config = require('../base/config')({ path: 'config/test.json' });
var expb = require('../express/express-base');
var expl = require('../express/express-local');
var expect = require('../base/assert2').expect;
before(function (done) {
init.run(done);
});
describe('hello', function () {
it('should return appName', function (done) {
expl.get('/api/hello').end(function (err, res) {
expect(err).not.exist;
expect(res).json;
expect(res.body.name).equal(config.appName);
var stime = parseInt(res.body.time || 0);
var ctime = Date.now();
expect(stime <= ctime).true;
expect(stime >= ctime - 100).true;
done();
});
});
});
describe('echo', function () {
it('get should succeed', function (done) {
expl.get('/api/echo?p1&p2=123').end(function (err, res) {
expect(err).not.exist;
expect(res.body.method).equal('GET');
expect(res.body.query).eql({ p1: '', p2: '123' });
done();
});
});
it('post should succeed', function (done) {
expl.post('/api/echo').send({ p1: '', p2: '123' }).end(function (err, res) {
expect(err).not.exist;
expect(res.body.method).equal('POST');
expect(res.body.body).eql({ p1: '', p2: '123' });
done();
});
});
it('delete should succeed', function (done) {
expl.del('/api/echo').end(function (err, res) {
expect(err).not.exist;
expect(res.body.method).equal('DELETE');
done();
});
});
});
describe('undefined', function () {
it('should return 404', function (done) {
expl.get('/api/test/undefined-url').end(function (err, res) {
expect(err).exist;
expect(res).status(404); // Not Found
done();
});
});
});
describe('json object', function () {
it('given handler', function () {
expb.core.get('/api/test/object', function (req, res, done) {
res.json({ msg: 'valid json' });
});
});
it('should return json', function (done) {
expl.get('/api/test/object').end(function (err, res) {
expect(err).not.exist;
expect(res).json;
expect(res.body.msg).equal('valid json');
done();
});
});
});
describe('json string', function () {
it('given handler', function () {
expb.core.get('/api/test/string', function (req, res, done) {
res.json('hi');
});
});
it('should return json', function (done) {
expl.get('/api/test/string').end(function (err, res) {
expect(err).not.exist;
expect(res).json;
expect(res.body).equal('hi');
done();
});
});
});
describe('json null', function () {
it('given handler', function () {
expb.core.get('/api/test/null', function (req, res, done) {
res.json(null);
});
});
it('should return {}', function (done) {
expl.get('/api/test/null').end(function (err, res) {
expect(err).not.exist;
expect(res).json;
expect(res.body).equal(null);
done();
});
});
});
describe('no-action', function () {
it('given handler', function () {
expb.core.get('/api/test/no-action', function (req, res, done) {
done();
});
});
it('should return 404', function (done) {
expl.get('/api/test/no-action').end(function (err, res) {
expect(err).exist;
expect(res).status(404); // Not Found
done();
});
});
});
describe('json error', function () {
it('given handler', function () {
expb.core.get('/api/test/invalid-data', function (req, res, done) {
done(error('INVALID_DATA'));
});
});
it('should return json', function (done) {
expl.get('/api/test/invalid-data').end(function (err, res) {
expect(err).not.exist;
expect(res).json;
expect(res.body.err).exist;
expect(res.body.err).error('INVALID_DATA');
done();
});
});
});
describe('html', function () {
it('given handler', function () {
expb.core.get('/test/html', function (req, res, done) {
res.send('<p>some text</p>');
});
});
it('should return html', function (done) {
expl.get('/test/html').end(function (err, res) {
expect(err).not.exist;
expect(res).html;
expect(res.text).equal('<p>some text</p>');
done();
});
});
});
describe('html error', function () {
it('given handler', function () {
expb.core.get('/test/invalid-data', function (req, res, done) {
done(error('INVALID_DATA'));
});
});
it('should return html', function (done) {
expl.get('/test/invalid-data').end(function (err, res) {
expect(err).not.exist;
expect(res).html;
expect(res.text).match(/.*INVALID_DATA.*/);
done();
});
});
});
describe('cache control', function () {
it('given handler', function () {
expb.core.get('/test/cache-test', function (req, res, done) {
res.send('<p>muse be cached</p>');
});
});
it('none api request should return Cache-Control: private', function (done) {
expl.get('/test/cache-test').end(function (err, res) {
expect(err).not.exist;
expect(res.get('Cache-Control')).equal('private');
done();
});
});
it('api should return Cache-Control: no-cache', function (done) {
expl.get('/api/hello').end(function (err, res) {
expect(err).not.exist;
expect(res.get('Cache-Control')).equal('no-cache');
done();
});
});
});
describe('session', function () {
it('given handler', function () {
expb.core.put('/api/test/session', function (req, res) {
for (var key in req.body) {
req.session[key] = req.body[key];
}
res.json({});
});
expb.core.get('/api/test/session', function (req, res) {
var obj = {};
for (var i = 0; i < req.body.length; i++) {
var key = req.body[i];
obj[key] = req.session[key];
}
res.json(obj);
});
});
it('post should succeed', function (done) {
expl.put('/api/test/session').send({ book: 'book1', price: 11 }).end(function (err, res) {
expect(err).not.exist;
expect(res.body.err).not.exist;
done();
});
});
it('get should succeed', function (done) {
expl.get('/api/test/session').send([ 'book', 'price' ]).end(function (err, res) {
expect(err).not.exist;
expect(res.body).property('book', 'book1');
expect(res.body).property('price', 11);
done();
});
});
it('given session destroied', function (done) {
expl.post('/api/test/destroy-session').end(function (err, res) {
expect(err).not.exist;
expect(res.body.err).not.exist;
done();
});
});
it('get should fail', function (done) {
expl.get('/api/test/session').send([ 'book', 'price' ]).end(function (err, res) {
expect(err).not.exist;
expect(res.body).not.property('book');
expect(res.body).not.property('price');
done();
});
});
});
describe('middleware', function () {
var result;
it('given handlers', function () {
function mid1(req, res, done) {
result.mid1 = 'ok';
done();
}
function mid2(req, res, done) {
result.mid2 = 'ok';
done();
}
function miderr(req, res, done) {
done(new Error('some error'));
}
expb.core.get('/api/test/mw-1-2', mid1, mid2, function (req, res, done) {
result.mid3 = 'ok';
res.json({});
});
expb.core.get('/api/test/mw-1-err-2', mid1, miderr, mid2, function (req, res, done) {
result.mid3 = 'ok';
res.json({});
});
});
it('mw-1-2 should return 1, 2', function (done) {
result = {};
expl.get('/api/test/mw-1-2').end(function (err, res) {
expect(err).not.exist;
expect(result.mid1).exist;
expect(result.mid2).exist;
expect(result.mid3).exist;
done();
});
});
it('mw-1-err-2 should return 1, 2', function (done) {
result = {};
expl.get('/api/test/mw-1-err-2').end(function (err, res) {
expect(err).not.exist;
expect(result.mid1).exist;
expect(result.mid2).not.exist;
expect(result.mid3).not.exist;
done();
});
});
});
| mit |
yaplex/learn-git | LearnGitTestApp/Models/IdentityModels.cs | 1214 | using System.Data.Entity;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
namespace LearnGitTestApp.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
} | mit |
ghurlman/emberjs-simpleauth-adal-aad | gulpfile.js | 992 | /// <binding Clean='clean' />
/*
This file in the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
var gulp = require('gulp'),
shell = require('gulp-shell'),
del = require('del'),
dnx = require('gulp-dnx');
gulp.task('clean', function(cb) {
return del(['wwwroot/**/*','tmp/**'], cb);
});
gulp.task('embercleanbuild', ['emberbuild'], function() {
del('tmp/**');
})
gulp.task('emberbuild', shell.task([
'ember build'
]));
gulp.task('emberwatch', shell.task([
'ember build -w'
]));
gulp.task('dnx-run', dnx('web'));
gulp.task('watch', function() {
gulp.watch(['app/**/*', 'config/**/*', 'public/**/*', 'vendor/**/*', 'tests/**/*'], ['embercleanbuild']);
//gulp.watch(['*.json', '*.cs', 'ApiControllers/**/*.cs'], ['clrbuild']);
});
gulp.task('prodbuild', ['embercleanbuild'], function() {
dnx.build();
})
gulp.task('default', ['embercleanbuild', 'watch', 'dnx-run']);
| mit |
ohac/sakuracoin | src/util.cpp | 43229 | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef WIN32
// for posix_fallocate
#ifdef __linux__
#define _POSIX_C_SOURCE 200112L
#endif
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/resource.h>
#endif
#include "util.h"
#include "sync.h"
#include "version.h"
#include "ui_interface.h"
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
// Work around clang compilation problem in Boost 1.46:
// /usr/include/boost/program_options/detail/config_file.hpp:163:17: error: call to function 'to_internal' that is neither visible in the template definition nor found by argument-dependent lookup
// See also: http://stackoverflow.com/questions/10020179/compilation-fail-in-boost-librairies-program-options
// http://clang.debian.net/status.php?version=3.0&key=CANNOT_FIND_FUNCTION
namespace boost {
namespace program_options {
std::string to_internal(const std::string&);
}
}
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <stdarg.h>
#ifdef WIN32
#ifdef _MSC_VER
#pragma warning(disable:4786)
#pragma warning(disable:4804)
#pragma warning(disable:4805)
#pragma warning(disable:4717)
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <io.h> /* for _commit */
#include "shlobj.h"
#elif defined(__linux__)
# include <sys/prctl.h>
#endif
using namespace std;
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fDebug = false;
bool fDebugNet = false;
bool fPrintToConsole = false;
bool fPrintToDebugger = false;
bool fDaemon = false;
bool fServer = false;
bool fCommandLine = false;
string strMiscWarning;
bool fTestNet = false;
bool fBloomFilters = true;
bool fNoListen = false;
bool fLogTimestamps = false;
CMedianFilter<int64> vTimeOffsets(200,0);
volatile bool fReopenDebugLog = false;
bool fCachedPath[2] = {false, false};
// Init OpenSSL library multithreading support
static CCriticalSection** ppmutexOpenSSL;
void locking_callback(int mode, int i, const char* file, int line)
{
if (mode & CRYPTO_LOCK) {
ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
} else {
LEAVE_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
}
}
LockedPageManager LockedPageManager::instance;
// Init
class CInit
{
public:
CInit()
{
// Init OpenSSL library multithreading support
ppmutexOpenSSL = (CCriticalSection**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(CCriticalSection*));
for (int i = 0; i < CRYPTO_num_locks(); i++)
ppmutexOpenSSL[i] = new CCriticalSection();
CRYPTO_set_locking_callback(locking_callback);
#ifdef WIN32
// Seed random number generator with screen scrape and other hardware sources
RAND_screen();
#endif
// Seed random number generator with performance counter
RandAddSeed();
}
~CInit()
{
// Shutdown OpenSSL library multithreading support
CRYPTO_set_locking_callback(NULL);
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];
OPENSSL_free(ppmutexOpenSSL);
}
}
instance_of_cinit;
void RandAddSeed()
{
// Seed with CPU performance counter
int64 nCounter = GetPerformanceCounter();
RAND_add(&nCounter, sizeof(nCounter), 1.5);
memset(&nCounter, 0, sizeof(nCounter));
}
void RandAddSeedPerfmon()
{
RandAddSeed();
// This can take up to 2 seconds, so only do it every 10 minutes
static int64 nLastPerfmon;
if (GetTime() < nLastPerfmon + 10 * 60)
return;
nLastPerfmon = GetTime();
#ifdef WIN32
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data
unsigned char pdata[250000];
memset(pdata, 0, sizeof(pdata));
unsigned long nSize = sizeof(pdata);
long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
RegCloseKey(HKEY_PERFORMANCE_DATA);
if (ret == ERROR_SUCCESS)
{
RAND_add(pdata, nSize, nSize/100.0);
OPENSSL_cleanse(pdata, nSize);
printf("RandAddSeed() %lu bytes\n", nSize);
}
#endif
}
uint64 GetRand(uint64 nMax)
{
if (nMax == 0)
return 0;
// The range of the random source must be a multiple of the modulus
// to give every possible output value an equal possibility
uint64 nRange = (std::numeric_limits<uint64>::max() / nMax) * nMax;
uint64 nRand = 0;
do
RAND_bytes((unsigned char*)&nRand, sizeof(nRand));
while (nRand >= nRange);
return (nRand % nMax);
}
int GetRandInt(int nMax)
{
return GetRand(nMax);
}
uint256 GetRandHash()
{
uint256 hash;
RAND_bytes((unsigned char*)&hash, sizeof(hash));
return hash;
}
//
// OutputDebugStringF (aka printf -- there is a #define that we really
// should get rid of one day) has been broken a couple of times now
// by well-meaning people adding mutexes in the most straightforward way.
// It breaks because it may be called by global destructors during shutdown.
// Since the order of destruction of static/global objects is undefined,
// defining a mutex as a global object doesn't work (the mutex gets
// destroyed, and then some later destructor calls OutputDebugStringF,
// maybe indirectly, and you get a core dump at shutdown trying to lock
// the mutex).
static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT;
// We use boost::call_once() to make sure these are initialized in
// in a thread-safe manner the first time it is called:
static FILE* fileout = NULL;
static boost::mutex* mutexDebugLog = NULL;
static void DebugPrintInit()
{
assert(fileout == NULL);
assert(mutexDebugLog == NULL);
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
fileout = fopen(pathDebug.string().c_str(), "a");
if (fileout) setbuf(fileout, NULL); // unbuffered
mutexDebugLog = new boost::mutex();
}
int OutputDebugStringF(const char* pszFormat, ...)
{
int ret = 0; // Returns total number of characters written
if (fPrintToConsole)
{
// print to console
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
ret += vprintf(pszFormat, arg_ptr);
va_end(arg_ptr);
}
else if (!fPrintToDebugger)
{
static bool fStartedNewLine = true;
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
if (fileout == NULL)
return ret;
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
// reopen the log file, if requested
if (fReopenDebugLog) {
fReopenDebugLog = false;
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
if (freopen(pathDebug.string().c_str(),"a",fileout) != NULL)
setbuf(fileout, NULL); // unbuffered
}
// Debug print useful for profiling
if (fLogTimestamps && fStartedNewLine)
ret += fprintf(fileout, "%s ", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str());
if (pszFormat[strlen(pszFormat) - 1] == '\n')
fStartedNewLine = true;
else
fStartedNewLine = false;
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
ret += vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr);
}
#ifdef WIN32
if (fPrintToDebugger)
{
static CCriticalSection cs_OutputDebugStringF;
// accumulate and output a line at a time
{
LOCK(cs_OutputDebugStringF);
static std::string buffer;
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
buffer += vstrprintf(pszFormat, arg_ptr);
va_end(arg_ptr);
int line_start = 0, line_end;
while((line_end = buffer.find('\n', line_start)) != -1)
{
OutputDebugStringA(buffer.substr(line_start, line_end - line_start).c_str());
line_start = line_end + 1;
ret += line_end-line_start;
}
buffer.erase(0, line_start);
}
}
#endif
return ret;
}
string vstrprintf(const char *format, va_list ap)
{
char buffer[50000];
char* p = buffer;
int limit = sizeof(buffer);
int ret;
loop
{
va_list arg_ptr;
va_copy(arg_ptr, ap);
#ifdef WIN32
ret = _vsnprintf(p, limit, format, arg_ptr);
#else
ret = vsnprintf(p, limit, format, arg_ptr);
#endif
va_end(arg_ptr);
if (ret >= 0 && ret < limit)
break;
if (p != buffer)
delete[] p;
limit *= 2;
p = new char[limit];
if (p == NULL)
throw std::bad_alloc();
}
string str(p, p+ret);
if (p != buffer)
delete[] p;
return str;
}
string real_strprintf(const char *format, int dummy, ...)
{
va_list arg_ptr;
va_start(arg_ptr, dummy);
string str = vstrprintf(format, arg_ptr);
va_end(arg_ptr);
return str;
}
string real_strprintf(const std::string &format, int dummy, ...)
{
va_list arg_ptr;
va_start(arg_ptr, dummy);
string str = vstrprintf(format.c_str(), arg_ptr);
va_end(arg_ptr);
return str;
}
bool error(const char *format, ...)
{
va_list arg_ptr;
va_start(arg_ptr, format);
std::string str = vstrprintf(format, arg_ptr);
va_end(arg_ptr);
printf("ERROR: %s\n", str.c_str());
return false;
}
void ParseString(const string& str, char c, vector<string>& v)
{
if (str.empty())
return;
string::size_type i1 = 0;
string::size_type i2;
loop
{
i2 = str.find(c, i1);
if (i2 == str.npos)
{
v.push_back(str.substr(i1));
return;
}
v.push_back(str.substr(i1, i2-i1));
i1 = i2+1;
}
}
string FormatMoney(int64 n, bool fPlus)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
int64 n_abs = (n > 0 ? n : -n);
int64 quotient = n_abs/COIN;
int64 remainder = n_abs%COIN;
string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder);
// Right-trim excess zeros before the decimal point:
int nTrim = 0;
for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
++nTrim;
if (nTrim)
str.erase(str.size()-nTrim, nTrim);
if (n < 0)
str.insert((unsigned int)0, 1, '-');
else if (fPlus && n > 0)
str.insert((unsigned int)0, 1, '+');
return str;
}
bool ParseMoney(const string& str, int64& nRet)
{
return ParseMoney(str.c_str(), nRet);
}
bool ParseMoney(const char* pszIn, int64& nRet)
{
string strWhole;
int64 nUnits = 0;
const char* p = pszIn;
while (isspace(*p))
p++;
for (; *p; p++)
{
if (*p == '.')
{
p++;
int64 nMult = CENT*10;
while (isdigit(*p) && (nMult > 0))
{
nUnits += nMult * (*p++ - '0');
nMult /= 10;
}
break;
}
if (isspace(*p))
break;
if (!isdigit(*p))
return false;
strWhole.insert(strWhole.end(), *p);
}
for (; *p; p++)
if (!isspace(*p))
return false;
if (strWhole.size() > 10) // guard against 63 bit overflow
return false;
if (nUnits < 0 || nUnits > COIN)
return false;
int64 nWhole = atoi64(strWhole);
int64 nValue = nWhole*COIN + nUnits;
nRet = nValue;
return true;
}
// safeChars chosen to allow simple messages/URLs/email addresses, but avoid anything
// even possibly remotely dangerous like & or >
static string safeChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 .,;_/:?@");
string SanitizeString(const string& str)
{
string strResult;
for (std::string::size_type i = 0; i < str.size(); i++)
{
if (safeChars.find(str[i]) != std::string::npos)
strResult.push_back(str[i]);
}
return strResult;
}
static const signed char phexdigit[256] =
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, };
bool IsHex(const string& str)
{
BOOST_FOREACH(unsigned char c, str)
{
if (phexdigit[c] < 0)
return false;
}
return (str.size() > 0) && (str.size()%2 == 0);
}
vector<unsigned char> ParseHex(const char* psz)
{
// convert hex dump to vector
vector<unsigned char> vch;
loop
{
while (isspace(*psz))
psz++;
signed char c = phexdigit[(unsigned char)*psz++];
if (c == (signed char)-1)
break;
unsigned char n = (c << 4);
c = phexdigit[(unsigned char)*psz++];
if (c == (signed char)-1)
break;
n |= c;
vch.push_back(n);
}
return vch;
}
vector<unsigned char> ParseHex(const string& str)
{
return ParseHex(str.c_str());
}
static void InterpretNegativeSetting(string name, map<string, string>& mapSettingsRet)
{
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
if (name.find("-no") == 0)
{
std::string positive("-");
positive.append(name.begin()+3, name.end());
if (mapSettingsRet.count(positive) == 0)
{
bool value = !GetBoolArg(name);
mapSettingsRet[positive] = (value ? "1" : "0");
}
}
}
void ParseParameters(int argc, const char* const argv[])
{
mapArgs.clear();
mapMultiArgs.clear();
for (int i = 1; i < argc; i++)
{
std::string str(argv[i]);
std::string strValue;
size_t is_index = str.find('=');
if (is_index != std::string::npos)
{
strValue = str.substr(is_index+1);
str = str.substr(0, is_index);
}
#ifdef WIN32
boost::to_lower(str);
if (boost::algorithm::starts_with(str, "/"))
str = "-" + str.substr(1);
#endif
if (str[0] != '-')
break;
mapArgs[str] = strValue;
mapMultiArgs[str].push_back(strValue);
}
// New 0.6 features:
BOOST_FOREACH(const PAIRTYPE(string,string)& entry, mapArgs)
{
string name = entry.first;
// interpret --foo as -foo (as long as both are not set)
if (name.find("--") == 0)
{
std::string singleDash(name.begin()+1, name.end());
if (mapArgs.count(singleDash) == 0)
mapArgs[singleDash] = entry.second;
name = singleDash;
}
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
InterpretNegativeSetting(name, mapArgs);
}
}
std::string GetArg(const std::string& strArg, const std::string& strDefault)
{
if (mapArgs.count(strArg))
return mapArgs[strArg];
return strDefault;
}
int64 GetArg(const std::string& strArg, int64 nDefault)
{
if (mapArgs.count(strArg))
return atoi64(mapArgs[strArg]);
return nDefault;
}
bool GetBoolArg(const std::string& strArg, bool fDefault)
{
if (mapArgs.count(strArg))
{
if (mapArgs[strArg].empty())
return true;
return (atoi(mapArgs[strArg]) != 0);
}
return fDefault;
}
bool SoftSetArg(const std::string& strArg, const std::string& strValue)
{
if (mapArgs.count(strArg))
return false;
mapArgs[strArg] = strValue;
return true;
}
bool SoftSetBoolArg(const std::string& strArg, bool fValue)
{
if (fValue)
return SoftSetArg(strArg, std::string("1"));
else
return SoftSetArg(strArg, std::string("0"));
}
string EncodeBase64(const unsigned char* pch, size_t len)
{
static const char *pbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
string strRet="";
strRet.reserve((len+2)/3*4);
int mode=0, left=0;
const unsigned char *pchEnd = pch+len;
while (pch<pchEnd)
{
int enc = *(pch++);
switch (mode)
{
case 0: // we have no bits
strRet += pbase64[enc >> 2];
left = (enc & 3) << 4;
mode = 1;
break;
case 1: // we have two bits
strRet += pbase64[left | (enc >> 4)];
left = (enc & 15) << 2;
mode = 2;
break;
case 2: // we have four bits
strRet += pbase64[left | (enc >> 6)];
strRet += pbase64[enc & 63];
mode = 0;
break;
}
}
if (mode)
{
strRet += pbase64[left];
strRet += '=';
if (mode == 1)
strRet += '=';
}
return strRet;
}
string EncodeBase64(const string& str)
{
return EncodeBase64((const unsigned char*)str.c_str(), str.size());
}
vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid)
{
static const int decode64_table[256] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
-1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
if (pfInvalid)
*pfInvalid = false;
vector<unsigned char> vchRet;
vchRet.reserve(strlen(p)*3/4);
int mode = 0;
int left = 0;
while (1)
{
int dec = decode64_table[(unsigned char)*p];
if (dec == -1) break;
p++;
switch (mode)
{
case 0: // we have no bits and get 6
left = dec;
mode = 1;
break;
case 1: // we have 6 bits and keep 4
vchRet.push_back((left<<2) | (dec>>4));
left = dec & 15;
mode = 2;
break;
case 2: // we have 4 bits and get 6, we keep 2
vchRet.push_back((left<<4) | (dec>>2));
left = dec & 3;
mode = 3;
break;
case 3: // we have 2 bits and get 6
vchRet.push_back((left<<6) | dec);
mode = 0;
break;
}
}
if (pfInvalid)
switch (mode)
{
case 0: // 4n base64 characters processed: ok
break;
case 1: // 4n+1 base64 character processed: impossible
*pfInvalid = true;
break;
case 2: // 4n+2 base64 characters processed: require '=='
if (left || p[0] != '=' || p[1] != '=' || decode64_table[(unsigned char)p[2]] != -1)
*pfInvalid = true;
break;
case 3: // 4n+3 base64 characters processed: require '='
if (left || p[0] != '=' || decode64_table[(unsigned char)p[1]] != -1)
*pfInvalid = true;
break;
}
return vchRet;
}
string DecodeBase64(const string& str)
{
vector<unsigned char> vchRet = DecodeBase64(str.c_str());
return string((const char*)&vchRet[0], vchRet.size());
}
string EncodeBase32(const unsigned char* pch, size_t len)
{
static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
string strRet="";
strRet.reserve((len+4)/5*8);
int mode=0, left=0;
const unsigned char *pchEnd = pch+len;
while (pch<pchEnd)
{
int enc = *(pch++);
switch (mode)
{
case 0: // we have no bits
strRet += pbase32[enc >> 3];
left = (enc & 7) << 2;
mode = 1;
break;
case 1: // we have three bits
strRet += pbase32[left | (enc >> 6)];
strRet += pbase32[(enc >> 1) & 31];
left = (enc & 1) << 4;
mode = 2;
break;
case 2: // we have one bit
strRet += pbase32[left | (enc >> 4)];
left = (enc & 15) << 1;
mode = 3;
break;
case 3: // we have four bits
strRet += pbase32[left | (enc >> 7)];
strRet += pbase32[(enc >> 2) & 31];
left = (enc & 3) << 3;
mode = 4;
break;
case 4: // we have two bits
strRet += pbase32[left | (enc >> 5)];
strRet += pbase32[enc & 31];
mode = 0;
}
}
static const int nPadding[5] = {0, 6, 4, 3, 1};
if (mode)
{
strRet += pbase32[left];
for (int n=0; n<nPadding[mode]; n++)
strRet += '=';
}
return strRet;
}
string EncodeBase32(const string& str)
{
return EncodeBase32((const unsigned char*)str.c_str(), str.size());
}
vector<unsigned char> DecodeBase32(const char* p, bool* pfInvalid)
{
static const int decode32_table[256] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
if (pfInvalid)
*pfInvalid = false;
vector<unsigned char> vchRet;
vchRet.reserve((strlen(p))*5/8);
int mode = 0;
int left = 0;
while (1)
{
int dec = decode32_table[(unsigned char)*p];
if (dec == -1) break;
p++;
switch (mode)
{
case 0: // we have no bits and get 5
left = dec;
mode = 1;
break;
case 1: // we have 5 bits and keep 2
vchRet.push_back((left<<3) | (dec>>2));
left = dec & 3;
mode = 2;
break;
case 2: // we have 2 bits and keep 7
left = left << 5 | dec;
mode = 3;
break;
case 3: // we have 7 bits and keep 4
vchRet.push_back((left<<1) | (dec>>4));
left = dec & 15;
mode = 4;
break;
case 4: // we have 4 bits, and keep 1
vchRet.push_back((left<<4) | (dec>>1));
left = dec & 1;
mode = 5;
break;
case 5: // we have 1 bit, and keep 6
left = left << 5 | dec;
mode = 6;
break;
case 6: // we have 6 bits, and keep 3
vchRet.push_back((left<<2) | (dec>>3));
left = dec & 7;
mode = 7;
break;
case 7: // we have 3 bits, and keep 0
vchRet.push_back((left<<5) | dec);
mode = 0;
break;
}
}
if (pfInvalid)
switch (mode)
{
case 0: // 8n base32 characters processed: ok
break;
case 1: // 8n+1 base32 characters processed: impossible
case 3: // +3
case 6: // +6
*pfInvalid = true;
break;
case 2: // 8n+2 base32 characters processed: require '======'
if (left || p[0] != '=' || p[1] != '=' || p[2] != '=' || p[3] != '=' || p[4] != '=' || p[5] != '=' || decode32_table[(unsigned char)p[6]] != -1)
*pfInvalid = true;
break;
case 4: // 8n+4 base32 characters processed: require '===='
if (left || p[0] != '=' || p[1] != '=' || p[2] != '=' || p[3] != '=' || decode32_table[(unsigned char)p[4]] != -1)
*pfInvalid = true;
break;
case 5: // 8n+5 base32 characters processed: require '==='
if (left || p[0] != '=' || p[1] != '=' || p[2] != '=' || decode32_table[(unsigned char)p[3]] != -1)
*pfInvalid = true;
break;
case 7: // 8n+7 base32 characters processed: require '='
if (left || p[0] != '=' || decode32_table[(unsigned char)p[1]] != -1)
*pfInvalid = true;
break;
}
return vchRet;
}
string DecodeBase32(const string& str)
{
vector<unsigned char> vchRet = DecodeBase32(str.c_str());
return string((const char*)&vchRet[0], vchRet.size());
}
bool WildcardMatch(const char* psz, const char* mask)
{
loop
{
switch (*mask)
{
case '\0':
return (*psz == '\0');
case '*':
return WildcardMatch(psz, mask+1) || (*psz && WildcardMatch(psz+1, mask));
case '?':
if (*psz == '\0')
return false;
break;
default:
if (*psz != *mask)
return false;
break;
}
psz++;
mask++;
}
}
bool WildcardMatch(const string& str, const string& mask)
{
return WildcardMatch(str.c_str(), mask.c_str());
}
static std::string FormatException(std::exception* pex, const char* pszThread)
{
#ifdef WIN32
char pszModule[MAX_PATH] = "";
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else
const char* pszModule = "sakuracoin";
#endif
if (pex)
return strprintf(
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
return strprintf(
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
void LogException(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
printf("\n%s", message.c_str());
}
void PrintException(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
printf("\n\n************************\n%s\n", message.c_str());
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
throw;
}
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
printf("\n\n************************\n%s\n", message.c_str());
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
}
boost::filesystem::path GetDefaultDataDir()
{
namespace fs = boost::filesystem;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin
// Mac: ~/Library/Application Support/Bitcoin
// Unix: ~/.bitcoin
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Sakuracoin";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == NULL || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// Mac
pathRet /= "Library/Application Support";
fs::create_directory(pathRet);
return pathRet / "Sakuracoin";
#else
// Unix
return pathRet / ".sakuracoin";
#endif
#endif
}
const boost::filesystem::path &GetDataDir(bool fNetSpecific)
{
namespace fs = boost::filesystem;
static fs::path pathCached[2];
static CCriticalSection csPathCached;
fs::path &path = pathCached[fNetSpecific];
// This can be called during exceptions by printf, so we cache the
// value so we don't have to do memory allocations after that.
if (fCachedPath[fNetSpecific])
return path;
LOCK(csPathCached);
if (mapArgs.count("-datadir")) {
path = fs::system_complete(mapArgs["-datadir"]);
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDefaultDataDir();
}
if (fNetSpecific && GetBoolArg("-testnet", false))
path /= "testnet3";
fs::create_directories(path);
fCachedPath[fNetSpecific] = true;
return path;
}
boost::filesystem::path GetConfigFile()
{
boost::filesystem::path pathConfigFile(GetArg("-conf", "sakuracoin.conf"));
if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile;
return pathConfigFile;
}
void ReadConfigFile(map<string, string>& mapSettingsRet,
map<string, vector<string> >& mapMultiSettingsRet)
{
boost::filesystem::ifstream streamConfig(GetConfigFile());
if (!streamConfig.good())
return; // No bitcoin.conf file is OK
// clear path cache after loading config file
fCachedPath[0] = fCachedPath[1] = false;
set<string> setOptions;
setOptions.insert("*");
for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
{
// Don't overwrite existing settings so command line settings override bitcoin.conf
string strKey = string("-") + it->string_key;
if (mapSettingsRet.count(strKey) == 0)
{
mapSettingsRet[strKey] = it->value[0];
// interpret nofoo=1 as foo=0 (and nofoo=0 as foo=1) as long as foo not set)
InterpretNegativeSetting(strKey, mapSettingsRet);
}
mapMultiSettingsRet[strKey].push_back(it->value[0]);
}
}
boost::filesystem::path GetPidFile()
{
boost::filesystem::path pathPidFile(GetArg("-pid", "sakuracoind.pid"));
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
return pathPidFile;
}
#ifndef WIN32
void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
{
FILE* file = fopen(path.string().c_str(), "w");
if (file)
{
fprintf(file, "%d\n", pid);
fclose(file);
}
}
#endif
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
{
#ifdef WIN32
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
MOVEFILE_REPLACE_EXISTING);
#else
int rc = std::rename(src.string().c_str(), dest.string().c_str());
return (rc == 0);
#endif /* WIN32 */
}
void FileCommit(FILE *fileout)
{
fflush(fileout); // harmless if redundantly called
#ifdef WIN32
_commit(_fileno(fileout));
#else
#if defined(__linux__) || defined(__NetBSD__)
fdatasync(fileno(fileout));
#elif defined(__APPLE__) && defined(F_FULLFSYNC)
fcntl(fileno(fileout), F_FULLFSYNC, 0);
#else
fsync(fileno(fileout));
#endif
#endif
}
int GetFilesize(FILE* file)
{
int nSavePos = ftell(file);
int nFilesize = -1;
if (fseek(file, 0, SEEK_END) == 0)
nFilesize = ftell(file);
fseek(file, nSavePos, SEEK_SET);
return nFilesize;
}
bool TruncateFile(FILE *file, unsigned int length) {
#if defined(WIN32)
return _chsize(_fileno(file), length) == 0;
#else
return ftruncate(fileno(file), length) == 0;
#endif
}
// this function tries to raise the file descriptor limit to the requested number.
// It returns the actual file descriptor limit (which may be more or less than nMinFD)
int RaiseFileDescriptorLimit(int nMinFD) {
#if defined(WIN32)
return 2048;
#else
struct rlimit limitFD;
if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
if (limitFD.rlim_cur < (rlim_t)nMinFD) {
limitFD.rlim_cur = nMinFD;
if (limitFD.rlim_cur > limitFD.rlim_max)
limitFD.rlim_cur = limitFD.rlim_max;
setrlimit(RLIMIT_NOFILE, &limitFD);
getrlimit(RLIMIT_NOFILE, &limitFD);
}
return limitFD.rlim_cur;
}
return nMinFD; // getrlimit failed, assume it's fine
#endif
}
// this function tries to make a particular range of a file allocated (corresponding to disk space)
// it is advisory, and the range specified in the arguments will never contain live data
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
#if defined(WIN32)
// Windows-specific version
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
LARGE_INTEGER nFileSize;
int64 nEndPos = (int64)offset + length;
nFileSize.u.LowPart = nEndPos & 0xFFFFFFFF;
nFileSize.u.HighPart = nEndPos >> 32;
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
SetEndOfFile(hFile);
#elif defined(MAC_OSX)
// OSX specific version
fstore_t fst;
fst.fst_flags = F_ALLOCATECONTIG;
fst.fst_posmode = F_PEOFPOSMODE;
fst.fst_offset = 0;
fst.fst_length = (off_t)offset + length;
fst.fst_bytesalloc = 0;
if (fcntl(fileno(file), F_PREALLOCATE, &fst) == -1) {
fst.fst_flags = F_ALLOCATEALL;
fcntl(fileno(file), F_PREALLOCATE, &fst);
}
ftruncate(fileno(file), fst.fst_length);
#elif defined(__linux__)
// Version using posix_fallocate
off_t nEndPos = (off_t)offset + length;
posix_fallocate(fileno(file), 0, nEndPos);
#else
// Fallback version
// TODO: just write one byte per block
static const char buf[65536] = {};
fseek(file, offset, SEEK_SET);
while (length > 0) {
unsigned int now = 65536;
if (length < now)
now = length;
fwrite(buf, 1, now, file); // allowed to fail; this function is advisory anyway
length -= now;
}
#endif
}
void ShrinkDebugFile()
{
// Scroll debug.log if it's getting too big
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
FILE* file = fopen(pathLog.string().c_str(), "r");
if (file && GetFilesize(file) > 10 * 1000000)
{
// Restart the file with some of the end
char pch[200000];
fseek(file, -sizeof(pch), SEEK_END);
int nBytes = fread(pch, 1, sizeof(pch), file);
fclose(file);
file = fopen(pathLog.string().c_str(), "w");
if (file)
{
fwrite(pch, 1, nBytes, file);
fclose(file);
}
}
else if(file != NULL)
fclose(file);
}
//
// "Never go to sea with two chronometers; take one or three."
// Our three time sources are:
// - System clock
// - Median of other nodes clocks
// - The user (asking the user to fix the system clock if the first two disagree)
//
static int64 nMockTime = 0; // For unit testing
int64 GetTime()
{
if (nMockTime) return nMockTime;
return time(NULL);
}
void SetMockTime(int64 nMockTimeIn)
{
nMockTime = nMockTimeIn;
}
static int64 nTimeOffset = 0;
int64 GetTimeOffset()
{
return nTimeOffset;
}
int64 GetAdjustedTime()
{
return GetTime() + GetTimeOffset();
}
void AddTimeData(const CNetAddr& ip, int64 nTime)
{
int64 nOffsetSample = nTime - GetTime();
// Ignore duplicates
static set<CNetAddr> setKnown;
if (!setKnown.insert(ip).second)
return;
// Add data
vTimeOffsets.input(nOffsetSample);
printf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
{
int64 nMedian = vTimeOffsets.median();
std::vector<int64> vSorted = vTimeOffsets.sorted();
// Only let other nodes change our time by so much
if (abs64(nMedian) < 35 * 60) // Sakuracoin: changed maximum adjust to 35 mins to avoid letting peers change our time too much in case of an attack.
{
nTimeOffset = nMedian;
}
else
{
nTimeOffset = 0;
static bool fDone;
if (!fDone)
{
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
bool fMatch = false;
BOOST_FOREACH(int64 nOffset, vSorted)
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
fMatch = true;
if (!fMatch)
{
fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong Sakuracoin will not work properly.");
strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
}
}
}
if (fDebug) {
BOOST_FOREACH(int64 n, vSorted)
printf("%+"PRI64d" ", n);
printf("| ");
}
printf("nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
}
}
uint32_t insecure_rand_Rz = 11;
uint32_t insecure_rand_Rw = 11;
void seed_insecure_rand(bool fDeterministic)
{
//The seed values have some unlikely fixed points which we avoid.
if(fDeterministic)
{
insecure_rand_Rz = insecure_rand_Rw = 11;
} else {
uint32_t tmp;
do {
RAND_bytes((unsigned char*)&tmp, 4);
} while(tmp == 0 || tmp == 0x9068ffffU);
insecure_rand_Rz = tmp;
do {
RAND_bytes((unsigned char*)&tmp, 4);
} while(tmp == 0 || tmp == 0x464fffffU);
insecure_rand_Rw = tmp;
}
}
string FormatVersion(int nVersion)
{
if (nVersion%100 == 0)
return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100);
else
return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100);
}
string FormatFullVersion()
{
return CLIENT_BUILD;
}
// Format the subversion field according to BIP 14 spec (https://en.bitcoin.it/wiki/BIP_0014)
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{
std::ostringstream ss;
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty())
ss << "(" << boost::algorithm::join(comments, "; ") << ")";
ss << "/";
return ss.str();
}
#ifdef WIN32
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
{
namespace fs = boost::filesystem;
char pszPath[MAX_PATH] = "";
if(SHGetSpecialFolderPathA(NULL, pszPath, nFolder, fCreate))
{
return fs::path(pszPath);
}
printf("SHGetSpecialFolderPathA() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
boost::filesystem::path GetTempPath() {
#if BOOST_FILESYSTEM_VERSION == 3
return boost::filesystem::temp_directory_path();
#else
// TODO: remove when we don't support filesystem v2 anymore
boost::filesystem::path path;
#ifdef WIN32
char pszPath[MAX_PATH] = "";
if (GetTempPathA(MAX_PATH, pszPath))
path = boost::filesystem::path(pszPath);
#else
path = boost::filesystem::path("/tmp");
#endif
if (path.empty() || !boost::filesystem::is_directory(path)) {
printf("GetTempPath(): failed to find temp path\n");
return boost::filesystem::path("");
}
return path;
#endif
}
void runCommand(std::string strCommand)
{
int nErr = ::system(strCommand.c_str());
if (nErr)
printf("runCommand error: system(%s) returned %d\n", strCommand.c_str(), nErr);
}
void RenameThread(const char* name)
{
#if defined(PR_SET_NAME)
// Only the first 15 characters are used (16 - NUL terminator)
::prctl(PR_SET_NAME, name, 0, 0, 0);
#elif 0 && (defined(__FreeBSD__) || defined(__OpenBSD__))
// TODO: This is currently disabled because it needs to be verified to work
// on FreeBSD or OpenBSD first. When verified the '0 &&' part can be
// removed.
pthread_set_name_np(pthread_self(), name);
#elif defined(MAC_OSX) && defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
// pthread_setname_np is XCode 10.6-and-later
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
pthread_setname_np(name);
#endif
#else
// Prevent warnings for unused parameters...
(void)name;
#endif
}
bool NewThread(void(*pfn)(void*), void* parg)
{
try
{
boost::thread(pfn, parg); // thread detaches when out of scope
} catch(boost::thread_resource_error &e) {
printf("Error creating thread: %s\n", e.what());
return false;
}
return true;
}
| mit |
cmawhorter/hmmac | lib/hmmac.js | 9888 | /*
* hmmac
* https://github.com/cmawhorter/hmmac
*
* Copyright (c) 2014 Cory Mawhorter
* Licensed under the MIT license.
*/
var crypto = require('crypto');
var schemeLoader = {
load: function(scheme) {
scheme = scheme.toLowerCase();
var includedSchemes = [ 'plain', 'aws4' ];
if (false === includedSchemes.indexOf(scheme)) throw new Error('Invalid hmmac scheme. Included schemes are ' + includedSchemes.join(', '));
return require('./schemes/' + scheme);
}
};
var defCredentialProvider = function(key, callback) {
throw new Error('Hmmac::credentialProvider. You have not specified a credential provider in your Hmmac options. This is the default being called right now.');
};
var DEFAULTS = {
algorithm: 'sha256',
acceptableDateSkew: 900, // in seconds, def 15 minutes. only done if date is signed
credentialProvider: defCredentialProvider,
credentialProviderTimeout: 15, // in seconds. time to wait for credentialProvider to return
signatureEncoding: 'hex', // signature encoding. valid = null (binary), hex or base64
signedHeaders: [ 'host', 'content-type', 'date' ],
wwwAuthenticateRealm: 'API',
scheme: schemeLoader.load('plain'),
debug: process.env.NODE_ENV == 'development' ? 1 : 0
};
function Hmmac(opts) {
opts = opts || {};
this.config = {};
// load defaults
for (var i in DEFAULTS) {
this.config[i] = DEFAULTS[i];
}
// load passed
for (var i in opts) {
this.config[i] = opts[i];
}
if (!this.config.scheme) throw new Error('Hmmac: The configured scheme is invalid.');
}
Hmmac.prototype.log = function() {
if (!this.config.debug || this.config.debug < 2) return;
if (arguments.length == 1) console.log(arguments[0]);
else console.log('Hmmac', arguments);
};
Hmmac.prototype.isRequestish = function(req) {
if (!req || typeof req != 'object') return false;
if (req._hmmac) req = req.original; // unwrap
return !!req && !!req.headers;
};
Hmmac.prototype.isCredentials = function(credentials) {
if (!credentials || typeof credentials != 'object') return false;
return !!credentials.key && !!credentials.secret;
};
Hmmac.prototype.isParsedAuth = function(parsedAuth) {
if (!parsedAuth || typeof parsedAuth != 'object') return false;
return !!parsedAuth.key && !!parsedAuth.signature && !!parsedAuth.serviceLabel;
};
Hmmac.prototype.validateSync = function(req, credentials) {
req = this._wrap(req);
if (!this.isRequestish(req) || !req.original.headers['authorization']) {
this.log('Hmmac::validateSync: Invalid Request Object')
return false;
}
if (!this.isCredentials(credentials)) {
this.log('Hmmac::validateSync: Invalid Credentials Object')
return false;
}
var parsedAuth = this.config.scheme.parseAuthorization.call(this, req);
if (!this.isParsedAuth(parsedAuth)) return false;
return this._validate(req, credentials, parsedAuth);
};
Hmmac.prototype.validate = function(req, callback) {
req = this._wrap(req);
if (!this.isRequestish(req) || !req.original.headers['authorization']) {
this.log('Hmmac::validateSync: Invalid Request Object')
return callback(false);
}
if (typeof callback != 'function') throw new Error('Hmmac::validate: Callback is not a function');
var self = this
, parsedAuth = this.config.scheme.parseAuthorization.call(self, req)
, cbDestruct = function(res, key) {
callback(res, key);
callback = null;
if (cpTimeout) clearTimeout(cpTimeout);
}
, cpTimeout = setTimeout(function() {
cbDestruct(null);
}, self.config.credentialProviderTimeout * 1000);
if (!this.isParsedAuth(parsedAuth)) return cbDestruct(null, null);
var _credentialProviderHandler = function(credentials) {
if (!callback) return; // callback destructed
var key = (credentials || {}).key;
if (!self.isCredentials(credentials)) return cbDestruct(null, key);
return cbDestruct(self._validate(req, credentials, parsedAuth), key);
};
if (self.config.credentialProvider.length === 3) {
self.config.credentialProvider(req.original, parsedAuth.key, _credentialProviderHandler);
}
else {
self.config.credentialProvider(parsedAuth.key, _credentialProviderHandler);
}
};
Hmmac.prototype.sign = function(req, credentials, returnSignature) {
req = this._wrap(req);
if (!this.isRequestish(req)) throw new Error('Hmmac::sign: Not a valid request object');
var signature = this._sign(req, credentials)
, auth = this.config.scheme.buildAuthorization.call(this, req, credentials.key, signature);
if (returnSignature) return auth.value;
else req.original.headers[auth.key] = auth.value;
};
Hmmac.prototype.why = function() {
if (!this.config.debug) return;
console.log('Canonical Request (START)\n"%s"\n(END)', this._lastCanonicalRequest);
console.log('Request Body (START)\n"%s"\n(END)', this._lastRequestBody);
console.log('String to Sign (START)\n"%s"\n(END)', this._lastStringToSign);
};
Hmmac.prototype._validate = function(req, credentials, parsedAuth) {
this._normalizedHeaders(req);
if (!this.isRequestish || !this.isCredentials || !this.isParsedAuth(parsedAuth)) return false;
var passedSignature = parsedAuth.signature
, compareSignature;
// failed signatures immediately fail
try {
compareSignature = this._sign(req, credentials);
}
catch(err) {
this.log(err);
return false;
}
// if date isn't a signed header, then we don't do skew check
if (~req.signedHeaders.indexOf('date')) {
if (!req.original.headers['date'] || !this._checkSkew(req)) {
this.log('Date Skew Expired', req.original.headers['date']);
return false;
}
}
this.log('Comparing', passedSignature, compareSignature);
// slow equals
var diff = passedSignature.length ^ compareSignature.length;
for (var i = 0; i < passedSignature.length && i < compareSignature.length; i++) {
diff |= passedSignature[i] ^ compareSignature[i];
}
return diff === 0;
};
Hmmac.prototype._sign = function(req, credentials) {
this._normalizedHeaders(req);
req.signedHeaders = req.signedHeaders || this.config.signedHeaders;
if (!this.isRequestish || !this.isCredentials) throw new Error('Hmmac::_sign: Cannot sign invalid request');
try {
return this.config.scheme.sign.call(this, req, credentials);
}
catch(err) {
this.log(err);
throw new Error('Hmmac::_sign: Unable to sign the request because: ' + err.message);
}
};
Hmmac.prototype._hash = function(message, encoding) {
encoding = encoding || null;
var hash = crypto.createHash(this.config.algorithm);
hash.update(message);
return hash.digest(encoding);
};
Hmmac.prototype._hmac = function(message, key, encoding) {
encoding = encoding || null;
var hmac = crypto.createHmac(this.config.algorithm, key);
hmac.update(message);
return hmac.digest(encoding);
};
Hmmac.prototype._wrap = function(obj) {
return {
_hmmac: true,
original: obj
};
};
Hmmac.prototype._normalizedHeaders = function(req) {
if (!this.isRequestish(req)) return;
var headerKeys = []
, normal = {};
if (!req.original.headers.hasOwnProperty('host')) req.original.headers['host'] = req.original.host + (req.original.hasOwnProperty('port') ? ':' + req.original.port : '');
for (var k in req.original.headers) headerKeys.push(k);
headerKeys.sort();
headerKeys.forEach(function(headerKey) {
normal[headerKey.toLowerCase()] = req.original.headers[headerKey];
});
req.original.headers = normal;
};
// body can be in multiple places, and there is no guarantee it exists
Hmmac.prototype._body = function(req) {
var body;
if ('body' in req.original) {
body = req.original.body;
}
else if ('_body' in req.original) {
body = req.original._body;
}
else {
body = '';
}
if (typeof body !== 'string') {
// XXX: some version of express always set req.body to an empty object. this isn't perfect,
// but a GET request shouldn't contain a body (.net doesn't allow it at all in WebClient IIRC)
// so we detect an empty object GET and replace with an empty string
if (req.original.method === 'GET' && Object.keys(body).length === 0) {
body = '';
}
else {
body = JSON.stringify(body);
}
}
return body;
};
Hmmac.prototype._checkSkew = function(req) {
if (!this.config.acceptableDateSkew) return true;
if (!this.isRequestish(req) || !req.original.headers['date']) return false;
try {
var msskew = (this.config.acceptableDateSkew * 1000)
, now = new Date()
, then = new Date(req.original.headers['date'])
, diff = Math.abs(now.getTime() - then.getTime());
if (isNaN(diff)) diff = Infinity;
return diff < msskew;
}
catch (err) {
this.log(err);
return false;
}
};
/////////
Hmmac.schemes = schemeLoader;
Hmmac.middleware = function(opts, customResponder) {
var hmmac = !!opts && opts instanceof Hmmac ? opts : new Hmmac(opts);
if (hmmac.config.credentialProvider === defCredentialProvider) throw new Error('Hmmac::middleware requires a credentialProvider to work');
customResponder = customResponder || function(valid, req, res, next) {
if (true === valid) {
return next();
}
else {
res.statusCode = 401;
if (hmmac.config.wwwAuthenticateRealm) {
res.setHeader('WWW-Authenticate', hmmac.config.scheme.getServiceLabel.call(hmmac) + ' realm="' + hmmac.config.wwwAuthenticateRealm.replace(/"/g, '\'') + '"');
}
return next(new Error('Unauthorized'));
}
};
return function (req, res, next) {
hmmac.validate(req, function(valid, key) {
if (customResponder.length === 5) {
return customResponder.apply(this, [valid, key, req, res, next]);
}
else {
return customResponder.apply(this, [valid, req, res, next]);
}
});
};
};
//////////
module.exports = Hmmac;
| mit |
groupdocs-comparison/GroupDocs.Comparison-for-Java | Demos/Dropwizard/src/main/java/com/groupdocs/ui/common/resources/Resources.java | 8526 | package com.groupdocs.ui.common.resources;
import com.google.common.collect.Lists;
import com.groupdocs.ui.common.config.GlobalConfiguration;
import com.groupdocs.ui.common.exception.TotalGroupDocsException;
import io.dropwizard.jetty.ConnectorFactory;
import io.dropwizard.jetty.HttpConnectorFactory;
import io.dropwizard.server.SimpleServerFactory;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;
import java.io.*;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.groupdocs.ui.common.util.Utils.getFreeFileName;
/**
* Resources
*
* @author Aspose Pty Ltd
*/
public abstract class Resources {
protected final String DEFAULT_CHARSET = "UTF-8";
protected final GlobalConfiguration globalConfiguration;
private static final ZoneId GMT = ZoneId.of("GMT");
/**
* Get path to storage. Different for different products
*
* @param params parameters for calculating the path
* @return path to files storage
*/
protected abstract String getStoragePath(Map<String, Object> params);
/**
* Internal upload file into server
*
* @param documentUrl url for document
* @param inputStream file stream
* @param fileDetail file description
* @param rewrite flag for rewriting file
* @param params parameters for creating path to files storage
* @return path to file in storage
*/
protected String uploadFile(String documentUrl, InputStream inputStream, FormDataContentDisposition fileDetail, boolean rewrite, Map<String, Object> params) {
InputStream uploadedInputStream = null;
String pathname;
try {
String fileName;
if (StringUtils.isEmpty(documentUrl)) {
// get the InputStream to store the file
uploadedInputStream = inputStream;
fileName = fileDetail.getFileName();
} else {
// get the InputStream from the URL
URL url = new URL(documentUrl);
uploadedInputStream = url.openStream();
fileName = FilenameUtils.getName(url.getPath());
}
// get documents storage path
String documentStoragePath = getStoragePath(params);
// save the file
pathname = String.format("%s%s%s", documentStoragePath, File.separator, fileName);
File file = new File(pathname);
// check rewrite mode
if (rewrite) {
// save file with rewrite if exists
Files.copy(uploadedInputStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} else {
if (file.exists()){
// get file with new name
file = getFreeFileName(documentStoragePath, fileName);
}
// save file with out rewriting
Path path = file.toPath();
Files.copy(uploadedInputStream, path);
pathname = path.toString();
}
} catch(Exception ex) {
throw new TotalGroupDocsException(ex.getMessage(), ex);
} finally {
try {
uploadedInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return pathname;
}
/**
* Date formats with time zone as specified in the HTTP RFC.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.1">Section 7.1.1.1 of RFC 7231</a>
*/
private static final DateTimeFormatter[] DATE_FORMATTERS = new DateTimeFormatter[] {
DateTimeFormatter.RFC_1123_DATE_TIME,
DateTimeFormatter.ofPattern("EEEE, dd-MMM-yy HH:mm:ss zz", Locale.US),
DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss yyyy",Locale.US).withZone(GMT)
};
/**
* Fill Header Content-disposition parameter for download file
*
* @param response http response to fill header
* @param fileName name of file
*/
protected void fillResponseHeaderDisposition(HttpServletResponse response, String fileName) {
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
}
/**
* Download file
*
* @param response http response
* @param pathToFile path to file
*/
protected void downloadFile(HttpServletResponse response, String pathToFile) {
String fileName = FilenameUtils.getName(pathToFile);
// don't delete, should be before writing
fillResponseHeaderDisposition(response, fileName);
long length;
try (InputStream inputStream = new FileInputStream(pathToFile);
OutputStream outputStream = response.getOutputStream()){
// download the document
length = IOUtils.copyLarge(inputStream, outputStream);
} catch (Exception ex){
throw new TotalGroupDocsException(ex.getMessage(), ex);
}
// set response content disposition
addFileDownloadHeaders(response, fileName, length);
}
/**
* Constructor
* @param globalConfiguration global application configuration
* @throws UnknownHostException
*/
public Resources(GlobalConfiguration globalConfiguration) throws UnknownHostException {
this.globalConfiguration = globalConfiguration;
// set HTTP port
SimpleServerFactory serverFactory = (SimpleServerFactory) globalConfiguration.getServerFactory();
ConnectorFactory connector = serverFactory.getConnector();
globalConfiguration.getServer().setHttpPort(((HttpConnectorFactory) connector).getPort());
// set host address
String hostAddress = globalConfiguration.getApplication().getHostAddress();
if (StringUtils.isEmpty(hostAddress) || hostAddress.startsWith("${")) {
globalConfiguration.getApplication().setHostAddress(InetAddress.getLocalHost().getHostAddress());
}
}
/**
* Fill header HTTP response with file data
*/
public void addFileDownloadHeaders(HttpServletResponse response, String fileName, Long fileLength) {
Map<String, List<String>> fileDownloadHeaders = createFileDownloadHeaders(fileName, fileLength, MediaType.APPLICATION_OCTET_STREAM);
for (Map.Entry<String, List<String>> entry : fileDownloadHeaders.entrySet()) {
for (String value : entry.getValue()) {
response.addHeader(entry.getKey(), value);
}
}
}
/**
* Get headers for downloading files
*/
private static Map<String, List<String>> createFileDownloadHeaders(String fileName, Long fileLength, String mediaType) {
Map<String, List<String>> httpHeaders = new HashMap<>();
httpHeaders.put("Content-disposition", Lists.newArrayList("attachment; filename=" + fileName));
httpHeaders.put("Content-Type", Lists.newArrayList(mediaType));
httpHeaders.put("Content-Description", Lists.newArrayList("File Transfer"));
httpHeaders.put("Content-Transfer-Encoding", Lists.newArrayList("binary"));
httpHeaders.put("Expires", Lists.newArrayList(formatDate(0)));
httpHeaders.put("Cache-Control", Lists.newArrayList("must-revalidate"));
httpHeaders.put("Pragma", Lists.newArrayList("public"));
if (fileLength != null) {
httpHeaders.put("Content-Length", Lists.newArrayList(Long.toString(fileLength)));
}
return httpHeaders;
}
private static String formatDate(long date) {
Instant instant = Instant.ofEpochMilli(date);
ZonedDateTime time = ZonedDateTime.ofInstant(instant, GMT);
return DATE_FORMATTERS[0].format(time);
}
}
| mit |
callemall/material-ui | packages/material-ui-icons/src/CopyrightRounded.js | 465 | import * as React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" /><path d="M14 8h-4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1c0-.55-.45-1-1-1s-1 .45-1 1h-2v-4h2c0 .55.45 1 1 1s1-.45 1-1V9c0-.55-.45-1-1-1z" /></React.Fragment>
, 'CopyrightRounded');
| mit |
SamDelgado/samson.js | src/component/loadEvents.js | 1475 |
import Async from 'async-lite';
import { SamsonApp } from '../index.js';
import getTopParent from '../utils/getTopParent.js';
export default function loadEvents(callback) {
var self = this;
Async.parallel({
loadDOMEvents: function(loadDOMEvents_cb) {
if (!self.__loadedDOMEvents.length) {
var parent = getTopParent(self);
var parent_element = parent.element;
var parent_delegate = parent.delegate;
Async.each(self.__DOMEvents, function(event, cb) {
if (event.selector) {
parent_delegate.on(event.type, event.selector, event.handler, event.onCapture);
} else {
parent_element.addEventListener(event.type, event.handler, event.onCapture);
}
self.__loadedDOMEvents.push(event);
cb();
}, function() {
loadDOMEvents_cb();
});
} else {
loadDOMEvents_cb();
}
},
loadAppEvents: function(loadAppEvents_cb) {
if (!self.__loadedAppEvents.length) {
Async.each(self.__AppEvents, function(event, cb) {
SamsonApp.on(event.type, event.handler, self);
self.__loadedAppEvents.push(event);
cb();
}, function() {
loadAppEvents_cb();
});
} else {
loadAppEvents_cb();
}
}
}, function() {
if (callback) callback();
});
}
| mit |
msgpack4z/msgpack4z-core | src/test/scala/msgpack4z/UnionGen.scala | 2096 | package msgpack4z
import java.math.BigInteger
import scalaprops._
object UnionGen {
val booleanGen: Gen[MsgpackUnion] =
Gen.elements(
MsgpackUnion.True,
MsgpackUnion.False
)
val longGen: Gen[MsgpackUnion] =
Gen.from1(MsgpackLong)
val ulongGen: Gen[MsgpackUnion] =
Gen
.chooseLong(0, Long.MaxValue)
.flatMap(i =>
Gen.elements(
MsgpackULong(BigInteger.valueOf(i)),
MsgpackULong(BigInteger.valueOf(i).add(BigInteger.valueOf(i - 1L)))
)
)
val integerGen: Gen[MsgpackUnion] =
Gen.oneOf(ulongGen, longGen)
implicit val scalaDoubleGen: Gen[Double] =
Gen[Long].map { n =>
java.lang.Double.longBitsToDouble(n) match {
case x if x.isNaN => n.toDouble
case x => x
}
}
implicit val scalaFloatGen: Gen[Float] =
Gen[Int].map { n =>
java.lang.Float.intBitsToFloat(n) match {
case x if x.isNaN => n.toFloat
case x => x
}
}
val doubleGen: Gen[MsgpackUnion] =
Gen.oneOf(
Gen[Double].map(MsgpackUnion.double),
Gen[Float].map(MsgpackUnion.float)
)
val numberGen: Gen[MsgpackUnion] =
Gen.oneOf(integerGen, doubleGen)
val stringGen: Gen[MsgpackUnion] =
Gen.alphaNumString.map(MsgpackString)
val binaryGen: Gen[MsgpackUnion] =
Gen.from1(MsgpackBinary)
val unionGen0: Gen[MsgpackUnion] =
Gen.frequency(
1 -> Gen.value(MsgpackUnion.nil),
1 -> booleanGen,
6 -> numberGen,
6 -> stringGen,
3 -> binaryGen
)
val arrayGen: Gen[MsgpackUnion] =
Gen.list(unionGen0).map(MsgpackArray)
val mapGen: Gen[MsgpackUnion] =
Gen.mapGen(unionGen0, unionGen0).map(MsgpackMap)
val extGen: Gen[MsgpackExt] =
Gen.from2(MsgpackExt.apply)
val unionWithoutExtGen: Gen[MsgpackUnion] =
Gen.oneOf(
unionGen0,
arrayGen,
mapGen,
stringGen,
binaryGen
)
implicit val unionGen: Gen[MsgpackUnion] =
Gen.oneOf(
unionGen0,
arrayGen,
mapGen,
stringGen,
extGen.map(x => x),
binaryGen
)
}
| mit |
xuan6/admin_dashboard_local_dev | node_modules/react-icons-kit/md/ic_important_devices.js | 507 | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var ic_important_devices = exports.ic_important_devices = { "viewBox": "0 0 24 24", "children": [{ "name": "path", "attribs": { "d": "M23 11.01L18 11c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-9c0-.55-.45-.99-1-.99zM23 20h-5v-7h5v7zM20 2H2C.89 2 0 2.89 0 4v12c0 1.1.89 2 2 2h7v2H7v2h8v-2h-2v-2h2v-2H2V4h18v5h2V4c0-1.11-.9-2-2-2zm-8.03 7L11 6l-.97 3H7l2.47 1.76-.94 2.91 2.47-1.8 2.47 1.8-.94-2.91L15 9h-3.03z" } }] }; | mit |
protechdm/CompareCloudware | CompareCloudware.Web/Models/SearchFiltersModelTwoColumn.cs | 1912 | using CompareCloudware.Web;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
namespace CompareCloudware.Web.Models
{
public class SearchFiltersModelTwoColumn : BaseModel
{
public SearchFiltersModelTwoColumn()
{
}
public SearchFiltersModelTwoColumn(ICustomSession session)
{
base.CustomSession = session;
}
[Display(Name="Categories")]
public IList<CategoryModel> Categories { get; set; }
public int? ChosenCategoryID { get; set; }
public int? ChosenNumberOfUsers { get; set; }
[Display(Name="Users")]
public IList<NumberOfUsersModel> NumberOfUsers { get; set; }
public int? PreviouslyChosenCategoryID { get; set; }
[Display(Name="Search Filters")]
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersBrowsers { get; set; }
public IEnumerable<SearchFilterModelOneColumn> SearchFiltersFeatures { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersLanguages { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersMobilePlatforms { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersOperatingSystems { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersDevices { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersSupportDays { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersSupportHours { get; set; }
public IEnumerable<SearchFilterModelTwoColumn> SearchFiltersSupportTypes { get; set; }
public IEnumerable<SearchFilterModelOneColumn> SearchFiltersTimeZones { get; set; }
[Display(Name="Test Value")]
public string TestValue { get; set; }
}
}
| mit |
jepegit/cellpy | dev_utils/helpers/find_bugs.py | 837 | """utility for finding bugs / fixing edge-cases"""
import os
import sys
import time
from pathlib import Path
print(f"running {sys.argv[0]}")
import cellpy
from cellpy import log
from cellpy import cellreader
from cellpy.parameters import prms
prms.Reader.use_cellpy_stat_file = False
prms.Reader.cycle_mode = "cathode"
prms.Reader.sorted_data = False
log.setup_logging(default_level="DEBUG", custom_log_dir=os.getcwd())
datapath = "/Users/jepe/scripting/cellpy/dev_data/bugfixing"
filename = Path(datapath) / "20180919_FC_LFP2_cen14_01_cc_01.res"
assert os.path.isfile(filename)
d = cellreader.CellpyData()
d.from_raw(filename)
d.set_mass(0.12)
d.make_step_table()
d.make_summary()
# checking extracting cycles
n = d.get_number_of_cycles()
c = d.get_cycle_numbers()
# checking creating dqdv
cc = d.get_cap()
d.to_csv(datapath)
| mit |
MOIPA/J2eeStudy | XML/宠物管理系统CS架构/src/petCon/Client.java | 3726 | package petCon;
import javax.swing.*;
import java.awt.*;
import java.awt.List;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import javax.swing.event.*;
public class Client {
public static void main(String[] args) {
new Fram().inititalFrm();
}
}
class Fram{
constructDao con = new constructDao();
private JPanel midpet = new JPanel();
private JPanel left = new JPanel();
private JPanel mid = new JPanel();
private JPanel right = new JPanel();
private JFrame frm= new JFrame("¹ÜÀíϵͳ1.0");
private JLabel stu = new JLabel("ѧÉú");
private JLabel pet = new JLabel("³èÎï");
private JLabel petStatu = new JLabel("³èÎï״̬");
private JTextArea petText = new JTextArea();
private JButton addstu = new JButton("Ìí¼ÓѧÉú");
private JButton delstu = new JButton("ɾ³ýѧÉú");
private JButton addpet = new JButton("Ìí¼Ó³èÎï");
private JButton delpet = new JButton("ɾ³ýѧÉú");
public void inititalFrm(){
frm.setBounds(700,200,900,600);
frm.setLayout(null);
//³õʼ»¯×é¼þ
initialLeft(frm);
initialmid(frm);
initialright(frm);
//Ìí¼ÓÃæ°å
frm.add(midpet);
frm.add(left);
frm.add(mid);
frm.add(right);
//¶ÁȡѧÉú³èÎï
readStudent(left,midpet);
frm.setVisible(true);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void initialLeft(JFrame frm){
left.setLayout(null);
stu.setBounds(100, 130, 100, 50);
addstu.setBounds(70, 20, 120, 50);
delstu.setBounds(70, 70, 120, 50);
left.setBounds(0, 0, 300, 600);
left.add(stu);left.add(addstu);left.add(delstu);
}
public void initialmid(JFrame frm){
mid.setLayout(null);
pet.setBounds(100, 130, 100, 50);
addpet.setBounds(70, 20, 120, 50);
delpet.setBounds(70, 70, 120, 50);
mid.setBounds(300, 0, 300, 170);
mid.add(pet);mid.add(addpet);mid.add(delpet);
midpet.setLayout(null);
midpet.setBounds(300, 180, 300, 420);
}
public void initialright(JFrame frm){
right.setLayout(null);
petStatu.setBounds(100, 50, 120, 50);
petText.setBounds(50, 100, 200, 400);
right.add(petStatu);
right.add(petText);
right.setBounds(600, 0, 300, 600);
}
public void readStudent(JPanel p,JPanel pets){
int y=180;
java.util.List<Student> lists = con.getALLStudent();
int size = lists.size();
JButton[] buts = new JButton[size];
for(int i=0;i<size;i++){
buts[i]=new JButton(lists.get(i).getName());
buts[i].setBounds(50, y, 120, 50);
y+=50;
p.add(buts[i]);
//
// readPets("ÌÆÈñ",pets);
buts[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JButton but = (JButton)e.getSource();
readPets(but.getText(),pets);
// System.out.println(but.getText());
}
});
}
}
public void readPets(String mname,JPanel p){
p.removeAll();
java.util.List<Student> lists = con.getALLStudent();
Student stu = null;
for(int i=0;i<lists.size();i++){
if(lists.get(i).getName().equals(mname)){
stu = lists.get(i);
}
}
// System.out.println(stu.getName());
java.util.List<Pet> plists = con.getStudentPet(stu);
int y = 0;
// System.out.println(plists.get(0).getName());
JButton[] buts = new JButton[plists.size()];
for(int i=0;i<plists.size();i++){
buts[i]=new JButton(plists.get(i).getName());
buts[i].setBounds(50, y, 120, 50);
y+=50;
p.add(buts[i]);
p.repaint();
buts[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JButton but = (JButton) e.getSource();
Pet sel = con.getPetByName(but.getText());
String info = "Ãû×Ö:"+sel.getName()+"\r\nÄêÁä:"+sel.getAge()+"\r\nÐÔ±ð:"+sel.getSex();
petText.setText(info);
}
});
}
}
}
| mit |
8th-mile/android-publicity | app/src/main/java/com/a8thmile/rvce/a8thmile/events/register/RegisterInteractor.java | 1154 | package com.a8thmile.rvce.a8thmile.events.register;
import com.a8thmile.rvce.a8thmile.models.EventResponse;
import com.a8thmile.rvce.a8thmile.models.MyEventResponse;
/**
* Created by vignesh on 24/1/17.
*/
public interface RegisterInteractor {
public void callRegisterApi(String event_id,String user_id,String token,onRegisterCalledListener listener);
public void callWishListApi(String event_id,String user_id,String token,onRegisterCalledListener listener);
public void callWishListGetApi(String user_id,String token,onWishListGotListener listener);
public void callMyEventListApi(String user_id,String token,onMyEventListener listener);
public interface onRegisterCalledListener
{
public void onSuccess(String message);
public void onFailure(String message);
}
public interface onWishListGotListener
{
public void onSuccess(EventResponse eventResponse);
public void onWishListFailure(String message);
}
public interface onMyEventListener
{
public void onSuccess(MyEventResponse eventResponse);
public void onMyEventFailure(String message);
}
}
| mit |
fosterfarrell9/mampf | db/interactions_migrate/20191211160621_create_consumptions.rb | 210 | class CreateConsumptions < ActiveRecord::Migration[6.0]
def change
create_table :consumptions do |t|
t.integer :medium_id
t.text :sort
t.text :mode
t.timestamps
end
end
end
| mit |
cryptodevis/hashold | src/qt/locale/bitcoin_zh_TW.ts | 113385 | <?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 Hashcoin</source>
<translation>關於莱特幣</translation>
</message>
<message>
<location line="+39"/>
<source><b>Hashcoin</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 Hashcoin 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 Hashcoin 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 Hashcoin 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 Hashcoin 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 Hashcoin 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 HASHCOINS</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>Hashcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your hashcoins 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 Hashcoin</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 Hashcoin address</source>
<translation>付錢到莱特幣位址</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Hashcoin</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>Hashcoin</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 Hashcoin</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 Hashcoin addresses to prove you own them</source>
<translation>用莱特幣位址簽署訊息來證明那是你的</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Hashcoin 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>Hashcoin client</source>
<translation>莱特幣客戶端軟體</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Hashcoin 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 Hashcoin 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. Hashcoin 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 Hashcoin 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>Hashcoin-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 Hashcoin after logging in to the system.</source>
<translation>在登入系統後自動啓動莱特幣.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Hashcoin 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 Hashcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>自動在路由器上開啟 Hashcoin 的客戶端通訊埠. 只有在你的路由器支援 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 Hashcoin 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 Hashcoin.</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 Hashcoin 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 Hashcoin.</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 Hashcoin 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 hashcoin: click-to-pay handler</source>
<translation>無法啟動 hashcoin 隨按隨付處理器</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 Hashcoin-Qt help message to get a list with possible Hashcoin 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>Hashcoin - Debug window</source>
<translation>莱特幣 - 除錯視窗</translation>
</message>
<message>
<location line="+25"/>
<source>Hashcoin Core</source>
<translation>莱特幣核心</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>除錯紀錄檔</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Hashcoin 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 Hashcoin 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. HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</source>
<translation>付款的目標位址 (比如說 HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</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 Hashcoin address (e.g. HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</source>
<translation>輸入莱特幣位址 (比如說 HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</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. HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</source>
<translation>用來簽署訊息的位址 (比如說 HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</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 Hashcoin 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. HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</source>
<translation>簽署該訊息的位址 (比如說 HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Hashcoin 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 Hashcoin address (e.g. HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</source>
<translation>輸入莱特幣位址 (比如說 HnU183x5aaWYZvydJPLRa4AMnERj4nHecw)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>按"訊息簽署"來產生簽章</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Hashcoin 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 Hashcoin 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>Hashcoin 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 hashcoind</source>
<translation>送指令給 -server 或 hashcoind
</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: hashcoin.conf)</source>
<translation>指定設定檔 (預設: hashcoin.conf)
</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: hashcoind.pid)</source>
<translation>指定行程識別碼檔案 (預設: hashcoind.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=hashcoinrpc
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 "Hashcoin Alert" admin@foo.com
</source>
<translation>%s, 你必須要在以下設定檔中設定 RPC 密碼(rpcpassword):
%s
建議你使用以下隨機產生的密碼:
rpcuser=hashcoinrpc
rpcpassword=%s
(你不用記住這個密碼)
使用者名稱(rpcuser)和密碼(rpcpassword)不可以相同!
如果設定檔還不存在, 請在新增時, 設定檔案權限為"只有主人才能讀取".
也建議你設定警示通知, 發生問題時你才會被通知到;
比如說設定為:
alertnotify=echo %%s | mail -s "Hashcoin 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. Hashcoin 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 Hashcoin 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 Hashcoin Wiki for SSL setup instructions)</source>
<translation>SSL 選項: (SSL 設定程序請見 Hashcoin 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 Hashcoin</source>
<translation>載入檔案 wallet.dat 失敗: 此錢包需要新版的 Hashcoin</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Hashcoin 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. Hashcoin 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> | mit |
silkcoin-dev/silkcoin | src/qt/qrcodedialog.cpp | 4311 | #include "qrcodedialog.h"
#include "ui_qrcodedialog.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include <QPixmap>
#include <QUrl>
#include <qrencode.h>
QRCodeDialog::QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent) :
QDialog(parent),
ui(new Ui::QRCodeDialog),
model(0),
address(addr)
{
ui->setupUi(this);
setWindowTitle(QString("%1").arg(address));
ui->chkReqPayment->setVisible(enableReq);
ui->lblAmount->setVisible(enableReq);
ui->lnReqAmount->setVisible(enableReq);
ui->lnLabel->setText(label);
ui->btnSaveAs->setEnabled(false);
genCode();
}
QRCodeDialog::~QRCodeDialog()
{
delete ui;
}
void QRCodeDialog::setModel(OptionsModel *model)
{
this->model = model;
if (model)
connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
// update the display unit, to not use the default ("BTC")
updateDisplayUnit();
}
void QRCodeDialog::genCode()
{
QString uri = getURI();
if (uri != "")
{
ui->lblQRCode->setText("");
QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1);
if (!code)
{
ui->lblQRCode->setText(tr("Error encoding URI into QR Code."));
return;
}
myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
myImage.fill(0xffffff);
unsigned char *p = code->data;
for (int y = 0; y < code->width; y++)
{
for (int x = 0; x < code->width; x++)
{
myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff));
p++;
}
}
QRcode_free(code);
ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300));
ui->outUri->setPlainText(uri);
}
}
QString QRCodeDialog::getURI()
{
QString ret = QString("silkcoin:%1").arg(address);
int paramCount = 0;
ui->outUri->clear();
if (ui->chkReqPayment->isChecked())
{
if (ui->lnReqAmount->validate())
{
// even if we allow a non BTC unit input in lnReqAmount, we generate the URI with BTC as unit (as defined in BIP21)
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, ui->lnReqAmount->value()));
paramCount++;
}
else
{
ui->btnSaveAs->setEnabled(false);
ui->lblQRCode->setText(tr("The entered amount is invalid, please check."));
return QString("");
}
}
if (!ui->lnLabel->text().isEmpty())
{
QString lbl(QUrl::toPercentEncoding(ui->lnLabel->text()));
ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl);
paramCount++;
}
if (!ui->lnMessage->text().isEmpty())
{
QString msg(QUrl::toPercentEncoding(ui->lnMessage->text()));
ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg);
paramCount++;
}
// limit URI length to prevent a DoS against the QR-Code dialog
if (ret.length() > MAX_URI_LENGTH)
{
ui->btnSaveAs->setEnabled(false);
ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message."));
return QString("");
}
ui->btnSaveAs->setEnabled(true);
return ret;
}
void QRCodeDialog::on_lnReqAmount_textChanged()
{
genCode();
}
void QRCodeDialog::on_lnLabel_textChanged()
{
genCode();
}
void QRCodeDialog::on_lnMessage_textChanged()
{
genCode();
}
void QRCodeDialog::on_btnSaveAs_clicked()
{
QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Images (*.png)"));
if (!fn.isEmpty())
myImage.scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE).save(fn);
}
void QRCodeDialog::on_chkReqPayment_toggled(bool fChecked)
{
if (!fChecked)
// if chkReqPayment is not active, don't display lnReqAmount as invalid
ui->lnReqAmount->setValid(true);
genCode();
}
void QRCodeDialog::updateDisplayUnit()
{
if (model)
{
// Update lnReqAmount with the current unit
ui->lnReqAmount->setDisplayUnit(model->getDisplayUnit());
}
}
| mit |
marketplacer/barcodevalidation | spec/lib/barcodevalidation/gtin_spec.rb | 3260 | # frozen_string_literal: true
require "barcodevalidation/mixin/has_check_digit"
require "barcodevalidation/mixin/value_object"
require "barcodevalidation/digit"
require "barcodevalidation/digit_sequence"
require "barcodevalidation/gtin"
RSpec.describe BarcodeValidation::GTIN do
subject(:gtin) { described_class.new(input) }
context "with a valid UPC" do
let(:input) { 123_456_789_012 }
it { is_expected.to be_valid }
end
context "with a valid UPC where the check digit is 0" do
let(:input) { 123_456_789_050 }
it { is_expected.to be_valid }
end
context "with a UPC with an invalid check digit" do
let(:input) { 123_456_789_011 }
it { is_expected.to_not be_valid }
end
context "with a sequence of digits of unknown length" do
let(:input) { 123_456_789_012_345_678 }
it { is_expected.to_not be_valid }
end
context "with a non-numeric input" do
let(:input) { "abcdef" }
it { is_expected.to_not be_valid }
end
describe "sequence methods" do
let(:input) { 12_345_678 }
subject(:sequence) { gtin.reverse }
it { is_expected.to_not be_a described_class }
end
describe "factory interface" do
context "for 8-digit input" do
let(:input) { "12345678" }
it "constructs a BarcodeValidation::GTIN::GTIN8" do
expect(gtin.is_a?(BarcodeValidation::GTIN::GTIN8)).to be_truthy
end
end
context "for 12-digit input" do
let(:input) { "123456789012" }
it "constructs a BarcodeValidation::GTIN::GTIN12" do
expect(gtin.is_a?(BarcodeValidation::GTIN::GTIN12)).to be_truthy
end
end
context "for 13-digit input" do
let(:input) { "1234567890123" }
it "constructs a BarcodeValidation::GTIN::GTIN13" do
expect(gtin.is_a?(BarcodeValidation::GTIN::GTIN13)).to be_truthy
end
end
context "for 14-digit input" do
let(:input) { "12345678901234" }
it "constructs a BarcodeValidation::GTIN::GTIN14" do
expect(gtin.is_a?(BarcodeValidation::GTIN::GTIN14)).to be_truthy
end
end
context "for non-standard input length" do
let(:input) { "1234" }
it "constructs a BarcodeValidation::InvalidGTIN" do
expect(gtin.is_a?(BarcodeValidation::InvalidGTIN)).to be_truthy
end
end
end
describe "conversion" do
context "when converting from a superset down to a subset" do
let(:gtin8) { gtin.to_gtin_8 }
context "for a zero-padded code" do
let(:input) { "000012345670" }
it "returns an instance of the concrete class for that subset" do
expect(gtin8.is_a?(BarcodeValidation::GTIN::GTIN8)).to be_truthy
end
end
context "for a code that is not zero-padded" do
let(:input) { "123456789012" }
let(:error_message) do
"invalid value for BarcodeValidation::GTIN::GTIN8(): #{input.inspect}"
end
let(:is_an_invalid_gtin) { gtin8.is_a?(BarcodeValidation::InvalidGTIN) }
it "returns a BarcodeValidation::InvalidGTIN instance" do
expect(is_an_invalid_gtin).to be_truthy
end
it "has a meaningful error message" do
expect(gtin8.error_message).to eq(error_message)
end
end
end
end
end
| mit |
greghoover/gluon | hase/hase.DevLib/Framework/Utility/AltFileProvider.cs | 559 | using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
namespace hase.DevLib.Framework.Utility
{
public class AltFileProvider : IFileProvider
{
public IFileInfo GetFileInfo(string subpath)
{
return new AltFileInfo(subpath);
}
public IDirectoryContents GetDirectoryContents(string subpath)
{
return new AltDirectoryContents();
}
public IChangeToken Watch(string filter)
{
return new AltChangeToken();
}
}
}
| mit |
hungpham2511/toppra | toppra/simplepath.py | 2329 | from typing import List, Union, Optional
import numpy as np
from scipy.interpolate import BPoly
from .interpolator import AbstractGeometricPath
class SimplePath(AbstractGeometricPath):
"""A class for representing continuous multi-dimentional function.
This geometric path is specified by positions, velocities
(optional) and acceleration (optional). Internally a scipy.PPoly
instance is used to store the path. The polynomial degree depends
on the input.
If velocity is not given, they will be computed automatically.
Parameters
------------
x:
"Time instances" of the waypoints.
y:
Function values at waypoints.
yd:
First-derivatives. If not given (None) will be computed
automatically.
"""
def __init__(
self,
x: np.ndarray,
y: np.ndarray,
yd: np.ndarray = None,
):
if len(y.shape) == 1:
y = y.reshape(-1, 1)
if yd is not None and len(yd.shape) == 1:
yd = yd.reshape(-1, 1)
self._x = x
self._y = y.astype(float)
self._yd = yd if yd is None else yd.astype(float)
self._polys = self._construct_polynomials()
def __call__(self, xi, order=0):
"""Evaluate the path at given position."""
ret = [poly.derivative(order)(xi) for poly in self._polys]
return np.array(ret).T
@property
def dof(self):
return self._y.shape[1]
@property
def path_interval(self):
return np.array([self._x[0], self._x[-1]], dtype=float)
@property
def waypoints(self):
return self._y
def _autofill_yd(self):
if self._yd is None:
_yd = np.zeros_like(self._y[:], dtype=float)
for i in range(1, len(_yd) - 1):
_yd[i] = (self._y[i + 1] - self._y[i - 1]) / (
self._x[i + 1] - self._x[i - 1]
)
else:
_yd = np.array(self._yd[:])
return _yd
def _construct_polynomials(self):
polys = []
_yd = self._autofill_yd()
for j in range(self._y.shape[1]):
y_with_derivatives = np.vstack((self._y[:, j], _yd[:, j])).T
poly = BPoly.from_derivatives(self._x, y_with_derivatives)
polys.append(poly)
return polys
| mit |
GameWorthy/ChompRabbit | Assets/Scripts/UI/SettingsMenu.cs | 986 | using System;
using UnityEngine;
public class SettingsMenu : MonoBehaviour
{
[SerializeField] private TextMesh soundText = null;
private bool soundIsOn = true;
void Start() {
soundIsOn = GameData.GlobalPlaySound;
SetText ();
}
void SetText() {
if (soundIsOn) {
soundText.text = "Sound: ON";
} else {
soundText.text = "Sound: OFF";
}
}
void OnSoundToggle() {
soundIsOn = !soundIsOn;
GameData.GlobalPlaySound = soundIsOn;
GameData.Save ();
SetText ();
}
void OpenGW() {
Application.OpenURL ("http://gameworthystudios.com/");
}
void OpenEmail() {
string email = "gameworthyfeedback@gmail.com";
string subject = MyEscapeURL("Game Worthy Support Request");
string body = MyEscapeURL("Please include your device details, such as model and operational system.");
Application.OpenURL("mailto:" + email + "?subject=" + subject + "&body=" + body);
}
string MyEscapeURL (string url) {
return WWW.EscapeURL(url).Replace("+","%20");
}
}
| mit |
3dseals/Bonnie3D | test/src/js/MirrorRTT.js | 241 | B3D.MirrorRTT = function ( width, height, options ) {
B3D.Mirror.call( this, width, height, options );
this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
};
B3D.MirrorRTT.prototype = Object.create( B3D.Mirror.prototype );
| mit |
kiyonori-matsumoto/tcl-ruby | lib/tcl/ruby/list_array.rb | 1993 | require 'forwardable'
module Tcl
module Ruby
class ListArray
extend Forwardable
def_delegators :@ary, :find, :any?
Array.public_instance_methods(false).each do |name|
define_method(name) do |*args, &block|
@ary.send(name, *args, &block)
end
end
def uniq!(&block)
@ary = @ary.reverse.uniq(&block).reverse
self
end
def uniq(&block)
dup.uniq!(&block)
end
def find_index_all
raise ArgumentError unless block_given?
r = []
@ary.each_with_index do |e, idx|
r << idx.to_s if yield(e)
end
r
end
def initialize(ary = [])
@ary = Array(ary).map(&:to_s)
@brackets = []
end
def clear
@ary = []
@brackets = []
end
def bracket_add(val)
@brackets[@ary.size] ||= []
@brackets[@ary.size] << val
end
def <<(buffer)
@ary << buffer.dup unless buffer.empty?
buffer.clear
buffer.init
self
end
def to_string
@ary.map!(&:to_tcl_string)
self
end
def to_list
@ary.map(&:to_tcl_list).join(' ')
end
def replace
@ary.size.times do |n|
@ary[n] = yield(@ary[n]) unless @ary[n].brace?
end
# @ary.map! { |m| m.brace? ? m : yield(m) }
self
end
def map!(&block)
@ary.each(&:init)
@ary.map!(&block)
self
end
def map(&block)
r = dup
r.map!(&block)
r
end
def [](arg)
if arg.is_a?(Range)
r = dup
r.ary = r.ary[arg]
r
else
@ary.[](arg)
end
end
def to_h
raise(TclArgumentError, 'list must have an even number of elements') if
@ary.size.odd?
Hash[@ary.each_slice(2).to_a]
end
protected
attr_accessor :ary
end
end
end
| mit |
jugglinmike/es6draft | src/test/scripts/suite/regress/bug4098.js | 512 | /*
* Copyright (c) 2012-2016 André Bargull
* Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms.
*
* <https://github.com/anba/es6draft>
*/
const {
assertSyntaxError
} = Assert;
// Elison not allowed in ArrayBindingPattern and ArrayAssignmentPattern after RestElement
// https://bugs.ecmascript.org/show_bug.cgi?id=4098
assertSyntaxError(`[...a,] = []`);
assertSyntaxError(`var [...a,] = []`);
assertSyntaxError(`let [...a,] = []`);
assertSyntaxError(`const [...a,] = []`);
| mit |
bjoberg/brettoberg.com | src/tests/components/footer.component.spec.ts | 2702 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
import { FooterComponent } from '../../app/components/footer/footer.component';
import { UserConfig } from '../../app/config/user.config';
describe('FooterComponent', () => {
let component: FooterComponent;
let fixture: ComponentFixture<FooterComponent>;
let el: DebugElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FooterComponent ],
imports: [ RouterTestingModule ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it(': should create', () => {
expect(component).toBeDefined();
});
it(': should initialize member variables', () => {
expect(component.email).toBe(UserConfig.about.email);
expect(JSON.stringify(component.social)).toBe(JSON.stringify(UserConfig.social));
});
it(': should contain #footer', () => {
el = fixture.debugElement.query(By.css('#footer'));
expect(el).not.toBe(undefined);
expect(el).not.toBe(null);
});
it(': should contain #footer--items-left', () => {
el = fixture.debugElement.query(By.css('#footer--items-left'));
expect(el).not.toBe(undefined);
expect(el).not.toBe(null);
});
it(': #footer--items-left should contain valid text', () => {
el = fixture.debugElement.query(By.css('#footer--items-left'));
const text = el.nativeElement.innerText;
expect(text).toBe('Brett Oberg - brett@obergmail.com');
});
it(': #footer--social should contain valid social items', () => {
el = fixture.debugElement.query(By.css('#footer--items-right'));
const nativeEl = el.nativeElement;
let i = 0;
for (const item of nativeEl.children) {
if (item.firstElementChild.id.includes('social')) {
expect(item.firstElementChild.href).toBe(UserConfig.social[i].url);
expect(item.firstElementChild.id).toBe(`footer--social-${UserConfig.social[i].title}`);
expect(item.firstElementChild.title).toBe(UserConfig.social[i].title);
expect(item.firstElementChild.firstElementChild.className).toBe(`fa ${UserConfig.social[i].fa_icon}`);
}
i++;
}
});
it(': #footer--copyright-information should contain valid text', () => {
el = fixture.debugElement.query(By.css('#footer--copyright-information'));
const text = el.nativeElement.innerText;
expect(text).toBe(`| ${new Date().getFullYear()}`);
});
});
| mit |
Mitali-Sodhi/CodeLingo | Dataset/ruby/onegem.rb | 541 | #---
# Excerpted from "Everyday Scripting in Ruby"
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/bmsft for more book information.
#---
module OneGem
ONEDIR = "test/data/one"
ONENAME = "one-0.0.1.gem"
ONEGEM = "#{ONEDIR}/#{ONENAME}"
def clear
FileUtils.rm_f ONEGEM
end
def build(controller)
Dir.chdir(ONEDIR) do
controller.gem "build one.gemspec"
end
end
def rebuild(controller)
clear
build(controller)
end
extend self
end
| mit |
houssem9/SysNews | src/SN/SysNewsBundle/Count/CountListener.php | 1784 | <?php
namespace SN\SysNewsBundle\Count;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use SN\SysNewsBundle\Entity\Connecte;
use Symfony\Bundle\DoctrineBundle\Registry;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class CountListener
{
protected $counthtml;
protected $doctrine;
public function __construct(ContainerInterface $container, CountHtml $counthtml, EntityManager $doctrine)
{
$this->counthtml = $counthtml;
$this->doctrine = $doctrine;
$this->container = $container;
}
public function processCount(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$connecte = new Connecte();
$ip = $this->container->get('request')->getClientIp();
$times = time();
$doctrine = $this->container->get('doctrine.orm.entity_manager');
$listIp = $this->doctrine->getRepository('SNSysNewsBundle:Connecte')->findAll();
if(!in_array($ip, $listIp))
{
$connecte->setIp($ip);
$connecte->setTimes($times);
$doctrine->persist($connecte);
$doctrine->flush();
}
else
{
$times = time();
$connecte->setTimes($times);
$doctrine->persist($connecte);
$doctrine->flush();
}
$time_5 = time()-(60*5);
if ($times < $time_5)
{
$connecte = $this->doctrine->getRepository('SNSysNewsBundle:Connecte')->findOneByTimes($times);
$doctrine->remove($connecte);
$doctrine->flush();
}
$nbvisit = $doctrine->getRepository('SNSysNewsBundle:Connecte')->getcountnumbervisit();
$rep = $this->counthtml->viewNbVisit($event->getResponse(), $nbvisit);
$event->setResponse($rep);
}
}
| mit |
Arragro/ArragroCMS.Examples | src/arragro.com.ContentTypes/Posts/MarkdownPost.cs | 1145 | using Arragro.Core.Common.RulesExceptions;
using ArragroCMS.Core.Web.Interfaces;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace arragro.com.ContentTypes.Post
{
[DisplayName("Markdown Post")]
public class MarkdownPost : RulesBase<MarkdownPost>
{
[Required]
[MaxLength(512)]
public string Title { get; set; }
public string Markdown { get; set; }
public decimal Version
{
get
{
return 1;
}
set
{
return;
}
}
public Type ConfigurationType => null;
public void Upgrade()
{
throw new NotImplementedException();
}
public void Validate(Guid urlRouteId, IServiceProvider serviceProvider)
{
ValidateModelPropertiesAndBuildRulesException(this);
var rulesExceptionCollection = ValidateModelPropertiesAndBuildRulesExceptionCollection(this, new ValidationParameters());
rulesExceptionCollection.ThrowException();
}
}
}
| mit |
Countly/countly-sdk-windows-phone | countlyCommon/countlyCommon/Entities/ExceptionEvent.cs | 9549 | /*
Copyright (c) 2012, 2013, 2014 Countly
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.
*/
using CountlySDK.Entities.EntityBase;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace CountlySDK.Entities
{
/// <summary>
/// This class holds the data about an application exception
/// </summary>
[DataContractAttribute]
internal class ExceptionEvent : IComparable<ExceptionEvent>
{
//device metrics
[DataMemberAttribute]
[JsonProperty("_os")]
public string OS { get; set; }
[DataMemberAttribute]
[JsonProperty("_os_version")]
public string OSVersion { get; set; }
[DataMemberAttribute]
[JsonProperty("_manufacture")]
public string Manufacture { get; set; }
[DataMemberAttribute]
[JsonProperty("_device")]
public string Device { get; set; }
[DataMemberAttribute]
[JsonProperty("_resolution")]
public string Resolution { get; set; }
[DataMemberAttribute]
[JsonProperty("_app_version")]
public string AppVersion { get; set; }
//state of device
[DataMemberAttribute]
[JsonProperty("_orientation")]
public string Orientation { get; set; }
[DataMemberAttribute]
[JsonProperty("_ram_current")]
public long? RamCurrent { get; set; }
[DataMemberAttribute]
[JsonProperty("_ram_total")]
public long? RamTotal { get; set; }
//bools
[DataMemberAttribute]
[JsonProperty("_online")]
public bool Online { get; set; }
//error info
[DataMemberAttribute]
[JsonProperty("_name")]
public string Name { get; set; }
[DataMemberAttribute]
[JsonProperty("_error")]
public string Error { get; set; }
[DataMemberAttribute]
[JsonProperty("_nonfatal")]
public bool NonFatal { get; set; }
[DataMemberAttribute]
[JsonProperty("_logs")]
public string Logs { get; set; }
[DataMemberAttribute]
[JsonProperty("_run")]
public long Run { get; set; }
//custom key/values provided by developers
[DataMemberAttribute]
[JsonProperty("_custom")]
public Dictionary<string, string> Custom { get; set; }
/// <summary>
/// Needed for JSON deserialization
/// </summary>
internal ExceptionEvent()
{ }
internal ExceptionEvent(string Error, string StackTrace, bool fatal, string breadcrumb, TimeSpan run, string appVersion, Dictionary<string, string> customInfo, DeviceBase DeviceData)
{
//device metrics
OS = DeviceData.OS;
OSVersion = DeviceData.OSVersion;
Manufacture = DeviceData.Manufacturer;
Device = DeviceData.DeviceName;
Resolution = DeviceData.Resolution;
AppVersion = appVersion;
//state of device
Orientation = DeviceData.Orientation;
RamCurrent = DeviceData.RamCurrent;
RamTotal = DeviceData.RamTotal;
//bools
Online = DeviceData.Online;
//error info
this.Name = Error;
this.Error = StackTrace;
if (this.Error == null || this.Error.Length == 0)
{
//in case stacktrace is empty, replace it with the error name
this.Error = this.Name;
}
NonFatal = !fatal;
Logs = breadcrumb;
Run = (long)run.TotalSeconds;
Custom = customInfo;
}
public int CompareTo(ExceptionEvent other)
{
if (!(OS == null && other.OS == null))
{
if (OS == null) { return -1; }
if (other.OS == null) { return 1; }
if (!OS.Equals(other.OS)) { return OS.CompareTo(other.OS); }
}
if (!(OSVersion == null && other.OSVersion == null))
{
if (OSVersion == null) { return -1; }
if (other.OSVersion == null) { return 1; }
if (!OSVersion.Equals(other.OSVersion)) { return OSVersion.CompareTo(other.OSVersion); }
}
if (!(Manufacture == null && other.Manufacture == null))
{
if (Manufacture == null) { return -1; }
if (other.Manufacture == null) { return 1; }
if (!Manufacture.Equals(other.Manufacture)) { return Manufacture.CompareTo(other.Manufacture); }
}
if (!(Device == null && other.Device == null))
{
if (Device == null) { return -1; }
if (other.Device == null) { return 1; }
if (!Device.Equals(other.Device)) { return Device.CompareTo(other.Device); }
}
if (!(Resolution == null && other.Resolution == null))
{
if (Resolution == null) { return -1; }
if (other.Resolution == null) { return 1; }
if (!Resolution.Equals(other.Resolution)) { return Resolution.CompareTo(other.Resolution); }
}
if (!(AppVersion == null && other.AppVersion == null))
{
if (AppVersion == null) { return -1; }
if (other.AppVersion == null) { return 1; }
if (!AppVersion.Equals(other.AppVersion)) { return AppVersion.CompareTo(other.AppVersion); }
}
if (!(Orientation == null && other.Orientation == null))
{
if (Orientation == null) { return -1; }
if (other.Orientation == null) { return 1; }
if (!Orientation.Equals(other.Orientation)) { return Orientation.CompareTo(other.Orientation); }
}
if (!(RamCurrent == null && other.RamCurrent == null))
{
if (RamCurrent == null) { return -1; }
if (other.RamCurrent == null) { return 1; }
if (!RamCurrent.Equals(other.RamCurrent)) { return RamCurrent.Value.CompareTo(other.RamCurrent.Value); }
}
if (!(RamTotal == null && other.RamTotal == null))
{
if (RamTotal == null) { return -1; }
if (other.RamTotal == null) { return 1; }
if (!RamTotal.Equals(other.RamTotal)) { return RamTotal.Value.CompareTo(other.RamTotal.Value); }
}
if (!Online.Equals(other.Online)) { return Online.CompareTo(other.Online); }
if (!(Name == null && other.Name == null))
{
if (Name == null) { return -1; }
if (other.Name == null) { return 1; }
if (!Name.Equals(other.Name)) { return Name.CompareTo(other.Name); }
}
if (!(Error == null && other.Error == null))
{
if (Error == null) { return -1; }
if (other.Error == null) { return 1; }
if (!Error.Equals(other.Error)) { return Error.CompareTo(other.Error); }
}
if (!NonFatal.Equals(other.NonFatal)) { return NonFatal.CompareTo(other.NonFatal); }
if (!(Logs == null && other.Logs == null))
{
if (Logs == null) { return -1; }
if (other.Logs == null) { return 1; }
if (!Logs.Equals(other.Logs)) { return Logs.CompareTo(other.Logs); }
}
if (!Run.Equals(other.Run)) { return Run.CompareTo(other.Run); }
if (!(OS == null && other.OS == null))
{
if (OS == null) { return -1; }
if (other.OS == null) { return 1; }
if (!OS.Equals(other.OS)) { return OS.CompareTo(other.OS); }
}
if (!(Custom == null && other.Custom == null))
{
if (Custom == null) { return -1; }
if (other.Custom == null) { return 1; }
if (!Custom.Count.Equals(other.Custom.Count)) { return Custom.Count.CompareTo(other.Custom.Count); }
foreach(var a in Custom.Keys)
{
if (!other.Custom.ContainsKey(a)) { return -1; }
if (!Custom[a].Equals(other.Custom[a])) { return Custom[a].CompareTo(other.Custom[a]); }
}
}
return 0;
}
}
}
| mit |
weebo-org/laravel | app/config/app.php | 7330 | <?php
return array(
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => true,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://localhost',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => 'xcWBDTTHDB7PEEhPfJqG7u19c1VFTWfV',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Foundation\Providers\CommandCreatorServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ComposerServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Foundation\Providers\KeyGeneratorServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Foundation\Providers\MaintenanceServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Foundation\Providers\OptimizeServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Foundation\Providers\PublisherServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Foundation\Providers\RouteListServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Foundation\Providers\ServerServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Foundation\Providers\TinkerServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
),
/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/
'manifest' => storage_path().'/meta',
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controllers\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
),
);
| mit |
tias79/jomnipod | src/main/java/com/github/jomnipod/datatypes/DataType.java | 1249 | /*
* Copyright (c) 2017 Mattias Eklöf <mattias.eklof@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.github.jomnipod.datatypes;
public interface DataType<T> {
public T value();
}
| mit |
bartonlp/updatesite | updatesite-preview.i.php | 4766 | <?php
// This is included by the program instantiating the UpdateSite class via updatesite.class.php
// This is the AJAX PART!!!
if($_GET['ajax']) {
// The Ajax part does not need the UpdateSite class.
// This part reads the 'page' file and replaces the '// START UpdateSite ...' marker with an array that fills the $item rather
// than filling it via the $u->getItem() function.
session_start(); // Start the session for the ajax part!
// The function part of this file sets up these session variables.
$title = $_SESSION['title'];
$bodytext = $_SESSION['bodytext'];
$itemname = $_SESSION['itemname'];
$page = $_SESSION['page'];
$title = preg_replace("/'/s", "'", $title);
$bodytext = preg_replace("/'/s", "'", $bodytext);
$date = date("Y-m-d H:i:s");
$item = "array(title=>'$title', bodytext=>'$bodytext', date=>'$date');";
$data = file_get_contents("$page");
$data = preg_replace("|// START UpdateSite $itemname.*?// END UpdateSite.*?\n|s", '$item=' . $item, $data);
// Remove the Admin Notice.
// Note we have to escape the paren and the $
$data = preg_replace('/if\(\$S->isAdmin.*?}/s', "", $data, 1);
// This works using an eval!
// I want the file to actually execute the PHP in it. That is execute it just like if
// the file was loaded via the server. All of the PHP in the file is executed and the
// results is output.
ob_start();
eval('?>' . $data);
$data = ob_get_clean();
$data = preg_replace("|<!-- Google Analitics -->.*<!-- END Google Analitics -->|s", "", $data);
header("Content-type: text/html");
echo $data;
exit(); // All DONE EXIT
}
// This file is included in the site specific updatesite2.php (or whatever it is called -- the second part of the site specific
// pair of files).
// This function is then called from updatesite.class.php (UpdateSite class) 'previewpage' function. 'previewpage' check to see
// that the function exists. If it does not exist then a message is presented and the user is given the option to proceed to the
// post page without a preview option.
// If this function does exist it is passed the "$this" of the UpdateSite class, the id of the item, the page name, itemname, and
// the title and bodytext text.
// This function then starts a session and sets the session variables for the AJAX part above.
// It then presents an <iframe> that is filled via the AJAX logic and a form that has a 'create' and 'discard' button.
// The iframe has the full page of the 'page' file with the insert.
// The AJAX ifram is '<iframe id="frame" style="width: 100%; height: 100%;" src="$self?ajax=1"></iframe>'. The Javascript in the
// header handles the Ajax and the buttons.
function updatesite_preview($classthis, $id, $page, $itemname, $title, $bodytext) {
session_start();
$_SESSION['title'] = $title = stripslashes($title);
$_SESSION['bodytext'] = $bodytext = stripslashes($bodytext);
$_SESSION['itemname'] = $itemname;
$_SESSION['page'] = $page;
$self = $classthis->self; // this self is not this file but the one that called us!
// $title = str_replace("\\", "", $title);
// $bodytext = str_replace("\\", "", $bodytext);
$u_title = urlencode($title);
$u_bodytext = urlencode($bodytext);
echo <<<EOF
<html>
<head>
<title>UpdateSite Preview</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("#reset").click(function() {
$("#subButton").hide();
$("#reset").hide();
$("iframe").fadeOut(1000, function() {
// The ajax needs time to do its thing so do a 1 second hide
// before doing the back
// window.history.back();
$("form input[name=page]").val("reedit");
$("form").submit();
});
return false;
});
$("#subButton").click(function() {
$("form").submit();
});
});
</script>
<style type="text/css">
#subButton {
font-size: 1.5em;
background-color: green;
color: white;
padding: 20px;
}
#reset {
font-size: 1.5em;
background-color: red;
color: white;
padding: 20px;
}
</style>
</head>
<body>
<iframe id="frame" style="width: 100%; height: 100%;" src="$self?ajax=1"></iframe>
<form action="$self" method="post">
<input type="hidden" name="title" value="$u_title"/>
<input type="hidden" name="bodytext" value="$u_bodytext"/>
<input type="hidden" name="id" value="{$id}" />
<input type="hidden" name="page" value="Post"/>
<input type="hidden" name="pagename" value="$page"/>
<input type="hidden" name="itemname" value="$itemname"/>
<button id="subButton">Create Article</button>
<button id="reset">Discard and return to editor panel</button>
</form>
</body>
</html>
EOF;
}
| mit |
ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/tensorflow/core/framework/resource_handle_pb2.py | 4066 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/framework/resource_handle.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='tensorflow/core/framework/resource_handle.proto',
package='tensorflow',
syntax='proto3',
serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow\"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tB/\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01\xf8\x01\x01\x62\x06proto3')
)
_RESOURCEHANDLEPROTO = _descriptor.Descriptor(
name='ResourceHandleProto',
full_name='tensorflow.ResourceHandleProto',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='device', full_name='tensorflow.ResourceHandleProto.device', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='container', full_name='tensorflow.ResourceHandleProto.container', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='name', full_name='tensorflow.ResourceHandleProto.name', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='hash_code', full_name='tensorflow.ResourceHandleProto.hash_code', index=3,
number=4, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='maybe_type_name', full_name='tensorflow.ResourceHandleProto.maybe_type_name', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=63,
serialized_end=177,
)
DESCRIPTOR.message_types_by_name['ResourceHandleProto'] = _RESOURCEHANDLEPROTO
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ResourceHandleProto = _reflection.GeneratedProtocolMessageType('ResourceHandleProto', (_message.Message,), dict(
DESCRIPTOR = _RESOURCEHANDLEPROTO,
__module__ = 'tensorflow.core.framework.resource_handle_pb2'
# @@protoc_insertion_point(class_scope:tensorflow.ResourceHandleProto)
))
_sym_db.RegisterMessage(ResourceHandleProto)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\030org.tensorflow.frameworkB\016ResourceHandleP\001\370\001\001'))
# @@protoc_insertion_point(module_scope)
| mit |
ryfeus/lambda-packs | pytorch/source/caffe2/contrib/playground/resnetdemo/IN1k_resnet_no_test_model.py | 2025 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from caffe2.python import workspace, cnn, core
from caffe2.python import timeout_guard
from caffe2.proto import caffe2_pb2
def init_model(self):
# if cudnn needs to be turned off, several other places
# need to be modified:
# 1. operators need to be constructed with engine option, like below:
# conv_blob = model.Conv(...engine=engine)
# 2. when launch model, opts['model_param']['engine'] = "" instead of "CUDNN"
# 2. caffe2_disable_implicit_engine_preference in operator.cc set to true
train_model = cnn.CNNModelHelper(
order="NCHW",
name="resnet",
use_cudnn=False,
cudnn_exhaustive_search=False,
)
self.train_model = train_model
# test_model = cnn.CNNModelHelper(
# order="NCHW",
# name="resnet_test",
# use_cudnn=False,
# cudnn_exhaustive_search=False,
# init_params=False,
# )
self.test_model = None
self.log.info("Model creation completed")
def fun_per_epoch_b4RunNet(self, epoch):
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
for idx in range(self.opts['distributed']['first_xpu_id'],
self.opts['distributed']['first_xpu_id'] +
self.opts['distributed']['num_xpus']):
caffe2_pb2_device = caffe2_pb2.CUDA if \
self.opts['distributed']['device'] == 'gpu' else \
caffe2_pb2.CPU
with core.DeviceScope(core.DeviceOption(caffe2_pb2_device, idx)):
workspace.FeedBlob(
'{}_{}/lr'.format(self.opts['distributed']['device'], idx),
np.array(learning_rate, dtype=np.float32)
)
def run_training_net(self):
timeout = 2000.0
with timeout_guard.CompleteInTimeOrDie(timeout):
workspace.RunNet(self.train_model.net.Proto().name)
| mit |
htw-bui/EnergieNetz | EnergyNetwork.Domain/Model/WeeklyReference.cs | 243 | namespace EnergyNetwork.Domain.Model
{
public enum WeeklyReference
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
WorkingDay,
Weekend
}
} | mit |
faizaand/Gluon | src/main/java/me/faizaand/gluon/GluonRegistry.java | 2051 | package me.faizaand.gluon;
import me.faizaand.gluon.property.GluonProperty;
import java.util.*;
/**
* Keeps track of all properties loaded on the server.
*
* @since 1.0
*/
public class GluonRegistry {
private List<GluonProperty> gluonProperties;
private Map<String, GluonScript> gluonScripts;
/**
* Initialize the registry. To avoid catastrophe,
* this method should only be invoked once on any server instance.
*/
public void init() {
this.gluonProperties = new ArrayList<>();
this.gluonScripts = new HashMap<>();
}
/**
* Register a property on the server.
*
* @param property the property to register.
* @throws IllegalArgumentException if the property has already been added
*/
public void registerProperty(GluonProperty property) {
if (getProperty(property.getId()).isPresent()) {
throw new IllegalArgumentException("already added");
}
gluonProperties.add(property);
}
/**
* Gets a specific property by ID.
*
* @param id the full ID of the property, in the format: gluon:name
* @return the property, or an empty optional
*/
public Optional<GluonProperty> getProperty(String id) {
return gluonProperties.stream()
.filter(gluonProperty -> gluonProperty.getId().equalsIgnoreCase(id)).findFirst();
}
/**
* Gets a list of all properties loaded on the server.
*
* @return a list, never null
*/
public List<GluonProperty> getAllProperties() {
return gluonProperties;
}
public void registerScript(String name, GluonScript script) {
if(gluonScripts.containsKey(name)) {
throw new IllegalArgumentException("already added");
}
gluonScripts.put(name, script);
}
public Optional<GluonScript> getScript(String name) {
return Optional.ofNullable(gluonScripts.get(name));
}
public Map<String, GluonScript> getAllScripts() {
return gluonScripts;
}
}
| mit |
jvasileff/aos-xp | src.java/org/anodyneos/xpImpl/translater/TranslaterResult.java | 458 | package org.anodyneos.xpImpl.translater;
import java.util.List;
public interface TranslaterResult {
/**
* @return "package.class" or "class" if no package.
*/
String getFullClassName();
/**
* @return Package name or null.
*/
String getPackageName();
/**
* @return Class name or null.
*/
String getClassName();
/**
* @return dependents or empty list
*/
List getDependents();
}
| mit |
Safello/KnugenCoin | src/qt/locale/bitcoin_et.ts | 114095 | <?xml version="1.0" ?><!DOCTYPE TS><TS language="et" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Litecoin</source>
<translation>KnugenCoinist</translation>
</message>
<message>
<location line="+39"/>
<source><b>Litecoin</b> version</source>
<translation><b>KnugenCoini</b> versioon</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>⏎
See on eksperimentaalne tarkvara.⏎
⏎
Levitatud MIT/X11 tarkvara litsentsi all, vaata kaasasolevat faili COPYING või http://www.opensource.org/licenses/mit-license.php⏎
⏎
Toode sisaldab OpenSSL Projekti all toodetud tarkvara, mis on kasutamiseks OpenSSL Toolkitis (http://www.openssl.org/) ja Eric Young'i poolt loodud krüptograafilist tarkvara (eay@cryptsoft.com) ning Thomas Bernard'i loodud UPnP tarkvara.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Autoriõigus</translation>
</message>
<message>
<location line="+0"/>
<source>The Litecoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Aadressiraamat</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Topeltklõps aadressi või märgise muutmiseks</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Loo uus aadress</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopeeri märgistatud aadress vahemällu</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Uus aadress</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>Maksete saamiseks kasutatavad KnugenCoini aadressid. Maksjate paremaks jälgimiseks võib igaühele anda erineva.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Aadressi kopeerimine</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Kuva %QR kood</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Litecoin address</source>
<translation>Allkirjasta sõnum, et tõestada Bitconi aadressi olemasolu.</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Allkirjasta &Sõnum</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Kustuta märgistatud aadress loetelust</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Litecoin address</source>
<translation>Kinnita sõnum tõestamaks selle allkirjastatust määratud KnugenCoini aadressiga.</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Kinnita Sõnum</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Kustuta</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>Need on sinu KnugenCoini aadressid maksete saatmiseks. Müntide saatmisel kontrolli alati summat ning saaja aadressi.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>&Märgise kopeerimine</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Muuda</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Saada &Münte</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Ekspordi Aadressiraamat</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Komaeraldatud fail (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Viga eksportimisel</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Tõrge faili kirjutamisel %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Silt</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Aadress</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(silti pole)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Salafraasi dialoog</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Sisesta salafraas</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Uus salafraas</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Korda salafraasi</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>Sisesta rahakotile uus salafraas.<br/>Palun kasuta salafraasina <b>vähemalt 10 tähte/numbrit/sümbolit</b>, või <b>vähemalt 8 sõna</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Krüpteeri rahakott</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>See toiming nõuab sinu rahakoti salafraasi.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Tee rahakott lukust lahti.</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>See toiming nõuab sinu rahakoti salafraasi.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dekrüpteeri rahakott.</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Muuda salafraasi</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Sisesta rahakoti vana ning uus salafraas.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Kinnita rahakoti krüpteering</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>Hoiatus: Kui sa kaotad oma, rahakoti krüpteerimisel kasutatud, salafraasi, siis <b>KAOTAD KA KÕIK OMA KnugenCoinID</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Kas soovid oma rahakoti krüpteerida?</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>TÄHTIS: Kõik varasemad rahakoti varundfailid tuleks üle kirjutada äsja loodud krüpteeritud rahakoti failiga. Turvakaalutlustel tühistatakse krüpteerimata rahakoti failid alates uue, krüpteeritud rahakoti, kasutusele võtust.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Hoiatus: Caps Lock on sisse lülitatud!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Rahakott krüpteeritud</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>KnugenCoin sulgub krüpteeringu lõpetamiseks. Pea meeles, et rahakoti krüpteerimine ei välista KnugenCoinide vargust, kui sinu arvuti on nakatunud pahavaraga.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Tõrge rahakoti krüpteerimisel</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Rahakoti krüpteering ebaõnnestus tõrke tõttu. Sinu rahakotti ei krüpteeritud.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Salafraasid ei kattu.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Rahakoti avamine ebaõnnestus</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Rahakoti salafraas ei ole õige.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Rahakoti dekrüpteerimine ei õnnestunud</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Rahakoti salafraasi muutmine õnnestus.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Signeeri &sõnum</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Võrgusünkimine...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Ülevaade</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Kuva rahakoti üld-ülevaade</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Tehingud</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Sirvi tehingute ajalugu</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Salvestatud aadresside ja märgiste loetelu muutmine</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Kuva saadud maksete aadresside loetelu</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>V&älju</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Väljumine</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Litecoin</source>
<translation>Kuva info KnugenCoini kohta</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Teave &Qt kohta</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Kuva Qt kohta käiv info</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Valikud...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Krüpteeri Rahakott</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Varunda Rahakott</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Salafraasi muutmine</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Impordi blokid kettalt...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Kettal olevate blokkide re-indekseerimine...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Litecoin address</source>
<translation>Saada münte KnugenCoini aadressile</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Litecoin</source>
<translation>Muuda KnugenCoini seadeid</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Varunda rahakott teise asukohta</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Rahakoti krüpteerimise salafraasi muutmine</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Debugimise aken</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Ava debugimise ja diagnostika konsool</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>&Kontrolli sõnumit...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Litecoin</source>
<translation>KnugenCoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Rahakott</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>&Saada</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>&Saama</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>&Aadressid</translation>
</message>
<message>
<location line="+22"/>
<source>&About Litecoin</source>
<translation>%KnugenCoinist</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Näita / Peida</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Näita või peida peaaken</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Krüpteeri oma rahakoti privaatvõtmed</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Litecoin addresses to prove you own them</source>
<translation>Omandi tõestamiseks allkirjasta sõnumid oma KnugenCoini aadressiga</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Litecoin addresses</source>
<translation>Kinnita sõnumid kindlustamaks et need allkirjastati määratud KnugenCoini aadressiga</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Fail</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Seaded</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Abi</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Vahelehe tööriistariba</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>KnugenCoini klient</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Litecoin network</source>
<translation><numerusform>%n aktiivne ühendus KnugenCoini võrku</numerusform><numerusform>%n aktiivset ühendust KnugenCoini võrku</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation>Protsessitud %1 (arvutuslikult) tehingu ajaloo blokki %2-st.</translation>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>Protsessitud %1 tehingute ajaloo blokki.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n tund</numerusform><numerusform>%n tundi</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n päev</numerusform><numerusform>%n päeva</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n nädal</numerusform><numerusform>%n nädalat</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation>%1 maas</translation>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>Viimane saabunud blokk loodi %1 tagasi.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation>Peale seda ei ole tehingud veel nähtavad.</translation>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Tõrge</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Hoiatus</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Informatsioon</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>See tehing ületab mahupiirangu. Saatmine on võimalik %1, node'idele ning võrgustiku toetuseks, makstava lisatasu eest. Kas nõustud lisatasuga?</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Ajakohane</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Jõuan...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Kinnita tehingu tasu</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Saadetud tehing</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Sisenev tehing</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Kuupäev: %1⏎
Summa: %2⏎
Tüüp: %3⏎
Aadress: %4⏎</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI käsitsemine</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 ei suudeta parsida. Põhjuseks võib olla kehtetu KnugenCoini aadress või vigased URI parameetrid.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Rahakott on <b>krüpteeritud</b> ning hetkel <b>avatud</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Rahakott on <b>krüpteeritud</b> ning hetkel <b>suletud</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>Ilmnes kriitiline tõrge. KnugenCoin suletakse turvakaalutluste tõttu.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Võrgu Häire</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Muuda aadressi</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Märgis</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Selle aadressiraamatu kirjega seotud märgis</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Aadress</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>Selle aadressiraamatu kirjega seotud aadress. Võimalik muuta ainult aadresside saatmiseks.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Uus sissetulev aadress</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Uus väljaminev aadress</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Sissetulevate aadresside muutmine</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Väljaminevate aadresside muutmine</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Selline aadress on juba olemas: "%1"</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Litecoin address.</source>
<translation>Sisestatud aadress "%1" ei ole KnugenCoinis kehtiv.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Rahakotti ei avatud</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Tõrge uue võtme loomisel.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Litecoin-Qt</source>
<translation>KnugenCoini-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versioon</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Kasutus:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>käsurea valikud</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>UI valikud</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Keele valik, nt "ee_ET" (vaikeväärtus: system locale)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Käivitu tegumiribale</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Käivitamisel teabeakna kuvamine (vaikeväärtus: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Valikud</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>%Peamine</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 type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Tasu tehingu &fee</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Litecoin after logging in to the system.</source>
<translation>Käivita KnugenCoin süsteemi logimisel.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Litecoin on system login</source>
<translation>&Start KnugenCoin sisselogimisel</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>Taasta kõik klientprogrammi seadete vaikeväärtused.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>&Lähtesta valikud</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Võrk</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>KnugenCoini kliendi pordi automaatne avamine ruuteris. Toimib, kui sinu ruuter aktsepteerib UPnP ühendust.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Suuna port &UPnP kaudu</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Litecoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Kasuta KnugenCoini võrgustikku ühendumiseks SOCKS turva proxy't (nt Tor'i kasutamisel).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>%Connect läbi turva proxi:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Proxi &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Proxi IP (nt 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>Proxi port (nt 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>Turva proxi SOCKS &Version:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Turva proxi SOCKS versioon (nt 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Aken</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Minimeeri systray alale.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimeeri systray alale</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>Sulgemise asemel minimeeri aken. Selle valiku tegemisel suletakse programm Menüüst "Välju" käsuga.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimeeri sulgemisel</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Kuva</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Kasutajaliidese &keel:</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>Kasutajaliidese keele valimise koht. Valik rakendub KnugenCoini käivitamisel.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>Summade kuvamise &Unit:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Vali liideses ning müntide saatmisel kuvatav vaikimisi alajaotus.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Litecoin addresses in the transaction list or not.</source>
<translation>Kuvada KnugenCoini aadress tehingute loetelus või mitte.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>Tehingute loetelu &Display aadress</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Katkesta</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Rakenda</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>vaikeväärtus</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>Kinnita valikute algseadistamine</translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>Mõned seadete muudatused rakenduvad programmi käivitumisel.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>Kas soovid jätkata?</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Hoiatus</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Litecoin.</source>
<translation>Tehtud valik rakendub KnugenCoini käivitamisel.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Sisestatud kehtetu proxy aadress.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Vorm</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>Kuvatav info ei pruugi olla ajakohane. Ühenduse loomisel süngitakse sinu rahakott automaatselt Bitconi võrgustikuga, kuid see toiming on hetkel lõpetamata.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Jääk:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Kinnitamata:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Rahakott</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Ebaküps:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Mitte aegunud mine'itud jääk</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Uuesti saadetud tehingud</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Sinu jääk hetkel</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>Kinnitamata tehingud kokku. Ei kajastu hetke jäägis</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>sünkimata</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start litecoin: click-to-pay handler</source>
<translation>KnugenCoin ei käivitu: vajuta-maksa toiming</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR koodi dialoog</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Makse taotlus</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Summa:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Märgis:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Sõnum:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Salvesta nimega...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Tõrge URI'st QR koodi loomisel</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Sisestatud summa on vale, palun kontrolli.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Tulemuseks on liiga pikk URL, püüa lühendada märgise/teate teksti.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Salvesta QR kood</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG pildifail (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Kliendi nimi</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>N/A</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Kliendi versioon</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informatsioon</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Kasutan OpenSSL versiooni</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Käivitamise hetk</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Võrgustik</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Ühenduste arv</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Testnetis</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Ploki jada</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Plokkide hetkearv</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Ligikaudne plokkide kogus</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Viimane ploki aeg</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Ava</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Käsurea valikud</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>Näita kehtivate käsurea valikute kuvamiseks KnugenCoini-Qt abiteksti</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Kuva</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsool</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Valmistusaeg</translation>
</message>
<message>
<location line="-104"/>
<source>Litecoin - Debug window</source>
<translation>KnugenCoin - debugimise aken</translation>
</message>
<message>
<location line="+25"/>
<source>Litecoin Core</source>
<translation>KnugenCoini tuumik</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Debugimise logifail</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>Ava KnugenCoini logifail praegusest andmekaustast. Toiminguks võib kuluda kuni mõni sekund.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Puhasta konsool</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Litecoin RPC console.</source>
<translation>Teretulemast KnugenCoini RPC konsooli.</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>Ajaloo sirvimiseks kasuta üles ja alla nooli, ekraani puhastamiseks <b>Ctrl-L</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Ülevaateks võimalikest käsklustest trüki <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>Müntide saatmine</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Saatmine mitmele korraga</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Lisa &Saaja</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Eemalda kõik tehingu väljad</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Puhasta &Kõik</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Jääk:</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>Saatmise kinnitamine</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>S&aada</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> kuni %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Müntide saatmise kinnitamine</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Soovid kindlasti saata %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>ja</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Saaja aadress ei ole kehtiv, palun kontrolli.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Makstav summa peab olema suurem kui 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Summa ületab jäägi.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Summa koos tehingu tasuga %1 ületab sinu jääki.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Ühe saatmisega topelt-adressaati olla ei tohi.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Tõrge: Tehingu loomine ebaõnnestus!</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>Viga: Tehingust keelduti. Nt rahakoti koopia kasutamisel võivad selle põhjustada juba kulutatud mündid.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Vorm</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>S&umma:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Maksa &:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Tehingu saaja aadress (nt: 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>Aadressiraamatusse sisestamiseks märgista aadress</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Märgis</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Vali saaja aadressiraamatust</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>Kleebi aadress vahemälust</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>Saaja eemaldamine</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Sisesta KnugenCoini aadress (nt: Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Signatuurid - Allkirjasta / Kinnita Sõnum</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>&Allkirjastamise teade</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>Omandiõigsuse tõestamiseks saad sõnumeid allkirjastada oma aadressiga. Ettevaatust petturitega, kes üritavad saada sinu allkirja endale saada. Allkirjasta ainult korralikult täidetud avaldusi, millega nõustud.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Sõnumi signeerimise aadress (nt: Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Vali aadress aadressiraamatust</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>Kleebi aadress vahemälust</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>Sisesta siia allkirjastamise sõnum</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>Signatuur</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopeeri praegune signatuur vahemällu</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Litecoin address</source>
<translation>Allkirjasta sõnum KnugenCoini aadressi sulle kuulumise tõestamiseks</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Allkirjasta &Sõnum</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Tühjenda kõik sõnumi allkirjastamise väljad</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Puhasta &Kõik</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>&Kinnita Sõnum</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>Kinnitamiseks sisesta allkirjastamise aadress, sõnum (kindlasti kopeeri täpselt ka reavahetused, tühikud, tabulaatorid jms) ning allolev signatuur.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Aadress, millega sõnum allkirjastati (nt: Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Litecoin address</source>
<translation>Kinnita sõnum tõestamaks selle allkirjastatust määratud KnugenCoini aadressiga.</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>Kinnita &Sõnum</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Tühjenda kõik sõnumi kinnitamise väljad</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Sisesta KnugenCoini aadress (nt: Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Signatuuri genereerimiseks vajuta "Allkirjasta Sõnum"</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Litecoin signature</source>
<translation>Sisesta KnugenCoini allkiri</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Sisestatud aadress ei kehti.</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>Palun kontrolli aadressi ning proovi uuesti.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Sisestatud aadress ei viita võtmele.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Rahakoti avamine katkestati.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Sisestatud aadressi privaatvõti ei ole saadaval.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Sõnumi signeerimine ebaõnnestus.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Sõnum signeeritud.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Signatuuri ei õnnestunud dekodeerida.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Palun kontrolli signatuuri ning proovi uuesti.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Signatuur ei kattunud sõnumi kokkuvõttega.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Sõnumi kontroll ebaõnnestus.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Sõnum kontrollitud.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Litecoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Avatud kuni %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%/1offline'is</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/kinnitamata</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 kinnitust</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Staatus</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, levita läbi %n node'i</numerusform><numerusform>, levita läbi %n node'i</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Kuupäev</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Allikas</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Genereeritud</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Saatja</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Saaja</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>oma aadress</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>märgis</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Krediit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>aegub %n bloki pärast</numerusform><numerusform>aegub %n bloki pärast</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>mitte aktsepteeritud</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Deebet</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Tehingu tasu</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Neto summa</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Sõnum</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Kommentaar</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Tehingu ID</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>Enne, kui loodud münte saab kulutama asuda, peavad need läbima 120 blokki. Kui sina selle bloki lõid, levitati see, bloki jadasse ühendamiseks, võrgustikku. Kui jadasse ühendamine ei õnnestu, muudetakse tema staatus "keeldutud" olekusse ning seda ei saa kulutada. Selline olukord võib juhtuda, kui mõni teine node loob bloki sinuga samal ajal.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Debug'imise info</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Tehing</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>Sisendid</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Kogus</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>õige</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>vale</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, veel esitlemata</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Avaneb %n bloki pärast</numerusform><numerusform>Avaneb %n bloki pärast</numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>tundmatu</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Tehingu üksikasjad</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Paan kuvab tehingu detailid</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Kuupäev</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tüüp</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Aadress</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Kogus</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Avaneb %n bloki pärast</numerusform><numerusform>Avaneb %n bloki pärast</numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Avatud kuni %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Ühenduseta (%1 kinnitust)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Kinnitamata (%1/%2 kinnitust)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Kinnitatud (%1 kinnitust)</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>Mine'itud jääk muutub kättesaadavaks %n bloki läbimisel</numerusform><numerusform>Mine'itud jääk muutub kättesaadavaks %n bloki läbimisel</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>Antud klotsi pole saanud ükski osapool ning tõenäoliselt seda ei aktsepteerita!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Loodud, kuid aktsepteerimata</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Saadud koos</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Kellelt saadud</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Saadetud</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Makse iseendale</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Mine'itud</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(n/a)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Tehingu staatus. Kinnituste arvu kuvamiseks liigu hiire noolega selle peale.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Tehingu saamise kuupäev ning kellaaeg.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Tehingu tüüp.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Tehingu saaja aadress.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Jäägile lisatud või eemaldatud summa.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Kõik</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Täna</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Jooksev nädal</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Jooksev kuu</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Eelmine kuu</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Jooksev aasta</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Ulatus...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Saadud koos</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Saadetud</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Iseendale</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Mine'itud</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Muu</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Otsimiseks sisesta märgis või aadress</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Vähim summa</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Aadressi kopeerimine</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Märgise kopeerimine</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopeeri summa</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Kopeeri tehingu ID</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Märgise muutmine</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Kuva tehingu detailid</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Tehinguandmete eksport</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Komaeraldatud fail (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Kinnitatud</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Kuupäev</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tüüp</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Silt</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Aadress</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Kogus</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Viga eksportimisel</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Tõrge faili kirjutamisel %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Ulatus:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>saaja</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Varundatud Rahakott</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Rahakoti andmed (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Varundamine nurjus</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Rahakoti andmete uude kohta salvestamine nurjus.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Varundamine õnnestus</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Rahakoti andmete uude kohta salvestamine õnnestus.</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Litecoin version</source>
<translation>KnugenCoini versioon</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Kasutus:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or litecoind</source>
<translation>Saada käsklus -serverile või KnugenCoindile</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Käskluste loetelu</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Käskluste abiinfo</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Valikud:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: litecoin.conf)</source>
<translation>Täpsusta sätete fail (vaikimisi: KnugenCoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: litecoind.pid)</source>
<translation>Täpsusta PID fail (vaikimisi: KnugenCoin.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Täpsusta andmekataloog</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Sea andmebaasi vahemälu suurus MB (vaikeväärtus: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation>Kuula ühendusi pordil <port> (vaikeväärtus: 9333 või testnet: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Säilita vähemalt <n> ühendust peeridega (vaikeväärtus: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Peeri aadressi saamiseks ühendu korraks node'iga</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Täpsusta enda avalik aadress</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Ulakate peeride valulävi (vaikeväärtus: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Mitme sekundi pärast ulakad peerid tagasi võivad tulla (vaikeväärtus: 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>RPC pordi %u kuulamiseks seadistamisel ilmnes viga IPv4'l: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation>Kuula JSON-RPC ühendusel seda porti <port> (vaikeväärtus: 9332 või testnet: 19332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Luba käsurea ning JSON-RPC käsklusi</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Tööta taustal ning aktsepteeri käsklusi</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Testvõrgu kasutamine</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Luba välisühendusi (vaikeväärtus: 1 kui puudub -proxy või -connect)</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, sul tuleb rpcpassword määrata seadete failis:
%s
Soovitatav on kasutada järgmist juhuslikku parooli:
rpcuser=litecoinrpc
rpcpassword=%s
(seda parooli ei pea meeles pidama)
Kasutajanimi ning parool EI TOHI kattuda.
Kui faili ei leita, loo see ainult-omaniku-loetavas failiõigustes .
Soovitatav on seadistada tõrgete puhul teavitus;
nt: alertnotify=echo %%s | email -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>RPC pordi %u kuulamiseks seadistamisel ilmnes viga IPv6'l, lülitumine tagasi IPv4'le : %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>Määratud aadressiga sidumine ning sellelt kuulamine. IPv6 jaoks kasuta vormingut [host]:port</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Litecoin is probably already running.</source>
<translation>Ei suuda määrata ainuõigust andmekaustale %s. Tõenäolisel on KnugenCoin juba avatud.</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>Tõrge: Tehingust keelduti! Põhjuseks võib olla juba kulutatud mündid, nt kui wallet.dat fail koopias kulutatid mündid, kuid ei märgitud neid siin vastavalt.</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>Tõrge: Selle tehingu jaoks on nõutav lisatasu vähemalt %s. Põhjuseks võib olla summa suurus, keerukus või hiljuti saadud summade kasutamine!</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>Käivita käsklus, kui saabub tähtis hoiatus (%s cmd's asendatakse sõnumiga)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Käivita käsklus, kui rahakoti tehing muutub (%s cmd's muudetakse TxID'ks)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Sea "kõrge tähtsusega"/"madala tehingu lisatasuga" tehingute maksimumsuurus baitides (vaikeväärtus: 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>See on test-versioon - kasutamine omal riisikol - ära kasuta mining'uks ega kaupmeeste programmides</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>Hoiatus: -paytxfee on seatud väga kõrgeks! See on sinu poolt makstav tehingu lisatasu.</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>Hoiatus: Kuvatavad tehingud ei pruugi olla korrektsed! Sina või node'id peate tegema uuenduse.</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>Hoiatus: Palun kontrolli oma arvuti kuupäeva/kellaaega! Kui arvuti kell on vale, siis KnugenCoin ei tööta korralikult</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>Hoiatus: ilmnes tõrge wallet.dat faili lugemisel! Võtmed on terved, kuid tehingu andmed või aadressiraamatu kirjed võivad olla kadunud või vigased.</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>Hoiatus: toimus wallet.dat faili andmete päästmine! Originaal wallet.dat nimetati kaustas %s ümber wallet.{ajatempel}.bak'iks, jäägi või tehingute ebakõlade puhul tuleks teha backup'ist taastamine.</translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Püüa vigasest wallet.dat failist taastada turvavõtmed</translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Blokeeri loomise valikud:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Ühendu ainult määratud node'i(de)ga</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>Tuvastati vigane bloki andmebaas</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Leia oma IP aadress (vaikeväärtus: 1, kui kuulatakse ning puudub -externalip)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>Kas soovid bloki andmebaasi taastada?</translation>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>Tõrge bloki andmebaasi käivitamisel</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation>Tõrge rahakoti keskkonna %s käivitamisel!</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>Tõrge bloki baasi lugemisel</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>Tõrge bloki andmebaasi avamisel</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Tõrge: liiga vähe kettaruumi!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>Tõrge: Rahakott on lukus, tehingu loomine ei ole võimalik!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Tõrge: süsteemi tõrge:</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Pordi kuulamine nurjus. Soovikorral kasuta -listen=0.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>Tõrge bloki sisu lugemisel</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation>Bloki lugemine ebaõnnestus</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation>Bloki indeksi sünkimine ebaõnnestus</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation>Bloki indeksi kirjutamine ebaõnnestus</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation>Bloki sisu kirjutamine ebaõnnestus</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>Tõrge bloki sisu kirjutamisel</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation>Tõrge faili info kirjutamisel</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation>Tõrge mündi andmebaasi kirjutamisel</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation>Tehingu indeksi kirjutamine ebaõnnestus</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation>Tagasivõtmise andmete kirjutamine ebaõnnestus</translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>Otsi DNS'i lookup'i kastavaid peere (vaikeväärtus: 1, kui mitte -connect)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>Käivitamisel kontrollitavate blokkide arv (vaikeväärtus: 288, 0=kõik)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation>Blokkide kontrollimise põhjalikkus (0-4, vaikeväärtus: 3)</translation>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation>Taasta bloki jada indeks blk000??.dat failist</translation>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>Määra RPC kõnede haldurite arv (vaikeväärtus: 4)</translation>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation>Kontrollin blokke...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>Kontrollin rahakotti...</translation>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Impordi blokid välisest blk000??.dat failist</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 type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Informatsioon</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Vigane -tor aadress: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation>Säilita kogu tehingu indeks (vaikeväärtus: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Maksimaalne saamise puhver -connection kohta , <n>*1000 baiti (vaikeväärtus: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maksimaalne saatmise puhver -connection kohta , <n>*1000 baiti (vaikeväärtus: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation>Tunnusta ainult sisseehitatud turvapunktidele vastavaid bloki jadu (vaikeväärtus: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Ühenda ainult node'idega <net> võrgus (IPv4, IPv6 või Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Väljund lisa debug'imise infoks. Tuleneb kõikidest teistest -debug* valikutest</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Lisa võrgu debug'imise info väljund</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Varusta debugi väljund ajatempliga</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Litecoin Wiki for SSL setup instructions)</source>
<translation>SSL valikud: (vaata KnugenCoini Wikist või SSL sätete juhendist)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Vali turva proxi SOCKS versioon (4-5, vaikeväärtus: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Saada jälitus/debug, debug.log faili asemel, konsooli</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Saada jälitus/debug info debuggerile</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Sea maksimaalne bloki suurus baitides (vaikeväärtus: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Sea minimaalne bloki suurus baitides (vaikeväärtus: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Kahanda programmi käivitamisel debug.log faili (vaikeväärtus: 1, kui ei ole -debug)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Sea ühenduse timeout millisekundites (vaikeväärtus: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Süsteemi tõrge:</translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Kasuta kuulatava pordi määramiseks UPnP ühendust (vaikeväärtus: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Kasuta kuulatava pordi määramiseks UPnP ühendust (vaikeväärtus: 1, kui kuulatakse)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Kasuta varjatud teenustele ligipääsuks proxy't (vaikeväärtus: sama, mis -proxy)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>JSON-RPC ühenduste kasutajatunnus</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Hoiatus</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Hoiatus: versioon on aegunud, uuendus on nõutav!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation>Andmebaas tuleb taastada kasutades -reindex, et muuta -txindex</translation>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat fail on katki, päästmine ebaõnnestus</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>JSON-RPC ühenduste salasõna</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>JSON-RPC ühenduste lubamine kindla IP pealt</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Saada käsklusi node'ile IP'ga <ip> (vaikeväärtus: 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>Käivita käsklus, kui parim plokk muutub (käskluse %s asendatakse ploki hash'iga)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Uuenda rahakott uusimasse vormingusse</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Sea võtmete hulgaks <n> (vaikeväärtus: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Otsi ploki jadast rahakoti kadunud tehinguid</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Kasuta JSON-RPC ühenduste jaoks OpenSSL'i (https)</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Serveri sertifikaadifail (vaikeväärtus: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Serveri privaatvõti (vaikeväärtus: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Lubatud šiffrid (vaikeväärtus: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Käesolev abitekst</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Selle arvutiga ei ole võimalik siduda %s külge (katse nurjus %d, %s tõttu)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Ühendu läbi turva proxi</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>-addnode, -seednode ja -connect tohivad kasutada DNS lookup'i</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Aadresside laadimine...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Viga wallet.dat käivitamisel. Vigane rahakkott</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Litecoin</source>
<translation>Viga wallet.dat käivitamisel: Rahakott nõuab KnugenCoini uusimat versiooni</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Litecoin to complete</source>
<translation>Rahakott tuli ümberkirjutada: toimingu lõpetamiseks taaskäivita KnugenCoin</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Viga wallet.dat käivitamisel</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Vigane -proxi aadress: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Kirjeldatud tundmatu võrgustik -onlynet'is: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Küsitud tundmatu -socks proxi versioon: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Tundmatu -bind aadress: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Tundmatu -externalip aadress: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>-paytxfee=<amount> jaoks vigane kogus: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Kehtetu summa</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Liiga suur summa</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Klotside indeksi laadimine...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Lisa node ning hoia ühendus avatud</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Litecoin is probably already running.</source>
<translation>%s'ga ei ole võimalik sellest arvutist siduda. KnugenCoin juba töötab.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Minu saadetavate tehingute lisatasu KB kohta</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Rahakoti laadimine...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Rahakoti vanandamine ebaõnnestus</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Tõrge vaikimisi aadressi kirjutamisel</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Üleskaneerimine...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Laetud</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>%s valiku kasutamine</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Tõrge</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=<password> peab sätete failis olema seadistatud:⏎
%s⏎
Kui seda faili ei ole, loo see ainult-omanikule-lugemiseks faili õigustes.</translation>
</message>
</context>
</TS> | mit |
wiflsnmo/react_study2 | node_modules/echarts/lib/chart/pie/PieSeries.js | 4975 | 'use strict';
var List = require('../../data/List');
var zrUtil = require('zrender/lib/core/util');
var modelUtil = require('../../util/model');
var completeDimensions = require('../../data/helper/completeDimensions');
var dataSelectableMixin = require('../../component/helper/selectableMixin');
var PieSeries = require('../../echarts').extendSeriesModel({
type: 'series.pie',
// Overwrite
init: function (option) {
PieSeries.superApply(this, 'init', arguments);
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this.legendDataProvider = function () {
return this._dataBeforeProcessed;
};
this.updateSelectedMap(option.data);
this._defaultLabelLine(option);
},
// Overwrite
mergeOption: function (newOption) {
PieSeries.superCall(this, 'mergeOption', newOption);
this.updateSelectedMap(this.option.data);
},
getInitialData: function (option, ecModel) {
var dimensions = completeDimensions(['value'], option.data);
var list = new List(dimensions, this);
list.initData(option.data);
return list;
},
// Overwrite
getDataParams: function (dataIndex) {
var data = this._data;
var params = PieSeries.superCall(this, 'getDataParams', dataIndex);
var sum = data.getSum('value');
// FIXME toFixed?
//
// Percent is 0 if sum is 0
params.percent = !sum ? 0 : +(data.get('value', dataIndex) / sum * 100).toFixed(2);
params.$vars.push('percent');
return params;
},
_defaultLabelLine: function (option) {
// Extend labelLine emphasis
modelUtil.defaultEmphasis(option.labelLine, ['show']);
var labelLineNormalOpt = option.labelLine.normal;
var labelLineEmphasisOpt = option.labelLine.emphasis;
// Not show label line if `label.normal.show = false`
labelLineNormalOpt.show = labelLineNormalOpt.show
&& option.label.normal.show;
labelLineEmphasisOpt.show = labelLineEmphasisOpt.show
&& option.label.emphasis.show;
},
defaultOption: {
zlevel: 0,
z: 2,
legendHoverLink: true,
hoverAnimation: true,
// 默认全局居中
center: ['50%', '50%'],
radius: [0, '75%'],
// 默认顺时针
clockwise: true,
startAngle: 90,
// 最小角度改为0
minAngle: 0,
// 选中是扇区偏移量
selectedOffset: 10,
// If use strategy to avoid label overlapping
avoidLabelOverlap: true,
// 选择模式,默认关闭,可选single,multiple
// selectedMode: false,
// 南丁格尔玫瑰图模式,'radius'(半径) | 'area'(面积)
// roseType: null,
label: {
normal: {
// If rotate around circle
rotate: false,
show: true,
// 'outer', 'inside', 'center'
position: 'outer'
// formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
// distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数
},
emphasis: {}
},
// Enabled when label.normal.position is 'outer'
labelLine: {
normal: {
show: true,
// 引导线两段中的第一段长度
length: 15,
// 引导线两段中的第二段长度
length2: 15,
smooth: false,
lineStyle: {
// color: 各异,
width: 1,
type: 'solid'
}
}
},
itemStyle: {
normal: {
// color: 各异,
borderColor: 'rgba(0,0,0,0)',
borderWidth: 1
},
emphasis: {
// color: 各异,
borderColor: 'rgba(0,0,0,0)',
borderWidth: 1
}
},
animationEasing: 'cubicOut',
data: []
}
});
zrUtil.mixin(PieSeries, dataSelectableMixin);
module.exports = PieSeries;
| mit |
Pletora/Chester | src/services/calendars/calendars.filters.js | 358 | /* eslint no-console: 1 */
console.warn(
'You are using the default filter for the calendars service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'
); // eslint-disable-line no-console
module.exports = function(data, connection, hook) {
// eslint-disable-line no-unused-vars
return data;
};
| mit |
Engensmax/Warlocked | Properties/AssemblyInfo.cs | 1394 | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Warlocked")]
[assembly: AssemblyProduct("Warlocked")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6d9c90d7-9487-45d7-b408-e8b33bea0ff8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit |
navneetzz/Hackerrank | src/Algorithms/Implementation/JumpingOnTheClouds.java | 611 | package Algorithms.Implementation;
import java.util.Scanner;
/**
* Created by Navneet Sharma (navneetzz) ryu on 1/7/17.
*/
public class JumpingOnTheClouds {
public static void main (String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int e = 100;
int[] arr = new int[n];
for (int i=0;i<n;i++) arr[i] = in.nextInt();
for (int i=0;i<n;i=i+k) {
if (arr[i%n]==0)
e-=1;
else
e-=3;
}
in.close();
System.out.println(e);
}
}
| mit |
standart-n/spacepro | gulpfile.js | 317 |
var gulp = require('gulp');
var po2json = require('gulp-po2json');
gulp.task('default', function() {
gulp.task('po2json');
});
gulp.task('po2json', function() {
return gulp.src(['public/locale/**/messages.po'])
.pipe(po2json({
pretty: true,
format: 'mf'
}))
.pipe(gulp.dest('public/i18n/'));
}) | mit |
RenatoMAlves/AnimaSom-Game | .history/animaSom/js/play_20170606134735.js | 2186 | var playState = {
create: function(){
var background = game.add.sprite(0, 0, 'cidade');
background.width = 1300;
background.height = 650;
graphics = game.add.graphics(0, 0);
groupCidade = game.add.group();
groupCidade.inputEnableChildren = true;
var x = 100;
for (var i = 0; i < 3; i++){
// Gera os retangulos que ficarão atras das imagens
graphics.beginFill(0xFFFFFF);
graphics.lineStyle(3, 0x05005e, 1);
graphics.drawRoundedRect(x, 200, 315, 190, 10);
graphics.endFill();
var button = groupCidade.create(x, 200, graphics.generateTexture());
button.tint = 0xff8800;
button.name = 'groupCidade-child-' + i;
x = x + 400;
}
graphics.destroy();
var cachorro = game.add.sprite(110, 210, 'cachorro');
cachorro.width = 300;
cachorro.height = 170;
// Desenha o gato e a borda da box
var gato = game.add.sprite(510, 210, 'gato');
gato.width = 300;
gato.height = 170;
// Desenha o passaro e a borda da box
var passaro = game.add.sprite(910, 210, 'passaro');
passaro.width = 300;
passaro.height = 170;
start();
// groupCidade.onChildInputDown.add(onDown, this);
// groupCidade.onChildInputOver.add(onOver, this);
// groupCidade.onChildInputOut.add(onOut, this);
function start(){
groupCidade.children[1].tint = 0x000000;
groupCidade.children[2].tint = 0x000000;
gato.tint = 0x000000;
passaro.tint = 0x000000;
background.tint = 0x888888;
}
function onDown (sprite) {
sprite.tint = 0x00ff00;
}
function onOver (sprite) {
sprite.tint = 0xffff00;
}
function onOut (sprite) {
sprite.tint = 0xff8800;
// sprite.tint = Math.random() * 0xffffff;
}
},
update: function(){
console.log(group)
},
Win: function(){
game.state.start('win');
}
}; | mit |
tim-group/deployapp | lib/deployapp/service_wrapper.rb | 234 | require 'deployapp/namespace'
class DeployApp::ServiceWrapper
def start_service(service_name)
system("service #{service_name} start")
end
def stop_service(service_name)
system("service #{service_name} stop")
end
end
| mit |
MystFan/TelerikAcademy | JavaScript Fundamentals/Operators and Expressions/scripts/thirdBit.js | 1362 | /// <reference path="js-console.js" />
jsConsole.writeLine('---------------------------------------------------------------------------');
jsConsole.writeLine('Problem 5: Write a boolean expression for finding if the bit #3 (counting from 0) of a given integer.The bits are counted from right to left, starting from bit #0.The result of the expression should be either 1 or 0.');
jsConsole.writeLine('---------------------------------------------------------------------------');
console.log('---------------------------------------------------------------------------');
console.log('Problem 5: Write a boolean expression for finding if the bit #3 (counting from 0) of a given integer.The bits are counted from right to left, starting from bit #0.The result of the expression should be either 1 or 0.');
console.log('---------------------------------------------------------------------------');
var numbers = [5, 8, 0, 15, 5343, 62241];
for (var i = 0; i < numbers.length; i++) {
var bitPosition = 3;
var mask = 1 << bitPosition;
console.log('Number ' + numbers[i] + ' binary --> ' + numbers[i].toString(2));
jsConsole.writeLine('Number ' + numbers[i] + ' binary --> ' + numbers[i].toString(2));
var bit = (mask & numbers[i]) >> bitPosition;
jsConsole.writeLine('Third bit is ' + bit);
console.log('Third bit is ' + bit);
}
| mit |
gitsno/MySqlConnector | src/MySqlConnector/MySqlClient/CommandExecutors/StoredProcedureCommandExecutor.cs | 3773 | using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using MySql.Data.MySqlClient.Types;
using MySql.Data.Protocol.Serialization;
namespace MySql.Data.MySqlClient.CommandExecutors
{
internal class StoredProcedureCommandExecutor : TextCommandExecutor
{
internal StoredProcedureCommandExecutor(MySqlCommand command)
: base(command)
{
m_command = command;
}
public override async Task<DbDataReader> ExecuteReaderAsync(string commandText, MySqlParameterCollection parameterCollection,
CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken)
{
var cachedProcedure = await m_command.Connection.GetCachedProcedure(ioBehavior, commandText, cancellationToken).ConfigureAwait(false);
if (cachedProcedure != null)
parameterCollection = cachedProcedure.AlignParamsWithDb(parameterCollection);
MySqlParameter returnParam = null;
m_outParams = new MySqlParameterCollection();
m_outParamNames = new List<string>();
var inParams = new MySqlParameterCollection();
var argParamNames = new List<string>();
var inOutSetParams = "";
for (var i = 0; i < parameterCollection.Count; i++)
{
var param = parameterCollection[i];
var inName = "@inParam" + i;
var outName = "@outParam" + i;
switch (param.Direction)
{
case 0:
case ParameterDirection.Input:
case ParameterDirection.InputOutput:
var inParam = param.WithParameterName(inName);
inParams.Add(inParam);
if (param.Direction == ParameterDirection.InputOutput)
{
inOutSetParams += $"SET {outName}={inName}; ";
goto case ParameterDirection.Output;
}
argParamNames.Add(inName);
break;
case ParameterDirection.Output:
m_outParams.Add(param);
m_outParamNames.Add(outName);
argParamNames.Add(outName);
break;
case ParameterDirection.ReturnValue:
returnParam = param;
break;
}
}
// if a return param is set, assume it is a funciton. otherwise, assume stored procedure
commandText += "(" + string.Join(", ", argParamNames) +")";
if (returnParam == null)
{
commandText = inOutSetParams + "CALL " + commandText;
if (m_outParams.Count > 0)
{
m_setParamsFlags = true;
m_cancellationToken = cancellationToken;
}
}
else
{
commandText = "SELECT " + commandText;
}
var reader = (MySqlDataReader) await base.ExecuteReaderAsync(commandText, inParams, behavior, ioBehavior, cancellationToken).ConfigureAwait(false);
if (returnParam != null && await reader.ReadAsync(ioBehavior, cancellationToken).ConfigureAwait(false))
returnParam.Value = reader.GetValue(0);
return reader;
}
internal void SetParams()
{
if (!m_setParamsFlags)
return;
m_setParamsFlags = false;
var commandText = "SELECT " + string.Join(", ", m_outParamNames);
using (var reader = (MySqlDataReader) base.ExecuteReaderAsync(commandText, new MySqlParameterCollection(), CommandBehavior.Default, IOBehavior.Synchronous, m_cancellationToken).GetAwaiter().GetResult())
{
reader.Read();
for (var i = 0; i < m_outParams.Count; i++)
{
var param = m_outParams[i];
if (param.DbType != default(DbType))
{
var dbTypeMapping = TypeMapper.Mapper.GetDbTypeMapping(param.DbType);
if (dbTypeMapping != null)
{
param.Value = dbTypeMapping.DoConversion(reader.GetValue(i));
continue;
}
}
param.Value = reader.GetValue(i);
}
}
}
readonly MySqlCommand m_command;
bool m_setParamsFlags;
MySqlParameterCollection m_outParams;
List<string> m_outParamNames;
private CancellationToken m_cancellationToken;
}
} | mit |
Blue64/Space_Engineers | AppData/Local/Temp/SpaceEngineers/920013121.sbm_IndustrialAutomaton_CloakingDevice/Cloaking_Device.cs | 11276 | using Sandbox.Engine;
using Sandbox.Engine.Multiplayer;
using Sandbox.ModAPI;
using Sandbox.Common.ObjectBuilders;
using Sandbox.Definitions;
using Sandbox.Game.Entities;
using Sandbox.Game.EntityComponents;
using Sandbox.Game.Weapons;
using VRage;
using VRage.Game;
using VRage.Game.Components;
using VRage.Game.Entity;
using VRage.Game.ModAPI;
using VRage.ModAPI;
using VRage.ObjectBuilders;
using VRage.Utils;
using VRageMath;
using System;
using System.Collections.Generic;
using System.Text;
using VRage.Game.ObjectBuilders.Definitions;
namespace IndustrialAutomaton.CloakingDevice
{
[MyEntityComponentDescriptor(typeof(MyObjectBuilder_UpgradeModule), false, new string[] { "CloakingDevice_Large", "CloakingDevice_Small" })]
public class CloakingDevice : MyGameLogicComponent
{
private bool _isInit;
private IMyTerminalBlock m_block;
private int _phase=0;
private int _timeOut;
private IMyCubeGrid _grid;
private List<IMyFunctionalBlock> _myGunList = new List<IMyFunctionalBlock>();
private List<Sandbox.ModAPI.Ingame.IMyLargeTurretBase> _gunList = new List<Sandbox.ModAPI.Ingame.IMyLargeTurretBase>();
private List<IMyEntity> _entities = new List<IMyEntity>();
private List<IMySlimBlock> _slimBlocks = new List<IMySlimBlock>();
private bool firstRun = true;
private MyObjectBuilder_EntityBase _builder = null;
public static MyDefinitionId Electricity = new MyDefinitionId(typeof(MyObjectBuilder_GasProperties), "Electricity");
protected IMyUpgradeModule _imyUM;
private MyResourceSinkComponent _sink;
public float _power;
public float _mass;
private static bool _AllowAITargeting;
private static bool _PowerBasedOnMass;
private static float _PowerMultiplier;
private static float _SmallGridDivisor;
public override MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false)
{
return Container.Entity.GetObjectBuilder(copy);
}
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
if (_isInit) return;
m_block = Container.Entity as IMyTerminalBlock;
m_block.AppendingCustomInfo += appendCustomInfo;
_imyUM = Entity as IMyUpgradeModule;
if (!_imyUM.Components.TryGet(out _sink))
{
_sink = new MyResourceSinkComponent();
MyResourceSinkInfo info = new MyResourceSinkInfo();
info.ResourceTypeId = Electricity;
_sink.AddType(ref info);
_imyUM.Components.Add(_sink);
}
this.NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
// deprecated Container.Entity.NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
}
public class ConfigInfo
{
public bool AllowAITargeting;
public bool PowerBasedOnMass;
public float PowerMultiplier;
public float SmallGridDivisor;
}
public static void loadXML()
{
if (MyAPIGateway.Utilities.FileExistsInLocalStorage("config.cfg", typeof(ConfigInfo)))
try {
var reader = MyAPIGateway.Utilities.ReadFileInLocalStorage("config.cfg", typeof(ConfigInfo));
var xmlText = reader.ReadToEnd();
reader.Close();
ConfigInfo fileData = MyAPIGateway.Utilities.SerializeFromXML<ConfigInfo>(xmlText);
_AllowAITargeting=fileData.AllowAITargeting;
_PowerBasedOnMass=fileData.PowerBasedOnMass;
if (fileData.PowerMultiplier!=0) _PowerMultiplier=fileData.PowerMultiplier;
if (fileData.SmallGridDivisor!=0) _SmallGridDivisor=fileData.SmallGridDivisor;
} catch (Exception ex) {}
}
public static void saveXML()
{
ConfigInfo fileData = new ConfigInfo();
fileData.AllowAITargeting=_AllowAITargeting;
fileData.PowerBasedOnMass=_PowerBasedOnMass;
fileData.PowerMultiplier=_PowerMultiplier;
fileData.SmallGridDivisor=_SmallGridDivisor;
var writer = MyAPIGateway.Utilities.WriteFileInLocalStorage("config.cfg", typeof(ConfigInfo));
writer.Write(MyAPIGateway.Utilities.SerializeToXML(fileData));
writer.Flush();
writer.Close();
}
public override void Close()
{
if (firstRun) return;
foreach (var block in _slimBlocks) try { block.Dithering = 0f; } catch (Exception ex) {}
foreach (var ent in _entities)
try {
ent.Render.Transparency = 0f;
ent.Render.RemoveRenderObjects();
ent.Render.AddRenderObjects();
} catch (Exception ex) {}
foreach (var slim in _slimBlocks) try { slim.Dithering=0f; } catch (Exception ex) {}
try { _grid.Render.Visible=true; } catch (Exception ex) {}
_entities.Clear();
_slimBlocks.Clear();
}
public override void UpdateOnceBeforeFrame()
{
this.NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME;
this.NeedsUpdate |= MyEntityUpdateEnum.EACH_10TH_FRAME;
this.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
// Container.Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME;
// Container.Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_10TH_FRAME;
// Container.Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
}
bool IsWorking()
{
if(_imyUM.Closed || _imyUM.MarkedForClose)
{
MarkForClose();
return false;
}
if (!_sink.IsPowerAvailable(Electricity, _power) && _imyUM.Enabled)
{
_timeOut=0;
_imyUM.Enabled=false;
}
return (_imyUM.IsFunctional && _imyUM.Enabled);
}
public void appendCustomInfo(Sandbox.ModAPI.IMyTerminalBlock block, StringBuilder info)
{
info.Clear();
info.AppendLine("Type: " + m_block.DefinitionDisplayNameText);
info.AppendLine("Required input: " + _power.ToString("N") + " MW");
info.AppendLine("Current input: " + _sink.CurrentInputByType(Electricity).ToString("N") + "MW");
}
void InitResourceSink()
{
_sink.SetMaxRequiredInputByType(Electricity, _power);
_sink.SetRequiredInputFuncByType(Electricity, PowerConsumptionFunc);
_sink.SetRequiredInputByType(Electricity, PowerConsumptionFunc());
_sink.Update();
}
float PowerConsumptionFunc()
{
if (!IsWorking()) return 0f;
return _power;
}
public override void UpdateBeforeSimulation()
{
if (!_isInit) return;
if (IsWorking() || _timeOut>0)
foreach (var gun in _myGunList)
gun.Enabled=false;
if (!IsWorking() && _gunList.Count>0)
{
foreach (var gun in _gunList)
{
gun.Enabled=true;
gun.ResetTargetingToDefault();
}
_gunList.Clear();
}
}
public override void UpdateBeforeSimulation100()
{
if (!_isInit)
try {
_AllowAITargeting=true;
_PowerBasedOnMass=false;
_PowerMultiplier=1.0f;
_SmallGridDivisor=8.0f;
loadXML();
saveXML();
var f_block = Container.Entity as IMyFunctionalBlock;
f_block.Enabled=false;
InitResourceSink();
_grid = m_block.CubeGrid as VRage.Game.ModAPI.IMyCubeGrid;
if (_grid.GridSizeEnum==(byte)0) _SmallGridDivisor=1f;
_mass = _grid.Physics.Mass;
_power = 300f * _PowerMultiplier / _SmallGridDivisor;
if (_PowerBasedOnMass) _power *= (_mass/500000f);
m_block.RefreshCustomInfo();
_isInit=true;
} catch (Exception ex) { return; }
if (_PowerBasedOnMass && _grid.Physics.Mass!=_mass)
{
_mass = _grid.Physics.Mass;
_power = 300f * _PowerMultiplier * (_mass/500000f) / _SmallGridDivisor;
m_block.RefreshCustomInfo();
}
if (!IsWorking()) return;
if (firstRun) firstRun=false;
_myGunList.Clear();
List<IMySlimBlock> blockList = new List<IMySlimBlock>();
_grid.GetBlocks(blockList);
foreach (var block in blockList) if (block.FatBlock is IMyUserControllableGun)
{
var gun = block.FatBlock as IMyFunctionalBlock;
if (gun!=null) _myGunList.Add(gun);
}
}
public override void UpdateBeforeSimulation10()
{
if (!_isInit) return;
if (IsWorking() && !_AllowAITargeting)
{
foreach (var gun in _gunList)
{
gun.Enabled=true;
gun.ResetTargetingToDefault();
}
_gunList.Clear();
Vector3D gridPos = _grid.Physics.CenterOfMassWorld;
BoundingSphereD sphere = new BoundingSphereD(gridPos, 1000f);
List<IMyEntity> entList = MyAPIGateway.Entities.GetEntitiesInSphere(ref sphere);
foreach (var ent in entList)
{
var cube = ent as IMyCubeBlock;
if (cube==null) continue;
var obj = cube.GetObjectBuilderCubeBlock(false);
if (obj==null) continue;
var turret = obj as MyObjectBuilder_TurretBase;
if (turret==null) continue;
IMyEntity target;
MyAPIGateway.Entities.TryGetEntityById(turret.Target, out target);
if (target==null) continue;
cube = target as IMyCubeBlock;
if (cube==null) continue;
var grid = cube.CubeGrid;
if (grid==null || grid!=_grid) continue;
var fblock = ent as Sandbox.ModAPI.Ingame.IMyLargeTurretBase;
if (fblock==null) continue;
_gunList.Add(fblock);
fblock.Enabled=false;
fblock.Azimuth=0;
fblock.Elevation=0;
fblock.ResetTargetingToDefault();
}
}
if (_timeOut>0) _timeOut--;
foreach (var slim in _slimBlocks) try {
if (slim.CubeGrid!=_grid)
slim.Dithering=0f;
} catch (Exception ex) {}
foreach (var ent in _entities) try {
var block = ent as IMyCubeBlock;
if (block.CubeGrid!=_grid) {
ent.Render.Transparency = 0f;
ent.Render.RemoveRenderObjects();
ent.Render.AddRenderObjects();
}
} catch (Exception ex) {}
if (_phase==0 && !IsWorking()) return;
if ((_phase==-20 && IsWorking()) || _timeOut>0) return;
_sink.Update();
m_block.RefreshCustomInfo();
if (IsWorking()) _phase--; else _phase++;
float transparency = (float)_phase/20f;
foreach (var ent in _entities)
{
ent.Render.Transparency = 0f;
ent.Render.RemoveRenderObjects();
ent.Render.AddRenderObjects();
}
_entities.Clear();
_slimBlocks.Clear();
_grid.GetBlocks(_slimBlocks);
foreach (var block in _slimBlocks) {
block.Dithering = transparency;
var ent = block.FatBlock as MyEntity;
if (ent!=null) addEntities(ent);
var motor = block.FatBlock as IMyMotorBase;
if (motor!=null) {
var rotor = motor.Rotor.SlimBlock;
if (rotor!=null) rotor.Dithering = transparency;
}
var piston = block.FatBlock as IMyPistonBase;
if (piston!=null) {
var top = piston.Top.SlimBlock;
if (top!=null) top.Dithering = transparency;
}
}
foreach (var ent in _entities)
{
ent.Render.Transparency = transparency;
ent.Render.RemoveRenderObjects();
ent.Render.AddRenderObjects();
}
if (_phase==0 || _phase==-20)
{
_timeOut=30;
_grid.Render.Visible=(_phase==0);
}
}
public void addEntities(MyEntity ent)
{
if (ent.Subparts==null) return;
foreach (var part in ent.Subparts)
{
_entities.Add(part.Value);
addEntities(part.Value);
}
}
}
} | mit |
plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/aaxis/_dtick.py | 493 | import _plotly_utils.basevalidators
class DtickValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="dtick", parent_name="layout.ternary.aaxis", **kwargs
):
super(DtickValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "plot"),
implied_edits=kwargs.pop("implied_edits", {"tickmode": "linear"}),
**kwargs
)
| mit |
rmoriz/decaptcha | lib/decaptcha/provider.rb | 43 | module Decaptcha
module Provider; end
end | mit |
JasonHaley/Redis.WebJobs.Extensions | source/Redis.WebJobs.Extensions/Samples/Publisher/Functions.cs | 3478 | using Microsoft.Azure.WebJobs;
using Redis.WebJobs.Extensions;
using System;
using System.IO;
namespace Publisher
{
public static class Functions
{
// PubSub Examples ***********************************************************************************
// Pub/Sub example: output binding that publishes a string message on a given channel
public static void SendStringMessage(
[Redis("pubsub:stringMessages", Mode.PubSub)] out string message,
TextWriter log)
{
message = "This is a test";
log.WriteLine($"Sending message: {message}");
}
// Pub/Sub example: output binding that publishes multiple messages on a given channel
public static void SendMultipleStringPubSubMessages(
[Redis("pubsub:stringMessages", Mode.PubSub)] IAsyncCollector<string> messages,
TextWriter log)
{
messages.AddAsync("Message 1");
messages.AddAsync("Message 2");
messages.AddAsync("Message 3");
log.WriteLine($"Sending 3 messages");
}
// Pub/Sub example: output binding that publishes a POCO on a given channel
public static void SendPocoMessage(
[Redis("pubsub:pocoMessages", Mode.PubSub)] out Message message,
TextWriter log)
{
message = new Message
{
Text = "This is a test POCO message",
Sent = DateTime.UtcNow,
Id = Guid.Parse("bc3a6131-937c-4541-a0cf-27d49b96a5f2")
};
log.WriteLine($"Sending Message from SendPubSubMessage(): {message.Id}");
}
// Cache Examples ***********************************************************************************
// Cache example: output binding that sets a string value in the cache for a given key
public static void SetStringToCache(
[Redis("StringKey", Mode.Cache)] out string value,
TextWriter log)
{
value = "This is a test value at " + DateTime.UtcNow;
log.WriteLine($"Adding String to cache from SetStringToCache(): {value}");
}
// Cache example: output binding that uses a name resolver to get the cache key to set the
// string value to
public static void SetStringToCacheUsingResolver(
[Redis("%CacheKey%", Mode.Cache)] out string value,
TextWriter log)
{
value = "This is a test sent using a name resolver for CacheKey at " + DateTime.UtcNow;
log.WriteLine($"Adding String to cache from SetStringToCacheUsingResolver(): {value}");
}
// Cache example: output binding that sets a POCO objec in the cache for a given key
public static void SetPocoToCache(
[Redis("PocoKey", Mode.Cache)] out Message message,
TextWriter log)
{
message = new Message
{
Text = "message #",
Sent = DateTime.UtcNow,
Id = Guid.Parse("bc3a6131-937c-4541-a0cf-27d49b96a5f2")
};
log.WriteLine($"Adding Message to cache from SetPocoToCache(): {message.Id}");
}
public class Message
{
public Guid Id { get; set; }
public string Text { get; set; }
public DateTime Sent { get; set; }
}
}
}
| mit |
ubpb/metacrunch-ubpb | spec/metacrunch/ubpb/transformations/mab_to_primo/add_issn_spec.rb | 706 | describe Metacrunch::UBPB::Transformations::MabToPrimo::AddIssn do
transformation = transformation_factory(described_class)
define_field_test '000637121', issn: ['0935-4018', '1437-2940']
context "secondary forms issns" do
context "for a RDA record" do
subject do
mab_xml = mab_xml_builder do
datafield("649", ind2: "1") do
subfield("x", "0935-4018")
end
datafield("649", ind2: "1") do
subfield("x", "1437-2940")
subfield("x", "1437-2941")
end
end
transformation.call(mab_xml)["issn"]
end
it { is_expected.to eq(["0935-4018", "1437-2940", "1437-2941"]) }
end
end
end
| mit |
dnair926/AjaxControlToolkit.Extended | AjaxControlToolkit.SampleSite/About.aspx.cs | 318 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace AjaxControlToolkit.SampleSite
{
public partial class About : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
} | mit |
mainio/c5_automatic_email_obfuscator | src/EmailObfuscator/HtmlObfuscator.php | 1025 | <?php
namespace Concrete\Package\AutomaticEmailObfuscator\Src\EmailObfuscator;
use Concrete\Core\Asset\AssetList;
use Concrete\Core\Http\ResponseAssetGroup;
class HtmlObfuscator extends AbstractObfuscator
{
public function registerViewAssets()
{
$al = AssetList::getInstance();
$al->register(
'javascript', 'automatic_email_obfuscator/html', 'js/email_deobfuscator_html.js', array(),
'automatic_email_obfuscator'
);
$r = ResponseAssetGroup::get();
$r->requireAsset('javascript', 'automatic_email_obfuscator/html');
}
public function obfuscateMail($email)
{
$ret = "";
$email = str_replace("@", "(at)", $email);
for ($i = 0; $i < strlen($email); $i++) {
$ret .= "&#" . ord($email[$i]) . ";";
}
return $ret;
}
public function obfuscateMailtoLinkHref($href)
{
$href = $this->obfuscateMail(str_replace("mailto:", "", $href));
return "#MAIL:" . $href;
}
} | mit |
solguttman/nodejs | gulpfile.js | 362 | //Gulp stuff
var gulp = require('gulp');
var sass = require('gulp-sass');
var prefixer = require('gulp-autoprefixer');
var minify = require('gulp-minify-css');
// Default task
gulp.task('default',['sass']);
//Build Sass
gulp.task('sass',function(){
gulp
.src('./stylesheets/main.scss')
.pipe(sass())
.pipe(prefixer())
.pipe(gulp.dest('./public'));
}); | mit |
zenilt/bicubic-framework-php | web/lib/bicubic/MandrillEmail.php | 3152 | <?php
/*
* The MIT License
*
* Copyright 2015 Juan Francisco Rodríguez.
*
* 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.
*/
class MandrillEmail {
public $to;
public $from;
public $fromName;
public $subject;
public $error;
function __construct($to, $from, $fromName, $subject) {
$this->to = $to;
$this->from = $from;
$this->fromName = $fromName;
$this->subject = $subject;
}
function send($key, $html, $text = "") {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://mandrillapp.com/api/1.0/messages/send.json");
curl_setopt($ch, CURLOPT_POST, 1);
$jsonObject = new ObjectJson();
$jsonObject->key = $key;
$jsonObject->message = new ObjectJson();
$jsonObject->message->html = $html;
$jsonObject->message->text = $text;
$jsonObject->message->subject = $this->subject;
$jsonObject->message->from_email = $this->from;
$jsonObject->message->from_name = $this->fromName;
$jsonObject->message->to = array();
$toObject = new ObjectJson();
$toObject->email = $this->to;
$jsonObject->message->to [] = $toObject;
$jsonObject->async = true;
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($jsonObject));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// $result = curl_exec($ch);
// if ($result) {
// $r = json_decode($result);
// if ($r) {
// if (property_exists($r, "status") && $r->status == "error") {
// $this->error = $r->message;
// } else {
// foreach ($r as $key=> $response) {
// if (property_exists($response, "status") && $response->status != "error") {
// return true;
// }
// if (property_exists($response, "status") && $response->status == "error") {
// $this->error = $r->message;
// }
// break;
// }
// }
// }
// }
// curl_close($ch);
// return false;
curl_exec($ch);
curl_close($ch);
return true;
}
}
| mit |
nirvash/Justaway-for-Android-Original | Justaway/src/main/java/info/justaway/fragment/main/tab/ReactionsFragment.java | 1823 | package info.justaway.fragment.main.tab;
import android.os.AsyncTask;
import android.view.View;
import info.justaway.event.model.StreamingCreateFavoriteEvent;
import info.justaway.model.AccessTokenManager;
import info.justaway.model.Row;
import info.justaway.model.TabManager;
import info.justaway.model.TwitterManager;
import info.justaway.settings.BasicSettings;
import info.justaway.util.StatusUtil;
import twitter4j.Paging;
import twitter4j.ResponseList;
import twitter4j.Status;
public class ReactionsFragment extends BaseFragment {
@Override
protected boolean isSkip(Row row) {
if (row.isFavorite()) {
// 自分の Fav は除外
return row.getSource().getId() == AccessTokenManager.getUserId();
}
if (row.isStatus()) {
Status status = row.getStatus();
Status retweet = status.getRetweetedStatus();
/**
* 自分のツイートがRTされた時
*/
if (retweet != null && retweet.getUser().getId() == AccessTokenManager.getUserId()) {
return false;
}
}
return true;
}
@Override
public long getTabId() {
return TabManager.REACTIONS_TAB_ID;
}
@Override
protected void taskExecute() {
// 対応する REST API はない。
// ストリームで受けとったものしか表示されない
mReloading = false;
mPullToRefreshLayout.setRefreshComplete();
mListView.setVisibility(View.VISIBLE);
return;
}
/**
* ストリーミングAPIからふぁぼを受け取った時のイベント
* @param event ふぁぼイベント
*/
public void onEventMainThread(StreamingCreateFavoriteEvent event) {
addStack(event.getRow());
}
}
| mit |
1988gadocansey/srms-laravel | app/Models/WorkerModel.php | 378 | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class WorkerModel extends Model
{
//
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'tpoly_workers';
protected $primaryKey="id";
protected $guarded = ['id'];
public $timestamps = false;
}
| mit |
bgourlie/BriansMod | Oxide.Ext.BriansMod/Model/Rust/Contracts/IHeldEntity.cs | 171 | namespace Oxide.Ext.BriansMod.Model.Rust.Contracts
{
public interface IHeldEntity : IBaseEntity
{
HoldType HoldType { get; }
IBasePlayer OwnerPlayer { get; }
}
} | mit |
drewtorg/wramtas | src/templates/informationPage.tsx | 667 | import React from 'react';
import { graphql } from 'gatsby';
import MainLayout from '../layouts';
import { documentToReactComponents } from '@contentful/rich-text-react-renderer';
import { richTextToComponents } from '../utils/render';
const InformationPage = ({ data }: any) => {
const page = data.contentfulInformationPage;
return (
<MainLayout>
<div className="informationPage">{richTextToComponents(page.content.json)}</div>
</MainLayout>
);
};
export default InformationPage;
export const pageQuery = graphql`
query($slug: String!) {
contentfulInformationPage(slug: { eq: $slug }) {
content {
json
}
}
}
`;
| mit |
AndriusBil/material-ui | src/styles/spacing.d.ts | 67 | export type Spacing = {
unit: number;
};
export default Spacing;
| mit |
zflat/label_gen | lib/label_gen.rb | 579 | require 'prawn'
require 'i18n'
I18n.enforce_available_locales = true
I18n.load_path ||= []
I18n.load_path << [ File.join(File.dirname(__FILE__), "..", "config", "locales", "en.yml") ]
require 'data_mapper'
require "label_gen/configuration"
require "label_gen/version"
require "label_gen/frame_iter"
require "label_gen/page"
require "label_gen/number_generator"
require "label_gen/number_record"
require "label_gen/qr_render"
require "label_gen/template"
require "label_gen/utils"
module LabelGen
TEMPLATE_DIR = File.join(File.dirname(__FILE__), 'label_gen/template')
end
| mit |
queue-interop/amqp-interop | src/AmqpConsumer.php | 811 | <?php
declare(strict_types=1);
namespace Interop\Amqp;
use Interop\Queue\Consumer;
/**
* @method AmqpMessage|null receiveNoWait()
* @method AmqpMessage|null receive(int $timeout = 0)
* @method AmqpQueue getQueue()
* @method void acknowledge(AmqpMessage $message)
* @method void reject(AmqpMessage $message, bool $requeue)
*/
interface AmqpConsumer extends Consumer
{
const FLAG_NOPARAM = 0;
const FLAG_NOLOCAL = 1;
const FLAG_NOACK = 2;
const FLAG_EXCLUSIVE = 4;
const FLAG_NOWAIT = 8;
public function setConsumerTag(string $consumerTag = null): void;
public function getConsumerTag(): ?string;
public function clearFlags(): void;
public function addFlag(int $flag): void;
public function getFlags(): int;
public function setFlags(int $flags): void;
}
| mit |
ycabon/presentations | 2020-devsummit/arcgis-js-api-road-ahead/js-api/esri/widgets/Directions.js | 24894 | // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.16/esri/copyright.txt for details.
//>>built
define("require exports ../core/tsSupport/declareExtendsHelper ../core/tsSupport/decorateHelper ../core/tsSupport/assignHelper dojo/i18n!../nls/common dojo/i18n!./Directions/nls/Directions ../intl ../moment ../core/Collection ../core/events ../core/Handles ../core/watchUtils ../core/accessorSupport/decorators ../libs/sortablejs/Sortable ./Search ./Widget ./Directions/DirectionsViewModel ./Directions/support/CostSummary ./Directions/support/directionsUtils ./Directions/support/maneuverUtils ./Directions/support/RouteSections ./support/DatePicker ./support/TimePicker ./support/widget".split(" "),
function(y,Q,z,e,A,v,g,p,B,C,w,D,l,h,E,F,G,x,H,q,I,J,K,L,c){function M(c){c=c.getTimezoneOffset();var b=Math.abs(Math.floor(c)%60);return"GMT"+(0<c?"-":"+")+p.formatNumber(Math.abs(Math.floor(c/60)),u)+p.formatNumber(b,u)}var N=y.toUrl("../themes/base/images/maneuvers/"),O={hour:"numeric",minute:"numeric"},u={minimumIntegerDigits:2};return function(u){function b(a){var d=u.call(this,a)||this;d._autoStopRemovalDelay=100;d._costSummary=new H;d._departureTime="now";d._datePicker=new K;d._handles=new D;
d._newPlaceholderStop=null;d._routeSections=new J;d._stops=new C([{},{}]);d._stopsToSearches=new Map;d._timePicker=new L;d.goToOverride=null;d.iconClass="esri-icon-directions";d.label=g.widgetLabel;d.lastRoute=null;d.maxStops=null;d.routeServiceUrl=null;d.routeSymbol=null;d.searchProperties=null;d.stopSymbols=null;d.view=null;d.viewModel=new x;d._setUpDragAndDropStops=function(a){d._sortable=E.create(a,{draggable:".esri-directions__stop-row--valid",ghostClass:"esri-directions__stop-row-ghost",handle:".esri-directions__stop-handle",
onEnd:d._handleStopInputDragEnd})};d._handleStopInputDragEnd=function(a){var c=a.oldIndex,b=a.newIndex;a=a.target;if(c!==b){var k=a.children,g=k[c];a.insertBefore(k[b],0>b-c?g.nextElementSibling:g);a=d._stops;a.reorder(a.getItemAt(c),b);d._processStops()}};return d}z(b,u);b.prototype.postInitialize=function(){var a=this;this.own([l.init(this,"viewModel.lastRoute",function(){a._routeSections.routePath=a.get("viewModel.directionLines");a._activeManeuver=null;a._focusedManeuver=null;a.scheduleRender()}),
l.init(this,"viewModel.selectedTravelMode, viewModel.departureTime",function(){1<a.get("viewModel.stops.length")&&a.getDirections()}),l.when(this,"view",function(d,c){c&&(a._viewClickHandle=null,a._handles.remove(c));d&&(c=a._prepViewClick(),a._handles.add([w.on(d.surface,"mousedown",function(){return a._autoStopRemovalDelay=500}),w.on(d.surface,"mouseup",function(){return a._autoStopRemovalDelay=100}),c],a.view.surface),a._viewClickHandle=c)}),l.whenOnce(this,"routeServiceUrl",function(){return a.viewModel.load()}),
l.watch(this,"viewModel.stops.length",function(d){0===d&&(a._stops.toArray().forEach(function(d){return a._removeStop(d,!0)}),a._stops.addMany([{},{}]),a.scheduleRender())})])};b.prototype.destroy=function(){this._datePicker.destroy();this._timePicker.destroy();this._stopsToSearches.forEach(function(a){return a.destroy()});this._sortable&&this._sortable.destroy()};b.prototype.getDirections=function(){return null};b.prototype.zoomToRoute=function(){};b.prototype.render=function(){return c.tsx("div",
{class:this.classes("esri-directions esri-widget esri-widget--panel","esri-directions__scroller")},this._renderPanelContent())};b.prototype._renderPanelContent=function(){var a,d=this.viewModel.state,b="initializing"===d,n="error"===d&&!this.viewModel.serviceDescription,f="unauthenticated"===d,d=(a={},a["esri-directions__panel-content--loading"]=b,a["esri-directions__panel-content--error"]=n,a["esri-directions__panel-content--sign-in"]=f,a);a=b?"presentation":"group";b=f?this._renderSignIn():n?this._renderMessage(this._getErrorMessage()):
b?this._renderLoader():this._renderReadyContent();return c.tsx("div",{class:this.classes("esri-directions__panel-content",d),role:a},b)};b.prototype._renderReadyContent=function(){return[this._renderStopsContainer(),this._renderTravelModeOptions(),this._renderDepartureTimeControls(),this._renderSectionSplitter(),this._renderDirectionsContainer(),this._renderDisclaimer()]};b.prototype._renderSignIn=function(){return c.tsx("div",{key:"sign-in",class:"esri-directions__sign-in-content"},c.tsx("h2",{class:this.classes("esri-widget__heading",
"esri-directions__content-title")},g.widgetLabel),this._renderPlaceholder(),c.tsx("h3",{class:"esri-widget__heading"},g.signInRequired),c.tsx("button",{class:this.classes("esri-button","esri-button--secondary","esri-directions__sign-in-button"),tabIndex:0,onclick:this._handleSignInClick,bind:this},v.auth.signIn))};b.prototype._handleSignInClick=function(){this.viewModel.load().catch(function(){})};b.prototype._renderTravelModeOptions=function(){var a=this.viewModel.travelModes;if(0===a.length)return null;
var d=this.viewModel.selectedTravelMode,b=d.name||g.travelMode;return c.tsx("select",{"aria-label":b,bind:this,class:this.classes("esri-directions__travel-modes-select","esri-select"),key:"esri-directions__travel-mode-options",onchange:this._handleTravelModeChange,title:b},a.map(function(a){return c.tsx("option",{key:a,"data-mode":a,selected:a.id===d.id,value:a.id},a.name)}))};b.prototype._handleTravelModeChange=function(a){a=a.currentTarget;a=a.item(a.selectedIndex);this.viewModel.selectedTravelMode=
a["data-mode"]};b.prototype._renderStopsContainer=function(){return c.tsx("div",{class:"esri-directions__section",key:"esri-directions__stops-container",role:"group"},this._renderStops())};b.prototype._renderDepartureTimeControls=function(){var a="now"===this._departureTime,d=g.departureTime;return c.tsx("div",{class:"esri-directions__departure-time",key:"esri-directions__departure-time-controls",role:"group"},c.tsx("select",{"aria-label":d,bind:this,class:this.classes("esri-directions__departure-time-select",
"esri-select"),onchange:this._handleDepartureOptionChange,title:d},c.tsx("option",{value:"now",selected:a},g.leaveNow),c.tsx("option",{value:"depart-by",selected:!a},g.departBy)),a?null:this._renderTimeControls())};b.prototype._renderStops=function(){var a=this,d=this._stops,b=d.toArray().map(function(b,k){var n,f,e,m=d.length,h=1<k&&!b.result,P=(n={},n["esri-icon-radio-unchecked"]=0<=k&&k<m-1,n["esri-icon-radio-checked"]=k===m-1,n);n=(f={},f["esri-directions__stop-icon-container--last"]=k===m-1,
f);f=(e={},e["esri-directions__stop-row--valid"]=!h,e);var l=(e=d.getItemAt(m-1))&&e.result;e=(e=d.getItemAt(k+1))&&e.result;var r=k===m-1,t=k===m-2;e=2===m&&0===k||2<m&&!r&&!t||2<m&&t&&e||2<m&&r&&!b.result;var m=2===m||3===m&&!l||h,h=a._acquireSearch(b),l=g.removeStop,r=g.reverseStops,t=g.unlocated,t=p.substitute(g.stopLabelTemplate,{number:k+1,label:b.result?b.result.name:t}),q=a.id+"__stop--"+k;b=!!h.searchTerm&&!!h.selectedResult&&!!b.result&&h.selectedResult===b.result;return c.tsx("li",{"aria-label":t,
afterCreate:a._handleStopFieldCreation,bind:a,class:a.classes("esri-directions__stop-row",f),id:q,key:k,"data-stop-index":k},c.tsx("div",{class:"esri-directions__stop-handle"},c.tsx("span",{"aria-hidden":"true",class:a.classes("esri-directions__stop-icon","esri-icon-handle-vertical","esri-directions__stop-handle-icon","esri-directions__stop-icon--interactive")}),c.tsx("div",{bind:a,"aria-labelledby":q,class:a.classes("esri-directions__stop-icon-container",n),"data-stop-index":k,onclick:a._handleStopIconClick,
onkeydown:a._handleStopIconClick,role:"button"},c.tsx("span",{class:a.classes("esri-directions__stop-icon",P),tabindex:b?"0":null}))),c.tsx("div",{class:"esri-directions__stop-input"},h.render(),c.tsx("div",{class:"esri-directions__stop-underline"})),c.tsx("div",{class:"esri-directions__stop-options",role:"group"},c.tsx("div",{"aria-label":l,class:"esri-directions__remove-stop",bind:a,"data-stop-index":k,hidden:m,onkeydown:a._handleRemoveStop,onclick:a._handleRemoveStop,role:"button",tabIndex:0,title:l},
c.tsx("span",{"aria-hidden":"true",class:a.classes("esri-directions__stop-icon","esri-directions__remove-stop-icon","esri-icon-close","esri-directions__stop-icon--interactive")}),c.tsx("span",{class:"esri-icon-font-fallback-text"},"removeStopTitle")),c.tsx("div",{"aria-label":r,class:"esri-directions__reverse-stops",bind:a,hidden:e,onkeydown:a._handleReverseStops,onclick:a._handleReverseStops,role:"button",tabIndex:0,title:r},c.tsx("span",{"aria-hidden":"true",class:a.classes("esri-directions__stop-icon",
"esri-icon-up-down-arrows","esri-directions__stop-icon--interactive")}),c.tsx("span",{class:"esri-icon-font-fallback-text"},"removeStopTitle"))))}),n=d.every(function(d){var b=a._stopsToSearches.get(d);return d.result&&b.selectedResult===d.result}),f=this._stops.length>=this.maxStops,e=g.addStop,n=2<=d.length&&n&&!f?c.tsx("div",{"aria-label":e,bind:this,class:"esri-directions__add-stop",key:"esri-directions__add-stop",onfocus:this._handleAddStopFocus,tabIndex:0},c.tsx("span",{"aria-hidden":"true",
class:this.classes("esri-icon-plus","esri-directions__stop-icon","esri-directions__stop-icon--interactive")}),c.tsx("div",{"aria-hidden":"true",class:"esri-directions__add-stop-text"},e)):null;return c.tsx("div",null,c.tsx("ol",{class:"esri-directions__stops",role:"group",afterCreate:this._setUpDragAndDropStops},b),n)};b.prototype._handleStopIconClick=function(a){(a=this._stops.getItemAt(a.currentTarget["data-stop-index"]))&&a.result&&this._centerAtStop(a)};b.prototype._handleClearRouteClick=function(){this.viewModel.reset()};
b.prototype._centerAtStop=function(a){this.viewModel.centerAt(a.result.feature)};b.prototype._handleStopFieldCreation=function(a){var d=this._newPlaceholderStop;d&&(a=this._stops.getItemAt(a["data-stop-index"]),d===a&&this._acquireSearch(a).focus(),this._newPlaceholderStop=null)};b.prototype._handleStopInputBlur=function(a,d){var b=this;this._handles.remove("awaiting-view-click-stop");this.view.cursor=this._previousCursor;a.selectedResult&&d.result&&a.selectedResult===d.result||("none"!==a.activeMenu||
!a.searchTerm||a.selectedResult===d.result&&(a.selectedResult||d.result)?a.searchTerm||(this._viewClickHandle.resume(),clearTimeout(this._autoStopRemovalTimeoutId),this._autoStopRemovalTimeoutId=setTimeout(function(){b.destroyed||(b._viewClickHandle.pause(),"searching"!==a.viewModel.state&&(b._removeStop(d),d.result&&(d.result=null,b._processStops()),b.scheduleRender()))},this._autoStopRemovalDelay)):a.search())};b.prototype._handleStopInputFocus=function(a,d){if(!this._handles.has("awaiting-view-click-stop")){var b=
this.view,c=this.view.cursor;this._previousCursor=c;this._handles.add(l.init(a,"searchTerm",function(a){b.cursor=0===a.length?"copy":c}),"awaiting-view-click-stop");this._activeStop=d}};b.prototype._prepViewClick=function(){var a=this,d=this.get("viewModel.view"),b=w.pausable(d,"click",this._handleViewClick.bind(this)),c=w.pausable(d.surface,"click",function(){clearTimeout(a._autoStopRemovalTimeoutId);c.pause()});return{remove:function(){c.remove();b.remove()},pause:function(){c.pause();b.pause()},
resume:function(){c.resume();b.resume()}}};b.prototype._handleViewClick=function(a){var d=this,b=this._stopsToSearches.get(this._activeStop);b&&!b.searchTerm&&(b.search(a.mapPoint).then(function(a){a=a.results[0].results[0];var c=d._activeStop;c.result=a;c.result.feature.attributes.Name=a.name;b.searchTerm=a.name}),this.scheduleRender());this._viewClickHandle.pause();clearTimeout(this._autoStopRemovalTimeoutId)};b.prototype._handleAddStopFocus=function(){this._addNewPlaceholder()};b.prototype._addNewPlaceholder=
function(){if(!this._newPlaceholderStop){var a={};this._stops.add(a);this._newPlaceholderStop=a}};b.prototype._handleReverseStops=function(){this._reverseStops()};b.prototype._reverseStops=function(){this._stops.reverse();this._processStops()};b.prototype._handleRemoveStop=function(a){this._removeStop(this._stops.getItemAt(a.currentTarget["data-stop-index"]));this._processStops()};b.prototype._removeStop=function(a,b){void 0===b&&(b=!1);2>=this._stops.length&&!b||(this._disposeSearch(a),this._stops.remove(a))};
b.prototype._handleDepartureOptionChange=function(){var a=this,b=event.currentTarget,b=b.item(b.selectedIndex);"now"===b.value?(this._departureTime="now",this.viewModel.departureTime="now",this._handles.remove("departure-time-controls")):"depart-by"===b.value&&(this._departureTime="depart-by",this._handles.add([l.init(this._datePicker,"value",function(){return a._updateDepartureTime()}),l.init(this._timePicker,"value",function(){return a._updateDepartureTime()})],"departure-time-controls"))};b.prototype._updateDepartureTime=
function(){var a=this._datePicker.value,b=this._timePicker.value,a=B({date:a.date(),month:a.month(),year:a.year(),hour:b.hour(),minute:b.minute()});this.viewModel.departureTime=a.toDate()};b.prototype._renderTimeControls=function(){return c.tsx("div",{class:"esri-directions__departure-time-controls",key:"esri-directions__time-controls",role:"group"},this._datePicker.render(),this._timePicker.render())};b.prototype._renderSectionSplitter=function(){return c.tsx("div",{class:"esri-directions__section-splitter"})};
b.prototype._renderDisclaimer=function(){var a=p.substitute(g.disclaimer,{esriTerms:'\x3ca class\x3d"esri-widget__anchor" href\x3d"http://www.esri.com/legal/software-license" rel\x3d"noreferrer" target\x3d"_blank"\x3e'+g.esriTerms+"\x3c/a\x3e"});return c.tsx("div",{class:"esri-directions__disclaimer",innerHTML:a,key:"esri-directions__disclaimer"})};b.prototype._renderDirectionsContainer=function(){return c.tsx("div",{class:this.classes("esri-directions__directions-section","esri-directions__section"),
key:"esri-directions__container"},this._renderDirectionsContainerContent())};b.prototype._renderLoader=function(){return c.tsx("div",{class:"esri-directions__loader",key:"loader"})};b.prototype._renderWarningCard=function(){return c.tsx("div",{class:"esri-directions__warning-card",role:"alert"},c.tsx("div",{class:"esri-directions__warning-header"},c.tsx("span",{class:"esri-icon-notice-triangle","aria-hidden":"true"}),c.tsx("div",{class:this.classes("esri-widget__heading","esri-directions__warning-heading")},
v.warning)),c.tsx("div",{class:"esri-directions__warning-message"},this._getErrorMessage()))};b.prototype._renderDirectionsContainerContent=function(){var a=this.viewModel,b=a.lastRoute,a=a.state,k="routing"===a;return"error"===a?this._renderWarningCard():k?this._renderLoader():b?c.tsx("div",{class:"esri-directions__summary",key:"esri-directions__summary",role:"group"},this._renderCosts(),this._renderRouteActions(),this._renderManeuverSections()):c.tsx("div",{key:"esri-directions__placeholder",class:"esri-widget__content--empty"},
this._renderPlaceholder(),c.tsx("h3",{class:this.classes("esri-directions__message","esri-widget__heading")},g.directionsPlaceholder))};b.prototype._renderPlaceholder=function(){return c.tsx("svg",{class:"esri-widget__content-illustration--empty",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256"},c.tsx("path",{fill:"currentcolor",d:"M192 36c-15.477 0-24 6.034-24 16.99v45.822l24 24 24-24v-45.82C216 42.033 207.477 36 192 36zm20 61.155l-20 20-20-20V52.99c0-8.62 6.73-12.99 20-12.99s20 4.37 20 12.99zM192 52a12 12 0 1 0 12 12 12.013 12.013 0 0 0-12-12zm0 20a8 8 0 1 1 8-8 8.008 8.008 0 0 1-8 8zM92 140.99C92 130.035 83.477 124 68 124s-24 6.034-24 16.99v45.822l24 24 24-24zm-4 44.165l-20 20-20-20V140.99c0-8.62 6.73-12.99 20-12.99s20 4.37 20 12.99zM68 140a12 12 0 1 0 12 12 12.013 12.013 0 0 0-12-12zm0 20a8 8 0 1 1 8-8 8.008 8.008 0 0 1-8 8zm84-44h16v4h-16zm-24 80h4v12h-12v-4h8zm0-28h4v16h-4zm0-52h12v4h-8v8h-4zm0 24h4v16h-4zm-36 64h16v4H92z"}))};
b.prototype._renderMessage=function(a){return c.tsx("h3",null,a)};b.prototype._renderRouteActions=function(){return c.tsx("div",{class:"esri-directions__route-actions"},c.tsx("button",{"aria-label":g.clearRoute,class:this.classes("esri-directions__clear-route-button","esri-button","esri-button--tertiary"),tabIndex:0,onclick:this._handleClearRouteClick,bind:this},g.clearRoute))};b.prototype._renderManeuverSections=function(){var a=this,b=this._routeSections.sections;return c.tsx("div",{class:"esri-directions__maneuvers",
role:"group"},b.map(function(d,n){var f,k,e=d.open,g;0<d.maneuvers.length&&e&&(g=c.tsx("ol",{class:"esri-directions__maneuver-list"},d.maneuvers.map(function(b){return a._renderManeuver(b)})));var h=2<b.length,l=n===b.length-1;n=(f={},f["esri-directions__maneuver-section--collapsible"]=h,f);f=(k={},k["esri-icon-right-triangle-arrow"]=!e,k["esri-icon-down-arrow"]=e,k);h&&!l?(k=e?v.open:v.close,d=c.tsx("header",{class:a.classes("esri-directions__maneuver-section-header","esri-directions__maneuver-section-toggle"),
key:"esri-directions__maneuver-section-header"},c.tsx("div",{"aria-expanded":e,"aria-label":k,bind:a,class:"esri-directions__maneuver-section-header-toggle-button","data-maneuver-section":d,onkeydown:a._handleSectionToggle,onclick:a._handleSectionToggle,role:"button",tabIndex:0,title:k},c.tsx("span",{"aria-hidden":"true",class:a.classes(f)}),c.tsx("h2",{class:a.classes("esri-widget__heading","esri-directions__maneuver-section-title")},d.name)))):d=c.tsx("header",{class:"esri-directions__maneuver-section-header",
key:"esri-directions__maneuver-section-header"},l?c.tsx("span",{"aria-hidden":"true",class:"esri-icon-radio-checked"}):null,c.tsx("h2",{class:a.classes("esri-widget__heading","esri-directions__maneuver-section-title")},d.name));return c.tsx("section",{class:a.classes("esri-directions__maneuver-section",n)},d,g)}))};b.prototype._handleSectionToggle=function(a){a=a.currentTarget["data-maneuver-section"];a.open=!a.open};b.prototype._renderCosts=function(){var a=this.get("viewModel.directionLines"),b=
new Date(a[a.length-1].attributes.arriveTimeUTC),a=this._costSummary.set({directionsViewModel:this.viewModel}),k=g.zoomToRoute,e=p.formatDate(b,O),b=p.substitute(g.etaTemplate,{time:"\x3cstrong\x3e"+e+"\x3c/strong\x3e",gmt:""+M(b)}),e=g.primaryCosts,f=g.secondaryCosts,h=g.eta;return c.tsx("div",{"aria-label":k,bind:this,class:"esri-directions__costs",onkeydown:this._handleSummaryInteraction,onclick:this._handleSummaryInteraction,role:"button",tabIndex:0,title:k},c.tsx("div",{class:"esri-directions__costs-details",
role:"group"},c.tsx("div",{"aria-label":e,class:"esri-directions__costs-value",title:e},a.primary),c.tsx("div",{class:"esri-directions__vertical-splitter"}),c.tsx("div",{"aria-label":f,class:"esri-directions__other-costs-total",title:f},a.secondary)),c.tsx("div",{"aria-label":h,innerHTML:b,title:h}))};b.prototype._handleSummaryInteraction=function(){this._focusedManeuver=this._activeManeuver=null;this.viewModel.clearHighlights();this.zoomToRoute()};b.prototype._getErrorMessage=function(){var a=this.viewModel.error;
return"directions-view-model:unable-to-route"===a.name?g.errors.unableToRoute:"directions-view-model:service-metadata-unavailable"===a.name?g.errors.unableToLoadServiceMetadata:g.errors.unknownError};b.prototype._normalizeSearchSources=function(a){this._overrideDefaultSources(a);this._ensureLocationTypeOnLocatorSources(a)};b.prototype._overrideDefaultSources=function(a){var b=a.view?g.searchFieldPlaceholder:g.viewlessSearchFieldPlaceholder;a.viewModel.defaultSources.forEach(function(a){a.placeholder=
b;a.autoNavigate=!1})};b.prototype._ensureLocationTypeOnLocatorSources=function(a){a=a.allSources;0!==a.length&&a.forEach(function(a){"locator"in a&&a.locator&&null===a.locationType&&(a.locationType="street")})};b.prototype._acquireSearch=function(a){var b=this,c=this.get("viewModel.view");if(this._stopsToSearches.has(a)){var e=this._stopsToSearches.get(a);e.view=c;this._overrideDefaultSources(e);return e}var f=new F(A({view:c,resultGraphicEnabled:!1,popupEnabled:!1},this.searchProperties));this._normalizeSearchSources(f);
this._handles.add([l.on(f,"allSources","change",function(){return b._normalizeSearchSources(f)}),f.on("select-result",function(){a.result=f.selectedResult;a.result.feature.attributes.Name=f.selectedResult.name;b._processStops();b.scheduleRender()}),f.on("search-focus",function(){return b._handleStopInputFocus(f,a)}),f.on("search-blur",function(){return b._handleStopInputBlur(f,a)})],f);this._stopsToSearches.set(a,f);return f};b.prototype._disposeSearch=function(a){this._stopsToSearches.get(a).destroy();
this._stopsToSearches.delete(a)};b.prototype._processStops=function(){var a=this.viewModel;a.stops.removeAll();a.stops.addMany(this._stops.filter(function(a){return!!a.result}).map(function(a){return a.result.feature}));1<a.stops.length&&a.getDirections()};b.prototype._renderManeuver=function(a){var b,e,h=a.attributes,f=this.get("viewModel.routeParameters.directionsLengthUnits"),f=q.formatDistance(h.length,{toUnits:f}),m=q.formatTime(h.time),l=q.getAssociatedStop(a);q.useSpatiallyLocalTime(a,this.get("viewModel.routeParameters.startTime"))?
e=q.toSpatiallyLocalTimeString(h.arriveTimeUTC,h.ETA,"now"===this._departureTime):f&&(e=m?f+"\x26nbsp;\x26middot;\x26nbsp;"+m:f);f=this._getFormattedManeuverText(a);h=this._getIconPath(h.maneuverType);if(l)return c.tsx("li",{class:"esri-directions__maneuver",key:a},c.tsx("header",null,l.attributes.Name));var l="esri-directions__maneuver-"+a.uid,m="esri-directions__cumulative-costs-"+a.uid,r="esri-directions__intermediate-costs-"+a.uid,p=(b={},b["esri-directions__maneuver--active"]=this._activeManeuver===
a,b);return c.tsx("li",{"aria-labelledby":l+" "+m+" "+r,bind:this,class:this.classes("esri-directions__maneuver",p),"data-maneuver":a,key:a,onclick:this._handleManeuverClick,onkeydown:this._handleManeuverClick,onfocus:this._handleManeuverFocus,onmouseover:this._handleManeuverMouseOver,onmouseout:this._handleManeuverMouseOut,onblur:this._handleManeuverBlur,tabIndex:0},c.tsx("img",{alt:"",class:"esri-directions__maneuver-icon",src:h}),c.tsx("div",{class:"esri-directions__maneuver-costs-container"},
c.tsx("span",{id:l,innerHTML:f}),c.tsx("div",{class:"esri-directions__maneuver-costs"},c.tsx("div",{class:"esri-directions__horizontal-splitter"}),c.tsx("div",{id:m,"aria-label":g.cumulativeCosts,class:"esri-directions__cost--cumulative",innerHTML:"",title:g.cumulativeCosts}),c.tsx("div",{id:r,"aria-label":g.intermediateCosts,class:"esri-directions__cost--intermediate",innerHTML:e,title:g.intermediateCosts}))))};b.prototype._getIconPath=function(a){a=I.toIconName(a);return""+N+a+(2===window.devicePixelRatio?
"@2x":"")+".png"};b.prototype._handleManeuverClick=function(a){a=a.currentTarget["data-maneuver"];this._activeManeuver===a?(this._activeManeuver=null,this.zoomToRoute()):(this._activeManeuver=a,this.viewModel.centerAt(a),this.viewModel.highlightSegment(a))};b.prototype._handleManeuverMouseOver=function(a){this._activeManeuver||this._focusedManeuver||this.viewModel.highlightSegment(a.currentTarget["data-maneuver"])};b.prototype._handleManeuverMouseOut=function(){this._activeManeuver||this._focusedManeuver||
this.viewModel.clearHighlights()};b.prototype._handleManeuverBlur=function(){this._activeManeuver||(this._focusedManeuver=null,this.viewModel.clearHighlights())};b.prototype._handleManeuverFocus=function(a){this._activeManeuver||(this._focusedManeuver=a=a.currentTarget["data-maneuver"],this.viewModel.highlightSegment(a))};b.prototype._getFormattedManeuverText=function(a){var b=a.attributes.text;a=a.strings;if(!a)return b;var c=b;a.forEach(function(a){c=c.replace(a.string,"\x3cstrong\x3e"+a.string+
"\x3c/strong\x3e")});return c};e([h.aliasOf("viewModel.goToOverride")],b.prototype,"goToOverride",void 0);e([h.property()],b.prototype,"iconClass",void 0);e([h.property()],b.prototype,"label",void 0);e([h.aliasOf("viewModel.lastRoute")],b.prototype,"lastRoute",void 0);e([h.aliasOf("viewModel.maxStops")],b.prototype,"maxStops",void 0);e([h.aliasOf("viewModel.routeServiceUrl")],b.prototype,"routeServiceUrl",void 0);e([h.aliasOf("viewModel.routeSymbol")],b.prototype,"routeSymbol",void 0);e([h.property()],
b.prototype,"searchProperties",void 0);e([h.aliasOf("viewModel.stopSymbols")],b.prototype,"stopSymbols",void 0);e([h.aliasOf("viewModel.view")],b.prototype,"view",void 0);e([c.renderable(["lastRoute","state","travelModes"]),h.property({type:x})],b.prototype,"viewModel",void 0);e([h.aliasOf("viewModel.getDirections")],b.prototype,"getDirections",null);e([h.aliasOf("viewModel.zoomToRoute")],b.prototype,"zoomToRoute",null);e([c.accessibleHandler()],b.prototype,"_handleStopIconClick",null);e([c.accessibleHandler()],
b.prototype,"_handleClearRouteClick",null);e([c.accessibleHandler()],b.prototype,"_handleReverseStops",null);e([c.accessibleHandler()],b.prototype,"_handleRemoveStop",null);e([c.accessibleHandler()],b.prototype,"_handleSectionToggle",null);e([c.accessibleHandler()],b.prototype,"_handleSummaryInteraction",null);e([c.accessibleHandler()],b.prototype,"_handleManeuverClick",null);return b=e([h.subclass("esri.widgets.Directions")],b)}(h.declared(G))}); | mit |
chd7well/yii2-smartmenu | models/Menu.php | 2379 | <?php
/*
* This file is part of the chd7well project.
*
* (c) chd7well project <http://github.com/chd7well/> by CHD Electronic Engineering
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace chd7well\smartmenu\models;
use Yii;
/**
* This is the model class for table "{{%sys_menu}}".
*
* @property integer $ID
* @property string $label
* @property string $url
* @property integer $parent_ID
* @property string $comment
* @property integer $weight
* @property integer $type_ID
* @property integer $noguest
*
* @property Menu $parent
* @property Menu[] $menus
* @property SysMenuType $type
* @author Christian Dumhart <christian.dumhart@chd.at>
*/
class Menu extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%sys_menu}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['label'], 'required'],
[['url'], 'string'],
[['parent_ID', 'weight', 'type_ID', 'noguest'], 'integer'],
[['label', 'comment'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'ID' => Yii::t('smartmenu', 'ID'),
'label' => Yii::t('smartmenu', 'Label'),
'url' => Yii::t('smartmenu', 'Url'),
'parent_ID' => Yii::t('smartmenu', 'Parent ID'),
'comment' => Yii::t('smartmenu', 'Comment'),
'weight' => Yii::t('smartmenu', 'Weight'),
'type_ID' => Yii::t('smartmenu', 'Type ID'),
'noguest' => Yii::t('smartmenu', 'Noguest'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getParent()
{
return $this->hasOne(Menu::className(), ['ID' => 'parent_ID']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getMenus()
{
return $this->hasMany(Menu::className(), ['parent_ID' => 'ID']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getType()
{
return $this->hasOne(SysMenuType::className(), ['ID' => 'type_ID']);
}
} | mit |
Creative-Self/DSA2 | A06 - Octree/MyOctant.cpp | 8203 | #include "MyOctant.h"
using namespace Simplex;
//static
uint MyOctant::m_uOctantCount;
uint MyOctant::m_uLeafCount;
uint MyOctant::m_uMaxLevel;
uint MyOctant::m_uIdealEntityCount;
//root construct
MyOctant::MyOctant(uint a_nMaxLevel, uint a_nIdealEntityCount)
{
//create root
Init();
m_pRoot = this;
m_uMaxLevel = a_nMaxLevel;
m_uIdealEntityCount = a_nIdealEntityCount;
//sets the max/min to center
m_v3Max = m_v3Min = m_pEntityMngr->GetRigidBody()->GetCenterGlobal();
m_uCurrEntityCount = m_pEntityMngr->GetEntityCount();
for (uint i = 0; i < m_uCurrEntityCount; ++i)
{
m_lEntityList.push_back(i);
//get min/max
vector3 min = m_pEntityMngr->GetRigidBody(i)->GetMinGlobal();
vector3 max = m_pEntityMngr->GetRigidBody(i)->GetMaxGlobal();
//set min/max
if (min.x < m_v3Min.x) m_v3Min.x = min.x;
if (min.y < m_v3Min.y) m_v3Min.y = min.y;
if (min.z < m_v3Min.z) m_v3Min.z = min.z;
if (max.x > m_v3Max.x) m_v3Max.x = max.x;
if (max.y > m_v3Max.y) m_v3Max.y = max.y;
if (max.z > m_v3Max.z) m_v3Max.z = max.z;
}
//calc center
m_v3Center = (m_v3Min + m_v3Max) / 2.0f;
m_v3Size = m_v3Max - m_v3Min;
//create children
Subdivide();
//add leaf dimensions
ConfigureDimensions();
}
//constructor branch/leaf
MyOctant::MyOctant(vector3 a_v3Center, vector3 a_v3Size)
{
Init();
m_v3Center = a_v3Center;
m_v3Size = a_v3Size;
m_v3Max = a_v3Center + m_v3Size / 2.0f;
m_v3Min = a_v3Center - m_v3Size / 2.0f;
}
//copy con
MyOctant::MyOctant(MyOctant const & other)
{
Init();
//copy data
m_uLevel = other.m_uLevel;
m_v3Size = other.m_v3Size;
m_v3Center = other.m_v3Center;
m_v3Min = other.m_v3Min;
m_v3Max = other.m_v3Max;
m_pParent = other.m_pParent;
//copy/create more nodes
m_uChildren = other.m_uChildren;
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i] = new MyOctant(*other.m_pChild[i]);
}
//create entity list
m_uCurrEntityCount = other.m_uCurrEntityCount;
for (uint i = 0; i < m_uCurrEntityCount; ++i)
{
m_lEntityList.push_back(other.m_lEntityList[i]);
}
//if root copy child
m_pRoot = other.m_pRoot;
if (this == m_pRoot)
{
float fChildCount = other.m_lChildren.size();
for (uint i = 0; i < fChildCount; ++i)
{
m_lChildren.push_back(other.m_lChildren[i]);
}
}
}
//copy assignment
MyOctant & MyOctant::operator=(MyOctant const & other)
{
if (&other == this)
{
return *this;
}
Release();
Init();
//copy data
m_uLevel = other.m_uLevel;
m_v3Size = other.m_v3Size;
m_v3Center = other.m_v3Center;
m_v3Min = other.m_v3Min;
m_v3Max = other.m_v3Max;
m_pParent = other.m_pParent;
//copy/create more nodes
m_uChildren = other.m_uChildren;
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i] = new MyOctant(*other.m_pChild[i]);
}
//create entity list
m_uCurrEntityCount = other.m_uCurrEntityCount;
for (uint i = 0; i < m_uCurrEntityCount; ++i)
{
m_lEntityList.push_back(other.m_lEntityList[i]);
}
//if root copy child
m_pRoot = other.m_pRoot;
if (this == m_pRoot)
{
float fChildCount = other.m_lChildren.size();
for (uint i = 0; i < fChildCount; ++i)
{
m_lChildren.push_back(other.m_lChildren[i]);
}
}
return *this;
}
//destructor
MyOctant::~MyOctant(void)
{
Release();
}
void MyOctant::Swap(MyOctant & other)
{
std::swap(m_uID, other.m_uID);
std::swap(m_uLevel, other.m_uLevel);
std::swap(m_uChildren, other.m_uChildren);
std::swap(m_v3Size, other.m_v3Size);
std::swap(m_v3Center, other.m_v3Center);
std::swap(m_v3Min, other.m_v3Min);
std::swap(m_v3Max, other.m_v3Max);
std::swap(m_pParent, other.m_pParent);
std::swap(m_pChild, other.m_pChild);
std::swap(m_lEntityList, other.m_lEntityList);
std::swap(m_uCurrEntityCount, other.m_uCurrEntityCount);
std::swap(m_pRoot, other.m_pRoot);
std::swap(m_lChildren, other.m_lChildren);
}
//Getterz
vector3 MyOctant::GetSize() { return m_v3Size; }
vector3 MyOctant::GetCenterGlobal() { return m_v3Center; }
vector3 MyOctant::GetMinGlobal() { return m_v3Min; }
vector3 MyOctant::GetMaxGlobal() { return m_v3Max; }
uint MyOctant::GetOctantCount() { return m_uOctantCount; }
uint Simplex::MyOctant::GetLeafCount() { return m_uLeafCount; }
MyOctant * MyOctant::GetParent() { return m_pParent; }
///////
MyOctant * MyOctant::GetChild(uint a_nChild)
{
if (m_uChildren == 0)
return nullptr;
else return m_pChild[a_nChild];
}
bool MyOctant::IsLeaf(void) { return m_uChildren == 0; }
bool MyOctant::ContainsMoreThan(uint a_nEntities) { return m_uCurrEntityCount > a_nEntities; }
bool MyOctant::IsColliding(uint a_uRBIndex)
{
MyRigidBody* rb = m_pEntityMngr->GetRigidBody(a_uRBIndex);
vector3 rb_max = rb->GetMaxGlobal();
vector3 rb_min = rb->GetMinGlobal();
if (rb_max.x > m_v3Min.x &&
rb_max.y > m_v3Min.y &&
rb_max.z > m_v3Min.z &&
rb_min.x < m_v3Max.x &&
rb_min.y < m_v3Max.y &&
rb_min.z < m_v3Max.z)
{
return true;
}
else return false;
}
//display select octants
void Simplex::MyOctant::Display(uint a_uIndex, vector3 a_v3Color)
{
if (a_uIndex >= m_uOctantCount)
{
DisplayAll();
return;
}
m_lChildren[a_uIndex]->DisplayCurrent(a_v3Color);
}
// only display 1 octant
void MyOctant::DisplayCurrent(vector3 a_v3Color)
{
m_pMeshMngr->AddWireCubeToRenderList(glm::translate(IDENTITY_M4, m_v3Center) * glm::scale(IDENTITY_M4, m_v3Size), a_v3Color);
}
// display all octants
void Simplex::MyOctant::DisplayAll(vector3 a_v3Color)
{
if (IsLeaf())
{
DisplayCurrent(a_v3Color);
}
else {
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i]->DisplayAll(a_v3Color);
}
}
}
//clear all child nodes
void MyOctant::ClearEntityList(void)
{
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i]->ClearEntityList();
}
m_lEntityList.clear();
}
void MyOctant::Subdivide(void)
{
if (m_uLevel >= m_uMaxLevel || !ContainsMoreThan(m_uIdealEntityCount))
{
m_pRoot->m_lChildren.push_back(this);
m_uLeafCount += 1;
return;
}
if (m_uChildren == 8)
{
return;
}
//create each octant at updated position
m_pChild[0] = new MyOctant(m_v3Center + vector3(-m_v3Size.x / 4, m_v3Size.y / 4, -m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[1] = new MyOctant(m_v3Center + vector3(-m_v3Size.x / 4, m_v3Size.y / 4, m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[2] = new MyOctant(m_v3Center + vector3(-m_v3Size.x / 4, -m_v3Size.y / 4, -m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[3] = new MyOctant(m_v3Center + vector3(-m_v3Size.x / 4, -m_v3Size.y / 4, m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[4] = new MyOctant(m_v3Center + vector3(m_v3Size.x / 4, -m_v3Size.y / 4, -m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[5] = new MyOctant(m_v3Center + vector3(m_v3Size.x / 4, -m_v3Size.y / 4, m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[6] = new MyOctant(m_v3Center + vector3(m_v3Size.x / 4, m_v3Size.y / 4, -m_v3Size.z / 4), m_v3Size / 2.0f);
m_pChild[7] = new MyOctant(m_v3Center + vector3(m_v3Size.x / 4, m_v3Size.y / 4, m_v3Size.z / 4), m_v3Size / 2.0f);
m_uChildren = 8;
//initialize children
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i]->m_pParent = this;
m_pChild[i]->m_uLevel = m_uLevel + 1;
m_pChild[i]->m_pRoot = m_pRoot;
// add rigid body
for (uint j = 0; j < m_uCurrEntityCount; ++j)
{
if (m_pChild[i]->IsColliding(m_lEntityList[j]))
m_pChild[i]->m_lEntityList.push_back(m_lEntityList[j]);
}
//update entity count
m_pChild[i]->m_uCurrEntityCount = m_pChild[i]->m_lEntityList.size();
m_pChild[i]->Subdivide();
}
}
//kills all nodes minus root
void MyOctant::KillBranches(void)
{
if (IsLeaf())
{
return;
}
else
{
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i]->KillBranches();
SafeDelete(m_pChild[i]);
}
}
}
//configure dimensions for leaves
void Simplex::MyOctant::ConfigureDimensions()
{
if (IsLeaf())
{
for (uint i = 0; i < m_uCurrEntityCount; ++i)
{
m_pEntityMngr->AddDimension(m_lEntityList[i], m_uID);
}
}
else
{
for (uint i = 0; i < m_uChildren; ++i)
{
m_pChild[i]->ConfigureDimensions();
}
}
}
void MyOctant::Release(void)
{
if (this == m_pRoot)
{
KillBranches(); //deforestation
}
}
void MyOctant::Init(void)
{
m_pEntityMngr = MyEntityManager::GetInstance();
m_pMeshMngr = MeshManager::GetInstance();
m_uID = m_uOctantCount;
m_uOctantCount += 1;
}
| mit |
GraphExec/GraphExecNet | GraphExec/IDataProvider.cs | 373 |
namespace GraphExec
{
public interface IDataProvider : IProvider
{
}
public interface IDataProvider<TData> : IDataProvider
{
TData GetData();
}
public interface IDataProvider<TData, TProviderInfo> : IDataProvider
where TProviderInfo : class, IProviderInfo, new()
{
TData GetData(TProviderInfo info);
}
}
| mit |
psolstice/zcoin | src/qt/zerocoinpage.cpp | 7596 | // Copyright (c) 2011-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#endif
#include "zerocoinpage.h"
#include "ui_zerocoinpage.h"
#include "addresstablemodel.h"
#include "bitcoingui.h"
#include "csvmodelwriter.h"
#include "editaddressdialog.h"
#include "guiutil.h"
#include "platformstyle.h"
#include <QIcon>
#include <QMenu>
#include <QMessageBox>
#include <QSortFilterProxyModel>
ZerocoinPage::ZerocoinPage(const PlatformStyle *platformStyle, Mode mode, QWidget *parent) :
QWidget(parent),
ui(new Ui::ZerocoinPage),
model(0),
mode(mode){
ui->setupUi(this);
if (!platformStyle->getImagesOnButtons()) {
ui->exportButton->setIcon(QIcon());
} else {
ui->exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
}
switch (mode) {
case ForSelection:
setWindowTitle(tr("Zerocoin"));
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setFocus();
ui->exportButton->hide();
break;
case ForEditing:
setWindowTitle(tr("Zerocoin"));
}
ui->labelExplanation->setText(
tr("These are your private coins from mint zerocoin operation, You can perform spend zerocoin operation to redeem zcoin back from Zerocoin."));
ui->zerocoinAmount->setVisible(true);
ui->zerocoinMintButton->setVisible(true);
ui->zerocoinSpendButton->setVisible(true);
ui->zerocoinAmount->addItem("1");
ui->zerocoinAmount->addItem("10");
ui->zerocoinAmount->addItem("25");
ui->zerocoinAmount->addItem("50");
ui->zerocoinAmount->addItem("100");
// Context menu actions
// QAction *showQRCodeAction = new QAction(ui->showQRCode->text(), this);
// Build context menu
contextMenu = new QMenu(this);
// contextMenu->addAction(showQRCodeAction);
// Connect signals for context menu actions
// connect(showQRCodeAction, SIGNAL(triggered()), this, SLOT(on_showQRCode_clicked()));
connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
}
ZerocoinPage::~ZerocoinPage() {
delete ui;
}
void ZerocoinPage::setModel(AddressTableModel *model) {
this->model = model;
if (!model)
return;
proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(model);
proxyModel->setDynamicSortFilter(true);
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
proxyModel->setFilterRole(AddressTableModel::TypeRole);
proxyModel->setFilterFixedString(AddressTableModel::Zerocoin);
ui->tableView->setModel(proxyModel);
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
// Set column widths
#if QT_VERSION < 0x050000
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
#else
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
#endif
// connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
// this, SLOT(selectionChanged()));
// Select row for newly created address
connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(selectNewAddress(QModelIndex, int, int)));
// selectionChanged();
}
void ZerocoinPage::on_zerocoinMintButton_clicked() {
QString amount = ui->zerocoinAmount->currentText();
std::string denomAmount = amount.toStdString();
std::string stringError;
if(!model->zerocoinMint(stringError, denomAmount)){
QString t = tr(stringError.c_str());
QMessageBox::critical(this, tr("Error"),
tr("You cannot mint zerocoin because %1").arg(t),
QMessageBox::Ok, QMessageBox::Ok);
}
}
void ZerocoinPage::on_zerocoinSpendButton_clicked() {
QString amount = ui->zerocoinAmount->currentText();
std::string denomAmount = amount.toStdString();
std::string stringError;
if(!model->zerocoinSpend(stringError, denomAmount)){
QString t = tr(stringError.c_str());
QMessageBox::critical(this, tr("Error"),
tr("You cannot spend zerocoin because %1").arg(t),
QMessageBox::Ok, QMessageBox::Ok);
}
}
//void ZerocoinPage::on_showQRCode_clicked()
//{
//#ifdef USE_QRCODE
// QTableView *table = ui->tableView;
// QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
//
// Q_FOREACH(const QModelIndex &index, indexes) {
// {
// QString address = index.data().toString();
// QString label = index.sibling(index.row(), 0).data(Qt::EditRole).toString();
//
// QRCodeDialog *dialog = new QRCodeDialog(address, label, tab == ReceivingTab, this);
// dialog->setModel(optionsModel);
// dialog->setAttribute(Qt::WA_DeleteOnClose);
// dialog->show();
// }
//#endif
//}
//void ZerocoinPage::done(int retval) {
// QTableView *table = ui->tableView;
// if (!table->selectionModel() || !table->model())
// return;
//
// // Figure out which address was selected, and return it
// QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
//
// Q_FOREACH(const QModelIndex &index, indexes) {
// QVariant address = table->model()->data(index);
// returnValue = address.toString();
// }
//
// if (returnValue.isEmpty()) {
// // If no address entry selected, return rejected
//// retval = Rejected;
// }
//
// QDialog::done(retval);
//}
void ZerocoinPage::on_exportButton_clicked() {
// CSV is currently the only supported format
QString filename = GUIUtil::getSaveFileName(this, tr("Export Address List"), QString(), tr("Comma separated file (*.csv)"), NULL);
if (filename.isNull())
return;
CSVModelWriter writer(filename);
// name, column, role
writer.setModel(proxyModel);
writer.addColumn("Label", AddressTableModel::Label, Qt::EditRole);
writer.addColumn("Address", AddressTableModel::Address, Qt::EditRole);
if (!writer.write()) {
QMessageBox::critical(this, tr("Exporting Failed"), tr("There was an error trying to save the address list to %1. Please try again.").arg(
filename));
}
}
void ZerocoinPage::contextualMenu(const QPoint &point) {
QModelIndex index = ui->tableView->indexAt(point);
if (index.isValid()) {
contextMenu->exec(QCursor::pos());
}
}
void ZerocoinPage::selectNewAddress(const QModelIndex &parent, int begin, int /*end*/) {
QModelIndex idx = proxyModel->mapFromSource(model->index(begin, AddressTableModel::Address, parent));
if (idx.isValid() && (idx.data(Qt::EditRole).toString() == newAddressToSelect)) {
// Select row of newly created address, once
ui->tableView->setFocus();
ui->tableView->selectRow(idx.row());
newAddressToSelect.clear();
}
}
| mit |
zheralfin/oras | resources/views/subjects/partials/form.blade.php | 1788 | <div class="box-body">
@if (count($errors) > 0)
<div class="alert alert-warning">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-group">
{!! Form::label('code', 'Code') !!}
{!! Form::text('code', null, ['class' => 'form-control', 'required', 'placeholder' => 'Enter Code', 'minlength' => 3, 'maxlength' => 20]) !!}
</div>
<div class="form-group">
{!! Form::label('name', 'Name') !!}
{!! Form::text('name', null, ['class' => 'form-control', 'required', 'placeholder' => 'Enter Name', 'maxlength' => 254]) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'Description') !!}
{!! Form::textarea('description', null, ['class' => 'form-control', 'placeholder' => 'Enter Description']) !!}
</div>
<div class="form-group">
{!! Form::label('units', 'Units') !!}
{!! Form::number('units', null, ['class' => 'form-control', 'required', 'placeholder' => 'Enter Units']) !!}
</div>
<div class="form-group">
{!! Form::label('lec_hours', 'Lecture Hours per week') !!}
{!! Form::number('lec_hours', null, ['class' => 'form-control', 'required', 'placeholder' => 'Enter Lecture Hours']) !!}
</div>
<div class="form-group">
{!! Form::label('lab_hours', 'Lab/Activity Hours per week') !!}
{!! Form::number('lab_hours', null, ['class' => 'form-control', 'required', 'placeholder' => 'Enter Lab Hours']) !!}
</div>
<div class="form-group">
{!! Form::label('feature_id', 'Lab/Activity Room') !!}
{!! Form::select('feature_id', $features, null, ['class' => 'form-control' ]) !!}
</div>
</div> | mit |
apo-j/Projects_Working | EC/espace-client-dot-net/EspaceClient.BackOffice.Services.Contracts/IServiceTraductionCategorieClient.Generated.cs | 1009 | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This code was auto-generated by AFNOR StoredProcedureSystem, version 1.0
//
using System.Collections.Generic;
using System.ServiceModel;
using EspaceClient.BackOffice.Infrastructure.Context;
using EspaceClient.FrontOffice.Domaine;
namespace EspaceClient.BackOffice.Services.Contracts
{
/// <summary>
/// Définition des services des TraductionCategorieClient.
/// </summary>
[ServiceContract]
public partial interface IServiceTraductionCategorieClient
{
[OperationContract]
IEnumerable<TraductionCategorieClientDto> GetAll(WebContext context);
}
}
| mit |
bingoo0/SoftUni-TechModule | Array and List Algorithms - Exercises/1. Shoot List Elements/ShootListElements.cs | 2856 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _1.Shoot_List_Elements
{
class ShootListElements
{
static void Main()
{
var numbers = new List<int>();
var input = Console.ReadLine();
var lastRemoved = 0;
var output = "";
while (input != "stop")
{
if (input == "bang")
{
if (numbers.Count == 0 )
{
output = $"nobody left to shoot! last one was {lastRemoved}";
break;
}
// REMOVE ELEMENT
int sum = SumElements(numbers);
double average = (double)sum / numbers.Count;
lastRemoved = RemoveSmallerElement(numbers, average);
DecrementElements(numbers);
}
else
{
// ADD INTS
var number = int.Parse(input);
numbers.Insert(0, number);
}
input = Console.ReadLine();
} // end while
if (numbers.Count > 0 && output == "")
{
Console.WriteLine("survivors: {0}", string.Join(" ", numbers));
}
else if (numbers.Count == 0 && output == "")
{
Console.WriteLine("you shot them all. last one was {0}", string.Join(" ", lastRemoved));
}
else
{
Console.WriteLine(output, lastRemoved);
}
}
static void DecrementElements(List<int> numbers)
{
for (int i = 0; i < numbers.Count; i++)
{
numbers[i]--;
}
}
private static int RemoveSmallerElement(List<int> numbers, double average)
{
var result = -1;
if (numbers.Count == 1)
{
Console.WriteLine($"shot {numbers[0]}");
result = numbers[0];
numbers.RemoveAt(0);
return result;
}
for (int i = 0; i < numbers.Count; i++)
{
if (numbers[i] < average)
{
Console.WriteLine($"shot {numbers[i]}");
result = numbers[i];
numbers.RemoveAt(i);
break;
}
}
return result;
}
static int SumElements(List<int> numbers)
{
var sum = 0;
for (int i = 0; i < numbers.Count; i++)
{
sum += numbers[i];
}
return sum;
}
}
}
| mit |
moroztaras/my_blog_2015_GH_PHP | app/cache/dev/twig/8b/ae/39be815b75904f2a44a8df12b137a751575dedb81cd6aebe3eca890d2af6.php | 2080 | <?php
/* MorozBlogBundle:Comment:comments.html.twig */
class __TwigTemplate_8bae39be815b75904f2a44a8df12b137a751575dedb81cd6aebe3eca890d2af6 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 "<p>
<table>
<tr>
<td>";
// line 4
echo $this->env->getExtension('translator')->getTranslator()->trans("Автор:", array(), "messages");
echo "</td><td>";
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["comment"]) ? $context["comment"] : $this->getContext($context, "comment")), "author", array()), "html", null, true);
echo "</td>
<tr>
<tr>
<td>";
// line 7
echo $this->env->getExtension('translator')->getTranslator()->trans("Створено:", array(), "messages");
echo "</td><td>";
echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute((isset($context["comment"]) ? $context["comment"] : $this->getContext($context, "comment")), "createdAt", array()), "d-m-Y H:i:s"), "html", null, true);
echo "</td>
<tr>
<tr>
<td>";
// line 10
echo $this->env->getExtension('translator')->getTranslator()->trans("Коментар:", array(), "messages");
echo "</td><td>";
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["comment"]) ? $context["comment"] : $this->getContext($context, "comment")), "comment", array()), "html", null, true);
echo "</td>
<tr>
</table>
</p>";
}
public function getTemplateName()
{
return "MorozBlogBundle:Comment:comments.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 40 => 10, 32 => 7, 24 => 4, 19 => 1,);
}
}
| mit |
Azure/azure-sdk-for-go | services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/version.go | 709 | package postgresqlflexibleservers
import "github.com/Azure/azure-sdk-for-go/version"
// 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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/" + Version() + " postgresqlflexibleservers/2021-06-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return version.Number
}
| mit |
vujita/playing-card-models | src/FaceValues.ts | 337 | /**
* Created by vuthasone on 8/20/2016.
*/
export const FaceValues = {
TWO: 'TWO',
THREE: 'THREE',
FOUR: 'FOUR',
FIVE: 'FIVE',
SIX: 'SIX',
SEVEN: 'SEVEN',
EIGHT: 'EIGHT',
NINE: 'NINE',
TEN: 'TEN',
JACK: 'JACK',
QUEEN: 'QUEEN',
KING: 'KING',
ACE: 'ACE'
};
export default FaceValues; | mit |
axllent/silverstripe-simplemodeladmin | _config.php | 90 | <?php
LeftAndMain::require_css(basename(dirname(__FILE__)) . '/css/simplemodeladmin.css'); | mit |
jeffbski/git-wiki | extensions.rb | 1136 | def require_gem_with_feedback(gem)
begin
require gem
rescue LoadError
puts "You need to 'sudo gem install #{gem}' before we can proceed"
end
end
class String
# convert to a filename (substitute _ for any whitespace, discard anything but word chars, underscores, dots, and dashes, slashes
def wiki_filename
self.gsub( /\s+/, '_' ).gsub( /[^A-Za-z0-9\._\/-]/ , '')
end
# unconvert filename into title (substitute spaces for _)
def unwiki_filename
self.gsub( '_', ' ' )
end
def starts_with?(str)
str = str.to_str
head = self[0, str.length]
head == str
end
def ends_with?(str)
str = str.to_str
tail = self[-str.length, str.length]
tail == str
end
# strip the extension PAGE_FILE_EXT if ends with PAGE_FILE_EXT
def strip_page_extension
(self.ends_with?(PAGE_FILE_EXT)) ? self[0...-PAGE_FILE_EXT.size] : self
end
# true if string is an attachment dir or file foo_files/bar.jpg, _foo, foo/bar_files/file.jpg
def attach_dir_or_file?
/#{ATTACH_DIR_SUFFIX}\// =~ self
end
end
class Time
def for_time_ago_in_words
"#{(self.to_i * 1000)}"
end
end
| mit |
googlestadia/renderdoc | renderdoc/driver/d3d11/d3d11_shader_cache.cpp | 9404 | /******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2018-2019 Baldur Karlsson
*
* 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 "d3d11_shader_cache.h"
#include "common/shader_cache.h"
#include "driver/dx/official/d3dcompiler.h"
#include "driver/shaders/dxbc/dxbc_inspect.h"
#include "strings/string_utils.h"
#include "d3d11_device.h"
#include "d3d11_resources.h"
typedef HRESULT(WINAPI *pD3DCreateBlob)(SIZE_T Size, ID3DBlob **ppBlob);
struct D3DBlobShaderCallbacks
{
D3DBlobShaderCallbacks()
{
HMODULE d3dcompiler = GetD3DCompiler();
if(d3dcompiler == NULL)
RDCFATAL("Can't get handle to d3dcompiler_??.dll");
m_BlobCreate = (pD3DCreateBlob)GetProcAddress(d3dcompiler, "D3DCreateBlob");
if(m_BlobCreate == NULL)
RDCFATAL("d3dcompiler.dll doesn't contain D3DCreateBlob");
}
bool Create(uint32_t size, byte *data, ID3DBlob **ret) const
{
RDCASSERT(ret);
*ret = NULL;
HRESULT hr = m_BlobCreate((SIZE_T)size, ret);
if(FAILED(hr))
{
RDCERR("Couldn't create blob of size %u from shadercache: %s", size, ToStr(ret).c_str());
return false;
}
memcpy((*ret)->GetBufferPointer(), data, size);
return true;
}
void Destroy(ID3DBlob *blob) const { blob->Release(); }
uint32_t GetSize(ID3DBlob *blob) const { return (uint32_t)blob->GetBufferSize(); }
const byte *GetData(ID3DBlob *blob) const { return (const byte *)blob->GetBufferPointer(); }
pD3DCreateBlob m_BlobCreate;
} D3D11ShaderCacheCallbacks;
struct EmbeddedD3D11Includer : public ID3DInclude
{
std::string texsample = GetEmbeddedResource(hlsl_texsample_h);
std::string cbuffers = GetEmbeddedResource(hlsl_cbuffers_h);
virtual HRESULT STDMETHODCALLTYPE Open(D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName,
LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) override
{
std::string *str;
if(!strcmp(pFileName, "hlsl_texsample.h"))
str = &texsample;
else if(!strcmp(pFileName, "hlsl_cbuffers.h"))
str = &cbuffers;
else
return E_FAIL;
if(ppData)
*ppData = str->c_str();
if(pBytes)
*pBytes = (uint32_t)str->size();
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE Close(LPCVOID pData) override { return S_OK; }
};
D3D11ShaderCache::D3D11ShaderCache(WrappedID3D11Device *wrapper)
{
m_pDevice = wrapper;
bool success = LoadShaderCache("d3dshaders.cache", m_ShaderCacheMagic, m_ShaderCacheVersion,
m_ShaderCache, D3D11ShaderCacheCallbacks);
// if we failed to load from the cache
m_ShaderCacheDirty = !success;
}
D3D11ShaderCache::~D3D11ShaderCache()
{
if(m_ShaderCacheDirty)
{
SaveShaderCache("d3dshaders.cache", m_ShaderCacheMagic, m_ShaderCacheVersion, m_ShaderCache,
D3D11ShaderCacheCallbacks);
}
else
{
for(auto it = m_ShaderCache.begin(); it != m_ShaderCache.end(); ++it)
D3D11ShaderCacheCallbacks.Destroy(it->second);
}
}
std::string D3D11ShaderCache::GetShaderBlob(const char *source, const char *entry,
const uint32_t compileFlags, const char *profile,
ID3DBlob **srcblob)
{
EmbeddedD3D11Includer includer;
uint32_t hash = strhash(source);
hash = strhash(entry, hash);
hash = strhash(profile, hash);
hash = strhash(includer.cbuffers.c_str(), hash);
hash = strhash(includer.texsample.c_str(), hash);
hash ^= compileFlags;
if(m_ShaderCache.find(hash) != m_ShaderCache.end())
{
*srcblob = m_ShaderCache[hash];
(*srcblob)->AddRef();
return "";
}
HRESULT hr = S_OK;
ID3DBlob *byteBlob = NULL;
ID3DBlob *errBlob = NULL;
HMODULE d3dcompiler = GetD3DCompiler();
if(d3dcompiler == NULL)
{
RDCFATAL("Can't get handle to d3dcompiler_??.dll");
}
pD3DCompile compileFunc = (pD3DCompile)GetProcAddress(d3dcompiler, "D3DCompile");
if(compileFunc == NULL)
{
RDCFATAL("Can't get D3DCompile from d3dcompiler_??.dll");
}
uint32_t flags = compileFlags & ~D3DCOMPILE_NO_PRESHADER;
hr = compileFunc(source, strlen(source), entry, NULL, &includer, entry, profile, flags, 0,
&byteBlob, &errBlob);
std::string errors = "";
if(errBlob)
{
errors = (char *)errBlob->GetBufferPointer();
std::string logerror = errors;
if(logerror.length() > 1024)
logerror = logerror.substr(0, 1024) + "...";
RDCWARN("Shader compile error in '%s':\n%s", entry, logerror.c_str());
SAFE_RELEASE(errBlob);
if(FAILED(hr))
{
SAFE_RELEASE(byteBlob);
return errors;
}
}
if(m_CacheShaders)
{
m_ShaderCache[hash] = byteBlob;
byteBlob->AddRef();
m_ShaderCacheDirty = true;
}
SAFE_RELEASE(errBlob);
*srcblob = byteBlob;
return errors;
}
ID3D11VertexShader *D3D11ShaderCache::MakeVShader(const char *source, const char *entry,
const char *profile, int numInputDescs,
D3D11_INPUT_ELEMENT_DESC *inputs,
ID3D11InputLayout **ret, std::vector<byte> *blob)
{
ID3DBlob *byteBlob = NULL;
if(GetShaderBlob(source, entry, D3DCOMPILE_WARNINGS_ARE_ERRORS, profile, &byteBlob) != "")
{
RDCERR("Couldn't get shader blob for %s", entry);
return NULL;
}
void *bytecode = byteBlob->GetBufferPointer();
size_t bytecodeLen = byteBlob->GetBufferSize();
ID3D11VertexShader *ps = NULL;
HRESULT hr = m_pDevice->CreateVertexShader(bytecode, bytecodeLen, NULL, &ps);
if(FAILED(hr))
{
RDCERR("Couldn't create vertex shader for %s %s", entry, ToStr(ret).c_str());
SAFE_RELEASE(byteBlob);
return NULL;
}
if(numInputDescs)
{
hr = m_pDevice->CreateInputLayout(inputs, numInputDescs, bytecode, bytecodeLen, ret);
if(FAILED(hr))
{
RDCERR("Couldn't create input layout for %s %s", entry, ToStr(ret).c_str());
}
}
if(blob)
{
blob->resize(bytecodeLen);
memcpy(&(*blob)[0], bytecode, bytecodeLen);
}
SAFE_RELEASE(byteBlob);
return ps;
}
ID3D11GeometryShader *D3D11ShaderCache::MakeGShader(const char *source, const char *entry,
const char *profile)
{
ID3DBlob *byteBlob = NULL;
if(GetShaderBlob(source, entry, D3DCOMPILE_WARNINGS_ARE_ERRORS, profile, &byteBlob) != "")
{
return NULL;
}
void *bytecode = byteBlob->GetBufferPointer();
size_t bytecodeLen = byteBlob->GetBufferSize();
ID3D11GeometryShader *gs = NULL;
HRESULT hr = m_pDevice->CreateGeometryShader(bytecode, bytecodeLen, NULL, &gs);
SAFE_RELEASE(byteBlob);
if(FAILED(hr))
{
RDCERR("Couldn't create geometry shader for %s %s", entry, ToStr(hr).c_str());
return NULL;
}
return gs;
}
ID3D11PixelShader *D3D11ShaderCache::MakePShader(const char *source, const char *entry,
const char *profile)
{
ID3DBlob *byteBlob = NULL;
if(GetShaderBlob(source, entry, D3DCOMPILE_WARNINGS_ARE_ERRORS, profile, &byteBlob) != "")
{
return NULL;
}
void *bytecode = byteBlob->GetBufferPointer();
size_t bytecodeLen = byteBlob->GetBufferSize();
ID3D11PixelShader *ps = NULL;
HRESULT hr = m_pDevice->CreatePixelShader(bytecode, bytecodeLen, NULL, &ps);
SAFE_RELEASE(byteBlob);
if(FAILED(hr))
{
RDCERR("Couldn't create pixel shader for %s %s", entry, ToStr(hr).c_str());
return NULL;
}
return ps;
}
ID3D11ComputeShader *D3D11ShaderCache::MakeCShader(const char *source, const char *entry,
const char *profile)
{
ID3DBlob *byteBlob = NULL;
if(GetShaderBlob(source, entry, D3DCOMPILE_WARNINGS_ARE_ERRORS, profile, &byteBlob) != "")
{
return NULL;
}
void *bytecode = byteBlob->GetBufferPointer();
size_t bytecodeLen = byteBlob->GetBufferSize();
ID3D11ComputeShader *cs = NULL;
HRESULT hr = m_pDevice->CreateComputeShader(bytecode, bytecodeLen, NULL, &cs);
SAFE_RELEASE(byteBlob);
if(FAILED(hr))
{
RDCERR("Couldn't create compute shader for %s %s", entry, ToStr(hr).c_str());
return NULL;
}
return cs;
}
| mit |
epwqice/admin-on-rest-old-man | lib/mui/delete/Delete.js | 7856 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactRedux = require('react-redux');
var _Card = require('material-ui/Card');
var _Toolbar = require('material-ui/Toolbar');
var _RaisedButton = require('material-ui/RaisedButton');
var _RaisedButton2 = _interopRequireDefault(_RaisedButton);
var _checkCircle = require('material-ui/svg-icons/action/check-circle');
var _checkCircle2 = _interopRequireDefault(_checkCircle);
var _errorOutline = require('material-ui/svg-icons/alert/error-outline');
var _errorOutline2 = _interopRequireDefault(_errorOutline);
var _compose = require('recompose/compose');
var _compose2 = _interopRequireDefault(_compose);
var _inflection = require('inflection');
var _inflection2 = _interopRequireDefault(_inflection);
var _ViewTitle = require('../layout/ViewTitle');
var _ViewTitle2 = _interopRequireDefault(_ViewTitle);
var _Title = require('../layout/Title');
var _Title2 = _interopRequireDefault(_Title);
var _button = require('../button');
var _dataActions = require('../../actions/dataActions');
var _translate = require('../../i18n/translate');
var _translate2 = _interopRequireDefault(_translate);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var styles = {
actions: { zIndex: 2, display: 'inline-block', float: 'right' },
toolbar: { clear: 'both' },
button: { margin: '10px 24px', position: 'relative' }
};
var Delete = function (_Component) {
(0, _inherits3.default)(Delete, _Component);
function Delete(props) {
(0, _classCallCheck3.default)(this, Delete);
var _this = (0, _possibleConstructorReturn3.default)(this, (Delete.__proto__ || Object.getPrototypeOf(Delete)).call(this, props));
_this.handleSubmit = _this.handleSubmit.bind(_this);
_this.goBack = _this.goBack.bind(_this);
return _this;
}
(0, _createClass3.default)(Delete, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.props.crudGetOne(this.props.resource, this.props.id, this.getBasePath());
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.id !== nextProps.id) {
this.props.crudGetOne(nextProps.resource, nextProps.id, this.getBasePath());
}
}
}, {
key: 'getBasePath',
value: function getBasePath() {
var location = this.props.location;
return location.pathname.split('/').slice(0, -2).join('/');
}
}, {
key: 'handleSubmit',
value: function handleSubmit(event) {
event.preventDefault();
this.props.crudDelete(this.props.resource, this.props.id, this.getBasePath());
}
}, {
key: 'goBack',
value: function goBack() {
this.props.history.goBack();
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
title = _props.title,
id = _props.id,
data = _props.data,
isLoading = _props.isLoading,
resource = _props.resource,
translate = _props.translate;
var basePath = this.getBasePath();
var resourceName = translate('resources.' + resource + '.name', {
smart_count: 1,
_: _inflection2.default.humanize(_inflection2.default.singularize(resource))
});
var defaultTitle = translate('aor.page.delete', {
name: '' + resourceName,
id: id,
data: data
});
var titleElement = data ? _react2.default.createElement(_Title2.default, { title: title, record: data, defaultTitle: defaultTitle }) : '';
return _react2.default.createElement(
'div',
null,
_react2.default.createElement(
_Card.Card,
{ style: { opacity: isLoading ? .8 : 1 } },
_react2.default.createElement(
_Card.CardActions,
{ style: styles.actions },
_react2.default.createElement(_button.ListButton, { basePath: basePath })
),
_react2.default.createElement(_ViewTitle2.default, { title: titleElement }),
_react2.default.createElement(
'form',
{ onSubmit: this.handleSubmit },
_react2.default.createElement(
_Card.CardText,
null,
translate('aor.message.are_you_sure')
),
_react2.default.createElement(
_Toolbar.Toolbar,
{ style: styles.toolbar },
_react2.default.createElement(
_Toolbar.ToolbarGroup,
null,
_react2.default.createElement(_RaisedButton2.default, {
type: 'submit',
label: translate('aor.action.delete'),
icon: _react2.default.createElement(_checkCircle2.default, null),
primary: true,
style: styles.button
}),
_react2.default.createElement(_RaisedButton2.default, {
label: translate('aor.action.cancel'),
icon: _react2.default.createElement(_errorOutline2.default, null),
onClick: this.goBack,
style: styles.button
})
)
)
)
)
);
}
}]);
return Delete;
}(_react.Component);
Delete.propTypes = {
title: _react.PropTypes.any,
id: _react.PropTypes.string.isRequired,
resource: _react.PropTypes.string.isRequired,
location: _react.PropTypes.object.isRequired,
params: _react.PropTypes.object.isRequired,
history: _react.PropTypes.object.isRequired,
data: _react.PropTypes.object,
isLoading: _react.PropTypes.bool.isRequired,
crudGetOne: _react.PropTypes.func.isRequired,
crudDelete: _react.PropTypes.func.isRequired,
translate: _react.PropTypes.func.isRequired
};
function mapStateToProps(state, props) {
return {
id: props.params.id,
data: state.admin[props.resource].data[props.params.id],
isLoading: state.admin.loading > 0
};
}
var enhance = (0, _compose2.default)((0, _reactRedux.connect)(mapStateToProps, { crudGetOne: _dataActions.crudGetOne, crudDelete: _dataActions.crudDelete }), _translate2.default);
exports.default = enhance(Delete);
module.exports = exports['default']; | mit |
wabbox/WabboxLettreBundle | src/Wabbox/UserBundle/Entity/User.php | 1831 | <?php
// src/Wabbox/UserBundle/Entity/User.php
namespace Wabbox\UserBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
//use Wabbox\LettreBundle\Entity\Personne;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @ORM\OneToMany(targetEntity="Wabbox\LettreBundle\Entity\Personne", mappedBy="user", orphanRemoval=true, cascade={"all"})
*/
private $personnes;
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
$this->personnnes = new \Doctrine\Common\Collections\ArrayCollection();
// your own logic
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Add personnes
*
* @param \Wabbox\LettreBundle\Entity\Personne $personnes
* @return User
*/
public function addPersonne(\Wabbox\LettreBundle\Entity\Personne $personnes)
{
$this->personnes[] = $personnes;
return $this;
}
/**
* Remove personnes
*
* @param \Wabbox\LettreBundle\Entity\Personne $personnes
*/
public function removePersonne(\Wabbox\LettreBundle\Entity\Personne $personnes)
{
$this->personnes->removeElement($personnes);
}
/**
* Get personnes
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPersonnes()
{
return $this->personnes;
}
} | mit |
pestanko/3scale-api-ruby | lib/three_scale_api/resources/oauth_dev_portal.rb | 274 | # frozen_string_literal: true
require 'three_scale_api/resources/default'
module ThreeScaleApi
module Resources
# WebHook resource wrapper for the OAuth for Developer portal entity received by the REST API
class OAuthDevPortal < DefaultResource
end
end
end
| mit |
tzuhan/organ-donation | test/functional/story_controller_test.rb | 132 | require 'test_helper'
class StoryControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| mit |
TanjidIslam/code-mangler | codemangler/models/user.py | 2630 | from datetime import datetime
from config import MongoConfig
class User(object):
""" A User Object """
def __init__(self, username, name, email, _id=None, user_type="regular", attempted=[],
completed=[], xp=0, level=0, account_created=None, last_modified=None):
""" (User, str, str, str, bson.ObjectId, str, Boolean, List of bson.ObjectId,
List of bson.ObjectId, int, int, datetime, datetime) -> NoneType
A new User with necessary username, name, email, unique id, user type, activeness,
attempted and completed questions, trophies/xp, level, data of creating and last modifying account
All kwargs can be left untouched for a new user and they will be filled upon creation (by calling User.create).
"""
self.username = username
self.name = name
self.email = email
self._id = _id
self.user_type = user_type
self.attempted = attempted
self.completed = completed
self.xp = xp
self.level = level
self.account_created = account_created
self.last_modified = last_modified
class UserModel(object):
"""UserModel handles interactions with the database."""
def get(filter_or_id):
""" (dict or bson.ObjectId) -> User
Return the instance of User object associated with the filter or id.
"""
doc = MongoConfig.user.find_one(filter_or_id)
if not doc:
return None
return User(doc['username'],
doc['name'],
doc['email'],
doc['_id'],
doc['user_type'],
doc['attempted'],
doc['completed'],
doc['xp'],
doc['level'],
doc['account_created'],
doc['last_modified'])
def create(user):
""" (User) -> User
Add user to the database.
"""
user.account_created = str(datetime.now())[:16]
user.last_modified = str(datetime.now())[:16]
result = MongoConfig.user.insert_one(user.__dict__)
return UserModel.get(result.inserted_id)
def update(user):
""" (User) -> User
Update user in the database. Return the updated user.
"""
user.last_modified = str(datetime.now())[:16]
# Update user entry if username matches #
MongoConfig.user.update_one({'username': user.username}, {'$set': user.__dict__})
return UserModel.get(user.username)
| mit |
zealot128/ruby-habtm-generator | lib/generators/habtm/habtm_generator.rb | 2376 |
require 'rails/generators/migration'
require 'rails/generators/active_record'
class HabtmGenerator < ActiveRecord::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :other_model, required: true,
type: :string, desc: "List both part of the habtm migration to generate the table"
class_option :convention, :type => :string, :aliases => "-c", :desc => "Table names convention. Available options are 'rails' and 'mysql_workbench'.", :default => "rails"
def create_migration_file
models.map!{|i|i.singularize}
migration_template "habtm_migration.rb.erb",
"db/migrate/#{migration_name}.rb"
add_migration_line model: models[0], other: models[1]
add_migration_line model: models[1], other: models[0]
end
private
def add_migration_line(hash)
other = hash[:other]
model = hash[:model]
extra = if other.include?('/') || model.include?('/')
", :join_table => '#{table_name}', :class_name => '#{other.camelcase}', :foreign_key => '#{no_ns(model.foreign_key)}', :association_foreign_key => '#{no_ns(other.foreign_key)}'"
else
""
end
inject_into_class "app/models/#{model}.rb", model.camelcase,
" has_and_belongs_to_many :#{no_ns other.pluralize}#{extra}\n"
end
def no_ns(m)
m.gsub('/','_')
end
def join_table(model)
end
def coding_convention
options[:convention].to_s
end
def table_name
junction_string = ''
case coding_convention
when 'mysql_workbench'
junction_string = '_has_'
else
junction_string = '_'
end
pluralized = sorted_models.map{|i| no_ns i.tableize}
# stolen from active_record/associations/builder/has_and_belongs_to_many.rb
pluralized.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').tr("\0", junction_string)
end
def models
[name, other_model]
end
def sorted_models
ret = models.map(&:singularize).map(&:underscore)
case coding_convention
when 'mysql_workbench'
ret
else
ret.sort
end
end
def references
sorted_models.map{|i| ":#{no_ns i.singularize}"}
end
def id_columns
sorted_models.map{|i| ":#{no_ns i.foreign_key}"}.join(", ")
end
def migration_name
"create_#{table_name}"
end
def migration_class_name
migration_name.camelize
end
end
| mit |
selvasingh/azure-sdk-for-java | sdk/datafactory/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/datafactory/v2018_06_01/PhoenixLinkedService.java | 12406 | /**
* 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.datafactory.v2018_06_01;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.microsoft.rest.serializer.JsonFlatten;
import com.microsoft.azure.management.datafactory.v2018_06_01.implementation.LinkedServiceInner;
/**
* Phoenix server linked service.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = PhoenixLinkedService.class)
@JsonTypeName("Phoenix")
@JsonFlatten
public class PhoenixLinkedService extends LinkedServiceInner {
/**
* The IP address or host name of the Phoenix server. (i.e.
* 192.168.222.160).
*/
@JsonProperty(value = "typeProperties.host", required = true)
private Object host;
/**
* The TCP port that the Phoenix server uses to listen for client
* connections. The default value is 8765.
*/
@JsonProperty(value = "typeProperties.port")
private Object port;
/**
* The partial URL corresponding to the Phoenix server. (i.e.
* /gateway/sandbox/phoenix/version). The default value is hbasephoenix if
* using WindowsAzureHDInsightService.
*/
@JsonProperty(value = "typeProperties.httpPath")
private Object httpPath;
/**
* The authentication mechanism used to connect to the Phoenix server.
* Possible values include: 'Anonymous', 'UsernameAndPassword',
* 'WindowsAzureHDInsightService'.
*/
@JsonProperty(value = "typeProperties.authenticationType", required = true)
private PhoenixAuthenticationType authenticationType;
/**
* The user name used to connect to the Phoenix server.
*/
@JsonProperty(value = "typeProperties.username")
private Object username;
/**
* The password corresponding to the user name.
*/
@JsonProperty(value = "typeProperties.password")
private SecretBase password;
/**
* Specifies whether the connections to the server are encrypted using SSL.
* The default value is false.
*/
@JsonProperty(value = "typeProperties.enableSsl")
private Object enableSsl;
/**
* The full path of the .pem file containing trusted CA certificates for
* verifying the server when connecting over SSL. This property can only be
* set when using SSL on self-hosted IR. The default value is the
* cacerts.pem file installed with the IR.
*/
@JsonProperty(value = "typeProperties.trustedCertPath")
private Object trustedCertPath;
/**
* Specifies whether to use a CA certificate from the system trust store or
* from a specified PEM file. The default value is false.
*/
@JsonProperty(value = "typeProperties.useSystemTrustStore")
private Object useSystemTrustStore;
/**
* Specifies whether to require a CA-issued SSL certificate name to match
* the host name of the server when connecting over SSL. The default value
* is false.
*/
@JsonProperty(value = "typeProperties.allowHostNameCNMismatch")
private Object allowHostNameCNMismatch;
/**
* Specifies whether to allow self-signed certificates from the server. The
* default value is false.
*/
@JsonProperty(value = "typeProperties.allowSelfSignedServerCert")
private Object allowSelfSignedServerCert;
/**
* The encrypted credential used for authentication. Credentials are
* encrypted using the integration runtime credential manager. Type: string
* (or Expression with resultType string).
*/
@JsonProperty(value = "typeProperties.encryptedCredential")
private Object encryptedCredential;
/**
* Get the IP address or host name of the Phoenix server. (i.e. 192.168.222.160).
*
* @return the host value
*/
public Object host() {
return this.host;
}
/**
* Set the IP address or host name of the Phoenix server. (i.e. 192.168.222.160).
*
* @param host the host value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withHost(Object host) {
this.host = host;
return this;
}
/**
* Get the TCP port that the Phoenix server uses to listen for client connections. The default value is 8765.
*
* @return the port value
*/
public Object port() {
return this.port;
}
/**
* Set the TCP port that the Phoenix server uses to listen for client connections. The default value is 8765.
*
* @param port the port value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withPort(Object port) {
this.port = port;
return this;
}
/**
* Get the partial URL corresponding to the Phoenix server. (i.e. /gateway/sandbox/phoenix/version). The default value is hbasephoenix if using WindowsAzureHDInsightService.
*
* @return the httpPath value
*/
public Object httpPath() {
return this.httpPath;
}
/**
* Set the partial URL corresponding to the Phoenix server. (i.e. /gateway/sandbox/phoenix/version). The default value is hbasephoenix if using WindowsAzureHDInsightService.
*
* @param httpPath the httpPath value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withHttpPath(Object httpPath) {
this.httpPath = httpPath;
return this;
}
/**
* Get the authentication mechanism used to connect to the Phoenix server. Possible values include: 'Anonymous', 'UsernameAndPassword', 'WindowsAzureHDInsightService'.
*
* @return the authenticationType value
*/
public PhoenixAuthenticationType authenticationType() {
return this.authenticationType;
}
/**
* Set the authentication mechanism used to connect to the Phoenix server. Possible values include: 'Anonymous', 'UsernameAndPassword', 'WindowsAzureHDInsightService'.
*
* @param authenticationType the authenticationType value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withAuthenticationType(PhoenixAuthenticationType authenticationType) {
this.authenticationType = authenticationType;
return this;
}
/**
* Get the user name used to connect to the Phoenix server.
*
* @return the username value
*/
public Object username() {
return this.username;
}
/**
* Set the user name used to connect to the Phoenix server.
*
* @param username the username value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withUsername(Object username) {
this.username = username;
return this;
}
/**
* Get the password corresponding to the user name.
*
* @return the password value
*/
public SecretBase password() {
return this.password;
}
/**
* Set the password corresponding to the user name.
*
* @param password the password value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withPassword(SecretBase password) {
this.password = password;
return this;
}
/**
* Get specifies whether the connections to the server are encrypted using SSL. The default value is false.
*
* @return the enableSsl value
*/
public Object enableSsl() {
return this.enableSsl;
}
/**
* Set specifies whether the connections to the server are encrypted using SSL. The default value is false.
*
* @param enableSsl the enableSsl value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withEnableSsl(Object enableSsl) {
this.enableSsl = enableSsl;
return this;
}
/**
* Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR.
*
* @return the trustedCertPath value
*/
public Object trustedCertPath() {
return this.trustedCertPath;
}
/**
* Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR.
*
* @param trustedCertPath the trustedCertPath value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withTrustedCertPath(Object trustedCertPath) {
this.trustedCertPath = trustedCertPath;
return this;
}
/**
* Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false.
*
* @return the useSystemTrustStore value
*/
public Object useSystemTrustStore() {
return this.useSystemTrustStore;
}
/**
* Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false.
*
* @param useSystemTrustStore the useSystemTrustStore value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withUseSystemTrustStore(Object useSystemTrustStore) {
this.useSystemTrustStore = useSystemTrustStore;
return this;
}
/**
* Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false.
*
* @return the allowHostNameCNMismatch value
*/
public Object allowHostNameCNMismatch() {
return this.allowHostNameCNMismatch;
}
/**
* Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false.
*
* @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) {
this.allowHostNameCNMismatch = allowHostNameCNMismatch;
return this;
}
/**
* Get specifies whether to allow self-signed certificates from the server. The default value is false.
*
* @return the allowSelfSignedServerCert value
*/
public Object allowSelfSignedServerCert() {
return this.allowSelfSignedServerCert;
}
/**
* Set specifies whether to allow self-signed certificates from the server. The default value is false.
*
* @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) {
this.allowSelfSignedServerCert = allowSelfSignedServerCert;
return this;
}
/**
* Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string).
*
* @return the encryptedCredential value
*/
public Object encryptedCredential() {
return this.encryptedCredential;
}
/**
* Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string).
*
* @param encryptedCredential the encryptedCredential value to set
* @return the PhoenixLinkedService object itself.
*/
public PhoenixLinkedService withEncryptedCredential(Object encryptedCredential) {
this.encryptedCredential = encryptedCredential;
return this;
}
}
| mit |
alt22247/YCQL | YCQL/SQLFunctions/MySQLFunctions/MySQLFunctionLastInsertedID.cs | 544 | /*
* Copyright © 2015 by YuXiang Chen
* All rights reserved
*/
using Ycql.SqlFunctions;
namespace Ycql.MySqlFunctions
{
/// <summary>
/// Represents LAST_INSERT_ID function in MySql which returns the most recently generated ID in the server on a per-connection basis
/// </summary>
public class MySqlFunctionLastInsertedID : SqlFunctionBase
{
/// <summary>
/// Initializes a new instance of the MySqlFunctionLastInsertedID class
/// </summary>
public MySqlFunctionLastInsertedID()
: base("LAST_INSERT_ID")
{
}
}
}
| mit |
stivalet/PHP-Vulnerability-test-suite | XSS/CWE_79/safe/CWE_79__SESSION__func_htmlspecialchars__Use_untrusted_data_script-doublequoted_Event_Handler.php | 1402 | <!--
Safe sample
input : get the UserData field of $_SESSION
sanitize : use of the function htmlspecialchars. Sanitizes the query but has a high chance to produce unexpected results
File : use of untrusted data in a double quoted event handler in a script
-->
<!--Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.-->
<!DOCTYPE html>
<html>
<head/>
<body>
<?php
$tainted = $_SESSION['UserData'];
$tainted = htmlspecialchars($tainted, ENT_QUOTES);
echo "<div onmouseover=\"x=\"". $tainted ."\"\>";
?>
<h1>Hello World!</h1>
</div>
</body>
</html> | mit |
bcvsolutions/CzechIdMng | Realization/backend/core/core-api/src/main/java/eu/bcvsolutions/idm/core/eav/api/dto/InvalidFormAttributeDto.java | 4444 | package eu.bcvsolutions.idm.core.eav.api.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import org.springframework.hateoas.core.Relation;
import eu.bcvsolutions.idm.core.api.dto.AbstractDto;
import eu.bcvsolutions.idm.core.api.service.LookupService;
/**
* DTO for keep informations about invalidate attribute.
*
* @author Vít Švanda
*
*/
@Relation(collectionRelation = "invalidFormAttributes")
public class InvalidFormAttributeDto extends AbstractDto {
private static final long serialVersionUID = 1L;
private Serializable ownerId; // UUID in most cases, but Identifiable is supported.
private String ownerType;
private String attributeCode; // form attribute code
private String definitionCode; // form definiton code
//
// error states - filled, when validation not pass
private boolean missingValue = false;
private BigDecimal minValue;
private BigDecimal maxValue;
private String uniqueValue;
private String regexValue;
//
private String message; // Custom message, when validation fails - localization key can be used.
public InvalidFormAttributeDto() {
}
public InvalidFormAttributeDto(IdmFormAttributeDto formAttribute) {
super(formAttribute);
//
this.attributeCode = formAttribute.getCode();
this.message = formAttribute.getValidationMessage();
}
/**
* Returns {@code true} when all error states are empty => checked form value is valid.
*
* @return
*/
public boolean isValid() {
return !missingValue
&& minValue == null
&& maxValue == null
&& uniqueValue == null
&& regexValue == null;
}
public String getAttributeCode() {
return attributeCode;
}
public void setAttributeCode(String attributeCode) {
this.attributeCode = attributeCode;
}
public boolean isMissingValue() {
return missingValue;
}
public void setMissingValue(boolean missingValue) {
this.missingValue = missingValue;
}
public BigDecimal getMinValue() {
return minValue;
}
public void setMinValue(BigDecimal minValue) {
this.minValue = minValue;
}
public BigDecimal getMaxValue() {
return maxValue;
}
public void setMaxValue(BigDecimal maxValue) {
this.maxValue = maxValue;
}
public String getUniqueValue() {
return uniqueValue;
}
public void setUniqueValue(String uniqueValue) {
this.uniqueValue = uniqueValue;
}
public String getRegexValue() {
return regexValue;
}
public void setRegexValue(String regexValue) {
this.regexValue = regexValue;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
/**
* Owner identifier.
*
* @return owner identifier
* @since 10.7.0
*/
public Serializable getOwnerId() {
return ownerId;
}
/**
* Owner identifier.
*
* @param ownerId owner identifier
* @since 10.7.0
*/
public void setOwnerId(Serializable ownerId) {
this.ownerId = ownerId;
}
/**
* Owner type.
*
* @see LookupService#getOwnerType(Class)
* @return owner type
* @since 10.7.0
*/
public String getOwnerType() {
return ownerType;
}
/**
* Owner type.
*
* @see LookupService#getOwnerType(Class)
* @param ownerType owner type
* @since 10.7.0
*/
public void setOwnerType(String ownerType) {
this.ownerType = ownerType;
}
/**
* Textual information used in logs.
*
* @since 10.7.0
*/
@Override
public String toString() {
StringBuilder result = new StringBuilder(String.format("Attribute code [%s]", attributeCode));
if (missingValue) {
result.append(" - missingValue [true]");
}
if (minValue != null) {
result.append(String.format(" - minValue [%s]", minValue));
}
if (maxValue != null) {
result.append(String.format(" - maxValue [%s]", maxValue));
}
if (uniqueValue != null) {
result.append(String.format(" - uniqueValue [%s]", uniqueValue));
}
if (regexValue != null) {
result.append(String.format(" - regexValue [%s]", regexValue));
}
//
return result.toString();
}
/**
* Related form definition code - more definitions can be validated.
*
* @return form definition code
* @since 11.0.0
*/
public String getDefinitionCode() {
return definitionCode;
}
/**
* Related form definition code - more definitions can be validated.
*
* @param definitionCode form definition code
* @since 11.0.0
*/
public void setDefinitionCode(String definitionCode) {
this.definitionCode = definitionCode;
}
}
| mit |
bmcdorman/libgab | include/gab/agent_selector.hpp | 401 | #ifndef _GAB_AGENT_SELECTOR_HPP_
#define _GAB_AGENT_SELECTOR_HPP_
#include <list>
#include <memory>
#include "agent.hpp"
#include "fitness_evaluator.hpp"
namespace gab
{
class agent_selector
{
public:
virtual std::list<std::shared_ptr<agent>> operator()(const std::list<std::shared_ptr<agent>> &agents, const fitness_evaluator::returns_container_type &fitnesses) const = 0;
};
}
#endif
| mit |
yosmared/escuela | src/Escuela/CoreBundle/Controller/ParentsController.php | 9658 | <?php
namespace Escuela\CoreBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Escuela\CoreBundle\Entity\Parents;
use Escuela\CoreBundle\Form\ParentsType;
use Escuela\UserManagerBundle\Form\ListType;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Parents controller.
*
* @Route("/parents")
*/
class ParentsController extends Controller
{
/**
* Lists all Parents entities.
*
* @Route("/list/{studentid}", name="parents_list")
* @Method("GET")
* @Template()
*/
public function indexAction($studentid)
{ $em = $this->getDoctrine()->getManager();
if($studentid==null){
$entities = $em->getRepository('EscuelaCoreBundle:Parents')->findAll();
}else{
$criteria = array("id"=>$studentid);
$student = $em->getRepository('EscuelaCoreBundle:Student')->findOneBy($criteria);
$entities = $student->getParents();
}
return array(
'entities' => $entities,
'list_form'=>$this->createListForm()->createView(),
'service'=>'',
'studentid'=>$studentid
);
}
/**
* Creates a new Parents entity.
*
* @Route("/", name="parents_create")
* @Method("POST")
* @Template("EscuelaCoreBundle:Parents:new.html.twig")
*/
public function createAction(Request $request)
{
$parent =$request->request->get('escuela_corebundle_parents');
$studentid = $parent['studentid'];
$entity = new Parents();
$form = $this->createCreateForm($entity);
$form->add('studentid','hidden',array('data'=>$studentid,'mapped'=>false));
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$student = $em->getRepository('EscuelaCoreBundle:Student')->find($studentid); //var_dump($student); die;
$student->addParent($entity);
$em->flush($student);
return $this->redirect($this->generateUrl('parents_show', array('id' => $entity->getId(),'studentid'=>$studentid)));
}
return array(
'entity' => $entity,
'form' => $form->createView(),
'studentid'=>$studentid
);
}
/**
* Creates a form to create a Parents entity.
*
* @param Parents $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Parents $entity)
{
$form = $this->createForm(new ParentsType(), $entity, array(
'action' => $this->generateUrl('parents_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new Parents entity.
*
* @Route("/new/{studentid}", name="parents_new")
* @Method("GET")
* @Template()
*/
public function newAction($studentid)
{
$entity = new Parents();
$form = $this->createCreateForm($entity);
$form->add('studentid','hidden',array('data'=>$studentid,'mapped'=>false));
return array(
'entity' => $entity,
'form' => $form->createView(),
'studentid'=>$studentid
);
}
/**
* Finds and displays a Parents entity.
*
* @Route("/{id}/show/{studentid}", name="parents_show")
* @Method("GET")
* @Template()
*/
public function showAction($id,$studentid)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('EscuelaCoreBundle:Parents')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Parents entity.');
}
return array(
'entity' => $entity,
'service'=>'',
'studentid'=> $studentid
);
}
/**
* Displays a form to edit an existing Parents entity.
*
* @Route("/{id}/edit/{studentid}", name="parents_edit")
* @Method("GET")
* @Template()
*/
public function editAction($id,$studentid)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('EscuelaCoreBundle:Parents')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Parents entity.');
}
$editForm = $this->createEditForm($entity);
$editForm->add('studentid','hidden',array('data'=>$studentid,'mapped'=>false));
return array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'service'=>'',
'studentid'=>$studentid
);
}
/**
* Creates a form to edit a Parents entity.
*
* @param Parents $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Parents $entity)
{
$form = $this->createForm(new ParentsType(), $entity, array(
'action' => $this->generateUrl('parents_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
}
/**
* Edits an existing Parents entity.
*
* @Route("/{id}", name="parents_update")
* @Method("PUT")
* @Template("EscuelaCoreBundle:Parents:edit.html.twig")
*/
public function updateAction(Request $request, $id)
{
$parent =$request->request->get('escuela_corebundle_parents');
$studentid = $parent['studentid'];
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('EscuelaCoreBundle:Parents')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Parents entity.');
}
$editForm = $this->createEditForm($entity);
$editForm->add('studentid','hidden',array('data'=>$studentid,'mapped'=>false));
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('parents_show', array('id' => $id,'studentid'=>$studentid)));
}
return array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'service'=>'',
'studentid'=>$studentid
);
}
/**
* Deletes a Parents entity.
*
* @Route("/{id}/delete/{studentid}", name="parents_delete")
* @Method("GET")
*/
public function deleteAction(Request $request, $id, $studentid)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('EscuelaCoreBundle:Parents')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Parents entity.');
}
$student = $em->getRepository('EscuelaCoreBundle:Student')->find($studentid);
$student->removeParent($entity);
$em->flush($student);
$em->remove($entity);
$em->flush();
return $this->redirect($this->generateUrl('parents_list',array('studentid'=>$studentid)));
}
/**
* Creates a form to delete a Parents entity by id.
*
* @param mixed $id The entity id
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm($id,$studentid)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('parents_delete', array('id' => $id,'studentid'=>$studentid)))
->setMethod('GET')
->add('submit', 'submit', array('label' => 'Delete'))
->getForm()
;
}
public function createListForm() {
$options = array (
'action' => $this->generateUrl('parents_deletes', array(), UrlGeneratorInterface::ABSOLUTE_PATH ),
'method' => 'POST'
);
$form = $this->createForm ( new ListType(), null, $options );
$form->add('deleteall_btn', 'button');
$form->add ( 'submit', 'submit', array ('label' => 'Eliminar') );
return $form;
}
/**
* Deletes a Student entity.
*
* @Route("/deletes/{page}", name="parents_deletes", defaults={"page"=1})
* @Method("DELETE")
*/
public function deleteVariousAction(Request $request, $page)
{
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('EscuelaCoreBundle:Parents')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Student entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('parents_list'));
}
/**
* Search a Student entity.
*
* @Route("/search/{phrase}/{page}", name="parents_search", defaults={"page"=1})
* @Method({"GET", "POST"})
* @Template("EscuelaCoreBundle:Parents:index.html.twig")
*/
public function searchAction($phrase = null, $page=null){
}
}
| mit |
skyarch-networks/skyhopper | spec/spec_helper.rb | 2725 | #
# Copyright (c) 2013-2017 SKYARCH NETWORKS INC.
#
# This software is released under the MIT License.
#
# http://opensource.org/licenses/mit-license.php
#
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
require 'rspec/rails'
require 'pundit/rspec'
require 'simplecov'
require 'coveralls'
Coveralls.wear!('rails')
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
# config.order = "random"
config.include FactoryGirl::Syntax::Methods
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :view
config.include ControllerMacrosInclude, type: :controller
config.extend ControllerMacros, type: :controller
config.extend ControllerMacros, type: :view
config.extend StackStub
config.extend ZabbixStub
config.extend RDSStub
config.extend S3Stub
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
FactoryGirl.create(:app_setting)
end
config.after(:each) do
DatabaseCleaner.clean
end
# disables should
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.infer_spec_type_from_file_location!
config.before do
allow(Redis).to receive(:new).and_return(double('redis', publish: true))
end
end
AWS.stub!
Aws.config[:stub_responses] = true
| mit |
createthis/createthis_vr_ui | Assets/CreateThis/Scripts/VR/UI/Scroller/KineticScroller.cs | 5663 | using System.Collections.Generic;
using UnityEngine;
using CreateThis.Math;
using CreateThis.Unity;
using CreateThis.VR.UI.Interact;
using CreateThis.VR.UI.Controller;
namespace CreateThis.VR.UI.Scroller {
public class KineticScroller : Grabbable {
public FixedJoint fixedJoint;
public float space = 0.1f;
public delegate void ClickAction(GameObject fileObject, Transform controller, int controllerIndex);
public static event ClickAction OnClicked;
public GameObject fileObjectGrabbed;
private float movementThresholdForClick = 0.01f;
private List<GameObject> list;
private float height;
private bool listChanged = false;
private new Rigidbody rigidbody;
private ConfigurableJoint slidingJoint;
private Vector3 dragStartPosition;
private bool hasInitialized = false;
public override void OnGrabStart(Transform controller, int controllerIndex) {
Rigidbody controllerRigidbody = controller.gameObject.GetComponent<Rigidbody>();
if (!controllerRigidbody) {
controllerRigidbody = controller.gameObject.AddComponent<Rigidbody>();
controllerRigidbody.isKinematic = true;
controllerRigidbody.useGravity = true;
}
dragStartPosition = controller.position;
fixedJoint = gameObject.AddComponent<FixedJoint>();
fixedJoint.anchor = transform.InverseTransformPoint(controller.position);
fixedJoint.connectedBody = controllerRigidbody;
fixedJoint.breakForce = Mathf.Infinity;
fixedJoint.breakTorque = Mathf.Infinity;
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
}
public override void OnGrabStop(Transform controller, int controllerIndex) {
if (!fixedJoint) return;
fixedJoint.connectedBody = null;
Destroy(fixedJoint);
float distance = Vector3.Distance(dragStartPosition, controller.position);
if (distance <= movementThresholdForClick) {
if (OnClicked != null) {
controller.parent.GetComponent<TouchController>().ClearTouching();
OnClicked(fileObjectGrabbed, controller, controllerIndex);
}
} else {
SteamVR_Controller.Device device = SteamVR_Controller.Input((int)controllerIndex);
rigidbody.velocity = device.velocity;
rigidbody.angularVelocity = device.angularVelocity;
}
fileObjectGrabbed = null;
}
public void SetHeight(float height) {
this.height = height;
listChanged = true;
Initialize();
}
public void SetList(List<GameObject> myList) {
list = myList;
listChanged = true;
Initialize();
}
public void Initialize() {
if (!hasInitialized) {
rigidbody = GetComponent<Rigidbody>();
slidingJoint = GetComponent<ConfigurableJoint>();
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
hasInitialized = true;
}
if (!listChanged) return;
if (list != null) {
ScaleGameObjects();
UpdateSlidingJoint();
}
listChanged = false;
}
private void UpdateSlidingJoint() {
gameObject.transform.localPosition = Vector3.zero;
float width = Width();
slidingJoint.anchor = new Vector3(0, 0, 0);
slidingJoint.autoConfigureConnectedAnchor = false;
slidingJoint.connectedAnchor = new Vector3(-width / 2, 0, 0);
SoftJointLimit limit = slidingJoint.linearLimit;
limit.limit = width / 2;
slidingJoint.linearLimit = limit;
}
private float Width() {
float width = 0;
List<float> widths = new List<float>();
for (int i = 0; i < list.Count - 1; i++) {
widths.Add(height);
}
width += PanelUtils.SumWithSpacing(widths, space);
return width;
}
private void PositionGameObject(GameObject myGameObject, int index) {
myGameObject.transform.parent = gameObject.transform;
myGameObject.transform.localPosition = new Vector3(index * (height + space), 0, 0);
myGameObject.transform.localRotation = Quaternion.identity;
}
private void ScaleGameObject(GameObject myGameObject) {
Transform[] children = DetachReattach.DetachChildren(myGameObject);
// scale to fit
Bounds bounds = myGameObject.GetComponent<MeshFilter>().mesh.bounds;
float x = bounds.size.x;
float y = bounds.size.y;
float z = bounds.size.z;
float max = x;
if (y > max) max = y;
if (z > max) max = z;
float newScale = Ratio.SolveForD(max, 1f, height);
myGameObject.transform.localScale = new Vector3(newScale, newScale, newScale);
DetachReattach.ReattachChildren(children, myGameObject);
}
private void ScaleGameObjects() {
for (int i = 0; i < list.Count; i++) {
PositionGameObject(list[i], i);
ScaleGameObject(list[i]);
}
}
// Use this for initialization
void Start() {
Initialize();
}
}
} | mit |
bpmn-io/diagram-js | test/spec/features/create/CreateSpec.js | 27773 | import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
import {
createCanvasEvent as canvasEvent
} from '../../../util/MockEvents';
import modelingModule from 'lib/features/modeling';
import moveModule from 'lib/features/move';
import dragModule from 'lib/features/dragging';
import createModule from 'lib/features/create';
import attachSupportModule from 'lib/features/attach-support';
import connectionPreviewModule from 'lib/features/connection-preview';
import rulesModule from './rules';
import {
classes as svgClasses
} from 'tiny-svg';
import { getMid } from 'lib/layout/LayoutUtil';
var testModules = [
createModule,
rulesModule,
attachSupportModule,
modelingModule,
moveModule,
dragModule
];
var LOW_PRIORITY = 500;
describe('features/create - Create', function() {
var rootShape,
parentShape,
hostShape,
childShape,
frameShape,
ignoreShape,
newShape,
newShape2,
newElements,
hiddenShape;
function setManualDragging(dragging) {
dragging.setOptions({ manual: true });
}
function setupDiagram(elementFactory, canvas) {
rootShape = elementFactory.createRoot({
id: 'root'
});
canvas.setRootElement(rootShape);
parentShape = elementFactory.createShape({
id: 'parentShape',
x: 100, y: 100, width: 300, height: 200
});
canvas.addShape(parentShape, rootShape);
hostShape = elementFactory.createShape({
id: 'hostShape',
x: 450, y: 250,
width: 100, height: 100
});
canvas.addShape(hostShape, rootShape);
childShape = elementFactory.createShape({
id: 'childShape',
x: 600, y: 250, width: 100, height: 100
});
canvas.addShape(childShape, rootShape);
frameShape = elementFactory.createShape({
id: 'frameShape',
x: 450, y: 100, width: 100, height: 100,
isFrame: true
});
canvas.addShape(frameShape, rootShape);
ignoreShape = elementFactory.createShape({
id: 'ignoreShape',
x: 600, y: 100, width: 100, height: 100
});
canvas.addShape(ignoreShape, rootShape);
newShape = elementFactory.createShape({
id: 'newShape',
width: 50,
height: 50
});
newElements = [];
newShape2 = elementFactory.createShape({
id: 'newShape2',
width: 50,
height: 50
});
newElements.push(newShape2);
var newShape3 = elementFactory.createShape({
id: 'newShape3',
x: 100,
y: -25,
width: 100,
height: 100
});
newElements.push(newShape3);
newElements.push(elementFactory.createShape({
id: 'newShape4',
parent: newShape2,
x: 100,
y: -25,
width: 100,
height: 100
}));
newElements.push(elementFactory.createConnection({
id: 'newConnection',
source: newShape2,
target: newShape3,
waypoints: [
{ x: 50, y: 25 },
{ x: 100, y: 25 }
]
}));
hiddenShape = elementFactory.createShape({
id: 'hiddenShape',
x: 1000, y: 100, width: 100, height: 100,
hidden: true
});
newElements.push(hiddenShape);
}
beforeEach(bootstrapDiagram({
modules: testModules
}));
beforeEach(inject(setManualDragging));
beforeEach(inject(setupDiagram));
describe('basics', function() {
it('should create', inject(function(create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
dragging.end();
// then
var createdShape = elementRegistry.get('newShape');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(parentShape);
}));
it('should update elements and shape after create', inject(
function(create, dragging, elementFactory, elementRegistry, eventBus) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
var shape = elementFactory.createShape({
id: 'shape',
x: 100,
y: 100,
width: 100,
height: 100
});
eventBus.on('commandStack.shape.create.preExecute', function(event) {
var context = event.context;
context.shape = shape;
});
eventBus.on('create.end', LOW_PRIORITY, function(context) {
// then
expect(context.elements).to.have.length(1);
expect(context.elements[0]).to.equal(shape);
expect(context.shape).to.equal(shape);
});
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
dragging.end();
}
));
it('should append and connect from source to new shape', inject(function(create, dragging, elementRegistry) {
// given
var rootGfx = elementRegistry.getGraphics('rootShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, {
source: childShape
});
dragging.hover({ element: rootShape, gfx: rootGfx });
dragging.move(canvasEvent({ x: 500, y: 500 }));
dragging.end();
// then
var createdShape = elementRegistry.get('newShape');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(rootShape);
expect(createdShape.incoming).to.have.length(1);
expect(createdShape.incoming[0].source).to.equal(childShape);
expect(childShape.outgoing).to.have.length(1);
expect(childShape.outgoing[0].target).to.equal(createdShape);
}));
it('should append and connect from new shape to source', inject(function(create, dragging, elementRegistry) {
// given
var rootGfx = elementRegistry.getGraphics('rootShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, {
source: childShape,
hints: {
connectionTarget: childShape
}
});
dragging.hover({ element: rootShape, gfx: rootGfx });
dragging.move(canvasEvent({ x: 500, y: 500 }));
dragging.end();
// then
var createdShape = elementRegistry.get('newShape');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(rootShape);
expect(createdShape.outgoing).to.have.length(1);
expect(createdShape.outgoing[0].target).to.equal(childShape);
expect(childShape.incoming).to.have.length(1);
expect(childShape.incoming[0].source).to.equal(createdShape);
}));
it('should attach', inject(function(create, dragging, elementRegistry) {
// given
var hostShapeGfx = elementRegistry.getGraphics('hostShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: hostShape, gfx: hostShapeGfx });
dragging.move(canvasEvent(getMid(hostShape)));
dragging.end();
// then
var createdShape = elementRegistry.get('newShape');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(rootShape);
expect(createdShape.host).to.equal(hostShape);
expect(hostShape.attachers).to.have.length;
expect(hostShape.attachers[0]).to.equal(createdShape);
}));
it('should attach with label', inject(function(create, dragging, elementFactory, elementRegistry) {
// given
var hostShapeGfx = elementRegistry.getGraphics('hostShape');
var newLabel = elementFactory.createLabel({
id: 'newLabel',
labelTarget: newShape,
x: 0,
y: 0,
width: 50,
height: 50
});
// when
create.start(canvasEvent({ x: 0, y: 0 }), [ newShape, newLabel ]);
dragging.hover({ element: hostShape, gfx: hostShapeGfx });
dragging.move(canvasEvent(getMid(hostShape)));
dragging.end();
// then
var createdShape = elementRegistry.get('newShape'),
createdLabel = elementRegistry.get('newLabel');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(rootShape);
expect(createdShape.host).to.equal(hostShape);
expect(hostShape.attachers).to.have.length;
expect(hostShape.attachers[0]).to.equal(createdShape);
expect(createdLabel).to.exist;
expect(createdLabel).to.equal(newLabel);
expect(createdShape.label).to.equal(newLabel);
expect(createdShape.labels).to.have.length(1);
expect(createdShape.labels[0]).to.equal(newLabel);
}));
it('should append AND attach', inject(function(create, dragging, elementRegistry) {
// given
var hostShapeGfx = elementRegistry.getGraphics('hostShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, {
source: parentShape
});
dragging.hover({ element: hostShape, gfx: hostShapeGfx });
dragging.move(canvasEvent(getMid(hostShape)));
dragging.end();
// then
var createdShape = elementRegistry.get('newShape');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(rootShape);
expect(createdShape.host).to.equal(hostShape);
expect(createdShape.incoming).to.have.length(1);
expect(createdShape.incoming[0].source).to.equal(parentShape);
expect(hostShape.attachers).to.have.length;
expect(hostShape.attachers[0]).to.equal(createdShape);
expect(parentShape.outgoing).to.have.length(1);
expect(parentShape.outgoing[0].target).to.equal(createdShape);
}));
it('should set first shape as primary shape', inject(function(create, dragging) {
// when
create.start(canvasEvent({ x: 0, y: 0 }), newElements);
// then
var context = dragging.context().data.context;
expect(context.shape).to.equal(newShape2);
}));
it('should ignore hidden shapes when centering elements around cursor', inject(
function(create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), [ newShape, hiddenShape ]);
var delta = {
x: hiddenShape.x - newShape.x,
y: hiddenShape.y - newShape.y
};
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent({ x: 100, y: 100 }));
dragging.end();
// then
var newVisibleShape = elementRegistry.get('newShape');
var expectedPosition = {
x: 100 - (newVisibleShape.width / 2),
y: 100 - (newVisibleShape.height / 2)
};
// visible shape should be centered around cursor
expect(newVisibleShape).to.exist;
expect(newVisibleShape.x).to.equal(expectedPosition.x);
expect(newVisibleShape.y).to.equal(expectedPosition.y);
var newHiddenShape = elementRegistry.get('hiddenShape');
// hidden shape should be positioned relative to visible shape
expect(newHiddenShape).to.exist;
expect({
x: newHiddenShape.x - newVisibleShape.x,
y: newHiddenShape.y - newVisibleShape.y
}).to.eql(delta);
expect(newHiddenShape.x).to.equal(1075);
expect(newHiddenShape.y).to.equal(175);
}
));
it('should cancel on <elements.changed>', inject(
function(create, dragging, elementRegistry, eventBus) {
// given
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
// when
eventBus.fire('elements.changed', { elements: [] });
// then
expect(dragging.context()).not.to.exist;
}
));
});
describe('rules', function() {
describe('create shape', function() {
it('should allow shape create', inject(function(create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.exist;
expect(canExecute.attach).to.be.false;
expect(canExecute.connect).to.be.false;
}));
it('should NOT allow shape create', inject(function(create, dragging, elementRegistry) {
// given
var childGfx = elementRegistry.getGraphics('childShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: childShape, gfx: childGfx });
dragging.move(canvasEvent(getMid(childShape)));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.be.false;
}));
});
describe('create elements', function() {
it('should allow create elements', inject(function(create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newElements);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.exist;
expect(canExecute.attach).to.be.false;
expect(canExecute.connect).to.be.false;
}));
it('should NOT allow create elements', inject(function(create, dragging, elementRegistry) {
// given
var childGfx = elementRegistry.getGraphics('childShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newElements);
dragging.hover({ element: childShape, gfx: childGfx });
dragging.move(canvasEvent(getMid(childShape)));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.be.false;
}));
});
describe('attach shape', function() {
it('should allow shape attach', inject(function(create, dragging, elementRegistry) {
// given
var hostGfx = elementRegistry.getGraphics('hostShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: hostShape, gfx: hostGfx });
dragging.move(canvasEvent(getMid(hostShape)));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.exist;
expect(canExecute.attach).to.equal('attach');
expect(canExecute.connect).to.be.false;
}));
it('should NOT allow shape attach', inject(function(create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.exist;
expect(canExecute.attach).to.be.false;
expect(canExecute.connect).to.be.false;
}));
});
describe('connect shape', function() {
it('should allow shape connect', inject(function(create, dragging, elementRegistry) {
// given
var rootGfx = elementRegistry.getGraphics('rootShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, {
source: childShape
});
dragging.hover({ element: rootShape, gfx: rootGfx });
dragging.move(canvasEvent({ x: 500, y: 500 }));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.exist;
expect(canExecute.attach).to.be.false;
expect(canExecute.connect).to.be.true;
}));
it('should NOT allow shape connect', inject(function(create, dragging, elementRegistry) {
// given
var rootGfx = elementRegistry.getGraphics('rootShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, {
source: hostShape
});
dragging.hover({ element: rootShape, gfx: rootGfx });
dragging.move(canvasEvent({ x: 500, y: 500 }));
// then
var canExecute = dragging.context().data.context.canExecute;
expect(canExecute).to.exist;
expect(canExecute.attach).to.be.false;
expect(canExecute.connect).to.be.false;
}));
});
describe.skip('connection preview', function() {
beforeEach(bootstrapDiagram({
modules: testModules.concat(connectionPreviewModule)
}));
beforeEach(inject(setManualDragging));
beforeEach(inject(setupDiagram));
it('should display connection preview', inject(function(create, elementRegistry, dragging) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, childShape);
dragging.move(canvasEvent({ x: 175, y: 175 }));
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent({ x: 400, y: 200 }));
var ctx = dragging.context();
// then
expect(ctx.data.context.connectionPreviewGfx).to.exist;
expect(svgClasses(ctx.data.context.connectionPreviewGfx).has('djs-dragger')).to.be.true;
}));
it('should not display preview if connection is disallowed',
inject(function(create, elementRegistry, dragging, createRules) {
// given
createRules.addRule('connection.create', 8000, function() {
return false;
});
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, childShape);
dragging.move(canvasEvent({ x: 175, y: 175 }));
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent({ x: 400, y: 200 }));
var ctx = dragging.context();
// then
expect(ctx.data.context.connectionPreviewGfx.childNodes).to.be.have.lengthOf(0);
})
);
it('should remove connection preview on dragging end', inject(function(create, elementRegistry, dragging) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, childShape);
dragging.move(canvasEvent({ x: 175, y: 175 }));
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent({ x: 400, y: 200 }));
var ctx = dragging.context();
dragging.end();
// then
expect(ctx.data.context.connectionPreviewGfx.parentNode).not.to.exist;
}));
it('should remove connection preview on dragging cancel', inject(function(create, elementRegistry, dragging) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, childShape);
dragging.move(canvasEvent({ x: 175, y: 175 }));
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent({ x: 400, y: 200 }));
var ctx = dragging.context();
dragging.cancel();
// then
expect(ctx.data.context.connectionPreviewGfx.parentNode).not.to.exist;
}));
});
it('should NOT allow create if no hover', inject(function(create, dragging, elementRegistry) {
// given
var rootGfx = elementRegistry.getGraphics('rootShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: rootShape, gfx: rootGfx });
dragging.out();
// no new hover
dragging.move(canvasEvent({ x: 500, y: 500 }));
// then
var canExecute = dragging.context().data.context;
expect(canExecute.canExecute).to.be.false;
expect(canExecute.target).to.be.null;
}));
});
describe('selection', function() {
it('should not select hidden after create', inject(
function(create, dragging, elementRegistry, selection) {
// given
newShape2.hidden = true;
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newElements);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
dragging.end();
// then
var createdHiddenShape = elementRegistry.get(newShape2.id);
expect(selection.get()).not.to.contain(createdHiddenShape);
}
));
});
describe('markers', function() {
it('should add "attach-ok" marker', inject(function(canvas, create, dragging, elementRegistry) {
// given
var hostGfx = elementRegistry.getGraphics('hostShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: hostShape, gfx: hostGfx });
dragging.move(canvasEvent(getMid(hostShape)));
// then
expect(canvas.hasMarker(hostShape, 'attach-ok')).to.be.true;
}));
it('should add "drop-not-ok" marker', inject(
function(canvas, create, dragging, elementRegistry) {
// given
var childGfx = elementRegistry.getGraphics('childShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: childShape, gfx: childGfx });
dragging.move(canvasEvent(getMid(childShape)));
// then
expect(canvas.hasMarker(childShape, 'drop-not-ok')).to.be.true;
}
));
it('should add "new-parent" marker', inject(
function(canvas, create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
// then
expect(canvas.hasMarker(parentShape, 'new-parent')).to.be.true;
}
));
it('should ignore hovering', inject(
function(canvas, create, dragging, elementRegistry) {
// given
var ignoreGfx = elementRegistry.getGraphics('ignoreShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: ignoreShape, gfx: ignoreGfx });
dragging.move(canvasEvent(getMid(ignoreShape)));
// then
expect(canvas.hasMarker(ignoreShape, 'attach-okay')).to.be.false;
expect(canvas.hasMarker(ignoreShape, 'drop-not-okay')).to.be.false;
expect(canvas.hasMarker(ignoreShape, 'new-parent')).to.be.false;
})
);
it('should remove markers on cleanup', inject(function(canvas, create, elementRegistry, dragging) {
// given
var targetGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.move(canvasEvent({ x: 200, y: 50 }));
dragging.hover({ element: parentShape, gfx: targetGfx });
dragging.move(canvasEvent({ x: 200, y: 225 }));
var hasMarker = canvas.hasMarker(parentShape, 'new-parent');
dragging.end();
// then
expect(canvas.hasMarker(parentShape, 'new-parent')).to.be.false;
expect(canvas.hasMarker(parentShape, 'new-parent')).not.to.eql(hasMarker);
}));
});
describe('hints', function() {
afterEach(sinon.restore);
it('should fire create.start with hints', inject(function(create, eventBus) {
// given
var spy = sinon.spy(function(event) {
expect(event.context.hints).to.exist;
});
eventBus.once('create.start', spy);
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
// then
expect(spy).to.have.been.called;
}));
it('should fire create.end with hints', inject(
function(create, dragging, elementRegistry, eventBus) {
// given
var parentGfx = elementRegistry.getGraphics(parentShape);
var spy = sinon.spy(function(event) {
expect(event.context.hints).to.exist;
});
eventBus.once('create.end', spy);
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape);
dragging.hover({ element: parentShape, gfx: parentGfx });
dragging.move(canvasEvent(getMid(parentShape)));
dragging.end();
// then
expect(spy).to.have.been.called;
}
));
});
describe('constraints', function() {
beforeEach(inject(function(create, dragging, elementRegistry) {
// given
var parentGfx = elementRegistry.getGraphics('parentShape');
// when
create.start(canvasEvent({ x: 0, y: 0 }), newShape, {
createConstraints: {
top: 10,
right: 110,
bottom: 110,
left: 10
}
});
dragging.hover({ element: parentShape, gfx: parentGfx });
}));
it('top left', inject(function(dragging, elementRegistry) {
dragging.move(canvasEvent({ x: 0, y: 0 }));
dragging.end();
var createdShape = elementRegistry.get('newShape');
// then
expect(getMid(createdShape)).to.eql({ x: 10, y: 10 });
}));
it('top right', inject(function(dragging, elementRegistry) {
dragging.move(canvasEvent({ x: 120, y: 0 }));
dragging.end();
var createdShape = elementRegistry.get('newShape');
// then
expect(getMid(createdShape)).to.eql({ x: 110, y: 10 });
}));
it('left bottom', inject(function(dragging, elementRegistry) {
dragging.move(canvasEvent({ x: 0, y: 120 }));
dragging.end();
var createdShape = elementRegistry.get('newShape');
// then
expect(getMid(createdShape)).to.eql({ x: 10, y: 110 });
}));
it('right bottom', inject(function(dragging, elementRegistry) {
dragging.move(canvasEvent({ x: 120, y: 120 }));
dragging.end();
var createdShape = elementRegistry.get('newShape');
// then
expect(getMid(createdShape)).to.eql({ x: 110, y: 110 });
}));
});
describe('integration', function() {
it('should create on hover after dragging is initialized', inject(
function(create, dragging, elementRegistry, hoverFix) {
// given
hoverFix._findTargetGfx = function(event) {
return elementRegistry.getGraphics(parentShape);
};
// when
create.start(canvasEvent(getMid(parentShape)), newShape);
dragging.end();
// then
var createdShape = elementRegistry.get('newShape');
expect(createdShape).to.exist;
expect(createdShape).to.equal(newShape);
expect(createdShape.parent).to.equal(parentShape);
}
));
});
});
| mit |
ggtakec/k2hash | lib/k2hattrs.cc | 11556 | /*
* K2HASH
*
* Copyright 2013 Yahoo Japan Corporation.
*
* K2HASH is key-valuew store base libraries.
* K2HASH is made for the purpose of the construction of
* original KVS system and the offer of the library.
* The characteristic is this KVS library which Key can
* layer. And can support multi-processing and multi-thread,
* and is provided safely as available KVS.
*
* For the full copyright and license information, please view
* the license file that was distributed with this source code.
*
* AUTHOR: Takeshi Nakatani
* CREATE: Wed Nov 25 2015
* REVISION:
*
*/
#include <string.h>
#include "k2hcommon.h"
#include "k2hattrs.h"
#include "k2hutil.h"
#include "k2hdbg.h"
using namespace std;
//---------------------------------------------------------
// K2HAttrs Methods
//---------------------------------------------------------
K2HAttrs::K2HAttrs()
{
}
K2HAttrs::K2HAttrs(const K2HAttrs& other)
{
(*this) = other;
}
K2HAttrs::K2HAttrs(const char* pattrs)
{
Serialize(reinterpret_cast<const unsigned char*>(pattrs), pattrs ? strlen(pattrs) + 1 : 0UL);
}
K2HAttrs::K2HAttrs(const unsigned char* pattrs, size_t attrslength)
{
Serialize(pattrs, attrslength);
}
K2HAttrs::~K2HAttrs()
{
clear();
}
bool K2HAttrs::Serialize(unsigned char** ppattrs, size_t& attrslen) const
{
if(!ppattrs){
ERR_K2HPRN("Parameter is wrong.");
return false;
}
if(0 == Attrs.size()){
*ppattrs = NULL;
attrslen = 0UL;
return true;
}
k2hattrarr_t::const_iterator iter;
// total length
size_t tlength = sizeof(size_t); // for attrs count as first data.
// cppcheck-suppress postfixOperator
for(iter = Attrs.begin(); iter != Attrs.end(); iter++){
tlength += sizeof(size_t) * 2;
tlength += iter->keylength;
tlength += iter->vallength;
}
// allocation
unsigned char* pSerialize;
if(NULL == (pSerialize = (unsigned char*)malloc(tlength))){
ERR_K2HPRN("Could not allocate memory.");
return false;
}
// set subkey count
size_t* pCountPos = reinterpret_cast<size_t*>(pSerialize);
*pCountPos = Attrs.size();
// set datas.
unsigned char* pSetPos = pSerialize + sizeof(size_t);
// cppcheck-suppress postfixOperator
for(iter = Attrs.begin(); iter != Attrs.end(); iter++){
// set length
size_t* pKeyLenPos = reinterpret_cast<size_t*>(pSetPos);
size_t* pValLenPos = reinterpret_cast<size_t*>(&pSetPos[sizeof(size_t)]);
*pKeyLenPos = iter->keylength;
*pValLenPos = iter->vallength;
// set data
if(0UL < iter->keylength){
memcpy(&pSetPos[sizeof(size_t) * 2], iter->pkey, iter->keylength);
}
if(0UL < iter->vallength){
memcpy(&pSetPos[sizeof(size_t) * 2 + iter->keylength], iter->pval, iter->vallength);
}
// set next position
pSetPos += (sizeof(size_t) * 2 + iter->keylength + iter->vallength);
}
// set return value
*ppattrs = pSerialize;
attrslen = tlength;
return true;
}
bool K2HAttrs::Serialize(const unsigned char* pattrs, size_t attrslength)
{
clear();
if(!pattrs || attrslength < sizeof(size_t)){
return true;
}
// get subkey count
size_t TotalCount = 0UL;
{
const size_t* pCountPos = reinterpret_cast<const size_t*>(pattrs);
TotalCount = *pCountPos;
}
// load
size_t rest_length = attrslength - sizeof(size_t);
const unsigned char* byReadPos = &pattrs[sizeof(size_t)];
for(size_t cnt = 0; cnt < TotalCount; cnt++){
// check length
if(rest_length < (sizeof(size_t) * 2)){
ERR_K2HPRN("Not enough length for loading.");
break;
}
// key & value length and position
const size_t* pKeyLengthPos = reinterpret_cast<const size_t*>(byReadPos);
const size_t* pValLengthPos = reinterpret_cast<const size_t*>(&byReadPos[sizeof(size_t)]);
const unsigned char* pKeyPos = &byReadPos[sizeof(size_t) * 2];
const unsigned char* pValPos = &byReadPos[sizeof(size_t) * 2 + (*pKeyLengthPos)];
// re-check length
if(rest_length < (sizeof(size_t) * 2 + (*pKeyLengthPos) + (*pValLengthPos))){
ERR_K2HPRN("Not enough length for loading.");
break;
}
// set into array(with allocation)
insert(pKeyPos, *pKeyLengthPos, pValPos, *pValLengthPos);
// set rest length and next position
byReadPos += (sizeof(size_t) * 2 + (*pKeyLengthPos) + (*pValLengthPos));
rest_length -= (sizeof(size_t) * 2 + (*pKeyLengthPos) + (*pValLengthPos));
}
return true;
}
strarr_t::size_type K2HAttrs::KeyStringArray(strarr_t& strarr) const
{
strarr.clear();
// cppcheck-suppress postfixOperator
for(k2hattrarr_t::const_iterator iter = Attrs.begin(); iter != Attrs.end(); iter++){
string strtmp(reinterpret_cast<const char*>(iter->pkey), iter->keylength);
strtmp += '\0';
strarr.push_back(strtmp);
}
return strarr.size();
}
void K2HAttrs::clear(void)
{
// cppcheck-suppress postfixOperator
for(k2hattrarr_t::iterator iter = Attrs.begin(); iter != Attrs.end(); iter++){
K2H_Free(iter->pkey);
K2H_Free(iter->pval);
}
Attrs.clear();
}
bool K2HAttrs::empty(void) const
{
return Attrs.empty();
}
size_t K2HAttrs::size(void) const
{
return Attrs.size();
}
K2HAttrs& K2HAttrs::operator=(const K2HAttrs& other)
{
clear();
// cppcheck-suppress postfixOperator
for(k2hattrarr_t::const_iterator iter = other.Attrs.begin(); iter != other.Attrs.end(); iter++){
insert(iter->pkey, iter->keylength, iter->pval, iter->vallength);
}
return *this;
}
K2HAttrs::iterator K2HAttrs::begin(void)
{
return K2HAttrIterator(this, Attrs.begin());
}
K2HAttrs::iterator K2HAttrs::end(void)
{
return K2HAttrIterator(this, Attrs.end());
}
K2HAttrs::iterator K2HAttrs::find(const char* pkey)
{
return find(reinterpret_cast<const unsigned char*>(pkey), pkey ? strlen(pkey) + 1 : 0UL);
}
K2HAttrs::iterator K2HAttrs::find(const unsigned char* pkey, size_t keylength)
{
if(!pkey || 0UL == keylength){
ERR_K2HPRN("Parameter is wrong.");
return end();
}
// Search
k2hattrarr_t::iterator found_iter;
size_t StartPos= 0;
size_t EndPos = Attrs.size();
int nResult;
while(true){
size_t MidPos;
MidPos = (StartPos + EndPos) / 2;
found_iter = Attrs.begin();
advance(found_iter, MidPos);
if(found_iter != Attrs.end()){
nResult = found_iter->compare(pkey, keylength);
}else{
nResult = -1;
}
if(nResult == 0){
// found
return K2HAttrIterator(this, found_iter);
}else if(nResult < 0){
// middle value < target value
if(StartPos == MidPos){
// not found
break;
}
StartPos = MidPos;
}else{ // 0 < nResult
// middle value > target value
if(EndPos == MidPos){
// not found
break;
}
EndPos = MidPos;
}
}
return end();
}
bool K2HAttrs::erase(const char* pkey)
{
return erase(reinterpret_cast<const unsigned char*>(pkey), pkey ? strlen(pkey) + 1 : 0UL);
}
bool K2HAttrs::erase(const unsigned char* pkey, size_t keylength)
{
K2HAttrs::iterator iter = find(pkey, keylength);
if(iter == end()){
return false;
}
erase(iter);
return true;
}
K2HAttrs::iterator K2HAttrs::erase(K2HAttrs::iterator iter)
{
if(iter.pK2HAttrs != this){
ERR_K2HPRN("iterator is not this object iterator.");
return iter;
}
if(iter.iter_pos == Attrs.end()){
WAN_K2HPRN("iterator is end(), so nothing is deleted.");
return iter;
}
K2H_Free(iter.iter_pos->pkey);
K2H_Free(iter.iter_pos->pval);
iter.iter_pos = Attrs.erase(iter.iter_pos);
return iter;
}
K2HAttrs::iterator K2HAttrs::insert(const char* pkey, const char* pval)
{
return insert(reinterpret_cast<const unsigned char*>(pkey), pkey ? strlen(pkey) + 1 : 0UL, reinterpret_cast<const unsigned char*>(pval), pval ? strlen(pval) + 1 : 0UL);
}
K2HAttrs::iterator K2HAttrs::insert(const unsigned char* pkey, size_t keylength, const unsigned char* pval, size_t vallength)
{
if(!pkey || 0UL == keylength){
ERR_K2HPRN("Parameter is wrong.");
return end();
}
// copy(allocate) attr
K2HATTR attr;
attr.keylength = keylength;
attr.vallength = vallength;
if(NULL == (attr.pkey = (unsigned char*)malloc(attr.keylength))){
ERR_K2HPRN("Could not allocate memory.");
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress memleak
return K2HAttrIterator(this, Attrs.end());
}
memcpy(attr.pkey, pkey, attr.keylength);
if(0UL < attr.vallength){
if(NULL == (attr.pval = (unsigned char*)malloc(attr.vallength))){
ERR_K2HPRN("Could not allocate memory.");
K2H_Free(attr.pkey);
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress memleak
return K2HAttrIterator(this, Attrs.end());
}
memcpy(attr.pval, pval, attr.vallength);
}
// Search insert pos & insert
k2hattrarr_t::iterator insert_iter;
size_t StartPos= 0;
size_t EndPos = Attrs.size();
int nResult;
while(true){
size_t MidPos;
MidPos = (StartPos + EndPos) / 2;
insert_iter = Attrs.begin();
advance(insert_iter, MidPos);
if(insert_iter != Attrs.end()){
nResult = insert_iter->compare(pkey, keylength);
}else{
nResult = -1;
}
if(nResult == 0){
// same value(remove old value).
unsigned char* poldkey = insert_iter->pkey;
unsigned char* poldval = insert_iter->pval;
insert_iter = Attrs.erase(insert_iter);
K2H_Free(poldkey);
K2H_Free(poldval);
break;
}else if(nResult < 0){
// middle value < target value
if(StartPos == MidPos){
// insert after middle.
if(Attrs.size() <= (MidPos + 1)){
// push_back
insert_iter = Attrs.end();
}else{
// insert before middle
advance(insert_iter, 1);
}
break;
}
StartPos = MidPos;
}else{ // 0 < nResult
// middle value > target value
if(EndPos == MidPos){
// insert before middle.
break;
}
EndPos = MidPos;
}
}
insert_iter = Attrs.insert(insert_iter, attr);
return K2HAttrIterator(this, insert_iter);
}
//---------------------------------------------------------
// K2HAttrIterator Methods
//---------------------------------------------------------
const K2HATTR K2HAttrIterator::dummy;
K2HAttrIterator::K2HAttrIterator() : pK2HAttrs(NULL), iter_pos()
{
}
K2HAttrIterator::K2HAttrIterator(const K2HAttrs* pK2HSKeys, k2hattrarr_t::iterator pos) : pK2HAttrs(pK2HSKeys), iter_pos(pos)
{
}
K2HAttrIterator::K2HAttrIterator(const K2HAttrIterator& iterator) : pK2HAttrs(iterator.pK2HAttrs), iter_pos(iterator.iter_pos)
{
}
K2HAttrIterator::~K2HAttrIterator()
{
}
bool K2HAttrIterator::Next(void)
{
if(!pK2HAttrs){
ERR_K2HPRN("Not initializing this object.");
return false;
}
if(iter_pos != pK2HAttrs->Attrs.end()){
// cppcheck-suppress postfixOperator
iter_pos++;
}
return true;
}
K2HAttrIterator& K2HAttrIterator::operator++(void)
{
if(!Next()){
WAN_K2HPRN("Something error occurred.");
}
return *this;
}
K2HAttrIterator K2HAttrIterator::operator++(int)
{
K2HAttrIterator result = *this;
if(!Next()){
WAN_K2HPRN("Something error occurred.");
}
return result;
}
K2HATTR& K2HAttrIterator::operator*(void)
{
if(!pK2HAttrs){
return *(const_cast<PK2HATTR>(&K2HAttrIterator::dummy));
}
if(iter_pos == pK2HAttrs->Attrs.end()){
return *(const_cast<PK2HATTR>(&K2HAttrIterator::dummy));
}
return (*iter_pos);
}
PK2HATTR K2HAttrIterator::operator->(void) const
{
if(!pK2HAttrs){
return const_cast<PK2HATTR>(&K2HAttrIterator::dummy);
}
if(iter_pos == pK2HAttrs->Attrs.end()){
return const_cast<PK2HATTR>(&K2HAttrIterator::dummy);
}
return &(*iter_pos);
}
bool K2HAttrIterator::operator==(const K2HAttrIterator& iterator)
{
return (pK2HAttrs == iterator.pK2HAttrs && iter_pos == iterator.iter_pos);
}
bool K2HAttrIterator::operator!=(const K2HAttrIterator& iterator)
{
return !(*this == iterator);
}
/*
* VIM modelines
*
* vim:set ts=4 fenc=utf-8:
*/
| mit |
tesera/bawlk | bin/headers.js | 453 | #!/usr/bin/env node
var es = require('event-stream');
var JSONStream = require('JSONStream');
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin
.pipe(JSONStream.parse('resources.*'))
.pipe(es.map(function (resource, callback) {
var headers = resource.schema.fields.map(function(f) {return f.name});
callback(null, ['', resource.path, headers.join(','), ''].join('\n'));
}))
.pipe(process.stdout); | mit |
betcoinproject/betcoin | build/moc_sendcoinsentry.cpp | 4082 | /****************************************************************************
** Meta object code from reading C++ file 'sendcoinsentry.h'
**
** Created: Sun Jan 5 14:07:20 2014
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../src/qt/sendcoinsentry.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'sendcoinsentry.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_SendCoinsEntry[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
8, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: signature, parameters, type, tag, flags
22, 16, 15, 15, 0x05,
// slots: signature, parameters, type, tag, flags
59, 51, 15, 15, 0x0a,
82, 15, 15, 15, 0x0a,
90, 15, 15, 15, 0x08,
124, 116, 15, 15, 0x08,
154, 15, 15, 15, 0x08,
185, 15, 15, 15, 0x08,
210, 15, 15, 15, 0x08,
0 // eod
};
static const char qt_meta_stringdata_SendCoinsEntry[] = {
"SendCoinsEntry\0\0entry\0"
"removeEntry(SendCoinsEntry*)\0enabled\0"
"setRemoveEnabled(bool)\0clear()\0"
"on_deleteButton_clicked()\0address\0"
"on_payTo_textChanged(QString)\0"
"on_addressBookButton_clicked()\0"
"on_pasteButton_clicked()\0updateDisplayUnit()\0"
};
void SendCoinsEntry::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
SendCoinsEntry *_t = static_cast<SendCoinsEntry *>(_o);
switch (_id) {
case 0: _t->removeEntry((*reinterpret_cast< SendCoinsEntry*(*)>(_a[1]))); break;
case 1: _t->setRemoveEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 2: _t->clear(); break;
case 3: _t->on_deleteButton_clicked(); break;
case 4: _t->on_payTo_textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 5: _t->on_addressBookButton_clicked(); break;
case 6: _t->on_pasteButton_clicked(); break;
case 7: _t->updateDisplayUnit(); break;
default: ;
}
}
}
const QMetaObjectExtraData SendCoinsEntry::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject SendCoinsEntry::staticMetaObject = {
{ &QFrame::staticMetaObject, qt_meta_stringdata_SendCoinsEntry,
qt_meta_data_SendCoinsEntry, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &SendCoinsEntry::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *SendCoinsEntry::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *SendCoinsEntry::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_SendCoinsEntry))
return static_cast<void*>(const_cast< SendCoinsEntry*>(this));
return QFrame::qt_metacast(_clname);
}
int SendCoinsEntry::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QFrame::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 8)
qt_static_metacall(this, _c, _id, _a);
_id -= 8;
}
return _id;
}
// SIGNAL 0
void SendCoinsEntry::removeEntry(SendCoinsEntry * _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
QT_END_MOC_NAMESPACE
| mit |
htonkovac/ieee-raspored | node_modules/googleapis/apis/androidenterprise/v1.js | 142194 | "use strict";
/**
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint maxlen: false */
const apirequest_1 = require("../../lib/apirequest");
/**
* Google Play EMM API
*
* Manages the deployment of apps to Android for Work users.
*
* @example
* const google = require('googleapis');
* const androidenterprise = google.androidenterprise('v1');
*
* @namespace androidenterprise
* @type {Function}
* @version v1
* @variation v1
* @param {object=} options Options for Androidenterprise
*/
function Androidenterprise(options) {
const self = this;
self._options = options || {};
self.devices = {
/**
* androidenterprise.devices.get
*
* @desc Retrieves the details of a device.
*
* @alias androidenterprise.devices.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId'],
pathParams: ['deviceId', 'enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.devices.getState
*
* @desc Retrieves whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users.
*
* @alias androidenterprise.devices.getState
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getState: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/state').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId'],
pathParams: ['deviceId', 'enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.devices.list
*
* @desc Retrieves the IDs of all of a user's devices.
*
* @alias androidenterprise.devices.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.devices.setState
*
* @desc Sets whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users.
*
* @alias androidenterprise.devices.setState
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).DeviceState} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setState: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/state').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId'],
pathParams: ['deviceId', 'enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.enterprises = {
/**
* androidenterprise.enterprises.acknowledgeNotificationSet
*
* @desc Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications.
*
* @alias androidenterprise.enterprises.acknowledgeNotificationSet
* @memberOf! androidenterprise(v1)
*
* @param {object=} params Parameters for request
* @param {string=} params.notificationSetId The notification set ID as returned by Enterprises.PullNotificationSet. This must be provided.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
acknowledgeNotificationSet: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/acknowledgeNotificationSet').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.completeSignup
*
* @desc Completes the signup flow, by specifying the Completion token and Enterprise token. This request must not be called multiple times for a given Enterprise Token.
*
* @alias androidenterprise.enterprises.completeSignup
* @memberOf! androidenterprise(v1)
*
* @param {object=} params Parameters for request
* @param {string=} params.completionToken The Completion token initially returned by GenerateSignupUrl.
* @param {string=} params.enterpriseToken The Enterprise token appended to the Callback URL.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
completeSignup: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/completeSignup').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.createWebToken
*
* @desc Returns a unique token to access an embeddable UI. To generate a web UI, pass the generated token into the managed Google Play javascript API. Each token may only be used to start one UI session. See the javascript API documentation for further information.
*
* @alias androidenterprise.enterprises.createWebToken
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).AdministratorWebTokenSpec} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
createWebToken: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/createWebToken').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.delete
*
* @desc Deletes the binding between the EMM and enterprise. This is now deprecated. Use this method only to unenroll customers that were previously enrolled with the insert call, then enroll them again with the enroll call.
*
* @alias androidenterprise.enterprises.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.enroll
*
* @desc Enrolls an enterprise with the calling EMM.
*
* @alias androidenterprise.enterprises.enroll
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.token The token provided by the enterprise to register the EMM.
* @param {androidenterprise(v1).Enterprise} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
enroll: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/enroll').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['token'],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.generateSignupUrl
*
* @desc Generates a sign-up URL.
*
* @alias androidenterprise.enterprises.generateSignupUrl
* @memberOf! androidenterprise(v1)
*
* @param {object=} params Parameters for request
* @param {string=} params.callbackUrl The callback URL to which the Admin will be redirected after successfully creating an enterprise. Before redirecting there the system will add a single query parameter to this URL named "enterpriseToken" which will contain an opaque token to be used for the CompleteSignup request. Beware that this means that the URL will be parsed, the parameter added and then a new URL formatted, i.e. there may be some minor formatting changes and, more importantly, the URL must be well-formed so that it can be parsed.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generateSignupUrl: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/signupUrl').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.get
*
* @desc Retrieves the name and domain of an enterprise.
*
* @alias androidenterprise.enterprises.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.getAndroidDevicePolicyConfig
*
* @desc Returns the Android Device Policy config resource.
*
* @alias androidenterprise.enterprises.getAndroidDevicePolicyConfig
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getAndroidDevicePolicyConfig: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/androidDevicePolicyConfig').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.getServiceAccount
*
* @desc Returns a service account and credentials. The service account can be bound to the enterprise by calling setAccount. The service account is unique to this enterprise and EMM, and will be deleted if the enterprise is unbound. The credentials contain private key data and are not stored server-side. This method can only be called after calling Enterprises.Enroll or Enterprises.CompleteSignup, and before Enterprises.SetAccount; at other times it will return an error. Subsequent calls after the first will generate a new, unique set of credentials, and invalidate the previously generated credentials. Once the service account is bound to the enterprise, it can be managed using the serviceAccountKeys resource.
*
* @alias androidenterprise.enterprises.getServiceAccount
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string=} params.keyType The type of credential to return with the service account. Required.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getServiceAccount: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/serviceAccount').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.getStoreLayout
*
* @desc Returns the store layout for the enterprise. If the store layout has not been set, returns "basic" as the store layout type and no homepage.
*
* @alias androidenterprise.enterprises.getStoreLayout
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getStoreLayout: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.insert
*
* @desc Establishes the binding between the EMM and an enterprise. This is now deprecated; use enroll instead.
*
* @alias androidenterprise.enterprises.insert
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.token The token provided by the enterprise to register the EMM.
* @param {androidenterprise(v1).Enterprise} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['token'],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.list
*
* @desc Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call.
*
* @alias androidenterprise.enterprises.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.domain The exact primary domain name of the enterprise to look up.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['domain'],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.pullNotificationSet
*
* @desc Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty. Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy. Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending. If no notifications are present, an empty notification list is returned. Subsequent requests may return more notifications once they become available.
*
* @alias androidenterprise.enterprises.pullNotificationSet
* @memberOf! androidenterprise(v1)
*
* @param {object=} params Parameters for request
* @param {string=} params.requestMode The request mode for pulling notifications. Specifying waitForNotifications will cause the request to block and wait until one or more notifications are present, or return an empty notification list if no notifications are present after some time. Speciying returnImmediately will cause the request to immediately return the pending notifications, or an empty list if no notifications are present. If omitted, defaults to waitForNotifications.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
pullNotificationSet: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/pullNotificationSet').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.sendTestPushNotification
*
* @desc Sends a test notification to validate the EMM integration with the Google Cloud Pub/Sub service for this enterprise.
*
* @alias androidenterprise.enterprises.sendTestPushNotification
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
sendTestPushNotification: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/sendTestPushNotification').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.setAccount
*
* @desc Sets the account that will be used to authenticate to the API as the enterprise.
*
* @alias androidenterprise.enterprises.setAccount
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).EnterpriseAccount} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setAccount: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/account').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.setAndroidDevicePolicyConfig
*
* @desc Sets the Android Device Policy config resource. EMM may use this method to enable or disable Android Device Policy support for the specified enterprise. To learn more about managing devices and apps with Android Device Policy, see the Android Management API.
*
* @alias androidenterprise.enterprises.setAndroidDevicePolicyConfig
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).AndroidDevicePolicyConfig} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setAndroidDevicePolicyConfig: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/androidDevicePolicyConfig').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.setStoreLayout
*
* @desc Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the admin, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom" and setting a homepage), the basic store layout is disabled.
*
* @alias androidenterprise.enterprises.setStoreLayout
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).StoreLayout} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setStoreLayout: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.enterprises.unenroll
*
* @desc Unenrolls an enterprise from the calling EMM.
*
* @alias androidenterprise.enterprises.unenroll
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
unenroll: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/unenroll').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.entitlements = {
/**
* androidenterprise.entitlements.delete
*
* @desc Removes an entitlement to an app for a user.
*
* @alias androidenterprise.entitlements.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.entitlementId The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'entitlementId'],
pathParams: ['enterpriseId', 'entitlementId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.entitlements.get
*
* @desc Retrieves details of an entitlement.
*
* @alias androidenterprise.entitlements.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.entitlementId The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'entitlementId'],
pathParams: ['enterpriseId', 'entitlementId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.entitlements.list
*
* @desc Lists all entitlements for the specified user. Only the ID is set.
*
* @alias androidenterprise.entitlements.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.entitlements.patch
*
* @desc Adds or updates an entitlement to an app for a user. This method supports patch semantics.
*
* @alias androidenterprise.entitlements.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.entitlementId The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
* @param {boolean=} params.install Set to true to also install the product on all the user's devices where possible. Failure to install on one or more devices will not prevent this operation from returning successfully, as long as the entitlement was successfully assigned to the user.
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).Entitlement} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'entitlementId'],
pathParams: ['enterpriseId', 'entitlementId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.entitlements.update
*
* @desc Adds or updates an entitlement to an app for a user.
*
* @alias androidenterprise.entitlements.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.entitlementId The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
* @param {boolean=} params.install Set to true to also install the product on all the user's devices where possible. Failure to install on one or more devices will not prevent this operation from returning successfully, as long as the entitlement was successfully assigned to the user.
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).Entitlement} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'entitlementId'],
pathParams: ['enterpriseId', 'entitlementId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.grouplicenses = {
/**
* androidenterprise.grouplicenses.get
*
* @desc Retrieves details of an enterprise's group license for a product.
*
* @alias androidenterprise.grouplicenses.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.groupLicenseId The ID of the product the group license is for, e.g. "app:com.google.android.gm".
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/groupLicenses/{groupLicenseId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'groupLicenseId'],
pathParams: ['enterpriseId', 'groupLicenseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.grouplicenses.list
*
* @desc Retrieves IDs of all products for which the enterprise has a group license.
*
* @alias androidenterprise.grouplicenses.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/groupLicenses').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.grouplicenseusers = {
/**
* androidenterprise.grouplicenseusers.list
*
* @desc Retrieves the IDs of the users who have been granted entitlements under the license.
*
* @alias androidenterprise.grouplicenseusers.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.groupLicenseId The ID of the product the group license is for, e.g. "app:com.google.android.gm".
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/groupLicenses/{groupLicenseId}/users').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'groupLicenseId'],
pathParams: ['enterpriseId', 'groupLicenseId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.installs = {
/**
* androidenterprise.installs.delete
*
* @desc Requests to remove an app from a device. A call to get or list will still show the app as installed on the device until it is actually removed.
*
* @alias androidenterprise.installs.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.installId The ID of the product represented by the install, e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'installId'],
pathParams: ['deviceId', 'enterpriseId', 'installId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.installs.get
*
* @desc Retrieves details of an installation of an app on a device.
*
* @alias androidenterprise.installs.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.installId The ID of the product represented by the install, e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'installId'],
pathParams: ['deviceId', 'enterpriseId', 'installId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.installs.list
*
* @desc Retrieves the details of all apps installed on the specified device.
*
* @alias androidenterprise.installs.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId'],
pathParams: ['deviceId', 'enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.installs.patch
*
* @desc Requests to install the latest version of an app to a device. If the app is already installed, then it is updated to the latest version if necessary. This method supports patch semantics.
*
* @alias androidenterprise.installs.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.installId The ID of the product represented by the install, e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).Install} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'installId'],
pathParams: ['deviceId', 'enterpriseId', 'installId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.installs.update
*
* @desc Requests to install the latest version of an app to a device. If the app is already installed, then it is updated to the latest version if necessary.
*
* @alias androidenterprise.installs.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.installId The ID of the product represented by the install, e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).Install} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'installId'],
pathParams: ['deviceId', 'enterpriseId', 'installId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.managedconfigurationsfordevice = {
/**
* androidenterprise.managedconfigurationsfordevice.delete
*
* @desc Removes a per-device managed configuration for an app for the specified device.
*
* @alias androidenterprise.managedconfigurationsfordevice.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForDeviceId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'managedConfigurationForDeviceId'],
pathParams: ['deviceId', 'enterpriseId', 'managedConfigurationForDeviceId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsfordevice.get
*
* @desc Retrieves details of a per-device managed configuration.
*
* @alias androidenterprise.managedconfigurationsfordevice.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForDeviceId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'managedConfigurationForDeviceId'],
pathParams: ['deviceId', 'enterpriseId', 'managedConfigurationForDeviceId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsfordevice.list
*
* @desc Lists all the per-device managed configurations for the specified device. Only the ID is set.
*
* @alias androidenterprise.managedconfigurationsfordevice.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId'],
pathParams: ['deviceId', 'enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsfordevice.patch
*
* @desc Adds or updates a per-device managed configuration for an app for the specified device. This method supports patch semantics.
*
* @alias androidenterprise.managedconfigurationsfordevice.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForDeviceId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).ManagedConfiguration} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'managedConfigurationForDeviceId'],
pathParams: ['deviceId', 'enterpriseId', 'managedConfigurationForDeviceId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsfordevice.update
*
* @desc Adds or updates a per-device managed configuration for an app for the specified device.
*
* @alias androidenterprise.managedconfigurationsfordevice.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.deviceId The Android ID of the device.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForDeviceId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).ManagedConfiguration} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'deviceId', 'managedConfigurationForDeviceId'],
pathParams: ['deviceId', 'enterpriseId', 'managedConfigurationForDeviceId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.managedconfigurationsforuser = {
/**
* androidenterprise.managedconfigurationsforuser.delete
*
* @desc Removes a per-user managed configuration for an app for the specified user.
*
* @alias androidenterprise.managedconfigurationsforuser.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForUserId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'managedConfigurationForUserId'],
pathParams: ['enterpriseId', 'managedConfigurationForUserId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsforuser.get
*
* @desc Retrieves details of a per-user managed configuration for an app for the specified user.
*
* @alias androidenterprise.managedconfigurationsforuser.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForUserId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'managedConfigurationForUserId'],
pathParams: ['enterpriseId', 'managedConfigurationForUserId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsforuser.list
*
* @desc Lists all the per-user managed configurations for the specified user. Only the ID is set.
*
* @alias androidenterprise.managedconfigurationsforuser.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsforuser.patch
*
* @desc Adds or updates a per-user managed configuration for an app for the specified user. This method supports patch semantics.
*
* @alias androidenterprise.managedconfigurationsforuser.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForUserId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).ManagedConfiguration} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'managedConfigurationForUserId'],
pathParams: ['enterpriseId', 'managedConfigurationForUserId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.managedconfigurationsforuser.update
*
* @desc Adds or updates a per-user managed configuration for an app for the specified user.
*
* @alias androidenterprise.managedconfigurationsforuser.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.managedConfigurationForUserId The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).ManagedConfiguration} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId', 'managedConfigurationForUserId'],
pathParams: ['enterpriseId', 'managedConfigurationForUserId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.permissions = {
/**
* androidenterprise.permissions.get
*
* @desc Retrieves details of an Android app permission for display to an enterprise admin.
*
* @alias androidenterprise.permissions.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string=} params.language The BCP47 tag for the user's preferred language (e.g. "en-US", "de")
* @param {string} params.permissionId The ID of the permission.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/permissions/{permissionId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['permissionId'],
pathParams: ['permissionId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.products = {
/**
* androidenterprise.products.approve
*
* @desc Approves the specified product and the relevant app permissions, if any. The maximum number of products that you can approve per enterprise customer is 1,000. To learn how to use managed Google Play to design and create a store layout to display approved products to your users, see Store Layout Design.
*
* @alias androidenterprise.products.approve
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.productId The ID of the product.
* @param {androidenterprise(v1).ProductsApproveRequest} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
approve: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/approve').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId', 'productId'],
pathParams: ['enterpriseId', 'productId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.products.generateApprovalUrl
*
* @desc Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day.
*
* @alias androidenterprise.products.generateApprovalUrl
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string=} params.languageCode The BCP 47 language code used for permission names and descriptions in the returned iframe, for instance "en-US".
* @param {string} params.productId The ID of the product.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generateApprovalUrl: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/generateApprovalUrl').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId', 'productId'],
pathParams: ['enterpriseId', 'productId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.products.get
*
* @desc Retrieves details of a product for display to an enterprise admin.
*
* @alias androidenterprise.products.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string=} params.language The BCP47 tag for the user's preferred language (e.g. "en-US", "de").
* @param {string} params.productId The ID of the product, e.g. "app:com.google.android.gm".
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'productId'],
pathParams: ['enterpriseId', 'productId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.products.getAppRestrictionsSchema
*
* @desc Retrieves the schema that defines the configurable properties for this product. All products have a schema, but this schema may be empty if no managed configurations have been defined. This schema can be used to populate a UI that allows an admin to configure the product. To apply a managed configuration based on the schema obtained using this API, see Managed Configurations through Play.
*
* @alias androidenterprise.products.getAppRestrictionsSchema
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string=} params.language The BCP47 tag for the user's preferred language (e.g. "en-US", "de").
* @param {string} params.productId The ID of the product.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getAppRestrictionsSchema: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/appRestrictionsSchema').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'productId'],
pathParams: ['enterpriseId', 'productId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.products.getPermissions
*
* @desc Retrieves the Android app permissions required by this app.
*
* @alias androidenterprise.products.getPermissions
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.productId The ID of the product.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getPermissions: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/permissions').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'productId'],
pathParams: ['enterpriseId', 'productId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.products.list
*
* @desc Finds approved products that match a query, or all approved products if there is no query.
*
* @alias androidenterprise.products.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {boolean=} params.approved Specifies whether to search among all products (false) or among only products that have been approved (true). Only "true" is supported, and should be specified.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string=} params.language The BCP47 tag for the user's preferred language (e.g. "en-US", "de"). Results are returned in the language best matching the preferred language.
* @param {integer=} params.maxResults Specifies the maximum number of products that can be returned per request. If not specified, uses a default value of 100, which is also the maximum retrievable within a single response.
* @param {string=} params.query The search query as typed in the Google Play store search box. If omitted, all approved apps will be returned (using the pagination parameters), including apps that are not available in the store (e.g. unpublished apps).
* @param {string=} params.token A pagination token is contained in a request''s response when there are more products. The token can be used in a subsequent request to obtain more products, and so forth. This parameter cannot be used in the initial request.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.products.unapprove
*
* @desc Unapproves the specified product (and the relevant app permissions, if any)
*
* @alias androidenterprise.products.unapprove
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.productId The ID of the product.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
unapprove: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/unapprove').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId', 'productId'],
pathParams: ['enterpriseId', 'productId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.serviceaccountkeys = {
/**
* androidenterprise.serviceaccountkeys.delete
*
* @desc Removes and invalidates the specified credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
*
* @alias androidenterprise.serviceaccountkeys.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.keyId The ID of the key.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/serviceAccountKeys/{keyId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'keyId'],
pathParams: ['enterpriseId', 'keyId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.serviceaccountkeys.insert
*
* @desc Generates new credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount. Only the type of the key should be populated in the resource to be inserted.
*
* @alias androidenterprise.serviceaccountkeys.insert
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).ServiceAccountKey} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/serviceAccountKeys').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.serviceaccountkeys.list
*
* @desc Lists all active credentials for the service account associated with this enterprise. Only the ID and key type are returned. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
*
* @alias androidenterprise.serviceaccountkeys.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/serviceAccountKeys').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.storelayoutclusters = {
/**
* androidenterprise.storelayoutclusters.delete
*
* @desc Deletes a cluster.
*
* @alias androidenterprise.storelayoutclusters.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.clusterId The ID of the cluster.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId', 'clusterId'],
pathParams: ['clusterId', 'enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutclusters.get
*
* @desc Retrieves details of a cluster.
*
* @alias androidenterprise.storelayoutclusters.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.clusterId The ID of the cluster.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId', 'clusterId'],
pathParams: ['clusterId', 'enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutclusters.insert
*
* @desc Inserts a new cluster in a page.
*
* @alias androidenterprise.storelayoutclusters.insert
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {androidenterprise(v1).StoreCluster} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId'],
pathParams: ['enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutclusters.list
*
* @desc Retrieves the details of all clusters on the specified page.
*
* @alias androidenterprise.storelayoutclusters.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId'],
pathParams: ['enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutclusters.patch
*
* @desc Updates a cluster. This method supports patch semantics.
*
* @alias androidenterprise.storelayoutclusters.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.clusterId The ID of the cluster.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {androidenterprise(v1).StoreCluster} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId', 'clusterId'],
pathParams: ['clusterId', 'enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutclusters.update
*
* @desc Updates a cluster.
*
* @alias androidenterprise.storelayoutclusters.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.clusterId The ID of the cluster.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {androidenterprise(v1).StoreCluster} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId', 'clusterId'],
pathParams: ['clusterId', 'enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.storelayoutpages = {
/**
* androidenterprise.storelayoutpages.delete
*
* @desc Deletes a store page.
*
* @alias androidenterprise.storelayoutpages.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId'],
pathParams: ['enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutpages.get
*
* @desc Retrieves details of a store page.
*
* @alias androidenterprise.storelayoutpages.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId'],
pathParams: ['enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutpages.insert
*
* @desc Inserts a new store page.
*
* @alias androidenterprise.storelayoutpages.insert
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).StorePage} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutpages.list
*
* @desc Retrieves the details of all pages in the store.
*
* @alias androidenterprise.storelayoutpages.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutpages.patch
*
* @desc Updates the content of a store page. This method supports patch semantics.
*
* @alias androidenterprise.storelayoutpages.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {androidenterprise(v1).StorePage} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId'],
pathParams: ['enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.storelayoutpages.update
*
* @desc Updates the content of a store page.
*
* @alias androidenterprise.storelayoutpages.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.pageId The ID of the page.
* @param {androidenterprise(v1).StorePage} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'pageId'],
pathParams: ['enterpriseId', 'pageId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
self.users = {
/**
* androidenterprise.users.delete
*
* @desc Deleted an EMM-managed user.
*
* @alias androidenterprise.users.delete
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.generateAuthenticationToken
*
* @desc Generates an authentication token which the device policy client can use to provision the given EMM-managed user account on a device. The generated token is single-use and expires after a few minutes. This call only works with EMM-managed accounts.
*
* @alias androidenterprise.users.generateAuthenticationToken
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generateAuthenticationToken: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/authenticationToken').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.generateToken
*
* @desc Generates a token (activation code) to allow this user to configure their managed account in the Android Setup Wizard. Revokes any previously generated token. This call only works with Google managed accounts.
*
* @alias androidenterprise.users.generateToken
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generateToken: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/token').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.get
*
* @desc Retrieves a user's details.
*
* @alias androidenterprise.users.get
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.getAvailableProductSet
*
* @desc Retrieves the set of products a user is entitled to access.
*
* @alias androidenterprise.users.getAvailableProductSet
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getAvailableProductSet: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/availableProductSet').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.insert
*
* @desc Creates a new EMM-managed user. The Users resource passed in the body of the request should include an accountIdentifier and an accountType. If a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed.
*
* @alias androidenterprise.users.insert
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {androidenterprise(v1).User} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['enterpriseId'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.list
*
* @desc Looks up a user by primary email address. This is only supported for Google-managed users. Lookup of the id is not needed for EMM-managed users because the id is already returned in the result of the Users.insert call.
*
* @alias androidenterprise.users.list
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.email The exact primary email address of the user to look up.
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['enterpriseId', 'email'],
pathParams: ['enterpriseId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.patch
*
* @desc Updates the details of an EMM-managed user. Can be used with EMM-managed users only (not Google managed users). Pass the new details in the Users resource in the request body. Only the displayName field can be changed. Other fields must either be unset or have the currently active value. This method supports patch semantics.
*
* @alias androidenterprise.users.patch
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).User} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PATCH'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.revokeToken
*
* @desc Revokes a previously generated token (activation code) for the user.
*
* @alias androidenterprise.users.revokeToken
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
revokeToken: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/token').replace(/([^:]\/)\/+/g, '$1'),
method: 'DELETE'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.setAvailableProductSet
*
* @desc Modifies the set of products that a user is entitled to access (referred to as whitelisted products). Only products that are approved or products that were previously approved (products with revoked approval) can be whitelisted.
*
* @alias androidenterprise.users.setAvailableProductSet
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).ProductSet} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setAvailableProductSet: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/availableProductSet').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* androidenterprise.users.update
*
* @desc Updates the details of an EMM-managed user. Can be used with EMM-managed users only (not Google managed users). Pass the new details in the Users resource in the request body. Only the displayName field can be changed. Other fields must either be unset or have the currently active value.
*
* @alias androidenterprise.users.update
* @memberOf! androidenterprise(v1)
*
* @param {object} params Parameters for request
* @param {string} params.enterpriseId The ID of the enterprise.
* @param {string} params.userId The ID of the user.
* @param {androidenterprise(v1).User} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://www.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}').replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['enterpriseId', 'userId'],
pathParams: ['enterpriseId', 'userId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
}
module.exports = Androidenterprise;
//# sourceMappingURL=v1.js.map | mit |
SELO77/seloPython | 3.X/ex/filterAndLambda.py | 281 | import traceback
data = [3,1,2,5,6,7]
try:
result = filter(lambda x, y: y <x ,data)
print(type(result))
print(result)
for i in result:
print(i)
testResult = filter(lambda x:x < 5, data)
for i in testResult:
print(i)
except:
print(traceback.format_exc()) | mit |
volontariat/voluntary_brainstorming | lib/voluntary_brainstorming/engine.rb | 833 | module VoluntaryBrainstorming
class Engine < ::Rails::Engine
config.autoload_paths << File.expand_path("../..", __FILE__)
config.autoload_paths << File.expand_path("../../../app/models/concerns", __FILE__)
config.autoload_paths << File.expand_path("../../../app/serializers", __FILE__)
config.i18n.load_path += Dir[File.expand_path("../../../config/locales/**/*.{rb,yml}", __FILE__)]
initializer 'configure ember-rails ranking', before: 'ember_rails.setup_vendor' do
config.handlebars.templates_root << 'voluntary_brainstorming/templates'
end
config.to_prepare do
User.send :include, VoluntaryBrainstorming::Concerns::Model::User::HasBrainstormings
Argument.send :include, VoluntaryBrainstorming::Concerns::Model::Argument::PublishesChangesToBrainstorming
end
end
end
| mit |
loafbaker/django_ecommerce1 | carts/migrations/0001_initial.py | 3543 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Cart'
db.create_table(u'carts_cart', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('total', self.gf('django.db.models.fields.DecimalField')(default=0.0, max_digits=100, decimal_places=2)),
('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('active', self.gf('django.db.models.fields.BooleanField')(default=True)),
))
db.send_create_signal(u'carts', ['Cart'])
# Adding M2M table for field products on 'Cart'
m2m_table_name = db.shorten_name(u'carts_cart_products')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('cart', models.ForeignKey(orm[u'carts.cart'], null=False)),
('product', models.ForeignKey(orm[u'products.product'], null=False))
))
db.create_unique(m2m_table_name, ['cart_id', 'product_id'])
def backwards(self, orm):
# Deleting model 'Cart'
db.delete_table(u'carts_cart')
# Removing M2M table for field products on 'Cart'
db.delete_table(db.shorten_name(u'carts_cart_products'))
models = {
u'carts.cart': {
'Meta': {'object_name': 'Cart'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'products': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['products.Product']", 'null': 'True', 'blank': 'True'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'default': '0.0', 'max_digits': '100', 'decimal_places': '2'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'products.product': {
'Meta': {'unique_together': "(('title', 'slug'),)", 'object_name': 'Product'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'price': ('django.db.models.fields.DecimalField', [], {'default': '29.989999999999998', 'max_digits': '100', 'decimal_places': '2'}),
'sale_price': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '100', 'decimal_places': '2', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
}
}
complete_apps = ['carts'] | mit |
dsaqt1516g3/walka-project | service/src/main/java/edu/upc/eetac/dsa/walka/Main.java | 1537 | package edu.upc.eetac.dsa.walka;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;
import java.io.IOException;
import java.net.URI;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
/**
* Main class.
*
*/
public class Main {
// Base URI the Grizzly HTTP server will listen on
private static String baseURI;
public static String getBaseURI() {
if (baseURI == null) {
PropertyResourceBundle prb = (PropertyResourceBundle) ResourceBundle.getBundle("walka");
baseURI = prb.getString("walka.context");
}
return baseURI;
}
/**
* Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
* @return Grizzly HTTP server.
*/
public static HttpServer startServer() {
// create a resource config that scans for JAX-RS resources and providers
// in edu.upc.eetac.dsa.walka package
final ResourceConfig rc = new WalkaResourceConfig();
// create and start a new instance of grizzly http server
// exposing the Jersey application at BASE_URI
return GrizzlyHttpServerFactory.createHttpServer(URI.create(getBaseURI()), rc);
}
/**
* Main method.
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
final HttpServer server = startServer();
}
}
| mit |