code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
class CreateDocuments < ActiveRecord::Migration[5.0] def change create_table :documents do |t| t.integer :product_id, null: false t.string :type, null: false t.string :url, null: false t.timestamps end end end
unasuke/proconist.net
db/migrate/20160610084904_create_documents.rb
Ruby
mit
265
# -*- coding: utf-8 -*- """ Created on Fri Jun 25 16:20:12 2015 @author: Balázs Hidasi @lastmodified: Loreto Parisi (loretoparisi at gmail dot com) """ import sys import os import numpy as np import pandas as pd import datetime as dt # To redirect output to file class Logger(object): def __init__(self, filename="Default.log"): self.terminal = sys.stdout self.log = open(filename, "a") def write(self, message): self.terminal.write(message) self.log.write(message) def flush(self): pass sys.stdout = Logger( os.environ['HOME' ] + '/theano.log' ) PATH_TO_ORIGINAL_DATA = os.environ['HOME'] + '/' PATH_TO_PROCESSED_DATA = os.environ['HOME'] + '/' data = pd.read_csv(PATH_TO_ORIGINAL_DATA + 'yoochoose-clicks.dat', sep=',', header=None, usecols=[0,1,2], dtype={0:np.int32, 1:str, 2:np.int64}) data.columns = ['SessionId', 'TimeStr', 'ItemId'] data['Time'] = data.TimeStr.apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%dT%H:%M:%S.%fZ').timestamp()) #This is not UTC. It does not really matter. del(data['TimeStr']) session_lengths = data.groupby('SessionId').size() data = data[np.in1d(data.SessionId, session_lengths[session_lengths>1].index)] item_supports = data.groupby('ItemId').size() data = data[np.in1d(data.ItemId, item_supports[item_supports>=5].index)] session_lengths = data.groupby('SessionId').size() data = data[np.in1d(data.SessionId, session_lengths[session_lengths>=2].index)] tmax = data.Time.max() session_max_times = data.groupby('SessionId').Time.max() session_train = session_max_times[session_max_times < tmax-86400].index session_test = session_max_times[session_max_times >= tmax-86400].index train = data[np.in1d(data.SessionId, session_train)] test = data[np.in1d(data.SessionId, session_test)] test = test[np.in1d(test.ItemId, train.ItemId)] tslength = test.groupby('SessionId').size() test = test[np.in1d(test.SessionId, tslength[tslength>=2].index)] print('Full train set\n\tEvents: {}\n\tSessions: {}\n\tItems: {}'.format(len(train), train.SessionId.nunique(), train.ItemId.nunique())) train.to_csv(PATH_TO_PROCESSED_DATA + 'rsc15_train_full.txt', sep='\t', index=False) print('Test set\n\tEvents: {}\n\tSessions: {}\n\tItems: {}'.format(len(test), test.SessionId.nunique(), test.ItemId.nunique())) test.to_csv(PATH_TO_PROCESSED_DATA + 'rsc15_test.txt', sep='\t', index=False) tmax = train.Time.max() session_max_times = train.groupby('SessionId').Time.max() session_train = session_max_times[session_max_times < tmax-86400].index session_valid = session_max_times[session_max_times >= tmax-86400].index train_tr = train[np.in1d(train.SessionId, session_train)] valid = train[np.in1d(train.SessionId, session_valid)] valid = valid[np.in1d(valid.ItemId, train_tr.ItemId)] tslength = valid.groupby('SessionId').size() valid = valid[np.in1d(valid.SessionId, tslength[tslength>=2].index)] print('Train set\n\tEvents: {}\n\tSessions: {}\n\tItems: {}'.format(len(train_tr), train_tr.SessionId.nunique(), train_tr.ItemId.nunique())) train_tr.to_csv(PATH_TO_PROCESSED_DATA + 'rsc15_train_tr.txt', sep='\t', index=False) print('Validation set\n\tEvents: {}\n\tSessions: {}\n\tItems: {}'.format(len(valid), valid.SessionId.nunique(), valid.ItemId.nunique())) valid.to_csv(PATH_TO_PROCESSED_DATA + 'rsc15_train_valid.txt', sep='\t', index=False)
loretoparisi/docker
theano/rsc15/preprocess.py
Python
mit
3,325
<?php namespace PSR2R\Sniffs\Commenting; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Util\Tokens; use PSR2R\Tools\AbstractSniff; use PSR2R\Tools\Traits\CommentingTrait; use PSR2R\Tools\Traits\SignatureTrait; /** * Methods always need doc blocks. * Constructor and destructor may not have one if they do not have arguments. */ class DocBlockSniff extends AbstractSniff { use CommentingTrait; use SignatureTrait; /** * @inheritDoc */ public function register(): array { return [T_FUNCTION]; } /** * @inheritDoc */ public function process(File $phpcsFile, $stackPtr): void { $tokens = $phpcsFile->getTokens(); $nextIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true); if ($nextIndex === false) { return; } if ($tokens[$nextIndex]['content'] === '__construct' || $tokens[$nextIndex]['content'] === '__destruct') { $this->checkConstructorAndDestructor($phpcsFile, $stackPtr); return; } // Don't mess with closures $prevIndex = $phpcsFile->findPrevious(Tokens::$emptyTokens, $stackPtr - 1, null, true); if (!$this->isGivenKind(Tokens::$methodPrefixes, $tokens[$prevIndex])) { return; } $docBlockEndIndex = $this->findRelatedDocBlock($phpcsFile, $stackPtr); if ($docBlockEndIndex) { return; } // We only look for void methods right now $returnType = $this->detectReturnTypeVoid($phpcsFile, $stackPtr); if ($returnType === null) { $phpcsFile->addError('Method does not have a doc block: ' . $tokens[$nextIndex]['content'] . '()', $nextIndex, 'DocBlockMissing'); return; } $fix = $phpcsFile->addFixableError('Method does not have a docblock with return void statement: ' . $tokens[$nextIndex]['content'], $nextIndex, 'ReturnVoidMissing'); if (!$fix) { return; } $this->addDocBlock($phpcsFile, $stackPtr, $returnType); } /** * @param \PHP_CodeSniffer\Files\File $phpcsFile * @param int $index * @param string $returnType * * @return void */ protected function addDocBlock(File $phpcsFile, int $index, string $returnType): void { $tokens = $phpcsFile->getTokens(); $firstTokenOfLine = $this->getFirstTokenOfLine($tokens, $index); $prevContentIndex = $phpcsFile->findPrevious(T_WHITESPACE, $firstTokenOfLine - 1, null, true); if ($prevContentIndex === false) { return; } if ($tokens[$prevContentIndex]['type'] === 'T_ATTRIBUTE_END') { $firstTokenOfLine = $this->getFirstTokenOfLine($tokens, $prevContentIndex); } $indentation = $this->getIndentationWhitespace($phpcsFile, $index); $phpcsFile->fixer->beginChangeset(); $phpcsFile->fixer->addNewlineBefore($firstTokenOfLine); $phpcsFile->fixer->addContentBefore($firstTokenOfLine, $indentation . ' */'); $phpcsFile->fixer->addNewlineBefore($firstTokenOfLine); $phpcsFile->fixer->addContentBefore($firstTokenOfLine, $indentation . ' * @return ' . $returnType); $phpcsFile->fixer->addNewlineBefore($firstTokenOfLine); $phpcsFile->fixer->addContentBefore($firstTokenOfLine, $indentation . '/**'); $phpcsFile->fixer->endChangeset(); } /** * @param \PHP_CodeSniffer\Files\File $phpcsFile * @param int $stackPtr * * @return void */ protected function checkConstructorAndDestructor(File $phpcsFile, int $stackPtr): void { $docBlockEndIndex = $this->findRelatedDocBlock($phpcsFile, $stackPtr); if ($docBlockEndIndex) { return; } $methodSignature = $this->getMethodSignature($phpcsFile, $stackPtr); $arguments = count($methodSignature); if (!$arguments) { return; } $phpcsFile->addError('Missing doc block for method', $stackPtr, 'ConstructDesctructMissingDocBlock'); } /** * @param \PHP_CodeSniffer\Files\File $phpcsFile * @param int $docBlockStartIndex * @param int $docBlockEndIndex * * @return int|null */ protected function findDocBlockReturn(File $phpcsFile, int $docBlockStartIndex, int $docBlockEndIndex): ?int { $tokens = $phpcsFile->getTokens(); for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) { if (!$this->isGivenKind(T_DOC_COMMENT_TAG, $tokens[$i])) { continue; } if ($tokens[$i]['content'] !== '@return') { continue; } return $i; } return null; } /** * For right now we only try to detect void. * * @param \PHP_CodeSniffer\Files\File $phpcsFile * @param int $index * * @return string|null */ protected function detectReturnTypeVoid(File $phpcsFile, int $index): ?string { $tokens = $phpcsFile->getTokens(); $type = 'void'; if (empty($tokens[$index]['scope_opener'])) { return null; } $methodStartIndex = $tokens[$index]['scope_opener']; $methodEndIndex = $tokens[$index]['scope_closer']; for ($i = $methodStartIndex + 1; $i < $methodEndIndex; ++$i) { if ($this->isGivenKind([T_FUNCTION, T_CLOSURE], $tokens[$i])) { $endIndex = $tokens[$i]['scope_closer']; if (!empty($tokens[$i]['nested_parenthesis'])) { $endIndex = array_pop($tokens[$i]['nested_parenthesis']); } $i = $endIndex; continue; } if (!$this->isGivenKind([T_RETURN], $tokens[$i])) { continue; } $nextIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $i + 1, null, true); if (!$this->isGivenKind(T_SEMICOLON, $tokens[$nextIndex])) { return null; } } return $type; } }
php-fig-rectified/psr2r-sniffer
PSR2R/Sniffs/Commenting/DocBlockSniff.php
PHP
mit
5,275
(function() { 'use strict'; process.env.debug_sql = true; var Class = require('ee-class') , log = require('ee-log') , assert = require('assert') , fs = require('fs') , QueryContext = require('related-query-context') , ORM = require('related'); var TimeStamps = require('../') , sqlStatments , extension , orm , db; // sql for test db sqlStatments = fs.readFileSync(__dirname+'/db.postgres.sql').toString().split(';').map(function(input){ return input.trim().replace(/\n/gi, ' ').replace(/\s{2,}/g, ' ') }).filter(function(item){ return item.length; }); describe('Travis', function(){ it('should have set up the test db', function(done){ var config; try { config = require('../config.js').db } catch(e) { config = [{ type: 'postgres' , schema: 'related_timestamps_test' , database : 'test' , hosts: [{}] }]; } this.timeout(5000); orm = new ORM(config); done(); }); it('should be able to drop & create the testing schema ('+sqlStatments.length+' raw SQL queries)', function(done){ orm.getDatabase('related_timestamps_test').getConnection('write').then((connection) => { return new Promise((resolve, reject) => { let exec = (index) => { if (sqlStatments[index]) { connection.query(new QueryContext({sql:sqlStatments[index]})).then(() => { exec(index + 1); }).catch(reject); } else resolve(); } exec(0); }); }).then(() => { done(); }).catch(done); }); }); var expect = function(val, cb){ return function(err, result){ try { assert.equal(JSON.stringify(result), val); } catch (err) { return cb(err); } cb(); } }; describe('The TimeStamps Extension', function() { var oldDate; it('should not crash when instatiated', function() { db = orm.related_timestamps_test; extension = new TimeStamps(); }); it('should not crash when injected into the orm', function(done) { orm.use(extension); orm.load(done); }); it('should set correct timestamps when inserting a new record', function(done) { db = orm.related_timestamps_test; new db.event().save(function(err, evt) { if (err) done(err); else { assert.notEqual(evt.created, null); assert.notEqual(evt.updated, null); assert.equal(evt.deleted, null); oldDate = evt.updated; done(); } }); }); it('should set correct timestamps when updating a record', function(done) { // wait, we nede a new timestamp setTimeout(function() { db.event({id:1}, ['*']).findOne(function(err, evt) { if (err) done(err); else { evt.name = 'func with timestamps? no, that ain\'t fun!'; evt.save(function(err){ assert.notEqual(evt.created, null); assert.notEqual(evt.updated, null); assert.notEqual(evt.updated.toUTCString(), oldDate.toUTCString()); assert.equal(evt.deleted, null); done(); }); } }); }, 1500); }); it('should set correct timestamps when deleting a record', function(done) { db.event({id:1}, ['*']).findOne(function(err, evt) { if (err) done(err); else { evt.delete(function(err) { assert.notEqual(evt.created, null); assert.notEqual(evt.updated, null); assert.notEqual(evt.deleted, null); done(); }); } }); }); it('should not return soft deleted records when not requested', function(done) { db.event({id:1}, ['*']).findOne(function(err, evt) { if (err) done(err); else { assert.equal(evt, undefined); done(); } }); }); it('should return soft deleted records when requested', function(done) { db.event({id:1}, ['*']).includeSoftDeleted().findOne(function(err, evt) { if (err) done(err); else { assert.equal(evt.id, 1); done(); } }); }); it('should hard delete records when requested', function(done) { db.event({id:1}, ['*']).includeSoftDeleted().findOne(function(err, evt) { if (err) done(err); else { evt.hardDelete(function(err) { if (err) done(err); else { db.event({id:1}, ['*']).findOne(function(err, evt) { if (err) done(err); else { assert.equal(evt, undefined); done(); } }); } }); } }); }); it('should not load softdeleted references', function(done) { new db.event({ name: 'so what' , eventInstance: [new db.eventInstance({startdate: new Date(), deleted: new Date()})] }).save(function(err, evt) { if (err) done(err); else { db.event(['*'], {id:evt.id}).fetchEventInstance(['*']).findOne(function(err, event) { if (err) done(err); else { assert.equal(event.eventInstance.length, 0); done(); } }); } }); }) it ('should work when using bulk deletes', function(done) { new db.event({name: 'bulk delete 1'}).save().then(function() { return new db.event({name: 'bulk delete 2'}).save() }).then(function() { return new db.event({name: 'bulk delete 3'}).save() }).then(function() { return db.event('id').find(); }).then(function(records) { if (JSON.stringify(records) !== '[{"id":2},{"id":3},{"id":4},{"id":5}]') return Promise.reject(new Error('Expected «[{"id":2},{"id":3},{"id":4},{"id":5}]», got «'+JSON.stringify(records)+'»!')) else return db.event({ id: ORM.gt(3) }).delete(); }).then(function() { return db.event('id').find(); }).then(function(emptyList) { if (JSON.stringify(emptyList) !== '[{"id":2},{"id":3}]') return Promise.reject(new Error('Expected «[{"id":2},{"id":3}]», got «'+JSON.stringify(emptyList)+'»!')) else return db.event('id').includeSoftDeleted().find(); }).then(function(list) { if (JSON.stringify(list) !== '[{"id":2},{"id":3},{"id":4},{"id":5}]') return Promise.reject(new Error('Expected «[{"id":2},{"id":3},{"id":4},{"id":5}]», got «'+JSON.stringify(list)+'»!')) done(); }).catch(done); }) }); })();
eventEmitter/related-timestamps
test/extension.js
JavaScript
mit
8,381
#!/usr/bin/env ruby require 'tasklist' during '2010 September' do on '2010-09-03' do task 'Take out garbage' task 'Wash car' end on '2010-09-02' do task 'Create tasklist DSL', '09:15:56', '', 'admin', 'done' task 'Push tasklist to github', '09:34:00', '09:38:04', 'github' end end
kevincolyar/tasklist
example.rb
Ruby
mit
310
var passport = require('passport'); var WebIDStrategy = require('passport-webid').Strategy; var tokens = require('../../util/tokens'); var ids = require('../../util/id'); var console = require('../../log'); var createError = require('http-errors'); var dateUtils = require('../../util/date'); var url = require('url'); function loadStrategy(conf, entityStorageConf) { var auth_type = "webid"; var db = require('../../db')(conf, entityStorageConf); var enabled = conf.enabledStrategies.filter(function (v) { return (v === auth_type); }); if (enabled.length === 0) { console.log('ignoring ' + auth_type + ' strategy for user authentication. Not enabled in the configuration'); return false; } else { try { passport.use(auth_type, new WebIDStrategy( function (webid, certificate, req, done) { console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log("Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); var id = { user_name: webid, auth_type: auth_type }; var oauth2ReturnToParsed = url.parse(req.session.returnTo, true).query; console.log(" sesion in strategy " + auth_type + JSON.stringify(oauth2ReturnToParsed)); console.log(" client id from session in " + auth_type + JSON.stringify(oauth2ReturnToParsed.client_id)); console.log(" response_type for oauth2 in " + auth_type + JSON.stringify(oauth2ReturnToParsed.response_type)); var accessToken = tokens.uid(30); var d = Date.parse(certificate.valid_to); var default_exp = dateUtils.dateToEpochMilis(d); db.users.findByUsernameAndAuthType(webid, auth_type, function (err, user) { if (err) { return done(err); } if (!user) { return done(null, false); } db.accessTokens.saveOauth2Token(accessToken, user.id, oauth2ReturnToParsed.client_id, "bearer", [conf.gateway_id], default_exp, null, oauth2ReturnToParsed.response_type, function (err) { if (err) { return done(err); } return done(null, user); }); }); } )); console.log('finished registering passport ' + auth_type + ' strategy'); return true; } catch (e) { console.log('FAIL TO register a strategy'); console.log('ERROR: error loading ' + auth_type + ' passport strategy: ' + e); return false; } } } module.exports = loadStrategy;
Agile-IoT/agile-idm-web-ui
lib/auth/providers/webid.js
JavaScript
mit
3,465
module AwsHelpers module ElasticLoadBalancing class CreateTag def initialize(elastic_load_balancing_client, load_balancer_name, tag_key, tag_value) @elastic_load_balancing_client = elastic_load_balancing_client @load_balancer_name = load_balancer_name @tag_key = tag_key @tag_value = tag_value end def execute resp = @elastic_load_balancing_client.add_tags({load_balancer_names: [@load_balancer_name], tags: [{key: @tag_key, value: @tag_value}] }) end end end end
MYOB-Technology/aws_helpers
lib/aws_helpers/elastic_load_balancing/create_tag.rb
Ruby
mit
652
export declare class Console { private static quiet; private static debug; private static verbose; static Log(text: any): void; private static readonly Timestamp; static Debug(text: any): void; static Verbose(text: any): void; static Error(text: any): void; static Exit(reason: any): void; }
APEEYEDOTCOM/hapi-bells
node_modules/autorest/console.d.ts
TypeScript
mit
328
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Sylius\Bundle\CoreBundle\Command; use Sylius\Component\Core\Model\AdminUserInterface; use Sylius\Component\User\Repository\UserRepositoryInterface; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\ConstraintViolationListInterface; use Webmozart\Assert\Assert; final class SetupCommand extends AbstractInstallCommand { /** * {@inheritdoc} */ protected function configure(): void { $this ->setName('sylius:install:setup') ->setDescription('Sylius configuration setup.') ->setHelp(<<<EOT The <info>%command.name%</info> command allows user to configure basic Sylius data. EOT ) ; } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output): void { $currency = $this->get('sylius.setup.currency')->setup($input, $output, $this->getHelper('question')); $locale = $this->get('sylius.setup.locale')->setup($input, $output); $this->get('sylius.setup.channel')->setup($locale, $currency); $this->setupAdministratorUser($input, $output, $locale->getCode()); } /** * @param InputInterface $input * @param OutputInterface $output * @param string $localeCode */ protected function setupAdministratorUser(InputInterface $input, OutputInterface $output, string $localeCode): void { $outputStyle = new SymfonyStyle($input, $output); $outputStyle->writeln('Create your administrator account.'); $userManager = $this->get('sylius.manager.admin_user'); $userFactory = $this->get('sylius.factory.admin_user'); try { $user = $this->configureNewUser($userFactory->createNew(), $input, $output); } catch (\InvalidArgumentException $exception) { return; } $user->setEnabled(true); $user->setLocaleCode($localeCode); $userManager->persist($user); $userManager->flush(); $outputStyle->writeln('<info>Administrator account successfully registered.</info>'); $outputStyle->newLine(); } /** * @param AdminUserInterface $user * @param InputInterface $input * @param OutputInterface $output * * @return AdminUserInterface */ private function configureNewUser( AdminUserInterface $user, InputInterface $input, OutputInterface $output ): AdminUserInterface { /** @var UserRepositoryInterface $userRepository */ $userRepository = $this->getAdminUserRepository(); if ($input->getOption('no-interaction')) { Assert::null($userRepository->findOneByEmail('sylius@example.com')); $user->setEmail('sylius@example.com'); $user->setUsername('sylius'); $user->setPlainPassword('sylius'); return $user; } $email = $this->getAdministratorEmail($input, $output); $user->setEmail($email); $user->setUsername($this->getAdministratorUsername($input, $output, $email)); $user->setPlainPassword($this->getAdministratorPassword($input, $output)); return $user; } /** * @return Question */ private function createEmailQuestion(): Question { return (new Question('E-mail: ')) ->setValidator(function ($value) { /** @var ConstraintViolationListInterface $errors */ $errors = $this->get('validator')->validate((string) $value, [new Email(), new NotBlank()]); foreach ($errors as $error) { throw new \DomainException($error->getMessage()); } return $value; }) ->setMaxAttempts(3) ; } /** * @param InputInterface $input * @param OutputInterface $output * * @return string */ private function getAdministratorEmail(InputInterface $input, OutputInterface $output): string { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelper('question'); /** @var UserRepositoryInterface $userRepository */ $userRepository = $this->getAdminUserRepository(); do { $question = $this->createEmailQuestion(); $email = $questionHelper->ask($input, $output, $question); $exists = null !== $userRepository->findOneByEmail($email); if ($exists) { $output->writeln('<error>E-Mail is already in use!</error>'); } } while ($exists); return $email; } /** * @param InputInterface $input * @param OutputInterface $output * @param string $email * * @return string */ private function getAdministratorUsername(InputInterface $input, OutputInterface $output, string $email): string { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelper('question'); /** @var UserRepositoryInterface $userRepository */ $userRepository = $this->getAdminUserRepository(); do { $question = new Question('Username (press enter to use email): ', $email); $username = $questionHelper->ask($input, $output, $question); $exists = null !== $userRepository->findOneBy(['username' => $username]); if ($exists) { $output->writeln('<error>Username is already in use!</error>'); } } while ($exists); return $username; } /** * @param InputInterface $input * @param OutputInterface $output * * @return mixed */ private function getAdministratorPassword(InputInterface $input, OutputInterface $output) { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelper('question'); $validator = $this->getPasswordQuestionValidator(); do { $passwordQuestion = $this->createPasswordQuestion('Choose password:', $validator); $confirmPasswordQuestion = $this->createPasswordQuestion('Confirm password:', $validator); $password = $questionHelper->ask($input, $output, $passwordQuestion); $repeatedPassword = $questionHelper->ask($input, $output, $confirmPasswordQuestion); if ($repeatedPassword !== $password) { $output->writeln('<error>Passwords do not match!</error>'); } } while ($repeatedPassword !== $password); return $password; } /** * @return \Closure */ private function getPasswordQuestionValidator(): \Closure { return function ($value) { /** @var ConstraintViolationListInterface $errors */ $errors = $this->get('validator')->validate($value, [new NotBlank()]); foreach ($errors as $error) { throw new \DomainException($error->getMessage()); } return $value; }; } /** * @param string $message * @param \Closure $validator * * @return Question */ private function createPasswordQuestion(string $message, \Closure $validator): Question { return (new Question($message)) ->setValidator($validator) ->setMaxAttempts(3) ->setHidden(true) ->setHiddenFallback(false) ; } /** * @return UserRepositoryInterface */ private function getAdminUserRepository(): UserRepositoryInterface { return $this->get('sylius.repository.admin_user'); } }
vihuvac/Sylius
src/Sylius/Bundle/CoreBundle/Command/SetupCommand.php
PHP
mit
8,226
import { Nibble, UInt4 } from '../types' /** * Returns a Nibble (0-15) which equals the given bits. * * @example * byte.write([1,0,1,0]) => 10 * * @param {Array} nibble 4-bit unsigned integer * @return {Number} */ export default (nibble: Nibble): UInt4 => { if (!Array.isArray(nibble) || nibble.length !== 4) throw new RangeError('invalid array length') let result: UInt4 = 0 for (let i: number = 0; i < 4; i++) if (nibble[3 - i]) result |= 1 << i return <UInt4>result }
dodekeract/bitwise
source/nibble/write.ts
TypeScript
mit
489
import { Injectable } from '@angular/core'; import { DataService } from '../../../_service/dataconnect'; import { Router } from '@angular/router'; @Injectable() export class WarehouseViewService { constructor(private _dataserver: DataService, private _router: Router) { } getwarehouseTransfer(req: any) { return this._dataserver.post("getwarehouseTransfer", req); } }
masagatech/erpv1
src/app/_service/warehousestock/view/view-service.ts
TypeScript
mit
390
using System; using Newtonsoft.Json; namespace MultiSafepay.Model { public class Transaction { [JsonProperty("transaction_id")] public string TransactionId { get; set; } [JsonProperty("payment_type")] public string PaymentType { get; set; } [JsonProperty("order_id")] public string OrderId { get; set; } [JsonProperty("status")] public string TransactionStatus { get; set; } [JsonProperty("description")] public string Description { get; set; } [JsonProperty("created")] public DateTime? CreatedDate { get; set; } [JsonProperty("order_status")] public string OrderStatus { get; set; } [JsonProperty("amount")] public int Amount { get; set; } [JsonProperty("currency")] public string CurrencyCode { get; set; } [JsonProperty("customer")] public Customer Customer { get; set; } [JsonProperty("payment_details")] public PaymentDetails PaymentDetails { get; set; } } }
MultiSafepay/.Net
Src/MultiSafepay/Model/Transaction.cs
C#
mit
1,056
require 'spec_helper' describe MWS::Report do describe ".method_missing" do describe ".get_report_list" do let(:valid_args){ { key: "ThisIsSigningKey", endpoint: "mws.amazonservices.com", params: { "AWSAccessKeyId" => "AccessKeyIdString", "SellerId" => "SellerIdString", "ReportTypeList" => ["_GET_FLAT_FILE_ORDERS_DATA_"], "Acknowledged" => false, "MaxCount" => 100 } } } before do response = double("request") expect(response).to receive(:body).and_return("BodyString") request = double("request") expect(request).to receive(:execute).and_return(response) expect(MWS::Request).to receive(:new).and_return(request) end subject { described_class.get_report_list(valid_args) } it { is_expected.to be_a String } end end end
s-osa/marketplace_web_service
spec/mws/report_spec.rb
Ruby
mit
929
require 'resolv' module Geocoder class IpAddress < String def loopback? valid? and !!(self == "0.0.0.0" or self.match(/\A127\./) or self == "::1") end def valid? !!((self =~ Resolv::IPv4::Regex) || (self =~ Resolv::IPv6::Regex)) end end end
tiramizoo/geocoder
lib/geocoder/ip_address.rb
Ruby
mit
275
const chai = require('chai'); const expect = chai.expect; const ComplexArray = require('../complex-array/complex-array'); function assertArrayEquals(first, second) { const message = `${first} != ${second}`; first.forEach((item, i) => { expect(item).to.equal(second[i], message); }); } describe('Complex Array', () => { describe('Consructor', () => { it('should construct from a number', () => { const a = new ComplexArray(10); expect(a).to.exist; expect(a.real.length).to.equal(10); expect(a.imag.length).to.equal(10); expect(a.real[0]).to.equal(0); expect(a.imag[0]).to.equal(0); }); it('should construct from a number with a type', () => { const a = new ComplexArray(10, Int32Array); expect(a.ArrayType).to.equal(Int32Array); expect(a.real.length).to.equal(10); expect(a.imag.length).to.equal(10); expect(a.real[0]).to.equal(0); expect(a.imag[0]).to.equal(0); }); it('should contruct from a real array', () => { const a = new ComplexArray([1, 2]); assertArrayEquals([1, 2], a.real); assertArrayEquals([0, 0], a.imag); }); it('should contruct from a real array with a type', () => { const a = new ComplexArray([1, 2], Int32Array); expect(a.ArrayType).to.equal(Int32Array) assertArrayEquals([1, 2], a.real); assertArrayEquals([0, 0], a.imag); }); it('should contruct from another complex array', () => { const a = new ComplexArray(new ComplexArray([1, 2])); assertArrayEquals([1, 2], a.real); assertArrayEquals([0, 0], a.imag); }); }); describe('`map` method', () => { it('should alter all values', () => { const a = new ComplexArray([1, 2]).map((value, i) => { value.real *= 10; value.imag = i; }); assertArrayEquals([10, 20], a.real); assertArrayEquals([0, 1], a.imag); }); }); describe('`forEach` method', () => { it('should touch every value', () => { const a = new ComplexArray([1, 2]); a.imag[0] = 4; a.imag[1] = 8; let sum = 0; a.forEach((value, i) => { sum += value.real; sum += value.imag; }); expect(sum).to.equal(15); }); }); describe('`conjugate` method', () => { it('should multiply a number', () => { const a = new ComplexArray([1, 2]); a.imag[0] = 1; a.imag[1] = -2; const b = a.conjugate(); assertArrayEquals([1, 2], b.real); assertArrayEquals([-1, 2], b.imag); }); }); describe('`magnitude` method', () => { it('should give the an array of magnitudes', () => { const a = new ComplexArray([1, 3]); a.imag[0] = 0; a.imag[1] = 4; assertArrayEquals([1, 5], a.magnitude()); }); it('should return an iterable ArrayType object', () => { const a = new ComplexArray([1, 2]); let sum = 0; a.magnitude().forEach((value, i) => { sum += value; }); expect(sum).to.equal(3); }); }); });
JoeKarlsson/data-structures
test/complex-array.spec.js
JavaScript
mit
3,055
/* * Copyright (C) 2011 by Jakub Lekstan <kuebzky@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. */ #include <v8.h> #include <node.h> #include <sys/time.h> #include <sys/resource.h> int globalWho = RUSAGE_SELF; static v8::Handle<v8::Value> get_r_usage(const v8::Arguments& args){ v8::HandleScope scope; int localWho = globalWho; if(args.Length() != 0){ bool isError = false; if(args[0]->IsNumber()){ v8::Local<v8::Integer> iWho = v8::Local<v8::Integer>::Cast(args[0]); localWho = (int)(iWho->Int32Value()); if(localWho != RUSAGE_SELF && localWho != RUSAGE_CHILDREN){ isError = true; } }else{ isError = true; } if(isError){ return v8::ThrowException(v8::Exception::TypeError(v8::String::New("First argument must be either a RUSAGE_SELF or RUSAGE_CHILDREN"))); } } rusage rusagedata; int status = getrusage(localWho, &rusagedata); if(status != 0){ scope.Close(v8::Null()); } v8::Local<v8::Object> data = v8::Object::New(); data->Set(v8::String::New("ru_utime.tv_sec"), v8::Number::New(rusagedata.ru_utime.tv_sec)); data->Set(v8::String::New("ru_utime.tv_usec"), v8::Number::New(rusagedata.ru_utime.tv_usec)); data->Set(v8::String::New("ru_stime.tv_sec"), v8::Number::New(rusagedata.ru_stime.tv_sec)); data->Set(v8::String::New("ru_stime.tv_usec"), v8::Number::New(rusagedata.ru_stime.tv_usec)); data->Set(v8::String::New("ru_maxrss"), v8::Number::New(rusagedata.ru_maxrss)); data->Set(v8::String::New("ru_ixrss"), v8::Number::New(rusagedata.ru_ixrss)); data->Set(v8::String::New("ru_idrss"), v8::Number::New(rusagedata.ru_idrss)); data->Set(v8::String::New("ru_isrss"), v8::Number::New(rusagedata.ru_isrss)); data->Set(v8::String::New("ru_minflt"), v8::Number::New(rusagedata.ru_minflt)); data->Set(v8::String::New("ru_majflt"), v8::Number::New(rusagedata.ru_majflt)); data->Set(v8::String::New("ru_nswap"), v8::Number::New(rusagedata.ru_nswap)); data->Set(v8::String::New("ru_inblock"), v8::Number::New(rusagedata.ru_inblock)); data->Set(v8::String::New("ru_oublock"), v8::Number::New(rusagedata.ru_oublock)); data->Set(v8::String::New("ru_msgsnd"), v8::Number::New(rusagedata.ru_msgsnd)); data->Set(v8::String::New("ru_msgrcv"), v8::Number::New(rusagedata.ru_msgrcv)); data->Set(v8::String::New("ru_nsignals"), v8::Number::New(rusagedata.ru_nsignals)); data->Set(v8::String::New("ru_nvcsw"), v8::Number::New(rusagedata.ru_nvcsw)); data->Set(v8::String::New("ru_nivcsw"), v8::Number::New(rusagedata.ru_nivcsw)); return scope.Close(data); } static v8::Handle<v8::Value> usage_cycles(const v8::Arguments& args){ v8::HandleScope scope; rusage rusagedata; int status = getrusage(globalWho, &rusagedata); if(status != 0){ return scope.Close(v8::Null()); } return scope.Close(v8::Number::New(rusagedata.ru_utime.tv_sec * 1e6 + rusagedata.ru_utime.tv_usec)); } static v8::Handle<v8::Value> who(const v8::Arguments& args){ v8::HandleScope scope; if(args.Length() != 0 && args[0]->IsNumber()){ v8::Local<v8::Integer> iWho = v8::Local<v8::Integer>::Cast(args[0]); int localWho = (int)(iWho->Int32Value()); if(localWho != RUSAGE_SELF && localWho != RUSAGE_CHILDREN){ return v8::ThrowException(v8::Exception::TypeError(v8::String::New("First argument must be either a RUSAGE_SELF or RUSAGE_CHILDREN"))); } globalWho = localWho; return scope.Close(v8::True()); }else{ return scope.Close(v8::False()); } } extern "C" void init (v8::Handle<v8::Object> target){ v8::HandleScope scope; NODE_SET_METHOD(target, "get", get_r_usage); NODE_SET_METHOD(target, "cycles", usage_cycles); NODE_SET_METHOD(target, "who", who); target->Set(v8::String::New("RUSAGE_SELF"), v8::Number::New(RUSAGE_SELF)); target->Set(v8::String::New("RUSAGE_CHILDREN"), v8::Number::New(RUSAGE_CHILDREN)); }
kuebk/node-rusage
src/node-rusage.cc
C++
mit
4,830
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package config; import interfaces.*; import java.sql.*; import java.util.logging.*; import javax.swing.*; /** * * @author Luis G */ public class Connector { public Connector() { } protected boolean getData(String query, Callback callback) { ResultSet rs = null; Connection conn = null; Statement stmt = null; boolean isNull = false; try { connect(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/escuela", "root", ""); stmt = conn.createStatement(); rs = stmt.executeQuery(query); for (int i = 0; rs.next(); i++) { callback.callback(rs, i); } stmt.close(); conn.close(); } catch (SQLException ex) { Logger.getLogger(Connector.class.getName()).log(Level.SEVERE, null, ex); } return isNull; } protected ResultSet getData(String query) { ResultSet rs = null; Connection conn = null; Statement stmt = null; try { connect(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/escuela", "root", ""); stmt = conn.createStatement(); rs = stmt.executeQuery(query); } catch (Exception e) { System.out.println(e); } return rs; } protected int executeQuery(String query) { int id = -1; try { connect(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/escuela", "root", ""); Statement stmt = conn.createStatement(); id = stmt.executeUpdate(query, Statement.RETURN_GENERATED_KEYS); ResultSet rs = stmt.getGeneratedKeys(); if (rs.next()) { id = rs.getInt(1); } stmt.close(); conn.close(); } catch (SQLException e) { Logger.getLogger(Connector.class.getName()).log(Level.SEVERE, null, e); switch (e.getErrorCode()) { case 1062: JOptionPane.showMessageDialog(null, "Ese correo ya esta registrado", "error", 0); break; case 1054: JOptionPane.showMessageDialog(null, "El registro no existe", "error", 0); break; default: JOptionPane.showMessageDialog(null, "A ocurrido un error " + e, "error", 0); System.out.println(e); break; } } return id; } private void connect() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { } } }
Luis-Gdx/escuela
Topicos Avanzados de Programacion/Tabla/Tabla con base de datos y login/src/config/Connector.java
Java
mit
2,950
<?php /* * This file is part of NodalFlow. * (c) Fabrice de Stefanis / https://github.com/fab2s/NodalFlow * This source file is licensed under the MIT license which you will * find in the LICENSE file or at https://opensource.org/licenses/MIT */ namespace fab2s\NodalFlow\Nodes; use fab2s\NodalFlow\Flows\FlowInterface; use fab2s\NodalFlow\NodalFlowException; /** * Class BranchNode */ class BranchNode extends PayloadNodeAbstract implements BranchNodeInterface { /** * This Node is a Branch * * @var bool */ protected $isAFlow = true; /** * @var FlowInterface */ protected $payload; /** * Instantiate the BranchNode * * @param FlowInterface $payload * @param bool $isAReturningVal * * @throws NodalFlowException */ public function __construct(FlowInterface $payload, bool $isAReturningVal) { // branch Node does not (yet) support traversing parent::__construct($payload, $isAReturningVal, false); } /** * Execute the BranchNode * * @param mixed|null $param * * @return mixed */ public function exec($param = null) { // in the branch case, we actually exec a Flow return $this->payload->exec($param); } }
fab2s/NodalFlow
src/Nodes/BranchNode.php
PHP
mit
1,307
<?PHP /** * password view. * * includes form for username and email to send password to user. * */ ?> <div id="content_area"> <div class="row" id="login"> <!--login box--> <div class="col-xs-24" > <?php //begins the login form. echo form_open(base_url().'Account/password'); //display error messages if (isset($message_display)) { echo $message_display; } if (isset($error_message)) { echo "<div class='alert alert-danger text-center' role='alert'>"; echo $error_message; echo validation_errors(); echo "</div>"; //display error_msg } //login form itself echo '<h5 class="text-center">Provide your username and email address.</h5>'; ?> <label>Username :</label> <p> <input type="text" name="username" id="name" placeholder="username"/> </p> <label>Email :</label> <p> <input type="email" name="email" id="email" placeholder="email@email.com"/> </p> <!-- End of the form, begin submit button --> <div class='submit_button_container text-center'> <button type="submit" class="btn btn-primary btn-center" name="submit"/>Get Password</button> <!--Link to retrieve username --> <div style="padding-top:10px"> <?php echo anchor('Account/username','Forgot Username?') ?> </div> </div><!-- end submit button container --> <?php echo form_close(); ?> </div> <!-- end login div --> </div> </div><!-- end content_area div --> </div> <?PHP /*End of file login.php*/ /*Location: ./application/veiws/Account/password.php*/
rshanecole/TheFFFL
views/account/password.php
PHP
mit
2,088
using System; using System.Threading; using MonoTouch.Foundation; using MonoTouch.UIKit; namespace vplan { public class PrefManager { NSUserDefaults locstore = new NSUserDefaults(); bool notified = false; public PrefManager () { refresh (); } protected void refresh () { locstore.Synchronize (); } public int getInt (string key) { int val; val = locstore.IntForKey (key); return val; } public string getString (string key) { string val; val = locstore.StringForKey (key); return val; } public void setInt (string key, int val) { locstore.SetInt (val, key); refresh (); } public void setString (string key, string val) { locstore.SetString (val, key); refresh (); } } }
reknih/informant-ios
vplan/vplan.Kit/PrefManager.cs
C#
mit
743
/* DISKSPD Copyright(c) Microsoft Corporation All rights reserved. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "StdAfx.h" #include "XmlResultParser.UnitTests.h" #include "Common.h" #include "xmlresultparser.h" #include <stdlib.h> #include <vector> using namespace WEX::TestExecution; using namespace WEX::Logging; using namespace std; namespace UnitTests { void XmlResultParserUnitTests::Test_ParseResults() { Profile profile; TimeSpan timeSpan; Target target; XmlResultParser parser; Results results; results.fUseETW = false; double fTime = 120.0; results.ullTimeCount = PerfTimer::SecondsToPerfTime(fTime); // First group has 1 core SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION systemProcessorInfo = {}; systemProcessorInfo.UserTime.QuadPart = static_cast<LONGLONG>(fTime * 30 * 100000); systemProcessorInfo.IdleTime.QuadPart = static_cast<LONGLONG>(fTime * 45 * 100000); systemProcessorInfo.KernelTime.QuadPart = static_cast<LONGLONG>(fTime * 70 * 100000); results.vSystemProcessorPerfInfo.push_back(systemProcessorInfo); // Second group has a maximum of 4 cores with 2 active SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION zeroSystemProcessorInfo = { 0 }; zeroSystemProcessorInfo.UserTime.QuadPart = static_cast<LONGLONG>(fTime * 0 * 100000); zeroSystemProcessorInfo.IdleTime.QuadPart = static_cast<LONGLONG>(fTime * 100 * 100000); zeroSystemProcessorInfo.KernelTime.QuadPart = static_cast<LONGLONG>(fTime * 100 * 100000); results.vSystemProcessorPerfInfo.push_back(zeroSystemProcessorInfo); results.vSystemProcessorPerfInfo.push_back(zeroSystemProcessorInfo); results.vSystemProcessorPerfInfo.push_back(zeroSystemProcessorInfo); results.vSystemProcessorPerfInfo.push_back(zeroSystemProcessorInfo); // TODO: multiple target cases, full profile/result variations target.SetPath("testfile1.dat"); target.SetCacheMode(TargetCacheMode::DisableOSCache); target.SetWriteThroughMode(WriteThroughMode::On); target.SetThroughputIOPS(1000); timeSpan.AddTarget(target); timeSpan.SetCalculateIopsStdDev(true); TargetResults targetResults; targetResults.sPath = "testfile1.dat"; targetResults.ullFileSize = 10 * 1024 * 1024; targetResults.ullReadBytesCount = 4 * 1024 * 1024; targetResults.ullReadIOCount = 6; targetResults.ullWriteBytesCount = 2 * 1024 * 1024; targetResults.ullWriteIOCount = 10; targetResults.ullBytesCount = targetResults.ullReadBytesCount + targetResults.ullWriteBytesCount; targetResults.ullIOCount = targetResults.ullReadIOCount + targetResults.ullWriteIOCount; // TODO: Histogram<float> readLatencyHistogram; // TODO: Histogram<float> writeLatencyHistogram; // TODO: IoBucketizer writeBucketizer; targetResults.readBucketizer.Initialize(1000, timeSpan.GetDuration()); for (size_t i = 0; i < timeSpan.GetDuration(); i++) { // add an io halfway through the bucket's time interval targetResults.readBucketizer.Add(i*1000 + 500, 0); } ThreadResults threadResults; threadResults.vTargetResults.push_back(targetResults); results.vThreadResults.push_back(threadResults); vector<Results> vResults; vResults.push_back(results); // just throw away the computername and reset the timestamp - for the ut, it's // as useful (and simpler) to verify statics as anything else. Reconstruct // processor topo to a fixed example as well. SystemInformation system; system.ResetTime(); system.sComputerName.clear(); system.processorTopology._ulProcCount = 5; system.processorTopology._ulActiveProcCount = 3; system.processorTopology._vProcessorGroupInformation.clear(); system.processorTopology._vProcessorGroupInformation.emplace_back((BYTE)1, (BYTE)1, (WORD)0, (KAFFINITY)0x1); system.processorTopology._vProcessorGroupInformation.emplace_back((BYTE)4, (BYTE)2, (WORD)1, (KAFFINITY)0x6); system.processorTopology._vProcessorNumaInformation.clear(); system.processorTopology._vProcessorNumaInformation.emplace_back((DWORD)0, (WORD)0, (KAFFINITY)0x1); system.processorTopology._vProcessorNumaInformation.emplace_back((DWORD)1, (WORD)1, (KAFFINITY)0x6); ProcessorSocketInformation socket; socket._vProcessorMasks.emplace_back((WORD)0, (KAFFINITY)0x1); socket._vProcessorMasks.emplace_back((WORD)1, (KAFFINITY)0x6); system.processorTopology._vProcessorSocketInformation.clear(); system.processorTopology._vProcessorSocketInformation.push_back(socket); system.processorTopology._vProcessorHyperThreadInformation.clear(); system.processorTopology._vProcessorHyperThreadInformation.emplace_back((WORD)0, (KAFFINITY)0x1); system.processorTopology._vProcessorHyperThreadInformation.emplace_back((WORD)1, (KAFFINITY)0x6); // finally, add the timespan to the profile and dump. profile.AddTimeSpan(timeSpan); string sResults = parser.ParseResults(profile, system, vResults); // stringify random text, quoting "'s and adding newline/preserving tabs // gc some.txt |% { write-host $("`"{0}\n`"" -f $($_ -replace "`"","\`"" -replace "`t","\t")) } const char *pcszExpectedOutput = \ "<Results>\n" " <System>\n" " <ComputerName></ComputerName>\n" " <Tool>\n" " <Version>" DISKSPD_NUMERIC_VERSION_STRING "</Version>\n" " <VersionDate>" DISKSPD_DATE_VERSION_STRING "</VersionDate>\n" " </Tool>\n" " <RunTime></RunTime>\n" " <ProcessorTopology>\n" " <Group Group=\"0\" MaximumProcessors=\"1\" ActiveProcessors=\"1\" ActiveProcessorMask=\"0x1\"/>\n" " <Group Group=\"1\" MaximumProcessors=\"4\" ActiveProcessors=\"2\" ActiveProcessorMask=\"0x6\"/>\n" " <Node Node=\"0\" Group=\"0\" Processors=\"0x1\"/>\n" " <Node Node=\"1\" Group=\"1\" Processors=\"0x6\"/>\n" " <Socket>\n" " <Group Group=\"0\" Processors=\"0x1\"/>\n" " <Group Group=\"1\" Processors=\"0x6\"/>\n" " </Socket>\n" " <HyperThread Group=\"0\" Processors=\"0x1\"/>\n" " <HyperThread Group=\"1\" Processors=\"0x6\"/>\n" " </ProcessorTopology>\n" " </System>\n" " <Profile>\n" " <Progress>0</Progress>\n" " <ResultFormat>text</ResultFormat>\n" " <Verbose>false</Verbose>\n" " <TimeSpans>\n" " <TimeSpan>\n" " <CompletionRoutines>false</CompletionRoutines>\n" " <MeasureLatency>false</MeasureLatency>\n" " <CalculateIopsStdDev>true</CalculateIopsStdDev>\n" " <DisableAffinity>false</DisableAffinity>\n" " <Duration>10</Duration>\n" " <Warmup>5</Warmup>\n" " <Cooldown>0</Cooldown>\n" " <ThreadCount>0</ThreadCount>\n" " <RequestCount>0</RequestCount>\n" " <IoBucketDuration>1000</IoBucketDuration>\n" " <RandSeed>0</RandSeed>\n" " <Targets>\n" " <Target>\n" " <Path>testfile1.dat</Path>\n" " <BlockSize>65536</BlockSize>\n" " <BaseFileOffset>0</BaseFileOffset>\n" " <SequentialScan>false</SequentialScan>\n" " <RandomAccess>false</RandomAccess>\n" " <TemporaryFile>false</TemporaryFile>\n" " <UseLargePages>false</UseLargePages>\n" " <DisableOSCache>true</DisableOSCache>\n" " <WriteThrough>true</WriteThrough>\n" " <WriteBufferContent>\n" " <Pattern>sequential</Pattern>\n" " </WriteBufferContent>\n" " <ParallelAsyncIO>false</ParallelAsyncIO>\n" " <StrideSize>65536</StrideSize>\n" " <InterlockedSequential>false</InterlockedSequential>\n" " <ThreadStride>0</ThreadStride>\n" " <MaxFileSize>0</MaxFileSize>\n" " <RequestCount>2</RequestCount>\n" " <WriteRatio>0</WriteRatio>\n" " <Throughput unit=\"IOPS\">1000</Throughput>\n" " <ThreadsPerFile>1</ThreadsPerFile>\n" " <IOPriority>3</IOPriority>\n" " <Weight>1</Weight>\n" " </Target>\n" " </Targets>\n" " </TimeSpan>\n" " </TimeSpans>\n" " </Profile>\n" " <TimeSpan>\n" " <TestTimeSeconds>120.00</TestTimeSeconds>\n" " <ThreadCount>1</ThreadCount>\n" " <RequestCount>0</RequestCount>\n" " <ProcCount>3</ProcCount>\n" " <CpuUtilization>\n" " <CPU>\n" " <Group>0</Group>\n" " <Id>0</Id>\n" " <UsagePercent>55.00</UsagePercent>\n" " <UserPercent>30.00</UserPercent>\n" " <KernelPercent>25.00</KernelPercent>\n" " <IdlePercent>45.00</IdlePercent>\n" " </CPU>\n" " <CPU>\n" " <Group>1</Group>\n" " <Id>1</Id>\n" " <UsagePercent>0.00</UsagePercent>\n" " <UserPercent>0.00</UserPercent>\n" " <KernelPercent>0.00</KernelPercent>\n" " <IdlePercent>100.00</IdlePercent>\n" " </CPU>\n" " <CPU>\n" " <Group>1</Group>\n" " <Id>2</Id>\n" " <UsagePercent>0.00</UsagePercent>\n" " <UserPercent>0.00</UserPercent>\n" " <KernelPercent>0.00</KernelPercent>\n" " <IdlePercent>100.00</IdlePercent>\n" " </CPU>\n" " <Average>\n" " <UsagePercent>18.33</UsagePercent>\n" " <UserPercent>10.00</UserPercent>\n" " <KernelPercent>8.33</KernelPercent>\n" " <IdlePercent>81.67</IdlePercent>\n" " </Average>\n" " </CpuUtilization>\n" " <Iops>\n" " <ReadIopsStdDev>0.000</ReadIopsStdDev>\n" " <IopsStdDev>0.000</IopsStdDev>\n" " <Bucket SampleMillisecond=\"1000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"2000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"3000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"4000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"5000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"6000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"7000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"8000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"9000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"10000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " </Iops>\n" " <Thread>\n" " <Id>0</Id>\n" " <Target>\n" " <Path>testfile1.dat</Path>\n" " <BytesCount>6291456</BytesCount>\n" " <FileSize>10485760</FileSize>\n" " <IOCount>16</IOCount>\n" " <ReadBytes>4194304</ReadBytes>\n" " <ReadCount>6</ReadCount>\n" " <WriteBytes>2097152</WriteBytes>\n" " <WriteCount>10</WriteCount>\n" " <Iops>\n" " <ReadIopsStdDev>0.000</ReadIopsStdDev>\n" " <IopsStdDev>0.000</IopsStdDev>\n" " <Bucket SampleMillisecond=\"1000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"2000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"3000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"4000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"5000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"6000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"7000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"8000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"9000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " <Bucket SampleMillisecond=\"10000\" Read=\"1\" Write=\"0\" Total=\"1\" ReadMinLatencyMilliseconds=\"0.000\" ReadMaxLatencyMilliseconds=\"0.000\" ReadAvgLatencyMilliseconds=\"0.000\" ReadLatencyStdDev=\"0.000\" WriteMinLatencyMilliseconds=\"0.000\" WriteMaxLatencyMilliseconds=\"0.000\" WriteAvgLatencyMilliseconds=\"0.000\" WriteLatencyStdDev=\"0.000\"/>\n" " </Iops>\n" " </Target>\n" " </Thread>\n" " </TimeSpan>\n" "</Results>"; #if 0 HANDLE h; DWORD written; h = CreateFileW(L"g:\\xmlresult-received.txt", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); WriteFile(h, sResults.c_str(), (DWORD)sResults.length(), &written, NULL); VERIFY_ARE_EQUAL(sResults.length(), written); CloseHandle(h); h = CreateFileW(L"g:\\xmlresult-expected.txt", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); WriteFile(h, pcszExpectedOutput, (DWORD)strlen(pcszExpectedOutput), &written, NULL); VERIFY_ARE_EQUAL((DWORD)strlen(pcszExpectedOutput), written); CloseHandle(h); printf("--\n%s\n", sResults.c_str()); printf("-------------------------------------------------\n"); printf("--\n%s\n", pcszExpectedOutput); #endif VERIFY_ARE_EQUAL(0, strcmp(sResults.c_str(), pcszExpectedOutput)); } void XmlResultParserUnitTests::Test_ParseProfile() { Profile profile; XmlResultParser parser; TimeSpan timeSpan; Target target; timeSpan.AddTarget(target); profile.AddTimeSpan(timeSpan); string s = parser.ParseProfile(profile); const char *pcszExpectedOutput = "<Profile>\n" " <Progress>0</Progress>\n" " <ResultFormat>text</ResultFormat>\n" " <Verbose>false</Verbose>\n" " <TimeSpans>\n" " <TimeSpan>\n" " <CompletionRoutines>false</CompletionRoutines>\n" " <MeasureLatency>false</MeasureLatency>\n" " <CalculateIopsStdDev>false</CalculateIopsStdDev>\n" " <DisableAffinity>false</DisableAffinity>\n" " <Duration>10</Duration>\n" " <Warmup>5</Warmup>\n" " <Cooldown>0</Cooldown>\n" " <ThreadCount>0</ThreadCount>\n" " <RequestCount>0</RequestCount>\n" " <IoBucketDuration>1000</IoBucketDuration>\n" " <RandSeed>0</RandSeed>\n" " <Targets>\n" " <Target>\n" " <Path></Path>\n" " <BlockSize>65536</BlockSize>\n" " <BaseFileOffset>0</BaseFileOffset>\n" " <SequentialScan>false</SequentialScan>\n" " <RandomAccess>false</RandomAccess>\n" " <TemporaryFile>false</TemporaryFile>\n" " <UseLargePages>false</UseLargePages>\n" " <WriteBufferContent>\n" " <Pattern>sequential</Pattern>\n" " </WriteBufferContent>\n" " <ParallelAsyncIO>false</ParallelAsyncIO>\n" " <StrideSize>65536</StrideSize>\n" " <InterlockedSequential>false</InterlockedSequential>\n" " <ThreadStride>0</ThreadStride>\n" " <MaxFileSize>0</MaxFileSize>\n" " <RequestCount>2</RequestCount>\n" " <WriteRatio>0</WriteRatio>\n" " <Throughput>0</Throughput>\n" " <ThreadsPerFile>1</ThreadsPerFile>\n" " <IOPriority>3</IOPriority>\n" " <Weight>1</Weight>\n" " </Target>\n" " </Targets>\n" " </TimeSpan>\n" " </TimeSpans>\n" "</Profile>\n"; //VERIFY_ARE_EQUAL(pcszExpectedOutput, s.c_str()); VERIFY_ARE_EQUAL(strlen(pcszExpectedOutput), s.length()); VERIFY_IS_TRUE(!strcmp(pcszExpectedOutput, s.c_str())); } void XmlResultParserUnitTests::Test_ParseTargetProfile() { Target target; string sResults; char pszExpectedOutput[4096]; int nWritten; const char *pcszOutputTemplate = \ "<Target>\n" " <Path>testfile1.dat</Path>\n" " <BlockSize>65536</BlockSize>\n" " <BaseFileOffset>0</BaseFileOffset>\n" " <SequentialScan>false</SequentialScan>\n" " <RandomAccess>false</RandomAccess>\n" " <TemporaryFile>false</TemporaryFile>\n" " <UseLargePages>false</UseLargePages>\n" " <DisableOSCache>true</DisableOSCache>\n" " <WriteThrough>true</WriteThrough>\n" " <WriteBufferContent>\n" " <Pattern>sequential</Pattern>\n" " </WriteBufferContent>\n" " <ParallelAsyncIO>false</ParallelAsyncIO>\n" " <StrideSize>65536</StrideSize>\n" " <InterlockedSequential>false</InterlockedSequential>\n" " <ThreadStride>0</ThreadStride>\n" " <MaxFileSize>0</MaxFileSize>\n" " <RequestCount>2</RequestCount>\n" " <WriteRatio>0</WriteRatio>\n" " <Throughput%s>%s</Throughput>\n" // 2 param " <ThreadsPerFile>1</ThreadsPerFile>\n" " <IOPriority>3</IOPriority>\n" " <Weight>1</Weight>\n" "</Target>\n"; target.SetPath("testfile1.dat"); target.SetCacheMode(TargetCacheMode::DisableOSCache); target.SetWriteThroughMode(WriteThroughMode::On); // Base case - no limit nWritten = sprintf_s(pszExpectedOutput, sizeof(pszExpectedOutput), pcszOutputTemplate, "", "0"); VERIFY_IS_GREATER_THAN(nWritten, 0); sResults = target.GetXml(0); VERIFY_ARE_EQUAL(sResults, pszExpectedOutput); // IOPS - with units target.SetThroughputIOPS(1000); nWritten = sprintf_s(pszExpectedOutput, sizeof(pszExpectedOutput), pcszOutputTemplate, " unit=\"IOPS\"", "1000"); VERIFY_IS_GREATER_THAN(nWritten, 0); sResults = target.GetXml(0); VERIFY_ARE_EQUAL(sResults, pszExpectedOutput); // BPMS - not specified with units in output target.SetThroughput(1000); nWritten = sprintf_s(pszExpectedOutput, sizeof(pszExpectedOutput), pcszOutputTemplate, "", "1000"); VERIFY_IS_GREATER_THAN(nWritten, 0); sResults = target.GetXml(0); VERIFY_ARE_EQUAL(sResults, pszExpectedOutput); } }
microsoft/diskspd
UnitTests/XmlResultParser/XmlResultParser.UnitTests.cpp
C++
mit
26,838
/** @jsx h */ import h from '../../helpers/h' export const schema = { blocks: { paragraph: { marks: [{ type: 'bold' }, { type: 'underline' }], }, }, } export const input = ( <value> <document> <paragraph> one <i>two</i> three </paragraph> </document> </value> ) export const output = ( <value> <document> <paragraph>one two three</paragraph> </document> </value> )
ashutoshrishi/slate
packages/slate/test/schema/custom/node-mark-invalid-default.js
JavaScript
mit
437
/* ======================================================================== * DOM-based Routing * Based on http://goo.gl/EUTi53 by Paul Irish * * Only fires on body classes that match. If a body class contains a dash, * replace the dash with an underscore when adding it to the object below. * * .noConflict() * The routing is enclosed within an anonymous function so that you can * always reference jQuery with $, even when in .noConflict() mode. * * Google CDN, Latest jQuery * To use the default WordPress version of jQuery, go to lib/config.php and * remove or comment out: add_theme_support('jquery-cdn'); * ======================================================================== */ (function($) { // Use this variable to set up the common and page specific functions. If you // rename this variable, you will also need to rename the namespace below. var Sage = { // All pages 'common': { init: function() { // JavaScript to be fired on all pages }, finalize: function() { // JavaScript to be fired on all pages, after page specific JS is fired } }, // Home page 'home': { init: function() { // JavaScript to be fired on the home page }, finalize: function() { // JavaScript to be fired on the home page, after the init JS } }, // About us page, note the change from about-us to about_us. 'about_us': { init: function() { // JavaScript to be fired on the about us page } } }; // The routing fires all common scripts, followed by the page specific scripts. // Add additional events for more control over timing e.g. a finalize event var UTIL = { fire: function(func, funcname, args) { var fire; var namespace = Sage; funcname = (funcname === undefined) ? 'init' : funcname; fire = func !== ''; fire = fire && namespace[func]; fire = fire && typeof namespace[func][funcname] === 'function'; if (fire) { namespace[func][funcname](args); } }, loadEvents: function() { // Fire common init JS UTIL.fire('common'); // Fire page-specific init JS, and then finalize JS $.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) { UTIL.fire(classnm); UTIL.fire(classnm, 'finalize'); }); // Fire common finalize JS UTIL.fire('common', 'finalize'); } }; // Load Events $(document).ready(UTIL.loadEvents); })(jQuery); // Fully reference jQuery after this point. $(document).ready(function(){ $("#sidebar-home ul li").addClass( "col-md-3 col-sm-6" ); $("#sidebar-home div").addClass( "clearfix" ); });
erikkowalski/hoe-sage-8.1.0
assets/scripts/main.js
JavaScript
mit
2,737
import {bootstrap} from '@angular/platform-browser-dynamic'; import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; import {HTTP_PROVIDERS} from '@angular/http'; import {AppComponent} from './app.component'; import {LoggerService} from './blocks/logger.service'; bootstrap(AppComponent, [ LoggerService, ROUTER_PROVIDERS, HTTP_PROVIDERS ]);
IMAMBAKS/data_viz_pa
app/main.ts
TypeScript
mit
352
package org.apache.shiro.grails.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.apache.shiro.authz.Permission; @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface PermissionRequired { Class<? extends Permission> type(); /** * The name of the role required to be granted this authorization. */ String target() default "*"; String actions() default ""; }
putin266/Vote
target/work/plugins/shiro-1.2.1/src/java/org/apache/shiro/grails/annotations/PermissionRequired.java
Java
mit
572
using Academy.Core.Contracts; using Academy.Commands.Adding; using Moq; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Academy.Tests.Commands.Mocks; namespace Academy.Tests.Commands.AddingTests.AddStudentToSeasonCommandTests { [TestFixture] public class Constructor_Should { [Test] public void ThrowArgumentNullException_WhenPassedFactoryIsNull() { // Arrange var engineMock = new Mock<IEngine>(); // Act & Assert Assert.Throws<ArgumentNullException>(() => new AddStudentToSeasonCommand(null, engineMock.Object)); } [Test] public void ThrowArgumentNullException_WhenPassedEngineIsNull() { // Arrange var factoryMock = new Mock<IAcademyFactory>(); // Act & Assert Assert.Throws<ArgumentNullException>(() => new AddStudentToSeasonCommand(factoryMock.Object, null)); } [Test] public void AssignCorrectValueToFactory_WhenPassedDependenciesAreNotNull() { // Arrange var factoryMock = new Mock<IAcademyFactory>(); var engineMock = new Mock<IEngine>(); // Act var command = new AddStudentToSeasonCommandMock(factoryMock.Object, engineMock.Object); // Assert Assert.AreSame(factoryMock.Object, command.AcademyFactory); } [Test] public void AssignCorrectValueToEngine_WhenPassedDependenciesAreNotNull() { // Arrange var factoryMock = new Mock<IAcademyFactory>(); var engineMock = new Mock<IEngine>(); // Act var command = new AddStudentToSeasonCommandMock(factoryMock.Object, engineMock.Object); // Assert Assert.AreSame(engineMock.Object, command.Engine); } } }
TelerikAcademy/Unit-Testing
Topics/04. Workshops/Workshop (Students)/Academy/Workshop/Academy.Tests/Commands/Adding/AddStudentToSeasonCommandTests/Constructor_Should.cs
C#
mit
2,040
module.exports = { before: [function () { console.log('global beforeAll1'); }, 'alias1'], 'alias1': 'alias2', 'alias2': function () { console.log('global beforeAll2'); }, 'One': function () { this.sum = 1; }, 'plus one': function () { this.sum += 1; }, 'equals two': function () { if (this.sum !== 2) { throw new Error(this.sum + ' !== 2'); } } };
twolfson/doubleshot
test/test_files/complex_global_hooks/content.js
JavaScript
mit
399
exports.__esModule = true; exports.parseServerOptionsForRunCommand = parseServerOptionsForRunCommand; exports.parseRunTargets = parseRunTargets; var _cordova = require('../cordova'); var cordova = babelHelpers.interopRequireWildcard(_cordova); var _cordovaProjectJs = require('../cordova/project.js'); var _cordovaRunnerJs = require('../cordova/runner.js'); var _cordovaRunTargetsJs = require('../cordova/run-targets.js'); // The architecture used by MDG's hosted servers; it's the architecture used by // 'meteor deploy'. var main = require('./main.js'); var _ = require('underscore'); var files = require('../fs/files.js'); var deploy = require('../meteor-services/deploy.js'); var buildmessage = require('../utils/buildmessage.js'); var auth = require('../meteor-services/auth.js'); var authClient = require('../meteor-services/auth-client.js'); var config = require('../meteor-services/config.js'); var Future = require('fibers/future'); var runLog = require('../runners/run-log.js'); var utils = require('../utils/utils.js'); var httpHelpers = require('../utils/http-helpers.js'); var archinfo = require('../utils/archinfo.js'); var catalog = require('../packaging/catalog/catalog.js'); var stats = require('../meteor-services/stats.js'); var Console = require('../console/console.js').Console; var projectContextModule = require('../project-context.js'); var release = require('../packaging/release.js'); var DEPLOY_ARCH = 'os.linux.x86_64'; // The default port that the development server listens on. var DEFAULT_PORT = '3000'; // Valid architectures that Meteor officially supports. var VALID_ARCHITECTURES = { "os.osx.x86_64": true, "os.linux.x86_64": true, "os.linux.x86_32": true, "os.windows.x86_32": true }; // __dirname - the location of the current executing file var __dirnameConverted = files.convertToStandardPath(__dirname); // Given a site name passed on the command line (eg, 'mysite'), return // a fully-qualified hostname ('mysite.meteor.com'). // // This is fairly simple for now. It appends 'meteor.com' if the name // doesn't contain a dot, and it deletes any trailing dots (the // technically legal hostname 'mysite.com.' is canonicalized to // 'mysite.com'). // // In the future, you should be able to make this default to some // other domain you control, rather than 'meteor.com'. var qualifySitename = function (site) { if (site.indexOf(".") === -1) site = site + ".meteor.com"; while (site.length && site[site.length - 1] === ".") site = site.substring(0, site.length - 1); return site; }; // Display a message showing valid Meteor architectures. var showInvalidArchMsg = function (arch) { Console.info("Invalid architecture: " + arch); Console.info("The following are valid Meteor architectures:"); _.each(_.keys(VALID_ARCHITECTURES), function (va) { Console.info(Console.command(va), Console.options({ indent: 2 })); }); }; // Utility functions to parse options in run/build/test-packages commands function parseServerOptionsForRunCommand(options, runTargets) { var parsedServerUrl = parsePortOption(options.port); // XXX COMPAT WITH 0.9.2.2 -- the 'mobile-port' option is deprecated var mobileServerOption = options['mobile-server'] || options['mobile-port']; var parsedMobileServerUrl = undefined; if (mobileServerOption) { parsedMobileServerUrl = parseMobileServerOption(mobileServerOption); } else { var isRunOnDeviceRequested = _.any(runTargets, function (runTarget) { return runTarget.isDevice; }); parsedMobileServerUrl = detectMobileServerUrl(parsedServerUrl, isRunOnDeviceRequested); } return { parsedServerUrl: parsedServerUrl, parsedMobileServerUrl: parsedMobileServerUrl }; } function parsePortOption(portOption) { var parsedServerUrl = utils.parseUrl(portOption); if (!parsedServerUrl.port) { Console.error("--port must include a port."); throw new main.ExitWithCode(1); } return parsedServerUrl; } function parseMobileServerOption(mobileServerOption) { var optionName = arguments.length <= 1 || arguments[1] === undefined ? 'mobile-server' : arguments[1]; var parsedMobileServerUrl = utils.parseUrl(mobileServerOption, { protocol: 'http://' }); if (!parsedMobileServerUrl.host) { Console.error('--' + optionName + ' must include a hostname.'); throw new main.ExitWithCode(1); } return parsedMobileServerUrl; } function detectMobileServerUrl(parsedServerUrl, isRunOnDeviceRequested) { // If we are running on a device, use the auto-detected IP if (isRunOnDeviceRequested) { var myIp = undefined; try { myIp = utils.ipAddress(); } catch (error) { Console.error('Error detecting IP address for mobile app to connect to:\n' + error.message + '\nPlease specify the address that the mobile app should connect\nto with --mobile-server.'); throw new main.ExitWithCode(1); } return { protocol: 'http://', host: myIp, port: parsedServerUrl.port }; } else { // We are running a simulator, use localhost return { protocol: 'http://', host: 'localhost', port: parsedServerUrl.port }; } } function parseRunTargets(targets) { return targets.map(function (target) { var targetParts = target.split('-'); var platform = targetParts[0]; var isDevice = targetParts[1] === 'device'; if (platform == 'ios') { return new _cordovaRunTargetsJs.iOSRunTarget(isDevice); } else if (platform == 'android') { return new _cordovaRunTargetsJs.AndroidRunTarget(isDevice); } else { Console.error('Unknown run target: ' + target); throw new main.ExitWithCode(1); } }); } ; /////////////////////////////////////////////////////////////////////////////// // options that act like commands /////////////////////////////////////////////////////////////////////////////// // Prints the Meteor architecture name of this host main.registerCommand({ name: '--arch', requiresRelease: false, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { Console.rawInfo(archinfo.host() + "\n"); }); //Prints the Meteor log about the versions main.registerCommand({ name:'--about', requiresRelease: false, catalogRefresh: new catalog.Refresh.Never() }, function (options){ if (release.current === null) { if (!options.appDir) throw new Error("missing release, but not in an app?"); Console.error("This project was created with a checkout of Meteor, rather than an " + "official release, and doesn't have a release number associated with " + "it. You can set its release with " + Console.command("'meteor update'") + "."); return 1; } if (release.current.isCheckout()) { var gitLog = utils.runGitInCheckout('log', '--format=%h%d', '-n 1').trim(); Console.error("Unreleased, running from a checkout at " + gitLog); return 1; } var dirname = files.convertToStandardPath(__dirname); var about = files.readFile(files.pathJoin(dirname, 'about.txt'), 'utf8'); console.log(about); }); // Prints the current release in use. Note that if there is not // actually a specific release, we print to stderr and exit non-zero, // while if there is a release we print to stdout and exit zero // (making this useful to scripts). // XXX: What does this mean in our new release-free world? main.registerCommand({ name: '--version', requiresRelease: false, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (release.current === null) { if (!options.appDir) throw new Error("missing release, but not in an app?"); Console.error("This project was created with a checkout of Meteor, rather than an " + "official release, and doesn't have a release number associated with " + "it. You can set its release with " + Console.command("'meteor update'") + "."); return 1; } if (release.current.isCheckout()) { var gitLog = utils.runGitInCheckout('log', '--format=%h%d', '-n 1').trim(); Console.error("Unreleased, running from a checkout at " + gitLog); return 1; } Console.info(release.current.getDisplayName()); }); // Internal use only. For automated testing. main.registerCommand({ name: '--long-version', requiresRelease: false, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (files.inCheckout()) { Console.error("checkout"); return 1; } else if (release.current === null) { // .meteor/release says "none" but not in a checkout. Console.error("none"); return 1; } else { Console.rawInfo(release.current.name + "\n"); Console.rawInfo(files.getToolsVersion() + "\n"); return 0; } }); // Internal use only. For automated testing. main.registerCommand({ name: '--requires-release', requiresRelease: true, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { return 0; }); /////////////////////////////////////////////////////////////////////////////// // run /////////////////////////////////////////////////////////////////////////////// var runCommandOptions = { requiresApp: true, maxArgs: Infinity, options: { port: { type: String, short: "p", 'default': DEFAULT_PORT }, 'mobile-server': { type: String }, // XXX COMPAT WITH 0.9.2.2 'mobile-port': { type: String }, 'app-port': { type: String }, 'debug-port': { type: String }, production: { type: Boolean }, 'raw-logs': { type: Boolean }, settings: { type: String }, test: { type: Boolean, 'default': false }, verbose: { type: Boolean, short: "v" }, // With --once, meteor does not re-run the project if it crashes // and does not monitor for file changes. Intentionally // undocumented: intended for automated testing (eg, cli-test.sh), // not end-user use. #Once once: { type: Boolean }, // Don't run linter on rebuilds 'no-lint': { type: Boolean }, // Allow the version solver to make breaking changes to the versions // of top-level dependencies. 'allow-incompatible-update': { type: Boolean } }, catalogRefresh: new catalog.Refresh.Never() }; main.registerCommand(_.extend({ name: 'run' }, runCommandOptions), doRunCommand); function doRunCommand(options) { Console.setVerbose(!!options.verbose); // Additional args are interpreted as run targets var runTargets = parseRunTargets(options.args); var _parseServerOptionsForRunCommand = parseServerOptionsForRunCommand(options, runTargets); var parsedServerUrl = _parseServerOptionsForRunCommand.parsedServerUrl; var parsedMobileServerUrl = _parseServerOptionsForRunCommand.parsedMobileServerUrl; var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir, allowIncompatibleUpdate: options['allow-incompatible-update'], lintAppAndLocalPackages: !options['no-lint'] }); main.captureAndExit("=> Errors while initializing project:", function () { // We're just reading metadata here --- we'll wait to do the full build // preparation until after we've started listening on the proxy, etc. projectContext.readProjectMetadata(); }); if (release.explicit) { if (release.current.name !== projectContext.releaseFile.fullReleaseName) { console.log("=> Using %s as requested (overriding %s)", release.current.getDisplayName(), projectContext.releaseFile.displayReleaseName); console.log(); } } var appHost = undefined, appPort = undefined; if (options['app-port']) { var appPortMatch = options['app-port'].match(/^(?:(.+):)?([0-9]+)?$/); if (!appPortMatch) { Console.error("run: --app-port must be a number or be of the form 'host:port' ", "where port is a number. Try", Console.command("'meteor help run'") + " for help."); return 1; } appHost = appPortMatch[1] || null; // It's legit to specify `--app-port host:` and still let the port be // randomized. appPort = appPortMatch[2] ? parseInt(appPortMatch[2]) : null; } if (options['raw-logs']) runLog.setRawLogs(true); // Velocity testing. Sets up a DDP connection to the app process and // runs phantomjs. // // NOTE: this calls process.exit() when testing is done. if (options['test']) { options.once = true; var serverUrlForVelocity = 'http://' + (parsedServerUrl.host || "localhost") + ':' + parsedServerUrl.port; var velocity = require('../runners/run-velocity.js'); velocity.runVelocity(serverUrlForVelocity); } var cordovaRunner = undefined; if (!_.isEmpty(runTargets)) { main.captureAndExit('', 'preparing Cordova project', function () { var cordovaProject = new _cordovaProjectJs.CordovaProject(projectContext, { settingsFile: options.settings, mobileServerUrl: utils.formatUrl(parsedMobileServerUrl) }); cordovaRunner = new _cordovaRunnerJs.CordovaRunner(cordovaProject, runTargets); cordovaRunner.checkPlatformsForRunTargets(); }); } var runAll = require('../runners/run-all.js'); return runAll.run({ projectContext: projectContext, proxyPort: parsedServerUrl.port, proxyHost: parsedServerUrl.host, appPort: appPort, appHost: appHost, debugPort: options['debug-port'], settingsFile: options.settings, buildOptions: { minifyMode: options.production ? 'production' : 'development', buildMode: options.production ? 'production' : 'development' }, rootUrl: process.env.ROOT_URL, mongoUrl: process.env.MONGO_URL, oplogUrl: process.env.MONGO_OPLOG_URL, mobileServerUrl: utils.formatUrl(parsedMobileServerUrl), once: options.once, cordovaRunner: cordovaRunner }); } /////////////////////////////////////////////////////////////////////////////// // debug /////////////////////////////////////////////////////////////////////////////// main.registerCommand(_.extend({ name: 'debug' }, runCommandOptions), function (options) { options['debug-port'] = options['debug-port'] || '5858'; return doRunCommand(options); }); /////////////////////////////////////////////////////////////////////////////// // shell /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'shell', requiresRelease: false, requiresApp: true, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (!options.appDir) { Console.error("The " + Console.command("'meteor shell'") + " command must be run", "in a Meteor app directory."); } else { var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir }); // Convert to OS path here because shell/server.js doesn't know how to // convert paths, since it exists in the app and in the tool. require('../shell-client.js').connect(files.convertToOSPath(projectContext.getMeteorShellDirectory())); throw new main.WaitForExit(); } }); /////////////////////////////////////////////////////////////////////////////// // create /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'create', maxArgs: 1, options: { list: { type: Boolean }, example: { type: String }, 'package': { type: Boolean } }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { // Creating a package is much easier than creating an app, so if that's what // we are doing, do that first. (For example, we don't springboard to the // latest release to create a package if we are inside an app) if (options['package']) { var packageName = options.args[0]; // No package examples exist yet. if (options.list && options.example) { Console.error("No package examples exist at this time."); Console.error(); throw new main.ShowUsage(); } if (!packageName) { Console.error("Please specify the name of the package."); throw new main.ShowUsage(); } utils.validatePackageNameOrExit(packageName, { detailedColonExplanation: true }); // When we create a package, avoid introducing a colon into the file system // by naming the directory after the package name without the prefix. var fsName = packageName; if (packageName.indexOf(":") !== -1) { var split = packageName.split(":"); if (split.length > 2) { // It may seem like this check should be inside package version parser's // validatePackageName, but we decided to name test packages like this: // local-test:prefix:name, so we have to support building packages // with at least two colons. Therefore we will at least try to // discourage people from putting a ton of colons in their package names // here. Console.error(packageName + ": Package names may not have more than one colon."); return 1; } fsName = split[1]; } var packageDir; if (options.appDir) { packageDir = files.pathResolve(options.appDir, 'packages', fsName); } else { packageDir = files.pathResolve(fsName); } var inYourApp = options.appDir ? " in your app" : ""; if (files.exists(packageDir)) { Console.error(packageName + ": Already exists" + inYourApp); return 1; } var transform = function (x) { var xn = x.replace(/~name~/g, packageName).replace(/~fs-name~/g, fsName); // If we are running from checkout, comment out the line sourcing packages // from a release, with the latest release filled in (in case they do want // to publish later). If we are NOT running from checkout, fill it out // with the current release. var relString; if (release.current.isCheckout()) { xn = xn.replace(/~cc~/g, "//"); var rel = catalog.official.getDefaultReleaseVersion(); // the no-release case should never happen except in tests. relString = rel ? rel.version : "no-release"; } else { xn = xn.replace(/~cc~/g, ""); relString = release.current.getDisplayName({ noPrefix: true }); } // If we are not in checkout, write the current release here. return xn.replace(/~release~/g, relString); }; try { files.cp_r(files.pathJoin(__dirnameConverted, '..', 'static-assets', 'skel-pack'), packageDir, { transformFilename: function (f) { return transform(f); }, transformContents: function (contents, f) { if (/(\.html|\.js|\.css)/.test(f)) return new Buffer(transform(contents.toString()));else return contents; }, ignore: [/^local$/] }); } catch (err) { Console.error("Could not create package: " + err.message); return 1; } var displayPackageDir = files.convertToOSPath(files.pathRelative(files.cwd(), packageDir)); // Since the directory can't have colons, the directory name will often not // match the name of the package exactly, therefore we should tell people // where it was created. Console.info(packageName + ": created in", Console.path(displayPackageDir)); return 0; } // Suppose you have an app A, and from some directory inside that // app, you run 'meteor create /my/new/app'. The new app should use // the latest available Meteor release, not the release that A // uses. So if we were run from inside an app directory, and the // user didn't force a release with --release, we need to // springboard to the correct release and tools version. // // (In particular, it's not sufficient to create the new app with // this version of the tools, and then stamp on the correct release // at the end.) if (!release.current.isCheckout() && !release.forced) { if (release.current.name !== release.latestKnown()) { throw new main.SpringboardToLatestRelease(); } } var exampleDir = files.pathJoin(__dirnameConverted, '..', '..', 'examples'); var examples = _.reject(files.readdir(exampleDir), function (e) { return e === 'unfinished' || e === 'other' || e[0] === '.'; }); if (options.list) { Console.info("Available examples:"); _.each(examples, function (e) { Console.info(Console.command(e), Console.options({ indent: 2 })); }); Console.info(); Console.info("Create a project from an example with " + Console.command("'meteor create --example <name>'") + "."); return 0; }; var appPathAsEntered; if (options.args.length === 1) appPathAsEntered = options.args[0];else if (options.example) appPathAsEntered = options.example;else throw new main.ShowUsage(); var appPath = files.pathResolve(appPathAsEntered); if (files.findAppDir(appPath)) { Console.error("You can't create a Meteor project inside another Meteor project."); return 1; } var appName; if (appPathAsEntered === "." || appPathAsEntered === "./") { // If trying to create in current directory appName = files.pathBasename(files.cwd()); } else { appName = files.pathBasename(appPath); } var transform = function (x) { return x.replace(/~name~/g, appName); }; // These file extensions are usually metadata, not app code var nonCodeFileExts = ['.txt', '.md', '.json', '.sh']; var destinationHasCodeFiles = false; // If the directory doesn't exist, it clearly doesn't have any source code // inside itself if (files.exists(appPath)) { destinationHasCodeFiles = _.any(files.readdir(appPath), function thisPathCountsAsAFile(filePath) { // We don't mind if there are hidden files or directories (this includes // .git) and we don't need to check for .meteor here because the command // will fail earlier var isHidden = /^\./.test(filePath); if (isHidden) { // Not code return false; } // We do mind if there are non-hidden directories, because we don't want // to recursively check everything to do some crazy heuristic to see if // we should try to creat an app. var stats = files.stat(filePath); if (stats.isDirectory()) { // Could contain code return true; } // Check against our file extension white list var ext = files.pathExtname(filePath); if (ext == '' || _.contains(nonCodeFileExts, ext)) { return false; } // Everything not matched above is considered to be possible source code return true; }); } if (options.example) { if (destinationHasCodeFiles) { Console.error('When creating an example app, the destination directory can only contain dot-files or files with the following extensions: ' + nonCodeFileExts.join(', ') + '\n'); return 1; } if (examples.indexOf(options.example) === -1) { Console.error(options.example + ": no such example."); Console.error(); Console.error("List available applications with", Console.command("'meteor create --list'") + "."); return 1; } else { files.cp_r(files.pathJoin(exampleDir, options.example), appPath, { // We try not to check the project ID into git, but it might still // accidentally exist and get added (if running from checkout, for // example). To be on the safe side, explicitly remove the project ID // from example apps. ignore: [/^local$/, /^\.id$/] }); } } else { var toIgnore = [/^local$/, /^\.id$/]; if (destinationHasCodeFiles) { // If there is already source code in the directory, don't copy our // skeleton app code over it. Just create the .meteor folder and metadata toIgnore.push(/(\.html|\.js|\.css)/); } files.cp_r(files.pathJoin(__dirnameConverted, '..', 'static-assets', 'skel'), appPath, { transformFilename: function (f) { return transform(f); }, transformContents: function (contents, f) { if (/(\.html|\.js|\.css)/.test(f)) return new Buffer(transform(contents.toString()));else return contents; }, ignore: toIgnore }); } // We are actually working with a new meteor project at this point, so // set up its context. var projectContext = new projectContextModule.ProjectContext({ projectDir: appPath, // Write .meteor/versions even if --release is specified. alwaysWritePackageMap: true, // examples come with a .meteor/versions file, but we shouldn't take it // too seriously allowIncompatibleUpdate: true }); main.captureAndExit("=> Errors while creating your project", function () { projectContext.readProjectMetadata(); if (buildmessage.jobHasMessages()) return; projectContext.releaseFile.write(release.current.isCheckout() ? "none" : release.current.name); if (buildmessage.jobHasMessages()) return; // Any upgrader that is in this version of Meteor doesn't need to be run on // this project. var upgraders = require('../upgraders.js'); projectContext.finishedUpgraders.appendUpgraders(upgraders.allUpgraders()); projectContext.prepareProjectForBuild(); }); // No need to display the PackageMapDelta here, since it would include all of // the packages (or maybe an unpredictable subset based on what happens to be // in the template's versions file). var appNameToDisplay = appPathAsEntered === "." ? "current directory" : '\'' + appPathAsEntered + '\''; var message = 'Created a new Meteor app in ' + appNameToDisplay; if (options.example && options.example !== appPathAsEntered) { message += ' (from \'' + options.example + '\' template)'; } message += "."; Console.info(message + "\n"); // Print a nice message telling people we created their new app, and what to // do next. Console.info("To run your new app:"); if (appPathAsEntered !== ".") { // Wrap the app path in quotes if it contains spaces var appPathWithQuotesIfSpaces = appPathAsEntered.indexOf(' ') === -1 ? appPathAsEntered : '\'' + appPathAsEntered + '\''; // Don't tell people to 'cd .' Console.info(Console.command("cd " + appPathWithQuotesIfSpaces), Console.options({ indent: 2 })); } Console.info(Console.command("meteor"), Console.options({ indent: 2 })); Console.info(""); Console.info("If you are new to Meteor, try some of the learning resources here:"); Console.info(Console.url("https://www.meteor.com/learn"), Console.options({ indent: 2 })); Console.info(""); }); /////////////////////////////////////////////////////////////////////////////// // build /////////////////////////////////////////////////////////////////////////////// var buildCommands = { minArgs: 1, maxArgs: 1, requiresApp: true, options: { debug: { type: Boolean }, directory: { type: Boolean }, architecture: { type: String }, 'mobile-settings': { type: String }, server: { type: String }, // XXX COMPAT WITH 0.9.2.2 "mobile-port": { type: String }, verbose: { type: Boolean, short: "v" }, 'allow-incompatible-update': { type: Boolean } }, catalogRefresh: new catalog.Refresh.Never() }; main.registerCommand(_.extend({ name: 'build' }, buildCommands), function (options) { return buildCommand(options); }); // Deprecated -- identical functionality to 'build' with one exception: it // doesn't output a directory with all builds but rather only one tarball with // server/client programs. // XXX COMPAT WITH 0.9.1.1 main.registerCommand(_.extend({ name: 'bundle', hidden: true }, buildCommands), function (options) { Console.error("This command has been deprecated in favor of " + Console.command("'meteor build'") + ", which allows you to " + "build for multiple platforms and outputs a directory instead of " + "a single tarball. See " + Console.command("'meteor help build'") + " " + "for more information."); Console.error(); return buildCommand(_.extend(options, { _serverOnly: true })); }); var buildCommand = function (options) { Console.setVerbose(!!options.verbose); // XXX output, to stderr, the name of the file written to (for human // comfort, especially since we might change the name) // XXX name the root directory in the bundle based on the basename // of the file, not a constant 'bundle' (a bit obnoxious for // machines, but worth it for humans) // Error handling for options.architecture. We must pass in only one of three // architectures. See archinfo.js for more information on what the // architectures are, what they mean, et cetera. if (options.architecture && !_.has(VALID_ARCHITECTURES, options.architecture)) { showInvalidArchMsg(options.architecture); return 1; } var bundleArch = options.architecture || archinfo.host(); var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir, serverArchitectures: _.uniq([bundleArch, archinfo.host()]), allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while initializing project:", function () { projectContext.prepareProjectForBuild(); }); projectContext.packageMapDelta.displayOnConsole(); // options['mobile-settings'] is used to set the initial value of // `Meteor.settings` on mobile apps. Pass it on to options.settings, // which is used in this command. if (options['mobile-settings']) { options.settings = options['mobile-settings']; } var appName = files.pathBasename(options.appDir); var cordovaPlatforms = undefined; var parsedMobileServerUrl = undefined; if (!options._serverOnly) { cordovaPlatforms = projectContext.platformList.getCordovaPlatforms(); if (process.platform === 'win32' && !_.isEmpty(cordovaPlatforms)) { Console.warn('Can\'t build for mobile on Windows. Skipping the following platforms: ' + cordovaPlatforms.join(", ")); cordovaPlatforms = []; } else if (process.platform !== 'darwin' && _.contains(cordovaPlatforms, 'ios')) { cordovaPlatforms = _.without(cordovaPlatforms, 'ios'); Console.warn("Currently, it is only possible to build iOS apps \ on an OS X system."); } if (!_.isEmpty(cordovaPlatforms)) { // XXX COMPAT WITH 0.9.2.2 -- the --mobile-port option is deprecated var mobileServerOption = options.server || options["mobile-port"]; if (!mobileServerOption) { // For Cordova builds, require '--server'. // XXX better error message? Console.error("Supply the server hostname and port in the --server option " + "for mobile app builds."); return 1; } parsedMobileServerUrl = parseMobileServerOption(mobileServerOption, 'server'); } } else { cordovaPlatforms = []; } var buildDir = projectContext.getProjectLocalDirectory('build_tar'); var outputPath = files.pathResolve(options.args[0]); // get absolute path // Unless we're just making a tarball, warn if people try to build inside the // app directory. if (options.directory || !_.isEmpty(cordovaPlatforms)) { var relative = files.pathRelative(options.appDir, outputPath); // We would like the output path to be outside the app directory, which // means the first step to getting there is going up a level. if (relative.substr(0, 3) !== '..' + files.pathSep) { Console.warn(); Console.labelWarn("The output directory is under your source tree.", "Your generated files may get interpreted as source code!", "Consider building into a different directory instead (" + Console.command("meteor build ../output") + ")", Console.options({ indent: 2 })); Console.warn(); } } var bundlePath = options.directory ? options._serverOnly ? outputPath : files.pathJoin(outputPath, 'bundle') : files.pathJoin(buildDir, 'bundle'); stats.recordPackages({ what: "sdk.bundle", projectContext: projectContext }); var bundler = require('../isobuild/bundler.js'); var bundleResult = bundler.bundle({ projectContext: projectContext, outputPath: bundlePath, buildOptions: { minifyMode: options.debug ? 'development' : 'production', // XXX is this a good idea, or should linux be the default since // that's where most people are deploying // default? i guess the problem with using DEPLOY_ARCH as default // is then 'meteor bundle' with no args fails if you have any local // packages with binary npm dependencies serverArch: bundleArch, buildMode: options.debug ? 'development' : 'production' }, providePackageJSONForUnavailableBinaryDeps: !!process.env.METEOR_BINARY_DEP_WORKAROUND }); if (bundleResult.errors) { Console.error("Errors prevented bundling:"); Console.error(bundleResult.errors.formatMessages()); return 1; } if (!options._serverOnly) files.mkdir_p(outputPath); if (!options.directory) { main.captureAndExit('', 'creating server tarball', function () { try { var outputTar = options._serverOnly ? outputPath : files.pathJoin(outputPath, appName + '.tar.gz'); files.createTarball(files.pathJoin(buildDir, 'bundle'), outputTar); } catch (err) { buildmessage.exception(err); files.rm_recursive(buildDir); } }); } if (!_.isEmpty(cordovaPlatforms)) { (function () { var cordovaProject = undefined; main.captureAndExit('', function () { buildmessage.enterJob({ title: "preparing Cordova project" }, function () { cordovaProject = new _cordovaProjectJs.CordovaProject(projectContext, { settingsFile: options.settings, mobileServerUrl: utils.formatUrl(parsedMobileServerUrl) }); var plugins = cordova.pluginVersionsFromStarManifest(bundleResult.starManifest); cordovaProject.prepareFromAppBundle(bundlePath, plugins); }); for (var _iterator = cordovaPlatforms, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { if (_isArray) { if (_i >= _iterator.length) break; platform = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; platform = _i.value; } buildmessage.enterJob({ title: 'building Cordova app for ' + cordova.displayNameForPlatform(platform) }, function () { var buildOptions = []; if (!options.debug) buildOptions.push('--release'); cordovaProject.buildForPlatform(platform, buildOptions); var buildPath = files.pathJoin(projectContext.getProjectLocalDirectory('cordova-build'), 'platforms', platform); var platformOutputPath = files.pathJoin(outputPath, platform); files.cp_r(buildPath, files.pathJoin(platformOutputPath, 'project')); if (platform === 'ios') { files.writeFile(files.pathJoin(platformOutputPath, 'README'), 'This is an auto-generated XCode project for your iOS application.\n\nInstructions for publishing your iOS app to App Store can be found at:\nhttps://github.com/meteor/meteor/wiki/How-to-submit-your-iOS-app-to-App-Store\n', "utf8"); } else if (platform === 'android') { var apkPath = files.pathJoin(buildPath, 'build/outputs/apk', options.debug ? 'android-debug.apk' : 'android-release-unsigned.apk'); if (files.exists(apkPath)) { files.copyFile(apkPath, files.pathJoin(platformOutputPath, options.debug ? 'debug.apk' : 'release-unsigned.apk')); } files.writeFile(files.pathJoin(platformOutputPath, 'README'), 'This is an auto-generated Gradle project for your Android application.\n\nInstructions for publishing your Android app to Play Store can be found at:\nhttps://github.com/meteor/meteor/wiki/How-to-submit-your-Android-app-to-Play-Store\n', "utf8"); } }); } }); })(); } files.rm_recursive(buildDir); }; /////////////////////////////////////////////////////////////////////////////// // lint /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'lint', maxArgs: 0, requiresAppOrPackage: true, options: { 'allow-incompatible-updates': { type: Boolean } }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { var packageDir = options.packageDir; var appDir = options.appDir; var projectContext = null; // if the goal is to lint the package, don't include the whole app if (packageDir) { // similar to `meteor publish`, create a fake project var tempProjectDir = files.mkdtemp('meteor-package-build'); projectContext = new projectContextModule.ProjectContext({ projectDir: tempProjectDir, explicitlyAddedLocalPackageDirs: [packageDir], packageMapFilename: files.pathJoin(packageDir, '.versions'), alwaysWritePackageMap: true, forceIncludeCordovaUnibuild: true, allowIncompatibleUpdate: options['allow-incompatible-update'], lintPackageWithSourceRoot: packageDir }); main.captureAndExit("=> Errors while setting up package:", function () { return( // Read metadata and initialize catalog. projectContext.initializeCatalog() ); }); var versionRecord = projectContext.localCatalog.getVersionBySourceRoot(packageDir); if (!versionRecord) { throw Error("explicitly added local package dir missing?"); } var packageName = versionRecord.packageName; var constraint = utils.parsePackageConstraint(packageName); projectContext.projectConstraintsFile.removeAllPackages(); projectContext.projectConstraintsFile.addConstraints([constraint]); } // linting the app if (!projectContext && appDir) { projectContext = new projectContextModule.ProjectContext({ projectDir: appDir, serverArchitectures: [archinfo.host()], allowIncompatibleUpdate: options['allow-incompatible-update'], lintAppAndLocalPackages: true }); } main.captureAndExit("=> Errors prevented the build:", function () { projectContext.prepareProjectForBuild(); }); var bundlePath = projectContext.getProjectLocalDirectory('build'); var bundler = require('../isobuild/bundler.js'); var bundle = bundler.bundle({ projectContext: projectContext, outputPath: null, buildOptions: { minifyMode: 'development' } }); var displayName = options.packageDir ? 'package' : 'app'; if (bundle.errors) { Console.error('=> Errors building your ' + displayName + ':\n\n' + bundle.errors.formatMessages()); throw new main.ExitWithCode(2); } if (bundle.warnings) { Console.warn(bundle.warnings.formatMessages()); return 1; } return 0; }); /////////////////////////////////////////////////////////////////////////////// // mongo /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'mongo', maxArgs: 1, options: { url: { type: Boolean, short: 'U' } }, requiresApp: function (options) { return options.args.length === 0; }, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { var mongoUrl; var usedMeteorAccount = false; if (options.args.length === 0) { // localhost mode var findMongoPort = require('../runners/run-mongo.js').findMongoPort; var mongoPort = findMongoPort(options.appDir); // XXX detect the case where Meteor is running, but MONGO_URL was // specified? if (!mongoPort) { Console.info("mongo: Meteor isn't running a local MongoDB server."); Console.info(); Console.info('This command only works while Meteor is running your application locally. Start your application first with \'meteor\' and then run this command in a new terminal. This error will also occur if you asked Meteor to use a different MongoDB server with $MONGO_URL when you ran your application.'); Console.info(); Console.info('If you\'re trying to connect to the database of an app you deployed with ' + Console.command("'meteor deploy'") + ', specify your site\'s name as an argument to this command.'); return 1; } mongoUrl = "mongodb://127.0.0.1:" + mongoPort + "/meteor"; } else { // remote mode var site = qualifySitename(options.args[0]); config.printUniverseBanner(); mongoUrl = deploy.temporaryMongoUrl(site); usedMeteorAccount = true; if (!mongoUrl) // temporaryMongoUrl() will have printed an error message return 1; } if (options.url) { console.log(mongoUrl); } else { if (usedMeteorAccount) auth.maybePrintRegistrationLink(); process.stdin.pause(); var runMongo = require('../runners/run-mongo.js'); runMongo.runMongoShell(mongoUrl); throw new main.WaitForExit(); } }); /////////////////////////////////////////////////////////////////////////////// // reset /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'reset', // Doesn't actually take an argument, but we want to print an custom // error message if they try to pass one. maxArgs: 1, requiresApp: true, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (options.args.length !== 0) { Console.error("meteor reset only affects the locally stored database."); Console.error(); Console.error("To reset a deployed application use"); Console.error(Console.command("meteor deploy --delete appname"), Console.options({ indent: 2 })); Console.error("followed by"); Console.error(Console.command("meteor deploy appname"), Console.options({ indent: 2 })); return 1; } // XXX detect the case where Meteor is running the app, but // MONGO_URL was set, so we don't see a Mongo process var findMongoPort = require('../runners/run-mongo.js').findMongoPort; var isRunning = !!findMongoPort(options.appDir); if (isRunning) { Console.error("reset: Meteor is running."); Console.error(); Console.error("This command does not work while Meteor is running your application.", "Exit the running Meteor development server."); return 1; } var localDir = files.pathJoin(options.appDir, '.meteor', 'local'); files.rm_recursive(localDir); Console.info("Project reset."); }); /////////////////////////////////////////////////////////////////////////////// // deploy /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'deploy', minArgs: 1, maxArgs: 1, options: { 'delete': { type: Boolean, short: 'D' }, debug: { type: Boolean }, settings: { type: String }, // No longer supported, but we still parse it out so that we can // print a custom error message. password: { type: String }, // Override architecture to deploy whatever stuff we have locally, even if // it contains binary packages that should be incompatible. A hack to allow // people to deploy from checkout or do other weird shit. We are not // responsible for the consequences. 'override-architecture-with-local': { type: Boolean }, 'allow-incompatible-update': { type: Boolean } }, requiresApp: function (options) { return !options['delete']; }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { var site = qualifySitename(options.args[0]); config.printUniverseBanner(); if (options['delete']) { return deploy.deleteApp(site); } if (options.password) { Console.error("Setting passwords on apps is no longer supported. Now there are " + "user accounts and your apps are associated with your account so " + "that only you (and people you designate) can access them. See the " + Console.command("'meteor claim'") + " and " + Console.command("'meteor authorized'") + " commands."); return 1; } var loggedIn = auth.isLoggedIn(); if (!loggedIn) { Console.error("To instantly deploy your app on a free testing server,", "just enter your email address!"); Console.error(); if (!auth.registerOrLogIn()) return 1; } // Override architecture iff applicable. var buildArch = DEPLOY_ARCH; if (options['override-architecture-with-local']) { Console.warn(); Console.labelWarn("OVERRIDING DEPLOY ARCHITECTURE WITH LOCAL ARCHITECTURE.", "If your app contains binary code, it may break in unexpected " + "and terrible ways."); buildArch = archinfo.host(); } var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir, serverArchitectures: _.uniq([buildArch, archinfo.host()]), allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while initializing project:", function () { projectContext.prepareProjectForBuild(); }); projectContext.packageMapDelta.displayOnConsole(); var buildOptions = { minifyMode: options.debug ? 'development' : 'production', buildMode: options.debug ? 'development' : 'production', serverArch: buildArch }; var deployResult = deploy.bundleAndDeploy({ projectContext: projectContext, site: site, settingsFile: options.settings, buildOptions: buildOptions }); if (deployResult === 0) { auth.maybePrintRegistrationLink({ leadingNewline: true, // If the user was already logged in at the beginning of the // deploy, then they've already been prompted to set a password // at least once before, so we use a slightly different message. firstTime: !loggedIn }); } return deployResult; }); /////////////////////////////////////////////////////////////////////////////// // logs /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'logs', minArgs: 1, maxArgs: 1, catalogRefresh: new catalog.Refresh.Never() }, function (options) { var site = qualifySitename(options.args[0]); return deploy.logs(site); }); /////////////////////////////////////////////////////////////////////////////// // authorized /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'authorized', minArgs: 1, maxArgs: 1, options: { add: { type: String, short: "a" }, remove: { type: String, short: "r" }, list: { type: Boolean } }, pretty: function (options) { // pretty if we're mutating; plain if we're listing (which is more likely to // be used by scripts) return options.add || options.remove; }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (options.add && options.remove) { Console.error("Sorry, you can only add or remove one user at a time."); return 1; } if ((options.add || options.remove) && options.list) { Console.error("Sorry, you can't change the users at the same time as", "you're listing them."); return 1; } config.printUniverseBanner(); auth.pollForRegistrationCompletion(); var site = qualifySitename(options.args[0]); if (!auth.isLoggedIn()) { Console.error("You must be logged in for that. Try " + Console.command("'meteor login'")); return 1; } if (options.add) return deploy.changeAuthorized(site, "add", options.add);else if (options.remove) return deploy.changeAuthorized(site, "remove", options.remove);else return deploy.listAuthorized(site); }); /////////////////////////////////////////////////////////////////////////////// // claim /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'claim', minArgs: 1, maxArgs: 1, catalogRefresh: new catalog.Refresh.Never() }, function (options) { config.printUniverseBanner(); auth.pollForRegistrationCompletion(); var site = qualifySitename(options.args[0]); if (!auth.isLoggedIn()) { Console.error("You must be logged in to claim sites. Use " + Console.command("'meteor login'") + " to log in. If you don't have a " + "Meteor developer account yet, create one by clicking " + Console.command("'Sign in'") + " and then " + Console.command("'Create account'") + " at www.meteor.com."); Console.error(); return 1; } return deploy.claim(site); }); /////////////////////////////////////////////////////////////////////////////// // test-packages /////////////////////////////////////////////////////////////////////////////// // // Test your local packages. // main.registerCommand({ name: 'test-packages', maxArgs: Infinity, options: { port: { type: String, short: "p", 'default': DEFAULT_PORT }, 'mobile-server': { type: String }, // XXX COMPAT WITH 0.9.2.2 'mobile-port': { type: String }, 'debug-port': { type: String }, deploy: { type: String }, production: { type: Boolean }, settings: { type: String }, velocity: { type: Boolean }, verbose: { type: Boolean, short: "v" }, // Undocumented. See #Once once: { type: Boolean }, // Undocumented. To ensure that QA covers both // PollingObserveDriver and OplogObserveDriver, this option // disables oplog for tests. (It still creates a replset, it just // doesn't do oplog tailing.) 'disable-oplog': { type: Boolean }, // Undocumented flag to use a different test driver. 'driver-package': { type: String, 'default': 'test-in-browser' }, // Sets the path of where the temp app should be created 'test-app-path': { type: String }, // Undocumented, runs tests under selenium 'selenium': { type: Boolean }, 'selenium-browser': { type: String }, // Undocumented. Usually we just show a banner saying 'Tests' instead of // the ugly path to the temporary test directory, but if you actually want // to see it you can ask for it. 'show-test-app-path': { type: Boolean }, // hard-coded options with all known Cordova platforms ios: { type: Boolean }, 'ios-device': { type: Boolean }, android: { type: Boolean }, 'android-device': { type: Boolean }, // This could theoretically be useful/necessary in conjunction with // --test-app-path. 'allow-incompatible-update': { type: Boolean }, // Don't print linting messages for tested packages 'no-lint': { type: Boolean }, // allow excluding packages when testing all packages. // should be a comma-separated list of package names. 'exclude': { type: String } }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { Console.setVerbose(!!options.verbose); var runTargets = parseRunTargets(_.intersection(Object.keys(options), ['ios', 'ios-device', 'android', 'android-device'])); var _parseServerOptionsForRunCommand2 = parseServerOptionsForRunCommand(options, runTargets); var parsedServerUrl = _parseServerOptionsForRunCommand2.parsedServerUrl; var parsedMobileServerUrl = _parseServerOptionsForRunCommand2.parsedMobileServerUrl; // Find any packages mentioned by a path instead of a package name. We will // load them explicitly into the catalog. var packagesByPath = _.filter(options.args, function (p) { return p.indexOf('/') !== -1; }); // Make a temporary app dir (based on the test runner app). This will be // cleaned up on process exit. Using a temporary app dir means that we can // run multiple "test-packages" commands in parallel without them stomping // on each other. var testRunnerAppDir = options['test-app-path'] || files.mkdtemp('meteor-test-run'); // Download packages for our architecture, and for the deploy server's // architecture if we're deploying. var serverArchitectures = [archinfo.host()]; if (options.deploy && DEPLOY_ARCH !== archinfo.host()) serverArchitectures.push(DEPLOY_ARCH); // XXX Because every run uses a new app with its own IsopackCache directory, // this always does a clean build of all packages. Maybe we can speed up // repeated test-packages calls with some sort of shared or semi-shared // isopack cache that's specific to test-packages? See #3012. var projectContext = new projectContextModule.ProjectContext({ projectDir: testRunnerAppDir, // If we're currently in an app, we still want to use the real app's // packages subdirectory, not the test runner app's empty one. projectDirForLocalPackages: options.appDir, explicitlyAddedLocalPackageDirs: packagesByPath, serverArchitectures: serverArchitectures, allowIncompatibleUpdate: options['allow-incompatible-update'], lintAppAndLocalPackages: !options['no-lint'] }); main.captureAndExit("=> Errors while setting up tests:", function () { // Read metadata and initialize catalog. projectContext.initializeCatalog(); }); // Overwrite .meteor/release. projectContext.releaseFile.write(release.current.isCheckout() ? "none" : release.current.name); var packagesToAdd = getTestPackageNames(projectContext, options.args); // filter out excluded packages var excludedPackages = options.exclude && options.exclude.split(','); if (excludedPackages) { packagesToAdd = _.filter(packagesToAdd, function (p) { return !_.some(excludedPackages, function (excluded) { return p.replace(/^local-test:/, '') === excluded; }); }); } // Use the driver package // Also, add `autoupdate` so that you don't have to manually refresh the tests packagesToAdd.unshift("autoupdate", options['driver-package']); var constraintsToAdd = _.map(packagesToAdd, function (p) { return utils.parsePackageConstraint(p); }); // Add the packages to our in-memory representation of .meteor/packages. (We // haven't yet resolved constraints, so this will affect constraint // resolution.) This will get written to disk once we prepareProjectForBuild, // either in the Cordova code below, right before deploying below, or in the // app runner. (Note that removeAllPackages removes any comments from // .meteor/packages, but that's OK since this isn't a real user project.) projectContext.projectConstraintsFile.removeAllPackages(); projectContext.projectConstraintsFile.addConstraints(constraintsToAdd); // Write these changes to disk now, so that if the first attempt to prepare // the project for build hits errors, we don't lose them on // projectContext.reset. projectContext.projectConstraintsFile.writeIfModified(); // The rest of the projectContext preparation process will happen inside the // runner, once the proxy is listening. The changes we made were persisted to // disk, so projectContext.reset won't make us forget anything. var cordovaRunner = undefined; if (!_.isEmpty(runTargets)) { main.captureAndExit('', 'preparing Cordova project', function () { var cordovaProject = new _cordovaProjectJs.CordovaProject(projectContext, { settingsFile: options.settings, mobileServerUrl: utils.formatUrl(parsedMobileServerUrl) }); cordovaRunner = new _cordovaRunnerJs.CordovaRunner(cordovaProject, runTargets); projectContext.platformList.write(cordovaRunner.platformsForRunTargets); cordovaRunner.checkPlatformsForRunTargets(); }); } options.cordovaRunner = cordovaRunner; if (options.velocity) { var serverUrlForVelocity = 'http://' + (parsedServerUrl.host || "localhost") + ':' + parsedServerUrl.port; var velocity = require('../runners/run-velocity.js'); velocity.runVelocity(serverUrlForVelocity); } return runTestAppForPackages(projectContext, _.extend(options, { mobileServerUrl: utils.formatUrl(parsedMobileServerUrl) })); }); // Returns the "local-test:*" package names for the given package names (or for // all local packages if packageNames is empty/unspecified). var getTestPackageNames = function (projectContext, packageNames) { var packageNamesSpecifiedExplicitly = !_.isEmpty(packageNames); if (_.isEmpty(packageNames)) { // If none specified, test all local packages. (We don't have tests for // non-local packages.) packageNames = projectContext.localCatalog.getAllPackageNames(); } var testPackages = []; main.captureAndExit("=> Errors while collecting tests:", function () { _.each(packageNames, function (p) { buildmessage.enterJob("trying to test package `" + p + "`", function () { // If it's a package name, look it up the normal way. if (p.indexOf('/') === -1) { if (p.indexOf('@') !== -1) { buildmessage.error("You may not specify versions for local packages: " + p); return; // recover by ignoring } // Check to see if this is a real local package, and if it is a real // local package, if it has tests. var version = projectContext.localCatalog.getLatestVersion(p); if (!version) { buildmessage.error("Not a known local package, cannot test"); } else if (version.testName) { testPackages.push(version.testName); } else if (packageNamesSpecifiedExplicitly) { // It's only an error to *ask* to test a package with no tests, not // to come across a package with no tests when you say "test all // packages". buildmessage.error("Package has no tests"); } } else { // Otherwise, it's a directory; find it by source root. version = projectContext.localCatalog.getVersionBySourceRoot(files.pathResolve(p)); if (!version) { throw Error("should have been caught when initializing catalog?"); } if (version.testName) { testPackages.push(version.testName); } // It is not an error to mention a package by directory that is a // package but has no tests; this means you can run `meteor // test-packages $APP/packages/*` without having to worry about the // packages that don't have tests. } }); }); }); return testPackages; }; var runTestAppForPackages = function (projectContext, options) { var buildOptions = { minifyMode: options.production ? 'production' : 'development', buildMode: options.production ? 'production' : 'development' }; if (options.deploy) { // Run the constraint solver and build local packages. main.captureAndExit("=> Errors while initializing project:", function () { projectContext.prepareProjectForBuild(); }); // No need to display the PackageMapDelta here, since it would include all // of the packages! buildOptions.serverArch = DEPLOY_ARCH; return deploy.bundleAndDeploy({ projectContext: projectContext, site: options.deploy, settingsFile: options.settings, buildOptions: buildOptions, recordPackageUsage: false }); } else { var runAll = require('../runners/run-all.js'); return runAll.run({ projectContext: projectContext, proxyPort: options.port, debugPort: options['debug-port'], disableOplog: options['disable-oplog'], settingsFile: options.settings, banner: options['show-test-app-path'] ? null : "Tests", buildOptions: buildOptions, rootUrl: process.env.ROOT_URL, mongoUrl: process.env.MONGO_URL, oplogUrl: process.env.MONGO_OPLOG_URL, mobileServerUrl: options.mobileServerUrl, once: options.once, recordPackageUsage: false, selenium: options.selenium, seleniumBrowser: options['selenium-browser'], cordovaRunner: options.cordovaRunner, // On the first run, we shouldn't display the delta between "no packages // in the temp app" and "all the packages we're testing". If we make // changes and reload, though, it's fine to display them. omitPackageMapDeltaDisplayOnFirstRun: true }); } }; /////////////////////////////////////////////////////////////////////////////// // rebuild /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'rebuild', maxArgs: Infinity, hidden: true, requiresApp: true, catalogRefresh: new catalog.Refresh.Never(), 'allow-incompatible-update': { type: Boolean } }, function (options) { var projectContextModule = require('../project-context.js'); var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir, forceRebuildPackages: options.args.length ? options.args : true, allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while rebuilding packages:", function () { projectContext.prepareProjectForBuild(); }); projectContext.packageMapDelta.displayOnConsole(); Console.info("Packages rebuilt."); }); /////////////////////////////////////////////////////////////////////////////// // login /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'login', options: { email: { type: Boolean } }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { return auth.loginCommand(_.extend({ overwriteExistingToken: true }, options)); }); /////////////////////////////////////////////////////////////////////////////// // logout /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'logout', catalogRefresh: new catalog.Refresh.Never() }, function (options) { return auth.logoutCommand(options); }); /////////////////////////////////////////////////////////////////////////////// // whoami /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'whoami', catalogRefresh: new catalog.Refresh.Never(), pretty: false }, function (options) { return auth.whoAmICommand(options); }); /////////////////////////////////////////////////////////////////////////////// // organizations /////////////////////////////////////////////////////////////////////////////// var loggedInAccountsConnectionOrPrompt = function (action) { var token = auth.getSessionToken(config.getAccountsDomain()); if (!token) { Console.error("You must be logged in to " + action + "."); auth.doUsernamePasswordLogin({ retry: true }); Console.info(); } token = auth.getSessionToken(config.getAccountsDomain()); var conn = auth.loggedInAccountsConnection(token); if (conn === null) { // Server rejected our token. Console.error("You must be logged in to " + action + "."); auth.doUsernamePasswordLogin({ retry: true }); Console.info(); token = auth.getSessionToken(config.getAccountsDomain()); conn = auth.loggedInAccountsConnection(token); } return conn; }; // List the organizations of which the current user is a member. main.registerCommand({ name: 'admin list-organizations', minArgs: 0, maxArgs: 0, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { var token = auth.getSessionToken(config.getAccountsDomain()); if (!token) { Console.error("You must be logged in to list your organizations."); auth.doUsernamePasswordLogin({ retry: true }); Console.info(); } var url = config.getAccountsApiUrl() + "/organizations"; try { var result = httpHelpers.request({ url: url, method: "GET", useSessionHeader: true, useAuthHeader: true }); var body = JSON.parse(result.body); } catch (err) { Console.error("Error listing organizations."); return 1; } if (result.response.statusCode === 401 && body && body.error === "invalid_credential") { Console.error("You must be logged in to list your organizations."); // XXX It would be nice to do a username/password prompt here like // we do for the other orgs commands. return 1; } if (result.response.statusCode !== 200 || !body || !body.organizations) { Console.error("Error listing organizations."); return 1; } if (body.organizations.length === 0) { Console.info("You are not a member of any organizations."); } else { Console.rawInfo(_.pluck(body.organizations, "name").join("\n") + "\n"); } return 0; }); main.registerCommand({ name: 'admin members', minArgs: 1, maxArgs: 1, options: { add: { type: String }, remove: { type: String }, list: { type: Boolean } }, pretty: function (options) { // pretty if we're mutating; plain if we're listing (which is more likely to // be used by scripts) return options.add || options.remove; }, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (options.add && options.remove) { Console.error("Sorry, you can only add or remove one member at a time."); throw new main.ShowUsage(); } config.printUniverseBanner(); var username = options.add || options.remove; var conn = loggedInAccountsConnectionOrPrompt(username ? "edit organizations" : "show an organization's members"); if (username) { // Adding or removing members try { conn.call(options.add ? "addOrganizationMember" : "removeOrganizationMember", options.args[0], username); } catch (err) { Console.error("Error " + (options.add ? "adding" : "removing") + " member: " + err.reason); return 1; } Console.info(username + " " + (options.add ? "added to" : "removed from") + " organization " + options.args[0] + "."); } else { // Showing the members of an org try { var result = conn.call("showOrganization", options.args[0]); } catch (err) { Console.error("Error showing organization: " + err.reason); return 1; } var members = _.pluck(result, "username"); Console.rawInfo(members.join("\n") + "\n"); } return 0; }); /////////////////////////////////////////////////////////////////////////////// // self-test /////////////////////////////////////////////////////////////////////////////// // XXX we should find a way to make self-test fully self-contained, so that it // ignores "packageDirs" (ie, it shouldn't fail just because you happen to be // sitting in an app with packages that don't build) main.registerCommand({ name: 'self-test', minArgs: 0, maxArgs: 1, options: { changed: { type: Boolean }, 'force-online': { type: Boolean }, slow: { type: Boolean }, galaxy: { type: Boolean }, browserstack: { type: Boolean }, history: { type: Number }, list: { type: Boolean }, file: { type: String }, exclude: { type: String } }, hidden: true, catalogRefresh: new catalog.Refresh.Never() }, function (options) { if (!files.inCheckout()) { Console.error("self-test is only supported running from a checkout"); return 1; } var selftest = require('../tool-testing/selftest.js'); // Auto-detect whether to skip 'net' tests, unless --force-online is passed. var offline = false; if (!options['force-online']) { try { require('../utils/http-helpers.js').getUrl("http://www.google.com/"); } catch (e) { if (e instanceof files.OfflineError) offline = true; } } var compileRegexp = function (str) { try { return new RegExp(str); } catch (e) { if (!(e instanceof SyntaxError)) throw e; Console.error("Bad regular expression: " + str); return null; } }; var testRegexp = undefined; if (options.args.length) { testRegexp = compileRegexp(options.args[0]); if (!testRegexp) { return 1; } } var fileRegexp = undefined; if (options.file) { fileRegexp = compileRegexp(options.file); if (!fileRegexp) { return 1; } } var excludeRegexp = undefined; if (options.exclude) { excludeRegexp = compileRegexp(options.exclude); if (!excludeRegexp) { return 1; } } if (options.list) { selftest.listTests({ onlyChanged: options.changed, offline: offline, includeSlowTests: options.slow, galaxyOnly: options.galaxy, testRegexp: testRegexp, fileRegexp: fileRegexp }); return 0; } var clients = { browserstack: options.browserstack }; return selftest.runTests({ // filtering options onlyChanged: options.changed, offline: offline, includeSlowTests: options.slow, galaxyOnly: options.galaxy, testRegexp: testRegexp, fileRegexp: fileRegexp, excludeRegexp: excludeRegexp, // other options historyLines: options.history, clients: clients }); }); /////////////////////////////////////////////////////////////////////////////// // list-sites /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'list-sites', minArgs: 0, maxArgs: 0, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { auth.pollForRegistrationCompletion(); if (!auth.isLoggedIn()) { Console.error("You must be logged in for that. Try " + Console.command("'meteor login'") + "."); return 1; } return deploy.listSites(); }); /////////////////////////////////////////////////////////////////////////////// // admin get-machine /////////////////////////////////////////////////////////////////////////////// main.registerCommand({ name: 'admin get-machine', minArgs: 1, maxArgs: 1, options: { json: { type: Boolean }, verbose: { type: Boolean, short: "v" }, // By default, we give you a machine for 5 minutes. You can request up to // 15. (MDG can reserve machines for longer than that.) minutes: { type: Number } }, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { // Check that we are asking for a valid architecture. var arch = options.args[0]; if (!_.has(VALID_ARCHITECTURES, arch)) { showInvalidArchMsg(arch); return 1; } // Set the minutes. We will check validity on the server. var minutes = options.minutes || 5; // In verbose mode, we let you know what is going on. var maybeLog = function (string) { if (options.verbose) { Console.info(string); } }; try { maybeLog("Logging into the get-machines server ..."); var conn = authClient.loggedInConnection(config.getBuildFarmUrl(), config.getBuildFarmDomain(), "build-farm"); } catch (err) { authClient.handleConnectionError(err, "get-machines server"); return 1; } try { maybeLog("Reserving machine ..."); // The server returns to us an object with the following keys: // username & sshKey : use this to log in. // host: what you login into // port: port you should use // hostKey: RSA key to compare for safety. var ret = conn.call('createBuildServer', arch, minutes); } catch (err) { authClient.handleConnectionError(err, "build farm"); return 1; } conn.close(); // Possibly, the user asked us to return a JSON of the data and is going to process it // themselves. In that case, let's do that and exit. if (options.json) { var retJson = { 'username': ret.username, 'host': ret.host, 'port': ret.port, 'key': ret.sshKey, 'hostKey': ret.hostKey }; Console.rawInfo(JSON.stringify(retJson, null, 2) + "\n"); return 0; } // Record the SSH Key in a temporary file on disk and give it the permissions // that ssh-agent requires it to have. var tmpDir = files.mkdtemp('meteor-ssh-'); var idpath = tmpDir + '/id'; maybeLog("Writing ssh key to " + idpath); files.writeFile(idpath, ret.sshKey, { encoding: 'utf8', mode: 256 }); // Add the known host key to a custom known hosts file. var hostpath = tmpDir + '/host'; var addendum = ret.host + " " + ret.hostKey + "\n"; maybeLog("Writing host key to " + hostpath); files.writeFile(hostpath, addendum, 'utf8'); // Finally, connect to the machine. var login = ret.username + "@" + ret.host; var maybeVerbose = options.verbose ? "-v" : "-q"; var connOptions = [login, "-i" + idpath, "-p" + ret.port, "-oUserKnownHostsFile=" + hostpath, maybeVerbose]; var printOptions = connOptions.join(' '); maybeLog("Connecting: " + Console.command("ssh " + printOptions)); var child_process = require('child_process'); var future = new Future(); if (arch.match(/win/)) { // The ssh output from Windows machines is buggy, it can overlay your // existing output on the top of the screen which is very ugly. Force the // screen cleaning to assist. Console.clear(); } var sshCommand = child_process.spawn("ssh", connOptions, { stdio: 'inherit' }); // Redirect spawn stdio to process sshCommand.on('error', function (err) { if (err.code === "ENOENT") { if (process.platform === "win32") { Console.error("Could not find the `ssh` command in your PATH.", "Please read this page about using the get-machine command on Windows:", Console.url("https://github.com/meteor/meteor/wiki/Accessing-Meteor-provided-build-machines-from-Windows")); } else { Console.error("Could not find the `ssh` command in your PATH."); } future['return'](1); } }); sshCommand.on('exit', function (code, signal) { if (signal) { // XXX: We should process the signal in some way, but I am not sure we // care right now. future['return'](1); } else { future['return'](code); } }); var sshEnd = future.wait(); return sshEnd; }); /////////////////////////////////////////////////////////////////////////////// // admin progressbar-test /////////////////////////////////////////////////////////////////////////////// // A test command to print a progressbar. Useful for manual testing. main.registerCommand({ name: 'admin progressbar-test', options: { secs: { type: Number, 'default': 20 }, spinner: { type: Boolean, 'default': false } }, hidden: true, catalogRefresh: new catalog.Refresh.Never() }, function (options) { buildmessage.enterJob({ title: "A test progressbar" }, function () { var doneFuture = new Future(); var progress = buildmessage.getCurrentProgressTracker(); var totalProgress = { current: 0, end: options.secs, done: false }; var i = 0; var n = options.secs; if (options.spinner) { totalProgress.end = undefined; } var updateProgress = function () { i++; if (!options.spinner) { totalProgress.current = i; } if (i === n) { totalProgress.done = true; progress.reportProgress(totalProgress); doneFuture['return'](); } else { progress.reportProgress(totalProgress); setTimeout(updateProgress, 1000); } }; setTimeout(updateProgress); doneFuture.wait(); }); }); /////////////////////////////////////////////////////////////////////////////// // dummy /////////////////////////////////////////////////////////////////////////////// // Dummy test command. Used for automated testing of the command line // option parser. main.registerCommand({ name: 'dummy', options: { ething: { type: String, short: "e", required: true }, port: { type: Number, short: "p", 'default': DEFAULT_PORT }, url: { type: Boolean, short: "U" }, 'delete': { type: Boolean, short: "D" }, changed: { type: Boolean } }, maxArgs: 2, hidden: true, pretty: false, catalogRefresh: new catalog.Refresh.Never() }, function (options) { var p = function (key) { if (_.has(options, key)) return JSON.stringify(options[key]); return 'none'; }; Console.info(p('ething') + " " + p('port') + " " + p('changed') + " " + p('args')); if (options.url) Console.info('url'); if (options['delete']) Console.info('delete'); }); /////////////////////////////////////////////////////////////////////////////// // throw-error /////////////////////////////////////////////////////////////////////////////// // Dummy test command. Used to test that stack traces work from an installed // Meteor tool. main.registerCommand({ name: 'throw-error', hidden: true, catalogRefresh: new catalog.Refresh.Never() }, function () { throw new Error("testing stack traces!"); // #StackTraceTest this line is found in tests/source-maps.js }); //# sourceMappingURL=commands.js.map
lpinto93/meteor
tools/cli/commands.js
JavaScript
mit
76,122
from attributes import * from constants import * # ------------------------------------------------------------------------------ # class UnitManager (Attributes) : """ UnitManager class -- manages a pool """ # -------------------------------------------------------------------------- # def __init__ (self, url=None, scheduler='default', session=None) : Attributes.__init__ (self) # -------------------------------------------------------------------------- # def add_pilot (self, pid) : """ add (Compute or Data)-Pilot(s) to the pool """ raise Exception ("%s.add_pilot() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def list_pilots (self, ptype=ANY) : """ List IDs of data and/or compute pilots """ raise Exception ("%s.list_pilots() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def remove_pilot (self, pid, drain=False) : """ Remove pilot(s) (does not cancel the pilot(s), but removes all units from the pilot(s). `drain` determines what happens to the units which are managed by the removed pilot(s). If `True`, the pilot removal is delayed until all units reach a final state. If `False` (the default), then `RUNNING` units will be canceled, and `PENDING` units will be re-assinged to the unit managers for re-scheduling to other pilots. """ raise Exception ("%s.remove_pilot() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def submit_unit (self, description) : """ Instantiate and return (Compute or Data)-Unit object(s) """ raise Exception ("%s.submit_unit() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def list_units (self, utype=ANY) : """ List IDs of data and/or compute units """ raise Exception ("%s.list_units() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def get_unit (self, uids) : """ Reconnect to and return (Compute or Data)-Unit object(s) """ raise Exception ("%s.get_unit() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def wait_unit (self, uids, state=[DONE, FAILED, CANCELED], timeout=-1.0) : """ Wait for given unit(s) to enter given state """ raise Exception ("%s.wait_unit() is not implemented" % self.__class__.__name__) # -------------------------------------------------------------------------- # def cancel_units (self, uids) : """ Cancel given unit(s) """ raise Exception ("%s.cancel_unit() is not implemented" % self.__class__.__name__) # ------------------------------------------------------------------------------ #
JensTimmerman/radical.pilot
docs/architecture/api_draft/unit_manager.py
Python
mit
3,311
'use strict'; angular.module('terminaaliApp') .factory('Auth', function Auth($location, $rootScope, $http, User, $cookieStore, $q) { var currentUser = {}; if($cookieStore.get('token')) { currentUser = User.get(); } return { /** * Authenticate user and save token * * @param {Object} user - login info * @param {Function} callback - optional * @return {Promise} */ login: function(user, callback) { var cb = callback || angular.noop; var deferred = $q.defer(); $http.post('/auth/local', { email: user.email, password: user.password }). success(function(data) { $cookieStore.put('token', data.token); currentUser = User.get(); deferred.resolve(data); return cb(); }). error(function(err) { this.logout(); deferred.reject(err); return cb(err); }.bind(this)); return deferred.promise; }, /** * Delete access token and user info * * @param {Function} */ logout: function() { $cookieStore.remove('token'); currentUser = {}; }, /** * Create a new user * * @param {Object} user - user info * @param {Function} callback - optional * @return {Promise} */ createUser: function(user, callback) { var cb = callback || angular.noop; return User.save(user, function(data) { $cookieStore.put('token', data.token); currentUser = User.get(); return cb(user); }, function(err) { this.logout(); return cb(err); }.bind(this)).$promise; }, /** * Change password * * @param {String} oldPassword * @param {String} newPassword * @param {Function} callback - optional * @return {Promise} */ changePassword: function(oldPassword, newPassword, callback) { var cb = callback || angular.noop; return User.changePassword({ id: currentUser._id }, { oldPassword: oldPassword, newPassword: newPassword }, function(user) { return cb(user); }, function(err) { return cb(err); }).$promise; }, /** * Gets all available info on authenticated user * * @return {Object} user */ getCurrentUser: function() { return currentUser; }, /** * Check if a user is logged in * * @return {Boolean} */ isLoggedIn: function() { return currentUser.hasOwnProperty('role'); }, /** * Waits for currentUser to resolve before checking if user is logged in */ isLoggedInAsync: function(cb) { if(currentUser.hasOwnProperty('$promise')) { currentUser.$promise.then(function() { cb(true); }).catch(function() { cb(false); }); } else if(currentUser.hasOwnProperty('role')) { cb(true); } else { cb(false); } }, /** * Check if a user is an admin * * @return {Boolean} */ isAdmin: function() { return currentUser.role === 'admin'; }, /** * Get auth token */ getToken: function() { return $cookieStore.get('token'); } }; });
henrikre/terminaali
client/components/auth/auth.service.js
JavaScript
mit
3,575
$(document).ready(function(){ var toggleMuffEditor = function(stat=false){ $("#muff-opt").remove(); // bind event if(stat){ $(".muff").mouseover(function() { $("#muff-opt").remove(); muffShowOptions($(this)); $(window).scroll(function(){ $("#muff-opt").remove(); }) }); }else{// unbind event $(".muff").unbind("mouseover"); } }; function muffShowOptions( e ){ var t = ""; var id = e.attr("data-muff-id"); var title = e.attr("data-muff-title"); var p = e.offset(); var opttop = p.top + 15; var optleft = p.left + 5; if(e.hasClass("muff-div")){ t="div"; }else if(e.hasClass("muff-text")){ t="text"; }else if(e.hasClass("muff-a")){ t="link"; }else if(e.hasClass("muff-img")){ t="image"; } if(!title){ title = t;} // check position is beyond document if((p.left + 25 + 75) > $(window).width()){ optleft -= 75; } var opt = "<div id='muff-opt' style='position:absolute;top:"+opttop+"px;left:"+optleft+"px;z-index:99998;display:none;'>"; opt += "<a href='admin/"+t+"/"+id+"/edit' class='mbtn edit'></a>"; opt += "<a href='admin/"+t+"/delete/' class='mbtn delete' data-mod='"+t+"' data-id='"+id+"'></a>"; opt += "<span>"+title+"</span>"; opt += "</div>"; $("body").prepend(opt); $("#muff-opt").slideDown(300); $("body").find("#muff-opt > a.delete").click(function(e){ var path = $(this).attr('href'); var mod = $(this).attr('data-mod'); // e.preventDefault(); swal({ title: "Are you sure?", text: "You are about to delete this "+mod, type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "Cancel", closeOnConfirm: true, closeOnCancel: true }, function(isConfirm){ if (isConfirm) { // window.location.href = path; proceedDelete(path, id); } }); return false; }); } toggleMuffEditor(false); // set checkbox editor event $("input[name=cb-muff-editor]").click(function(){ if($(this).is(':checked')){ toggleMuffEditor(true); } else{ toggleMuffEditor(false) } }); function proceedDelete(path, id){ var newForm = jQuery('<form>', { 'action': path, 'method': 'POST', 'target': '_top' }).append(jQuery('<input>', { 'name': '_token', 'value': $("meta[name=csrf-token]").attr("content"), 'type': 'hidden' })).append(jQuery('<input>', { 'name': 'id', 'value': id, 'type': 'hidden' })); newForm.hide().appendTo("body").submit(); } // $(".opt-div a.delete, .w-conf a.delete, .w-conf-hvr a.delete").click(function(e){ // var path = $(this).attr('href'); // var mod = $(this).attr('data-mod'); // // e.preventDefault(); // swal({ // title: "Are you sure?", // text: "You are about to delete this "+mod, // type: "warning", // showCancelButton: true, // confirmButtonColor: "#DD6B55", // confirmButtonText: "Yes, delete it!", // cancelButtonText: "Cancel", // closeOnConfirm: true, // closeOnCancel: true // }, // function(isConfirm){ // if (isConfirm) { // window.location.href = path; // } // }); // return false; // }); // top nav click $(".top-nav>li").click(function(){ var i = $(this).find('.dropdown-menu'); toggleClassExcept('.top-nav .dropdown-menu', 'rmv', 'active', i); i.toggleClass("active"); }); /** toggle a certain class except the given object * works with li and lists * @param id identifier * @param a action * @param c class * @param ex object */ function toggleClassExcept(id, a, c, ex){ $(id).each(function(){ switch(a){ case 'remove': case 'rmv': if(!$(this).is(ex)) $(this).removeClass(c); break; case 'add': if(!$(this).is(ex)) $(this).addClass(c); break; default: break; } }); } $(".w-add .muff-add").click(function(event){ event.preventDefault(); var b = $(this); var newForm = jQuery('<form>', { 'action': b.data('href'), 'method': 'GET', 'target': '_top' }).append(jQuery('<input>', { 'name': '_token', 'value': $("meta[name=csrf-token]").attr("content"), 'type': 'hidden' })).append(jQuery('<input>', { 'name': 'url', 'value': $("meta[name=muffin-url]").attr("content"), 'type': 'hidden' })).append(jQuery('<input>', { 'name': 'location', 'value': b.data("loc"), 'type': 'hidden' })); // console.log(newForm); newForm.hide().appendTo("body").submit(); }) // TAGs //var tagArea = '.tag-area'; if($('.tagarea')[0]){ var backSpace; var close = '<a class="close"></a>'; var PreTags = $('.tagarea').val().trim().split(" "); $('.tagarea').after('<ul class="tag-box"></ul>'); for (i=0 ; i < PreTags.length; i++ ){ var pretag = PreTags[i].split("_").join(" "); if($('.tagarea').val().trim() != "" ) $('.tag-box').append('<li class="tags"><input type="hidden" name="tags[]" value="'+pretag+'">'+pretag+close+'</li>'); } $('.tag-box').append('<li class="new-tag"><input class="input-tag" type="text"></li>'); // unbind submit form when pressing enter $('.input-tag').on('keyup keypress', function(e) { var keyCode = e.keyCode || e.which; if (keyCode === 13) { e.preventDefault(); return false; } }); // Taging $('.input-tag').bind("keydown", function (kp) { var tag = $('.input-tag').val().trim(); if(tag.length > 0){ $(".tags").removeClass("danger"); if(kp.keyCode == 13 || kp.keyCode == 9){ $(".new-tag").before('<li class="tags"><input type="hidden" name="tags[]" value="'+tag+'">'+tag+close+'</li>'); $(this).val(''); }} else {if(kp.keyCode == 8 ){ if($(".new-tag").prev().hasClass("danger")){ $(".new-tag").prev().remove(); }else{ $(".new-tag").prev().addClass("danger"); } } } }); //Delete tag $(".tag-box").on("click", ".close", function() { $(this).parent().remove(); }); $(".tag-box").click(function(){ $('.input-tag').focus(); }); // Edit $('.tag-box').on("dblclick" , ".tags", function(cl){ var tags = $(this); var tag = tags.text().trim(); $('.tags').removeClass('edit'); tags.addClass('edit'); tags.html('<input class="input-tag" value="'+tag+'" type="text">') $(".new-tag").hide(); tags.find('.input-tag').focus(); tag = $(this).find('.input-tag').val() ; $('.tags').dblclick(function(){ tags.html(tag + close); $('.tags').removeClass('edit'); $(".new-tag").show(); }); tags.find('.input-tag').bind("keydown", function (edit) { tag = $(this).val() ; if(edit.keyCode == 13){ $(".new-tag").show(); $('.input-tag').focus(); $('.tags').removeClass('edit'); if(tag.length > 0){ tags.html('<input type="hidden" name="tags[]" value="'+tag+'">'+tag + close); } else{ tags.remove(); } } }); }); } // sorting // $(function() { // $( ".tag-box" ).sortable({ // items: "li:not(.new-tag)", // containment: "parent", // scrollSpeed: 100 // }); // $( ".tag-box" ).disableSelection(); // }); });
johnguild/muffincms
src/Public/main/js/muffincms.js
JavaScript
mit
7,581
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = undefined; var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); 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 _objectAssign = require('object-assign'); var _objectAssign2 = _interopRequireDefault(_objectAssign); var _rcTable = require('rc-table'); var _rcTable2 = _interopRequireDefault(_rcTable); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var __assign = undefined && undefined.__assign || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } } return t; }; var Table = function (_React$Component) { (0, _inherits3["default"])(Table, _React$Component); function Table() { (0, _classCallCheck3["default"])(this, Table); return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments)); } Table.prototype.render = function render() { var _props = this.props, columns = _props.columns, dataSource = _props.dataSource, direction = _props.direction, scrollX = _props.scrollX, titleFixed = _props.titleFixed; var _props2 = this.props, style = _props2.style, className = _props2.className; var restProps = (0, _objectAssign2["default"])({}, this.props); ['style', 'className'].forEach(function (prop) { if (restProps.hasOwnProperty(prop)) { delete restProps[prop]; } }); var table = void 0; // 默认纵向 if (!direction || direction === 'vertical') { if (titleFixed) { table = _react2["default"].createElement(_rcTable2["default"], __assign({}, restProps, { columns: columns, data: dataSource, className: "am-table", scroll: { x: true }, showHeader: false })); } else { table = _react2["default"].createElement(_rcTable2["default"], __assign({}, restProps, { columns: columns, data: dataSource, className: "am-table", scroll: { x: scrollX } })); } } else if (direction === 'horizon') { columns[0].className = 'am-table-horizonTitle'; table = _react2["default"].createElement(_rcTable2["default"], __assign({}, restProps, { columns: columns, data: dataSource, className: "am-table", showHeader: false, scroll: { x: scrollX } })); } else if (direction === 'mix') { columns[0].className = 'am-table-horizonTitle'; table = _react2["default"].createElement(_rcTable2["default"], __assign({}, restProps, { columns: columns, data: dataSource, className: "am-table", scroll: { x: scrollX } })); } return _react2["default"].createElement("div", { className: className, style: style }, table); }; return Table; }(_react2["default"].Component); exports["default"] = Table; Table.defaultProps = { dataSource: [], prefixCls: 'am-table' }; module.exports = exports['default'];
forwk1990/wechart-checkin
antd-mobile-custom/antd-mobile/lib/table/index.web.js
JavaScript
mit
3,649
using System.ComponentModel; namespace NSysmon.Collector.HAProxy { /// <summary> /// Current server statuses /// </summary> public enum ProxyServerStatus { [Description("Status Unknown!")] None = 0, //Won't be populated for backends [Description("Server is up, status normal.")] ActiveUp = 2, [Description("Server has not responded to checks in a timely manner, going down.")] ActiveUpGoingDown = 8, [Description("Server is responsive and recovering.")] ActiveDownGoingUp = 6, [Description("Backup server is up, status normal.")] BackupUp = 3, [Description("Backup server has not responded to checks in a timely manner, going down.")] BackupUpGoingDown = 9, [Description("Backup server is responsive and recovering.")] BackupDownGoingUp = 7, [Description("Server is not checked.")] NotChecked = 4, [Description("Server is down and receiving no requests.")] Down = 10, [Description("Server is in maintenance and receiving no requests.")] Maintenance = 5, [Description("Front end is open to receiving requests.")] Open = 1 } public static class ProxyServerStatusExtensions { public static string ShortDescription(this ProxyServerStatus status) { switch (status) { case ProxyServerStatus.ActiveUp: return "Active"; case ProxyServerStatus.ActiveUpGoingDown: return "Active (Up -> Down)"; case ProxyServerStatus.ActiveDownGoingUp: return "Active (Down -> Up)"; case ProxyServerStatus.BackupUp: return "Backup"; case ProxyServerStatus.BackupUpGoingDown: return "Backup (Up -> Down)"; case ProxyServerStatus.BackupDownGoingUp: return "Backup (Down -> Up)"; case ProxyServerStatus.NotChecked: return "Not Checked"; case ProxyServerStatus.Down: return "Down"; case ProxyServerStatus.Maintenance: return "Maintenance"; case ProxyServerStatus.Open: return "Open"; //case ProxyServerStatus.None: default: return "Unknown"; } } public static bool IsBad(this ProxyServerStatus status) { switch (status) { case ProxyServerStatus.ActiveUpGoingDown: case ProxyServerStatus.BackupUpGoingDown: case ProxyServerStatus.Down: return true; default: return false; } } } }
clearwavebuild/nsysmon
NSysmon.Collector/HAProxy/ProxyServerStatus.cs
C#
mit
2,906
import datetime from django.contrib.contenttypes.models import ContentType from django.utils import timezone from .models import Action def create_action(user, verb, target=None): now = timezone.now() last_minute = now - datetime.timedelta(seconds=60) similar_actions = Action.objects.filter(user_id=user.id, verb=verb, created__gte=last_minute) if target: target_ct = ContentType.objects.get_for_model(target) similar_actions = Action.objects.filter(target_ct=target_ct, target_id=target.id) if not similar_actions: action = Action(user=user, verb=verb, target=target) action.save() return True return False
EssaAlshammri/django-by-example
bookmarks/bookmarks/actions/utils.py
Python
mit
679
package engine; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; public class CircleShape extends Shape { double radius; //radius of shape public CircleShape(double rad, Vector2D v, double r, double d, Color c) { super(v, r, d, c); radius = rad; } @Override public void calculateInertia() { mass = radius * radius * Math.PI * density; inertia = radius * radius * mass; } @Override public void paint(Graphics2D g) { super.paint(g); vector.readyPoint(); g.fillOval((int) (x - radius), (int) (y - radius), (int) radius * 2, (int) radius * 2); g.drawOval((int) (x - radius), (int) (y - radius), (int) radius * 2, (int) radius * 2); g.setColor(Color.BLACK); g.drawLine((int) (x), (int) (y), (int) (x + Math.cos(rotation) * radius), (int) (y + Math.sin(rotation) * radius)); } @Override public boolean contains(Point.Double p) { return p.distanceSq(x, y) < radius * radius; } }
bjornenalfa/GA
src/engine/CircleShape.java
Java
mit
1,041
<?xml version="1.0" ?><!DOCTYPE TS><TS language="ms_MY" version="2.1"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+39"/> <source>&lt;b&gt;DarkSwift&lt;/b&gt; version</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The DarkSwift developers</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Double-click to edit address or label</source> <translation>Klik dua kali untuk mengubah alamat atau label</translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>Cipta alamat baru</translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Salin alamat terpilih ke dalam sistem papan klip</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation type="unfinished"/> </message> <message> <location line="-46"/> <source>These are your DarkSwift addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>&amp;Copy Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a DarkSwift address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Verify a message to ensure it was signed with a specified DarkSwift address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>&amp;Padam</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+65"/> <source>Copy &amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Edit</source> <translation type="unfinished"/> </message> <message> <location line="+250"/> <source>Export Address Book Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Fail yang dipisahkan dengan koma</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation>Alamat</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation type="unfinished"/> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+33"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>For staking only</source> <translation type="unfinished"/> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+35"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"/> </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 type="unfinished"/> </message> <message> <location line="+103"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation type="unfinished"/> </message> <message> <location line="-133"/> <location line="+60"/> <source>Wallet encrypted</source> <translation type="unfinished"/> </message> <message> <location line="-58"/> <source>DarkSwift will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+44"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation type="unfinished"/> </message> <message> <location line="-56"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <location line="+50"/> <source>The supplied passphrases do not match.</source> <translation type="unfinished"/> </message> <message> <location line="-38"/> <source>Wallet unlock failed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+12"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation type="unfinished"/> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+282"/> <source>Sign &amp;message...</source> <translation type="unfinished"/> </message> <message> <location line="+251"/> <source>Synchronizing with network...</source> <translation type="unfinished"/> </message> <message> <location line="-319"/> <source>&amp;Overview</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>&amp;Transactions</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>&amp;Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit the list of stored addresses and labels</source> <translation type="unfinished"/> </message> <message> <location line="-13"/> <source>&amp;Receive coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show the list of addresses for receiving payments</source> <translation type="unfinished"/> </message> <message> <location line="-7"/> <source>&amp;Send coins</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>E&amp;xit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Quit application</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show information about DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>Pilihan</translation> </message> <message> <location line="+4"/> <source>&amp;Encrypt Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+259"/> <source>~%n block(s) remaining</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation type="unfinished"/> </message> <message> <location line="-256"/> <source>&amp;Export...</source> <translation type="unfinished"/> </message> <message> <location line="-64"/> <source>Send coins to a DarkSwift address</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Modify configuration options for DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Encrypt or decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup wallet to another location</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>&amp;Verify message...</source> <translation type="unfinished"/> </message> <message> <location line="-202"/> <source>DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+180"/> <source>&amp;About DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>&amp;File</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>&amp;Settings</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Tabs toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Actions toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+9"/> <source>[testnet]</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+60"/> <source>DarkSwift client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+75"/> <source>%n active connection(s) to DarkSwift network</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+40"/> <source>Downloaded %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+413"/> <source>Staking.&lt;br&gt;Your weight is %1&lt;br&gt;Network weight is %2&lt;br&gt;Expected time to earn reward is %3</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Not staking because wallet is locked</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is syncing</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because you don&apos;t have mature coins</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-403"/> <source>%n second(s) ago</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="-312"/> <source>About DarkSwift card</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about DarkSwift card</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>&amp;Unlock Wallet...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+297"/> <source>%n minute(s) ago</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s) ago</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s) ago</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Up to date</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Catching up...</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Last received block was generated %1.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Sent transaction</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <location line="+15"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <location line="+15"/> <source>URI can not be parsed! This can be caused by an invalid DarkSwift address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+76"/> <source>%n second(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+18"/> <source>Not staking</source> <translation type="unfinished"/> </message> <message> <location filename="../bitcoin.cpp" line="+109"/> <source>A fatal error occurred. DarkSwift can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+90"/> <source>Network Alert</source> <translation type="unfinished"/> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation type="unfinished"/> </message> <message> <location line="+48"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Priority:</source> <translation type="unfinished"/> </message> <message> <location line="+48"/> <source>Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation type="unfinished"/> </message> <message> <location filename="../coincontroldialog.cpp" line="+551"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Change:</source> <translation type="unfinished"/> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>List mode</source> <translation type="unfinished"/> </message> <message> <location line="+45"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Address</source> <translation>Alamat</translation> </message> <message> <location line="+5"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Priority</source> <translation type="unfinished"/> </message> <message> <location filename="../coincontroldialog.cpp" line="-515"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy change</source> <translation type="unfinished"/> </message> <message> <location line="+317"/> <source>highest</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>high</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>medium-high</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>low-medium</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>low</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>lowest</source> <translation type="unfinished"/> </message> <message> <location line="+155"/> <source>DUST</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>yes</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+66"/> <source>(no label)</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>(change)</source> <translation type="unfinished"/> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Alamat</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>Alamat</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation type="unfinished"/> </message> <message> <location filename="../editaddressdialog.cpp" line="+20"/> <source>New receiving address</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>New sending address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid DarkSwift address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation type="unfinished"/> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+420"/> <location line="+12"/> <source>DarkSwift-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Reserve</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start DarkSwift after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start DarkSwift on system login</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Detach databases at shutdown</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Network</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Automatically open the DarkSwift client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Connect to the DarkSwift network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation type="unfinished"/> </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 type="unfinished"/> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting DarkSwift.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Whether to show DarkSwift addresses in the transaction list or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Whether to show coin control features or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Display coin &amp;control features (experts only!)</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+55"/> <source>default</source> <translation type="unfinished"/> </message> <message> <location line="+149"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting DarkSwift.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation type="unfinished"/> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+33"/> <location line="+231"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the DarkSwift network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-160"/> <source>Stake:</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation type="unfinished"/> </message> <message> <location line="-107"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Spendable:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current spendable balance</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>Immature:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Total:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current total balance</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-108"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Total of coins that was staked, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+113"/> <location line="+1"/> <source>out of sync</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+348"/> <source>N/A</source> <translation type="unfinished"/> </message> <message> <location line="-217"/> <source>Client version</source> <translation type="unfinished"/> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation type="unfinished"/> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Startup time</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Last block time</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the DarkSwift-Qt help message to get a list with possible DarkSwift command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation type="unfinished"/> </message> <message> <location line="-260"/> <source>Build date</source> <translation type="unfinished"/> </message> <message> <location line="-104"/> <source>DarkSwift - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>DarkSwift Core</source> <translation type="unfinished"/> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Open the DarkSwift debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation type="unfinished"/> </message> <message> <location filename="../rpcconsole.cpp" line="-33"/> <source>Welcome to the DarkSwift RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+182"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>Coin Control Features</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Inputs...</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>automatically selected</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Insufficient funds!</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Quantity:</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <location line="+35"/> <source>0</source> <translation type="unfinished"/> </message> <message> <location line="-19"/> <source>Bytes:</source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <location line="+86"/> <location line="+86"/> <location line="+32"/> <source>0.00 BOST</source> <translation type="unfinished"/> </message> <message> <location line="-191"/> <source>Priority:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>After Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Change</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>custom change address</source> <translation type="unfinished"/> </message> <message> <location line="+106"/> <source>Send to multiple recipients at once</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Balance:</source> <translation>Baki</translation> </message> <message> <location line="+16"/> <source>123.456 BOST</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-173"/> <source>Enter a DarkSwift address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Copy quantity</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy change</source> <translation type="unfinished"/> </message> <message> <location line="+86"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+251"/> <source>WARNING: Invalid DarkSwift address</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>(no label)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>WARNING: unknown change address</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <location filename="../sendcoinsentry.cpp" line="+25"/> <source>Enter a label for this address to add it to your address book</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Label:</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to send the payment to (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a DarkSwift address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+124"/> <source>&amp;Sign Message</source> <translation type="unfinished"/> </message> <message> <location line="-118"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+203"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-193"/> <location line="+203"/> <source>Alt+A</source> <translation type="unfinished"/> </message> <message> <location line="-193"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Copy the current signature to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this DarkSwift address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all sign message fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <location line="+70"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="-64"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified DarkSwift address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all verify message fields</source> <translation type="unfinished"/> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a DarkSwift address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Enter DarkSwift signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation type="unfinished"/> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+19"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-2"/> <source>Open for %n block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+8"/> <source>conflicted</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Status</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Source</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Generated</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation type="unfinished"/> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>label</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation type="unfinished"/> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Net amount</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Message</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Comment</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated coins must mature 510 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 &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Transaction</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Inputs</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>true</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>false</source> <translation type="unfinished"/> </message> <message> <location line="-211"/> <source>, has not been successfully broadcast yet</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>unknown</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+226"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation>Alamat</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Offline</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Received from</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation type="unfinished"/> </message> <message> <location line="+190"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+55"/> <location line="+16"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Today</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This week</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Last month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This year</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Range...</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>To yourself</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Min amount</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+144"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Fail yang dipisahkan dengan koma</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Address</source> <translation>Alamat</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>ID</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <source>Range:</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>to</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+206"/> <source>Sending...</source> <translation type="unfinished"/> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+33"/> <source>DarkSwift version</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send command to -server or DarkSwiftd</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>List commands</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Options:</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify configuration file (default: DarkSwift.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify pid file (default: DarkSwiftd.pid)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Set database cache size in megabytes (default: 25)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Listen for connections on &lt;port&gt; (default: 15714 or testnet: 25714)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Stake your coins to support network and gain reward (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Detach block and address databases. Increases shutdown time (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 15715 or testnet: 25715)</source> <translation type="unfinished"/> </message> <message> <location line="-11"/> <source>Accept command line and JSON-RPC commands</source> <translation type="unfinished"/> </message> <message> <location line="+101"/> <source>Error: Transaction creation failed </source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: Wallet locked, unable to create transaction </source> <translation type="unfinished"/> </message> <message> <location line="-8"/> <source>Importing blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Importing bootstrap blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="-88"/> <source>Run in the background as a daemon and accept commands</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation type="unfinished"/> </message> <message> <location line="-24"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation type="unfinished"/> </message> <message> <location line="-38"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+117"/> <source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+61"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong DarkSwift will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="-31"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="-18"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation type="unfinished"/> </message> <message> <location line="-30"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Block creation options:</source> <translation type="unfinished"/> </message> <message> <location line="-62"/> <source>Connect only to the specified node(s)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation type="unfinished"/> </message> <message> <location line="+94"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation type="unfinished"/> </message> <message> <location line="-90"/> <source>Find peers using DNS lookup (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync checkpoints policy (default: strict)</source> <translation type="unfinished"/> </message> <message> <location line="+83"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-82"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation type="unfinished"/> </message> <message> <location line="-16"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation type="unfinished"/> </message> <message> <location line="-74"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation type="unfinished"/> </message> <message> <location line="-42"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Unable to sign checkpoint, wrong checkpointkey? </source> <translation type="unfinished"/> </message> <message> <location line="-80"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Username for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Verifying database integrity...</source> <translation type="unfinished"/> </message> <message> <location line="+57"/> <source>WARNING: syncronized checkpoint violation detected, but skipped!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation type="unfinished"/> </message> <message> <location line="-48"/> <source>wallet.dat corrupt, salvage failed</source> <translation type="unfinished"/> </message> <message> <location line="-54"/> <source>Password for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-84"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=DarkSwiftrpc 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 &quot;DarkSwift Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Find peers using internet relay chat (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+53"/> <source>Error: Wallet unlocked for staking only, unable to create transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source> <translation type="unfinished"/> </message> <message> <location line="-158"/> <source>This help message</source> <translation type="unfinished"/> </message> <message> <location line="+95"/> <source>Wallet %s resides outside data directory %s.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot obtain a lock on data directory %s. DarkSwift is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-98"/> <source>DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+140"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation type="unfinished"/> </message> <message> <location line="-130"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation type="unfinished"/> </message> <message> <location line="+122"/> <source>Loading addresses...</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Error loading blkindex.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of DarkSwift</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart DarkSwift to complete</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="-16"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-24"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <source>Error: could not start node</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sending...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation type="unfinished"/> </message> <message> <location line="-34"/> <source>Loading block index...</source> <translation type="unfinished"/> </message> <message> <location line="-103"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation type="unfinished"/> </message> <message> <location line="+122"/> <source>Unable to bind to %s on this computer. DarkSwift is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-97"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+55"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Loading wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot initialize keypool</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Done loading</source> <translation type="unfinished"/> </message> <message> <location line="-167"/> <source>To use the %s option</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation type="unfinished"/> </message> </context> </TS>
DarkSwift/DarkSwift
src/qt/locale/bitcoin_ms_MY.ts
TypeScript
mit
107,393
# -*- coding: utf-8 -*- # # RedPipe documentation build configuration file, created by # sphinx-quickstart on Wed Apr 19 13:22:45 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. import os import sys from os import path ROOTDIR = path.abspath(os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, ROOTDIR) import redpipe # noqa extensions = [ 'alabaster', 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = u'RedPipe' copyright = u'2017, John Loehrer' author = u'John Loehrer' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = redpipe.__version__ # The full version, including alpha/beta/rc tags. release = redpipe.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = { 'logo': 'redpipe-logo.gif', 'github_banner': True, 'github_user': '72squared', 'github_repo': 'redpipe', 'travis_button': True, 'analytics_id': 'UA-98626018-1', } html_sidebars = { '**': [ 'about.html', 'navigation.html', 'relations.html', 'searchbox.html', ] } # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. htmlhelp_basename = 'RedPipedoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'RedPipe.tex', u'%s Documentation' % project, u'John Loehrer', 'manual'), ] # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, project, u'%s Documentation' % project, [author], 1) ] # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, project, u'%s Documentation' % project, author, project, 'making redis pipelines easy in python', 'Miscellaneous'), ] suppress_warnings = ['image.nonlocal_uri']
72squared/redpipe
docs/conf.py
Python
mit
5,400
import { assign, forEach, isArray } from 'min-dash'; var abs= Math.abs, round = Math.round; var TOLERANCE = 10; export default function BendpointSnapping(eventBus) { function snapTo(values, value) { if (isArray(values)) { var i = values.length; while (i--) if (abs(values[i] - value) <= TOLERANCE) { return values[i]; } } else { values = +values; var rem = value % values; if (rem < TOLERANCE) { return value - rem; } if (rem > values - TOLERANCE) { return value - rem + values; } } return value; } function mid(element) { if (element.width) { return { x: round(element.width / 2 + element.x), y: round(element.height / 2 + element.y) }; } } // connection segment snapping ////////////////////// function getConnectionSegmentSnaps(context) { var snapPoints = context.snapPoints, connection = context.connection, waypoints = connection.waypoints, segmentStart = context.segmentStart, segmentStartIndex = context.segmentStartIndex, segmentEnd = context.segmentEnd, segmentEndIndex = context.segmentEndIndex, axis = context.axis; if (snapPoints) { return snapPoints; } var referenceWaypoints = [ waypoints[segmentStartIndex - 1], segmentStart, segmentEnd, waypoints[segmentEndIndex + 1] ]; if (segmentStartIndex < 2) { referenceWaypoints.unshift(mid(connection.source)); } if (segmentEndIndex > waypoints.length - 3) { referenceWaypoints.unshift(mid(connection.target)); } context.snapPoints = snapPoints = { horizontal: [] , vertical: [] }; forEach(referenceWaypoints, function(p) { // we snap on existing bendpoints only, // not placeholders that are inserted during add if (p) { p = p.original || p; if (axis === 'y') { snapPoints.horizontal.push(p.y); } if (axis === 'x') { snapPoints.vertical.push(p.x); } } }); return snapPoints; } eventBus.on('connectionSegment.move.move', 1500, function(event) { var context = event.context, snapPoints = getConnectionSegmentSnaps(context), x = event.x, y = event.y, sx, sy; if (!snapPoints) { return; } // snap sx = snapTo(snapPoints.vertical, x); sy = snapTo(snapPoints.horizontal, y); // correction x/y var cx = (x - sx), cy = (y - sy); // update delta assign(event, { dx: event.dx - cx, dy: event.dy - cy, x: sx, y: sy }); }); // bendpoint snapping ////////////////////// function getBendpointSnaps(context) { var snapPoints = context.snapPoints, waypoints = context.connection.waypoints, bendpointIndex = context.bendpointIndex; if (snapPoints) { return snapPoints; } var referenceWaypoints = [ waypoints[bendpointIndex - 1], waypoints[bendpointIndex + 1] ]; context.snapPoints = snapPoints = { horizontal: [] , vertical: [] }; forEach(referenceWaypoints, function(p) { // we snap on existing bendpoints only, // not placeholders that are inserted during add if (p) { p = p.original || p; snapPoints.horizontal.push(p.y); snapPoints.vertical.push(p.x); } }); return snapPoints; } eventBus.on('bendpoint.move.move', 1500, function(event) { var context = event.context, snapPoints = getBendpointSnaps(context), target = context.target, targetMid = target && mid(target), x = event.x, y = event.y, sx, sy; if (!snapPoints) { return; } // snap sx = snapTo(targetMid ? snapPoints.vertical.concat([ targetMid.x ]) : snapPoints.vertical, x); sy = snapTo(targetMid ? snapPoints.horizontal.concat([ targetMid.y ]) : snapPoints.horizontal, y); // correction x/y var cx = (x - sx), cy = (y - sy); // update delta assign(event, { dx: event.dx - cx, dy: event.dy - cy, x: event.x - cx, y: event.y - cy }); }); } BendpointSnapping.$inject = [ 'eventBus' ];
pedesen/diagram-js
lib/features/bendpoints/BendpointSnapping.js
JavaScript
mit
4,283
var changeSpan; var i = 0; var hobbies = [ 'Music', 'HTML5', 'Learning', 'Exploring', 'Art', 'Teaching', 'Virtual Reality', 'The Cosmos', 'Unity3D', 'Tilemaps', 'Reading', 'Butterscotch', 'Drawing', 'Taking Photos', 'Smiles', 'The Poetics of Space', 'Making Sounds', 'Board games', 'Travelling', 'Sweetened condensed milk' ]; function changeWord() { changeSpan.textContent = hobbies[i]; i++; if (i >= hobbies.length) i = 0; } function init() { console.log('initialising scrolling text'); changeSpan = document.getElementById("scrollingText"); nIntervId = setInterval(changeWord, 950); changeWord(); } if (document.addEventListener) { init(); } else { init(); }
oddgoo/oddgoo.com
static/js/hobbies.js
JavaScript
mit
725
<?php namespace App\Http\ViewComposers; use App\Models\Character; use App\Models\Message; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Arr; use Illuminate\Support\Facades\Auth; use Illuminate\View\View; class CharacterMessagesComposer { /** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $data = $view->getData(); /** @var Character $currentCharacter */ /** @var Character $otherCharacter */ $currentCharacter = Auth::user()->character; $otherCharacter = Arr::get($data, 'character'); $messages = Message::query()->where(function (Builder $query) use ($currentCharacter, $otherCharacter) { $query->where([ 'to_id' => $currentCharacter->id, 'from_id' => $otherCharacter->id, ]); })->orWhere(function (Builder $query) use ($currentCharacter, $otherCharacter) { $query->where([ 'to_id' => $otherCharacter->id, 'from_id' => $currentCharacter->id, ]); })->orderByDesc('created_at')->paginate(5); $otherCharacter->sentMessages()->whereIn('id', $messages->pluck('id'))->markAsRead(); $contentLimit = Message::CONTENT_LIMIT; $view->with(compact('messages', 'currentCharacter', 'otherCharacter', 'contentLimit')); } }
mchekin/rpg
app/Http/ViewComposers/CharacterMessagesComposer.php
PHP
mit
1,435
from src.tools.dictionaries import PostLoadedDict # Utility class ################################################ class ServerImplementationDict(PostLoadedDict): def __missing__(self, key): try: return super().__missing__(key) except KeyError: return NotImplemented ################################################ class Server(): def __init__(self, shortname, loader): # Not preloaded # loaders must produce dictionaries (or an appropriate iterable) # with the required keys. # The reason for this is that code for certain servers need not be loaded # if it's not going to be used at all # It also prevents import loop collisions. global __ServerImplementationDict self.__data = ServerImplementationDict(loader) self.__shortname = shortname @property def shortname(self): # This is the only property provided from above return self.__shortname def __str__(self): return str(self.__shortname) # All other properties must come from canonical sources # provided by the server loader # CONSTANTS (STRINGS, BOOLEANS, INTS, ETC.) @property def name(self): return self.__data['str_name'] @property def internal_shortname(self): return self.__data['str_shortname'] @property def beta(self): return self.__data['bool_tester'] # CLASSES # 1- Credentials: @property def Auth(self): # I really don't know how to call this. return self.__data['cls_auth'] @property def auth_fields(self): return self.__data['list_authkeys'] # 2- Server Elements: @property def Player(self): return self.__data['cls_player'] @property def Tournament(self): return self.__data['cls_tournament']
juanchodepisa/sbtk
SBTK_League_Helper/src/interfacing/servers.py
Python
mit
1,946
import { GraphQLInputObjectType, GraphQLID, GraphQLList, GraphQLBoolean, } from 'graphql'; import RecipientTypeEnum from './RecipientTypeEnum'; import MessageTypeEnum from './MessageTypeEnum'; import NoteInputType from './NoteInputType'; import TranslationInputType from './TranslationInputType'; import CommunicationInputType from './CommunicationInputType'; const MessageInputType = new GraphQLInputObjectType({ name: 'MessageInput', fields: { parentId: { type: GraphQLID, }, note: { type: NoteInputType, }, communication: { type: CommunicationInputType, }, subject: { type: TranslationInputType, }, enforceEmail: { type: GraphQLBoolean, }, isDraft: { type: GraphQLBoolean, }, recipients: { type: new GraphQLList(GraphQLID), }, recipientType: { type: RecipientTypeEnum }, messageType: { type: MessageTypeEnum }, }, }); export default MessageInputType;
nambawan/g-old
src/data/types/MessageInputType.js
JavaScript
mit
979
require "rubygems" require 'active_support' require "ruby-debug" gem 'test-unit' require "test/unit" require 'active_support' require 'active_support/test_case' require 'shoulda' require 'rr' require File.dirname(__FILE__) + '/../lib/ubiquitously' Ubiquitously.configure("test/config/secrets.yml") Passport.configure("test/config/tokens.yml") ActiveSupport::TestCase.class_eval do def create_user(options) @user = Ubiquitously::User.new(options.merge(:username => "viatropos")) end end
lancejpollard/ubiquitously
test/test_helper.rb
Ruby
mit
497
#include <boost/lexical_cast.hpp> #include <disccord/models/user.hpp> namespace disccord { namespace models { user::user() : username(""), avatar(), email(), discriminator(0), bot(false), mfa_enabled(), verified() { } user::~user() { } void user::decode(web::json::value json) { entity::decode(json); username = json.at("username").as_string(); // HACK: use boost::lexical_cast here since it safely // validates values auto str_js = json.at("discriminator"); discriminator = boost::lexical_cast<uint16_t>(str_js.as_string()); #define get_field(var, conv) \ if (json.has_field(#var)) { \ auto field = json.at(#var); \ if (!field.is_null()) { \ var = decltype(var)(field.conv()); \ } else { \ var = decltype(var)::no_value(); \ } \ } else { \ var = decltype(var)(); \ } get_field(avatar, as_string); bot = json.at("bot").as_bool(); //get_field(bot, as_bool); get_field(mfa_enabled, as_bool); get_field(verified, as_bool); get_field(email, as_string); #undef get_field } void user::encode_to(std::unordered_map<std::string, web::json::value> &info) { entity::encode_to(info); info["username"] = web::json::value(get_username()); info["discriminator"] = web::json::value(std::to_string(get_discriminator())); if (get_avatar().is_specified()) info["avatar"] = get_avatar(); info["bot"] = web::json::value(get_bot()); if (get_mfa_enabled().is_specified()) info["mfa_enabled"] = get_mfa_enabled(); if (get_verified().is_specified()) info["verified"] = get_verified(); if (get_email().is_specified()) info["email"] = get_email(); } #define define_get_method(field_name) \ decltype(user::field_name) user::get_##field_name() { \ return field_name; \ } define_get_method(username) define_get_method(discriminator) define_get_method(avatar) define_get_method(bot) define_get_method(mfa_enabled) define_get_method(verified) define_get_method(email) util::optional<std::string> user::get_avatar_url() { if (get_avatar().is_specified()) { std::string url = "https://cdn.discordapp.com/avatars/" + std::to_string(get_id()) + "/" + get_avatar().get_value()+".png?size=1024"; return util::optional<std::string>(url); } else return util::optional<std::string>::no_value(); } #undef define_get_method } }
FiniteReality/disccord
lib/models/user.cpp
C++
mit
3,213
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ASPPatterns.Chap7.Library.Services.Views; namespace ASPPatterns.Chap7.Library.Services.Messages { public class FindMembersResponse : ResponseBase { public IEnumerable<MemberView> MembersFound { get; set; } } }
liqipeng/helloGithub
Book-Code/ASP.NET Design Pattern/ASPPatternsc07/ASPPatterns.Chap7.Library/ASPPatterns.Chap7.Library.Services/Messages/FindMembersResponse.cs
C#
mit
327
let _ = require('underscore'), React = require('react'); class Icon extends React.Component { render() { let className = "icon " + this.props.icon; let other = _.omit(this.props.icon, "icon"); return ( <span className={className} role="img" {...other}></span> ); } } Icon.propTypes = { icon: React.PropTypes.string.isRequired }; module.exports = Icon;
legendary-code/chaos-studio-web
app/src/js/components/Icon.js
JavaScript
mit
433
using System.IO; namespace Mandro.Utils.Setup { public class DirectoryHelper { public DirectoryHelper() { } public static void CopyDirectory(string sourceDirName, string destDirName, bool copySubDirs) { // Get the subdirectories for the specified directory. DirectoryInfo dir = new DirectoryInfo(sourceDirName); DirectoryInfo[] dirs = dir.GetDirectories(); if (!dir.Exists) { throw new DirectoryNotFoundException( "Source directory does not exist or could not be found: " + sourceDirName); } // If the destination directory doesn't exist, create it. if (!Directory.Exists(destDirName)) { Directory.CreateDirectory(destDirName); } // Get the files in the directory and copy them to the new location. FileInfo[] files = dir.GetFiles(); foreach (FileInfo file in files) { string temppath = Path.Combine(destDirName, file.Name); file.CopyTo(temppath, true); } // If copying subdirectories, copy them and their contents to new location. if (copySubDirs) { foreach (DirectoryInfo subdir in dirs) { string temppath = Path.Combine(destDirName, subdir.Name); CopyDirectory(subdir.FullName, temppath, copySubDirs); } } } } }
mandrek44/Mandro.Utils
Mandro.Utils/Setup/DirectoryHelper.cs
C#
mit
1,605
import { NotificationType } from 'vscode-languageclient' export enum Status { ok = 1, warn = 2, error = 3 } export interface StatusParams { state: Status } export const type = new NotificationType<StatusParams>('standard/status')
chenxsan/vscode-standardjs
client/src/utils/StatusNotification.ts
TypeScript
mit
241
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class ChevronDown extends React.Component { render() { if(this.props.bare) { return <g> <path d="M256,298.3L256,298.3L256,298.3l174.2-167.2c4.3-4.2,11.4-4.1,15.8,0.2l30.6,29.9c4.4,4.3,4.5,11.3,0.2,15.5L264.1,380.9 c-2.2,2.2-5.2,3.2-8.1,3c-3,0.1-5.9-0.9-8.1-3L35.2,176.7c-4.3-4.2-4.2-11.2,0.2-15.5L66,131.3c4.4-4.3,11.5-4.4,15.8-0.2L256,298.3 z"></path> </g>; } return <IconBase> <path d="M256,298.3L256,298.3L256,298.3l174.2-167.2c4.3-4.2,11.4-4.1,15.8,0.2l30.6,29.9c4.4,4.3,4.5,11.3,0.2,15.5L264.1,380.9 c-2.2,2.2-5.2,3.2-8.1,3c-3,0.1-5.9-0.9-8.1-3L35.2,176.7c-4.3-4.2-4.2-11.2,0.2-15.5L66,131.3c4.4-4.3,11.5-4.4,15.8-0.2L256,298.3 z"></path> </IconBase>; } };ChevronDown.defaultProps = {bare: false}
fbfeix/react-icons
src/icons/ChevronDown.js
JavaScript
mit
819
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const webpack = require('webpack'); const paths = require('./tools/paths'); const env = { 'process.env.NODE_ENV': JSON.stringify('development') }; module.exports = { devtool: 'cheap-module-eval-source-map', entry: [ require.resolve('./tools/polyfills'), 'webpack-dev-server/client?http://localhost:3000', 'webpack/hot/only-dev-server', 'react-hot-loader/patch', './src/index' ], output: { filename: 'static/js/bundle.js', path: paths.appDist, pathinfo: true, publicPath: '/' }, module: { rules: [ // Default loader: load all assets that are not handled // by other loaders with the url loader. // Note: This list needs to be updated with every change of extensions // the other loaders match. // E.g., when adding a loader for a new supported file extension, // we need to add the supported extension to this loader too. // Add one new line in `exclude` for each loader. // // "file" loader makes sure those assets get served by WebpackDevServer. // When you `import` an asset, you get its (virtual) filename. // In production, they would get copied to the `dist` folder. // "url" loader works like "file" loader except that it embeds assets // smaller than specified limit in bytes as data URLs to avoid requests. // A missing `test` is equivalent to a match. { exclude: [ /\.html$/, /\.js$/, /\.scss$/, /\.json$/, /\.svg$/, /node_modules/ ], use: [{ loader: 'url-loader', options: { limit: 10000, name: 'static/media/[name].[hash:8].[ext]' } }] }, { test: /\.js$/, enforce: 'pre', include: paths.appSrc, use: [{ loader: 'xo-loader', options: { // This loader must ALWAYS return warnings during development. If // errors are emitted, no changes will be pushed to the browser for // testing until the errors have been resolved. emitWarning: true } }] }, { test: /\.js$/, include: paths.appSrc, use: [{ loader: 'babel-loader', options: { // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. cacheDirectory: true } }] }, { test: /\.scss$/, use: [ 'style-loader', { loader: 'css-loader', options: { importLoaders: 2 } }, 'postcss-loader', 'sass-loader' ] }, { test: /\.svg$/, use: [{ loader: 'file-loader', options: { name: 'static/media/[name].[hash:8].[ext]' } }] } ] }, plugins: [ new HtmlWebpackPlugin({ inject: true, template: paths.appHtml }), new webpack.DefinePlugin(env), new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin(), // Watcher doesn't work well if you mistype casing in a path so we use // a plugin that prints an error when you attempt to do this. // See https://github.com/facebookincubator/create-react-app/issues/240 new CaseSensitivePathsPlugin(), // If you require a missing module and then `npm install` it, you still have // to restart the development server for Webpack to discover it. This plugin // makes the discovery automatic so you don't have to restart. // See https://github.com/facebookincubator/create-react-app/issues/186 new WatchMissingNodeModulesPlugin(paths.appNodeModules) ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. node: { fs: 'empty', net: 'empty', tls: 'empty' } };
hn3etta/VS2015-React-Redux-Webpack-Front-end-example
webpack.config.js
JavaScript
mit
3,928
<?php namespace BackOfficeBundle\Entity; use Doctrine\ORM\EntityRepository; /** * PosteCollaborateurRepository * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ class PosteCollaborateurRepository extends EntityRepository { }
elmabdgrub/azplatform
src/BackOfficeBundle/Entity/PosteCollaborateurRepository.php
PHP
mit
284
// ========================================================================== // snd_app // ========================================================================== // Copyright (c) 2006-2012, Knut Reinert, FU Berlin // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of Knut Reinert or the FU Berlin nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. // // ========================================================================== // Author: Your Name <your.email@example.net> // ========================================================================== #include <seqan/basic.h> #include <seqan/sequence.h> #include <seqan/arg_parse.h> // ========================================================================== // Classes // ========================================================================== // -------------------------------------------------------------------------- // Class AppOptions // -------------------------------------------------------------------------- // This struct stores the options from the command line. // // You might want to rename this to reflect the name of your app. struct AppOptions { // Verbosity level. 0 -- quiet, 1 -- normal, 2 -- verbose, 3 -- very verbose. int verbosity; // The first (and only) argument of the program is stored here. seqan::CharString text; AppOptions() : verbosity(1) {} }; // ========================================================================== // Functions // ========================================================================== // -------------------------------------------------------------------------- // Function parseCommandLine() // -------------------------------------------------------------------------- seqan::ArgumentParser::ParseResult parseCommandLine(AppOptions & options, int argc, char const ** argv) { // Setup ArgumentParser. seqan::ArgumentParser parser("snd_app"); // Set short description, version, and date. setShortDescription(parser, "Put a Short Description Here"); setVersion(parser, "0.1"); setDate(parser, "July 2012"); // Define usage line and long description. addUsageLine(parser, "[\\fIOPTIONS\\fP] \"\\fITEXT\\fP\""); addDescription(parser, "This is the application skelleton and you should modify this string."); // We require one argument. addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::STRING, "TEXT")); addOption(parser, seqan::ArgParseOption("q", "quiet", "Set verbosity to a minimum.")); addOption(parser, seqan::ArgParseOption("v", "verbose", "Enable verbose output.")); addOption(parser, seqan::ArgParseOption("vv", "very-verbose", "Enable very verbose output.")); // Add Examples Section. addTextSection(parser, "Examples"); addListItem(parser, "\\fBsnd_app\\fP \\fB-v\\fP \\fItext\\fP", "Call with \\fITEXT\\fP set to \"text\" with verbose output."); // Parse command line. seqan::ArgumentParser::ParseResult res = seqan::parse(parser, argc, argv); // Only extract options if the program will continue after parseCommandLine() if (res != seqan::ArgumentParser::PARSE_OK) return res; // Extract option values. if (isSet(parser, "quiet")) options.verbosity = 0; if (isSet(parser, "verbose")) options.verbosity = 2; if (isSet(parser, "very-verbose")) options.verbosity = 3; seqan::getArgumentValue(options.text, parser, 0); return seqan::ArgumentParser::PARSE_OK; } // -------------------------------------------------------------------------- // Function main() // -------------------------------------------------------------------------- // Program entry point. int main(int argc, char const ** argv) { // Parse the command line. seqan::ArgumentParser parser; AppOptions options; seqan::ArgumentParser::ParseResult res = parseCommandLine(options, argc, argv); // If there was an error parsing or built-in argument parser functionality // was triggered then we exit the program. The return code is 1 if there // were errors and 0 if there were none. if (res != seqan::ArgumentParser::PARSE_OK) return res == seqan::ArgumentParser::PARSE_ERROR; std::cout << "EXAMPLE PROGRAM\n" << "===============\n\n"; // Print the command line arguments back to the user. if (options.verbosity > 0) { std::cout << "__OPTIONS____________________________________________________________________\n" << '\n' << "VERBOSITY\t" << options.verbosity << '\n' << "TEXT \t" << options.text << "\n\n"; } return 0; }
bkahlert/seqan-research
raw/pmsb13/pmsb13-data-20130530/sources/130wu1dgzoqmxyu2/2013-04-09T10-23-18.897+0200/sandbox/my_sandbox/apps/snd_app/snd_app.cpp
C++
mit
6,165
<?php /** * @file * Contains \Drupal\shortcut\ShortcutSetStorageControllerInterface. */ namespace Drupal\shortcut; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\shortcut\ShortcutSetInterface; /** * Defines a common interface for shortcut entity controller classes. */ interface ShortcutSetStorageControllerInterface extends EntityStorageControllerInterface { /** * Assigns a user to a particular shortcut set. * * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set * An object representing the shortcut set. * @param $account * A user account that will be assigned to use the set. */ public function assignUser(ShortcutSetInterface $shortcut_set, $account); /** * Unassigns a user from any shortcut set they may have been assigned to. * * The user will go back to using whatever default set applies. * * @param $account * A user account that will be removed from the shortcut set assignment. * * @return bool * TRUE if the user was previously assigned to a shortcut set and has been * successfully removed from it. FALSE if the user was already not assigned * to any set. */ public function unassignUser($account); /** * Delete shortcut sets assigned to users. * * @param \Drupal\shortcut\ShortcutSetInterface $entity * Delete the user assigned sets belonging to this shortcut. */ public function deleteAssignedShortcutSets(ShortcutSetInterface $entity); /** * Get the name of the set assigned to this user. * * @param \Drupal\user\Plugin\Core\Entity\User * The user account. * * @return string * The name of the shortcut set assigned to this user. */ public function getAssignedToUser($account); /** * Get the number of users who have this set assigned to them. * * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set * The shortcut to count the users assigned to. * * @return int * The number of users who have this set assigned to them. */ public function countAssignedUsers(ShortcutSetInterface $shortcut_set); }
augustash/d8.dev
core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageControllerInterface.php
PHP
mit
2,130
using System; using System.Collections.Generic; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using MS.Core; namespace System.Runtime.Remoting.Contexts { public static class __ContextAttribute { public static IObservable<System.Boolean> IsNewContextOK( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue, IObservable<System.Runtime.Remoting.Contexts.Context> newCtx) { return Observable.Zip(ContextAttributeValue, newCtx, (ContextAttributeValueLambda, newCtxLambda) => ContextAttributeValueLambda.IsNewContextOK(newCtxLambda)); } public static IObservable<System.Reactive.Unit> Freeze( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue, IObservable<System.Runtime.Remoting.Contexts.Context> newContext) { return ObservableExt.ZipExecute(ContextAttributeValue, newContext, (ContextAttributeValueLambda, newContextLambda) => ContextAttributeValueLambda.Freeze(newContextLambda)); } public static IObservable<System.Boolean> Equals( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue, IObservable<System.Object> o) { return Observable.Zip(ContextAttributeValue, o, (ContextAttributeValueLambda, oLambda) => ContextAttributeValueLambda.Equals(oLambda)); } public static IObservable<System.Int32> GetHashCode( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue) { return Observable.Select(ContextAttributeValue, (ContextAttributeValueLambda) => ContextAttributeValueLambda.GetHashCode()); } public static IObservable<System.Boolean> IsContextOK( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue, IObservable<System.Runtime.Remoting.Contexts.Context> ctx, IObservable<System.Runtime.Remoting.Activation.IConstructionCallMessage> ctorMsg) { return Observable.Zip(ContextAttributeValue, ctx, ctorMsg, (ContextAttributeValueLambda, ctxLambda, ctorMsgLambda) => ContextAttributeValueLambda.IsContextOK(ctxLambda, ctorMsgLambda)); } public static IObservable<System.Reactive.Unit> GetPropertiesForNewContext( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue, IObservable<System.Runtime.Remoting.Activation.IConstructionCallMessage> ctorMsg) { return ObservableExt.ZipExecute(ContextAttributeValue, ctorMsg, (ContextAttributeValueLambda, ctorMsgLambda) => ContextAttributeValueLambda.GetPropertiesForNewContext(ctorMsgLambda)); } public static IObservable<System.String> get_Name( this IObservable<System.Runtime.Remoting.Contexts.ContextAttribute> ContextAttributeValue) { return Observable.Select(ContextAttributeValue, (ContextAttributeValueLambda) => ContextAttributeValueLambda.Name); } } }
RixianOpenTech/RxWrappers
Source/Wrappers/mscorlib/System.Runtime.Remoting.Contexts.ContextAttribute.cs
C#
mit
3,328
# -*- coding: utf-8 -*- # # Copyright (C) 2008 John Paulett (john -at- paulett.org) # Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com) # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. """Python library for serializing any arbitrary object graph into JSON. jsonpickle can take almost any Python object and turn the object into JSON. Additionally, it can reconstitute the object back into Python. The object must be accessible globally via a module and must inherit from object (AKA new-style classes). Create an object:: class Thing(object): def __init__(self, name): self.name = name obj = Thing('Awesome') Use jsonpickle to transform the object into a JSON string:: import jsonpickle frozen = jsonpickle.encode(obj) Use jsonpickle to recreate a Python object from a JSON string:: thawed = jsonpickle.decode(frozen) .. warning:: Loading a JSON string from an untrusted source represents a potential security vulnerability. jsonpickle makes no attempt to sanitize the input. The new object has the same type and data, but essentially is now a copy of the original. .. code-block:: python assert obj.name == thawed.name If you will never need to load (regenerate the Python class from JSON), you can pass in the keyword unpicklable=False to prevent extra information from being added to JSON:: oneway = jsonpickle.encode(obj, unpicklable=False) result = jsonpickle.decode(oneway) assert obj.name == result['name'] == 'Awesome' """ import sys, os from music21 import common sys.path.append(common.getSourceFilePath() + os.path.sep + 'ext') from jsonpickle import pickler from jsonpickle import unpickler from jsonpickle.backend import JSONBackend from jsonpickle.version import VERSION # ensure built-in handlers are loaded __import__('jsonpickle.handlers') __all__ = ('encode', 'decode') __version__ = VERSION json = JSONBackend() # Export specific JSONPluginMgr methods into the jsonpickle namespace set_preferred_backend = json.set_preferred_backend set_encoder_options = json.set_encoder_options load_backend = json.load_backend remove_backend = json.remove_backend enable_fallthrough = json.enable_fallthrough def encode(value, unpicklable=True, make_refs=True, keys=False, max_depth=None, backend=None, warn=False, max_iter=None): """Return a JSON formatted representation of value, a Python object. :param unpicklable: If set to False then the output will not contain the information necessary to turn the JSON data back into Python objects, but a simpler JSON stream is produced. :param max_depth: If set to a non-negative integer then jsonpickle will not recurse deeper than 'max_depth' steps into the object. Anything deeper than 'max_depth' is represented using a Python repr() of the object. :param make_refs: If set to False jsonpickle's referencing support is disabled. Objects that are id()-identical won't be preserved across encode()/decode(), but the resulting JSON stream will be conceptually simpler. jsonpickle detects cyclical objects and will break the cycle by calling repr() instead of recursing when make_refs is set False. :param keys: If set to True then jsonpickle will encode non-string dictionary keys instead of coercing them into strings via `repr()`. :param warn: If set to True then jsonpickle will warn when it returns None for an object which it cannot pickle (e.g. file descriptors). :param max_iter: If set to a non-negative integer then jsonpickle will consume at most `max_iter` items when pickling iterators. >>> encode('my string') '"my string"' >>> encode(36) '36' >>> encode({'foo': True}) '{"foo": true}' >>> encode({'foo': True}, max_depth=0) '"{\\'foo\\': True}"' >>> encode({'foo': True}, max_depth=1) '{"foo": "True"}' """ if backend is None: backend = json return pickler.encode(value, backend=backend, unpicklable=unpicklable, make_refs=make_refs, keys=keys, max_depth=max_depth, warn=warn) def decode(string, backend=None, keys=False): """Convert a JSON string into a Python object. The keyword argument 'keys' defaults to False. If set to True then jsonpickle will decode non-string dictionary keys into python objects via the jsonpickle protocol. >>> str(decode('"my string"')) 'my string' >>> decode('36') 36 """ if backend is None: backend = json return unpickler.decode(string, backend=backend, keys=keys) # json.load(),loads(), dump(), dumps() compatibility dumps = encode loads = decode
arnavd96/Cinemiezer
myvenv/lib/python3.4/site-packages/music21/ext/jsonpickle/__init__.py
Python
mit
5,049
require 'spec_helper' describe "beings/show" do before(:each) do @being = FactoryGirl.create(:being) @being.randomize! end end
slabgorb/populinator-0
spec/views/beings/show.html.haml_spec.rb
Ruby
mit
142
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; class ProteinTranslator { private static final Integer CODON_LENGTH = 3; private static final Map<String, String> CODON_TO_PROTEIN = Map.ofEntries( Map.entry("AUG", "Methionine"), Map.entry("UUU", "Phenylalanine"), Map.entry("UUC", "Phenylalanine"), Map.entry("UUA", "Leucine"), Map.entry("UUG", "Leucine"), Map.entry("UCU", "Serine"), Map.entry("UCC", "Serine"), Map.entry("UCA", "Serine"), Map.entry("UCG", "Serine"), Map.entry("UAU", "Tyrosine"), Map.entry("UAC", "Tyrosine"), Map.entry("UGU", "Cysteine"), Map.entry("UGC", "Cysteine"), Map.entry("UGG", "Tryptophan")); private static final Set<String> STOP_CODONS = Set.of("UAA", "UAG", "UGA"); public List<String> translate(final String rnaSequence) { final List<String> codons = splitIntoCodons(rnaSequence); List<String> proteins = new ArrayList<>(); for (String codon : codons) { if (STOP_CODONS.contains(codon)) { return proteins; } proteins.add(translateCodon(codon)); } ; return proteins; } private static List<String> splitIntoCodons(final String rnaSequence) { final List<String> codons = new ArrayList<>(); for (int i = 0; i < rnaSequence.length(); i += CODON_LENGTH) { codons.add(rnaSequence.substring(i, Math.min(rnaSequence.length(), i + CODON_LENGTH))); } return codons; } private static String translateCodon(final String codon) { return CODON_TO_PROTEIN.get(codon); } }
rootulp/exercism
java/protein-translation/src/main/java/ProteinTranslator.java
Java
mit
1,679
# -*- coding: utf-8 -*- """ Created on Wed Sep 09 13:04:53 2015 * If TimerTool.exe is running, kill the process. * If input parameter is given, start TimerTool and set clock resolution Starts TimerTool.exe and sets the clock resolution to argv[0] ms Ex: python set_clock_resolution 0.5 @author: marcus """ import time, datetime from socket import gethostname, gethostbyname import os import numpy as np def main(): my_path = os.path.join('C:',os.sep,'Share','sync_clocks') os.chdir(my_path) # Initial timestamps t1 = time.clock() t2 = time.time() t3 = datetime.datetime.now() td1 = [] td2 = [] td3 = [] for i in xrange(100): td1.append(time.clock()-t1) td2.append(time.time() -t2) td3.append((datetime.datetime.now()-t3).total_seconds()) time.sleep(0.001) # Create text file and write header t = datetime.datetime.now() ip = gethostbyname(gethostname()).split('.')[-1] f_name = '_'.join([ip,'test_clock_res',str(t.year),str(t.month),str(t.day), str(t.hour),str(t.minute),str(t.second)]) f = open(f_name+'.txt','w') f.write('%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % ('mean_clock','median_clock','sd_clock', 'mean_time','median_time','sd_time', 'mean_datetime','median_datetime','sd_datetime',)) # Write results to text file f.write('%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n' % (np.mean(np.diff(td1))*1000, np.median(np.diff(td1))*1000,np.std(np.diff(td1))*1000, np.mean(np.diff(td2))*1000, np.median(np.diff(td2))*1000,np.std(np.diff(td2))*1000, np.mean(np.diff(td3))*1000, np.median(np.diff(td3))*1000,np.std(np.diff(td3))*1000)) f.close() if __name__ == "__main__": main()
marcus-nystrom/share-gaze
sync_clocks/test_clock_resolution.py
Python
mit
1,930
<?php use Illuminate\Database\Seeder; use jeremykenedy\LaravelRoles\Models\Permission; class PermissionsTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { /* * Add Permissions * */ if (Permission::where('name', '=', 'Can View Users')->first() === null) { Permission::create([ 'name' => 'Can View Users', 'slug' => 'view.users', 'description' => 'Can view users', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Can Create Users')->first() === null) { Permission::create([ 'name' => 'Can Create Users', 'slug' => 'create.users', 'description' => 'Can create new users', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Can Edit Users')->first() === null) { Permission::create([ 'name' => 'Can Edit Users', 'slug' => 'edit.users', 'description' => 'Can edit users', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Can Delete Users')->first() === null) { Permission::create([ 'name' => 'Can Delete Users', 'slug' => 'delete.users', 'description' => 'Can delete users', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Super Admin Permissions')->first() === null) { Permission::create([ 'name' => 'Super Admin Permissions', 'slug' => 'perms.super-admin', 'description' => 'Has Super Admin Permissions', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Admin Permissions')->first() === null) { Permission::create([ 'name' => 'Admin Permissions', 'slug' => 'perms.admin', 'description' => 'Has Admin Permissions', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Moderator Permissions')->first() === null) { Permission::create([ 'name' => 'Moderator Permissions', 'slug' => 'perms.moderator', 'description' => 'Has Moderator Permissions', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'Writer Permissions')->first() === null) { Permission::create([ 'name' => 'Writer Permissions', 'slug' => 'perms.writer', 'description' => 'Has Writer Permissions', 'model' => 'Permission', ]); } if (Permission::where('name', '=', 'User Permissions')->first() === null) { Permission::create([ 'name' => 'User Permissions', 'slug' => 'perms.user', 'description' => 'Has User Permissions', 'model' => 'Permission', ]); } } }
jeremykenedy/larablog
database/seeds/PermissionsTableSeeder.php
PHP
mit
3,481
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; namespace TrueSync.Physics2D { // Original Code by Steven Lu - see http://www.box2d.org/forum/viewtopic.php?f=3&t=1688 // Ported to Farseer 3.0 by Nicolás Hormazábal internal struct ShapeData { public Body Body; public FP Max; public FP Min; // absolute angles } /// <summary> /// This is a comprarer used for /// detecting angle difference between rays /// </summary> internal class RayDataComparer : IComparer<FP> { #region IComparer<FP> Members int IComparer<FP>.Compare(FP a, FP b) { FP diff = (a - b); if (diff > 0) return 1; if (diff < 0) return -1; return 0; } #endregion } /* Methodology: * Force applied at a ray is inversely proportional to the square of distance from source * AABB is used to query for shapes that may be affected * For each RIGID BODY (not shape -- this is an optimization) that is matched, loop through its vertices to determine * the extreme points -- if there is structure that contains outlining polygon, use that as an additional optimization * Evenly cast a number of rays against the shape - number roughly proportional to the arc coverage * - Something like every 3 degrees should do the trick although this can be altered depending on the distance (if really close don't need such a high density of rays) * - There should be a minimum number of rays (3-5?) applied to each body so that small bodies far away are still accurately modeled * - Be sure to have the forces of each ray be proportional to the average arc length covered by each. * For each ray that actually intersects with the shape (non intersections indicate something blocking the path of explosion): * - Apply the appropriate force dotted with the negative of the collision normal at the collision point * - Optionally apply linear interpolation between aforementioned Normal force and the original explosion force in the direction of ray to simulate "surface friction" of sorts */ /// <summary> /// Creates a realistic explosion based on raycasting. Objects in the open will be affected, but objects behind /// static bodies will not. A body that is half in cover, half in the open will get half the force applied to the end in /// the open. /// </summary> public sealed class RealExplosion : PhysicsLogic { /// <summary> /// Two degrees: maximum angle from edges to first ray tested /// </summary> private static readonly FP MaxEdgeOffset = FP.Pi / 90; /// <summary> /// Ratio of arc length to angle from edges to first ray tested. /// Defaults to 1/40. /// </summary> public FP EdgeRatio = 1.0f / 40.0f; /// <summary> /// Ignore Explosion if it happens inside a shape. /// Default value is false. /// </summary> public bool IgnoreWhenInsideShape = false; /// <summary> /// Max angle between rays (used when segment is large). /// Defaults to 15 degrees /// </summary> public FP MaxAngle = FP.Pi / 15; /// <summary> /// Maximum number of shapes involved in the explosion. /// Defaults to 100 /// </summary> public int MaxShapes = 100; /// <summary> /// How many rays per shape/body/segment. /// Defaults to 5 /// </summary> public int MinRays = 5; private List<ShapeData> _data = new List<ShapeData>(); private RayDataComparer _rdc; public RealExplosion(World world) : base(world, PhysicsLogicType.Explosion) { _rdc = new RayDataComparer(); _data = new List<ShapeData>(); } /// <summary> /// Activate the explosion at the specified position. /// </summary> /// <param name="pos">The position where the explosion happens </param> /// <param name="radius">The explosion radius </param> /// <param name="maxForce">The explosion force at the explosion point (then is inversely proportional to the square of the distance)</param> /// <returns>A list of bodies and the amount of force that was applied to them.</returns> public Dictionary<Fixture, TSVector2> Activate(TSVector2 pos, FP radius, FP maxForce) { AABB aabb; aabb.LowerBound = pos + new TSVector2(-radius, -radius); aabb.UpperBound = pos + new TSVector2(radius, radius); Fixture[] shapes = new Fixture[MaxShapes]; // More than 5 shapes in an explosion could be possible, but still strange. Fixture[] containedShapes = new Fixture[5]; bool exit = false; int shapeCount = 0; int containedShapeCount = 0; // Query the world for overlapping shapes. World.QueryAABB( fixture => { if (fixture.TestPoint(ref pos)) { if (IgnoreWhenInsideShape) { exit = true; return false; } containedShapes[containedShapeCount++] = fixture; } else { shapes[shapeCount++] = fixture; } // Continue the query. return true; }, ref aabb); if (exit) return new Dictionary<Fixture, TSVector2>(); Dictionary<Fixture, TSVector2> exploded = new Dictionary<Fixture, TSVector2>(shapeCount + containedShapeCount); // Per shape max/min angles for now. FP[] vals = new FP[shapeCount * 2]; int valIndex = 0; for (int i = 0; i < shapeCount; ++i) { PolygonShape ps; CircleShape cs = shapes[i].Shape as CircleShape; if (cs != null) { // We create a "diamond" approximation of the circle Vertices v = new Vertices(); TSVector2 vec = TSVector2.zero + new TSVector2(cs.Radius, 0); v.Add(vec); vec = TSVector2.zero + new TSVector2(0, cs.Radius); v.Add(vec); vec = TSVector2.zero + new TSVector2(-cs.Radius, cs.Radius); v.Add(vec); vec = TSVector2.zero + new TSVector2(0, -cs.Radius); v.Add(vec); ps = new PolygonShape(v, 0); } else ps = shapes[i].Shape as PolygonShape; if ((shapes[i].Body.BodyType == BodyType.Dynamic) && ps != null) { TSVector2 toCentroid = shapes[i].Body.GetWorldPoint(ps.MassData.Centroid) - pos; FP angleToCentroid = FP.Atan2(toCentroid.y, toCentroid.x); FP min = FP.MaxValue; FP max = FP.MinValue; FP minAbsolute = 0.0f; FP maxAbsolute = 0.0f; for (int j = 0; j < ps.Vertices.Count; ++j) { TSVector2 toVertex = (shapes[i].Body.GetWorldPoint(ps.Vertices[j]) - pos); FP newAngle = FP.Atan2(toVertex.y, toVertex.x); FP diff = (newAngle - angleToCentroid); diff = (diff - FP.Pi) % (2 * FP.Pi); // the minus pi is important. It means cutoff for going other direction is at 180 deg where it needs to be if (diff < 0.0f) diff += 2 * FP.Pi; // correction for not handling negs diff -= FP.Pi; if (FP.Abs(diff) > FP.Pi) continue; // Something's wrong, point not in shape but exists angle diff > 180 if (diff > max) { max = diff; maxAbsolute = newAngle; } if (diff < min) { min = diff; minAbsolute = newAngle; } } vals[valIndex] = minAbsolute; ++valIndex; vals[valIndex] = maxAbsolute; ++valIndex; } } Array.Sort(vals, 0, valIndex, _rdc); _data.Clear(); bool rayMissed = true; for (int i = 0; i < valIndex; ++i) { Fixture fixture = null; FP midpt; int iplus = (i == valIndex - 1 ? 0 : i + 1); if (vals[i] == vals[iplus]) continue; if (i == valIndex - 1) { // the single edgecase midpt = (vals[0] + FP.PiTimes2 + vals[i]); } else { midpt = (vals[i + 1] + vals[i]); } midpt = midpt / 2; TSVector2 p1 = pos; TSVector2 p2 = radius * new TSVector2(FP.Cos(midpt), FP.Sin(midpt)) + pos; // RaycastOne bool hitClosest = false; World.RayCast((f, p, n, fr) => { Body body = f.Body; if (!IsActiveOn(body)) return 0; hitClosest = true; fixture = f; return fr; }, p1, p2); //draws radius points if ((hitClosest) && (fixture.Body.BodyType == BodyType.Dynamic)) { if ((_data.Any()) && (_data.Last().Body == fixture.Body) && (!rayMissed)) { int laPos = _data.Count - 1; ShapeData la = _data[laPos]; la.Max = vals[iplus]; _data[laPos] = la; } else { // make new ShapeData d; d.Body = fixture.Body; d.Min = vals[i]; d.Max = vals[iplus]; _data.Add(d); } if ((_data.Count > 1) && (i == valIndex - 1) && (_data.Last().Body == _data.First().Body) && (_data.Last().Max == _data.First().Min)) { ShapeData fi = _data[0]; fi.Min = _data.Last().Min; _data.RemoveAt(_data.Count - 1); _data[0] = fi; while (_data.First().Min >= _data.First().Max) { fi.Min -= FP.PiTimes2; _data[0] = fi; } } int lastPos = _data.Count - 1; ShapeData last = _data[lastPos]; while ((_data.Count > 0) && (_data.Last().Min >= _data.Last().Max)) // just making sure min<max { last.Min = _data.Last().Min - FP.PiTimes2; _data[lastPos] = last; } rayMissed = false; } else { rayMissed = true; // raycast did not find a shape } } for (int i = 0; i < _data.Count; ++i) { if (!IsActiveOn(_data[i].Body)) continue; FP arclen = _data[i].Max - _data[i].Min; FP first = TSMath.Min(MaxEdgeOffset, EdgeRatio * arclen); int insertedRays = FP.Ceiling((((arclen - 2.0f * first) - (MinRays - 1) * MaxAngle) / MaxAngle)).AsInt(); if (insertedRays < 0) insertedRays = 0; FP offset = (arclen - first * 2.0f) / ((FP)MinRays + insertedRays - 1); //Note: This loop can go into infinite as it operates on FPs. //Added FPEquals with a large epsilon. for (FP j = _data[i].Min + first; j < _data[i].Max || MathUtils.FPEquals(j, _data[i].Max, 0.0001f); j += offset) { TSVector2 p1 = pos; TSVector2 p2 = pos + radius * new TSVector2(FP.Cos(j), FP.Sin(j)); TSVector2 hitpoint = TSVector2.zero; FP minlambda = FP.MaxValue; List<Fixture> fl = _data[i].Body.FixtureList; for (int x = 0; x < fl.Count; x++) { Fixture f = fl[x]; RayCastInput ri; ri.Point1 = p1; ri.Point2 = p2; ri.MaxFraction = 50f; RayCastOutput ro; if (f.RayCast(out ro, ref ri, 0)) { if (minlambda > ro.Fraction) { minlambda = ro.Fraction; hitpoint = ro.Fraction * p2 + (1 - ro.Fraction) * p1; } } // the force that is to be applied for this particular ray. // offset is angular coverage. lambda*length of segment is distance. FP impulse = (arclen / (MinRays + insertedRays)) * maxForce * 180.0f / FP.Pi * (1.0f - TrueSync.TSMath.Min(FP.One, minlambda)); // We Apply the impulse!!! TSVector2 vectImp = TSVector2.Dot(impulse * new TSVector2(FP.Cos(j), FP.Sin(j)), -ro.Normal) * new TSVector2(FP.Cos(j), FP.Sin(j)); _data[i].Body.ApplyLinearImpulse(ref vectImp, ref hitpoint); // We gather the fixtures for returning them if (exploded.ContainsKey(f)) exploded[f] += vectImp; else exploded.Add(f, vectImp); if (minlambda > 1.0f) hitpoint = p2; } } } // We check contained shapes for (int i = 0; i < containedShapeCount; ++i) { Fixture fix = containedShapes[i]; if (!IsActiveOn(fix.Body)) continue; FP impulse = MinRays * maxForce * 180.0f / FP.Pi; TSVector2 hitPoint; CircleShape circShape = fix.Shape as CircleShape; if (circShape != null) { hitPoint = fix.Body.GetWorldPoint(circShape.Position); } else { PolygonShape shape = fix.Shape as PolygonShape; hitPoint = fix.Body.GetWorldPoint(shape.MassData.Centroid); } TSVector2 vectImp = impulse * (hitPoint - pos); fix.Body.ApplyLinearImpulse(ref vectImp, ref hitPoint); if (!exploded.ContainsKey(fix)) exploded.Add(fix, vectImp); } return exploded; } } }
Xaer033/YellowSign
YellowSignUnity/Assets/ThirdParty/Networking/TrueSync/Physics/Farseer/Common/PhysicsLogic/RealExplosion.cs
C#
mit
16,308
<?php /* * This file is part of the Sonata project. * * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sonata\MediaBundle\Tests\Validator; use Sonata\MediaBundle\Provider\Pool; use Sonata\MediaBundle\Validator\Constraints\ValidMediaFormat; use Sonata\MediaBundle\Validator\FormatValidator; class FormatValidatorTest extends \PHPUnit_Framework_TestCase { public function testValidate() { $pool = new Pool('defaultContext'); $pool->addContext('test', array(), array('format1' => array())); $gallery = $this->getMock('Sonata\MediaBundle\Model\GalleryInterface'); $gallery->expects($this->once())->method('getDefaultFormat')->will($this->returnValue('format1')); $gallery->expects($this->once())->method('getContext')->will($this->returnValue('test')); // Prefer the Symfony 2.5+ API if available if (class_exists('Symfony\Component\Validator\Context\ExecutionContext')) { $contextClass = 'Symfony\Component\Validator\Context\ExecutionContext'; } else { $contextClass = 'Symfony\Component\Validator\ExecutionContext'; } $context = $this->getMock($contextClass, array(), array(), '', false); $context->expects($this->never())->method('addViolation'); $validator = new FormatValidator($pool); $validator->initialize($context); $validator->validate($gallery, new ValidMediaFormat()); } public function testValidateWithValidContext() { $pool = new Pool('defaultContext'); $pool->addContext('test'); $gallery = $this->getMock('Sonata\MediaBundle\Model\GalleryInterface'); $gallery->expects($this->once())->method('getDefaultFormat')->will($this->returnValue('format1')); $gallery->expects($this->once())->method('getContext')->will($this->returnValue('test')); // Prefer the Symfony 2.5+ API if available if (class_exists('Symfony\Component\Validator\Context\ExecutionContext')) { $contextClass = 'Symfony\Component\Validator\Context\ExecutionContext'; } else { $contextClass = 'Symfony\Component\Validator\ExecutionContext'; } $context = $this->getMock($contextClass, array(), array(), '', false); $context->expects($this->once())->method('addViolation'); $validator = new FormatValidator($pool); $validator->initialize($context); $validator->validate($gallery, new ValidMediaFormat()); } }
DevKhater/YallaWebSite
vendor/sonata-project/media-bundle/Tests/Validator/FormatValidatorTest.php
PHP
mit
2,647
require "rails_helper" describe Linter::Shellcheck do it_behaves_like "a linter" do let(:lintable_files) { %w(foo.sh foo.zsh foo.bash) } let(:not_lintable_files) { %w(foo.js) } end describe "#file_review" do it "returns a saved and incomplete file review" do commit_file = build_commit_file(filename: "lib/a.sh") linter = build_linter result = linter.file_review(commit_file) expect(result).to be_persisted expect(result).not_to be_completed end it "schedules a review job" do build = build(:build, commit_sha: "foo", pull_request_number: 123) commit_file = build_commit_file(filename: "lib/a.sh") allow(LintersJob).to receive(:perform_async) linter = build_linter(build) linter.file_review(commit_file) expect(LintersJob).to have_received(:perform_async).with( filename: commit_file.filename, commit_sha: build.commit_sha, linter_name: "shellcheck", pull_request_number: build.pull_request_number, patch: commit_file.patch, content: commit_file.content, config: "--- {}\n", linter_version: nil, ) end end end
thoughtbot/hound
spec/models/linter/shellcheck_spec.rb
Ruby
mit
1,185
/* * 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. */ var THREE = require('./three-math.js'); var PredictionMode = { NONE: 'none', INTERPOLATE: 'interpolate', PREDICT: 'predict' } // How much to interpolate between the current orientation estimate and the // previous estimate position. This is helpful for devices with low // deviceorientation firing frequency (eg. on iOS8 and below, it is 20 Hz). The // larger this value (in [0, 1]), the smoother but more delayed the head // tracking is. var INTERPOLATION_SMOOTHING_FACTOR = 0.01; // Angular threshold, if the angular speed (in deg/s) is less than this, do no // prediction. Without it, the screen flickers quite a bit. var PREDICTION_THRESHOLD_DEG_PER_S = 0.01; //var PREDICTION_THRESHOLD_DEG_PER_S = 0; // How far into the future to predict. window.WEBVR_PREDICTION_TIME_MS = 80; // Whether to predict or what. window.WEBVR_PREDICTION_MODE = PredictionMode.PREDICT; function PosePredictor() { this.lastQ = new THREE.Quaternion(); this.lastTimestamp = null; this.outQ = new THREE.Quaternion(); this.deltaQ = new THREE.Quaternion(); } PosePredictor.prototype.getPrediction = function(currentQ, rotationRate, timestamp) { // If there's no previous quaternion, output the current one and save for // later. if (!this.lastTimestamp) { this.lastQ.copy(currentQ); this.lastTimestamp = timestamp; return currentQ; } // DEBUG ONLY: Try with a fixed 60 Hz update speed. //var elapsedMs = 1000/60; var elapsedMs = timestamp - this.lastTimestamp; switch (WEBVR_PREDICTION_MODE) { case PredictionMode.INTERPOLATE: this.outQ.copy(currentQ); this.outQ.slerp(this.lastQ, INTERPOLATION_SMOOTHING_FACTOR); // Save the current quaternion for later. this.lastQ.copy(currentQ); break; case PredictionMode.PREDICT: var axisAngle; if (rotationRate) { axisAngle = this.getAxisAngularSpeedFromRotationRate_(rotationRate); } else { axisAngle = this.getAxisAngularSpeedFromGyroDelta_(currentQ, elapsedMs); } // If there is no predicted axis/angle, don't do prediction. if (!axisAngle) { this.outQ.copy(currentQ); this.lastQ.copy(currentQ); break; } var angularSpeedDegS = axisAngle.speed; var axis = axisAngle.axis; var predictAngleDeg = (WEBVR_PREDICTION_TIME_MS / 1000) * angularSpeedDegS; // If we're rotating slowly, don't do prediction. if (angularSpeedDegS < PREDICTION_THRESHOLD_DEG_PER_S) { this.outQ.copy(currentQ); this.lastQ.copy(currentQ); break; } // Calculate the prediction delta to apply to the original angle. this.deltaQ.setFromAxisAngle(axis, THREE.Math.degToRad(predictAngleDeg)); // DEBUG ONLY: As a sanity check, use the same axis and angle as before, // which should cause no prediction to happen. //this.deltaQ.setFromAxisAngle(axis, angle); this.outQ.copy(this.lastQ); this.outQ.multiply(this.deltaQ); // Use the predicted quaternion as the new last one. //this.lastQ.copy(this.outQ); this.lastQ.copy(currentQ); break; case PredictionMode.NONE: default: this.outQ.copy(currentQ); } this.lastTimestamp = timestamp; return this.outQ; }; PosePredictor.prototype.setScreenOrientation = function(screenOrientation) { this.screenOrientation = screenOrientation; }; PosePredictor.prototype.getAxis_ = function(quat) { // x = qx / sqrt(1-qw*qw) // y = qy / sqrt(1-qw*qw) // z = qz / sqrt(1-qw*qw) var d = Math.sqrt(1 - quat.w * quat.w); return new THREE.Vector3(quat.x / d, quat.y / d, quat.z / d); }; PosePredictor.prototype.getAngle_ = function(quat) { // angle = 2 * acos(qw) // If w is greater than 1 (THREE.js, how can this be?), arccos is not defined. if (quat.w > 1) { return 0; } var angle = 2 * Math.acos(quat.w); // Normalize the angle to be in [-π, π]. if (angle > Math.PI) { angle -= 2 * Math.PI; } return angle; }; PosePredictor.prototype.getAxisAngularSpeedFromRotationRate_ = function(rotationRate) { if (!rotationRate) { return null; } var screenRotationRate; if (/iPad|iPhone|iPod/.test(navigator.platform)) { // iOS: angular speed in deg/s. var screenRotationRate = this.getScreenAdjustedRotationRateIOS_(rotationRate); } else { // Android: angular speed in rad/s, so need to convert. rotationRate.alpha = THREE.Math.radToDeg(rotationRate.alpha); rotationRate.beta = THREE.Math.radToDeg(rotationRate.beta); rotationRate.gamma = THREE.Math.radToDeg(rotationRate.gamma); var screenRotationRate = this.getScreenAdjustedRotationRate_(rotationRate); } var vec = new THREE.Vector3( screenRotationRate.beta, screenRotationRate.alpha, screenRotationRate.gamma); /* var vec; if (/iPad|iPhone|iPod/.test(navigator.platform)) { vec = new THREE.Vector3(rotationRate.gamma, rotationRate.alpha, rotationRate.beta); } else { vec = new THREE.Vector3(rotationRate.beta, rotationRate.alpha, rotationRate.gamma); } // Take into account the screen orientation too! vec.applyQuaternion(this.screenTransform); */ // Angular speed in deg/s. var angularSpeedDegS = vec.length(); var axis = vec.normalize(); return { speed: angularSpeedDegS, axis: axis } }; PosePredictor.prototype.getScreenAdjustedRotationRate_ = function(rotationRate) { var screenRotationRate = { alpha: -rotationRate.alpha, beta: rotationRate.beta, gamma: rotationRate.gamma }; switch (this.screenOrientation) { case 90: screenRotationRate.beta = - rotationRate.gamma; screenRotationRate.gamma = rotationRate.beta; break; case 180: screenRotationRate.beta = - rotationRate.beta; screenRotationRate.gamma = - rotationRate.gamma; break; case 270: case -90: screenRotationRate.beta = rotationRate.gamma; screenRotationRate.gamma = - rotationRate.beta; break; default: // SCREEN_ROTATION_0 screenRotationRate.beta = rotationRate.beta; screenRotationRate.gamma = rotationRate.gamma; break; } return screenRotationRate; }; PosePredictor.prototype.getScreenAdjustedRotationRateIOS_ = function(rotationRate) { var screenRotationRate = { alpha: rotationRate.alpha, beta: rotationRate.beta, gamma: rotationRate.gamma }; // Values empirically derived. switch (this.screenOrientation) { case 90: screenRotationRate.beta = -rotationRate.beta; screenRotationRate.gamma = rotationRate.gamma; break; case 180: // You can't even do this on iOS. break; case 270: case -90: screenRotationRate.alpha = -rotationRate.alpha; screenRotationRate.beta = rotationRate.beta; screenRotationRate.gamma = rotationRate.gamma; break; default: // SCREEN_ROTATION_0 screenRotationRate.alpha = rotationRate.beta; screenRotationRate.beta = rotationRate.alpha; screenRotationRate.gamma = rotationRate.gamma; break; } return screenRotationRate; }; PosePredictor.prototype.getAxisAngularSpeedFromGyroDelta_ = function(currentQ, elapsedMs) { // Sometimes we use the same sensor timestamp, in which case prediction // won't work. if (elapsedMs == 0) { return null; } // Q_delta = Q_last^-1 * Q_curr this.deltaQ.copy(this.lastQ); this.deltaQ.inverse(); this.deltaQ.multiply(currentQ); // Convert from delta quaternion to axis-angle. var axis = this.getAxis_(this.deltaQ); var angleRad = this.getAngle_(this.deltaQ); // It took `elapsed` ms to travel the angle amount over the axis. Now, // we make a new quaternion based how far in the future we want to // calculate. var angularSpeedRadMs = angleRad / elapsedMs; var angularSpeedDegS = THREE.Math.radToDeg(angularSpeedRadMs) * 1000; // If no rotation rate is provided, do no prediction. return { speed: angularSpeedDegS, axis: axis }; }; module.exports = PosePredictor;
lacker/universe
vr_webpack/webvr-polyfill/src/pose-predictor.js
JavaScript
mit
8,628
<?php namespace Kuxin\Helper; /** * Class Collect * * @package Kuxin\Helper * @author Pakey <pakey@qq.com> */ class Collect { /** * 获取内容 * * @param $data * @return bool|mixed|string */ public static function getContent($data, $header = [], $option = []) { if (is_string($data)) $data = ['rule' => $data, 'charset' => 'auto']; if (strpos($data['rule'], '[timestamp]') || strpos($data['rule'], '[时间]')) { $data['rule'] = str_replace(['[timestamp]', '[时间]'], [time() - 64566122, date('Y-m-d H:i:s')], $data['rule']); } elseif (isset($data['usetimestamp']) && $data['usetimestamp'] == 1) { $data['rule'] .= (strpos($data['rule'], '?') ? '&_ptcms=' : '?_ptcms=') . (time() - 13456867); } if (isset($data['method']) && strtolower($data['method']) == 'post') { $content = Http::post($data['rule'], [], $header, $option); } else { $content = Http::get($data['rule'], [], $header, $option); } if ($content) { // 处理编码 if (empty($data['charset']) || !in_array($data['charset'], ['auto', 'utf-8', 'gbk'])) { $data['charset'] = 'auto'; } // 检测编码 if ($data['charset'] == 'auto') { if (preg_match('/[;\s\'"]charset[=\'\s]+?big/i', $content)) { $data['charset'] = 'big5'; } elseif (preg_match('/[;\s\'"]charset[=\'"\s]+?gb/i', $content) || preg_match('/[;\s\'"]encoding[=\'"\s]+?gb/i', $content)) { $data['charset'] = 'gbk'; } elseif (mb_detect_encoding($content) != 'UTF-8') { $data['charset'] = 'gbk'; } } // 转换 switch ($data['charset']) { case 'gbk': $content = mb_convert_encoding($content, 'UTF-8', 'GBK'); break; case 'big5': $content = mb_convert_encoding($content, 'UTF-8', 'big-5'); $content = big5::toutf8($content); break; case 'utf-16': $content = mb_convert_encoding($content, 'UTF-8', 'UTF-16'); default: } //错误标识 if (!empty($data['error']) && strpos($content, $data['error']) !== false) { return ''; } if (!empty($data['replace'])) { $content = self::replace($content, $data['replace']); } return $content; } return ''; } /** * 根据正则批量获取 * * @param mixed $pregArr 正则 * @param string $code 源内容 * @param int $needposition 确定是否需要间距数字 * @return array|bool */ public static function getMatchAll($pregArr, $code, $needposition = 0) { if (is_numeric($pregArr)) { return $pregArr; } elseif (is_string($pregArr)) { $pregArr = ['rule' => self::parseMatchRule($pregArr)]; } elseif (empty($pregArr['rule'])) { return []; } if (!self::isreg($pregArr['rule'])) return []; $pregstr = '{' . $pregArr['rule'] . '}'; $pregstr .= empty($pregArr['option']) ? '' : $pregArr['option']; $matchvar = $match = []; if (!empty($pregstr)) { if ($needposition) { preg_match_all($pregstr, $code, $match, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); } else { preg_match_all($pregstr, $code, $match); } } if (is_array($match)) { if ($needposition) { foreach ($match as $var) { if (is_array($var)) { $matchvar[] = $var[count($var) - 1]; } else { $matchvar[] = $var; } } } else { if (isset($match['2'])) { $count = count($match); foreach ($match['1'] as $k => $v) { if ($v == '') { for ($i = 2; $i < $count; $i++) { if (!empty($match[$i][$k])) { $match['1'][$k] = $match[$i][$k]; break; } } } } } if (isset($match['1'])) { $matchvar = $match['1']; } else { return false; } } if (!empty($pregArr['replace'])) { foreach ($matchvar as $k => $v) { $matchvar[$k] = self::replace($v, $pregArr['replace']); } } return $matchvar; } return []; } /** * 根据正则获取指定数据 单个 * * @param mixed $pregArr 正则 * @param string $code 源内容 * @return bool|string */ public static function getMatch($pregArr, $code) { if (is_numeric($pregArr)) { return $pregArr; } elseif (empty($pregArr) || (isset($pregArr['rule']) && empty($pregArr['rule']))) { return ''; } elseif (is_string($pregArr)) { $pregArr = ['rule' => self::parseMatchRule($pregArr), 'replace' => []]; } if (!self::isreg($pregArr['rule'])) return $pregArr['rule']; $pregstr = '{' . $pregArr['rule'] . '}'; $pregstr .= empty($pregArr['option']) ? '' : $pregArr['option']; preg_match($pregstr, $code, $match); if (isset($match['1'])) { if (empty($pregArr['replace'])) { return $match['1']; } else { return self::replace($match[1], $pregArr['replace']); } } return ''; } /** * 内容替换 支持正则批量替换 * * @param string $con 代替换的内容 * @param array $arr 替换规则数组 单个元素如下 * array( * 'rule'=>'规则1',//♂后面表示要替换的 内容 * 'option'=>'参数', * 'method'=>1,//1 正则 0普通 * v ), * @return mixed */ public static function replace($con, array $arr) { foreach ($arr as $v) { if (!empty($v['rule'])) { $tmp = explode('♂', $v['rule']); $rule = $tmp['0']; $replace = isset($tmp['1']) ? $tmp['1'] : ''; $v['option'] = isset($v['option']) ? $v['option'] : ''; if ($v['method'] == 1) { //正则 $con = preg_replace("{" . $rule . "}{$v['option']}", $replace, $con); } else { if (strpos($v['option'], 'i') === false) { $con = str_replace($rule, $replace, $con); } else { $con = str_ireplace($rule, $replace, $con); } } } } return $con; } /** * 处理链接,根据当前页面地址得到完整的链接地址 * * @param string $url 当前链接 * @param string $path 当前页面地址 * @return string */ public static function parseUrl($url, $path) { if ($url) { if (strpos($url, '://') === false) { if (substr($url, 0, 1) == '/') { $tmp = parse_url($path); $url = $tmp['scheme'] . '://' . $tmp['host'] . $url; } elseif (substr($url, 0, 3) == '../') { $url = dirname($path) . substr($url, 2); } elseif (substr($path, -1) == '/') { $url = $path . $url; } else { $url = dirname($path) . '/' . $url; } } return $url; } else { return ''; } } /** * 内容切割方式 * * @param string $strings 要切割的内容 * @param string $argl 左侧标识 如果带有.+?则为正则模式 * @param string $argr 右侧标识 如果带有.+?则为正则模式 * @param bool $lt 是否包含左切割字符串 * @param bool $gt 是否包含右切割字符串 * @return string */ public static function cut($strings, $argl, $argr, $lt = false, $gt = false) { if (!$strings) return (""); if (strpos($argl, ".+?")) { $argl = strtr($argl, ["/" => "\/"]); if (preg_match("/" . $argl . "/", $strings, $match)) $argl = $match[0]; } if (strpos($argr, ".+?")) { $argr = strtr($argr, ["/" => "\/"]); if (preg_match("/" . $argr . "/", $strings, $match)) $argr = $match[0]; } $args = explode($argl, $strings); $args = explode($argr, $args[1]); $args = $args[0]; if ($args) { if ($lt) $args = $argl . $args; if ($gt) $args .= $argr; } else { $args = ""; } return ($args); } /** * 简写规则转化 * * @param $rules * @return array|string */ public static function parseMatchRule($rules) { $replace_pairs = [ '{' => '\{', '}' => '\}', '[内容]' => '(.*?)', '[数字]' => '\d*', '[空白]' => '\s*', '[任意]' => '.*?', '[参数]' => '[^\>\<]*?', '[属性]' => '[^\>\<\'"]*?', ]; if (is_array($rules)) { $rules['rule'] = strtr($rules['rule'], $replace_pairs); return $rules; } return strtr($rules, $replace_pairs); } /** * 是否正则 * * @param $str * @return bool */ public static function isreg($str) { return (strpos($str, ')') !== false || strpos($str, '(') !== false); } /** * @param $data * @return array */ public static function parseListData($data) { $list = []; $num = 0; foreach ($data as $v) { if ($v) { if ($num) { if ($num != count($v)) return []; } else { $num = count($v); } } } foreach ($data as $k => $v) { if ($v) { foreach ($v as $kk => $vv) { $list[$kk][$k] = $vv; } } else { for ($i = 0; $i < $num; $i++) { $list[$i][$k] = ''; } } } return $list; } }
pakey/PTFrameWork
kuxin/helper/collect.php
PHP
mit
11,227
/** * JS for the player character. * * * * */ import * as Consts from './consts'; var leftLeg; var rightLeg; var leftArm; var rightArm; const BODY_HEIGHT = 5; const LEG_HEIGHT = 5; const HEAD_HEIGHT = Consts.BLOCK_WIDTH * (3/5); const SKIN_COLORS = [0xFADCAB, 0x9E7245, 0x4F3F2F]; const BASE_MAT = new THREE.MeshLambertMaterial({color: 0xFF0000}); export var Player = function() { THREE.Object3D.call(this); this.position.y += BODY_HEIGHT / 2 + LEG_HEIGHT / 2 + HEAD_HEIGHT / 2 + HEAD_HEIGHT; this.moveLeft = false; this.moveRight = false; this.moveUp = false; this.moveDown = false; this.orientation = "backward"; var scope = this; var legGeo = new THREE.BoxGeometry(Consts.BLOCK_WIDTH / 2, LEG_HEIGHT, Consts.BLOCK_WIDTH / 2); var armGeo = new THREE.BoxGeometry(Consts.BLOCK_WIDTH / 2, BODY_HEIGHT, Consts.BLOCK_WIDTH / 2); // Base mat(s) var redMaterial = new THREE.MeshLambertMaterial({color: 0xFF2E00}); var blueMaterial = new THREE.MeshLambertMaterial({color: 0x23A8FC}); var yellowMaterial = new THREE.MeshLambertMaterial({color: 0xFFD000}); // Skin color mat, only used for head var skinColor = SKIN_COLORS[Math.floor(Math.random() * SKIN_COLORS.length)] var skinMat = new THREE.MeshLambertMaterial({color: skinColor}); // Body material var bodyFrontMat = new THREE.MeshPhongMaterial({color: 0xFFFFFF}); var bodyFrontTexture = new THREE.TextureLoader().load("img/tetratowerbodyfront.png", function(texture) { bodyFrontMat.map = texture; bodyFrontMat.needsUpdate = true; }) var bodyMat = new THREE.MultiMaterial([ redMaterial, redMaterial, redMaterial, redMaterial, bodyFrontMat, bodyFrontMat ]); var armSideMat = new THREE.MeshLambertMaterial({color: 0xFFFFFF}) var armTopMat = new THREE.MeshLambertMaterial({color: 0xFFFFFF}); var armMat = new THREE.MultiMaterial([ armSideMat, armSideMat, armTopMat, armTopMat, armSideMat, armSideMat ]); // Leg material var legSideMat = new THREE.MeshLambertMaterial({color: 0xFFFFFF}) var legMat = new THREE.MultiMaterial([ legSideMat, legSideMat, blueMaterial, blueMaterial, legSideMat, legSideMat ]); var legTexture = new THREE.TextureLoader().load("/img/tetratowerleg.png", function (texture) { legSideMat.map = texture; legSideMat.needsUpdate = true; }); var textureURL; switch (skinColor) { case SKIN_COLORS[0]: textureURL = "/img/tetratowerarm_white.png"; break; case SKIN_COLORS[1]: textureURL = "/img/tetratowerarm_brown.png"; break; case SKIN_COLORS[2]: textureURL = "/img/tetratowerarm_black.png"; break; default: textureURL = "/img/tetratowerarm.png"; break; } var armTexture = new THREE.TextureLoader().load(textureURL, function(texture) { armSideMat.map = texture; armSideMat.needsUpdate = true; }); var armTopTexture = new THREE.TextureLoader().load("img/tetratowerarmtop.png", function(texture) { armTopMat.map = texture; armTopMat.needsUpdate = true; }) // Create a body var bodyGeo = new THREE.BoxGeometry(Consts.BLOCK_WIDTH, BODY_HEIGHT, Consts.BLOCK_WIDTH / 2); var body = new THREE.Mesh(bodyGeo, bodyMat); this.add(body); // Create some leggy legs leftLeg = new THREE.Mesh(legGeo, legMat); this.add(leftLeg) leftLeg.translateX(-Consts.BLOCK_WIDTH / 4); leftLeg.translateY(-(LEG_HEIGHT + BODY_HEIGHT) / 2); rightLeg = new THREE.Mesh(legGeo, legMat); this.add(rightLeg); rightLeg.translateX(Consts.BLOCK_WIDTH / 4); rightLeg.translateY(-(LEG_HEIGHT + BODY_HEIGHT) / 2); // Create the arms leftArm = new THREE.Mesh(armGeo, armMat); this.add(leftArm); leftArm.translateX(-(Consts.BLOCK_WIDTH / 4 + Consts.BLOCK_WIDTH / 2)); rightArm = new THREE.Mesh(armGeo, armMat); this.add(rightArm); rightArm.translateX((Consts.BLOCK_WIDTH / 4 + Consts.BLOCK_WIDTH / 2)); // Now add a head var headGeo = new THREE.BoxGeometry(Consts.BLOCK_WIDTH * (3/5), Consts.BLOCK_WIDTH * (3/5), Consts.BLOCK_WIDTH * (3/5)); var head = new THREE.Mesh(headGeo, skinMat); this.add(head); head.translateY((BODY_HEIGHT + HEAD_HEIGHT) / 2); // And a fashionable hat var hatBodyGeo = new THREE.BoxGeometry(HEAD_HEIGHT * 1.05, HEAD_HEIGHT * (4/5), HEAD_HEIGHT * 1.05); var hatBody = new THREE.Mesh(hatBodyGeo, yellowMaterial); head.add(hatBody); hatBody.translateY(HEAD_HEIGHT * (4/5)); var hatBrimGeo = new THREE.BoxGeometry(HEAD_HEIGHT * 1.05, HEAD_HEIGHT / 5, HEAD_HEIGHT * 0.525); var hatBrim = new THREE.Mesh(hatBrimGeo, yellowMaterial); head.add(hatBrim); hatBrim.translateZ((HEAD_HEIGHT * 1.05) / 2 + (HEAD_HEIGHT * 0.525 / 2)); hatBrim.translateY(HEAD_HEIGHT / 2); // Add some listeners var onKeyDown = function(event) { switch(event.keyCode) { case 38: // up case 87: // w scope.moveForward = true; break; case 40: // down case 83: // s scope.moveBackward = true; break; case 37: // left case 65: // a scope.moveLeft = true; break; case 39: // right case 68: // d scope.moveRight = true; break; } } var onKeyUp = function(event) { switch(event.keyCode) { case 38: // up case 87: // w scope.moveForward = false; break; case 40: // down case 83: // s scope.moveBackward = false; break; case 37: // left case 65: // a scope.moveLeft = false; break; case 39: // right case 68: // d scope.moveRight = false; break; } } document.addEventListener('keydown', onKeyDown, false); document.addEventListener('keyup', onKeyUp, false); } Player.prototype = new THREE.Object3D(); Player.prototype.constructor = Player; THREE.Object3D.prototype.worldToLocal = function ( vector ) { if ( !this.__inverseMatrixWorld ) this.__inverseMatrixWorld = new THREE.Matrix4(); return vector.applyMatrix4( this.__inverseMatrixWorld.getInverse( this.matrixWorld )); }; THREE.Object3D.prototype.lookAtWorld = function( vector ) { vector = vector.clone(); this.parent.worldToLocal( vector ); this.lookAt( vector ); };
Bjorkbat/tetratower
js/src/player.js
JavaScript
mit
6,258
blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"] def normalizeEnter(src): #Deletes all user defined for readability reason existing line breaks that are issues for the HTML output for elem in blocklevel: while src.find("\r<" + elem) > -1: src = src.replace("\r<" + elem, "<" + elem) while src.find("</" + elem + ">\r") > -1: src = src.replace("</" + elem + ">\r", "</" + elem + ">") while src.find(">\r") > -1: src = src.replace(">\r", ">") #It is really needed, it created some other bugs?! while src.find("\r</") > -1: src = src.replace("\r</", "</") ##It is really needed, it created some other bugs?! return src def main(islinput, inputfile, pluginData, globalData): currentIndex = 0 for item in islinput: item = normalizeEnter(item) #Deletes not wanted line breaks in order to prevent the problem we have with Markdown. islinput[currentIndex] = item currentIndex += 1 return islinput, pluginData, globalData
ValorNaram/isl
inputchangers/002.py
Python
mit
1,044
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class DataQuestionnaire extends Model { protected $fillable = ['game_question', 'game_opponent_evaluation', 'study_evaluation']; /** * Relationship with parent DataParticipant. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function data_participant() { return $this->belongsTo('App\Models\DataParticipant'); } }
mihaiconstantin/game-theory-tilburg
app/Models/DataQuestionnaire.php
PHP
mit
460
<?php namespace Tests\Map\Gazzetta; use PHPUnit\Framework\TestCase; use FFQP\Map\Gazzetta\GazzettaMapSince2013; class GazzettaMapSince2013Test extends TestCase { public function testExtractRows() { $map = new GazzettaMapSince2013(); $this->assertInternalType('int', 3); $rows = $map->extractRows('tests/fixtures/2014_quotazioni_gazzetta_01.xls'); $this->assertSame(665, count($rows)); // First Footballer $this->assertSame('101', $rows[0]->code); $this->assertSame('ABBIATI', $rows[0]->player); $this->assertSame('MILAN', $rows[0]->team); $this->assertSame('P', $rows[0]->role); $this->assertSame('P', $rows[0]->secondaryRole); $this->assertSame('1', $rows[0]->status); $this->assertSame('12', $rows[0]->quotation); $this->assertSame('-', $rows[0]->magicPoints); $this->assertSame('-', $rows[0]->vote); $this->assertSame('', $rows[0]->goals); $this->assertSame('', $rows[0]->yellowCards); $this->assertSame('', $rows[0]->redCards); $this->assertSame('', $rows[0]->penalties); $this->assertSame('', $rows[0]->autoGoals); $this->assertSame('', $rows[0]->assists); // Footballer with a vote $this->assertSame('106', $rows[5]->code); $this->assertSame('BARDI', $rows[5]->player); $this->assertSame('CHIEVO', $rows[5]->team); $this->assertSame('P', $rows[5]->role); $this->assertSame('P', $rows[5]->secondaryRole); $this->assertSame('1', $rows[5]->status); $this->assertSame('8', $rows[5]->quotation); $this->assertSame('4', $rows[5]->magicPoints); $this->assertSame('5', $rows[5]->vote); $this->assertSame('-1', $rows[5]->goals); $this->assertSame('0', $rows[5]->yellowCards); $this->assertSame('0', $rows[5]->redCards); $this->assertSame('0', $rows[5]->penalties); $this->assertSame('0', $rows[5]->autoGoals); $this->assertSame('0', $rows[5]->assists); // Footballer without a vote $this->assertSame('105', $rows[4]->code); $this->assertSame('AVRAMOV', $rows[4]->player); $this->assertSame('ATALANTA', $rows[4]->team); $this->assertSame('P', $rows[4]->role); $this->assertSame('P', $rows[4]->secondaryRole); $this->assertSame('1', $rows[4]->status); $this->assertSame('1', $rows[4]->quotation); $this->assertSame('-', $rows[4]->magicPoints); $this->assertSame('-', $rows[4]->vote); $this->assertSame('', $rows[4]->goals); $this->assertSame('', $rows[4]->yellowCards); $this->assertSame('', $rows[4]->redCards); $this->assertSame('', $rows[4]->penalties); $this->assertSame('', $rows[4]->autoGoals); $this->assertSame('', $rows[4]->assists); } }
astronati/fantasy-football-quotations-parser
tests/Map/Gazzetta/GazzettaMapSince2013Test.php
PHP
mit
2,877
<?php namespace ObjectStorage\Test\Adapter; use ObjectStorage\Adapter\PlaintextStorageKeyEncryptedStorageAdapter; use ObjectStorage\Adapter\StorageAdapterInterface; use ParagonIE\Halite\KeyFactory; use ParagonIE\Halite\Symmetric\Crypto; use ParagonIE\HiddenString\HiddenString; use PHPUnit\Framework\Constraint\LogicalNot; use PHPUnit\Framework\TestCase; class PlaintextStorageKeyEncryptedStorageAdapterTest extends TestCase { private $encryptedStorageAdapter; private $encryptionKey; private $storageAdapter; protected function setUp(): void { $this->encryptionKey = KeyFactory::generateEncryptionKey(); $this->storageAdapter = $this->getMockBuilder(StorageAdapterInterface::class) ->getMockForAbstractClass() ; $this->encryptedStorageAdapter = new PlaintextStorageKeyEncryptedStorageAdapter( $this->storageAdapter, $this->encryptionKey ); } public function testSetDataDoesNotPassUnencryptedDataToStorageAdapter() { $this->storageAdapter ->expects($this->once()) ->method('setData') ->with( $this->identicalTo('some-key'), new LogicalNot('some-data') ) ; $this->encryptedStorageAdapter->setData('some-key', 'some-data'); } public function testGetDataDoesNotPassUnencryptedDataToStorageAdapter() { $this->storageAdapter ->expects($this->once()) ->method('getData') ->with($this->identicalTo('some-key')) ->willReturn(Crypto::encrypt(new HiddenString('some-data'), $this->encryptionKey)) ; $this->encryptedStorageAdapter->getData('some-key'); } public function testDeleteDataDoesNotPassUnencryptedDataToStorageAdapter() { $this->storageAdapter ->expects($this->once()) ->method('deleteData') ->with($this->identicalTo('some-key')) ; $this->encryptedStorageAdapter->deleteData('some-key'); } }
linkorb/objectstorage
tests/Adapter/PlaintextStorageKeyEncryptedStorageAdapterTest.php
PHP
mit
2,076
package com.github.kolandroid.kol.model.elements.basic; import com.github.kolandroid.kol.model.elements.interfaces.ModelGroup; import java.util.ArrayList; import java.util.Iterator; public class BasicGroup<E> implements ModelGroup<E> { /** * Autogenerated by eclipse. */ private static final long serialVersionUID = 356357357356695L; private final ArrayList<E> items; private final String name; public BasicGroup(String name) { this(name, new ArrayList<E>()); } public BasicGroup(String name, ArrayList<E> items) { this.name = name; this.items = items; } @Override public int size() { return items.size(); } @Override public E get(int index) { return items.get(index); } @Override public void set(int index, E value) { items.set(index, value); } @Override public void remove(int index) { items.remove(index); } public void add(E item) { items.add(item); } @Override public String getName() { return name; } @Override public Iterator<E> iterator() { return items.iterator(); } }
Kasekopf/kolandroid
kol_base/src/main/java/com/github/kolandroid/kol/model/elements/basic/BasicGroup.java
Java
mit
1,193
import Ember from 'ember'; import { module, test } from 'qunit'; import startApp from 'superhero/tests/helpers/start-app'; import characterData from '../fixtures/character'; var application, server; module('Acceptance: Character', { beforeEach: function() { application = startApp(); var character = characterData(); server = new Pretender(function() { this.get('/v1/public/characters/1009609', function(request) { var responseData = JSON.stringify(character); return [ 200, {"Content-Type": "application/json"}, responseData ]; }); }); }, afterEach: function() { Ember.run(application, 'destroy'); server.shutdown(); } }); test('visiting /characters/1009609 shows character detail', function(assert) { assert.expect(3); visit('/characters/1009609'); andThen(function() { assert.equal(currentURL(), '/characters/1009609'); assert.equal(find('.heading').text(), 'Spider-Girl (May Parker)', 'Should show character heading'); assert.equal( find('.description').text(), "May \"Mayday\" Parker is the daughter of Spider-Man and Mary Jane Watson-Parker. Born with all her father's powers-and the same silly sense of humor-she's grown up to become one of Earth's most trusted heroes and a fitting tribute to her proud papa.", 'Should show character descripton' ); }); }); test('visiting /characters/1009609 shows key events for the character', function(assert) { assert.expect(2); visit('/characters/1009609'); andThen(function() { assert.equal(find('.events .event').length, 1, 'Should show one event'); assert.equal( find('.events .event:first').text(), 'Fear Itself', 'Should show event name' ); }); });
dtt101/superhero
tests/acceptance/character-test.js
JavaScript
mit
1,790
#!/usr/bin/env node (function () { var DirectoryLayout = require('../lib/index.js'), program = require('commander'), options; program .version('1.0.2') .usage('[options] <path, ...>') .option('-g, --generate <path> <output-directory-layout-file-path>', 'Generate directory layout') .option('-v, --verify <input-directory-layout-file-path> <path>', 'Verify directory layout') .parse(process.argv); if(program.generate) { options = { output: program.args[0] || 'layout.md', ignore: [] }; console.log('Generating layout for ' + program.generate + '... \n') DirectoryLayout .generate(program.generate, options) .then(function() { console.log('Layout generated at: ' + options.output); }); } else if(program.verify) { options = { root: program.args[0] }; console.log('Verifying layout for ' + options.root + ' ...\n'); DirectoryLayout .verify(program.verify, options) .then(function() { console.log('Successfully verified layout available in ' + program.verify + '.'); }); } }());
ApoorvSaxena/directory-layout
bin/index.js
JavaScript
mit
1,267
var class_snowflake_1_1_game_1_1_game_database = [ [ "GameDatabase", "class_snowflake_1_1_game_1_1_game_database.html#a2f09c1f7fe18beaf8be1447e541f4d68", null ], [ "AddGame", "class_snowflake_1_1_game_1_1_game_database.html#a859513bbac24328df5d3fe2e47dbc183", null ], [ "GetAllGames", "class_snowflake_1_1_game_1_1_game_database.html#a7c43f2ccabe44f0491ae25e9b88bb07a", null ], [ "GetGameByUUID", "class_snowflake_1_1_game_1_1_game_database.html#ada7d853b053f0bbfbc6dea8eb89e85c4", null ], [ "GetGamesByName", "class_snowflake_1_1_game_1_1_game_database.html#ac1bbd90e79957e360dd5542f6052616e", null ], [ "GetGamesByPlatform", "class_snowflake_1_1_game_1_1_game_database.html#a2e93a35ea18a9caac9a6165cb33b5494", null ] ];
SnowflakePowered/snowflakepowered.github.io
doc/html/class_snowflake_1_1_game_1_1_game_database.js
JavaScript
mit
745
package org.winterblade.minecraft.harmony.api.questing; import org.winterblade.minecraft.scripting.api.IScriptObjectDeserializer; import org.winterblade.minecraft.scripting.api.ScriptObjectDeserializer; /** * Created by Matt on 5/29/2016. */ public enum QuestStatus { INVALID, ACTIVE, LOCKED, COMPLETE, CLOSED; @ScriptObjectDeserializer(deserializes = QuestStatus.class) public static class Deserializer implements IScriptObjectDeserializer { @Override public Object Deserialize(Object input) { if(!String.class.isAssignableFrom(input.getClass())) return null; return QuestStatus.valueOf(input.toString().toUpperCase()); } } }
legendblade/CraftingHarmonics
api/src/main/java/org/winterblade/minecraft/harmony/api/questing/QuestStatus.java
Java
mit
697
package leetcode11_20; /**Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Try to do this in one pass. */ public class RemoveNthFromEnd { // Definition for singly-linked list. public static class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } //one pass public ListNode removeNthFromEnd(ListNode head, int n) { ListNode dummy = new ListNode(0); dummy.next = head; ListNode slow = dummy, fast = dummy; //Move fast in front so that the gap between slow and fast becomes n for(int i=1; i<=n+1; i++) { //TODO 注意边界 fast = fast.next; } while(fast != null) {//Move fast to the end, maintaining the gap slow = slow.next; fast = fast.next; } slow.next = slow.next.next;//Skip the desired node return dummy.next; } //two pass public ListNode removeNthFromEnd1(ListNode head, int n) { int length = 0; ListNode temp = head; while (temp != null){ length++; temp = temp.next; } if (n == length) return head.next; temp = head; for (int i = 2; i <= length - n; i++){ //TODO 循环条件极易出错 temp = temp.next; } temp.next = temp.next.next; return head; } }
Ernestyj/JStudy
src/main/java/leetcode11_20/RemoveNthFromEnd.java
Java
mit
1,586
package org.kohsuke.github; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLEncoder; import java.util.Collections; import java.util.Date; import java.util.List; import static java.lang.String.*; /** * Release in a github repository. * * @see GHRepository#getReleases() GHRepository#getReleases() * @see GHRepository#listReleases() () GHRepository#listReleases() * @see GHRepository#createRelease(String) GHRepository#createRelease(String) */ public class GHRelease extends GHObject { GHRepository owner; private String html_url; private String assets_url; private List<GHAsset> assets; private String upload_url; private String tag_name; private String target_commitish; private String name; private String body; private boolean draft; private boolean prerelease; private Date published_at; private String tarball_url; private String zipball_url; private String discussion_url; /** * Gets discussion url. Only present if a discussion relating to the release exists * * @return the discussion url */ public String getDiscussionUrl() { return discussion_url; } /** * Gets assets url. * * @return the assets url */ public String getAssetsUrl() { return assets_url; } /** * Gets body. * * @return the body */ public String getBody() { return body; } /** * Is draft boolean. * * @return the boolean */ public boolean isDraft() { return draft; } /** * Sets draft. * * @param draft * the draft * @return the draft * @throws IOException * the io exception * @deprecated Use {@link #update()} */ @Deprecated public GHRelease setDraft(boolean draft) throws IOException { return update().draft(draft).update(); } public URL getHtmlUrl() { return GitHubClient.parseURL(html_url); } /** * Gets name. * * @return the name */ public String getName() { return name; } /** * Sets name. * * @param name * the name */ public void setName(String name) { this.name = name; } /** * Gets owner. * * @return the owner */ @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") public GHRepository getOwner() { return owner; } /** * Sets owner. * * @param owner * the owner * @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding. */ @Deprecated public void setOwner(GHRepository owner) { throw new RuntimeException("Do not use this method."); } /** * Is prerelease boolean. * * @return the boolean */ public boolean isPrerelease() { return prerelease; } /** * Gets published at. * * @return the published at */ public Date getPublished_at() { return new Date(published_at.getTime()); } /** * Gets tag name. * * @return the tag name */ public String getTagName() { return tag_name; } /** * Gets target commitish. * * @return the target commitish */ public String getTargetCommitish() { return target_commitish; } /** * Gets upload url. * * @return the upload url */ public String getUploadUrl() { return upload_url; } /** * Gets zipball url. * * @return the zipball url */ public String getZipballUrl() { return zipball_url; } /** * Gets tarball url. * * @return the tarball url */ public String getTarballUrl() { return tarball_url; } GHRelease wrap(GHRepository owner) { this.owner = owner; return this; } static GHRelease[] wrap(GHRelease[] releases, GHRepository owner) { for (GHRelease release : releases) { release.wrap(owner); } return releases; } /** * Because github relies on SNI (http://en.wikipedia.org/wiki/Server_Name_Indication) this method will only work on * Java 7 or greater. Options for fixing this for earlier JVMs can be found here * http://stackoverflow.com/questions/12361090/server-name-indication-sni-on-java but involve more complicated * handling of the HTTP requests to github's API. * * @param file * the file * @param contentType * the content type * @return the gh asset * @throws IOException * the io exception */ public GHAsset uploadAsset(File file, String contentType) throws IOException { FileInputStream s = new FileInputStream(file); try { return uploadAsset(file.getName(), s, contentType); } finally { s.close(); } } /** * Upload asset gh asset. * * @param filename * the filename * @param stream * the stream * @param contentType * the content type * @return the gh asset * @throws IOException * the io exception */ public GHAsset uploadAsset(String filename, InputStream stream, String contentType) throws IOException { Requester builder = owner.root().createRequest().method("POST"); String url = getUploadUrl(); // strip the helpful garbage from the url url = url.substring(0, url.indexOf('{')); url += "?name=" + URLEncoder.encode(filename, "UTF-8"); return builder.contentType(contentType).with(stream).withUrlPath(url).fetch(GHAsset.class).wrap(this); } /** * Get the cached assets. * * @return the assets * * @deprecated This should be the default behavior of {@link #getAssets()} in a future release. This method is * introduced in addition to enable a transition to using cached asset information while keeping the * existing logic in place for backwards compatibility. */ @Deprecated public List<GHAsset> assets() { return Collections.unmodifiableList(assets); } /** * Re-fetch the assets of this release. * * @return the assets * @throws IOException * the io exception * @deprecated The behavior of this method will change in a future release. It will then provide cached assets as * provided by {@link #assets()}. Use {@link #listAssets()} instead to fetch up-to-date information of * assets. */ @Deprecated public List<GHAsset> getAssets() throws IOException { return listAssets().toList(); } /** * Re-fetch the assets of this release. * * @return the assets * @throws IOException * the io exception */ public PagedIterable<GHAsset> listAssets() throws IOException { Requester builder = owner.root().createRequest(); return builder.withUrlPath(getApiTailUrl("assets")).toIterable(GHAsset[].class, item -> item.wrap(this)); } /** * Deletes this release. * * @throws IOException * the io exception */ public void delete() throws IOException { root().createRequest().method("DELETE").withUrlPath(owner.getApiTailUrl("releases/" + getId())).send(); } /** * Updates this release via a builder. * * @return the gh release updater */ public GHReleaseUpdater update() { return new GHReleaseUpdater(this); } private String getApiTailUrl(String end) { return owner.getApiTailUrl(format("releases/%s/%s", getId(), end)); } }
kohsuke/github-api
src/main/java/org/kohsuke/github/GHRelease.java
Java
mit
8,107
import cairo from gi.repository import Gtk from gi.repository import Gdk from pylsner import plugin class Window(Gtk.Window): def __init__(self): super(Window, self).__init__(skip_pager_hint=True, skip_taskbar_hint=True, ) self.set_title('Pylsner') screen = self.get_screen() self.width = screen.get_width() self.height = screen.get_height() self.set_size_request(self.width, self.height) self.set_position(Gtk.WindowPosition.CENTER) rgba = screen.get_rgba_visual() self.set_visual(rgba) self.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0, 0, 0, 0), ) self.set_wmclass('pylsner', 'pylsner') self.set_type_hint(Gdk.WindowTypeHint.DOCK) self.stick() self.set_keep_below(True) drawing_area = Gtk.DrawingArea() drawing_area.connect('draw', self.redraw) self.refresh_cnt = 0 self.add(drawing_area) self.connect('destroy', lambda q: Gtk.main_quit()) self.widgets = [] self.show_all() def refresh(self, force=False): self.refresh_cnt += 1 if self.refresh_cnt >= 60000: self.refresh_cnt = 0 redraw_required = False for wid in self.widgets: if (self.refresh_cnt % wid.metric.refresh_rate == 0) or force: wid.refresh() redraw_required = True if redraw_required: self.queue_draw() return True def redraw(self, _, ctx): ctx.set_antialias(cairo.ANTIALIAS_SUBPIXEL) for wid in self.widgets: wid.redraw(ctx) class Widget: def __init__(self, name='default', metric={'plugin': 'time'}, indicator={'plugin': 'arc'}, fill={'plugin': 'rgba_255'}, ): self.name = name MetricPlugin = plugin.load_plugin('metrics', metric['plugin']) self.metric = MetricPlugin(**metric) IndicatorPlugin = plugin.load_plugin('indicators', indicator['plugin']) self.indicator = IndicatorPlugin(**indicator) FillPlugin = plugin.load_plugin('fills', fill['plugin']) self.fill = FillPlugin(**fill) def refresh(self): self.metric.refresh() self.fill.refresh(self.metric.value) def redraw(self, ctx): ctx.set_source(self.fill.pattern) self.indicator.redraw(ctx, self.metric.value)
mrmrwat/pylsner
pylsner/gui.py
Python
mit
2,624
<?php $t = $a->getThing(); ?> <div class="linkitem item-flavour-<?php echo $a->getFlavour() ?>" id="link-item-<?php echo $a->getId(); ?>"> <?php if (isset($nopos)): ?> <span class="itempos">&nbsp;</span> <?php else: ?> <span class="itempos"><?php echo $pos; ?></span> <?php endif; ?> <div class="votebtn"> <?php if ($sf_user->isAuthenticated()):?> <?php $vote = $a->getThing()->getUserVote($sf_user->getId()); ?> <?php if ($vote): ?> <?php if ($vote['type'] == 'up'): ?> <a href="#" onclick="voteUp(this, <?php echo $t->getId(); ?>); return false;"> <?php echo image_tag('mod_up.png', array('id' => 'link-up-' . $t->getId())) ?> </a> <?php else: ?> <a href="#" onclick="voteUp(this, <?php echo $t->getId(); ?>); return false;"> <?php echo image_tag('up.png', array('id' => 'link-up-' . $t->getId())) ?> </a> <?php endif; ?> <?php if ($vote['type'] == 'down'): ?> <a href="#" onclick="voteDown(this, <?php echo $t->getId(); ?>); return false;"> <?php echo image_tag('mod_down.png', array('id' => 'link-down-' . $t->getId())) ?> </a> <?php else: ?> <a href="#" onclick="voteDown(this, <?php echo $t->getId(); ?>); return false;"> <?php echo image_tag('down.png', array('id' => 'link-down-' . $t->getId())) ?> </a> <?php endif; ?> <?php else: ?> <a href="#" onclick="voteUp(this, <?php echo $t->getId(); ?>); return false;"><?php echo image_tag('up.png', array('id' => 'link-up-' . $t->getId())) ?></a> <a href="#" onclick="voteDown(this, <?php echo $t->getId(); ?>); return false;"><?php echo image_tag('down.png', array('id' => 'link-down-' . $t->getId())) ?></a> <?php endif; ?> <?php else: ?> <a href="#" onclick="return false;"><?php echo image_tag('up.png', array('id' => 'link-up-' . $t->getId())) ?></a> <a href="#" onclick="return false;"><?php echo image_tag('down.png', array('id' => 'link-down-' . $t->getId())) ?></a> <?php endif; ?> </div> <div class="item"> <?php if ($a->getFlavour() == 'link'): ?> <p><?php echo link_to($a->getTitle(), $a->getUrl(), array('class' => 'name', 'target' => '_blank', 'rel' => 'nofollow')); ?></p> <p class="url"><?php echo $a->getUrl(); ?></p> <?php else: ?> <p><?php echo link_to($a->getTitle(), $a->getViewUrl(), array('class' => 'name')); ?></p> <?php endif;?> <p class="link_footer"> <span class="flavour-<?php echo $a->getFlavour(); ?>"><?php echo $a->getFlavour(); ?></span> <?php $score = $t->getScore(); ?> <?php if ($score > 0): ?> <?php if ($score === 1): ?> <span id="link-score-<?php echo $t->getId(); ?>"><?php echo $t->getScore(); ?></span> point <?php else: ?> <span id="link-score-<?php echo $t->getId(); ?>"><?php echo $t->getScore(); ?></span> points <?php endif; ?> <?php endif; ?> posted <?php echo time_ago_in_words(strtotime($a->getCreatedAt())) ?> ago by <span class="link_author"><?php echo link_to($a->getUsername(), "@show_profile?username=" . $a->getUsername()); ?></span> <?php $comment_count = $a->getTotalComments(); ?> <?php if ($comment_count == 1): ?> <a class="ctrl" href="<?php echo url_for($a->getViewUrl()); ?>">1 comment</a> <?php else: ?> <a class="ctrl" href="<?php echo url_for($a->getViewUrl()); ?>"><?php echo $comment_count; ?> comments</a> <?php endif; ?> <?php if ($sf_user->isAuthenticated() && $sf_user->isAdmin()): ?> <?php echo link_to('delete', 'article/delete?articleid=' . $a->getId(), array('class' => 'ctrl admin', 'confirm' => 'Are you sure you want to delet this?')); ?> <?php endif; ?> </p> <?php if ($a->getFlavour() == 'snapshot'): ?> <?php $snapshot = $a->getSnapshot(true); ?> <a title="<?php echo $a->getTitle(); ?>" rel="lightbox" target="_blank" href="<?php echo $snapshot->getUrl(); ?>"><img class="snapshot" src="<?php echo $snapshot->getThumbnailUrl(200); ?>" /></a> <p class="link_summary"><?php echo truncate_text($a->getSummary(), 200); ?></p> <div class="clear"></div> <?php endif; ?> <?php if ($a->getFlavour() == 'link'): ?> <p class="link_summary"><?php echo truncate_text($a->getSummary(), 200); ?></p> <?php if ($a->getHasThumbnails()): ?> <?php $ftas = $a->getFiles(true); ?> <?php if (count($ftas) > 0): ?> <div class="preview"> <?php foreach ($ftas as $fta): ?> <img class="preview-image" src="<?php echo $fta->getFile()->getThumbnailUrl(); ?>" /> <?php endforeach; ?> </div> <?php endif; ?> <?php endif; ?> <?php endif; ?> <?php if ($a->getFlavour() == 'code'): ?> <pre style="display: none;" class="brush: <?php echo $a->getBrushAlias(); ?>"><?php echo htmlspecialchars($a->getCode()); ?></pre> <?php endif; ?> <?php if ($a->getFlavour() == 'question'): ?> <div class="question-body"><?php echo $a->getQuestionHtml(); ?></div> <?php endif; ?> </div> <div style="clear:both;"></div> </div>
sanjeevan/codelovely
apps/frontend/modules/article/templates/_article.php
PHP
mit
5,279
import { Physics as EightBittrPhysics } from "eightbittr"; import { FullScreenPokemon } from "../FullScreenPokemon"; import { Direction } from "./Constants"; import { Character, Grass, Actor } from "./Actors"; /** * Physics functions to move Actors around. */ export class Physics<Game extends FullScreenPokemon> extends EightBittrPhysics<Game> { /** * Determines the bordering direction from one Actor to another. * * @param actor The source Actor. * @param other The destination Actor. * @returns The direction from actor to other. */ public getDirectionBordering(actor: Actor, other: Actor): Direction | undefined { if (Math.abs(actor.top - (other.bottom - other.tolBottom)) < 4) { return Direction.Top; } if (Math.abs(actor.right - other.left) < 4) { return Direction.Right; } if (Math.abs(actor.bottom - other.top) < 4) { return Direction.Bottom; } if (Math.abs(actor.left - other.right) < 4) { return Direction.Left; } return undefined; } /** * Determines the direction from one Actor to another. * * @param actor The source Actor. * @param other The destination Actor. * @returns The direction from actor to other. * @remarks Like getDirectionBordering, but for cases where the two Actors * aren't necessarily touching. */ public getDirectionBetween(actor: Actor, other: Actor): Direction { const dx: number = this.getMidX(other) - this.getMidX(actor); const dy: number = this.getMidY(other) - this.getMidY(actor); if (Math.abs(dx) > Math.abs(dy)) { return dx > 0 ? Direction.Right : Direction.Left; } return dy > 0 ? Direction.Bottom : Direction.Top; } /** * Checks whether one Actor is overlapping another. * * @param actor An in-game Actor. * @param other An in-game Actor. * @returns Whether actor and other are overlapping. */ public isActorWithinOther(actor: Actor, other: Actor): boolean { return ( actor.top >= other.top && actor.right <= other.right && actor.bottom <= other.bottom && actor.left >= other.left ); } /** * Determines whether a Character is visually within grass. * * @param actor An in-game Character. * @param other Grass that actor might be in. * @returns Whether actor is visually within other. */ public isActorWActorrass(actor: Character, other: Grass): boolean { if (actor.right <= other.left) { return false; } if (actor.left >= other.right) { return false; } if (other.top > actor.top + actor.height / 2) { return false; } if (other.bottom < actor.top + actor.height / 2) { return false; } return true; } /** * Shifts a Character according to its xvel and yvel. * * @param actor A Character to shift. */ public shiftCharacter(actor: Character): void { if (actor.bordering[Direction.Top] && actor.yvel < 0) { actor.yvel = 0; } if (actor.bordering[Direction.Right] && actor.xvel > 0) { actor.xvel = 0; } if (actor.bordering[Direction.Bottom] && actor.yvel > 0) { actor.yvel = 0; } if (actor.bordering[Direction.Left] && actor.xvel < 0) { actor.xvel = 0; } this.shiftBoth(actor, actor.xvel, actor.yvel); } /** * Snaps a moving Actor to a predictable grid position. * * @param actor An Actor to snap the position of. */ public snapToGrid(actor: Actor): void { const grid = 32; const x: number = (this.game.mapScreener.left + actor.left) / grid; const y: number = (this.game.mapScreener.top + actor.top) / grid; this.setLeft(actor, Math.round(x) * grid - this.game.mapScreener.left); this.setTop(actor, Math.round(y) * grid - this.game.mapScreener.top); } }
FullScreenShenanigans/FullScreenPokemon
src/sections/Physics.ts
TypeScript
mit
4,204
import {Model} from '../../models/base/Model'; import {Subject} from 'rxjs/Subject'; import {BaseService} from '../BaseService'; import {ActivatedRoute, Router} from '@angular/router'; import {UserRights, UserService} from '../../services/UserService'; import {ListTableColumn} from './ListTableColumn'; import {BehaviorSubject} from 'rxjs/BehaviorSubject'; import {SortDirection} from '../SortDirection'; import {ListTableColumnActionType, ListTableColumnType} from './ListEnums'; export class ListProvider<T extends Model> { public currentPage = 1; public itemsPerPage = 10; public totalItems = 0; public dataLoaded = false; public items: Subject<T[]>; public cardTitle = ''; public cardIcon = ''; public columns: ListTableColumn<T>[]; public sortDirection = SortDirection; public columnTypes = ListTableColumnType; public actionTypes = ListTableColumnActionType; protected title = 'Список'; private sort = '-id'; public getRowClass: (model: T) => { [key: string]: boolean }; private static getSortKey(column: string, desc: boolean = false): string { let sortKey = column; if (desc) { sortKey = '-' + sortKey; } return sortKey; } constructor(private service: BaseService<T>, private router: Router, private route: ActivatedRoute, private _userService: UserService) { } public init() { this.items = new BehaviorSubject<T[]>([]); this.route.queryParamMap.subscribe(params => { const pageNumber = parseInt(params.get('page'), 10); if (pageNumber >= 1) { this.currentPage = pageNumber; } const sort = params.get('sort'); if (sort != null) { this.sort = sort; const key = this.sort.replace('-', ''); const sortDirection = this.sort.indexOf('-') > -1 ? SortDirection.Desc : SortDirection.Asc; this.columns.forEach(col => { col.setSorted(col.Key === key ? sortDirection : null); }); } this.load(this.currentPage); }); } public applySort(column: string) { let sortKey; if (this.sort === column) { sortKey = ListProvider.getSortKey(column, true); } else { sortKey = ListProvider.getSortKey(column); } this.sort = sortKey; this.reload(); } public changePage(page: number) { this.currentPage = page; this.reload(); } public load(page?: number) { page = page ? page : this.currentPage; this.service.getList(page, this.itemsPerPage, this.sort).subscribe((res) => { this.items.next(res.data); this.totalItems = res.totalItems; this.currentPage = page; this.dataLoaded = true; }); } private reload() { this.router.navigate([], {queryParams: {page: this.currentPage, sort: this.sort}, relativeTo: this.route}); } public can(right: UserRights): boolean { return this._userService.hasRight(right); } }
BioWareRu/Admin
src/core/lists/ListProvider.ts
TypeScript
mit
2,898
# Given the list values = [] , write code that fills the list with each set of numbers below. # a.1 2 3 4 5 6 7 8 9 10 list = [] for i in range(11): list.append(i) print(list)
futurepr0n/Books-solutions
Python-For-Everyone-Horstmann/Chapter6-Lists/R6.1A.py
Python
mit
203
using System; using System.IO; using System.ServiceProcess; using InEngine.Core; //using Mono.Unix; //using Mono.Unix.Native; namespace InEngine { class Program { public const string ServiceName = "InEngine.NET"; public static ServerHost ServerHost { get; set; } static void Main(string[] args) { /* * Set current working directory as services use the system directory by default. * Also, maybe run from the CLI from a different directory than the application root. */ Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); new ArgumentInterpreter().Interpret(args); } /// <summary> /// Start the server as a service or as a CLI program in the foreground. /// </summary> public static void RunServer() { var settings = InEngineSettings.Make(); ServerHost = new ServerHost() { MailSettings = settings.Mail, QueueSettings = settings.Queue, }; if (!Environment.UserInteractive && Type.GetType("Mono.Runtime") == null) { using (var service = new Service()) ServiceBase.Run(service); } else { ServerHost.Start(); Console.WriteLine("Press any key to exit..."); Console.ReadLine(); ServerHost.Dispose(); } } static void Start(string[] args) { ServerHost.Start(); } static void Stop() { ServerHost.Dispose(); } public class Service : ServiceBase { public Service() { ServiceName = Program.ServiceName; } protected override void OnStart(string[] args) { Start(args); } protected override void OnStop() { Stop(); } } } }
InEngine-NET/InEngine.NET
src/InEngine/Program.cs
C#
mit
2,105
// JavaScript Document $(document).ready(function() { $('form input[type="file"]').change(function() { var filename = $(this).val(); $(this).prev('i').text(filename); }); $('.input-file').click(function() { $(this).find('input').click(); }); /* * Previene doble click en boton submit de envio de datos de formulario y evitar doble envio */ $('form').on('submit', function() { var submit = $(this).find('input[type="submit"]'); submit.attr('disabled','yes').css('cursor', 'not-allowed'); }); $('form').on('reset', function() { $('form .input-file i').text('Selecciona un archivo'); }); /* * Toggle en menu principal lateral */ $('ul#navi li').click(function() { $(this).next('ul').slideToggle('fast'); //$(this).toggleClass('active'); }); /* * Coloca un simbolo para identificar los item con subitems en el menu navegacion izquierda */ $('ul.subnavi').each(function() { var ori_text = $(this).prev('li').find('a').text(); $(this).prev('li').find('a').html(ori_text+'<span class="fa ellipsis">&#xf107;</span>'); }); /* * Despliega cuadro de informacion de usuario */ $('li.user_photo, li.user_letter').click(function(e) { $(this).next('div.user_area').fadeToggle(50); e.stopPropagation(); }); $('body').click(function() { $('li.user_photo, li.user_letter').next('div.user_area').hide(); }); $('div.user_area').click(function(e) { e.stopPropagation(); }); /* * Mostrar/Ocultar mapa */ $('#toggle_map').click(function() { $('ul.map_icon_options').fadeToggle('fast'); $('img#mapa').fadeToggle('fast'); $(this).toggleClass('active'); }); /* * Confirmación de cerrar sesión */ /*$('#cerrar_sesion').click(function() { return confirm(String.fromCharCode(191)+'Esta seguro que desea salir de la sesi'+String.fromCharCode(243)+'n?'); });*/ /* * Confirmación de eliminar datos */ $('a.eliminar').click(function() { return confirm(String.fromCharCode(191)+'Esta seguro que desea eliminar este registro?'); }); /* * Confirmación de quitar asignacion a responsable de un area */ $('a.quitar_asignacion').click(function() { return confirm('Se quitara la asignacion al usuario. '+String.fromCharCode(191)+'Desea continuar?'); }); /* * Ajusta tamaño a imagenes de mapas que son mas altas que anchas */ $('.map_wrapper img#mapa').each(function() { var h = $(this).height(); var w = $(this).width(); if(h > w) { $(this).css('width', '50%').addClass('halign'); } }) /* * Envia a impresion */ $('#print').click(function() { window.print(); }); /* * Inhabilita el click derecho */ $(function(){ $(document).bind("contextmenu",function(e){ return false; }); }); /* * Toma atruto ALT de campo de formulario y lo usa como descripcion debajo del campo */ $('form.undertitled').find('input:text, input:password, input:file, select, textarea').each(function() { $(this).after('<span>'+$(this).attr('title')+'</span>'); }); /* * Hack para centrar horizontalmente mensajes de notificación */ $('p.notify').each(function() { var w = $(this).width(); $(this).css('left', -(w/2)+'px'); }).delay(5000).fadeOut('medium'); //-- /* * Focus en elementos de tabla */ $("table tbody tr").click(function() { $(this).addClass('current').siblings("tr").removeClass('current'); }); /* * Hace scroll al tope de la página * * $('.boton_accion').toTop(); */ $.fn.toTop = function() { $(this).click(function() { $('html, body').animate({scrollTop:0}, 'medium'); }) } //-- /* * Ventana modal * @param text box * Qparam text overlay * * $('.boton_que_acciona_ventana').lightbox('.objeto_a_mostrar', 'w|d : opcional') * w : Muestra una ventana al centro de la pantalla en fondo blanco * d : Muestra una ventana al top de la pantalla sobre fondo negro, si no define * el segundo parametro se mostrara por default este modo. */ $.fn.lightbox = function(box, overlay='d') { $(this).click(function() { var ol = (overlay=='w') ? 'div.overlay_white' : 'div.overlay'; $(ol).fadeIn(250).click(function() { $(box).slideUp(220); $(this).delay(221).fadeOut(250); }).attr('title','Click para cerrar'); $(box).delay(251).slideDown(220); }); if(overlay=='d') { $(box).each(function() { $(this).html($(this).html()+'<p style="border-top:1px #CCC solid; color:#888; margin-bottom:0; padding-top:10px">Para cerrar esta ventana haga click sobre el &aacute;rea sombreada.</p>'); }); } }; //-- })
rguezque/enlaces
web/res/js/jquery-functions.js
JavaScript
mit
4,483
<?php namespace App\Jobs; use App\Jobs\Job; use App\Models\API\Outpost; use DB; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Log; use Pheal\Pheal; class UpdateOutpostsJob extends Job implements ShouldQueue { use InteractsWithQueue, SerializesModels; /** * @var \App\Models\API\Outpost; */ private $outpost; /** * @var \Pheal\Pheal */ private $pheal; /** * Create a new job instance. * @param \App\Models\API\Outpost $outpost * @param \Pheal\Pheal $pheal * @return void */ public function __construct(Outpost $outpost, Pheal $pheal) { $this->outpost = $outpost; $this->pheal = $pheal; } /** * Execute the job. * @return void */ public function handle() { try { Log::info('Updating outposts.'); DB::transaction(function () { $stations = $this->pheal->eveScope->ConquerableStationList(); foreach ($stations->outposts as $station) { $this->outpost->updateOrCreate([ 'stationID' => $station->stationID, ], [ 'stationName' => $station->stationName, 'stationTypeID' => $station->stationTypeID, 'solarSystemID' => $station->solarSystemID, 'corporationID' => $station->corporationID, 'corporationName' => $station->corporationName, 'x' => $station->x, 'y' => $station->y, 'z' => $station->z, ]); } }); // transaction } catch (Exception $e) { Log::error('Failed updating outposts. Throwing exception:'); throw $e; } } }
msims04/eve-buyback
app/Jobs/UpdateOutpostsJob.php
PHP
mit
1,614
using System; using System.Net; using Jasper.Configuration; using Jasper.Runtime; using Jasper.Transports; using Jasper.Transports.Sending; using Jasper.Util; namespace Jasper.Tcp { public class TcpEndpoint : Endpoint { public TcpEndpoint() : this("localhost", 2000) { } public TcpEndpoint(int port) : this ("localhost", port) { } public TcpEndpoint(string hostName, int port) { HostName = hostName; Port = port; Name = Uri.ToString(); } protected override bool supportsMode(EndpointMode mode) { return mode != EndpointMode.Inline; } public override Uri Uri => ToUri(Port, HostName); public static Uri ToUri(int port, string hostName = "localhost") { return $"tcp://{hostName}:{port}".ToUri(); } public override Uri ReplyUri() { var uri = ToUri(Port, HostName); if (Mode != EndpointMode.Durable) { return uri; } return $"{uri}durable".ToUri(); } public string HostName { get; set; } = "localhost"; public int Port { get; private set; } public override void Parse(Uri uri) { if (uri.Scheme != "tcp") { throw new ArgumentOutOfRangeException(nameof(uri)); } HostName = uri.Host; Port = uri.Port; if (uri.IsDurable()) { Mode = EndpointMode.Durable; } } public override void StartListening(IMessagingRoot root, ITransportRuntime runtime) { if (!IsListener) return; var listener = createListener(root); runtime.AddListener(listener, this); } protected override ISender CreateSender(IMessagingRoot root) { return new BatchedSender(Uri, new SocketSenderProtocol(), root.Settings.Cancellation, root.TransportLogger); } private IListener createListener(IMessagingRoot root) { // check the uri for an ip address to bind to var cancellation = root.Settings.Cancellation; var hostNameType = Uri.CheckHostName(HostName); if (hostNameType != UriHostNameType.IPv4 && hostNameType != UriHostNameType.IPv6) return HostName == "localhost" ? new SocketListener(root.TransportLogger,IPAddress.Loopback, Port, cancellation) : new SocketListener(root.TransportLogger,IPAddress.Any, Port, cancellation); var ipaddr = IPAddress.Parse(HostName); return new SocketListener(root.TransportLogger, ipaddr, Port, cancellation); } } }
JasperFx/jasper
src/Jasper.Tcp/TcpEndpoint.cs
C#
mit
2,840
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Palestrantes_model extends CI_Model { private $id; private $nome; private $foto; public function __construct() { parent::__construct(); } public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setNome($nome) { $this->nome = $nome; } public function getNome() { return $this->nome; } public function setFoto($foto) { $this->foto = $foto; } public function getFoto() { return $this->foto; } private function salvar() { $id = $this->input->post('id'); $nome = $this->input->post('nome'); $foto = $this->input->post('foto'); $this->setId($id); $this->setNome($nome); $this->setFoto($foto); $this->db->set('nome',$this->getNome()); $this->db->set('foto',$this->getFoto()); if ( empty( $this->id ) ) { $query = $this->db->insert('palestrantes'); if ( $query == TRUE ) { $this->setId($this->db->insert_id()); return TRUE; } else { return FALSE; } } else { $this->db->where('id',$this->getId()); $query = $this->db->update('palestrantes'); return $query; } } private function salvar_detalhes() { $palestrantes_id = $this->getId(); $idioma = $this->input->post('idioma'); $pequena_descricao = $this->input->post('pequena_descricao'); $descricao = $this->input->post('descricao'); if (empty($idioma)) $idioma = 'pt'; $this->db->where('palestrantes_id',$palestrantes_id); $this->db->where('idioma',$idioma); $query = $this->db->get('palestrantes_detalhes'); $this->db->set('pequena_descricao',$pequena_descricao); $this->db->set('descricao',$descricao); $this->db->set('idioma',$idioma); $this->db->set('palestrantes_id',$palestrantes_id); if ( $query->num_rows() > 0 ) { $query = $query->row_array(); $this->db->where('id',$query['id']); $rowset = $this->db->update('palestrantes_detalhes'); } else { $this->db->insert('palestrantes_detalhes'); } } public function salvar_palestrante() { $this->db->trans_begin(); $this->salvar(); $this->salvar_detalhes(); if ( $this->db->trans_status() === FALSE ) { $this->db->trans_rollback(); return array('status'=>'fail','msg'=>'Não foi possível salvar, tente novamente mais tarde', 'id' => ''); } else { $this->db->trans_commit(); return array('status'=>'ok','msg'=>'Salvo com sucesso', 'id' => $this->getId()); } } public function grid_palestrantes() { $this->db->select(' palestrantes.id, palestrantes.nome, palestrantes.foto '); $query = $this->db->get('palestrantes')->result_array(); $dados = array(); foreach ($query as $key => $value) { $dados[$key]['id'] = $value['id']; $dados[$key]['nome'] = $value['nome']; $dados[$key]['foto'] = base_url('files/get/'.$value['foto']); } $retorno['status'] = 'ok'; $retorno['msg'] = sizeof($dados) . " registros encontrados"; $retorno['dados'] = $dados; return $retorno; } public function get_palestrante($id) { $this->db->where('palestrantes.id',$id); $this->db->select(' palestrantes.id, palestrantes.nome, palestrantes.foto, palestrantes_detalhes.idioma, palestrantes_detalhes.descricao, palestrantes_detalhes.pequena_descricao '); $this->db->join('palestrantes_detalhes','palestrantes_detalhes.palestrantes_id = palestrantes.id AND palestrantes_detalhes.idioma = "pt"','LEFT'); $query = $this->db->get('palestrantes')->row_array(); return $query; } public function trocar_idioma_palestrante() { $palestrantes_id = $this->input->post('id'); $idioma = $this->input->post('idioma'); if (empty($idioma)) $idioma = 'pt'; $descricao = ''; $pequena_descricao = ''; if (!empty($palestrantes_id)) { $this->db->where('palestrantes_id',$palestrantes_id); $this->db->where('idioma',$idioma); $row = $this->db->get('palestrantes_detalhes'); if ($row->num_rows() > 0) { $row = $row->row_array(); $descricao = $row['descricao']; $pequena_descricao = $row['pequena_descricao']; } } $retorno['status'] = 'ok'; $retorno['msg'] = ''; $retorno['dados']['id'] = $palestrantes_id; $retorno['dados']['idioma'] = $idioma; $retorno['dados']['descricao'] = $descricao; $retorno['dados']['pequena_descricao'] = $pequena_descricao; return $retorno; } public function get_all_palestrantes($idioma) { // $idioma = $this->input->post('idioma'); if (empty($idioma)) $idioma = 'pt'; $this->db->select(' palestrantes.id, palestrantes.nome, palestrantes.foto, palestrantes_detalhes.pequena_descricao, palestrantes_detalhes.descricao, palestrantes_detalhes.idioma '); $this->db->join('palestrantes_detalhes','palestrantes_detalhes.palestrantes_id = palestrantes.id AND palestrantes_detalhes.idioma = "'.$idioma.'"','LEFT'); $dados = $this->db->get('palestrantes')->result_array(); foreach ($dados as $key => $value) { $dados[$key]['foto'] = base_url('files/get/'.$value['foto']); } $retorno['status'] = 'ok'; $retorno['msg'] = sizeof($dados) . " registros encontrados"; $retorno['dados'] = $dados; return $retorno; } } /* End of file Palestrantes_model.php */ /* Location: ./application/models/Palestrantes_model.php */
tucanowned/congressouniapac
application/models/Palestrantes_model.php
PHP
mit
5,283
<?php namespace Acast; /** * 中间件 * @package Acast */ abstract class Middleware { /** * 存储中间件回调函数 * @var array */ protected static $_middleware = []; /** * 注册中间件 * * @param string $name * @param callable $callback */ static function register(string $name, callable $callback) { if (isset(self::$_middleware[$name])) Console::warning("Overwriting middleware callback \"$name\"."); self::$_middleware[$name] = $callback; } /** * 获取中间件 * * @param string $name * @return callable|null */ static function fetch(string $name) : ?callable { if (!isset(self::$_middleware[$name])) { Console::warning("Failed to fetch middleware \"$name\". Not exist."); return null; } return self::$_middleware[$name]; } }
CismonX/Acast
src/Middleware.php
PHP
mit
917
clean "/tmp" do copy "*.*", to: "/test" end
akatakritos/rcleaner
spec/fixtures/rfiles/copyfile.rb
Ruby
mit
46
using System; using System.CodeDom; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; namespace EmptyKeys.UserInterface.Generator.Types { /// <summary> /// Implements List Box control generator /// </summary> public class ListBoxGeneratorType : SelectorGeneratorType { /// <summary> /// Gets the type of the xaml. /// </summary> /// <value> /// The type of the xaml. /// </value> public override Type XamlType { get { return typeof(ListBox); } } /// <summary> /// Generates code /// </summary> /// <param name="source">The dependence object</param> /// <param name="classType">Type of the class.</param> /// <param name="initMethod">The initialize method.</param> /// <param name="generateField"></param> /// <returns></returns> public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField) { CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField); ListBox listBox = source as ListBox; CodeComHelper.GenerateEnumField<SelectionMode>(initMethod, fieldReference, source, ListBox.SelectionModeProperty); return fieldReference; } } }
EmptyKeys/UI_Generator
UIGenerator/Types/ListBoxGeneratorType.cs
C#
mit
1,638
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* * Copyright (c) 2008 litl, LLC * * 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 <config.h> #include <string.h> /* include first for logging related #define used in repo.h */ #include <util/log.h> #include "union.h" #include "arg.h" #include "object.h" #include <cjs/gjs-module.h> #include <cjs/compat.h> #include "repo.h" #include "proxyutils.h" #include "function.h" #include "gtype.h" #include <girepository.h> typedef struct { GIUnionInfo *info; void *gboxed; /* NULL if we are the prototype and not an instance */ GType gtype; } Union; extern struct JSClass gjs_union_class; GJS_DEFINE_PRIV_FROM_JS(Union, gjs_union_class) /* * Like JSResolveOp, but flags provide contextual information as follows: * * JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not id * JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment * JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequence * JSRESOLVE_DECLARING var, const, or boxed prolog declaration opcode * JSRESOLVE_CLASSNAME class name used when constructing * * The *objp out parameter, on success, should be null to indicate that id * was not resolved; and non-null, referring to obj or one of its prototypes, * if id was resolved. */ static JSBool union_new_resolve(JSContext *context, JSObject **obj, jsid *id, unsigned flags, JSObject **objp) { Union *priv; char *name; JSBool ret = JS_TRUE; *objp = NULL; if (!gjs_get_string_id(context, *id, &name)) return JS_TRUE; /* not resolved, but no error */ priv = priv_from_js(context, *obj); gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p", name, (void *)obj, priv); if (priv == NULL) { ret = JS_FALSE; /* wrong class */ goto out; } if (priv->gboxed == NULL) { /* We are the prototype, so look for methods and other class properties */ GIFunctionInfo *method_info; method_info = g_union_info_find_method((GIUnionInfo*) priv->info, name); if (method_info != NULL) { JSObject *union_proto; const char *method_name; #if GJS_VERBOSE_ENABLE_GI_USAGE _gjs_log_info_usage((GIBaseInfo*) method_info); #endif method_name = g_base_info_get_name( (GIBaseInfo*) method_info); gjs_debug(GJS_DEBUG_GBOXED, "Defining method %s in prototype for %s.%s", method_name, g_base_info_get_namespace( (GIBaseInfo*) priv->info), g_base_info_get_name( (GIBaseInfo*) priv->info)); union_proto = *obj; if (gjs_define_function(context, union_proto, g_registered_type_info_get_g_type(priv->info), method_info) == NULL) { g_base_info_unref( (GIBaseInfo*) method_info); ret = JS_FALSE; goto out; } *objp = union_proto; /* we defined the prop in object_proto */ g_base_info_unref( (GIBaseInfo*) method_info); } } else { /* We are an instance, not a prototype, so look for * per-instance props that we want to define on the * JSObject. Generally we do not want to cache these in JS, we * want to always pull them from the C object, or JS would not * see any changes made from C. So we use the get/set prop * hooks, not this resolve hook. */ } out: g_free(name); return ret; } static void* union_new(JSContext *context, JSObject *obj, /* "this" for constructor */ GIUnionInfo *info) { int n_methods; int i; /* Find a zero-args constructor and call it */ n_methods = g_union_info_get_n_methods(info); for (i = 0; i < n_methods; ++i) { GIFunctionInfo *func_info; GIFunctionInfoFlags flags; func_info = g_union_info_get_method(info, i); flags = g_function_info_get_flags(func_info); if ((flags & GI_FUNCTION_IS_CONSTRUCTOR) != 0 && g_callable_info_get_n_args((GICallableInfo*) func_info) == 0) { jsval rval; rval = JSVAL_NULL; gjs_invoke_c_function_uncached(context, func_info, obj, 0, NULL, &rval); g_base_info_unref((GIBaseInfo*) func_info); /* We are somewhat wasteful here; invoke_c_function() above * creates a JSObject wrapper for the union that we immediately * discard. */ if (JSVAL_IS_NULL(rval)) return NULL; else return gjs_c_union_from_union(context, JSVAL_TO_OBJECT(rval)); } g_base_info_unref((GIBaseInfo*) func_info); } gjs_throw(context, "Unable to construct union type %s since it has no zero-args <constructor>, can only wrap an existing one", g_base_info_get_name((GIBaseInfo*) info)); return NULL; } GJS_NATIVE_CONSTRUCTOR_DECLARE(union) { GJS_NATIVE_CONSTRUCTOR_VARIABLES(union) Union *priv; Union *proto_priv; JSObject *proto; void *gboxed; GJS_NATIVE_CONSTRUCTOR_PRELUDE(union); priv = g_slice_new0(Union); GJS_INC_COUNTER(boxed); g_assert(priv_from_js(context, object) == NULL); JS_SetPrivate(object, priv); gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "union constructor, obj %p priv %p", object, priv); JS_GetPrototype(context, object, &proto); gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "union instance __proto__ is %p", proto); /* If we're the prototype, then post-construct we'll fill in priv->info. * If we are not the prototype, though, then we'll get ->info from the * prototype and then create a GObject if we don't have one already. */ proto_priv = priv_from_js(context, proto); if (proto_priv == NULL) { gjs_debug(GJS_DEBUG_GBOXED, "Bad prototype set on union? Must match JSClass of object. JS error should have been reported."); return JS_FALSE; } priv->info = proto_priv->info; g_base_info_ref( (GIBaseInfo*) priv->info); priv->gtype = proto_priv->gtype; /* union_new happens to be implemented by calling * gjs_invoke_c_function(), which returns a jsval. * The returned "gboxed" here is owned by that jsval, * not by us. */ gboxed = union_new(context, object, priv->info); if (gboxed == NULL) { return JS_FALSE; } /* Because "gboxed" is owned by a jsval and will * be garbage collected, we make a copy here to be * owned by us. */ priv->gboxed = g_boxed_copy(priv->gtype, gboxed); gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "JSObject created with union instance %p type %s", priv->gboxed, g_type_name(priv->gtype)); GJS_NATIVE_CONSTRUCTOR_FINISH(union); return JS_TRUE; } static void union_finalize(JSFreeOp *fop, JSObject *obj) { Union *priv; priv = (Union*) JS_GetPrivate(obj); gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "finalize, obj %p priv %p", obj, priv); if (priv == NULL) return; /* wrong class? */ if (priv->gboxed) { g_boxed_free(g_registered_type_info_get_g_type( (GIRegisteredTypeInfo*) priv->info), priv->gboxed); priv->gboxed = NULL; } if (priv->info) { g_base_info_unref( (GIBaseInfo*) priv->info); priv->info = NULL; } GJS_DEC_COUNTER(boxed); g_slice_free(Union, priv); } static JSBool to_string_func(JSContext *context, unsigned argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(context, vp); Union *priv; JSBool ret = JS_FALSE; jsval retval; if (!priv_from_js_with_typecheck(context, obj, &priv)) goto out; if (!_gjs_proxy_to_string_func(context, obj, "union", (GIBaseInfo*)priv->info, priv->gtype, priv->gboxed, &retval)) goto out; ret = JS_TRUE; JS_SET_RVAL(context, vp, retval); out: return ret; } /* The bizarre thing about this vtable is that it applies to both * instances of the object, and to the prototype that instances of the * class have. */ struct JSClass gjs_union_class = { "GObject_Union", JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, (JSResolveOp) union_new_resolve, /* needs cast since it's the new resolve signature */ JS_ConvertStub, union_finalize, NULL, NULL, NULL, NULL, NULL }; JSPropertySpec gjs_union_proto_props[] = { { NULL } }; JSFunctionSpec gjs_union_proto_funcs[] = { { "toString", JSOP_WRAPPER((JSNative)to_string_func), 0, 0 }, { NULL } }; JSBool gjs_define_union_class(JSContext *context, JSObject *in_object, GIUnionInfo *info) { const char *constructor_name; JSObject *prototype; jsval value; Union *priv; GType gtype; JSObject *constructor; /* For certain unions, we may be able to relax this in the future by * directly allocating union memory, as we do for structures in boxed.c */ gtype = g_registered_type_info_get_g_type( (GIRegisteredTypeInfo*) info); if (gtype == G_TYPE_NONE) { gjs_throw(context, "Unions must currently be registered as boxed types"); return JS_FALSE; } /* See the comment in gjs_define_object_class() for an * explanation of how this all works; Union is pretty much the * same as Object. */ constructor_name = g_base_info_get_name( (GIBaseInfo*) info); if (!gjs_init_class_dynamic(context, in_object, NULL, g_base_info_get_namespace( (GIBaseInfo*) info), constructor_name, &gjs_union_class, gjs_union_constructor, 0, /* props of prototype */ &gjs_union_proto_props[0], /* funcs of prototype */ &gjs_union_proto_funcs[0], /* props of constructor, MyConstructor.myprop */ NULL, /* funcs of constructor, MyConstructor.myfunc() */ NULL, &prototype, &constructor)) { g_error("Can't init class %s", constructor_name); } GJS_INC_COUNTER(boxed); priv = g_slice_new0(Union); priv->info = info; g_base_info_ref( (GIBaseInfo*) priv->info); priv->gtype = gtype; JS_SetPrivate(prototype, priv); gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p", constructor_name, prototype, JS_GetClass(prototype), in_object); value = OBJECT_TO_JSVAL(gjs_gtype_create_gtype_wrapper(context, gtype)); JS_DefineProperty(context, constructor, "$gtype", value, NULL, NULL, JSPROP_PERMANENT); return JS_TRUE; } JSObject* gjs_union_from_c_union(JSContext *context, GIUnionInfo *info, void *gboxed) { JSObject *obj; JSObject *proto; Union *priv; GType gtype; if (gboxed == NULL) return NULL; /* For certain unions, we may be able to relax this in the future by * directly allocating union memory, as we do for structures in boxed.c */ gtype = g_registered_type_info_get_g_type( (GIRegisteredTypeInfo*) info); if (gtype == G_TYPE_NONE) { gjs_throw(context, "Unions must currently be registered as boxed types"); return NULL; } gjs_debug_marshal(GJS_DEBUG_GBOXED, "Wrapping union %s %p with JSObject", g_base_info_get_name((GIBaseInfo *)info), gboxed); proto = gjs_lookup_generic_prototype(context, (GIUnionInfo*) info); obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, gjs_get_import_global (context)); GJS_INC_COUNTER(boxed); priv = g_slice_new0(Union); JS_SetPrivate(obj, priv); priv->info = info; g_base_info_ref( (GIBaseInfo *) priv->info); priv->gtype = gtype; priv->gboxed = g_boxed_copy(gtype, gboxed); return obj; } void* gjs_c_union_from_union(JSContext *context, JSObject *obj) { Union *priv; if (obj == NULL) return NULL; priv = priv_from_js(context, obj); return priv->gboxed; } JSBool gjs_typecheck_union(JSContext *context, JSObject *object, GIStructInfo *expected_info, GType expected_type, JSBool throw_error) { Union *priv; JSBool result; if (!do_base_typecheck(context, object, throw_error)) return JS_FALSE; priv = priv_from_js(context, object); if (priv->gboxed == NULL) { if (throw_error) { gjs_throw_custom(context, "TypeError", "Object is %s.%s.prototype, not an object instance - cannot convert to a union instance", g_base_info_get_namespace( (GIBaseInfo*) priv->info), g_base_info_get_name( (GIBaseInfo*) priv->info)); } return JS_FALSE; } if (expected_type != G_TYPE_NONE) result = g_type_is_a (priv->gtype, expected_type); else if (expected_info != NULL) result = g_base_info_equal((GIBaseInfo*) priv->info, (GIBaseInfo*) expected_info); else result = JS_TRUE; if (!result && throw_error) { if (expected_info != NULL) { gjs_throw_custom(context, "TypeError", "Object is of type %s.%s - cannot convert to %s.%s", g_base_info_get_namespace((GIBaseInfo*) priv->info), g_base_info_get_name((GIBaseInfo*) priv->info), g_base_info_get_namespace((GIBaseInfo*) expected_info), g_base_info_get_name((GIBaseInfo*) expected_info)); } else { gjs_throw_custom(context, "TypeError", "Object is of type %s.%s - cannot convert to %s", g_base_info_get_namespace((GIBaseInfo*) priv->info), g_base_info_get_name((GIBaseInfo*) priv->info), g_type_name(expected_type)); } } return result; }
mtwebster/cjs
gi/union.cpp
C++
mit
16,293
/* Project Orleans Cloud Service SDK ver. 1.0 Copyright (c) Microsoft Corporation All rights reserved. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System.Collections.Generic; using System.Diagnostics; using System; namespace Orleans.Runtime { internal class Constants { // This needs to be first, as GrainId static initializers reference it. Otherwise, GrainId actually see a uninitialized (ie Zero) value for that "constant"! public static readonly TimeSpan INFINITE_TIMESPAN = TimeSpan.FromMilliseconds(-1); // We assume that clock skew between silos and between clients and silos is always less than 1 second public static readonly TimeSpan MAXIMUM_CLOCK_SKEW = TimeSpan.FromSeconds(1); public const string DEFAULT_STORAGE_PROVIDER_NAME = "Default"; public const string MEMORY_STORAGE_PROVIDER_NAME = "MemoryStore"; public const string DATA_CONNECTION_STRING_NAME = "DataConnectionString"; public static readonly GrainId DirectoryServiceId = GrainId.GetSystemTargetGrainId(10); public static readonly GrainId DirectoryCacheValidatorId = GrainId.GetSystemTargetGrainId(11); public static readonly GrainId SiloControlId = GrainId.GetSystemTargetGrainId(12); public static readonly GrainId ClientObserverRegistrarId = GrainId.GetSystemTargetGrainId(13); public static readonly GrainId CatalogId = GrainId.GetSystemTargetGrainId(14); public static readonly GrainId MembershipOracleId = GrainId.GetSystemTargetGrainId(15); public static readonly GrainId ReminderServiceId = GrainId.GetSystemTargetGrainId(16); public static readonly GrainId TypeManagerId = GrainId.GetSystemTargetGrainId(17); public static readonly GrainId ProviderManagerSystemTargetId = GrainId.GetSystemTargetGrainId(19); public static readonly GrainId DeploymentLoadPublisherSystemTargetId = GrainId.GetSystemTargetGrainId(22); public const int PULLING_AGENTS_MANAGER_SYSTEM_TARGET_TYPE_CODE = 254; public const int PULLING_AGENT_SYSTEM_TARGET_TYPE_CODE = 255; public static readonly GrainId SystemMembershipTableId = GrainId.GetSystemGrainId(new Guid("01145FEC-C21E-11E0-9105-D0FB4724019B")); public static readonly GrainId SiloDirectConnectionId = GrainId.GetSystemGrainId(new Guid("01111111-1111-1111-1111-111111111111")); internal const long ReminderTableGrainId = 12345; /// <summary> /// The default timeout before a request is assumed to have failed. /// </summary> public static readonly TimeSpan DEFAULT_RESPONSE_TIMEOUT = Debugger.IsAttached ? TimeSpan.FromMinutes(30) : TimeSpan.FromSeconds(30); /// <summary> /// Minimum period for registering a reminder ... we want to enforce a lower bound /// </summary> public static readonly TimeSpan MinReminderPeriod = TimeSpan.FromMinutes(1); // increase this period, reminders are supposed to be less frequent ... we use 2 seconds just to reduce the running time of the unit tests /// <summary> /// Refresh local reminder list to reflect the global reminder table every 'REFRESH_REMINDER_LIST' period /// </summary> public static readonly TimeSpan RefreshReminderList = TimeSpan.FromMinutes(5); public const int LARGE_OBJECT_HEAP_THRESHOLD = 85000; public const bool DEFAULT_PROPAGATE_E2E_ACTIVITY_ID = false; public const int DEFAULT_LOGGER_BULK_MESSAGE_LIMIT = 5; public static readonly bool USE_BLOCKING_COLLECTION = true; private static readonly Dictionary<GrainId, string> singletonSystemTargetNames = new Dictionary<GrainId, string> { {DirectoryServiceId, "DirectoryService"}, {DirectoryCacheValidatorId, "DirectoryCacheValidator"}, {SiloControlId,"SiloControl"}, {ClientObserverRegistrarId,"ClientObserverRegistrar"}, {CatalogId,"Catalog"}, {MembershipOracleId,"MembershipOracle"}, {ReminderServiceId,"ReminderService"}, {TypeManagerId,"TypeManagerId"}, {ProviderManagerSystemTargetId, "ProviderManagerSystemTarget"}, {DeploymentLoadPublisherSystemTargetId, "DeploymentLoadPublisherSystemTarge"}, }; private static readonly Dictionary<int, string> nonSingletonSystemTargetNames = new Dictionary<int, string> { {PULLING_AGENT_SYSTEM_TARGET_TYPE_CODE, "PullingAgentSystemTarget"}, {PULLING_AGENTS_MANAGER_SYSTEM_TARGET_TYPE_CODE, "PullingAgentsManagerSystemTarget"}, }; public static string SystemTargetName(GrainId id) { string name; if (singletonSystemTargetNames.TryGetValue(id, out name)) return name; if (nonSingletonSystemTargetNames.TryGetValue(id.GetTypeCode(), out name)) return name; return String.Empty; } public static bool IsSingletonSystemTarget(GrainId id) { return singletonSystemTargetNames.ContainsKey(id); } private static readonly Dictionary<GrainId, string> systemGrainNames = new Dictionary<GrainId, string> { {SystemMembershipTableId, "MembershipTableGrain"}, {SiloDirectConnectionId, "SiloDirectConnectionId"} }; public static bool TryGetSystemGrainName(GrainId id, out string name) { return systemGrainNames.TryGetValue(id, out name); } public static bool IsSystemGrain(GrainId grain) { return systemGrainNames.ContainsKey(grain); } } }
yaronthurm/orleans
src/Orleans/Runtime/Constants.cs
C#
mit
6,677
// // FastTemplate // // The MIT License (MIT) // // Copyright (c) 2014 Jeff Panici // 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 System; using System.Globalization; namespace PaniciSoftware.FastTemplate.Common { public class UIntType : PrimitiveType { public UIntType() { } public UIntType(Int64 i) { Value = (UInt64) i; } public override Type UnderlyingType { get { return typeof (UInt64); } } public override object RawValue { get { return Value; } } public UInt64 Value { get; set; } public static explicit operator UIntType(UInt64 i) { return new UIntType((Int64) i); } public override object ApplyBinary(Operator op, ITemplateType rhs) { switch (op) { case Operator.Div: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value/(uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value/(doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value/(decimalType).Value; } break; } case Operator.EQ: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value == (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value == (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value == (decimalType).Value; } if (rhs is NullType) { return Value == default(ulong); } break; } case Operator.GE: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value >= (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value >= (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value >= (decimalType).Value; } break; } case Operator.GT: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value > (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value > (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value > (decimalType).Value; } break; } case Operator.LE: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value <= (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value <= (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value <= (decimalType).Value; } break; } case Operator.LT: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value < (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value < (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value < (decimalType).Value; } break; } case Operator.Minus: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value - (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value - (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value - (decimalType).Value; } break; } case Operator.Mod: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value%(uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value%(doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value%(decimalType).Value; } break; } case Operator.Mul: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value*(uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value*(doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value*(decimalType).Value; } break; } case Operator.NEQ: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value != (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value != (doubleType).Value; } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value != (decimalType).Value; } if (rhs is NullType) { return Value != default(ulong); } break; } case Operator.Plus: { var uIntType = rhs as UIntType; if (uIntType != null) { return Value + (uIntType).Value; } var doubleType = rhs as DoubleType; if (doubleType != null) { return Value + (doubleType).Value; } var stringType = rhs as StringType; if (stringType != null) { return string.Format( "{0}{1}", Value, (stringType).Value); } var decimalType = rhs as DecimalType; if (decimalType != null) { return Value + (decimalType).Value; } break; } } throw new InvalidTypeException( op.ToString(), UnderlyingType, rhs.UnderlyingType); } public override bool TryConvert<T>(out T o) { try { var type = typeof (T); if (type == typeof (string)) { o = (T) (object) Value.ToString(CultureInfo.InvariantCulture); return true; } if (type == typeof (double)) { o = (T) (object) Convert.ToDouble(Value); return true; } if (type == typeof (UInt64)) { o = (T) (object) Value; return true; } if (type == typeof (Int64)) { o = (T) (object) Convert.ToInt64(Value); return true; } if (type == typeof (decimal)) { o = (T) (object) Convert.ToDecimal(Value); return true; } } catch (Exception) { o = default(T); return false; } o = default(T); return false; } public override object ApplyUnary(Operator op) { switch (op) { case Operator.Plus: { return +Value; } } throw new InvalidTypeException( op.ToString(), UnderlyingType); } } }
jeffpanici75/FastTemplate
PaniciSoftware.FastTemplate/Common/UIntType.cs
C#
mit
11,872
<?xml version="1.0" ?><!DOCTYPE TS><TS language="bs" version="2.1"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About phreak</source> <translation type="unfinished"/> </message> <message> <location line="+39"/> <source>&lt;b&gt;phreak&lt;/b&gt; version</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The phreak developers</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Double-click to edit address or label</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation type="unfinished"/> </message> <message> <location line="-46"/> <source>These are your phreak addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>&amp;Copy Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a phreak address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Verify a message to ensure it was signed with a specified phreak address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../addressbookpage.cpp" line="+65"/> <source>Copy &amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Edit</source> <translation type="unfinished"/> </message> <message> <location line="+250"/> <source>Export Address Book Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>(no label)</source> <translation type="unfinished"/> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+33"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>For staking only</source> <translation type="unfinished"/> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+35"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"/> </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 type="unfinished"/> </message> <message> <location line="+103"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation type="unfinished"/> </message> <message> <location line="-133"/> <location line="+60"/> <source>Wallet encrypted</source> <translation type="unfinished"/> </message> <message> <location line="-58"/> <source>phreak will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+44"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation type="unfinished"/> </message> <message> <location line="-56"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <location line="+50"/> <source>The supplied passphrases do not match.</source> <translation type="unfinished"/> </message> <message> <location line="-38"/> <source>Wallet unlock failed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+12"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation type="unfinished"/> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+282"/> <source>Sign &amp;message...</source> <translation type="unfinished"/> </message> <message> <location line="+251"/> <source>Synchronizing with network...</source> <translation type="unfinished"/> </message> <message> <location line="-319"/> <source>&amp;Overview</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>&amp;Transactions</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>&amp;Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit the list of stored addresses and labels</source> <translation type="unfinished"/> </message> <message> <location line="-13"/> <source>&amp;Receive coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show the list of addresses for receiving payments</source> <translation type="unfinished"/> </message> <message> <location line="-7"/> <source>&amp;Send coins</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>E&amp;xit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Quit application</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show information about phreak</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>&amp;Encrypt Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+259"/> <source>~%n block(s) remaining</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation type="unfinished"/> </message> <message> <location line="-256"/> <source>&amp;Export...</source> <translation type="unfinished"/> </message> <message> <location line="-64"/> <source>Send coins to a phreak address</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Modify configuration options for phreak</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Encrypt or decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup wallet to another location</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>&amp;Verify message...</source> <translation type="unfinished"/> </message> <message> <location line="-202"/> <source>phreak</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+180"/> <source>&amp;About phreak</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>&amp;File</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>&amp;Settings</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Tabs toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Actions toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+9"/> <source>[testnet]</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+60"/> <source>phreak client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+75"/> <source>%n active connection(s) to phreak network</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+40"/> <source>Downloaded %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+413"/> <source>Staking.&lt;br&gt;Your weight is %1&lt;br&gt;Network weight is %2&lt;br&gt;Expected time to earn reward is %3</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Not staking because wallet is locked</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is syncing</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because you don&apos;t have mature coins</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-403"/> <source>%n second(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="-312"/> <source>About phreak card</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about phreak card</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>&amp;Unlock Wallet...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+297"/> <source>%n minute(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Up to date</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Catching up...</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Last received block was generated %1.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Sent transaction</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <location line="+15"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <location line="+15"/> <source>URI can not be parsed! This can be caused by an invalid phreak address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+76"/> <source>%n second(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+18"/> <source>Not staking</source> <translation type="unfinished"/> </message> <message> <location filename="../bitcoin.cpp" line="+109"/> <source>A fatal error occurred. phreak can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+90"/> <source>Network Alert</source> <translation type="unfinished"/> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation type="unfinished"/> </message> <message> <location line="+48"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Priority:</source> <translation type="unfinished"/> </message> <message> <location line="+48"/> <source>Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation type="unfinished"/> </message> <message> <location filename="../coincontroldialog.cpp" line="+551"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Change:</source> <translation type="unfinished"/> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>List mode</source> <translation type="unfinished"/> </message> <message> <location line="+45"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Priority</source> <translation type="unfinished"/> </message> <message> <location filename="../coincontroldialog.cpp" line="-515"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy change</source> <translation type="unfinished"/> </message> <message> <location line="+317"/> <source>highest</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>high</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>medium-high</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>low-medium</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>low</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>lowest</source> <translation type="unfinished"/> </message> <message> <location line="+155"/> <source>DUST</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>yes</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+66"/> <source>(no label)</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>(change)</source> <translation type="unfinished"/> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation type="unfinished"/> </message> <message> <location filename="../editaddressdialog.cpp" line="+20"/> <source>New receiving address</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>New sending address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid phreak address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation type="unfinished"/> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+420"/> <location line="+12"/> <source>phreak-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Reserve</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start phreak after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start phreak on system login</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Detach databases at shutdown</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Network</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Automatically open the phreak client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Connect to the phreak network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation type="unfinished"/> </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 type="unfinished"/> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting phreak.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Whether to show phreak addresses in the transaction list or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Whether to show coin control features or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Display coin &amp;control features (experts only!)</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+55"/> <source>default</source> <translation type="unfinished"/> </message> <message> <location line="+149"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting phreak.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation type="unfinished"/> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+33"/> <location line="+231"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the phreak network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-160"/> <source>Stake:</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation type="unfinished"/> </message> <message> <location line="-107"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Spendable:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current spendable balance</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>Immature:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Total:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current total balance</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-108"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Total of coins that was staked, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+113"/> <location line="+1"/> <source>out of sync</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+348"/> <source>N/A</source> <translation type="unfinished"/> </message> <message> <location line="-217"/> <source>Client version</source> <translation type="unfinished"/> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation type="unfinished"/> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Startup time</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Last block time</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the phreak-Qt help message to get a list with possible phreak command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation type="unfinished"/> </message> <message> <location line="-260"/> <source>Build date</source> <translation type="unfinished"/> </message> <message> <location line="-104"/> <source>phreak - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>phreak Core</source> <translation type="unfinished"/> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Open the phreak debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation type="unfinished"/> </message> <message> <location filename="../rpcconsole.cpp" line="-33"/> <source>Welcome to the phreak RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+182"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>Coin Control Features</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Inputs...</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>automatically selected</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Insufficient funds!</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Quantity:</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <location line="+35"/> <source>0</source> <translation type="unfinished"/> </message> <message> <location line="-19"/> <source>Bytes:</source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <location line="+86"/> <location line="+86"/> <location line="+32"/> <source>0.00 PHR</source> <translation type="unfinished"/> </message> <message> <location line="-191"/> <source>Priority:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>After Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Change</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>custom change address</source> <translation type="unfinished"/> </message> <message> <location line="+106"/> <source>Send to multiple recipients at once</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Balance:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>123.456 PHR</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-173"/> <source>Enter a phreak address (e.g. PHR1xGeKnTkaAotEVgs2rnUfVsFv8LVSM)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Copy quantity</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy change</source> <translation type="unfinished"/> </message> <message> <location line="+86"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+251"/> <source>WARNING: Invalid phreak address</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>(no label)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>WARNING: unknown change address</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <location filename="../sendcoinsentry.cpp" line="+25"/> <source>Enter a label for this address to add it to your address book</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Label:</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to send the payment to (e.g. PHR1xGeKnTkaAotEVgs2rnUfVsFv8LVSM)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a phreak address (e.g. PHR1xGeKnTkaAotEVgs2rnUfVsFv8LVSM)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+124"/> <source>&amp;Sign Message</source> <translation type="unfinished"/> </message> <message> <location line="-118"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. PHR1xGeKnTkaAotEVgs2rnUfVsFv8LVSM)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+203"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-193"/> <location line="+203"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-193"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </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 type="unfinished"/> </message> <message> <location line="+24"/> <source>Copy the current signature to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this phreak address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all sign message fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <location line="+70"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="-64"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. PHR1xGeKnTkaAotEVgs2rnUfVsFv8LVSM)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified phreak address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all verify message fields</source> <translation type="unfinished"/> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a phreak address (e.g. PHR1xGeKnTkaAotEVgs2rnUfVsFv8LVSM)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Enter phreak signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation type="unfinished"/> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+19"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-2"/> <source>Open for %n block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+8"/> <source>conflicted</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Status</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Source</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Generated</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation type="unfinished"/> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>label</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation type="unfinished"/> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Net amount</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Message</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Comment</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated coins must mature 110 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 &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Transaction</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Inputs</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>true</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>false</source> <translation type="unfinished"/> </message> <message> <location line="-211"/> <source>, has not been successfully broadcast yet</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>unknown</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+226"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Offline</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Received from</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation type="unfinished"/> </message> <message> <location line="+190"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+55"/> <location line="+16"/> <source>All</source> <translation>Sve</translation> </message> <message> <location line="-15"/> <source>Today</source> <translation>Danas</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This month</source> <translation>Ovaj mjesec</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>Prošli mjesec</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>Ove godine</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>To yourself</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Min amount</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+144"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>ID</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <source>Range:</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>to</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+206"/> <source>Sending...</source> <translation type="unfinished"/> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+33"/> <source>phreak version</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send command to -server or phreakd</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>List commands</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Options:</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify configuration file (default: phreak.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify pid file (default: phreakd.pid)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Set database cache size in megabytes (default: 25)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Listen for connections on &lt;port&gt; (default: 15714 or testnet: 25714)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Stake your coins to support network and gain reward (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Detach block and address databases. Increases shutdown time (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 15715 or testnet: 25715)</source> <translation type="unfinished"/> </message> <message> <location line="-11"/> <source>Accept command line and JSON-RPC commands</source> <translation type="unfinished"/> </message> <message> <location line="+101"/> <source>Error: Transaction creation failed </source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: Wallet locked, unable to create transaction </source> <translation type="unfinished"/> </message> <message> <location line="-8"/> <source>Importing blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Importing bootstrap blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="-88"/> <source>Run in the background as a daemon and accept commands</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation type="unfinished"/> </message> <message> <location line="-24"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation type="unfinished"/> </message> <message> <location line="-38"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+117"/> <source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+61"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong phreak will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="-31"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="-18"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation type="unfinished"/> </message> <message> <location line="-30"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Block creation options:</source> <translation type="unfinished"/> </message> <message> <location line="-62"/> <source>Connect only to the specified node(s)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation type="unfinished"/> </message> <message> <location line="+94"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation type="unfinished"/> </message> <message> <location line="-90"/> <source>Find peers using DNS lookup (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync checkpoints policy (default: strict)</source> <translation type="unfinished"/> </message> <message> <location line="+83"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-82"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation type="unfinished"/> </message> <message> <location line="-16"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation type="unfinished"/> </message> <message> <location line="-74"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation type="unfinished"/> </message> <message> <location line="-42"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Unable to sign checkpoint, wrong checkpointkey? </source> <translation type="unfinished"/> </message> <message> <location line="-80"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Username for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Verifying database integrity...</source> <translation type="unfinished"/> </message> <message> <location line="+57"/> <source>WARNING: syncronized checkpoint violation detected, but skipped!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation type="unfinished"/> </message> <message> <location line="-48"/> <source>wallet.dat corrupt, salvage failed</source> <translation type="unfinished"/> </message> <message> <location line="-54"/> <source>Password for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-84"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=phreakrpc 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 &quot;phreak Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Find peers using internet relay chat (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+53"/> <source>Error: Wallet unlocked for staking only, unable to create transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source> <translation type="unfinished"/> </message> <message> <location line="-158"/> <source>This help message</source> <translation type="unfinished"/> </message> <message> <location line="+95"/> <source>Wallet %s resides outside data directory %s.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot obtain a lock on data directory %s. phreak is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-98"/> <source>phreak</source> <translation type="unfinished"/> </message> <message> <location line="+140"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation type="unfinished"/> </message> <message> <location line="-130"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation type="unfinished"/> </message> <message> <location line="+122"/> <source>Loading addresses...</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Error loading blkindex.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of phreak</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart phreak to complete</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="-16"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-24"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <source>Error: could not start node</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sending...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation type="unfinished"/> </message> <message> <location line="-34"/> <source>Loading block index...</source> <translation type="unfinished"/> </message> <message> <location line="-103"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation type="unfinished"/> </message> <message> <location line="+122"/> <source>Unable to bind to %s on this computer. phreak is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-97"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+55"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Loading wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot initialize keypool</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Done loading</source> <translation type="unfinished"/> </message> <message> <location line="-167"/> <source>To use the %s option</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation type="unfinished"/> </message> </context> </TS>
qtvideofilter/streamingcoin
src/qt/locale/bitcoin_bs.ts
TypeScript
mit
107,835
<?php /** * Created by PhpStorm. * User: phpNT * Date: 24.07.2016 * Time: 21:57 */ namespace phpnt\cropper\assets; use yii\web\AssetBundle; class DistAsset extends AssetBundle { public $sourcePath = '@vendor/phpnt/yii2-cropper'; public $css = [ 'css/crop.css' ]; public $images = [ 'images/' ]; }
phpnt/yii2-cropper
assets/DistAsset.php
PHP
mit
343
require 'vcr' require 'vcr/rspec' VCR.config do |c| c.cassette_library_dir = 'spec/vcr' c.http_stubbing_library = :webmock c.default_cassette_options = { :record => :new_episodes } end RSpec.configure do |c| c.extend VCR::RSpec::Macros end
compactcode/recurly-client-ruby
spec/support/vcr.rb
Ruby
mit
249
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NonVisitorPatternExample { public class Loan { public int Owed { get; set; } public int MonthlyPayment { get; set; } } }
jasonlowder/DesignPatterns
NonVisitorPatternExample/Loan.cs
C#
mit
279
Application.class_eval do get '/' do if current_user @sites = ABPlugin::API.sites( :include => { :envs => true, :categories => { :include => { :tests => { :include => { :variants => { :methods => :for_dashboard } } } } } }, :token => current_user.single_access_token ) @sites.sort! { |a, b| a["name"] <=> b["name"] } @sites.each do |site| site["categories"].sort! { |a, b| a["name"] <=> b["name"] } site["envs"].sort! { |a, b| a["name"] <=> b["name"] } site["categories"].each do |category| category["tests"].reverse! end end haml :dashboard else haml :front end end end
winton/a_b_front_end
lib/a_b_front_end/controller/front.rb
Ruby
mit
867
<?php namespace Wahlemedia\Showroom\Updates; use Schema; use October\Rain\Database\Schema\Blueprint; use October\Rain\Database\Updates\Migration; class add_short_description_to_items_table extends Migration { public function up() { Schema::table('wahlemedia_showroom_items', function (Blueprint $table) { $table->text('short_description')->nullable(); }); } public function down() { Schema::dropColumn('short_description'); } }
wahlemedia/oc-showroom-plugin
updates/add_short_description_to_items_table.php
PHP
mit
492
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header" role="heading"> <h1 class="entry-title"> <?php if( !is_single() ) : ?> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a> <?php else: ?> <?php the_title(); ?> <?php endif; ?> </h1> </header><!-- .entry-header --> <div class="entry-meta clearfix"> <?php $postFormat = get_post_format($post->id); echo '<span class="genericon genericon-' . $postFormat . '"></span>'; ?> <?php cs_bootstrap_entry_meta(); ?> <?php comments_popup_link(__( '0 Kommentare', 'cs-bootstrap' ), __( '1 Kommentar', 'cs-bootstrap' ), __( '% Kommentare', 'cs-bootstrap' )); ?> <?php edit_post_link( __( 'editieren', 'cs-bootstrap' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-meta --> <div class="row"> <?php if( has_post_thumbnail() ) : ?> <div class="entry-thumbnail col-sm-4"> <a href="<?php the_permalink(); ?>"> <figure> <?php the_post_thumbnail( 'full' ); ?> </figure> </a> </div> <div class="entry-content col-sm-8"> <blockquote> <?php the_content( __( 'Artikel "' . get_the_title() . '" lesen <span class="meta-nav">&raquo;</span>', 'cs-bootstrap' ) ); ?> </blockquote> </div> <?php else : ?> <div class="entry-content col-sm-12"> <blockquote> <?php the_content( __( 'Artikel "' . get_the_title() . '" lesen <span class="meta-nav">&raquo;</span>', 'cs-bootstrap' ) ); ?> </blockquote> </div> <?php endif; ?> <?php if( is_single() ) { wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Seiten:', 'cs-bootstrap' ) . '</span>', 'after' => '</div>' ) ); } ?> </div><!-- .entry-content --> </article><!-- #post-<?php the_ID(); ?> -->
purzlbaum/cs-bootstrap
content-quote.php
PHP
mit
1,925
module Days class App < Sinatra::Base get "/admin/users", :admin_only => true do @users = User.all haml :'admin/users/index', layout: :admin end get "/admin/users/new", :admin_only => true do @user = User.new haml :'admin/users/form', layout: :admin end post "/admin/users", :admin_only => true do user = params[:user] || halt(400) @user = User.new(user) if @user.save redirect "/admin/users/#{@user.id}" # FIXME: Permalink else status 406 haml :'admin/users/form', layout: :admin end end get "/admin/users/:id", :admin_only => true do @user = User.where(id: params[:id]).first || halt(404) haml :'admin/users/form', layout: :admin end put "/admin/users/:id", :admin_only => true do user = params[:user] || halt(400) @user = User.where(id: params[:id]).first || halt(404) if user[:password] == "" user.delete :password end @user.assign_attributes(user) if @user.save redirect "/admin/users/#{@user.id}" else status 406 haml :'admin/users/form', layout: :admin end end delete "/admin/users/:id", :admin_only => true do @user = User.where(id: params[:id]).first || halt(404) if @user == current_user halt 400 else @user.destroy redirect "/admin/users" end end end end
sorah/days
lib/days/app/admin/users.rb
Ruby
mit
1,446