text
stringlengths 2
1.04M
| meta
dict |
---|---|
set -o errexit
set -o nounset
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
STDLIB_TOKEN=$1
if [[ ${STDLIB_TOKEN} == "" ]]
then
echo "STDLIB_TOKEN needs to be supplied as first script argument."
exit 1
fi
ponyc packages/stdlib --docs-public --pass expr
sed -i 's/site_name:\ stdlib/site_name:\ Pony Standard Library/' stdlib-docs/mkdocs.yml
echo "Uploading docs using mkdocs..."
git remote add gh-token "https://${STDLIB_TOKEN}@github.com/ponylang/stdlib.ponylang.io"
git fetch gh-token
git reset gh-token/main
pushd stdlib-docs
mkdocs gh-deploy -v --clean --remote-name gh-token --remote-branch main
popd
| {
"content_hash": "b2426c4a7e9778abc20ccc2b3ffe0f95",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 88,
"avg_line_length": 26.52173913043478,
"alnum_prop": 0.7311475409836066,
"repo_name": "sgebbie/ponyc",
"id": "2c05eabaabeabb4a89ffbfedfc67d962c0ff708b",
"size": "623",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".ci-scripts/build-and-push-stdlib-documentation.bash",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "2071"
},
{
"name": "C",
"bytes": "2137678"
},
{
"name": "C++",
"bytes": "2254962"
},
{
"name": "CMake",
"bytes": "34142"
},
{
"name": "DTrace",
"bytes": "5301"
},
{
"name": "Dockerfile",
"bytes": "36731"
},
{
"name": "GAP",
"bytes": "9468"
},
{
"name": "LLVM",
"bytes": "675"
},
{
"name": "Makefile",
"bytes": "6234"
},
{
"name": "Pony",
"bytes": "1203509"
},
{
"name": "Python",
"bytes": "67965"
},
{
"name": "Ruby",
"bytes": "299"
},
{
"name": "Shell",
"bytes": "23790"
}
],
"symlink_target": ""
} |
/*
* GET home page.
*/
var models = require('../models');
function include(arr,obj) {
return (arr.indexOf(obj) != -1);
}
exports.view = function(req, res){
var allBool = req.query.all == "true";
function formatAMPM(date) {
var hours = date.getHours();
var minutes = date.getMinutes();
//GMT->PST
hours = hours - 8;
hours = hours < 0 ? hours + 24 : hours;
var ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
return "Today @ " + strTime;
}
//if we are returning to the homepage from an added alert, must process form
var venue = req.body.venue;
var description = req.body.description;
var severity = req.body.severity;
var currentTime = new Date();
//console.log(currentTime);
var newAlert = new models.Alert({
"venue": venue,
"alert": description,
"severity": severity,
"timestamp": currentTime,
"pretty_timestamp": formatAMPM(currentTime),
"status": ""
});
var favorited_venues;
var favorite_names = [];
models.Venue.find({"favorited":true}).exec(showFaves);
function showFaves(err, faves) {
if(err) {console.log(err); res.send(500); }
favorited_venues = faves;
for (var i = 0; i< favorited_venues.length; i++)
favorite_names.push(favorited_venues[i]["name"]);
}
if (typeof venue != "undefined"){ //form posted successfully
newAlert.save(afterSave);
console.log(newAlert);
}
else {
models.Alert.find().sort('severity').exec(renderIndex);
}
function afterSave(err) {
if(err) {console.log(err); res.send(500); }
console.log('getting alerts from db');
models.Alert.find().sort('severity').exec(renderIndex);
}
function renderIndex(err, alerts_db) {
if(err) {console.log(err); res.send(500); }
console.log(favorite_names);
var alerts_to_show = [];
for (var i = 0; i < alerts_db.length; i++) {
var venue_db = alerts_db[i]["venue"];
if (include(favorite_names, venue_db) || allBool)
alerts_to_show.push(alerts_db[i]);
}
alerts_severe = [];
alerts_minor = [];
alerts_fyi = [];
alerts_kudos = [];
for (var i = 0; i < alerts_to_show.length; i++) {
var a = alerts_to_show[i]
var severity = a["severity"];
if (severity == "danger")
alerts_severe.push(a);
if (severity == "warning")
alerts_minor.push(a);
if (severity == "info")
alerts_fyi.push(a);
if (severity == "success")
alerts_kudos.push(a);
}
var alerts_by_servity = alerts_severe.concat(alerts_kudos).concat(alerts_minor).concat(alerts_fyi);
res.render('index', {'alerts':alerts_by_servity, 'all': allBool});
}
}; | {
"content_hash": "12a6cdc85061031746d2c6ee05b226ba",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 101,
"avg_line_length": 24.747826086956522,
"alnum_prop": 0.5997891777933942,
"repo_name": "alexpopof/147-project",
"id": "85fa646358c40686f2950891d650a5819a929eea",
"size": "2846",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "routes/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1748"
},
{
"name": "JavaScript",
"bytes": "28716"
},
{
"name": "Shell",
"bytes": "9756"
}
],
"symlink_target": ""
} |
<?php
namespace KDuma\emSzmalAPI;
use DateTime;
use Exception;
use GuzzleHttp\Client;
use KDuma\emSzmalAPI\CacheProviders\CacheProviderInterface;
/**
* Class emSzmalAPI.
*/
class emSzmalAPI
{
/**
* @var Client
*/
protected $client;
/**
* @var string
*/
private $api_id;
/**
* @var string
*/
private $api_key;
/**
* @var string|null
*/
private $session_id;
/**
* @var CacheProviderInterface|null
*/
protected $cache_provider = null;
/**
* @var callable|null
*/
protected $default_bank_credentials_resolver = null;
/**
* emSzmalAPI constructor.
*
* @param string $api_id
* @param string $api_key
* @param int $timeout
*/
public function __construct($api_id, $api_key, $timeout = 120)
{
$this->api_id = $api_id;
$this->api_key = $api_key;
$this->client = new Client([
'base_uri' => 'https://web.emszmal.pl/',
'timeout' => $timeout,
'cookies' => true,
]);
}
/**
* emSzmalAPI destructor.
*/
public function __destruct()
{
$this->SayBye();
}
/**
* @return string
*/
public function SayHello()
{
if ($this->session_id) {
return $this->session_id;
}
$response = $this->client->post('/api/Common/SayHello', [
'json' => [
'License' => [
'APIId' => $this->api_id,
'APIKey' => $this->api_key,
],
],
]);
$data = json_decode($response->getBody(), true);
return $this->session_id = $data['SessionId'];
}
/**
* @param BankCredentials|string|null $credentials
*
* @return Account[]
*/
public function GetAccountsList($credentials = null)
{
$credentials = $this->GetCredentials($credentials);
$cache_key = 'GetAccountsList.'.$credentials->getProvider().'.'.$credentials->getLogin();
$data = $this->cache($cache_key, function () use ($credentials) {
if (! $this->session_id) {
$this->SayHello();
}
$response = $this->client->post('/api/Accounts/GetAccountsList', [
'json' => $credentials->toArray() + [
'SessionId' => $this->session_id,
'License' => [
'APIId' => $this->api_id,
'APIKey' => $this->api_key,
],
],
]);
return json_decode($response->getBody(), true);
});
$accounts = [];
foreach ($data['Accounts'] as $account) {
$accounts[] = new Account(
$account['AccountNumber'],
$account['AccountCurrency'],
$account['AccountAvailableFunds'],
$account['AccountBalance']
);
}
return $accounts;
}
/**
* @param string $account_number
* @param DateTime|string $date_since
* @param DateTime|string $date_to
* @param BankCredentials|string|null $credentials
*
* @return Transaction[]
*/
public function GetAccountHistory($account_number, $date_since, $date_to, $credentials = null)
{
$credentials = $this->GetCredentials($credentials);
if (! $date_since instanceof DateTime) {
$date_since = new DateTime($date_since);
}
if (! $date_to instanceof DateTime) {
$date_to = new DateTime($date_to);
}
$cache_key = 'GetAccountHistory.'.$credentials->getProvider().'.'.$credentials->getLogin().'.'.$account_number.'.'.$date_since->format('Y-m-d').'.'.$date_to->format('Y-m-d');
$data = $this->cache($cache_key, function () use ($account_number, $date_since, $date_to, $credentials) {
if (! $this->session_id) {
$this->SayHello();
}
$response = $this->client->post('/api/Accounts/GetAccountHistory', [
'json' => $credentials->toArray() + [
'SessionId' => $this->session_id,
'Data' => [
'AccountNumber' => $account_number,
'DateSince' => $date_since->format('Y-m-d'),
'DateTo' => $date_to->format('Y-m-d'),
],
'License' => [
'APIId' => $this->api_id,
'APIKey' => $this->api_key,
],
],
]);
return json_decode($response->getBody(), true);
});
$transactions = [];
foreach ($data['Transactions'] as $transaction) {
$transactions[] = new Transaction(
$transaction['TransactionRefNumber'],
new DateTime($transaction['TransactionOperationDate']),
new DateTime($transaction['TransactionBookingDate']),
$transaction['TransactionAmount'],
$transaction['TransactionBalance'],
$transaction['TransactionType'],
$transaction['TransactionDescription']
);
}
return $transactions;
}
/**
* @return bool
*/
public function SayBye()
{
if (! $this->session_id) {
return false;
}
$this->client->post('/api/Common/SayBye', [
'json' => [
'SessionId' => $this->session_id,
'License' => [
'APIId' => $this->api_id,
'APIKey' => $this->api_key,
],
],
]);
$this->session_id = null;
return true;
}
/**
* @param string $cache_key
* @param callable $callable
*
* @return array
*/
private function cache($cache_key, callable $callable)
{
if (! $this->cache_provider) {
return $callable();
}
return $this->cache_provider->cache($cache_key, $callable);
}
/**
* @param CacheProviderInterface|null $cache_provider
*
* @return emSzmalAPI
*/
public function setCacheProvider(CacheProviderInterface $cache_provider = null)
{
$this->cache_provider = $cache_provider;
return $this;
}
/**
* @param callable|null $default_bank_credentials_resolver
*
* @return emSzmalAPI
*/
public function setDefaultBankCredentialsResolver(callable $default_bank_credentials_resolver = null)
{
$this->default_bank_credentials_resolver = $default_bank_credentials_resolver;
return $this;
}
/**
* @param BankCredentials|string|null $credentials
*
* @return BankCredentials
* @throws Exception
*/
protected function GetCredentials($credentials = null)
{
if ($credentials instanceof BankCredentials) {
return $credentials;
}
if ($this->default_bank_credentials_resolver) {
$resolver = $this->default_bank_credentials_resolver;
return is_null($credentials) ? $resolver() : $resolver($credentials);
}
throw new Exception('Missing BankCredentials');
}
}
| {
"content_hash": "2d34cf4ce7336a5d821c107f28fe0f7b",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 182,
"avg_line_length": 26.5,
"alnum_prop": 0.4931266846361186,
"repo_name": "kduma/L5-emSzmal-api",
"id": "160dfd75d2092aeb831f89114aec64ffe451524e",
"size": "7420",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/emSzmalAPI.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "20122"
}
],
"symlink_target": ""
} |
'''
Contributors of this code: Alexander Belchenko, Harco Kuppens, Justin Riley.
http://code.activestate.com/recipes/440694-determine-size-of-console-window-on-windows/
https://stackoverflow.com/questions/566746/how-to-get-linux-console-window-width-in-python
https://gist.github.com/jtriley/1108174
I changed python2 to python3, and added crediting printing.
'''
import os
import shlex
import struct
import platform
import subprocess
import random
def get_terminal_size():
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
"""
current_os = platform.system()
tuple_xy = None
if current_os == 'Windows':
tuple_xy = _get_terminal_size_windows()
if tuple_xy is None:
tuple_xy = _get_terminal_size_tput()
# needed for window's python in cygwin's xterm!
if current_os in ['Linux', 'Darwin'] or current_os.startswith('CYGWIN'):
tuple_xy = _get_terminal_size_linux()
if tuple_xy is None:
print("default")
tuple_xy = (80, 25) # default value
return tuple_xy
def _get_terminal_size_windows():
try:
from ctypes import windll, create_string_buffer
# stdin handle is -10
# stdout handle is -11
# stderr handle is -12
h = windll.kernel32.GetStdHandle(-12)
csbi = create_string_buffer(22)
res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
if res:
(bufx, bufy, curx, cury, wattr,
left, top, right, bottom,
maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw)
sizex = right - left + 1
sizey = bottom - top + 1
return sizex, sizey
except:
pass
def _get_terminal_size_tput():
# get terminal width
# src: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window
try:
cols = int(subprocess.check_call(shlex.split('tput cols')))
rows = int(subprocess.check_call(shlex.split('tput lines')))
return (cols, rows)
except:
pass
def _get_terminal_size_linux():
def ioctl_GWINSZ(fd):
try:
import fcntl
import termios
cr = struct.unpack('hh',
fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
return cr
except:
pass
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
if not cr:
try:
fd = os.open(os.ctermid(), os.O_RDONLY)
cr = ioctl_GWINSZ(fd)
os.close(fd)
except:
pass
if not cr:
try:
cr = (os.environ['LINES'], os.environ['COLUMNS'])
except:
return None
return int(cr[1]), int(cr[0])
if __name__ == "__main__":
sizex, sizey = get_terminal_size()
print('width =', sizex, 'height =', sizey)
else:
if random.randint(0, 5) == 0:
print('import terminalsize: Special thank to Alexander Belchenko, Harco Kuppens, and Justin Riley for writing a wonderful script that detects terminal size across OSes. ')
else:
print('Thanks to Belchenko, Kuppens, and Riley! ')
print()
| {
"content_hash": "465e9f9cc81729e912fbd4a13fbc5dc6",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 179,
"avg_line_length": 33.21782178217822,
"alnum_prop": 0.6038748137108793,
"repo_name": "willettk/common_language",
"id": "de162afa6c237c8e4898acd945debbb501b4d3bd",
"size": "3377",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "terminalsize.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "118636"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Sun Public License Notice
The contents of this file are subject to the Sun Public License
Version 1.0 (the "License"). You may not use this file except in
compliance with the License. A copy of the License is available at
http://www.sun.com/
The Original Code is NetBeans. The Initial Developer of the Original
Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
Microsystems, Inc. All Rights Reserved.
-->
<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
<editor_palette_item version="1.0">
<class name="org.netbeans.modules.filepalette.items.InLineComment" />
<icon16 urlvalue="org/netbeans/modules/filepalette/items/resources/comment16.png" />
<icon32 urlvalue="org/netbeans/modules/filepalette/items/resources/comment32.png" />
<description localizing-bundle="org/netbeans/modules/filepalette/items/resources/Bundle"
display-name-key="NAME_html-inLine"
tooltip-key="HINT_html-inLine" />
</editor_palette_item>
| {
"content_hash": "e33dbf99d0808802b73b6e295f04853e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 139,
"avg_line_length": 47.125,
"alnum_prop": 0.7259062776304156,
"repo_name": "qcccs/PhpPalette",
"id": "e55299e8ae26dee8de1fd0b4ccf4850deb090232",
"size": "1131",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/org/netbeans/modules/filepalette/InLineComment.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1762380"
}
],
"symlink_target": ""
} |
import json
import queue
import time
from collections import namedtuple
from random import shuffle
from threading import Thread
import numpy as np
import tensorflow as tf
from dataset import to_sentences, tokens_to_ids, tf_Examples, SENTENCE_END, PAD_TOKEN
ModelInput = namedtuple('ModelInput',
['input_context', 'input_question', 'input_answer',
'origin_context', 'origin_question', 'origin_answer'])
BUCKET_CACHE_BATCH = 3
QUEUE_NUM_BATCH = 3
class Generator:
"""Data class for batch generator."""
def __init__(self, file_path, vocab, params,
context_key, question_key, answer_key,
max_context, max_question, bucketing=True, truncate_input=False):
#Generator constructor.
self._file_path = file_path #file_path: Path to data file.
self._vocab = vocab #vocab: Vocabulary.
self._params = params #params: model hyperparameters.
self._context_key = context_key #context_key: context key for tf.Example.
self._question_key = question_key #question_key: question key for tf.Example.
self._answer_key = answer_key #answer_key: answer key for tf.Example.
self._max_context = max_context #max_context: Max number of sentences used from context.
self._max_question = max_question #max_question: Max number of sentences used from question.
self._bucketing = bucketing #bucketing: Whether bucket articles of similar length into the same batch.
self._truncate_input = truncate_input #truncate_input: Whether to truncate input that is too long. Alternative is to discard such examples.
self._input_queue = queue.Queue(QUEUE_NUM_BATCH * self._params.batch_size)
self._bucket_input_queue = queue.Queue(QUEUE_NUM_BATCH)
self._input_threads = []
for _ in range(2):
self._input_threads.append(Thread(target=self._enqueue))
self._input_threads[-1].daemon = True
self._input_threads[-1].start()
self._bucketing_threads = []
for _ in range(1):
self._bucketing_threads.append(Thread(target=self._fill_bucket))
self._bucketing_threads[-1].daemon = True
self._bucketing_threads[-1].start()
self._watch_thread = Thread(target=self._monitor)
self._watch_thread.daemon = True
self._watch_thread.start()
def next(self):
"""Returns next batch of inputs for model.
Returns:
batch_context: A batch of encoder inputs [c_timesteps, batch_size].
batch_question: A batch of encoder inputs [q_timesteps, batch_size].
batch_answer: A batch of one-hot encoded answers [2, batch_size].
origin_context: original context words.
origin_question: original question words.
origin_answer: original answer words.
"""
batch_context = np.zeros(
(self._params.c_timesteps, self._params.batch_size), dtype=np.int32)
batch_question = np.zeros(
(self._params.q_timesteps, self._params.batch_size), dtype=np.int32)
batch_answer = np.zeros(
(2, self._params.batch_size), dtype=np.int32)
origin_context = ['None'] * self._params.batch_size
origin_question = ['None'] * self._params.batch_size
origin_answer = ['None'] * self._params.batch_size
buckets = self._bucket_input_queue.get()
for i in range(self._params.batch_size):
(input_context, input_question, input_answer,
context, question, answer) = buckets[i]
origin_context[i] = context
origin_question[i] = question
origin_answer[i] = answer
batch_context[:, i] = input_context[:]
batch_question[:, i] = input_question[:]
batch_answer[:, i] = input_answer[:]
return (batch_context, batch_question, batch_answer,
origin_context, origin_question, origin_answer)
def _enqueue(self):
"""Fill input queue with ModelInput."""
end_id = self._vocab.tokenToId(SENTENCE_END)
pad_id = self._vocab.tokenToId(PAD_TOKEN)
input_gen = self._textGenerator(tf_Examples(self._file_path))
while True:
(context, question, answer) = next(input_gen)
context_sentences = [sent.strip() for sent in to_sentences(context)]
question_sentences = [sent.strip() for sent in to_sentences(question)]
answer_sentences = [sent.strip() for sent in to_sentences(answer)]
input_context = []
input_question = []
# Convert first N sentences to word IDs, stripping existing <s> and </s>.
for i in range(min(self._max_context,
len(context_sentences))):
input_context += tokens_to_ids(context_sentences[i], self._vocab)
for i in range(min(self._max_question,
len(question_sentences))):
input_question += tokens_to_ids(question_sentences[i], self._vocab)
# assume single sentence answer
ans_ids = tokens_to_ids(answer_sentences[0], self._vocab)
# Filter out too-short input
if (len(input_context) < self._params.min_input_len or
len(input_question) < self._params.min_input_len):
tf.logging.warning('Drop an example - too short.\nc_enc: %d\nq_enc: %d',
len(input_context), len(input_question))
continue
# If we're not truncating input, throw out too-long input
if not self._truncate_input:
if (len(input_context) > self._params.c_timesteps or
len(input_question) > self._params.q_timesteps):
tf.logging.warning('Drop an example - too long.\nc_enc: %d\nq_enc: %d',
len(input_context), len(input_question))
continue
# If we are truncating input, do so if necessary
else:
if len(input_context) > self._params.c_timesteps:
input_context = input_context[:self._params.c_timesteps]
if len(input_question) > self._params.q_timesteps:
input_question = input_question[:self._params.q_timesteps]
# Pad if necessary
while len(input_context) < self._params.c_timesteps:
input_context.append(pad_id)
while len(input_question) < self._params.q_timesteps:
input_question.append(pad_id)
# start and end indices of answer
s = input_context.index(ans_ids[0])
e = input_context.index(ans_ids[-1])
input_answer = [s, e]
element = ModelInput(input_context, input_question, input_answer,
' '.join(context_sentences),
' '.join(question_sentences),
' '.join(answer_sentences))
self._input_queue.put(element)
def _fill_bucket(self):
"""Fill bucketed batches into the bucket_input_queue."""
while True:
inputs = []
for _ in range(self._params.batch_size * BUCKET_CACHE_BATCH):
inputs.append(self._input_queue.get())
if self._bucketing:
inputs = sorted(inputs, key=lambda inp: inp.enc_len)
batches = []
for i in range(0, len(inputs), self._params.batch_size):
batches.append(inputs[i:i+self._params.batch_size])
shuffle(batches)
for b in batches:
self._bucket_input_queue.put(b)
def _monitor(self):
"""Watch the daemon input threads and restart if dead."""
while True:
time.sleep(60)
input_threads = []
for t in self._input_threads:
if t.is_alive():
input_threads.append(t)
else:
tf.logging.error('Found input thread dead.')
new_t = Thread(target=self._enqueue)
input_threads.append(new_t)
input_threads[-1].daemon = True
input_threads[-1].start()
self._input_threads = input_threads
bucketing_threads = []
for t in self._bucketing_threads:
if t.is_alive():
bucketing_threads.append(t)
else:
tf.logging.error('Found bucketing thread dead.')
new_t = Thread(target=self._fill_bucket)
bucketing_threads.append(new_t)
bucketing_threads[-1].daemon = True
bucketing_threads[-1].start()
self._bucketing_threads = bucketing_threads
def _getExFeatureText(self, ex, key):
"""Extract text for a feature from td.Example.
Args:
ex: tf.Example.
key: key of the feature to be extracted.
Returns:
feature: a feature text extracted.
"""
return ex.features.feature[key].bytes_list.value[0]
def _textGenerator(self, example_gen):
"""Yields original (context, question, answer) tuple."""
while True:
e = next(example_gen)
try:
context_text = self._getExFeatureText(e, self._context_key)
question_text = self._getExFeatureText(e, self._question_key)
answer_text = self._getExFeatureText(e, self._answer_key)
except ValueError:
tf.logging.error('Failed to get data from example')
continue
yield (context_text, question_text, answer_text)
| {
"content_hash": "171e9a39839411eae90cdedd91f8008b",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 143,
"avg_line_length": 39.19736842105263,
"alnum_prop": 0.6295177352579165,
"repo_name": "drakessn/Question-Answering",
"id": "9a39f400d184898616ff0ceb25365d0170d60626",
"size": "8937",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "batch_reader.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "49488"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Beco</tipo><logradouro>União</logradouro><bairro>Jacaré</bairro><cidade>Cabo Frio</cidade><uf>RJ</uf><cep>28922630</cep></feed>
| {
"content_hash": "2f3fbe669b8f74ddf715e11eca8025ff",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 139,
"avg_line_length": 98,
"alnum_prop": 0.7142857142857143,
"repo_name": "chesarex/webservice-cep",
"id": "4541da89cee3917dfb82dcfd483fc2bcdf41d08e",
"size": "198",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/ceps/28/922/630/cep.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
class Ezine::TestMembersController < ApplicationController
include Cms::BaseFilter
include Cms::CrudFilter
model Ezine::TestMember
navi_view "ezine/main/navi"
private
def fix_params
{ cur_user: @cur_user, cur_site: @cur_site, node_id: @cur_node.id }
end
public
def index
raise "403" unless @cur_node.allowed?(:read, @cur_user, site: @cur_site)
@items = @model.site(@cur_site).
where(node_id: @cur_node.id).
search(params[:s]).
order_by(updated: -1).
page(params[:page]).per(50)
end
def new
@item = Ezine::TestMember.new(site_id: @cur_site.id, node_id: @cur_node.id)
end
end
| {
"content_hash": "64dbfc87e466ba3fbfa9755ae3e543cc",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 22.24137931034483,
"alnum_prop": 0.6465116279069767,
"repo_name": "tany/ss",
"id": "8dabdb897d5422f6b7e934a4fe9e1fc1b54d690f",
"size": "645",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "app/controllers/ezine/test_members_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "86617"
},
{
"name": "HTML",
"bytes": "2954705"
},
{
"name": "JavaScript",
"bytes": "5619171"
},
{
"name": "Ruby",
"bytes": "10054601"
},
{
"name": "SCSS",
"bytes": "481390"
},
{
"name": "Shell",
"bytes": "21408"
}
],
"symlink_target": ""
} |
#include <aws/ec2/model/DescribeAccountAttributesResponse.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <utility>
using namespace Aws::EC2::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils::Logging;
using namespace Aws::Utils;
using namespace Aws;
DescribeAccountAttributesResponse::DescribeAccountAttributesResponse()
{
}
DescribeAccountAttributesResponse::DescribeAccountAttributesResponse(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
*this = result;
}
DescribeAccountAttributesResponse& DescribeAccountAttributesResponse::operator =(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
const XmlDocument& xmlDocument = result.GetPayload();
XmlNode rootNode = xmlDocument.GetRootElement();
XmlNode resultNode = rootNode;
if (!rootNode.IsNull() && (rootNode.GetName() != "DescribeAccountAttributesResponse"))
{
resultNode = rootNode.FirstChild("DescribeAccountAttributesResponse");
}
if(!resultNode.IsNull())
{
XmlNode accountAttributesNode = resultNode.FirstChild("accountAttributeSet");
if(!accountAttributesNode.IsNull())
{
XmlNode accountAttributesMember = accountAttributesNode.FirstChild("item");
while(!accountAttributesMember.IsNull())
{
m_accountAttributes.push_back(accountAttributesMember);
accountAttributesMember = accountAttributesMember.NextNode("item");
}
}
}
if (!rootNode.IsNull()) {
XmlNode requestIdNode = rootNode.FirstChild("requestId");
if (!requestIdNode.IsNull())
{
m_responseMetadata.SetRequestId(StringUtils::Trim(requestIdNode.GetText().c_str()));
}
AWS_LOGSTREAM_DEBUG("Aws::EC2::Model::DescribeAccountAttributesResponse", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
}
return *this;
}
| {
"content_hash": "05a9ebaae06b95c9816656ba75bd32c2",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 139,
"avg_line_length": 32.25,
"alnum_prop": 0.7509043927648579,
"repo_name": "awslabs/aws-sdk-cpp",
"id": "1e04c20c323438b81eeb865043fac68434e20bdf",
"size": "2054",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-ec2/source/model/DescribeAccountAttributesResponse.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "7596"
},
{
"name": "C++",
"bytes": "61740540"
},
{
"name": "CMake",
"bytes": "337520"
},
{
"name": "Java",
"bytes": "223122"
},
{
"name": "Python",
"bytes": "47357"
}
],
"symlink_target": ""
} |
'use strict';
var chai = require('chai');
var should = chai.should();
var Mnemonic = require('..');
var errors = require('bitcore-lib').errors;
var bip39_vectors = require('./data/fixtures.json');
describe('Mnemonic', function() {
this.timeout(30000);
it('should initialize the class', function() {
should.exist(Mnemonic);
});
describe('# Mnemonic', function() {
describe('Constructor', function() {
it('does not require new keyword', function() {
var mnemonic = Mnemonic(); // jshint ignore:line
mnemonic.should.be.instanceof(Mnemonic);
});
it('should fail with invalid data', function() {
(function() {
return new Mnemonic({});
}).should.throw(errors.InvalidArgument);
});
it('should fail with unknown word list', function() {
(function() {
return new Mnemonic('pilots foster august tomorrow kit daughter unknown awesome model town village master');
}).should.throw(errors.Mnemonic.UnknownWordlist);
});
it('should fail with invalid mnemonic', function() {
(function() {
return new Mnemonic('monster foster august tomorrow kit daughter unknown awesome model town village pilot');
}).should.throw(errors.Mnemonic.InvalidMnemonic);
});
it('should fail with invalid ENT', function() {
(function() {
return new Mnemonic(64);
}).should.throw(errors.InvalidArgument);
});
it('constructor defaults to english worldlist', function() {
var mnemonic = new Mnemonic();
mnemonic.wordlist.should.equal(Mnemonic.Words.ENGLISH);
});
it('allow using different worldlists', function() {
var mnemonic = new Mnemonic(Mnemonic.Words.SPANISH);
mnemonic.wordlist.should.equal(Mnemonic.Words.SPANISH);
});
it('constructor honor both length and wordlist', function() {
var mnemonic = new Mnemonic(32 * 7, Mnemonic.Words.SPANISH);
mnemonic.phrase.split(' ').length.should.equal(21);
mnemonic.wordlist.should.equal(Mnemonic.Words.SPANISH);
});
it('constructor should detect standard wordlist', function() {
var mnemonic = new Mnemonic('afirmar diseño hielo fideo etapa ogro cambio fideo toalla pomelo número buscar');
mnemonic.wordlist.should.equal(Mnemonic.Words.SPANISH);
});
});
it('english wordlist is complete', function() {
Mnemonic.Words.ENGLISH.length.should.equal(2048);
Mnemonic.Words.ENGLISH[0].should.equal('abandon');
});
it('spanish wordlist is complete', function() {
Mnemonic.Words.SPANISH.length.should.equal(2048);
Mnemonic.Words.SPANISH[0].should.equal('ábaco');
});
it('japanese wordlist is complete', function() {
Mnemonic.Words.JAPANESE.length.should.equal(2048);
Mnemonic.Words.JAPANESE[0].should.equal('あいこくしん');
});
it('chinese wordlist is complete', function() {
Mnemonic.Words.CHINESE.length.should.equal(2048);
Mnemonic.Words.CHINESE[0].should.equal('的');
});
it('french wordlist is complete', function() {
Mnemonic.Words.FRENCH.length.should.equal(2048);
Mnemonic.Words.FRENCH[0].should.equal('abaisser');
});
it('allows use different phrase lengths', function() {
var mnemonic;
mnemonic = new Mnemonic(32 * 4);
mnemonic.phrase.split(' ').length.should.equal(12);
mnemonic = new Mnemonic(32 * 5);
mnemonic.phrase.split(' ').length.should.equal(15);
mnemonic = new Mnemonic(32 * 6);
mnemonic.phrase.split(' ').length.should.equal(18);
mnemonic = new Mnemonic(32 * 7);
mnemonic.phrase.split(' ').length.should.equal(21);
mnemonic = new Mnemonic(32 * 8);
mnemonic.phrase.split(' ').length.should.equal(24);
});
it('validates a phrase', function() {
var valid = Mnemonic.isValid('afirmar diseño hielo fideo etapa ogro cambio fideo toalla pomelo número buscar');
valid.should.equal(true);
var invalid = Mnemonic.isValid('afirmar diseño hielo fideo etapa ogro cambio fideo hielo pomelo número buscar');
invalid.should.equal(false);
var invalid2 = Mnemonic.isValid('afirmar diseño hielo fideo etapa ogro cambio fideo hielo pomelo número oneInvalidWord');
invalid2.should.equal(false);
var invalid3 = Mnemonic.isValid('totally invalid phrase');
invalid3.should.equal(false);
var valid2 = Mnemonic.isValid('caution opprimer époque belote devenir ficeler filleul caneton apologie nectar frapper fouiller');
valid2.should.equal(true);
});
it('has a toString method', function() {
var mnemonic = new Mnemonic();
mnemonic.toString().should.equal(mnemonic.phrase);
});
it('has a toString method', function() {
var mnemonic = new Mnemonic();
mnemonic.inspect().should.have.string('<Mnemonic:');
});
it('derives a seed without a passphrase', function() {
var mnemonic = new Mnemonic();
var seed = mnemonic.toSeed();
should.exist(seed);
});
it('derives a seed using a passphrase', function() {
var mnemonic = new Mnemonic();
var seed = mnemonic.toSeed('my passphrase');
should.exist(seed);
});
it('derives an extended private key', function() {
var mnemonic = new Mnemonic();
var pk = mnemonic.toHDPrivateKey();
should.exist(pk);
});
it('Mnemonic.fromSeed should fail with invalid wordlist', function() {
(function() {
return Mnemonic.fromSeed(new Buffer(1));
}).should.throw(errors.InvalidArgument);
});
it('Mnemonic.fromSeed should fail with invalid seed', function() {
(function() {
return Mnemonic.fromSeed();
}).should.throw(errors.InvalidArgument);
});
it('Constructor should fail with invalid seed', function() {
(function() {
return new Mnemonic(new Buffer(1));
}).should.throw(errors.InvalidEntropy);
});
// To add new vectors for different languages:
// 1. Add and implement the wordlist so it appears in Mnemonic.Words
// 2. Add the vectors and make sure the key is lowercase of the key for Mnemonic.Words
var vector_wordlists = {};
for(var key in Mnemonic.Words) {
if (Mnemonic.Words.hasOwnProperty(key)) {
vector_wordlists[key.toLowerCase()] = Mnemonic.Words[key];
}
}
var test_vector = function(v, lang) {
it('should pass test vector for ' + lang + ' #' + v, function() {
var wordlist = vector_wordlists[lang];
var vector = bip39_vectors[lang][v];
var code = vector[1];
var mnemonic = vector[2];
var seed = vector[3];
var mnemonic1 = Mnemonic.fromSeed(new Buffer(code, 'hex'), wordlist).phrase;
mnemonic1.should.equal(mnemonic);
var m = new Mnemonic(mnemonic);
var seed1 = m.toSeed(vector[0]);
seed1.toString('hex').should.equal(seed);
Mnemonic.isValid(mnemonic, wordlist).should.equal(true);
});
};
for(var key in bip39_vectors) {
if (bip39_vectors.hasOwnProperty(key)) {
for (var v = 0; v < bip39_vectors[key].length; v++) {
test_vector(v, key);
}
}
}
});
});
| {
"content_hash": "9c9abc0a76c638331f72820082521302",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 136,
"avg_line_length": 33.23287671232877,
"alnum_prop": 0.6323165704863973,
"repo_name": "bitjson/bitcore-mnemonic",
"id": "5d522a588099edf76b6c6fc29a1610c71132b029",
"size": "7302",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/mnemonic.unit.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "522"
},
{
"name": "JavaScript",
"bytes": "19317"
}
],
"symlink_target": ""
} |
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <assert.h>
#include "mpi.h"
#include "mdhim.h"
#define KEYS 10000
#define TOTAL_KEYS 10000
#define SLICE_SIZE 100000
#define SECONDARY_SLICE_SIZE 10000
#define PRIMARY 1
#define SECONDARY 2
uint64_t **keys;
int *key_lens;
uint64_t **values;
int *value_lens;
uint64_t ***secondary_keys;
int **secondary_key_lens;
void start_record(struct timeval *start) {
gettimeofday(start, NULL);
}
void end_record(struct timeval *end) {
gettimeofday(end, NULL);
}
void add_time(struct timeval *start, struct timeval *end, long double *time) {
long double elapsed = (long double) (end->tv_sec - start->tv_sec) +
((long double) (end->tv_usec - start->tv_usec)/1000000.0);
*time += elapsed;
}
void gen_keys_values(int rank, int total_keys) {
int i = 0;
for (i = 0; i < KEYS; i++) {
keys[i] = malloc(sizeof(uint64_t));
*keys[i] = i + (uint64_t) ((uint64_t) rank * (uint64_t)TOTAL_KEYS) + total_keys;
/* If we are generating keys for the secondary index, then they should be distributed differently
across the range servers */
secondary_keys[i] = malloc(sizeof(uint64_t *));
*secondary_keys[i] = malloc(sizeof(uint64_t));
**secondary_keys[i] = i + rank;
key_lens[i] = sizeof(uint64_t);
secondary_key_lens[i] = malloc(sizeof(uint64_t));
*secondary_key_lens[i] = sizeof(uint64_t);
values[i] = malloc(sizeof(uint64_t));
value_lens[i] = sizeof(uint64_t);
*values[i] = rank;
//The secondary key's values should be the primary key they refer to
}
}
void free_key_values() {
int i;
for (i = 0; i < KEYS; i++) {
free(keys[i]);
free(values[i]);
free(*secondary_keys[i]);
free(secondary_keys[i]);
free(secondary_key_lens[i]);
}
}
int main(int argc, char **argv) {
int ret;
int provided;
int i;
struct mdhim_t *md;
int total = 0;
struct mdhim_brm_t *brm, *brmp;
struct mdhim_bgetrm_t *bgrm, *bgrmp;
struct timeval start_tv, end_tv;
char *db_path = "./";
char *db_name = "mdhimTstDB-";
int dbug = MLOG_DBG; //MLOG_CRIT=1, MLOG_DBG=2
mdhim_options_t *db_opts; // Local variable for db create options to be passed
int db_type = LEVELDB; //(data_store.h)
long double put_time = 0;
long double get_time = 0;
struct index_t *secondary_local_index;
struct secondary_bulk_info *secondary_info;
int num_keys[KEYS];
MPI_Comm comm;
// Create options for DB initialization
db_opts = mdhim_options_init();
mdhim_options_set_db_path(db_opts, db_path);
mdhim_options_set_db_name(db_opts, db_name);
mdhim_options_set_db_type(db_opts, db_type);
mdhim_options_set_key_type(db_opts, MDHIM_LONG_INT_KEY);
mdhim_options_set_max_recs_per_slice(db_opts, SLICE_SIZE);
mdhim_options_set_server_factor(db_opts, 4);
mdhim_options_set_debug_level(db_opts, dbug);
//Initialize MPI with multiple thread support
ret = MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
if (ret != MPI_SUCCESS) {
printf("Error initializing MPI with threads\n");
exit(1);
}
//Quit if MPI didn't initialize with multiple threads
if (provided != MPI_THREAD_MULTIPLE) {
printf("Not able to enable MPI_THREAD_MULTIPLE mode\n");
exit(1);
}
gettimeofday(&start_tv, NULL);
//Initialize MDHIM
comm = MPI_COMM_WORLD;
md = mdhimInit(&comm, db_opts);
if (!md) {
printf("Error initializing MDHIM\n");
MPI_Abort(MPI_COMM_WORLD, ret);
exit(1);
}
key_lens = malloc(sizeof(int) * KEYS);
value_lens = malloc(sizeof(int) * KEYS);
keys = malloc(sizeof(uint64_t *) * KEYS);
values = malloc(sizeof(uint64_t *) * KEYS);
secondary_key_lens = malloc(sizeof(int *) * KEYS);
secondary_keys = malloc(sizeof(uint64_t **) * KEYS);
memset(secondary_keys, 0, sizeof(uint64_t **) * KEYS);
/* Primary and secondary key entries */
MPI_Barrier(MPI_COMM_WORLD);
total = 0;
secondary_local_index = create_local_index(md, LEVELDB,
MDHIM_LONG_INT_KEY, NULL);
for (i = 0; i < KEYS; i++) {
num_keys[i] = 1;
}
while (total != TOTAL_KEYS) {
//Populate the primary keys and values to insert
gen_keys_values(md->mdhim_rank, total);
secondary_info = mdhimCreateSecondaryBulkInfo(secondary_local_index,
(void ***) secondary_keys,
secondary_key_lens, num_keys,
SECONDARY_LOCAL_INFO);
//record the start time
start_record(&start_tv);
//Insert the primary keys into MDHIM
brm = mdhimBPut(md, (void **) keys, key_lens,
(void **) values, value_lens, KEYS,
NULL, secondary_info);
//Record the end time
end_record(&end_tv);
//Add the final time
add_time(&start_tv, &end_tv, &put_time);
if (!brm || brm->error) {
printf("Rank - %d: Error inserting keys/values into MDHIM\n", md->mdhim_rank);
}
while (brm) {
if (brm->error < 0) {
printf("Rank: %d - Error inserting key/values info MDHIM\n", md->mdhim_rank);
}
brmp = brm->next;
//Free the message
mdhim_full_release_msg(brm);
brm = brmp;
}
free_key_values();
mdhimReleaseSecondaryBulkInfo(secondary_info);
total += KEYS;
}
/* End primary and secondary entries */
MPI_Barrier(MPI_COMM_WORLD);
/* End secondary key entries */
//Commit the database
ret = mdhimCommit(md, md->primary_index);
if (ret != MDHIM_SUCCESS) {
printf("Error committing MDHIM database\n");
} else {
printf("Committed MDHIM database\n");
}
//Get the stats for the secondary index so the client figures out who to query
ret = mdhimStatFlush(md, secondary_local_index);
if (ret != MDHIM_SUCCESS) {
printf("Error getting stats\n");
} else {
printf("Got stats\n");
}
MPI_Barrier(MPI_COMM_WORLD);
//Retrieve the primary key's values from the secondary key
total = 0;
while (total != TOTAL_KEYS) {
//Populate the keys and values to retrieve
gen_keys_values(md->mdhim_rank, total);
start_record(&start_tv);
//Get the values back for each key inserted
for (i = 0; i < KEYS; i++) {
bgrm = mdhimBGet(md, secondary_local_index,
(void **) secondary_keys[i], secondary_key_lens[i],
1, MDHIM_GET_PRIMARY_EQ);
}
end_record(&end_tv);
add_time(&start_tv, &end_tv, &get_time);
while (bgrm) {
/* if (!bgrm || bgrm->error) {
printf("Rank: %d - Error retrieving values starting at: %llu",
md->mdhim_rank, (long long unsigned int) *keys[0]);
} */
//Validate that the data retrieved is the correct data
for (i = 0; i < bgrm->num_keys && !bgrm->error; i++) {
if (!bgrm->value_lens[i]) {
printf("Rank: %d - Got an empty value for key: %llu",
md->mdhim_rank, *(long long unsigned int *)bgrm->keys[i]);
continue;
}
}
bgrmp = bgrm;
bgrm = bgrm->next;
mdhim_full_release_msg(bgrmp);
}
free_key_values();
total += KEYS;
}
free(key_lens);
free(keys);
free(values);
free(value_lens);
free(secondary_key_lens);
free(secondary_keys);
MPI_Barrier(MPI_COMM_WORLD);
//Quit MDHIM
ret = mdhimClose(md);
gettimeofday(&end_tv, NULL);
if (ret != MDHIM_SUCCESS) {
printf("Error closing MDHIM\n");
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
printf("Took: %Lf seconds to put %d keys\n",
put_time, TOTAL_KEYS * 2);
printf("Took: %Lf seconds to get %d keys/values\n",
get_time, TOTAL_KEYS * 2);
return 0;
}
| {
"content_hash": "27b80d4c01fd1c0b3b8e223afb6bf5e9",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 102,
"avg_line_length": 28.15,
"alnum_prop": 0.6403880311517967,
"repo_name": "mdhim/mdhim-tng",
"id": "50cd3b459ce8fa15a85614da9b26be2b5a574279",
"size": "7319",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/single_tests/bput-bget_secondary_local.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "631839"
},
{
"name": "FORTRAN",
"bytes": "3037"
},
{
"name": "Java",
"bytes": "137402"
},
{
"name": "Makefile",
"bytes": "4755"
},
{
"name": "Perl",
"bytes": "6759"
},
{
"name": "Shell",
"bytes": "1530"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using StickEmApp.Entities;
using StickEmApp.Windows.ViewModel;
namespace StickEmApp.Windows.Builders
{
public interface IVendorListItemBuilder
{
IReadOnlyCollection<VendorListItem> BuildFrom(IReadOnlyCollection<Vendor> vendorList);
}
} | {
"content_hash": "cb8721c4772f2b9dc9db007bae798aa3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 94,
"avg_line_length": 26.454545454545453,
"alnum_prop": 0.7938144329896907,
"repo_name": "jdt/StickEmApp",
"id": "fcaa5f03976c6de5bd1d6e750939d519485d4039",
"size": "293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/StickEmApp/StickEmApp.Windows/Builders/IVendorListItemBuilder.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "132794"
}
],
"symlink_target": ""
} |
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using LiteGuard;
namespace LeagueRecorder.Server.Infrastructure.LeagueApi
{
public class ApiKeyMessageHandler : DelegatingHandler
{
private readonly string _apiKey;
public ApiKeyMessageHandler(string apiKey)
{
Guard.AgainstNullArgument("apiKey", apiKey);
this._apiKey = apiKey;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
request.RequestUri = this.AppendApiKeyToQueryString(request.RequestUri);
return base.SendAsync(request, cancellationToken);
}
private Uri AppendApiKeyToQueryString(Uri uri)
{
var builder = new UriBuilder(uri);
var query = HttpUtility.ParseQueryString(builder.Query);
query["api_key"] = _apiKey;
builder.Query = query.ToString();
return builder.Uri;
}
}
} | {
"content_hash": "6a5df312ee4de31769ee80b2bd4041ae",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 127,
"avg_line_length": 26.875,
"alnum_prop": 0.6558139534883721,
"repo_name": "haefele/LeagueRecorderOld",
"id": "02acf63b3b0a79b398ef3eca5e9e5416cb6c878e",
"size": "1077",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Server/LeagueRecorder.Server.Infrastructure/LeagueApi/ApiKeyMessageHandler.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "128658"
}
],
"symlink_target": ""
} |
import * as SunCalc from 'suncalc';
let d: Date;
let x: number;
let b: boolean;
const date = new Date();
const latitude = 0.0;
const longitude = 0.0;
const times = SunCalc.getTimes(date, latitude, longitude);
d = times.dawn;
d = times.dusk;
d = times.goldenHour;
d = times.goldenHourEnd;
d = times.nadir;
d = times.nauticalDawn;
d = times.nauticalDusk;
d = times.night;
d = times.nightEnd;
d = times.solarNoon;
d = times.sunrise;
d = times.sunriseEnd;
d = times.sunset;
d = times.sunsetStart;
SunCalc.addTime(0.0, 'customTime', 'customTimeEnd');
const pos = SunCalc.getPosition(date, latitude, longitude);
x = pos.altitude;
x = pos.azimuth;
const mp = SunCalc.getMoonPosition(date, latitude, longitude);
x = mp.altitude;
x = mp.azimuth;
x = mp.distance;
x = mp.parallacticAngle;
const mi = SunCalc.getMoonIllumination(date);
x = mi.fraction;
x = mi.phase;
x = mi.angle;
const mt = SunCalc.getMoonTimes(date, latitude, longitude, true);
d = mt.rise;
d = mt.set;
b = mt.alwaysUp;
b = mt.alwaysDown;
| {
"content_hash": "3fc17c71c70ea754e985ff20b57bdb27",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 65,
"avg_line_length": 20.9375,
"alnum_prop": 0.7064676616915423,
"repo_name": "georgemarshall/DefinitelyTyped",
"id": "0bc8772d04db04efce24e4cf188996d4f3c9239f",
"size": "1005",
"binary": false,
"copies": "58",
"ref": "refs/heads/master",
"path": "types/suncalc/suncalc-tests.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "16338312"
},
{
"name": "Ruby",
"bytes": "40"
},
{
"name": "Shell",
"bytes": "73"
},
{
"name": "TypeScript",
"bytes": "17728346"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using IIS.SLSharp.Bindings.MOGRE;
using IIS.SLSharp.Shaders;
using Mogre;
namespace IIS.SLSharp.Examples.MOGRE.GeoClipmap.GeoClipmap
{
public class Patch : IDisposable
{
private HardwareVertexBufferSharedPtr _vb;
private HardwareIndexBufferSharedPtr _ib;
private VertexDeclaration _vertexDeclaration;
internal VertexData VertexData { get; private set; }
internal IndexData IndexData { get; private set; }
public int Height { get; private set; }
public int Width { get; private set; }
private void CreateBuffers(ushort[] indices, short[] vertices)
{
var numIndices = (uint)indices.Length;
var numVertices = (uint)vertices.Length;
_vertexDeclaration = HardwareBufferManager.Singleton.CreateVertexDeclaration();
_vertexDeclaration.AddElement(0, 0, VertexElementType.VET_SHORT2, VertexElementSemantic.VES_POSITION);
_ib = HardwareBufferManager.Singleton.CreateIndexBuffer(HardwareIndexBuffer.IndexType.IT_16BIT, numIndices, HardwareBuffer.Usage.HBU_STATIC_WRITE_ONLY);
_vb = HardwareBufferManager.Singleton.CreateVertexBuffer(_vertexDeclaration.GetVertexSize(0), numVertices, HardwareBuffer.Usage.HBU_STATIC_WRITE_ONLY, false);
unsafe
{
fixed (ushort* x = indices)
_ib.WriteData(0, numIndices * sizeof(ushort), x, true);
fixed (short* x = vertices)
_vb.WriteData(0, numVertices * sizeof(ushort), x, true);
}
var binding = new VertexBufferBinding();
binding.SetBinding(0, _vb);
VertexData = new VertexData(_vertexDeclaration, binding);
VertexData.vertexCount = numVertices;
VertexData.vertexStart = 0;
IndexData = new IndexData();
IndexData.indexBuffer = _ib;
IndexData.indexCount = numIndices;
IndexData.indexStart = 0;
}
private void Generate(int m, int n)
{
// TODO: optimize patches for vertex caching!
var indices = new ushort[2 * 3 * (m - 1) * (n - 1)];
var vertices = new short[2 * m * n];
var i = 0;
for (var y = 0; y < n; y++)
{
for (var x = 0; x < m; x++)
{
vertices[i++] = (short)x;
vertices[i++] = (short)y;
}
}
i = 0;
for (var y = 0; y < n - 1; y++)
{
for (var x = 0; x < m - 1; x++)
{
var current = x + y * m;
indices[i++] = (ushort)current;
indices[i++] = (ushort)(current + 1);
indices[i++] = (ushort)(current + m);
indices[i++] = (ushort)(current + 1);
indices[i++] = (ushort)(current + m + 1);
indices[i++] = (ushort)(current + m);
}
}
// TODO: permutate indices here to optimize vertex caching
// it would theoretically be possible to share a single
// vertex buffer as well if vertex caching can still be maintained
// with this
CreateBuffers(indices, vertices);
Width = m - 1;
Height = n - 1;
}
protected internal Patch(int m, int n)
{
Generate(m, n);
}
protected internal Patch(int n)
{
// ib = (1 2 3) (3 4 5) (5 6 7) (7 8 9) (9 10 11) (11 12 13) (13 14 15)
var indices = new ushort[(n / 2 * 3) * 4];
var vertices = new short[(2 * n) * 4];
var i = 0;
var j = 0;
// bottom
for (var x = 0; x < n; x++)
{
vertices[i++] = (short)x;
vertices[i++] = 0;
}
for (var x = 0; x < n - 1; x += 2)
{
indices[j++] = (ushort)(x + 2);
indices[j++] = (ushort)(x + 1);
indices[j++] = (ushort)x;
}
// top
for (var x = 0; x < n; x++)
{
vertices[i++] = (short)x;
vertices[i++] = (short)(n - 1);
}
var start = n;
for (var x = 0; x < n - 1; x += 2)
{
indices[j++] = (ushort)(start + x);
indices[j++] = (ushort)(start + x + 1);
indices[j++] = (ushort)(start + x + 2);
}
// left
for (var x = 0; x < n; x++)
{
vertices[i++] = 0;
vertices[i++] = (short)x;
}
start = n * 2;
for (var x = 0; x < n - 1; x += 2)
{
indices[j++] = (ushort)(start + x);
indices[j++] = (ushort)(start + x + 1);
indices[j++] = (ushort)(start + x + 2);
}
// right
for (var x = 0; x < n; x++)
{
vertices[i++] = (short)(n - 1);
vertices[i++] = (short)x;
}
start = n * 3;
for (var x = 0; x < n - 1; x += 2)
{
indices[j++] = (ushort)(start + x + 2);
indices[j++] = (ushort)(start + x + 1);
indices[j++] = (ushort)(start + x);
}
CreateBuffers(indices, vertices);
Width = 0;
Height = 0;
}
// cant override? well mogre wont be able to manage it! ...
public virtual void Dispose()
{
_ib.Dispose();
_vb.Dispose();
}
}
}
| {
"content_hash": "4ebd5ede9b1e34448ebb0a7232b5d3d8",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 170,
"avg_line_length": 30.803108808290155,
"alnum_prop": 0.45164003364171573,
"repo_name": "hach-que/SLSharp",
"id": "184cf263ae0c80505cb3105c7f073c1b065509d3",
"size": "5947",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "IIS.SLSharp.Examples.Mogre.GeoClipmap/GeoClipmap/Patch.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1160481"
},
{
"name": "Shell",
"bytes": "609"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="content"
type="java.lang.String" />
</data>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:gravity="center_vertical"
android:text="@{content}" />
</android.support.v7.widget.CardView>
</layout>
| {
"content_hash": "ca8af85658dd45cdf3838c68e8dfaa00",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 67,
"avg_line_length": 27.82608695652174,
"alnum_prop": 0.5921875,
"repo_name": "RichardGottschalk/RecyclerAdapter",
"id": "4c811f91a65c55ee8160a0d887377482c874d413",
"size": "640",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/container_simple_databinding.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "193919"
}
],
"symlink_target": ""
} |
import * as childProcess from "child_process";
import * as fs from "fs";
import * as process from "process";
import * as tmp from "tmp";
// Mine
import * as repo from "../src/repo";
import * as util from "../src/util";
import * as cc from "./core-common";
describe("repo", () => {
const startDir = process.cwd();
let tempFolder: tmp.DirResult;
const testOrigin = "[email protected]:path/to/main.git";
beforeAll(() => {
tempFolder = tmp.dirSync({ unsafeCleanup: true, keep: true });
process.chdir(tempFolder.name);
fs.mkdirSync("notRepo");
childProcess.execFileSync("git", ["init", "emptyGitRepo", "-b", "trunk", "-q"]);
childProcess.execFileSync("hg", ["init", "emptyHgRepo"]);
cc.makeOneGitRepo("hasOrigin", testOrigin);
cc.makeOneGitRepo("detached", testOrigin);
cc.commitAndDetach("detached");
});
afterAll(() => {
process.chdir(startDir);
tempFolder.removeCallback();
});
beforeEach(() => {
process.chdir(tempFolder.name);
});
afterEach(() => {
// process.chdir(startDir);
});
test("isGitRepository", () => {
expect(repo.isGitRepository("notRepo")).toBe(false);
expect(repo.isGitRepository("doesNotExist")).toBe(false);
expect(repo.isGitRepository("emptyGitRepo")).toBe(true);
expect(repo.isGitRepository("emptyHgRepo")).toBe(false);
});
test("isHgRepository", () => {
expect(repo.isHgRepository("notRepo")).toBe(false);
expect(repo.isGitRepository("doesNotExist")).toBe(false);
expect(repo.isHgRepository("emptyGitRepo")).toBe(false);
expect(repo.isHgRepository("emptyHgRepo")).toBe(true);
});
test("getOrigin", () => {
expect(() => {
repo.getOrigin("notRepo");
}).toThrowError(util.suppressTerminateExceptionMessage);
expect(() => {
repo.getOrigin("doesNotExist");
}).toThrowError(util.suppressTerminateExceptionMessage);
// We have local only repos, so no origin.
expect(repo.getOrigin("emptyGitRepo", "git")).toBeUndefined();
expect(repo.getOrigin("emptyHgRepo", "hg")).toBeUndefined();
expect(repo.getOrigin("hasOrigin", "git")).toBe(testOrigin);
});
test("getBranch", () => {
expect(() => {
repo.getBranch("notRepo");
}).toThrowError(util.suppressTerminateExceptionMessage);
expect(() => {
repo.getBranch("doesNotExist");
}).toThrowError(util.suppressTerminateExceptionMessage);
expect(repo.getBranch("emptyGitRepo", "git")).toBe("trunk");
expect(repo.getBranch("detached", "git")).toBeUndefined();
expect(repo.getBranch("emptyHgRepo", "hg")).toBe("default");
});
test("getRevision", () => {
// Basic checks, throw on no repo
expect(() => {
repo.getRevision("notRepo");
}).toThrowError(util.suppressTerminateExceptionMessage);
expect(() => {
repo.getRevision("doesNotExist");
}).toThrowError(util.suppressTerminateExceptionMessage);
expect(repo.getRevision("detached", "git")).not.toBeUndefined();
expect(repo.getRevision("emptyGitRepo", "git")).toBeUndefined();
expect(repo.getRevision("emptyHgRepo", "hg")).toBe("0000000000000000000000000000000000000000");
});
});
| {
"content_hash": "0317a9fcece7d2fb0a8362aee67d08d1",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 99,
"avg_line_length": 33,
"alnum_prop": 0.6567783094098884,
"repo_name": "JohnRGee/arm",
"id": "1836e4e58ff037a2b7cb50ae08230d316525822b",
"size": "3181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/repo.int.test.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "38879"
}
],
"symlink_target": ""
} |
<?php
defined('_JEXEC') or die;
/**
* Installer HTML class.
*
* @since 2.5
*/
abstract class InstallerHtmlManage
{
/**
* Returns a published state on a grid.
*
* @param integer $value The state value.
* @param integer $i The row index.
* @param boolean $enabled An optional setting for access control on the action.
* @param string $checkbox An optional prefix for checkboxes.
*
* @return string The Html code
*
* @see JHtmlJGrid::state
*
* @since 2.5
*/
public static function state($value, $i, $enabled = true, $checkbox = 'cb')
{
$states = array(
2 => array(
'',
'COM_INSTALLER_EXTENSION_PROTECTED',
'',
'COM_INSTALLER_EXTENSION_PROTECTED',
true,
'protected',
'protected',
),
1 => array(
'unpublish',
'COM_INSTALLER_EXTENSION_ENABLED',
'COM_INSTALLER_EXTENSION_DISABLE',
'COM_INSTALLER_EXTENSION_ENABLED',
true,
'publish',
'publish',
),
0 => array(
'publish',
'COM_INSTALLER_EXTENSION_DISABLED',
'COM_INSTALLER_EXTENSION_ENABLE',
'COM_INSTALLER_EXTENSION_DISABLED',
true,
'unpublish',
'unpublish',
),
);
return JHtml::_('jgrid.state', $states, $value, $i, 'manage.', $enabled, true, $checkbox);
}
}
| {
"content_hash": "62e3e212b2b588dd6e518c535bf8a02c",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 92,
"avg_line_length": 21.098360655737704,
"alnum_prop": 0.5944055944055944,
"repo_name": "kobudev/lpp",
"id": "da18a185e868092747b47ac6f31e5a435a334029",
"size": "1532",
"binary": false,
"copies": "143",
"ref": "refs/heads/master",
"path": "administrator/components/com_installer/helpers/html/manage.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1356247"
},
{
"name": "HTML",
"bytes": "1016"
},
{
"name": "JavaScript",
"bytes": "1552104"
},
{
"name": "PHP",
"bytes": "10957717"
},
{
"name": "PLpgSQL",
"bytes": "1056"
}
],
"symlink_target": ""
} |
import { Component, OnInit, Input } from '@angular/core';
import { Page } from '../models';
@Component({
selector: 'app-pages',
templateUrl: './pages.component.html',
styleUrls: ['./pages.component.less']
})
export class PagesComponent implements OnInit {
@Input() activePage: Page;
Page = Page;
ngOnInit(): void {
}
}
| {
"content_hash": "f2cef0b165b8fb1858642fe92d602ada",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 19.823529411764707,
"alnum_prop": 0.658753709198813,
"repo_name": "lematty/mysite",
"id": "53ba6f7497e33f5d7d55fb42b2a3f8102725ae8e",
"size": "337",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/pages/pages.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1274"
},
{
"name": "HTML",
"bytes": "14207"
},
{
"name": "JavaScript",
"bytes": "222911"
}
],
"symlink_target": ""
} |
import logging
import numpy as np
import pandas as pd
from . import snpmatch
from . import parsers
from . import snp_genotype
log = logging.getLogger(__name__)
def simulateSNPs(g, AccID, numSNPs, outFile=None, err_rate=0.001):
assert type(AccID) is str, "provide Accession ID as a string"
assert AccID in g.g.accessions, "accession is not present in the matrix!"
AccToCheck = np.where(g.g.accessions == AccID)[0][0]
log.info("loading input files")
acc_snp = g.g_acc.snps[:,AccToCheck]
informative_snps = np.where(acc_snp >= 0)[0] ## Removing NAs for accession
input_df = pd.DataFrame(np.column_stack((np.array(g.g.chromosomes)[informative_snps], g.g.positions[informative_snps], acc_snp[informative_snps] )), columns = ["chr", 'pos', 'snp'])
## Input -- pandas dataframe with chr, position and genotype
#assert type(input_df) == pd.core.frame.DataFrame, "please provide a pandas dataframe"
#assert input_df.shape[1] >= 3, "first three columns are needed in dataframe: chr, pos, snp"
## default error rates = 0.001
log.info("sampling %s positions" % numSNPs)
sampleSNPs = np.sort(np.random.choice(np.arange(input_df.shape[0]), numSNPs, replace=False))
input_df = input_df.iloc[sampleSNPs,:]
log.info("adding in error rate: %s" % err_rate)
num_to_change = int(err_rate * input_df.shape[0])
input_df.iloc[np.sort(np.random.choice(np.arange(input_df.shape[0]), num_to_change, replace=False)), 2] = np.random.choice(3, num_to_change)
input_df.iloc[:, 2] = parsers.snp_binary_to_gt( np.array(input_df.iloc[:,2]) )
if outFile is not None:
input_df.to_csv( outFile, sep = "\t", index = None, header = False )
return(input_df)
def simulateSNPs_F1(g, parents, numSNPs, outFile, err_rate, rm_hets = 1):
indP1 = np.where(g.g_acc.accessions == parents.split("x")[0])[0][0]
indP2 = np.where(g.g_acc.accessions == parents.split("x")[1])[0][0]
log.info("loading files!")
snpsP1 = g.g_acc.snps[:,indP1]
snpsP2 = g.g_acc.snps[:,indP2]
common_ix = np.where((snpsP1 >= 0) & (snpsP2 >= 0) & (snpsP1 < 2) & (snpsP2 < 2))[0]
segregating_ix = np.where(snpsP1[common_ix] != snpsP2[common_ix] )[0]
diff_ix = np.setdiff1d( np.arange(len(common_ix)), segregating_ix )
common_snps = np.zeros(len(common_ix), dtype="int8")
common_snps[segregating_ix] = 2
common_snps[diff_ix] = snpsP1[common_ix[diff_ix]]
input_df = pd.DataFrame( np.column_stack((np.array(g.g_acc.chromosomes)[common_ix], np.array(g.g_acc.positions)[common_ix], common_snps )), columns = ["chr", 'pos', 'snp'] )
log.info("sampling %s positions" % numSNPs)
sampleSNPs = np.sort(np.random.choice(np.arange(input_df.shape[0]), numSNPs, replace=False))
input_df = input_df.iloc[sampleSNPs,:]
input_df['snp'] = input_df['snp'].astype(int)
log.info("adding in error rate: %s" % err_rate)
num_to_change = int(err_rate * input_df.shape[0])
input_df.iloc[np.sort(np.random.choice(np.where(input_df['snp'] != 2)[0], num_to_change, replace=False)), 2] = np.random.choice(2, num_to_change)
## Also change hets randomly to homozygous
het_ix = np.where(input_df['snp'] == 2)[0]
input_df.iloc[het_ix, 2] = np.random.choice(3, het_ix.shape[0], p=[(1-rm_hets)/2,(1-rm_hets)/2,rm_hets])
## Save the file to a bed file
input_df.iloc[:, 2] = parsers.snp_binary_to_gt( np.array(input_df.iloc[:,2]) )
if outFile is not None:
input_df.to_csv( outFile, sep = "\t", index = None, header = False )
return(input_df)
def potatoSimulate(args):
g = snp_genotype.Genotype(args['hdf5File'], args['hdf5accFile'] )
if args['simF1']:
simulateSNPs_F1(g, args['AccID'], args['numSNPs'], args['outFile'], args['err_rate'], args['rm_het'])
else:
simulateSNPs(g, args['AccID'], args['numSNPs'], args['outFile'], args['err_rate'])
log.info("finished!")
| {
"content_hash": "58eb2b7dbe7d7da37a2258b1462a2bf8",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 185,
"avg_line_length": 57.19117647058823,
"alnum_prop": 0.651581383389046,
"repo_name": "Gregor-Mendel-Institute/SNPmatch",
"id": "bc10a3950ca1027577d27908a6d9c6baaafca64a",
"size": "3889",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "snpmatch/core/simulate.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "338"
},
{
"name": "Jupyter Notebook",
"bytes": "67490"
},
{
"name": "Python",
"bytes": "150075"
}
],
"symlink_target": ""
} |
package com.github.binarywang.wxpay.testbase;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
* The type Xml wx pay config.
*/
@XStreamAlias("xml")
public class XmlWxPayConfig extends WxPayConfig {
private String openid;
/**
* Gets openid.
*
* @return the openid
*/
public String getOpenid() {
return openid;
}
/**
* Sets openid.
*
* @param openid the openid
*/
public void setOpenid(String openid) {
this.openid = openid;
}
@Override
public boolean isUseSandboxEnv() {
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
//return true;
return false;
}
}
| {
"content_hash": "a9f6850abe6ac5337eae7694544802cb",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 57,
"avg_line_length": 18.027027027027028,
"alnum_prop": 0.6686656671664168,
"repo_name": "binarywang/weixin-java-tools",
"id": "bdb394cd296baad880545cfc03f0bd4ba7be1280",
"size": "709",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/XmlWxPayConfig.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1934347"
},
{
"name": "Shell",
"bytes": "276"
}
],
"symlink_target": ""
} |
'use strict'
import expect from './common'
import BaseGitHubApi from '../src/api'
describe('BaseGitHubApi', function () {
it('should return a valid api instance without config', () => {
const api = new BaseGitHubApi()
expect(api).to.be.an.instanceOf(BaseGitHubApi)
})
describe('#doRequest', function () {
describe('without authentication', function () {
it('should be able to make requests to public api', () => {
const apiEndpoint = '/zen'
const api = new BaseGitHubApi()
const promise = api.doRequest(apiEndpoint)
return promise.then((res) => {
expect(res).to.be.an.object
expect(res).to.have.property('status')
expect(res.status).to.equal(200)
})
})
})
})
})
| {
"content_hash": "17f219dd5d27a9be5abf498bf9a7e6ff",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 65,
"avg_line_length": 26.689655172413794,
"alnum_prop": 0.6059431524547804,
"repo_name": "jamsinclair/github-lite",
"id": "a4d72fb8cb5c4c13b734be6fd3e3a196491ad6ab",
"size": "774",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/api.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "5765"
}
],
"symlink_target": ""
} |
import re
import sys
from subprocess import PIPE, STDOUT
import subprocess
def err(msg="Undetermined error"):
print "ERROR"
print msg
sys.exit(0)
if __name__ == '__main__':
if len(sys.argv) < 2:
genders_query = '~NONE' # Trick to list all hosts
else:
genders_query = sys.argv[1]
if len(sys.argv) > 2:
header = sys.argv[2]
else:
header = "host"
if re.search('[^\w\d&|~\-()=:\.]', genders_query):
err("Inappropriate character in Genders query")
hosts = subprocess.Popen( ['/usr/bin/nodeattr', '-n', genders_query], \
stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True).communicate()[0]
print header
print hosts,
| {
"content_hash": "fb0de1ff5069a26fe00d75060666c00f",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 84,
"avg_line_length": 23.9,
"alnum_prop": 0.5913528591352859,
"repo_name": "wcooley/splunk-puppet",
"id": "56b73ee069c1e2b2d540e72bc0dec739ab8eb107",
"size": "1516",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bin/gendershosts.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2927"
},
{
"name": "Python",
"bytes": "3827"
},
{
"name": "Shell",
"bytes": "1285"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "7d4759e61a3ca305b36deb2de7598f69",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "1187159b272bf15d3b037946c20964a41795081a",
"size": "171",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rosaceae/Prunus/Prunus salicina/Prunus triflora triflora/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/**
* SECTION:element-av1dec
*
* AV1 Decoder.
*
* <refsect2>
* <title>Example launch line</title>
* |[
* gst-launch-1.0 -v filesrc location=videotestsrc.webm ! matroskademux ! av1dec ! videoconvert ! videoscale ! autovideosink
* ]|
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "gstav1dec.h"
enum
{
PROP_0,
};
static GstStaticPadTemplate gst_av1_dec_sink_pad_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-av1")
);
static GstStaticPadTemplate gst_av1_dec_src_pad_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ I420, YV12, Y42B, Y444"
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
", I420_10LE, I420_12LE, I422_10LE, I422_12LE, Y444_10LE, Y444_12LE"
#else
", I420_10BE, I420_12BE, I422_10BE, I422_12BE, Y444_10BE, Y444_12BE"
#endif
" }"))
);
GST_DEBUG_CATEGORY_STATIC (av1_dec_debug);
#define GST_CAT_DEFAULT av1_dec_debug
#define GST_VIDEO_FORMAT_WITH_ENDIAN(fmt,endian) GST_VIDEO_FORMAT_##fmt##endian
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define AOM_FMT_TO_GST(fmt) GST_VIDEO_FORMAT_WITH_ENDIAN(fmt,LE)
#else
#define AOM_FMT_TO_GST(fmt) GST_VIDEO_FORMAT_WITH_ENDIAN(fmt,BE)
#endif
static void gst_av1_dec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_av1_dec_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_av1_dec_start (GstVideoDecoder * dec);
static gboolean gst_av1_dec_stop (GstVideoDecoder * dec);
static gboolean gst_av1_dec_set_format (GstVideoDecoder * dec,
GstVideoCodecState * state);
static gboolean gst_av1_dec_flush (GstVideoDecoder * dec);
static GstFlowReturn
gst_av1_dec_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
static void gst_av1_dec_image_to_buffer (GstAV1Dec * dec,
const aom_image_t * img, GstBuffer * buffer);
static GstFlowReturn gst_av1_dec_open_codec (GstAV1Dec * av1dec,
GstVideoCodecFrame * frame);
static gboolean gst_av1_dec_get_valid_format (GstAV1Dec * dec,
const aom_image_t * img, GstVideoFormat * fmt);
#define gst_av1_dec_parent_class parent_class
G_DEFINE_TYPE (GstAV1Dec, gst_av1_dec, GST_TYPE_VIDEO_DECODER);
static void
gst_av1_dec_class_init (GstAV1DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstVideoDecoderClass *vdec_class;
gobject_class = (GObjectClass *) klass;
element_class = (GstElementClass *) klass;
vdec_class = (GstVideoDecoderClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = gst_av1_dec_set_property;
gobject_class->get_property = gst_av1_dec_get_property;
gst_element_class_add_static_pad_template (element_class,
&gst_av1_dec_src_pad_template);
gst_element_class_add_static_pad_template (element_class,
&gst_av1_dec_sink_pad_template);
gst_element_class_set_static_metadata (element_class, "AV1 Decoder",
"Codec/Decoder/Video", "Decode AV1 video streams",
"Sean DuBois <[email protected]>");
vdec_class->start = GST_DEBUG_FUNCPTR (gst_av1_dec_start);
vdec_class->stop = GST_DEBUG_FUNCPTR (gst_av1_dec_stop);
vdec_class->flush = GST_DEBUG_FUNCPTR (gst_av1_dec_flush);
vdec_class->set_format = GST_DEBUG_FUNCPTR (gst_av1_dec_set_format);
vdec_class->handle_frame = GST_DEBUG_FUNCPTR (gst_av1_dec_handle_frame);
klass->codec_algo = &aom_codec_av1_dx_algo;
GST_DEBUG_CATEGORY_INIT (av1_dec_debug, "av1dec", 0, "AV1 decoding element");
}
static void
gst_av1_dec_init (GstAV1Dec * av1dec)
{
GstVideoDecoder *dec = (GstVideoDecoder *) av1dec;
GST_DEBUG_OBJECT (dec, "gst_av1_dec_init");
gst_video_decoder_set_packetized (dec, TRUE);
gst_video_decoder_set_needs_format (dec, TRUE);
gst_video_decoder_set_use_default_pad_acceptcaps (dec, TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_VIDEO_DECODER_SINK_PAD (dec));
}
static void
gst_av1_dec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_av1_dec_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
gst_av1_dec_start (GstVideoDecoder * dec)
{
GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
av1dec->decoder_inited = FALSE;
av1dec->output_state = NULL;
av1dec->input_state = NULL;
return TRUE;
}
static gboolean
gst_av1_dec_stop (GstVideoDecoder * dec)
{
GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
if (av1dec->output_state) {
gst_video_codec_state_unref (av1dec->output_state);
av1dec->output_state = NULL;
}
if (av1dec->input_state) {
gst_video_codec_state_unref (av1dec->input_state);
av1dec->input_state = NULL;
}
if (av1dec->decoder_inited) {
aom_codec_destroy (&av1dec->decoder);
}
av1dec->decoder_inited = FALSE;
return TRUE;
}
static gboolean
gst_av1_dec_set_format (GstVideoDecoder * dec, GstVideoCodecState * state)
{
GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
if (av1dec->decoder_inited) {
aom_codec_destroy (&av1dec->decoder);
}
av1dec->decoder_inited = FALSE;
if (av1dec->output_state) {
gst_video_codec_state_unref (av1dec->output_state);
av1dec->output_state = NULL;
}
if (av1dec->input_state) {
gst_video_codec_state_unref (av1dec->input_state);
}
av1dec->input_state = gst_video_codec_state_ref (state);
return TRUE;
}
static gboolean
gst_av1_dec_flush (GstVideoDecoder * dec)
{
GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
if (av1dec->output_state) {
gst_video_codec_state_unref (av1dec->output_state);
av1dec->output_state = NULL;
}
if (av1dec->decoder_inited) {
aom_codec_destroy (&av1dec->decoder);
}
av1dec->decoder_inited = FALSE;
return TRUE;
}
static GstFlowReturn
gst_av1_dec_open_codec (GstAV1Dec * av1dec, GstVideoCodecFrame * frame)
{
aom_codec_err_t status;
GstAV1DecClass *av1class = GST_AV1_DEC_GET_CLASS (av1dec);
status = aom_codec_dec_init (&av1dec->decoder, av1class->codec_algo, NULL, 0);
if (status != AOM_CODEC_OK) {
GST_ELEMENT_ERROR (av1dec, LIBRARY, INIT,
("Failed to initialize AOM decoder"), ("%s", ""));
return GST_FLOW_ERROR;
}
av1dec->decoder_inited = TRUE;
return GST_FLOW_OK;
}
static void
gst_av1_dec_handle_resolution_change (GstAV1Dec * av1dec, aom_image_t * img,
GstVideoFormat fmt)
{
if (!av1dec->output_state ||
av1dec->output_state->info.finfo->format != fmt ||
av1dec->output_state->info.width != img->d_w ||
av1dec->output_state->info.height != img->d_h) {
if (av1dec->output_state)
gst_video_codec_state_unref (av1dec->output_state);
av1dec->output_state =
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (av1dec),
fmt, img->d_w, img->d_h, av1dec->input_state);
gst_video_decoder_negotiate (GST_VIDEO_DECODER (av1dec));
}
}
static void
gst_av1_dec_image_to_buffer (GstAV1Dec * dec, const aom_image_t * img,
GstBuffer * buffer)
{
int deststride, srcstride, height, width, line, comp, y;
guint8 *dest, *src;
GstVideoFrame frame;
GstVideoInfo *info = &dec->output_state->info;
if (!gst_video_frame_map (&frame, info, buffer, GST_MAP_WRITE)) {
GST_ERROR_OBJECT (dec, "Could not map video buffer");
return;
}
for (comp = 0; comp < 3; comp++) {
dest = GST_VIDEO_FRAME_COMP_DATA (&frame, comp);
src = img->planes[comp];
width =
GST_VIDEO_FRAME_COMP_WIDTH (&frame,
comp) * GST_VIDEO_FRAME_COMP_PSTRIDE (&frame, comp);
height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, comp);
deststride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp);
srcstride = img->stride[comp];
if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8) {
GST_TRACE_OBJECT (dec,
"HIGHBITDEPTH image with 8 bit_depth. Comp %d: %d != %d, copying "
"line by line.", comp, srcstride, deststride);
for (line = 0; line < height; line++) {
for (y = 0; y < width; y++) {
dest[y] = src[y * 2];
}
dest += deststride;
src += srcstride;
}
} else if (srcstride == deststride) {
GST_TRACE_OBJECT (dec, "Stride matches. Comp %d: %d, copying full plane",
comp, srcstride);
memcpy (dest, src, srcstride * height);
} else {
GST_TRACE_OBJECT (dec, "Stride mismatch. Comp %d: %d != %d, copying "
"line by line.", comp, srcstride, deststride);
for (line = 0; line < height; line++) {
memcpy (dest, src, width);
dest += deststride;
src += srcstride;
}
}
}
gst_video_frame_unmap (&frame);
}
gboolean
gst_av1_dec_get_valid_format (GstAV1Dec * dec, const aom_image_t * img,
GstVideoFormat * fmt)
{
switch (img->fmt) {
case AOM_IMG_FMT_I420:
case AOM_IMG_FMT_I42016:
if (img->bit_depth == 8) {
*fmt = img->monochrome ? GST_VIDEO_FORMAT_GRAY8 : GST_VIDEO_FORMAT_I420;
return TRUE;
} else if (img->bit_depth == 10) {
*fmt = AOM_FMT_TO_GST (I420_10);
return TRUE;
} else if (img->bit_depth == 12) {
*fmt = AOM_FMT_TO_GST (I420_12);
return TRUE;
}
GST_FIXME_OBJECT (dec,
"Please add a 4:2:0 planar %u bit depth frame format",
img->bit_depth);
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED, (NULL),
("Unsupported frame format - 4:2:0 planar %u bit depth",
img->bit_depth));
return FALSE;
case AOM_IMG_FMT_I422:
case AOM_IMG_FMT_I42216:
if (img->bit_depth == 8) {
*fmt = GST_VIDEO_FORMAT_Y42B;
return TRUE;
} else if (img->bit_depth == 10) {
*fmt = AOM_FMT_TO_GST (I422_10);
return TRUE;
} else if (img->bit_depth == 12) {
*fmt = AOM_FMT_TO_GST (I422_12);
return TRUE;
}
GST_FIXME_OBJECT (dec,
"Please add a 4:2:2 planar %u bit depth frame format",
img->bit_depth);
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED, (NULL),
("Unsupported frame format - 4:2:2 planar %u bit depth",
img->bit_depth));
return FALSE;
case AOM_IMG_FMT_I444:
case AOM_IMG_FMT_I44416:
if (img->bit_depth == 8) {
*fmt = GST_VIDEO_FORMAT_Y444;
return TRUE;
} else if (img->bit_depth == 10) {
*fmt = AOM_FMT_TO_GST (Y444_10);
return TRUE;
} else if (img->bit_depth == 12) {
*fmt = AOM_FMT_TO_GST (Y444_12);
return TRUE;
}
GST_FIXME_OBJECT (dec,
"Please add a 4:4:4 planar %u bit depth frame format",
img->bit_depth);
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED, (NULL),
("Unsupported frame format - 4:4:4 planar %u bit depth",
img->bit_depth));
return FALSE;
case AOM_IMG_FMT_YV12:
*fmt = GST_VIDEO_FORMAT_YV12;
return TRUE;
default:
return FALSE;
}
}
static GstFlowReturn
gst_av1_dec_handle_frame (GstVideoDecoder * dec, GstVideoCodecFrame * frame)
{
GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
GstFlowReturn ret;
GstMapInfo minfo;
aom_codec_err_t status;
aom_image_t *img;
aom_codec_iter_t iter = NULL;
GstVideoFormat fmt;
if (!av1dec->decoder_inited) {
ret = gst_av1_dec_open_codec (av1dec, frame);
if (ret == GST_FLOW_CUSTOM_SUCCESS_1) {
gst_video_decoder_drop_frame (dec, frame);
return GST_FLOW_OK;
} else if (ret != GST_FLOW_OK) {
gst_video_codec_frame_unref (frame);
return ret;
}
}
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
GST_ERROR_OBJECT (dec, "Failed to map input buffer");
gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}
status = aom_codec_decode (&av1dec->decoder, minfo.data, minfo.size, NULL);
gst_buffer_unmap (frame->input_buffer, &minfo);
if (status) {
GST_ELEMENT_ERROR (av1dec, LIBRARY, INIT,
("Failed to decode frame"), ("%s", ""));
gst_video_codec_frame_unref (frame);
return ret;
}
img = aom_codec_get_frame (&av1dec->decoder, &iter);
if (img) {
if (gst_av1_dec_get_valid_format (av1dec, img, &fmt) == FALSE) {
aom_img_free (img);
GST_ELEMENT_ERROR (dec, LIBRARY, ENCODE,
("Failed to decode frame"), ("Unsupported color format %d",
img->fmt));
gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}
gst_av1_dec_handle_resolution_change (av1dec, img, fmt);
ret = gst_video_decoder_allocate_output_frame (dec, frame);
if (ret == GST_FLOW_OK) {
gst_av1_dec_image_to_buffer (av1dec, img, frame->output_buffer);
ret = gst_video_decoder_finish_frame (dec, frame);
} else {
gst_video_decoder_drop_frame (dec, frame);
}
aom_img_free (img);
while ((img = aom_codec_get_frame (&av1dec->decoder, &iter))) {
GST_WARNING_OBJECT (dec, "Multiple decoded frames... dropping");
aom_img_free (img);
}
} else {
GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame);
gst_video_decoder_finish_frame (dec, frame);
}
return ret;
}
| {
"content_hash": "8def412068ece6223595645d710f60f4",
"timestamp": "",
"source": "github",
"line_count": 467,
"max_line_length": 124,
"avg_line_length": 28.843683083511777,
"alnum_prop": 0.6358574610244989,
"repo_name": "google/aistreams",
"id": "6e0a9bd5dbc087172bb0f91e19dcaa44cb2b7c57",
"size": "14284",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "third_party/gst-plugins-bad/ext/aom/gstav1dec.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "77741"
},
{
"name": "C++",
"bytes": "626396"
},
{
"name": "Python",
"bytes": "41809"
},
{
"name": "Starlark",
"bytes": "56595"
}
],
"symlink_target": ""
} |
echo "STARTING build.sh"
# commenting out this loading geonames stuff now because free travis ci doens't have enough memory
#cd /tmp && wget http://download.geonames.org/export/dump/allCountries.zip
#cd /tmp && unzip allCountries.zip
# takes about 20 min an an AWS Medium EC2 Ubuntu 15.04
#sudo -Hu postgres psql -f /home/usrfd/firstdraft/load_geonames.sql dbfd;
#python manage.py runscript loadGeoNames
#python manage.py runscript loadAlternateNames
#python manage.py runscript loadCountryInfo
#python manage.py runscript loadLSIBWVS
sudo -Hu usrfd bash -c "cd /home/usrfd/firstdraft/projfd python manage.py runscript load --script-args='https://data.hdx.rwlabs.org/dataset/myanmar-adiministrative-boundaries'";
sudo -Hu usrfd bash -c "cd /home/usrfd/firstdraft/projfd python manage.py runscript load --script-args='https://data.hdx.rwlabs.org/dataset/myanmar-village-boundaries'";
#sudo -Hu usrfd bash -c "cd /home/usrfd/firstdraft/projfd python manage.py runscript load --script-args='https://data.hdx.rwlabs.org/dataset/myanmar-village-locations'"
# to-do: figure out admin level for new towns based on looking at parent admin level and see if 100% same admin level
#sudo -Hu usrfd bash -c "cd /home/usrfd/firstdraft/projfd python manage.py runscript load --script-args='https://data.hdx.rwlabs.org/dataset/myanmar-town-locations'"
#sudo -Hu usrfd bash -c "cd /home/usrfd/firstdraft/projfd python manage.py runscript load --script-args='https://data.hdx.rwlabs.org/dataset/honduras-admin-level-1-boundaries'"
#sudo wget http://download.geonames.org/export/dump/alternateNames.zip
#cd /tmp && sudo unzip alternateNames.zip
#sudo -u postgres psql -f /home/usrfd/firstdraft/load_alternate_names.sql dbfd;
#sudo wget http://data.openaddresses.io/openaddresses-collected.zip
#cd /tmp && sudo unzip openaddresses-collected.zip
# add hidden.py
# add md5 auth for usrfd to /etc/postgresql/9.4/main/pg_hba.conf
#sudo service postgresql restart
#sudo -u postgres psql -c "ALTER ROLE usrfd WITH PASSWORD 'passwordhere'"
# enable wsgi mod in
#sudo a2enmod wsgi;
#sudo cp /home/usrfd/firstdraft/fd.conf /etc/apache2/sites-available/fd.conf;
#sudo ln -s /etc/apache2/sites-available/fd.conf /etc/apache2/sites-enabled/fd.conf;
#sudo service apache2 restart;
# add useful aliases
#echo "alias a='sudo su usrfd'" >> ~/.bashrc
#echo "alias m='sudo -u usrfd bash -c\"m\"'" >> ~/.bashrc
#. ~/.bashrc
#sudo -u usrfd bash -c "echo \"alias a='cd /home/usrfd && source venv/bin/activate && cd /home/usrfd/firstdraft/projfd'\" && . /home/usrfd/.bashrc"
#sudo -u usrfd bash -c "echo \"alias m='cd /home/usrfd && source venv/bin/activate && cd /home/usrfd/firstdraft/projfd && python manage.py makemigrations && python manage.py migrate'\" >> /home/usrfd/.bashrc && . /home/usrfd/.bashrc"
#sudo -u usrfd bash -c "echo \"alias s='cd /home/usrfd && source venv/bin/activate && cd /home/usrfd/firstdraft/projfd && python manage.py shell'\" && . /home/usrfd/.bashrc"
echo "FINISHING build.sh"
| {
"content_hash": "eb2d349e9fbbb36e10e7914fc291d4e3",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 233,
"avg_line_length": 58.450980392156865,
"alnum_prop": 0.7507547802750755,
"repo_name": "DanielJDufour/firstdraft",
"id": "06a119238163ffbdd2dd234e00628f1d4a2ccbca",
"size": "2981",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build.sh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "56642"
},
{
"name": "Cucumber",
"bytes": "563"
},
{
"name": "HTML",
"bytes": "18177"
},
{
"name": "JavaScript",
"bytes": "167014"
},
{
"name": "Python",
"bytes": "95910"
},
{
"name": "Shell",
"bytes": "17635"
}
],
"symlink_target": ""
} |
declare type RoutingProjectItemParams = {
slug: string
};
| {
"content_hash": "636b0a5c6dce72a43287dd4c6dfc97cf",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.7258064516129032,
"repo_name": "BrianLusina/brianlusina.github.io",
"id": "0e1e89c0f8ba4a0cd61d38939854727f1971cace",
"size": "62",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/@types/routing.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2200"
},
{
"name": "Dockerfile",
"bytes": "732"
},
{
"name": "HTML",
"bytes": "2216"
},
{
"name": "JavaScript",
"bytes": "105169"
},
{
"name": "Makefile",
"bytes": "2123"
},
{
"name": "SCSS",
"bytes": "48101"
},
{
"name": "Shell",
"bytes": "348"
},
{
"name": "TypeScript",
"bytes": "55937"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
in Ciferri, Publções Inst. Micol. Recife 56: 395 (1959)
#### Original name
Ciferriotheca brosimi Bat. & I.H. Lima
### Remarks
null | {
"content_hash": "1bb706877ab9f43512cc76071412254b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 14.923076923076923,
"alnum_prop": 0.7010309278350515,
"repo_name": "mdoering/backbone",
"id": "45d93631a8a86a5b39d37f4fcaf6fdb8563cfdea",
"size": "258",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Capnodiales/Schizothyriaceae/Ciferriotheca/Ciferriotheca brosimi/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import { TestBed } from '@angular/core/testing';
import { AppModelMemoryToModelModule } from './memory-to-model.module';
import { ModelToMemoryService } from './model-to-memory.service';
import { TEST_MEMORY, TEST_MODEL } from './test-memory-to-model';
describe('Service: ModelToMemoryService', () => {
let service: ModelToMemoryService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AppModelMemoryToModelModule,
],
});
service = TestBed.get(ModelToMemoryService);
});
it('ModelToMemoryService should transform model into memory correctly', () => {
const memory = service.export(TEST_MODEL);
expect(memory).toEqual(TEST_MEMORY);
});
});
| {
"content_hash": "7d41b7091a0e9ce188e794fa3dfeea16",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 83,
"avg_line_length": 31.625,
"alnum_prop": 0.6389986824769434,
"repo_name": "nb48/chart-hero",
"id": "2ac3cffd0d46a9e0c20f42565a3e0aec776983b8",
"size": "759",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/app/model/import-export/memory-to-model/model-to-memory.service.spec.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10971"
},
{
"name": "HTML",
"bytes": "31235"
},
{
"name": "JavaScript",
"bytes": "6965"
},
{
"name": "TypeScript",
"bytes": "228515"
}
],
"symlink_target": ""
} |
<?php
echo $form->textFieldGroup($model, 'y_adsoyad', array(
'labelOptions' => array('label' => 'Adı Soyadı', 'class' => 'col-sm-2'),
'wrapperHtmlOptions' => array('class' => 'col-sm-6')
));
echo $form->textFieldGroup($model, 'y_email', array(
'labelOptions' => array('label' => 'E-Posta', 'class' => 'col-sm-2'),
'wrapperHtmlOptions' => array('class' => 'col-sm-6')
));
$birimler = CHtml::listData(Birimler::model()->findAll(), 'birim_id', 'birim_adi');
echo $form->dropDownListGroup($model, 'y_birim', array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-6',
),
'widgetOptions' => array(
'empty' => 'Seçiniz...',
'data' => $birimler,),
'labelOptions' => array('label' => 'Birim', 'class' => 'col-sm-2 control-label'),
));
echo $form->textFieldGroup($model, 'y_kullanici_adi', array(
'labelOptions' => array('label' => 'Kullanıcı Adı', 'class' => 'col-sm-2'),
'wrapperHtmlOptions' => array('class' => 'col-sm-6')
));
echo $form->textFieldGroup($model, 'y_sifre', array(
'labelOptions' => array('label' => 'Şifre', 'class' => 'col-sm-2'),
'wrapperHtmlOptions' => array('class' => 'col-sm-6')
));
echo $form->dropDownListGroup($model, 'yetki', array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-6',
),
'widgetOptions' => array(
'empty' => 'Seçiniz...',
'data' => $model->yetkiarray),
'labelOptions' => array('label' => 'Birim', 'class' => 'col-sm-2 control-label'),
));
?> | {
"content_hash": "50935dafaee6e55e5f35ce1a072deb60",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 85,
"avg_line_length": 34.09090909090909,
"alnum_prop": 0.5733333333333334,
"repo_name": "sevenseez/A-TASARISI",
"id": "1613c8675a2e2474de8de997fc9a2e8b5aab1a56",
"size": "1510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "protected/views/tables/yonetici/yonetici_form.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "595667"
},
{
"name": "JavaScript",
"bytes": "5895079"
},
{
"name": "PHP",
"bytes": "1224102"
},
{
"name": "Shell",
"bytes": "4025"
},
{
"name": "XML",
"bytes": "1205"
},
{
"name": "XSLT",
"bytes": "8493"
}
],
"symlink_target": ""
} |
package gOsm
import log "github.com/helmutkemper/seelog"
func init(){
logger, _ := log.LoggerFromConfigAsString( `<seelog levels="off"></seelog>` )
log.ReplaceLogger( logger )
}
| {
"content_hash": "a44b8090117653a55c41002edc57b1cc",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 79,
"avg_line_length": 23,
"alnum_prop": 0.7119565217391305,
"repo_name": "helmutkemper/gOsm",
"id": "bdca4a5088df6cdcafc610e01533ca9f4e0e5f59",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "init_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "1584025"
}
],
"symlink_target": ""
} |
/*!
* Reqwest! A general purpose XHR connection manager
* (c) Dustin Diaz 2013
* https://github.com/ded/reqwest
* license MIT
*/
!function (name, context, definition) {
if (typeof module != 'undefined' && module.exports) module.exports = definition()
else if (typeof define == 'function' && define.amd) define(definition)
else context[name] = definition()
}('reqwest', this, function () {
var win = window
, doc = document
, twoHundo = /^20\d$/
, byTag = 'getElementsByTagName'
, readyState = 'readyState'
, contentType = 'Content-Type'
, requestedWith = 'X-Requested-With'
, head = doc[byTag]('head')[0]
, uniqid = 0
, callbackPrefix = 'reqwest_' + (+new Date())
, lastValue // data stored by the most recent JSONP callback
, xmlHttpRequest = 'XMLHttpRequest'
, noop = function () {}
, isArray = typeof Array.isArray == 'function'
? Array.isArray
: function (a) {
return a instanceof Array
}
, defaultHeaders = {
contentType: 'application/x-www-form-urlencoded'
, requestedWith: xmlHttpRequest
, accept: {
'*': 'text/javascript, text/html, application/xml, text/xml, */*'
, xml: 'application/xml, text/xml'
, html: 'text/html'
, text: 'text/plain'
, json: 'application/json, text/javascript'
, js: 'application/javascript, text/javascript'
}
}
, xhr = win[xmlHttpRequest]
? function () {
return new XMLHttpRequest()
}
: function () {
return new ActiveXObject('Microsoft.XMLHTTP')
}
, globalSetupOptions = {
dataFilter: function (data) {
return data
}
}
function handleReadyState(r, success, error) {
return function () {
// use _aborted to mitigate against IE err c00c023f
// (can't read props on aborted request objects)
if (r._aborted) return error(r.request)
if (r.request && r.request[readyState] == 4) {
r.request.onreadystatechange = noop
if (twoHundo.test(r.request.status))
success(r.request)
else
error(r.request)
}
}
}
function setHeaders(http, o) {
var headers = o.headers || {}
, h
headers.Accept = headers.Accept
|| defaultHeaders.accept[o.type]
|| defaultHeaders.accept['*']
// breaks cross-origin requests with legacy browsers
if (!o.crossOrigin && !headers[requestedWith]) headers[requestedWith] = defaultHeaders.requestedWith
if (!headers[contentType]) headers[contentType] = o.contentType || defaultHeaders.contentType
for (h in headers)
headers.hasOwnProperty(h) && http.setRequestHeader(h, headers[h])
}
function setCredentials(http, o) {
if (typeof o.withCredentials !== 'undefined' && typeof http.withCredentials !== 'undefined') {
http.withCredentials = !!o.withCredentials
}
}
function generalCallback(data) {
lastValue = data
}
function urlappend (url, s) {
return url + (/\?/.test(url) ? '&' : '?') + s
}
function handleJsonp(o, fn, err, url) {
var reqId = uniqid++
, cbkey = o.jsonpCallback || 'callback' // the 'callback' key
, cbval = o.jsonpCallbackName || reqwest.getcallbackPrefix(reqId)
// , cbval = o.jsonpCallbackName || ('reqwest_' + reqId) // the 'callback' value
, cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)')
, match = url.match(cbreg)
, script = doc.createElement('script')
, loaded = 0
, isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1
if (match) {
if (match[3] === '?') {
url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name
} else {
cbval = match[3] // provided callback func name
}
} else {
url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em
}
win[cbval] = generalCallback
script.type = 'text/javascript'
script.src = url
script.async = true
if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {
// need this for IE due to out-of-order onreadystatechange(), binding script
// execution to an event listener gives us control over when the script
// is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
//
// if this hack is used in IE10 jsonp callback are never called
script.event = 'onclick'
script.htmlFor = script.id = '_reqwest_' + reqId
}
script.onload = script.onreadystatechange = function () {
if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {
return false
}
script.onload = script.onreadystatechange = null
script.onclick && script.onclick()
// Call the user callback with the last value stored and clean up values and scripts.
o.success && o.success(lastValue)
lastValue = undefined
head.removeChild(script)
loaded = 1
}
// Add the script to the DOM head
head.appendChild(script)
// Enable JSONP timeout
return {
abort: function () {
script.onload = script.onreadystatechange = null
o.error && o.error({}, 'Request is aborted: timeout', {})
lastValue = undefined
head.removeChild(script)
loaded = 1
}
}
}
function getRequest(fn, err) {
var o = this.o
, method = (o.method || 'GET').toUpperCase()
, url = typeof o === 'string' ? o : o.url
// convert non-string objects to query-string form unless o.processData is false
, data = (o.processData !== false && o.data && typeof o.data !== 'string')
? reqwest.toQueryString(o.data)
: (o.data || null)
, http
// if we're working on a GET request and we have data then we should append
// query string to end of URL and not post data
if ((o.type == 'jsonp' || method == 'GET') && data) {
url = urlappend(url, data)
data = null
}
if (o.type == 'jsonp') return handleJsonp(o, fn, err, url)
http = xhr()
http.open(method, url, true)
setHeaders(http, o)
setCredentials(http, o)
http.onreadystatechange = handleReadyState(this, fn, err)
o.before && o.before(http)
http.send(data)
return http
}
function Reqwest(o, fn) {
this.o = o
this.fn = fn
init.apply(this, arguments)
}
function setType(url) {
var m = url.match(/\.(json|jsonp|html|xml)(\?|$)/)
return m ? m[1] : 'js'
}
function init(o, fn) {
this.url = typeof o == 'string' ? o : o.url
this.timeout = null
// whether request has been fulfilled for purpose
// of tracking the Promises
this._fulfilled = false
// success handlers
this._fulfillmentHandlers = []
// error handlers
this._errorHandlers = []
// complete (both success and fail) handlers
this._completeHandlers = []
this._erred = false
this._responseArgs = {}
var self = this
, type = o.type || setType(this.url)
fn = fn || function () {}
if (o.timeout) {
this.timeout = setTimeout(function () {
self.abort()
}, o.timeout)
}
if (o.success) {
this._fulfillmentHandlers.push(function () {
o.success.apply(o, arguments)
})
}
if (o.error) {
this._errorHandlers.push(function () {
o.error.apply(o, arguments)
})
}
if (o.complete) {
this._completeHandlers.push(function () {
o.complete.apply(o, arguments)
})
}
function complete (resp) {
o.timeout && clearTimeout(self.timeout)
self.timeout = null
while (self._completeHandlers.length > 0) {
self._completeHandlers.shift()(resp)
}
}
function success (resp) {
// use global data filter on response text
var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)
, r = resp.responseText = filteredResponse
if (r) {
switch (type) {
case 'json':
try {
resp = win.JSON ? win.JSON.parse(r) : eval('(' + r + ')')
} catch (err) {
return error(resp, 'Could not parse JSON in response', err)
}
break
case 'js':
resp = eval(r)
break
case 'html':
resp = r
break
case 'xml':
resp = resp.responseXML
&& resp.responseXML.parseError // IE trololo
&& resp.responseXML.parseError.errorCode
&& resp.responseXML.parseError.reason
? null
: resp.responseXML
break
}
}
self._responseArgs.resp = resp
self._fulfilled = true
fn(resp)
while (self._fulfillmentHandlers.length > 0) {
self._fulfillmentHandlers.shift()(resp)
}
complete(resp)
}
function error(resp, msg, t) {
self._responseArgs.resp = resp
self._responseArgs.msg = msg
self._responseArgs.t = t
self._erred = true
while (self._errorHandlers.length > 0) {
self._errorHandlers.shift()(resp, msg, t)
}
complete(resp)
}
this.request = getRequest.call(this, success, error)
}
Reqwest.prototype = {
abort: function () {
this._aborted = true
this.request.abort()
}
, retry: function () {
init.call(this, this.o, this.fn)
}
/**
* Small deviation from the Promises A CommonJs specification
* http://wiki.commonjs.org/wiki/Promises/A
*/
/**
* `then` will execute upon successful requests
*/
, then: function (success, fail) {
if (this._fulfilled) {
success(this._responseArgs.resp)
} else if (this._erred) {
fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)
} else {
this._fulfillmentHandlers.push(success)
this._errorHandlers.push(fail)
}
return this
}
/**
* `always` will execute whether the request succeeds or fails
*/
, always: function (fn) {
if (this._fulfilled || this._erred) {
fn(this._responseArgs.resp)
} else {
this._completeHandlers.push(fn)
}
return this
}
/**
* `fail` will execute when the request fails
*/
, fail: function (fn) {
if (this._erred) {
fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)
} else {
this._errorHandlers.push(fn)
}
return this
}
}
function reqwest(o, fn) {
return new Reqwest(o, fn)
}
// normalize newline variants according to spec -> CRLF
function normalize(s) {
return s ? s.replace(/\r?\n/g, '\r\n') : ''
}
function serial(el, cb) {
var n = el.name
, t = el.tagName.toLowerCase()
, optCb = function (o) {
// IE gives value="" even where there is no value attribute
// 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273
if (o && !o.disabled)
cb(n, normalize(o.attributes.value && o.attributes.value.specified ? o.value : o.text))
}
, ch, ra, val, i
// don't serialize elements that are disabled or without a name
if (el.disabled || !n) return
switch (t) {
case 'input':
if (!/reset|button|image|file/i.test(el.type)) {
ch = /checkbox/i.test(el.type)
ra = /radio/i.test(el.type)
val = el.value
// WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here
;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))
}
break
case 'textarea':
cb(n, normalize(el.value))
break
case 'select':
if (el.type.toLowerCase() === 'select-one') {
optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)
} else {
for (i = 0; el.length && i < el.length; i++) {
el.options[i].selected && optCb(el.options[i])
}
}
break
}
}
// collect up all form elements found from the passed argument elements all
// the way down to child elements; pass a '<form>' or form fields.
// called with 'this'=callback to use for serial() on each element
function eachFormElement() {
var cb = this
, e, i
, serializeSubtags = function (e, tags) {
var i, j, fa
for (i = 0; i < tags.length; i++) {
fa = e[byTag](tags[i])
for (j = 0; j < fa.length; j++) serial(fa[j], cb)
}
}
for (i = 0; i < arguments.length; i++) {
e = arguments[i]
if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)
serializeSubtags(e, [ 'input', 'select', 'textarea' ])
}
}
// standard query string style serialization
function serializeQueryString() {
return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))
}
// { 'name': 'value', ... } style serialization
function serializeHash() {
var hash = {}
eachFormElement.apply(function (name, value) {
if (name in hash) {
hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])
hash[name].push(value)
} else hash[name] = value
}, arguments)
return hash
}
// [ { name: 'name', value: 'value' }, ... ] style serialization
reqwest.serializeArray = function () {
var arr = []
eachFormElement.apply(function (name, value) {
arr.push({name: name, value: value})
}, arguments)
return arr
}
reqwest.serialize = function () {
if (arguments.length === 0) return ''
var opt, fn
, args = Array.prototype.slice.call(arguments, 0)
opt = args.pop()
opt && opt.nodeType && args.push(opt) && (opt = null)
opt && (opt = opt.type)
if (opt == 'map') fn = serializeHash
else if (opt == 'array') fn = reqwest.serializeArray
else fn = serializeQueryString
return fn.apply(null, args)
}
reqwest.toQueryString = function (o) {
var qs = '', i
, enc = encodeURIComponent
, push = function (k, v) {
qs += enc(k) + '=' + enc(v) + '&'
}
, k, v
if (isArray(o)) {
for (i = 0; o && i < o.length; i++) push(o[i].name, o[i].value)
} else {
for (k in o) {
if (!Object.hasOwnProperty.call(o, k)) continue
v = o[k]
if (isArray(v)) {
for (i = 0; i < v.length; i++) push(k, v[i])
} else push(k, o[k])
}
}
// spaces should be + according to spec
return qs.replace(/&$/, '').replace(/%20/g, '+')
}
reqwest.getcallbackPrefix = function () {
return callbackPrefix
}
// jQuery and Zepto compatibility, differences can be remapped here so you can call
// .ajax.compat(options, callback)
reqwest.compat = function (o, fn) {
if (o) {
o.type && (o.method = o.type) && delete o.type
o.dataType && (o.type = o.dataType)
o.jsonpCallback && (o.jsonpCallbackName = o.jsonpCallback) && delete o.jsonpCallback
o.jsonp && (o.jsonpCallback = o.jsonp)
}
return new Reqwest(o, fn)
}
reqwest.ajaxSetup = function (options) {
options = options || {}
for (var k in options) {
globalSetupOptions[k] = options[k]
}
}
return reqwest
});
// RSVP.js provides simple tools for organizing asynchronous code.
// https://github.com/tildeio/rsvp.js
// Copyright (c) 2013 Yehuda Katz, Tom Dale, and contributors
(function() {
var define, requireModule;
(function() {
var registry = {}, seen = {};
define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requireModule = function(name) {
if (seen[name]) { return seen[name]; }
seen[name] = {};
var mod = registry[name],
deps = mod.deps,
callback = mod.callback,
reified = [],
exports;
for (var i=0, l=deps.length; i<l; i++) {
if (deps[i] === 'exports') {
reified.push(exports = {});
} else {
reified.push(requireModule(deps[i]));
}
}
var value = callback.apply(this, reified);
return seen[name] = exports || value;
};
})();
define("rsvp/all",
["rsvp/defer","exports"],
function(__dependency1__, __exports__) {
"use strict";
var defer = __dependency1__.defer;
function all(promises) {
var results = [], deferred = defer(), remaining = promises.length;
if (remaining === 0) {
deferred.resolve([]);
}
var resolver = function(index) {
return function(value) {
resolveAll(index, value);
};
};
var resolveAll = function(index, value) {
results[index] = value;
if (--remaining === 0) {
deferred.resolve(results);
}
};
var rejectAll = function(error) {
deferred.reject(error);
};
for (var i = 0; i < promises.length; i++) {
if (promises[i] && typeof promises[i].then === 'function') {
promises[i].then(resolver(i), rejectAll);
} else {
resolveAll(i, promises[i]);
}
}
return deferred.promise;
}
__exports__.all = all;
});
define("rsvp/async",
["exports"],
function(__exports__) {
"use strict";
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var async;
if (typeof process !== 'undefined' &&
{}.toString.call(process) === '[object process]') {
async = function(callback, binding) {
process.nextTick(function() {
callback.call(binding);
});
};
} else if (BrowserMutationObserver) {
var queue = [];
var observer = new BrowserMutationObserver(function() {
var toProcess = queue.slice();
queue = [];
toProcess.forEach(function(tuple) {
var callback = tuple[0], binding = tuple[1];
callback.call(binding);
});
});
var element = document.createElement('div');
observer.observe(element, { attributes: true });
// Chrome Memory Leak: https://bugs.webkit.org/show_bug.cgi?id=93661
window.addEventListener('unload', function(){
observer.disconnect();
observer = null;
});
async = function(callback, binding) {
queue.push([callback, binding]);
element.setAttribute('drainQueue', 'drainQueue');
};
} else {
async = function(callback, binding) {
setTimeout(function() {
callback.call(binding);
}, 1);
};
}
__exports__.async = async;
});
define("rsvp/config",
["rsvp/async","exports"],
function(__dependency1__, __exports__) {
"use strict";
var async = __dependency1__.async;
var config = {};
config.async = async;
__exports__.config = config;
});
define("rsvp/defer",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
function defer() {
var deferred = {};
var promise = new Promise(function(resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
deferred.promise = promise;
return deferred;
}
__exports__.defer = defer;
});
define("rsvp/events",
["exports"],
function(__exports__) {
"use strict";
var Event = function(type, options) {
this.type = type;
for (var option in options) {
if (!options.hasOwnProperty(option)) { continue; }
this[option] = options[option];
}
};
var indexOf = function(callbacks, callback) {
for (var i=0, l=callbacks.length; i<l; i++) {
if (callbacks[i][0] === callback) { return i; }
}
return -1;
};
var callbacksFor = function(object) {
var callbacks = object._promiseCallbacks;
if (!callbacks) {
callbacks = object._promiseCallbacks = {};
}
return callbacks;
};
var EventTarget = {
mixin: function(object) {
object.on = this.on;
object.off = this.off;
object.trigger = this.trigger;
return object;
},
on: function(eventNames, callback, binding) {
var allCallbacks = callbacksFor(this), callbacks, eventName;
eventNames = eventNames.split(/\s+/);
binding = binding || this;
while (eventName = eventNames.shift()) {
callbacks = allCallbacks[eventName];
if (!callbacks) {
callbacks = allCallbacks[eventName] = [];
}
if (indexOf(callbacks, callback) === -1) {
callbacks.push([callback, binding]);
}
}
},
off: function(eventNames, callback) {
var allCallbacks = callbacksFor(this), callbacks, eventName, index;
eventNames = eventNames.split(/\s+/);
while (eventName = eventNames.shift()) {
if (!callback) {
allCallbacks[eventName] = [];
continue;
}
callbacks = allCallbacks[eventName];
index = indexOf(callbacks, callback);
if (index !== -1) { callbacks.splice(index, 1); }
}
},
trigger: function(eventName, options) {
var allCallbacks = callbacksFor(this),
callbacks, callbackTuple, callback, binding, event;
if (callbacks = allCallbacks[eventName]) {
// Don't cache the callbacks.length since it may grow
for (var i=0; i<callbacks.length; i++) {
callbackTuple = callbacks[i];
callback = callbackTuple[0];
binding = callbackTuple[1];
if (typeof options !== 'object') {
options = { detail: options };
}
event = new Event(eventName, options);
callback.call(binding, event);
}
}
}
};
__exports__.EventTarget = EventTarget;
});
define("rsvp/hash",
["rsvp/defer","exports"],
function(__dependency1__, __exports__) {
"use strict";
var defer = __dependency1__.defer;
function size(object) {
var size = 0;
for (var prop in object) {
size++;
}
return size;
}
function hash(promises) {
var results = {}, deferred = defer(), remaining = size(promises);
if (remaining === 0) {
deferred.resolve({});
}
var resolver = function(prop) {
return function(value) {
resolveAll(prop, value);
};
};
var resolveAll = function(prop, value) {
results[prop] = value;
if (--remaining === 0) {
deferred.resolve(results);
}
};
var rejectAll = function(error) {
deferred.reject(error);
};
for (var prop in promises) {
if (promises[prop] && typeof promises[prop].then === 'function') {
promises[prop].then(resolver(prop), rejectAll);
} else {
resolveAll(prop, promises[prop]);
}
}
return deferred.promise;
}
__exports__.hash = hash;
});
define("rsvp/node",
["rsvp/promise","rsvp/all","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
var all = __dependency2__.all;
function makeNodeCallbackFor(resolve, reject) {
return function (error, value) {
if (error) {
reject(error);
} else if (arguments.length > 2) {
resolve(Array.prototype.slice.call(arguments, 1));
} else {
resolve(value);
}
};
}
function denodeify(nodeFunc) {
return function() {
var nodeArgs = Array.prototype.slice.call(arguments), resolve, reject;
var promise = new Promise(function(nodeResolve, nodeReject) {
resolve = nodeResolve;
reject = nodeReject;
});
all(nodeArgs).then(function(nodeArgs) {
nodeArgs.push(makeNodeCallbackFor(resolve, reject));
try {
nodeFunc.apply(this, nodeArgs);
} catch(e) {
reject(e);
}
});
return promise;
};
}
__exports__.denodeify = denodeify;
});
define("rsvp/promise",
["rsvp/config","rsvp/events","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var config = __dependency1__.config;
var EventTarget = __dependency2__.EventTarget;
function objectOrFunction(x) {
return isFunction(x) || (typeof x === "object" && x !== null);
}
function isFunction(x){
return typeof x === "function";
}
var Promise = function(resolver) {
var promise = this,
resolved = false;
if (typeof resolver !== 'function') {
throw new TypeError('You must pass a resolver function as the sole argument to the promise constructor');
}
if (!(promise instanceof Promise)) {
return new Promise(resolver);
}
var resolvePromise = function(value) {
if (resolved) { return; }
resolved = true;
resolve(promise, value);
};
var rejectPromise = function(value) {
if (resolved) { return; }
resolved = true;
reject(promise, value);
};
this.on('promise:resolved', function(event) {
this.trigger('success', { detail: event.detail });
}, this);
this.on('promise:failed', function(event) {
this.trigger('error', { detail: event.detail });
}, this);
resolver(resolvePromise, rejectPromise);
};
var invokeCallback = function(type, promise, callback, event) {
var hasCallback = isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
try {
value = callback(event.detail);
succeeded = true;
} catch(e) {
failed = true;
error = e;
}
} else {
value = event.detail;
succeeded = true;
}
if (objectOrFunction(value) && isFunction(value.then)) {
value.then(function(value) {
resolve(promise, value);
}, function(error) {
reject(promise, error);
});
} else if (hasCallback && succeeded) {
resolve(promise, value);
} else if (failed) {
reject(promise, error);
} else if (type === 'resolve') {
resolve(promise, value);
} else if (type === 'reject') {
reject(promise, value);
}
};
Promise.prototype = {
constructor: Promise,
then: function(done, fail) {
var thenPromise = new Promise(function() {});
if (this.isFulfilled) {
config.async(function() {
invokeCallback('resolve', thenPromise, done, { detail: this.fulfillmentValue });
}, this);
}
if (this.isRejected) {
config.async(function() {
invokeCallback('reject', thenPromise, fail, { detail: this.rejectedReason });
}, this);
}
this.on('promise:resolved', function(event) {
invokeCallback('resolve', thenPromise, done, event);
});
this.on('promise:failed', function(event) {
invokeCallback('reject', thenPromise, fail, event);
});
return thenPromise;
}
};
EventTarget.mixin(Promise.prototype);
function resolve(promise, value) {
if (promise === value) {
fulfill(promise, value);
} else if (objectOrFunction(value) && isFunction(value.then)) {
value.then(function(val) {
if (value !== val) {
resolve(promise, val);
} else {
fulfill(promise, val);
}
}, function(val) {
reject(promise, val);
});
} else {
fulfill(promise, value);
}
}
function fulfill(promise, value) {
config.async(function() {
promise.trigger('promise:resolved', { detail: value });
promise.isFulfilled = true;
promise.fulfillmentValue = value;
});
}
function reject(promise, value) {
config.async(function() {
promise.trigger('promise:failed', { detail: value });
promise.isRejected = true;
promise.rejectedReason = value;
});
}
__exports__.Promise = Promise;
});
define("rsvp/resolve",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
function objectOrFunction(x) {
return typeof x === "function" || (typeof x === "object" && x !== null);
}
function resolve(thenable){
var promise = new Promise(function(resolve, reject){
var then;
try {
if ( objectOrFunction(thenable) ) {
then = thenable.then;
if (typeof then === "function") {
then.call(thenable, resolve, reject);
} else {
resolve(thenable);
}
} else {
resolve(thenable);
}
} catch(error) {
reject(error);
}
});
return promise;
}
__exports__.resolve = resolve;
});
define("rsvp",
["rsvp/events","rsvp/promise","rsvp/node","rsvp/all","rsvp/hash","rsvp/defer","rsvp/config","rsvp/resolve","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __exports__) {
"use strict";
var EventTarget = __dependency1__.EventTarget;
var Promise = __dependency2__.Promise;
var denodeify = __dependency3__.denodeify;
var all = __dependency4__.all;
var hash = __dependency5__.hash;
var defer = __dependency6__.defer;
var config = __dependency7__.config;
var resolve = __dependency8__.resolve;
function configure(name, value) {
config[name] = value;
}
__exports__.Promise = Promise;
__exports__.EventTarget = EventTarget;
__exports__.all = all;
__exports__.hash = hash;
__exports__.defer = defer;
__exports__.denodeify = denodeify;
__exports__.configure = configure;
__exports__.resolve = resolve;
});
window.RSVP = requireModule('rsvp');
})();
// Underscore.js 1.4.4
// http://underscorejs.org
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var
push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeForEach = ArrayProto.forEach,
nativeMap = ArrayProto.map,
nativeReduce = ArrayProto.reduce,
nativeReduceRight = ArrayProto.reduceRight,
nativeFilter = ArrayProto.filter,
nativeEvery = ArrayProto.every,
nativeSome = ArrayProto.some,
nativeIndexOf = ArrayProto.indexOf,
nativeLastIndexOf = ArrayProto.lastIndexOf,
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object via a string identifier,
// for Closure Compiler "advanced" mode.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root._ = _;
}
// Current version.
_.VERSION = '1.4.4';
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles objects with the built-in `forEach`, arrays, and raw objects.
// Delegates to **ECMAScript 5**'s native `forEach` if available.
var each = _.each = _.forEach = function(obj, iterator, context) {
if (obj == null) return;
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (obj.length === +obj.length) {
for (var i = 0, l = obj.length; i < l; i++) {
if (iterator.call(context, obj[i], i, obj) === breaker) return;
}
} else {
for (var key in obj) {
if (_.has(obj, key)) {
if (iterator.call(context, obj[key], key, obj) === breaker) return;
}
}
}
};
// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
_.map = _.collect = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
each(obj, function(value, index, list) {
results.push(iterator.call(context, value, index, list));
});
return results;
};
var reduceError = 'Reduce of empty array with no initial value';
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduce && obj.reduce === nativeReduce) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
}
each(obj, function(value, index, list) {
if (!initial) {
memo = value;
initial = true;
} else {
memo = iterator.call(context, memo, value, index, list);
}
});
if (!initial) throw new TypeError(reduceError);
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
_.reduceRight = _.foldr = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
}
var length = obj.length;
if (length !== +length) {
var keys = _.keys(obj);
length = keys.length;
}
each(obj, function(value, index, list) {
index = keys ? keys[--length] : --length;
if (!initial) {
memo = obj[index];
initial = true;
} else {
memo = iterator.call(context, memo, obj[index], index, list);
}
});
if (!initial) throw new TypeError(reduceError);
return memo;
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, iterator, context) {
var result;
any(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Delegates to **ECMAScript 5**'s native `filter` if available.
// Aliased as `select`.
_.filter = _.select = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
each(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) results.push(value);
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, iterator, context) {
return _.filter(obj, function(value, index, list) {
return !iterator.call(context, value, index, list);
}, context);
};
// Determine whether all of the elements match a truth test.
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
_.every = _.all = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = true;
if (obj == null) return result;
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
each(obj, function(value, index, list) {
if (!(result = result && iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if at least one element in the object matches a truth test.
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (result || (result = iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if the array or object contains a given value (using `===`).
// Aliased as `include`.
_.contains = _.include = function(obj, target) {
if (obj == null) return false;
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
return any(obj, function(value) {
return value === target;
});
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
var isFunc = _.isFunction(method);
return _.map(obj, function(value) {
return (isFunc ? method : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, function(value){ return value[key]; });
};
// Convenience version of a common use case of `filter`: selecting only objects
// containing specific `key:value` pairs.
_.where = function(obj, attrs, first) {
if (_.isEmpty(attrs)) return first ? void 0 : [];
return _[first ? 'find' : 'filter'](obj, function(value) {
for (var key in attrs) {
if (attrs[key] !== value[key]) return false;
}
return true;
});
};
// Convenience version of a common use case of `find`: getting the first object
// containing specific `key:value` pairs.
_.findWhere = function(obj, attrs) {
return _.where(obj, attrs, true);
};
// Return the maximum element or (element-based computation).
// Can't optimize arrays of integers longer than 65,535 elements.
// See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
_.max = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
return Math.max.apply(Math, obj);
}
if (!iterator && _.isEmpty(obj)) return -Infinity;
var result = {computed : -Infinity, value: -Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed >= result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
return Math.min.apply(Math, obj);
}
if (!iterator && _.isEmpty(obj)) return Infinity;
var result = {computed : Infinity, value: Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed < result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Shuffle an array.
_.shuffle = function(obj) {
var rand;
var index = 0;
var shuffled = [];
each(obj, function(value) {
rand = _.random(index++);
shuffled[index - 1] = shuffled[rand];
shuffled[rand] = value;
});
return shuffled;
};
// An internal function to generate lookup iterators.
var lookupIterator = function(value) {
return _.isFunction(value) ? value : function(obj){ return obj[value]; };
};
// Sort the object's values by a criterion produced by an iterator.
_.sortBy = function(obj, value, context) {
var iterator = lookupIterator(value);
return _.pluck(_.map(obj, function(value, index, list) {
return {
value : value,
index : index,
criteria : iterator.call(context, value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index < right.index ? -1 : 1;
}), 'value');
};
// An internal function used for aggregate "group by" operations.
var group = function(obj, value, context, behavior) {
var result = {};
var iterator = lookupIterator(value == null ? _.identity : value);
each(obj, function(value, index) {
var key = iterator.call(context, value, index, obj);
behavior(result, key, value);
});
return result;
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = function(obj, value, context) {
return group(obj, value, context, function(result, key, value) {
(_.has(result, key) ? result[key] : (result[key] = [])).push(value);
});
};
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
_.countBy = function(obj, value, context) {
return group(obj, value, context, function(result, key) {
if (!_.has(result, key)) result[key] = 0;
result[key]++;
});
};
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator, context) {
iterator = iterator == null ? _.identity : lookupIterator(iterator);
var value = iterator.call(context, obj);
var low = 0, high = array.length;
while (low < high) {
var mid = (low + high) >>> 1;
iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
}
return low;
};
// Safely convert anything iterable into a real, live array.
_.toArray = function(obj) {
if (!obj) return [];
if (_.isArray(obj)) return slice.call(obj);
if (obj.length === +obj.length) return _.map(obj, _.identity);
return _.values(obj);
};
// Return the number of elements in an object.
_.size = function(obj) {
if (obj == null) return 0;
return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
_.first = _.head = _.take = function(array, n, guard) {
if (array == null) return void 0;
return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
};
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
_.initial = function(array, n, guard) {
return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
_.last = function(array, n, guard) {
if (array == null) return void 0;
if ((n != null) && !guard) {
return slice.call(array, Math.max(array.length - n, 0));
} else {
return array[array.length - 1];
}
};
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
// Especially useful on the arguments object. Passing an **n** will return
// the rest N values in the array. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = _.drop = function(array, n, guard) {
return slice.call(array, (n == null) || guard ? 1 : n);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, _.identity);
};
// Internal implementation of a recursive `flatten` function.
var flatten = function(input, shallow, output) {
each(input, function(value) {
if (_.isArray(value)) {
shallow ? push.apply(output, value) : flatten(value, shallow, output);
} else {
output.push(value);
}
});
return output;
};
// Return a completely flattened version of an array.
_.flatten = function(array, shallow) {
return flatten(array, shallow, []);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iterator, context) {
if (_.isFunction(isSorted)) {
context = iterator;
iterator = isSorted;
isSorted = false;
}
var initial = iterator ? _.map(array, iterator, context) : array;
var results = [];
var seen = [];
each(initial, function(value, index) {
if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
seen.push(value);
results.push(array[index]);
}
});
return results;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(concat.apply(ArrayProto, arguments));
};
// Produce an array that contains every item shared between all the
// passed-in arrays.
_.intersection = function(array) {
var rest = slice.call(arguments, 1);
return _.filter(_.uniq(array), function(item) {
return _.every(rest, function(other) {
return _.indexOf(other, item) >= 0;
});
});
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
return _.filter(array, function(value){ return !_.contains(rest, value); });
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
var args = slice.call(arguments);
var length = _.max(_.pluck(args, 'length'));
var results = new Array(length);
for (var i = 0; i < length; i++) {
results[i] = _.pluck(args, "" + i);
}
return results;
};
// The inverse operation to `_.zip`. If given an array of pairs it
// returns an array of the paired elements split into two left and
// right element arrays, if given an array of triples it returns a
// three element array and so on. For example, `_.unzip` given
// `[['a',1],['b',2],['c',3]]` returns the array
// [['a','b','c'],[1,2,3]].
_.unzip = function(tuples) {
var maxLen = _.max(_.pluck(tuples, "length"))
return _.times(maxLen, _.partial(_.pluck, tuples));
};
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
_.object = function(list, values) {
if (list == null) return {};
var result = {};
for (var i = 0, l = list.length; i < l; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
};
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
// we need this function. Return the position of the first occurrence of an
// item in an array, or -1 if the item is not included in the array.
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = function(array, item, isSorted) {
if (array == null) return -1;
var i = 0, l = array.length;
if (isSorted) {
if (typeof isSorted == 'number') {
i = (isSorted < 0 ? Math.max(0, l + isSorted) : isSorted);
} else {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
for (; i < l; i++) if (array[i] === item) return i;
return -1;
};
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
_.lastIndexOf = function(array, item, from) {
if (array == null) return -1;
var hasIndex = from != null;
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
}
var i = (hasIndex ? from : array.length);
while (i--) if (array[i] === item) return i;
return -1;
};
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = arguments[2] || 1;
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
while(idx < len) {
range[idx++] = start;
start += step;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Reusable constructor function for prototype setting.
var ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
_.bind = function(func, context) {
var args, bound;
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
args = slice.call(arguments, 2);
return bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
ctor.prototype = func.prototype;
var self = new ctor;
ctor.prototype = null;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) return result;
return self;
};
};
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context.
_.partial = function(func) {
var args = slice.call(arguments, 1);
return function() {
return func.apply(this, args.concat(slice.call(arguments)));
};
};
// Bind all of an object's methods to that object. Useful for ensuring that
// all callbacks defined on an object belong to it.
_.bindAll = function(obj) {
var funcs = slice.call(arguments, 1);
if (funcs.length === 0) throw new Error("bindAll must be passed function names");
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memo = {};
hasher || (hasher = _.identity);
return function() {
var key = hasher.apply(this, arguments);
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
};
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){ return func.apply(null, args); }, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = function(func) {
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
_.throttle = function(func, wait, immediate) {
var context, args, timeout, result;
var previous = 0;
var later = function() {
previous = new Date;
timeout = null;
result = func.apply(context, args);
};
return function() {
var now = new Date;
if (!previous && immediate === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0) {
clearTimeout(timeout);
timeout = null;
previous = now;
result = func.apply(context, args);
} else if (!timeout) {
timeout = setTimeout(later, remaining);
}
return result;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
_.debounce = function(func, wait, immediate) {
var timeout, result;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) result = func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) result = func.apply(context, args);
return result;
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = function(func) {
var ran = false, memo;
return function() {
if (ran) return memo;
ran = true;
memo = func.apply(this, arguments);
func = null;
return memo;
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return function() {
var args = [func];
push.apply(args, arguments);
return wrapper.apply(this, args);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var funcs = arguments;
return function() {
var args = arguments;
for (var i = funcs.length - 1; i >= 0; i--) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
if (times <= 0) return func();
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = nativeKeys || function(obj) {
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys.push(key);
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
var values = [];
for (var key in obj) if (_.has(obj, key)) values.push(obj[key]);
return values;
};
// Convert an object into a list of `[key, value]` pairs.
_.pairs = function(obj) {
var pairs = [];
for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]);
return pairs;
};
// Invert the keys and values of an object. The values must be serializable.
_.invert = function(obj) {
var result = {};
for (var key in obj) if (_.has(obj, key)) result[obj[key]] = key;
return result;
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = function(obj) {
each(slice.call(arguments, 1), function(source) {
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
});
return obj;
};
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(obj) {
var copy = {};
var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
each(keys, function(key) {
if (key in obj) copy[key] = obj[key];
});
return copy;
};
// Return a copy of the object without the blacklisted properties.
_.omit = function(obj) {
var copy = {};
var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
for (var key in obj) {
if (!_.contains(keys, key)) copy[key] = obj[key];
}
return copy;
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
each(slice.call(arguments, 1), function(source) {
if (source) {
for (var prop in source) {
if (obj[prop] === void 0) obj[prop] = source[prop];
}
}
});
return obj;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] == a) return bStack[length] == b;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0, result = true;
// Recursively compare objects and arrays.
if (className == '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
_.isFunction(bCtor) && (bCtor instanceof bCtor))) {
return false;
}
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
};
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b, [], []);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (obj == null) return true;
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
for (var key in obj) if (_.has(obj, key)) return false;
return true;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType === 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) == '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
return obj === Object(obj);
};
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) == '[object ' + name + ']';
};
});
// Define a fallback version of the method in browsers (ahem, IE), where
// there isn't any inspectable "Arguments" type.
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return !!(obj && _.has(obj, 'callee'));
};
}
// Optimize `isFunction` if appropriate.
if (typeof (/./) !== 'function') {
_.isFunction = function(obj) {
return typeof obj === 'function';
};
}
// Is a given object a finite number?
_.isFinite = function(obj) {
return isFinite(obj) && !isNaN(parseFloat(obj));
};
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
return _.isNumber(obj) && obj != +obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Shortcut function for checking if an object has a given property directly
// on itself (in other words, not on a prototype).
_.has = function(obj, key) {
return hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iterators.
_.identity = function(value) {
return value;
};
// Run a function **n** times.
_.times = function(n, iterator, context) {
var accum = Array(Math.max(0, n));
for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
return accum;
};
// Return a random integer between min and max (inclusive).
_.random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
};
// List of HTML entities for escaping.
var entityMap = {
escape: {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/'
}
};
entityMap.unescape = _.invert(entityMap.escape);
// Regexes containing the keys and values listed immediately above.
var entityRegexes = {
escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
};
// Functions for escaping and unescaping strings to/from HTML interpolation.
_.each(['escape', 'unescape'], function(method) {
_[method] = function(string) {
if (string == null) return '';
return ('' + string).replace(entityRegexes[method], function(match) {
return entityMap[method][match];
});
};
});
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property) {
if (object == null) return void 0;
var value = object[property];
return _.isFunction(value) ? value.call(object) : value;
};
// Add your own custom functions to the Underscore object.
_.mixin = function(obj) {
each(_.functions(obj), function(name){
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
push.apply(args, arguments);
return result.call(this, func.apply(_, args));
};
});
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /(.)^/;
// Certain characters need to be escaped so that they can be put into a
// string literal.
var escapes = {
"'": "'",
'\\': '\\',
'\r': 'r',
'\n': 'n',
'\t': 't',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_.template = function(text, data, settings) {
var render;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
var matcher = new RegExp([
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source
].join('|') + '|$', 'g');
// Compile the template source, escaping string literals appropriately.
var index = 0;
var source = "__p+='";
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset)
.replace(escaper, function(match) { return '\\' + escapes[match]; });
if (escape) {
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
}
if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
}
if (evaluate) {
source += "';\n" + evaluate + "\n__p+='";
}
index = offset + match.length;
return match;
});
source += "';\n";
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + "return __p;\n";
try {
render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
if (data) return render(data, _);
var template = function(data) {
return render.call(this, data, _);
};
// Provide the compiled function source as a convenience for precompilation.
template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
return template;
};
// Add a "chain" function, which will delegate to the wrapper.
_.chain = function(obj) {
return _(obj).chain();
};
// OOP
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
// Helper function to continue chaining intermediate results.
var result = function(obj) {
return this._chain ? _(obj).chain() : obj;
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
var obj = this._wrapped;
method.apply(obj, arguments);
if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
return result.call(this, obj);
};
});
// Add all accessor Array functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
return result.call(this, method.apply(this._wrapped, arguments));
};
});
_.extend(_.prototype, {
// Start chaining a wrapped Underscore object.
chain: function() {
this._chain = true;
return this;
},
// Extracts the result from a wrapped and chained object.
value: function() {
return this._wrapped;
}
});
}).call(this);
/*!
The MIT License (MIT)
Copyright (c) 2013 Telerik AD
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.y distributed under the MIT license.
*/
/*!
Everlive SDK
Version 1.1.0
*/
/*global RSVP,reqwest,_*/
(function (ns) {
'use strict';
var slice = Array.prototype.slice;
var everliveUrl = "//api.everlive.com/v1/";
var idField = "Id";
function guardUnset(value, name, message) {
if (!message)
message = "The " + name + " is required";
if (typeof value === "undefined" || value === null)
throw new Error(message);
}
// An object that keeps information about an Everlive connecton
function Setup(options) {
this.url = everliveUrl;
this.apiKey = null;
this.masterKey = null;
this.token = null;
this.tokenType = null;
this.scheme = 'https'; // http or https
if (typeof options === "string")
this.apiKey = options;
else
_.extend(this, options);
}
// An array keeping initialization functions called by the Everlive constructor.
// These functions will be used to extend the functionality of an Everlive instance.
var initializations = [];
// The constructor of Everlive instances.
// The entry point for the SDK.
function Everlive(options) {
var self = this;
this.setup = new Setup(options);
_.each(initializations, function (init) {
init.func.call(self, options);
});
if (Everlive.$ === null)
Everlive.$ = self;
}
// A reference to the current Everlive instance
Everlive.$ = null;
Everlive.idField = idField;
Everlive.initializations = initializations;
// Creates a new Everlive instance and set it as the current one
Everlive.init = function (options) {
Everlive.$ = null;
return new Everlive(options);
};
Everlive.buildUrl = function (setup) {
var url = '';
if (typeof setup.scheme === "string")
url += setup.scheme + ":";
url += setup.url;
if (setup.apiKey)
url += setup.apiKey + "/";
return url;
};
Everlive.prototype.data = function (collectionName) {
return new Data(this.setup, collectionName);
};
Everlive.prototype.buildUrl = function () {
return Everlive.buildUrl(this.setup);
};
var buildAuthHeader = function (setup, options) {
var authHeaderValue = null;
if (options && options.authHeaders === false)
return authHeaderValue;
if (setup.token) {
authHeaderValue = (setup.tokenType || "bearer") + " " + setup.token;
}
else if (setup.masterKey) {
authHeaderValue = 'masterkey ' + setup.masterKey;
}
if (authHeaderValue)
return { "Authorization": authHeaderValue };
else
return null;
};
Everlive.prototype.buildAuthHeader = function () {
return buildAuthHeader(this.setup);
};
// Everlive queries
(function () {
var OperatorType = {
query: 1,
where: 100,
filter: 101,
and: 110,
or: 111,
not: 112,
equal: 120,
not_equal: 121,
lt: 122,
lte: 123,
gt: 124,
gte: 125,
isin: 126,
notin: 127,
all: 128,
size: 129,
regex: 130,
contains: 131,
startsWith: 132,
endsWith: 133,
nearShpere: 140,
withinBox: 141,
withinPolygon: 142,
withinShpere: 143,
select: 200,
exclude: 201,
order: 300,
order_desc: 301,
skip: 400,
take: 401
};
function Expression(operator, operands) {
this.operator = operator;
this.operands = operands || [];
}
Expression.prototype = {
addOperand: function (operand) {
this.operands.push(operand);
}
};
function Query(filter, fields, sort, skip, take) {
this.filter = filter;
this.fields = fields;
this.sort = sort;
this.toskip = skip;
this.totake = take;
this.expr = new Expression(OperatorType.query);
}
Query.prototype = {
where: function (filter) {
if (filter) {
return this._simple(OperatorType.filter, [filter]);
}
else {
return new WhereQuery(this);
}
},
select: function () {
return this._simple(OperatorType.select, arguments);
},
// TODO
//exclude: function () {
// return this._simple(OperatorType.exclude, arguments);
//},
order: function (field) {
return this._simple(OperatorType.order, [field]);
},
orderDesc: function (field) {
return this._simple(OperatorType.order_desc, [field]);
},
skip: function (value) {
return this._simple(OperatorType.skip, [value]);
},
take: function (value) {
return this._simple(OperatorType.take, [value]);
},
build: function () {
return new QueryBuilder(this).build();
},
_simple: function (op, oprs) {
var args = slice.call(oprs);
this.expr.addOperand(new Expression(op, args));
return this;
}
};
function WhereQuery(parentQuery, exprOp, singleOperand) {
this.parent = parentQuery;
this.single = singleOperand;
this.expr = new Expression(exprOp || OperatorType.where);
this.parent.expr.addOperand(this.expr);
}
WhereQuery.prototype = {
and: function () {
return new WhereQuery(this, OperatorType.and);
},
or: function () {
return new WhereQuery(this, OperatorType.or);
},
not: function () {
return new WhereQuery(this, OperatorType.not, true);
},
_simple: function (operator) {
var args = slice.call(arguments, 1);
this.expr.addOperand(new Expression(operator, args));
return this._done();
},
eq: function (field, value) {
return this._simple(OperatorType.equal, field, value);
},
ne: function (field, value) {
return this._simple(OperatorType.not_equal, field, value);
},
gt: function (field, value) {
return this._simple(OperatorType.gt, field, value);
},
gte: function (field, value) {
return this._simple(OperatorType.gte, field, value);
},
lt: function (field, value) {
return this._simple(OperatorType.lt, field, value);
},
lte: function (field, value) {
return this._simple(OperatorType.lte, field, value);
},
isin: function (field, value) {
return this._simple(OperatorType.isin, field, value);
},
notin: function (field, value) {
return this._simple(OperatorType.notin, field, value);
},
all: function (field, value) {
return this._simple(OperatorType.all, field, value);
},
size: function (field, value) {
return this._simple(OperatorType.size, field, value);
},
regex: function (field, value, flags) {
return this._simple(OperatorType.regex, field, value, flags);
},
startsWith: function (field, value, flags) {
return this._simple(OperatorType.startsWith, field, value, flags);
},
endsWith: function (field, value, flags) {
return this._simple(OperatorType.endsWith, field, value, flags);
},
nearSphere: function (field, point, distance, metrics) {
return this._simple(OperatorType.nearShpere, field, point, distance, metrics);
},
withinBox: function (field, pointBottomLeft, pointUpperRight) {
return this._simple(OperatorType.withinBox, field, pointBottomLeft, pointUpperRight);
},
withinPolygon: function (field, points) {
return this._simple(OperatorType.withinPolygon, field, points);
},
withinCenterSphere: function (field, center, radius, metrics) {
return this._simple(OperatorType.withinShpere, field, center, radius, metrics);
},
done: function () {
if (this.parent instanceof WhereQuery)
return this.parent._done();
else
return this.parent;
},
_done: function () {
if (this.single)
return this.parent;
else
return this;
}
};
WhereQuery.prototype.equal = WhereQuery.prototype.eq;
WhereQuery.prototype.notEqual = WhereQuery.prototype.ne;
WhereQuery.prototype.greaterThan = WhereQuery.prototype.gt;
WhereQuery.prototype.greaterThanEqual = WhereQuery.prototype.gte;
WhereQuery.prototype.lessThan = WhereQuery.prototype.lt;
WhereQuery.prototype.lessThanEqual = WhereQuery.prototype.lte;
function QueryBuilder(query) {
this.query = query;
this.expr = query.expr;
}
var maxDistanceConsts = { 'radians': '$maxDistance', 'km': '$maxDistanceInKilometers', 'miles': '$maxDistanceInMiles' };
var radiusConsts = { 'radians': 'radius', 'km': 'radiusInKilometers', 'miles': 'radiusInMiles' };
QueryBuilder.prototype = {
// TODO merge the two objects before returning them
build: function () {
var query = this.query;
if (query.filter || query.fields || query.sort || query.toskip || query.totake)
return {
$where: query.filter || null,
$select: query.fields || null,
$sort: query.sort || null,
$skip: query.toskip || null,
$take: query.totake || null
};
return {
$where: this._buildWhere(),
$select: this._buildSelect(),
$sort: this._buildSort(),
$skip: this._getSkip(),
$take: this._getTake()
};
},
_getSkip: function () {
var skipExpression = _.find(this.expr.operands, function (value, index, list) {
return value.operator === OperatorType.skip;
});
return skipExpression ? skipExpression.operands[0] : null;
},
_getTake: function () {
var takeExpression = _.find(this.expr.operands, function (value, index, list) {
return value.operator === OperatorType.take;
});
return takeExpression ? takeExpression.operands[0] : null;
},
_buildSelect: function () {
var selectExpression = _.find(this.expr.operands, function (value, index, list) {
return value.operator === OperatorType.select;
});
var result = {};
if (selectExpression) {
_.reduce(selectExpression.operands, function (memo, value) {
memo[value] = 1;
return memo;
}, result);
return result;
}
else {
return null;
}
},
_buildSort: function () {
var sortExpressions = _.filter(this.expr.operands, function (value, index, list) {
return value.operator === OperatorType.order || value.operator === OperatorType.order_desc;
});
var result = {};
if (sortExpressions.length > 0) {
_.reduce(sortExpressions, function (memo, value) {
memo[value.operands[0]] = value.operator === OperatorType.order ? 1 : -1;
return memo;
}, result);
return result;
}
else {
return null;
}
},
_buildWhere: function () {
var whereExpression = _.find(this.expr.operands, function (value, index, list) {
return value.operator === OperatorType.where;
});
if (whereExpression) {
return this._build(new Expression(OperatorType.and, whereExpression.operands));
}
else {
var filterExpression = _.find(this.expr.operands, function (value, index, list) {
return value.operator === OperatorType.filter;
});
if (filterExpression) {
return filterExpression.operands[0];
}
return null;
}
},
_build: function (expr) {
if (this._isSimple(expr)) {
return this._simple(expr);
}
else if (this._isRegex(expr)) {
return this._regex(expr);
}
else if (this._isGeo(expr)) {
return this._geo(expr);
}
else if (this._isAnd(expr)) {
return this._and(expr);
}
else if (this._isOr(expr)) {
return this._or(expr);
}
else if (this._isNot(expr)) {
return this._not(expr);
}
},
_isSimple: function (expr) {
return expr.operator >= OperatorType.equal && expr.operator <= OperatorType.size;
},
_simple: function (expr) {
var term = {}, fieldTerm = {};
var operands = expr.operands;
var operator = this._translateoperator(expr.operator);
if (operator) {
term[operator] = operands[1];
}
else {
term = operands[1];
}
fieldTerm[operands[0]] = term;
return fieldTerm;
},
_isRegex: function (expr) {
return expr.operator >= OperatorType.regex && expr.operator <= OperatorType.endsWith;
},
_regex: function (expr) {
var fieldTerm = {};
var regex = this._getRegex(expr);
var regexValue = this._getRegexValue(regex);
var operands = expr.operands;
fieldTerm[operands[0]] = regexValue;
return fieldTerm;
},
_getRegex: function (expr) {
var pattern = expr.operands[1];
var flags = expr.operands[2] ? expr.operands[2] : '';
switch (expr.operator) {
case OperatorType.regex:
return pattern instanceof RegExp ? pattern : new RegExp(pattern, flags);
case OperatorType.startsWith:
return new RegExp(pattern + ".*", flags);
case OperatorType.endsWith:
return new RegExp(".*" + pattern, flags);
default:
throw new Error("Unknown operator type.");
}
},
_getRegexValue: function (regex) {
var options = '';
if (regex.global)
options += 'g';
if (regex.multiline)
options += 'm';
if (regex.ignoreCase)
options += 'i';
return { $regex: regex.source, $options: options };
},
_isGeo: function (expr) {
return expr.operator >= OperatorType.nearShpere && expr.operator <= OperatorType.withinShpere;
},
_geo: function (expr) {
var fieldTerm = {};
var operands = expr.operands;
fieldTerm[operands[0]] = this._getGeoTerm(expr);
return fieldTerm;
},
_getGeoTerm: function (expr) {
switch (expr.operator) {
case OperatorType.nearShpere:
return this._getNearSphereTerm(expr);
case OperatorType.withinBox:
return this._getWithinBox(expr);
case OperatorType.withinPolygon:
return this._getWithinPolygon(expr);
case OperatorType.withinShpere:
return this._getWithinCenterSphere(expr);
default:
throw new Error("Unknown operator type.");
}
},
_getNearSphereTerm: function (expr) {
var operands = expr.operands;
var center = this._getGeoPoint(operands[1]);
var maxDistance = operands[2];
var metrics = operands[3];
var maxDistanceConst;
var term = {
'$nearSphere': center
};
if (typeof maxDistance !== 'undefined') {
maxDistanceConst = maxDistanceConsts[metrics] || maxDistanceConsts.radians;
term[maxDistanceConst] = maxDistance;
}
return term;
},
_getWithinBox: function (expr) {
var operands = expr.operands;
var bottomLeft = this._getGeoPoint(operands[1]);
var upperRight = this._getGeoPoint(operands[2]);
return {
'$within': {
'$box': [bottomLeft, upperRight]
}
};
},
_getWithinPolygon: function (expr) {
var operands = expr.operands;
var points = this._getGeoPoints(operands[1]);
return {
'$within': {
'$polygon': points
}
};
},
_getWithinCenterSphere: function (expr) {
var operands = expr.operands;
var center = this._getGeoPoint(operands[1]);
var radius = operands[2];
var metrics = operands[3];
var radiusConst = radiusConsts[metrics] || radiusConsts.radians;
var sphereInfo = {
'center': center
};
sphereInfo[radiusConst] = radius;
return {
'$within': {
'$centerSphere': sphereInfo
}
};
},
_getGeoPoint: function (point) {
if (_.isArray(point))
return new GeoPoint(point[0], point[1]);
return point;
},
_getGeoPoints: function (points) {
var self = this;
return _.map(points, function (point) {
return self._getGeoPoint(point);
});
},
_isAnd: function (expr) {
return expr.operator === OperatorType.and;
},
_and: function (expr) {
var i, l, term, result = {};
var operands = expr.operands;
for (i = 0, l = operands.length; i < l; i++) {
term = this._build(operands[i]);
result = this._andAppend(result, term);
}
return result;
},
_andAppend: function (andObj, newObj) {
var i, l, key, value, newValue;
var keys = _.keys(newObj);
for (i = 0, l = keys.length; i < l; i++) {
key = keys[i];
value = andObj[key];
if (typeof value === 'undefined') {
andObj[key] = newObj[key];
}
else {
newValue = newObj[key];
if (typeof value === "object" && typeof newValue === "object")
value = _.extend(value, newValue);
else
value = newValue;
andObj[key] = value;
}
}
return andObj;
},
_isOr: function (expr) {
return expr.operator === OperatorType.or;
},
_or: function (expr) {
var i, l, term, result = [];
var operands = expr.operands;
for (i = 0, l = operands.length; i < l; i++) {
term = this._build(operands[i]);
result.push(term);
}
return { $or: result };
},
_isNot: function (expr) {
return expr.operator === OperatorType.not;
},
_not: function (expr) {
return { $not: this._build(expr.operands[0]) };
},
_translateoperator: function (operator) {
switch (operator) {
case OperatorType.equal:
return null;
case OperatorType.not_equal:
return "$ne";
case OperatorType.gt:
return "$gt";
case OperatorType.lt:
return "$lt";
case OperatorType.gte:
return "$gte";
case OperatorType.lte:
return "$lte";
case OperatorType.isin:
return "$in";
case OperatorType.notin:
return "$nin";
case OperatorType.all:
return "$all";
case OperatorType.size:
return "$size";
}
throw new Error("Unknown operator type.");
}
};
Everlive.Query = Query;
Everlive.QueryBuilder = QueryBuilder;
}());
// Everlive requests
var Request = (function () {
// The headers used by the Everlive services
var Headers = {
filter: "X-Everlive-Filter",
select: "X-Everlive-Fields",
sort: "X-Everlive-Sort",
skip: "X-Everlive-Skip",
take: "X-Everlive-Take"
};
// The Request type is an abstraction over Ajax libraries
// A Request object needs information about the Everlive connection and initialization options
function Request(setup, options) {
guardUnset(setup, "setup");
guardUnset(options, "options");
this.setup = setup;
this.method = null;
this.endpoint = null;
this.data = null;
this.headers = {};
// TODO success and error callbacks should be uniformed for all ajax libs
this.success = null;
this.error = null;
this.parse = Request.parsers.simple;
_.extend(this, options);
this._init(options);
}
Request.prototype = {
// Calls the underlying Ajax library
send: function () {
Everlive.sendRequest(this);
},
// Returns an authorization header used by the request.
// If there is a logged in user for the Everlive instance then her/his authentication will be used.
buildAuthHeader: buildAuthHeader,
// Builds the URL of the target Everlive service
buildUrl: function buildUrl(setup) {
return Everlive.buildUrl(setup);
},
// Processes the given query to return appropriate headers to be used by the request
buildQueryHeaders: function buildQueryHeaders(query) {
if (query) {
if (query instanceof Everlive.Query) {
return Request.prototype._buildQueryHeaders(query);
}
else {
return Request.prototype._buildFilterHeader(query);
}
}
else {
return {};
}
},
// Initialize the Request object by using the passed options
_init: function (options) {
_.extend(this.headers, this.buildAuthHeader(this.setup, options), this.buildQueryHeaders(options.filter), options.headers);
},
// Translates an Everlive.Query to request headers
_buildQueryHeaders: function (query) {
query = query.build();
var headers = {};
if (query.$where !== null) {
headers[Headers.filter] = JSON.stringify(query.$where);
}
if (query.$select !== null) {
headers[Headers.select] = JSON.stringify(query.$select);
}
if (query.$sort !== null) {
headers[Headers.sort] = JSON.stringify(query.$sort);
}
if (query.$skip !== null) {
headers[Headers.skip] = query.$skip;
}
if (query.$take !== null) {
headers[Headers.take] = query.$take;
}
return headers;
},
// Creates a header from a simple filter
_buildFilterHeader: function (filter) {
var headers = {};
headers[Headers.filter] = JSON.stringify(filter);
return headers;
}
};
// Exposes the Request constructor
Everlive.Request = Request;
// A utility method for creating requests for the current Everlive instance
Everlive.prototype.request = function (attrs) {
return new Request(this.setup, attrs);
};
function parseResult(data) {
if (typeof data === "string" && data.length > 0) {
data = JSON.parse(data);
}
if (data) {
return { result: data.Result, count: data.Count };
}
else {
return data;
}
}
function parseError(error) {
if (typeof error === "string" && error.length > 0) {
try {
error = JSON.parse(error);
return { message: error.message, code: error.errorCode };
}
catch (e) {
return error;
}
}
else {
return error;
}
}
function parseSingleResult(data) {
if (typeof data === "string" && data.length > 0) {
data = JSON.parse(data);
}
if (data) {
return { result: data.Result };
}
else {
return data;
}
}
Request.parsers = {
simple: {
result: parseResult,
error: parseError
},
single: {
result: parseSingleResult,
error: parseError
}
};
Everlive.disableRequestCache = function (url, method) {
if (method === 'GET') {
var timestamp = (new Date()).getTime();
var separator = url.indexOf('?') > -1 ? '&' : '?';
url += separator + '_el=' + timestamp;
}
return url;
};
// TODO built for reqwest
if (typeof Everlive.sendRequest === "undefined") {
Everlive.sendRequest = function (request) {
var url = request.buildUrl(request.setup) + request.endpoint;
url = Everlive.disableRequestCache(url, request.method);
var data = request.method === 'GET' ? request.data : JSON.stringify(request.data);
//$.ajax(url, {
reqwest({
url: url,
method: request.method,
data: data,
headers: request.headers,
type: "json",
contentType: 'application/json',
crossOrigin: true,
//processData: request.method === "GET",
success: function (data, textStatus, jqXHR) {
request.success.call(request, request.parse.result(data));
},
error: function (jqXHR, textStatus, errorThrown) {
request.error.call(request, request.parse.error(jqXHR.responseText));
}
});
};
}
return Request;
}());
// rsvp promises
Everlive.getCallbacks = function (success, error) {
var promise;
if (typeof success !== "function" && typeof error !== "function") {
//promise = new RSVP.Promise();
//success = function (data) {
// promise.resolve(data);
//};
//error = function (error) {
// promise.reject(error);
//};
promise = new RSVP.Promise(function (resolve, reject) {
success = function (data) {
resolve(data);
};
error = function (error) {
reject(error);
};
});
}
return { promise: promise, success: success, error: error };
};
// whenjs promises
//Everlive.getCallbacks = function (success, error) {
// var promise;
// if (typeof success !== "function" && typeof error !== "function") {
// promise = when.defer();
// success = function (data) {
// promise.resolve(data);
// };
// error = function (error) {
// promise.reject(error);
// };
// }
// return { promise: promise.promise, success: success, error: error };
//};
function buildPromise(operation, success, error) {
var callbacks = Everlive.getCallbacks(success, error);
operation(callbacks.success, callbacks.error);
return callbacks.promise;
}
function Data(setup, collectionName) {
this.setup = setup;
this.collectionName = collectionName;
this.options = null;
}
// Everlive base CRUD functions
Data.prototype = {
withHeaders: function (headers) {
var options = this.options || {};
options.headers = _.extend(options.headers || {}, headers);
this.options = options;
return this;
},
_createRequest: function (options) {
_.extend(options, this.options);
this.options = null;
return new Request(this.setup, options);
},
// TODO implement options: { requestSettings: { executeServerCode: false } }. power fields queries could be added to that options argument
get: function (filter, success, error) {
var self = this;
return buildPromise(function (success, error) {
var request = self._createRequest({
method: "GET",
endpoint: self.collectionName,
filter: filter,
success: success,
error: error
});
request.send();
}, success, error);
},
// TODO handle options
// TODO think to pass the id as a filter
getById: function (id, success, error) {
var self = this;
return buildPromise(function (success, error) {
var request = self._createRequest({
method: "GET",
endpoint: self.collectionName + "/" + id,
parse: Request.parsers.single,
success: success,
error: error
});
request.send();
}, success, error);
},
count: function (filter, success, error) {
var self = this;
return buildPromise(function (success, error) {
var request = self._createRequest({
method: "GET",
endpoint: self.collectionName + "/_count",
filter: filter,
parse: Request.parsers.single,
success: success,
error: error
});
request.send();
}, success, error);
},
create: function (data, success, error) {
var self = this;
return buildPromise(function (success, error) {
var request = self._createRequest({
method: "POST",
endpoint: self.collectionName,
data: data,
parse: Request.parsers.single,
success: success,
error: error
});
request.send();
}, success, error);
},
rawUpdate: function (attrs, filter, success, error) {
var self = this;
return buildPromise(function (success, error) {
var endpoint = self.collectionName;
var ofilter = null; // request options filter
if (typeof filter === "string") // if filter is string than will update a single item using the filter as an identifier
endpoint += "/" + filter;
else if (typeof filter === "object") // else if it is an object than we will use it as a query filter
ofilter = filter;
var request = self._createRequest({
method: "PUT",
endpoint: endpoint,
data: attrs,
filter: ofilter,
success: success,
error: error
});
request.send();
}, success, error);
},
_update: function (attrs, filter, single, replace, success, error) {
var self = this;
return buildPromise(function (success, error) {
var endpoint = self.collectionName;
if (single)
endpoint += "/" + attrs[idField];
var data = {};
data[replace ? "$replace" : "$set"] = attrs;
var request = self._createRequest({
method: "PUT",
endpoint: endpoint,
data: data,
filter: filter,
success: success,
error: error
});
request.send();
}, success, error);
},
updateSingle: function (model, success, error) {
return this._update(model, null, true, false, success, error);
},
update: function (model, filter, success, error) {
return this._update(model, filter, false, false, success, error);
},
replaceSingle: function (model, success, error) {
return this._update(model, null, true, true, success, error);
},
_destroy: function (attrs, filter, single, success, error) {
var self = this;
return buildPromise(function (success, error) {
var endpoint = self.collectionName;
if (single)
endpoint += "/" + attrs[idField];
var request = self._createRequest({
method: "DELETE",
endpoint: endpoint,
filter: filter,
success: success,
error: error
});
request.send();
}, success, error);
},
destroySingle: function (model, success, error) {
return this._destroy(model, null, true, success, error);
},
destroy: function (filter, success, error) {
return this._destroy(null, filter, false, success, error);
}
};
//TODO add a function for calculating the distances in geospatial queries
function GeoPoint(longitude, latitude) {
this.longitude = longitude || 0;
this.latitude = latitude || 0;
}
Everlive.GeoPoint = GeoPoint;
var addUsersFunctions = function (ns) {
ns._loginSuccess = function (data) {
var result = data.result;
var setup = this.setup;
setup.token = result.access_token;
setup.tokenType = result.token_type;
};
ns._logoutSuccess = function () {
var setup = this.setup;
setup.token = null;
setup.tokenType = null;
};
ns.register = function (username, password, attrs, success, error) {
guardUnset(username, "username");
guardUnset(password, "password");
var user = {
Username: username,
Password: password
};
_.extend(user, attrs);
return this.create(user, success, error);
};
ns.login = function (username, password, success, error) {
var self = this;
return buildPromise(function (success, error) {
var request = new Request(self.setup, {
method: "POST",
endpoint: "oauth/token",
data: {
username: username,
password: password,
grant_type: "password"
},
authHeaders: false,
parse: Request.parsers.single,
success: function () {
self._loginSuccess.apply(self, arguments);
success.apply(null, arguments);
},
error: error
});
request.send();
}, success, error);
};
ns.currentUser = function (success, error) {
return this.getById("me", success, error);
};
ns.changePassword = function (username, password, newPassword, keepTokens, success, error) {
var self = this;
return buildPromise(function (success, error) {
var endpoint = "Users/changepassword";
if (keepTokens)
endpoint += "?keepTokens=true";
var request = new Request(self.setup, {
method: "POST",
endpoint: endpoint,
data: {
Username: username,
Password: password,
NewPassword: newPassword
},
authHeaders: false,
parse: Request.parsers.single,
success: success,
error: error
});
request.send();
}, success, error);
};
ns.logout = function (success, error) {
var self = this;
return buildPromise(function (success, error) {
var request = new Request(self.setup, {
method: "GET",
endpoint: "oauth/logout",
success: function () {
self._logoutSuccess.apply(self, arguments);
success.apply(null, arguments);
},
error: error
});
request.send();
}, success, error);
};
ns._loginWithProvider = function (providerName, accessToken, success, error) {
var user = {
Identity: {
Provider: providerName,
Token: accessToken
}
};
var self = this;
return buildPromise(function (success, error) {
var request = new Request(self.setup, {
method: 'POST',
endpoint: 'Users',
data: user,
authHeaders: false,
parse: Request.parsers.single,
success: function () {
self._loginSuccess.apply(self, arguments);
success.apply(null, arguments);
},
error: error
});
request.send();
}, success, error);
};
ns._linkWithProvider = function (providerName, userId, accessToken, success, error) {
var identity = {
Provider: providerName,
Token: accessToken
};
var self = this;
return buildPromise(function (success, error) {
var request = new Request(self.setup, {
method: 'POST',
endpoint: 'Users/' + userId + '/link',
data: identity,
parse: Request.parsers.single,
success: success,
error: error
});
request.send();
}, success, error);
};
ns._unlinkFromProvider = function (providerName, userId, success, error) {
var identity = {
Provider: providerName
};
var self = this;
return buildPromise(function (success, error) {
var request = new Request(self.setup, {
method: 'POST',
endpoint: 'Users/' + userId + '/unlink',
data: identity,
parse: Request.parsers.single,
success: success,
error: error
});
request.send();
}, success, error);
};
ns.loginWithFacebook = function (accessToken, success, error) {
return ns._loginWithProvider('Facebook', accessToken, success, error);
};
ns.linkWithFacebook = function (userId, accessToken, success, error) {
return ns._linkWithProvider('Facebook', userId, accessToken, success, error);
};
ns.unlinkFromFacebook = function (userId, success, error) {
return ns._unlinkFromProvider('Facebook', userId, success, error);
};
ns.loginWithLiveID = function (accessToken, success, error) {
return ns._loginWithProvider('LiveID', accessToken, success, error);
};
ns.linkWithLiveID = function (userId, accessToken, success, error) {
return ns._linkWithProvider('LiveID', userId, accessToken, success, error);
};
ns.unlinkFromLiveID = function (userId, success, error) {
return ns._unlinkFromProvider('LiveID', userId, success, error);
};
ns.loginWithGoogle = function (accessToken, success, error) {
return ns._loginWithProvider('Google', accessToken, success, error);
}
ns.linkWithGoogle = function (accessToken, success, error) {
return ns._linkWithProvider('Google', userId, accessToken, success, error);
}
ns.unlinkFromGoogle = function (userId, success, error) {
return ns._unlinkFromProvider('Google', userId, success, error);
}
};
var addFilesFunctions = function (ns) {
ns.getUploadUrl = function () {
return Everlive.buildUrl(this.setup) + this.collectionName;
};
ns.getDownloadUrl = function (fileId) {
return Everlive.buildUrl(this.setup) + this.collectionName + '/' + fileId + '/Download';
};
ns._getUpdateUrl = function (fileId) {
return this.collectionName + '/' + fileId + '/Content';
};
ns.getUpdateUrl = function (fileId) {
return Everlive.buildUrl(this.setup) + this._getUpdateUrl(fileId);
};
ns.updateContent = function (fileId, file, success, error) {
var self = this;
return buildPromise(function (success, error) {
var endpoint = self._getUpdateUrl(fileId);
// the passed file content is base64 encoded
var request = self._createRequest({
method: "PUT",
endpoint: endpoint,
data: file,
success: success,
error: error
});
request.send();
}, success, error);
};
};
//#region Push
//Constants for different platforms in Everlive
var Platform = {
WindowsPhone: 1,
Windows8: 2,
Android: 3,
iOS: 4,
OSX: 5,
Blackberry: 6,
Nokia: 7,
Unknown: 100
};
//Global event handlers for push notification events. Required by the cordova PushNotifications plugin that we use.
Everlive.PushCallbacks = {};
var Push = function (el) {
this._el = el;
this._currentDevice;
this.notifications = el.data('Push/Notifications');
this.devices = el.data('Push/Devices');
};
Push.prototype = {
currentDevice: function (emulatorMode) {
if (!window.cordova) {
throw new Error("Error: currentDevice() can only be called from within a hybrid mobile app, after 'deviceready' event has been fired.");
}
if (!this._currentDevice) {
this._currentDevice = new CurrentDevice(this);
this._currentDevice.emulatorMode = emulatorMode;
}
return this._currentDevice;
}
};
var PushSettings = {
iOS: {
badge: true,
sound: true,
alert: true
},
android: {
senderID: null
},
notificationCallbackAndroid: null,
notificationCallbackIOS: null
};
var CurrentDevice = function (pushHandler) {
this._pushHandler = pushHandler;
this._initSuccessCallback = null;
this._initErrorCallback = null;
//Suffix for the global callback functions
this._globalFunctionSuffix = null;
this.pushSettings = null;
this.pushToken = null;
this.isInitialized = false;
this.isInitializing = false;
this.emulatorMode = false;
};
CurrentDevice.prototype = {
/**
* Initializes the current device for push notifications. This method requests a push token
* from the device vendor and enables the push notification functionality on the device.
* Once this is done, you can register the device in Everlive using the register() method.
*
* @param {PushSettings} pushSettings
* An object specifying various settings for the initialization.
* @param {Function} success
* Callback to invoke on success.
* @param {Function} error
* Callback to invoke on error.
* @returns {Object}
* A promise for the operation, or void if success/error are supplied.
*/
enableNotifications: function (pushSettings, success, error) {
this.pushSettings = pushSettings;
return buildPromise(_.bind(this._initialize, this), success, error);
},
/**
* Disables push notifications for the current device. This method invalidates any push tokens
* that were obtained for the device from the current application.
*
* @param {Function} success
* Callback to invoke on success.
* @param {Function} error
* Callback to invoke on error.
* @returns {Object}
* A promise for the operation, or void if success/error are supplied.
*/
disableNotifications: function (success, error) {
var self = this;
return this.unregister().then(
function () {
return buildPromise(
function (success, error) {
if (self.emulatorMode) {
success();
} else {
var pushNotification = window.plugins.pushNotification;
pushNotification.unregister(
function () {
self.isInitialized = false;
success();
},
error
);
}
},
success,
error
);
},
error
);
},
/**
* Returns the push registration for the current device.
*
* @param {Function} success
* Callback to invoke on success.
* @param {Function} error
* Callback to invoke on error.
* @returns {Object}
* A promise for the operation, or void if success/error are supplied.
*/
getRegistration: function (success, error) {
var deviceId = this._getDeviceId();
return this._pushHandler.devices.getById('HardwareId/' + deviceId, success, error);
},
/**
* Registers the current device for push notifications in Everlive. This method can be called
* only after enableNotifications() has completed successfully.
*
* @param {Object} customParameters
* Custom parameters for the registration.
* @param {Function} success
* Callback to invoke on success.
* @param {Function} error
* Callback to invoke on error.
* @returns {Object}
* A promise for the operation, or void if success/error are supplied.
*/
register: function (customParameters, success, error) {
var self = this;
var deviceRegistration = {};
if (customParameters !== undefined) {
deviceRegistration.Parameters = customParameters;
}
return this._populateRegistrationObject(deviceRegistration).then(
function () {
return self._pushHandler.devices.create(deviceRegistration, success, error);
},
error
);
},
/**
* Unregisters the current device from push notifications in Everlive. After this call completes
* successfully, Everlive will no longer send notifications to this device. Note that this does
* not prevent the device from receiving notifications and does not imvalidate push tokens.
*
* @param {Function} success
* Callback to invoke on success.
* @param {Function} error
* Callback to invoke on error.
* @returns {Object}
* A promise for the operation, or void if success/error are supplied.
*/
unregister: function (success, error) {
var deviceId = device.uuid;
return this._pushHandler.devices.destroySingle({ Id: 'HardwareId/' + deviceId }, success, error);
},
/**
* Updates the registration for the current device.
*
* @param {Object} customParameters
* Custom parameters for the registration. If undefined, customParameters are not updated.
* @param {Function} success
* Callback to invoke on success.
* @param {Function} error
* Callback to invoke on error.
* @returns {Object}
* A promise for the operation, or void if success/error are supplied.
*/
updateRegistration: function (customParameters, success, error) {
var self = this;
var deviceRegistration = {};
if (customParameters !== undefined) {
deviceRegistration.Parameters = customParameters;
}
return this._populateRegistrationObject(deviceRegistration).then(
function () {
deviceRegistration.Id = 'HardwareId/' + deviceRegistration.HardwareId
return self._pushHandler.devices.updateSingle(deviceRegistration, success, error);
},
error
);
},
//Initializes the push functionality on the device.
_initialize: function (success, error) {
var self = this;
if (this.isInitializing) {
error(new Error('Push notifications are currently initializing.'));
return;
}
if (!this.emulatorMode && (!window.plugins || !window.plugins.pushNotification)) {
error(new Error('The push notifications plugin is not initialized.'));
return;
}
this._initSuccessCallback = success;
this._initErrorCallback = error;
if (this.isInitialized) {
this._deviceRegistrationSuccess(this.pushToken);
return;
}
if (this.emulatorMode) {
setTimeout(
function () {
self._deviceRegistrationSuccess("fake_push_token");
},
1000
);
return;
}
this.isInitializing = true;
var suffix = this._globalFunctionSuffix;
if (!suffix) {
suffix = Date.now().toString();
this._globalFunctionSuffix = suffix;
}
var pushNotification = window.plugins.pushNotification;
var platformType = this._getPlatformType(device.platform);
if (platformType == Platform.iOS) {
//Initialize global APN callback
var apnCallbackName = "apnCallback_" + suffix;
Everlive.PushCallbacks[apnCallbackName] = _.bind(this._onNotificationAPN, this);
//Construct registration options object and validate iOS settings
var apnRegistrationOptions = this.pushSettings.iOS;
this._validateIOSSettings(apnRegistrationOptions);
apnRegistrationOptions["ecb"] = "Everlive.PushCallbacks." + apnCallbackName;
//Register for APN
pushNotification.register(
_.bind(this._successfulRegistrationAPN, this),
_.bind(this._failedRegistrationAPN, this),
apnRegistrationOptions
);
} else if (platformType == Platform.Android) {
//Initialize global GCM callback
var gcmCallbackName = "gcmCallback_" + suffix;
Everlive.PushCallbacks[gcmCallbackName] = _.bind(this._onNotificationGCM, this);
//Construct registration options object and validate the Android settings
var gcmRegistrationOptions = this.pushSettings.android;
this._validateAndroidSettings(gcmRegistrationOptions);
gcmRegistrationOptions["ecb"] = "Everlive.PushCallbacks." + gcmCallbackName;
//Register for GCM
pushNotification.register(
_.bind(this._successSentRegistrationGCM, this),
_.bind(this._errorSentRegistrationGCM, this),
gcmRegistrationOptions
);
} else {
throw new Error("The current platform is not supported: " + device.platform);
}
},
_validateAndroidSettings: function (androidSettings) {
if (!androidSettings.senderID) {
throw new Error("Sender ID (project number) is not set in the android settings.");
}
},
_validateIOSSettings: function (iOSSettings) {
},
_populateRegistrationObject: function (deviceRegistration, success, error) {
var self = this;
return buildPromise(
function (success, error) {
if (!self.pushToken) {
throw new Error("Push token is not available.");
}
self._getLocaleName(
function (locale) {
var deviceId = self._getDeviceId();
var hardwareModel = device.name;
var platformType = self._getPlatformType(device.platform);
var timeZoneOffset = -(new Date().getTimezoneOffset());
var pushToken = self.pushToken;
var language = locale.value;
var platformVersion = device.version;
deviceRegistration.HardwareId = deviceId;
deviceRegistration.HardwareModel = hardwareModel;
deviceRegistration.PlatformType = platformType;
deviceRegistration.PlatformVersion = platformVersion;
deviceRegistration.TimeZoneOffset = timeZoneOffset;
deviceRegistration.PushToken = pushToken;
deviceRegistration.Locale = language;
success();
},
error
);
},
success,
error
);
},
_getLocaleName: function (success, error) {
if (this.emulatorMode) {
success({ value: "en_US" });
} else {
navigator.globalization.getLocaleName(
function (locale) {
success(locale);
},
error
);
navigator.globalization.getLocaleName(
function (locale) {
},
error
);
}
},
_getDeviceId: function () {
return device.uuid;
},
//Returns the Everlive device platform constant given a value aquired from cordova's device.platform.
_getPlatformType: function (platformString) {
var psLower = platformString.toLowerCase();
switch (psLower) {
case "ios":
case "iphone":
case "ipad":
return Platform.iOS;
case "android":
return Platform.Android;
case "wince":
return Platform.WindowsPhone;
default:
return Platform.Unknown;
}
},
_deviceRegistrationFailed: function (error) {
this.pushToken = null;
this.isInitializing = false;
this.isInitialized = false;
if (this._initErrorCallback) {
this._initErrorCallback({ error: error });
}
},
_deviceRegistrationSuccess: function (token) {
this.pushToken = token;
this.isInitializing = false;
this.isInitialized = true;
if (this._initSuccessCallback) {
this._initSuccessCallback({ token: token });
}
},
//Occurs when the device registration in APN succeeds
_successfulRegistrationAPN: function (token) {
this._deviceRegistrationSuccess(token);
},
//Occurs if the device registration in APN fails
_failedRegistrationAPN: function (error) {
this._deviceRegistrationFailed(error);
},
//Occurs when device registration has been successfully sent to GCM
_successSentRegistrationGCM: function (id) {
//console.log("Successfully sent request for registering with GCM.");
},
//Occurs when an error occured when sending registration request to GCM
_errorSentRegistrationGCM: function (error) {
this._deviceRegistrationFailed(error);
},
//This function receives all notification events from APN
_onNotificationAPN: function (e) {
this._raiseNotificationEventIOS(e);
},
//This function receives all notification events from GCM
_onNotificationGCM: function onNotificationGCM(e) {
switch (e.event) {
case 'registered':
if (e.regid.length > 0) {
this._deviceRegistrationSuccess(e.regid);
}
break;
case 'message':
this._raiseNotificationEventAndroid(e);
break;
case 'error':
if (!this.pushToken) {
this._deviceRegistrationFailed(e);
} else {
this._raiseNotificationEventAndroid(e);
}
break;
default:
this._raiseNotificationEventAndroid(e);
break;
}
},
_raiseNotificationEventAndroid: function (e) {
if (this.pushSettings.notificationCallbackAndroid) {
this.pushSettings.notificationCallbackAndroid(e);
}
},
_raiseNotificationEventIOS: function (e) {
if (this.pushSettings.notificationCallbackIOS) {
this.pushSettings.notificationCallbackIOS(e);
}
}
};
//#endregion
var initDefault = function () {
this.Users = this.data('Users');
addUsersFunctions(this.Users);
this.Files = this.data('Files');
addFilesFunctions(this.Files);
this.push = new Push(this);
};
initializations.push({ name: "default", func: initDefault });
ns.Everlive = Everlive;
}(this));
(function ($, undefined) {
var kendo = window.kendo,
extend = $.extend;
if (kendo === undefined)
return;
extend(true, kendo.data, {
schemas: {
everlive: {
type: "json",
data: function (data) {
return data.Result || data;
},
total: "Count"
}
},
transports: {
everlive: {
read: {
dataType: "json",
type: "GET",
cache: false
},
update: {
dataType: "json",
contentType: "application/json",
type: "PUT",
cache: false
},
create: {
dataType: "json",
contentType: "application/json",
type: "POST",
cache: false
},
destroy: {
dataType: "json",
type: "DELETE",
cache: false
},
parameterMap: function (data, operation) {
if (operation === "destroy") {
return {};
}
if (operation === "create" || operation === "update") {
return JSON.stringify(data);
}
if (operation === "read") {
return null;
}
}
}
}
});
function translateKendoQuery(data) {
var result = {};
if (data) {
if (data.skip) {
result.$skip = data.skip;
delete data.skip;
}
if (data.take) {
result.$take = data.take;
delete data.take;
}
if (data.sort) {
var sortExpressions = data.sort;
var sort = {}
if (!$.isArray(sortExpressions)) {
sortExpressions = [sortExpressions];
}
$.each(sortExpressions, function (idx, value) {
sort[value.field] = value.dir === 'asc' ? 1 : -1;
});
result.$sort = sort;
delete data.sort;
}
if (data.filter) {
var filter = new FilterBuilder().build(data.filter);
result.$where = filter;
delete data.filter;
}
}
return result;
}
var regexOperations = ['startsWith', 'endsWith', 'contains'];
function FilterBuilder() {
}
FilterBuilder.prototype = {
build: function (filter) {
return this._build(filter);
},
_build: function (filter) {
if (this._isRaw(filter)) {
return this._raw(filter);
}
else if (this._isSimple(filter)) {
return this._simple(filter);
}
else if (this._isRegex(filter)) {
return this._regex(filter);
}
else if (this._isAnd(filter)) {
return this._and(filter);
}
else if (this._isOr(filter)) {
return this._or(filter);
}
},
_isRaw: function (filter) {
return filter.operator === '_raw';
},
_raw: function (filter) {
var fieldTerm = {};
fieldTerm[filter.field] = filter.value;
return fieldTerm;
},
_isSimple: function (filter) {
return typeof filter.logic === 'undefined' && !this._isRegex(filter);
},
_simple: function (filter) {
var term = {}, fieldTerm = {};
var operator = this._translateoperator(filter.operator);
if (operator) {
term[operator] = filter.value;
}
else {
term = filter.value;
}
fieldTerm[filter.field] = term;
return fieldTerm;
},
_isRegex: function (filter) {
return $.inArray(filter.operator, regexOperations) !== -1;
},
_regex: function (filter) {
var fieldTerm = {};
var regex = this._getRegex(filter);
var regexValue = this._getRegexValue(regex);
fieldTerm[filter.field] = regexValue;
return fieldTerm;
},
_getRegex: function (filter) {
var pattern = filter.value;
switch (filter.operator) {
case 'contains':
return new RegExp(".*" + pattern + ".*", "i");
case 'startsWith':
return new RegExp(pattern + ".*", "i");
case 'endsWith':
return new RegExp(".*" + pattern, "i");
}
throw new Error("Unknown operator type.");
},
_getRegexValue: function (regex) {
return Everlive.QueryBuilder.prototype._getRegexValue.call(this, regex);
},
_isAnd: function (filter) {
return filter.logic === 'and';
},
_and: function (filter) {
var i, l, term, result = {};
var operands = filter.filters;
for (i = 0, l = operands.length; i < l; i++) {
term = this._build(operands[i]);
result = this._andAppend(result, term);
}
return result;
},
_andAppend: function (andObj, newObj) {
return Everlive.QueryBuilder.prototype._andAppend.call(this, andObj, newObj);
},
_isOr: function (filter) {
return filter.logic === 'or';
},
_or: function (filter) {
var i, l, term, result = [];
var operands = filter.filters;
for (i = 0, l = operands.length; i < l; i++) {
term = this._build(operands[i]);
result.push(term);
}
return { $or: result };
},
_translateoperator: function (operator) {
switch (operator) {
case 'eq':
return null;
case 'neq':
return "$ne";
case 'gt':
return "$gt";
case 'lt':
return "$lt";
case 'gte':
return "$gte";
case 'lte':
return "$lte";
}
throw new Error("Unknown operator type.");
}
};
function createEverliveQuery(query) {
return new Everlive.Query(query.$where, null, query.$sort, query.$skip, query.$take);
}
// replace the setup method of RemoteTransport in order to inject options
// the setup method is called on all crud operations
var RemoteTransport_setup = kendo.data.RemoteTransport.prototype.setup;
kendo.data.RemoteTransport.prototype.setup = function (options, type) {
if (!options.url && !this.options[type].url && this.options.typeName) {
options.url = Everlive.Request.prototype.buildUrl(Everlive.$.setup) + this.options.typeName;
if (type === 'update' || type === 'destroy')
options.url += '/' + options.data[Everlive.idField];
}
options.headers = Everlive.Request.prototype.buildAuthHeader(Everlive.$.setup);
if (type === 'read' && options.data) {
var query = translateKendoQuery(options.data);
var everliveQuery = createEverliveQuery(query);
options.headers = $.extend(options.headers, Everlive.Request.prototype.buildQueryHeaders(everliveQuery));
}
return RemoteTransport_setup.call(this, options, type);
};
// replace the accept method of Model in order to merge the response
// from the request for creating a new item to the client model item
var createRequestFields = [Everlive.idField, 'CreatedAt'];
var Model_accept = kendo.data.Model.prototype.accept;
kendo.data.Model.prototype.accept = function (data) {
var that = this, field, value;
if (data && that.isNew() && data[Everlive.idField]) {
for (field in that.fields) {
if ($.inArray(field, createRequestFields) === -1) {
value = that.get(field);
data[field] = value;
}
}
}
Model_accept.call(this, data);
};
})(jQuery);
| {
"content_hash": "851797429762bed94d8ab2f6c8d339c1",
"timestamp": "",
"source": "github",
"line_count": 4307,
"max_line_length": 161,
"avg_line_length": 34.01950313443232,
"alnum_prop": 0.5343770901298098,
"repo_name": "niki-funky/Telerik_Academy",
"id": "b7a9b53f514e34bb75db10df35486da29326b340",
"size": "146522",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Web Development/JS_frameworks/06. SPA/Scripts/libs/everlive.all.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "2773"
},
{
"name": "C#",
"bytes": "4074086"
},
{
"name": "CSS",
"bytes": "850276"
},
{
"name": "JavaScript",
"bytes": "5915582"
},
{
"name": "PowerShell",
"bytes": "785001"
},
{
"name": "Puppet",
"bytes": "329334"
}
],
"symlink_target": ""
} |
package org.litepal;
import android.text.TextUtils;
import org.litepal.crud.LitePalSupport;
import org.litepal.crud.QueryHandler;
import org.litepal.crud.async.AverageExecutor;
import org.litepal.crud.async.CountExecutor;
import org.litepal.crud.async.FindExecutor;
import org.litepal.crud.async.FindMultiExecutor;
import org.litepal.exceptions.LitePalSupportException;
import org.litepal.tablemanager.Connector;
import org.litepal.util.BaseUtility;
import org.litepal.util.DBUtility;
import java.util.List;
/**
* Allows developers to query tables with fluent style.
*
* @author Tony Green
* @since 2.0
*/
public class FluentQuery {
/**
* Representing the selected columns in SQL.
*/
String[] mColumns;
/**
* Representing the where clause in SQL.
*/
String[] mConditions;
/**
* Representing the order by clause in SQL.
*/
String mOrderBy;
/**
* Representing the limit clause in SQL.
*/
String mLimit;
/**
* Representing the offset in SQL.
*/
String mOffset;
/**
* Do not allow to create instance by developers.
*/
FluentQuery() {
}
/**
* Declaring to query which columns in table.
*
* <pre>
* LitePal.select("name", "age").find(Person.class);
* </pre>
*
* This will find all rows with name and age columns in Person table.
*
* @param columns
* A String array of which columns to return. Passing null will
* return all columns.
*
* @return A ClusterQuery instance.
*/
public FluentQuery select(String... columns) {
mColumns = columns;
return this;
}
/**
* Declaring to query which rows in table.
*
* <pre>
* LitePal.where("name = ? or age > ?", "Tom", "14").find(Person.class);
* </pre>
*
* This will find rows which name is Tom or age greater than 14 in Person
* table.
*
* @param conditions
* A filter declaring which rows to return, formatted as an SQL
* WHERE clause. Passing null will return all rows.
* @return A ClusterQuery instance.
*/
public FluentQuery where(String... conditions) {
mConditions = conditions;
return this;
}
/**
* Declaring how to order the rows queried from table.
*
* <pre>
* LitePal.order("name desc").find(Person.class);
* </pre>
*
* This will find all rows in Person table sorted by name with inverted
* order.
*
* @param column
* How to order the rows, formatted as an SQL ORDER BY clause.
* Passing null will use the default sort order, which may be
* unordered.
* @return A ClusterQuery instance.
*/
public FluentQuery order(String column) {
mOrderBy = column;
return this;
}
/**
* Limits the number of rows returned by the query.
*
* <pre>
* LitePal.limit(2).find(Person.class);
* </pre>
*
* This will find the top 2 rows in Person table.
*
* @param value
* Limits the number of rows returned by the query, formatted as
* LIMIT clause.
* @return A ClusterQuery instance.
*/
public FluentQuery limit(int value) {
mLimit = String.valueOf(value);
return this;
}
/**
* Declaring the offset of rows returned by the query. This method must be
* used with {@link #limit(int)}, or nothing will return.
*
* <pre>
* LitePal.limit(1).offset(2).find(Person.class);
* </pre>
*
* This will find the third row in Person table.
*
* @param value
* The offset amount of rows returned by the query.
* @return A ClusterQuery instance.
*/
public FluentQuery offset(int value) {
mOffset = String.valueOf(value);
return this;
}
/**
* Finds multiple records by the cluster parameters. You can use the below
* way to finish a complicated query:
*
* <pre>
* LitePal.select("name").where("age > ?", "14").order("age").limit(1).offset(2)
* .find(Person.class);
* </pre>
*
* You can also do the same job with SQLiteDatabase like this:
*
* <pre>
* getSQLiteDatabase().query("Person", "name", "age > ?", new String[] { "14" }, null, null, "age",
* "2,1");
* </pre>
*
* Obviously, the first way is much more semantic.<br>
* Note that the associated models won't be loaded by default considering
* the efficiency, but you can do that by using
* {@link FluentQuery#find(Class, boolean)}.
*
* @param modelClass
* Which table to query and the object type to return as a list.
* @return An object list with founded data from database, or an empty list.
*/
public <T> List<T> find(Class<T> modelClass) {
return find(modelClass, false);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindMultiExecutor<T> findAsync(final Class<T> modelClass) {
return findAsync(modelClass, false);
}
/**
* It is mostly same as {@link FluentQuery#find(Class)} but an isEager
* parameter. If set true the associated models will be loaded as well.
* <br>
* Note that isEager will only work for one deep level relation, considering the query efficiency.
* You have to implement on your own if you need to load multiple deepness of relation at once.
*
* @param modelClass
* Which table to query and the object type to return as a list.
* @param isEager
* True to load the associated models, false not.
* @return An object list with founded data from database, or an empty list.
*/
public <T> List<T> find(Class<T> modelClass, boolean isEager) {
synchronized (LitePalSupport.class) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
String limit;
if (mOffset == null) {
limit = mLimit;
} else {
if (mLimit == null) {
mLimit = "0";
}
limit = mOffset + "," + mLimit;
}
return queryHandler.onFind(modelClass, mColumns, mConditions, mOrderBy, limit, isEager);
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindMultiExecutor<T> findAsync(final Class<T> modelClass, final boolean isEager) {
final FindMultiExecutor<T> executor = new FindMultiExecutor<>();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final List<T> t = find(modelClass, isEager);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Finds the first record by the cluster parameters. You can use the below
* way to finish a complicated query:
*
* <pre>
* LitePal.select("name").where("age > ?", "14").order("age").limit(10).offset(2)
* .findFirst(Person.class);
* </pre>
*
* Note that the associated models won't be loaded by default considering
* the efficiency, but you can do that by using
* {@link FluentQuery#findFirst(Class, boolean)}.
*
* @param modelClass
* Which table to query and the object type to return.
* @return An object with founded data from database, or null.
*/
public <T> T findFirst(Class<T> modelClass) {
return findFirst(modelClass, false);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> findFirstAsync(Class<T> modelClass) {
return findFirstAsync(modelClass, false);
}
/**
* It is mostly same as {@link FluentQuery#findFirst(Class)} but an isEager
* parameter. If set true the associated models will be loaded as well.
* <br>
* Note that isEager will only work for one deep level relation, considering the query efficiency.
* You have to implement on your own if you need to load multiple deepness of relation at once.
*
* @param modelClass
* Which table to query and the object type to return.
* @param isEager
* True to load the associated models, false not.
* @return An object with founded data from database, or null.
*/
public <T> T findFirst(Class<T> modelClass, boolean isEager) {
synchronized (LitePalSupport.class) {
String limitTemp = mLimit;
if (!"0".equals(mLimit)) { // If mLimit not equals to 0, set mLimit to 1 to find the first record.
mLimit = "1";
}
List<T> list = find(modelClass, isEager);
mLimit = limitTemp; // Don't forget to change it back after finding operation.
if (list.size() > 0) {
if (list.size() != 1) throw new LitePalSupportException("Found multiple records while only one record should be found at most.");
return list.get(0);
}
return null;
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> findFirstAsync(final Class<T> modelClass, final boolean isEager) {
final FindExecutor<T> executor = new FindExecutor<>();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final T t = findFirst(modelClass, isEager);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Finds the last record by the cluster parameters. You can use the below
* way to finish a complicated query:
*
* <pre>
* LitePal.select("name").where("age > ?", "14").order("age").limit(10).offset(2)
* .findLast(Person.class);
* </pre>
*
* Note that the associated models won't be loaded by default considering
* the efficiency, but you can do that by using
* {@link FluentQuery#findLast(Class, boolean)}.
*
* @param modelClass
* Which table to query and the object type to return.
* @return An object with founded data from database, or null.
*/
public <T> T findLast(Class<T> modelClass) {
return findLast(modelClass, false);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> findLastAsync(Class<T> modelClass) {
return findLastAsync(modelClass, false);
}
/**
* It is mostly same as {@link FluentQuery#findLast(Class)} but an isEager
* parameter. If set true the associated models will be loaded as well.
* <br>
* Note that isEager will only work for one deep level relation, considering the query efficiency.
* You have to implement on your own if you need to load multiple deepness of relation at once.
*
* @param modelClass
* Which table to query and the object type to return.
* @param isEager
* True to load the associated models, false not.
* @return An object with founded data from database, or null.
*/
public <T> T findLast(Class<T> modelClass, boolean isEager) {
synchronized (LitePalSupport.class) {
String orderByTemp = mOrderBy;
String limitTemp = mLimit;
if (TextUtils.isEmpty(mOffset) && TextUtils.isEmpty(mLimit)) { // If mOffset or mLimit is specified, we can't use the strategy in this block to speed up finding.
if (TextUtils.isEmpty(mOrderBy)) {
// If mOrderBy is null, we can use id desc order, then the first record will be the record value where want to find.
mOrderBy = "id desc";
} else {
// If mOrderBy is not null, check if it ends with desc.
if (mOrderBy.endsWith(" desc")) {
// If mOrderBy ends with desc, then the last record of desc order will be the first record of asc order, so we remove the desc.
mOrderBy = mOrderBy.replace(" desc", "");
} else {
// If mOrderBy not ends with desc, then the last record of asc order will be the first record of desc order, so we add the desc.
mOrderBy += " desc";
}
}
if (!"0".equals(mLimit)) {
mLimit = "1";
}
}
List<T> list = find(modelClass, isEager);
mOrderBy = orderByTemp;
mLimit = limitTemp;
int size = list.size();
if (size > 0) {
return list.get(size - 1);
}
return null;
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> findLastAsync(final Class<T> modelClass, final boolean isEager) {
final FindExecutor<T> executor = new FindExecutor<>();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final T t = findLast(modelClass, isEager);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Count the records.
*
* <pre>
* LitePal.count(Person.class);
* </pre>
*
* This will count all rows in person table.<br>
* You can also specify a where clause when counting.
*
* <pre>
* LitePal.where("age > ?", "15").count(Person.class);
* </pre>
*
* @param modelClass
* Which table to query from by class.
* @return Count of the specified table.
*/
public int count(Class<?> modelClass) {
return count(BaseUtility.changeCase(modelClass.getSimpleName()));
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public CountExecutor countAsync(Class<?> modelClass) {
return countAsync(BaseUtility.changeCase(DBUtility.getTableNameByClassName(modelClass.getName())));
}
/**
* Count the records.
*
* <pre>
* LitePal.count("person");
* </pre>
*
* This will count all rows in person table.<br>
* You can also specify a where clause when counting.
*
* <pre>
* LitePal.where("age > ?", "15").count("person");
* </pre>
*
* @param tableName
* Which table to query from.
* @return Count of the specified table.
*/
public int count(String tableName) {
synchronized (LitePalSupport.class) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
return queryHandler.onCount(tableName, mConditions);
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public CountExecutor countAsync(final String tableName) {
final CountExecutor executor = new CountExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final int count = count(tableName);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(count);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Calculates the average value on a given column.
*
* <pre>
* LitePal.average(Person.class, "age");
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").average(Person.class, "age");
* </pre>
*
* @param modelClass
* Which table to query from by class.
* @param column
* The based on column to calculate.
* @return The average value on a given column.
*/
public double average(Class<?> modelClass, String column) {
return average(BaseUtility.changeCase(modelClass.getSimpleName()), column);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public AverageExecutor averageAsync(final Class<?> modelClass, final String column) {
return averageAsync(BaseUtility.changeCase(DBUtility.getTableNameByClassName(modelClass.getName())), column);
}
/**
* Calculates the average value on a given column.
*
* <pre>
* LitePal.average("person", "age");
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").average("person", "age");
* </pre>
*
* @param tableName
* Which table to query from.
* @param column
* The based on column to calculate.
* @return The average value on a given column.
*/
public double average(String tableName, String column) {
synchronized (LitePalSupport.class) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
return queryHandler.onAverage(tableName, column, mConditions);
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public AverageExecutor averageAsync(final String tableName, final String column) {
final AverageExecutor executor = new AverageExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final double average = average(tableName, column);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(average);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Calculates the maximum value on a given column. The value is returned
* with the same data type of the column.
*
* <pre>
* LitePal.max(Person.class, "age", int.class);
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").max(Person.class, "age", Integer.TYPE);
* </pre>
*
* @param modelClass
* Which table to query from by class.
* @param columnName
* The based on column to calculate.
* @param columnType
* The type of the based on column.
* @return The maximum value on a given column.
*/
public <T> T max(Class<?> modelClass, String columnName, Class<T> columnType) {
return max(BaseUtility.changeCase(modelClass.getSimpleName()), columnName, columnType);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> maxAsync(final Class<?> modelClass, final String columnName, final Class<T> columnType) {
return maxAsync(BaseUtility.changeCase(DBUtility.getTableNameByClassName(modelClass.getName())), columnName, columnType);
}
/**
* Calculates the maximum value on a given column. The value is returned
* with the same data type of the column.
*
* <pre>
* LitePal.max("person", "age", int.class);
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").max("person", "age", Integer.TYPE);
* </pre>
*
* @param tableName
* Which table to query from.
* @param columnName
* The based on column to calculate.
* @param columnType
* The type of the based on column.
* @return The maximum value on a given column.
*/
public <T> T max(String tableName, String columnName, Class<T> columnType) {
synchronized (LitePalSupport.class) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
return queryHandler.onMax(tableName, columnName, mConditions, columnType);
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> maxAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor<T> executor = new FindExecutor<>();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final T t = max(tableName, columnName, columnType);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Calculates the minimum value on a given column. The value is returned
* with the same data type of the column.
*
* <pre>
* LitePal.min(Person.class, "age", int.class);
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").min(Person.class, "age", Integer.TYPE);
* </pre>
*
* @param modelClass
* Which table to query from by class.
* @param columnName
* The based on column to calculate.
* @param columnType
* The type of the based on column.
* @return The minimum value on a given column.
*/
public <T> T min(Class<?> modelClass, String columnName, Class<T> columnType) {
return min(BaseUtility.changeCase(modelClass.getSimpleName()), columnName, columnType);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> minAsync(final Class<?> modelClass, final String columnName, final Class<T> columnType) {
return minAsync(BaseUtility.changeCase(DBUtility.getTableNameByClassName(modelClass.getName())), columnName, columnType);
}
/**
* Calculates the minimum value on a given column. The value is returned
* with the same data type of the column.
*
* <pre>
* LitePal.min("person", "age", int.class);
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").min("person", "age", Integer.TYPE);
* </pre>
*
* @param tableName
* Which table to query from.
* @param columnName
* The based on column to calculate.
* @param columnType
* The type of the based on column.
* @return The minimum value on a given column.
*/
public <T> T min(String tableName, String columnName, Class<T> columnType) {
synchronized (LitePalSupport.class) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
return queryHandler.onMin(tableName, columnName, mConditions, columnType);
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> minAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor<T> executor = new FindExecutor<>();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final T t = min(tableName, columnName, columnType);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
/**
* Calculates the sum of values on a given column. The value is returned
* with the same data type of the column.
*
* <pre>
* LitePal.sum(Person.class, "age", int.class);
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").sum(Person.class, "age", Integer.TYPE);
* </pre>
*
* @param modelClass
* Which table to query from by class.
* @param columnName
* The based on column to calculate.
* @param columnType
* The type of the based on column.
* @return The sum value on a given column.
*/
public <T> T sum(Class<?> modelClass, String columnName, Class<T> columnType) {
return sum(BaseUtility.changeCase(modelClass.getSimpleName()), columnName, columnType);
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> sumAsync(final Class<?> modelClass, final String columnName, final Class<T> columnType) {
return sumAsync(BaseUtility.changeCase(DBUtility.getTableNameByClassName(modelClass.getName())), columnName, columnType);
}
/**
* Calculates the sum of values on a given column. The value is returned
* with the same data type of the column.
*
* <pre>
* LitePal.sum("person", "age", int.class);
* </pre>
*
* You can also specify a where clause when calculating.
*
* <pre>
* LitePal.where("age > ?", "15").sum("person", "age", Integer.TYPE);
* </pre>
*
* @param tableName
* Which table to query from.
* @param columnName
* The based on column to calculate.
* @param columnType
* The type of the based on column.
* @return The sum value on a given column.
*/
public <T> T sum(String tableName, String columnName, Class<T> columnType) {
synchronized (LitePalSupport.class) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
return queryHandler.onSum(tableName, columnName, mConditions, columnType);
}
}
/**
* This method is deprecated and will be removed in the future releases.
* Handle async db operation in your own logic instead.
*/
@Deprecated
public <T> FindExecutor<T> sumAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor<T> executor = new FindExecutor<>();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (LitePalSupport.class) {
final T t = sum(tableName, columnName, columnType);
if (executor.getListener() != null) {
Operator.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
} | {
"content_hash": "988d5a505e2992ea27faea7ccdc79270",
"timestamp": "",
"source": "github",
"line_count": 882,
"max_line_length": 170,
"avg_line_length": 33.93764172335601,
"alnum_prop": 0.5983028764240136,
"repo_name": "LitePalFramework/LitePal",
"id": "9097591f36fd58c8a3553a944d84304be478adb2",
"size": "30566",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/litepal/FluentQuery.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "565143"
},
{
"name": "Kotlin",
"bytes": "74107"
}
],
"symlink_target": ""
} |
using System;
using System.Web;
using System.Web.Mvc;
using Microsoft.SharePoint.Client;
//Must be in the same namespace as SharePointContextFilterAttribute
namespace SharePointPermissionFiltersWeb
{
public class SharePointEffectivePermissionsFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext == null)
{
throw new ArgumentNullException("filterContext");
}
if (SharePointPermissionsProvider.Current == null)
{
SharePointPermissionsProvider.NewProvider(filterContext.HttpContext);
}
}
}
} | {
"content_hash": "fe92df91f806051db5d3759d9bd9ab9b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 86,
"avg_line_length": 27.692307692307693,
"alnum_prop": 0.6708333333333333,
"repo_name": "dafunkphenomenon/dev",
"id": "c1ee6298dab7a7f97dce02f43a235c5cfd9528c4",
"size": "722",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "SharePointPermissionFilters/SharePointPermissionFiltersWeb/Filters/SharePointEffectivePermissionsFilterAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "35416"
},
{
"name": "C#",
"bytes": "257120"
},
{
"name": "CSS",
"bytes": "25997"
},
{
"name": "Cucumber",
"bytes": "5446"
},
{
"name": "HTML",
"bytes": "47039"
},
{
"name": "JavaScript",
"bytes": "169526"
},
{
"name": "PowerShell",
"bytes": "6683"
},
{
"name": "TypeScript",
"bytes": "1580"
}
],
"symlink_target": ""
} |
package net.venaglia.nondairy.soylang.elements;
import static net.venaglia.nondairy.soylang.SoyElement.*;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.ElementManipulators;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import com.intellij.util.IncorrectOperationException;
import net.venaglia.nondairy.soylang.elements.path.ElementPredicate;
import net.venaglia.nondairy.soylang.elements.path.ElementTypePredicate;
import net.venaglia.nondairy.soylang.elements.path.PsiElementCollection;
import net.venaglia.nondairy.soylang.elements.path.PsiElementPath;
import net.venaglia.nondairy.soylang.elements.path.TemplateNamePredicate;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* User: ed
* Date: Aug 24, 2010
* Time: 5:37:04 PM
*
* PsiElement implementation that represents the local template name in a call
* or delcall soy tag.
*/
public class LocalTemplateNameRef
extends SoyPsiElement
implements SoyNamedElement, ItemPresentation, TemplateMemberElement {
public static final PsiElementPath PATH_TO_TEMPLATE_NAMES =
new PsiElementPath(new ElementTypePredicate(soy_file).onFirstAncestor(),
new ElementTypePredicate(template_tag_pair).onDescendants(1,2),
new ElementTypePredicate(template_tag).onChildren(),
new ElementTypePredicate(tag_between_braces).onChildren(),
new ElementTypePredicate(template_name).onChildren()).debug("path_to_template_names");
public LocalTemplateNameRef(@NotNull ASTNode node) {
super(node);
}
@Override
public PsiReference getReference() {
final String myTemplateName = getTemplateName();
if (myTemplateName == null) {
return null;
}
ElementPredicate templateNamePredicate = new TemplateNamePredicate(myTemplateName);
return new SoyPsiElementReference(this, PATH_TO_TEMPLATE_NAMES, templateNamePredicate);//.bound(BIND_HANDLER);
}
@Override
@NotNull
public String getName() {
String name = getText();
if (name.startsWith(".")) {
name = name.substring(1);
}
return name;
}
@Override
public PsiElement setName(@NotNull @NonNls String name) throws IncorrectOperationException {
if (getText().startsWith(".") ^ name.startsWith(".")) {
name = name.startsWith(".") ? name.substring(1) : "." + name;
}
TextRange range = getTextRange().shiftRight(0 - getTextOffset());
return ElementManipulators.getManipulator(this).handleContentChange(this, range, name);
}
@Override
public String getPresentableText() {
return getTemplateName();
}
@Override
public String getLocationString() {
return getNamespace();
}
@Override
public Icon getIcon(boolean open) {
return null;
}
@Override
public String getCanonicalName() {
return getTemplateName();
}
@Override
public String getTemplateName() {
String localName = getName();
String namespace = getNamespace();
return (namespace == null) ? localName : namespace + "." + localName;
}
@Override
public String getNamespace() {
PsiElement namespace = PATH_TO_NAMESPACE_NAME.navigate(this).oneOrNull();
return namespace instanceof NamespaceMemberElement
? ((NamespaceMemberElement)namespace).getNamespace()
: null;
}
}
| {
"content_hash": "3b7a0ddb624a8ed0f8ba1b66a4021a23",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 125,
"avg_line_length": 33.85585585585586,
"alnum_prop": 0.6729643427354977,
"repo_name": "Arcnor/Non-Dairy-Soy-Plugin",
"id": "18bd783fe10e9ac502b3a19970ddd4763c8d202b",
"size": "4386",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/net/venaglia/nondairy/soylang/elements/LocalTemplateNameRef.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1549428"
},
{
"name": "Lex",
"bytes": "57420"
}
],
"symlink_target": ""
} |
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
body { font-family:'DB Helvethaica X 45 Li', Arial, sans-serif; font-size:26px; font-weight:normal; color:#181818; background:#fff; }
a { display:inline-block; color:#181818; -webkit-transition: all 0.1s ease; -moz-transition: all 0.1s ease; -o-transition: all 0.1s ease; transition: all 0.1s ease; }
a:hover { color:#ee6a8d; }
h1, h2, h3, h4, h5, h6 { position:relative; font-weight:normal; }
h1 { font-size:76px; }
h2 { font-size:46px; }
h3 { font-size:41px; }
h4 { font-size:33px; }
h5 { font-size:27px; }
p { padding:15px 0 0 0; }
#container { margin:0 auto; position:relative; width:1080px; height:1920px; overflow:hidden; }
.warpper { position:relative; margin:0 auto; width:100%; max-width:1080px; }
.section { float:left; width:100%; }
.header { float:left; width:100%; height:80px; background:#181818; }
.header h2 { display:inline-block; padding-top:14px; font-weight:bold; }
.header h2 span { font-weight:normal; }
.header .date-time { position:absolute; left:40px; top:0px; font-size:22px; }
.header .box-date { color:#d0abff; }
.header .box-temperature { display:inline-block; padding-left:15px; color:#6cb6ff; }
.header .box { position:relative; width:100%; max-width:1080px; height:100%; margin:0 auto; padding:0 40px; color:#ffd800; }
.header .left { float:left; width:650px; }
.header .left i { display:inline-block; width:60px; height:60px; margin-left:15px; margin-top:-20px; vertical-align:middle; }
.header .left i img { width:100%; }
.header .right { float:left; display:table; width:350px; height:100%; text-align:right; }
.header .right span { display:table-cell; vertical-align:middle; }
.header .right a { display:inline-block; width:150px; height:44px; padding:0 10px; text-align:center; line-height:45px; color:#181818; text-transform:uppercase; font-weight:bold; background:#fcd402; border-radius: 30px; }
.header .right a:hover { background:#fff; }
.header .right i.home { display:inline-block; width:32px; height:32px; margin-right:10px; background:url(../images/icon-home.png) no-repeat top; background-size:100%; vertical-align:middle; }
.box-nav { float:left; width:100%; height:350px; padding:0 40px 20px 40px; background:#ffd800 url(../images/bg-nav.png) no-repeat center top; }
.box-nav h1 { position:relative; text-align:center; color:#181818; font-weight:bold; }
.box-nav h1 span.date { position:absolute; left:0; top:30px; padding:0 20px; font-size:30px; border:1px dashed #7c44fa; border-radius: 30px;
background:#feffcf }
.box-nav h1 span.temperature { position:absolute; height:40px; line-height:18px; padding:0 20px; right:0; top:28px; font-size:30px; border:1px dashed #7c44fa; border-radius: 30px;
background:#feffcf;
}
.nav { float:left; width:100%; }
.nav .three-nav { position:relative; margin-top:10px; margin-left:-40px; margin-right:-40px; }
.nav .items { float:left; height:220px; }
.nav .fix-rows { width:100%; padding:0 15px; }
.nav .box { position:relative; float:left; width:100%; height:100%; text-align:center; background:#fff; border-radius: 10px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.nav .box h3 { position:absolute; left:0; right:0; margin-left:auto; margin-right:auto; bottom:0; font-weight:bold; z-index:1; }
.nav .box a { display:block; width:100%; height:100%; color:#fff; border:3px solid #fff; text-align:center; background:url(../images/bg-nav-li.png); border-radius: 10px; }
.nav .box a:hover { border:3px solid #0077db; color:#ffc800; }
.nav .box a.one { background:url(../images/bg-nav-one.png) no-repeat center center; }
.nav .box a.two { background:url(../images/bg-nav-two.png) no-repeat center center; }
.nav .box a.three { background:url(../images/bg-nav-three.png) no-repeat center center; }
.nav .box a.four { background:url(../images/bg-nav-four.png) no-repeat center center; }
.nav .box a img { display:inline-block; padding:10px 0 10px 0; }
.nav .three-nav .slick-prev,.nav .three-nav .slick-next { width:50px; height:50px; top:126px; }
.nav .three-nav .slick-prev:before { background-size: 150%; background-position: 4px; }
.nav .three-nav .slick-next:before { background-size: 150%; background-position: -30px; }
.less-nav { height:90px !important; }
.line-below { float:left; width:100%; height:4px; margin-top:-10px; background:#0077db; border-radius: 90px; }
.full-box { float:left; width:100%; padding:0; }
.product-full { height:1450px !important; }
.product-full .box-slick { height:1315px; }
.product-full .slick-prev, .product-full .slick-next { top:51%; }
.product-items { float:left; width:100%; height:842px; background:#ffc800; }
.product-items .box-warpper { position:relative; width:100%; height:100%; padding:30px 0 20px 0; }
.product-items .box-slick { position:relative; }
.product-items .items { float:left; width:100%; height:100%; }
.product-row-mini { float:left; width:100%; padding-left:40px; }
.product-row-mini .flex-rows { margin-left:-7.5px; margin-right:-7.5px; }
.product-row-mini .box { float:left; position:relative; width:188px; height:250px; margin-left:7.5px; margin-right:7.5px; margin-bottom:15px; text-align:center; background:#fff; border-radius: 10px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
background: rgba(254,254,254,1);
background: -moz-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(254,254,254,1)), color-stop(0%, rgba(254,254,254,1)), color-stop(58%, rgba(250,250,250,1)), color-stop(58%, rgba(255,255,255,1)), color-stop(100%, rgba(235,235,235,1)));
background: -webkit-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -o-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -ms-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: linear-gradient(to bottom, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#ebebeb', GradientType=0 ); }
.product-row-mini .box a { display:block; width:100%; height:100%; padding-top:5px; border:2px solid #fff; border-radius: 10px; }
.product-row-mini .box a:hover { border:2px solid #0077db; -webkit-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);-moz-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7); }
.product-row-mini .box a:hover .price { color:#fff; background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );}
.product-row-mini .box img { display:inline-block; width:180px; height:190px; }
.product-row-mini .price { display:inline-block; position:relative; margin-top:10px; width:80px; height:34px; font-size:29px; color:#fff; background:#8e30f8; border-radius: 30px; }
.product-row-mini .price span { display:inline-block; padding-top:2px; font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:24px; }
.outstock { background:#ddd !important; }
.outstock a { border:2px solid #ddd !important; }
.product-row-big { float:left; width:100%; padding-left:40px; }
.product-row-big .flex-rows { margin-left:-7.5px; margin-right:-7.5px; }
.product-row-big .box { float:left; position:relative; width:323px; height:250px; margin-left:7.5px; margin-right:7.5px; margin-bottom:15px; text-align:center; background:#fff; border-radius: 10px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
background: rgba(254,254,254,1);
background: -moz-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(254,254,254,1)), color-stop(0%, rgba(254,254,254,1)), color-stop(58%, rgba(250,250,250,1)), color-stop(58%, rgba(255,255,255,1)), color-stop(100%, rgba(235,235,235,1)));
background: -webkit-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -o-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -ms-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: linear-gradient(to bottom, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#ebebeb', GradientType=0 );
}
.product-row-big .box a { display:block; width:100%; height:100%; padding-top:5px; border:2px solid #fff; border-radius: 10px; }
.product-row-big .box a:hover { border:2px solid #0077db; -webkit-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);-moz-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7); }
.product-row-big .box a:hover .price { color:#fff; background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );}
.product-row-big .price { display:inline-block; position:relative; margin-top:10px; width:300px; height:34px; font-size:29px; color:#fff; background:#8e30f8; border-radius: 30px; }
.product-row-big .price span { display:inline-block; position:relative; padding-top:2px; font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:24px; }
.product-row-big .price span.sale:before { content:''; position:absolute; width:25px; height:25px; left:0; top:4px; background:url(../images/icon-sale.png) no-repeat center center; }
.product-row-big .combo { float:left; position:relative; width:100%; height:190px; text-align:center; }
.product-row-big .combo img { display:inline-block; width:160px; vertical-align:bottom; }
.product-row-big .combo span { position: absolute;
width: 40px;
height: 40px;
background: url(../images/icon-plus.png) no-repeat center center; background-size:100%;
left: 0;
right: 0; text-indent:-9999px;
top: 0;
bottom: 0;
margin: auto;
z-index: 2; }
.product-row-big .combo .pro-one { position:absolute; bottom:0; left:5px; z-index:1; }
.product-row-big .combo .pro-two { position:absolute; bottom:0; right:5px; z-index:1; }
.product-outstock { position:absolute; width:100%; height:100%; text-align:center; z-index:1; }
.product-outstock span { display:block; margin-top:-4px; width:100%; height:43px; text-align:center; color:#fff; font-size:30px; line-height:34px; font-weight:bold; background:url(../images/bg-outstock.png) no-repeat center center; z-index:1; }
.event-row { float:left; width:100%; padding-left:40px; }
.event-row .flex-rows { margin-left:-7.5px; margin-right:-7.5px; }
.event-row .box { float:left; position:relative; width:492.5px; height:250px; margin-left:7.5px; margin-right:7.5px; margin-bottom:15px; text-align:center; background:#fff; border-radius: 10px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
background: rgba(254,254,254,1);
background: -moz-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(254,254,254,1)), color-stop(0%, rgba(254,254,254,1)), color-stop(58%, rgba(250,250,250,1)), color-stop(58%, rgba(255,255,255,1)), color-stop(100%, rgba(235,235,235,1)));
background: -webkit-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -o-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -ms-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: linear-gradient(to bottom, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#ebebeb', GradientType=0 );
}
.event-row .box a { display:block; width:100%; height:100%; border:2px solid #fff; border-radius: 10px; }
.event-row .box a:hover { color:#0077db; border:2px solid #0077db; -webkit-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);-moz-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7); }
.event-row .box a:hover .price { color:#fff; background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );}
.event-row .photo-item img { display:inline-block; height:170px; }
.event-row .photo-item { display:table-cell; position:relative; width:200px; height:246px; vertical-align:middle; }
.event-row .requirements { display:table-cell; width:290px; vertical-align:middle; padding:0 15px; text-align:left; border-left:1px dashed #7c87ff; }
.event-row .requirements p { padding:0; font-weight:bold; color:#181818; }
.event-row .box-play-event { width:100%; padding-top:15px; text-align:center; }
.event-row .play-event { display:inline-block; min-width:150px; height:40px; padding:0 15px; text-align:center; line-height:40px; color:#fff; text-transform:uppercase; font-weight:bold; background:#e8740d;
border-radius: 30px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.event-row .box a:hover .play-event { background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );}
.event-row .price { display:inline-block; position:relative; margin-top:10px; width:80px; height:34px; font-size:29px; color:#fff; background:#8e30f8; border-radius: 30px; }
.event-row .price span { display:inline-block; padding-top:2px; font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:24px; }
.event-row .icon { display:inline-block; margin:0 8px 0 5px; }
.event-detail { float:left; width:100%; height:500px; }
.event-detail .box { float:left; position:relative; width:100%; height:500px; text-align:center; font-size:50px !important; background:#fff; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
background: rgba(254,254,254,1);
background: -moz-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(254,254,254,1)), color-stop(0%, rgba(254,254,254,1)), color-stop(58%, rgba(250,250,250,1)), color-stop(58%, rgba(255,255,255,1)), color-stop(100%, rgba(235,235,235,1)));
background: -webkit-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -o-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: -ms-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
background: linear-gradient(to bottom, rgba(254,254,254,1) 0%, rgba(254,254,254,1) 0%, rgba(250,250,250,1) 58%, rgba(255,255,255,1) 58%, rgba(235,235,235,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#ebebeb', GradientType=0 );
}
.event-detail .photo-item img { display:inline-block; height:400px; }
.event-detail .photo-item { display:table-cell; position:relative; width:450px; height:500px; vertical-align:middle; }
.event-detail .requirements { display:table-cell; width:630px; height:500px; vertical-align:middle; padding:0 15px 0 60px; text-align:left; border-left:1px dashed #7c87ff; }
.event-detail .requirements p { padding:0; font-weight:bold; color:#181818; }
.event-detail .ribbon-less { width:150px; height:150px; background-size:100%; }
.event-detail .ribbon-less span { font-size:40px !important; }
.event-detail .price { display:inline-block; position:relative; margin-top:10px; width:200px; height:40px; line-height:35px; font-size:24px !important; color:#fff; background:#8e30f8; border-radius: 30px; }
.event-detail .price span { display:inline-block; padding-top:2px; font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:32px !important; }
.event-detail .price b { font-size:40px !important; }
.event-detail .icon { display:inline-block; margin:0 8px 0 5px; }
.ribbon-less { position:absolute; width:100px; height:100px; padding:0 12px; color:#fff; text-align:center; font-weight:bold; z-index:1; left:2px; top:2px; -webkit-transform: rotate(-7deg); }
.ribbon-less p { display:table; width:100%; height:100%; padding-top:5px; line-height:.9; }
.ribbon-less span { display:table-cell; vertical-align:middle; }
.ribbon-one-blue { background: url(../images/ribbon-a-blue.png) no-repeat center center; }
.ribbon-one-yellow { background: url(../images/ribbon-a-yellow.png) no-repeat center center; }
.ribbon-one-green { background: url(../images/ribbon-a-green.png) no-repeat center center; }
.ribbon-one-red { background: url(../images/ribbon-a-red.png) no-repeat center center; }
.ribbon-one-purple { background: url(../images/ribbon-a-purple.png) no-repeat center center; }
.ribbon-one-mint { background: url(../images/ribbon-a-mint.png) no-repeat center center; }
.ribbon-two-blue { background: url(../images/ribbon-b-blue.png) no-repeat center center; }
.ribbon-two-yellow { background: url(../images/ribbon-b-yellow.png) no-repeat center center; }
.ribbon-two-green { background: url(../images/ribbon-b-green.png) no-repeat center center; }
.ribbon-two-red { background: url(../images/ribbon-b-red.png) no-repeat center center; }
.ribbon-two-purple { background: url(../images/ribbon-b-purple.png) no-repeat center center; }
.ribbon-two-mint { background: url(../images/ribbon-b-mint.png) no-repeat center center; }
.topup-row { float:left; width:100%; padding-left:40px; }
.topup-row .flex-rows { margin-left:-7.5px; margin-right:-7.5px; }
.topup-row .box { float:left; display:table; position:relative; width:492.5px; height:250px; margin-left:7.5px; margin-right:7.5px; margin-bottom:15px; text-align:center; background:#fff; border-radius: 10px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.topup-row .box a { display:block; width:100%; height:100%; border:2px solid #fff; border-radius: 10px; }
.topup-row .box a:hover { color:#0077db; border:2px solid #0077db; -webkit-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);-moz-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7); }
.topup-row .box a:hover .price { color:#fff; background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );}
.topup-row .box img { display:inline-block; height:160px; }
.topup-row .photo-item { display:table-cell; width:490px; height:246px; text-align:center; vertical-align:middle; }
.topup-row .requirements { display:table-cell; width:310px; vertical-align:middle; padding:0 15px; text-align:left; border-left:1px dashed #ddd; }
.topup-row .requirements p { padding:0; font-weight:bold; color:#181818; }
.topup-row .box-play-event { width:100%; padding-top:15px; text-align:center; }
.topup-row .play-event { display:inline-block; min-width:220px; height:50px; padding:0 15px; text-align:center; line-height:50px; color:#fff; text-transform:uppercase; font-weight:bold;
background: rgba(124,135,255,1);
background: -moz-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(124,135,255,1)), color-stop(100%, rgba(182,109,255,1)));
background: -webkit-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -o-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -ms-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: linear-gradient(to right, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7c87ff', endColorstr='#b66dff', GradientType=1 );
border-radius: 30px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.topup-row .box a:hover .play-event { background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );}
.process-list { float:left; width:100%; font-weight:bold; font-size:30px; }
.process-list h2 { padding-top:10px; font-weight:bold; }
.process-list ul.one { float:left; width:50%; }
.process-list ul.two { float:left; width:50%; padding-left:5px; }
.process-list li { float:left; display:table; width:100%; padding:2px 0; }
.process-list div.left { float:none; position:relative; display:table-cell; width:40px; font-weight:bold; vertical-align:top; }
.process-list div.right { float:none; display:table-cell; padding-top:7px; padding-left:10px; line-height:25px; }
.process-list .numlist { display:inline-block; width:36px; height:36px; line-height:36px; color:#fff; text-align:center; vertical-align:middle; background: rgba(124,135,255,1);
background: -moz-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(124,135,255,1)), color-stop(100%, rgba(182,109,255,1)));
background: -webkit-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -o-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -ms-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: linear-gradient(to right, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7c87ff', endColorstr='#b66dff', GradientType=1 ); border-radius: 90px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.play-vdo-manual { float:left; width:100%; padding-top:20px; text-align:center; }
.play-vdo-manual a { display:inline-block; min-width:220px; height:50px; padding:0 15px; text-align:center; line-height:50px; border:1px solid #fff; color:#181818; text-transform:uppercase; font-weight:bold;
background: rgba(254,254,254,1);
background: -moz-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(232,232,232,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(254,254,254,1)), color-stop(100%, rgba(232,232,232,1)));
background: -webkit-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(232,232,232,1) 100%);
background: -o-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(232,232,232,1) 100%);
background: -ms-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(232,232,232,1) 100%);
background: linear-gradient(to bottom, rgba(254,254,254,1) 0%, rgba(232,232,232,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#e8e8e8', GradientType=0 );
border-radius: 30px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.play-vdo-manual a:hover { border:1px solid #ddd; -webkit-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);-moz-box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7);box-shadow: inset 0px 0px 20px 0px rgba(124,134,255,0.7); }
.play-vdo-manual i.play { display:inline-block; width:33px; height:33px; margin-right:10px; background:url(../images/icon-play.png) no-repeat center center; background-size:100%; vertical-align:sub; }
.product-detail { float:left; width:100%; height:1102px; background:#ffc800; }
.product-detail .box-warpper { position:relative; width:100%; height:100%; }
.product-detail .box-content { float:left; position:relative; width:100%; height:500px; background:#fff; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.product-detail .product-fix-item { position:absolute; width:100%; height:420px; text-align:center; top:0; left:0; right:0; bottom:0; margin-top:auto; margin-bottom:auto; margin-left:auto; margin-right:auto; }
.product-detail .product-fix-item .photo { position:relative; width:100%; height:100%; }
.product-detail .product-fix-item .photo img { position:absolute; max-height:420px; height:auto; left:0; right:0; margin-left:auto; margin-right:auto; margin-top:auto; margin-bottom:auto; bottom:0; }
.product-detail .product-full-item { float:left; width:100%; height:100%; position:relative; }
.product-detail .product-full-item img { display:block; }
.product-detail .product-combo-item .pro-one { position:absolute; bottom:0; top:0; margin-top:auto; margin-bottom:auto; left:100px; z-index:1; }
.product-detail .product-combo-item .pro-two { position:absolute; bottom:0; top:0; margin-top:auto; margin-bottom:auto; right:100px; z-index:1; }
.product-detail .product-combo-item .photo { position:relative; width:100%; height:100%; }
.product-detail .product-combo-item .photo img { width:380px; }
.product-detail .product-combo-item .photo span {position:absolute; width:90px; height:90px; background:url(../images/icon-plus.png) no-repeat center center; left:0; right:0; top:0; bottom:0; margin:auto; z-index:2; }
.product-detail .box-form { float:left; position:relative; display:table; width:100%; height:480px; padding:40px 80px 20px 80px; font-size:34px; font-weight:bold; }
.product-detail .box-form-full { height:1100px !important; }
.product-detail .left { float:left; position:relative; width:50%; padding-right:30px; }
.product-detail .right { float:left; position:relative; width:50%; padding-left:30px; }
.product-detail .left-70 { float:left; display:table; position:relative; width:70%; padding-right:30px; }
.product-detail .right-30 { float:left; position:relative; width:30%; padding-left:30px; }
.product-detail .less-price { position:relative; width:100%; }
.product-detail .less-price a { position:absolute; display:block; width:80px; height:60px; line-height:58px; color:#fff; text-align:center; background:#0077db;
top:15px; right:0;
-webkit-border-top-right-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px; }
.product-detail .less-price a:hover { color:#ffc800 }
.product-detail .box-form h2 { position:relative; font-weight:bold; font-size:50px; padding-bottom:0; line-height:1.2; }
.product-detail .box-form small { font-size:24px; color:#815800; }
.product-detail .box-show-price { float:left; width:100%; }
.product-detail .row-price { float:left; width:100%; padding:10px 0 20px 0; text-align:center; }
.product-detail .flex-left { display:inline-table; width:150px; height:150px; margin-right:25px; text-align:center; vertical-align:top; }
.product-detail .flex-right { display:inline-table; width:150px; height:150px; margin-left:25px; text-align:center; vertical-align:top; }
.product-detail .normal-price { display:inline-table; width:150px; height:150px; text-align:center; vertical-align:top; color:#fff; background:#fff; border-radius: 90px;
background: rgba(124,134,255,1);
background: -moz-linear-gradient(top, rgba(124,134,255,1) 0%, rgba(124,134,255,1) 16%, rgba(118,28,201,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(124,134,255,1)), color-stop(16%, rgba(124,134,255,1)), color-stop(100%, rgba(118,28,201,1)));
background: -webkit-linear-gradient(top, rgba(124,134,255,1) 0%, rgba(124,134,255,1) 16%, rgba(118,28,201,1) 100%);
background: -o-linear-gradient(top, rgba(124,134,255,1) 0%, rgba(124,134,255,1) 16%, rgba(118,28,201,1) 100%);
background: -ms-linear-gradient(top, rgba(124,134,255,1) 0%, rgba(124,134,255,1) 16%, rgba(118,28,201,1) 100%);
background: linear-gradient(to bottom, rgba(124,134,255,1) 0%, rgba(124,134,255,1) 16%, rgba(118,28,201,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7c86ff', endColorstr='#761cc9', GradientType=0 );
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
}
.product-detail .normal-price span { font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:50px; }
.product-detail .normal-price b { font-size:50px; }
.product-detail .normal-price .box { display:table-cell; vertical-align:middle; }
.product-detail .descount-price { display:inline-table; width:150px; height:150px; text-align:center; vertical-align:top; color:#fff; background:#fff; border-radius: 90px;
background: rgba(79,251,159,1);
background: -moz-linear-gradient(top, rgba(79,251,159,1) 0%, rgba(79,251,159,1) 16%, rgba(5,159,162,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(79,251,159,1)), color-stop(16%, rgba(79,251,159,1)), color-stop(100%, rgba(5,159,162,1)));
background: -webkit-linear-gradient(top, rgba(79,251,159,1) 0%, rgba(79,251,159,1) 16%, rgba(5,159,162,1) 100%);
background: -o-linear-gradient(top, rgba(79,251,159,1) 0%, rgba(79,251,159,1) 16%, rgba(5,159,162,1) 100%);
background: -ms-linear-gradient(top, rgba(79,251,159,1) 0%, rgba(79,251,159,1) 16%, rgba(5,159,162,1) 100%);
background: linear-gradient(to bottom, rgba(79,251,159,1) 0%, rgba(79,251,159,1) 16%, rgba(5,159,162,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4ffb9f', endColorstr='#059fa2', GradientType=0 );
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
}
.product-detail .descount-price span { font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:50px; }
.product-detail .descount-price b { font-size:50px; }
.product-detail .descount-price .box { display:table-cell; vertical-align:middle; }
.product-detail .boxmini-less { margin:0 auto; width:400px; text-align:center; }
.product-detail .input-price { display:inline-table; width:150px; height:150px; text-align:center; vertical-align:top; color:#fff; background:#fff; border-radius: 90px;
background: rgba(174,255,107,1);
background: -moz-linear-gradient(top, rgba(174,255,107,1) 0%, rgba(27,161,0,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(174,255,107,1)), color-stop(100%, rgba(27,161,0,1)));
background: -webkit-linear-gradient(top, rgba(174,255,107,1) 0%, rgba(27,161,0,1) 100%);
background: -o-linear-gradient(top, rgba(174,255,107,1) 0%, rgba(27,161,0,1) 100%);
background: -ms-linear-gradient(top, rgba(174,255,107,1) 0%, rgba(27,161,0,1) 100%);
background: linear-gradient(to bottom, rgba(174,255,107,1) 0%, rgba(27,161,0,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#aeff6b', endColorstr='#1ba100', GradientType=0 );
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
}
.product-detail .input-price span { font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:50px; }
.product-detail .input-price b { font-size:50px; }
.product-detail .input-price .box { display:table-cell; vertical-align:middle; }
.product-detail .sumtotal-price { display:inline-table; width:150px; height:150px; text-align:center; vertical-align:top; color:#fff; background:#fff; border-radius: 90px;
background: rgba(55,198,250,1);
background: -moz-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(55,198,250,1)), color-stop(16%, rgba(55,198,250,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: linear-gradient(to bottom, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#37c6fa', endColorstr='#0078db', GradientType=0 );
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
}
.product-detail .sumtotal-price span { font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:50px; }
.product-detail .sumtotal-price b { font-size:50px; }
.product-detail .sumtotal-price .box { display:table-cell; vertical-align:middle; }
.product-detail .row-total { float:left; width:100%; padding:0 0 10px 0; text-align:center; }
.product-detail .show-total { width:50%; height:80px; margin:0 auto; text-align:center; vertical-align:top; }
.product-detail .show-total .box-con { vertical-align:middle; font-size:40px; animation: fadeIn 0.8s infinite ; }
.product-detail .show-total .box-con span { font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:50px; }
.product-detail .show-total .box-con b { font-size:50px; }
.product-detail .show-total a { display:block; width:100%; height:100%; color:#fff; background:#fff; border-radius: 90px; border:3px solid #fff;
background: rgba(55,198,250,1);
background: -moz-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(55,198,250,1)), color-stop(16%, rgba(55,198,250,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(top, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
background: linear-gradient(to bottom, rgba(55,198,250,1) 0%, rgba(55,198,250,1) 16%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#37c6fa', endColorstr='#0078db', GradientType=0 );
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.product-detail .show-total a:hover { color:#ffc800; background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 ); }
.product-detail .box { vertical-align:middle; font-size:40px; }
.product-detail .box span { font-family:'robotobold','DB Helvethaica X 45 Li'; font-size:50px; }
.product-detail .box b { font-size:50px; }
.product-detail .ani-pay { float:left; position:relative; width:100%; height:60px; margin-top:30px; font-size:46px; text-align:center; }
.product-detail .ani-pay span { position:absolute; top:-45px; padding-left:0; }
.product-detail .anilong-pay { float:left; display:table; position:relative; width:100%; height:380px; margin-top:30px; font-size:50px;background: rgba(250,250,250,1);
background: -moz-linear-gradient(top, rgba(250,250,250,1) 0%, rgba(250,250,250,1) 49%, rgba(224,224,224,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(250,250,250,1)), color-stop(49%, rgba(250,250,250,1)), color-stop(100%, rgba(224,224,224,1)));
background: -webkit-linear-gradient(top, rgba(250,250,250,1) 0%, rgba(250,250,250,1) 49%, rgba(224,224,224,1) 100%);
background: -o-linear-gradient(top, rgba(250,250,250,1) 0%, rgba(250,250,250,1) 49%, rgba(224,224,224,1) 100%);
background: -ms-linear-gradient(top, rgba(250,250,250,1) 0%, rgba(250,250,250,1) 49%, rgba(224,224,224,1) 100%);
background: linear-gradient(to bottom, rgba(250,250,250,1) 0%, rgba(250,250,250,1) 49%, rgba(224,224,224,1) 100%); border: 3px solid #fff; border-radius: 10px }
.product-detail .anilong-pay .text { display:table-cell; width:100%; vertical-align:middle; text-align:center; }
.product-detail .anilong-pay span { position:absolute; width:178px; height:314px; top:0; left:-40px; bottom:0; margin-top:auto; margin-bottom:auto; }
.product-detail .fix-ani { position:relative; display:inline-block; width:100px; }
.product-detail .clash-alert { display:none; font-size:30px; color:#F00; text-align:center; }
.product-detail .thank { display:table-cell; position:relative; width:100%; vertical-align:middle; text-align:center; }
.product-detail .thank h2.big { font-size:80px; height:70px; }
.product-detail .animation-box { float:left; width:100%; height:80px; margin-top:20px; }
.product-detail .ani-thank { float:left; position:relative; width:100%; margin-top:30px; text-align:center; }
.product-detail .ani-thank span { position:absolute; left:0; right:0; margin-left:auto; margin-right:auto; }
.product-detail .box-point { display:inline-block; margin:0 auto; width:700px; padding-bottom:30px; padding-top:15px; background:#ffc600; border:1px solid #e0ae00; border-radius: 10px; }
.product-detail .icon-thank { position:absolute; width:80px; top:-30px; right:0; left:0; margin-left:auto; margin-right:auto; z-index:1; }
.product-detail .icon-thank img { display:inline-block; width:60px; margin-left:150px; }
.product-detail .box-qrcode { position:relative; width:314px; height:314px; margin:0 auto; margin-top:15px; padding:10px; text-align:center; background:#f9f9f9; border:2px solid #0077db; border-radius: 10px; }
.product-detail .box-qrcode img { width:100%; }
.product-detail .box-qrcode-box { display:table; width:100%; height:350px; }
.product-detail .box-qrcode-detail { display:table-cell; vertical-align:middle; }
.box-qrcode-fix { position:absolute; width:250px; height:250px; top:10px; right:10px; padding:10px; text-align:center; background:#f9f9f9; border:2px solid #ffd800; border-radius: 10px; z-index:99; }
.box-qrcode-fix img { width:100%; }
.product-detail .topup-pack { display:inline-block; margin:0 auto; margin-top:15px; margin-bottom:30px; width:700px; }
.product-detail .topup-pack ul { margin-left:-7.5px; margin-right:-7.5px; }
.product-detail .topup-pack li { float:left; width:50%; padding:0 7.5px; margin-bottom:15px; text-align:left; }
.product-detail .topup-pack li a { display:block; position:relative; width:100%; padding:10px 20px 10px 0; color:#fff; border-radius: 10px;
background: rgba(124,135,255,1);
background: -moz-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(124,135,255,1)), color-stop(100%, rgba(182,109,255,1)));
background: -webkit-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -o-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: -ms-linear-gradient(left, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
background: linear-gradient(to right, rgba(124,135,255,1) 0%, rgba(182,109,255,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7c87ff', endColorstr='#b66dff', GradientType=1 );
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
}
.product-detail .topup-pack li a:hover,.product-detail .topup-pack li a.current {
background: rgba(0,120,219,1);
background: -moz-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,120,219,1)), color-stop(100%, rgba(0,120,219,1)));
background: -webkit-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -o-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: -ms-linear-gradient(left, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
background: linear-gradient(to right, rgba(0,120,219,1) 0%, rgba(0,120,219,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078db', endColorstr='#0078db', GradientType=1 );
}
.product-detail .topup-pack li span { display:inline-block; width:160px; padding-left:60px; }
.product-detail .topup-pack li a:hover span,.product-detail .topup-pack li a.current span { background:url(../images/icon-check.png) no-repeat 20px center; }
.product-detail .topup-pack li small { color:#fff; font-size:25px; }
.product-detail .topup-pack li.fix-show { float:none; display:inline-block; }
.product-detail .topup-pack li.fix-show a.current span { background:none; }
.box-pluspoint { position:absolute; width:100%; height:602px; background:rgba(0,0,0,.8); z-index:1; left:0; top:0; }
.box-pluspoint .pluspoint { display:table; margin:0 auto; margin-top:100px; position:relative; width:80%; height:400px; text-align:center; background:#ffd800 ; border-radius: 10px; }
.box-pluspoint .detail { display:table-cell; vertical-align:middle; }
.box-timeout { display:none; position:absolute; width:100%; height:100%; background:rgba(0,0,0,.8); z-index:2; left:0; top:0; }
.box-timeout .lesstime { display:table; margin:0 auto; margin-top:300px; position:relative; width:80%; height:400px; text-align:center; background:#ffd800 ; border-radius: 10px; }
.box-timeout .detail { display:table-cell; vertical-align:middle; }
.box-timeout h2 { position:relative; font-weight:bold; font-size:50px; padding-bottom:0; line-height:1.2; }
.coin { float:left; width:35%; text-align:center; }
.banknote { float:left; width:65%; text-align:center; }
.count-time { position:absolute; width:150px; height:44px; top:5px; left:0; right:0; margin-left:auto; margin-right:auto; padding:0 10px; text-align:center; line-height:44px; color:#181818; text-transform:uppercase; font-weight:bold; background:#fcd402; border-radius: 30px; z-index:2; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.box-back { float:left; width:100%; padding:0 40px; }
.box-back a { display:inline-block; width:188px; height:50px; padding:0 10px; text-align:center; line-height:50px; color:#fff; text-transform:uppercase; font-size:34px; font-weight:bold;
background:#8e30f8;
border-radius: 30px; -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2); }
.box-back a:hover { color:#ffc800; background:#0077db; }
.box-back i.back { display:inline-block; width:32px; height:34px; margin-right:0; background:url(../images/icon-back.png) no-repeat left center; vertical-align:sub; }
.box-back i.cancle { display:inline-block; width:35px; height:34px; margin-right:15px; background:url(../images/icon-cancle.png) no-repeat left center; vertical-align:middle; }
.box-back i.ok { display:inline-block; width:35px; height:34px; margin-right:15px; background:url(../images/icon-ok.png) no-repeat left center; vertical-align:middle; }
.box-back i.edit { display:inline-block; width:35px; height:34px; margin-right:15px; background:url(../images/icon-edit.png) no-repeat left center; vertical-align:middle; }
.box-back span { display:inline-block; margin:0 20px; }
.view-ads { position:relative; width:100%; height:1920px; background:#ddd; }
.view-ads .content { position:relative; width:100%; height:100%; font-size: 70px;}
.view-ads .end-ads { display:none; position:absolute; width:100%; height:100%; background:rgba(0,0,0,.8); z-index:1; left:0; top:0; }
.view-ads .box-des { position:absolute; width:80%; height:400px; left:0; top:0; right:0; bottom:0; margin:auto; z-index:2; }
.view-ads .pluspoint { display:table; width:100%; height:400px; text-align:center; background:#ffd800 ; vertical-align:middle; border-radius: 10px; }
.view-ads .detail { display:table-cell; vertical-align:middle; }
.view-ads h2 {
position: relative;
font-weight: bold;
font-size: 60px;
padding-bottom: 0;
line-height: 1.2;
}
.view-ads p { font-size:40px; font-weight:bold; }
.but-ok a {background:#8e30f8;}
.but-edit a {background: rgba(145,44,247,1);
background: -moz-linear-gradient(left, rgba(145,44,247,1) 0%, rgba(91,105,255,1) 39%, rgba(91,105,255,1) 69%, rgba(145,44,247,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(145,44,247,1)), color-stop(39%, rgba(91,105,255,1)), color-stop(69%, rgba(91,105,255,1)), color-stop(100%, rgba(145,44,247,1)));
background: -webkit-linear-gradient(left, rgba(145,44,247,1) 0%, rgba(91,105,255,1) 39%, rgba(91,105,255,1) 69%, rgba(145,44,247,1) 100%);
background: -o-linear-gradient(left, rgba(145,44,247,1) 0%, rgba(91,105,255,1) 39%, rgba(91,105,255,1) 69%, rgba(145,44,247,1) 100%);
background: -ms-linear-gradient(left, rgba(145,44,247,1) 0%, rgba(91,105,255,1) 39%, rgba(91,105,255,1) 69%, rgba(145,44,247,1) 100%);
background: linear-gradient(to right, rgba(145,44,247,1) 0%, rgba(91,105,255,1) 39%, rgba(91,105,255,1) 69%, rgba(145,44,247,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#912cf7', endColorstr='#912cf7', GradientType=1 );}
.footer-ads { float:left; width:100%; }
.footer-ads img { display:block; }
.footer { float:left; width:100%; height:40px; background:#181818; }
.footer .copy { float:left; width:100%; color:#ffd800; line-height:40px; font-size:22px; text-align:center; }
.footer .copy p { padding:0; }
.with-pads { position:relative; padding-top:15px; }
.pads-number { display:none; position:absolute; width:290px; padding:10px; left:0; right:0; margin-left:auto; margin-right:auto; margin-top:4px; background:#329ffb; border-radius: 10px; z-index:99; -webkit-box-shadow: 0px 10px 35px -5px rgba(0,0,0,0.42);
-moz-box-shadow: 0px 10px 35px -5px rgba(0,0,0,0.42);
box-shadow: 0px 10px 35px -5px rgba(0,0,0,0.42); }
.pads-number li { float:left; width:80px; height:80px; margin:5px; text-align:center;}
.pads-number li a { display:list-item; width:100%; height:100%; color:#fff; font-family:'robotobold','DB Helvethaica X 45 Li'; line-height:76px; font-size:36px; font-weight:bold; background:#0077db; border-radius: 10px; }
.pads-number li a:hover { background:#8218ed; }
.pads-number li img { display:inline-block; vertical-align: sub; padding-bottom: 3px; }
.pads-keyboard { display:none; position:absolute; width:720px; padding:10px; left:-10px; right:0; margin-left:auto; margin-right:auto; margin-top:4px; background:#329ffb; border-radius: 10px; z-index:99; -webkit-box-shadow: 0px 10px 35px -5px rgba(0,0,0,0.42);
-moz-box-shadow: 0px 10px 35px -5px rgba(0,0,0,0.42);
box-shadow: 0px 10px 35px -5px rgba(0,0,0,0.42); }
.pads-keyboard ul { float:left; width:100%; text-align:center; }
.pads-keyboard li { display:inline-block; width:60px; height:60px; margin-left:4px; margin-top:5px; margin-bottom:5px; text-align:center;}
.pads-keyboard li a { display:list-item; width:100%; height:100%; color:#fff; font-family:'robotobold','DB Helvethaica X 45 Li'; line-height:56px; font-size:36px; font-weight:bold; background:#0077db; border-radius: 10px; }
.pads-keyboard li a:hover { background:#8218ed; }
.pads-keyboard li img { display:inline-block; vertical-align: sub; padding-bottom: 3px; vertical-align:middle; }
.height-604 { height:604px !important; }
.fade-flash { animation: fadeIn 0.8s infinite ; }
.animation-x { -webkit-animation: bounce 0.7s infinite; -moz-animation: bounce 0.7s infinite; -ms-animation: bounce 0.7s infinite; -o-animation: bounce 0.7s infinite; animation: bounce 0.7s infinite; }
@-webkit-keyframes bounce {
0%, 100% {transform: translateX(0);}
50% {transform: translateX(-10px);}
50% {transform: translateX(10px);}
}
@-moz-keyframes bounce {
0%, 100% {transform: translateX(0);}
50% {transform: translateX(-10px);}
50% {transform: translateX(10px);}
}
@-o-keyframes bounce {
0%, 100% {transform: translateX(0);}
50% {transform: translateX(-10px);}
50% {transform: translateX(10px);}
}
@keyframes bounce {
0%, 100% {transform: translateX(0);}
50% {transform: translateX(-10px);}
50% {transform: translateX(10px);}
}
.animation-y { -webkit-animation: bounce-y 0.7s infinite; -moz-animation: bounce-y 0.7s infinite; -ms-animation: bounce-y 0.7s infinite; -o-animation: bounce-y 0.7s infinite; animation: bounce-y 0.7s infinite; }
@-webkit-keyframes bounce-y {
0%, 100% {transform: translateY(0);}
50% {transform: translateY(-10px);}
50% {transform: translateY(10px);}
}
@-moz-keyframes bounce-y {
0%, 100% {transform: translateY(0);}
50% {transform: translateY(-10px);}
50% {transform: translateY(10px);}
}
@-o-keyframes bounce-y {
0%, 100% {transform: translateY(0);}
50% {transform: translateY(-10px);}
50% {transform: translateY(10px);}
}
@keyframes bounce-y {
0%, 100% {transform: translateY(0);}
50% {transform: translateY(-10px);}
50% {transform: translateY(10px);}
} | {
"content_hash": "db18826ca669addc5d5f6ecf3493bacc",
"timestamp": "",
"source": "github",
"line_count": 650,
"max_line_length": 338,
"avg_line_length": 83.91846153846154,
"alnum_prop": 0.7109465231818431,
"repo_name": "hlex/vms",
"id": "c56c6965dccc0348df977117f41694a3ec4e3db1",
"size": "54547",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/css/legacy.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "560351"
},
{
"name": "HTML",
"bytes": "110424"
},
{
"name": "JavaScript",
"bytes": "440614"
}
],
"symlink_target": ""
} |
CHANGELOG
=========
### 2013-12-05
* [BC BREAK] Move some classes to SonataCoreBundle, you need to add a new dependency
### 2013-11-23
* [BC BREAK] added ``getBatchActions`` to the AdminInterface
If you do not extend the Admin class, you need to add this method to
your admin.
### 2013-10-13
* [BC BREAK] added ``setCurrentChild``, ``getCurrentChild`` to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
### 2013-10-05
* [BC BREAK] added ``getExportFormats``, ``getDataSourceIterator`` to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
### 2013-10-01
* [BC BREAK] added ``supportsPreviewMode`` to the AdminInterface
If you do not extend the Admin class, you need to add this method to
your admin.
### 2013-09-30
* [BC BREAK] added ``getFilterParameters`` to the AdminInterface
If you do not extend the Admin class, you need to add this method to
your admin.
### 2013-09-27
* [BC BREAK] added ``hasParentFieldDescription``, ``getPersistentParameters``,
``getParentFieldDescription``, ``getUniqid``, ``getBaseCodeRoute``,
``getIdParameter`` to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
* added support for select2 (jQuery based replacement for select boxes)
### 2013-09-23
* change list's action buttons to use ``btn-small`` from twitter bootstrap
### 2013-09-20
* [BC BREAK] added ``getTranslator``, ``getForm``, ``getBreadcrumbs``
to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
### 2013-09-13
* [BC BREAK] added ``getMaxPerPage``, ``setMaxPerPage``, ``setPage``,
``setQuery ``, ``getResults`` to the PagerInterface
If you do not extend the Pager class, you need to add these methods to
your pager.
* [BC BREAK] added ``isActive`` to the FilterInterface
If you do not extend the Filter class, you need to add this method to
your filter.
### 2013-09-11
* [BC BREAK] added ``hasShowFieldDescription``, ``hasListFieldDescription``,
``removeListFieldDescription``, ``removeFilterFieldDescription``,
``hasFilterFieldDescription`` to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
* [BC BREAK] added ``reorderFilters`` to the DatagridInterface
If you do not extend the Datagrid class, you need to add this method to
your Datagrid.
### 2013-09-05
* [BC BREAK] added ``getListBuilder``, ``getDatagridBuilder``, ``setBaseControllerName``,
``getBaseControllerName``, ``getFormFieldDescriptions``, ``getRoutes``, ``getFilterFieldDescriptions``,
``getListFieldDescriptions``, ``isChild`` to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
### 2013-08-30
* [BC BREAK] added ``getLabel``, ``removeShowFieldDescription``, ``getShowGroups``,
``setShowGroups``, ``reorderShowGroup`` to the AdminInterface
If you do not extend the Admin class, you need to add these methods to
your admin.
### 2013-07-26
* [BC BREAK] added alterNewInstance to AdminExtensionInterface
If you do not extend the AdminExtension, you need to add an empty method to
your extension classes:
public function alterNewInstance(AdminInterface $admin, $object)
{}
* [BC BREAK] added hasRequest to the AdminInterface
If you do not extend the Admin class, you need to add a hasRequest method to
your admin like this (depending on how you handle the request you return in
getRequest:
public function hasRequest()
{
return null !== $this->request;
}
### 2013-07-23
* [BC BREAK] changed route name/pattern guesser to be more acurate and
persistance layer agnostic, this might affect you if you use a namespace scheme
similar to the examples below:
* **Before** - admin for `Symfony\Cmf\Bundle\FoobarBundle\Document\Bar` generated base route name `admin_bundle_foobar_bar` and base pattern `/cmf/bundle/bar`
* **After** - admin for `Symfony\Cmf\Bundle\FoobarBundle\Document\Bar` generates `admin_cmf_foobar_bar` and `/cmf/foobar/bar`
### 2013-07-05
* Remove qTip
### 2012-11-25
* [BC BREAK] change the configureSideMenu signature to use the AdminInterface
- protected function configureSideMenu(MenuItemInterface $menu, $action, Admin $childAdmin = null)
+ protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
### 2012-08-05
* [BC BREAK] remove ``getListTemplate``, ``getEditTemplate``, ``getShowTemplate`` => just use ``getTemplate('edit')``
* add a ``delete`` template configuration entry
### 2012-06-05
* [BC BREAK] Fix bug introduces by 09334d81, now an admin must have the role ``ROLE_SONATA_ADMIN`` to see the top bar navigation
### 2012-05-31
* Update batch action confirmation message (breaks some translations)
### 2012-05-02
* [BC BREAK] add ProxyQueryInterface hint into the FilterInterface class
### 2012-03-07
* [BC BREAK] Extension : refactor the AdminExtensionInterface to use the proper AdminInterface, add a new configureQuery method
* Add export to xls format (html file)
### 2012-03-01
* [BC BREAK] Introduce Block Into the Admin Bundle
* The AdminBundle has now a dependency to BlockBundle : http://github.com/sonata-project/SonataBlockBundle
* The dashboard list is now a block, so it can be removed from the sonata_admin configuration.
* More blocks can be created please follow the instruction here : http://sonata-project.org/bundles/block/master/doc/reference/your_first_block.html
* [BC BREAK] New configuration format for the dashboard section.
### 2012-02-28
* Add export feature to csv, xml, json
The AdminBundle has now a new dependency to exporter : https://github.com/sonata-project/exporter
### 2011-09-04
* Add a delete option on widget with edit = list
* Refactoring the Menu/Breadcrumb management due to a change in the KnpLab Menu lib
### 2011-08-03
* remove property definitions
* add TypeGuesser for list/show/filter
* refactor [Form|List|Filter|Show]|Mapper to match the Symfony2 Form API
* add theme form definition from within the Admin class - default : SonataAdminBundle:Form:admin_fields.html.twig
* add new twig block type names to allows custom widget layouts per admin
* add show
### 2011-04-01
* migrate to the new form framework
### 2011-03-03
* add sortable option
### 2011-02-08
* add prototype for nested admin
### 2011-02-07
* refactor code to use builder (FormBuilder, DatagradBuilder, FilterBuilder)
### 2011-02-02
* starting to use the form.field_factory service
* update code to integrate the last symfony changes
### 2011-01-24
* add list mode
* add 'add_empty' option to association widget (ie: select)
* add country field type
* refactor the form creation
### 2011-01-18
* respect symfony conventions
* add new base edit template (standard and inline)
* admin instances are not singletons anymore
* add inline edition
### 2011-01-15
* respect symfony conventions
* add a FieldDescription
* register routes by using the getUrls from each Admin class
* build admin information "on demand"
* create an EntityAdmin and add new abstract method into the Admin class
* add inline edition for one-to-one association
| {
"content_hash": "c19835414a003c0482188d4d1e427258",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 163,
"avg_line_length": 32.47787610619469,
"alnum_prop": 0.7325613079019073,
"repo_name": "PhilippeGremmel/fromage_symfony",
"id": "ae3af42591863107254cc54cf1d345247a8b311c",
"size": "7340",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "vendor/sonata-project/admin-bundle/Sonata/AdminBundle/CHANGELOG.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "45902"
},
{
"name": "JavaScript",
"bytes": "207894"
},
{
"name": "PHP",
"bytes": "74267"
},
{
"name": "Perl",
"bytes": "2647"
},
{
"name": "Shell",
"bytes": "1680"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="da" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About GammaCoin</source>
<translation>Om GammaCoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>GammaCoin</b> version</source>
<translation><b>GammaCoin</b> version</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation>
Dette program er ekperimentielt.
Det er gjort tilgængeligt under MIT/X11-softwarelicensen. Se den tilhørende fil "COPYING" eller http://www.opensource.org/licenses/mit-license.php.
Produktet indeholder software som er udviklet af OpenSSL Project til brug i OpenSSL Toolkit (http://www.openssl.org/), kryptografisk software skrevet af Eric Young ([email protected]) og UPnP-software skrevet af Thomas Bernard.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Copyright</translation>
</message>
<message>
<location line="+0"/>
<source>The GammaCoin developers</source>
<translation>GammaCoin-udviklerne</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adressebog</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Dobbeltklik for at redigere adresse eller mærkat</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Opret en ny adresse</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopier den valgte adresse til systemets udklipsholder</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>Ny adresse</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your GammaCoin 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>Dette er dine GammaCoin-adresser til at modtage betalinger med. Du kan give en forskellig adresse til hver afsender, så du kan holde styr på, hvem der betaler dig.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>Kopier adresse</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Vis QR-kode</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a GammaCoin address</source>
<translation>Underskriv en besked for at bevise, at en GammaCoin-adresse tilhører dig</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Underskriv besked</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Slet den markerede adresse fra listen</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Eksportér den aktuelle visning til en fil</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation>Eksporter</translation>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified GammaCoin address</source>
<translation>Efterprøv en besked for at sikre, at den er underskrevet med den angivne GammaCoin-adresse</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>Efterprøv besked</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>Slet</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your GammaCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>Disse er dine GammaCoin-adresser for at sende betalinger. Tjek altid beløb og modtageradresse, inden du sender gammacoins.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Kopier mærkat</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>Rediger</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Send gammacoins</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Eksporter adressebogsdata</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommasepareret fil (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Fejl under eksport</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kunne ikke skrive til filen %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Mærkat</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(ingen mærkat)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Adgangskodedialog</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Indtast adgangskode</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Ny adgangskode</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Gentag ny adgangskode</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Indtast den nye adgangskode til tegnebogen.<br/>Brug venligst en adgangskode på <b>10 eller flere tilfældige tegn</b> eller <b>otte eller flere ord</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Krypter tegnebog</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Denne funktion har brug for din tegnebogs adgangskode for at låse tegnebogen op.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Lås tegnebog op</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Denne funktion har brug for din tegnebogs adgangskode for at dekryptere tegnebogen.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dekrypter tegnebog</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Skift adgangskode</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Indtast den gamle og den nye adgangskode til tegnebogen.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Bekræft tegnebogskryptering</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR GAMMACOINS</b>!</source>
<translation>Advarsel: Hvis du krypterer din tegnebog og mister din adgangskode, vil du <b>MISTE ALLE DINE GAMMACOINS</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Er du sikker på, at du ønsker at kryptere din tegnebog?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>VIGTIGT: Enhver tidligere sikkerhedskopi, som du har lavet af tegnebogsfilen, bør blive erstattet af den nyligt genererede, krypterede tegnebogsfil. Af sikkerhedsmæssige årsager vil tidligere sikkerhedskopier af den ikke-krypterede tegnebogsfil blive ubrugelig i det øjeblik, du starter med at anvende den nye, krypterede tegnebog.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Advarsel: Caps Lock-tasten er aktiveret!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Tegnebog krypteret</translation>
</message>
<message>
<location line="-56"/>
<source>GammaCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your gammacoins from being stolen by malware infecting your computer.</source>
<translation>GammaCoin vil nu lukke for at gennemføre krypteringsprocessen. Husk på, at kryptering af din tegnebog vil ikke beskytte dine gammacoins fuldt ud mod at blive stjålet af malware på din computer.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Tegnebogskryptering mislykkedes</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Tegnebogskryptering mislykkedes på grund af en intern fejl. Din tegnebog blev ikke krypteret.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>De angivne adgangskoder stemmer ikke overens.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Tegnebogsoplåsning mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Den angivne adgangskode for tegnebogsdekrypteringen er forkert.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Tegnebogsdekryptering mislykkedes</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Tegnebogens adgangskode blev ændret.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Underskriv besked...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Synkroniserer med netværk...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>Oversigt</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Vis generel oversigt over tegnebog</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>Transaktioner</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Gennemse transaktionshistorik</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Rediger listen over gemte adresser og mærkater</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Vis listen over adresser for at modtage betalinger</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>Luk</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Afslut program</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about GammaCoin</source>
<translation>Vis informationer om GammaCoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Om Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Vis informationer om Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>Indstillinger...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>Krypter tegnebog...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>Sikkerhedskopier tegnebog...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>Skift adgangskode...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Importerer blokke fra disken...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Genindekserer blokke på disken...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a GammaCoin address</source>
<translation>Send gammacoins til en GammaCoin-adresse</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for GammaCoin</source>
<translation>Rediger konfigurationsindstillinger af GammaCoin</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Lav sikkerhedskopi af tegnebogen til et andet sted</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Skift adgangskode anvendt til tegnebogskryptering</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>Fejlsøgningsvindue</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Åbn fejlsøgnings- og diagnosticeringskonsollen</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>Efterprøv besked...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>GammaCoin</source>
<translation>GammaCoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Tegnebog</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>Send</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>Modtag</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>Adresser</translation>
</message>
<message>
<location line="+22"/>
<source>&About GammaCoin</source>
<translation>Om GammaCoin</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>Vis/skjul</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Vis eller skjul hovedvinduet</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Krypter de private nøgler, der hører til din tegnebog</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your GammaCoin addresses to prove you own them</source>
<translation>Underskriv beskeder med dine GammaCoin-adresser for at bevise, at de tilhører dig</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified GammaCoin addresses</source>
<translation>Efterprøv beskeder for at sikre, at de er underskrevet med de(n) angivne GammaCoin-adresse(r)</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>Fil</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>Indstillinger</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>Hjælp</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Faneværktøjslinje</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnetværk]</translation>
</message>
<message>
<location line="+47"/>
<source>GammaCoin client</source>
<translation>GammaCoin-klient</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to GammaCoin network</source>
<translation><numerusform>%n aktiv(e) forbindelse(r) til GammaCoin-netværket</numerusform><numerusform>%n aktiv(e) forbindelse(r) til GammaCoin-netværket</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation>Ingen blokkilde tilgængelig...</translation>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation>%1 ud af %2 (estimeret) blokke af transaktionshistorikken er blevet behandlet.</translation>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>%1 blokke af transaktionshistorikken er blevet behandlet.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n time(r)</numerusform><numerusform>%n time(r)</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n dag(e)</numerusform><numerusform>%n dag(e)</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n uge(r)</numerusform><numerusform>%n uge(r)</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation>%1 bagefter</translation>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>Senest modtagne blok blev genereret for %1 siden.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation>Transaktioner herefter vil endnu ikke være synlige.</translation>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Fejl</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Advarsel</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Information</translation>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation>Transaktionen overskrider størrelsesgrænsen. Du kan stadig sende den for et gebyr på %1, hvilket går til de knuder, der behandler din transaktion og hjælper med at understøtte netværket. Vil du betale gebyret?</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Opdateret</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Indhenter...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Bekræft transaktionsgebyr</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Afsendt transaktion</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Indgående transaktion</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Dato: %1
Beløb: %2
Type: %3
Adresse: %4
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI-håndtering</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid GammaCoin address or malformed URI parameters.</source>
<translation>URI kan ikke fortolkes! Dette kan skyldes en ugyldig GammaCoin-adresse eller misdannede URI-parametre.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Tegnebog er <b>krypteret</b> og i øjeblikket <b>ulåst</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Tegnebog er <b>krypteret</b> og i øjeblikket <b>låst</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. GammaCoin can no longer continue safely and will quit.</source>
<translation>Der opstod en fatal fejl. GammaCoin kan ikke længere fortsætte sikkert og vil afslutte.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Netværksadvarsel</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Rediger adresse</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>Mærkat</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Mærkaten forbundet med denne post i adressebogen</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>Adresse</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>Adressen tilknyttet til denne post i adressebogen. Dette kan kun ændres for afsendelsesadresser.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Ny modtagelsesadresse</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Ny afsendelsesadresse</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Rediger modtagelsesadresse</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Rediger afsendelsesadresse</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Den indtastede adresse "%1" er allerede i adressebogen.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid GammaCoin address.</source>
<translation>Den indtastede adresse "%1" er ikke en gyldig GammaCoin-adresse.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Kunne ikke låse tegnebog op.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Ny nøglegenerering mislykkedes.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>GammaCoin-Qt</source>
<translation>GammaCoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>version</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Anvendelse:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>kommandolinjetilvalg</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Brugergrænsefladeindstillinger</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Angiv sprog, f.eks "de_DE" (standard: systemlokalitet)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Start minimeret</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Vis opstartsbillede ved start (standard: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Indstillinger</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>Generelt</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation>Valgfrit transaktionsgebyr pr. kB, der hjælper dine transaktioner med at blive behandlet hurtigt. De fleste transaktioner er på 1 kB.</translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Betal transaktionsgebyr</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start GammaCoin after logging in to the system.</source>
<translation>Start GammaCoin automatisk, når der logges ind på systemet</translation>
</message>
<message>
<location line="+3"/>
<source>&Start GammaCoin on system login</source>
<translation>Start GammaCoin, når systemet startes</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>Nulstil alle klientindstillinger til deres standard.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>Nulstil indstillinger</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>Netværk</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the GammaCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Åbn GammaCoin-klientens port på routeren automatisk. Dette virker kun, når din router understøtter UPnP og UPnP er aktiveret.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Konfigurer port vha. UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the GammaCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Opret forbindelse til GammaCoin-netværket via en SOCKS-proxy (f.eks. ved tilslutning gennem Tor)</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>Forbind gennem SOCKS-proxy:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Proxy-IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>IP-adressen på proxyen (f.eks. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>Port:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Porten på proxyen (f.eks. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS-version</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>SOCKS-version af proxyen (f.eks. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>Vindue</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Vis kun et statusikon efter minimering af vinduet.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>Minimer til statusfeltet i stedet for proceslinjen</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Minimer i stedet for at afslutte programmet, når vinduet lukkes. Når denne indstilling er valgt, vil programmet kun blive lukket, når du har valgt Afslut i menuen.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>Minimer ved lukning</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>Visning</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Brugergrænsefladesprog:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting GammaCoin.</source>
<translation>Brugergrænsefladesproget kan angives her. Denne indstilling træder først i kraft, når GammaCoin genstartes.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>Enhed at vise beløb i:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Vælg den standard underopdelingsenhed, som skal vises i brugergrænsefladen og ved afsendelse af gammacoins.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show GammaCoin addresses in the transaction list or not.</source>
<translation>Afgør hvorvidt GammaCoin-adresser skal vises i transaktionslisten eller ej.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>Vis adresser i transaktionsliste</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>Annuller</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>Anvend</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>standard</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>Bekræft nulstilling af indstillinger</translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>Nogle indstillinger kan kræve, at klienten genstartes, før de træder i kraft.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>Ønsker du at fortsætte?</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Advarsel</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting GammaCoin.</source>
<translation>Denne indstilling træder i kraft, efter GammaCoin genstartes.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Ugyldig proxy-adresse</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Formular</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the GammaCoin network after a connection is established, but this process has not completed yet.</source>
<translation>Den viste information kan være forældet. Din tegnebog synkroniserer automatisk med GammaCoin-netværket, når en forbindelse etableres, men denne proces er ikke gennemført endnu.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Ubekræftede:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Tegnebog</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Umodne:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Udvunden saldo, som endnu ikke er modnet</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Nyeste transaktioner</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Din nuværende saldo</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Summen af transaktioner, der endnu ikke er bekræftet og endnu ikke er inkluderet i den nuværende saldo</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>ikke synkroniseret</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start gammacoin: click-to-pay handler</source>
<translation>Kan ikke starte gammacoin: click-to-pay-håndtering</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR-kode-dialog</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Anmod om betaling</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Beløb:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Mærkat:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Besked:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>Gem som...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Fejl ved kodning fra URI til QR-kode</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Det indtastede beløb er ugyldig, tjek venligst.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Resulterende URI var for lang; prøv at forkorte teksten til mærkaten/beskeden.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Gem QR-kode</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG-billeder (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Klientnavn</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Klientversion</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>Information</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Anvendt OpenSSL-version</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Opstartstid</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Netværk</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Antal forbindelser</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Tilsluttet testnetværk</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blokkæde</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Nuværende antal blokke</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Estimeret antal blokke</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Tidsstempel for seneste blok</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>Åbn</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Kommandolinjetilvalg</translation>
</message>
<message>
<location line="+7"/>
<source>Show the GammaCoin-Qt help message to get a list with possible GammaCoin command-line options.</source>
<translation>Vis GammaCoin-Qt-hjælpebeskeden for at få en liste over de tilgængelige GammaCoin-kommandolinjeindstillinger.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>Vis</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>Konsol</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Byggedato</translation>
</message>
<message>
<location line="-104"/>
<source>GammaCoin - Debug window</source>
<translation>GammaCoin - Fejlsøgningsvindue</translation>
</message>
<message>
<location line="+25"/>
<source>GammaCoin Core</source>
<translation>GammaCoin Core</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Fejlsøgningslogfil</translation>
</message>
<message>
<location line="+7"/>
<source>Open the GammaCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Åbn GammaCoin-fejlsøgningslogfilen fra det nuværende datakatalog. Dette kan tage nogle få sekunder for en store logfiler.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Ryd konsol</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the GammaCoin RPC console.</source>
<translation>Velkommen til GammaCoin RPC-konsollen</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Brug op og ned-piletasterne til at navigere historikken og <b>Ctrl-L</b> til at rydde skærmen.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Tast <b>help</b> for en oversigt over de tilgængelige kommandoer.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Send gammacoins</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Send til flere modtagere på en gang</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Tilføj modtager</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Fjern alle transaktionsfelter</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Ryd alle</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123,456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Bekræft afsendelsen</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>Afsend</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> til %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Bekræft afsendelse af gammacoins</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Er du sikker på, at du vil sende %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> og </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Modtagerens adresse er ikke gyldig. Tjek venligst adressen igen.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Beløbet til betaling skal være større end 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Beløbet overstiger din saldo.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Totalen overstiger din saldo, når %1 transaktionsgebyr er inkluderet.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Duplikeret adresse fundet. Du kan kun sende til hver adresse en gang pr. afsendelse.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Fejl: Oprettelse af transaktionen mislykkedes!</translation>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Fejl: Transaktionen blev afvist. Dette kan ske, hvis nogle af dine gammacoins i din tegnebog allerede er brugt, som hvis du brugte en kopi af wallet.dat og dine gammacoins er blevet brugt i kopien, men ikke er markeret som brugt her.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Formular</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Beløb:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Betal til:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>GammaCoin-adressen som betalingen skal sendes til (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Indtast en mærkat for denne adresse for at føje den til din adressebog</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>Mærkat:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Vælg adresse fra adressebog</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Indsæt adresse fra udklipsholderen</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Fjern denne modtager</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a GammaCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Indtast en GammaCoin-adresse (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Underskrifter - Underskriv/efterprøv en besked</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>Underskriv besked</translation>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Du kan underskrive beskeder med dine GammaCoin-adresser for at bevise, at de tilhører dig. Pas på ikke at underskrive noget vagt, da phisingangreb kan narre dig til at overdrage din identitet. Underskriv kun fuldt detaljerede udsagn, du er enig i.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>GammaCoin-adressen som beskeden skal underskrives med (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Vælg adresse fra adressebog</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Indsæt adresse fra udklipsholderen</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Indtast beskeden, du ønsker at underskrive</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>Underskrift</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopier den nuværende underskrift til systemets udklipsholder</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this GammaCoin address</source>
<translation>Underskriv denne besked for at bevise, at GammaCoin-adressen tilhører dig</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Underskriv besked</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Nulstil alle underskriv besked-indtastningsfelter</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Ryd alle</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>Efterprøv besked</translation>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Indtast den underskrevne adresse, beskeden (inkluder linjeskift, mellemrum mv. nøjagtigt, som de fremgår) og underskriften for at efterprøve beskeden. Vær forsigtig med ikke at lægge mere i underskriften end besked selv, så du undgår at blive narret af et man-in-the-middle-angreb.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>GammaCoin-adressen som beskeden er underskrevet med (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified GammaCoin address</source>
<translation>Efterprøv beskeden for at sikre, at den er underskrevet med den angivne GammaCoin-adresse</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>Efterprøv besked</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Nulstil alle efterprøv besked-indtastningsfelter</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a GammaCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Indtast en GammaCoin-adresse (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Klik "Underskriv besked" for at generere underskriften</translation>
</message>
<message>
<location line="+3"/>
<source>Enter GammaCoin signature</source>
<translation>Indtast GammaCoin-underskriften</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Den indtastede adresse er ugyldig.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Tjek venligst adressen, og forsøg igen.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Den indtastede adresse henviser ikke til en nøgle.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Tegnebogsoplåsning annulleret.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Den private nøgle for den indtastede adresse er ikke tilgængelig.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Underskrivning af besked mislykkedes.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Besked underskrevet.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Underskriften kunne ikke afkodes.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Tjek venligst underskriften, og forsøg igen.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Underskriften matcher ikke beskedens indhold.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Efterprøvelse af besked mislykkedes.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Besked efterprøvet.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The GammaCoin developers</source>
<translation>GammaCoin-udviklerne</translation>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Åben indtil %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/ubekræftet</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 bekræftelser</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Status</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, transmitteret igennem %n knude(r)</numerusform><numerusform>, transmitteret igennem %n knude(r)</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Kilde</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Genereret</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Fra</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Til</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>egen adresse</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>mærkat</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Kredit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>modner efter yderligere %n blok(ke)</numerusform><numerusform>modner efter yderligere %n blok(ke)</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>ikke accepteret</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debet</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Transaktionsgebyr</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Nettobeløb</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Besked</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Kommentar</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Transaktionens ID</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Genererede gammacoins skal vente 120 blokke, før de kan blive brugt. Da du genererede denne blok, blev den transmitteret til netværket for at blive føjet til blokkæden. Hvis det mislykkes at komme ind i kæden, vil den skifte til "ikke godkendt" og ikke blive kunne bruges. Dette kan lejlighedsvis ske, hvis en anden knude genererer en blok inden for få sekunder af din.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Fejlsøgningsinformation</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transaktion</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>Input</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Beløb</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>sand</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>falsk</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, er ikke blevet transmitteret endnu</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Åben %n blok yderligere</numerusform><numerusform>Åben %n blokke yderligere</numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>ukendt</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transaktionsdetaljer</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Denne rude viser en detaljeret beskrivelse af transaktionen</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Beløb</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Åben %n blok(ke) yderligere</numerusform><numerusform>Åben %n blok(ke) yderligere</numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Åben indtil %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Offline (%1 bekræftelser)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Ubekræftet (%1 af %2 bekræftelser)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Bekræftet (%1 bekræftelser)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>Udvunden saldo, som vil være tilgængelig, når den modner efter yderligere %n blok(ke)</numerusform><numerusform>Udvunden saldo, som vil være tilgængelig, når den modner efter yderligere %n blok(ke)</numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Denne blok blev ikke modtaget af nogen andre knuder og vil formentlig ikke blive accepteret!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Genereret, men ikke accepteret</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Modtaget med</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Modtaget fra</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Sendt til</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Betaling til dig selv</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Udvundne</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(n/a)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transaktionsstatus. Hold musen over dette felt for at vise antallet af bekræftelser.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Dato og klokkeslæt for modtagelse af transaktionen.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Transaktionstype.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Destinationsadresse for transaktion.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Beløb fjernet eller tilføjet balance.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Alle</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>I dag</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Denne uge</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Denne måned</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Sidste måned</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Dette år</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Interval...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Modtaget med</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Sendt til</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Til dig selv</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Udvundne</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Andet</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Indtast adresse eller mærkat for at søge</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimumsbeløb</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopier adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopier mærkat</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopier beløb</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Kopier transaktionens ID</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Rediger mærkat</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Vis transaktionsdetaljer</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Eksporter transaktionsdata</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommasepareret fil (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Bekræftet</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Mærkat</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Beløb</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Fejl under eksport</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kunne ikke skrive til filen %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Interval:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>til</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Send gammacoins</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation>Eksporter</translation>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Eksportér den aktuelle visning til en fil</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Sikkerhedskopier tegnebog</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Tegnebogsdata (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Foretagelse af sikkerhedskopi fejlede</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Der opstod en fejl i forbindelse med at gemme tegnebogsdata til det nye sted</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Sikkerhedskopieret problemfri</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Tegnebogsdata blev problemfrit gemt til det nye sted.</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>GammaCoin version</source>
<translation>GammaCoin-version</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Anvendelse:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or gammacoind</source>
<translation>Send kommando til -server eller gammacoind</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Liste over kommandoer</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Få hjælp til en kommando</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Indstillinger:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: gammacoin.conf)</source>
<translation>Angiv konfigurationsfil (standard: gammacoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: gammacoind.pid)</source>
<translation>Angiv pid-fil (default: gammacoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Angiv datakatalog</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Angiv databasecachestørrelse i megabytes (standard: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation>Lyt til forbindelser på <port> (standard: 9333 eller testnetværk: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Oprethold højest <n> forbindelser til andre i netværket (standard: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Forbind til en knude for at modtage adresse, og afbryd</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Angiv din egen offentlige adresse</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Grænse for afbrydelse til dårlige forbindelser (standard: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Antal sekunder dårlige forbindelser skal vente før reetablering (standard: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Der opstod en fejl ved angivelse af RPC-porten %u til at lytte på IPv4: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation>Lyt til JSON-RPC-forbindelser på <port> (standard: 9332 eller testnetværk: 19332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Accepter kommandolinje- og JSON-RPC-kommandoer</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Kør i baggrunden som en service, og accepter kommandoer</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Brug testnetværket</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Accepter forbindelser udefra (standard: 1 hvis hverken -proxy eller -connect)</translation>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=gammacoinrpc
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 "GammaCoin Alert" [email protected]
</source>
<translation>%s, du skal angive en RPC-adgangskode i konfigurationsfilen:
%s
Det anbefales, at du bruger nedenstående, tilfældige adgangskode:
rpcuser=gammacoinrpc
rpcpassword=%s
(du behøver ikke huske denne adgangskode)
Brugernavnet og adgangskode MÅ IKKE være det samme.
Hvis filen ikke eksisterer, opret den og giv ingen andre end ejeren læserettighed.
Det anbefales også at angive alertnotify, så du påmindes om problemer;
f.eks.: alertnotify=echo %%s | mail -s "GammaCoin Alert" [email protected]
</translation>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Der opstod en fejl ved angivelse af RPC-porten %u til at lytte på IPv6, falder tilbage til IPv4: %s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation>Tildel til den givne adresse og lyt altid på den. Brug [vært]:port-notation for IPv6</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. GammaCoin is probably already running.</source>
<translation>Kan ikke opnå lås på datakatalog %s. GammaCoin er sandsynligvis allerede startet.</translation>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Fejl: Transaktionen blev afvist. Dette kan ske, hvis nogle af dine gammacoins i din tegnebog allerede er brugt, som hvis du brugte en kopi af wallet.dat og dine gammacoins er blevet brugt i kopien, men ikke er markeret som brugt her.</translation>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation>Fejl: Denne transaktion kræver et transaktionsgebyr på minimum %s pga. dens størrelse, kompleksitet eller anvendelse af nyligt modtagne gammacoins!</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>Udfør kommando, når en relevant advarsel modtages (%s i kommandoen erstattes med beskeden)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Udfør kommando, når en transaktion i tegnebogen ændres (%s i kommandoen erstattes med TxID)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Angiv maksimumstørrelse for høj prioritet/lavt gebyr-transaktioner i bytes (standard: 27000)</translation>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation>Dette er en foreløbig testudgivelse - brug på eget ansvar - brug ikke til udvinding eller handelsprogrammer</translation>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Advarsel: -paytxfee er sat meget højt! Dette er det gebyr du vil betale, hvis du sender en transaktion.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation>Advarsel: Viste transaktioner kan være ukorrekte! Du eller andre knuder kan have behov for at opgradere.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong GammaCoin will not work properly.</source>
<translation>Advarsel: Undersøg venligst, at din computers dato og klokkeslæt er korrekt indstillet! Hvis der er fejl i disse, vil GammaCoin ikke fungere korrekt.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Advarsel: fejl under læsning af wallet.dat! Alle nøgler blev læst korrekt, men transaktionsdata eller adressebogsposter kan mangle eller være forkerte.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Advarsel: wallet.dat ødelagt, data reddet! Oprindelig wallet.net gemt som wallet.{timestamp}.bak i %s; hvis din saldo eller dine transaktioner er forkert, bør du genskabe fra en sikkerhedskopi.</translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Forsøg at genskabe private nøgler fra ødelagt wallet.dat</translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Blokoprettelsestilvalg:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Tilslut kun til de(n) angivne knude(r)</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>Ødelagt blokdatabase opdaget</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Find egen IP-adresse (standard: 1 når lytter og ingen -externalip)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>Ønsker du at genbygge blokdatabasen nu?</translation>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>Klargøring af blokdatabase mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation>Klargøring af tegnebogsdatabasemiljøet %s mislykkedes!</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>Indlæsning af blokdatabase mislykkedes</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>Åbning af blokdatabase mislykkedes</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Fejl: Mangel på ledig diskplads!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>Fejl: Tegnebog låst, kan ikke oprette transaktion!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Fejl: systemfejl: </translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Lytning på enhver port mislykkedes. Brug -listen=0, hvis du ønsker dette.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>Læsning af blokinformation mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation>Læsning af blok mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation>Synkronisering af blokindeks mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation>Skrivning af blokindeks mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation>Skrivning af blokinformation mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>Skrivning af blok mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation>Skriving af filinformation mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation>Skrivning af gammacoin-database mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation>Skrivning af transaktionsindeks mislykkedes</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation>Skrivning af genskabelsesdata mislykkedes</translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>Find ligeværdige ved DNS-opslag (standard: 1 hvis ikke -connect)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation>Generer gammacoins (standard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>Antal blokke som tjekkes ved opstart (0=alle, standard: 288)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation>Grundighed af efterprøvning af blokke (0-4, standard: 3)</translation>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation>For få tilgængelige fildeskriptorer.</translation>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation>Genbyg blokkædeindeks fra nuværende blk000??.dat filer</translation>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>Angiv antallet af tråde til at håndtere RPC-kald (standard: 4)</translation>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation>Efterprøver blokke...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>Efterprøver tegnebog...</translation>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Importerer blokke fra ekstern blk000??.dat fil</translation>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation>Angiv nummeret af skriptefterprøvningstråde (op til 16, 0 = automatisk, <0 = efterlad det antal kerner tilgængelige, standard: 0)</translation>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Information</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Ugyldig -tor adresse: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation>Ugyldigt beløb til -minrelaytxfee=<beløb>:'%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation>Ugyldigt beløb til -mintxfee=<beløb>:'%s'</translation>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation>Vedligehold et komplet transaktionsindeks (standard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Maksimum for modtagelsesbuffer pr. forbindelse, <n>*1000 bytes (standard: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maksimum for afsendelsesbuffer pr. forbindelse, <n>*1000 bytes (standard: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation>Accepter kun blokkæde, som matcher indbyggede kontrolposter (standard: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Tilslut kun til knuder i netværk <net> (IPv4, IPv6 eller Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Skriv ekstra fejlsøgningsinformation. Indebærer alle andre -debug* tilvalg</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Skriv ekstra netværksfejlsøgningsinformation</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Tilføj fejlsøgningsoutput med tidsstempel</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the GammaCoin Wiki for SSL setup instructions)</source>
<translation>SSL-indstillinger: (se GammaCoin Wiki for SSL-opsætningsinstruktioner)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Angiv version af SOCKS-proxyen (4-5, standard: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Send sporings-/fejlsøgningsinformation til konsollen i stedet for debug.log filen</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Send sporings-/fejlsøgningsinformation til fejlsøgningprogrammet</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Angiv maksimumblokstørrelse i bytes (standard: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Angiv minimumsblokstørrelse i bytes (standard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Formindsk debug.log filen ved klientopstart (standard: 1 hvis ikke -debug)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation>Underskrift af transaktion mislykkedes</translation>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Angiv tilslutningstimeout i millisekunder (standard: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Systemfejl: </translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation>Transaktionsbeløb er for lavt</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation>Transaktionsbeløb skal være positive</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation>Transaktionen er for stor</translation>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Forsøg at bruge UPnP til at konfigurere den lyttende port (standard: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Forsøg at bruge UPnP til at konfigurere den lyttende port (standard: 1 når lytter)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Brug proxy til at tilgå Tor Hidden Services (standard: som -proxy)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Brugernavn til JSON-RPC-forbindelser</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Advarsel</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Advarsel: Denne version er forældet, opgradering påkrævet!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation>Du skal genbygge databaserne med -reindex for at ændre -txindex</translation>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat ødelagt, redning af data mislykkedes</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Adgangskode til JSON-RPC-forbindelser</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Tillad JSON-RPC-forbindelser fra bestemt IP-adresse</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Send kommandoer til knude, der kører på <ip> (standard: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Udfør kommando, når den bedste blok ændres (%s i kommandoen erstattes med blokhash)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Opgrader tegnebog til seneste format</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Angiv nøglepoolstørrelse til <n> (standard: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Gennemsøg blokkæden for manglende tegnebogstransaktioner</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Brug OpenSSL (https) for JSON-RPC-forbindelser</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Servercertifikat-fil (standard: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Serverens private nøgle (standard: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Acceptable ciphers (standard: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Denne hjælpebesked</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Kunne ikke tildele %s på denne computer (bind returnerede fejl %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Tilslut via SOCKS-proxy</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Tillad DNS-opslag for -addnode, -seednode og -connect</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Indlæser adresser...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Fejl ved indlæsning af wallet.dat: Tegnebog ødelagt</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of GammaCoin</source>
<translation>Fejl ved indlæsning af wallet.dat: Tegnebog kræver en nyere version af GammaCoin</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart GammaCoin to complete</source>
<translation>Det var nødvendigt at genskrive tegnebogen: genstart GammaCoin for at gennemføre</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Fejl ved indlæsning af wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Ugyldig -proxy adresse: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Ukendt netværk anført i -onlynet: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Ukendt -socks proxy-version: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Kan ikke finde -bind adressen: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Kan ikke finde -externalip adressen: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Ugyldigt beløb for -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Ugyldigt beløb</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Manglende dækning</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Indlæser blokindeks...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Tilføj en knude til at forbinde til og forsøg at holde forbindelsen åben</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. GammaCoin is probably already running.</source>
<translation>Kunne ikke tildele %s på denne computer. GammaCoin kører sikkert allerede.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Gebyr pr. kB, som skal tilføjes til transaktioner, du sender</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Indlæser tegnebog...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Kan ikke nedgradere tegnebog</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Kan ikke skrive standardadresse</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Genindlæser...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Indlæsning gennemført</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>For at bruge %s mulighed</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Fejl</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Du skal angive rpcpassword=<password> i konfigurationsfilen:
%s
Hvis filen ikke eksisterer, opret den og giv ingen andre end ejeren læserettighed.</translation>
</message>
</context>
</TS> | {
"content_hash": "9bb3625aedae32a183da799f3ce7611a",
"timestamp": "",
"source": "github",
"line_count": 2938,
"max_line_length": 414,
"avg_line_length": 39.72328114363513,
"alnum_prop": 0.6352917991208753,
"repo_name": "nuggetbram/gammacoin",
"id": "6bc858eaeafab873ced8d17d66c32d5220688643",
"size": "117084",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_da.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "103297"
},
{
"name": "C++",
"bytes": "2527784"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "IDL",
"bytes": "14700"
},
{
"name": "Objective-C",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69719"
},
{
"name": "Shell",
"bytes": "9702"
},
{
"name": "TypeScript",
"bytes": "5240524"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using System.Runtime.InteropServices;
using SharpDX.Mathematics.Interop;
namespace SharpDX.Direct3D9
{
public partial class CubeTexture
{
/// <summary>
/// Initializes a new instance of the <see cref="CubeTexture"/> class.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="edgeLength">Length of the edge.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
public CubeTexture(Device device, int edgeLength, int levelCount, Usage usage, Format format, Pool pool = Pool.Managed) : base(IntPtr.Zero)
{
device.CreateCubeTexture(edgeLength, levelCount, (int)usage, format, pool, this, IntPtr.Zero);
}
/// <summary>
/// Initializes a new instance of the <see cref="CubeTexture"/> class.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="edgeLength">Length of the edge.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="sharedHandle">The shared handle.</param>
public CubeTexture(Device device, int edgeLength, int levelCount, Usage usage, Format format, Pool pool, ref IntPtr sharedHandle) : base(IntPtr.Zero)
{
unsafe
{
fixed (void* pSharedHandle = &sharedHandle)
device.CreateCubeTexture(edgeLength, levelCount, (int)usage, format, pool, this, (IntPtr)pSharedHandle);
}
}
/// <summary>
/// Checks texture-creation parameters.
/// </summary>
/// <param name="device">Device associated with the texture.</param>
/// <param name="size">Requested size of the texture. Null if </param>
/// <param name="mipLevelCount">Requested number of mipmap levels for the texture.</param>
/// <param name="usage">The requested usage for the texture.</param>
/// <param name="format">Requested format for the texture.</param>
/// <param name="pool">Memory class where the resource will be placed.</param>
/// <returns>A value type containing the proposed values to pass to the texture creation functions.</returns>
/// <unmanaged>HRESULT D3DXCheckCubeTextureRequirements([In] IDirect3DDevice9* pDevice,[InOut] unsigned int* pSize,[InOut] unsigned int* pNumMipLevels,[In] unsigned int Usage,[InOut] D3DFORMAT* pFormat,[In] D3DPOOL Pool)</unmanaged>
public static CubeTextureRequirements CheckRequirements(Device device, int size, int mipLevelCount, Usage usage, Format format, Pool pool)
{
var result = new CubeTextureRequirements
{
Size = size,
MipLevelCount = mipLevelCount,
Format = format
};
D3DX9.CheckCubeTextureRequirements(device, ref result.Size, ref result.MipLevelCount, (int)usage, ref result.Format, pool);
return result;
}
/// <summary>
/// Uses a user-provided function to fill each texel of each mip level of a given cube texture.
/// </summary>
/// <param name="callback">A function that is used to fill the texture.</param>
/// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
public void Fill(Fill3DCallback callback)
{
var handle = GCHandle.Alloc(callback);
try
{
D3DX9.FillCubeTexture(this, FillCallbackHelper.Native3DCallbackPtr, GCHandle.ToIntPtr(handle));
}
finally
{
handle.Free();
}
}
/// <summary>
/// Uses a compiled high-level shader language (HLSL) function to fill each texel of each mipmap level of a texture.
/// </summary>
/// <param name="shader">A texture shader object that is used to fill the texture.</param>
/// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
public void Fill(TextureShader shader)
{
D3DX9.FillCubeTextureTX(this, shader);
}
/// <summary>
/// Locks a rectangle on a cube texture resource.
/// </summary>
/// <param name="faceType">Type of the face.</param>
/// <param name="level">The level.</param>
/// <param name="flags">The flags.</param>
/// <returns>
/// A <see cref="DataRectangle"/> describing the region locked.
/// </returns>
/// <unmanaged>HRESULT IDirect3DCubeTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
public DataRectangle LockRectangle(SharpDX.Direct3D9.CubeMapFace faceType, int level, SharpDX.Direct3D9.LockFlags flags)
{
LockedRectangle lockedRect;
LockRectangle(faceType, level, out lockedRect, IntPtr.Zero, flags);
return new DataRectangle(lockedRect.PBits, lockedRect.Pitch);
}
/// <summary>
/// Locks a rectangle on a cube texture resource.
/// </summary>
/// <param name="faceType">Type of the face.</param>
/// <param name="level">The level.</param>
/// <param name="flags">The flags.</param>
/// <param name="stream">The stream pointing to the locked region.</param>
/// <returns>
/// A <see cref="DataRectangle"/> describing the region locked.
/// </returns>
/// <unmanaged>HRESULT IDirect3DCubeTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
public DataRectangle LockRectangle(SharpDX.Direct3D9.CubeMapFace faceType, int level, SharpDX.Direct3D9.LockFlags flags, out DataStream stream)
{
LockedRectangle lockedRect;
LockRectangle(faceType, level, out lockedRect, IntPtr.Zero, flags);
stream = new DataStream(lockedRect.PBits, lockedRect.Pitch * GetLevelDescription(level).Height, true, (flags & LockFlags.ReadOnly) == 0);
return new DataRectangle(lockedRect.PBits, lockedRect.Pitch);
}
/// <summary>
/// Locks a rectangle on a cube texture resource.
/// </summary>
/// <param name="faceType">Type of the face.</param>
/// <param name="level">The level.</param>
/// <param name="rectangle">The rectangle.</param>
/// <param name="flags">The flags.</param>
/// <returns>
/// A <see cref="DataRectangle"/> describing the region locked.
/// </returns>
/// <unmanaged>HRESULT IDirect3DCubeTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
public DataRectangle LockRectangle(SharpDX.Direct3D9.CubeMapFace faceType, int level, RawRectangle rectangle, SharpDX.Direct3D9.LockFlags flags) {
unsafe
{
LockedRectangle lockedRect;
LockRectangle(faceType, level, out lockedRect, new IntPtr(&rectangle), flags);
return new DataRectangle(lockedRect.PBits, lockedRect.Pitch);
}
}
/// <summary>
/// Locks a rectangle on a cube texture resource.
/// </summary>
/// <param name="faceType">Type of the face.</param>
/// <param name="level">The level.</param>
/// <param name="rectangle">The rectangle.</param>
/// <param name="flags">The flags.</param>
/// <param name="stream">The stream pointing to the locked region.</param>
/// <returns>
/// A <see cref="DataRectangle"/> describing the region locked.
/// </returns>
/// <unmanaged>HRESULT IDirect3DCubeTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
public DataRectangle LockRectangle(SharpDX.Direct3D9.CubeMapFace faceType, int level, RawRectangle rectangle, SharpDX.Direct3D9.LockFlags flags, out DataStream stream)
{
unsafe
{
LockedRectangle lockedRect;
LockRectangle(faceType, level, out lockedRect, new IntPtr(&rectangle), flags);
stream = new DataStream(lockedRect.PBits, lockedRect.Pitch * GetLevelDescription(level).Height, true, (flags & LockFlags.ReadOnly) == 0);
return new DataRectangle(lockedRect.PBits, lockedRect.Pitch);
}
}
/// <summary>
/// Adds a dirty region to a cube texture resource.
/// </summary>
/// <param name="faceType">Type of the face.</param>
/// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
/// <unmanaged>HRESULT IDirect3DCubeTexture9::AddDirtyRect([In] D3DCUBEMAP_FACES FaceType,[In] const void* pDirtyRect)</unmanaged>
public void AddDirtyRectangle(SharpDX.Direct3D9.CubeMapFace faceType)
{
AddDirtyRectangle(faceType, IntPtr.Zero);
}
/// <summary>
/// Adds a dirty region to a cube texture resource.
/// </summary>
/// <param name="faceType">Type of the face.</param>
/// <param name="dirtyRectRef">The dirty rect ref.</param>
/// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
/// <unmanaged>HRESULT IDirect3DCubeTexture9::AddDirtyRect([In] D3DCUBEMAP_FACES FaceType,[In] const void* pDirtyRect)</unmanaged>
public void AddDirtyRectangle(SharpDX.Direct3D9.CubeMapFace faceType, RawRectangle dirtyRectRef)
{
unsafe
{
AddDirtyRectangle(faceType, new IntPtr(&dirtyRectRef));
}
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a file
/// </summary>
/// <param name="device">The device.</param>
/// <param name="filename">The filename.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromFile(Device device, string filename)
{
CubeTexture cubeTexture;
D3DX9.CreateCubeTextureFromFileW(device, filename, out cubeTexture);
return cubeTexture;
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a file
/// </summary>
/// <param name="device">The device.</param>
/// <param name="filename">The filename.</param>
/// <param name="usage">The usage.</param>
/// <param name="pool">The pool.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromFile(Device device, string filename, Usage usage, Pool pool)
{
return FromFile(device, filename, -1, -1, usage, Format.Unknown, pool, Filter.Default, Filter.Default, 0);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a file
/// </summary>
/// <param name="device">The device.</param>
/// <param name="filename">The filename.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromFile(Device device, string filename, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey)
{
return CreateFromFile(device, filename, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, IntPtr.Zero, null);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a file
/// </summary>
/// <param name="device">The device.</param>
/// <param name="filename">The filename.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static unsafe CubeTexture FromFile(Device device, string filename, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation)
{
fixed (void* pImageInfo = &imageInformation)
return CreateFromFile(device, filename, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, null);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a file
/// </summary>
/// <param name="device">The device.</param>
/// <param name="filename">The filename.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static unsafe CubeTexture FromFile(Device device, string filename, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
{
palette = new PaletteEntry[256];
fixed (void* pImageInfo = &imageInformation)
return CreateFromFile(device, filename, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a memory buffer.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="buffer">The buffer.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemory([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromMemory(Device device, byte[] buffer)
{
CubeTexture cubeTexture;
unsafe
{
fixed (void* pData = buffer)
D3DX9.CreateCubeTextureFromFileInMemory(device, (IntPtr)pData, buffer.Length, out cubeTexture);
}
return cubeTexture;
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a memory buffer.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="buffer">The buffer.</param>
/// <param name="usage">The usage.</param>
/// <param name="pool">The pool.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromMemory(Device device, byte[] buffer, Usage usage, Pool pool)
{
return FromMemory(device, buffer, -1, -1, usage, Format.Unknown, pool, Filter.Default, Filter.Default, 0);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a memory buffer.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="buffer">The buffer.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey)
{
return CreateFromMemory(device, buffer, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, IntPtr.Zero, null);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a memory buffer.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="buffer">The buffer.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static unsafe CubeTexture FromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation)
{
fixed (void* pImageInfo = &imageInformation)
return CreateFromMemory(device, buffer, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, null);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a memory buffer.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="buffer">The buffer.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static unsafe CubeTexture FromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
{
palette = new PaletteEntry[256];
fixed (void* pImageInfo = &imageInformation)
return CreateFromMemory(device, buffer, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <returns>A <see cref="CubeTexture"/></returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemory([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromStream(Device device, Stream stream)
{
CubeTexture cubeTexture;
if (stream is DataStream)
{
D3DX9.CreateCubeTextureFromFileInMemory(device, ((DataStream)stream).PositionPointer, (int)(stream.Length - stream.Position), out cubeTexture);
}
else
{
unsafe
{
var data = Utilities.ReadStream(stream);
fixed (void* pData = data)
D3DX9.CreateCubeTextureFromFileInMemory(device, (IntPtr)pData, data.Length, out cubeTexture);
}
}
return cubeTexture;
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <param name="usage">The usage.</param>
/// <param name="pool">The pool.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromStream(Device device, Stream stream, Usage usage, Pool pool)
{
return FromStream(device, stream, 0, -1, -1, usage, Format.Unknown, pool, Filter.Default, Filter.Default, 0);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromStream(Device device, Stream stream, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey)
{
return FromStream(device, stream, 0, size, levelCount, usage, format, pool, filter, mipFilter, colorKey);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <param name="sizeBytes">The size bytes.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey)
{
return CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, IntPtr.Zero, null);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <param name="sizeBytes">The size bytes.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static unsafe CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation)
{
fixed (void* pImageInfo = &imageInformation)
return CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, null);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <param name="sizeBytes">The size bytes.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
public static unsafe CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
{
palette = new PaletteEntry[256];
fixed (void* pImageInfo = &imageInformation)
return CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette);
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="buffer">The buffer.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
private static unsafe CubeTexture CreateFromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
{
CubeTexture cubeTexture;
fixed (void* pBuffer = buffer)
cubeTexture = CreateFromPointer(
device,
(IntPtr)pBuffer,
buffer.Length,
size,
levelCount,
usage,
format,
pool,
filter,
mipFilter,
colorKey,
imageInformation,
palette
);
return cubeTexture;
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="stream">The stream.</param>
/// <param name="sizeBytes">The size bytes.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>A <see cref="CubeTexture"/></returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
private static unsafe CubeTexture CreateFromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
{
CubeTexture cubeTexture;
sizeBytes = sizeBytes == 0 ? (int)(stream.Length - stream.Position) : sizeBytes;
if (stream is DataStream)
{
cubeTexture = CreateFromPointer(
device,
((DataStream)stream).PositionPointer,
sizeBytes,
size,
levelCount,
usage,
format,
pool,
filter,
mipFilter,
colorKey,
imageInformation,
palette
);
}
else
{
var data = Utilities.ReadStream(stream);
fixed (void* pData = data)
cubeTexture = CreateFromPointer(
device,
(IntPtr)pData,
data.Length,
size,
levelCount,
usage,
format,
pool,
filter,
mipFilter,
colorKey,
imageInformation,
palette
);
}
stream.Position = sizeBytes;
return cubeTexture;
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="pointer">The pointer.</param>
/// <param name="sizeInBytes">The size in bytes.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
private static unsafe CubeTexture CreateFromPointer(Device device, IntPtr pointer, int sizeInBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
{
CubeTexture cubeTexture;
D3DX9.CreateCubeTextureFromFileInMemoryEx(
device,
pointer,
sizeInBytes,
size,
levelCount,
(int)usage,
format,
pool,
(int)filter,
(int)mipFilter,
*(RawColorBGRA*)&colorKey,
imageInformation,
palette,
out cubeTexture);
return cubeTexture;
}
/// <summary>
/// Creates a <see cref="CubeTexture"/> from a stream.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="fileName">Name of the file.</param>
/// <param name="size">The size.</param>
/// <param name="levelCount">The level count.</param>
/// <param name="usage">The usage.</param>
/// <param name="format">The format.</param>
/// <param name="pool">The pool.</param>
/// <param name="filter">The filter.</param>
/// <param name="mipFilter">The mip filter.</param>
/// <param name="colorKey">The color key.</param>
/// <param name="imageInformation">The image information.</param>
/// <param name="palette">The palette.</param>
/// <returns>
/// A <see cref="CubeTexture"/>
/// </returns>
/// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
private unsafe static CubeTexture CreateFromFile(Device device, string fileName, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
{
CubeTexture cubeTexture;
D3DX9.CreateCubeTextureFromFileExW(
device,
fileName,
size,
levelCount,
(int)usage,
format,
pool,
(int)filter,
(int)mipFilter,
*(RawColorBGRA*)&colorKey,
imageInformation,
palette,
out cubeTexture);
return cubeTexture;
}
}
} | {
"content_hash": "5e3d223720c7cd38a18dec52aa3609bd",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 472,
"avg_line_length": 59.14402173913044,
"alnum_prop": 0.6126349643923731,
"repo_name": "weltkante/SharpDX",
"id": "3277929c87547ce8e6562d3411b857000a13273c",
"size": "44662",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "Source/SharpDX.Direct3D9/CubeTexture.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "3277"
},
{
"name": "C",
"bytes": "2259871"
},
{
"name": "C#",
"bytes": "11540136"
},
{
"name": "C++",
"bytes": "6540722"
},
{
"name": "Groff",
"bytes": "15315"
},
{
"name": "HTML",
"bytes": "13912"
},
{
"name": "PowerShell",
"bytes": "2056"
}
],
"symlink_target": ""
} |
namespace DataService.Enum
{
/// <summary>
/// Les Parametres Systems
/// </summary>
public enum MatrixSettings
{
/// <summary>
/// L'Annee Scolaire Actuelle
/// </summary>
CurrentAnneeScolaire = 1,
/// <summary>
/// La Periode Scolaire Actuelle
/// </summary>
CurrentPerodeScolaire = 2,
/// <summary>
/// Le Nom de L'Etablissement
/// </summary>
EtablissementName = 3,
/// <summary>
/// Le Tel de L'Etablissement
/// </summary>
EtablissementTel = 4,
/// <summary>
/// Le Fax de L'Etablissement
/// </summary>
EtablissementFax = 5,
/// <summary>
/// Le Logo de L'Etablissement
/// </summary>
EtablissementLogo = 6,
}
}
| {
"content_hash": "ff0a66dbd4a4a9566dba26916aacd765",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 40,
"avg_line_length": 19.674418604651162,
"alnum_prop": 0.4858156028368794,
"repo_name": "HalidCisse/HLib",
"id": "41f3a812f7a8b168e1c6a45072f1e1475e379825",
"size": "848",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DataService/Enum/MatrixSettings.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "414353"
},
{
"name": "Smalltalk",
"bytes": "1368"
}
],
"symlink_target": ""
} |
package com.griddynamics.jagger.util.statistics.percentiles;
import java.util.ArrayList;
// This class is a derivation of hist4j https://github.com/flaptor/hist4j
/**
* The HistogramDataNode stores the histogram data for a range of values.
* It knows the minimum and maximum values for which it counts the number of instances.
* When the count exceeds the allowed limit it splits itself in two, increasing the
* histogram resolution for this range.
* @author Jorge Handl
*/
public class HistogramDataNode implements HistogramNode {
// Attributes of a data node.
private Cell cell = new Cell();
/**
* Creates an empty data node.
*/
public HistogramDataNode () {
reset();
}
/**
* Creates a data node for the given range with the given instance count.
* @param count the number of data instances in the given range.
* @param minValue the start of the range of counted values.
* @param maxValue the end of the range of counted values.
*/
public HistogramDataNode (long count, double minValue, double maxValue) {
reset();
cell.count = count;
cell.minValue = minValue;
cell.maxValue = maxValue;
}
/**
* Clears the data node.
*/
public void reset () {
cell.count = 0;
cell.minValue = Double.MAX_VALUE;
cell.maxValue = -Double.MAX_VALUE;
}
/**
* Adds a value to the data node.<p>
* If the value falls inside of the nodes' range and the count does not exceed the imposed limit, it simply increments the count.<br>
* If the value falls outside of the nodes' range, it expands the range.<br>
* If the count exceeds the limit, it splits in two assuming uniform distribution inside the node.<br>
* If the value falls outside of the nodes' range AND the count exceeds the limit, it creates a new node for that value.
* @param root a reference to the adaptive histogram instance that uses this structure.
* @param value the value for which the count is to be incremented.
* @return A reference to itself if no structural change happened, or a reference to the new fork node if this node was split.
*/
public HistogramNode addValue (AdaptiveHistogram root, double value) {
// "self" is what is returned to the caller. If this node needs to be replaced by a fork node,
// this variable will hold the new fork node and it will be returned to the caller.
// Otherwise, the node returned will be this, in which case nothing changes.
HistogramNode self = this;
if (value >= cell.minValue && value <= cell.maxValue) { // the value falls within this nodes' range
if (cell.count < root.getCountPerNodeLimit() // there is enough room in this node for the new value
|| cell.minValue == cell.maxValue) { // or the node defines a zero-width range so it can't be split
cell.count++;
} else { // not enough room, distribute the value count among the new nodes, assuming uniform distribution
double splitValue = (cell.minValue + cell.maxValue) / 2;
long rightCount = cell.count / 2;
long leftCount = rightCount;
boolean countWasOdd = (leftCount + rightCount < cell.count);
// assign the new value to the corresponding side. If the count is odd, add the extra item to the other side to keep balance
if (value > splitValue) {
rightCount++;
leftCount += (countWasOdd?1:0);
} else {
leftCount++;
rightCount += (countWasOdd?1:0);
}
// create a new subtree that will replace this node
HistogramNode leftNode = new HistogramDataNode(leftCount, cell.minValue, splitValue);
HistogramNode rightNode = new HistogramDataNode(rightCount, splitValue, cell.maxValue);
self = new HistogramForkNode(splitValue, leftNode, rightNode);
}
} else { // the value falls outside of this nodes' range
if (cell.count < root.getCountPerNodeLimit()) { // there is enough room in this node for the new value
cell.count++;
// extend the range of this node, assuming that the tree structure above correctly directed
// the given value to this node and therefore it lies at one of the borders of the tree.
if (value < cell.minValue) cell.minValue = value;
if (value > cell.maxValue) cell.maxValue = value;
} else { // not enough room, create a new sibling node for the new value and put both under a new fork node
if (value < cell.minValue) {
cell.minValue = Math.min(cell.minValue, (value + cell.maxValue) / 2);
self = new HistogramForkNode(cell.minValue, new HistogramDataNode(1,value,cell.minValue), this);
} else {
cell.maxValue = Math.max(cell.maxValue, (cell.minValue + value) / 2);
self = new HistogramForkNode(cell.maxValue, this, new HistogramDataNode(1,cell.maxValue,value));
}
}
}
return self;
}
/**
* Returns the number of data points stored in the same bucket as a given value.
* @param value the reference data point.
* @return the number of data points stored in the same bucket as the reference point.
*/
public long getCount (double value) {
long res = 0;
if (value >= cell.minValue && value <= cell.maxValue) {
res = cell.count;
}
return res;
}
/**
* Returns the cumulative density function for a given data point.
* @param value the reference data point.
* @return the cumulative density function for the reference point.
*/
public long getAccumCount (double value) {
long res = 0;
if (value >= cell.minValue) {
res = cell.count;
}
return res;
}
// Linear interpolation for double values.
private double interpolate (double x0, double y0, double x1, double y1, double x) {
return y0+((x-x0)*(y1-y0))/(x1-x0);
}
/**
* Returns the data point where the running cumulative count reaches the target cumulative count.
* It uses linear interpolation over the range of the node to get a better estimate of the true value.
* @param accumCount an array containing:<br>
* - accumCount[0] the running cumulative count. <br>
* - accumCount[1] the target cumulative count.
* @return the data point where the running cumulative count reaches the target cumulative count.
*/
public Double getValueForAccumCount (long[] accumCount) {
Double res = null;
long runningAccumCount = accumCount[0];
long targetAccumCount = accumCount[1];
if (runningAccumCount <= targetAccumCount && runningAccumCount + cell.count >= targetAccumCount) {
double val = interpolate((double)runningAccumCount, cell.minValue, (double)(runningAccumCount + cell.count), cell.maxValue, (double)targetAccumCount);
res = new Double(val);
}
accumCount[0] += cell.count;
return res;
}
/**
* Applies a convertion function to the values stored in the histogram.
* @param valueConversion a class that defines a function to convert the value.
*/
public void apply (AdaptiveHistogram.ValueConversion valueConversion) {
cell.minValue = valueConversion.convertValue(cell.minValue);
cell.maxValue = valueConversion.convertValue(cell.maxValue);
}
/**
* Build the table representing the histogram data adding this node's cell to it.
*/
public void toTable (ArrayList<Cell> table) {
table.add(cell);
}
}
| {
"content_hash": "5b18f21afa2c65fa89616a58883f2202",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 162,
"avg_line_length": 45.15340909090909,
"alnum_prop": 0.6331949163206242,
"repo_name": "Nmishin/jagger",
"id": "3a67ec35e0ee62416b9c91edc04a5cc6856681f2",
"size": "9039",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "chassis/core/src/main/java/com/griddynamics/jagger/util/statistics/percentiles/HistogramDataNode.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1411"
},
{
"name": "CSS",
"bytes": "10486"
},
{
"name": "Dockerfile",
"bytes": "1294"
},
{
"name": "Groovy",
"bytes": "16756"
},
{
"name": "HTML",
"bytes": "848"
},
{
"name": "Java",
"bytes": "2971102"
},
{
"name": "Shell",
"bytes": "8594"
}
],
"symlink_target": ""
} |
(function( $ ) {
$.widget("smartclassroom.treeview", {
version: "1.0.0",
options: {
onNodeClick: function(node){},
onNodeCollapsed: function(node){},
onNodeExpanded: function(node){}
},
_create: function(){
var that = this, element = this.element;
element.find('.node.collapsed').find('ul').hide();
element.find('.node-toggle').on('click', function(e){
var $this = $(this), node = $this.parent().parent("li");
if (node.hasClass("keep-open")) return;
node.toggleClass('collapsed');
if (node.hasClass('collapsed')) {
node.children('ul').fadeOut('fast');
that.options.onNodeCollapsed(node);
} else {
node.children('ul').fadeIn('fast');
that.options.onNodeExpanded(node);
}
that.options.onNodeClick(node);
e.preventDefault();
e.stopPropagation();
});
element.find("a").each(function(){
var $this = $(this);
$this.css({
paddingLeft: ($this.parents("ul").length-1) * 10
});
});
element.find('a').on('click', function(e){
var $this = $(this), node = $this.parent('li');
element.find('a').removeClass('active');
$this.toggleClass('active');
that.options.onNodeClick(node);
e.preventDefault();
});
},
_destroy: function(){
},
_setOption: function(key, value){
this._super('_setOption', key, value);
}
})
})( jQuery );
| {
"content_hash": "ac56a2b41ac4488ecd00e1e492d6dac1",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 72,
"avg_line_length": 28.46875,
"alnum_prop": 0.4462129527991218,
"repo_name": "shaina-ashraf/smartclass",
"id": "dacc0ec6e5431395110b899ca03ad903393be125",
"size": "1822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "assets/js/metro/metro-treeview.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "243"
},
{
"name": "CSS",
"bytes": "685539"
},
{
"name": "HTML",
"bytes": "227670"
},
{
"name": "JavaScript",
"bytes": "1009313"
},
{
"name": "PHP",
"bytes": "3040292"
}
],
"symlink_target": ""
} |
package adapter
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/goharbor/harbor/src/pkg/reg/model"
)
type fakedFactory struct {
}
func (fakedFactory) Create(*model.Registry) (Adapter, error) {
return nil, nil
}
func (fakedFactory) AdapterPattern() *model.AdapterPattern {
return nil
}
func TestRegisterFactory(t *testing.T) {
// empty type
assert.NotNil(t, RegisterFactory("", nil))
// empty factory
assert.NotNil(t, RegisterFactory("harbor", nil))
// pass
assert.Nil(t, RegisterFactory("harbor", new(fakedFactory)))
// already exists
assert.NotNil(t, RegisterFactory("harbor", new(fakedFactory)))
}
func TestGetFactory(t *testing.T) {
registry = map[string]Factory{}
require.Nil(t, RegisterFactory("harbor", new(fakedFactory)))
// doesn't exist
_, err := GetFactory("gcr")
assert.NotNil(t, err)
// pass
_, err = GetFactory("harbor")
assert.Nil(t, err)
}
func TestListRegisteredAdapterTypes(t *testing.T) {
registry = map[string]Factory{}
registryKeys = []string{}
// not register, got nothing
types := ListRegisteredAdapterTypes()
assert.Equal(t, 0, len(types))
// register one factory
require.Nil(t, RegisterFactory("harbor", new(fakedFactory)))
types = ListRegisteredAdapterTypes()
require.Equal(t, 1, len(types))
assert.Equal(t, "harbor", types[0])
}
func TestListRegisteredAdapterTypesOrder(t *testing.T) {
registry = map[string]Factory{}
registryKeys = []string{}
require.Nil(t, RegisterFactory("a", new(fakedFactory)))
require.Nil(t, RegisterFactory("c", new(fakedFactory)))
require.Nil(t, RegisterFactory("b", new(fakedFactory)))
types := ListRegisteredAdapterTypes()
require.Equal(t, 3, len(types))
require.Equal(t, "a", types[0])
require.Equal(t, "b", types[1])
require.Equal(t, "c", types[2])
}
| {
"content_hash": "67bd3a4c7d9f23c3334fbd11f052054b",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 63,
"avg_line_length": 25.26388888888889,
"alnum_prop": 0.7163276525563497,
"repo_name": "wy65701436/harbor",
"id": "e5f6794347d51f31dd37b4e8b0a5d228441f943c",
"size": "2413",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/pkg/reg/adapter/adapter_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2122"
},
{
"name": "Dockerfile",
"bytes": "17013"
},
{
"name": "Go",
"bytes": "5543957"
},
{
"name": "HTML",
"bytes": "857388"
},
{
"name": "JavaScript",
"bytes": "8987"
},
{
"name": "Jinja",
"bytes": "199133"
},
{
"name": "Makefile",
"bytes": "41515"
},
{
"name": "PLpgSQL",
"bytes": "11799"
},
{
"name": "Python",
"bytes": "532665"
},
{
"name": "RobotFramework",
"bytes": "482646"
},
{
"name": "SCSS",
"bytes": "113564"
},
{
"name": "Shell",
"bytes": "81765"
},
{
"name": "Smarty",
"bytes": "1931"
},
{
"name": "TypeScript",
"bytes": "2048995"
}
],
"symlink_target": ""
} |
//
// SDCycleScrollView.m
// SDCycleScrollView
//
// Created by aier on 15-3-22.
// Copyright (c) 2015年 GSD. All rights reserved.
//
/*
*********************************************************************************
*
* 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟
*
* 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并
* 帮您解决问题。
* 新浪微博:GSD_iOS
* Email : [email protected]
* GitHub: https://github.com/gsdios
*
* 另(我的自动布局库SDAutoLayout):
* 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于
* 做最简单易用的AutoLayout库。
* 视频教程:http://www.letv.com/ptv/vplay/24038772.html
* 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md
* GitHub:https://github.com/gsdios/SDAutoLayout
*********************************************************************************
*/
#import "SDCycleScrollView.h"
#import "SDCollectionViewCell.h"
#import "UIView+SDExtension.h"
#import "TAPageControl.h"
#import "UIImageView+WebCache.h"
#import "SDImageCache.h"
#define kCycleScrollViewInitialPageControlDotSize CGSizeMake(10, 10)
NSString * const ID = @"cycleCell";
@interface SDCycleScrollView () <UICollectionViewDataSource, UICollectionViewDelegate>
@property (nonatomic, weak) UICollectionView *mainView; // 显示图片的collectionView
@property (nonatomic, weak) UICollectionViewFlowLayout *flowLayout;
@property (nonatomic, strong) NSArray *imagePathsGroup;
@property (nonatomic, weak) NSTimer *timer;
@property (nonatomic, assign) NSInteger totalItemsCount;
@property (nonatomic, weak) UIControl *pageControl;
@property (nonatomic, strong) UIImageView *backgroundImageView; // 当imageURLs为空时的背景图
@property (nonatomic, assign) NSInteger networkFailedRetryCount;
@end
@implementation SDCycleScrollView
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self initialization];
[self setupMainView];
}
return self;
}
- (void)awakeFromNib
{
[super awakeFromNib];
[self initialization];
[self setupMainView];
}
- (void)initialization
{
_pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
_autoScrollTimeInterval = 2.0;
_titleLabelTextColor = [UIColor whiteColor];
_titleLabelTextFont= [UIFont systemFontOfSize:14];
_titleLabelBackgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
_titleLabelHeight = 30;
_autoScroll = YES;
_infiniteLoop = YES;
_showPageControl = YES;
_pageControlDotSize = kCycleScrollViewInitialPageControlDotSize;
_pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
_hidesForSinglePage = YES;
_currentPageDotColor = [UIColor whiteColor];
_pageDotColor = [UIColor lightGrayColor];
_bannerImageViewContentMode = UIViewContentModeScaleToFill;
self.backgroundColor = [UIColor lightGrayColor];
}
+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageNamesGroup:(NSArray *)imageNamesGroup
{
SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
cycleScrollView.localizationImageNamesGroup = [NSMutableArray arrayWithArray:imageNamesGroup];
return cycleScrollView;
}
+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame shouldInfiniteLoop:(BOOL)infiniteLoop imageNamesGroup:(NSArray *)imageNamesGroup
{
SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
cycleScrollView.infiniteLoop = infiniteLoop;
cycleScrollView.localizationImageNamesGroup = [NSMutableArray arrayWithArray:imageNamesGroup];
return cycleScrollView;
}
+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageURLStringsGroup:(NSArray *)imageURLsGroup
{
SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
cycleScrollView.imageURLStringsGroup = [NSMutableArray arrayWithArray:imageURLsGroup];
return cycleScrollView;
}
+ (instancetype)cycleScrollViewWithFrame:(CGRect)frame delegate:(id<SDCycleScrollViewDelegate>)delegate placeholderImage:(UIImage *)placeholderImage
{
SDCycleScrollView *cycleScrollView = [[self alloc] initWithFrame:frame];
cycleScrollView.delegate = delegate;
cycleScrollView.placeholderImage = placeholderImage;
return cycleScrollView;
}
// 设置显示图片的collectionView
- (void)setupMainView
{
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.minimumLineSpacing = 0;
flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
_flowLayout = flowLayout;
UICollectionView *mainView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:flowLayout];
mainView.backgroundColor = [UIColor clearColor];
mainView.pagingEnabled = YES;
mainView.showsHorizontalScrollIndicator = NO;
mainView.showsVerticalScrollIndicator = NO;
[mainView registerClass:[SDCollectionViewCell class] forCellWithReuseIdentifier:ID];
mainView.dataSource = self;
mainView.delegate = self;
mainView.scrollsToTop = NO;
[self addSubview:mainView];
_mainView = mainView;
}
#pragma mark - properties
- (void)setPlaceholderImage:(UIImage *)placeholderImage
{
_placeholderImage = placeholderImage;
if (!self.backgroundImageView) {
UIImageView *bgImageView = [UIImageView new];
bgImageView.contentMode = UIViewContentModeScaleAspectFit;
[self insertSubview:bgImageView belowSubview:self.mainView];
self.backgroundImageView = bgImageView;
}
self.backgroundImageView.image = placeholderImage;
}
- (void)setPageControlDotSize:(CGSize)pageControlDotSize
{
_pageControlDotSize = pageControlDotSize;
[self setupPageControl];
if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
TAPageControl *pageContol = (TAPageControl *)_pageControl;
pageContol.dotSize = pageControlDotSize;
}
}
- (void)setShowPageControl:(BOOL)showPageControl
{
_showPageControl = showPageControl;
_pageControl.hidden = !showPageControl;
}
- (void)setCurrentPageDotColor:(UIColor *)currentPageDotColor
{
_currentPageDotColor = currentPageDotColor;
if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
TAPageControl *pageControl = (TAPageControl *)_pageControl;
pageControl.dotColor = currentPageDotColor;
} else {
UIPageControl *pageControl = (UIPageControl *)_pageControl;
pageControl.currentPageIndicatorTintColor = currentPageDotColor;
}
}
- (void)setPageDotColor:(UIColor *)pageDotColor
{
_pageDotColor = pageDotColor;
if ([self.pageControl isKindOfClass:[UIPageControl class]]) {
UIPageControl *pageControl = (UIPageControl *)_pageControl;
pageControl.pageIndicatorTintColor = pageDotColor;
}
}
- (void)setCurrentPageDotImage:(UIImage *)currentPageDotImage
{
_currentPageDotImage = currentPageDotImage;
if (self.pageControlStyle != SDCycleScrollViewPageContolStyleAnimated) {
self.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
}
[self setCustomPageControlDotImage:currentPageDotImage isCurrentPageDot:YES];
}
- (void)setPageDotImage:(UIImage *)pageDotImage
{
_pageDotImage = pageDotImage;
if (self.pageControlStyle != SDCycleScrollViewPageContolStyleAnimated) {
self.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
}
[self setCustomPageControlDotImage:pageDotImage isCurrentPageDot:NO];
}
- (void)setCustomPageControlDotImage:(UIImage *)image isCurrentPageDot:(BOOL)isCurrentPageDot
{
if (!image || !self.pageControl) return;
if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
TAPageControl *pageControl = (TAPageControl *)_pageControl;
if (isCurrentPageDot) {
pageControl.currentDotImage = image;
} else {
pageControl.dotImage = image;
}
}
}
- (void)setInfiniteLoop:(BOOL)infiniteLoop
{
_infiniteLoop = infiniteLoop;
if (self.imagePathsGroup.count) {
self.imagePathsGroup = self.imagePathsGroup;
}
}
-(void)setAutoScroll:(BOOL)autoScroll{
_autoScroll = autoScroll;
[self invalidateTimer];
if (_autoScroll) {
[self setupTimer];
}
}
- (void)setScrollDirection:(UICollectionViewScrollDirection)scrollDirection
{
_scrollDirection = scrollDirection;
_flowLayout.scrollDirection = scrollDirection;
}
- (void)setAutoScrollTimeInterval:(CGFloat)autoScrollTimeInterval
{
_autoScrollTimeInterval = autoScrollTimeInterval;
[self setAutoScroll:self.autoScroll];
}
- (void)setPageControlStyle:(SDCycleScrollViewPageContolStyle)pageControlStyle
{
_pageControlStyle = pageControlStyle;
[self setupPageControl];
}
- (void)setImagePathsGroup:(NSArray *)imagePathsGroup
{
if (imagePathsGroup.count < _imagePathsGroup.count) {
[_mainView setContentOffset:CGPointZero animated:NO];
}
_imagePathsGroup = imagePathsGroup;
_totalItemsCount = self.infiniteLoop ? self.imagePathsGroup.count * 100 : self.imagePathsGroup.count;
if (imagePathsGroup.count != 1) {
self.mainView.scrollEnabled = YES;
[self setAutoScroll:self.autoScroll];
} else {
[self invalidateTimer];
self.mainView.scrollEnabled = NO;
}
[self setupPageControl];
[self.mainView reloadData];
if (imagePathsGroup.count) {
[self.backgroundImageView removeFromSuperview];
} else {
if (self.backgroundImageView && !self.backgroundImageView.superview) {
[self insertSubview:self.backgroundImageView belowSubview:self.mainView];
}
}
}
- (void)setImageURLStringsGroup:(NSArray *)imageURLStringsGroup
{
_imageURLStringsGroup = imageURLStringsGroup;
NSMutableArray *temp = [NSMutableArray new];
[_imageURLStringsGroup enumerateObjectsUsingBlock:^(NSString * obj, NSUInteger idx, BOOL * stop) {
NSString *urlString;
if ([obj isKindOfClass:[NSString class]]) {
urlString = obj;
} else if ([obj isKindOfClass:[NSURL class]]) {
NSURL *url = (NSURL *)obj;
urlString = [url absoluteString];
}
if (urlString) {
[temp addObject:urlString];
}
}];
self.imagePathsGroup = [temp copy];
}
- (void)setLocalizationImageNamesGroup:(NSArray *)localizationImageNamesGroup
{
_localizationImageNamesGroup = localizationImageNamesGroup;
self.imagePathsGroup = [localizationImageNamesGroup copy];
}
- (void)setTitlesGroup:(NSArray *)titlesGroup
{
_titlesGroup = titlesGroup;
if (self.onlyDisplayText) {
NSMutableArray *temp = [NSMutableArray new];
for (int i = 0; i < _titlesGroup.count; i++) {
[temp addObject:@""];
}
self.backgroundColor = [UIColor clearColor];
self.imageURLStringsGroup = [temp copy];
}
}
#pragma mark - actions
- (void)setupTimer
{
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:self.autoScrollTimeInterval target:self selector:@selector(automaticScroll) userInfo:nil repeats:YES];
_timer = timer;
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
}
- (void)invalidateTimer
{
[_timer invalidate];
_timer = nil;
}
- (void)setupPageControl
{
if (_pageControl) [_pageControl removeFromSuperview]; // 重新加载数据时调整
if (self.imagePathsGroup.count == 0 || self.onlyDisplayText) return;
if ((self.imagePathsGroup.count == 1) && self.hidesForSinglePage) return;
int indexOnPageControl = [self currentIndex] % self.imagePathsGroup.count;
switch (self.pageControlStyle) {
case SDCycleScrollViewPageContolStyleAnimated:
{
TAPageControl *pageControl = [[TAPageControl alloc] init];
pageControl.numberOfPages = self.imagePathsGroup.count;
pageControl.dotColor = self.currentPageDotColor;
pageControl.userInteractionEnabled = NO;
pageControl.currentPage = indexOnPageControl;
[self addSubview:pageControl];
_pageControl = pageControl;
}
break;
case SDCycleScrollViewPageContolStyleClassic:
{
UIPageControl *pageControl = [[UIPageControl alloc] init];
pageControl.numberOfPages = self.imagePathsGroup.count;
pageControl.currentPageIndicatorTintColor = self.currentPageDotColor;
pageControl.pageIndicatorTintColor = self.pageDotColor;
pageControl.userInteractionEnabled = NO;
pageControl.currentPage = indexOnPageControl;
[self addSubview:pageControl];
_pageControl = pageControl;
}
break;
default:
break;
}
// 重设pagecontroldot图片
if (self.currentPageDotImage) {
self.currentPageDotImage = self.currentPageDotImage;
}
if (self.pageDotImage) {
self.pageDotImage = self.pageDotImage;
}
}
- (void)automaticScroll
{
if (0 == _totalItemsCount) return;
int currentIndex = [self currentIndex];
int targetIndex = currentIndex + 1;
if (targetIndex >= _totalItemsCount) {
if (self.infiniteLoop) {
targetIndex = _totalItemsCount * 0.5;
[_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
}
return;
}
[_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:YES];
}
- (int)currentIndex
{
if (_mainView.sd_width == 0 || _mainView.sd_height == 0) {
return 0;
}
int index = 0;
if (_flowLayout.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
index = (_mainView.contentOffset.x + _flowLayout.itemSize.width * 0.5) / _flowLayout.itemSize.width;
} else {
index = (_mainView.contentOffset.y + _flowLayout.itemSize.height * 0.5) / _flowLayout.itemSize.height;
}
return MAX(0, index);
}
- (void)clearCache
{
[[self class] clearImagesCache];
}
+ (void)clearImagesCache
{
[[[SDWebImageManager sharedManager] imageCache] clearDisk];
}
#pragma mark - life circles
- (void)layoutSubviews
{
[super layoutSubviews];
_flowLayout.itemSize = self.frame.size;
_mainView.frame = self.bounds;
if (_mainView.contentOffset.x == 0 && _totalItemsCount) {
int targetIndex = 0;
if (self.infiniteLoop) {
targetIndex = _totalItemsCount * 0.5;
}else{
targetIndex = 0;
}
[_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
}
CGSize size = CGSizeZero;
if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
TAPageControl *pageControl = (TAPageControl *)_pageControl;
if (!(self.pageDotImage && self.currentPageDotImage && CGSizeEqualToSize(kCycleScrollViewInitialPageControlDotSize, self.pageControlDotSize))) {
pageControl.dotSize = self.pageControlDotSize;
}
size = [pageControl sizeForNumberOfPages:self.imagePathsGroup.count];
} else {
size = CGSizeMake(self.imagePathsGroup.count * self.pageControlDotSize.width * 1.2, self.pageControlDotSize.height);
}
CGFloat x = (self.sd_width - size.width) * 0.5;
if (self.pageControlAliment == SDCycleScrollViewPageContolAlimentRight) {
x = self.mainView.sd_width - size.width - 10;
}
CGFloat y = self.mainView.sd_height - size.height - 10;
if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
TAPageControl *pageControl = (TAPageControl *)_pageControl;
[pageControl sizeToFit];
}
self.pageControl.frame = CGRectMake(x, y, size.width, size.height);
self.pageControl.hidden = !_showPageControl;
if (self.backgroundImageView) {
self.backgroundImageView.frame = self.bounds;
}
}
//解决当父View释放时,当前视图因为被Timer强引用而不能释放的问题
- (void)willMoveToSuperview:(UIView *)newSuperview
{
if (!newSuperview) {
[self invalidateTimer];
}
}
//解决当timer释放后 回调scrollViewDidScroll时访问野指针导致崩溃
- (void)dealloc {
_mainView.delegate = nil;
_mainView.dataSource = nil;
}
#pragma mark - public actions
- (void)adjustWhenControllerViewWillAppera
{
long targetIndex = [self currentIndex];
if (targetIndex < _totalItemsCount) {
[_mainView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
}
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return _totalItemsCount;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
SDCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
long itemIndex = indexPath.item % self.imagePathsGroup.count;
NSString *imagePath = self.imagePathsGroup[itemIndex];
if (!self.onlyDisplayText && [imagePath isKindOfClass:[NSString class]]) {
if ([imagePath hasPrefix:@"http"]) {
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:imagePath] placeholderImage:self.placeholderImage];
} else {
UIImage *image = [UIImage imageNamed:imagePath];
if (!image) {
[UIImage imageWithContentsOfFile:imagePath];
}
cell.imageView.image = image;
}
} else if (!self.onlyDisplayText && [imagePath isKindOfClass:[UIImage class]]) {
cell.imageView.image = (UIImage *)imagePath;
}
if (_titlesGroup.count && itemIndex < _titlesGroup.count) {
cell.title = _titlesGroup[itemIndex];
}
if (!cell.hasConfigured) {
cell.titleLabelBackgroundColor = self.titleLabelBackgroundColor;
cell.titleLabelHeight = self.titleLabelHeight;
cell.titleLabelTextColor = self.titleLabelTextColor;
cell.titleLabelTextFont = self.titleLabelTextFont;
cell.hasConfigured = YES;
cell.imageView.contentMode = self.bannerImageViewContentMode;
cell.clipsToBounds = YES;
cell.onlyDisplayText = self.onlyDisplayText;
}
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didSelectItemAtIndex:)]) {
[self.delegate cycleScrollView:self didSelectItemAtIndex:indexPath.item % self.imagePathsGroup.count];
}
if (self.clickItemOperationBlock) {
self.clickItemOperationBlock(indexPath.item % self.imagePathsGroup.count);
}
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (!self.imagePathsGroup.count) return; // 解决清除timer时偶尔会出现的问题
int itemIndex = [self currentIndex];
int indexOnPageControl = itemIndex % self.imagePathsGroup.count;
if ([self.pageControl isKindOfClass:[TAPageControl class]]) {
TAPageControl *pageControl = (TAPageControl *)_pageControl;
pageControl.currentPage = indexOnPageControl;
} else {
UIPageControl *pageControl = (UIPageControl *)_pageControl;
pageControl.currentPage = indexOnPageControl;
}
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
if (self.autoScroll) {
[self invalidateTimer];
}
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if (self.autoScroll) {
[self setupTimer];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
[self scrollViewDidEndScrollingAnimation:self.mainView];
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
if (!self.imagePathsGroup.count) return; // 解决清除timer时偶尔会出现的问题
int itemIndex = [self currentIndex];
int indexOnPageControl = itemIndex % self.imagePathsGroup.count;
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScrollToIndex:)]) {
[self.delegate cycleScrollView:self didScrollToIndex:indexOnPageControl];
} else if (self.itemDidScrollOperationBlock) {
self.itemDidScrollOperationBlock(indexOnPageControl);
}
}
@end
| {
"content_hash": "5860cc98ab5bd4a2e0148edd6dc12936",
"timestamp": "",
"source": "github",
"line_count": 640,
"max_line_length": 167,
"avg_line_length": 32.1671875,
"alnum_prop": 0.7021907028707437,
"repo_name": "RocketsChen/CDDStore",
"id": "51c1afd4f02baaa422e6b1cbb0f4007b11d65da5",
"size": "21055",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CDDStoreDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCycleScrollView.m",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "1119256"
},
{
"name": "Ruby",
"bytes": "375"
}
],
"symlink_target": ""
} |
package com.formulasearchengine.mathosphere.mlp.cli;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import java.io.Serializable;
@Parameters(commandDescription = "Applies the MLP evaluation to an evaluation dataset")
public class EvalCommandConfig extends FlinkMlpCommandConfig implements Serializable {
@Parameter(names = {"--queries"}, description = "query file")
private String queries;
public String getQueries() {
return queries;
}
}
| {
"content_hash": "41befe913df11b0fe30c48bfe092d1db",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 87,
"avg_line_length": 28.705882352941178,
"alnum_prop": 0.7848360655737705,
"repo_name": "leokraemer/mathosphere",
"id": "2efe891fd2b29330daf9bb04060f1ee7b915cbf2",
"size": "488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mathosphere-core/src/main/java/com/formulasearchengine/mathosphere/mlp/cli/EvalCommandConfig.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "166773"
},
{
"name": "Java",
"bytes": "510104"
},
{
"name": "XQuery",
"bytes": "208"
},
{
"name": "XSLT",
"bytes": "136622"
}
],
"symlink_target": ""
} |
package models
import anorm._
import play.api.db.DB
import java.util.{Date}
import play.api.Play.current
import scala.language.postfixOps
import anorm.{SQL, SqlParser}
import anorm.SqlParser._
case class User(id: Long, name: String, designation: String, email: String, password: String, isAdmin: Boolean)
/**
* Created by anand on 17/8/15.
*/
class UserDAO extends DAOParsers {
// -- Queries
/**
* Retrieve an user by given user id
*
* @param id
* @return
*/
def findById(id: Long): Option[User] = {
DB.withConnection { implicit connection =>
SQL("select * from users where id = {id}").on('id -> id).as(user.singleOpt)
}
}
/**
* Retrieve an user by given user email
*
* @param email
* @return
*/
def findByEmail(email: String): Option[User] = {
DB.withConnection { implicit connection =>
SQL("select * from users where email = {email}").on('email -> email).as(user.singleOpt)
}
}
/**
* Retrieve all user
*
* @return
*/
def findAll(): List[User] = {
DB.withConnection { implicit connection =>
SQL("select * from users").as(user *)
}
}
}
| {
"content_hash": "4a400021fd01bdd2c1a681eee9528450",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 111,
"avg_line_length": 20.90909090909091,
"alnum_prop": 0.6243478260869565,
"repo_name": "anand-singh/csr-ticketing-system",
"id": "f5e913293d60a02207a13350a36de014519d9b57",
"size": "1150",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/models/UserDAO.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "229"
},
{
"name": "HTML",
"bytes": "42870"
},
{
"name": "JavaScript",
"bytes": "2134"
},
{
"name": "Scala",
"bytes": "26190"
}
],
"symlink_target": ""
} |
namespace mojo {
using blink::test::mojom::ClientToAuthenticatorProtocol;
using blink::test::mojom::Ctap2Version;
// static
ClientToAuthenticatorProtocol
EnumTraits<ClientToAuthenticatorProtocol, device::ProtocolVersion>::ToMojom(
device::ProtocolVersion input) {
switch (input) {
case ::device::ProtocolVersion::kU2f:
return ClientToAuthenticatorProtocol::U2F;
case ::device::ProtocolVersion::kCtap2:
return ClientToAuthenticatorProtocol::CTAP2;
case ::device::ProtocolVersion::kUnknown:
NOTREACHED();
return ClientToAuthenticatorProtocol::U2F;
}
NOTREACHED();
return ClientToAuthenticatorProtocol::U2F;
}
// static
bool EnumTraits<ClientToAuthenticatorProtocol, device::ProtocolVersion>::
FromMojom(ClientToAuthenticatorProtocol input,
device::ProtocolVersion* output) {
switch (input) {
case ClientToAuthenticatorProtocol::U2F:
*output = ::device::ProtocolVersion::kU2f;
return true;
case ClientToAuthenticatorProtocol::CTAP2:
*output = ::device::ProtocolVersion::kCtap2;
return true;
}
NOTREACHED();
return false;
}
// static
Ctap2Version EnumTraits<Ctap2Version, device::Ctap2Version>::ToMojom(
device::Ctap2Version input) {
switch (input) {
case ::device::Ctap2Version::kCtap2_0:
return Ctap2Version::CTAP2_0;
case ::device::Ctap2Version::kCtap2_1:
return Ctap2Version::CTAP2_1;
}
NOTREACHED();
return Ctap2Version::CTAP2_0;
}
// static
bool EnumTraits<Ctap2Version, device::Ctap2Version>::FromMojom(
Ctap2Version input,
device::Ctap2Version* output) {
switch (input) {
case Ctap2Version::CTAP2_0:
*output = ::device::Ctap2Version::kCtap2_0;
return true;
case Ctap2Version::CTAP2_1:
*output = ::device::Ctap2Version::kCtap2_1;
return true;
}
NOTREACHED();
return false;
}
} // namespace mojo
| {
"content_hash": "58916ea4e0583689d18699c43edf465e",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 76,
"avg_line_length": 28.208955223880597,
"alnum_prop": 0.707936507936508,
"repo_name": "scheib/chromium",
"id": "13f13cbc8d8c003efaf9fd4201c6735723f90151",
"size": "2143",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "content/browser/webauth/virtual_authenticator_mojom_traits.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
A high quality rip of the Eggman-OS.
The Eggman-OS is a high quality crapware made by the eggman croporation.
| {
"content_hash": "f58e9b4d5ab5fe11eb2ffb40f6f93bd5",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 72,
"avg_line_length": 37,
"alnum_prop": 0.7837837837837838,
"repo_name": "AAYapps/Eggman-OS",
"id": "f148e2b2c27e367487ae50d7b5961a4f4bcb82b9",
"size": "123",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "126099"
},
{
"name": "HTML",
"bytes": "99187"
},
{
"name": "Visual Basic",
"bytes": "69405"
}
],
"symlink_target": ""
} |
svn status dev/doc/phpdoc | grep "?" | awk '{print $2}' | xargs svn add
svn status dev/doc/phpdoc | grep "!" | awk '{print $2}' | xargs svn del
svn ci -m "Update php documentation" dev/doc/phpdoc
| {
"content_hash": "b6dd24b5722032758fe3adbe9739ed72",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 71,
"avg_line_length": 65.33333333333333,
"alnum_prop": 0.6632653061224489,
"repo_name": "filesender/filesender",
"id": "c12e3e2335e5ce55f48c734834ab2824cdfa1d27",
"size": "196",
"binary": false,
"copies": "4",
"ref": "refs/heads/development",
"path": "dev/commitphpdoc.sh",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "42040"
},
{
"name": "Dockerfile",
"bytes": "3447"
},
{
"name": "HTML",
"bytes": "6584"
},
{
"name": "Hack",
"bytes": "978"
},
{
"name": "JavaScript",
"bytes": "3187885"
},
{
"name": "PHP",
"bytes": "5033685"
},
{
"name": "Python",
"bytes": "11556"
},
{
"name": "Roff",
"bytes": "2835"
},
{
"name": "Shell",
"bytes": "25069"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.tsa.ar_model.AutoRegResults.save — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/material.css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.ar_model.AutoRegResults.scale" href="statsmodels.tsa.ar_model.AutoRegResults.scale.html" />
<link rel="prev" title="statsmodels.tsa.ar_model.AutoRegResults.remove_data" href="statsmodels.tsa.ar_model.AutoRegResults.remove_data.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.tsa.ar_model.AutoRegResults.save" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.13.1</span>
<span class="md-header-nav__topic"> statsmodels.tsa.ar_model.AutoRegResults.save </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="get" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../../versions-v2.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../tsa.html" class="md-tabs__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a></li>
<li class="md-tabs__item"><a href="statsmodels.tsa.ar_model.AutoRegResults.html" class="md-tabs__link">statsmodels.tsa.ar_model.AutoRegResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.13.1</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../tsa.html" class="md-nav__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a>
</li>
<li class="md-nav__item">
<a href="../statespace.html" class="md-nav__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a>
</li>
<li class="md-nav__item">
<a href="../vector_ar.html" class="md-nav__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.tsa.ar_model.AutoRegResults.save.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<section id="statsmodels-tsa-ar-model-autoregresults-save">
<h1 id="generated-statsmodels-tsa-ar-model-autoregresults-save--page-root">statsmodels.tsa.ar_model.AutoRegResults.save<a class="headerlink" href="#generated-statsmodels-tsa-ar-model-autoregresults-save--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py method">
<dt class="sig sig-object py" id="statsmodels.tsa.ar_model.AutoRegResults.save">
<span class="sig-prename descclassname"><span class="pre">AutoRegResults.</span></span><span class="sig-name descname"><span class="pre">save</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fname</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">remove_data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.ar_model.AutoRegResults.save" title="Permalink to this definition">¶</a></dt>
<dd><p>Save a pickle of this instance.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>fname</strong><span class="classifier">{<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="docutils literal notranslate"><span class="pre">str</span></code></a>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">handle</span></code>}</span></dt><dd><p>A string filename or a file handle.</p>
</dd>
<dt><strong>remove_data</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bltin-boolean-values" title="(in Python v3.10)"><span class="xref std std-ref">bool</span></a></span></dt><dd><p>If False (default), then the instance is pickled without changes.
If True, then all arrays with length nobs are set to None before
pickling. See the remove_data method.
In some cases not all arrays will be set to None.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If remove_data is true and the model result does not implement a
remove_data method then this will raise an exception.</p>
</dd></dl>
</section>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.tsa.ar_model.AutoRegResults.remove_data.html" title="statsmodels.tsa.ar_model.AutoRegResults.remove_data"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.tsa.ar_model.AutoRegResults.remove_data </span>
</div>
</a>
<a href="statsmodels.tsa.ar_model.AutoRegResults.scale.html" title="statsmodels.tsa.ar_model.AutoRegResults.scale"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.tsa.ar_model.AutoRegResults.scale </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Nov 12, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 4.3.0.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html> | {
"content_hash": "731e90294f64ae4788730d72f6dd50b8",
"timestamp": "",
"source": "github",
"line_count": 464,
"max_line_length": 999,
"avg_line_length": 40.91379310344828,
"alnum_prop": 0.6073008849557522,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "4720393f054b6fdb28b181a37f9cec66d856e121",
"size": "18988",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.13.1/generated/statsmodels.tsa.ar_model.AutoRegResults.save.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
#include <tommath.h>
#ifdef BN_MP_XOR_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
*/
/* XOR two ints together */
int
mp_xor (mp_int * a, mp_int * b, mp_int * c)
{
int res, ix, px;
mp_int t, *x;
if (a->used > b->used) {
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
px = b->used;
x = b;
} else {
if ((res = mp_init_copy (&t, b)) != MP_OKAY) {
return res;
}
px = a->used;
x = a;
}
for (ix = 0; ix < px; ix++) {
t.dp[ix] ^= x->dp[ix];
}
mp_clamp (&t);
mp_exch (c, &t);
mp_clear (&t);
return MP_OKAY;
}
#endif
| {
"content_hash": "1cd9b8956e95cc5dd77f3ef71937d031",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 66,
"avg_line_length": 22.829787234042552,
"alnum_prop": 0.6001863932898416,
"repo_name": "danchr/macports-base",
"id": "432f42eba2e2f0ac538c686dc87558d3af77250e",
"size": "1073",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "vendor/tcl8.5.19/libtommath/bn_mp_xor.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "1020978"
},
{
"name": "M4",
"bytes": "92664"
},
{
"name": "Makefile",
"bytes": "27709"
},
{
"name": "Rich Text Format",
"bytes": "6806"
},
{
"name": "Shell",
"bytes": "39213"
},
{
"name": "Tcl",
"bytes": "1511374"
}
],
"symlink_target": ""
} |
import React from 'react';
import classnames from 'classnames';
class ModalBody extends React.Component {
render() {
return (
<div {...this.props} className={classnames(this.props.className, this.props.modalClassName)}>
{this.props.children}
</div>
);
}
}
ModalBody.propTypes = {
/**
* A css class applied to the Component
*/
modalClassName: React.PropTypes.string
};
ModalBody.defaultProps = {
modalClassName: 'modal-body'
};
export default ModalBody;
| {
"content_hash": "04cf72438560e8169b5725a7d3b6e0a3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 99,
"avg_line_length": 19.307692307692307,
"alnum_prop": 0.6713147410358565,
"repo_name": "rapilabs/react-bootstrap",
"id": "40c667c00193fe6b424c5d86547885ee9a271d5d",
"size": "502",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "src/ModalBody.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "395170"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "7131c9acdec400ee14385b3089ba84ab",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "017a9b4d61db40726841b9284c5435f43fcf2f3d",
"size": "199",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Bacteria/Firmicutes/Mollicutes/Mycoplasmatales/Mycoplasmataceae/Mycoplasma/Mycoplasma phocidae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.lwjgl.opengles;
public interface OES_stencil4 {
/** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
int GL_STENCIL_INDEX4_OES = 0x8D47;
} | {
"content_hash": "341ab8ae5e0bb2dd3a7fd7f61be2ab51",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 83,
"avg_line_length": 21.555555555555557,
"alnum_prop": 0.7216494845360825,
"repo_name": "ThePlexianNetwork/Grumy",
"id": "1e2c31b6776d5d1f5c3d461c65e2c1c79f164389",
"size": "1793",
"binary": false,
"copies": "11",
"ref": "refs/heads/development",
"path": "lib/lwjgl/jar/src/templates/org/lwjgl/opengles/OES_stencil4.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2271672"
},
{
"name": "C++",
"bytes": "3076"
},
{
"name": "GLSL",
"bytes": "4415"
},
{
"name": "Java",
"bytes": "9012727"
},
{
"name": "Objective-C",
"bytes": "87796"
},
{
"name": "Shell",
"bytes": "155"
}
],
"symlink_target": ""
} |
using namespace g4;
using namespace std;
namespace http
{
ServerState::ServerState()
: _stateMutex(PTHREAD_MUTEX_INITIALIZER)
{
_configuration = Configuration::GetItems();
}
int ServerState::GetEventNumber() const
{
pthread_mutex_lock(&_stateMutex);
int eventNumber = _eventNumber;
pthread_mutex_unlock(&_stateMutex);
return eventNumber;
}
void ServerState::SetEventNumber(int number)
{
pthread_mutex_lock(&_stateMutex);
_eventNumber = number;
pthread_mutex_unlock(&_stateMutex);
}
std::map<string, g4::ConfigurationValue> ServerState::GetConfiguration() const
{
pthread_mutex_lock(&_stateMutex);
std::map<string, g4::ConfigurationValue> result = _configuration;
pthread_mutex_unlock(&_stateMutex);
return result;
}
void ServerState::ConfigurationChanged(const string &key)
{
pthread_mutex_lock(&_stateMutex);
_configuration[key] = Configuration::Get(key);
pthread_mutex_unlock(&_stateMutex);
}
}
| {
"content_hash": "0a302c317705160adbd3e00b4a9c12c3",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 82,
"avg_line_length": 26.585365853658537,
"alnum_prop": 0.634862385321101,
"repo_name": "janpipek/g4application",
"id": "f5b740df45648ad34ee915c2f49ff3437c6abb70",
"size": "1117",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/httpPlugin/src/ServerState.cc",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "728917"
},
{
"name": "CMake",
"bytes": "2966"
}
],
"symlink_target": ""
} |
#include "third_party/blink/renderer/modules/webdatabase/database_tracker.h"
#include <memory>
#include "base/location.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/modules/webdatabase/database.h"
#include "third_party/blink/renderer/modules/webdatabase/database_client.h"
#include "third_party/blink/renderer/modules/webdatabase/database_context.h"
#include "third_party/blink/renderer/modules/webdatabase/quota_tracker.h"
#include "third_party/blink/renderer/modules/webdatabase/web_database_host.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
namespace blink {
static void DatabaseClosed(Database* database) {
WebDatabaseHost::GetInstance().DatabaseClosed(*database->GetSecurityOrigin(),
database->StringIdentifier());
}
DatabaseTracker& DatabaseTracker::Tracker() {
DEFINE_THREAD_SAFE_STATIC_LOCAL(DatabaseTracker, tracker, ());
return tracker;
}
DatabaseTracker::DatabaseTracker() {
}
bool DatabaseTracker::CanEstablishDatabase(DatabaseContext* database_context,
DatabaseError& error) {
ExecutionContext* execution_context = database_context->GetExecutionContext();
bool success =
DatabaseClient::From(execution_context)->AllowDatabase(execution_context);
if (!success)
error = DatabaseError::kGenericSecurityError;
return success;
}
String DatabaseTracker::FullPathForDatabase(const SecurityOrigin* origin,
const String& name,
bool) {
return String(Platform::Current()->DatabaseCreateOriginIdentifier(
WebSecurityOrigin(origin))) +
"/" + name + "#";
}
void DatabaseTracker::AddOpenDatabase(Database* database) {
MutexLocker open_database_map_lock(open_database_map_guard_);
if (!open_database_map_)
open_database_map_ = std::make_unique<DatabaseOriginMap>();
String origin_string = database->GetSecurityOrigin()->ToRawString();
DatabaseNameMap* name_map;
auto open_database_map_it = open_database_map_->find(origin_string);
if (open_database_map_it == open_database_map_->end()) {
name_map = new DatabaseNameMap();
open_database_map_->Set(origin_string, name_map);
} else {
name_map = open_database_map_it->value;
DCHECK(name_map);
}
String name = database->StringIdentifier();
DatabaseSet* database_set;
auto name_map_it = name_map->find(name);
if (name_map_it == name_map->end()) {
database_set = new DatabaseSet();
name_map->Set(name, database_set);
} else {
database_set = name_map_it->value;
DCHECK(database_set);
}
database_set->insert(database);
}
void DatabaseTracker::RemoveOpenDatabase(Database* database) {
{
MutexLocker open_database_map_lock(open_database_map_guard_);
String origin_string = database->GetSecurityOrigin()->ToRawString();
DCHECK(open_database_map_);
auto open_database_map_it = open_database_map_->find(origin_string);
if (open_database_map_it == open_database_map_->end())
return;
DatabaseNameMap* name_map = open_database_map_it->value;
DCHECK(name_map);
String name = database->StringIdentifier();
auto name_map_it = name_map->find(name);
if (name_map_it == name_map->end())
return;
DatabaseSet* database_set = name_map_it->value;
DCHECK(database_set);
DatabaseSet::iterator found = database_set->find(database);
if (found == database_set->end())
return;
database_set->erase(found);
if (database_set->IsEmpty()) {
name_map->erase(name);
delete database_set;
if (name_map->IsEmpty()) {
open_database_map_->erase(origin_string);
delete name_map;
}
}
}
DatabaseClosed(database);
}
void DatabaseTracker::PrepareToOpenDatabase(Database* database) {
DCHECK(
database->GetDatabaseContext()->GetExecutionContext()->IsContextThread());
// This is an asynchronous call to the browser to open the database, however
// we can't actually use the database until we revieve an RPC back that
// advises is of the actual size of the database, so there is a race condition
// where the database is in an unusable state. To assist, we will record the
// size of the database straight away so we can use it immediately, and the
// real size will eventually be updated by the RPC from the browser.
WebDatabaseHost::GetInstance().DatabaseOpened(*database->GetSecurityOrigin(),
database->StringIdentifier(),
database->DisplayName());
// We write a temporary size of 0 to the QuotaTracker - we will be updated
// with the correct size via RPC asynchronously.
QuotaTracker::Instance().UpdateDatabaseSize(database->GetSecurityOrigin(),
database->StringIdentifier(), 0);
}
void DatabaseTracker::FailedToOpenDatabase(Database* database) {
DatabaseClosed(database);
}
uint64_t DatabaseTracker::GetMaxSizeForDatabase(const Database* database) {
uint64_t space_available = 0;
uint64_t database_size = 0;
QuotaTracker::Instance().GetDatabaseSizeAndSpaceAvailableToOrigin(
database->GetSecurityOrigin(), database->StringIdentifier(),
&database_size, &space_available);
return database_size + space_available;
}
void DatabaseTracker::CloseDatabasesImmediately(const SecurityOrigin* origin,
const String& name) {
String origin_string = origin->ToRawString();
MutexLocker open_database_map_lock(open_database_map_guard_);
if (!open_database_map_)
return;
auto open_database_map_it = open_database_map_->find(origin_string);
if (open_database_map_it == open_database_map_->end())
return;
DatabaseNameMap* name_map = open_database_map_it->value;
DCHECK(name_map);
auto name_map_it = name_map->find(name);
if (name_map_it == name_map->end())
return;
DatabaseSet* database_set = name_map_it->value;
DCHECK(database_set);
// We have to call closeImmediately() on the context thread.
for (DatabaseSet::iterator it = database_set->begin();
it != database_set->end(); ++it) {
PostCrossThreadTask(
*(*it)->GetDatabaseTaskRunner(), FROM_HERE,
CrossThreadBindOnce(&DatabaseTracker::CloseOneDatabaseImmediately,
CrossThreadUnretained(this), origin_string, name,
*it));
}
}
void DatabaseTracker::ForEachOpenDatabaseInPage(Page* page,
DatabaseCallback callback) {
MutexLocker open_database_map_lock(open_database_map_guard_);
if (!open_database_map_)
return;
for (auto& origin_map : *open_database_map_) {
for (auto& name_database_set : *origin_map.value) {
for (Database* database : *name_database_set.value) {
ExecutionContext* context = database->GetExecutionContext();
if (To<LocalDOMWindow>(context)->GetFrame()->GetPage() == page)
callback.Run(database);
}
}
}
}
void DatabaseTracker::CloseOneDatabaseImmediately(const String& origin_string,
const String& name,
Database* database) {
// First we have to confirm the 'database' is still in our collection.
{
MutexLocker open_database_map_lock(open_database_map_guard_);
if (!open_database_map_)
return;
auto open_database_map_it = open_database_map_->find(origin_string);
if (open_database_map_it == open_database_map_->end())
return;
DatabaseNameMap* name_map = open_database_map_it->value;
DCHECK(name_map);
auto name_map_it = name_map->find(name);
if (name_map_it == name_map->end())
return;
DatabaseSet* database_set = name_map_it->value;
DCHECK(database_set);
if (!database_set->Contains(database))
return;
}
// And we have to call closeImmediately() without our collection lock being
// held.
database->CloseImmediately();
}
} // namespace blink
| {
"content_hash": "f095d7fea5b1d110c18df573dd037300",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 88,
"avg_line_length": 37.07983193277311,
"alnum_prop": 0.6712747875354108,
"repo_name": "ric2b/Vivaldi-browser",
"id": "921153a7a2a4cdc00928b54999451c448a889b07",
"size": "10387",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "chromium/third_party/blink/renderer/modules/webdatabase/database_tracker.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
@interface CarRuleModel : JSONModel
@property (nonatomic,strong) NSString <Optional> *airport_name;
@property (nonatomic,strong) NSString <Optional> *car_type_id;
@property (nonatomic,strong) NSString <Optional> *contain_mileage;
@property (nonatomic,strong) NSString <Optional> *high_low_speed;
@property (nonatomic,strong) NSString <Optional> *id;
@property (nonatomic,strong) NSString <Optional> *long_mileage;
@property (nonatomic,strong) NSString <Optional> *low_speed;
@property (nonatomic,strong) NSString <Optional> *mileage;
@property (nonatomic,strong) NSString <Optional> *night;
@property (nonatomic,strong) NSString <Optional> *once_price;
@property (nonatomic,strong) NSString <Optional> *over_mileage_money;
@property (nonatomic,strong) NSString <Optional> *over_time_money;
@property (nonatomic,strong) NSString <Optional> *rule_type;
@property (nonatomic,strong) NSString <Optional> *step;
@property (nonatomic,strong) NSString <Optional> *times;
@end
| {
"content_hash": "4660b6988defd19a23fc79521d26bd20",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 51.10526315789474,
"alnum_prop": 0.7744593202883625,
"repo_name": "NY-Z/MaShangTong-Driver",
"id": "f6fda9af0953dcab8367a7808df428b036906f16",
"size": "1136",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MaShangTong-Driver/Home/Model/CarRuleModel.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "563100"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.medialive.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.medialive.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* StopTimecodeMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class StopTimecodeMarshaller {
private static final MarshallingInfo<String> LASTFRAMECLIPPINGBEHAVIOR_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("lastFrameClippingBehavior").build();
private static final MarshallingInfo<String> TIMECODE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("timecode").build();
private static final StopTimecodeMarshaller instance = new StopTimecodeMarshaller();
public static StopTimecodeMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(StopTimecode stopTimecode, ProtocolMarshaller protocolMarshaller) {
if (stopTimecode == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopTimecode.getLastFrameClippingBehavior(), LASTFRAMECLIPPINGBEHAVIOR_BINDING);
protocolMarshaller.marshall(stopTimecode.getTimecode(), TIMECODE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| {
"content_hash": "59b0e7efbce84d7b42cdf9cb59ddeedd",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 158,
"avg_line_length": 36.5531914893617,
"alnum_prop": 0.740395809080326,
"repo_name": "jentfoo/aws-sdk-java",
"id": "cee42bb8270c3c97e078423808ad041a5e85018f",
"size": "2298",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/transform/StopTimecodeMarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "270"
},
{
"name": "FreeMarker",
"bytes": "173637"
},
{
"name": "Gherkin",
"bytes": "25063"
},
{
"name": "Java",
"bytes": "356214839"
},
{
"name": "Scilab",
"bytes": "3924"
},
{
"name": "Shell",
"bytes": "295"
}
],
"symlink_target": ""
} |
<?php
namespace PhpUnitGen\Container;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use PhpUnitGen\Configuration\ConfigurationInterface\ConfigInterface;
use PhpUnitGen\Configuration\ConfigurationInterface\ConsoleConfigInterface;
use PhpUnitGen\Container\ContainerInterface\ContainerFactoryInterface;
use PhpUnitGen\Executor\Executor;
use PhpUnitGen\Executor\ExecutorInterface\ExecutorInterface;
use PhpUnitGen\Parser\ParserInterface\PhpParserInterface;
use PhpUnitGen\Parser\PhpParser;
use PhpUnitGen\Renderer\PhpFileRenderer;
use PhpUnitGen\Renderer\RendererInterface\PhpFileRendererInterface;
use PhpUnitGen\Report\Report;
use PhpUnitGen\Report\ReportInterface\ReportInterface;
use Psr\Container\ContainerInterface;
use Slim\Views\PhpRenderer;
/**
* Class ContainerFactory.
*
* @author Paul Thébaud <[email protected]>.
* @copyright 2017-2018 Paul Thébaud <[email protected]>.
* @license https://opensource.org/licenses/MIT The MIT license.
* @link https://github.com/paul-thebaud/phpunit-generator
* @since Class available since Release 2.0.0.
*/
class ContainerFactory implements ContainerFactoryInterface
{
/**
* {@inheritdoc}
*/
public function invoke(
ConfigInterface $config
): ContainerInterface {
$container = new Container();
// Configuration
$container->setInstance(ConfigInterface::class, $config);
$container->setInstance(ConsoleConfigInterface::class, $config);
// Php parser
$container->setInstance(Parser::class, (new ParserFactory())->create(ParserFactory::PREFER_PHP7));
// Php renderer
$container->setInstance(PhpRenderer::class, new PhpRenderer($config->getTemplatesPath()));
// Automatically created dependencies and aliases
$container->set(PhpParserInterface::class, PhpParser::class);
$container->set(ExecutorInterface::class, Executor::class);
$container->set(ReportInterface::class, Report::class);
$container->set(PhpFileRendererInterface::class, PhpFileRenderer::class);
return $container;
}
}
| {
"content_hash": "229a6b5a5f93f5b3026aa8766c03dafd",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 106,
"avg_line_length": 36.58620689655172,
"alnum_prop": 0.7459943449575872,
"repo_name": "paul-thebaud/phpunit-generator",
"id": "3c12f379d2fc708f0624be0caedaba55fec44c86",
"size": "2361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Container/ContainerFactory.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "524567"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 20px/1 Ahem;
white-space: break-spaces;
color: green;
white-space: pre;
}
</style>
<p>Test passes if there is a green rectangle and no red.
<div>XX<br>XX<br>XX<br>XX<br>XX<br>XX<br>XX</div>
| {
"content_hash": "cff3f164a8332ae9c3b3b9692fc9ff9c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 76,
"avg_line_length": 26.875,
"alnum_prop": 0.6813953488372093,
"repo_name": "chromium/chromium",
"id": "798e35fd660b9d1e9681c7de01cb0efc923e6aa6",
"size": "430",
"binary": false,
"copies": "34",
"ref": "refs/heads/main",
"path": "third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/break-spaces-tab-005-ref.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
The contained AppleScript `Extract placeholder.scpt` augments [BBEdit](http://www.barebones.com/products/bbedit/)’s placeholders by reducing the work required to keep the text included as the placeholder label.
## BBEdit placeholders
A BBEdit placeholder is a portion of text prefixed with `<#` and suffixed with `#>`, e.g. `<#example#>`. Striking TAB on your keyboard when a placeholder is present causes the pointy brackets and their contents to be selected – greatly reducing the time and effort to find and edit these portions of the document. Tabbing through the document will highlight each placeholder ready to be replaced when one starts typing.
## Why this script
Typically the text between the placeholder delimiters is intended as a label. Consider this portion of a letter template:
--
<#sign off#>
Oliver Boermans
With `<#sign off#>` selected I can start typing to replace it with the appropriate formality. Although I notice that most of the time I write:
--
Yours sincerely
Oliver Boermans
I could remove the placeholder from the template and it would be right *most* of the time. Alternatively I could use this instead:
--
<#Yours sincerely#>
Oliver Boermans
It is self evident that this is the intended position for a “sign off” and my most frequent selection is pre-filled. This seems great, except now I have the inconvenience of manually removing the placeholder delimiters. This is exactly what this BBEdit script makes effortless.
Evoke the script and the delimiters are removed from the first placeholder found in the selected text.
## One more thing…
There is room for improvement as sometimes I have the arduous task of typing something different:
--
Yours faithfully
Oliver Boermans
Wouldn’t it be nice if my template could store an alternative. Perhaps something like:
--
<#Yours sincerely|Yours faithfully#>
Oliver Boermans
With this placeholder selected evoking the script pops a dialog from which my the appropriate option may be chosen and entered in a snap.
## Keep the label
Although removing the placeholder label `sign off` is no great loss in this particular example, it is easy to imagine scenarios where it would help to indicate the purpose of placeholder. By default the option dialog uses the label “Options”. To customise this designate the first option in the placeholder as the label by prefixing it with a delimiter:
--
<#|Sign off|Yours sincerely|Yours faithfully|Cheers|Love#>
Oliver Boermans
## Setting a custom option delimiter
To use an alternative delimiter (perhaps to use a pipe `|` in your output) specify one by placing the desired character or characters at the very start of the placeholder – separating it from the placeholder options (and custom label if specified) with:
=|=
For example to use “$” as a delimiter:
--
<#$=|=Yours sincerely$Yours faithfully$Cheers$Love#>
Oliver Boermans
Or a comma “,” and a custom label
<#,=|=,Sign off,Yours sincerely,Yours faithfully,Cheers,Love#>
Oliver Boermans
## No delimits
If nothing precedes the custom delimiter delimiter, the script presumes you don’t want to delimit:
--
<#=|=Yours sincerely | Yours faithfully | Cheers | Love#>
Oliver Boermans
Inserting the whole placeholder text following the custom delimiter delimiter:
--
Yours sincerely | Yours faithfully | Cheers | Love
Oliver Boermans
## No placeholders
Upon executing the script, if a BBEdit placeholder is not found within the selection, the extent of selection is used in its place.
## Placeholder convention
In summary this is the expected pattern – brackets indicate optional elements:
`[<#[*]][CUSTOM_DELIMITER][=|=][|CUSTOM_LABEL|]replacement option[|additional replacement options][#>]`
## Does everything work?
- Line breaks within placeholders are not handled well. For more complex options I suggest creating a Clipping for the purpose.
- Only tested with BBEdit 11
## Installation
1. Download and unzip the package: [Extract-Placeholder.bbpackage_v1.0.0.zip](https://github.com/ollicle/BBEdit-Extract-Placeholder/raw/master/dist/Extract-Placeholder.bbpackage_v1.0.0.zip)
2. Double–click the Extract-Placeholder.bbpackage, BBEdit will prompt you to install (or update), and restart.
The package file will be copied to the Packages directory in BBEdit’s Application Support directory. Delete it from here should you wish uninstall later.
## Usage
Invoke the script "Extract placeholder" from BBEdit’s Scripts Menu or ideally assign a keyboard short cut of your choosing.
## Building the package
In your Terminal:
cd BBEdit-ESLint/
make
to also install the fresh build:
make install
| {
"content_hash": "d5382ed444c2b6537876075121b86086",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 419,
"avg_line_length": 36.574803149606296,
"alnum_prop": 0.7741657696447793,
"repo_name": "ollicle/BBEdit-Extract-Placeholder",
"id": "62b611a26ace2c211dd80a92c0973d15cc451c48",
"size": "4711",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AppleScript",
"bytes": "4235"
},
{
"name": "Makefile",
"bytes": "648"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Cambé</logradouro><bairro>Alto Tarumã</bairro><cidade>Pinhais</cidade><uf>PR</uf><cep>83325280</cep></feed>
| {
"content_hash": "e654d73ca12f9cb2845bee3bcb2bb2c3",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 141,
"avg_line_length": 99,
"alnum_prop": 0.7171717171717171,
"repo_name": "chesarex/webservice-cep",
"id": "994687162240350f535eab1abbbdfa3f52db1b1a",
"size": "200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/ceps/83/325/280/cep.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.openforis.idm.metamodel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.junit.Test;
/**
*
* @author S. Ricci
*
*/
public class LocalizedLanguageMapTest {
@Test
public void testAddEmptyLocaleText() {
LanguageSpecificTextMap map = new LanguageSpecificTextMap();
LanguageSpecificText languageSpecificText = new LanguageSpecificText(null, "Test");
map.add(languageSpecificText);
LanguageSpecificText reloaded = map.get(null);
assertNotNull(reloaded);
assertEquals(languageSpecificText, reloaded);
}
@Test
public void testAddNotEmptyLocaleText() {
LanguageSpecificTextMap map = new LanguageSpecificTextMap();
LanguageSpecificText languageSpecificText = new LanguageSpecificText("en_US", "Test");
map.add(languageSpecificText);
LanguageSpecificText reloaded = map.get("en_US");
assertNotNull(reloaded);
assertEquals(languageSpecificText, reloaded);
}
@Test
public void testSetText() {
LanguageSpecificTextMap map = createComplexMap();
map.setText("it_ITA", "Testo nuovo");
LanguageSpecificText reloaded = map.get("it_ITA");
assertNotNull(reloaded);
assertEquals("Testo nuovo", reloaded.getText());
}
@Test
public void removeText() {
LanguageSpecificTextMap map = createComplexMap();
List<LanguageSpecificText> oldValues = map.values();
int oldSize = oldValues.size();
map.remove("it_ITA");
List<LanguageSpecificText> values = map.values();
int size = values.size();
assertEquals(oldSize - 1, size);
}
protected LanguageSpecificTextMap createComplexMap() {
LanguageSpecificTextMap map = new LanguageSpecificTextMap();
LanguageSpecificText languageSpecificText = new LanguageSpecificText(null, "Text");
map.add(languageSpecificText);
languageSpecificText = new LanguageSpecificText("it_ITA", "Testo");
map.add(languageSpecificText);
languageSpecificText = new LanguageSpecificText("fr_FRA", "Texte");
map.add(languageSpecificText);
languageSpecificText = new LanguageSpecificText("sp_SPA", "Texto");
map.add(languageSpecificText);
return map;
}
}
| {
"content_hash": "2f603440fe971a7ac040c4f2d128c718",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 88,
"avg_line_length": 31.442857142857143,
"alnum_prop": 0.7355747387551114,
"repo_name": "openforis/collect",
"id": "f90e66643ffebe791d4be93b2ca0efa6713f67d3",
"size": "2201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "collect-core/src/test/java/org/openforis/idm/metamodel/LocalizedLanguageMapTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2032"
},
{
"name": "CSS",
"bytes": "492878"
},
{
"name": "HTML",
"bytes": "55093"
},
{
"name": "Java",
"bytes": "6027874"
},
{
"name": "JavaScript",
"bytes": "5049757"
},
{
"name": "Less",
"bytes": "60736"
},
{
"name": "SCSS",
"bytes": "310370"
},
{
"name": "Shell",
"bytes": "515"
},
{
"name": "TSQL",
"bytes": "1199"
},
{
"name": "XSLT",
"bytes": "8150"
}
],
"symlink_target": ""
} |
template <typename T>
struct Generic { T x; };
struct AbstractClass {
virtual void pureMethod() = 0;
virtual void aPureMethod(int (*fptr)(), Generic<int> y) = 0;
virtual int anotherPureMethod(const int &x) const = 0;
virtual int operator + (int) const = 0;
virtual void otherMethod() { }
};
struct Base {
virtual void nonAbstractClassMethod() { }
};
struct Target : Base, AbstractClass {
};
// CHECK1: "void pureMethod() override;\n\nvoid aPureMethod(int (*fptr)(), Generic<int> y) override;\n\nint anotherPureMethod(const int &x) const override;\n\nint operator+(int) const override;\n\n" [[@LINE-1]]:1 -> [[@LINE-1]]:1
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:16:1 %s | FileCheck --check-prefix=CHECK1 %s
struct SubTarget : AbstractClass {
int anotherPureMethod(const int &) const { return 0; }
#ifdef HAS_OP
int operator + (int) const override { return 2; }
#endif
};
struct Target2 : SubTarget, Base {
};
// CHECK2: "void pureMethod() override;\n\nvoid aPureMethod(int (*fptr)(), Generic<int> y) override;\n\nint operator+(int) const override;\n\n" [[@LINE-1]]:1
// CHECK3: "void pureMethod() override;\n\nvoid aPureMethod(int (*fptr)(), Generic<int> y) override;\n\n" [[@LINE-2]]:1
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:29:1 %s | FileCheck --check-prefix=CHECK2 %s
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:29:1 %s -DHAS_OP | FileCheck --check-prefix=CHECK3 %s
struct Abstract2 {
virtual void firstMethod(int x, int y) = 0;
virtual void secondMethod(int, int) { }
virtual void thirdMethod(int a) = 0;
virtual void fourthMethod() = 0;
};
struct FillInGoodLocations : Base, Abstract2 {
void secondMethod(int, int) override; // comment
void unrelatedMethod();
};
// CHECK4: "\n\nvoid firstMethod(int x, int y) override;\n\nvoid thirdMethod(int a) override;\n\nvoid fourthMethod() override;\n" [[@LINE-5]]:51 -> [[@LINE-5]]:51
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:44:1 %s | FileCheck --check-prefix=CHECK4 %s
struct FillInGoodLocations2 : FillInGoodLocations, AbstractClass {
void fourthMethod() override;
// comment
void unrelatedMethod();
int operator + (int) const override;
};
// CHECK5: "\n\nvoid firstMethod(int x, int y) override;\n\nvoid thirdMethod(int a) override;\n" [[@LINE-7]]:32 -> [[@LINE-7]]:32
// CHECK5-NEXT: "\n\nvoid pureMethod() override;\n\nvoid aPureMethod(int (*fptr)(), Generic<int> y) override;\n\nint anotherPureMethod(const int &x) const override;\n" [[@LINE-3]]:39 -> [[@LINE-3]]:39
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:54:1 %s | FileCheck --check-prefix=CHECK5 %s
struct FillInGoodLocations3 : Base, AbstractClass, Abstract2 {
// comment
void unrelatedMethod();
void thirdMethod(int a) override;
void firstMethod(int x, int y) override;
};
// CHECK6: "\n\nvoid fourthMethod() override;\n" [[@LINE-3]]:43 -> [[@LINE-3]]:43
// CHECK6-NEXT: "void pureMethod() override;\n\nvoid aPureMethod(int (*fptr)(), Generic<int> y) override;\n\nint anotherPureMethod(const int &x) const override;\n\nint operator+(int) const override;\n\n" [[@LINE-2]]:1 -> [[@LINE-2]]:1
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:67:1 %s | FileCheck --check-prefix=CHECK6 %s
struct FIllInGoodLocationsWithMacros : Abstract2 {
#define METHOD(decl) void decl override;
METHOD(thirdMethod(int a))
METHOD(firstMethod(int x, int y)) void foo();
};
// CHECK7: "\n\nvoid fourthMethod() override;\n" [[@LINE-2]]:36 -> [[@LINE-2]]:36
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:81:1 %s | FileCheck --check-prefix=CHECK7 %s
template<typename T>
class GenericType : Abstract2 {
};
// CHECK8: "void firstMethod(int x, int y) override;\n\nvoid thirdMethod(int a) override;\n\nvoid fourthMethod() override;\n\n" [[@LINE-1]]:1
struct GenericSubType : GenericType<int> {
};
// CHECK8: "void firstMethod(int x, int y) override;\n\nvoid thirdMethod(int a) override;\n\nvoid fourthMethod() override;\n\n" [[@LINE-1]]:1
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=%s:91:1 -at=%s:96:1 %s | FileCheck --check-prefix=CHECK8 %s
struct BaseClass2
{
virtual ~BaseClass2();
virtual int load() = 0;
};
// correct-implicit-destructor-placement: +1:1
struct DerivedImplicitDestructorClass2
: public BaseClass2
{
}; // CHECK-DESTRUCTOR: "int load() override;\n\n" [[@LINE]]:1
// Don't insert methods after the destructor:
// correct-destructor-placement: +1:1
struct DerivedExplicitDestructorClass2
: public BaseClass2 {
~DerivedImplicitDestructorClass2();
}; // CHECK-DESTRUCTOR: "int load() override;\n\n" [[@LINE]]:1
// RUN: clang-refactor-test perform -action fill-in-missing-abstract-methods -at=correct-implicit-destructor-placement -at=correct-destructor-placement %s | FileCheck --check-prefix=CHECK-DESTRUCTOR %s
| {
"content_hash": "993a7598095f83db2ec6a4fb87e8250b",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 234,
"avg_line_length": 39.92063492063492,
"alnum_prop": 0.7031809145129224,
"repo_name": "apple/swift-clang",
"id": "8ae223b67ea961bc59410bcfcaf618451011f07d",
"size": "5030",
"binary": false,
"copies": "2",
"ref": "refs/heads/stable",
"path": "test/Refactor/FillInMissingMethodStubsFromAbstractClasses/fill-in-missing-abstract-methods-perform.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AppleScript",
"bytes": "1429"
},
{
"name": "Assembly",
"bytes": "48411"
},
{
"name": "Batchfile",
"bytes": "73"
},
{
"name": "C",
"bytes": "21215199"
},
{
"name": "C#",
"bytes": "27472"
},
{
"name": "C++",
"bytes": "72404163"
},
{
"name": "CMake",
"bytes": "175348"
},
{
"name": "CSS",
"bytes": "8395"
},
{
"name": "Cool",
"bytes": "22451"
},
{
"name": "Cuda",
"bytes": "413843"
},
{
"name": "Dockerfile",
"bytes": "2083"
},
{
"name": "Emacs Lisp",
"bytes": "17001"
},
{
"name": "Forth",
"bytes": "925"
},
{
"name": "Fortran",
"bytes": "8180"
},
{
"name": "HTML",
"bytes": "986812"
},
{
"name": "JavaScript",
"bytes": "42269"
},
{
"name": "LLVM",
"bytes": "27231"
},
{
"name": "M",
"bytes": "4660"
},
{
"name": "MATLAB",
"bytes": "69036"
},
{
"name": "Makefile",
"bytes": "8489"
},
{
"name": "Mathematica",
"bytes": "15066"
},
{
"name": "Mercury",
"bytes": "1193"
},
{
"name": "Objective-C",
"bytes": "3626772"
},
{
"name": "Objective-C++",
"bytes": "1033408"
},
{
"name": "Perl",
"bytes": "96256"
},
{
"name": "Python",
"bytes": "784542"
},
{
"name": "RenderScript",
"bytes": "741"
},
{
"name": "Roff",
"bytes": "10932"
},
{
"name": "Rust",
"bytes": "200"
},
{
"name": "Shell",
"bytes": "10663"
}
],
"symlink_target": ""
} |
package main
import (
"fmt"
"os"
"strings"
"testing"
"github.com/coreos/rkt/tests/testutils"
)
type ImageId struct {
path string
hash string
}
func (imgId *ImageId) getShortHash(length int) (string, error) {
if length >= len(imgId.hash) {
return "", fmt.Errorf("getShortHash: Hash %s is shorter than %d chars", imgId.hash, length)
}
return imgId.hash[:length], nil
}
// containsConflictingHash returns an ImageId pair if a conflicting short hash is found. The minimum
// hash of 2 chars is used for comparisons.
func (imgId *ImageId) containsConflictingHash(imgIds []ImageId) (imgIdPair []ImageId, found bool) {
shortHash, err := imgId.getShortHash(2)
if err != nil {
panic(fmt.Sprintf("containsConflictingHash: %s", err))
}
for _, iId := range imgIds {
if strings.HasPrefix(iId.hash, shortHash) {
imgIdPair = []ImageId{*imgId, iId}
found = true
break
}
}
return
}
// TestShortHash tests that the short hash generated by the rkt image list
// command is usable by the commands that accept image hashes.
func TestShortHash(t *testing.T) {
var (
imageIds []ImageId
iter int
)
// Generate unique images until we get a collision of the first 2 hash chars
for {
image := patchTestACI(fmt.Sprintf("rkt-shorthash-%d.aci", iter), fmt.Sprintf("--name=shorthash--%d", iter))
defer os.Remove(image)
imageHash := getHashOrPanic(image)
imageId := ImageId{image, imageHash}
imageIdPair, isMatch := imageId.containsConflictingHash(imageIds)
if isMatch {
imageIds = imageIdPair
break
}
imageIds = append(imageIds, imageId)
iter++
}
ctx := testutils.NewRktRunCtx()
defer ctx.Cleanup()
// Pull the 2 images with matching first 2 hash chars into cas
for _, imageId := range imageIds {
cmd := fmt.Sprintf("%s --insecure-skip-verify fetch %s", ctx.Cmd(), imageId.path)
t.Logf("Fetching %s: %v", imageId.path, cmd)
spawnAndWaitOrFail(t, cmd, true)
}
// Get hash from 'rkt image list'
hash0 := fmt.Sprintf("sha512-%s", imageIds[0].hash[:12])
hash1 := fmt.Sprintf("sha512-%s", imageIds[1].hash[:12])
for _, hash := range []string{hash0, hash1} {
imageListCmd := fmt.Sprintf("%s image list --fields=id --no-legend", ctx.Cmd())
runRktAndCheckOutput(t, imageListCmd, hash, false)
}
tmpDir := createTempDirOrPanic("rkt_image_list_test")
defer os.RemoveAll(tmpDir)
// Define tests
tests := []struct {
cmd string
shouldFail bool
expect string
}{
// Try invalid ID
{
"image cat-manifest sha512-12341234",
true,
"no image IDs found",
},
// Try using one char hash
{
fmt.Sprintf("image cat-manifest %s", hash0[:len("sha512-")+1]),
true,
"image ID too short",
},
// Try short hash that collides
{
fmt.Sprintf("image cat-manifest %s", hash0[:len("sha512-")+2]),
true,
"ambiguous image ID",
},
// Test that 12-char hash works with image cat-manifest
{
fmt.Sprintf("image cat-manifest %s", hash0),
false,
"ImageManifest",
},
// Test that 12-char hash works with image export
{
fmt.Sprintf("image export --overwrite %s %s/export.aci", hash0, tmpDir),
false,
"",
},
// Test that 12-char hash works with image render
{
fmt.Sprintf("image render --overwrite %s %s", hash0, tmpDir),
false,
"",
},
// Test that 12-char hash works with image extract
{
fmt.Sprintf("image extract --overwrite %s %s", hash0, tmpDir),
false,
"",
},
// Test that 12-char hash works with prepare
{
fmt.Sprintf("prepare --debug %s", hash0),
false,
"Writing pod manifest",
},
// Test that 12-char hash works with image rm
{
fmt.Sprintf("image rm %s", hash1),
false,
"successfully removed aci",
},
}
// Run tests
for i, tt := range tests {
runCmd := fmt.Sprintf("%s %s", ctx.Cmd(), tt.cmd)
t.Logf("Running test #%d", i)
runRktAndCheckOutput(t, runCmd, tt.expect, tt.shouldFail)
}
}
| {
"content_hash": "67bf6feb12f18081228f4c73ebc034b0",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 109,
"avg_line_length": 24.75796178343949,
"alnum_prop": 0.6591201440699769,
"repo_name": "jzelinskie/rkt",
"id": "a217c9be13a38dc0be45dbbc235d8de20a0c3d3b",
"size": "4480",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/rkt_image_list_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "23687"
},
{
"name": "Go",
"bytes": "901712"
},
{
"name": "Makefile",
"bytes": "123598"
},
{
"name": "Protocol Buffer",
"bytes": "15635"
},
{
"name": "Shell",
"bytes": "35724"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using Manos.Http;
using Manos.IO;
namespace Manos.Http.Testing
{
public class MockHttpResponse : IHttpResponse
{
StringBuilder builder = new StringBuilder ();
Dictionary<string, HttpCookie> cookies = new Dictionary<string, HttpCookie> ();
public MockHttpResponse ()
{
this.Headers = new HttpHeaders ();
Properties = new Dictionary<string,object> ();
}
public void Dispose ()
{
}
public IHttpTransaction Transaction { get; set; }
public HttpHeaders Headers { get; set; }
public HttpStream Stream {
get {
throw new NotImplementedException ();
}
}
public String ResponseString()
{
return this.builder.ToString();
}
public StreamWriter Writer { get{throw new NotImplementedException();} }
public Encoding ContentEncoding {
get { return Headers.ContentEncoding; }
set { Headers.ContentEncoding = value; }
}
public int StatusCode { get; set; }
public bool WriteHeaders { get; set; }
public void Write (string str)
{
this.builder.Append(str);
}
public void Write (string str, params object[] prms)
{
this.builder.AppendFormat (str, prms);
}
public void WriteLine (string str)
{
this.builder.AppendLine (str);
}
public void WriteLine (string str, params object[] prms)
{
this.builder.AppendLine(String.Format(str, prms));
}
public void End ()
{
}
public void End (string str)
{
this.Write (str);
}
public void End (byte[] data)
{
this.Write (data);
}
public void End (string str, params object[] prms)
{
this.Write (str, prms);
}
public void Write (byte[] data)
{
throw new NotImplementedException();
}
public void Write (byte [] data, int offset, int length)
{
throw new NotImplementedException ();
}
public void End (byte [] data, int offset, int length)
{
throw new NotImplementedException ();
}
public void SendFile (string file)
{
SentFile = file;
}
public string SentFile
{
get;
private set;
}
public string RedirectedUrl
{
get;
private set;
}
public void Redirect (string url)
{
StatusCode = 302;
RedirectedUrl = url;
}
public void Read ()
{
throw new NotImplementedException ();
}
public void SetHeader (string name, string value)
{
this.Headers.SetHeader (name, value);
}
public Dictionary<string,HttpCookie> Cookies {
get { return cookies; }
}
public void SetCookie (string name, HttpCookie cookie)
{
cookies [name] = cookie;
}
public HttpCookie SetCookie (string name, string value)
{
var cookie = new HttpCookie (name, value);
SetCookie (name, cookie);
return cookie;
}
public HttpCookie SetCookie (string name, string value, string domain)
{
var cookie = new HttpCookie (name, value);
cookie.Domain = domain;
SetCookie (name, cookie);
return cookie;
}
public HttpCookie SetCookie (string name, string value, DateTime expires)
{
return SetCookie (name, value, null, expires);
}
public HttpCookie SetCookie (string name, string value, string domain, DateTime expires)
{
var cookie = new HttpCookie (name, value);
cookie.Domain = domain;
cookie.Expires = expires;
SetCookie (name, cookie);
return cookie;
}
public HttpCookie SetCookie (string name, string value, TimeSpan max_age)
{
return SetCookie (name, value, DateTime.Now + max_age);
}
public HttpCookie SetCookie (string name, string value, string domain, TimeSpan max_age)
{
return SetCookie (name, value, domain, DateTime.Now + max_age);
}
public void RemoveCookie(string name)
{
var cookie = new HttpCookie (name, "");
cookie.Expires = DateTime.Now.AddYears(-1);
SetCookie (name, cookie);
}
public void Complete (Action callback)
{
}
public Dictionary<string,object> Properties {
get;
set;
}
public string PostBody {
get;
set;
}
public void WriteMetadata (StringBuilder builder)
{
throw new NotImplementedException ();
}
public void SetProperty (string name, object o)
{
if (name == null)
throw new ArgumentNullException ("name");
if (o == null) {
Properties.Remove (name);
return;
}
Properties [name] = o;
}
public object GetProperty (string name)
{
if (name == null)
throw new ArgumentNullException ("name");
object res = null;
if (Properties.TryGetValue (name, out res))
return null;
return res;
}
public T GetProperty<T> (string name)
{
object res = GetProperty (name);
if (res == null)
return default (T);
return (T) res;
}
public event Action OnCompleted;
public event Action<byte [], int, int> BodyData;
public event Action OnEnd;
}
}
| {
"content_hash": "856b863469f45cc463aa011894922155",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 90,
"avg_line_length": 19.094488188976378,
"alnum_prop": 0.6544329896907216,
"repo_name": "jacksonh/manos",
"id": "42789ca463938487bb45cfa815eced1b82c66962",
"size": "4850",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/Manos/Manos.Http.Testing/MockHttpResponse.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "84"
},
{
"name": "C",
"bytes": "277639"
},
{
"name": "C#",
"bytes": "860154"
},
{
"name": "C++",
"bytes": "21096"
},
{
"name": "CSS",
"bytes": "7697"
},
{
"name": "Groff",
"bytes": "406198"
},
{
"name": "HTML",
"bytes": "3395"
},
{
"name": "JavaScript",
"bytes": "13637"
},
{
"name": "Makefile",
"bytes": "1599"
},
{
"name": "Objective-C",
"bytes": "403"
},
{
"name": "Perl",
"bytes": "214405"
},
{
"name": "Ruby",
"bytes": "673"
},
{
"name": "Shell",
"bytes": "21533"
}
],
"symlink_target": ""
} |
#!/bin/bash
# Copyright 2018 Google LLC
#
# 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
#
# https://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.
# Code taken and adapted from
# https://github.com/openconfig/gnmitest/blob/master/schemas/openconfig/update.sh,
# under Apache License, Version 2.0.
MODELS_FOLDER=$(dirname $0)/models
MODELS_PATH=${MODELS_FOLDER}/public/release/models
PYBINDPLUGIN=$(/usr/bin/env python -c 'import pyangbind; import os; print ("{}/plugin".format(os.path.dirname(pyangbind.__file__)))')
rm -fr ${MODELS_FOLDER}/*
touch ${MODELS_FOLDER}/__init__.py
git clone --depth 1 https://github.com/openconfig/public.git "$MODELS_FOLDER/public"
for m in $( ls -d ${MODELS_PATH}/*/ ); do
MODELS=$(find $m -name openconfig-*.yang)
MODEL_NAME=$(basename $m | tr "-" "_")
# Skip openconfig-bdf model until https://github.com/robshakir/pyangbind/issues/286 is fixed
if [[ $MODEL_NAME == "bfd" ]]; then
continue
fi
echo "Binding models in $m"
# Skipping Warnings due to https://github.com/openconfig/public/issues/571
pyang -W none --plugindir $PYBINDPLUGIN -f pybind \
--path "$MODELS_PATH/" --output "$MODELS_FOLDER/${MODEL_NAME}.py" ${MODELS}
pyang -W none --plugindir $PYBINDPLUGIN -f name --name-print-revision \
--path "$MODELS_PATH/" ${MODELS} >> ${MODELS_FOLDER}/versions
done
rm -rf "$MODELS_FOLDER/public"
| {
"content_hash": "8d4c3ffa6d683451d766ef490fe2cbda",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 133,
"avg_line_length": 40.06666666666667,
"alnum_prop": 0.7138103161397671,
"repo_name": "google/gnxi",
"id": "45e5f2f071e0faca02a6001fd8250c81f548f03b",
"size": "1803",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "oc_config_validate/oc_config_validate/update_models.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1730"
},
{
"name": "Dockerfile",
"bytes": "1957"
},
{
"name": "Go",
"bytes": "1194247"
},
{
"name": "HTML",
"bytes": "7132"
},
{
"name": "JavaScript",
"bytes": "1887"
},
{
"name": "Python",
"bytes": "83970889"
},
{
"name": "Shell",
"bytes": "11353"
},
{
"name": "TypeScript",
"bytes": "32597"
}
],
"symlink_target": ""
} |
<?php
final class PhabricatorChatLogChannelListController
extends PhabricatorChatLogController {
public function shouldAllowPublic() {
return true;
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$channels = id(new PhabricatorChatLogChannelQuery())
->setViewer($user)
->execute();
$list = new PHUIObjectItemListView();
foreach ($channels as $channel) {
$item = id(new PHUIObjectItemView())
->setHeader($channel->getChannelName())
->setHref('/chatlog/channel/'.$channel->getID().'/')
->addAttribute($channel->getServiceName())
->addAttribute($channel->getServiceType());
$list->addItem($item);
}
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb(pht('Channel List'), $this->getApplicationURI());
return $this->buildApplicationPage(
array(
$crumbs,
$list,
),
array(
'title' => pht('Channel List'),
'device' => true,
));
}
}
| {
"content_hash": "d4c7734444c87143bad8b6b89c086a24",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 70,
"avg_line_length": 25.928571428571427,
"alnum_prop": 0.5876951331496786,
"repo_name": "Automattic/phabricator",
"id": "d313aa132c5e188dd68813561af546d59229de19",
"size": "1089",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "39828"
},
{
"name": "CSS",
"bytes": "359456"
},
{
"name": "JavaScript",
"bytes": "650315"
},
{
"name": "PHP",
"bytes": "9338280"
},
{
"name": "Shell",
"bytes": "8644"
}
],
"symlink_target": ""
} |
#include "tensorflow/core/kernels/data/concatenate_dataset_op.h"
#include "tensorflow/core/kernels/data/dataset_test_base.h"
namespace tensorflow {
namespace data {
namespace {
constexpr char kNodeName[] = "concatenate_dataset";
// Test case 1: same shape.
ConcatenateDatasetParams SameShapeConcatenateDatasetParams() {
auto tensor_slice_dataset_params_0 = TensorSliceDatasetParams(
/*components=*/CreateTensors<int64>(TensorShape{2, 2},
{{1, 2, 3, 4}, {5, 6, 7, 8}}),
/*node_name=*/"tensor_slice_0");
auto tensor_slice_dataset_params_1 = TensorSliceDatasetParams(
/*components=*/CreateTensors<int64>(TensorShape{2, 2},
{{11, 12, 13, 14}, {15, 16, 17, 18}}),
/*node_name=*/"tensor_slice_1");
return ConcatenateDatasetParams(
std::move(tensor_slice_dataset_params_0),
std::move(tensor_slice_dataset_params_1),
/*output_dtypes=*/{DT_INT64, DT_INT64},
/*output_shapes=*/{PartialTensorShape({2}), PartialTensorShape({2})},
/*node_name=*/kNodeName);
}
// Test case 2: different shape.
ConcatenateDatasetParams DifferentShapeConcatenateDatasetParams() {
auto tensor_slice_dataset_params_0 = TensorSliceDatasetParams(
/*components=*/
{CreateTensor<int64>(TensorShape{2, 3}, {1, 2, 3, 4, 5, 6}),
CreateTensor<int64>(TensorShape{2, 2}, {7, 8, 9, 10})},
/*node_name=*/"tensor_slice_0");
auto tensor_slice_dataset_params_1 = TensorSliceDatasetParams(
/*components=*/
{CreateTensor<int64>(TensorShape{2, 2}, {11, 12, 13, 14}),
CreateTensor<int64>(TensorShape{2, 1}, {15, 16})},
/*node_name=*/"tensor_slice_1");
return ConcatenateDatasetParams(
std::move(tensor_slice_dataset_params_0),
std::move(tensor_slice_dataset_params_1),
/*output_dtypes=*/{DT_INT64, DT_INT64},
/*output_shapes=*/{PartialTensorShape({-1}), PartialTensorShape({-1})},
/*node_name=*/kNodeName);
}
// Test case 3: different dtypes
ConcatenateDatasetParams DifferentDtypeConcatenateDatasetParams() {
auto tensor_slice_dataset_params_0 = TensorSliceDatasetParams(
/*components=*/CreateTensors<int64>(TensorShape{2, 2}, {{1, 2, 3, 4}}),
/*node_name=*/"tensor_slice_0");
auto tensor_slice_dataset_params_1 = TensorSliceDatasetParams(
/*components=*/
CreateTensors<double>(TensorShape{2, 2}, {{1.0, 2.0, 3.0, 4.0}}),
/*node_name=*/"tensor_slice_1");
return ConcatenateDatasetParams(std::move(tensor_slice_dataset_params_0),
std::move(tensor_slice_dataset_params_1),
/*output_dtypes=*/{DT_INT64},
/*output_shapes=*/{PartialTensorShape({2})},
/*node_name=*/kNodeName);
}
class ConcatenateDatasetOpTest : public DatasetOpsTestBase {};
std::vector<GetNextTestCase<ConcatenateDatasetParams>> GetNextTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*expected_outputs=*/
CreateTensors<int64>(TensorShape({2}), {{1, 2},
{5, 6},
{3, 4},
{7, 8},
{11, 12},
{15, 16},
{13, 14},
{17, 18}})},
{/*dataset_params=*/DifferentShapeConcatenateDatasetParams(),
/*expected_outputs=*/
{CreateTensor<int64>(TensorShape{3}, {1, 2, 3}),
CreateTensor<int64>(TensorShape{2}, {7, 8}),
CreateTensor<int64>(TensorShape{3}, {4, 5, 6}),
CreateTensor<int64>(TensorShape{2}, {9, 10}),
CreateTensor<int64>(TensorShape{2}, {11, 12}),
CreateTensor<int64>(TensorShape{1}, {15}),
CreateTensor<int64>(TensorShape{2}, {13, 14}),
CreateTensor<int64>(TensorShape{1}, {16})}}};
}
ITERATOR_GET_NEXT_TEST_P(ConcatenateDatasetOpTest, ConcatenateDatasetParams,
GetNextTestCases())
TEST_F(ConcatenateDatasetOpTest, DifferentDtypes) {
auto dataset_params = DifferentDtypeConcatenateDatasetParams();
EXPECT_EQ(Initialize(dataset_params).code(),
tensorflow::error::INVALID_ARGUMENT);
}
TEST_F(ConcatenateDatasetOpTest, DatasetNodeName) {
auto dataset_params = SameShapeConcatenateDatasetParams();
TF_ASSERT_OK(Initialize(dataset_params));
TF_ASSERT_OK(CheckDatasetNodeName(dataset_params.node_name()));
}
TEST_F(ConcatenateDatasetOpTest, DatasetTypeString) {
auto dataset_params = SameShapeConcatenateDatasetParams();
TF_ASSERT_OK(Initialize(dataset_params));
TF_ASSERT_OK(CheckDatasetTypeString(
name_utils::OpName(ConcatenateDatasetOp::kDatasetType)));
}
std::vector<DatasetOutputDtypesTestCase<ConcatenateDatasetParams>>
DatasetOutputDtypesTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*expected_output_dtypes=*/
SameShapeConcatenateDatasetParams().output_dtypes()},
{/*dataset_params=*/DifferentShapeConcatenateDatasetParams(),
/*expected_output_dtypes=*/
DifferentShapeConcatenateDatasetParams().output_dtypes()}};
}
DATASET_OUTPUT_DTYPES_TEST_P(ConcatenateDatasetOpTest, ConcatenateDatasetParams,
DatasetOutputDtypesTestCases())
std::vector<DatasetOutputShapesTestCase<ConcatenateDatasetParams>>
DatasetOutputShapesTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*expected_output_shapes*/
SameShapeConcatenateDatasetParams().output_shapes()},
{/*dataset_params=*/
DifferentShapeConcatenateDatasetParams(),
/*expected_output_shapes*/
DifferentShapeConcatenateDatasetParams().output_shapes()}};
}
DATASET_OUTPUT_SHAPES_TEST_P(ConcatenateDatasetOpTest, ConcatenateDatasetParams,
DatasetOutputShapesTestCases())
std::vector<CardinalityTestCase<ConcatenateDatasetParams>>
CardinalityTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*expected_cardinality=*/4},
{/*dataset_params=*/DifferentShapeConcatenateDatasetParams(),
/*expected_cardinality=*/4}};
}
DATASET_CARDINALITY_TEST_P(ConcatenateDatasetOpTest, ConcatenateDatasetParams,
CardinalityTestCases())
std::vector<IteratorOutputDtypesTestCase<ConcatenateDatasetParams>>
IteratorOutputDtypesTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*expected_output_dtypes=*/
SameShapeConcatenateDatasetParams().output_dtypes()},
{/*dataset_params=*/DifferentShapeConcatenateDatasetParams(),
/*expected_output_dtypes=*/
DifferentShapeConcatenateDatasetParams().output_dtypes()}};
}
ITERATOR_OUTPUT_DTYPES_TEST_P(ConcatenateDatasetOpTest,
ConcatenateDatasetParams,
IteratorOutputDtypesTestCases())
std::vector<IteratorOutputShapesTestCase<ConcatenateDatasetParams>>
IteratorOutputShapesTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*expected_output_shapes=*/
SameShapeConcatenateDatasetParams().output_shapes()},
{/*dataset_params=*/DifferentShapeConcatenateDatasetParams(),
/*expected_output_shapes=*/
DifferentShapeConcatenateDatasetParams().output_shapes()}};
}
ITERATOR_OUTPUT_SHAPES_TEST_P(ConcatenateDatasetOpTest,
ConcatenateDatasetParams,
IteratorOutputShapesTestCases())
TEST_F(ConcatenateDatasetOpTest, IteratorPrefix) {
auto dataset_params = SameShapeConcatenateDatasetParams();
TF_ASSERT_OK(Initialize(dataset_params));
TF_ASSERT_OK(CheckIteratorPrefix(name_utils::IteratorPrefix(
ConcatenateDatasetOp::kDatasetType, dataset_params.iterator_prefix())));
}
std::vector<IteratorSaveAndRestoreTestCase<ConcatenateDatasetParams>>
IteratorSaveAndRestoreTestCases() {
return {{/*dataset_params=*/SameShapeConcatenateDatasetParams(),
/*breakpoints=*/{0, 2, 5},
/*expected_outputs=*/
CreateTensors<int64>(TensorShape({2}), {{1, 2},
{5, 6},
{3, 4},
{7, 8},
{11, 12},
{15, 16},
{13, 14},
{17, 18}})},
{/*dataset_params=*/DifferentShapeConcatenateDatasetParams(),
/*breakpoints=*/{0, 2, 5},
/*expected_outputs=*/
{CreateTensor<int64>(TensorShape{3}, {1, 2, 3}),
CreateTensor<int64>(TensorShape{2}, {7, 8}),
CreateTensor<int64>(TensorShape{3}, {4, 5, 6}),
CreateTensor<int64>(TensorShape{2}, {9, 10}),
CreateTensor<int64>(TensorShape{2}, {11, 12}),
CreateTensor<int64>(TensorShape{1}, {15}),
CreateTensor<int64>(TensorShape{2}, {13, 14}),
CreateTensor<int64>(TensorShape{1}, {16})}}};
}
ITERATOR_SAVE_AND_RESTORE_TEST_P(ConcatenateDatasetOpTest,
ConcatenateDatasetParams,
IteratorSaveAndRestoreTestCases())
} // namespace
} // namespace data
} // namespace tensorflow
| {
"content_hash": "59cf728958712d1340a391f8882b8369",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 80,
"avg_line_length": 44.598173515981735,
"alnum_prop": 0.6065322002662025,
"repo_name": "renyi533/tensorflow",
"id": "a66a2a81cef0b1f42c9ff2bd394f5a94c6209941",
"size": "10435",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "tensorflow/core/kernels/data/concatenate_dataset_op_test.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "31572"
},
{
"name": "Batchfile",
"bytes": "55269"
},
{
"name": "C",
"bytes": "903309"
},
{
"name": "C#",
"bytes": "8562"
},
{
"name": "C++",
"bytes": "82507951"
},
{
"name": "CMake",
"bytes": "6967"
},
{
"name": "Dockerfile",
"bytes": "113964"
},
{
"name": "Go",
"bytes": "1871425"
},
{
"name": "HTML",
"bytes": "4686483"
},
{
"name": "Java",
"bytes": "988219"
},
{
"name": "Jupyter Notebook",
"bytes": "550861"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "MLIR",
"bytes": "2073744"
},
{
"name": "Makefile",
"bytes": "66796"
},
{
"name": "Objective-C",
"bytes": "116558"
},
{
"name": "Objective-C++",
"bytes": "319021"
},
{
"name": "PHP",
"bytes": "4236"
},
{
"name": "Pascal",
"bytes": "318"
},
{
"name": "Pawn",
"bytes": "20422"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "Python",
"bytes": "37811412"
},
{
"name": "RobotFramework",
"bytes": "1779"
},
{
"name": "Roff",
"bytes": "2705"
},
{
"name": "Ruby",
"bytes": "7464"
},
{
"name": "SWIG",
"bytes": "6846"
},
{
"name": "Shell",
"bytes": "696058"
},
{
"name": "Smarty",
"bytes": "35725"
},
{
"name": "Starlark",
"bytes": "3655758"
},
{
"name": "Swift",
"bytes": "62814"
},
{
"name": "Vim Snippet",
"bytes": "58"
}
],
"symlink_target": ""
} |
/* Component containers
----------------------------------*/
.ui-widget {
font-family: Arial,Helvetica,sans-serif/*{ffDefault}*/;
font-size: 1em/*{fsDefault}*/;
}
.ui-widget .ui-widget {
font-size: 1em;
}
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
.ui-widget button {
font-family: Arial,Helvetica,sans-serif/*{ffDefault}*/;
font-size: 1em;
}
.ui-widget.ui-widget-content {
border: 1px solid #c5c5c5/*{borderColorDefault}*/;
}
.ui-widget-content {
border: 1px solid #dddddd/*{borderColorContent}*/;
background: #ffffff/*{bgColorContent}*/ /*{bgImgUrlContent}*/ /*{bgContentXPos}*/ /*{bgContentYPos}*/ /*{bgContentRepeat}*/;
color: #333333/*{fcContent}*/;
}
.ui-widget-content a {
color: #333333/*{fcContent}*/;
}
.ui-widget-header {
border: 1px solid #dddddd/*{borderColorHeader}*/;
background: #e9e9e9/*{bgColorHeader}*/ /*{bgImgUrlHeader}*/ /*{bgHeaderXPos}*/ /*{bgHeaderYPos}*/ /*{bgHeaderRepeat}*/;
color: #333333/*{fcHeader}*/;
font-weight: bold;
}
.ui-widget-header a {
color: #333333/*{fcHeader}*/;
}
/* Interaction states
----------------------------------*/
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default,
.ui-button,
/* We use html here because we need a greater specificity to make sure disabled
works properly when clicked or hovered */
html .ui-button.ui-state-disabled:hover,
html .ui-button.ui-state-disabled:active {
border: 1px solid #c5c5c5/*{borderColorDefault}*/;
background: #f6f6f6/*{bgColorDefault}*/ /*{bgImgUrlDefault}*/ /*{bgDefaultXPos}*/ /*{bgDefaultYPos}*/ /*{bgDefaultRepeat}*/;
font-weight: normal/*{fwDefault}*/;
color: #454545/*{fcDefault}*/;
}
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited,
a.ui-button,
a:link.ui-button,
a:visited.ui-button,
.ui-button {
color: #454545/*{fcDefault}*/;
text-decoration: none;
}
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus,
.ui-button:hover,
.ui-button:focus {
border: 1px solid #cccccc/*{borderColorHover}*/;
background: #ededed/*{bgColorHover}*/ /*{bgImgUrlHover}*/ /*{bgHoverXPos}*/ /*{bgHoverYPos}*/ /*{bgHoverRepeat}*/;
font-weight: normal/*{fwDefault}*/;
color: #2b2b2b/*{fcHover}*/;
}
.ui-state-hover a,
.ui-state-hover a:hover,
.ui-state-hover a:link,
.ui-state-hover a:visited,
.ui-state-focus a,
.ui-state-focus a:hover,
.ui-state-focus a:link,
.ui-state-focus a:visited,
a.ui-button:hover,
a.ui-button:focus {
color: #2b2b2b/*{fcHover}*/;
text-decoration: none;
}
.ui-visual-focus {
box-shadow: 0 0 3px 1px rgb(94, 158, 214);
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active,
a.ui-button:active,
.ui-button:active,
.ui-button.ui-state-active:hover {
border: 1px solid #003eff/*{borderColorActive}*/;
background: #007fff/*{bgColorActive}*/ /*{bgImgUrlActive}*/ /*{bgActiveXPos}*/ /*{bgActiveYPos}*/ /*{bgActiveRepeat}*/;
font-weight: normal/*{fwDefault}*/;
color: #ffffff/*{fcActive}*/;
}
.ui-icon-background {
border: #dddddd/*{borderColorContent}*/;
background-color: #ffffff/*{bgColorContent}*/;
}
.ui-state-active a,
.ui-state-active a:link,
.ui-state-active a:visited {
color: #ffffff/*{fcActive}*/;
text-decoration: none;
}
/* Interaction Cues
----------------------------------*/
.ui-state-highlight,
.ui-widget-content .ui-state-highlight,
.ui-widget-header .ui-state-highlight {
border: 1px solid #dad55e/*{borderColorHighlight}*/;
background: #fffa90/*{bgColorHighlight}*/ /*{bgImgUrlHighlight}*/ /*{bgHighlightXPos}*/ /*{bgHighlightYPos}*/ /*{bgHighlightRepeat}*/;
color: #777620/*{fcHighlight}*/;
}
.ui-state-highlight a,
.ui-widget-content .ui-state-highlight a,
.ui-widget-header .ui-state-highlight a {
color: #777620/*{fcHighlight}*/;
}
.ui-state-error,
.ui-widget-content .ui-state-error,
.ui-widget-header .ui-state-error {
border: 1px solid #f1a899/*{borderColorError}*/;
background: #fddfdf/*{bgColorError}*/ /*{bgImgUrlError}*/ /*{bgErrorXPos}*/ /*{bgErrorYPos}*/ /*{bgErrorRepeat}*/;
color: #5f3f3f/*{fcError}*/;
}
.ui-state-error a,
.ui-widget-content .ui-state-error a,
.ui-widget-header .ui-state-error a {
color: #5f3f3f/*{fcError}*/;
}
.ui-state-error-text,
.ui-widget-content .ui-state-error-text,
.ui-widget-header .ui-state-error-text {
color: #5f3f3f/*{fcError}*/;
}
.ui-priority-primary,
.ui-widget-content .ui-priority-primary,
.ui-widget-header .ui-priority-primary {
font-weight: bold;
}
.ui-priority-secondary,
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
width: 16px;
height: 16px;
}
.ui-icon,
.ui-widget-content .ui-icon {
background-image: url("images/ui-icons_444444_256x240.png")/*{iconsContent}*/;
}
.ui-widget-header .ui-icon {
background-image: url("images/ui-icons_444444_256x240.png")/*{iconsHeader}*/;
}
.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon,
.ui-button:hover .ui-icon,
.ui-button:focus .ui-icon {
background-image: url("images/ui-icons_555555_256x240.png")/*{iconsHover}*/;
}
.ui-state-active .ui-icon,
.ui-button:active .ui-icon {
background-image: url("images/ui-icons_ffffff_256x240.png")/*{iconsActive}*/;
}
.ui-state-highlight .ui-icon,
.ui-button .ui-state-highlight.ui-icon {
background-image: url("images/ui-icons_777620_256x240.png")/*{iconsHighlight}*/;
}
.ui-state-error .ui-icon,
.ui-state-error-text .ui-icon {
background-image: url("images/ui-icons_cc0000_256x240.png")/*{iconsError}*/;
}
.ui-button .ui-icon,
.ui-state-default .ui-icon {
background-image: url("images/ui-icons_777777_256x240.png")/*{iconsDefault}*/;
}
/* positioning */
.ui-icon-blank { background-position: 16px 16px; }
.ui-icon-caret-1-n { background-position: 0 0; }
.ui-icon-caret-1-ne { background-position: -16px 0; }
.ui-icon-caret-1-e { background-position: -32px 0; }
.ui-icon-caret-1-se { background-position: -48px 0; }
.ui-icon-caret-1-s { background-position: -65px 0; }
.ui-icon-caret-1-sw { background-position: -80px 0; }
.ui-icon-caret-1-w { background-position: -96px 0; }
.ui-icon-caret-1-nw { background-position: -112px 0; }
.ui-icon-caret-2-n-s { background-position: -128px 0; }
.ui-icon-caret-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -65px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -65px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 1px -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-on { background-position: -96px -144px; }
.ui-icon-radio-off { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
.ui-corner-tl {
border-top-left-radius: 3px/*{cornerRadius}*/;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-right,
.ui-corner-tr {
border-top-right-radius: 3px/*{cornerRadius}*/;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-left,
.ui-corner-bl {
border-bottom-left-radius: 3px/*{cornerRadius}*/;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-right,
.ui-corner-br {
border-bottom-right-radius: 3px/*{cornerRadius}*/;
}
/* Overlays */
.ui-widget-overlay {
background: #aaaaaa/*{bgColorOverlay}*/ /*{bgImgUrlOverlay}*/ /*{bgOverlayXPos}*/ /*{bgOverlayYPos}*/ /*{bgOverlayRepeat}*/;
opacity: .3/*{opacityOverlay}*/;
filter: Alpha(Opacity=30)/*{opacityFilterOverlay}*/; /* support: IE8 */
}
.ui-widget-shadow {
-webkit-box-shadow: 0/*{offsetLeftShadow}*/ 0/*{offsetTopShadow}*/ 5px/*{thicknessShadow}*/ #666666/*{bgColorShadow}*/;
box-shadow: 0/*{offsetLeftShadow}*/ 0/*{offsetTopShadow}*/ 5px/*{thicknessShadow}*/ #666666/*{bgColorShadow}*/;
}
| {
"content_hash": "efe8fe43dba21130a2b3717fed20d02e",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 135,
"avg_line_length": 41.07710280373832,
"alnum_prop": 0.6978556396109437,
"repo_name": "GrayYoung/jQuery.UI.Extension",
"id": "bb097bf296e5d669f5e6a06f8f0bce7a514a2674",
"size": "17892",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "themes/base/theme.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "58844"
},
{
"name": "HTML",
"bytes": "155294"
},
{
"name": "JavaScript",
"bytes": "1486833"
}
],
"symlink_target": ""
} |
<?php namespace Tests\Support\Helpers;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\URI;
use Config\App;
/**
* ControllerTester Trait
*
* Provides features that make testing controllers simple and fluent.
*
* Example:
*
* $this->withRequest($request)
* ->withResponse($response)
* ->withURI($uri)
* ->withBody($body)
* ->controller('App\Controllers\Home')
* ->run('methodName');
*/
trait ControllerTester
{
protected $appConfig;
protected $request;
protected $response;
protected $controller;
protected $uri = 'http://example.com';
protected $body;
/**
* Loads the specified controller, and generates any needed dependencies.
*
* @param string $name
*
* @return mixed
*/
public function controller(string $name)
{
if (! class_exists($name))
{
throw new \InvalidArgumentException('Invalid Controller: '.$name);
}
if (empty($this->appConfig))
{
$this->appConfig = new App();
}
if (empty($this->request))
{
$this->request = new IncomingRequest($this->appConfig, $this->uri, $this->body);
}
if (empty($this->response))
{
$this->response = new Response($this->appConfig);
}
$this->controller = new $name($this->request, $this->response);
return $this;
}
/**
* Runs the specified method on the controller and returns the results.
*
* @param string $method
* @param array $params
*
* @return \Tests\Support\Helpers\ControllerResponse
*/
public function execute(string $method, ...$params)
{
if (! method_exists($this->controller, $method) || ! is_callable([$this->controller, $method]))
{
throw new \InvalidArgumentException('Method does not exist or is not callable in controller: '.$method);
}
// The URL helper is always loaded by the system
// so ensure it's available.
helper('url');
$result = (new ControllerResponse())
->setRequest($this->request)
->setResponse($this->response);
try
{
ob_start();
$response = $this->controller->{$method}(...$params);
}
catch (\Throwable $e)
{
$result->response()
->setStatusCode($e->getCode());
}
finally
{
$output = ob_get_clean();
// If the controller returned a redirect response
// then we need to use that...
if (isset($response) && $response instanceof Response)
{
$result->setResponse($response);
}
$result->response()->setBody($output);
$result->setBody($output);
}
// If not response code has been sent, assume a success
if (empty($result->response()->getStatusCode()))
{
$result->response()->setStatusCode(200);
}
return $result;
}
/**
* @param mixed $appConfig
*
* @return mixed
*/
public function withConfig($appConfig)
{
$this->appConfig = $appConfig;
return $this;
}
/**
* @param mixed $request
*
* @return mixed
*/
public function withRequest($request)
{
$this->request = $request;
return $this;
}
/**
* @param mixed $response
*
* @return mixed
*/
public function withResponse($response)
{
$this->response = $response;
return $this;
}
/**
* @param string $uri
*
* @return mixed
*/
public function withUri(string $uri)
{
$this->uri = new URI($uri);
return $this;
}
/**
* @param mixed $body
*
* @return mixed
*/
public function withBody($body)
{
$this->body = $body;
return $this;
}
}
| {
"content_hash": "b4707de1b11f7614b1f0d59da7808782",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 107,
"avg_line_length": 18.084656084656086,
"alnum_prop": 0.6284376828554711,
"repo_name": "JuveLee/CodeIgniter4",
"id": "bf97190ac26e10dab53e981077c044755a111bf4",
"size": "3418",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "tests/_support/Helpers/ControllerTester.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "142662"
},
{
"name": "HTML",
"bytes": "24555"
},
{
"name": "JavaScript",
"bytes": "22440"
},
{
"name": "Makefile",
"bytes": "4808"
},
{
"name": "PHP",
"bytes": "2371353"
},
{
"name": "Python",
"bytes": "11560"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace Sicily.Gps
{
//=======================================================================
/// <summary>
/// Ground speed and course data
/// </summary>
public class VtgData
{
/// <summary>
/// Heading, from true north, in degrees
/// </summary>
public decimal TrueHeading
{
get { return this._trueHeading; }
set { this._trueHeading = value; }
}
protected decimal _trueHeading;
/// <summary>
/// Heading, from magnetic north, in degrees
/// </summary>
public decimal MagneticHeading
{
get { return this._magneticHeading; }
set { this._magneticHeading = value; }
}
protected decimal _magneticHeading;
/// <summary>
/// Velocity of travel over the ground in knots
/// </summary>
public decimal GroundSpeedInKnots
{
get { return this._groundSpeedInKnots; }
set { this._groundSpeedInKnots = value; }
}
protected decimal _groundSpeedInKnots;
/// <summary>
/// Velocity of travel over the ground in Kilometers per Hour (KMH)
/// </summary>
public decimal GroundSpeedInKmh
{
get { return this._groundSpeedInKmh; }
set { this._groundSpeedInKmh = value; }
}
protected decimal _groundSpeedInKmh;
/// <summary>
///
/// </summary>
public GpsMode Mode
{
get { return this._mode; }
set { this._mode = value; }
}
protected GpsMode _mode;
/// <summary>
///
/// </summary>
public int CheckSum
{
get { return this._checkSum; }
set { this._checkSum = value; }
}
protected int _checkSum;
}
//=======================================================================
}
| {
"content_hash": "2048150ce443e343bec0a9b4fa4c892b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 74,
"avg_line_length": 23.226666666666667,
"alnum_prop": 0.5545350172215844,
"repo_name": "mksmbrtsh/gpstalk",
"id": "b07ea24ca8629ef7ea04f8202054863a8b39c992",
"size": "1744",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gpstalk_PDA/SimpleTypes/VtgData.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "56990"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-pom</artifactId>
<version>1.11.11-SNAPSHOT</version>
</parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-iam</artifactId>
<name>AWS Java SDK for AWS IAM</name>
<description>The AWS Java SDK for AWS IAM module holds the client classes that are used for communicating with AWS Identity and Access Management Service</description>
<url>https://aws.amazon.com/sdkforjava</url>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.10</version>
<optional>false</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>versiondiff</id>
<build>
<plugins>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.5.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>cmp</goal>
</goals>
</execution>
</executions>
<configuration>
<oldVersion>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-iam</artifactId>
<version>RELEASE</version>
</dependency>
</oldVersion>
<newVersion>
<file>
<path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
</file>
</newVersion>
<parameter>
<onlyModified>true</onlyModified>
<accessModifier>public</accessModifier>
<breakBuildOnModifications>false</breakBuildOnModifications>
<breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications>
<onlyBinaryIncompatible>false</onlyBinaryIncompatible>
</parameter>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
| {
"content_hash": "2a03bdf7914d1e6d7f9f899f3e9de249",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 169,
"avg_line_length": 35.8421052631579,
"alnum_prop": 0.580029368575624,
"repo_name": "nterry/aws-sdk-java",
"id": "b97c136a2186dabdc37afd657a9e3d268a15ab98",
"size": "2724",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-iam/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "FreeMarker",
"bytes": "126417"
},
{
"name": "Java",
"bytes": "113994954"
},
{
"name": "Scilab",
"bytes": "3561"
}
],
"symlink_target": ""
} |
import win from 'global/window'
import { isString } from './utils'
type OriginLocation = {
protocol: 'http:' | 'https:'
hostname: string
port?: string
}
const isLocation = (origin: any): origin is OriginLocation =>
origin?.protocol && origin?.hostname
const determineOrigin = (
origin: string | OriginLocation | undefined
): string => {
const actualOrigin = origin ?? win?.location
if (isLocation(actualOrigin)) {
const { protocol, hostname, port } = actualOrigin
return `${protocol}//${hostname}${port ? `:${port}` : ''}`
}
if (isString(actualOrigin)) {
return actualOrigin
}
return ''
}
export default determineOrigin
| {
"content_hash": "7b7c8df20ba8175665e9b32ba8ff18a9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 62,
"avg_line_length": 23.535714285714285,
"alnum_prop": 0.669195751138088,
"repo_name": "reimagined/resolve",
"id": "d279943778293a47f7921594a0a25366fec4c91f",
"size": "659",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "packages/core/client/src/determine-origin.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11199"
},
{
"name": "JavaScript",
"bytes": "724085"
},
{
"name": "TypeScript",
"bytes": "2067323"
},
{
"name": "Vue",
"bytes": "2902"
}
],
"symlink_target": ""
} |
#ifdef SUPPORT_ITUNES
#include <cybergarage/upnp/media/server/directory/itunes/iTunesPlaylistItemList.h>
using namespace CyberLink;
////////////////////////////////////////////////
// Methods
////////////////////////////////////////////////
void iTunesPlaylistItemList::clear()
{
int nTrack= size();
for (int n=0; n<nTrack; n++) {
iTunesPlaylistItem *item = getItem(n);
delete item;
}
Vector::clear();
}
#endif
| {
"content_hash": "d119e73971c105137b27d9dcad6dfb81",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 82,
"avg_line_length": 19.565217391304348,
"alnum_prop": 0.5222222222222223,
"repo_name": "cybergarage/mupnpcc",
"id": "07d37018531d76a5ca050b5b8adfdf9e42af56eb",
"size": "747",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "std/src/cybergarage/upnp/media/server/directory/itunes/iTunesPlaylistItemList.cpp",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "831"
},
{
"name": "C++",
"bytes": "702384"
},
{
"name": "Makefile",
"bytes": "147780"
},
{
"name": "Perl",
"bytes": "2069"
},
{
"name": "Ruby",
"bytes": "654"
},
{
"name": "Shell",
"bytes": "310343"
}
],
"symlink_target": ""
} |
define([
'configuration/plugins/registry',
'util/promise',
], function(registry) {
const createFakeStore = (fakeData, dispatch) => ({
dispatch,
getState() {
return fakeData;
}
});
const dispatchWithStoreAndExtension = ({ store, extensionConfig, action }) => {
const moduleId = '/base/jsc/data/web-worker/store/middleware/undo';
requirejs.undef(moduleId);
if (extensionConfig) {
registry.registerExtension('org.visallo.store', extensionConfig);
}
return Promise.require(moduleId)
.then(undo => {
let dispatched;
const dispatch = undo(store)(actionAttempt => {
dispatched = actionAttempt;
});
dispatch(action);
return dispatched;
});
};
describe('undo middleware', () => {
it('should always call next to dispatch the original action', () => {
const action = { type: 'NOT_UNDO' };
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: []
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch undo when there is nothing to undo', () => {
const action = { type: 'UNDO' };
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: []
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch a scoped undo when the scope has no history', () => {
const action = {
type: 'UNDO',
payload: { undoScope: 1 }
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [ { type: 'TEST' }],
redos: []
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch a scoped undo when there is nothing to undo', () => {
const action = { type: 'UNDO', scope: 1 };
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [{ type: 'TEST' }],
redos: []
},
1: {
undos: [],
redos: []
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch undo when there is not a plugin for the type', () => {
const action = { type: 'UNDO' };
const actionToUndo = {
type: 'NO_PLUGIN',
undo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [ actionToUndo ],
redos: []
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
undo: () => ({ type: 'UNDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch undo when there is not a plugin scoped for the type', () => {
const action = { type: 'UNDO', scope: 1 };
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [ { type: 'TEST' }],
redos: []
},
1: {
undos: [ { type: 'NO_PLUGIN' } ],
redos: []
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
undo: () => ({ type: 'UNDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should dispatch the last undo action when there is at least one action', () => {
const action = { type: 'UNDO' };
const actionToUndo = {
type: 'TEST',
undo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [ actionToUndo ],
redos: []
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
undo: () => ({ type: 'UNDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.have.been.calledWith({ type: 'UNDO_TEST' });
});
});
it('should dispatch the last scoped undo action when there is at least one scoped action', () => {
const action = {
type: 'UNDO',
payload: { undoScope: 1 }
};
const actionToUndo = {
type: 'TEST',
undo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: []
},
1: {
undos: [ actionToUndo ],
redos: []
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
undo: () => ({ type: 'UNDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.have.been.calledWith({ type: 'UNDO_TEST' });
});
});
it("should dispatch an undo action with the saved action's undo payload", () => {
const action = { type: 'UNDO' };
const actionToUndo = {
type: 'TEST',
undo: {
data: 'TEST_PAYLOAD'
}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [ actionToUndo ],
redos: []
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
undo: undo => ({
type: 'UNDO_TEST',
...undo
})
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.have.been.calledWith({
type: 'UNDO_TEST',
data: 'TEST_PAYLOAD'
});
});
});
it('should not dispatch redo when there is nothing to redo', () => {
const action = { type: 'REDO' };
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: []
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch a scoped redo when the scope has no history', () => {
const action = {
type: 'REDO',
payload: { undoScope: 1 }
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: [{ type: 'TEST' }]
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch a scoped redo when there is nothing to redo', () => {
const action = {
type: 'REDO',
payload: { undoScope: 1 }
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: [{ type: 'TEST' }]
},
1: {
undos: [],
redos: []
}
}
},
dispatch
);
return dispatchWithStoreAndExtension({
store,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch redo when there is not a plugin for the type', () => {
const action = { type: 'REDO' };
const actionToRedo = {
type: 'NO_PLUGIN',
redo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: [ actionToRedo ]
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
redo: () => ({ type: 'REDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should not dispatch redo when there is not a plugin scoped for the type', () => {
const action = {
type: 'REDO',
scope: 1
};
const actionToRedo = {
type: 'NO_PLUGIN',
redo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: [ { type: 'TEST' }]
},
1: {
undos: [],
redos: [ { type: 'NO_PLUGIN' } ]
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
redo: () => ({ type: 'REDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.not.have.been.called;
});
});
it('should dispatch the last redo action when there is at least one action', () => {
const action = { type: 'REDO' };
const actionToRedo = {
type: 'TEST',
redo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: [ actionToRedo ]
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
redo: () => ({ type: 'REDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.have.been.calledWith({ type: 'REDO_TEST' });
});
});
it('should dispatch the last scoped redo action when there is at least one action', () => {
const action = {
type: 'REDO',
payload: { undoScope: 1 }
};
const actionToRedo = {
type: 'TEST',
redo: {}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: []
},
1: {
undos: [],
redos: [ actionToRedo ]
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
redo: () => ({ type: 'REDO_TEST' })
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.have.been.calledWith({ type: 'REDO_TEST' });
});
});
it("should dispatch a redo action with the saved action's redo payload", () => {
const action = { type: 'REDO' };
const actionToRedo = {
type: 'TEST',
redo: {
data: 'TEST_PAYLOAD'
}
};
const dispatch = sinon.spy();
const store = createFakeStore(
{
undoActionHistory: {
global: {
undos: [],
redos: [ actionToRedo ]
}
}
},
dispatch
);
const extensionConfig = {
key: 'test',
undoActions: {
TEST: {
redo: redo => ({
type: 'REDO_TEST',
...redo
})
}
}
};
return dispatchWithStoreAndExtension({
store,
extensionConfig,
action
}).then(result => {
expect(result).to.equal(action);
dispatch.should.have.been.calledWith({
type: 'REDO_TEST',
data: 'TEST_PAYLOAD'
});
});
});
});
});
| {
"content_hash": "d79a1c237795a1ae41729d58ff6d490c",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 106,
"avg_line_length": 31.415064102564102,
"alnum_prop": 0.3394888537468755,
"repo_name": "visallo/visallo",
"id": "ee98d9573f8765f6e582154a54ccc7a28a936523",
"size": "19603",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/war/src/main/webapp/test/unit/spec/data/web-worker/store/middleware/undoMiddlewareTest.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "205371"
},
{
"name": "Go",
"bytes": "2988"
},
{
"name": "HTML",
"bytes": "66006"
},
{
"name": "Java",
"bytes": "3686598"
},
{
"name": "JavaScript",
"bytes": "4648797"
},
{
"name": "Makefile",
"bytes": "623"
},
{
"name": "Shell",
"bytes": "17212"
}
],
"symlink_target": ""
} |
module Network.Riak.HTTP (
put, tryPut, putWithRandomKey, putWithIndexes, get, tryGet, delete,
tryDelete, lookupIndex, lookupIndexRange, tryClients, getListOfKeys,
defaultClient, Types.host, Types.port, Client,
Bucket, Key, IndexKey, IndexValue (..), IndexTag,
module Network.Riak.HTTP.MapReduce
) where
import Network.Riak.HTTP.Types
import Network.Riak.HTTP.Types as Types
import Network.Riak.HTTP.Internal
import Network.Riak.HTTP.MapReduce
import Network.HTTP
import Network.HTTP.Base
import Network.URI
import Data.ByteString.Lazy.Char8 (ByteString)
put :: Client -> Bucket -> Key -> ByteString -> IO (Either String ())
put client bucket key value = putWithIndexes client bucket key [] value
putWithRandomKey :: Client -> Bucket -> ByteString -> IO (Either String Key)
putWithRandomKey = putWithContentTypeWithRandomKey "text/plain"
-- | Try a put, finding a client where it succeeds
tryPut :: [Client] -> Bucket -> Key -> ByteString -> IO (Either String ())
tryPut clients bucket key value = tryClients clients $ \client ->
put client bucket key value
putWithIndexes :: Client -> Bucket -> Key -> [IndexTag] -> ByteString
-> IO (Either String ())
putWithIndexes = putWithContentType "text/plain"
| {
"content_hash": "e6048e152453b2c31e945bdf26b4d736",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 40.193548387096776,
"alnum_prop": 0.7367576243980738,
"repo_name": "ThoughtLeadr/Riak-Haskell-HTTP-Client",
"id": "64a44cdebff295a86dbbb09ca24f937cbf2a086c",
"size": "1246",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Network/Riak/HTTP.hs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Haskell",
"bytes": "17860"
}
],
"symlink_target": ""
} |
var Marion = require('../../')
, debug = true;
/* Configure your TLS certificate & key or use demo provided as well
* as the server you wish to communcate with */
client = new Marion.Rejewski('client', {
host: 'node.dev',
key: 'test/fixtures/client/Rejewski.key',
cert: 'test/fixtures/client/Rejewski.crt',
passphrase: 'rejewski',
log: debug
});
/* connection, REG, REGOFFER, REGACK & REGFIN are read-only event streams
* we can use to monitor the registration process for new clients */
client.on('connection', function(err, stream){
if (err) throw new Error(err.error);
if (debug) console.log('CLIENT (connection): '+JSON.stringify(stream));
});
client.on('REG', function(err, stream){
if (err) throw new Error(err.error);
if (debug) console.log('CLIENT (REG): '+JSON.stringify(stream));
});
client.on('REGOFFER', function(err, stream){
if (err) throw new Error(err.error);
if (debug) console.log('CLIENT (REGOFFER): '+JSON.stringify(stream));
});
client.on('REGACK', function(err, stream){
if (err) throw new Error(err.error);
if (debug) console.log('CLIENT (REGACK): '+JSON.stringify(stream));
});
client.on('REGFIN', function(err, stream){
if (err) throw new Error(err.error);
if (debug) console.log('CLIENT (REGFIN): '+JSON.stringify(stream));
/* PING event is the writable stream which will provide the transparent
* RSA signed symmetric cihper text (generated from Diffie-Hellman keys)
* to a registered server */
client.emit('PING', {foo: 'bar', key: 'value'});
});
/* PING & PONG event binding are read only streams we can use to verify
* send & recieved payloads */
client.on('PING', function(err, stream){
// if (err) throw new Error(err.error);
if (debug && stream) console.log('CLIENT (PING): '+JSON.stringify(stream));
});
client.on('PONG', function(err, stream){
if (err) throw new Error(err.error);
if (debug) console.log('CLIENT (PONG): '+JSON.stringify(stream));
});
| {
"content_hash": "ab800dd704d3f350be774d5d45063a82",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 33.60344827586207,
"alnum_prop": 0.680861980502822,
"repo_name": "jas-/Rejewski",
"id": "818ac25501c68bdeb4dce9e833a54608abc27712",
"size": "2798",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/examples/client.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "102411"
},
{
"name": "Makefile",
"bytes": "90"
}
],
"symlink_target": ""
} |
#ifndef CDSUNIT_SET_TYPE_SPLIT_LIST_H
#define CDSUNIT_SET_TYPE_SPLIT_LIST_H
#include "set_type.h"
#include <cds/container/michael_list_hp.h>
#include <cds/container/michael_list_dhp.h>
#include <cds/container/michael_list_rcu.h>
#include <cds/container/lazy_list_hp.h>
#include <cds/container/lazy_list_dhp.h>
#include <cds/container/lazy_list_rcu.h>
#include <cds/container/iterable_list_hp.h>
#include <cds/container/iterable_list_dhp.h>
#include <cds/container/split_list_set.h>
#include <cds/container/split_list_set_rcu.h>
#include <cds_test/stat_splitlist_out.h>
#include <cds_test/stat_michael_list_out.h>
#include <cds_test/stat_lazy_list_out.h>
#include <cds_test/stat_iterable_list_out.h>
namespace set {
template <typename GC, typename T, typename Traits = cc::split_list::traits>
class SplitListSet : public cc::SplitListSet< GC, T, Traits >
{
typedef cc::SplitListSet< GC, T, Traits > base_class;
public:
template <typename Config>
SplitListSet( Config const& cfg )
: base_class( cfg.s_nSetSize, cfg.s_nLoadFactor )
{}
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
struct tag_SplitListSet;
template <typename Key, typename Val>
struct set_type< tag_SplitListSet, Key, Val >: public set_type_base< Key, Val >
{
typedef set_type_base< Key, Val > base_class;
typedef typename base_class::key_val key_val;
typedef typename base_class::compare compare;
typedef typename base_class::less less;
typedef typename base_class::hash hash;
// ***************************************************************************
// SplitListSet based on MichaelList
struct traits_SplitList_Michael_dyn_cmp :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::compare< compare >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_HP_dyn_cmp;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_DHP_dyn_cmp;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_GPI_dyn_cmp;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_GPB_dyn_cmp;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_GPT_dyn_cmp;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_SHB_dyn_cmp;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_SHT_dyn_cmp;
#endif
struct traits_SplitList_Michael_dyn_cmp_stat :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,co::hash< hash >
,co::stat< cc::split_list::stat<> >
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::compare< compare >
,co::stat< cc::michael_list::stat<>>
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_HP_dyn_cmp_stat;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_DHP_dyn_cmp_stat;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_GPI_dyn_cmp_stat;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_GPB_dyn_cmp_stat;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_GPT_dyn_cmp_stat;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_SHB_dyn_cmp_stat;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_SHT_dyn_cmp_stat;
#endif
struct traits_SplitList_Michael_dyn_cmp_seqcst :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,co::hash< hash >
,co::memory_model< co::v::sequential_consistent >
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::compare< compare >
,co::memory_model< co::v::sequential_consistent >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_HP_dyn_cmp_seqcst;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_DHP_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_GPI_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_GPB_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_GPT_dyn_cmp_seqcst;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_SHB_dyn_cmp_seqcst;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_SHT_dyn_cmp_seqcst;
#endif
struct traits_SplitList_Michael_st_cmp :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::compare< compare >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_HP_st_cmp;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_DHP_st_cmp;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_GPI_st_cmp;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_GPB_st_cmp;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_GPT_st_cmp;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_SHB_st_cmp;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_SHT_st_cmp;
#endif
//HP + less
struct traits_SplitList_Michael_dyn_less :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::less< less >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_HP_dyn_less;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_DHP_dyn_less;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_GPI_dyn_less;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_GPB_dyn_less;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_GPT_dyn_less;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_SHB_dyn_less;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_SHT_dyn_less;
#endif
struct traits_SplitList_Michael_st_less :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::less< less >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_HP_st_less;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_DHP_st_less;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_GPI_st_less;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_GPB_st_less;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_GPT_st_less;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_SHB_st_less;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_SHT_st_less;
#endif
struct traits_SplitList_Michael_st_less_stat :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::michael_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,co::stat< cc::split_list::stat<>>
,cc::split_list::ordered_list_traits<
typename cc::michael_list::make_traits<
co::less< less >
,co::stat< cc::michael_list::stat<>>
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_HP_st_less_stat;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_DHP_st_less_stat;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_GPI_st_less_stat;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_GPB_st_less_stat;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_GPT_st_less_stat;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_SHB_st_less_stat;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_SHT_st_less_stat;
#endif
// ***************************************************************************
// SplitListSet based on LazyList
struct traits_SplitList_Lazy_dyn_cmp :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::lazy_list_tag>
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
co::compare< compare >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_HP_dyn_cmp;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_DHP_dyn_cmp;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_GPI_dyn_cmp;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_GPB_dyn_cmp;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_GPT_dyn_cmp;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHB_dyn_cmp;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHT_dyn_cmp;
#endif
struct traits_SplitList_Lazy_dyn_cmp_stat : public traits_SplitList_Lazy_dyn_cmp
{
typedef cc::split_list::stat<> stat;
typedef typename cc::lazy_list::make_traits<
co::compare< compare >
, co::stat< cc::lazy_list::stat<>>
>::type ordered_list_traits;
};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_HP_dyn_cmp_stat;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_DHP_dyn_cmp_stat;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_RCU_GPI_dyn_cmp_stat;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_RCU_GPB_dyn_cmp_stat;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_RCU_GPT_dyn_cmp_stat;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHB_dyn_cmp_stat;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHT_dyn_cmp_stat;
#endif
struct traits_SplitList_Lazy_dyn_cmp_seqcst :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::lazy_list_tag>
,co::hash< hash >
,co::memory_model< co::v::sequential_consistent >
,cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
co::compare< compare >
,co::memory_model< co::v::sequential_consistent >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_HP_dyn_cmp_seqcst;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_DHP_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_GPI_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_GPB_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_GPT_dyn_cmp_seqcst;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_SHB_dyn_cmp_seqcst;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_SHT_dyn_cmp_seqcst;
#endif
struct traits_SplitList_Lazy_st_cmp :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::lazy_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
co::compare< compare >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_HP_st_cmp;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_DHP_st_cmp;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_GPI_st_cmp;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_GPB_st_cmp;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_GPT_st_cmp;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_SHB_st_cmp;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_SHT_st_cmp;
#endif
struct traits_SplitList_Lazy_dyn_less :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::lazy_list_tag>
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
co::less< less >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_HP_dyn_less;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_DHP_dyn_less;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_GPI_dyn_less;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_GPB_dyn_less;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_GPT_dyn_less;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_SHB_dyn_less;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_SHT_dyn_less;
#endif
struct traits_SplitList_Lazy_st_less :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::lazy_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
co::less< less >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_HP_st_less;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_DHP_st_less;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_GPI_st_less;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_GPB_st_less;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_GPT_st_less;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_SHB_st_less;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_SHT_st_less;
#endif
struct traits_SplitList_Lazy_st_less_stat : public traits_SplitList_Lazy_st_less
{
typedef cc::split_list::stat<> stat;
typedef typename cc::lazy_list::make_traits<
co::less< less >
, co::stat< cc::lazy_list::stat<>>
>::type ordered_list_traits;
};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_HP_st_less_stat;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_DHP_st_less_stat;
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_GPI_st_less_stat;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_GPB_st_less_stat;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_GPT_st_less_stat;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_SHB_st_less_stat;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_SHT_st_less_stat;
#endif
// ***************************************************************************
// SplitListSet based on IterableList
struct traits_SplitList_Iterable_dyn_cmp :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::compare< compare >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_HP_dyn_cmp;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_DHP_dyn_cmp;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_RCU_GPI_dyn_cmp;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_RCU_GPB_dyn_cmp;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_RCU_GPT_dyn_cmp;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_RCU_SHB_dyn_cmp;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_dyn_cmp > SplitList_Iterable_RCU_SHT_dyn_cmp;
#endif
#endif
struct traits_SplitList_Iterable_dyn_cmp_stat:
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,co::hash< hash >
,co::stat< cc::split_list::stat<> >
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::compare< compare >
,co::stat< cc::iterable_list::stat<>>
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_HP_dyn_cmp_stat;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_DHP_dyn_cmp_stat;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_RCU_GPI_dyn_cmp_stat;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_RCU_GPB_dyn_cmp_stat;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_RCU_GPT_dyn_cmp_stat;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_RCU_SHB_dyn_cmp_stat;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_RCU_SHT_dyn_cmp_stat;
#endif
#endif
struct traits_SplitList_Iterable_dyn_cmp_seqcst :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,co::hash< hash >
,co::memory_model< co::v::sequential_consistent >
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::compare< compare >
,co::memory_model< co::v::sequential_consistent >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_HP_dyn_cmp_seqcst;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_DHP_dyn_cmp_seqcst;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_RCU_GPI_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_RCU_GPB_dyn_cmp_seqcst;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_RCU_GPT_dyn_cmp_seqcst;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_RCU_SHB_dyn_cmp_seqcst;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_dyn_cmp_seqcst > SplitList_Iterable_RCU_SHT_dyn_cmp_seqcst;
#endif
#endif
struct traits_SplitList_Iterable_st_cmp :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::compare< compare >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_HP_st_cmp;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_DHP_st_cmp;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_RCU_GPI_st_cmp;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_RCU_GPB_st_cmp;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_RCU_GPT_st_cmp;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_RCU_SHB_st_cmp;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_st_cmp > SplitList_Iterable_RCU_SHT_st_cmp;
#endif
#endif
//HP + less
struct traits_SplitList_Iterable_dyn_less :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::less< less >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_HP_dyn_less;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_DHP_dyn_less;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_RCU_GPI_dyn_less;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_RCU_GPB_dyn_less;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_RCU_GPT_dyn_less;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_RCU_SHB_dyn_less;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_dyn_less > SplitList_Iterable_RCU_SHT_dyn_less;
#endif
#endif
struct traits_SplitList_Iterable_st_less :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::less< less >
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_HP_st_less;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_DHP_st_less;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_RCU_GPI_st_less;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_RCU_GPB_st_less;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_RCU_GPT_st_less;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_RCU_SHB_st_less;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_st_less > SplitList_Iterable_RCU_SHT_st_less;
#endif
#endif
struct traits_SplitList_Iterable_st_less_stat :
public cc::split_list::make_traits<
cc::split_list::ordered_list<cc::iterable_list_tag>
,cc::split_list::dynamic_bucket_table< false >
,co::hash< hash >
,co::stat< cc::split_list::stat<>>
,cc::split_list::ordered_list_traits<
typename cc::iterable_list::make_traits<
co::less< less >
,co::stat< cc::iterable_list::stat<>>
>::type
>
>::type
{};
typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_HP_st_less_stat;
typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_DHP_st_less_stat;
#if 0
typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_RCU_GPI_st_less_stat;
typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_RCU_GPB_st_less_stat;
typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_RCU_GPT_st_less_stat;
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_RCU_SHB_st_less_stat;
typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_RCU_SHT_st_less_stat;
#endif
#endif
};
template <typename GC, typename T, typename Traits>
static inline void print_stat( cds_test::property_stream& o, SplitListSet<GC, T, Traits> const& s )
{
o << s.statistics()
<< cds_test::stat_prefix( "list_stat" )
<< s.list_statistics()
<< cds_test::stat_prefix( "" );
}
} // namespace set
#define CDSSTRESS_SplitListSet_case( fixture, test_case, splitlist_set_type, key_type, value_type, level ) \
TEST_P( fixture, splitlist_set_type ) \
{ \
if ( !check_detail_level( level )) return; \
typedef set::set_type< tag_SplitListSet, key_type, value_type >::splitlist_set_type set_type; \
test_case<set_type>(); \
}
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
# define CDSSTRESS_SplitListSet_SHRCU( fixture, test_case, key_type, value_type ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHB_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_SHT_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHB_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHT_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHB_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHT_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHB_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHT_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHB_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHT_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHB_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHT_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHB_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_SHT_st_less_stat, key_type, value_type, 0 ) \
# define CDSSTRESS_SplitListIterableSet_SHRCU( fixture, test_case, key_type, value_type )
/*
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHB_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_SHT_st_less_stat, key_type, value_type, 1 ) \
*/
#else
# define CDSSTRESS_SplitListSet_SHRCU( fixture, test_case, key_type, value_type )
# define CDSSTRESS_SplitListIterableSet_SHRCU( fixture, test_case, key_type, value_type )
#endif
#define CDSSTRESS_SplitListSet( fixture, test_case, key_type, value_type ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_HP_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_DHP_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPI_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPB_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Michael_RCU_GPT_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_HP_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_DHP_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPI_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPB_dyn_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPT_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_HP_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_DHP_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPI_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPB_dyn_cmp_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPT_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_HP_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_DHP_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPI_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPB_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPT_st_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_HP_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_DHP_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPI_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPB_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPT_dyn_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_HP_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_DHP_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPI_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPB_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPT_st_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_HP_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_DHP_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPI_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPB_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Lazy_RCU_GPT_st_less_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_SHRCU( fixture, test_case, key_type, value_type )
#define CDSSTRESS_SplitListIterableSet( fixture, test_case, key_type, value_type ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_dyn_cmp, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_dyn_cmp, key_type, value_type, 1 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_dyn_cmp, key_type, value_type, 0 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_dyn_cmp, key_type, value_type, 1 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_dyn_cmp, key_type, value_type, 0 )*/ \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_dyn_cmp_stat, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_dyn_cmp_stat, key_type, value_type, 0 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_dyn_cmp_stat, key_type, value_type, 1 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_dyn_cmp_stat, key_type, value_type, 0 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_dyn_cmp_stat, key_type, value_type, 1 )*/ \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_dyn_cmp_seqcst, key_type, value_type, 2 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_dyn_cmp_seqcst, key_type, value_type, 2 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_dyn_cmp_seqcst, key_type, value_type, 2 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_dyn_cmp_seqcst, key_type, value_type, 2 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_dyn_cmp_seqcst, key_type, value_type, 2 )*/ \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_st_cmp, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_st_cmp, key_type, value_type, 0 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_st_cmp, key_type, value_type, 1 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_st_cmp, key_type, value_type, 0 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_st_cmp, key_type, value_type, 1 )*/ \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_dyn_less, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_dyn_less, key_type, value_type, 1 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_dyn_less, key_type, value_type, 0 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_dyn_less, key_type, value_type, 1 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_dyn_less, key_type, value_type, 0 )*/ \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_st_less, key_type, value_type, 1 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_st_less, key_type, value_type, 0 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_st_less, key_type, value_type, 1 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_st_less, key_type, value_type, 0 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_st_less, key_type, value_type, 1 )*/ \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_HP_st_less_stat, key_type, value_type, 0 ) \
CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_DHP_st_less_stat, key_type, value_type, 1 ) \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPI_st_less_stat, key_type, value_type, 0 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPB_st_less_stat, key_type, value_type, 1 )*/ \
/*CDSSTRESS_SplitListSet_case( fixture, test_case, SplitList_Iterable_RCU_GPT_st_less_stat, key_type, value_type, 0 )*/ \
CDSSTRESS_SplitListIterableSet_SHRCU( fixture, test_case, key_type, value_type )
#endif // #ifndef CDSUNIT_SET_TYPE_SPLIT_LIST_H
| {
"content_hash": "6ffe8ab30f92009e147aaf68a18fdbc0",
"timestamp": "",
"source": "github",
"line_count": 716,
"max_line_length": 134,
"avg_line_length": 70.65782122905028,
"alnum_prop": 0.6491668478583147,
"repo_name": "eugenyk/libcds",
"id": "1929995429d01b0a13dc6126960e1289bd378db3",
"size": "52162",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/stress/set/set_type_split_list.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "649"
},
{
"name": "C",
"bytes": "133185"
},
{
"name": "C++",
"bytes": "9230672"
},
{
"name": "CMake",
"bytes": "61927"
},
{
"name": "HTML",
"bytes": "466"
},
{
"name": "Perl",
"bytes": "874"
},
{
"name": "Shell",
"bytes": "16"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<!--
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>hbase-indexer-demo</artifactId>
<name>HBase Indexer: Demo</name>
<parent>
<groupId>com.ngdata</groupId>
<artifactId>hbase-indexer</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${version.hadoop}</version>
</dependency>
<!-- Normally, client applications don't need to depend on hbase-indexer stuff, we only
use it here to load the hbase connection settings from hbase-indexer-site.xml -->
<dependency>
<groupId>com.ngdata</groupId>
<artifactId>hbase-indexer-common</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
</dependency>
</dependencies>
</project>
| {
"content_hash": "0c458e9de6a414b67d7a4946d4148893",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 204,
"avg_line_length": 32.52777777777778,
"alnum_prop": 0.6780529461998293,
"repo_name": "chenrongwei/hbase-indexer",
"id": "b3f1a9a49f7f5d358e2be85b76b890763694b0c2",
"size": "1763",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "hbase-indexer-demo/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1371214"
},
{
"name": "Shell",
"bytes": "23076"
}
],
"symlink_target": ""
} |
#ifndef _OGREAXISALIGNEDBOXADAPTER_H
#define _OGREAXISALIGNEDBOXADAPTER_H
#include "Pathfinding/Math/PathfindingAxisAlignedBox.h"
#include "Pathfinding/Math/PathfindingVector3Adapter.h"
namespace PathIrr
{
/** @class PathfindingAxisAlignedBoxAdapter PathfindingAxisAlignedBoxAdapter.h "include/GOOFPathfinding/Utilities/Math/PathfindingAxisAlignedBoxAdapter.h"
*
* This class is an adapter to interchange from Ogre::AxisAlignedBox to Pathfinding::Math::AxisAlignedBox
*/
class PathfindingAxisAlignedBoxAdapter : public Pathfinding::Math::AxisAlignedBox
{
public:
PathfindingAxisAlignedBoxAdapter( core::aabbox3df &in_adaptee ) : Pathfinding::Math::AxisAlignedBox( PathfindingVector3Adapter( in_adaptee.getMinimum() ), PathfindingVector3Adapter( in_adaptee.getMaximum() ) )
{
}
PathfindingAxisAlignedBoxAdapter( const core::aabbox3df &in_adaptee ) : Pathfinding::Math::AxisAlignedBox( PathfindingVector3Adapter( in_adaptee.getMinimum() ), PathfindingVector3Adapter( in_adaptee.getMaximum() ) )
{
}
};
}
#endif
| {
"content_hash": "cfdff85e9fb9351e01a0442d2aa6d2a5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 218,
"avg_line_length": 30.91176470588235,
"alnum_prop": 0.7897240723120837,
"repo_name": "fredericjoanis/Argorha-Pathfinding",
"id": "53bd7dfc090fb4771c86b071a7d8927c2bb6b65a",
"size": "2063",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/demos/Irrlicht/src/Utilities/Math/PathfindingAxisAlignedBoxAdapter.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "54217"
},
{
"name": "C++",
"bytes": "1293972"
},
{
"name": "CSS",
"bytes": "2711"
},
{
"name": "Lua",
"bytes": "12708"
},
{
"name": "Objective-C",
"bytes": "35311"
},
{
"name": "Shell",
"bytes": "1465"
}
],
"symlink_target": ""
} |
<?php
use models\scriptureforge\dto\ProjectPageDto;
use models\AnswerModel;
use models\CommentModel;
use models\QuestionModel;
use models\TextModel;
require_once dirname(__FILE__) . '/../../TestConfig.php';
require_once SimpleTestPath . 'autorun.php';
require_once TestPath . 'common/MongoTestEnvironment.php';
class TestProjectPageDto extends UnitTestCase
{
public function testEncode_TextWithQuestions_DtoReturnsExpectedData()
{
$e = new MongoTestEnvironment();
$e->clean();
$project = $e->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
$projectId = $project->id->asString();
// Two texts, with different numbers of questions for each text and different create dates
$text1 = new TextModel($project);
$text1->title = "Chapter 3";
$text1->content = "I opened my eyes upon a strange and weird landscape. I knew that I was on Mars; …";
$text1->write();
$text1->dateCreated->sub(date_interval_create_from_date_string('1 day'));
$text1Id = $text1->write();
$text2 = new TextModel($project);
$text2->title = "Chapter 4";
$text2->content = "We had gone perhaps ten miles when the ground began to rise very rapidly. …";
$text2Id = $text2->write();
// Answers are tied to specific users, so let's create some sample users
$user1Id = $e->createUser("jcarter", "John Carter", "[email protected]");
$user2Id = $e->createUser("dthoris", "Dejah Thoris", "[email protected]");
// Two questions for text 1...
$question1 = new QuestionModel($project);
$question1->title = "Who is speaking?";
$question1->description = "Who is telling the story in this text?";
$question1->textRef->id = $text1Id;
$question1Id = $question1->write();
$question2 = new QuestionModel($project);
$question2->title = "Where is the storyteller?";
$question2->description = "The person telling this story has just arrived somewhere. Where is he?";
$question2->textRef->id = $text1Id;
$question2Id = $question2->write();
// ... and one question for text 2.
$question3 = new QuestionModel($project);
$question3->title = "How far had they travelled?";
$question3->description = "How far had the group just travelled when this text begins?";
$question3->textRef->id = $text2Id;
$question3Id = $question3->write();
// One answer for question 1...
$answer1 = new AnswerModel();
$answer1->content = "Me, John Carter.";
$answer1->score = 10;
$answer1->userRef->id = $user1Id;
$answer1->textHightlight = "I knew that I was on Mars";
$answer1Id = $question1->writeAnswer($answer1);
// ... and two answers for question 2...
$answer2 = new AnswerModel();
$answer2->content = "On Mars.";
$answer2->score = 1;
$answer2->userRef->id = $user1Id;
$answer2->textHightlight = "I knew that I was on Mars";
$answer2Id = $question2->writeAnswer($answer2);
$answer3 = new AnswerModel();
$answer3->content = "On the planet we call Barsoom, which you inhabitants of Earth normally call Mars.";
$answer3->score = 7;
$answer3->userRef->id = $user2Id;
$answer3->textHightlight = "I knew that I was on Mars";
$answer3Id = $question2->writeAnswer($answer3);
// ... and 1 comment.
$comment1 = new CommentModel();
$comment1->content = "By the way, our name for Earth is Jasoom.";
$comment1->userRef->id = $user2Id;
$comment1Id = QuestionModel::writeComment($project->databaseName(), $question2Id, $answer3Id, $comment1);
$dto = ProjectPageDto::encode($projectId, $user1Id);
// Now check that it all looks right
$this->assertIsa($dto['texts'], 'array');
$this->assertEqual($dto['texts'][0]['id'], $text2Id);
$this->assertEqual($dto['texts'][1]['id'], $text1Id);
$this->assertEqual($dto['texts'][0]['title'], "Chapter 4");
$this->assertEqual($dto['texts'][1]['title'], "Chapter 3");
$this->assertEqual($dto['texts'][0]['questionCount'], 1);
$this->assertEqual($dto['texts'][1]['questionCount'], 2);
$this->assertEqual($dto['texts'][0]['responseCount'], 0);
$this->assertEqual($dto['texts'][1]['responseCount'], 4);
// archive 1 Question
$question2->isArchived = true;
$question2->write();
$dto = ProjectPageDto::encode($projectId, $user1Id);
$this->assertEqual($dto['texts'][0]['questionCount'], 1);
$this->assertEqual($dto['texts'][1]['questionCount'], 1);
$this->assertEqual($dto['texts'][0]['responseCount'], 0);
$this->assertEqual($dto['texts'][1]['responseCount'], 1);
}
}
| {
"content_hash": "185b794637285662f68688f7a676d219",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 113,
"avg_line_length": 42.80701754385965,
"alnum_prop": 0.6118852459016394,
"repo_name": "UpstatePedro/web-languageforge",
"id": "a0e720427cd9c711cc4f7336d8f6dca89a411f4a",
"size": "4884",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/php/scriptureforge/dto/ProjectPageDto_Test.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "312"
},
{
"name": "Batchfile",
"bytes": "699"
},
{
"name": "C#",
"bytes": "5038"
},
{
"name": "CSS",
"bytes": "145452"
},
{
"name": "HTML",
"bytes": "1546531"
},
{
"name": "JavaScript",
"bytes": "707593"
},
{
"name": "PHP",
"bytes": "2704942"
},
{
"name": "Python",
"bytes": "64410"
},
{
"name": "Ruby",
"bytes": "2057"
},
{
"name": "Shell",
"bytes": "14191"
}
],
"symlink_target": ""
} |
import logging
import unittest
import bus
class FakeHandler:
def __init__(self):
self.handle_called = False
self.command = None
def handle(self, command):
self.handle_called = True
self.command = command
class RaiseExceptionHandler:
def __init__(self):
pass
@staticmethod
def handle(command):
raise Exception
class BusTestCase(unittest.TestCase):
def setUp(self):
root = logging.getLogger()
root.setLevel(logging.CRITICAL)
def test_bus_can_register_handler(self):
b = bus.Bus()
command = object
handler = object()
b.register(command, handler)
self.assertTrue(command in b.handlers)
self.assertEqual(handler, b.handlers[command])
def test_execute_handle_method_from_handler(self):
b = bus.Bus()
handler = FakeHandler()
b.register(object, handler)
command = object()
b.execute(command)
self.assertTrue(handler.handle_called)
self.assertEqual(command, handler.command)
def test_handler_raise_exception_in_execute_method(self):
b = bus.Bus()
b.register(object, RaiseExceptionHandler())
command = object()
result = b.execute(command)
self.assertFalse(result.ok)
def test_raise_error_if_no_handlers_availables(self):
b = bus.Bus()
with self.assertRaises(Exception):
b.execute(object())
| {
"content_hash": "eb2925e048863bf549bf8f56f6c17318",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 61,
"avg_line_length": 23.046875,
"alnum_prop": 0.6196610169491525,
"repo_name": "guillaumevincent/rangevoting",
"id": "6fe729973136f9779c45b1f2dda3ceb2cb369709",
"size": "1475",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/test_bus.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12535"
},
{
"name": "HTML",
"bytes": "18111"
},
{
"name": "JavaScript",
"bytes": "19557"
},
{
"name": "Python",
"bytes": "38836"
}
],
"symlink_target": ""
} |
import win32com.client
import array
import PPCOM
from PPCOM import enumInterfaces
from PPCOM import enumFrequencies
from PPCOM import enumSonosArrays
import sys
import os
#Define global variables
m_sLastError = ""
PY3 = sys.version_info.major == 3
#Distinguishing identifier of PSoC3/5 families
LEOPARD_ID = 0xE0;
PANTHER_ID = 0xE1;
def SUCCEEDED(hr):
return hr >= 0
def GetGenerationByJtagID(hr):
return hr >= 0
#Check JTAG ID of device - identify family PSoC3 or PSoC5
def GetGenerationByJtagID(JtagID):
if PY3:
JtagID = [chr(c) for c in JtagID]
distinguisher = (((ord(JtagID[0]) & 0x0F) << 4) | (ord(JtagID[1]) >> 4))
return distinguisher
def IsPSoC3ES3(jtagID):
global LEOPARD_ID
if PY3:
jtagID = [chr(c) for c in jtagID]
if (GetGenerationByJtagID(jtagID) == LEOPARD_ID):
if ((ord(jtagID[0]) >> 4) >= 0x01): return 1 #silicon version==0x01 saved in bits [4..7]
#For ES0-2==0x00, ES3==0x01
return 0
def Is_PSoC5_TM_ID(jtagID):
if PY3:
jtagID = [chr(c) for c in jtagID]
return ((ord(jtagID[0]) & 0xFF) == 0x0E) and ((ord(jtagID[1]) & 0xF0) == 0x10) and (ord(jtagID[3]) == 0x69)
def Is_PSoC_5_LP_ID(jtagID):
#Check whether SWD ID belongs to PSoC5LP
#PSoC5LP: 0x1BA01477 (SWD/JTAG read ID read request retuns CM3 ID always)
# 0x2E1xx069 (LP) - this Device ID must be read from PANTHER_DEVICE_ID reg (0x4008001C)
#2E0xx069
if PY3:
jtagID = [chr(c) for c in jtagID]
return (((ord(jtagID[0]) & 0xFF) >= 0x2E) and ((ord(jtagID[1]) & 0xF0) == 0x10) and (ord(jtagID[3]) == 0x69))
def OpenPort():
global m_sLastError
# Open Port - get last (connected) port in the ports list
hResult = pp.GetPorts()
hr = hResult[0]
portArray = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
if (len(portArray) <= 0):
m_sLastError = "Connect any Programmer to PC"
return -1
bFound = 0
for i in range(0, len(portArray)):
if (portArray[i].startswith("MiniProg3") or portArray[i].startswith("DVKProg") or portArray[i].startswith("FirstTouch") or portArray[i].startswith("Gen-FX2LP") or portArray[i].startswith("KitProg")):
portName = portArray[i]
print('FOUND DEVICE:', portName)
bFound = 1;
break
if(bFound == 0):
m_sLastError = "Connect any MiniProg3/DVKProg/FirstTouch/Gen-FX2LP/KitProg device to the PC"
return -1
#Port should be opened just once to connect Programmer device (MiniProg1/3,etc).
#After that you can use Chip-/Programmer- specific APIs as long as you need.
#No need to repoen port when you need to acquire chip 2nd time, just call Acquire() again.
#This is true for all other APIs which get available once port is opened.
#You have to call OpenPort() again if port was closed by ClosePort() method, or
#when there is a need to connect to other programmer, or
#if programmer was physically reconnected to USB-port.
hr = pp.OpenPort(portName)
m_sLastError = hr[1]
return hr[0]
def ClosePort():
hResult = pp.ClosePort()
hr = hResult[0]
strError = hResult[1]
return hr
def Allow_Hard_Reset():
listResult = []
hResult = pp.DAP_GetJtagID();
hr = hResult[0]
chipJtagID = hResult[1]
m_sLastError = hResult[2]
if not SUCCEEDED(hr):
listResult.append(hr)
listResult.append(result)
return listResult
#Apply to PSoC5 LP only
if Is_PSoC_5_LP_ID(chipJtagID):
#Set 'allow_rst_hrd' bit in MLOGIC_DEBUG register (see PSoC5 IROS: 001-43078, Book 2)
hr = pp.DAP_WriteIO(0x400046E8, 0x00000040)
return hr;
def CheckHexAndDeviceCompatibility():
global m_sLastError
listResult = []
result = 0
hResult = pp.DAP_GetJtagID();
hr = hResult[0]
chipJtagID = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)):
listResult.append(hr)
listResult.append(result)
return listResult
hResult = pp.HEX_ReadJtagID();
hr = hResult[0]
hexJtagID = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)):
listResult.append(hr)
listResult.append(result)
return listResult
result = 1
if PY3:
hexJtagID = [chr(c) for c in hexJtagID]
chipJtagID = [chr(c) for c in chipJtagID]
for i in range(0, 4):
if(ord(hexJtagID[i]) != ord(chipJtagID[i])):
result = 0
break
listResult.append(0)
listResult.append(result)
return listResult
def IsNvlUpdatePossible():
global m_sLastError
listResult = []
hResult = pp.GetPower1()
hr = hResult[0]
power = hResult[1]
voltage = hResult[2]
state = 0
if (not SUCCEEDED(hr)):
listResult.append(hr)
listResult.append(0)
return listResult
if (voltage > 3700):
state = 0
else:
state = 1
listResult.append(hr)
listResult.append(state)
return listResult
def ProgramNvlArrays(nvlArrayType):
global m_sLastError
hResult = pp.PSoC3_GetSonosArrays(nvlArrayType)
hr = hResult[0]
arrayInfo = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
addrHex = 0
for i in range(0, len(arrayInfo[0])):
arrayID = arrayInfo[0][i]
arraySize = arrayInfo[1][i]
#Read data from Hex file
if (nvlArrayType == enumSonosArrays.ARRAY_NVL_USER):
hResult = pp.PSoC3_ReadHexNvlCustom(addrHex, arraySize)
else: #enumSonosArrays.ARRAY_NVL_WO_LATCHES
hResult = pp.PSoC3_ReadHexNvlWo(addrHex, arraySize)
hr = hResult[0]
hexData = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
addrHex += arraySize
#Read data from device
hResult = pp.PSoC3_ReadNvlArray(arrayID)
hr = hResult[0]
chipData = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
#Compare data from Chip against corresponding Hex-block
if (len(chipData) != len(hexData)):
m_sLastError = "Hex file's NVL array differs from corresponding device's one!"
return -1
fIdentical = 1
if PY3:
chipData = [chr(c) for c in chipData]
hexData = [chr(c) for c in hexData]
for i in range(0, arraySize):
if (ord(chipData[i]) != ord(hexData[i])):
fIdentical = 0
break
if (fIdentical == 1): continue #Arrays are equal, skip programming, goto following array
#Verify voltage range for TM silicon. Do not allow TM programming if voltage is greater than 3.3 V
hResult = pp.DAP_GetJtagID()
hr = hResult[0]
chipJtagID = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
if (Is_PSoC5_TM_ID(chipJtagID)):
hResult = IsNvlUpdatePossible()
hr = hResult[0]
state = hResult[1]
if (state == 0):
if(nvlArrayType == enumSonosArrays.ARRAY_NVL_USER):
m_sLastError = "User NVLs"
else:
m_sLastError = "WO NVLs"
m_sLastError = m_sLastError + " update failed. This operation can be completed in voltage range 1.8 - 3.3 V only."
return -1
#Program NVL array
hResult = pp.PSoC3_WriteNvlArray(arrayID, hexData);
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#PSoC3 ES3 support - check whether ECCEnable bit is changed and reacquire device
if (nvlArrayType == enumSonosArrays.ARRAY_NVL_USER):
hResult = pp.DAP_GetJtagID()
hr = hResult[0]
chipJtagID = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
#ES3 and probably newer revisions
if (IsPSoC3ES3(chipJtagID) or Is_PSoC_5_LP_ID(chipJtagID)):
eccEnableChanged = 0
if (len(hexData) >= 4):
eccEnableChanged = ((ord(hexData[3]) ^ ord(chipData[3])) & 0x08) == 0x08
#need to reacquire chip if EccEnable bit was changed to apply it for flash rows.
if (eccEnableChanged):
hResult = pp.DAP_Acquire()
hr = hResult[0]
m_sLastError = hResult[1]
return hr
return 0
def GetEccOption(arrayID):
global m_sLastError
hResult = pp.PSoC3_GetFlashArrayInfo(arrayID)
hr = hResult[0]
rowSize = hResult[1]
rowsPerArray = hResult[2]
eccPresence = hResult[3]
m_sLastError = hResult[4]
if (not SUCCEEDED(hr)): return hr
hResult = pp.PSoC3_GetEccStatus() #get ecc status of the acquired device
hr = hResult[0]
eccHwStatus = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
#take into account data from the Config area
if ((eccPresence != 0) and (eccHwStatus == 0)):
eccOption = 1
else:
eccOption = 0
return eccOption
def ProgramFlashArrays(flashSize):
global m_sLastError
hResult = pp.PSoC3_GetSonosArrays(enumSonosArrays.ARRAY_FLASH)
hr = hResult[0]
arrayInfo = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
flashProgrammed = 0
#Program Flash arrays
for i in range(0, len(arrayInfo[0])):
arrayID = arrayInfo[0][i]
arraySize = arrayInfo[1][i]
#Program flash array from hex file taking into account ECC (Config Data)
hResult = pp.PSoC3_GetFlashArrayInfo(arrayID)
hr = hResult[0]
rowSize = hResult[1]
rowsPerArray = hResult[2]
eccPresence = hResult[3]
m_sLastError = hResult[4]
if (not SUCCEEDED(hr)): return hr
eccOption = GetEccOption(arrayID); #take into account data from the Config area
for rowID in range(0, rowsPerArray):
hResult = pp.PSoC3_ProgramRowFromHex(arrayID, rowID, eccOption)
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#Limit programming to the device flash size
flashProgrammed += rowSize
if (flashProgrammed >= flashSize): return hr
return hr
def GetTotalFlashRowsCount(flashSize):
global m_sLastError
listResult = []
totalRows = 0
rowSize = 256
totalRows = flashSize / rowSize
listResult.append(0)
listResult.append(totalRows)
return listResult
def CheckSum_All(flashSize):
global m_sLastError
listResult = []
cs = 0
hResult = pp.PSoC3_GetSonosArrays(enumSonosArrays.ARRAY_FLASH)
hr = hResult[0]
arrayInfo = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)):
listResult.append(hr)
listResult.append(cs)
return listResult
hResult = GetTotalFlashRowsCount(flashSize)
hr = hResult[0]
RowsToChecksum = hResult[1]
for i in range(0, len(arrayInfo[0])):
arrayID = arrayInfo[0][i]
arraySize = arrayInfo[1][i]
#Get info about flash array
hResult = pp.PSoC3_GetFlashArrayInfo(arrayID)
hr = hResult[0]
rowSize = hResult[1]
rowsPerArray = hResult[2]
eccPresence = hResult[3]
m_sLastError = hResult[4]
if (not SUCCEEDED(hr)):
listResult.append(hr)
listResult.append(cs)
return listResult
#Find number of rows in array to be checksumed
if ((RowsToChecksum - rowsPerArray) < 0):
rowsPerArray = RowsToChecksum
#Calculate checksum of the array
arrayChecksum = 0;
hResult = pp.PSoC3_CheckSum(arrayID, 0, rowsPerArray)
hr = hResult[0]
arrayChecksum = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)):
listResult.append(hr)
listResult.append(cs)
return listResult
#Sum checksum
cs += arrayChecksum
#Update number of rows to be checksumed
RowsToChecksum -= rowsPerArray
if (RowsToChecksum <= 0):
break;
listResult.append(hr)
listResult.append(cs)
return listResult
def ProgramAll(hex_file):
global m_sLastError
#Setup Power - "5.0V" and internal
print('Setting Power Voltage to 5.0V')
hResult = pp.SetPowerVoltage("5.0")
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
'''
print('Turning on device')
hResult = pp.PowerOn()
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
'''
#Set protocol, connector and frequency
print('Setting communication protocols')
hResult = pp.SetProtocol(enumInterfaces.SWD)
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#hResult = pp.SetProtocolConnector(1); #10-pin connector
hResult = pp.SetProtocolConnector(0); #5-pin connector
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
hResult = pp.SetProtocolClock(enumFrequencies.FREQ_03_0); #3.0 MHz clock on SWD bus
hr = hResult[0]
m_sLastError = hResult[1]
# Set Hex File
print('Reading Hex file')
hResult = pp.ReadHexFile(hex_file)
hr = hResult[0]
hexImageSize = int(hResult[1])
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
# Set Acquire Mode
pp.SetAcquireMode("Reset")
#The "Programming Flow" proper
#Acquire Device
print('Acquiring device')
hResult = pp.DAP_Acquire()
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#Check Hex File and Device compatibility
fCompatibility = 0
print('Checking Hex file and device compatability')
hResult = CheckHexAndDeviceCompatibility()
hr = hResult[0]
fCompatibility = hResult[1]
if (not SUCCEEDED(hr)): return hr
if (fCompatibility == 0):
m_sLastError = "The Hex file does not match the acquired device, please connect the appropriate device";
return -1
#Erase All
print('Erasing all flash')
hResult = pp.PSoC3_EraseAll();
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#Program User NVL arrays
print('Programming User NVL arrays')
hr = ProgramNvlArrays(enumSonosArrays.ARRAY_NVL_USER)
if (not SUCCEEDED(hr)): return hr
#Program Flash arrays
print('Programming Flash arrays')
hr = ProgramFlashArrays(hexImageSize)
#Protect All arrays
print('Protecting all arrays')
hResult = pp.PSoC3_ProtectAll()
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#CheckSum
print('Generating checksum')
hResult = CheckSum_All(hexImageSize)
hr = hResult[0]
flashChecksum = hResult[1]
if (not SUCCEEDED(hr)): return hr
hResult = pp.ReadHexChecksum()
hr = hResult[0]
hexChecksum = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
flashChecksum &= 0xFFFF
if (flashChecksum != hexChecksum):
print("Mismatch of Checksum: Expected 0x%x, Got 0x%x" %(flashChecksum, hexChecksum))
return -1
else:
print("Checksum 0x%x" %(flashChecksum))
#Release PSoC3 device
#For PSoC5 LP call "Allow_Hard_Reset()" as in C#/C++ example
Allow_Hard_Reset()
hResult = pp.DAP_ReleaseChip()
hr = hResult[0]
m_sLastError = hResult[1]
return hr
def UpgradeBlock():
global m_sLastError
#Setup Power - "5.0V" and internal
hResult = pp.SetPowerVoltage("5.0")
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
hResult = pp.PowerOn()
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#Set protocol, connector and frequency
hResult = pp.SetProtocol(enumInterfaces.SWD)
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#hResult = pp.SetProtocolConnector(1); #10-pin connector
hResult = pp.SetProtocolConnector(0); #5-pin connector
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
hResult = pp.SetProtocolClock(enumFrequencies.FREQ_03_0); #<=3.0 MHz for Read operations
hr = hResult[0]
m_sLastError = hResult[1]
#Set Acquire Mode
pp.SetAcquireMode("Reset")
#Acquire Device
hResult = pp.DAP_Acquire()
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#Write Row, use PSoC3_WriteRow() instead PSoC3_ProgramRow()
writeData = [] #User and Config area of the Row (256+32)
for i in range(0, 288):
writeData.append(i & 0xFF)
data = array.array('B',writeData)
arrayID = 0
rowID = 255
hResult = pp.PSoC3_WriteRow(arrayID, rowID, buffer(data))
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
#Verify Row - only user area (without Config one)
hResult = pp.PSoC3_ReadRow(arrayID, rowID, 0)
hr = hResult[0]
readRow = hResult[1]
if PY3:
readRow = [chr(c) for c in readRow]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
for i in range(0, len(readRow)): #check 256 bytes
if (ord(readRow[i]) != writeData[i]):
hr = -1
break
if (not SUCCEEDED(hr)):
m_sLastError = "Verification of User area failed!"
return hr
#Verify Row - Config are only
hResult = pp.PSoC3_ReadRow(arrayID, rowID, 1)
hr = hResult[0]
readRow = hResult[1]
m_sLastError = hResult[2]
if (not SUCCEEDED(hr)): return hr
for i in range(0, len(readRow)): #check 256 bytes
if (ord(readRow[i]) != writeData[256+i]):
hr = -1
break
if (not SUCCEEDED(hr)):
m_sLastError = "Verification of Config area failed!"
return hr
#Release PSoC3 chip
#For PSoC5 LP call "Allow_Hard_Reset()" as in C#/C++ example
Allow_Hard_Reset()
hResult = pp.DAP_ReleaseChip()
hr = hResult[0]
m_sLastError = hResult[1]
return hr
def Execute(hex_file):
print("Opening Port")
hr = OpenPort()
if (not SUCCEEDED(hr)): return hr
hr = ProgramAll(hex_file)
#hr = UpgradeBlock()
print('Closing Port')
ClosePort()
return hr
def PowerOffDevice():
global m_sLastError
print("Opening Port")
hr = OpenPort()
if (not SUCCEEDED(hr)): return hr
#Setup Power - "5.0V" and internal
print('Setting Power Voltage to 5.0V')
hResult = pp.SetPowerVoltage("5.0")
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
print('Turning off device')
hResult = pp.PowerOff()
hr = hResult[0]
m_sLastError = hResult[1]
if (not SUCCEEDED(hr)): return hr
print('Closing Port')
ClosePort()
return hr
#Begin main program
if __name__ == '__main__':
#Use Version Independent Prog ID to instantiate COM-object
pp = win32com.client.Dispatch("PSoCProgrammerCOM.PSoCProgrammerCOM_Object")
#For version dependent Prog ID use below commented line, but update there COM-object version (e.g. 14)
#pp = win32com.client.Dispatch("PSoCProgrammerCOM.PSoCProgrammerCOM_Object.14")
if len(sys.argv) == 2 and sys.argv[1] == '--power-off-device':
hr = PowerOffDevice()
else:
print("Program All using COM-object interface only")
hex_file = os.path.abspath(sys.argv[1])
print("Using Hex File:", hex_file)
hr = Execute(hex_file)
if (SUCCEEDED(hr)):
str = "Succeeded!"
exit_code = 0
else:
str = "Failed! " + m_sLastError
exit_code = 1
print(str)
sys.exit(exit_code)
#End main function
| {
"content_hash": "4d4054120a341bab903243e342d484b6",
"timestamp": "",
"source": "github",
"line_count": 613,
"max_line_length": 207,
"avg_line_length": 32.54649265905383,
"alnum_prop": 0.61841511703674,
"repo_name": "open-storm/perfect-cell",
"id": "1972c2e50004c20b0be261b879d281de43980f1c",
"size": "21074",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build_tools/psoc_program.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "188252"
},
{
"name": "C++",
"bytes": "148"
},
{
"name": "Python",
"bytes": "42431"
}
],
"symlink_target": ""
} |
<?php
/**
* @category Payment Gateway
* @package Adyen_Payment
* @author Adyen
* @property Adyen B.V
* @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
*/
$installer = $this;
$installer->startSetup();
$installer->addAttribute('order_payment', 'adyen_card_bin', array());
$installer->endSetup();
| {
"content_hash": "1ca08036a2985cc2d85cf7916867e968",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 69,
"avg_line_length": 21.933333333333334,
"alnum_prop": 0.6504559270516718,
"repo_name": "Adyen/magento",
"id": "ec97af743e8f0f7b70e9defd1a43e6f4c6043267",
"size": "1040",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "app/code/community/Adyen/Payment/sql/adyen_setup/mysql4-upgrade-2.5.4-2.5.4.1.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7693"
},
{
"name": "HTML",
"bytes": "171706"
},
{
"name": "JavaScript",
"bytes": "18434"
},
{
"name": "PHP",
"bytes": "687680"
}
],
"symlink_target": ""
} |
class CreateLinks < ActiveRecord::Migration
def self.up
create_table :links do |t|
t.string :url
t.timestamps
end
end
def self.down
drop_table :links
end
end
| {
"content_hash": "506099696f62aad73c676d8b9fc309bb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 43,
"avg_line_length": 14.76923076923077,
"alnum_prop": 0.640625,
"repo_name": "mcansky/mjolk",
"id": "6c8da7737aec5d1ca5c956e2ed00c8f2a483509f",
"size": "192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20101217095243_create_links.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "96069"
},
{
"name": "Ruby",
"bytes": "88044"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Music
{
//https://fr.wikipedia.org/wiki/Note_de_musique
public class Test
{
public void Play()
{
//Console.WriteLine(new Note(-12).Same(new Note(NoteEnum.A, 2)));
//Console.WriteLine(new Note(-12 - 12).Same(new Note(NoteEnum.A, 1)));
//Console.WriteLine(new Note(-12 - 12 - 12).Same(new Note(NoteEnum.A, 0)));
//Console.WriteLine(new Note(0).Same(new Note(NoteEnum.A, 3)));
//Console.WriteLine(new Note(1).Same(new Note(NoteEnum.Bb, 3)));
//Console.WriteLine(new Note(2).Same(new Note(NoteEnum.B, 3)));
//Console.WriteLine(new Note(3).Same(new Note(NoteEnum.C, 4)));
//Console.WriteLine(new Note(3+11).Same(new Note(NoteEnum.B, 4)));
//Console.WriteLine(new Note(3+12).Same(new Note(NoteEnum.C, 5)));
//Console.WriteLine(new Note(3 + 12+13).Same(new Note(NoteEnum.Cd, 6)));
//int n = NoteEnum.A;
//for(int i=0; i<8; i++)
// new Note(n, i).Play();
}
}
}
| {
"content_hash": "4648c0fff8ed8f7134adde16c31e5944",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 87,
"avg_line_length": 26.387755102040817,
"alnum_prop": 0.568445475638051,
"repo_name": "bnogent/music",
"id": "5a1474fdf63bd49181be0be169c8730df9d975d7",
"size": "1295",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Music/Test.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "19544"
}
],
"symlink_target": ""
} |
package info.source4code.jms;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UnidentifiedProducer {
private static final Logger LOGGER = LoggerFactory
.getLogger(UnidentifiedProducer.class);
private Connection connection;
private Session session;
private MessageProducer messageProducer;
public void create() throws JMSException {
// create a Connection Factory
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
ActiveMQConnection.DEFAULT_BROKER_URL);
// create a Connection
connection = connectionFactory.createConnection();
// create a Session
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// create a Message Producer for sending messages
messageProducer = session.createProducer(null);
}
public void close() throws JMSException {
connection.close();
}
public void sendName(String destinationName, String firstName,
String lastName) throws JMSException {
String text = firstName + " " + lastName;
// create a JMS TextMessage
TextMessage textMessage = session.createTextMessage(text);
// create the Destination to which messages will be sent
Destination destination = session.createQueue(destinationName);
// send the message to the queue destination
messageProducer.send(destination, textMessage);
LOGGER.debug("unidentifiedProducer sent message with text='{}'", text);
}
} | {
"content_hash": "9853cf7dd1beaf82ea5e6f2c1a311806",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 79,
"avg_line_length": 31,
"alnum_prop": 0.7202538339502909,
"repo_name": "source4code/repo",
"id": "2250ee80633fb2202fa95ce5a40ddef3bcb18090",
"size": "1891",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jms-activemq-helloworld/src/main/java/info/source4code/jms/UnidentifiedProducer.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "135927"
}
],
"symlink_target": ""
} |
package generated.zcsclient.admin;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for testResultInfo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="testResultInfo">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="completed" type="{urn:zimbraAdmin}completedTestInfo" maxOccurs="unbounded" minOccurs="0"/>
* <element name="failure" type="{urn:zimbraAdmin}failedTestInfo" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "testResultInfo", propOrder = {
"completed",
"failure"
})
public class testTestResultInfo {
protected List<testCompletedTestInfo> completed;
protected List<testFailedTestInfo> failure;
/**
* Gets the value of the completed property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the completed property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCompleted().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link testCompletedTestInfo }
*
*
*/
public List<testCompletedTestInfo> getCompleted() {
if (completed == null) {
completed = new ArrayList<testCompletedTestInfo>();
}
return this.completed;
}
/**
* Gets the value of the failure property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the failure property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFailure().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link testFailedTestInfo }
*
*
*/
public List<testFailedTestInfo> getFailure() {
if (failure == null) {
failure = new ArrayList<testFailedTestInfo>();
}
return this.failure;
}
}
| {
"content_hash": "8db3226014228ed25b300ebc56c61131",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 119,
"avg_line_length": 28.737373737373737,
"alnum_prop": 0.6260105448154657,
"repo_name": "nico01f/z-pec",
"id": "76de2e93b61cc592f1ea92df6f1a8cb4a681f305",
"size": "2845",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ZimbraSoap/src/wsdl-test/generated/zcsclient/admin/testTestResultInfo.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "18110"
},
{
"name": "C",
"bytes": "61139"
},
{
"name": "C#",
"bytes": "1461640"
},
{
"name": "C++",
"bytes": "723279"
},
{
"name": "CSS",
"bytes": "2648118"
},
{
"name": "Groff",
"bytes": "15389"
},
{
"name": "HTML",
"bytes": "83875860"
},
{
"name": "Java",
"bytes": "49998455"
},
{
"name": "JavaScript",
"bytes": "39307223"
},
{
"name": "Makefile",
"bytes": "13060"
},
{
"name": "PHP",
"bytes": "4263"
},
{
"name": "PLSQL",
"bytes": "17047"
},
{
"name": "Perl",
"bytes": "2030870"
},
{
"name": "PowerShell",
"bytes": "1485"
},
{
"name": "Python",
"bytes": "129210"
},
{
"name": "Shell",
"bytes": "575209"
},
{
"name": "XSLT",
"bytes": "20635"
}
],
"symlink_target": ""
} |
<?php
/**
* SFTP Stream Wrapper
*
* @package Net_SFTP_Stream
* @author Jim Wigginton <[email protected]>
* @access public
*/
class Net_SFTP_Stream
{
/**
* SFTP instances
*
* Rather than re-create the connection we re-use instances if possible
*
* @var Array
*/
static $instances;
/**
* SFTP instance
*
* @var Object
* @access private
*/
var $sftp;
/**
* Path
*
* @var String
* @access private
*/
var $path;
/**
* Mode
*
* @var String
* @access private
*/
var $mode;
/**
* Position
*
* @var Integer
* @access private
*/
var $pos;
/**
* Size
*
* @var Integer
* @access private
*/
var $size;
/**
* Directory entries
*
* @var Array
* @access private
*/
var $entries;
/**
* EOF flag
*
* @var Boolean
* @access private
*/
var $eof;
/**
* Context resource
*
* Technically this needs to be publically accessible so PHP can set it directly
*
* @var Resource
* @access public
*/
var $context;
/**
* Notification callback function
*
* @var Callable
* @access public
*/
var $notification;
/**
* Registers this class as a URL wrapper.
*
* @param optional String $protocol The wrapper name to be registered.
* @return Boolean True on success, false otherwise.
* @access public
*/
static function register($protocol = 'sftp')
{
if (in_array($protocol, stream_get_wrappers(), true)) {
return false;
}
$class = function_exists('get_called_class') ? get_called_class() : __CLASS__;
return stream_wrapper_register($protocol, $class);
}
/**
* The Constructor
*
* @access public
*/
function Net_SFTP_Stream()
{
if (defined('NET_SFTP_STREAM_LOGGING')) {
echo "__construct()\r\n";
}
if (!class_exists('Net_SFTP')) {
include_once 'Net/SFTP.php';
}
}
/**
* Path Parser
*
* Extract a path from a URI and actually connect to an SSH server if appropriate
*
* If "notification" is set as a context parameter the message code for successful login is
* NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE.
*
* @param String $path
* @return String
* @access private
*/
function _parse_path($path)
{
extract(parse_url($path) + array('port' => 22));
if (!isset($host)) {
return false;
}
if (isset($this->context)) {
$context = stream_context_get_params($this->context);
if (isset($context['notification'])) {
$this->notification = $context['notification'];
}
}
if ($host[0] == '$') {
$host = substr($host, 1);
global $$host;
if (!is_object($$host) || get_class($$host) != 'Net_SFTP') {
return false;
}
$this->sftp = $$host;
} else {
if (isset($this->context)) {
$context = stream_context_get_options($this->context);
}
if (isset($context[$scheme]['session'])) {
$sftp = $context[$scheme]['session'];
}
if (isset($context[$scheme]['sftp'])) {
$sftp = $context[$scheme]['sftp'];
}
if (isset($sftp) && is_object($sftp) && get_class($sftp) == 'Net_SFTP') {
$this->sftp = $sftp;
return $path;
}
if (isset($context[$scheme]['username'])) {
$user = $context[$scheme]['username'];
}
if (isset($context[$scheme]['password'])) {
$pass = $context[$scheme]['password'];
}
if (isset($context[$scheme]['privkey']) && is_object($context[$scheme]['privkey']) && get_Class($context[$scheme]['privkey']) == 'Crypt_RSA') {
$pass = $context[$scheme]['privkey'];
}
if (!isset($user) || !isset($pass)) {
return false;
}
// casting $pass to a string is necessary in the event that it's a Crypt_RSA object
if (isset(self::$instances[$host][$port][$user][(string) $pass])) {
$this->sftp = self::$instances[$host][$port][$user][(string) $pass];
} else {
$this->sftp = new Net_SFTP($host, $port);
$this->sftp->disableStatCache();
if (isset($this->notification) && is_callable($this->notification)) {
/* if !is_callable($this->notification) we could do this:
user_error('fopen(): failed to call user notifier', E_USER_WARNING);
the ftp wrapper gives errors like that when the notifier isn't callable.
i've opted not to do that, however, since the ftp wrapper gives the line
on which the fopen occurred as the line number - not the line that the
user_error is on.
*/
call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
if (!$this->sftp->login($user, $pass)) {
call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0);
return false;
}
call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0);
} else {
if (!$this->sftp->login($user, $pass)) {
return false;
}
}
self::$instances[$host][$port][$user][(string) $pass] = $this->sftp;
}
}
return $path;
}
/**
* Opens file or URL
*
* @param String $path
* @param String $mode
* @param Integer $options
* @param String $opened_path
* @return Boolean
* @access public
*/
function _stream_open($path, $mode, $options, &$opened_path)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
$this->path = $path;
$this->size = $this->sftp->size($path);
$this->mode = preg_replace('#[bt]$#', '', $mode);
$this->eof = false;
if ($this->size === false) {
if ($this->mode[0] == 'r') {
return false;
} else {
$this->sftp->touch($path);
$this->size = 0;
}
} else {
switch ($this->mode[0]) {
case 'x':
return false;
case 'w':
$this->sftp->truncate($path, 0);
$this->size = 0;
}
}
$this->pos = $this->mode[0] != 'a' ? 0 : $this->size;
return true;
}
/**
* Read from stream
*
* @param Integer $count
* @return Mixed
* @access public
*/
function _stream_read($count)
{
switch ($this->mode) {
case 'w':
case 'a':
case 'x':
case 'c':
return false;
}
// commented out because some files - eg. /dev/urandom - will say their size is 0 when in fact it's kinda infinite
//if ($this->pos >= $this->size) {
// $this->eof = true;
// return false;
//}
$result = $this->sftp->get($this->path, false, $this->pos, $count);
if (isset($this->notification) && is_callable($this->notification)) {
if ($result === false) {
call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0);
return 0;
}
// seems that PHP calls stream_read in 8k chunks
call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size);
}
if (empty($result)) { // ie. false or empty string
$this->eof = true;
return false;
}
$this->pos+= strlen($result);
return $result;
}
/**
* Write to stream
*
* @param String $data
* @return Mixed
* @access public
*/
function _stream_write($data)
{
switch ($this->mode) {
case 'r':
return false;
}
$result = $this->sftp->put($this->path, $data, NET_SFTP_STRING, $this->pos);
if (isset($this->notification) && is_callable($this->notification)) {
if (!$result) {
call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0);
return 0;
}
// seems that PHP splits up strings into 8k blocks before calling stream_write
call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data));
}
if ($result === false) {
return false;
}
$this->pos+= strlen($data);
if ($this->pos > $this->size) {
$this->size = $this->pos;
}
$this->eof = false;
return strlen($data);
}
/**
* Retrieve the current position of a stream
*
* @return Integer
* @access public
*/
function _stream_tell()
{
return $this->pos;
}
/**
* Tests for end-of-file on a file pointer
*
* In my testing there are four classes functions that normally effect the pointer:
* fseek, fputs / fwrite, fgets / fread and ftruncate.
*
* Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof()
* will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof()
* will return false. do fread($fp, 1) and feof() will then return true.
*
* @return Boolean
* @access public
*/
function _stream_eof()
{
return $this->eof;
}
/**
* Seeks to specific location in a stream
*
* @param Integer $offset
* @param Integer $whence
* @return Boolean
* @access public
*/
function _stream_seek($offset, $whence)
{
switch ($whence) {
case SEEK_SET:
if ($offset >= $this->size || $offset < 0) {
return false;
}
break;
case SEEK_CUR:
$offset+= $this->pos;
break;
case SEEK_END:
$offset+= $this->size;
}
$this->pos = $offset;
$this->eof = false;
return true;
}
/**
* Change stream options
*
* @param String $path
* @param Integer $option
* @param Mixed $var
* @return Boolean
* @access public
*/
function _stream_metadata($path, $option, $var)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
// stream_metadata was introduced in PHP 5.4.0 but as of 5.4.11 the constants haven't been defined
// see http://www.php.net/streamwrapper.stream-metadata and https://bugs.php.net/64246
// and https://github.com/php/php-src/blob/master/main/php_streams.h#L592
switch ($option) {
case 1: // PHP_STREAM_META_TOUCH
return $this->sftp->touch($path, $var[0], $var[1]);
case 2: // PHP_STREAM_OWNER_NAME
case 3: // PHP_STREAM_GROUP_NAME
return false;
case 4: // PHP_STREAM_META_OWNER
return $this->sftp->chown($path, $var);
case 5: // PHP_STREAM_META_GROUP
return $this->sftp->chgrp($path, $var);
case 6: // PHP_STREAM_META_ACCESS
return $this->sftp->chmod($path, $var) !== false;
}
}
/**
* Retrieve the underlaying resource
*
* @param Integer $cast_as
* @return Resource
* @access public
*/
function _stream_cast($cast_as)
{
return $this->sftp->fsock;
}
/**
* Advisory file locking
*
* @param Integer $operation
* @return Boolean
* @access public
*/
function _stream_lock($operation)
{
return false;
}
/**
* Renames a file or directory
*
* Attempts to rename oldname to newname, moving it between directories if necessary.
* If newname exists, it will be overwritten. This is a departure from what Net_SFTP
* does.
*
* @param String $path_from
* @param String $path_to
* @return Boolean
* @access public
*/
function _rename($path_from, $path_to)
{
$path1 = parse_url($path_from);
$path2 = parse_url($path_to);
unset($path1['path'], $path2['path']);
if ($path1 != $path2) {
return false;
}
$path_from = $this->_parse_path($path_from);
$path_to = parse_url($path_to);
if ($path_from === false) {
return false;
}
$path_to = $path_to['path']; // the $component part of parse_url() was added in PHP 5.1.2
// "It is an error if there already exists a file with the name specified by newpath."
// -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.5
if (!$this->sftp->rename($path_from, $path_to)) {
if ($this->sftp->stat($path_to)) {
return $this->sftp->delete($path_to, true) && $this->sftp->rename($path_from, $path_to);
}
return false;
}
return true;
}
/**
* Open directory handle
*
* The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and
* removed in 5.4 I'm just going to ignore it.
*
* Also, nlist() is the best that this function is realistically going to be able to do. When an SFTP client
* sends a SSH_FXP_READDIR packet you don't generally get info on just one file but on multiple files. Quoting
* the SFTP specs:
*
* The SSH_FXP_NAME response has the following format:
*
* uint32 id
* uint32 count
* repeats count times:
* string filename
* string longname
* ATTRS attrs
*
* @param String $path
* @param Integer $options
* @return Boolean
* @access public
*/
function _dir_opendir($path, $options)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
$this->pos = 0;
$this->entries = $this->sftp->nlist($path);
return $this->entries !== false;
}
/**
* Read entry from directory handle
*
* @return Mixed
* @access public
*/
function _dir_readdir()
{
if (isset($this->entries[$this->pos])) {
return $this->entries[$this->pos++];
}
return false;
}
/**
* Rewind directory handle
*
* @return Boolean
* @access public
*/
function _dir_rewinddir()
{
$this->pos = 0;
return true;
}
/**
* Close directory handle
*
* @return Boolean
* @access public
*/
function _dir_closedir()
{
return true;
}
/**
* Create a directory
*
* Only valid $options is STREAM_MKDIR_RECURSIVE
*
* @param String $path
* @param Integer $mode
* @param Integer $options
* @return Boolean
* @access public
*/
function _mkdir($path, $mode, $options)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
return $this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE);
}
/**
* Removes a directory
*
* Only valid $options is STREAM_MKDIR_RECURSIVE per <http://php.net/streamwrapper.rmdir>, however,
* <http://php.net/rmdir> does not have a $recursive parameter as mkdir() does so I don't know how
* STREAM_MKDIR_RECURSIVE is supposed to be set. Also, when I try it out with rmdir() I get 8 as
* $options. What does 8 correspond to?
*
* @param String $path
* @param Integer $mode
* @param Integer $options
* @return Boolean
* @access public
*/
function _rmdir($path, $options)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
return $this->sftp->rmdir($path);
}
/**
* Flushes the output
*
* See <http://php.net/fflush>. Always returns true because Net_SFTP doesn't cache stuff before writing
*
* @return Boolean
* @access public
*/
function _stream_flush()
{
return true;
}
/**
* Retrieve information about a file resource
*
* @return Mixed
* @access public
*/
function _stream_stat()
{
$results = $this->sftp->stat($this->path);
if ($results === false) {
return false;
}
return $results;
}
/**
* Delete a file
*
* @param String $path
* @return Boolean
* @access public
*/
function _unlink($path)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
return $this->sftp->delete($path, false);
}
/**
* Retrieve information about a file
*
* Ignores the STREAM_URL_STAT_QUIET flag because the entirety of Net_SFTP_Stream is quiet by default
* might be worthwhile to reconstruct bits 12-16 (ie. the file type) if mode doesn't have them but we'll
* cross that bridge when and if it's reached
*
* @param String $path
* @param Integer $flags
* @return Mixed
* @access public
*/
function _url_stat($path, $flags)
{
$path = $this->_parse_path($path);
if ($path === false) {
return false;
}
$results = $flags & STREAM_URL_STAT_LINK ? $this->sftp->lstat($path) : $this->sftp->stat($path);
if ($results === false) {
return false;
}
return $results;
}
/**
* Truncate stream
*
* @param Integer $new_size
* @return Boolean
* @access public
*/
function _stream_truncate($new_size)
{
if (!$this->sftp->truncate($this->path, $new_size)) {
return false;
}
$this->eof = false;
$this->size = $new_size;
return true;
}
/**
* Change stream options
*
* STREAM_OPTION_WRITE_BUFFER isn't supported for the same reason stream_flush isn't.
* The other two aren't supported because of limitations in Net_SFTP.
*
* @param Integer $option
* @param Integer $arg1
* @param Integer $arg2
* @return Boolean
* @access public
*/
function _stream_set_option($option, $arg1, $arg2)
{
return false;
}
/**
* Close an resource
*
* @access public
*/
function _stream_close()
{
}
/**
* __call Magic Method
*
* When you're utilizing an SFTP stream you're not calling the methods in this class directly - PHP is calling them for you.
* Which kinda begs the question... what methods is PHP calling and what parameters is it passing to them? This function
* lets you figure that out.
*
* If NET_SFTP_STREAM_LOGGING is defined all calls will be output on the screen and then (regardless of whether or not
* NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method.
*
* @param String
* @param Array
* @return Mixed
* @access public
*/
function __call($name, $arguments)
{
if (defined('NET_SFTP_STREAM_LOGGING')) {
echo $name . '(';
$last = count($arguments) - 1;
foreach ($arguments as $i => $argument) {
var_export($argument);
if ($i != $last) {
echo ',';
}
}
echo ")\r\n";
}
$name = '_' . $name;
if (!method_exists($this, $name)) {
return false;
}
return call_user_func_array(array($this, $name), $arguments);
}
}
Net_SFTP_Stream::register();
| {
"content_hash": "50f8393b567defc418cd7e531cad6705",
"timestamp": "",
"source": "github",
"line_count": 773,
"max_line_length": 169,
"avg_line_length": 27.671410090556275,
"alnum_prop": 0.5046750818139317,
"repo_name": "lcssk8board/rsa-communication",
"id": "0085b9592ae7dac8ba62282521a8f69b7a17d9e7",
"size": "22882",
"binary": false,
"copies": "36",
"ref": "refs/heads/master",
"path": "source/PHP/Net/SFTP/Stream.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "4701"
},
{
"name": "PHP",
"bytes": "1219734"
},
{
"name": "Shell",
"bytes": "330"
}
],
"symlink_target": ""
} |
import factory
from oscar.core.loading import get_model
__all__ = [
'RangeFactory', 'ConditionFactory', 'BenefitFactory',
'ConditionalOfferFactory',
]
class RangeFactory(factory.DjangoModelFactory):
name = factory.Sequence(lambda n: 'Range %d' % n)
slug = factory.Sequence(lambda n: 'range-%d' % n)
class Meta:
model = get_model('offer', 'Range')
@factory.post_generation
def products(self, create, extracted, **kwargs):
if not create or not extracted:
return
RangeProduct = get_model('offer', 'RangeProduct')
for product in extracted:
RangeProduct.objects.create(product=product, range=self)
class BenefitFactory(factory.DjangoModelFactory):
type = get_model('offer', 'Benefit').PERCENTAGE
value = 10
max_affected_items = None
range = factory.SubFactory(RangeFactory)
class Meta:
model = get_model('offer', 'Benefit')
class ConditionFactory(factory.DjangoModelFactory):
type = get_model('offer', 'Condition').COUNT
value = 10
range = factory.SubFactory(RangeFactory)
class Meta:
model = get_model('offer', 'Condition')
class ConditionalOfferFactory(factory.DjangoModelFactory):
name = 'Test offer'
benefit = factory.SubFactory(BenefitFactory)
condition = factory.SubFactory(ConditionFactory)
class Meta:
model = get_model('offer', 'ConditionalOffer')
| {
"content_hash": "ff909eadfc205b173cc9cc79ca9a7d9d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 68,
"avg_line_length": 26.462962962962962,
"alnum_prop": 0.675297410776767,
"repo_name": "john-parton/django-oscar",
"id": "b5ddaf402321506f72c1f2c6558e09ee6fb692ab",
"size": "1429",
"binary": false,
"copies": "15",
"ref": "refs/heads/master",
"path": "src/oscar/test/factories/offer.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "542048"
},
{
"name": "HTML",
"bytes": "495616"
},
{
"name": "JavaScript",
"bytes": "413706"
},
{
"name": "Makefile",
"bytes": "2653"
},
{
"name": "Python",
"bytes": "1712293"
},
{
"name": "Shell",
"bytes": "2751"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ublas: boost::numeric::ublas::packed_tag Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><b>boost</b>::<b>numeric</b>::<b>ublas</b>::<a class="el" href="structboost_1_1numeric_1_1ublas_1_1packed__tag.html">packed_tag</a>
</div>
</div>
<div class="contents">
<h1>boost::numeric::ublas::packed_tag Struct Reference</h1><!-- doxytag: class="boost::numeric::ublas::packed_tag" --><!-- doxytag: inherits="boost::numeric::ublas::packed_proxy_tag" -->
<p>Inherits <a class="el" href="structboost_1_1numeric_1_1ublas_1_1packed__proxy__tag.html">boost::numeric::ublas::packed_proxy_tag</a>.</p>
<table border="0" cellpadding="0" cellspacing="0">
</table>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Sun Jul 4 20:31:07 2010 for ublas by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>
| {
"content_hash": "114af979841e5c153f6adda3b2d534f9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 186,
"avg_line_length": 50.2,
"alnum_prop": 0.6344621513944223,
"repo_name": "cpascal/af-cpp",
"id": "01adf84816d05823a2f5afefe1d3362db992d958",
"size": "2008",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "apdos/exts/boost_1_53_0/libs/numeric/ublas/doc/html/structboost_1_1numeric_1_1ublas_1_1packed__tag.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "142321"
},
{
"name": "Batchfile",
"bytes": "45292"
},
{
"name": "C",
"bytes": "2380742"
},
{
"name": "C#",
"bytes": "41850"
},
{
"name": "C++",
"bytes": "141733840"
},
{
"name": "CMake",
"bytes": "1784"
},
{
"name": "CSS",
"bytes": "303526"
},
{
"name": "Cuda",
"bytes": "27558"
},
{
"name": "FORTRAN",
"bytes": "1440"
},
{
"name": "Groff",
"bytes": "8174"
},
{
"name": "HTML",
"bytes": "80494592"
},
{
"name": "IDL",
"bytes": "15"
},
{
"name": "JavaScript",
"bytes": "134468"
},
{
"name": "Lex",
"bytes": "1318"
},
{
"name": "Makefile",
"bytes": "1028949"
},
{
"name": "Max",
"bytes": "36857"
},
{
"name": "Objective-C",
"bytes": "4297"
},
{
"name": "PHP",
"bytes": "60249"
},
{
"name": "Perl",
"bytes": "30505"
},
{
"name": "Perl6",
"bytes": "2130"
},
{
"name": "Python",
"bytes": "1751993"
},
{
"name": "QML",
"bytes": "613"
},
{
"name": "Rebol",
"bytes": "372"
},
{
"name": "Shell",
"bytes": "374946"
},
{
"name": "Tcl",
"bytes": "1205"
},
{
"name": "TeX",
"bytes": "13819"
},
{
"name": "XSLT",
"bytes": "780775"
},
{
"name": "Yacc",
"bytes": "19612"
}
],
"symlink_target": ""
} |
#ifndef TENSORFLOW_COMPILER_XLA_TESTS_CONV_DEPTHWISE_COMMON_H_
#define TENSORFLOW_COMPILER_XLA_TESTS_CONV_DEPTHWISE_COMMON_H_
#include "absl/types/optional.h"
#include "tensorflow/compiler/xla/client/xla_computation.h"
#include "tensorflow/compiler/xla/execution_options_util.h"
#include "tensorflow/compiler/xla/service/bfloat16_normalization.h"
#include "tensorflow/compiler/xla/service/despecializer.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/test.h"
#include "tensorflow/compiler/xla/tests/client_library_test_base.h"
#include "tensorflow/compiler/xla/tests/hlo_test_base.h"
#include "tensorflow/compiler/xla/tests/test_macros.h"
namespace xla {
string GetFloatDataType(bool use_bfloat16);
struct DepthwiseConvolution2DSpec {
int64 output_feature, window, stride, pad, lhs_dilate;
std::vector<int64> activation_dims;
std::vector<int64> activation_layout;
std::vector<int64> kernel_dims;
std::vector<int64> kernel_layout;
std::vector<int64> output_dims;
std::vector<int64> output_layout;
};
string DepthwiseConvolution2DTestDataToString(
const ::testing::TestParamInfo<
::testing::tuple<DepthwiseConvolution2DSpec, bool>>& data);
string BuildHloTextDepthwiseConvolution2D(
const DepthwiseConvolution2DSpec& spec, bool use_bfloat16,
bool is_scheduled = false);
} // namespace xla
#endif // TENSORFLOW_COMPILER_XLA_TESTS_CONV_DEPTHWISE_COMMON_H_
| {
"content_hash": "0ac4c13c44d3da996362648b7fcbd1a4",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 67,
"avg_line_length": 36.82051282051282,
"alnum_prop": 0.7799442896935933,
"repo_name": "adit-chandra/tensorflow",
"id": "18c92f21862c67899d4451c58ab6ee95099e16d7",
"size": "2104",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tensorflow/compiler/xla/tests/conv_depthwise_common.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "5003"
},
{
"name": "Batchfile",
"bytes": "45988"
},
{
"name": "C",
"bytes": "773694"
},
{
"name": "C#",
"bytes": "8562"
},
{
"name": "C++",
"bytes": "76734263"
},
{
"name": "CMake",
"bytes": "6545"
},
{
"name": "Dockerfile",
"bytes": "81136"
},
{
"name": "Go",
"bytes": "1679107"
},
{
"name": "HTML",
"bytes": "4686483"
},
{
"name": "Java",
"bytes": "952944"
},
{
"name": "Jupyter Notebook",
"bytes": "567243"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "MLIR",
"bytes": "1299322"
},
{
"name": "Makefile",
"bytes": "61397"
},
{
"name": "Objective-C",
"bytes": "104706"
},
{
"name": "Objective-C++",
"bytes": "297753"
},
{
"name": "PHP",
"bytes": "24055"
},
{
"name": "Pascal",
"bytes": "3752"
},
{
"name": "Pawn",
"bytes": "17546"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "Python",
"bytes": "38764318"
},
{
"name": "RobotFramework",
"bytes": "891"
},
{
"name": "Ruby",
"bytes": "7459"
},
{
"name": "Shell",
"bytes": "643787"
},
{
"name": "Smarty",
"bytes": "34727"
},
{
"name": "Swift",
"bytes": "62814"
}
],
"symlink_target": ""
} |
layout: default
title: Input Feedback
menu_title: UI/UX Patterns
id: 35
parent_id : 32
navigation: false
group: user-input
---
# Input Feedback
### Pattern Description
When users submit content to your site via forms, errors in the data the user has provided is bound to happen from time to time. The goal of this pattern is to improve the user experience by minimizing input errors.
A paradigm suited for determining whether errors happened during form submission is whether the data validates. A common way to tell if data validates is to set up rules for each input field in the form that the entered data must pass to validate.
### Problem Statement
When user enter data to the system and which is wrong and system needs to inform the user about it in a proper manner so that it helps user to understand the problem and also gets the clue how to correct the mistake.
### Use When
System needs to validate or check the sanity of data as per the requirement of the system to function properly. Also needs to help user how to provide correct data as input.
### Solution
Indicate where user has faltered with a visible clue and a message stating what has entered wrong so that user can map. System also needs to provide appropriate message by which user can able to understand how to correct it or what is the correct way of providing input.
### Rationale
System needs to take care of the users mistake which is very common. It is obvious to the user that system will help them to use it in a proper manner with guidance.
### Examples

| {
"content_hash": "98c0cb9cb6c7b048401576aa4fef08d4",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 270,
"avg_line_length": 50.21875,
"alnum_prop": 0.7840696950840075,
"repo_name": "backdrop-ops/backdrop-hig",
"id": "508d4a918b1ae46b840bcbbefd60ee8165f96230",
"size": "1611",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ui-ux-patterns/user-input/input-feedback.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "201871"
},
{
"name": "JavaScript",
"bytes": "71417"
}
],
"symlink_target": ""
} |
import os
from pants.base.build_environment import get_buildroot, pants_version
from pants.build_graph.aliased_target import AliasTargetFactory
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.build_graph.files import Files
from pants.build_graph.intransitive_dependency import (
IntransitiveDependencyFactory,
ProvidedDependencyFactory,
)
from pants.build_graph.prep_command import PrepCommand
from pants.build_graph.remote_sources import RemoteSources
from pants.build_graph.resources import Resources
from pants.build_graph.target import Target
from pants.build_graph.target_scopes import ScopedDependencyFactory
from pants.util.netrc import Netrc
"""Register the elementary BUILD file constructs."""
class BuildFilePath:
def __init__(self, parse_context):
self._parse_context = parse_context
def __call__(self):
"""
:returns: The absolute path of this BUILD file.
"""
return os.path.join(get_buildroot(), self._parse_context.rel_path)
def build_file_aliases():
return BuildFileAliases(
targets={
"alias": AliasTargetFactory(),
"files": Files,
"prep_command": PrepCommand,
"resources": Resources,
"remote_sources": RemoteSources,
"target": Target,
},
objects={"get_buildroot": get_buildroot, "netrc": Netrc, "pants_version": pants_version,},
context_aware_object_factories={
"buildfile_path": BuildFilePath,
"intransitive": IntransitiveDependencyFactory,
"provided": ProvidedDependencyFactory,
"scoped": ScopedDependencyFactory,
},
)
| {
"content_hash": "132742d3ac39ad74ccc054bd49c40765",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 98,
"avg_line_length": 34.61224489795919,
"alnum_prop": 0.6904481132075472,
"repo_name": "wisechengyi/pants",
"id": "cd57295efc5ef36df0c82425fbac654f8e084edb",
"size": "1828",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/python/pants/build_graph/register.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "655"
},
{
"name": "C++",
"bytes": "2010"
},
{
"name": "CSS",
"bytes": "9444"
},
{
"name": "Dockerfile",
"bytes": "6634"
},
{
"name": "GAP",
"bytes": "1283"
},
{
"name": "Gherkin",
"bytes": "919"
},
{
"name": "Go",
"bytes": "2765"
},
{
"name": "HTML",
"bytes": "44381"
},
{
"name": "Java",
"bytes": "507948"
},
{
"name": "JavaScript",
"bytes": "22906"
},
{
"name": "Python",
"bytes": "7608990"
},
{
"name": "Rust",
"bytes": "1005243"
},
{
"name": "Scala",
"bytes": "106520"
},
{
"name": "Shell",
"bytes": "105217"
},
{
"name": "Starlark",
"bytes": "489739"
},
{
"name": "Thrift",
"bytes": "2953"
}
],
"symlink_target": ""
} |
cask "ipfs" do
version "0.12.2"
sha256 "cc51561e1a28d25ce0f5d738bbe529150ca081faeaac2f843fb1e51b63240793"
url "https://github.com/ipfs-shipyard/ipfs-desktop/releases/download/v#{version}/ipfs-desktop-#{version}.dmg"
appcast "https://github.com/ipfs-shipyard/ipfs-desktop/releases.atom"
name "IPFS Desktop"
homepage "https://github.com/ipfs-shipyard/ipfs-desktop"
auto_updates true
app "IPFS Desktop.app"
end
| {
"content_hash": "0e0408a6ceaa37d1fdaf8f2c20ab4349",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 111,
"avg_line_length": 32.84615384615385,
"alnum_prop": 0.765807962529274,
"repo_name": "haha1903/homebrew-cask",
"id": "c0c2c08f77e587803834d0967d4939925b96533c",
"size": "427",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Casks/ipfs.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "1646063"
},
{
"name": "Shell",
"bytes": "57683"
}
],
"symlink_target": ""
} |
typedef const struct __CFNumber *CFNumberRef;
void takes_int(int);
void bad(CFNumberRef p) {
#ifdef PEDANTIC
if (p) {} // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive boolean value; instead, either compare the pointer to NULL or call CFNumberGetValue()}}
if (!p) {} // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive boolean value; instead, either compare the pointer to NULL or call CFNumberGetValue()}}
p ? 1 : 2; // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive boolean value; instead, either compare the pointer to NULL or call CFNumberGetValue()}}
if (p == 0) {} // expected-warning{{Comparing a pointer value of type 'CFNumberRef' to a primitive integer value; instead, either compare the pointer to NULL or compare the result of calling CFNumberGetValue()}}
#else
if (p) {} // no-warning
if (!p) {} // no-warning
p ? 1 : 2; // no-warning
if (p == 0) {} // no-warning
#endif
if (p > 0) {} // expected-warning{{Comparing a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to compare the result of calling CFNumberGetValue()?}}
int x = p; // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to call CFNumberGetValue()?}}
x = p; // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to call CFNumberGetValue()?}}
takes_int(p); // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to call CFNumberGetValue()?}}
takes_int(x); // no-warning
}
// Conversion of a pointer to an intptr_t is fine.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long fintptr_t; // Fake, for testing the regex.
void test_intptr_t(CFNumberRef p) {
(long)p; // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to call CFNumberGetValue()?}}
(intptr_t)p; // no-warning
(unsigned long)p; // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to call CFNumberGetValue()?}}
(uintptr_t)p; // no-warning
(fintptr_t)p; // expected-warning{{Converting a pointer value of type 'CFNumberRef' to a primitive integer value; did you mean to call CFNumberGetValue()?}}
}
| {
"content_hash": "62df8fde79c04e750b0b057289d448a5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 213,
"avg_line_length": 69.31428571428572,
"alnum_prop": 0.72959604286892,
"repo_name": "epiqc/ScaffCC",
"id": "8f1e672179744b1026088def35975fcd55069eaf",
"size": "2750",
"binary": false,
"copies": "24",
"ref": "refs/heads/master",
"path": "clang/test/Analysis/number-object-conversion.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "3493637"
},
{
"name": "Batchfile",
"bytes": "753"
},
{
"name": "C",
"bytes": "3272269"
},
{
"name": "C++",
"bytes": "56117969"
},
{
"name": "CMake",
"bytes": "204481"
},
{
"name": "CSS",
"bytes": "55547"
},
{
"name": "Cuda",
"bytes": "5785"
},
{
"name": "Emacs Lisp",
"bytes": "20994"
},
{
"name": "HTML",
"bytes": "3200864"
},
{
"name": "JavaScript",
"bytes": "17391"
},
{
"name": "LLVM",
"bytes": "10223782"
},
{
"name": "M",
"bytes": "578"
},
{
"name": "M4",
"bytes": "189436"
},
{
"name": "MATLAB",
"bytes": "22305"
},
{
"name": "Makefile",
"bytes": "413012"
},
{
"name": "Mercury",
"bytes": "1195"
},
{
"name": "OCaml",
"bytes": "343061"
},
{
"name": "Objective-C",
"bytes": "18301489"
},
{
"name": "Objective-C++",
"bytes": "317800"
},
{
"name": "PHP",
"bytes": "1128"
},
{
"name": "Perl",
"bytes": "200404"
},
{
"name": "Python",
"bytes": "1043548"
},
{
"name": "Roff",
"bytes": "18799"
},
{
"name": "Shell",
"bytes": "566849"
},
{
"name": "Vim script",
"bytes": "27002"
}
],
"symlink_target": ""
} |
package gov.hhs.fha.nhinc.docretrieve.entity.proxy;
import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetCommunitiesType;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundDocRetrieveAggregator_a0;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundDocRetrieveAuditTransformer_a0;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundDocRetrieveDelegate;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundDocRetrieveOrchestratable;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundStandardDocRetrieveOrchestrator;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundDocRetrievePolicyTransformer_a0;
import gov.hhs.fha.nhinc.docretrieve.entity.OutboundStandardDocRetrieveOrchestratable;
import gov.hhs.fha.nhinc.orchestration.AuditTransformer;
import gov.hhs.fha.nhinc.orchestration.NhinAggregator;
import gov.hhs.fha.nhinc.orchestration.OutboundDelegate;
import gov.hhs.fha.nhinc.orchestration.PolicyTransformer;
import ihe.iti.xds_b._2007.RetrieveDocumentSetRequestType;
import ihe.iti.xds_b._2007.RetrieveDocumentSetResponseType;
/**
*
* @author dunnek
*/
public class EntityDocRetrieveProxyJavaImpl implements EntityDocRetrieveProxy {
public EntityDocRetrieveProxyJavaImpl() {
}
public RetrieveDocumentSetResponseType respondingGatewayCrossGatewayRetrieve(RetrieveDocumentSetRequestType body,
AssertionType assertion, NhinTargetCommunitiesType targets) {
PolicyTransformer pt = new OutboundDocRetrievePolicyTransformer_a0();
AuditTransformer at = new OutboundDocRetrieveAuditTransformer_a0();
OutboundDelegate nd = new OutboundDocRetrieveDelegate();
NhinAggregator na = new OutboundDocRetrieveAggregator_a0();
OutboundDocRetrieveOrchestratable EntityDROrchImpl = new OutboundStandardDocRetrieveOrchestratable(pt, at, nd,
na, body, assertion, null);
OutboundStandardDocRetrieveOrchestrator oOrchestrator = new OutboundStandardDocRetrieveOrchestrator();
oOrchestrator.process(EntityDROrchImpl);
return EntityDROrchImpl.getResponse();
}
}
| {
"content_hash": "3ca6d5f15d58efae14238737b5911cd4",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 118,
"avg_line_length": 50.857142857142854,
"alnum_prop": 0.8127340823970037,
"repo_name": "sailajaa/CONNECT",
"id": "a6bd523e268ddfdb6e76d2071749524d79613b63",
"size": "3828",
"binary": false,
"copies": "2",
"ref": "refs/heads/CONNECT_integration",
"path": "Product/Production/Services/DocumentRetrieveCore/src/main/java/gov/hhs/fha/nhinc/docretrieve/entity/proxy/EntityDocRetrieveProxyJavaImpl.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "5539"
},
{
"name": "Groovy",
"bytes": "1641"
},
{
"name": "Java",
"bytes": "12552183"
},
{
"name": "Python",
"bytes": "773"
},
{
"name": "Shell",
"bytes": "14607"
},
{
"name": "XSLT",
"bytes": "35057"
}
],
"symlink_target": ""
} |
package ir.asparsa.android.core.util;
import android.support.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;
/**
* Imported from https://github.com/hadilq/java-persian-calendar/blob/master/persian/src/main/java/ir/hadilq/PersianCalendar.java
* */
public class PersianCalendar extends Calendar {
/**
* Value for the after hejra era.
*/
public static final int AH = 1;
/**
* Value for the before hejra era.
*/
public static final int BH = 0;
/**
* Value of the {@code MONTH} field indicating the first month of the
* year.
*/
public static final int FARVARDIN = 0;
/**
* Value of the {@code MONTH} field indicating the second month of
* the year.
*/
public static final int ORDIBEHESHT = 1;
/**
* Value of the {@code MONTH} field indicating the third month of the
* year.
*/
public static final int KHORDAD = 2;
/**
* Value of the {@code MONTH} field indicating the fourth month of
* the year.
*/
public static final int TIR = 3;
/**
* Value of the {@code MONTH} field indicating the fifth month of the
* year.
*/
public static final int MORDAD = 4;
/**
* Value of the {@code MONTH} field indicating the sixth month of the
* year.
*/
public static final int SHAHRIVAR = 5;
/**
* Value of the {@code MONTH} field indicating the seventh month of
* the year.
*/
public static final int MEHR = 6;
/**
* Value of the {@code MONTH} field indicating the eighth month of
* the year.
*/
public static final int ABAN = 7;
/**
* Value of the {@code MONTH} field indicating the ninth month of the
* year.
*/
public static final int AZAR = 8;
/**
* Value of the {@code MONTH} field indicating the tenth month of the
* year.
*/
public static final int DEY = 9;
/**
* Value of the {@code MONTH} field indicating the eleventh month of
* the year.
*/
public static final int BAHMAN = 10;
/**
* Value of the {@code MONTH} field indicating the twelfth month of
* the year.
*/
public static final int ESFAND = 11;
private final static int EPOCH_OFFSET = 492268;
private final static int BASE_YEAR = 1349;
private final static int[] FIXED_DATES = new int[]{
492347, // False , 1349
492712, // True , 1350
493078, // False , 1351
493443, // False , 1352
493808, // False , 1353
494173, // True , 1354
494539, // False , 1355
494904, // False , 1356
495269, // False , 1357
495634, // True , 1358
496000, // False , 1359
496365, // False , 1360
496730, // False , 1361
497095, // True , 1362
497461, // False , 1363
497826, // False , 1364
498191, // False , 1365
498556, // True , 1366
498922, // False , 1367
499287, // False , 1368
499652, // False , 1369
500017, // True , 1370
500383, // False , 1371
500748, // False , 1372
501113, // False , 1373
501478, // False , 1374
501843, // True , 1375
502209, // False , 1376
502574, // False , 1377
502939, // False , 1378
503304, // True , 1379
503670, // False , 1380
504035, // False , 1381
504400, // False , 1382
504765, // True , 1383
505131, // False , 1384
505496, // False , 1385
505861, // False , 1386
506226, // True , 1387
506592, // False , 1388
506957, // False , 1389
507322, // False , 1390
507687, // True , 1391
508053, // False , 1392
508418, // False , 1393
508783, // False , 1394
509148, // True , 1395
509514, // False , 1396
509879, // False , 1397
510244, // False , 1398
510609, // True , 1399
510975, // False , 1400
511340, // False , 1401
511705, // False , 1402
512070, // False , 1403
512435, // True , 1404
512801, // False , 1405
513166, // False , 1406
513531, // False , 1407
513896, // True , 1408
514262, // False , 1409
514627, // False , 1410
514992, // False , 1411
515357, // True , 1412
515723, // False , 1413
516088, // False , 1414
516453, // False , 1415
516818, // True , 1416
517184, // False , 1417
};
private final static int[] ACCUMULATED_DAYS_IN_MONTH = new int[]{0, 31, 62, 93, 124, 155,
186, 216, 246, 276, 306, 336};
private final static int[] MINIMUMS = new int[]{0, 1, 0, 1, 0, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, -13 * 3600 * 1000, 0};
private static int[] MAXIMUMS = new int[]{1, 292278994, 11, 53, 6, 31,
366, 7, 6, 1, 11, 23, 59, 59, 999, 14 * 3600 * 1000, 7200000};
private static int[] LEAST_MAXIMUMS = new int[]{1, 292269054, 11, 50, 3,
28, 355, 7, 3, 1, 11, 23, 59, 59, 999, 50400000, 1200000};
private final static long ONE_SECOND_IN_MILLIS = 1000,
ONE_MINUTE_IN_MILLIS = 60 * ONE_SECOND_IN_MILLIS,
ONE_HOUR_IN_MILLIS = 60 * ONE_MINUTE_IN_MILLIS,
ONE_DAY_IN_MILLIS = 24 * ONE_HOUR_IN_MILLIS;
private int fixedDate = EPOCH_OFFSET;
@IntDef(value = {Calendar.ERA, Calendar.YEAR, Calendar.MONTH, Calendar.WEEK_OF_YEAR, Calendar.WEEK_OF_MONTH,
Calendar.DATE, Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK,
Calendar.DAY_OF_WEEK_IN_MONTH, Calendar.AM_PM, Calendar.HOUR, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND, Calendar.ZONE_OFFSET, Calendar.DST_OFFSET})
@Retention(RetentionPolicy.SOURCE)
public @interface Fields {
}
/**
* Constructs a new {@code PersianCalendar} initialized to the current date and
* time with the default {@code Locale} and {@code TimeZone}.
*/
public PersianCalendar() {
this(TimeZone.getDefault(), Locale.getDefault());
}
/**
* Constructs a new {@code PersianCalendar} initialized to midnight in the default
* {@code TimeZone} and {@code Locale} on the specified date.
*
* @param year the year.
* @param month the month.
* @param day the day of the month.
*/
public PersianCalendar(
int year,
int month,
int day
) {
super(TimeZone.getDefault(), Locale.getDefault());
set(year, month, day);
}
/**
* Constructs a new {@code PersianCalendar} initialized to the specified date and
* time in the default {@code TimeZone} and {@code Locale}.
*
* @param year the year.
* @param month the month.
* @param day the day of the month.
* @param hour the hour.
* @param minute the minute.
*/
public PersianCalendar(
int year,
int month,
int day,
int hour,
int minute
) {
super(TimeZone.getDefault(), Locale.getDefault());
set(year, month, day, hour, minute);
}
/**
* Constructs a new {@code PersianCalendar} initialized to the specified date and
* time in the default {@code TimeZone} and {@code Locale}.
*
* @param year the year.
* @param month the month.
* @param day the day of the month.
* @param hour the hour.
* @param minute the minute.
* @param second the second.
*/
public PersianCalendar(
int year,
int month,
int day,
int hour,
int minute,
int second
) {
super(TimeZone.getDefault(), Locale.getDefault());
set(year, month, day, hour, minute, second);
}
/**
* Constructs a new {@code PersianCalendar} initialized to the current date and
* time and using the specified {@code Locale} and the default {@code TimeZone}.
*
* @param locale the {@code Locale}.
*/
public PersianCalendar(Locale locale) {
this(TimeZone.getDefault(), locale);
}
/**
* Constructs a new {@code PersianCalendar} initialized to the current date and
* time and using the specified {@code TimeZone} and the default {@code Locale}.
*
* @param timezone the {@code TimeZone}.
*/
public PersianCalendar(TimeZone timezone) {
this(timezone, Locale.getDefault());
}
/**
* Constructs a new {@code PersianCalendar} initialized to the current date and
* time and using the specified {@code TimeZone} and {@code Locale}.
*
* @param timezone the {@code TimeZone}.
* @param locale the {@code Locale}.
*/
public PersianCalendar(
TimeZone timezone,
Locale locale
) {
super(timezone, locale);
setTimeInMillis(System.currentTimeMillis());
}
@Override
public void add(
@Fields int field,
int value
) {
if (value == 0) {
return;
}
if (field < 0 || field >= ZONE_OFFSET) {
throw new IllegalArgumentException();
}
if (field == ERA) {
complete();
if (fields[ERA] == AH) {
if (value >= 0) {
return;
}
set(ERA, BH);
} else {
if (value <= 0) {
return;
}
set(ERA, AH);
}
complete();
return;
}
if (field == YEAR || field == MONTH) {
complete();
if (field == MONTH) {
int month = fields[MONTH] + value;
if (month < 0) {
value = (month - 11) / 12;
month = 12 + (month % 12);
} else {
value = month / 12;
}
set(MONTH, month % 12);
}
set(YEAR, fields[YEAR] + value);
int days = daysInMonth(isLeapYear(fields[YEAR], fields[ERA] == AH), fields[MONTH]);
if (fields[DATE] > days) {
set(DATE, days);
}
complete();
return;
}
long multiplier = 0;
getTimeInMillis(); // Update the time
switch (field) {
case MILLISECOND:
time += value;
break;
case SECOND:
time += value * 1000L;
break;
case MINUTE:
time += value * 60000L;
break;
case HOUR:
case HOUR_OF_DAY:
time += value * 3600000L;
break;
case AM_PM:
multiplier = 43200000L;
break;
case DATE:
case DAY_OF_YEAR:
case DAY_OF_WEEK:
multiplier = 86400000L;
break;
case WEEK_OF_YEAR:
case WEEK_OF_MONTH:
case DAY_OF_WEEK_IN_MONTH:
multiplier = 604800000L;
break;
}
if (multiplier == 0) {
areFieldsSet = false;
complete();
return;
}
long delta = value * multiplier;
/*
* Attempt to keep the hour and minute constant when we've crossed a DST
* boundary and the user's units are AM_PM or larger. The typical
* consequence is that calls to add(DATE, 1) will add 23, 24 or 25 hours
* depending on whether the DST goes forward, constant, or backward.
*
* We know we've crossed a DST boundary if the new time will have a
* different timezone offset. Adjust by adding the difference of the two
* offsets. We don't adjust when doing so prevents the change from
* crossing the boundary.
*/
int zoneOffset = getTimeZone().getRawOffset();
int offsetBefore = getOffset(time + zoneOffset);
int offsetAfter = getOffset(time + zoneOffset + delta);
int dstDelta = offsetBefore - offsetAfter;
if (getOffset(time + zoneOffset + delta + dstDelta) == offsetAfter) {
delta += dstDelta;
}
time += delta;
areFieldsSet = false;
complete();
}
@Override
protected void computeFields() {
long timeInZone = time + getOffset(time);
fixedDate = ((int) Math.floor(timeInZone * 1d / ONE_DAY_IN_MILLIS)) + EPOCH_OFFSET;
fields[YEAR] = getYearFromFixedDate(fixedDate);
if (fields[YEAR] <= 0) {
fields[YEAR] = -fields[YEAR] + 1;
fields[ERA] = BH;
} else {
fields[ERA] = AH;
}
int far1 = getFixedDateFar1(fields[YEAR], fields[ERA] == AH);
fields[DAY_OF_YEAR] = fixedDate - far1 + 1;
if (fields[DAY_OF_YEAR] < ACCUMULATED_DAYS_IN_MONTH[6]) {
fields[MONTH] = (int) Math.floor((fields[DAY_OF_YEAR] - 1) / 31d); // month range is 0-11
} else {
fields[MONTH] = (int) Math.floor((fields[DAY_OF_YEAR] - 1 - ACCUMULATED_DAYS_IN_MONTH[6]) / 30d) + 6;
}
fields[DAY_OF_MONTH] = fields[DAY_OF_YEAR] - ACCUMULATED_DAYS_IN_MONTH[fields[MONTH]];
long extra = timeInZone - ((fixedDate - EPOCH_OFFSET) * ONE_DAY_IN_MILLIS);
fields[HOUR_OF_DAY] = (int) Math.floor(extra * 1d / ONE_HOUR_IN_MILLIS);
if (fields[HOUR_OF_DAY] >= 12) {
fields[HOUR] = fields[HOUR_OF_DAY] - 12;
fields[AM_PM] = PM;
} else {
fields[HOUR] = fields[HOUR_OF_DAY] - 12;
fields[AM_PM] = AM;
}
extra -= fields[HOUR_OF_DAY] * ONE_HOUR_IN_MILLIS;
fields[MINUTE] = (int) Math.floor(extra * 1d / ONE_MINUTE_IN_MILLIS);
extra -= fields[MINUTE] * ONE_MINUTE_IN_MILLIS;
fields[SECOND] = (int) Math.floor(extra * 1d / ONE_SECOND_IN_MILLIS);
extra -= fields[SECOND] * ONE_SECOND_IN_MILLIS;
fields[MILLISECOND] = (int) extra;
}
@Override
protected void computeTime() {
// Time is the reference and
if (!isSet(YEAR) || !isSet(MONTH)) {
return;
}
if (fields[YEAR] == 0) {
throw new IllegalArgumentException("Year cannot be zero");
}
if (!isSet(ERA)) {
fields[ERA] = AH;
}
int extraYear = (int) Math.floor(fields[MONTH] / 12d);
if (extraYear != 0) {
if (fields[ERA] == AH ^ extraYear > 0) {
if (fields[ERA] == AH && fields[YEAR] <= Math.abs(extraYear)) {
fields[YEAR] = Math.abs(extraYear) - fields[YEAR] + 1;
set(ERA, BH);
} else if (fields[ERA] == BH && fields[YEAR] <= Math.abs(extraYear)) {
fields[YEAR] = Math.abs(extraYear) - fields[YEAR] + 1;
set(ERA, AH);
} else if (fields[ERA] == AH) {
fields[YEAR] += extraYear; // the same as -= Math.abs(extraYear)
} else {
fields[YEAR] -= extraYear; // the same as += Math.abs(extraYear)
}
} else {
fields[YEAR] += Math.abs(extraYear);
}
}
fields[MONTH] %= 12; // months of a year is a fixed number (12)
if (fields[MONTH] < 0) {
fields[MONTH] += 12; // month range is 0-11
}
int fixedDate = getFixedDateFar1(fields[YEAR], fields[ERA] == AH) +
ACCUMULATED_DAYS_IN_MONTH[fields[MONTH]] +
(isSet(DAY_OF_MONTH) ? fields[DAY_OF_MONTH] - 1 : 0);
int timezoneOffset = -getOffset(fixedDate * ONE_DAY_IN_MILLIS);
time = (fixedDate - EPOCH_OFFSET) * ONE_DAY_IN_MILLIS + ONE_HOUR_IN_MILLIS +
(isSet(HOUR_OF_DAY) ? fields[HOUR_OF_DAY] :
(isSet(HOUR) && isSet(AM_PM) ? (fields[HOUR] + (fields[AM_PM] == AM ? 0 : 12)) : 0)) *
ONE_HOUR_IN_MILLIS +
(isSet(MINUTE) ? fields[MINUTE] : 0) * ONE_MINUTE_IN_MILLIS + timezoneOffset +
(isSet(SECOND) ? fields[SECOND] : 0) * ONE_SECOND_IN_MILLIS +
(isSet(MILLISECOND) ? fields[MILLISECOND] : 0);
areFieldsSet = false;
}
/**
* Compares the given object to this {@code Calendar} and returns whether they are
* equal. The object must be an instance of {@code Calendar} and have the same
* properties.
*
* @return {@code true} if the given object is equal to this {@code Calendar}, {@code false}
* otherwise.
*/
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Calendar)) {
return false;
}
Calendar cal = (Calendar) object;
return getTimeInMillis() == cal.getTimeInMillis()
&& get(YEAR) == cal.get(YEAR)
&& get(MONTH) == cal.get(MONTH)
&& get(DAY_OF_MONTH) == cal.get(DAY_OF_MONTH)
&& get(HOUR) == cal.get(HOUR)
&& get(MINUTE) == cal.get(MINUTE)
&& get(SECOND) == cal.get(SECOND)
&& get(MILLISECOND) == cal.get(MILLISECOND);
}
@Override
public int getActualMinimum(int field) {
return getMinimum(field);
}
/**
* Returns the maximum value of the given field for the current date.
* For example, the maximum number of days in the current month.
*/
@Override
public int getActualMaximum(int field) {
return getMaximum(field);
}
/**
* Returns the minimum value of the given field for the current date.
*/
@Override
public int getGreatestMinimum(@Fields int field) {
return MINIMUMS[field];
}
@Override
public int getLeastMaximum(@Fields int field) {
return LEAST_MAXIMUMS[field];
}
@Override
public int getMaximum(@Fields int field) {
return MAXIMUMS[field];
}
@Override
public int getMinimum(@Fields int field) {
return MINIMUMS[field];
}
@Override
public void roll(
@Fields int field,
boolean increment
) {
throw new IllegalArgumentException("Not supported");
}
private int getOffset(long localTime) {
return getTimeZone().getOffset(localTime);
}
/* To find the year that associated with fixedDat. */
private int getYearFromFixedDate(int fd) {
int testYear;
boolean testAfterH = fd > 0;
if (testAfterH) {
testYear = (int) Math.floor(Math.round((fd - 1) / 365.24219)) + 1;
} else {
testYear = (int) Math.floor(Math.round(fd / 365.24219));
}
if (testYear == 0) {
testYear = 1;
testAfterH = true;
}
int far1 = getFixedDateFar1(Math.abs(testYear), testAfterH);
if (far1 <= fd)
if (testYear <= 0) {
return testYear + 1;
} else {
return testYear;
}
else {
// last year of testYear and try to convert it to include zero
if (testYear <= -1) {
return testYear;
} else {
return testYear - 1;
}
}
}
/* To find the fixedDate of first day of year. Farvardin 1, 1 must have fixedDate of one. */
public static int getFixedDateFar1(
int year,
boolean afterH
) {
if (year <= 0) {
throw new IllegalArgumentException("Year cannot be negative or zero. Year: " + year);
}
if (afterH && year >= BASE_YEAR && year < BASE_YEAR + FIXED_DATES.length - 1) {
return FIXED_DATES[year - BASE_YEAR];
}
// The detail can be found in en.wikibook.com
int realYear;
if (afterH)
realYear = year - 1;
else
realYear = -year;
int days = 1029983 * ((int) Math.floor((realYear + 38) / 2820d));
int cycle = (realYear + 38) % 2820;
if (cycle < 0) cycle += 2820;
days += Math.floor((cycle - 38) * 365.24219) + 1;
double extra = cycle * 0.24219;
int frac = getIntegerPart((extra - Math.floor(extra)) * 1000);
int lastYear = year - 1;
boolean lastYearAfterH = afterH;
if (afterH && year == 1) {
lastYear = 1;
lastYearAfterH = false;
} else if (!afterH) {
lastYear = year + 1;
}
if (isLeapYear(lastYear, lastYearAfterH) && frac <= 202) {
days++;
}
return days;
}
public int daysInMonth() {
return daysInMonth(isLeapYear(fields[YEAR], fields[ERA] == AH), fields[MONTH]);
}
public static int daysInMonth(
boolean leapYear,
int month
) {
if (month < 0 || month > ESFAND) {
throw new IllegalArgumentException();
}
if (month == ESFAND) {
if (leapYear) {
return 30;
} else {
return 29;
}
}
return ACCUMULATED_DAYS_IN_MONTH[month + 1] - ACCUMULATED_DAYS_IN_MONTH[month];
}
private int daysInYear(
int year,
boolean afterH
) {
return isLeapYear(year, afterH) ? 366 : 365;
}
/**
* Returns true if {@code year} is a leap year.
*/
public boolean isLeapYear() {
if (isSet(YEAR)) {
return isLeapYear(fields[YEAR], fields[ERA] == AH);
}
throw new IllegalArgumentException("Year must be set");
}
/**
* Returns true if {@code year} is a leap year.
*/
public static boolean isLeapYear(
int year,
boolean afterH
) {
// The detail can be found in en.wikibook.com
double realYear0, realYear1;
if (afterH) {
realYear0 = realYear(year, true);
realYear1 = realYear(year + 1, true);
} else {
realYear0 = realYear(year, false);
realYear1 = realYear(year - 1, false);
}
double extraDaysOfOneYear = 0.24219d; // 0.24219 ~ extra days of one year
double delta = 0.025;
double leapDays0 = realYear0 * extraDaysOfOneYear + delta;
double leapDays1 = realYear1 * extraDaysOfOneYear + delta;
double frac0 = getIntegerPart((leapDays0 - getIntegerPart(leapDays0)) * 1000);
double frac1 = getIntegerPart((leapDays1 - getIntegerPart(leapDays1)) * 1000);
int criticalPoint = 266;
if (frac0 <= criticalPoint && frac1 > criticalPoint)
return true;
else
return false;
}
public static int realYear(
int year,
boolean afterH
) {
if (afterH) {
return mod(year + 38, 2820);
} else {
return mod(-year + 39, 2820);
}
}
public static int mod(
int i,
int j
) {
int m = i % j;
if (m < 0) {
return m + j;
} else {
return m;
}
}
/* To get integer part of a float */
public static int getIntegerPart(double d) {
if (d >= 0) return (int) Math.floor(d);
else return (int) Math.floor(d) + 1;
}
} | {
"content_hash": "e8590580648234ec94d8def04e7f58dd",
"timestamp": "",
"source": "github",
"line_count": 748,
"max_line_length": 129,
"avg_line_length": 32.5975935828877,
"alnum_prop": 0.5108887339539844,
"repo_name": "hadilq/HobbyTaste",
"id": "8bd44036252308639d90161d42037967380602d1",
"size": "24383",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client-core/src/main/java/ir/asparsa/android/core/util/PersianCalendar.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "638755"
},
{
"name": "Protocol Buffer",
"bytes": "1664"
}
],
"symlink_target": ""
} |
package ru.atom.lecture06.server.resource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.jetty.util.ConcurrentArrayQueue;
import org.w3c.dom.UserDataHandler;
import ru.atom.lecture06.server.dao.MessageDao;
import ru.atom.lecture06.server.dao.UserDao;
import ru.atom.lecture06.server.model.Message;
import ru.atom.lecture06.server.model.User;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.stream.Collectors;
@Path("/")
public class ChatResource {
private static final Logger log = LogManager.getLogger(ChatResource.class);
private static final UserDao userDao = new UserDao();
private static final MessageDao messageDao = new MessageDao();
@POST
@Consumes("application/x-www-form-urlencoded")
@Path("/login")
public Response login(@QueryParam("name") String name) {
if (name.length() < 1) {
return Response.status(Response.Status.BAD_REQUEST).entity("Too short name, sorry :(").build();
}
if (name.length() > 20) {
return Response.status(Response.Status.BAD_REQUEST).entity("Too long name, sorry :(").build();
}
if (name.toLowerCase().contains("hitler")) {
return Response.status(Response.Status.BAD_REQUEST).entity("hitler not allowed, sorry :(").build();
}
List<User> alreadyLogined = userDao.getAllWhere("chat.user.login = '" + name + "'");
if (alreadyLogined.stream().anyMatch(l -> l.getLogin().equals(name))) {
return Response.status(Response.Status.BAD_REQUEST).entity("Already logined").build();
}
User newUser = new User().setLogin(name);
userDao.insert(newUser);
log.info("[" + name + "] logined");
//TODO send message "[user]: joined"
return Response.ok().build();
}
@GET
@Produces("text/plain")
@Path("/online")
public Response online() {
List<User> all = userDao.getAll();
return Response.ok(String.join("\n", all.stream().map(User::getLogin).collect(Collectors.toList()))).build();
}
@POST
@Consumes("application/x-www-form-urlencoded")
@Path("/say")
public Response say(@QueryParam("name") String name, @FormParam("msg") String msg) {
if (name == null) {
return Response.status(Response.Status.UNAUTHORIZED).entity("Name not provided").build();
}
if (msg == null) {
return Response.status(Response.Status.BAD_REQUEST).entity("No message provided").build();
}
if (msg.length() > 140) {
return Response.status(Response.Status.BAD_REQUEST).entity("Too long message").build();
}
List<User> authors = userDao.getAllWhere("chat.user.login = '" + name + "'");
if (authors.isEmpty()) {
return Response.status(Response.Status.UNAUTHORIZED).entity("Not logined").build();
}
User author = authors.get(0);
Message message = new Message()
.setUser(author)
.setValue(msg);
messageDao.insert(message);
log.info("[" + name + "]: " + msg);
return Response.ok().build();
}
@GET
@Produces("text/plain")
@Path("/chat")
public Response chat(@QueryParam("name") String name) {
if (name == null || name.isEmpty()) {
List<Message> chatHistory = messageDao.getAll();
return Response.ok(String.join("\n", chatHistory
.stream()
.map(m -> "[" + m.getUser().getLogin() + "]: " + m.getValue())
.collect(Collectors.toList()))).build();
}
User user = userDao.getByName(name);
if (user == null) {
return Response.status(Response.Status.BAD_REQUEST).entity("No such logined user " + name).build();
}
List<Message> chatHistory = messageDao.getAll();
return Response.ok(String.join("\n", chatHistory
.stream()
.map(m -> "[" + m.getUser() + "]: " + m.getValue())
.collect(Collectors.toList()))).build();
}
} | {
"content_hash": "597a3f00a12270695f29f28b05d0b344",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 117,
"avg_line_length": 36.46218487394958,
"alnum_prop": 0.6098179303987094,
"repo_name": "Bragaman/atom",
"id": "f580ab260f86c99a66cdc50f12175ea2beec8d5a",
"size": "4339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lecture06/src/main/java/ru/atom/lecture06/server/resource/ChatResource.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2575"
},
{
"name": "HTML",
"bytes": "10430"
},
{
"name": "Java",
"bytes": "490433"
},
{
"name": "JavaScript",
"bytes": "54267"
},
{
"name": "PLpgSQL",
"bytes": "482"
},
{
"name": "XSLT",
"bytes": "2573"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.