code stringlengths 3 1.05M | repo_name stringlengths 4 116 | path stringlengths 4 991 | language stringclasses 9 values | license stringclasses 15 values | size int32 3 1.05M |
|---|---|---|---|---|---|
<?php
namespace Wallabag\CoreBundle\Event\Subscriber;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Wallabag\CoreBundle\Entity\Entry;
/**
* SQLite doesn't care about cascading remove, so we need to manually remove associated stuf for an Entry.
* Foreign Key Support can be enabled by running `PRAGMA foreign_keys = ON;` at runtime (AT RUNTIME !).
* But it needs a compilation flag that not all SQLite instance has ...
*
* @see https://www.sqlite.org/foreignkeys.html#fk_enable
*/
class SQLiteCascadeDeleteSubscriber implements EventSubscriber
{
private $doctrine;
public function __construct(Registry $doctrine)
{
$this->doctrine = $doctrine;
}
/**
* @return array
*/
public function getSubscribedEvents()
{
return [
'preRemove',
];
}
/**
* We removed everything related to the upcoming removed entry because SQLite can't handle it on it own.
* We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone).
*/
public function preRemove(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform
|| !$entity instanceof Entry) {
return;
}
$em = $this->doctrine->getManager();
if (null !== $entity->getTags()) {
foreach ($entity->getTags() as $tag) {
$entity->removeTag($tag);
}
}
if (null !== $entity->getAnnotations()) {
foreach ($entity->getAnnotations() as $annotation) {
$em->remove($annotation);
}
}
$em->flush();
}
}
| wallabag/wallabag | src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php | PHP | mit | 1,862 |
<?php
namespace Fnetwork\TPL\Templates;
use Fnetwork\TPL\Template;
class TemplatePhp extends Template {
protected $language = 'php';
}
| tpl42/tpl | templates/TemplatePhp.php | PHP | mit | 140 |
class Solution(object):
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
if not s:
return True
start = 0
end = len(s)-1
s = s.lower()
while start < end:
while start < end and not s[start].isalnum():
start += 1
while start < end and not s[end].isalnum():
end -= 1
if s[start] == s[end]:
start += 1
end -= 1
else:
return False
return True | tedye/leetcode | Python/leetcode.125.valid-palindrome.py | Python | mit | 594 |
export const sampleIds = ["bass", "snare", "cymbal", "hihat"];
import { Direction, SliderOptions } from "../../../lib/slider/Slider";
export function RowConfig(rowIndex: number): Array<number> {
switch (rowIndex) {
case 0: //bass
return [0, 10];
case 1: //snare
return [4, 12];
case 2: //cymbal
return [];
case 3: //hihat
return [2,7,9,12];
}
return [];
}
export function VolumeSliderOptions(size: number): SliderOptions {
return {
initPerc: .7,
dir: Direction.VERTICAL,
knob: {
radius: 25,
color: 0xFF0000
},
track: {
sizeX: 50,
sizeY: size,
color: 0x00ff00
}
}
}
export function SpeedSliderOptions(size: number): SliderOptions {
return {
initPerc: .5,
dir: Direction.HORIZONTAL,
knob: {
radius: 25,
color: 0xFF0000
},
track: {
sizeX: size,
sizeY: 50,
color: 0x00ff00
}
}
} | dakom/sodium-typescript-playground | src/app/modules/drum_machine/DrumMachine_Config.ts | TypeScript | mit | 1,205 |
// getPostsParameters gives an object containing the appropriate find and options arguments for the subscriptions's Posts.find()
getPostsParameters = function (terms) {
var maxLimit = 200;
// console.log(terms)
// note: using jquery's extend() with "deep" parameter set to true instead of shallow _.extend()
// see: http://api.jquery.com/jQuery.extend/
// initialize parameters by extending baseParameters object, to avoid passing it by reference
var parameters = deepExtend(true, {}, viewParameters.baseParameters);
// if view is not defined, default to "top"
var view = !!terms.view ? dashToCamel(terms.view) : 'top';
// get query parameters according to current view
if (typeof viewParameters[view] !== 'undefined')
parameters = deepExtend(true, parameters, viewParameters[view](terms));
// extend sort to sort posts by _id to break ties
deepExtend(true, parameters, {options: {sort: {_id: -1}}});
// if a limit was provided with the terms, add it too (note: limit=0 means "no limit")
if (typeof terms.limit !== 'undefined')
_.extend(parameters.options, {limit: parseInt(terms.limit)});
// limit to "maxLimit" posts at most when limit is undefined, equal to 0, or superior to maxLimit
if(!parameters.options.limit || parameters.options.limit == 0 || parameters.options.limit > maxLimit) {
parameters.options.limit = maxLimit;
}
// hide future scheduled posts unless "showFuture" is set to true or postedAt is already defined
if (!parameters.showFuture && !parameters.find.postedAt)
parameters.find.postedAt = {$lte: new Date()};
// console.log(parameters);
return parameters;
};
getUsersParameters = function(filterBy, sortBy, limit) {
var find = {},
sort = {createdAt: -1};
switch(filterBy){
case 'invited':
// consider admins as invited
find = {$or: [{isInvited: true}, adminMongoQuery]};
break;
case 'uninvited':
find = {$and: [{isInvited: false}, notAdminMongoQuery]};
break;
case 'admin':
find = adminMongoQuery;
break;
}
switch(sortBy){
case 'username':
sort = {username: 1};
break;
case 'karma':
sort = {karma: -1};
break;
case 'postCount':
sort = {postCount: -1};
break;
case 'commentCount':
sort = {commentCount: -1};
case 'invitedCount':
sort = {invitedCount: -1};
}
return {
find: find,
options: {sort: sort, limit: limit}
};
};
| haribabuthilakar/fh | lib/parameters.js | JavaScript | mit | 2,548 |
#include <boost\math\special_functions.hpp>
#include "common.h"
#include "cusolverOperations.h"
namespace matCUDA
{
template< typename TElement>
cusolverStatus_t cusolverOperations<TElement>::ls( Array<TElement> *A, Array<TElement> *x, Array<TElement> *C )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
TElement *d_A, *Workspace, *d_C;
int INFOh = 2;
CUDA_CALL( cudaMalloc(&d_A, A->getDim(0) * A->getDim(1) * sizeof(TElement)) );
CUDA_CALL( cudaMalloc(&d_C, C->getDim(0) * C->getDim(1) * sizeof(TElement)) );
CUDA_CALL( cudaMemcpy(d_A, A->data(), A->getDim(0) * A->getDim(1) * sizeof(TElement), cudaMemcpyHostToDevice) );
CUDA_CALL( cudaMemcpy(d_C, C->data(), C->getDim(0) * C->getDim(1) * sizeof(TElement), cudaMemcpyHostToDevice) );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgetrf_bufferSize(&handle, A->getDim(0), A->getDim(1), d_A, A->getDim(0), &Lwork) );
CUDA_CALL( cudaMalloc( &Workspace, Lwork * sizeof(TElement) ) );
int *devIpiv, *devInfo;
size_t size_pivot = std::min(C->getDim(0),C->getDim(1));
CUDA_CALL( cudaMalloc( &devIpiv, size_pivot * sizeof(int) ) );
CUDA_CALL( cudaMalloc( &devInfo, sizeof(int) ) );
/////***** performance test *****/////
//CUDA_CALL( cudaDeviceSynchronize() );
//tic();
//for( int i = 0; i < 10; i++ ) {
CUSOLVER_CALL( cusolverDnTgetrf( &handle, A->getDim(0), A->getDim(1), d_A, A->getDim(0), Workspace, devIpiv, devInfo ) );
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Factorization Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
CUSOLVER_CALL( cusolverDnTgetrs( &handle, CUBLAS_OP_N, std::min(A->getDim(0),A->getDim(1)), C->getDim(1), d_A, A->getDim(0), devIpiv, d_C, C->getDim(0), devInfo ) );
//}
//CUDA_CALL( cudaDeviceSynchronize() );
//toc();
////***** end of performance test *****/////
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
INFOh = 2;
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Inversion Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
CUDA_CALL( cudaMemcpy( C->data(), d_C, C->getNElements()*sizeof( TElement ), cudaMemcpyDeviceToHost ) );
for( int i = 0; i< x->GetDescriptor().GetDim( 0 ); i++ ) {
for( int j = 0; j < x->GetDescriptor().GetDim( 1 ); j++ )
(*x)( i, j ) = (*C)( i, j );
}
// free memory
CUDA_CALL( cudaFree( d_A ) );
CUDA_CALL( cudaFree( d_C ) );
CUDA_CALL( cudaFree( Workspace ) );
CUDA_CALL( cudaFree( devIpiv ) );
CUDA_CALL( cudaFree( devInfo ) );
// Destroy the handle
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::ls( Array<int> *A, Array<int> *x, Array<int> *C );
template cusolverStatus_t cusolverOperations<float>::ls( Array<float> *A, Array<float> *x, Array<float> *C );
template cusolverStatus_t cusolverOperations<double>::ls( Array<double> *A, Array<double> *x, Array<double> *C );
template cusolverStatus_t cusolverOperations<ComplexFloat>::ls( Array<ComplexFloat> *A, Array<ComplexFloat> *x, Array<ComplexFloat> *C );
template cusolverStatus_t cusolverOperations<ComplexDouble>::ls( Array<ComplexDouble> *A, Array<ComplexDouble> *x, Array<ComplexDouble> *C );
template< typename TElement>
cusolverStatus_t cusolverOperations<TElement>::invert( Array<TElement> *result, Array<TElement> *data )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
size_t M = data->getDim(0);
size_t N = data->getDim(1);
size_t minMN = std::min(M,N);
TElement *d_A, *Workspace, *d_B;
int INFOh = 2;
CUDA_CALL( cudaMalloc(&d_A, M * N * sizeof(TElement)) );
CUDA_CALL( cudaMalloc(&d_B, M * N * sizeof(TElement)) );
CUDA_CALL( cudaMemcpy(d_A, data->data(), M * N * sizeof(TElement), cudaMemcpyHostToDevice) );
cuda_eye<TElement>( d_B, minMN );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgetrf_bufferSize(&handle, M, N, d_A, M, &Lwork) );
CUDA_CALL( cudaMalloc( &Workspace, Lwork * sizeof(TElement) ) );
int *devIpiv, *devInfo;
size_t size_pivot = std::min(data->getDim(0),data->getDim(1));
CUDA_CALL( cudaMalloc( &devIpiv, size_pivot * sizeof(int) ) );
CUDA_CALL( cudaMalloc( &devInfo, sizeof(int) ) );
/////***** performance test *****/////
//CUDA_CALL( cudaDeviceSynchronize() );
//tic();
//for( int i = 0; i < 10; i++ ) {
CUSOLVER_CALL( cusolverDnTgetrf( &handle, M, N, d_A, M, Workspace, devIpiv, devInfo ) );
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Factorization Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
CUSOLVER_CALL( cusolverDnTgetrs( &handle, CUBLAS_OP_N, data->getDim(0), data->getDim(1), d_A, data->getDim(0), devIpiv, d_B, data->getDim(0), devInfo ) );
//}
//CUDA_CALL( cudaDeviceSynchronize() );
//toc();
////***** end of performance test *****/////
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
INFOh = 2;
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Inversion Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
CUDA_CALL( cudaMemcpy( result->data(), d_B, result->getNElements()*sizeof( TElement ), cudaMemcpyDeviceToHost ) );
// free memory
CUDA_CALL( cudaFree( d_A ) );
CUDA_CALL( cudaFree( d_B ) );
CUDA_CALL( cudaFree( Workspace ) );
CUDA_CALL( cudaFree( devIpiv ) );
CUDA_CALL( cudaFree( devInfo ) );
// Destroy the handle
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::invert( Array<int> *result, Array<int> *data );
template cusolverStatus_t cusolverOperations<float>::invert( Array<float> *result, Array<float> *data );
template cusolverStatus_t cusolverOperations<double>::invert( Array<double> *result, Array<double> *data );
template cusolverStatus_t cusolverOperations<ComplexFloat>::invert( Array<ComplexFloat> *result, Array<ComplexFloat> *data );
template cusolverStatus_t cusolverOperations<ComplexDouble>::invert( Array<ComplexDouble> *result, Array<ComplexDouble> *data );
template< typename TElement>
cusolverStatus_t cusolverOperations<TElement>::invert_zerocopy( Array<TElement> *result, Array<TElement> *data )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
size_t M = data->getDim(0);
size_t N = data->getDim(1);
size_t minMN = std::min(M,N);
TElement *d_A, *Workspace, *d_B;
CUDA_CALL( cudaMalloc(&d_A, M * N * sizeof(TElement)) );
// pass host pointer to device
CUDA_CALL( cudaHostGetDevicePointer( &d_B, result->data(), 0 ) );
CUDA_CALL( cudaMemcpy(d_A, data->data(), M * N * sizeof(TElement), cudaMemcpyHostToDevice) );
cuda_eye<TElement>( d_B, minMN );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgetrf_bufferSize(&handle, M, N, d_A, M, &Lwork) );
CUDA_CALL( cudaMalloc( &Workspace, Lwork * sizeof(TElement) ) );
int *devIpiv, *devInfo;
size_t size_pivot = std::min(data->getDim(0),data->getDim(1));
CUDA_CALL( cudaMalloc( &devIpiv, size_pivot * sizeof(int) ) );
CUDA_CALL( cudaMalloc( &devInfo, sizeof(int) ) );
CUSOLVER_CALL( cusolverDnTgetrf( &handle, M, N, d_A, M, Workspace, devIpiv, devInfo ) );
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
int INFOh = 2;
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Factorization Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
CUSOLVER_CALL( cusolverDnTgetrs( &handle, CUBLAS_OP_N, data->getDim(0), data->getDim(1), d_A, data->getDim(0), devIpiv, d_B, data->getDim(0), devInfo ) );
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
INFOh = 2;
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Inversion Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
// free memory
CUDA_CALL( cudaFree( d_A ) );
CUDA_CALL( cudaFree( Workspace ) );
CUDA_CALL( cudaFree( devIpiv ) );
CUDA_CALL( cudaFree( devInfo ) );
// Destroy the handle
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::invert_zerocopy( Array<int> *result, Array<int> *data );
template cusolverStatus_t cusolverOperations<float>::invert_zerocopy( Array<float> *result, Array<float> *data );
template cusolverStatus_t cusolverOperations<double>::invert_zerocopy( Array<double> *result, Array<double> *data );
template cusolverStatus_t cusolverOperations<ComplexFloat>::invert_zerocopy( Array<ComplexFloat> *result, Array<ComplexFloat> *data );
template cusolverStatus_t cusolverOperations<ComplexDouble>::invert_zerocopy( Array<ComplexDouble> *result, Array<ComplexDouble> *data );
template< typename TElement>
cusolverStatus_t cusolverOperations<TElement>::lu( Array<TElement> *A, Array<TElement> *lu, Array<TElement> *Pivot )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
size_t M = A->getDim(0);
size_t N = A->getDim(1);
size_t minMN = std::min(M,N);
TElement *d_A, *Workspace;
CUDA_CALL( cudaMalloc(&d_A, M * N * sizeof(TElement)) );
CUDA_CALL( cudaMemcpy(d_A, A->data(), M * N * sizeof(TElement), cudaMemcpyHostToDevice) );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgetrf_bufferSize(&handle, M, N, d_A, M, &Lwork) );
CUDA_CALL( cudaMalloc( &Workspace, Lwork * sizeof(TElement) ) );
int *devIpiv, *devInfo;
size_t size_pivot = std::min(A->getDim(0),A->getDim(1));
CUDA_CALL( cudaMalloc( &devIpiv, size_pivot * sizeof(int) ) );
CUDA_CALL( cudaMalloc( &devInfo, sizeof(int) ) );
CUSOLVER_CALL( cusolverDnTgetrf( &handle, M, N, d_A, M, Workspace, devIpiv, devInfo ) );
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
int INFOh = 2;
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Factorization Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
Array<int> pivotVector( size_pivot );
CUDA_CALL( cudaMemcpy( lu->data(), d_A, lu->getNElements()*sizeof( TElement ), cudaMemcpyDeviceToHost ) );
CUDA_CALL( cudaMemcpy( pivotVector.data(), devIpiv, size_pivot*sizeof( int ), cudaMemcpyDeviceToHost ) );
from_permutation_vector_to_permutation_matrix( Pivot, &pivotVector );
// free memory
CUDA_CALL( cudaFree( d_A ) );
CUDA_CALL( cudaFree( Workspace ) );
CUDA_CALL( cudaFree( devIpiv ) );
CUDA_CALL( cudaFree( devInfo ) );
// Destroy the handle
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::lu( Array<int> *A, Array<int> *lu, Array<int> *Pivot );
template cusolverStatus_t cusolverOperations<float>::lu( Array<float> *A, Array<float> *lu, Array<float> *Pivot );
template cusolverStatus_t cusolverOperations<double>::lu( Array<double> *A, Array<double> *lu, Array<double> *Pivot );
template cusolverStatus_t cusolverOperations<ComplexFloat>::lu( Array<ComplexFloat> *A, Array<ComplexFloat> *lu, Array<ComplexFloat> *Pivot );
template cusolverStatus_t cusolverOperations<ComplexDouble>::lu( Array<ComplexDouble> *A, Array<ComplexDouble> *lu, Array<ComplexDouble> *Pivot );
template< typename TElement>
cusolverStatus_t cusolverOperations<TElement>::lu( Array<TElement> *A, Array<TElement> *lu )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
size_t M = A->getDim(0);
size_t N = A->getDim(1);
size_t minMN = std::min(M,N);
TElement *d_A, *Workspace;
CUDA_CALL( cudaMalloc(&d_A, M * N * sizeof(TElement)) );
CUDA_CALL( cudaMemcpy(d_A, A->data(), M * N * sizeof(TElement), cudaMemcpyHostToDevice) );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgetrf_bufferSize(&handle, M, N, d_A, M, &Lwork) );
CUDA_CALL( cudaMalloc( &Workspace, Lwork * sizeof(TElement) ) );
int *devIpiv, *devInfo;
size_t size_pivot = std::min(A->getDim(0),A->getDim(1));
CUDA_CALL( cudaMalloc( &devIpiv, size_pivot * sizeof(int) ) );
CUDA_CALL( cudaMalloc( &devInfo, sizeof(int) ) );
/////***** performance test *****/////
//CUDA_CALL( cudaDeviceSynchronize() );
//tic();
//for( int i = 0; i < 10; i++ ) {
CUSOLVER_CALL( cusolverDnTgetrf( &handle, M, N, d_A, M, Workspace, devIpiv, devInfo ) );
//}
//CUDA_CALL( cudaDeviceSynchronize() );
//toc();
////***** end of performance test *****/////
CUDA_CALL( cudaDeviceSynchronize() );
// copy from GPU
int INFOh = 2;
CUDA_CALL( cudaMemcpy( &INFOh, devInfo, sizeof( int ), cudaMemcpyDeviceToHost ) );
if( INFOh > 0 )
{
printf("Factorization Failed: Matrix is singular\n");
return CUSOLVER_STATUS_EXECUTION_FAILED;
}
CUDA_CALL( cudaMemcpy( lu->data(), d_A, lu->getNElements()*sizeof( TElement ), cudaMemcpyDeviceToHost ) );
// free memory
CUDA_CALL( cudaFree( d_A ) );
CUDA_CALL( cudaFree( Workspace ) );
CUDA_CALL( cudaFree( devIpiv ) );
CUDA_CALL( cudaFree( devInfo ) );
// Destroy the handle
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::lu( Array<int> *A, Array<int> *lu );
template cusolverStatus_t cusolverOperations<float>::lu( Array<float> *A, Array<float> *lu );
template cusolverStatus_t cusolverOperations<double>::lu( Array<double> *A, Array<double> *lu );
template cusolverStatus_t cusolverOperations<ComplexFloat>::lu( Array<ComplexFloat> *A, Array<ComplexFloat> *lu );
template cusolverStatus_t cusolverOperations<ComplexDouble>::lu( Array<ComplexDouble> *A, Array<ComplexDouble> *lu );
template <typename TElement>
cusolverStatus_t cusolverOperations<TElement>::qr( Array<TElement> *A, Array<TElement> *Q, Array<TElement> *R )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
int M = A->getDim(0);
int N = A->getDim(1);
int minMN = std::min(M,N);
TElement *d_A, *h_A, *TAU, *Workspace, *d_Q;
h_A = A->data();
CUDA_CALL( cudaMalloc(&d_A, M * N * sizeof(TElement)) );
CUDA_CALL( cudaMemcpy(d_A, h_A, M * N * sizeof(TElement), cudaMemcpyHostToDevice) );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgeqrf_bufferSize(&handle, M, N, d_A, M, &Lwork) );
CUDA_CALL( cudaMalloc(&TAU, minMN * sizeof(TElement)) );
CUDA_CALL(cudaMalloc(&Workspace, Lwork * sizeof(TElement)));
int *devInfo;
CUDA_CALL( cudaMalloc(&devInfo, sizeof(int)) );
CUDA_CALL( cudaMemset( (void*)devInfo, 0, 1 ) );
CUSOLVER_CALL( cusolverDnTgeqrf(&handle, M, N, d_A, M, TAU, Workspace, Lwork, devInfo) );
int devInfo_h = 0;
CUDA_CALL( cudaMemcpy(&devInfo_h, devInfo, sizeof(int), cudaMemcpyDeviceToHost) );
if (devInfo_h != 0)
return CUSOLVER_STATUS_INTERNAL_ERROR;
// CALL CUDA FUNCTION
CUDA_CALL( cudaMemcpy( R->data(), d_A, R->getNElements()*sizeof( TElement ), cudaMemcpyDeviceToHost ) );
for(int j = 0; j < M; j++)
for(int i = j + 1; i < N; i++)
(*R)(i,j) = 0;
// --- Initializing the output Q matrix (Of course, this step could be done by a kernel function directly on the device)
//*Q = eye<TElement> ( std::min(Q->getDim(0),Q->getDim(1)) );
CUDA_CALL( cudaMalloc(&d_Q, M*M*sizeof(TElement)) );
cuda_eye<TElement>( d_Q, std::min(Q->getDim(0),Q->getDim(1)) );
// --- CUDA qr execution
CUSOLVER_CALL( cusolverDnTormqr(&handle, CUBLAS_SIDE_LEFT, CUBLAS_OP_N, M, N, std::min(M, N), d_A, M, TAU, d_Q, M, Workspace, Lwork, devInfo) );
// --- At this point, d_Q contains the elements of Q. Showing this.
CUDA_CALL( cudaMemcpy(Q->data(), d_Q, M*M*sizeof(TElement), cudaMemcpyDeviceToHost) );
CUDA_CALL( cudaDeviceSynchronize() );
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::qr( Array<int> *A, Array<int> *Q, Array<int> *R );
template cusolverStatus_t cusolverOperations<float>::qr( Array<float> *A, Array<float> *Q, Array<float> *R );
template cusolverStatus_t cusolverOperations<double>::qr( Array<double> *A, Array<double> *Q, Array<double> *R );
template cusolverStatus_t cusolverOperations<ComplexFloat>::qr( Array<ComplexFloat> *A, Array<ComplexFloat> *Q, Array<ComplexFloat> *R );
template cusolverStatus_t cusolverOperations<ComplexDouble>::qr( Array<ComplexDouble> *A, Array<ComplexDouble> *Q, Array<ComplexDouble> *R );
template<> cusolverStatus_t cusolverOperations<ComplexFloat>::dpss( Array<ComplexFloat> *eigenvector, index_t N, double NW, index_t degree )
{
return CUSOLVER_STATUS_NOT_INITIALIZED;
}
template<> cusolverStatus_t cusolverOperations<ComplexDouble>::dpss( Array<ComplexDouble> *eigenvector, index_t N, double NW, index_t degree )
{
return CUSOLVER_STATUS_NOT_INITIALIZED;
}
template <typename TElement>
cusolverStatus_t cusolverOperations<TElement>::dpss( Array<TElement> *eigenvector, index_t N, double NW, index_t degree )
{
// define matrix T (NxN)
TElement** T = new TElement*[ N ];
for(int i = 0; i < N; ++i)
T[ i ] = new TElement[ N ];
// fill in T as function of ( N, W )
// T is a tridiagonal matrix, i. e., it has diagonal, subdiagonal and superdiagonal
// the others elements are 0
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if( j == i - 1 ) // subdiagonal
T[ i ][ j ] = ( (TElement)N - i )*i/2;
else if( j == i ) // diagonal
T[ i ][ j ] = pow( (TElement)(N-1)/2 - i, 2 )*boost::math::cos_pi( 2*NW/(TElement)N/boost::math::constants::pi<TElement>() );
else if( j == i + 1 ) // superdiagonal
T[ i ][ j ] = ( i + 1 )*( (TElement)N - 1 - i )/2*( j == i + 1 );
else // others elements
T[ i ][ j ] = 0;
}
}
// declarations needed
cusolverStatus_t statCusolver = CUSOLVER_STATUS_SUCCESS;
cusolverSpHandle_t handleCusolver = NULL;
cusparseHandle_t handleCusparse = NULL;
cusparseMatDescr_t descrA = NULL;
int *h_cooRowIndex = NULL, *h_cooColIndex = NULL;
TElement *h_cooVal = NULL;
int *d_cooRowIndex = NULL, *d_cooColIndex = NULL, *d_csrRowPtr = NULL;
TElement *d_cooVal = NULL;
int nnz;
TElement *h_eigenvector0 = NULL, *d_eigenvector0 = NULL, *d_eigenvector = NULL;
int maxite = 1e6; // number of maximum iteration
TElement tol = 1; // tolerance
TElement mu, *d_mu;
TElement max_lambda;
// define interval of eigenvalues of T
// interval is [-max_lambda,max_lambda]
max_lambda = ( N - 1 )*( N + 2 ) + N*( N + 1 )/8 + 0.25;
// amount of nonzero elements of T
nnz = 3*N - 2;
// allocate host memory
h_cooRowIndex = new int[ nnz*sizeof( int ) ];
h_cooColIndex = new int[ nnz*sizeof( int ) ];
h_cooVal = new TElement[ nnz*sizeof( TElement ) ];
h_eigenvector0 = new TElement[ N*sizeof( TElement ) ];
// fill in vectors that describe T as a sparse matrix
int counter = 0;
for (int i = 0; i < N; i++ ) {
for( int j = 0; j < N; j++ ) {
if( T[ i ][ j ] != 0 ) {
h_cooRowIndex[counter] = i;
h_cooColIndex[counter] = j;
h_cooVal[counter++] = T[ i ][ j ];
}
}
}
// fill in initial eigenvector guess
for( int i = 0; i < N; i++ )
h_eigenvector0[ i ] = 1/( abs( i - N/2 ) + 1 );
// allocate device memory
CUDA_CALL( cudaMalloc((void**)&d_cooRowIndex,nnz*sizeof( int )) );
CUDA_CALL( cudaMalloc((void**)&d_cooColIndex,nnz*sizeof( int )) );
CUDA_CALL( cudaMalloc((void**)&d_cooVal, nnz*sizeof( TElement )) );
CUDA_CALL( cudaMalloc((void**)&d_csrRowPtr, (N+1)*sizeof( int )) );
CUDA_CALL( cudaMalloc((void**)&d_eigenvector0, N*sizeof( TElement )) );
CUDA_CALL( cudaMalloc((void**)&d_eigenvector, N*sizeof( TElement )) );
CUDA_CALL( cudaMalloc( &d_mu, sizeof( TElement ) ) );
CUDA_CALL( cudaMemset( d_mu, -max_lambda, sizeof( TElement ) ) );
// copy data to device
CUDA_CALL( cudaMemcpy( d_cooRowIndex, h_cooRowIndex, (size_t)(nnz*sizeof( int )), cudaMemcpyHostToDevice ) );
CUDA_CALL( cudaMemcpy( d_cooColIndex, h_cooColIndex, (size_t)(nnz*sizeof( int )), cudaMemcpyHostToDevice ) );
CUDA_CALL( cudaMemcpy( d_cooVal, h_cooVal, (size_t)(nnz*sizeof( TElement )), cudaMemcpyHostToDevice ) );
CUDA_CALL( cudaMemcpy( d_eigenvector0, h_eigenvector0, (size_t)(N*sizeof( TElement )), cudaMemcpyHostToDevice ) );
CUDA_CALL( cudaMemcpy( &mu, d_mu, sizeof( TElement ), cudaMemcpyDeviceToHost ) );
// initialize cusparse and cusolver
CUSOLVER_CALL( cusolverSpCreate( &handleCusolver ) );
CUSPARSE_CALL( cusparseCreate( &handleCusparse ) );
// create and define cusparse matrix descriptor
CUSPARSE_CALL( cusparseCreateMatDescr(&descrA) );
CUSPARSE_CALL( cusparseSetMatType(descrA, CUSPARSE_MATRIX_TYPE_GENERAL ) );
CUSPARSE_CALL( cusparseSetMatIndexBase(descrA, CUSPARSE_INDEX_BASE_ZERO ) );
// transform from coordinates (COO) values to compressed row pointers (CSR) values
CUSPARSE_CALL( cusparseXcoo2csr( handleCusparse, d_cooRowIndex, nnz, N, d_csrRowPtr, CUSPARSE_INDEX_BASE_ZERO ) );
// call cusolverSp<type>csreigvsi
CUSOLVER_CALL( cusolverSpTcsreigvsi( &handleCusolver, N, nnz, &descrA, d_cooVal, d_csrRowPtr, d_cooColIndex, max_lambda, d_eigenvector0, maxite, tol, d_mu, d_eigenvector ) );
cudaDeviceSynchronize();
CUDA_CALL( cudaGetLastError() );
// copy from device to host
CUDA_CALL( cudaMemcpy( &mu, d_mu, (size_t)sizeof( TElement ), cudaMemcpyDeviceToHost ) );
CUDA_CALL( cudaMemcpy( eigenvector->data(), d_eigenvector, (size_t)(N*sizeof( TElement )), cudaMemcpyDeviceToHost ) );
// destroy and free stuff
CUSPARSE_CALL( cusparseDestroyMatDescr( descrA ) );
CUSPARSE_CALL( cusparseDestroy( handleCusparse ) );
CUSOLVER_CALL( cusolverSpDestroy( handleCusolver ) );
CUDA_CALL( cudaFree( d_cooRowIndex ) );
CUDA_CALL( cudaFree( d_cooColIndex ) );
CUDA_CALL( cudaFree( d_cooVal ) );
CUDA_CALL( cudaFree( d_csrRowPtr ) );
CUDA_CALL( cudaFree( d_eigenvector0 ) );
CUDA_CALL( cudaFree( d_eigenvector ) );
CUDA_CALL( cudaFree( d_mu ) );
delete[] h_eigenvector0;
delete[] h_cooRowIndex;
delete[] h_cooColIndex;
delete[] h_cooVal;
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<float>::dpss( Array<float> *eigenvector, index_t N, double NW, index_t degree );
template cusolverStatus_t cusolverOperations<double>::dpss( Array<double> *eigenvector, index_t N, double NW, index_t degree );
template <typename TElement>
cusolverStatus_t cusolverOperations<TElement>::qr_zerocopy( Array<TElement> *A, Array<TElement> *Q, Array<TElement> *R )
{
cusolverDnHandle_t handle;
CUSOLVER_CALL( cusolverDnCreate(&handle) );
int M = A->getDim(0);
int N = A->getDim(1);
int minMN = std::min(M,N);
TElement *d_A, *h_A, *TAU, *Workspace, *d_Q, *d_R;
h_A = A->data();
CUDA_CALL( cudaMalloc(&d_A, M * N * sizeof(TElement)) );
CUDA_CALL( cudaMemcpy(d_A, h_A, M * N * sizeof(TElement), cudaMemcpyHostToDevice) );
int Lwork = 0;
CUSOLVER_CALL( cusolverDnTgeqrf_bufferSize(&handle, M, N, d_A, M, &Lwork) );
CUDA_CALL( cudaMalloc(&TAU, minMN * sizeof(TElement)) );
CUDA_CALL(cudaMalloc(&Workspace, Lwork * sizeof(TElement)));
int *devInfo;
CUDA_CALL( cudaMalloc(&devInfo, sizeof(int)) );
CUDA_CALL( cudaMemset( (void*)devInfo, 0, 1 ) );
CUSOLVER_CALL( cusolverDnTgeqrf(&handle, M, N, d_A, M, TAU, Workspace, Lwork, devInfo) );
int devInfo_h = 0;
CUDA_CALL( cudaMemcpy(&devInfo_h, devInfo, sizeof(int), cudaMemcpyDeviceToHost) );
if (devInfo_h != 0)
return CUSOLVER_STATUS_INTERNAL_ERROR;
// CALL CUDA FUNCTION
CUDA_CALL( cudaMemcpy( R->data(), d_A, R->getNElements()*sizeof( TElement ), cudaMemcpyDeviceToHost ) );
// pass host pointer to device
CUDA_CALL( cudaHostGetDevicePointer( &d_R, R->data(), 0 ) );
CUDA_CALL( cudaHostGetDevicePointer( &d_Q, Q->data(), 0 ) );
zeros_under_diag<TElement>( d_R, std::min(R->getDim(0),R->getDim(1)) );
//for(int j = 0; j < M; j++)
// for(int i = j + 1; i < N; i++)
// (*R)(i,j) = 0;
// --- Initializing the output Q matrix (Of course, this step could be done by a kernel function directly on the device)
//*Q = eye<TElement> ( std::min(Q->getDim(0),Q->getDim(1)) );
cuda_eye<TElement>( d_Q, std::min(Q->getDim(0),Q->getDim(1)) );
CUDA_CALL( cudaDeviceSynchronize() );
// --- CUDA qr_zerocopy execution
CUSOLVER_CALL( cusolverDnTormqr(&handle, CUBLAS_SIDE_LEFT, CUBLAS_OP_N, M, N, std::min(M, N), d_A, M, TAU, d_Q, M, Workspace, Lwork, devInfo) );
CUDA_CALL( cudaDeviceSynchronize() );
CUSOLVER_CALL( cusolverDnDestroy(handle) );
return CUSOLVER_STATUS_SUCCESS;
}
template cusolverStatus_t cusolverOperations<int>::qr_zerocopy( Array<int> *A, Array<int> *Q, Array<int> *R );
template cusolverStatus_t cusolverOperations<float>::qr_zerocopy( Array<float> *A, Array<float> *Q, Array<float> *R );
template cusolverStatus_t cusolverOperations<double>::qr_zerocopy( Array<double> *A, Array<double> *Q, Array<double> *R );
template cusolverStatus_t cusolverOperations<ComplexFloat>::qr_zerocopy( Array<ComplexFloat> *A, Array<ComplexFloat> *Q, Array<ComplexFloat> *R );
template cusolverStatus_t cusolverOperations<ComplexDouble>::qr_zerocopy( Array<ComplexDouble> *A, Array<ComplexDouble> *Q, Array<ComplexDouble> *R );// transform permutation vector into permutation matrix
// TODO (or redo) - too slow!!!
template <typename TElement>
void cusolverOperations<TElement>::from_permutation_vector_to_permutation_matrix( Array<TElement> *pivotMatrix, Array<int> *pivotVector )
{
//pivotVector->print();
//*pivotMatrix = eye<TElement>(pivotVector->getDim(0));
//index_t idx1, idx2;
//for( int i = 0; i < pivotVector->GetDescriptor().GetDim(0); i++ ) {
// if( i + 1 == (*pivotVector)(i) )
// continue;
// else
// {
// idx1 = i;
// idx2 = (*pivotVector)(i)-1;
// (*pivotMatrix)( idx1, idx1 ) = 0;
// (*pivotMatrix)( idx2, idx2 ) = 0;
// (*pivotMatrix)( idx1, idx2 ) = 1;
// (*pivotMatrix)( idx2, idx1 ) = 1;
// }
// pivotMatrix->print();
//}
//pivotMatrix->print();
//
//*pivotMatrix = eye<TElement>(pivotVector->getDim(0));
//pivotVector->print();
//eye<double>(pivotVector->getDim(0)).print();
Array<TElement> pivotAux = eye<TElement>(pivotVector->GetDescriptor().GetDim(0));
index_t idx1, idx2;
for( int i = 0; i < pivotVector->GetDescriptor().GetDim(0); i++ ) {
idx1 = i;
idx2 = (*pivotVector)(i)-1;
pivotAux( idx1, idx1 ) = 0;
pivotAux( idx2, idx2 ) = 0;
pivotAux( idx1, idx2 ) = 1;
pivotAux( idx2, idx1 ) = 1;
(*pivotMatrix) = pivotAux*(*pivotMatrix);
pivotAux = eye<TElement>(pivotVector->GetDescriptor().GetDim(0));
//pivotMatrix->print();
}
//pivotMatrix->print();
}
cusolverStatus_t cusolverOperations<float>::cusolverSpTcsreigvsi( cusolverSpHandle_t *handle, int m, int nnz, cusparseMatDescr_t *descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, float mu0, const float *x0, int maxite, float tol, float *mu, float *x )
{
return cusolverSpScsreigvsi( *handle, m ,nnz, *descrA, csrValA, csrRowPtrA, csrColIndA, mu0, x0, maxite, tol, mu, x );;
}
cusolverStatus_t cusolverOperations<double>::cusolverSpTcsreigvsi( cusolverSpHandle_t *handle, int m, int nnz, cusparseMatDescr_t *descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, double mu0, const double *x0, int maxite, double tol, double *mu, double *x )
{
return cusolverSpDcsreigvsi( *handle, m ,nnz, *descrA, csrValA, csrRowPtrA, csrColIndA, mu0, x0, maxite, tol, mu, x );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverSpTcsreigvsi( cusolverSpHandle_t *handle, int m, int nnz, cusparseMatDescr_t *descrA, const ComplexFloat *csrValA, const int *csrRowPtrA, const int *csrColIndA, ComplexFloat mu0, const ComplexFloat *x0, int maxite, ComplexFloat tol, ComplexFloat *mu, ComplexFloat *x )
{
cuFloatComplex mu02 = make_cuFloatComplex( mu0.real(), mu0.imag() );
return cusolverSpCcsreigvsi( *handle, m ,nnz, *descrA, (const cuFloatComplex*)csrValA, csrRowPtrA, csrColIndA, mu02, (const cuFloatComplex*)x0, maxite, tol.real(), (cuFloatComplex*)mu, (cuFloatComplex*)x );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverSpTcsreigvsi( cusolverSpHandle_t *handle, int m, int nnz, cusparseMatDescr_t *descrA, const ComplexDouble *csrValA, const int *csrRowPtrA, const int *csrColIndA, ComplexDouble mu0, const ComplexDouble *x0, int maxite, ComplexDouble tol, ComplexDouble *mu, ComplexDouble *x )
{
cuDoubleComplex mu02 = make_cuDoubleComplex( mu0.real(), mu0.imag() );
return cusolverSpZcsreigvsi( *handle, m ,nnz, *descrA, (const cuDoubleComplex*)csrValA, csrRowPtrA, csrColIndA, mu02, (const cuDoubleComplex*)x0, maxite, tol.real(), (cuDoubleComplex*)mu, (cuDoubleComplex*)x );
}
cusolverStatus_t cusolverOperations<int>::cusolverDnTgeqrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, int *A, int lda, int *Lwork )
{
return CUSOLVER_STATUS_SUCCESS;
}
cusolverStatus_t cusolverOperations<float>::cusolverDnTgeqrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, float *A, int lda, int *Lwork )
{
return cusolverDnSgeqrf_bufferSize( *handle, m, n, A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<double>::cusolverDnTgeqrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, double *A, int lda, int *Lwork )
{
return cusolverDnDgeqrf_bufferSize( *handle, m, n, A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverDnTgeqrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, ComplexFloat *A, int lda, int *Lwork )
{
return cusolverDnCgeqrf_bufferSize( *handle, m, n, (cuFloatComplex*)A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverDnTgeqrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, ComplexDouble *A, int lda, int *Lwork )
{
return cusolverDnZgeqrf_bufferSize( *handle, m, n, (cuDoubleComplex*)A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<int>::cusolverDnTgeqrf( cusolverDnHandle_t *handle, int m, int n, int *A, int lda, int *TAU, int *Workspace, int Lwork, int *devInfo )
{
return CUSOLVER_STATUS_SUCCESS;
}
cusolverStatus_t cusolverOperations<float>::cusolverDnTgeqrf( cusolverDnHandle_t *handle, int m, int n, float *A, int lda, float *TAU, float *Workspace, int Lwork, int *devInfo )
{
return cusolverDnSgeqrf( *handle, m, n, A, lda, TAU, Workspace, Lwork, devInfo );
}
cusolverStatus_t cusolverOperations<double>::cusolverDnTgeqrf( cusolverDnHandle_t *handle, int m, int n, double *A, int lda, double *TAU, double *Workspace, int Lwork, int *devInfo )
{
return cusolverDnDgeqrf( *handle, m, n, A, lda, TAU, Workspace, Lwork, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverDnTgeqrf( cusolverDnHandle_t *handle, int m, int n, ComplexFloat *A, int lda, ComplexFloat *TAU, ComplexFloat *Workspace, int Lwork, int *devInfo )
{
return cusolverDnCgeqrf( *handle, m, n, (cuFloatComplex*)A, lda, (cuFloatComplex*)TAU, (cuFloatComplex*)Workspace, Lwork, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverDnTgeqrf( cusolverDnHandle_t *handle, int m, int n, ComplexDouble *A, int lda, ComplexDouble *TAU, ComplexDouble *Workspace, int Lwork, int *devInfo )
{
return cusolverDnZgeqrf( *handle, m, n, (cuDoubleComplex*)A, lda, (cuDoubleComplex*)TAU, (cuDoubleComplex*)Workspace, Lwork, devInfo );
}
cusolverStatus_t cusolverOperations<int>::cusolverDnTormqr( cusolverDnHandle_t *handle, cublasSideMode_t side, cublasOperation_t trans, int m, int n, int k, const int *A, int lda, const int *tau, int *C, int ldc, int *work, int lwork, int *devInfo )
{
return CUSOLVER_STATUS_SUCCESS;
}
cusolverStatus_t cusolverOperations<float>::cusolverDnTormqr( cusolverDnHandle_t *handle, cublasSideMode_t side, cublasOperation_t trans, int m, int n, int k, const float *A, int lda, const float *tau, float *C, int ldc, float *work, int lwork, int *devInfo )
{
return cusolverDnSormqr( *handle, side, trans, m, n, k, A, lda, tau, C, ldc, work, lwork, devInfo );
}
cusolverStatus_t cusolverOperations<double>::cusolverDnTormqr( cusolverDnHandle_t *handle, cublasSideMode_t side, cublasOperation_t trans, int m, int n, int k, const double *A, int lda, const double *tau, double *C, int ldc, double *work, int lwork, int *devInfo )
{
return cusolverDnDormqr( *handle, side, trans, m, n, k, A, lda, tau, C, ldc, work, lwork, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverDnTormqr( cusolverDnHandle_t *handle, cublasSideMode_t side, cublasOperation_t trans, int m, int n, int k, const ComplexFloat *A, int lda, const ComplexFloat *tau, ComplexFloat *C, int ldc, ComplexFloat *work, int lwork, int *devInfo )
{
return cusolverDnCunmqr( *handle, side, trans, m, n, k, (const cuFloatComplex*)A, lda, (const cuFloatComplex*)tau, (cuFloatComplex*)C, ldc, (cuFloatComplex*)work, lwork, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverDnTormqr( cusolverDnHandle_t *handle, cublasSideMode_t side, cublasOperation_t trans, int m, int n, int k, const ComplexDouble *A, int lda, const ComplexDouble *tau, ComplexDouble *C, int ldc, ComplexDouble *work, int lwork, int *devInfo )
{
return cusolverDnZunmqr( *handle, side, trans, m, n, k, (const cuDoubleComplex*)A, lda, (const cuDoubleComplex*)tau, (cuDoubleComplex*)C, ldc, (cuDoubleComplex*)work, lwork, devInfo );
}
cusolverStatus_t cusolverOperations<int>::cusolverDnTgetrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, int *A, int lda, int *Lwork )
{
return CUSOLVER_STATUS_SUCCESS;
}
cusolverStatus_t cusolverOperations<float>::cusolverDnTgetrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, float *A, int lda, int *Lwork )
{
return cusolverDnSgetrf_bufferSize( *handle, m, n, A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<double>::cusolverDnTgetrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, double *A, int lda, int *Lwork )
{
return cusolverDnDgetrf_bufferSize( *handle, m, n, A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverDnTgetrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, ComplexFloat *A, int lda, int *Lwork )
{
return cusolverDnCgetrf_bufferSize( *handle, m, n, (cuFloatComplex*)A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverDnTgetrf_bufferSize( cusolverDnHandle_t *handle, int m, int n, ComplexDouble *A, int lda, int *Lwork )
{
return cusolverDnZgetrf_bufferSize( *handle, m, n, (cuDoubleComplex*)A, lda, Lwork );
}
cusolverStatus_t cusolverOperations<int>::cusolverDnTgetrf( cusolverDnHandle_t *handle, int m, int n, int *A, int lda, int *Workspace, int *devIpiv, int *devInfo )
{
return CUSOLVER_STATUS_SUCCESS;
}
cusolverStatus_t cusolverOperations<float>::cusolverDnTgetrf( cusolverDnHandle_t *handle, int m, int n, float *A, int lda, float *Workspace, int *devIpiv, int *devInfo )
{
return cusolverDnSgetrf( *handle, m, n, A, lda, Workspace, devIpiv, devInfo );
}
cusolverStatus_t cusolverOperations<double>::cusolverDnTgetrf( cusolverDnHandle_t *handle, int m, int n, double *A, int lda, double *Workspace, int *devIpiv, int *devInfo )
{
return cusolverDnDgetrf( *handle, m, n, A, lda, Workspace, devIpiv, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverDnTgetrf( cusolverDnHandle_t *handle, int m, int n, ComplexFloat *A, int lda, ComplexFloat *Workspace, int *devIpiv, int *devInfo )
{
return cusolverDnCgetrf( *handle, m, n, (cuFloatComplex*)A, lda, (cuFloatComplex*)Workspace, devIpiv, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverDnTgetrf( cusolverDnHandle_t *handle, int m, int n, ComplexDouble *A, int lda, ComplexDouble *Workspace, int *devIpiv, int *devInfo )
{
return cusolverDnZgetrf( *handle, m, n, (cuDoubleComplex*)A, lda, (cuDoubleComplex*)Workspace, devIpiv, devInfo );
}
cusolverStatus_t cusolverOperations<int>::cusolverDnTgetrs( cusolverDnHandle_t *handle, cublasOperation_t trans, int n, int nrhs, const int *A, int lda, const int *devIpiv, int *B, int ldb, int *devInfo )
{
return CUSOLVER_STATUS_SUCCESS;
}
cusolverStatus_t cusolverOperations<float>::cusolverDnTgetrs( cusolverDnHandle_t *handle, cublasOperation_t trans, int n, int nrhs, const float *A, int lda, const int *devIpiv, float *B, int ldb, int *devInfo )
{
return cusolverDnSgetrs( *handle, trans, n, nrhs, A, lda, devIpiv, B, ldb, devInfo );
}
cusolverStatus_t cusolverOperations<double>::cusolverDnTgetrs( cusolverDnHandle_t *handle, cublasOperation_t trans, int n, int nrhs, const double *A, int lda, const int *devIpiv, double *B, int ldb, int *devInfo )
{
return cusolverDnDgetrs( *handle, trans, n, nrhs, A, lda, devIpiv, B, ldb, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexFloat>::cusolverDnTgetrs( cusolverDnHandle_t *handle, cublasOperation_t trans, int n, int nrhs, const ComplexFloat *A, int lda, const int *devIpiv, ComplexFloat *B, int ldb, int *devInfo )
{
return cusolverDnCgetrs( *handle, trans, n, nrhs, (const cuFloatComplex*)A, lda, devIpiv, (cuFloatComplex*)B, ldb, devInfo );
}
cusolverStatus_t cusolverOperations<ComplexDouble>::cusolverDnTgetrs( cusolverDnHandle_t *handle, cublasOperation_t trans, int n, int nrhs, const ComplexDouble *A, int lda, const int *devIpiv, ComplexDouble *B, int ldb, int *devInfo )
{
return cusolverDnZgetrs( *handle, trans, n, nrhs, (const cuDoubleComplex*)A, lda, devIpiv, (cuDoubleComplex*)B, ldb, devInfo );
}
} | leomiquelutti/matCUDA | matCUDA lib/src/cusolverOperations.cpp | C++ | mit | 37,887 |
// ==UserScript==
// @name Kiss Simple Infobox hider
// @description Hides the infobox on kissanime.com, kisscartoon.me and kissasian.com player sites
// @include https://kissanime.ru/Anime/*/*
// @include https://kimcartoon.to/Cartoon/*/*
// @include https://kissasian.sh/Drama/*/*
// @author Playacem
// @updateURL https://raw.githubusercontent.com/Playacem/KissScripts/master/kiss-simple-infobox-hider/kiss-simple-infobox-hider.user.js
// @downloadURL https://raw.githubusercontent.com/Playacem/KissScripts/master/kiss-simple-infobox-hider/kiss-simple-infobox-hider.user.js
// @require https://code.jquery.com/jquery-latest.js
// @grant none
// @run-at document-end
// @version 0.0.11
// ==/UserScript==
// do not change
var JQ = jQuery;
function hideInfobox() {
var selector = JQ('#centerDivVideo') /* the div with the video */
.prev() /*a clear2 div*/
.prev() /*dropdown*/
.prev() /*a clear2 div*/
.prev(); /*the actual div*/
selector.remove();
}
// load after 2 seconds
setTimeout(hideInfobox, 2000);
| Playacem/KissScripts | kiss-simple-infobox-hider/kiss-simple-infobox-hider.user.js | JavaScript | mit | 1,191 |
'use strict';
const fs = require('fs');
const Q = require('q');
const exec = require('child_process').exec;
const searchpaths = ["/bin/xset"];
class XSetDriver {
constructor(props) {
this.name = "Backlight Control";
this.devicePath = "xset";
this.description = "Screensaver control via Xwindows xset command";
this.devices = [];
this.driver = {};
//this.depends = [];
}
probe(props) {
searchpaths.forEach(function(p) {
if(fs.existsSync(p)) {
let stat = fs.lstatSync(p);
if (stat.isFile()) {
console.log("found xset control at "+p);
this.devices.push(new XSetDriver.Channel(this, p, props));
}
}
}.bind(this));
return this.devices.length>0;
}
}
class XSetChannel {
constructor(driver, path, props)
{
this.value = 1;
this.setCommand = path;
this.enabled = true;
this.display = ":0.0";
this.error = 0;
// internal variables
this.lastReset = new Date();
}
enable() {
this.set("on");
}
disable() {
this.set("off");
}
activate() {
this.set("activate");
}
blank() {
this.set("blank");
}
reset() {
this.set("reset");
this.lastReset=new Date();
}
setTimeout(secs) {
this.set(""+secs);
}
set(action) {
if(!this.enabled) return false;
var ss = this;
exec("DISPLAY="+this.display+" "+this.setCommand+" s "+action, function(error,stdout, stderr) {
if(error) {
if(ss.error++ >10) {
ss.enabled=false;
}
console.log("xset error "+error);
console.log(stdout);
console.log("errors:");
console.log(stderr);
}
}.bind(this));
}
}
XSetDriver.Channel = XSetChannel;
module.exports = XSetDriver;
/*
Treadmill.prototype.init_screensaver = function(action)
{
this.screensaver = {
// config/settings
enabled: !simulate,
display: ":0.0",
error: 0,
// internal variables
lastReset: new Date(),
// screensaver functions
enable: function() { this.set("on"); },
disable: function() { this.set("off"); },
activate: function() { this.set("activate"); },
blank: function() { this.set("blank"); },
reset: function() { this.set("reset"); this.lastReset=new Date(); },
timeout: function(secs) { this.set(""+secs); },
// main set() function calls command "xset s <action>"
set: function(action) {
if(!this.enabled) return false;
var ss = this;
exec("DISPLAY="+this.display+" xset s "+action, function(error,stdout, stderr) {
if(error) {
if(ss.error++ >10) {
ss.enabled=false;
}
console.log("xset error "+error);
console.log(stdout);
console.log("errors:");
console.log(stderr);
}
});
}
};
if(simulate) return false;
// initialize the screensaver
var ss = this.screensaver;
exec("./screensaver.conf "+this.screensaver.display, function(error,stdout, stderr) {
if(error) {
ss.enabled = false;
console.log("screensaver.conf error "+error);
console.log(stdout);
console.log("errors:");
console.log(stderr);
}
});
this.screensaver.enable();
}
*/ | flyingeinstein/tread-station | nodejs/drivers/output/screensaver/xset.js | JavaScript | mit | 3,736 |
<?php
/* FOSUserBundle:Registration:register.html.twig */
class __TwigTemplate_b2e8a5a7d2f16905904154af2ea8a628b3260186e3b1e28bf7f63c56eb0b951d extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
try {
$this->parent = $this->env->loadTemplate("FOSUserBundle::layout.html.twig");
} catch (Twig_Error_Loader $e) {
$e->setTemplateFile($this->getTemplateName());
$e->setTemplateLine(1);
throw $e;
}
$this->blocks = array(
'fos_user_content' => array($this, 'block_fos_user_content'),
);
}
protected function doGetParent(array $context)
{
return "FOSUserBundle::layout.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_fos_user_content($context, array $blocks = array())
{
// line 4
$this->env->loadTemplate("FOSUserBundle:Registration:register_content.html.twig")->display($context);
}
public function getTemplateName()
{
return "FOSUserBundle:Registration:register.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 39 => 4, 36 => 3, 11 => 1,);
}
}
| kkuga/sfweb | app/cache/dev/twig/b2/e8/a5a7d2f16905904154af2ea8a628b3260186e3b1e28bf7f63c56eb0b951d.php | PHP | mit | 1,481 |
#include <bits/stdc++.h>
using namespace std;
#ifndef int64
#define int64 long long
#endif
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int64 h1, h2, a, b;
cin >> h1 >> h2 >> a >> b;
h1 += a * 8;
if (a <= b && h1 < h2) {
puts("-1");
} else if (h1 >= h2) {
puts("0");
} else {
int64 y = 12 * (a - b);
int64 i = (h2 - h1) / y;
if (h1 + i * y < h2)
i++;
cout << i << endl;
}
return 0;
} | bolatov/contests | codeforces.ru/contest652/a.cpp | C++ | mit | 514 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis;
using System.Collections.Immutable;
using System.Threading;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Formatting;
using System.Text.RegularExpressions;
namespace AnalyzeThis.ReadonlyField
{
internal class ReadonlyFieldRule : FixableAnalysisRule
{
public static readonly string Id = "AT001";
private readonly string fixTitle = "Set with constructor parameter";
public ReadonlyFieldRule()
: base(
diagnosticId: Id,
title: "Readonly fields must be assigned.",
messageFormat: "Readonly field(s) not assigned in constructor: {0}.",
category: "TODO",
severity: DiagnosticSeverity.Error,
description: "Readonly fields which are not assigned on declaration must be assigned in every non-chained constructor."
)
{
}
public override void Register(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.ConstructorDeclaration);
}
public override void RegisterCodeFix(CodeFixContext context, Diagnostic diagnostic)
{
// Register a code action that will invoke the fix.
context.RegisterCodeFix(
CodeAction.Create(
title: fixTitle,
createChangedDocument: c => AddConstructorParameterAndAssignAsync(context.Document, diagnostic.Location, c),
equivalenceKey: fixTitle
),
diagnostic);
}
private void AnalyzeNode(SyntaxNodeAnalysisContext context)
{
var constructorNode = context.Node as ConstructorDeclarationSyntax;
IEnumerable<string> unsetReadonlyFieldNames = GetUnassignedReadonlyFields(constructorNode)
.Select(declaration => declaration.GetIdentifierText());
if (unsetReadonlyFieldNames.Any())
{
var diagnostic = Diagnostic.Create(this.Descriptor, constructorNode.GetLocation(), string.Join(", ", unsetReadonlyFieldNames));
context.ReportDiagnostic(diagnostic);
}
}
private static IEnumerable<FieldDeclarationSyntax> GetUnassignedReadonlyFields(ConstructorDeclarationSyntax constructorNode)
{
// Ignore chained 'this' constructors
if (constructorNode.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer)
{
return Enumerable.Empty<FieldDeclarationSyntax>();
}
var classNode = constructorNode.Parent as ClassDeclarationSyntax;
var assignedFields = (constructorNode.Body?.DescendantNodes() ?? Enumerable.Empty<SyntaxNode>())
.WhereIs<SyntaxNode, AssignmentExpressionSyntax>()
.Select(x =>
{
return x;
})
.Select(assignment => assignment.Left)
.WhereIs<ExpressionSyntax, MemberAccessExpressionSyntax>()
.Select(memberAccess => memberAccess.Name.Identifier.ValueText)
.ToImmutableHashSet();
var unsetReadonlyFields = classNode.Members
.WhereIs<SyntaxNode, FieldDeclarationSyntax>() // Fields
.Where(fieldNode => fieldNode.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) // Readonly
.Where(fieldNode => fieldNode.Declaration.Variables.First().Initializer == null) // Not initialized inline
.Where(fieldNode => !assignedFields.Contains(fieldNode.GetIdentifierText())); // Not assigned in constructor
return unsetReadonlyFields;
}
private string GetLocalIdentifierName(string originalName)
{
return Regex.Replace(originalName, "^[A-Z]", match => match.Value.ToLower());
}
private async Task<Document> AddConstructorParameterAndAssignAsync(
Document document,
Location location,
CancellationToken cancellationToken
)
{
var root = await document.GetSyntaxRootAsync(cancellationToken);
var constructorNode = root.FindNode(location.SourceSpan) as ConstructorDeclarationSyntax;
var existingParameters = constructorNode.ParameterList
.Parameters
.ToDictionary(parameter => parameter.Identifier.ValueText, StringComparer.OrdinalIgnoreCase);
var unassignedFields = GetUnassignedReadonlyFields(constructorNode);
var newParameters = unassignedFields
.Where(field => !existingParameters.ContainsKey(field.GetIdentifierText()))
.Select(field =>
SyntaxFactory.Parameter(
SyntaxFactory
.Identifier(this.GetLocalIdentifierName(field.GetIdentifierText()))
)
.WithType(field.Declaration.Type)
);
var newStatements = unassignedFields.Select(field =>
{
ParameterSyntax existingParameter;
string assignmentRight;
// Find existing parameter with same name (ignoring case)
if (existingParameters.TryGetValue(field.GetIdentifierText(), out existingParameter))
{
// Use it if type is the same
if (existingParameter.Type.ProperEquals(field.Declaration.Type))
{
assignmentRight = existingParameter.Identifier.ValueText;
}
// Abort if type is different
else
{
return null;
}
}
// Otherwise use adjusted field name
else
{
assignmentRight = this.GetLocalIdentifierName(field.GetIdentifierText());
}
return SyntaxFactory.ExpressionStatement(
SyntaxFactory.AssignmentExpression(
SyntaxKind.SimpleAssignmentExpression,
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
SyntaxFactory.ThisExpression(),
SyntaxFactory.IdentifierName(field.GetIdentifierText())
),
SyntaxFactory.IdentifierName(assignmentRight)
)
);
})
.Where(statement => statement != null);
var updatedMethod = constructorNode
.AddParameterListParameters(newParameters.ToArray())
.AddBodyStatements(newStatements.ToArray());
var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken);
var updatedSyntaxTree = root.ReplaceNode(constructorNode, updatedMethod);
updatedSyntaxTree = Formatter.Format(updatedSyntaxTree, new AdhocWorkspace());
return document.WithSyntaxRoot(updatedSyntaxTree);
}
}
}
| tastott/AnalyzeThis | src/AnalyzeThis/ReadonlyField/ReadonlyFieldRule.cs | C# | mit | 7,557 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from orcid_api_v3.models.subtitle_v30_rc2 import SubtitleV30Rc2 # noqa: F401,E501
from orcid_api_v3.models.title_v30_rc2 import TitleV30Rc2 # noqa: F401,E501
from orcid_api_v3.models.translated_title_v30_rc2 import TranslatedTitleV30Rc2 # noqa: F401,E501
class WorkTitleV30Rc2(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'title': 'TitleV30Rc2',
'subtitle': 'SubtitleV30Rc2',
'translated_title': 'TranslatedTitleV30Rc2'
}
attribute_map = {
'title': 'title',
'subtitle': 'subtitle',
'translated_title': 'translated-title'
}
def __init__(self, title=None, subtitle=None, translated_title=None): # noqa: E501
"""WorkTitleV30Rc2 - a model defined in Swagger""" # noqa: E501
self._title = None
self._subtitle = None
self._translated_title = None
self.discriminator = None
if title is not None:
self.title = title
if subtitle is not None:
self.subtitle = subtitle
if translated_title is not None:
self.translated_title = translated_title
@property
def title(self):
"""Gets the title of this WorkTitleV30Rc2. # noqa: E501
:return: The title of this WorkTitleV30Rc2. # noqa: E501
:rtype: TitleV30Rc2
"""
return self._title
@title.setter
def title(self, title):
"""Sets the title of this WorkTitleV30Rc2.
:param title: The title of this WorkTitleV30Rc2. # noqa: E501
:type: TitleV30Rc2
"""
self._title = title
@property
def subtitle(self):
"""Gets the subtitle of this WorkTitleV30Rc2. # noqa: E501
:return: The subtitle of this WorkTitleV30Rc2. # noqa: E501
:rtype: SubtitleV30Rc2
"""
return self._subtitle
@subtitle.setter
def subtitle(self, subtitle):
"""Sets the subtitle of this WorkTitleV30Rc2.
:param subtitle: The subtitle of this WorkTitleV30Rc2. # noqa: E501
:type: SubtitleV30Rc2
"""
self._subtitle = subtitle
@property
def translated_title(self):
"""Gets the translated_title of this WorkTitleV30Rc2. # noqa: E501
:return: The translated_title of this WorkTitleV30Rc2. # noqa: E501
:rtype: TranslatedTitleV30Rc2
"""
return self._translated_title
@translated_title.setter
def translated_title(self, translated_title):
"""Sets the translated_title of this WorkTitleV30Rc2.
:param translated_title: The translated_title of this WorkTitleV30Rc2. # noqa: E501
:type: TranslatedTitleV30Rc2
"""
self._translated_title = translated_title
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(WorkTitleV30Rc2, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, WorkTitleV30Rc2):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/work_title_v30_rc2.py | Python | mit | 4,930 |
var fs = require("fs");
var longStr = (new Array(10000)).join("welefen");
while(true){
fs.writeFileSync("1.txt", longStr);
} | welefen/node-test | file/a.js | JavaScript | mit | 125 |
package commenttemplate.expressions.exceptions;
/**
*
* @author thiago
*/
// @TODO: RuntimeException?
public class FunctionWithSameNameAlreadyExistsException extends RuntimeException {
/**
* Justa a custom mensage.
*
* @param msg A custom mensage.
*/
public FunctionWithSameNameAlreadyExistsException(String msg) {
super(msg);
}
}
| thiagorabelo/CommentTemplate | src/commenttemplate/expressions/exceptions/FunctionWithSameNameAlreadyExistsException.java | Java | mit | 351 |
<?php
include ('conexion/conexion.php');
if (empty($_REQUEST["nombreActividad"]) or empty($_REQUEST["idMateria"]) or empty($_REQUEST["evidencia"])or empty($_REQUEST["unidad"])){
echo "sin datos";
} else{
$idMateria = $_REQUEST["idMateria"];
$nombreActividad = $_REQUEST["nombreActividad"];
$evidencia = $_REQUEST["evidencia"];
$unidad = $_REQUEST["unidad"];
$query = "INSERT INTO tb_actividad (nom_actividad,tb_competencias_id_competencia,tb_temaUnidad_id_temaU,tb_temaUnidad_tb_materias_id_materia)
VALUES ('$nombreActividad', $evidencia, $unidad, $idMateria)";
mysqli_query($mysqli,$query)or die(mysqli_error());
echo "ok";
}
?> | UniversidadPolitecnicaBacalar/web | SISCA_V1/modulos/guardarActividad.php | PHP | mit | 655 |
/**
* Copyright (c) 2011 Bruno Jouhier <bruno.jouhier@sage.com>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict";
var fs = require("fs");
var path = require("path");
var compile = require("./compile");
var registered = false;
var _options = {};
/// !doc
///
/// # streamline/lib/compiler/register
///
/// Streamline `require` handler registration
///
/// * `register.register(options)`
/// Registers `require` handlers for streamline.
/// `options` is a set of default options passed to the `transform` function.
exports.register = function(setoptions) {
if (registered) return;
_options = setoptions || {};
registered = true;
var pModule = require('module').prototype;
var orig = pModule._compile;
pModule._compile = function(content, filename) {
content = compile.transformModule(content, filename, _options);
return orig.call(this, content, filename);
}
};
var dirMode = parseInt('777', 8);
exports.trackModule = function(m, options) {
if (registered) throw new Error("invalid call to require('streamline/module')");
m.filename = m.filename.replace(/\\/g, '/');
var tmp = m.filename.substring(0, m.filename.lastIndexOf('/'));
tmp += '/tmp--' + Math.round(Math.random() * 1e9) + path.extname(m.filename);
//console.error("WARNING: streamline not registered, re-loading module " + m.filename + " as " + tmp);
exports.register({});
fs.writeFileSync(tmp, fs.readFileSync(m.filename, "utf8"), "utf8");
process.on('exit', function() {
try { fs.unlinkSync(tmp); }
catch (ex) {}
})
m.exports = require(tmp);
return false;
}
Object.defineProperty(exports, "options", {
enumerable: true,
get: function() {
return _options;
}
}); | doowb/grunttest | node_modules/azure/node_modules/streamline/lib/compiler/register.js | JavaScript | mit | 2,722 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Curt Binder
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package info.curtbinder.reefangel.phone;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
import info.curtbinder.reefangel.wizard.SetupWizardActivity;
public class MainActivity extends AppCompatActivity
implements ActionBar.OnNavigationListener {
// public static final int REQUEST_EXIT = 1;
// public static final int RESULT_EXIT = 1024;
private static final String OPENED_KEY = "OPENED_KEY";
private static final String STATE_CHECKED = "DRAWER_CHECKED";
private static final String PREVIOUS_CHECKED = "PREVIOUS";
// do not switch selected profile when restoring the application state
private static boolean fRestoreState = false;
public final String TAG = MainActivity.class.getSimpleName();
private RAApplication raApp;
private String[] mNavTitles;
private Toolbar mToolbar;
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private ActionBarDrawerToggle mDrawerToggle;
private Boolean opened = null;
private int mOldPosition = -1;
private Boolean fCanExit = false;
private Fragment mHistoryContent = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
raApp = (RAApplication) getApplication();
raApp.raprefs.setDefaultPreferences();
// Set the Theme before the layout is instantiated
//Utils.onActivityCreateSetTheme(this, raApp.raprefs.getSelectedTheme());
setContentView(R.layout.activity_main);
// Check for first run
if (raApp.isFirstRun()) {
Intent i = new Intent(this, SetupWizardActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(i);
finish();
}
// Load any saved position
int position = 0;
if (savedInstanceState != null) {
position = savedInstanceState.getInt(STATE_CHECKED, 0);
Log.d(TAG, "Restore, position: " + position);
if (position == 3) {
// history fragment
mHistoryContent = getSupportFragmentManager().getFragment(savedInstanceState, "HistoryGraphFragment");
}
}
setupToolbar();
setupNavDrawer();
updateActionBar();
selectItem(position);
// launch a new thread to show the drawer on very first app launch
new Thread(new Runnable() {
@Override
public void run() {
opened = raApp.raprefs.getBoolean(OPENED_KEY, false);
if (!opened) {
mDrawerLayout.openDrawer(mDrawerList);
}
}
}).start();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// get the checked item and subtract off one to get the actual position
// the same logic applies that is used in the DrawerItemClickedListener.onItemClicked
int position = mDrawerList.getCheckedItemPosition() - 1;
outState.putInt(STATE_CHECKED, position);
if (position == 3) {
getSupportFragmentManager().putFragment(outState, "HistoryGraphFragment", mHistoryContent);
}
}
@Override
protected void onResume() {
super.onResume();
fCanExit = false;
fRestoreState = true;
setNavigationList();
if (raApp.raprefs.isKeepScreenOnEnabled()) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
// last thing we do is display the changelog if necessary
// TODO add in a preference check for displaying changelog on app startup
raApp.displayChangeLog(this);
}
@Override
protected void onPause() {
super.onPause();
}
private void setupToolbar() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitle("");
setSupportActionBar(mToolbar);
}
private void setupNavDrawer() {
// get the string array for the navigation items
mNavTitles = getResources().getStringArray(R.array.nav_items);
// locate the navigation drawer items in the layout
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
// set a custom shadow that overlays the main content when the drawer
// opens
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
GravityCompat.START);
// add in the logo header
View header = getLayoutInflater().inflate(R.layout.drawer_list_header, null);
mDrawerList.addHeaderView(header, null, false);
// set the adapter for the navigation list view
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this, R.layout.drawer_list_item,
mNavTitles);
mDrawerList.setAdapter(adapter);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
// setup the toggling for the drawer
mDrawerToggle =
new MyDrawerToggle(this, mDrawerLayout, mToolbar,
R.string.drawer_open, R.string.drawer_close);
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
private void setNavigationList() {
// set list navigation items
final ActionBar ab = getSupportActionBar();
Context context = ab.getThemedContext();
int arrayID;
if (raApp.isAwayProfileEnabled()) {
arrayID = R.array.profileLabels;
} else {
arrayID = R.array.profileLabelsHomeOnly;
}
ArrayAdapter<CharSequence> list =
ArrayAdapter.createFromResource(context, arrayID,
R.layout.support_simple_spinner_dropdown_item);
ab.setListNavigationCallbacks(list, this);
ab.setSelectedNavigationItem(raApp.getSelectedProfile());
}
private void updateActionBar() {
// update actionbar
final ActionBar ab = getSupportActionBar();
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
// only switch profiles when the user changes the navigation item,
// not when the navigation list state is restored
if (!fRestoreState) {
raApp.setSelectedProfile(itemPosition);
} else {
fRestoreState = false;
}
return true;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// sync the toggle state after onRestoreInstanceState has occurred
mDrawerToggle.syncState();
}
@Override
public void onBackPressed() {
/*
When the back button is pressed, this function is called.
If the drawer is open, check it and cancel it here.
Calling super.onBackPressed() causes the BackStackChangeListener to be called
*/
// Log.d(TAG, "onBackPressed");
if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
// Log.d(TAG, "drawer open, closing");
mDrawerLayout.closeDrawer(mDrawerList);
return;
}
if ( !fCanExit ) {
Toast.makeText(this, R.string.messageExitNotification, Toast.LENGTH_SHORT).show();
fCanExit = true;
Handler h = new Handler();
h.postDelayed(new Runnable() {
@Override
public void run() {
// Log.d(TAG, "Disabling exit flag");
fCanExit = false;
}
}, 2000);
return;
}
super.onBackPressed();
}
private void updateContent(int position) {
if (position != mOldPosition) {
// update the main content by replacing fragments
Fragment fragment;
switch (position) {
default:
case 0:
fragment = StatusFragment.newInstance();
break;
case 1:
fragment = MemoryFragment.newInstance(raApp.raprefs.useOldPre10MemoryLocations());
break;
case 2:
fragment = NotificationsFragment.newInstance();
break;
case 3:
//fragment = HistoryFragment.newInstance();
// TODO check the restoration of the fragment content
if (mHistoryContent != null ) {
fragment = mHistoryContent;
} else {
// mHistoryContent = HistoryGraphFragment.newInstance();
mHistoryContent = HistoryMultipleGraphFragment.newInstance();
fragment = mHistoryContent;
}
break;
case 4:
fragment = ErrorsFragment.newInstance();
break;
case 5:
fragment = DateTimeFragment.newInstance();
break;
}
Log.d(TAG, "UpdateContent: " + position);
FragmentTransaction ft =
getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content_frame, fragment);
ft.commit();
mOldPosition = position;
}
}
public void selectItem(int position) {
// Log.d(TAG, "selectItem: " + position);
updateContent(position);
highlightItem(position);
mDrawerLayout.closeDrawer(mDrawerList);
}
public void highlightItem(int position) {
// Log.d(TAG, "highlightItem: " + position);
// since we are using a header for the list, the first
// item/position in the list is the header. our header is non-selectable
// so in order for us to have the proper item in our list selected, we must
// increase the position by 1. this same logic is applied to the
// DrawerItemClickedListener.onItemClicked
mDrawerList.setItemChecked(position + 1, true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.global, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// pass the event to ActionBarDrawerToggle, if it returns true,
// then it has handled the app icon touch event
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// handle the rest of the action bar items here
switch (item.getItemId()) {
case R.id.action_settings:
Fragment f = getSupportFragmentManager().findFragmentById(R.id.content_frame);
if (f instanceof StatusFragment) {
// the current fragment is the status fragment
Log.d(TAG, "Status Fragment is current");
((StatusFragment) f).reloadPages();
}
startActivity(new Intent(this, SettingsActivity.class));
// startActivityForResult(new Intent(this, SettingsActivity.class), REQUEST_EXIT);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
// @Override
// protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Log.d(TAG, "onActivityResult");
// if (requestCode == REQUEST_EXIT) {
// if (resultCode == RESULT_EXIT) {
// this.finish();
// }
// }
// }
// called whenever we call invalidateOptionsMenu()
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
/*
This function is called after invalidateOptionsMenu is called.
This happens when the Navigation drawer is opened and closed.
*/
boolean open = mDrawerLayout.isDrawerOpen(mDrawerList);
hideMenuItems(menu, open);
return super.onPrepareOptionsMenu(menu);
}
private void hideMenuItems(Menu menu, boolean open) {
// hide the menu item(s) when the drawer is open
// Refresh button on Status page
MenuItem mi = menu.findItem(R.id.action_refresh);
if ( mi != null )
mi.setVisible(!open);
// Add button on Notification page
mi = menu.findItem(R.id.action_add_notification);
if ( mi != null )
mi.setVisible(!open);
// Delete button on Notification page
mi = menu.findItem(R.id.action_delete_notification);
if ( mi != null )
mi.setVisible(!open);
// Delete button on Error page
mi = menu.findItem(R.id.menu_delete);
if ( mi != null )
mi.setVisible(!open);
// hide buttons on History / Chart page
mi = menu.findItem(R.id.action_configure_chart);
if (mi != null)
mi.setVisible(!open);
mi = menu.findItem(R.id.action_refresh_chart);
if (mi != null)
mi.setVisible(!open);
}
private class MyDrawerToggle extends ActionBarDrawerToggle {
public MyDrawerToggle(Activity activity, DrawerLayout drawerLayout,
Toolbar toolbar,
int openDrawerContentDescRes,
int closeDrawerContentDescRes) {
super(activity, drawerLayout, toolbar,
openDrawerContentDescRes, closeDrawerContentDescRes);
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
// Log.d(TAG, "DrawerClosed");
invalidateOptionsMenu();
if (opened != null && !opened) {
// drawer closed for the first time ever,
// set that it has been closed
opened = true;
raApp.raprefs.set(OPENED_KEY, true);
}
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
// getSupportActionBar().setTitle(R.string.app_name);
invalidateOptionsMenu();
}
}
private class DrawerItemClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(
AdapterView<?> parent,
View view,
int position,
long id) {
// Perform action when a drawer item is selected
// Log.d(TAG, "onDrawerItemClick: " + position);
// when we have a list header, it counts as a position in the list
// the first position to be exact. so we have to decrease the
// position by 1 to get the proper item chosen in our list
selectItem(position - 1);
}
}
}
| curtbinder/AndroidStatus | app/src/main/java/info/curtbinder/reefangel/phone/MainActivity.java | Java | mit | 17,315 |
using CoreTweet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TweetArea.NETFramework.Core.Structures
{
public class MediaInfo
{
public string OriginalURL { get; internal set; }
}
public class Tweet
{
public long TweetId { get; set; }
public string Text { get; set; }
public DateTimeOffset CreateAt { get; set; }
public UserInfo User { get; set; }
public long UserId { get { return this.User.UserId; } }
public string UserScreenName { get { return this.User.ScreenName; } }
public string AvatarImageURI { get { return this.User.AvatarImageURI; } }
public Tweet Retweet { get; set; }
public List<MediaInfo> MediaInfo { get; set; }
}
}
| joy1192/TweetAreas | source/TweetAreas/TweetArea.NETFramework.Core/Structures/Tweet.cs | C# | mit | 839 |
/*
* Copyright 2016 Joyent, Inc., All rights reserved.
*
* 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
*/
module.exports = {
KeyPair: SDCKeyPair,
LockedKeyPair: SDCLockedKeyPair
};
var mod_assert = require('assert-plus');
var mod_sshpk = require('sshpk');
var mod_util = require('util');
var mod_httpsig = require('http-signature');
var KeyRing = require('./keyring');
function SDCKeyPair(kr, opts) {
mod_assert.object(kr, 'keyring');
mod_assert.ok(kr instanceof KeyRing,
'keyring instanceof KeyRing');
this.skp_kr = kr;
mod_assert.object(opts, 'options');
mod_assert.string(opts.plugin, 'options.plugin');
mod_assert.optionalString(opts.source, 'options.source');
this.plugin = opts.plugin;
this.source = opts.source;
this.comment = '';
if (opts.public !== undefined) {
/*
* We need a Key of v1,3 or later for defaultHashAlgorithm and
* the Signature hashAlgorithm support.
*/
mod_assert.ok(mod_sshpk.Key.isKey(opts.public, [1, 3]),
'options.public must be a sshpk.Key instance');
this.comment = opts.public.comment;
}
this.skp_public = opts.public;
if (opts.private !== undefined) {
mod_assert.ok(mod_sshpk.PrivateKey.isPrivateKey(opts.private),
'options.private must be a sshpk.PrivateKey instance');
}
this.skp_private = opts.private;
}
SDCKeyPair.fromPrivateKey = function (key) {
mod_assert.object(key, 'key');
mod_assert.ok(mod_sshpk.PrivateKey.isPrivateKey(key),
'key is a PrivateKey');
var kr = new KeyRing({ plugins: [] });
var kp = new SDCKeyPair(kr, {
plugin: 'none',
private: key,
public: key.toPublic()
});
return (kp);
};
SDCKeyPair.prototype.canSign = function () {
return (this.skp_private !== undefined);
};
SDCKeyPair.prototype.createRequestSigner = function (opts) {
mod_assert.string(opts.user, 'options.user');
mod_assert.optionalString(opts.subuser, 'options.subuser');
mod_assert.optionalBool(opts.mantaSubUser, 'options.mantaSubUser');
var sign = this.createSign(opts);
var user = opts.user;
if (opts.subuser) {
if (opts.mantaSubUser)
user += '/' + opts.subuser;
else
user += '/users/' + opts.subuser;
}
var keyId = '/' + user + '/keys/' + this.getKeyId();
function rsign(data, cb) {
sign(data, function (err, res) {
if (res)
res.keyId = keyId;
cb(err, res);
});
}
return (mod_httpsig.createSigner({ sign: rsign }));
};
SDCKeyPair.prototype.createSign = function (opts) {
mod_assert.object(opts, 'options');
mod_assert.optionalString(opts.algorithm, 'options.algorithm');
mod_assert.optionalString(opts.keyId, 'options.keyId');
mod_assert.string(opts.user, 'options.user');
mod_assert.optionalString(opts.subuser, 'options.subuser');
mod_assert.optionalBool(opts.mantaSubUser, 'options.mantaSubUser');
if (this.skp_private === undefined) {
throw (new Error('Private key for this key pair is ' +
'unavailable (because, e.g. only a public key was ' +
'found and no matching private half)'));
}
var key = this.skp_private;
var keyId = this.getKeyId();
var alg = opts.algorithm;
var algParts = alg ? alg.toLowerCase().split('-') : [];
if (algParts[0] && algParts[0] !== key.type) {
throw (new Error('Requested algorithm ' + alg + ' is ' +
'not supported with a key of type ' + key.type));
}
var self = this;
var cache = this.skp_kr.getSignatureCache();
function sign(data, cb) {
if (Buffer.isBuffer(data)) {
mod_assert.buffer(data, 'data');
} else {
mod_assert.string(data, 'data');
}
mod_assert.func(cb, 'callback');
var ck = { key: key, data: data };
if (Buffer.isBuffer(data))
ck.data = data.toString('base64');
if (cache.get(ck, cb))
return;
cache.registerPending(ck);
/*
* We can throw in here if the hash algorithm we were told to
* use in 'algorithm' is invalid. Return it as a normal error.
*/
var signer, sig;
try {
signer = self.skp_private.createSign(algParts[1]);
signer.update(data);
sig = signer.sign();
} catch (e) {
cache.put(ck, e);
cb(e);
return;
}
var res = {
algorithm: key.type + '-' + sig.hashAlgorithm,
keyId: keyId,
signature: sig.toString(),
user: opts.user,
subuser: opts.subuser
};
sign.algorithm = res.algorithm;
cache.put(ck, null, res);
cb(null, res);
}
sign.keyId = keyId;
sign.user = opts.user;
sign.subuser = opts.subuser;
sign.getKey = function (cb) {
cb(null, self.skp_private);
};
return (sign);
};
SDCKeyPair.prototype.getKeyId = function () {
return (this.skp_public.fingerprint('md5').toString('hex'));
};
SDCKeyPair.prototype.getPublicKey = function () {
return (this.skp_public);
};
SDCKeyPair.prototype.getPrivateKey = function () {
return (this.skp_private);
};
SDCKeyPair.prototype.isLocked = function () {
return (false);
};
SDCKeyPair.prototype.unlock = function (passphrase) {
throw (new Error('Keypair is not locked'));
};
function SDCLockedKeyPair(kr, opts) {
SDCKeyPair.call(this, kr, opts);
mod_assert.buffer(opts.privateData, 'options.privateData');
this.lkp_privateData = opts.privateData;
mod_assert.string(opts.privateFormat, 'options.privateFormat');
this.lkp_privateFormat = opts.privateFormat;
this.lkp_locked = true;
}
mod_util.inherits(SDCLockedKeyPair, SDCKeyPair);
SDCLockedKeyPair.prototype.createSign = function (opts) {
if (this.lkp_locked) {
throw (new Error('SSH private key ' +
this.getPublicKey().comment +
' is locked (encrypted/password-protected). It must be ' +
'unlocked before use.'));
}
return (SDCKeyPair.prototype.createSign.call(this, opts));
};
SDCLockedKeyPair.prototype.createRequestSigner = function (opts) {
if (this.lkp_locked) {
throw (new Error('SSH private key ' +
this.getPublicKey().comment +
' is locked (encrypted/password-protected). It must be ' +
'unlocked before use.'));
}
return (SDCKeyPair.prototype.createRequestSigner.call(this, opts));
};
SDCLockedKeyPair.prototype.canSign = function () {
return (true);
};
SDCLockedKeyPair.prototype.getPrivateKey = function () {
if (this.lkp_locked) {
throw (new Error('SSH private key ' +
this.getPublicKey().comment +
' is locked (encrypted/password-protected). It must be ' +
'unlocked before use.'));
}
return (this.skp_private);
};
SDCLockedKeyPair.prototype.isLocked = function () {
return (this.lkp_locked);
};
SDCLockedKeyPair.prototype.unlock = function (passphrase) {
mod_assert.ok(this.lkp_locked);
this.skp_private = mod_sshpk.parsePrivateKey(this.lkp_privateData,
this.lkp_privateFormat, { passphrase: passphrase });
mod_assert.ok(this.skp_public.fingerprint('sha512').matches(
this.skp_private));
this.lkp_locked = false;
};
| joyent/node-smartdc-auth | lib/keypair.js | JavaScript | mit | 7,717 |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DropdownMenuItemType;
(function (DropdownMenuItemType) {
DropdownMenuItemType[DropdownMenuItemType["Normal"] = 0] = "Normal";
DropdownMenuItemType[DropdownMenuItemType["Divider"] = 1] = "Divider";
DropdownMenuItemType[DropdownMenuItemType["Header"] = 2] = "Header";
})(DropdownMenuItemType = exports.DropdownMenuItemType || (exports.DropdownMenuItemType = {}));
//# sourceMappingURL=Dropdown.Props.js.map
| SpatialMap/SpatialMapDev | node_modules/office-ui-fabric-react/lib/components/Dropdown/Dropdown.Props.js | JavaScript | mit | 499 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "HellBrick.Refactorings.Vsix" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "HellBrick.Refactorings.Vsix" )]
[assembly: AssemblyCopyright( "" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
| HellBrick/HellBrick.Refactorings | HellBrick.Refactorings.Vsix/Properties/AssemblyInfo.cs | C# | mit | 1,291 |
module WinFFI
module User32
# Windowstation creation flags.
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682496
CreateWindowStationFlag = enum :create_window_station_flag, [:CREATE_ONLY, 0x00000001]
define_prefix(:CWF, CreateWindowStationFlag)
end
end | P3t3rU5/win-ffi-user32 | lib/win-ffi/user32/enum/window_station/create_window_station_flag.rb | Ruby | mit | 288 |
/**
* Export exceptions
* @type {Object}
*/
module.exports = {
Schema: require('./Schema'),
Value: require('./Value')
}
| specla/validator | lib/exceptions/index.js | JavaScript | mit | 127 |
import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
| kura/batfish | tests/test_client_authorize.py | Python | mit | 1,645 |
package org.workcraft.plugins.policy.commands;
import org.workcraft.commands.AbstractConversionCommand;
import org.workcraft.plugins.petri.Petri;
import org.workcraft.plugins.petri.VisualPetri;
import org.workcraft.plugins.policy.Policy;
import org.workcraft.plugins.policy.PolicyDescriptor;
import org.workcraft.plugins.policy.VisualPolicy;
import org.workcraft.plugins.policy.tools.PetriToPolicyConverter;
import org.workcraft.utils.Hierarchy;
import org.workcraft.utils.DialogUtils;
import org.workcraft.workspace.ModelEntry;
import org.workcraft.workspace.WorkspaceEntry;
import org.workcraft.utils.WorkspaceUtils;
public class PetriToPolicyConversionCommand extends AbstractConversionCommand {
@Override
public String getDisplayName() {
return "Policy Net";
}
@Override
public boolean isApplicableTo(WorkspaceEntry we) {
return WorkspaceUtils.isApplicableExact(we, Petri.class);
}
@Override
public ModelEntry convert(ModelEntry me) {
if (Hierarchy.isHierarchical(me)) {
DialogUtils.showError("Policy Net cannot be derived from a hierarchical Petri Net.");
return null;
}
final VisualPetri src = me.getAs(VisualPetri.class);
final VisualPolicy dst = new VisualPolicy(new Policy());
final PetriToPolicyConverter converter = new PetriToPolicyConverter(src, dst);
return new ModelEntry(new PolicyDescriptor(), converter.getDstModel());
}
}
| tuura/workcraft | workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/commands/PetriToPolicyConversionCommand.java | Java | mit | 1,471 |
using Xunit;
namespace ZabbixApiTests.Integration
{
public class EventServiceIntegrationTest : IntegrationTestBase
{
[Fact]
public void MustGetAny()
{
var result = context.Events.Get();
Assert.NotNull(result);
}
}
}
| HenriqueCaires/ZabbixApi | ZabbixApiTests/Integration/EventServiceIntegrationTest.cs | C# | mit | 288 |
var express = require('express');
var userRouter = express.Router();
var passport = require('passport');
var Model = require('../models/user');
var authenticate = require('./auth');
/* GET all the users */
exports.getAll = function(req, res, next) {
Model.Users.forge()
.fetch({ columns: ['_id', 'username', 'admin'] })
.then(function(user) {
res.json(user);
}).catch(function(err) {
console.log(err);
});
};
/* GET a user given its id */
exports.getUser = function(req, res, next) {
var userID = req.params.userID;
Model.User.forge({'_id':userID})
.fetch({columns:['_id', 'username', 'admin']})
.then(function (user) {
res.json(user);
});
};
/* PUT update a user given its id */
exports.updateUser = function(req, res, next) {
var userID = req.params.userID;
Model.User.forge({'_id':userID})
.fetch({columns:['_id', 'username', 'admin']})
.then(function (user) {
res.json(user);
});
};
/* GET logout */
exports.signOut = function(req, res){
req.logout();
res.status(200).json({message: 'Login user out'});
};
/* POST login. */
exports.signIn = function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (err) {
return next(err);
}
if (!user) {
return res.status(401).json({
err: info
});
}
return req.logIn(user, function(err) {
if (err) {
console.log(err);
return res.status(500).json({
error: 'Could not log in user'
});
}
var token = authenticate.getToken(user);
res.status(200).json({
status: 'Login successful',
succes: true,
token: token
});
});
})(req, res, next);
};
/* POST Register. */
exports.signUp = function(req, res, next) {
var userData = req.body;
Model.User.forge({
username: userData.username
}).fetch() //see if user already exists
.then(function(user) {
if (user) {
return res.status(400).json({
title: 'signup',
errorMessage: 'That username already exists'
});
} else {
//User does not existe, lets add it
var signUpUser = Model.User.forge({
username: userData.username,
password: userData.password,
admin: false
});
signUpUser.save()
.then(function(user) {
var result = 'User ' + user.get('username') + ' created.';
return res.status(200).json({
message: result,
user: {
id: user.get('id'),
username: user.get('username'),
}
});
});
}
});
};
| TheKiqGit/TimeTracker | src/server/routes/userController.js | JavaScript | mit | 2,707 |
import Float from 'ember-advanced-form/components/float';
export default Float;
| jakkor/ember-advanced-form | app/components/advanced-form/float.js | JavaScript | mit | 81 |
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
const u = undefined;
function plural(n: number): number {
return 5;
}
export default [
'ccp-IN',
[['AM', 'PM'], u, u],
u,
[
['𑄢𑄧', '𑄥𑄧', '𑄟𑄧', '𑄝𑄪', '𑄝𑄳𑄢𑄨', '𑄥𑄪', '𑄥𑄧'],
[
'𑄢𑄧𑄝𑄨', '𑄥𑄧𑄟𑄴', '𑄟𑄧𑄁𑄉𑄧𑄣𑄴', '𑄝𑄪𑄖𑄴',
'𑄝𑄳𑄢𑄨𑄥𑄪𑄛𑄴', '𑄥𑄪𑄇𑄴𑄇𑄮𑄢𑄴', '𑄥𑄧𑄚𑄨'
],
[
'𑄢𑄧𑄝𑄨𑄝𑄢𑄴', '𑄥𑄧𑄟𑄴𑄝𑄢𑄴',
'𑄟𑄧𑄁𑄉𑄧𑄣𑄴𑄝𑄢𑄴', '𑄝𑄪𑄖𑄴𑄝𑄢𑄴',
'𑄝𑄳𑄢𑄨𑄥𑄪𑄛𑄴𑄝𑄢𑄴',
'𑄥𑄪𑄇𑄴𑄇𑄮𑄢𑄴𑄝𑄢𑄴', '𑄥𑄧𑄚𑄨𑄝𑄢𑄴'
],
[
'𑄢𑄧𑄝𑄨', '𑄥𑄧𑄟𑄴', '𑄟𑄧𑄁𑄉𑄧𑄣𑄴', '𑄝𑄪𑄖𑄴',
'𑄝𑄳𑄢𑄨𑄥𑄪𑄛𑄴', '𑄥𑄪𑄇𑄴𑄇𑄮𑄢𑄴', '𑄥𑄧𑄚𑄨'
]
],
u,
[
[
'𑄎', '𑄜𑄬', '𑄟', '𑄃𑄬', '𑄟𑄬', '𑄎𑄪𑄚𑄴', '𑄎𑄪', '𑄃',
'𑄥𑄬', '𑄃𑄧', '𑄚𑄧', '𑄓𑄨'
],
[
'𑄎𑄚𑄪', '𑄜𑄬𑄛𑄴', '𑄟𑄢𑄴𑄌𑄧',
'𑄃𑄬𑄛𑄳𑄢𑄨𑄣𑄴', '𑄟𑄬', '𑄎𑄪𑄚𑄴', '𑄎𑄪𑄣𑄭',
'𑄃𑄉𑄧𑄌𑄴𑄑𑄴', '𑄥𑄬𑄛𑄴𑄑𑄬𑄟𑄴𑄝𑄧𑄢𑄴',
'𑄃𑄧𑄇𑄴𑄑𑄮𑄝𑄧𑄢𑄴', '𑄚𑄧𑄞𑄬𑄟𑄴𑄝𑄧𑄢𑄴',
'𑄓𑄨𑄥𑄬𑄟𑄴𑄝𑄢𑄴'
],
[
'𑄎𑄚𑄪𑄠𑄢𑄨', '𑄜𑄬𑄛𑄴𑄝𑄳𑄢𑄪𑄠𑄢𑄨',
'𑄟𑄢𑄴𑄌𑄧', '𑄃𑄬𑄛𑄳𑄢𑄨𑄣𑄴', '𑄟𑄬', '𑄎𑄪𑄚𑄴',
'𑄎𑄪𑄣𑄭', '𑄃𑄉𑄧𑄌𑄴𑄑𑄴',
'𑄥𑄬𑄛𑄴𑄑𑄬𑄟𑄴𑄝𑄧𑄢𑄴',
'𑄃𑄧𑄇𑄴𑄑𑄬𑄝𑄧𑄢𑄴', '𑄚𑄧𑄞𑄬𑄟𑄴𑄝𑄧𑄢𑄴',
'𑄓𑄨𑄥𑄬𑄟𑄴𑄝𑄧𑄢𑄴'
]
],
[
[
'𑄎', '𑄜𑄬', '𑄟', '𑄃𑄬', '𑄟𑄬', '𑄎𑄪𑄚𑄴', '𑄎𑄪', '𑄃',
'𑄥𑄬', '𑄃𑄧', '𑄚𑄧', '𑄓𑄨'
],
[
'𑄎𑄚𑄪𑄠𑄢𑄨', '𑄜𑄬𑄛𑄴𑄝𑄳𑄢𑄪𑄠𑄢𑄨',
'𑄟𑄢𑄴𑄌𑄧', '𑄃𑄬𑄛𑄳𑄢𑄨𑄣𑄴', '𑄟𑄬', '𑄎𑄪𑄚𑄴',
'𑄎𑄪𑄣𑄭', '𑄃𑄉𑄧𑄌𑄴𑄑𑄴',
'𑄥𑄬𑄛𑄴𑄑𑄬𑄟𑄴𑄝𑄧𑄢𑄴',
'𑄃𑄧𑄇𑄴𑄑𑄮𑄝𑄧𑄢𑄴', '𑄚𑄧𑄞𑄬𑄟𑄴𑄝𑄧𑄢𑄴',
'𑄓𑄨𑄥𑄬𑄟𑄴𑄝𑄧𑄢𑄴'
],
u
],
[
[
'𑄈𑄳𑄢𑄨𑄌𑄴𑄑𑄴𑄛𑄫𑄢𑄴𑄝𑄧',
'𑄈𑄳𑄢𑄨𑄌𑄴𑄑𑄛𑄴𑄘𑄧'
],
u, u
],
0,
[0, 0],
['d/M/yy', 'd MMM, y', 'd MMMM, y', 'EEEE, d MMMM, y'],
['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
['{1} {0}', u, u, u],
['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
['#,##,##0.###', '#,##,##0%', '#,##,##0.00¤', '#E0'],
'₹',
'𑄃𑄨𑄚𑄴𑄘𑄨𑄠𑄚𑄴 𑄢𑄪𑄛𑄨',
{
'BDT': ['৳'],
'JPY': ['JP¥', '¥'],
'STD': [u, 'Db'],
'THB': ['฿'],
'TWD': ['NT$'],
'USD': ['US$', '$']
},
'ltr',
plural
];
| vikerman/angular | packages/common/locales/ccp-IN.ts | TypeScript | mit | 3,581 |
document.getElementsByTagName('body')[0].style.overflow = 'hidden';
window.scrollTo(70, 95); | nash716/SandanshikiKanpan | src2/inject/scroll.js | JavaScript | mit | 92 |
package main
import (
"github.com/emicklei/go-restful"
"io"
"net/http"
)
// This example shows how to create a (Route) Filter that performs Basic Authentication on the Http request.
//
// GET http://localhost:8080/secret
// and use admin,admin for the credentials
func main() {
ws := new(restful.WebService)
ws.Route(ws.GET("/secret").Filter(basicAuthenticate).To(secret))
restful.Add(ws)
http.ListenAndServe(":8080", nil)
}
func basicAuthenticate(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {
encoded := req.Request.Header.Get("Authorization")
// usr/pwd = admin/admin
// real code does some decoding
if len(encoded) == 0 || "Basic YWRtaW46YWRtaW4=" != encoded {
resp.AddHeader("WWW-Authenticate", "Basic realm=Protected Area")
resp.WriteErrorString(401, "401: Not Authorized")
return
}
chain.ProcessFilter(req, resp)
}
func secret(req *restful.Request, resp *restful.Response) {
io.WriteString(resp, "42")
}
| spacexnice/ctlplane | Godeps/_workspace/src/github.com/emicklei/go-restful/examples/restful-basic-authentication.go | GO | mit | 1,025 |
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
* Auditore
*
* @author sanik90
* @copyright Copyright (c) 2017 sanik90
* @license https://github.com/sanik90/auditore/blob/master/LICENSE.txt
* @link https://github.com/sanik90/auditore
*/
/**
* Class Custom_Fields
*/
class Custom_Fields extends Admin_Controller
{
/**
* Custom_Fields constructor.
*/
public function __construct()
{
parent::__construct();
$this->load->model('mdl_custom_fields');
}
/**
* @param int $page
*/
public function index($page = 0)
{
$this->mdl_custom_fields->paginate(site_url('custom_fields/index'), $page);
$custom_fields = $this->mdl_custom_fields->result();
$this->load->model('custom_values/mdl_custom_values');
$this->layout->set('custom_fields', $custom_fields);
$this->layout->set('custom_tables', $this->mdl_custom_fields->custom_tables());
$this->layout->set('custom_value_fields', $this->mdl_custom_values->custom_value_fields());
$this->layout->buffer('content', 'custom_fields/index');
$this->layout->render();
}
/**
* @param null $id
*/
public function form($id = null)
{
if ($this->input->post('btn_cancel')) {
redirect('custom_fields');
}
if ($this->mdl_custom_fields->run_validation()) {
$this->mdl_custom_fields->save($id);
redirect('custom_fields');
}
if ($id and !$this->input->post('btn_submit')) {
if (!$this->mdl_custom_fields->prep_form($id)) {
show_404();
}
}
$this->load->model('mdl_client_custom');
$this->load->model('mdl_invoice_custom');
$this->load->model('mdl_payment_custom');
$this->load->model('mdl_quote_custom');
$this->load->model('mdl_user_custom');
$this->layout->set('custom_field_tables', $this->mdl_custom_fields->custom_tables());
$this->layout->set('custom_field_types', $this->mdl_custom_fields->custom_types());
$this->layout->buffer('content', 'custom_fields/form');
$this->layout->render();
}
/**
* @param $id
*/
public function delete($id)
{
$this->mdl_custom_fields->delete($id);
redirect('custom_fields');
}
}
| sanik90/auditore | application/modules/custom_fields/controllers/Custom_fields.php | PHP | mit | 2,385 |
<?php
/*
* This file is part of PHPExifTool.
*
* (c) 2012 Romain Neutron <imprec@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\XMPCrs;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class PerspectiveHorizontal extends AbstractTag
{
protected $Id = 'PerspectiveHorizontal';
protected $Name = 'PerspectiveHorizontal';
protected $FullName = 'XMP::crs';
protected $GroupName = 'XMP-crs';
protected $g0 = 'XMP';
protected $g1 = 'XMP-crs';
protected $g2 = 'Image';
protected $Type = 'integer';
protected $Writable = true;
protected $Description = 'Perspective Horizontal';
}
| romainneutron/PHPExiftool | lib/PHPExiftool/Driver/Tag/XMPCrs/PerspectiveHorizontal.php | PHP | mit | 829 |
var url = args.url;
var limit = args.limitl;
var defaultWaitTime = Number(args.wait_time_for_polling)
uuid = executeCommand('urlscan-submit-url-command', {'url': url})[0].Contents;
uri = executeCommand('urlscan-get-result-page', {'uuid': uuid})[0].Contents;
var resStatusCode = 404
var waitedTime = 0
while(resStatusCode == 404 && waitedTime < Number(args.timeout)) {
var resStatusCode = executeCommand('urlscan-poll-uri', {'uri': uri})[0].Contents;
if (resStatusCode == 200) {
break;
}
wait(defaultWaitTime);
waitedTime = waitedTime + defaultWaitTime;
}
if(resStatusCode == 200) {
return executeCommand('urlscan-get-http-transaction-list', {'uuid': uuid, 'url': url, 'limit': limit});
} else {
if(waitedTime >= Number(args.timeout)){
return 'Could not get result from UrlScan, please try to increase the timeout.'
} else {
return 'Could not get result from UrlScan, possible rate-limit issues.'
}
}
| demisto/content | Packs/UrlScan/Scripts/UrlscanGetHttpTransactions/UrlscanGetHttpTransactions.js | JavaScript | mit | 963 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Nucleo.Services
{
public class WebStaticInstanceManager : IStaticInstanceManager
{
private HttpContextBase _context = null;
#region " Properties "
private HttpContextBase Context
{
get
{
if (_context == null)
_context = new HttpContextWrapper(HttpContext.Current);
return _context;
}
}
#endregion
#region " Constructors "
/// <summary>
/// Creates the singleton manager.
/// </summary>
public WebStaticInstanceManager() { }
/// <summary>
/// Creates the singleton manager.
/// </summary>
/// <param name="context">The context to use.</param>
public WebStaticInstanceManager(HttpContextBase context)
{
_context = context;
}
#endregion
#region " Methods "
/// <summary>
/// Adds an entry to the singleton collection.
/// </summary>
/// <typeparam name="T">The type of service to register.</typeparam>
/// <param name="obj">The object to add.</param>
public void AddEntry<T>(T obj)
{
if (this.Context.Items.Contains(typeof(T)))
throw new Exception("A entry already exists of type " + typeof(T).FullName);
this.Context.Items.Add(typeof(T), obj);
}
/// <summary>
/// Adds an entry to the singleton collection.
/// </summary>
/// <typeparam name="T">The type of service to register.</typeparam>
/// <param name="name">The name identifier to allow for multiple registrations.</param>
/// <param name="obj">The object to add.</param>
public void AddEntry<T>(T obj, string name)
{
if (this.Context.Items.Contains(typeof(T)))
throw new Exception("A entry already exists of type " + typeof(T).FullName);
this.Context.Items.Add(GetIdentifier<T>(name), obj);
}
/// <summary>
/// Adds or updates an entry to the singleton collection.
/// </summary>
/// <typeparam name="T">The type of service to register.</typeparam>
/// <param name="obj">The object to add or update.</param>
public void AddOrUpdateEntry<T>(T obj)
{
if (!this.Context.Items.Contains(typeof(T)))
this.Context.Items.Add(typeof(T), obj);
else
this.Context.Items[typeof(T)] = obj;
}
/// <summary>
/// Adds or updates an entry to the singleton collection.
/// </summary>
/// <typeparam name="T">The type of service to register.</typeparam>
/// <param name="name">The name identifier to allow for multiple registrations.</param>
/// <param name="obj">The object to add or update.</param>
public void AddOrUpdateEntry<T>(T obj, string name)
{
if (!this.Context.Items.Contains(typeof(T)))
this.Context.Items.Add(GetIdentifier<T>(name), obj);
else
this.Context.Items[GetIdentifier<T>(name)] = obj;
}
/// <summary>
/// Gets the current web singleton manager.
/// </summary>
/// <returns>The <see cref="ISingletonManager"/> instance.</returns>
public static IStaticInstanceManager GetCurrent()
{
if (HttpContext.Current == null)
return null;
var mgr = HttpContext.Current.Items[typeof(WebStaticInstanceManager)] as WebStaticInstanceManager;
if (mgr != null)
return mgr;
mgr = new WebStaticInstanceManager();
HttpContext.Current.Items.Add(typeof(WebStaticInstanceManager), mgr);
return mgr;
}
/// <summary>
/// Gets an entry from local storage, or null if not found.
/// </summary>
/// <typeparam name="T">The type of entry to retrieve.</typeparam>
/// <returns>The entry or null.</returns>
public T GetEntry<T>()
{
return (T)this.Context.Items[typeof(T)];
}
/// <summary>
/// Gets an entry from local storage, or null if not found.
/// </summary>
/// <typeparam name="T">The type of entry to retrieve.</typeparam>
/// <param name="name">The name identifier to allow for multiple registrations.</param>
/// <returns>The entry or null.</returns>
public T GetEntry<T>(string name)
{
return (T)this.Context.Items[GetIdentifier<T>(name)];
}
private string GetIdentifier<T>(string name)
{
return typeof(T).FullName + "-" + name;
}
/// <summary>
/// Determines whether the dictionary has the entry.
/// </summary>
/// <typeparam name="T">THe type to check for.</typeparam>
/// <returns>Whether the entry exists.</returns>
public bool HasEntry<T>()
{
return this.Context.Items.Contains(typeof(T));
}
/// <summary>
/// Determines whether the dictionary has the entry.
/// </summary>
/// <typeparam name="T">THe type to check for.</typeparam>
/// <param name="name">The name identifier to allow for multiple registrations.</param>
/// <returns>Whether the entry exists.</returns>
public bool HasEntry<T>(string name)
{
return this.Context.Items.Contains(GetIdentifier<T>(name));
}
#endregion
}
}
| brianmains/Nucleo.NET | src_wip/Nucleo.ApplicationServices.Web/Services/WebStaticInstanceManager.cs | C# | mit | 4,777 |
import User from '../models/user.model';
import Post from '../models/post.model';
import UserPost from '../models/users_posts.model';
import fs from 'fs';
import path from 'path';
/**
* Load user and append to req.
*/
function load(req, res, next, id) {
User.get(id)
.then((user) => {
req.user = user; // eslint-disable-line no-param-reassign
return next();
})
.catch(e => next(e));
}
/**
* Get user
* @returns {User}
*/
function get(req, res) {
req.user.password = "";
var user = JSON.parse(JSON.stringify(req.user));
Post.count({
userId: req.user._id
}).exec()
.then(postCount => {
user.postCount = postCount;
User.count({
following: req.user._id
}).exec()
.then(followedByCount => {
user.followedByCount = followedByCount;
return res.json({
data: user,
result: 0
});
})
})
.catch(err => {
return res.json({
data: err,
result: 1
});
})
}
/**
* Update basic info;firstname lastname profie.bio description title
* @returns {User}
*/
function updateBasicinfo(req, res, next) {
var user = req.user;
user.firstname = req.body.firstname;
user.lastname = req.body.lastname;
user.profile.bio = req.body.profile.bio;
user.profile.title = req.body.profile.title;
user.profile.description = req.body.profile.description;
user.save()
.then(savedUser => res.json({
data: savedUser,
result: 0
}))
.catch(e => next(e));
}
/**
* Update basic info;firstname lastname profie.bio description title
* @returns {User}
*/
function uploadUserimg(req, res, next) {
var user = req.user;
var file = req.files.file;
fs.readFile(file.path, function(err, original_data) {
if (err) {
next(err);
}
// save image in db as base64 encoded - this limits the image size
// to there should be size checks here and in client
var newPath = path.join(__filename, '../../../../public/uploads/avatar/');
fs.writeFile(newPath + user._id + path.extname(file.path), original_data, function(err) {
if (err)
next(err);
console.log("write file" + newPath + user._id + path.extname(file.path));
fs.unlink(file.path, function(err) {
if (err) {
console.log('failed to delete ' + file.path);
} else {
console.log('successfully deleted ' + file.path);
}
});
user.image = '/uploads/avatar/' + user._id + path.extname(file.path);
user.save(function(err) {
if (err) {
next(err);
} else {
res.json({
data: user,
result: 1
});
}
});
});
});
}
/**
* Create new user
* @property {string} req.body.username - The username of user.
* @property {string} req.body.mobileNumber - The mobileNumber of user.
* @returns {User}
*/
function create(req, res, next) {
const user = new User({
username: req.body.username,
mobileNumber: req.body.mobileNumber
});
user.save()
.then(savedUser => res.json(savedUser))
.catch(e => next(e));
}
/**
* Update existing user
* @property {string} req.body.username - The username of user.
* @property {string} req.body.mobileNumber - The mobileNumber of user.
* @returns {User}
*/
function update(req, res, next) {
const user = req.user;
user.username = req.body.username;
user.mobileNumber = req.body.mobileNumber;
user.save()
.then(savedUser => res.json(savedUser))
.catch(e => next(e));
}
/**
* Get user list.
req.params.query : search string
req.params.
* @returns {User[]}
*/
function list(req, res, next) {
var params = req.query;
var condition;
if (params.query == "")
condition = {};
else {
condition = {
$or: [{
"firstname": new RegExp(params.query, 'i')
}, {
"lastname": new RegExp(params.query, 'i')
}]
};
}
User.count(condition).exec()
.then(total => {
if (params.page * params.item_per_page > total) {
params.users = [];
throw {
data: params,
result: 1
};
}
params.total = total;
return User.find(condition)
.sort({
createdAt: -1
})
.skip(params.page * params.item_per_page)
.limit(parseInt(params.item_per_page))
.exec();
})
.then(users => {
params.users = users;
res.json({
data: params,
result: 0
});
})
.catch(err => next(err));
}
/**
* Delete user.
* @returns {User}
*/
function remove(req, res, next) {
const user = req.user;
user.remove()
.then(deletedUser => res.json(deletedUser))
.catch(e => next(e));
}
/**
* get post of ther user
* @returns {User}
*/
function getPosts(req, res, next) {
var user = req.user;
Post.find({
userId: user._id
})
.sort({
createdAt: -1
})
.populate('userId')
.populate({
path: 'comments',
// Get friends of friends - populate the 'friends' array for every friend
populate: {
path: 'author'
}
})
.exec()
.then(posts => {
console.log(posts);
res.json({
data: posts,
result: 0
})
})
.catch(e => next(e));
}
/**
* get post of ther user
* @returns {User}
*/
function addPost(req, res, next) {
var user = req.user;
var post = new Post({
userId: user._id,
title: req.body.title,
content: req.body.content,
});
post.save()
.then(post => {
console.log(post);
res.json({
data: post,
result: 0
})
})
.catch(e => next(e));
}
function followUser(req, res, next) {
var user = req.user;
User.get(req.body.user_follow_to)
.then((user_follow_to) => {
if (user.following.indexOf(user_follow_to._id) == -1)
user.following.push(user_follow_to._id);
user.save()
.then(result => {
res.json({
result: 0,
data: result
});
})
.catch(e => next(e));
})
.catch(e => next(e));
}
function disconnectUser(req, res, next) {
var user = req.user;
User.get(req.body.user_disconnect_to)
.then(user_disconnect_to => {
var index = user.following.indexOf(user_disconnect_to._id)
if (index > -1)
user.following.splice(index, 1);
user.save()
.then(result => {
res.json({
result: 0,
data: result
});
})
.catch(e => next(e));
})
.catch(e => next(e));
}
function myFeeds(req, res, next) {
var user = req.user;
Post.find({
userId: {
$in: user.following
}
})
.populate('userId')
.populate({
path: 'comments',
// Get friends of friends - populate the 'friends' array for every friend
populate: {
path: 'author'
}
})
// .populate('likeUsers')
.exec()
.then(feeds => {
res.json({
data: feeds,
result: 0
});
})
.catch(e => next(e));
}
// function allUsers(req, res, next) {
// var user = req.user;
// User.find()
// .sort({ createdAt: -1 })
// .exec()
// .then(users => {
// res.json(users)
// })
// .catch(e => next(e));
// }
//----------------------Like system----------------
function likePost(req, res, next) {
// UserPost.find({
// user: req.current_user,
// post: req.body.post_id
// })
// .exec()
// .then(userpost => {
// if(userpost.length == 0){
// new UserPost({
// user: req.current_user,
// post: req.body.post_id
// }).save().then((userpost)=>{
// res.json({
// result:0,
// data:userpost
// });
// })
// }
// else
// {
// res.json({
// result:0,
// data:"You already like it"
// })
// }
// })
// .catch(e => {
// res.json({
// result: 1,
// data: e
// })
// });
Post.get(req.body.post_id)
.then((post) => {
if (post.likeUsers.indexOf(req.current_user._id) == -1)
post.likeUsers.push(req.current_user._id);
post.save()
.then(result => {
res.json({
result: 0,
data: result
});
})
.catch(e => next(e));
})
.catch(e => next(e));
}
function dislikePost(req, res, next) {
// UserPost.remove({
// user: req.current_user,
// post: req.body.post_id
// })
// .exec()
// .then(userpost => {
// res.json({
// result:0,
// data:userpost
// })
// })
// .catch(e => {
// res.json({
// result: 1,
// data: e.message
// })
// });
Post.get(req.body.post_id)
.then((post) => {
if (post.likeUsers.indexOf(req.current_user._id) != -1)
post.likeUsers.splice(post.likeUsers.indexOf(req.current_user._id), 1);
post.save()
.then(result => {
res.json({
result: 0,
data: result
});
})
.catch(e => next(e));
})
.catch(e => next(e));
}
export default {
load,
get,
create,
update,
list,
remove,
updateBasicinfo,
uploadUserimg,
getPosts,
addPost,
followUser,
disconnectUser,
myFeeds,
likePost,
dislikePost
}; | kenectin215/kenectin | server/controllers/user.controller.js | JavaScript | mit | 8,464 |
import { formValueSelector, getFormValues } from 'redux-form';
import { createSelector } from 'reselect';
import { BookingProps } from '@waldur/booking/types';
import { getOfferingComponentsFilter } from '@waldur/marketplace/common/registry';
import { OfferingComponent } from '@waldur/marketplace/types';
import { RootState } from '@waldur/store/reducers';
import {
isOwnerOrStaff,
getCustomer,
getUser,
} from '@waldur/workspace/selectors';
import { FORM_ID, DRAFT } from './constants';
import { PlanFormData } from './types';
import { formatComponents } from './utils';
export const getOffering = (state: RootState) => state.marketplace.offering;
export const getStep = (state: RootState) => getOffering(state).step;
export const isLoading = (state: RootState) => getOffering(state).loading;
export const isLoaded = (state: RootState) => getOffering(state).loaded;
export const isErred = (state: RootState) => getOffering(state).erred;
export const getCategories = (state: RootState) =>
getOffering(state).categories;
export const getOfferingComponents = (state: RootState, type) =>
getOffering(state).plugins[type].components;
export const getOfferingLimits = (state: RootState, type) =>
getOffering(state).plugins[type].available_limits;
export const getForm = formValueSelector(FORM_ID);
export const getComponents = (
state: RootState,
type: string,
): OfferingComponent[] => {
const builtinComponents = getOfferingComponents(state, type);
const builtinTypes: string[] = builtinComponents.map((c) => c.type);
const formComponents: OfferingComponent[] = formatComponents(
getForm(state, 'components') || [],
);
let components = [
...builtinComponents,
...formComponents.filter((c) => !builtinTypes.includes(c.type)),
];
const offeringComponentsFilter = getOfferingComponentsFilter(type);
if (offeringComponentsFilter) {
const formData = getFormValues(FORM_ID)(state);
components = offeringComponentsFilter(formData, components);
}
return components;
};
export const getTypeLabel = (state: RootState): string => {
const option = getForm(state, 'type');
if (option) {
return option.label;
}
};
export const getType = (state: RootState): string => {
const option = getForm(state, 'type');
if (option) {
return option.value;
}
};
export const getCategory = (state: RootState) => getForm(state, 'category');
export const getAttributes = (state: RootState) => getForm(state, 'attributes');
export const getPlans = (state): PlanFormData[] => getForm(state, 'plans');
export const getPlanData = (state: RootState, planPath: string): PlanFormData =>
getForm(state, planPath);
export const getPlanPrice = (state: RootState, planPath: string) => {
const planData = getPlanData(state, planPath);
if (planData && planData.quotas && planData.prices) {
const type = getType(state);
const components = (type ? getComponents(state, type) : [])
.filter((component) => component.billing_type === 'fixed')
.map((component) => component.type);
const keys = Object.keys(planData.quotas).filter(
(key) => components.indexOf(key) !== -1,
);
return keys.reduce(
(total, item) =>
total + (planData.quotas[item] || 0) * (planData.prices[item] || 0),
0,
);
}
return 0;
};
export const isOfferingManagementDisabled = createSelector(
isOwnerOrStaff,
getOffering,
getCustomer,
getUser,
(ownerOrStaff, offeringState, customer, user) => {
if (!customer) {
return false;
}
if (!customer.is_service_provider) {
return true;
}
if (!ownerOrStaff) {
return true;
}
const offering = offeringState.offering;
if (
offering &&
offering.state &&
offering.state !== DRAFT &&
!user.is_staff
) {
return true;
}
},
);
export const getSchedules = (state: RootState) =>
getForm(state, 'schedules') as BookingProps[];
| opennode/waldur-homeport | src/marketplace/offerings/store/selectors.ts | TypeScript | mit | 3,938 |
namespace SharpCompress.Common.Zip.Headers
{
using System;
using System.Runtime.CompilerServices;
internal class ExtraData
{
[CompilerGenerated]
private byte[] _DataBytes_k__BackingField;
[CompilerGenerated]
private ushort _Length_k__BackingField;
[CompilerGenerated]
private ExtraDataType _Type_k__BackingField;
internal byte[] DataBytes
{
[CompilerGenerated]
get
{
return this._DataBytes_k__BackingField;
}
[CompilerGenerated]
set
{
this._DataBytes_k__BackingField = value;
}
}
internal ushort Length
{
[CompilerGenerated]
get
{
return this._Length_k__BackingField;
}
[CompilerGenerated]
set
{
this._Length_k__BackingField = value;
}
}
internal ExtraDataType Type
{
[CompilerGenerated]
get
{
return this._Type_k__BackingField;
}
[CompilerGenerated]
set
{
this._Type_k__BackingField = value;
}
}
}
}
| RainsSoft/sharpcompress | SharpCompressForUnity3D/SharpCompress/Common/Zip/Headers/ExtraData.cs | C# | mit | 1,330 |
//package org.grain.mongo;
//
//import static org.junit.Assert.assertEquals;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.UUID;
//
//import org.bson.conversions.Bson;
//import org.junit.BeforeClass;
//import org.junit.Test;
//
//import com.mongodb.client.model.Filters;
//
//public class MongodbManagerTest {
//
// @BeforeClass
// public static void setUpBeforeClass() throws Exception {
// MongodbManager.init("172.27.108.73", 27017, "test", "test", "test", null);
// boolean result = MongodbManager.createCollection("test_table");
// if (!result) {
// System.out.println("创建test_table失败");
// }
// TestMongo testMongo = new TestMongo("111", "name");
// result = MongodbManager.insertOne("test_table", testMongo);
// if (!result) {
// System.out.println("插入TestMongo失败");
// }
// }
//
// @Test
// public void testCreateCollection() {
// boolean result = MongodbManager.createCollection("test_table1");
// assertEquals(true, result);
// }
//
// @Test
// public void testInsertOne() {
// TestMongo testMongo = new TestMongo(UUID.randomUUID().toString(), "name");
// boolean result = MongodbManager.insertOne("test_table", testMongo);
// assertEquals(true, result);
// }
//
// @Test
// public void testInsertMany() {
// TestMongo testMongo = new TestMongo(UUID.randomUUID().toString(), "name");
// TestMongo testMongo1 = new TestMongo(UUID.randomUUID().toString(), "name1");
// List<MongoObj> list = new ArrayList<>();
// list.add(testMongo);
// list.add(testMongo1);
// boolean result = MongodbManager.insertMany("test_table", list);
// assertEquals(true, result);
// }
//
// @Test
// public void testFind() {
// List<TestMongo> list = MongodbManager.find("test_table", null, TestMongo.class, 0, 0);
// assertEquals(true, list.size() > 0);
// }
//
// @Test
// public void testDeleteById() {
// TestMongo testMongo = new TestMongo("222", "name");
// boolean result = MongodbManager.insertOne("test_table", testMongo);
// Bson filter = Filters.and(Filters.eq("id", "222"));
// List<TestMongo> list = MongodbManager.find("test_table", filter, TestMongo.class, 0, 0);
// testMongo = list.get(0);
// result = MongodbManager.deleteById("test_table", testMongo);
// assertEquals(true, result);
// }
//
// @Test
// public void testUpdateById() {
// TestMongo testMongo = new TestMongo("333", "name");
// boolean result = MongodbManager.insertOne("test_table", testMongo);
// Bson filter = Filters.and(Filters.eq("id", "333"));
// List<TestMongo> list = MongodbManager.find("test_table", filter, TestMongo.class, 0, 0);
// testMongo = list.get(0);
// testMongo.setName("name" + UUID.randomUUID().toString());
// result = MongodbManager.updateById("test_table", testMongo);
// assertEquals(true, result);
// }
//
// @Test
// public void testCount() {
// long count = MongodbManager.count("test_table", null);
// assertEquals(true, count > 0);
// }
//
//}
| dianbaer/grain | mongodb/src/test/java/org/grain/mongo/MongodbManagerTest.java | Java | mit | 2,935 |
// SharpMath - C# Mathematical Library
// Copyright (c) 2016 Morten Bakkedal
// This code is published under the MIT License.
using System;
using System.IO;
using System.Text;
namespace SharpMath.Samples
{
public static class ImportIpopt
{
public static void Import()
{
// Rename 32/64-bit files so they can be present in the same directory. However, the Ipopt*.dll file
// references IpOptFSS39.dll. Replace the reference in the binary file.
File.Copy(@"D:\Udvikling\SharpMath\Ipopt\Ipopt-3.9.2-win32-win64-dll\Ipopt-3.9.2-win32-win64-dll\lib\win32\release\IpOptFSS39.dll", @"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\IpOptFSS32.dll", true);
File.Copy(@"D:\Udvikling\SharpMath\Ipopt\Ipopt-3.9.2-win32-win64-dll\Ipopt-3.9.2-win32-win64-dll\lib\x64\release\IpOptFSS39.dll", @"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\IpOptFSS64.dll", true);
BinaryReplace(@"D:\Udvikling\SharpMath\Ipopt\Ipopt-3.9.2-win32-win64-dll\Ipopt-3.9.2-win32-win64-dll\lib\win32\release\Ipopt39.dll", @"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\Ipopt32.dll", "IpOptFSS39", "IpOptFSS32");
BinaryReplace(@"D:\Udvikling\SharpMath\Ipopt\Ipopt-3.9.2-win32-win64-dll\Ipopt-3.9.2-win32-win64-dll\lib\x64\release\Ipopt39.dll", @"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\Ipopt64.dll", "IpOptFSS39", "IpOptFSS64");
// Replace back again to verify.
BinaryReplace(@"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\Ipopt32.dll", @"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\Ipopt32_verify.dll", "IpOptFSS32", "IpOptFSS39");
BinaryReplace(@"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\Ipopt64.dll", @"D:\Udvikling\SharpMath\SharpMath\SharpMath.Optimization.Ipopt\Ipopt64_verify.dll", "IpOptFSS64", "IpOptFSS39");
}
private static void BinaryReplace(string sourceFileName, string destinationFileName, string oldValue, string newValue)
{
// Assumes that the 8-bit encodes keep the binary content.
string s = File.ReadAllText(sourceFileName, Encoding.GetEncoding(850));
s = s.Replace(oldValue, newValue);
File.WriteAllText(destinationFileName, s, Encoding.GetEncoding(850));
}
}
}
| mortenbakkedal/SharpMath | SharpMath.Samples/ImportIpopt.cs | C# | mit | 2,274 |
# encoding: utf-8
require "aws-sdk"
# require "aws_ec2_config"
class Amazon::SesAdapter < Amazon::AwsAdapter
def verify_email_identity(email_address)
Rails.logger.debug "do verify_email_identity params=#{email_address}"
create_client.verify_email_identity({email_address: email_address})
end
def delete_identity(email_address)
Rails.logger.debug "do delete_identity params=#{email_address}"
create_client.delete_identity({identity: email_address})
end
def list_verified_email_addresses
Rails.logger.debug "do list_verified_email_addresses"
response = create_client.list_verified_email_addresses
list = response[:verified_email_addresses]
list
end
def list_identities_to_email(opts={})
opts[:identity_type] = "EmailAddress"
ret = self.list_identities opts
ret
end
def list_identities_to_domain(opts={})
opts[:identity_type] = "Domain"
ret = self.list_identities opts
ret
end
def list_identities(opts={})
Rails.logger.debug "do list_identities params=#{opts}"
response = create_client.list_identities opts
ret = {
identities: response[:identities],
next_token: response[:next_token]
}
ret
end
def set_identity_dkim_enabled(indentity, enable)
Rails.logger.debug "do set_identity_dkim_enabled params=#{indentity}, #{enable}"
opts = {identity: indentity, dkim_enabled: enable}
create_client.set_identity_dkim_enabled opts
end
def get_identity_dkim_attributes(*indentity)
Rails.logger.debug "do get_identity_dkim_attributes params=#{indentity}"
opts = {identities: indentity}
response = create_client.get_identity_dkim_attributes opts
response[:dkim_attributes]
end
def get_identity_verification_attributes(*indentity)
Rails.logger.debug "do get_identity_verification_attributes params=#{indentity}"
opts = {identities: indentity}
response = create_client.get_identity_verification_attributes opts
response[:verification_attributes]
end
def verified_email?(email)
res = self.get_identity_verification_attributes email
ret = false
if res.present? && res[email].present?
Rails.logger.debug "#{res[email]}"
if res[email][:verification_status] == "Success"
ret = true
end
end
Rails.logger.info "verified_email? #{email} = #{ret}"
ret
end
def verified_dkim?(identity)
res = self.get_identity_dkim_attributes identity
ret = false
if res.present? && res[identity].present?
Rails.logger.debug "#{res[identity]}"
if res[identity][:dkim_enabled] && res[identity][:dkim_verification_status] == "Success"
ret = true
end
end
Rails.logger.info "verified_dkim? #{identity} = #{ret}"
ret
end
private
def create_client
client = AWS::SimpleEmailService::Client.new
client
end
end | yasuhisa1984/jins_common_rails | app/adapters/amazon/ses_adapter.rb | Ruby | mit | 2,878 |
/**
* The MIT License
*
* Copyright (C) 2012 KK.Kon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkinsci.plugins.job_strongauth_simple;
import hudson.Launcher;
import hudson.Extension;
import hudson.util.FormValidation;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.model.AbstractProject;
import hudson.model.Cause;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.User;
import hudson.tasks.Builder;
import hudson.tasks.BuildStepDescriptor;
import hudson.triggers.TimerTrigger;
import hudson.util.RunList;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.QueryParameter;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
/**
* Sample {@link Builder}.
*
* <p>
* When the user configures the project and enables this builder,
* {@link DescriptorImpl#newInstance(StaplerRequest)} is invoked
* and a new {@link HelloWorldBuilder} is created. The created
* instance is persisted to the project configuration XML by using
* XStream, so this allows you to use instance fields (like {@link #name})
* to remember the configuration.
*
* <p>
* When a build is performed, the {@link #perform(AbstractBuild, Launcher, BuildListener)}
* method will be invoked.
*
* @author KK.Kon
*/
public class JobStrongAuthSimpleBuilder extends Builder {
// default expireTimeInHours
private static final int DEFAULT_EXPIRE_TIME_IN_HOURS = 16;
private Integer getEffectiveExpireTime( final Integer jobValue, final Integer globalValue )
{
if ( null == jobValue && null == globalValue )
{
return DEFAULT_EXPIRE_TIME_IN_HOURS;
}
Integer value = null;
{
if ( null != globalValue )
{
value = globalValue;
}
if ( null != jobValue )
{
value = jobValue;
}
}
return value;
}
private Set<String> makeAuthUsers( final String jobUsers, final boolean useGlobalUsers, final String globalUsers )
{
if ( null == jobUsers && null == globalUsers )
{
return Collections.emptySet();
}
Set<String> set = new HashSet<String>();
if ( null != jobUsers )
{
final String[] users = jobUsers.split(",");
if ( null != users )
{
for ( final String userRaw : users )
{
if ( null != userRaw )
{
final String userTrimed = userRaw.trim();
if ( null != userTrimed )
{
set.add( userTrimed );
}
}
}
}
}
if ( useGlobalUsers )
{
final String[] users = globalUsers.split(",");
if ( null != users )
{
for ( final String userRaw : users )
{
if ( null != userRaw )
{
final String userTrimed = userRaw.trim();
if ( null != userTrimed )
{
set.add( userTrimed );
}
}
}
}
}
return set;
}
private String getUserNameFromCause( final Cause cause )
{
// UserCause deprecated 1.428
Class<?> clazz = null;
Object retval = null;
{
Method method = null;
try
{
clazz = Class.forName("hudson.model.Cause$UserIdCause");
}
catch ( ClassNotFoundException e )
{
}
if ( null != clazz )
{
try
{
method = cause.getClass().getMethod( "getUserName", new Class<?>[]{} );
}
catch ( SecurityException e)
{
}
catch ( NoSuchMethodException e )
{
}
if ( null != method )
{
try
{
retval = method.invoke( cause, new Object[]{} );
}
catch ( IllegalAccessException e )
{
}
catch ( IllegalArgumentException e )
{
}
catch ( InvocationTargetException e )
{
}
}
}
}
if ( null != retval )
{
if ( retval instanceof String )
{
return (String)retval;
}
}
{
Method method = null;
try
{
clazz = Class.forName("hudson.model.Cause$UserCause");
}
catch ( ClassNotFoundException e )
{
}
if ( null != clazz )
{
try
{
method = cause.getClass().getMethod( "getUserName", new Class<?>[]{} );
}
catch ( SecurityException e)
{
}
catch ( NoSuchMethodException e )
{
}
if ( null != method )
{
try
{
retval = method.invoke( cause, new Object[]{} );
}
catch ( IllegalAccessException e )
{
}
catch ( IllegalArgumentException e )
{
}
catch ( InvocationTargetException e )
{
}
}
}
}
if ( null != retval )
{
if ( retval instanceof String )
{
return (String)retval;
}
}
LOGGER.severe( "unknown cause" );
return null;
}
private Cause getCauseFromRun( final Run run )
{
if ( null == run )
{
return null;
}
Class<?> clazz = null;
{
try
{
clazz = Class.forName("hudson.model.Cause$UserIdCause");
if ( null != clazz )
{
// getCause since 1.362
final Cause cause = run.getCause( clazz );
if ( null != cause )
{
return cause;
}
}
}
catch ( ClassNotFoundException e )
{
}
}
{
try
{
clazz = Class.forName("hudson.model.Cause$UserCause");
if ( null != clazz )
{
final Cause cause = run.getCause( clazz );
if ( null != cause )
{
return cause;
}
}
}
catch ( ClassNotFoundException e )
{
}
}
return null;
}
private final String jobUsers;
private final boolean useGlobalUsers;
private final Integer jobMinAuthUserNum;
private final boolean useJobExpireTime;
private final Integer jobExpireTimeInHours;
//private final boolean buildKickByTimerTrigger;
// Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
@DataBoundConstructor
public JobStrongAuthSimpleBuilder(
final String jobUsers
, final boolean useGlobalUsers
, final Integer jobMinAuthUserNum
, final boolean useJobExpireTime
, final Integer jobExpireTimeInHours
// , final boolean buildKickByTimerTrigger
)
{
this.jobUsers = jobUsers;
this.useGlobalUsers = useGlobalUsers;
this.jobMinAuthUserNum = jobMinAuthUserNum;
this.useJobExpireTime = useJobExpireTime;
this.jobExpireTimeInHours = jobExpireTimeInHours;
//this.buildKickByTimerTrigger = buildKickByTimerTrigger;
}
/**
* We'll use this from the <tt>config.jelly</tt>.
*/
public String getJobUsers() {
return jobUsers;
}
public boolean getUseGlobalUsers() {
return useGlobalUsers;
}
public Integer getJobMinAuthUserNum() {
return jobMinAuthUserNum;
}
public boolean getUseJobExpireTime() {
return useJobExpireTime;
}
public Integer getJobExpireTimeInHours() {
return jobExpireTimeInHours;
}
// public Integer getBuildKickByTimerTrigger() {
// return buildKickByTimerTrigger;
// }
@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
// This is where you 'build' the project.
final PrintStream log = listener.getLogger();
{
final String jenkinsVersion = build.getHudsonVersion();
if ( 0 < "1.374".compareTo(jenkinsVersion) )
{
log.println( "jenkins version old. need 1.374 over. Caused by `" + getDescriptor().getDisplayName() + "`" );
build.setResult(Result.FAILURE);
return false;
}
}
{
final Cause cause = getCauseFromRun( build );
if ( null == cause )
{
log.println( "internal error. getCauseFromRun failed. Caused by `" + getDescriptor().getDisplayName() + "`" );
build.setResult(Result.FAILURE);
return false;
}
else
{
final String userName = getUserNameFromCause(cause);
log.println( "userName=" + userName );
if ( null == userName )
{
log.println( "internal error. getUserNameFromCause failed. Caused by `" + getDescriptor().getDisplayName() + "`" );
build.setResult(Result.FAILURE);
return false;
}
else
{
if ( 0 < userName.length() )
{
if ( 0 == "anonymous".compareToIgnoreCase(userName) )
{
build.setResult( Result.ABORTED );
log.println( "reject `anonymous` user's build. Caused by `" + getDescriptor().getDisplayName() + "`" );
return false;
}
}
}
}
}
boolean currentBuildCauseByTimerTrigger = false;
{
final Cause cause = build.getCause(TimerTrigger.TimerTriggerCause.class);
if ( null != cause )
{
if ( cause instanceof TimerTrigger.TimerTriggerCause )
{
final TimerTrigger.TimerTriggerCause causeTimer = (TimerTrigger.TimerTriggerCause)cause;
if ( null != causeTimer )
{
currentBuildCauseByTimerTrigger = true;
}
}
}
}
final Calendar calStart = Calendar.getInstance();
// This also shows how you can consult the global configuration of the builder
final Integer expireTimeInHours = getEffectiveExpireTime( jobExpireTimeInHours, getDescriptor().getExpireTimeInHours() );
LOGGER.finest("expireTimeInHours="+expireTimeInHours+".");
final Set<String> authUsers = makeAuthUsers( this.jobUsers, this.useGlobalUsers, getDescriptor().getUsers() );
LOGGER.finest( "authUsers=" + authUsers );
build.setResult(Result.SUCCESS);
// 1.374 457315f40fb803391f5367d1ac3d50459a6f5020
RunList runList = build.getProject().getBuilds();
LOGGER.finest( "runList=" + runList );
final int currentNumber = build.getNumber();
final Set<String> listUsers = new HashSet<String>();
Calendar calLastBuild = calStart;
for ( final Object r : runList )
{
if ( null == r )
{
continue;
}
if ( r instanceof Run )
{
final Run run = (Run)r;
LOGGER.finest("run: " + run );
/*
// skip current build
if ( currentNumber <= run.getNumber() )
{
log.println( "skip current." );
continue;
}
*/
final Result result = run.getResult();
LOGGER.finest( " result: " + result );
if ( Result.SUCCESS.ordinal == result.ordinal )
{
if ( run.getNumber() < currentNumber )
{
break;
}
}
final Calendar calRun = run.getTimestamp();
if ( this.getUseJobExpireTime() )
{
final long lDistanceInMillis = calLastBuild.getTimeInMillis() - calRun.getTimeInMillis();
final long lDistanceInSeconds = lDistanceInMillis / (1000);
final long lDistanceInMinutes = lDistanceInSeconds / (60);
final long lDistanceInHours = lDistanceInMinutes / (60);
LOGGER.finest( " lDistanceInHours=" + lDistanceInHours );
if ( expireTimeInHours < lDistanceInHours )
{
LOGGER.finest( " expireTimeInHours=" + expireTimeInHours + ",lDistanceInHours=" + lDistanceInHours );
break;
}
}
final Cause cause = getCauseFromRun( run );
if ( null == cause )
{
log.println( "internal error. getCauseFromRun failed. Caused by `" + getDescriptor().getDisplayName() + "`" );
build.setResult(Result.FAILURE);
return false;
}
else
{
final String userName = getUserNameFromCause(cause);
LOGGER.finest( " usercause:" + userName );
if ( null == userName )
{
log.println( "internal error. getUserNameFromCause failed. Caused by `" + getDescriptor().getDisplayName() + "`" );
build.setResult(Result.FAILURE);
return false;
}
else
{
if ( 0 < userName.length() )
{
if ( 0 != "anonymous".compareToIgnoreCase(userName) )
{
listUsers.add( userName );
if ( authUsers.contains( userName ) )
{
calLastBuild = run.getTimestamp();
}
}
}
}
}
}
} // for RunList
LOGGER.finest( "listUsers=" + listUsers );
boolean strongAuth = false;
{
int count = 0;
for ( Iterator<String> it = listUsers.iterator(); it.hasNext(); )
{
final String user = it.next();
if ( null != user )
{
if ( authUsers.contains( user ) )
{
count += 1;
}
}
}
LOGGER.finest( "count=" + count );
if ( null == jobMinAuthUserNum )
{
final int authUserCount = authUsers.size();
LOGGER.finest( "authUserCount=" + authUserCount );
if ( authUserCount <= count )
{
strongAuth = true;
}
}
else
{
LOGGER.finest( "jobMinAuthUserNum=" + jobMinAuthUserNum );
if ( jobMinAuthUserNum.intValue() <= count )
{
strongAuth = true;
}
}
}
if ( strongAuth )
{
boolean doBuild = false;
{
// if ( buildKickByTimerTrigger )
// {
// if ( currentBuildCauseByTimerTrigger )
// {
// // no build
// }
// else
// {
// doBuild = true;
// }
// }
// else
{
doBuild = true;
}
}
if ( doBuild )
{
build.setResult(Result.SUCCESS);
return true;
}
}
log.println( "stop build. number of authed people does not satisfy. Caused by `" + getDescriptor().getDisplayName() + "`" );
build.setResult(Result.NOT_BUILT);
return false;
}
// Overridden for better type safety.
// If your plugin doesn't really define any property on Descriptor,
// you don't have to do this.
@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl)super.getDescriptor();
}
/**
* Descriptor for {@link JobStrongAuthSimpleBuilder}. Used as a singleton.
* The class is marked as public so that it can be accessed from views.
*
* <p>
* See <tt>src/main/resources/hudson/plugins/job_strongauth_simple/JobStrongAuthSimpleBuilder/*.jelly</tt>
* for the actual HTML fragment for the configuration screen.
*/
@Extension // This indicates to Jenkins that this is an implementation of an extension point.
public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
/**
* To persist global configuration information,
* simply store it in a field and call save().
*
* <p>
* If you don't want fields to be persisted, use <tt>transient</tt>.
*/
private Integer expireTimeInHours;
private String users;
public DescriptorImpl() {
load();
{
final Collection<User> userAll = User.getAll();
for ( final User user : userAll )
{
LOGGER.finest( "Id: " + user.getId() );
LOGGER.finest( "DisplayName: " + user.getDisplayName() );
LOGGER.finest( "FullName: " + user.getFullName() );
}
}
}
/**
* Performs on-the-fly validation of the form field 'users'.
*
* @param value
* This parameter receives the value that the user has typed.
* @return
* Indicates the outcome of the validation. This is sent to the browser.
*/
public FormValidation doCheckUsers(@QueryParameter String value)
throws IOException, ServletException {
if ( 0 == value.length() )
{
return FormValidation.ok();
}
final String invalidUser = checkUsers( value );
if ( null != invalidUser )
{
return FormValidation.error("Invalid user: " + invalidUser );
}
return FormValidation.ok();
}
/**
* Performs on-the-fly validation of the form field 'expireTimeInHours'.
*
* @param value
* This parameter receives the value that the user has typed.
* @return
* Indicates the outcome of the validation. This is sent to the browser.
*/
public FormValidation doCheckExpireTimeInHours(@QueryParameter String value)
throws IOException, ServletException {
// if (value.length() == 0)
// return FormValidation.warning("Please set expire time");
if ( 0 == value.length() )
{
return FormValidation.ok();
}
try
{
int intValue = Integer.parseInt(value);
if ( intValue < 0 )
{
return FormValidation.error("Please set positive value");
}
}
catch ( NumberFormatException e )
{
return FormValidation.error("Please set numeric value");
}
return FormValidation.ok();
}
/**
* Performs on-the-fly validation of the form field 'jobExpireTimeInHours'.
*
* @param value
* This parameter receives the value that the user has typed.
* @return
* Indicates the outcome of the validation. This is sent to the browser.
*/
public FormValidation doCheckJobExpireTimeInHours(@QueryParameter String value)
throws IOException, ServletException {
// if (value.length() == 0)
// return FormValidation.warning("Please set expire time");
if ( 0 == value.length() )
{
return FormValidation.ok();
}
try
{
int intValue = Integer.parseInt(value);
if ( intValue < 0 )
{
return FormValidation.error("Please set positive value");
}
}
catch ( NumberFormatException e )
{
return FormValidation.error("Please set numeric value");
}
return FormValidation.ok();
}
/**
* Performs on-the-fly validation of the form field 'jobUsers'.
*
* @param value
* This parameter receives the value that the user has typed.
* @return
* Indicates the outcome of the validation. This is sent to the browser.
*/
public FormValidation doCheckJobUsers(@QueryParameter String value)
throws IOException, ServletException {
if ( 0 == value.length() )
{
return FormValidation.ok();
}
final String invalidUser = checkUsers( value );
if ( null != invalidUser )
{
return FormValidation.error("Invalid user@job: " + invalidUser );
}
return FormValidation.ok();
}
/**
* Performs on-the-fly validation of the form field 'jobMinAuthUserNum'.
*
* @param value
* This parameter receives the value that the user has typed.
* @return
* Indicates the outcome of the validation. This is sent to the browser.
*/
public FormValidation doCheckJobMinAuthUserNum(@QueryParameter String value)
throws IOException, ServletException {
if ( 0 == value.length() )
{
return FormValidation.ok();
}
try
{
int intValue = Integer.parseInt(value);
if ( intValue < 0 )
{
return FormValidation.error("Please set positive value");
}
}
catch ( NumberFormatException e )
{
return FormValidation.error("Please set numeric value");
}
return FormValidation.ok();
}
public boolean isApplicable(Class<? extends AbstractProject> aClass) {
// Indicates that this builder can be used with all kinds of project types
return true;
}
/**
* This human readable name is used in the configuration screen on job.
*/
public String getDisplayName() {
return "StrongAuthSimple for Job";
}
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
// To persist global configuration information,
// set that to properties and call save().
//expireTimeInHours = formData.getInt("expireTimeInHours"); // invoke 500 error
if ( formData.containsKey("expireTimeInHours") )
{
final String value = formData.getString("expireTimeInHours");
if ( null != value )
{
if ( 0 < value.length() )
{
try
{
expireTimeInHours = Integer.parseInt(value);
}
catch ( NumberFormatException e )
{
LOGGER.warning( e.toString() );
return false;
}
}
}
}
if ( formData.containsKey("users") )
{
users = formData.getString("users");
}
// ^Can also use req.bindJSON(this, formData);
// (easier when there are many fields; need set* methods for this, like setUseFrench)
save();
return super.configure(req,formData);
}
/**
* This method returns true if the global configuration says we should speak French.
*
* The method name is bit awkward because global.jelly calls this method to determine
* the initial state of the checkbox by the naming convention.
*/
public Integer getExpireTimeInHours() {
return expireTimeInHours;
}
public String getUsers() {
return users;
}
public String checkUsers( final String value )
{
if ( null == value )
{
return null;
}
final Collection<User> userAll = User.getAll();
String invalidUser = null;
if ( null != userAll )
{
final String[] inputUsers = value.split(",");
if ( null == inputUsers )
{
final String userTrimed = value.trim();
boolean validUser = false;
for ( final User user : userAll )
{
if ( null != user )
{
final String dispName = user.getDisplayName();
if ( null != dispName )
{
if ( 0 == userTrimed.compareTo(dispName) )
{
validUser = true;
break;
}
}
}
} // for userAll
if ( validUser )
{
// nothing
}
else
{
invalidUser = userTrimed;
}
}
else
{
for ( final String userRaw : inputUsers )
{
if ( null != userRaw )
{
final String userTrimed = userRaw.trim();
boolean validUser = false;
for ( final User user : userAll )
{
if ( null != user )
{
final String dispName = user.getDisplayName();
if ( null != dispName )
{
if ( 0 == userTrimed.compareTo(dispName) )
{
validUser = true;
break;
}
}
}
} // for userAll
if ( validUser )
{
// nothing
}
else
{
invalidUser = userTrimed;
}
if ( null != invalidUser )
{
break;
}
}
}
}
}
return invalidUser;
}
}
private static final Logger LOGGER = Logger.getLogger(JobStrongAuthSimpleBuilder.class.getName());
}
| kkkon/job-strongauth-simple-plugin | src/main/java/org/jenkinsci/plugins/job_strongauth_simple/JobStrongAuthSimpleBuilder.java | Java | mit | 31,334 |
/*
* The MIT License
*
* Copyright 2016 Matthias.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.lutana.easyflickrbackup;
import com.flickr4java.flickr.photos.Size;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class ImageSizes {
private Map<Integer,String> suffix;
public ImageSizes() {
suffix = new HashMap<>();
suffix.put(Size.SQUARE, "_s");
suffix.put(Size.SQUARE_LARGE, "_q");
suffix.put(Size.THUMB, "_t");
suffix.put(Size.SMALL, "_m");
suffix.put(Size.SMALL_320, "_n");
suffix.put(Size.MEDIUM, "");
suffix.put(Size.MEDIUM_640, "_z");
suffix.put(Size.MEDIUM_800, "_c");
suffix.put(Size.LARGE, "_b");
suffix.put(Size.LARGE_1600, "_h");
suffix.put(Size.LARGE_2048, "_k");
suffix.put(Size.ORIGINAL, "_o");
}
public String getSuffix(int size) {
try {
return suffix.get(size);
} catch(Exception e) {
return null;
}
}
}
| lutana-de/easyflickrbackup | src/main/java/de/lutana/easyflickrbackup/ImageSizes.java | Java | mit | 2,063 |
/**
* Copyright (c) 2011 Prashant Dighe
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package com.example.demo.model.impl;
import java.util.HashMap;
import java.util.Map;
import com.example.demo.model.RegisteredDriver;
/**
*
* @author Prashant Dighe
*
*/
public class RegisteredDriverImpl implements RegisteredDriver {
public RegisteredDriverImpl() {}
public RegisteredDriverImpl(Map<String, Object> map) {
_name = (String)map.get("name");
_age = (Integer)map.get("age");
}
@Override
public String getName() {
return _name;
}
@Override
public void setName(String name) {
_name = name;
}
@Override
public int getAge() {
return _age;
}
@Override
public void setAge(int age) {
_age = age;
}
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", _name);
map.put("age", _age);
return map;
}
private String _name = null;
private int _age = 0;
private static final long serialVersionUID = 1L;
} | pdd/mongoj | test/src/java/custom/com/example/demo/model/impl/RegisteredDriverImpl.java | Java | mit | 2,066 |
<?php
return array(
'friends:all' => 'Wszyscy znajomi',
'notifications:subscriptions:personal:description' => '',
'notifications:subscriptions:personal:title' => 'Powiadomienia osobiste',
'notifications:subscriptions:friends:title' => 'Znajomi',
'notifications:subscriptions:friends:description' => '',
'notifications:subscriptions:collections:edit' => 'Aby edytować swoje powiadomienia o dzielonym dostępie, kliknij tutaj.',
'notifications:subscriptions:changesettings' => 'Powiadomienia',
'notifications:subscriptions:changesettings:groups' => 'Powiadomienia grupowe',
'notifications:subscriptions:title' => 'Powiadomienia o użytkowniku',
'notifications:subscriptions:description' => '',
'notifications:subscriptions:groups:description' => '',
'notifications:subscriptions:success' => 'Twoje ustawienia powiadomień zostały zapisane.',
);
| Srokap/polish_translation | mod/notifications/languages/pl.php | PHP | mit | 866 |
namespace _03EmployeeData
{
using System;
public class Program
{
public static void Main()
{
var name = Console.ReadLine();
var age = int.Parse(Console.ReadLine());
var employeeID = int.Parse(Console.ReadLine());
var monthlySalary = double.Parse(Console.ReadLine());
Console.WriteLine($"Name: {name}");
Console.WriteLine($"Age: {age}");
Console.WriteLine($"Employee ID: {employeeID:D8}");
Console.WriteLine($"Salary: {monthlySalary:f2}");
}
}
}
| DannyBerova/Exercises-Programming-Fundamentals-Extended-May-2017 | ExerciseIntroAndBasicSyntax/03EmployeeData/03EmployeeData.cs | C# | mit | 588 |
define(function (require) {
require('plugins/timelion/directives/expression_directive');
const module = require('ui/modules').get('kibana/timelion_vis', ['kibana']);
module.controller('TimelionVisParamsController', function ($scope, $rootScope) {
$scope.vis.params.expression = $scope.vis.params.expression || '.es(*)';
$scope.vis.params.interval = $scope.vis.params.interval || '1m';
$scope.search = function () {
$rootScope.$broadcast('courier:searchRefresh');
};
});
});
| istresearch/PulseTheme | kibana/src/core_plugins/timelion/public/vis/timelion_vis_params_controller.js | JavaScript | mit | 507 |
using System;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using SData.Internal;
namespace SData.Compiler
{
internal static class CSEX
{
internal static readonly string[] SchemaNamespaceAttributeNameParts = new string[] { "SchemaNamespaceAttribute", "SData" };
internal static readonly string[] __CompilerSchemaNamespaceAttributeNameParts = new string[] { "__CompilerSchemaNamespaceAttribute", "SData" };
internal static readonly string[] SchemaClassAttributeNameParts = new string[] { "SchemaClassAttribute", "SData" };
internal static readonly string[] SchemaPropertyAttributeNameParts = new string[] { "SchemaPropertyAttribute", "SData" };
internal static readonly string[] IgnoreCaseStringNameParts = new string[] { "IgnoreCaseString", "SData" };
internal static readonly string[] BinaryNameParts = new string[] { "Binary", "SData" };
internal static int MapNamespaces(NamespaceInfoMap nsInfoMap, IAssemblySymbol assSymbol, bool isRef)
{
var count = 0;
foreach (AttributeData attData in assSymbol.GetAttributes())
{
if (attData.AttributeClass.FullNameEquals(isRef ? __CompilerSchemaNamespaceAttributeNameParts : SchemaNamespaceAttributeNameParts))
{
var ctorArgs = attData.ConstructorArguments;
string uri = null, dottedString = null;
var ctorArgsLength = ctorArgs.Length;
if (ctorArgsLength >= 2)
{
uri = ctorArgs[0].Value as string;
if (uri != null)
{
dottedString = ctorArgs[1].Value as string;
}
}
if (dottedString == null)
{
if (isRef)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.Invalid__CompilerSchemaNamespaceAttribute,
assSymbol.Identity.Name), default(TextSpan));
}
else
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaNamespaceAttribute),
GetTextSpan(attData));
}
}
NamespaceInfo nsInfo;
if (!nsInfoMap.TryGetValue(uri, out nsInfo))
{
if (isRef)
{
continue;
}
else
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaNamespaceAttributeUri, uri),
GetTextSpan(attData));
}
}
if (nsInfo.DottedName != null)
{
if (isRef)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.Duplicate__CompilerSchemaNamespaceAttributeUri,
uri, assSymbol.Identity.Name), default(TextSpan));
}
else
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.DuplicateSchemaNamespaceAttributeUri, uri),
GetTextSpan(attData));
}
}
CSDottedName dottedName;
if (!CSDottedName.TryParse(dottedString, out dottedName))
{
if (isRef)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.Invalid__CompilerSchemaNamespaceAttributeNamespaceName,
dottedString, assSymbol.Identity.Name), default(TextSpan));
}
else
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaNamespaceAttributeNamespaceName, dottedString),
GetTextSpan(attData));
}
}
nsInfo.DottedName = dottedName;
nsInfo.IsRef = isRef;
++count;
if (isRef)
{
if (ctorArgsLength >= 4)
{
var ca2 = ctorArgs[2];
var ca3 = ctorArgs[3];
nsInfo.SetRefData(ca2.IsNull ? null : ca2.Values.Select(i => i.Value as string),
ca3.IsNull ? null : ca3.Values.Select(i => i.Value as string));
}
else
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.Invalid__CompilerSchemaNamespaceAttribute,
assSymbol.Identity.Name), default(TextSpan));
}
}
}
}
return count;
}
internal static string GetFirstArgumentAsString(AttributeData attData)
{
var ctorArgs = attData.ConstructorArguments;
if (ctorArgs.Length > 0)
{
return ctorArgs[0].Value as string;
}
return null;
}
internal static void MapGlobalTypes(NamespaceInfoMap nsInfoMap, INamespaceSymbol nsSymbol)
{
if (!nsSymbol.IsGlobalNamespace)
{
foreach (var nsInfo in nsInfoMap.Values)
{
if (nsSymbol.FullNameEquals(nsInfo.DottedName.NameParts))
{
var typeSymbolList = nsSymbol.GetMembers().OfType<INamedTypeSymbol>().Where(i => i.TypeKind == Microsoft.CodeAnalysis.TypeKind.Class).ToList();
for (var i = 0; i < typeSymbolList.Count;)
{
var typeSymbol = typeSymbolList[i];
var clsAttData = typeSymbol.GetAttributeData(SchemaClassAttributeNameParts);
if (clsAttData != null)
{
if (typeSymbol.IsGenericType)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeGeneric), GetTextSpan(typeSymbol));
}
if (typeSymbol.IsStatic)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeStatic), GetTextSpan(typeSymbol));
}
var clsName = GetFirstArgumentAsString(clsAttData);
if (clsName == null)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaClassAttribute), GetTextSpan(clsAttData));
}
var clsInfo = nsInfo.TryGetGlobalType<ClassTypeInfo>(clsName);
if (clsInfo == null)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaClassAttributeName, clsName), GetTextSpan(clsAttData));
}
if (clsInfo.Symbol != null)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.DuplicateSchemaClassAttributeName, clsName), GetTextSpan(clsAttData));
}
if (!clsInfo.IsAbstract)
{
if (typeSymbol.IsAbstract)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.NonAbstractSchemaClassRequired),
GetTextSpan(typeSymbol));
}
if (!typeSymbol.HasParameterlessConstructor())
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.ParameterlessConstructorRequired),
GetTextSpan(typeSymbol));
}
}
clsInfo.Symbol = typeSymbol;
typeSymbolList.RemoveAt(i);
continue;
}
++i;
}
foreach (var typeSymbol in typeSymbolList)
{
if (!typeSymbol.IsGenericType)
{
var clsName = typeSymbol.Name;
var clsInfo = nsInfo.TryGetGlobalType<ClassTypeInfo>(clsName);
if (clsInfo != null)
{
if (clsInfo.Symbol == null)
{
if (typeSymbol.IsStatic)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeStatic), GetTextSpan(typeSymbol));
}
if (!clsInfo.IsAbstract)
{
if (typeSymbol.IsAbstract)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.NonAbstractSchemaClassRequired),
GetTextSpan(typeSymbol));
}
if (!typeSymbol.HasParameterlessConstructor())
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.ParameterlessConstructorRequired),
GetTextSpan(typeSymbol));
}
}
clsInfo.Symbol = typeSymbol;
}
}
}
}
}
}
}
foreach (var subNsSymbol in nsSymbol.GetNamespaceMembers())
{
MapGlobalTypes(nsInfoMap, subNsSymbol);
}
}
#region
internal static TextSpan GetTextSpan(AttributeData attData)
{
if (attData != null)
{
return GetTextSpan(attData.ApplicationSyntaxReference);
}
return default(TextSpan);
}
internal static TextSpan GetTextSpan(SyntaxReference sr)
{
if (sr != null)
{
return GetTextSpan(sr.GetSyntax().GetLocation());
}
return default(TextSpan);
}
internal static TextSpan GetTextSpan(ISymbol symbol)
{
if (symbol != null)
{
var locations = symbol.Locations;
if (locations.Length > 0)
{
return GetTextSpan(locations[0]);
}
}
return default(TextSpan);
}
internal static TextSpan GetTextSpan(Location location)
{
if (location != null && location.IsInSource)
{
var csLineSpan = location.GetLineSpan();
if (csLineSpan.IsValid)
{
var csTextSpan = location.SourceSpan;
return new TextSpan(csLineSpan.Path, csTextSpan.Start, csTextSpan.Length,
ToTextPosition(csLineSpan.StartLinePosition), ToTextPosition(csLineSpan.EndLinePosition));
}
}
return default(TextSpan);
}
private static TextPosition ToTextPosition(this LinePosition csPosition)
{
return new TextPosition(csPosition.Line + 1, csPosition.Character + 1);
}
#endregion
internal static bool IsAtomType(TypeKind typeKind, ITypeSymbol typeSymbol)
{
switch (typeKind)
{
case TypeKind.String:
return typeSymbol.SpecialType == SpecialType.System_String;
case TypeKind.IgnoreCaseString:
return typeSymbol.FullNameEquals(IgnoreCaseStringNameParts);
case TypeKind.Char:
return typeSymbol.SpecialType == SpecialType.System_Char;
case TypeKind.Decimal:
return typeSymbol.SpecialType == SpecialType.System_Decimal;
case TypeKind.Int64:
return typeSymbol.SpecialType == SpecialType.System_Int64;
case TypeKind.Int32:
return typeSymbol.SpecialType == SpecialType.System_Int32;
case TypeKind.Int16:
return typeSymbol.SpecialType == SpecialType.System_Int16;
case TypeKind.SByte:
return typeSymbol.SpecialType == SpecialType.System_SByte;
case TypeKind.UInt64:
return typeSymbol.SpecialType == SpecialType.System_UInt64;
case TypeKind.UInt32:
return typeSymbol.SpecialType == SpecialType.System_UInt32;
case TypeKind.UInt16:
return typeSymbol.SpecialType == SpecialType.System_UInt16;
case TypeKind.Byte:
return typeSymbol.SpecialType == SpecialType.System_Byte;
case TypeKind.Double:
return typeSymbol.SpecialType == SpecialType.System_Double;
case TypeKind.Single:
return typeSymbol.SpecialType == SpecialType.System_Single;
case TypeKind.Boolean:
return typeSymbol.SpecialType == SpecialType.System_Boolean;
case TypeKind.Binary:
return typeSymbol.FullNameEquals(BinaryNameParts);
case TypeKind.Guid:
return typeSymbol.FullNameEquals(CS.GuidNameParts);
case TypeKind.TimeSpan:
return typeSymbol.FullNameEquals(CS.TimeSpanNameParts);
case TypeKind.DateTimeOffset:
return typeSymbol.FullNameEquals(CS.DateTimeOffsetNameParts);
default:
throw new ArgumentException("Invalid type kind: " + typeKind.ToString());
}
}
internal static ExpressionSyntax AtomValueLiteral(TypeKind typeKind, object value)
{
switch (typeKind)
{
case TypeKind.String:
return CS.Literal((string)value);
case TypeKind.IgnoreCaseString:
return Literal((IgnoreCaseString)value);
case TypeKind.Char:
return CS.Literal((char)value);
case TypeKind.Decimal:
return CS.Literal((decimal)value);
case TypeKind.Int64:
return CS.Literal((long)value);
case TypeKind.Int32:
return CS.Literal((int)value);
case TypeKind.Int16:
return CS.Literal((short)value);
case TypeKind.SByte:
return CS.Literal((sbyte)value);
case TypeKind.UInt64:
return CS.Literal((ulong)value);
case TypeKind.UInt32:
return CS.Literal((uint)value);
case TypeKind.UInt16:
return CS.Literal((ushort)value);
case TypeKind.Byte:
return CS.Literal((byte)value);
case TypeKind.Double:
return CS.Literal((double)value);
case TypeKind.Single:
return CS.Literal((float)value);
case TypeKind.Boolean:
return CS.Literal((bool)value);
case TypeKind.Binary:
return Literal((Binary)value);
case TypeKind.Guid:
return CS.Literal((Guid)value); ;
case TypeKind.TimeSpan:
return CS.Literal((TimeSpan)value); ;
case TypeKind.DateTimeOffset:
return CS.Literal((DateTimeOffset)value); ;
default:
throw new ArgumentException("Invalid type kind: " + typeKind.ToString());
}
}
internal static string ToValidId(string s)
{
if (string.IsNullOrEmpty(s))
{
return s;
}
var sb = StringBuilderBuffer.Acquire();
foreach (var ch in s)
{
if (SyntaxFacts.IsIdentifierPartCharacter(ch))
{
sb.Append(ch);
}
else
{
sb.Append('_');
}
}
return sb.ToStringAndRelease();
}
internal static string SDataProgramName(string assName)
{
return "SData_" + ToValidId(assName);
}
internal static AliasQualifiedNameSyntax SDataName
{
get { return CS.GlobalAliasQualifiedName("SData"); }
}
internal static QualifiedNameSyntax __CompilerSchemaNamespaceAttributeName
{
get { return CS.QualifiedName(SDataName, "__CompilerSchemaNamespaceAttribute"); }
}
internal static MemberAccessExpressionSyntax ProgramMdExpr
{
get { return CS.MemberAccessExpr(SDataName, "ProgramMd"); }
}
internal static QualifiedNameSyntax GlobalTypeMdName
{
get { return CS.QualifiedName(SDataName, "GlobalTypeMd"); }
}
internal static ArrayTypeSyntax GlobalTypeMdArrayType
{
get { return CS.OneDimArrayType(GlobalTypeMdName); }
}
internal static QualifiedNameSyntax EnumTypeMdName
{
get { return CS.QualifiedName(SDataName, "EnumTypeMd"); }
}
internal static QualifiedNameSyntax ClassTypeMdName
{
get { return CS.QualifiedName(SDataName, "ClassTypeMd"); }
}
internal static QualifiedNameSyntax PropertyMdName
{
get { return CS.QualifiedName(SDataName, "PropertyMd"); }
}
internal static QualifiedNameSyntax KeyMdName
{
get { return CS.QualifiedName(SDataName, "KeyMd"); }
}
internal static ArrayTypeSyntax KeyMdArrayType
{
get { return CS.OneDimArrayType(KeyMdName); }
}
internal static QualifiedNameSyntax NullableTypeMdName
{
get { return CS.QualifiedName(SDataName, "NullableTypeMd"); }
}
internal static QualifiedNameSyntax GlobalTypeRefMdName
{
get { return CS.QualifiedName(SDataName, "GlobalTypeRefMd"); }
}
internal static QualifiedNameSyntax CollectionTypeMdName
{
get { return CS.QualifiedName(SDataName, "CollectionTypeMd"); }
}
internal static ExpressionSyntax Literal(TypeKind value)
{
return CS.MemberAccessExpr(CS.MemberAccessExpr(SDataName, "TypeKind"), value.ToString());
}
internal static QualifiedNameSyntax FullNameName
{
get { return CS.QualifiedName(SDataName, "FullName"); }
}
internal static ExpressionSyntax Literal(FullName value)
{
return CS.NewObjExpr(FullNameName, CS.Literal(value.Uri), CS.Literal(value.Name));
}
internal static QualifiedNameSyntax IgnoreCaseStringName
{
get { return CS.QualifiedName(SDataName, "IgnoreCaseString"); }
}
internal static ExpressionSyntax Literal(IgnoreCaseString value)
{
return CS.NewObjExpr(IgnoreCaseStringName, CS.Literal(value.Value), CS.Literal(value.IsReadOnly));
}
internal static QualifiedNameSyntax BinaryName
{
get { return CS.QualifiedName(SDataName, "Binary"); }
}
internal static ExpressionSyntax Literal(Binary value)
{
return CS.NewObjExpr(BinaryName, CS.Literal(value.ToBytes()), CS.Literal(value.IsReadOnly));
}
internal static QualifiedNameSyntax LoadingContextName
{
get { return CS.QualifiedName(SDataName, "LoadingContext"); }
}
internal static MemberAccessExpressionSyntax SerializerExpr
{
get { return CS.MemberAccessExpr(SDataName, "Serializer"); }
}
internal static MemberAccessExpressionSyntax ExtensionsExpr
{
get { return CS.MemberAccessExpr(SDataName, "Extensions"); }
}
internal static MemberAccessExpressionSyntax AtomTypeMdExpr
{
get { return CS.MemberAccessExpr(SDataName, "AtomTypeMd"); }
}
}
}
| knat/SData | Src/SData.Compiler/CSEX.cs | C# | mit | 22,229 |
#include <bits/stdc++.h>
using namespace std;
void solve() {
string s; cin >> s;
reverse(s.begin(), s.end());
vector<string> pre = {"dream", "dreamer", "erase", "eraser"};
for (auto& x: pre) {
reverse(x.begin(), x.end());
}
int i = 0, n = s.size();
while (i < n) {
if (s.substr(i, 5) == pre[0] || s.substr(i, 5) == pre[2])
i += 5;
else if (s.substr(i, 6) == pre[3])
i += 6;
else if (s.substr(i, 7) == pre[1])
i += 7;
else {
cout << "NO"; return;
}
}
cout << "YES";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
cout << endl;
}
| sogapalag/problems | atcoder/arc065c.cpp | C++ | mit | 706 |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ask My Doctors | Pasien</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link href="<?php echo base_url('assets/admin/css/bootstrap.min.css'); ?>" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="<?php echo base_url('assets/admin/css/font-awesome.min.css'); ?>" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="<?php echo base_url('assets/admin/css/ionicons.min.css'); ?>" rel="stylesheet" type="text/css" />
<!-- DataTables -->
<link rel="stylesheet" href="<?php echo base_url('assets/admin/datatables/dataTables.bootstrap.css'); ?>"/>
<link rel="stylesheet" href="<?php echo base_url('assets/admin/js/plugins/datepicker/datepicker3.css'); ?>"/>
<!-- Theme style -->
<link href="<?php echo base_url('assets/admin/css/AdminLTE.min.css'); ?>" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="<?php echo base_url('assets/admin/css/skins/_all-skins.min.css'); ?>" rel="stylesheet" type="text/css" />
</head>
<body class="skin-red">
<div class="wrapper">
<?php
include_once('include/header.php');
include_once('include/sidebar.php');
?>
<!-- Right side column. Contains the navbar and content of the page -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Pertanyaan
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo base_url(); ?>/admin"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">Pertanyaan</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<!-- <button class="btn btn-danger btn-flat btn-new" >+ Tambah Dokter</button> -->
</div>
<div class="box-body">
<table id="datatable" class="table table-bordered table-striped">
<thead>
<tr>
<th>No</th>
<th>Judul</th>
<th>Pertanyaan</th>
<th>Tanggal</th>
<th>Pengirim</th>
<th>Status</th>
<th>Notif</th>
</tr>
</thead>
<tbody>
<?php
if ($pertanyaan != null) {
$no = 0;
foreach ($pertanyaan as $key) {
$no++;
echo "<tr>
<td>".$no."</td>
<td>".$key->judul."</td>
<td>".$key->pertanyaan."</td>
<td>".$key->waktu_kirim."</td>
<td>".$key->pengirim."</td>
<td>";
if ($key->status == 'BELUM TERJAWAB')
echo '<span class="label label-warning">BELUM TERJAWAB</span>';
if ($key->status == 'TERJAWAB')
echo '<span class="label label-primary">TERJAWAB</span>';
echo "</td>";
echo '<td><button class="btn btn-danger btn-xs btn-notif" onclick="sendNotif('. $key->id_diskusi .')"><i class="fa fa-bell"></i></button></td>';
echo "</tr>";
}
}else{
echo '<tr><td colspan="12">Data tidak ditemukan</td></tr>';
}
?>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<?php include_once('include/footer.php'); ?>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.3 -->
<script src="<?php echo base_url('assets/admin/js/plugins/jQuery/jQuery-2.1.3.min.js'); ?>"></script>
<!-- Bootstrap 3.3.2 JS -->
<script src="<?php echo base_url('assets/admin/js/bootstrap.min.js'); ?>" type="text/javascript"></script>
<!-- DataTables -->
<script src="<?php echo base_url('assets/admin/datatables/jquery.dataTables.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/admin/js/plugins/datepicker/bootstrap-datepicker.js'); ?>"></script>
<script src="<?php echo base_url('assets/admin/js/plugins/bootstrap-growl/jquery.bootstrap-growl.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/admin/datatables/dataTables.bootstrap.min.js'); ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('assets/admin/js/plugins/fastclick/fastclick.min.js'); ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('assets/admin/js/AdminLTE/app.min.js'); ?>" type="text/javascript"></script>
<!-- SlimScroll 1.3.0 -->
<script src="<?php echo base_url('assets/admin/js/plugins/slimScroll/jquery.slimscroll.min.js'); ?>" type="text/javascript"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('assets/admin/js/AdminLTE/demo.js'); ?>"></script>
<!-- page script -->
<script>
$(function () {
$("#datatable").DataTable({
"scrollX":true,
"processing": true,
"columnDefs": [
{ "width": "2%", "targets": 0 },
{ "width": "13%", "targets": 1 },
{ "width": "33%", "targets": 2 },
{ "width": "12%", "targets": 3 },
{ "width": "10%", "targets": 4 },
{ "width": "2%", "targets": 5 },
{ "width": "2%", "targets": 6 }
]
});
// $("#datatable").DataTable({
// "scrollX":true,
// "processing": true
// });
});
function sendNotif($id){
var r = confirm("Apakah anda yakin untuk mengirim notifikasi?");
if (r == false) {
return false
}
var id_pertanyaan = $id;
$.ajax({
async: true,
type: 'post',
url: '<?= base_url(); ?>admin/kirimNotif',
data: 'id_pertanyaan=' + id_pertanyaan,
dataType: 'json',
success: function (resp) {
if (resp.success == 1) {
$.bootstrapGrowl("Berhasil mengirimkan notifikasi!", {type: 'success'});
location.reload();
} else if (resp.success == 0) {
$.bootstrapGrowl("Gagal mengirimkan notifikasi", {type: 'danger'});
location.reload();
}
}
});
}
</script>
</body>
</html> | meliafitriawati/askmydoctors | application/views/admin/pertanyaan.php | PHP | mit | 8,869 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("12IndexOfletters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("12IndexOfletters")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3f84bcf8-e099-406f-9ab2-d4b80ecdc733")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| ReniGetskova/CSharp-Part-2 | Arrays/12IndexOfletters/Properties/AssemblyInfo.cs | C# | mit | 1,408 |
using System;
using System.Drawing;
using System.Linq;
using System.Threading;
using Emgu.CV.Structure;
using System.Threading.Tasks;
namespace Pentacorn
{
static class IObservableEx
{
public static async Task<T> TakeNext<T>(this IObservable<T> observable)
{
return (await observable.Take(1)).First();
}
public static IObservable<Unit> Select<T>(this IObservable<T> observable)
{
return observable.Select(t => default(Unit));
}
public static IObservable<Picture<Gray, byte>> AddRef(this IObservable<Picture<Gray, byte>> observable)
{
return Observable.CreateWithDisposable<Picture<Gray, byte>>(observer =>
{
return observable.Subscribe(
p =>
{
if (p == null || p.IsDisposed)
return; // Todo, major hack;
p.AddRefs(1);
observer.OnNext(p);
},
e => observer.OnError(e),
() => observer.OnCompleted());
});
}
public static IObservable<PointF[]> FindChessboardSaddles(this IObservable<Picture<Gray, byte>> observable, Chessboard chessboard)
{
int searching = 0;
return Observable.CreateWithDisposable<PointF[]>(observer =>
{
return observable.Subscribe(
async p =>
{
if (0 == Interlocked.CompareExchange(ref searching, 1, 0))
{
p.Dispose();
}
else
{
var saddles = await p.FindChessboardCornersAsync(chessboard.SaddleCount);
// Todo, should use a proper using statement, seems to not work
// so great with await. Probably my fault rather than a CTP problem, but
// don't want to dig to deep right now.
p.Dispose();
if (saddles != null)
observer.OnNext(saddles);
searching = 0;
}
},
e => observer.OnError(e),
() => observer.OnCompleted());
});
}
public static IObservable<T> Using<T>(this IObservable<T> observable) where T : IDisposable
{
return observable.SelectMany(d =>
{
return Observable.Using(() => d, e =>
{
return Observable.Return(e);
});
});
}
}
}
| JaapSuter/Pentacorn | Backup/Pentacorn/IObservableEx.cs | C# | mit | 2,968 |
require 'active_support/core_ext/class/attribute'
module Travis
module Github
module Sync
# Fetches all repositories from Github which are in /user/repos or any of the user's
# orgs/[name]/repos. Creates or updates existing repositories on our side and adds
# it to the user's permissions. Also removes existing permissions for repositories
# which are not in the received Github data. NOTE that this does *not* delete any
# repositories because we do not know if the repository was deleted or renamed
# on Github's side.
class Repositories
extend Travis::Instrumentation
include Travis::Logging
class_attribute :type
self.type = 'public'
class << self
def private?
self.type == 'private'
end
end
attr_reader :user, :resources, :data
def initialize(user)
@user = user
@resources = ['user/repos'] + user.organizations.map { |org| "orgs/#{org.login}/repos" }
end
def run
with_github do
{ :synced => create_or_update, :removed => remove }
end
end
instrument :run
private
def create_or_update
data.map do |repository|
Repository.new(user, repository).run
end
end
def remove
repos = user.repositories.select { |repo| !slugs.include?(repo.slug) }
Repository.unpermit_all(user, repos)
repos
end
# we have to filter these ourselves because the github api is broken for this
def data
@data ||= fetch.select { |repo| repo['private'] == self.class.private? }
end
def slugs
@slugs ||= data.map { |repo| "#{repo['owner']['login']}/#{repo['name']}" }
end
def fetch
resources.map { |resource| fetch_resource(resource) }.map(&:to_a).flatten.compact
end
instrument :fetch, :level => :debug
def fetch_resource(resource)
GH[resource] # should be: ?type=#{self.class.type}
rescue Faraday::Error::ResourceNotFound => e
log_exception(e)
end
def with_github(&block)
# TODO in_parallel should return the block's result in a future version
result = nil
GH.with(:token => user.github_oauth_token) do
# GH.in_parallel do
result = yield
# end
end
result
end
Travis::Notification::Instrument::Github::Sync::Repositories.attach_to(self)
end
end
end
end
| travis-repos/travis-core | lib/travis/github/sync/repositories.rb | Ruby | mit | 2,707 |
import sys
import petsc4py
petsc4py.init(sys.argv)
from ecoli_in_pipe import head_tail
# import numpy as np
# from scipy.interpolate import interp1d
# from petsc4py import PETSc
# from ecoli_in_pipe import single_ecoli, ecoliInPipe, head_tail, ecoli_U
# from codeStore import ecoli_common
#
#
# def call_head_tial(uz_factor=1., wz_factor=1.):
# PETSc.Sys.Print('')
# PETSc.Sys.Print('################################################### uz_factor = %f, wz_factor = %f' %
# (uz_factor, wz_factor))
# t_head_U = head_U.copy()
# t_tail_U = tail_U.copy()
# t_head_U[2] = t_head_U[2] * uz_factor
# t_tail_U[2] = t_tail_U[2] * uz_factor
# # C1 = t_head_U[5] - t_tail_U[5]
# # C2 = t_head_U[5] / t_tail_U[5]
# # t_head_U[5] = wz_factor * C1 * C2 / (wz_factor * C2 - 1)
# # t_tail_U[5] = C1 / (wz_factor * C2 - 1)
# t_head_U[5] = wz_factor * t_head_U[5]
# t_kwargs = {'head_U': t_head_U,
# 'tail_U': t_tail_U, }
# total_force = head_tail.main_fun()
# return total_force
#
#
# OptDB = PETSc.Options()
# fileHandle = OptDB.getString('f', 'ecoliInPipe')
# OptDB.setValue('f', fileHandle)
# main_kwargs = {'fileHandle': fileHandle}
# # head_U, tail_U, ref_U = ecoli_common.ecoli_restart(**main_kwargs)
# # ecoli_common.ecoli_restart(**main_kwargs)
# head_U = np.array([0, 0, 1, 0, 0, 1])
# tail_U = np.array([0, 0, 1, 0, 0, 1])
# call_head_tial()
head_tail.main_fun()
| pcmagic/stokes_flow | ecoli_in_pipe/wrapper_head_tail.py | Python | mit | 1,450 |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Cache Status.
*
* The Initial Developer of the Original Code is
* Jason Purdy.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Thanks to the Fasterfox Extension for some pointers
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function cs_updated_stat( type, aDeviceInfo, prefs ) {
var current = round_memory_usage( aDeviceInfo.totalSize/1024/1024 );
var max = round_memory_usage( aDeviceInfo.maximumSize/1024/1024 );
var cs_id = 'cachestatus';
var bool_pref_key = 'auto_clear';
var int_pref_key = 'ac';
var clear_directive;
if ( type == 'memory' ) {
cs_id += '-ram-label';
bool_pref_key += '_ram';
int_pref_key += 'r_percent';
clear_directive = 'ram';
// this is some sort of random bug workaround
if ( current > max && current == 4096 ) {
current = 0;
}
} else if ( type == 'disk' ) {
cs_id += '-hd-label';
bool_pref_key += '_disk';
int_pref_key += 'd_percent';
clear_directive = 'disk';
} else {
// offline ... or something else we don't manage
return;
}
/*
dump( 'type: ' + type + ' - aDeviceInfo' + aDeviceInfo );
// do we need to auto-clear?
dump( "evaling if we need to auto_clear...\n" );
dump( bool_pref_key + ": " + prefs.getBoolPref( bool_pref_key ) + " and " +
(( current/max )*100) + " > " +
prefs.getIntPref( int_pref_key ) + "\n" );
dump( "new min level: " + prefs.getIntPref( int_pref_key )*.01*max + " > 10\n" );
*/
/*
This is being disabled for now:
http://code.google.com/p/cachestatus/issues/detail?id=10
*/
/*
if (
prefs.getBoolPref( bool_pref_key ) &&
prefs.getIntPref( int_pref_key )*.01*max > 10 &&
(( current/max )*100) > prefs.getIntPref( int_pref_key )
) {
//dump( "clearing!\n" );
cs_clear_cache( clear_directive, 1 );
current = 0;
}
*/
// Now, update the status bar label...
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
if (win) {
win.document.getElementById(cs_id).setAttribute(
'value', current + " MB / " + max + " MB " );
}
}
function update_cache_status() {
var cache_service = Components.classes["@mozilla.org/network/cache-service;1"]
.getService(Components.interfaces.nsICacheService);
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var prefs = prefService.getBranch("extensions.cachestatus.");
var cache_visitor = {
visitEntry: function(a,b) {},
visitDevice: function( device, aDeviceInfo ) {
cs_updated_stat( device, aDeviceInfo, prefs );
}
}
cache_service.visitEntries( cache_visitor );
}
/*
* This function takes what could be 15.8912576891 and drops it to just
* one decimal place. In a future version, I could have the user say
* how many decimal places...
*/
function round_memory_usage( memory ) {
memory = parseFloat( memory );
memory *= 10;
memory = Math.round(memory)/10;
return memory;
}
// I got the cacheService code from the fasterfox extension
// http://www.xulplanet.com/references/xpcomref/ifaces/nsICacheService.html
function cs_clear_cache( param, noupdate ) {
var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
.getService(Components.interfaces.nsICacheService);
if ( param && param == 'ram' ) {
cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
} else if ( param && param == 'disk' ) {
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
} else {
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
}
if ( ! noupdate ) {
update_cache_status();
}
}
/*
* Grabbed this helpful bit from:
* http://kb.mozillazine.org/On_Page_Load
* http://developer.mozilla.org/en/docs/Code_snippets:On_page_load
*/
var csExtension = {
onPageLoad: function(aEvent) {
update_cache_status();
},
QueryInterface : function (aIID) {
if (aIID.equals(Components.interfaces.nsIObserver) ||
aIID.equals(Components.interfaces.nsISupports) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference))
return this;
throw Components.results.NS_NOINTERFACE;
},
register: function()
{
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
this._prefs = prefService.getBranch("extensions.cachestatus.");
if ( this._prefs.getBoolPref( 'auto_update' ) ) {
var appcontent = document.getElementById( 'appcontent' );
if ( appcontent )
appcontent.addEventListener( "DOMContentLoaded", this.onPageLoad, true );
}
this._branch = this._prefs;
this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
this._branch.addObserver("", this, true);
this._hbox = this.grabHBox();
this.rebuildPresence( this._prefs.getCharPref( 'presence' ) );
this.welcome();
},
welcome: function ()
{
//Do not show welcome page if user has turned it off from Settings.
if (!csExtension._prefs.getBoolPref( 'welcome' )) {
return
}
//Detect Firefox version
var version = "";
try {
version = (navigator.userAgent.match(/Firefox\/([\d\.]*)/) || navigator.userAgent.match(/Thunderbird\/([\d\.]*)/))[1];
} catch (e) {}
function welcome(version) {
if (csExtension._prefs.getCharPref( 'version' ) == version) {
return;
}
//Showing welcome screen
setTimeout(function () {
var newTab = getBrowser().addTab("http://add0n.com/cache-status.html?version=" + version);
getBrowser().selectedTab = newTab;
}, 5000);
csExtension._prefs.setCharPref( 'version', version );
}
//FF < 4.*
var versionComparator = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
.getService(Components.interfaces.nsIVersionComparator)
.compare(version, "4.0");
if (versionComparator < 0) {
var extMan = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
var addon = extMan.getItemForID("cache@status.org");
welcome(addon.version);
}
//FF > 4.*
else {
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID("cache@status.org", function (addon) {
welcome(addon.version);
});
}
},
grabHBox: function()
{
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var found_hbox;
if (win) {
this._doc = win.document;
found_hbox = win.document.getElementById("cs_presence");
}
//dump( "In grabHBox(): WIN: " + win + " HB: " + found_hbox + "\n" );
return found_hbox;
},
observe: function(aSubject, aTopic, aData)
{
if ( aTopic != 'nsPref:changed' ) return;
// aSubject is the nsIPrefBranch we're observing (after appropriate QI)
// aData is the name of the pref that's been changed (relative to aSubject)
//dump( "pref changed: S: " + aSubject + " T: " + aTopic + " D: " + aData + "\n" );
if ( aData == 'auto_update' ) {
var add_event_handler = this._prefs.getBoolPref( 'auto_update' );
if ( add_event_handler ) {
window.addEventListener( 'load', this.onPageLoad, true );
} else {
window.removeEventListener( 'load', this.onPageLoad, true );
}
} else if ( aData == 'presence' ) {
var presence = this._prefs.getCharPref( 'presence' );
if ( presence == 'original' || presence == 'icons' ) {
this.rebuildPresence( presence );
} else {
dump( "Unknown presence value: " + presence + "\n" );
}
}
},
rebuildPresence: function(presence)
{
// Take the hbox 'cs_presence' and replace it
if ( this._hbox == null ) {
this._hbox = this.grabHBox();
}
var hbox = this._hbox;
var child_node = hbox.firstChild;
while( child_node != null ) {
hbox.removeChild( child_node );
child_node = hbox.firstChild;
}
var popupset = this._doc.getElementById( 'cs_popupset' );
var child_node = popupset.firstChild;
while( child_node != null ) {
popupset.removeChild( child_node );
child_node = popupset.firstChild;
}
var string_bundle = this._doc.getElementById( 'cache-status-strings' );
if ( presence == 'original' ) {
var ram_image = this._doc.createElement( 'image' );
ram_image.setAttribute(
'tooltiptext', string_bundle.getString( 'ramcache' ) );
ram_image.setAttribute( 'src', 'chrome://cachestatus/skin/ram.png' );
var ram_label = this._doc.createElement( 'label' );
ram_label.setAttribute( 'id', 'cachestatus-ram-label' );
ram_label.setAttribute(
'value', ': ' + string_bundle.getString( 'nly' ) );
ram_label.setAttribute(
'tooltiptext', string_bundle.getString( 'ramcache' ) );
var disk_image = this._doc.createElement( 'image' );
disk_image.setAttribute(
'tooltiptext', string_bundle.getString( 'diskcache' ) );
disk_image.setAttribute( 'src', 'chrome://cachestatus/skin/hd.png' );
var disk_label = this._doc.createElement( 'label' );
disk_label.setAttribute(
'tooltiptext', string_bundle.getString( 'diskcache' ) );
disk_label.setAttribute( 'id', 'cachestatus-hd-label' );
disk_label.setAttribute(
'value', ': ' + string_bundle.getString( 'nly' ) );
hbox.appendChild( ram_image );
hbox.appendChild( ram_label );
hbox.appendChild( disk_image );
hbox.appendChild( disk_label );
} else if ( presence == 'icons' ) {
var ram_tooltip = this._doc.createElement( 'tooltip' );
ram_tooltip.setAttribute( 'id', 'ram_tooltip' );
ram_tooltip.setAttribute( 'orient', 'horizontal' );
var ram_desc_prefix = this._doc.createElement( 'description' );
ram_desc_prefix.setAttribute( 'id', 'cachestatus-ram-prefix' );
ram_desc_prefix.setAttribute(
'value', string_bundle.getString( 'ramcache' ) + ':' );
ram_desc_prefix.setAttribute( 'style', 'font-weight: bold;' );
var ram_desc = this._doc.createElement( 'description' );
ram_desc.setAttribute( 'id', 'cachestatus-ram-label' );
ram_desc.setAttribute(
'value', string_bundle.getString( 'nly' ) );
ram_tooltip.appendChild( ram_desc_prefix );
ram_tooltip.appendChild( ram_desc );
var hd_tooltip = this._doc.createElement( 'tooltip' );
hd_tooltip.setAttribute( 'id', 'hd_tooltip' );
hd_tooltip.setAttribute( 'orient', 'horizontal' );
var hd_desc_prefix = this._doc.createElement( 'description' );
hd_desc_prefix.setAttribute( 'id', 'cachestatus-hd-prefix' );
hd_desc_prefix.setAttribute(
'value', string_bundle.getString( 'diskcache' ) + ':' );
hd_desc_prefix.setAttribute( 'style', 'font-weight: bold;' );
var hd_desc = this._doc.createElement( 'description' );
hd_desc.setAttribute( 'id', 'cachestatus-hd-label' );
hd_desc.setAttribute(
'value', string_bundle.getString( 'nly' ) );
hd_tooltip.appendChild( hd_desc_prefix );
hd_tooltip.appendChild( hd_desc );
popupset.appendChild( ram_tooltip );
popupset.appendChild( hd_tooltip );
hbox.parentNode.insertBefore( popupset, hbox );
var ram_image = this._doc.createElement( 'image' );
ram_image.setAttribute( 'src', 'chrome://cachestatus/skin/ram.png' );
ram_image.setAttribute( 'tooltip', 'ram_tooltip' );
var disk_image = this._doc.createElement( 'image' );
disk_image.setAttribute( 'src', 'chrome://cachestatus/skin/hd.png' );
disk_image.setAttribute( 'tooltip', 'hd_tooltip' );
hbox.appendChild( ram_image );
hbox.appendChild( disk_image );
}
}
}
// I can't just call csExtension.register directly b/c the XUL
// might not be loaded yet.
window.addEventListener( 'load', function() { csExtension.register(); }, false );
| purdy/cachestatus-firefox | chrome/content/cachestatus.js | JavaScript | mit | 15,267 |
#include <cstdio>
int main(int argc, char** argv) {
printf ("Hello World");
for (int i=0; i < 10; ++i) {
j = i && i;
}
return 0;
}
| PatrickTrentin88/intro_cpp_qt | examples/xml/domwalker/testhello.cpp | C++ | mit | 155 |
<?php
class Controller
{
}
| ejacky/honji | framework/Controller.php | PHP | mit | 28 |
require 'spec_helper'
describe Compose do
it 'should compose multiple procs/symbols' do
expect(Compose[[:upcase,:reverse,:*.(2)]].('hello')).to eq("OLLEHOLLEH")
expect(Compose[[:*.(2), :**.(3), :+.(10)]].(4)).to eq(522)
end
it 'should compose fns' do
init_prime = Compose2[Compose2[Reverse,Tail], Reverse]
init_prime_prime = Compose[[Reverse,Tail,Reverse]]
expect( init_prime.([1,2,3]) ).to eq([1,2])
expect( init_prime_prime.([1,2,3]) ).to eq([1,2])
end
it 'should have a synonym (Pipe)' do
expect(Pipe[[:+.(1), :*.(2)]].(1)).to eq(4)
expect(Pipe[[Reverse,Tail,Reverse]].([2,4,6,8])).to eq([2,4,6])
end
end
| jweissman/functionalism | spec/compose_spec.rb | Ruby | mit | 656 |
/// @file aStarNode.hpp
/// @brief Contains the class of nodes use by the astar pathfinder.
/// @author Enrico Fraccaroli
/// @date Nov 11 2016
/// @copyright
/// Copyright (c) 2016 Enrico Fraccaroli <enrico.fraccaroli@gmail.com>
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
/// The above copyright notice and this permission notice shall be included
/// in all copies or substantial portions of the Software.
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS IN THE SOFTWARE.
#pragma once
#include "pathFinderNode.hpp"
#include <memory>
#include <vector>
/// @brief The states of an AStar node.
using AStarNodeState = enum class AStarNodeState_t
{
Untested, /// <! The node has not been tested yet.
Open, /// <! The node is on the 'open' state.
Closed /// <! The node is on the 'closed' state.
};
/// @brief A supporting node for the AStart algorithm.
template<typename T>
class AStarNode :
public PathFinderNode<T>
{
private:
/// Node state.
AStarNodeState nodeState;
/// The length of the path from the start node to this node.
int g;
/// The straight-line distance from this node to the end node.
int h;
/// The previous node in path. It is used when recontructing the path
/// from the end node to the beginning.
std::shared_ptr<AStarNode<T>> parentNode;
/// Identifies the end node.
bool endNodeFlag;
public:
/// @brief Constructor.
AStarNode(T _element) :
PathFinderNode<T>(_element),
nodeState(),
g(),
h(),
parentNode(),
endNodeFlag()
{
// Nothing to do.
}
/// @brief Allows to set the state of the node.
void setNodeState(const AStarNodeState & _nodeState)
{
nodeState = _nodeState;
}
/// @brief Allows to set the 'g' value.
void setG(const int & _g)
{
g = _g;
}
/// @brief Allows to set the 'h' value.
void setH(const int & _h)
{
h = _h;
}
/// @brief Allows to set the parent node.
void setParentNode(std::shared_ptr<AStarNode<T>> _parentNode)
{
parentNode = _parentNode;
}
/// @brief Allows to set if this node is the end node.
void setIsEndNode()
{
endNodeFlag = true;
}
/// @brief Provides the state of the node.
AStarNodeState getNodeState() const
{
return nodeState;
}
/// @brief Provides the 'g' value.
int getG() const
{
return g;
}
/// @brief Provides the 'f' value.
int getF() const
{
return g + h;
}
/// @brief Privdes the parent node.
std::shared_ptr<AStarNode<T>> getParentNode()
{
return parentNode;
}
/// @brief Gives information if this node is the end node.
bool isEndNode() const
{
return endNodeFlag;
}
};
| Galfurian/RadMud | src/structure/algorithms/AStar/aStarNode.hpp | C++ | mit | 3,686 |
require_dependency 'query'
module DefaultCustomQuery
module QueryPatch
extend ActiveSupport::Concern
included do
scope :only_public, -> { where(visibility: Query::VISIBILITY_PUBLIC) }
end
end
end
DefaultCustomQuery::QueryPatch.tap do |mod|
Query.send :include, mod unless Query.include?(mod)
end
| hidakatsuya/redmine_default_custom_query | app/patches/models/query_patch.rb | Ruby | mit | 323 |
(function() {
'use strict';
angular.module('newApp')
.controller('newAppCtrl', newAppCtrl);
function newAppCtrl() {
}
})();
| ekrtf/angular-express-starter | client/index.controller.js | JavaScript | mit | 156 |
let upath = require('upath'),
through2 = require('through2'),
paths = require('../../project.conf.js').paths,
RegexUtil = require('../util/RegexUtil');
module.exports = class StreamReplacer {
constructor(replacements = {}) {
this.replacements = replacements;
}
/**
* Add a transform to the replacer. A transform is a function that takes a vinyl file from the stream as a
* parameter and returns the path to be used as a replacement for that file.
*
* This function is called for each file present in the stream.
*
* @param transformFn(file)
*
* @returns {through2}
*/
push(transformFn) {
let that = this;
return through2.obj(function (file, enc, flush) {
let dir = upath.dirname(upath.relative(paths.src(), file.path)),
ext = upath.extname(file.path),
name = upath.basename(file.path, ext);
that.replacements[transformFn(file)] =
new RegExp(RegexUtil.escape(upath.join(dir, name + ext)).replace(/ /g, '(?: |%20)'), 'g');
this.push(file);
flush();
});
}
/**
* Search and replace all files in the stream with values according to the transforms configured via `push()`.
*
* @returns {through2}
*/
replace() {
let that = this;
return through2.obj(function (file, enc, flush) {
Object.keys(that.replacements).forEach((replacement) => {
file.contents = new Buffer(String(file.contents).replace(that.replacements[replacement], replacement));
});
this.push(file);
flush();
});
}
};
| tniswong/web-build | build/support/stream/StreamReplacer.js | JavaScript | mit | 1,719 |
import { InternalMethods } from './types'
import fetch from 'node-fetch'
import HttpError from './http-error'
import {
PAUSE_REPLICATION,
RESUME_REPLICATION,
} from '@resolve-js/module-replication'
const setReplicationPaused: InternalMethods['setReplicationPaused'] = async (
pool,
paused
) => {
const endpoint = paused ? PAUSE_REPLICATION : RESUME_REPLICATION
const response = await fetch(
`${pool.targetApplicationUrl}${endpoint.endpoint}`,
{
method: endpoint.method,
}
)
if (!response.ok) {
throw new HttpError(await response.text(), response.status)
}
}
export default setReplicationPaused
| reimagined/resolve | packages/runtime/adapters/replicators/replicator-via-api-handler/src/set-replication-paused.ts | TypeScript | mit | 637 |
using System.ComponentModel;
namespace LinqAn.Google.Metrics
{
/// <summary>
/// The total numeric value for the requested goal number.
/// </summary>
[Description("The total numeric value for the requested goal number.")]
public class Goal1Value: Metric<decimal>
{
/// <summary>
/// Instantiates a <seealso cref="Goal1Value" />.
/// </summary>
public Goal1Value(): base("Goal 1 Value",true,"ga:goal1Value")
{
}
}
}
| kenshinthebattosai/LinqAn.Google | src/LinqAn.Google/Metrics/Goal1Value.cs | C# | mit | 443 |
namespace UnityEditor.ShaderGraph
{
interface IPropertyFromNode
{
AbstractShaderProperty AsShaderProperty();
int outputSlotId { get; }
}
}
| Unity-Technologies/ScriptableRenderLoop | com.unity.shadergraph/Editor/Data/Nodes/IPropertyFromNode.cs | C# | mit | 167 |
/**
* WebCLGLVertexFragmentProgram Object
* @class
* @constructor
*/
WebCLGLVertexFragmentProgram = function(gl, vertexSource, vertexHeader, fragmentSource, fragmentHeader) {
this.gl = gl;
var highPrecisionSupport = this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER, this.gl.HIGH_FLOAT);
this.precision = (highPrecisionSupport.precision != 0) ? 'precision highp float;\n\nprecision highp int;\n\n' : 'precision lowp float;\n\nprecision lowp int;\n\n';
this.utils = new WebCLGLUtils();
this.vertexSource;
this.fragmentSource;
this.in_vertex_values = [];
this.in_fragment_values = [];
this.vertexAttributes = []; // {location,value}
this.vertexUniforms = []; // {location,value}
this.fragmentSamplers = []; // {location,value}
this.fragmentUniforms = []; // {location,value}
if(vertexSource != undefined) this.setVertexSource(vertexSource, vertexHeader);
if(fragmentSource != undefined) this.setFragmentSource(fragmentSource, fragmentHeader);
};
/**
* Update the vertex source
* @type Void
* @param {String} vertexSource
* @param {String} vertexHeader
*/
WebCLGLVertexFragmentProgram.prototype.setVertexSource = function(vertexSource, vertexHeader) {
this.vertexHead =(vertexHeader!=undefined)?vertexHeader:'';
this.in_vertex_values = [];//{value,type,name,idPointer}
// value: argument value
// type: 'buffer_float4_fromKernel'(4 packet pointer4), 'buffer_float_fromKernel'(1 packet pointer4), 'buffer_float4'(1 pointer4), 'buffer_float'(1 pointer1)
// name: argument name
// idPointer to: this.vertexAttributes or this.vertexUniforms (according to type)
var argumentsSource = vertexSource.split(')')[0].split('(')[1].split(','); // "float* A", "float* B", "float C", "float4* D"
//console.log(argumentsSource);
for(var n = 0, f = argumentsSource.length; n < f; n++) {
if(argumentsSource[n].match(/\*kernel/gm) != null) {
if(argumentsSource[n].match(/float4/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'buffer_float4_fromKernel',
name:argumentsSource[n].split('*kernel')[1].trim()};
} else if(argumentsSource[n].match(/float/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'buffer_float_fromKernel',
name:argumentsSource[n].split('*kernel')[1].trim()};
}
} else if(argumentsSource[n].match(/\*/gm) != null) {
if(argumentsSource[n].match(/float4/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'buffer_float4',
name:argumentsSource[n].split('*')[1].trim()};
} else if(argumentsSource[n].match(/float/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'buffer_float',
name:argumentsSource[n].split('*')[1].trim()};
}
} else {
if(argumentsSource[n].match(/float4/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'float4',
name:argumentsSource[n].split(' ')[1].trim()};
} else if(argumentsSource[n].match(/float/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'float',
name:argumentsSource[n].split(' ')[1].trim()};
} else if(argumentsSource[n].match(/mat4/gm) != null) {
this.in_vertex_values[n] = {value:undefined,
type:'mat4',
name:argumentsSource[n].split(' ')[1].trim()};
}
}
}
//console.log(this.in_vertex_values);
//console.log('original source: '+vertexSource);
this.vertexSource = vertexSource.replace(/\r\n/gi, '').replace(/\r/gi, '').replace(/\n/gi, '');
this.vertexSource = this.vertexSource.replace(/^\w* \w*\([\w\s\*,]*\) {/gi, '').replace(/}(\s|\t)*$/gi, '');
//console.log('minified source: '+this.vertexSource);
this.vertexSource = this.parseVertexSource(this.vertexSource);
if(this.fragmentSource != undefined) this.compileVertexFragmentSource();
};
/** @private **/
WebCLGLVertexFragmentProgram.prototype.parseVertexSource = function(source) {
//console.log(source);
for(var n = 0, f = this.in_vertex_values.length; n < f; n++) { // for each in_vertex_values (in argument)
var regexp = new RegExp(this.in_vertex_values[n].name+'\\[\\w*\\]',"gm");
var varMatches = source.match(regexp);// "Search current "in_vertex_values.name[xxx]" in source and store in array varMatches
//console.log(varMatches);
if(varMatches != null) {
for(var nB = 0, fB = varMatches.length; nB < fB; nB++) { // for each varMatches ("A[x]", "A[x]")
var regexpNativeGL = new RegExp('```(\s|\t)*gl.*'+varMatches[nB]+'.*```[^```(\s|\t)*gl]',"gm");
var regexpNativeGLMatches = source.match(regexpNativeGL);
if(regexpNativeGLMatches == null) {
var name = varMatches[nB].split('[')[0];
var vari = varMatches[nB].split('[')[1].split(']')[0];
var regexp = new RegExp(name+'\\['+vari.trim()+'\\]',"gm");
if(this.in_vertex_values[n].type == 'buffer_float4_fromKernel')
source = source.replace(regexp, 'buffer_float4_fromKernel_data('+name+'0,'+name+'1,'+name+'2,'+name+'3)');
if(this.in_vertex_values[n].type == 'buffer_float_fromKernel')
source = source.replace(regexp, 'buffer_float_fromKernel_data('+name+'0)');
if(this.in_vertex_values[n].type == 'buffer_float4')
source = source.replace(regexp, name);
if(this.in_vertex_values[n].type == 'buffer_float')
source = source.replace(regexp, name);
}
}
}
}
source = source.replace(/```(\s|\t)*gl/gi, "").replace(/```/gi, "");
//console.log('%c translated source:'+source, "background-color:#000;color:#FFF");
return source;
};
/**
* Update the fragment source
* @type Void
* @param {String} fragmentSource
* @param {String} fragmentHeader
*/
WebCLGLVertexFragmentProgram.prototype.setFragmentSource = function(fragmentSource, fragmentHeader) {
this.fragmentHead =(fragmentHeader!=undefined)?fragmentHeader:'';
this.in_fragment_values = [];//{value,type,name,idPointer}
// value: argument value
// type: 'buffer_float4'(RGBA channels), 'buffer_float'(Red channel)
// name: argument name
// idPointer to: this.fragmentSamplers or this.fragmentUniforms (according to type)
var argumentsSource = fragmentSource.split(')')[0].split('(')[1].split(','); // "float* A", "float* B", "float C", "float4* D"
//console.log(argumentsSource);
for(var n = 0, f = argumentsSource.length; n < f; n++) {
if(argumentsSource[n].match(/\*/gm) != null) {
if(argumentsSource[n].match(/float4/gm) != null) {
this.in_fragment_values[n] = {value:undefined,
type:'buffer_float4',
name:argumentsSource[n].split('*')[1].trim()};
} else if(argumentsSource[n].match(/float/gm) != null) {
this.in_fragment_values[n] = {value:undefined,
type:'buffer_float',
name:argumentsSource[n].split('*')[1].trim()};
}
} else {
if(argumentsSource[n].match(/float4/gm) != null) {
this.in_fragment_values[n] = {value:undefined,
type:'float4',
name:argumentsSource[n].split(' ')[1].trim()};
} else if(argumentsSource[n].match(/float/gm) != null) {
this.in_fragment_values[n] = {value:undefined,
type:'float',
name:argumentsSource[n].split(' ')[1].trim()};
} else if(argumentsSource[n].match(/mat4/gm) != null) {
this.in_fragment_values[n] = {value:undefined,
type:'mat4',
name:argumentsSource[n].split(' ')[1].trim()};
}
}
}
//console.log(this.in_fragment_values);
//console.log('original source: '+source);
this.fragmentSource = fragmentSource.replace(/\r\n/gi, '').replace(/\r/gi, '').replace(/\n/gi, '');
this.fragmentSource = this.fragmentSource.replace(/^\w* \w*\([\w\s\*,]*\) {/gi, '').replace(/}(\s|\t)*$/gi, '');
//console.log('minified source: '+this.fragmentSource);
this.fragmentSource = this.parseFragmentSource(this.fragmentSource);
if(this.vertexSource != undefined) this.compileVertexFragmentSource();
};
/** @private **/
WebCLGLVertexFragmentProgram.prototype.parseFragmentSource = function(source) {
//console.log(source);
for(var n = 0, f = this.in_fragment_values.length; n < f; n++) { // for each in_fragment_values (in argument)
var regexp = new RegExp(this.in_fragment_values[n].name+'\\[\\w*\\]',"gm");
var varMatches = source.match(regexp);// "Search current "in_fragment_values.name[xxx]" in source and store in array varMatches
//console.log(varMatches);
if(varMatches != null) {
for(var nB = 0, fB = varMatches.length; nB < fB; nB++) { // for each varMatches ("A[x]", "A[x]")
var regexpNativeGL = new RegExp('```(\s|\t)*gl.*'+varMatches[nB]+'.*```[^```(\s|\t)*gl]',"gm");
var regexpNativeGLMatches = source.match(regexpNativeGL);
if(regexpNativeGLMatches == null) {
var name = varMatches[nB].split('[')[0];
var vari = varMatches[nB].split('[')[1].split(']')[0];
var regexp = new RegExp(name+'\\['+vari.trim()+'\\]',"gm");
if(this.in_fragment_values[n].type == 'buffer_float4')
source = source.replace(regexp, 'buffer_float4_data('+name+','+vari+')');
if(this.in_fragment_values[n].type == 'buffer_float')
source = source.replace(regexp, 'buffer_float_data('+name+','+vari+')');
}
}
}
}
source = source.replace(/```(\s|\t)*gl/gi, "").replace(/```/gi, "");
//console.log('%c translated source:'+source, "background-color:#000;color:#FFF");
return source;
};
/** @private **/
WebCLGLVertexFragmentProgram.prototype.compileVertexFragmentSource = function() {
lines_vertex_attrs = (function() {
str = '';
for(var n = 0, f = this.in_vertex_values.length; n < f; n++) {
if(this.in_vertex_values[n].type == 'buffer_float4_fromKernel') {
str += 'attribute vec4 '+this.in_vertex_values[n].name+'0;\n';
str += 'attribute vec4 '+this.in_vertex_values[n].name+'1;\n';
str += 'attribute vec4 '+this.in_vertex_values[n].name+'2;\n';
str += 'attribute vec4 '+this.in_vertex_values[n].name+'3;\n';
} else if(this.in_vertex_values[n].type == 'buffer_float_fromKernel') {
str += 'attribute vec4 '+this.in_vertex_values[n].name+'0;\n';
} else if(this.in_vertex_values[n].type == 'buffer_float4') {
str += 'attribute vec4 '+this.in_vertex_values[n].name+';\n';
} else if(this.in_vertex_values[n].type == 'buffer_float') {
str += 'attribute float '+this.in_vertex_values[n].name+';\n';
} else if(this.in_vertex_values[n].type == 'float') {
str += 'uniform float '+this.in_vertex_values[n].name+';\n';
} else if(this.in_vertex_values[n].type == 'float4') {
str += 'uniform vec4 '+this.in_vertex_values[n].name+';\n';
} else if(this.in_vertex_values[n].type == 'mat4') {
str += 'uniform mat4 '+this.in_vertex_values[n].name+';\n';
}
}
return str;
}).bind(this);
lines_fragment_attrs = (function() {
str = '';
for(var n = 0, f = this.in_fragment_values.length; n < f; n++) {
if(this.in_fragment_values[n].type == 'buffer_float4' || this.in_fragment_values[n].type == 'buffer_float') {
str += 'uniform sampler2D '+this.in_fragment_values[n].name+';\n';
} else if(this.in_fragment_values[n].type == 'float') {
str += 'uniform float '+this.in_fragment_values[n].name+';\n';
} else if(this.in_fragment_values[n].type == 'float4') {
str += 'uniform vec4 '+this.in_fragment_values[n].name+';\n';
} else if(this.in_fragment_values[n].type == 'mat4') {
str += 'uniform mat4 '+this.in_fragment_values[n].name+';\n';
}
}
return str;
}).bind(this);
var sourceVertex = this.precision+
'uniform float uOffset;\n'+
lines_vertex_attrs()+
this.utils.unpackGLSLFunctionString()+
'vec4 buffer_float4_fromKernel_data(vec4 arg0, vec4 arg1, vec4 arg2, vec4 arg3) {\n'+
'float argX = (unpack(arg0)*(uOffset*2.0))-uOffset;\n'+
'float argY = (unpack(arg1)*(uOffset*2.0))-uOffset;\n'+
'float argZ = (unpack(arg2)*(uOffset*2.0))-uOffset;\n'+
'float argW = (unpack(arg3)*(uOffset*2.0))-uOffset;\n'+
'return vec4(argX, argY, argZ, argW);\n'+
'}\n'+
'float buffer_float_fromKernel_data(vec4 arg0) {\n'+
'float argX = (unpack(arg0)*(uOffset*2.0))-uOffset;\n'+
'return argX;\n'+
'}\n'+
'vec2 get_global_id() {\n'+
'return vec2(0.0, 0.0);\n'+
'}\n'+
this.vertexHead+
'void main(void) {\n'+
this.vertexSource+
'}\n';
//console.log(sourceVertex);
var sourceFragment = this.precision+
lines_fragment_attrs()+
'vec4 buffer_float4_data(sampler2D arg, vec2 coord) {\n'+
'vec4 textureColor = texture2D(arg, coord);\n'+
'return textureColor;\n'+
'}\n'+
'float buffer_float_data(sampler2D arg, vec2 coord) {\n'+
'vec4 textureColor = texture2D(arg, coord);\n'+
'return textureColor.x;\n'+
'}\n'+
'vec2 get_global_id() {\n'+
'return vec2(0.0, 0.0);\n'+
'}\n'+
this.fragmentHead+
'void main(void) {\n'+
this.fragmentSource+
'}\n';
//console.log(sourceFragment);
this.vertexFragmentProgram = this.gl.createProgram();
this.utils.createShader(this.gl, "WEBCLGL VERTEX FRAGMENT PROGRAM", sourceVertex, sourceFragment, this.vertexFragmentProgram);
this.vertexAttributes = []; // {location,value}
this.vertexUniforms = []; // {location,value}
this.fragmentSamplers = []; // {location,value}
this.fragmentUniforms = []; // {location,value}
this.uOffset = this.gl.getUniformLocation(this.vertexFragmentProgram, "uOffset");
// vertexAttributes & vertexUniforms
for(var n = 0, f = this.in_vertex_values.length; n < f; n++) {
if( this.in_vertex_values[n].type == 'buffer_float4_fromKernel') {
this.vertexAttributes.push({location:[this.gl.getAttribLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name+"0"),
this.gl.getAttribLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name+"1"),
this.gl.getAttribLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name+"2"),
this.gl.getAttribLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name+"3")],
value:this.in_vertex_values[n].value,
type: this.in_vertex_values[n].type});
this.in_vertex_values[n].idPointer = this.vertexAttributes.length-1;
} else if(this.in_vertex_values[n].type == 'buffer_float_fromKernel') {
this.vertexAttributes.push({location:[this.gl.getAttribLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name+"0")],
value:this.in_vertex_values[n].value,
type: this.in_vertex_values[n].type});
this.in_vertex_values[n].idPointer = this.vertexAttributes.length-1;
} else if(this.in_vertex_values[n].type == 'buffer_float4' || this.in_vertex_values[n].type == 'buffer_float') {
this.vertexAttributes.push({location:[this.gl.getAttribLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name)],
value:this.in_vertex_values[n].value,
type: this.in_vertex_values[n].type});
this.in_vertex_values[n].idPointer = this.vertexAttributes.length-1;
} else if(this.in_vertex_values[n].type == 'float' || this.in_vertex_values[n].type == 'float4' || this.in_vertex_values[n].type == 'mat4') {
this.vertexUniforms.push({location:[this.gl.getUniformLocation(this.vertexFragmentProgram, this.in_vertex_values[n].name)],
value:this.in_vertex_values[n].value,
type: this.in_vertex_values[n].type});
this.in_vertex_values[n].idPointer = this.vertexUniforms.length-1;
}
}
// fragmentSamplers & fragmentUniforms
for(var n = 0, f = this.in_fragment_values.length; n < f; n++) {
if(this.in_fragment_values[n].type == 'buffer_float4' || this.in_fragment_values[n].type == 'buffer_float') {
this.fragmentSamplers.push({location:[this.gl.getUniformLocation(this.vertexFragmentProgram, this.in_fragment_values[n].name)],
value:this.in_fragment_values[n].value,
type: this.in_fragment_values[n].type});
this.in_fragment_values[n].idPointer = this.fragmentSamplers.length-1;
} else if(this.in_fragment_values[n].type == 'float' || this.in_fragment_values[n].type == 'float4' || this.in_fragment_values[n].type == 'mat4') {
this.fragmentUniforms.push({location:[this.gl.getUniformLocation(this.vertexFragmentProgram, this.in_fragment_values[n].name)],
value:this.in_fragment_values[n].value,
type: this.in_fragment_values[n].type});
this.in_fragment_values[n].idPointer = this.fragmentUniforms.length-1;
}
}
return true;
};
/**
* Bind float, mat4 or a WebCLGLBuffer to a vertex argument
* @type Void
* @param {Int|String} argument Id of argument or name of this
* @param {Float|Int|WebCLGLBuffer} data
*/
WebCLGLVertexFragmentProgram.prototype.setVertexArg = function(argument, data) {
if(data == undefined) alert("Error: setVertexArg("+argument+", undefined)");
var numArg;
if(typeof argument != "string") {
numArg = argument;
} else {
for(var n=0, fn = this.in_vertex_values.length; n < fn; n++) {
if(this.in_vertex_values[n].name == argument) {
numArg = n;
break;
}
}
}
if(this.in_vertex_values[numArg] == undefined) {
console.log("argument "+argument+" not exist in this vertex program");
return;
}
this.in_vertex_values[numArg].value = data;
if( this.in_vertex_values[numArg].type == 'buffer_float4_fromKernel' ||
this.in_vertex_values[numArg].type == 'buffer_float_fromKernel' ||
this.in_vertex_values[numArg].type == 'buffer_float4' ||
this.in_vertex_values[numArg].type == 'buffer_float') {
this.vertexAttributes[this.in_vertex_values[numArg].idPointer].value = this.in_vertex_values[numArg].value;
} else if(this.in_vertex_values[numArg].type == 'float' || this.in_vertex_values[numArg].type == 'float4' || this.in_vertex_values[numArg].type == 'mat4') {
this.vertexUniforms[this.in_vertex_values[numArg].idPointer].value = this.in_vertex_values[numArg].value;
}
};
/**
* Bind float or a WebCLGLBuffer to a fragment argument
* @type Void
* @param {Int|String} argument Id of argument or name of this
* @param {Float|Int|WebCLGLBuffer} data
*/
WebCLGLVertexFragmentProgram.prototype.setFragmentArg = function(argument, data) {
if(data == undefined) alert("Error: setFragmentArg("+argument+", undefined)");
var numArg;
if(typeof argument != "string") {
numArg = argument;
} else {
for(var n=0, fn = this.in_fragment_values.length; n < fn; n++) {
if(this.in_fragment_values[n].name == argument) {
numArg = n;
break;
}
}
}
if(this.in_fragment_values[numArg] == undefined) {
console.log("argument "+argument+" not exist in this fragment program");
return;
}
this.in_fragment_values[numArg].value = data;
if(this.in_fragment_values[numArg].type == 'buffer_float4' || this.in_fragment_values[numArg].type == 'buffer_float') {
this.fragmentSamplers[this.in_fragment_values[numArg].idPointer].value = this.in_fragment_values[numArg].value;
} else if(this.in_fragment_values[numArg].type == 'float' || this.in_fragment_values[numArg].type == 'float4' || this.in_fragment_values[numArg].type == 'mat4') {
this.fragmentUniforms[this.in_fragment_values[numArg].idPointer].value = this.in_fragment_values[numArg].value;
}
};
| stormcolor/stormenginec | StormEngineC/WebCLGLVertexFragmentProgram.class.js | JavaScript | mit | 19,084 |
"use strict";
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
interval: 200,
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: false,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true,
es5: true,
strict: true,
globalstrict: true
},
files: {
src: ['Gruntfile.js', 'package.json', 'lib/*.js', 'lib/controllers/**/*.js', 'lib/models/**/*.js', 'lib/utils/**/*.js', 'demo/*.js']
}
},
watch: {
files: ['<%= jshint.files.src %>'],
tasks: ['default']
}
});
// npm tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task.
grunt.registerTask('default', ['jshint']);
};
| ahultgren/presspress | Gruntfile.js | JavaScript | mit | 943 |
namespace _04.Hotel
{
using System;
public class Hotel
{
public static void Main()
{
string month = Console.ReadLine();
int nightsCount = int.Parse(Console.ReadLine());
if (month == "May" || month == "October")
{
double discount = 0.0;
double studioRoom = 50.0;
double doubleRoom = 65.0;
double suiteRoom = 75.0;
double freeNight = 0.0;
if (nightsCount > 7) // studio 5%
{
discount = nightsCount * studioRoom * 5 / 100.0;
}
if (month == "October" && nightsCount > 7)
{
freeNight = studioRoom - studioRoom * 5 / 100;
}
Console.WriteLine("Studio: {0:f2} lv.", (studioRoom * nightsCount - discount) - freeNight);
Console.WriteLine("Double: {0:f2} lv.", doubleRoom * nightsCount);
Console.WriteLine("Suite: {0:f2} lv.", suiteRoom * nightsCount);
}
else if (month == "June" || month == "September")
{
double discount = 0.0;
double studioRoom = 60.0;
double doubleRoom = 72.0;
double suiteRoom = 82.0;
double freeNight = 0.0;
if (nightsCount > 14) // studio 10%
{
discount = nightsCount * doubleRoom * 10 / 100.0;
}
if (month == "September" && nightsCount > 7)
{
freeNight = studioRoom; //- studioRoom * 10 / 100.0;
}
Console.WriteLine("Studio: {0:f2} lv.", studioRoom * nightsCount - freeNight);
Console.WriteLine("Double: {0:f2} lv.", doubleRoom * nightsCount - discount);
Console.WriteLine("Suite: {0:f2} lv.", suiteRoom * nightsCount);
}
else if (month == "July" || month == "August" || month == "December")
{
double discount = 0.0;
double studioRoom = 68.0;
double doubleRoom = 77.0;
double suiteRoom = 89.0;
if (nightsCount > 14) // studio 15%
{
discount = nightsCount * suiteRoom * 15 / 100.0;
}
Console.WriteLine("Studio: {0:f2} lv.", studioRoom * nightsCount);
Console.WriteLine("Double: {0:f2} lv.", doubleRoom * nightsCount);
Console.WriteLine("Suite: {0:f2} lv.", suiteRoom * nightsCount - discount);
}
}
}
}
| TsvetanNikolov123/CSharp---Programming-Fundamentals | 06 Conditional Statements And Loops - Exercises/04.Hotel/Hotel.cs | C# | mit | 2,718 |
# Python Code From Book
# This file consists of code snippets only
# It is not intended to be run as a script
raise SystemExit
####################################################################
# 3. Thinking in Binary
####################################################################
import magic
print magic.from_file("my_image.jpg")
# JPEG image data, Exif standard: [TIFF image data, big-endian,
# direntries=16, height=3264, bps=0, PhotometricIntepretation=RGB],
# baseline, precision 8, 2378x2379, frames 3
if magic.from_file("upload.jpg", mime=True) == "image/jpeg":
continue_uploading("upload.jpg")
else:
alert("Sorry! This file type is not allowed")
import imghdr
print imghdr.what("path/to/my/file.ext")
import binascii
def spoof_file(file, magic_number):
magic_number = binascii.unhexlify(magic_number)
with open(file, "r+b") as f:
old = f.read()
f.seek(0)
f.write(magic_number + old)
def to_ascii_bytes(string):
return " ".join(format(ord(char), '08b') for char in string)
string = "my ascii string"
"".join(hex(ord(char))[2:] for char in string)
# '6d7920617363696920737472696e67'
hex_string = "6d7920617363696920737472696e67"
hex_string.decode("hex")
# 'my ascii string'
"".join(chr(int(hex_string[i:i+2], 16)) for i in range(0, len(hex_string), 2))
# 'my ascii string'
# adapted from https://code.activestate.com/recipes/142812-hex-dumper/
def hexdump(string, length=8):
result = []
digits = 4 if isinstance(string, unicode) else 2
for i in xrange(0, len(string), length):
s = string[i:i + length]
hexa = "".join("{:0{}X}".format(ord(x), digits) for x in s)
text = "".join(x if 0x20 <= ord(x) < 0x7F else '.' for x in s)
result.append("{:04X} {:{}} {}".format(i, hexa, length * (digits + 1), text))
return '\n'.join(result)
with open("/path/to/my_file.ext", "r") as f:
print hexdump(f.read())
import struct
num = 0x103e4
struct.pack("I", 0x103e4)
# '\xe4\x03\x01\x00'
string = '\xe4\x03\x01\x00'
struct.unpack("i", string)
# (66532,)
bytes = '\x01\xc2'
struct.pack("<h", struct.unpack(">h", bytes)[0])
# '\xc2\x01'
import base64
base64.b64encode('encodings are fun...')
# 'ZW5jb2RpbmdzIGFyZSBmdW4uLi4='
base64.b64decode(_)
# 'encodings are fun...'
string = "hello\x00"
binary_string = ' '.join('{:08b}'.format(ord(char)) for char in string)
" ".join(binary_string[i:i+6] for i in range(0, len(binary_string), 6))
# '011010 000110 010101 101100 011011 000110 111100 000000'
bin_string = '011010 000110 010101 101100 011011 000110 111100 000000'
[int(b, 2) for b in bin_string.split()]
# [26, 6, 21, 44, 27, 6, 60, 0]
u'◑ \u2020'.encode('utf8')
# '\xe2\x97\x91 \xe2\x80\xa0'
'\xe2\x97\x91 \xe2\x80\xa0'.decode('utf8')
# u'\u25d1 \u2020'
unicode('\xe2\x97\x91 \xe2\x80\xa0', encoding='utf8')
# u'\u25d1 \u2020'
utf8_string = 'Åêíòü'
utf8_string
# '\xc3\x85\xc3\xaa\xc3\xad\xc3\xb2\xc3\xbc'
unicode_string = utf8_string.decode('utf8')
unicode_string
# u'\xc5\xea\xed\xf2\xfc'
unicode_string.encode('mac roman')
# '\x81\x90\x92\x98\x9f'
'Åêíòü'.decode('utf8').encode('ascii')
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)
file = """潍楪慢敫椠桴慧扲敬整瑸琠慨⁴獩琠敨爠獥汵⁴景琠硥⁴敢湩敤潣敤獵湩湡甠楮瑮湥敤档
牡捡整湥潣楤杮楷桴挠浯汰瑥汥⁹湵敲慬整湯獥景整牦浯愠搠晩敦敲瑮眠楲楴杮猠獹整‧⠊慔敫
牦浯攠楷楫数楤牯⥧"""
print file.decode('utf8').encode('utf16')
# ??Mojibake is the garbled text that is the result of text being decoded using an
# unintended character encoding with completely unrelated ones, often from a
# different writing system.' (Taken from en.wikipedia.org)
import ftfy
ftfy.fix_text(u"“Mojibake“ can be fixed.")
# u'"Mojibake" can be fixed.'
bin(0b1010 & 0b1111110111)
# '0b10'
bin(0b1010 | 0b0110)
# '0b1110'
bin(0b10111 | 0b01000)
# '0b11111'
bin(0b100 ^ 0b110)
# '0b10'
bin(-0b1010 >> 0b10)
# '-0b11'
x = 0b1111
y = 0b1010
bin(int("{:b}{:b}".format(x, y), 2))
# '0b11111010'
bin(x << 4 | y)
# '0b11111010'
####################################################################
# 4. Cryptography
####################################################################
import random
import string
r = random.SystemRandom()
# Get a random integer between 0 and 20
r.randint(0, 20)
# 5
# Get a random number between 0 and 1
r.random()
# 0.8282475835972263
# Generate a random 40-bit number
r.getrandbits(40)
# 595477188771L
# Choose a random item from a string or list
chars = string.printable
r.choice(chars)
# 'e'
# Randomize the order of a sequence
seq = ['a', 'b', 'c', 'd', 'e']
r.shuffle(seq)
print seq
# ['c','d', 'a', 'e', 'b']
"ALLIGATOR".encode('rot13')
# 'NYYVTNGBE'
"NYYVTNGBE".encode('rot13')
# 'ALLIGATOR'
plaintext = "A secret-ish message!"
"".join(chr((ord(c) + 20) % 256) for c in plaintext)
# 'U4\x87yw\x86y\x88A}\x87|4\x81y\x87\x87u{y5'
ciphertext = 'U4\x87yw\x86y\x88A}\x87|4\x81y\x87\x87u{y5'
"".join(chr((ord(c) - 20) % 256) for c in ciphertext)
# 'A secret-ish message!'
plaintext = 0b110100001101001
one_time_pad = 0b110000011100001
bin(plaintext ^ one_time_pad)
# '0b100010001000'
decrypted = 0b100010001000 ^ one_time_pad
format(decrypted, 'x').decode('hex')
# 'hi'
import os
import binascii
# ASCII-encoded plaintext
plaintext = "this is a secret message"
plaintext_bits = int(binascii.hexlify(plaintext), 16)
print "plaintext (ascii):", plaintext
print "plaintext (hex):", plaintext_bits
# Generate the one-time pad
onetime_pad = int(binascii.hexlify(os.urandom(len(plaintext))), 16)
print "one-time pad: (hex):", onetime_pad
# Encrypt plaintext using XOR operation with one-time pad
ciphertext_bits = plaintext_bits ^ onetime_pad
print "encrypted text (hex):", ciphertext_bits
# Decrypt using XOR operation with one-time pad
decrypted_text = ciphertext_bits ^ onetime_pad
decrypted_text = binascii.unhexlify(hex(decrypted_text)[2:-1])
print "decrypted text (ascii):", decrypted_text
import random
import binascii
p1 = "this is the part where you run away"
p2 = "from bad cryptography practices."
# pad plaintexts with spaces to ensure equal length
p1 = p1.ljust(len(p2))
p2 = p2.ljust(len(p1))
p1 = int(binascii.hexlify(p1), 16)
p2 = int(binascii.hexlify(p2), 16)
# get random one-time pad
otp = random.SystemRandom().getrandbits(p1.bit_length())
# encrypt
c1 = p1 ^ otp
c2 = p2 ^ otp # otp reuse...not good!
print "c1 ^ c2 == p1 ^ p2 ?", c1 ^ c2 == p1 ^ p2
print "c1 ^ c2 =", hex(c1 ^ c2)
# the crib
crib = " the "
crib = int(binascii.hexlify(crib), 16)
xored = c1 ^ c2
print "crib =", hex(crib)
cbl = crib.bit_length()
xbl = xored.bit_length()
print
mask = (2**(cbl + 1) - 1)
fill = len(str(xbl / 8))
# crib dragging
for s in range(0, xbl - cbl + 8, 8):
xor = (xored ^ (crib << s)) & (mask << s)
out = binascii.unhexlify(hex(xor)[2:-1])
print "{:>{}} {}".format(s/8, fill, out)
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
ciphertext = f.encrypt("this is my plaintext")
decrypted = f.decrypt(ciphertext)
print decrypted
# this is my plaintext
import os
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
pt = "my plaintext"
backend = default_backend()
key = os.urandom(32)
iv = os.urandom(16)
padder = padding.PKCS7(128).padder()
pt = padder.update(pt) + padder.finalize()
cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=backend)
encryptor = cipher.encryptor()
ct = encryptor.update(pt) + encryptor.finalize()
decryptor = cipher.decryptor()
out = decryptor.update(ct) + decryptor.finalize()
unpadder = padding.PKCS7(128).unpadder()
out = unpadder.update(out) + unpadder.finalize()
print out
import hashlib
hashlib.md5("hash me please").hexdigest()
# '760d92b6a6f974ae11904cd0a6fc2e90'
hashlib.sha1("hash me please").hexdigest()
# '1a58c9b3d138a45519518ee42e634600d1b52153'
import os
from cryptography.hazmat.primitives.kdf.scrypt import Scrypt
from cryptography.hazmat.backends import default_backend
backend = default_backend()
salt = os.urandom(16)
kdf = Scrypt(salt=salt, length=64, n=2**14, r=8, p=1, backend=backend)
key = kdf.derive("your favorite password")
key
import hmac
import hashlib
secret_key = "my secret key"
ciphertext = "my ciphertext"
# generate HMAC
h = hmac.new(key=secret_key, msg=ciphertext, digestmod=hashlib.sha256)
print h.hexdigest()
# verify HMAC
hmac.compare_digest(h.hexdigest(), h.hexdigest())
p = 9576890767
q = 1299827
n = p * q
print n
# 12448301194997309
e = 65537
phi = (p - 1) * (q - 1)
phi % e != 0
# True
import sympy
d = sympy.numbers.igcdex(e, phi)[0]
print d
# 1409376745910033
m = 12345
c = pow(m, e, n)
print c
# 3599057382134015
pow(c, d, n)
# 12345
m = 0
while pow(m, e, n) != c:
m += 1
print m
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048, b
ackend=default_backend())
public_key = private_key.public_key()
private_pem = private_key.private_bytes(encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.BestAvailableEncryption('your password here'))
public_pem = public_key.public_bytes(encoding=serialization.Encoding.PEM,
format=serialization.PublicFormat.SubjectPublicKeyInfo)
print public_pem
print private_pem
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
import base64
with open("path/to/public_key.pem", "rb") as key_file:
public_key = serialization.load_pem_public_key(key_file.read(),
backend=default_backend())
message = "your secret message"
ciphertext = public_key.encrypt(message,
padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()),
algorithm=hashes.SHA256(),
label=None))
b64_ciphertext = base64.urlsafe_b64encode(ciphertext)
print b64_ciphertext
plaintext = private_key.decrypt(ciphertext,
padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()),
algorithm=hashes.SHA256(),
label=None))
print plaintext
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
signer = private_key.signer(padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.MAX_LENGTH), hashes.SHA256())
message = "A message of arbitrary length"
signer.update(message)
signature = signer.finalize()
public_key = private_key.public_key()
verifier = public_key.verifier(signature, padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.MAX_LENGTH), hashes.SHA256())
verifier.update(message)
verifier.verify()
####################################################################
# 5. Networking
####################################################################
import requests
r = requests.get('https://www.google.com/imghp')
r.content[:200]
# View status code
r.status_code
# 200
# View response header fields
r.headers
# {'Alt-Svc': 'quic=":443"; ma=2592000; v="36,35,34"',
# 'Cache-Control': 'private, max-age=0',
# 'Content-Encoding': 'gzip',
# 'Content-Type': 'text/html; charset=ISO-8859-1',
# 'Expires': '-1',
# 'P3P': 'CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."',
# 'Server': 'gws',
# path=/; domain=.google.com; HttpOnly',
# 'Transfer-Encoding': 'chunked',
# 'X-Frame-Options': 'SAMEORIGIN',
# 'X-XSS-Protection': '1; mode=block'}
# Get content length in bytes
len(r.content)
# 10971
# Encoding
r.apparent_encoding
# 'ISO-8859-2'
# Time elapsed during request
r.elapsed
# datetime.timedelta(0, 0, 454447)
r.request.headers
# {'Accept': '*/*',
# 'Accept-Encoding': 'gzip, deflate',
# 'Connection': 'keep-alive',
# 'User-Agent': 'python-requests/2.12.4'}
custom_headers = {"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"}
r = requests.get("https://www.google.com/imghp", headers=custom_headers)
r.request.headers
# {'Accept': '*/*',
# 'Accept-Encoding': 'gzip, deflate',
# 'Connection': 'keep-alive',
# 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'}
import requests
import logging
import http.client as http_client
http_client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
r = requests.get('https://www.google.com/')
# send: 'GET / HTTP/1.1\r\nHost: www.google.com\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: python-requests/2.12.4\r\n\r\n'
# reply: 'HTTP/1.1 200 OK\r\n'
# header: Expires: -1
# header: Cache-Control: private, max-age=0
# header: Content-Type: text/html; charset=ISO-8859-1
# header: P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
# header: Content-Encoding: gzip
# header: Server: gws
# header: X-XSS-Protection: 1; mode=block
# header: X-Frame-Options: SAMEORIGIN
import urlparse
simple_url = "http://www.example.com/path/to/my/page"
parsed = urlparse.urlparse(simple_url)
parsed.scheme
parsed.hostname
parsed.path
url_with_query = "http://www.example.com/?page=1&key=Anvn4mo24"
query = urlparse.urlparse(url_with_query).query
urlparse.parse_qs(query)
# {'key': ['Anvn4mo24'], 'page': ['1']}
import urllib
url = 'https://www.example.com/%5EA-url-with-%-and-%5E?page=page+with%20spaces'
urllib.unquote(url)
# 'https://www.example.com/^A-url-with-%-and-^?page=page+with spaces'
chars = '!@#$%^%$#)'
urllib.quote(chars)
# '%21%40%23%24%25%5E%25%24%23%29'
urllib.unquote_plus(url)
# 'https://www.example.com/^A-url-with-%-and-^?page=page with spaces'
urllib.quote_plus('one two')
'one+two'
import requests
from bs4 import BeautifulSoup
r = requests.get("http://www.google.com")
soup = BeautifulSoup(r.content, "lxml")
soup.find_all('p')
soup.find_all('a')
# [<a class="gb1" href="http://www.google.com/imghp?hl=en&tab=wi">Images</a>,
# <a class="gb1" href="http://maps.google.com/maps?hl=en&tab=wl">Maps</a>,
# <a class="gb1" href="https://play.google.com/?hl=en&tab=w8">Play</a>,
# <a class="gb1" href="http://www.youtube.com/?tab=w1">YouTube</a>,
# <a class="gb1" href="http://news.google.com/nwshp?hl=en&tab=wn">News</a>,
# …]
for link in soup.find_all('a'):
print link.text, link["href"]
# Images http://www.google.com/imghp?hl=en&tab=wi
# Maps http://maps.google.com/maps?hl=en&tab=wl
# Play https://play.google.com/?hl=en&tab=w8
# YouTube http://www.youtube.com/?tab=w1
import dryscrape
from bs4 import BeautifulSoup
session = dryscrape.Session()
session.visit("http://www.google.com")
r = session.body()
soup = BeautifulSoup(r, "lxml")
from selenium import webdriver
driver = webdriver.Chrome("/path/to/chromedriver")
driver.get("http://www.google.com")
html = driver.page_source
driver.save_screenshot("screenshot.png")
driver.quit()
import smtplib
server = smtplib.SMTP('localhost', port=1025)
server.set_debuglevel(True)
server.sendmail("me@localhost", "you@localhost", "This is an email message")
server.quit()
| 0ppen/introhacking | code_from_book.py | Python | mit | 16,192 |
class ConferenceController < ApplicationController
before_filter :respond_to_options
load_and_authorize_resource find_by: :short_title
def index
@current = Conference.where('end_date >= ?', Date.current).order('start_date ASC')
@antiquated = @conferences - @current
end
def show; end
def schedule
@rooms = @conference.rooms
@events = @conference.events
@dates = @conference.start_date..@conference.end_date
if @dates == Date.current
@today = Date.current.strftime('%Y-%m-%d')
else
@today = @conference.start_date.strftime('%Y-%m-%d')
end
end
def gallery_photos
@photos = @conference.photos
render 'photos', formats: [:js]
end
private
def respond_to_options
respond_to do |format|
format.html { head :ok }
end if request.options?
end
end
| raluka/osem | app/controllers/conference_controller.rb | Ruby | mit | 834 |
//borrowed from stefanocudini bootstrap-list-filter
(function($) {
$.fn.btsListFilterContacts = function(inputEl, options) {
var searchlist = this,
searchlist$ = $(this),
inputEl$ = $(inputEl),
items$ = searchlist$,
callData,
callReq; //last callData execution
function tmpl(str, data) {
return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
return data[key] || '';
});
}
function debouncer(func, timeout) {
var timeoutID;
timeout = timeout || 300;
return function () {
var scope = this , args = arguments;
clearTimeout( timeoutID );
timeoutID = setTimeout( function () {
func.apply( scope , Array.prototype.slice.call( args ) );
}, timeout);
};
}
options = $.extend({
delay: 300,
minLength: 1,
initial: true,
eventKey: 'keyup',
resetOnBlur: true,
sourceData: null,
sourceTmpl: '<a class="list-group-item" href="#"><tr><h3><span>{title}</span></h3></tr></a>',
sourceNode: function(data) {
return tmpl(options.sourceTmpl, data);
},
emptyNode: function(data) {
return '<a class="list-group-item well" href="#"><span>No Results</span></a>';
},
itemEl: '.list-group-item',
itemChild: null,
itemFilter: function(item, val) {
//val = val.replace(new RegExp("^[.]$|[\[\]|()*]",'g'),'');
//val = val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
val = val && val.replace(new RegExp("[({[^.$*+?\\\]})]","g"),'');
var text = $.trim($(item).text()),
i = options.initial ? '^' : '',
regSearch = new RegExp(i + val,'i');
return regSearch.test( text );
}
}, options);
inputEl$.on(options.eventKey, debouncer(function(e) {
var val = $(this).val();
console.log(val);
if(options.itemEl)
items$ = searchlist$.find(options.itemEl);
if(options.itemChild)
items$ = items$.find(options.itemChild);
var contains = items$.filter(function(){
return options.itemFilter.call(searchlist, this, val);
}),
containsNot = items$.not(contains);
if (options.itemChild){
contains = contains.parents(options.itemEl);
containsNot = containsNot.parents(options.itemEl).hide();
}
if(val!=='' && val.length >= options.minLength)
{
contains.show();
containsNot.hide();
if($.type(options.sourceData)==='function')
{
contains.hide();
containsNot.hide();
if(callReq)
{
if($.isFunction(callReq.abort))
callReq.abort();
else if($.isFunction(callReq.stop))
callReq.stop();
}
callReq = options.sourceData.call(searchlist, val, function(data) {
callReq = null;
contains.hide();
containsNot.hide();
searchlist$.find('.bts-dynamic-item').remove();
if(!data || data.length===0)
$( options.emptyNode.call(searchlist) ).addClass('bts-dynamic-item').appendTo(searchlist$);
else
for(var i in data)
$( options.sourceNode.call(searchlist, data[i]) ).addClass('bts-dynamic-item').appendTo(searchlist$);
});
} else if(contains.length===0) {
$( options.emptyNode.call(searchlist) ).addClass('bts-dynamic-item').appendTo(searchlist$);
}
}
else
{
contains.show();
containsNot.show();
searchlist$.find('.bts-dynamic-item').remove();
}
}, options.delay));
if(options.resetOnBlur)
inputEl$.on('blur', function(e) {
$(this).val('').trigger(options.eventKey);
});
return searchlist$;
};
})(jQuery); | navroopsingh/HepBProject | app/assets/javascripts/bootstrap-list-filter-contacts.js | JavaScript | mit | 3,485 |
/*!
* jquery.initialize. An basic element initializer plugin for jQuery.
*
* Copyright (c) 2014 Barış Güler
* http://hwclass.github.io
*
* Licensed under MIT
* http://www.opensource.org/licenses/mit-license.php
*
* http://docs.jquery.com/Plugins/Authoring
* jQuery authoring guidelines
*
* Launch : July 2014
* Version : 0.1.0
* Released: July 29th, 2014
*
*
* makes an element initialize for defined events with their names
*/
(function ($) {
$.fn.initialize = function (options) {
var currentElement = $(this),
opts = options;
var getSize = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
var setEvents = function () {
for (var countForEventsObj = 0, len = getSize(opts.events); countForEventsObj < len; countForEventsObj++) {
$(this).on(opts.events[countForEventsObj].name, opts.events[countForEventsObj].funcBody)
}
}
if (opts.init) {
setEvents();
}
return this;
}
})(jQuery); | hwclass/jquery.initialize | jquery.initialize-0.1.0.js | JavaScript | mit | 1,101 |
package com.mdg.droiders.samagra.shush;
import android.Manifest;
import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.PlaceBuffer;
import com.google.android.gms.location.places.Places;
import com.google.android.gms.location.places.ui.PlacePicker;
import com.mdg.droiders.samagra.shush.data.PlacesContract;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LoaderManager.LoaderCallbacks<Cursor>{
//constants
private static final String LOG_TAG = "MainActivity";
private static final int PERMISSIONS_REQUEST_FINE_LOCATION = 111;
private static final int PLACE_PICKER_REQUEST = 1;
//member variables
private PlaceListAdapter mAdapter;
private RecyclerView mRecyclerView;
private Button addPlaceButton;
private GoogleApiClient mClient;
private Geofencing mGeofencing;
private boolean mIsEnabled;
private CheckBox mRingerPermissionCheckBox;
/**
* Called when the activity is starting.
*
* @param savedInstanceState Bundle that contains the data provided to onSavedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mRecyclerView = (RecyclerView) findViewById(R.id.places_list_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new PlaceListAdapter(this,null);
mRecyclerView.setAdapter(mAdapter);
mRingerPermissionCheckBox = (CheckBox) findViewById(R.id.ringer_permissions_checkbox);
mRingerPermissionCheckBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onRingerPermissionsClicked();
}
});
Switch onOffSwitch = (Switch) findViewById(R.id.enable_switch);
mIsEnabled = getPreferences(MODE_PRIVATE).getBoolean(getString(R.string.setting_enabled),false);
onOffSwitch.setChecked(mIsEnabled);
onOffSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
editor.putBoolean(getString(R.string.setting_enabled),isChecked);
editor.commit();
if (isChecked) mGeofencing.registerAllGeofences();
else mGeofencing.unRegisterAllGeofences();
}
});
addPlaceButton = (Button) findViewById(R.id.add_location_button);
addPlaceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onAddPlaceButtonClicked();
}
});
mClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.enableAutoManage(this,this)
.build();
mGeofencing = new Geofencing(mClient,this);
}
/**
* Button click event handler for the add place button.
*/
private void onAddPlaceButtonClicked() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)!=PackageManager.PERMISSION_GRANTED){
Toast.makeText(this, getString(R.string.need_location_permission_message), Toast.LENGTH_SHORT).show();
return;
}
Toast.makeText(this, getString(R.string.location_permissions_granted_message), Toast.LENGTH_SHORT).show();
try {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Intent placePickerIntent = builder.build(this);
startActivityForResult(placePickerIntent,PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
/***
* Called when the Place Picker Activity returns back with a selected place (or after canceling)
*
* @param requestCode The request code passed when calling startActivityForResult
* @param resultCode The result code specified by the second activity
* @param data The Intent that carries the result data.
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode==PLACE_PICKER_REQUEST&&resultCode==RESULT_OK){
Place place = PlacePicker.getPlace(this,data);
if (place==null){
Log.i(LOG_TAG,"No place selected");
return;
}
String placeName = place.getName().toString();
String placeAddress = place.getAddress().toString();
String placeId = place.getId();
ContentValues values = new ContentValues();
values.put(PlacesContract.PlaceEntry.COLUMN_PLACE_ID,placeId);
getContentResolver().insert(PlacesContract.PlaceEntry.CONTENT_URI,values);
refreshPlacesData();
}
}
@Override
protected void onResume() {
super.onResume();
//initialise location permissions checkbox
CheckBox locationPermissionsCheckBox = (CheckBox) findViewById(R.id.location_permission_checkbox);
if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED){
locationPermissionsCheckBox.setChecked(false);
}
else {
locationPermissionsCheckBox.setChecked(true);
locationPermissionsCheckBox.setEnabled(false);
}
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT>=24 && !notificationManager.isNotificationPolicyAccessGranted()){
mRingerPermissionCheckBox.setChecked(false);
}
else {
mRingerPermissionCheckBox.setChecked(true);
mRingerPermissionCheckBox.setEnabled(false);
}
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return null;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
}
/**
* Called when the google API client is successfully connected.
* @param bundle Bundle of data provided to the clients by google play services.
*/
@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i(LOG_TAG,"Api connection successful");
Toast.makeText(this, "onConnected", Toast.LENGTH_SHORT).show();
refreshPlacesData();
}
/**
* Called when the google API client is suspended
* @param cause The reason for the disconnection. Defined by the constant CAUSE_*.
*/
@Override
public void onConnectionSuspended(int cause) {
Log.i(LOG_TAG,"API Client connection suspended.");
}
/**
* Called when the google API client failed to connect to the PlayServices.
* @param connectionResult A coonectionResult that can be used to solve the error.
*/
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.i(LOG_TAG,"API Connection client suspended.");
Toast.makeText(this, "onConectionFailed", Toast.LENGTH_SHORT).show();
}
public void refreshPlacesData(){
Uri uri = PlacesContract.PlaceEntry.CONTENT_URI;
Cursor dataCursor = getContentResolver().query(uri,
null,
null,
null,null,null);
if (dataCursor==null||dataCursor.getCount()==0) return;
List<String> placeIds = new ArrayList<String>();
while (dataCursor.moveToNext()){
placeIds.add(dataCursor.getString(dataCursor.getColumnIndex(PlacesContract.PlaceEntry.COLUMN_PLACE_ID)));
}
PendingResult<PlaceBuffer> placeBufferPendingResult = Places.GeoDataApi.getPlaceById(mClient,
placeIds.toArray(new String[placeIds.size()]));
placeBufferPendingResult.setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(@NonNull PlaceBuffer places) {
mAdapter.swapPlaces(places);
mGeofencing.updateGeofencesList(places);
if (mIsEnabled) mGeofencing.registerAllGeofences();
}
});
}
private void onRingerPermissionsClicked(){
Intent intent = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
intent = new Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
}
startActivity(intent);
}
public void onLocationPermissionClicked (View view){
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
PERMISSIONS_REQUEST_FINE_LOCATION);
}
}
| samagra14/Shush | app/src/main/java/com/mdg/droiders/samagra/shush/MainActivity.java | Java | mit | 10,861 |
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the wp-nonce-wrapper package.
*
* (c) 2017 Brandon Olivares
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Devbanana\WPNonceWrapper;
/**
* Wordpress nonce attached to field.
*
* Wrapper of wp_nonce_field().
*
* @author Brandon Olivares
*/
class WPNonceField extends AbstractWPNonce {
/**
* Generate nonce.
*
* Wrapper for wp_nonce_field().
*
* @param string $action (optional) The action for this nonce. Defaults to -1.
* @param string $name (optional) The name of the nonce used in the URL. Defaults to _wpnonce.
* @param bool $referer (optional) Whether to add a referer field as well.
* @param bool $echo Whether to print out the form fields.
*
* @return Devbanana\WPNonceWrapper\WPNonceField
*/
public static function generate( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) {
$instance = new static();
$instance->setOutput( wp_nonce_field( $action, $name, $referer, $echo ) );
// Get the nonce from the field
$matched = preg_match( '/value="([^"]+)"/', $instance->getOutput(), $matches );
if ( $matched ) {
$instance->setNonce( $matches[1] );
}
$instance->setAction( $action );
$instance->setName( $name );
return $instance;
}
}
| devbanana/wp-nonce-wrapper | src/Devbanana/WPNonceWrapper/WPNonceField.php | PHP | mit | 1,417 |
/**
* utility library
*/
var basicAuth = require('basic-auth');
var fs = require('fs');
/**
* Simple basic auth middleware for use with Express 4.x.
*
* @example
* app.use('/api-requiring-auth', utils.basicAuth('username', 'password'));
*
* @param {string} username Expected username
* @param {string} password Expected password
* @returns {function} Express 4 middleware requiring the given credentials
*/
exports.basicAuth = function(username, password) {
return function(req, res, next) {
var user = basicAuth(req);
if (!user || user.name !== username || user.pass !== password) {
res.set('WWW-Authenticate', 'Basic realm=Authorization Required');
return res.sendStatus(401);
}
next();
};
};
exports.cpuTemp = function() {
var cputemp = Math.round(((parseFloat(fs.readFileSync("/sys/class/thermal/thermal_zone0/temp"))/1000) * (9/5) + 32)*100)/100;
return cputemp;
};
exports.w1Temp = function(serial) {
var temp;
var re=/t=(\d+)/;
try {
var text=fs.readFileSync('/sys/bus/w1/devices/' + serial + '/w1_slave','utf8');
if (typeof(text) != "undefined") {
if (text.indexOf("YES") > -1) {
var temptext=text.match(re);
if (typeof(temptext) != "undefined") {
temp = Math.round(((parseFloat(temptext[1])/1000) * (9/5) + 32)*100)/100;
}
}
}
} catch (e) {
console.log(e);
}
return temp;
};
| scwissel/garagepi | utils.js | JavaScript | mit | 1,421 |
version https://git-lfs.github.com/spec/v1
oid sha256:5f5740cfcc24e2a730f7ea590ae0dc07d66d256fd183c46facf3fdfeb0bd69d2
size 3654
| yogeshsaroya/new-cdnjs | ajax/libs/yui/3.16.0/io-queue/io-queue.js | JavaScript | mit | 129 |
version https://git-lfs.github.com/spec/v1
oid sha256:467bccdb74ef62e6611ba27f338a0ba0c49ba9a90ef1facb394c14de676318cf
size 1150464
| yogeshsaroya/new-cdnjs | ajax/libs/vis/3.12.0/vis.js | JavaScript | mit | 132 |
version https://git-lfs.github.com/spec/v1
oid sha256:4f8b1998d2048d6a6cabacdfb3689eba7c9cb669d6f81dbbd18156bdb0dbe18f
size 1880
| yogeshsaroya/new-cdnjs | ajax/libs/uikit/2.5.0/js/addons/form-password.js | JavaScript | mit | 129 |
<TS language="cs" version="2.1">
<context>
<name>AddressBookPage</name>
<message>
<source>Right-click to edit address or label</source>
<translation>Pravým kliknutím upravte adresu nebo popisek</translation>
</message>
<message>
<source>Create a new address</source>
<translation>Vytvořit novou adresu</translation>
</message>
<message>
<source>&New</source>
<translation>&Nová</translation>
</message>
<message>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopírovat vybranou adresu do mezipaměti</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopírovat</translation>
</message>
<message>
<source>Delete the currently selected address from the list</source>
<translation>Smazat aktuálně vybranou adresu ze seznamu</translation>
</message>
<message>
<source>&Delete</source>
<translation>&Smazat</translation>
</message>
<message>
<source>Export the data in the current tab to a file</source>
<translation>Exportovat data z aktulní záložky do souboru</translation>
</message>
<message>
<source>&Export</source>
<translation>&Exportovat</translation>
</message>
<message>
<source>C&lose</source>
<translation>Z&avřít</translation>
</message>
<message>
<source>Choose the address to send coins to</source>
<translation>Vybrat adresu kam poslat peníze</translation>
</message>
<message>
<source>Choose the address to receive coins with</source>
<translation>Vybrat adresu pro přijetí peněz</translation>
</message>
<message>
<source>C&hoose</source>
<translation>V&ybrat</translation>
</message>
<message>
<source>Sending addresses</source>
<translation>Adresy pro odeslání peněz</translation>
</message>
<message>
<source>Receiving addresses</source>
<translation>Adresy pro přijetí peněz</translation>
</message>
<message>
<source>These are your NEOS addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>Toto jsou Vaše NEOS adresy pro poslání platby. Vždy si překontrolujte množství peněz a cílovou adresu než platbu odešlete.</translation>
</message>
<message>
<source>These are your NEOS addresses for receiving payments. It is recommended to use a new receiving address for each transaction.</source>
<translation>Toto jsou Vaše NEOS adresy pro přijetí plateb. Je doporučeno použít novou adresu pro každou novou transakci.</translation>
</message>
<message>
<source>&Copy Address</source>
<translation>&Kopírovat Adresu</translation>
</message>
<message>
<source>Copy &Label</source>
<translation>Kopírovat &Popis</translation>
</message>
<message>
<source>&Edit</source>
<translation>&Upravit</translation>
</message>
<message>
<source>Export Address List</source>
<translation>Exportovat Seznam Adres</translation>
</message>
<message>
<source>Comma separated file (*.csv)</source>
<translation>Comma separated file (*.csv)</translation>
</message>
<message>
<source>Exporting Failed</source>
<translation>Export selhal</translation>
</message>
<message>
<source>There was an error trying to save the address list to %1. Please try again.</source>
<translation>Objevila se chyba při pokusu o uložení seznamu adres do %1. Prosím, zkuste to znovu.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<source>Label</source>
<translation>Popis</translation>
</message>
<message>
<source>Address</source>
<translation>Adresa</translation>
</message>
<message>
<source>(no label)</source>
<translation>(bez popisku)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<source>Passphrase Dialog</source>
<translation>Dialog frázového hesla</translation>
</message>
<message>
<source>Enter passphrase</source>
<translation>Zadejte frázové heslo</translation>
</message>
<message>
<source>New passphrase</source>
<translation>Nové frázové heslo</translation>
</message>
<message>
<source>Repeat new passphrase</source>
<translation>Zopakujte frázové heslo</translation>
</message>
<message>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation>Slouží k neumožnění zaslání jednoduché platby, pokud je učet OS kompromitován. Neposkytuje tak reálné zabezpeční.</translation>
</message>
<message>
<source>For anonymization and staking only</source>
<translation>Pouze pro anonymizaci a sázení</translation>
</message>
<message>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Zadejte nové frázové heslo pro Vaši peněženku <br/> Prosím, použijte frázové heslo z <b> nebo více náhodných znaků </b>, nebo<b>z osmi nebo více slov</b> .</translation>
</message>
<message>
<source>Encrypt wallet</source>
<translation>Šifrovat peněženku</translation>
</message>
<message>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Pro tuto operaci potřebujete frázové heslo k odemčení Vaší paněženky.</translation>
</message>
<message>
<source>Unlock wallet</source>
<translation>Odemknout peněženku</translation>
</message>
<message>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Pro tuto operaci potřebujete frázové heslo pro odšifrování Vaší paněženky.</translation>
</message>
<message>
<source>Decrypt wallet</source>
<translation>Odšifrovat peněženku</translation>
</message>
<message>
<source>Change passphrase</source>
<translation>Změnit frázové heslo</translation>
</message>
<message>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Zadajete staré a nové frázové heslo Vaší peněženky.</translation>
</message>
<message>
<source>Confirm wallet encryption</source>
<translation>Potvrdit zašifrování peněženky</translation>
</message>
<message>
<source>NEOS will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your NEOS from being stolen by malware infecting your computer.</source>
<translation>NEOS se teď zavře pro dokončení šifrovacího procesu. Prosím, vemte na vědomí, že zašifrování Vaší peněženky plně neochrání Vaše NEOS před krádží, pokud je Váš počítač infikován malwarem.</translation>
</message>
<message>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Opravdu chcete zašifrovat Vaši peněženku?</translation>
</message>
<message>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR NEOS</b>!</source>
<translation>Varování: Pokud zašifrujete svou peněženku a ztratíte frázové heslo, tak <b>ZTRATÍTE VŠECHNY VAŠE NEOS</b>!</translation>
</message>
<message>
<source>Wallet encrypted</source>
<translation>Pěněženka je zašifrována</translation>
</message>
<message>
<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>DŮLEŽITÉ: Každá předešlá zaloha, kterou jste provedli, by měla být nahrazena nově vygenerovanou, šifrovavou zálohou soboru Vaší peněženky. Z bezpečnostních důvodů budou všechny předešlé zálohy nezašifrované peněženky nepoužitelné, jakmile začnete používat nově zašifrovanou peněženku.</translation>
</message>
<message>
<source>Wallet encryption failed</source>
<translation>Šifrování peněženky selhalo</translation>
</message>
<message>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Šifrování peněženky selhalo kvůli vnitřní chybě aplikace. Vaše peněženka není zašifrovaná.</translation>
</message>
<message>
<source>The supplied passphrases do not match.</source>
<translation>Zadaná frázová hesla se neshodují.</translation>
</message>
<message>
<source>Wallet unlock failed</source>
<translation>Uzamčení pěněženky selhalo</translation>
</message>
<message>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Zadané frázové heslo pro dešifrování peněženky není správné.</translation>
</message>
<message>
<source>Wallet decryption failed</source>
<translation>Odšifrování peněženky selhalo</translation>
</message>
<message>
<source>Wallet passphrase was successfully changed.</source>
<translation>Frázové heslo peněženky bylo úspěšně změněno.</translation>
</message>
<message>
<source>Warning: The Caps Lock key is on!</source>
<translation>Vaarování: Cpas Lock je zapnutý!</translation>
</message>
</context>
<context>
<name>Bip38ToolDialog</name>
<message>
<source>BIP 38 Tool</source>
<translation>BIP 38 Nástroj</translation>
</message>
<message>
<source>&BIP 38 Encrypt</source>
<translation>&BIP 38 Šifrovat</translation>
</message>
<message>
<source>Enter a Neos Address that you would like to encrypt using BIP 38. Enter a passphrase in the middle box. Press encrypt to compute the encrypted private key.</source>
<translation>Zadejte NEOS adresu, kterou si přejete zašifrovat pomocí BIP38. Frázové heslo zadejte do prostředního boxu. Stiskněte šifrovat pro výpočet šifrovaného privátního klíče.</translation>
</message>
<message>
<source>Address:</source>
<translation>Adresa:</translation>
</message>
<message>
<source>The NEOS address to sign the message with</source>
<translation>NEOS adresa pro podepsání zprávy</translation>
</message>
<message>
<source>Choose previously used address</source>
<translation>Vyberte již dříve použitou adresu</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Vložit adresu z mezipamětí</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<source>Passphrase: </source>
<translation>Frázové heslo:</translation>
</message>
<message>
<source>Encrypted Key:</source>
<translation>Zašifrovaný Klíč:</translation>
</message>
<message>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopírovat aktuální podpis do systémové mezipaměti</translation>
</message>
<message>
<source>Sign the message to prove you own this NEOS address</source>
<translation>Podepsat zprávu k prokázání, že vlastníte tuto NEOS adresu</translation>
</message>
<message>
<source>Encrypt &Key</source>
<translation>Šifrovat &Klíč</translation>
</message>
<message>
<source>Reset all sign message fields</source>
<translation>Resetovat všechny položky podepsání zprávy</translation>
</message>
<message>
<source>Clear &All</source>
<translation>Smazat &Vše</translation>
</message>
<message>
<source>&BIP 38 Decrypt</source>
<translation>&BIP 38 Dešifrování</translation>
</message>
<message>
<source>Enter the BIP 38 encrypted private key. Enter the passphrase in the middle box. Click Decrypt Key to compute the private key. After the key is decrypted, clicking 'Import Address' will add this private key to the wallet.</source>
<translation>Vložte BIP 38 šifrovaný privítní klíc. Frázové heslo vložte do prostředního boxu. Kliknětě na Dešifrovat Klíč pro výpočet privátního klíče. Poté co bude klíč dešifrován, kliknutím na 'Importovat Adresu' přidáte privátní klíč do Vaší peněženky.</translation>
</message>
<message>
<source>The NEOS address the message was signed with</source>
<translation>NEOS adresa zprávy byla podpsána</translation>
</message>
<message>
<source>Verify the message to ensure it was signed with the specified NEOS address</source>
<translation>Verifikujte zprávu pro ujištění, že byla podepsána zmíněnou NEOS adresou</translation>
</message>
<message>
<source>Decrypt &Key</source>
<translation>Dešifrovat &Klíč</translation>
</message>
<message>
<source>Reset all verify message fields</source>
<translation>Resetovat všechny položky pro ověření zprávy</translation>
</message>
<message>
<source>Decrypted Key:</source>
<translation>Dešifrovaný Klíč</translation>
</message>
<message>
<source>Import Address</source>
<translation>Importovat Adresu</translation>
</message>
<message>
<source>Click "Decrypt Key" to compute key</source>
<translation>Kliněte na "Dešifrovat Klíč" pro výpočet klíče</translation>
</message>
<message>
<source>The entered passphrase is invalid. </source>
<translation>Zadané frázové heslo není validní.</translation>
</message>
<message>
<source>Allowed: 0-9,a-z,A-Z,</source>
<translation>Povoleno: 0-9,a-z,A-Z,</translation>
</message>
<message>
<source>The entered address is invalid.</source>
<translation>Zadaná adresa není validní.</translation>
</message>
<message>
<source>Please check the address and try again.</source>
<translation>Prosím zkontolujte adresu a zkuste to znovu.</translation>
</message>
<message>
<source>The entered address does not refer to a key.</source>
<translation>Zadaná adresa neodpovídá klíči.</translation>
</message>
<message>
<source>Wallet unlock was cancelled.</source>
<translation>Odemknutí peněženky bylo zrušeno.</translation>
</message>
<message>
<source>Private key for the entered address is not available.</source>
<translation>Privátní klíč pro zadanou adresu není dostupný.</translation>
</message>
<message>
<source>Failed to decrypt.</source>
<translation>Dešifrování selhalo.</translation>
</message>
<message>
<source>Please check the key and passphrase and try again.</source>
<translation>Prosím, zkontrolujte klíč a frázové heslo a zkuste to znovu.</translation>
</message>
<message>
<source>Data Not Valid.</source>
<translation>Data nejsou validní.</translation>
</message>
<message>
<source>Please try again.</source>
<translation>Prosím, zkuste to znovu.</translation>
</message>
<message>
<source>Please wait while key is imported</source>
<translation>Prosím, počkejte než se klíč importuje</translation>
</message>
<message>
<source>Key Already Held By Wallet</source>
<translation>Klíč se už v peněžence nachází</translation>
</message>
<message>
<source>Error Adding Key To Wallet</source>
<translation>Chyba při vkládání klíče do peněženky</translation>
</message>
<message>
<source>Successfully Added Private Key To Wallet</source>
<translation>Klíč byl úspěšně přidán do peněženky</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<source>Wallet</source>
<translation>Peněženka</translation>
</message>
<message>
<source>Node</source>
<translation>Uzel</translation>
</message>
<message>
<source>&Overview</source>
<translation>&Přehled</translation>
</message>
<message>
<source>Show general overview of wallet</source>
<translation>Ukaž celkový přehled peněženky</translation>
</message>
<message>
<source>&Send</source>
<translation>&Odeslat</translation>
</message>
<message>
<source>&Receive</source>
<translation>&Přijmout</translation>
</message>
<message>
<source>&Transactions</source>
<translation>&Transakce</translation>
</message>
<message>
<source>Browse transaction history</source>
<translation>Procházet historii transakcí</translation>
</message>
<message>
<source>E&xit</source>
<translation>E&xit</translation>
</message>
<message>
<source>Quit application</source>
<translation>Zavřít aplikaci</translation>
</message>
<message>
<source>About &Qt</source>
<translation>O &Qt</translation>
</message>
<message>
<source>Show information about Qt</source>
<translation>Ukaž informace o Qt</translation>
</message>
<message>
<source>&Options...</source>
<translation>&Možnosti...</translation>
</message>
<message>
<source>&Show / Hide</source>
<translation>&Zobrazit / Schovat</translation>
</message>
<message>
<source>Show or hide the main Window</source>
<translation>Zobrazit nebo schovat hlavní okno</translation>
</message>
<message>
<source>&Encrypt Wallet...</source>
<translation>&Šifrovat Peněženku...</translation>
</message>
<message>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Šifrovat privátní klíče náležící Vaší peněžence</translation>
</message>
<message>
<source>&Backup Wallet...</source>
<translation>&Zálohovat peněženku...</translation>
</message>
<message>
<source>Backup wallet to another location</source>
<translation>Zálohovat peněženku na jiné místo</translation>
</message>
<message>
<source>&Change Passphrase...</source>
<translation>&Změnit frázové heslo...</translation>
</message>
<message>
<source>Change the passphrase used for wallet encryption</source>
<translation>Změnit frázové heslo pro šifrování peněženky</translation>
</message>
<message>
<source>&Unlock Wallet...</source>
<translation>&Odemknout peněženku...</translation>
</message>
<message>
<source>Unlock wallet</source>
<translation>Odemknout peněženku</translation>
</message>
<message>
<source>&Lock Wallet</source>
<translation>&Zamknout Peněženku</translation>
</message>
<message>
<source>Sign &message...</source>
<translation>Podepsat &zprávu...</translation>
</message>
<message>
<source>&Verify message...</source>
<translation>&Verifikovat zprávu...</translation>
</message>
<message>
<source>&Information</source>
<translation>&Informace</translation>
</message>
<message>
<source>Show diagnostic information</source>
<translation>Zobrazit diagnostická data</translation>
</message>
<message>
<source>&Debug console</source>
<translation>&Ladící konzolce</translation>
</message>
<message>
<source>Open debugging console</source>
<translation>Otevřít ladící konzoli</translation>
</message>
<message>
<source>&Network Monitor</source>
<translation>&Monitorování sítě</translation>
</message>
<message>
<source>Show network monitor</source>
<translation>Zobrazit monitorování sítě</translation>
</message>
<message>
<source>&Peers list</source>
<translation>&Seznam peerů</translation>
</message>
<message>
<source>Show peers info</source>
<translation>Zobrazit info peerů</translation>
</message>
<message>
<source>Wallet &Repair</source>
<translation>&Oprava Peněženky</translation>
</message>
<message>
<source>Show wallet repair options</source>
<translation>Zobrazit možnosti opravy peněženky</translation>
</message>
<message>
<source>Open configuration file</source>
<translation>Otevřít konfigurační soubor</translation>
</message>
<message>
<source>Show Automatic &Backups</source>
<translation>Zobrazit Automatické &Zálohy</translation>
</message>
<message>
<source>Show automatically created wallet backups</source>
<translation>Zobrazit automaticky vytvořené zálohy peněženky</translation>
</message>
<message>
<source>&Sending addresses...</source>
<translation>&Odesílací adresy...</translation>
</message>
<message>
<source>Show the list of used sending addresses and labels</source>
<translation>Zobrazit seznam použitých adres a popisků pro odedslání platby</translation>
</message>
<message>
<source>&Receiving addresses...</source>
<translation>&Příjimací adresy...</translation>
</message>
<message>
<source>Show the list of used receiving addresses and labels</source>
<translation>Zobrazit seznam použitých adres a popisků pro přijetí plateb</translation>
</message>
<message>
<source>Open &URI...</source>
<translation>Otevřít &URI...</translation>
</message>
<message>
<source>&Command-line options</source>
<translation>Možnosti příkazové řádky</translation>
</message>
<message>
<source>Synchronizing additional data: %p%</source>
<translation>Synchronizuji přídavná data: %p%</translation>
</message>
<message>
<source>&File</source>
<translation>&Soubor</translation>
</message>
<message>
<source>&Settings</source>
<translation>&Nastavení</translation>
</message>
<message>
<source>&Tools</source>
<translation>&Nástroje</translation>
</message>
<message>
<source>&Help</source>
<translation>&Pomoc</translation>
</message>
<message>
<source>Tabs toolbar</source>
<translation>Nástrojová lišta záložek</translation>
</message>
<message>
<source>NEOS Core</source>
<translation>NEOS Core</translation>
</message>
<message>
<source>Send coins to a NEOS address</source>
<translation>Odeslat platbuna NEOS adresu</translation>
</message>
<message>
<source>Request payments (generates QR codes and neos: URIs)</source>
<translation>Vyžádat platbu (generování QK kódu a neos: URIs)</translation>
</message>
<message>
<source>&Masternodes</source>
<translation>&Masternody</translation>
</message>
<message>
<source>Browse masternodes</source>
<translation>Procházet masternody</translation>
</message>
<message>
<source>&About NEOS Core</source>
<translation>&O NEOS Core</translation>
</message>
<message>
<source>Show information about NEOS Core</source>
<translation>Zobraz informace o NEOS Core</translation>
</message>
<message>
<source>Modify configuration options for NEOS</source>
<translation>Upravit možnosti konfigurace pro NEOS</translation>
</message>
<message>
<source>Sign messages with your NEOS addresses to prove you own them</source>
<translation>Podepsat zprávy Vaší NEOS adresou pro prokázaní, že jste jejich vlastníkem</translation>
</message>
<message>
<source>Verify messages to ensure they were signed with specified NEOS addresses</source>
<translation>Ověřit zprávy k zajištění, že bylypodepsány vybranými NEOS adresami</translation>
</message>
<message>
<source>&BIP38 tool</source>
<translation>&BIP38 nástroj</translation>
</message>
<message>
<source>Encrypt and decrypt private keys using a passphrase</source>
<translation>Šifrovat a dešivraovat klíče s použitím frázového hesla</translation>
</message>
<message>
<source>&MultiSend</source>
<translation>&MultiSend</translation>
</message>
<message>
<source>MultiSend Settings</source>
<translation>Nastavení MultiSendu</translation>
</message>
<message>
<source>Open Wallet &Configuration File</source>
<translation>Otevřít Pěněženkový &Konfigurační soubor</translation>
</message>
<message>
<source>Open &Masternode Configuration File</source>
<translation>Otevřít &Masternodový Konfigurační Soubor</translation>
</message>
<message>
<source>Open Masternode configuration file</source>
<translation>Otevřít Masternodový konfigurační soubor</translation>
</message>
<message>
<source>Open a NEOS: URI or payment request</source>
<translation>Otevřít NEOS: URI nebo platební žádost</translation>
</message>
<message>
<source>&Blockchain explorer</source>
<translation>&Blockchanový průzkumník</translation>
</message>
<message>
<source>Block explorer window</source>
<translation>Okno blokového průzkumníka</translation>
</message>
<message>
<source>Show the NEOS Core help message to get a list with possible NEOS command-line options</source>
<translation>Zobrazit NEOS Core pomocnou zpráv pro získání seznamu možných parametrů NEOS pro příkazy do příkazové řádky</translation>
</message>
<message>
<source>NEOS Core client</source>
<translation>NEOS Core klient</translation>
</message>
<message>
<source>Synchronizing with network...</source>
<translation>Synchronizace se sítí...</translation>
</message>
<message>
<source>Importing blocks from disk...</source>
<translation>Import bloků z disku...</translation>
</message>
<message>
<source>Reindexing blocks on disk...</source>
<translation>Reindexace bloků na disku...</translation>
</message>
<message>
<source>No block source available...</source>
<translation>Není dostupný žádný zdroj bloků...</translation>
</message>
<message>
<source>Up to date</source>
<translation>Aktualizováno</translation>
</message>
<message>
<source>%1 and %2</source>
<translation>%1 a %2</translation>
</message>
<message>
<source>%1 behind</source>
<translation>%1 za</translation>
</message>
<message>
<source>Last received block was generated %1 ago.</source>
<translation>Poslední blok byl vygenerovaný před %1.</translation>
</message>
<message>
<source>Transactions after this will not yet be visible.</source>
<translation>Po této akci už nebudou transakce viditelné.</translation>
</message>
<message>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<source>Warning</source>
<translation>Varování</translation>
</message>
<message>
<source>Information</source>
<translation>Informace</translation>
</message>
<message>
<source>Sent transaction</source>
<translation>Odeslané transakce</translation>
</message>
<message>
<source>Incoming transaction</source>
<translation>Příchozí transakce</translation>
</message>
<message>
<source>Sent MultiSend transaction</source>
<translation>Odeslat MultiSend transakci</translation>
</message>
<message>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Datum: %1
Hodnota: %2
Typ: %3
Adresa: %4
</translation>
</message>
<message>
<source>Staking is active
MultiSend: %1</source>
<translation>Sázení je aktivní
MultiSend: %1</translation>
</message>
<message>
<source>Active</source>
<translation>Aktivní</translation>
</message>
<message>
<source>Not Active</source>
<translation>Neaktivní</translation>
</message>
<message>
<source>Staking is not active
MultiSend: %1</source>
<translation>Sázení není aktivní
MultiSend: %1</translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Peněženka je <b>zašifrovaná</b> a momentálně je <b>odemčená</b></translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b> for anonimization and staking only</source>
<translation>Peněženka je <b>zašifrovaná</b> a momentálně je <b>odemčená</b> pouze pro anonimizace a sázení</translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Peněženka je <b>zašifrovaná</b> a momentálně je <b>zamčená</b></translation>
</message>
</context>
<context>
<name>BlockExplorer</name>
<message>
<source>Blockchain Explorer</source>
<translation>Blockchainový průzkumník</translation>
</message>
<message>
<source>Address / Block / Transaction</source>
<translation>Adresa / Blok / Transakce</translation>
</message>
<message>
<source>Search</source>
<translation>Hledat</translation>
</message>
<message>
<source>TextLabel</source>
<translation>TextPopisku</translation>
</message>
<message>
<source>Not all transactions will be shown. To view all transactions you need to set txindex=1 in the configuration file (neos.conf).</source>
<translation>Ne všechny transakce budou zobrazeny. Pro zobrazení všech transackí nastavte v konfiguračním souboru (neos.conf) txindex=1.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<source>Network Alert</source>
<translation>Upozornění sítě</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<source>Quantity:</source>
<translation>Množství:</translation>
</message>
<message>
<source>Bytes:</source>
<translation>Byty:</translation>
</message>
<message>
<source>Amount:</source>
<translation>Hodnota:</translation>
</message>
<message>
<source>Priority:</source>
<translation>Priorita:</translation>
</message>
<message>
<source>Fee:</source>
<translation>Poplatek:</translation>
</message>
<message>
<source>Coin Selection</source>
<translation>Výběr mince</translation>
</message>
<message>
<source>After Fee:</source>
<translation>Po poplatku:</translation>
</message>
<message>
<source>Change:</source>
<translation>Změna:</translation>
</message>
<message>
<source>Tree mode</source>
<translation>Stromový mód</translation>
</message>
<message>
<source>List mode</source>
<translation>Seznamový mód</translation>
</message>
<message>
<source>(1 locked)</source>
<translation>(1 zamčeno)</translation>
</message>
<message>
<source>Amount</source>
<translation>Hodnota</translation>
</message>
<message>
<source>Received with label</source>
<translation>Obdrženo s popiskem</translation>
</message>
<message>
<source>Received with address</source>
<translation>Obdrženo s adresou</translation>
</message>
<message>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<source>Confirmations</source>
<translation>Potvrzení</translation>
</message>
<message>
<source>Confirmed</source>
<translation>Potvrzeno</translation>
</message>
<message>
<source>Priority</source>
<translation>Priorita</translation>
</message>
<message>
<source>Copy address</source>
<translation>Kopírovat adresu</translation>
</message>
<message>
<source>Copy label</source>
<translation>Kopírovat popisek</translation>
</message>
<message>
<source>Copy amount</source>
<translation>Kopírovat hodnotu</translation>
</message>
<message>
<source>Copy transaction ID</source>
<translation>Kopírovat ID transakce</translation>
</message>
<message>
<source>Lock unspent</source>
<translation>Zamknout neutracené</translation>
</message>
<message>
<source>Unlock unspent</source>
<translation>Odemknout neutracené</translation>
</message>
<message>
<source>Copy quantity</source>
<translation>Kopíroat množstí</translation>
</message>
<message>
<source>Copy fee</source>
<translation>Kopírovat poplatek</translation>
</message>
<message>
<source>Copy after fee</source>
<translation>Kopírovat s poplatkem</translation>
</message>
<message>
<source>Copy bytes</source>
<translation>Kopírovat byty</translation>
</message>
<message>
<source>Copy priority</source>
<translation>Kopírovat prioritu</translation>
</message>
<message>
<source>Copy change</source>
<translation>Kopírovat změnu</translation>
</message>
<message>
<source>Please switch to "List mode" to use this function.</source>
<translation>Prosím, přepněto do "Seznamového módu" pro použití této funkce</translation>
</message>
<message>
<source>highest</source>
<translation>nejvyšší</translation>
</message>
<message>
<source>higher</source>
<translation>vyšší</translation>
</message>
<message>
<source>high</source>
<translation>vysoký</translation>
</message>
<message>
<source>medium-high</source>
<translation>středně vysoký</translation>
</message>
<message>
<source>n/a</source>
<translation>n/a</translation>
</message>
<message>
<source>medium</source>
<translation>střední</translation>
</message>
<message>
<source>low-medium</source>
<translation>středně malý</translation>
</message>
<message>
<source>low</source>
<translation>nízký</translation>
</message>
<message>
<source>lower</source>
<translation>nižší</translation>
</message>
<message>
<source>lowest</source>
<translation>nejnižší</translation>
</message>
<message>
<source>(%1 locked)</source>
<translation>(%1 zamknuto)</translation>
</message>
<message>
<source>none</source>
<translation>žádný</translation>
</message>
<message>
<source>yes</source>
<translation>ano</translation>
</message>
<message>
<source>no</source>
<translation>ne</translation>
</message>
<message>
<source>This label turns red, if the transaction size is greater than 1000 bytes.</source>
<translation>Tento text zčervená, pokud bude velikost transakce větší než 1000 bytů.</translation>
</message>
<message>
<source>This means a fee of at least %1 per kB is required.</source>
<translation>To znaměná, že nejnižší nutný poplatek musí být nejméně %1 za kB.</translation>
</message>
<message>
<source>Can vary +/- 1 byte per input.</source>
<translation>Může se lišit +/- 1 byte na vstup.</translation>
</message>
<message>
<source>Transactions with higher priority are more likely to get included into a block.</source>
<translation>Transakce s vyšší prioritou bude pravděpodobněji zařazena do bloku.</translation>
</message>
<message>
<source>This label turns red, if the priority is smaller than "medium".</source>
<translation>Tento text zčervená, pokud je priorita menší než "střední".</translation>
</message>
<message>
<source>This label turns red, if any recipient receives an amount smaller than %1.</source>
<translation>Tento text zčervená, pokud je hodnota pro některého z příjemců menší než %1.</translation>
</message>
<message>
<source>(no label)</source>
<translation>(bez popisku)</translation>
</message>
<message>
<source>change from %1 (%2)</source>
<translation>změna z %1 (%2)</translation>
</message>
<message>
<source>(change)</source>
<translation>(změna)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<source>Edit Address</source>
<translation>Upravit adresu</translation>
</message>
<message>
<source>&Label</source>
<translation>&Popis</translation>
</message>
<message>
<source>&Address</source>
<translation>&Adresy</translation>
</message>
<message>
<source>New receiving address</source>
<translation>Nová adresa pro přijetí platby</translation>
</message>
<message>
<source>New sending address</source>
<translation>Nová adresa k odeslání platby</translation>
</message>
<message>
<source>Edit receiving address</source>
<translation>Upravit adresu pro přijetí platby</translation>
</message>
<message>
<source>Edit sending address</source>
<translation>Upravit adresu k odeslání platby</translation>
</message>
<message>
<source>The entered address "%1" is not a valid NEOS address.</source>
<translation>Zadaná adresa "%1" není validní NEOS adresa.</translation>
</message>
<message>
<source>The entered address "%1" is already in the address book.</source>
<translation>Zadaná adresa "%1" je již ve Vašem seznamu adres.</translation>
</message>
<message>
<source>Could not unlock wallet.</source>
<translation>Nepodařilo se odemknout peněženku.</translation>
</message>
<message>
<source>New key generation failed.</source>
<translation>Generování nového klíče selhalo.</translation>
</message>
</context>
<context>
<name>FreespaceChecker</name>
<message>
<source>A new data directory will be created.</source>
<translation>Nová složka byla vytvořena.</translation>
</message>
<message>
<source>name</source>
<translation>jméno</translation>
</message>
<message>
<source>Directory already exists. Add %1 if you intend to create a new directory here.</source>
<translation>Složka již existuje. Přidejte %1 pokud zde chcete vytvořit novou složku.</translation>
</message>
<message>
<source>Path already exists, and is not a directory.</source>
<translation>Cesta již existuje, a není to složka</translation>
</message>
<message>
<source>Cannot create data directory here.</source>
<translation>Zde nelze vytvořit složku.</translation>
</message>
</context>
<context>
<name>HelpMessageDialog</name>
<message>
<source>version</source>
<translation>verze</translation>
</message>
<message>
<source>NEOS Core</source>
<translation>NEOS Core</translation>
</message>
<message>
<source>About NEOS Core</source>
<translation>O NEOS Core</translation>
</message>
<message>
<source>Command-line options</source>
<translation>Možnosti příkazové řádky</translation>
</message>
<message>
<source>Usage:</source>
<translation>Použití:</translation>
</message>
<message>
<source>command-line options</source>
<translation>možnosti příkazové řádky</translation>
</message>
<message>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Nastavit jazyk, například "de_DE" (defaultně: systémová lokalizace)</translation>
</message>
<message>
<source>Start minimized</source>
<translation>Spustit minimalizované</translation>
</message>
<message>
<source>Set SSL root certificates for payment request (default: -system-)</source>
<translation>Nastavit SSL kořenový certifikát pro platební žádosti (defaultně: - system-)</translation>
</message>
</context>
<context>
<name>Intro</name>
<message>
<source>Welcome</source>
<translation>Vítejte</translation>
</message>
<message>
<source>Welcome to NEOS Core.</source>
<translation>Vítejte v NEOS Core.</translation>
</message>
<message>
<source>As this is the first time the program is launched, you can choose where NEOS Core will store its data.</source>
<translation>Při prvním spuštění programu si můžete vybrat, kam bude NEOS Core ukládat svá data.</translation>
</message>
<message>
<source>NEOS Core will download and store a copy of the NEOS block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</source>
<translation>NEOS Core stáhne a uloží kopii NEOS blockchainu. Nejméně %1GB dat bude do této složky uloženo a v průběhu času bude ukládat další data. Peněženka bude v této složce uložena také.</translation>
</message>
<message>
<source>Use the default data directory</source>
<translation>Použít defaultně nastavenou složku pro data</translation>
</message>
<message>
<source>Use a custom data directory:</source>
<translation>Použít vlastní složku pro data</translation>
</message>
<message>
<source>NEOS Core</source>
<translation>NEOS Core</translation>
</message>
<message>
<source>Error: Specified data directory "%1" cannot be created.</source>
<translation>Chyba: Zvolená složka "%1" nemůže být vytvořena.</translation>
</message>
<message>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<source>%1 GB of free space available</source>
<translation>%1 GB dostupného volného místa</translation>
</message>
<message>
<source>(of %1 GB needed)</source>
<translation>(z %1 GB potřeba)</translation>
</message>
</context>
<context>
<name>MasternodeList</name>
<message>
<source>Form</source>
<translation>Od</translation>
</message>
<message>
<source>My Masternodes</source>
<translation>Moje Masternody</translation>
</message>
<message>
<source>Alias</source>
<translation>Alias</translation>
</message>
<message>
<source>Address</source>
<translation>Adresa</translation>
</message>
<message>
<source>Protocol</source>
<translation>Protokol</translation>
</message>
<message>
<source>Status</source>
<translation>Stav</translation>
</message>
<message>
<source>Active</source>
<translation>Aktivní</translation>
</message>
<message>
<source>Pubkey</source>
<translation>Veřejný klíč</translation>
</message>
<message>
<source>S&tart alias</source>
<translation>S&pustit alias</translation>
</message>
<message>
<source>Start &all</source>
<translation>Spustit &vše</translation>
</message>
<message>
<source>Start &MISSING</source>
<translation>Spustit &CHYBĚJÍCÍ</translation>
</message>
<message>
<source>&Update status</source>
<translation>&Update stavu</translation>
</message>
<message>
<source>Status will be updated automatically in (sec):</source>
<translation>Stav bude automaticky updateován za (sec):</translation>
</message>
<message>
<source>0</source>
<translation>0</translation>
</message>
<message>
<source>Start alias</source>
<translation>Spustit alias:</translation>
</message>
<message>
<source>Confirm masternode start</source>
<translation>Potvrdit spuštění masternodu</translation>
</message>
<message>
<source>Are you sure you want to start masternode %1?</source>
<translation>Opravdu chcete spustit masternode %1?</translation>
</message>
<message>
<source>Confirm all masternodes start</source>
<translation>Potvrdit spuštění všech masternodů</translation>
</message>
<message>
<source>Are you sure you want to start ALL masternodes?</source>
<translation>Opravdu chcete spustit VŠECHNY masternody?</translation>
</message>
<message>
<source>Command is not available right now</source>
<translation>Příkaz teď není dostupný</translation>
</message>
<message>
<source>You can't use this command until masternode list is synced</source>
<translation>Nemůžete použít tento příkaz, dokud nebude seznam masternodů synchronizován</translation>
</message>
<message>
<source>Confirm missing masternodes start</source>
<translation>Potvrdit spuštění chybějícího masternodu</translation>
</message>
<message>
<source>Are you sure you want to start MISSING masternodes?</source>
<translation>Opravdu chcete spostit CHYBĚJÍCÍ masternody?</translation>
</message>
</context>
<context>
<name>MultiSendDialog</name>
<message>
<source>MultiSend</source>
<translation>MultiSend</translation>
</message>
<message>
<source>Enter whole numbers 1 - 100</source>
<translation>Zadejte celé čísla 1-100</translation>
</message>
<message>
<source>Enter % to Give (1-100)</source>
<translation>Zadejte % pro získání (1-100)</translation>
</message>
<message>
<source>Enter Address to Send to</source>
<translation>Zadejte adresu pro odeslání platby</translation>
</message>
<message>
<source>Add to MultiSend Vector</source>
<translation>Přidat MultiSend Vektor</translation>
</message>
<message>
<source>Add</source>
<translation>Přidat</translation>
</message>
<message>
<source>Deactivate MultiSend</source>
<translation>Deaktivovat MultiSend</translation>
</message>
<message>
<source>Deactivate</source>
<translation>Deaktivovat</translation>
</message>
<message>
<source>Choose an address from the address book</source>
<translation>Vybrat adresu z Vašeho seznamu adres</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<source>Percentage of stake to send</source>
<translation>Procento ze sázek k odeslání</translation>
</message>
<message>
<source>Percentage:</source>
<translation>Procento:</translation>
</message>
<message>
<source>Address to send portion of stake to</source>
<translation>Adresa pro zaslání části sázky - stake</translation>
</message>
<message>
<source>Address:</source>
<translation>Adresa:</translation>
</message>
<message>
<source>Delete Address From MultiSend Vector</source>
<translation>Smazat adresu z MultiSend Vektoru</translation>
</message>
<message>
<source>Delete</source>
<translation>Smazat</translation>
</message>
<message>
<source>Activate MultiSend</source>
<translation>Aktivovat MultiSend</translation>
</message>
<message>
<source>Activate</source>
<translation>Aktivovat</translation>
</message>
<message>
<source>View MultiSend Vector</source>
<translation>Zobrazit MultiSend Vecktor</translation>
</message>
<message>
<source>View MultiSend</source>
<translation>Zobrazit MultiSend</translation>
</message>
<message>
<source>Send For Stakes</source>
<translation>Poslat pro sázky - stake</translation>
</message>
<message>
<source>Send For Masternode Rewards</source>
<translation>Poslat pro odměny masternodů</translation>
</message>
<message>
<source>The entered address:
</source>
<translation>Zadaná adresa:
</translation>
</message>
<message>
<source> is invalid.
Please check the address and try again.</source>
<translation>není validní.
Prosím zkontrolujte adresu a zkuste to znovu.</translation>
</message>
<message>
<source>The total amount of your MultiSend vector is over 100% of your stake reward
</source>
<translation>Celkovvá hodnota Vašeho MultiSend Vekktoru je přes 100% vaší odměny ze vsázení
</translation>
</message>
<message>
<source>Please Enter 1 - 100 for percent.</source>
<translation>Prosím, zadejte 1-100 procent.</translation>
</message>
<message>
<source>MultiSend Vector
</source>
<translation>MultiSend Vektor
</translation>
</message>
<message>
<source>Removed </source>
<translation>Odstraněno</translation>
</message>
<message>
<source>Could not locate address
</source>
<translation>Nemůžu najít adresu
</translation>
</message>
</context>
<context>
<name>ObfuscationConfig</name>
<message>
<source>Configure Obfuscation</source>
<translation>Konfigurace obfuskace</translation>
</message>
<message>
<source>Basic Privacy</source>
<translation>Základní ochrana soukromí</translation>
</message>
<message>
<source>High Privacy</source>
<translation>Vysoká ochrana soukromí</translation>
</message>
<message>
<source>Maximum Privacy</source>
<translation>Maximální ochrana soukromí</translation>
</message>
<message>
<source>Please select a privacy level.</source>
<translation>Vyberte úrpvěň ochrany soukromí</translation>
</message>
<message>
<source>Use 2 separate masternodes to mix funds up to 10000 NEOS</source>
<translation>Použí 2 oddělené masternody k promíchání prostředků až do 10000 NEOS</translation>
</message>
<message>
<source>Use 16 separate masternodes</source>
<translation>Použít 16 oddělených masternodů</translation>
</message>
<message>
<source>This option is the quickest and will cost about ~0.025 NEOS to anonymize 10000 NEOS</source>
<translation>Tato možnost je nejrychleší a bude stát zhruba ~0.025 NEOS pro anonymizaci 10000 NEOS</translation>
</message>
<message>
<source>This is the slowest and most secure option. Using maximum anonymity will cost</source>
<translation>Toto je nejpomalejší a nejvíce bezpečná volba. Použití maximalní anonymity bude stát</translation>
</message>
<message>
<source>0.1 NEOS per 10000 NEOS you anonymize.</source>
<translation>0.1 NEOS za 10000 NEOS anonymizujete.</translation>
</message>
<message>
<source>Obfuscation Configuration</source>
<translation>Konfigurace obufuskace</translation>
</message>
</context>
<context>
<name>OpenURIDialog</name>
<message>
<source>Open URI</source>
<translation>Otevřít URI</translation>
</message>
<message>
<source>URI:</source>
<translation>URI:</translation>
</message>
<message>
<source>Select payment request file</source>
<translation>Vybrat soubor vyžádání platby</translation>
</message>
<message>
<source>Select payment request file to open</source>
<translation>Vybrat soubor vyžádání platby pro otevření</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<source>Options</source>
<translation>Možnosti</translation>
</message>
<message>
<source>&Main</source>
<translation>&Hlavní</translation>
</message>
<message>
<source>Size of &database cache</source>
<translation>Velikost &databatové cahce</translation>
</message>
<message>
<source>MB</source>
<translation>MB</translation>
</message>
<message>
<source>Number of script &verification threads</source>
<translation>Počet skriptových &ověřovacích vláken</translation>
</message>
<message>
<source>W&allet</source>
<translation>P&eněženka</translation>
</message>
<message>
<source>Accept connections from outside</source>
<translation>Přijmout připojení z venčí</translation>
</message>
<message>
<source>Allow incoming connections</source>
<translation>Povolit příchozí spojení</translation>
</message>
<message>
<source>Expert</source>
<translation>Expert</translation>
</message>
<message>
<source>Automatically start NEOS after logging in to the system.</source>
<translation>Automaticky spustit NEOS po přihlášení do systému</translation>
</message>
<message>
<source>&Start NEOS on system login</source>
<translation>&Spusti NEOS při přihlášení do systému</translation>
</message>
<message>
<source>Amount of NEOS to keep anonymized</source>
<translation>Počet NEOS pro anonymní držení</translation>
</message>
<message>
<source>Show Masternodes Tab</source>
<translation>Zobrazit záložku Masternodů</translation>
</message>
<message>
<source>&Network</source>
<translation>&Síť</translation>
</message>
<message>
<source>Proxy &IP:</source>
<translation>Proxy &IP</translation>
</message>
<message>
<source>IP address of the proxy (e.g. IPv4: 127.0.0.1 / IPv6: ::1)</source>
<translation>IP adresa proxy (například IPv4: 127.0.0.1 / IPv6: ::1)</translation>
</message>
<message>
<source>&Port:</source>
<translation>&Port</translation>
</message>
<message>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Port proxy (například 9050)</translation>
</message>
<message>
<source>&Window</source>
<translation>&Okno</translation>
</message>
<message>
<source>M&inimize on close</source>
<translation>Při zavření minimalizovat</translation>
</message>
<message>
<source>&Display</source>
<translation>&Zobrazit</translation>
</message>
<message>
<source>Reset all client options to default.</source>
<translation>Resetovat všechny klintské volby na defaultní hodnoty.</translation>
</message>
<message>
<source>&Reset Options</source>
<translation>&Resetovat Volby</translation>
</message>
<message>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Zrušit</translation>
</message>
<message>
<source>none</source>
<translation>žádný</translation>
</message>
<message>
<source>Confirm options reset</source>
<translation>Potvrdit resetování voleb</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<source>Form</source>
<translation>Od</translation>
</message>
<message>
<source>Available:</source>
<translation>Dostupné:</translation>
</message>
<message>
<source>Your current spendable balance</source>
<translation>Vaše aktuální disponibilní bilance</translation>
</message>
<message>
<source>Pending:</source>
<translation>Zpracovávané:</translation>
</message>
<message>
<source>Balances</source>
<translation>Balance</translation>
</message>
<message>
<source>Total:</source>
<translation>Celkem:</translation>
</message>
<message>
<source>Your current total balance</source>
<translation>Vaše aktuální celková balance</translation>
</message>
<message>
<source>Spendable:</source>
<translation>Disponibilní:</translation>
</message>
<message>
<source>Status:</source>
<translation>Stav:</translation>
</message>
<message>
<source>Obfuscation Balance:</source>
<translation>Obfuskační Balance:</translation>
</message>
<message>
<source>0 NEOS / 0 Rounds</source>
<translation>0 NEOS / 0 Kol</translation>
</message>
<message>
<source>Enabled/Disabled</source>
<translation>Zapnuté/Vypnuté</translation>
</message>
<message>
<source>Obfuscation</source>
<translation>Obfuskace</translation>
</message>
<message>
<source>n/a</source>
<translation>n/a</translation>
</message>
<message>
<source>Start/Stop Mixing</source>
<translation>Spustit/Zastavit Míchání</translation>
</message>
<message>
<source>Reset</source>
<translation>Reset</translation>
</message>
<message>
<source>Disabled</source>
<translation>Vypnuto</translation>
</message>
<message>
<source>No inputs detected</source>
<translation>Nedetekovány žádné vstupy</translation>
</message>
<message>
<source>Overall progress</source>
<translation>Celkový postup</translation>
</message>
<message>
<source>Anonymized</source>
<translation>Anonymizováno</translation>
</message>
<message>
<source>Obfuscation was successfully reset.</source>
<translation>Obfuskace byla úspěšně resetována</translation>
</message>
<message>
<source>Start Obfuscation</source>
<translation>Spustit Obfuskaci</translation>
</message>
<message>
<source>Stop Obfuscation</source>
<translation>Zastavit Obfuskaci</translation>
</message>
<message>
<source>Enabled</source>
<translation>Zapnuto</translation>
</message>
<message>
<source>N/A</source>
<translation>N/A</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<source>Invalid payment address %1</source>
<translation>Nevalidní adresa pro platbu %1</translation>
</message>
</context>
<context>
<name>PeerTableModel</name>
<message>
<source>Version</source>
<translation>Verze</translation>
</message>
<message>
<source>Ping Time</source>
<translation>Čas pingnutí</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>Amount</source>
<translation>Hodnota</translation>
</message>
<message>
<source>%1 d</source>
<translation>%1 d</translation>
</message>
<message>
<source>%1 h</source>
<translation>%1 h</translation>
</message>
<message>
<source>%1 m</source>
<translation>%1 m</translation>
</message>
<message>
<source>%1 s</source>
<translation>%1 s</translation>
</message>
<message>
<source>N/A</source>
<translation>N/A</translation>
</message>
</context>
<context>
<name>QRImageWidget</name>
<message>
<source>&Save Image...</source>
<translation>&Uložit Obrázek...</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<source>&Information</source>
<translation>&Informace</translation>
</message>
<message>
<source>General</source>
<translation>Obecné</translation>
</message>
<message>
<source>Name</source>
<translation>Jméno</translation>
</message>
<message>
<source>Client name</source>
<translation>Jméno klienta</translation>
</message>
<message>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<source>Number of connections</source>
<translation>Počet spojení</translation>
</message>
<message>
<source>&Open</source>
<translation>&Otevřít</translation>
</message>
<message>
<source>Network</source>
<translation>Síť</translation>
</message>
<message>
<source>Last block time</source>
<translation>Čas posledního bloku</translation>
</message>
<message>
<source>Using OpenSSL version</source>
<translation>Použítí OpenSSL verze</translation>
</message>
<message>
<source>Build date</source>
<translation>Čas buildu</translation>
</message>
<message>
<source>Current number of blocks</source>
<translation>Aktuální počet bloků</translation>
</message>
<message>
<source>Client version</source>
<translation>Verze Klienta</translation>
</message>
<message>
<source>Block chain</source>
<translation>Blockchain</translation>
</message>
<message>
<source>Number of Masternodes</source>
<translation>Počet Masternodů</translation>
</message>
<message>
<source>&Console</source>
<translation>Konzole</translation>
</message>
<message>
<source>Clear console</source>
<translation>Vymazat konzoli</translation>
</message>
<message>
<source>&Clear</source>
<translation>&Vymazat</translation>
</message>
<message>
<source>Totals</source>
<translation>Celkem</translation>
</message>
<message>
<source>Received</source>
<translation>Přijato</translation>
</message>
<message>
<source>Sent</source>
<translation>Odesláno</translation>
</message>
<message>
<source>&Peers</source>
<translation>&Peerů</translation>
</message>
<message>
<source>Direction</source>
<translation>Směr</translation>
</message>
<message>
<source>Protocol</source>
<translation>Protokol</translation>
</message>
<message>
<source>Version</source>
<translation>Verze</translation>
</message>
<message>
<source>Services</source>
<translation>Služby</translation>
</message>
<message>
<source>Last Send</source>
<translation>Poslední odeslané</translation>
</message>
<message>
<source>Last Receive</source>
<translation>Poslední přijaté</translation>
</message>
<message>
<source>Bytes Sent</source>
<translation>Odeslané Byty</translation>
</message>
<message>
<source>Bytes Received</source>
<translation>Přijaté Byty</translation>
</message>
<message>
<source>Ping Time</source>
<translation>Čas pingnutí</translation>
</message>
<message>
<source>&Wallet Repair</source>
<translation>&Oprava Peněženky</translation>
</message>
<message>
<source>Rescan blockchain files</source>
<translation>Reskenovat soubory blockchainu</translation>
</message>
<message>
<source>Upgrade wallet format</source>
<translation>Upgradovat formát peněženky</translation>
</message>
<message>
<source>In:</source>
<translation>Vstup:</translation>
</message>
<message>
<source>Out:</source>
<translation>Výstup</translation>
</message>
<message>
<source>%1 B</source>
<translation>%1 B</translation>
</message>
<message>
<source>%1 KB</source>
<translation>%1 KB</translation>
</message>
<message>
<source>%1 MB</source>
<translation>%1 MB</translation>
</message>
<message>
<source>%1 GB</source>
<translation>%1 GB</translation>
</message>
</context>
<context>
<name>ReceiveCoinsDialog</name>
<message>
<source>&Label:</source>
<translation>&Popis</translation>
</message>
<message>
<source>&Amount:</source>
<translation>&Hodnota</translation>
</message>
<message>
<source>&Request payment</source>
<translation>&Vyžádat platbu</translation>
</message>
<message>
<source>Clear</source>
<translation>Vymazat</translation>
</message>
<message>
<source>Show</source>
<translation>Zobrazit</translation>
</message>
<message>
<source>Remove</source>
<translation>Odstranit</translation>
</message>
<message>
<source>Copy label</source>
<translation>Kopírovat popisek</translation>
</message>
<message>
<source>Copy message</source>
<translation>Kopírovat zprávu</translation>
</message>
<message>
<source>Copy amount</source>
<translation>Kopírovat hodnotu</translation>
</message>
</context>
<context>
<name>ReceiveRequestDialog</name>
<message>
<source>QR Code</source>
<translation>QR kód</translation>
</message>
<message>
<source>Copy &URI</source>
<translation>Kopírovat &URI</translation>
</message>
<message>
<source>Copy &Address</source>
<translation>Kopírovat &Adresu</translation>
</message>
<message>
<source>&Save Image...</source>
<translation>&Uložit Obrázek...</translation>
</message>
<message>
<source>URI</source>
<translation>URI</translation>
</message>
<message>
<source>Address</source>
<translation>Adresa</translation>
</message>
<message>
<source>Amount</source>
<translation>Hodnota</translation>
</message>
<message>
<source>Label</source>
<translation>Popis</translation>
</message>
<message>
<source>Message</source>
<translation>Zpráva</translation>
</message>
</context>
<context>
<name>RecentRequestsTableModel</name>
<message>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<source>Label</source>
<translation>Popis</translation>
</message>
<message>
<source>Message</source>
<translation>Zpráva</translation>
</message>
<message>
<source>Amount</source>
<translation>Hodnota</translation>
</message>
<message>
<source>(no label)</source>
<translation>(bez popisku)</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<source>Inputs...</source>
<translation>Vstupy...</translation>
</message>
<message>
<source>automatically selected</source>
<translation>automaticky vybráno</translation>
</message>
<message>
<source>Insufficient funds!</source>
<translation>Nedostatek prostředků!</translation>
</message>
<message>
<source>Quantity:</source>
<translation>Množství:</translation>
</message>
<message>
<source>Bytes:</source>
<translation>Byty:</translation>
</message>
<message>
<source>Amount:</source>
<translation>Hodnota:</translation>
</message>
<message>
<source>Priority:</source>
<translation>Priorita:</translation>
</message>
<message>
<source>medium</source>
<translation>střední</translation>
</message>
<message>
<source>Fee:</source>
<translation>Poplatek:</translation>
</message>
<message>
<source>no</source>
<translation>ne</translation>
</message>
<message>
<source>After Fee:</source>
<translation>Po poplatku:</translation>
</message>
<message>
<source>Change:</source>
<translation>Změna:</translation>
</message>
<message>
<source>0 NEOS</source>
<translation>0 NEOS</translation>
</message>
<message>
<source>Transaction Fee:</source>
<translation>Poplatek Transakce:</translation>
</message>
<message>
<source>Choose...</source>
<translation>Vybrat...</translation>
</message>
<message>
<source>Minimize</source>
<translation>Minimalizovat</translation>
</message>
<message>
<source>Obfuscation</source>
<translation>Obfuskace</translation>
</message>
<message>
<source>per kilobyte</source>
<translation>za kilobyte</translation>
</message>
<message>
<source>total at least</source>
<translation>celkem nejméně</translation>
</message>
<message>
<source>Custom:</source>
<translation>Upravit:</translation>
</message>
<message>
<source>Recommended</source>
<translation>Doporučeno</translation>
</message>
<message>
<source>S&end</source>
<translation>O&deslat</translation>
</message>
<message>
<source>Clear &All</source>
<translation>Smazat &Vše</translation>
</message>
<message>
<source>Add &Recipient</source>
<translation>Přidat &Příjemce</translation>
</message>
<message>
<source>SwiftTX</source>
<translation>SwiftTX</translation>
</message>
<message>
<source>Balance:</source>
<translation>Balance:</translation>
</message>
<message>
<source>Copy quantity</source>
<translation>Kopíroat množstí</translation>
</message>
<message>
<source>Copy amount</source>
<translation>Kopírovat hodnotu</translation>
</message>
<message>
<source>Copy fee</source>
<translation>Kopírovat poplatek</translation>
</message>
<message>
<source>Copy after fee</source>
<translation>Kopírovat s poplatkem</translation>
</message>
<message>
<source>Copy bytes</source>
<translation>Kopírovat byty</translation>
</message>
<message>
<source>Copy priority</source>
<translation>Kopírovat prioritu</translation>
</message>
<message>
<source>Copy change</source>
<translation>Kopírovat změnu</translation>
</message>
<message>
<source>Are you sure you want to send?</source>
<translation>Opravdu chcete odeslat?</translation>
</message>
<message>
<source>(no label)</source>
<translation>(bez popisku)</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<source>Choose previously used address</source>
<translation>Vyberte již dříve použitou adresu</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Vložit adresu z mezipamětí</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<source>&Label:</source>
<translation>&Popis</translation>
</message>
<message>
<source>A&mount:</source>
<translation>H&odnota:</translation>
</message>
<message>
<source>Message:</source>
<translation>Zpráva:</translation>
</message>
<message>
<source>Pay To:</source>
<translation>Zaplatin na:</translation>
</message>
</context>
<context>
<name>ShutdownWindow</name>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<source>The NEOS address to sign the message with</source>
<translation>NEOS adresa pro podepsání zprávy</translation>
</message>
<message>
<source>Choose previously used address</source>
<translation>Vyberte již dříve použitou adresu</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Vložit adresu z mezipamětí</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<source>Signature</source>
<translation>Podpis</translation>
</message>
<message>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopírovat aktuální podpis do systémové mezipaměti</translation>
</message>
<message>
<source>Sign the message to prove you own this NEOS address</source>
<translation>Podepsat zprávu k prokázání, že vlastníte tuto NEOS adresu</translation>
</message>
<message>
<source>The NEOS address the message was signed with</source>
<translation>NEOS adresa zprávy byla podpsána</translation>
</message>
<message>
<source>Verify the message to ensure it was signed with the specified NEOS address</source>
<translation>Verifikujte zprávu pro ujištění, že byla podepsána zmíněnou NEOS adresou</translation>
</message>
<message>
<source>Sign &Message</source>
<translation>Podepsat &Zprávu</translation>
</message>
<message>
<source>Reset all sign message fields</source>
<translation>Resetovat všechny položky podepsání zprávy</translation>
</message>
<message>
<source>Clear &All</source>
<translation>Smazat &Vše</translation>
</message>
<message>
<source>Reset all verify message fields</source>
<translation>Resetovat všechny položky pro ověření zprávy</translation>
</message>
<message>
<source>The entered address is invalid.</source>
<translation>Zadaná adresa není validní.</translation>
</message>
<message>
<source>Please check the address and try again.</source>
<translation>Prosím zkontolujte adresu a zkuste to znovu.</translation>
</message>
<message>
<source>The entered address does not refer to a key.</source>
<translation>Zadaná adresa neodpovídá klíči.</translation>
</message>
<message>
<source>Wallet unlock was cancelled.</source>
<translation>Odemknutí peněženky bylo zrušeno.</translation>
</message>
<message>
<source>Private key for the entered address is not available.</source>
<translation>Privátní klíč pro zadanou adresu není dostupný.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<source>NEOS Core</source>
<translation>NEOS Core</translation>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
</context>
<context>
<name>TransactionDesc</name>
<message>
<source>Status</source>
<translation>Stav</translation>
</message>
<message>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<source>Message</source>
<translation>Zpráva</translation>
</message>
<message>
<source>Amount</source>
<translation>Hodnota</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<source>Address</source>
<translation>Adresa</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<source>Copy address</source>
<translation>Kopírovat adresu</translation>
</message>
<message>
<source>Copy label</source>
<translation>Kopírovat popisek</translation>
</message>
<message>
<source>Copy amount</source>
<translation>Kopírovat hodnotu</translation>
</message>
<message>
<source>Copy transaction ID</source>
<translation>Kopírovat ID transakce</translation>
</message>
<message>
<source>Comma separated file (*.csv)</source>
<translation>Comma separated file (*.csv)</translation>
</message>
<message>
<source>Confirmed</source>
<translation>Potvrzeno</translation>
</message>
<message>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<source>Label</source>
<translation>Popis</translation>
</message>
<message>
<source>Address</source>
<translation>Adresa</translation>
</message>
<message>
<source>Exporting Failed</source>
<translation>Export selhal</translation>
</message>
</context>
<context>
<name>UnitDisplayStatusBarControl</name>
</context>
<context>
<name>WalletFrame</name>
</context>
<context>
<name>WalletModel</name>
</context>
<context>
<name>WalletView</name>
<message>
<source>&Export</source>
<translation>&Exportovat</translation>
</message>
<message>
<source>Export the data in the current tab to a file</source>
<translation>Exportovat data z aktulní záložky do souboru</translation>
</message>
</context>
<context>
<name>neos-core</name>
<message>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<source>Information</source>
<translation>Informace</translation>
</message>
<message>
<source>SwiftTX options:</source>
<translation>SwiftTx možnosti:</translation>
</message>
<message>
<source>Synchronization failed</source>
<translation>Synchronizace selhala</translation>
</message>
<message>
<source>Synchronization finished</source>
<translation>Synchronizace dokončena</translation>
</message>
<message>
<source>Synchronization pending...</source>
<translation>Synchronizace probíhá</translation>
</message>
<message>
<source>Synchronizing budgets...</source>
<translation>Synchronizace rozpočtu...</translation>
</message>
<message>
<source>Synchronizing masternode winners...</source>
<translation>Synchronizace vítězných masternodů...</translation>
</message>
<message>
<source>Synchronizing masternodes...</source>
<translation>Synchronizace masternodů...</translation>
</message>
<message>
<source>This is experimental software.</source>
<translation>Toto je experimentální software.</translation>
</message>
<message>
<source>This is not a Masternode.</source>
<translation>Toto není Masternode.</translation>
</message>
<message>
<source>Transaction amount too small</source>
<translation>Hodnota transakce je příliš malá</translation>
</message>
<message>
<source>Transaction amounts must be positive</source>
<translation>Hodnota transakce musí být kladná</translation>
</message>
<message>
<source>Transaction created successfully.</source>
<translation>Transakce byla uspěšně vytvořena.</translation>
</message>
<message>
<source>Transaction fees are too high.</source>
<translation>Poplatek za transakci je příliš vysoký.</translation>
</message>
<message>
<source>Transaction not valid.</source>
<translation>Transakce není validní.</translation>
</message>
<message>
<source>Transaction too large for fee policy</source>
<translation>Transakce je příliš velká s ohledem na pravidla poplatků</translation>
</message>
<message>
<source>Transaction too large</source>
<translation>Transakce je příliš velká</translation>
</message>
<message>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Neznámá síť uvedená v -onlynet: '%s'</translation>
</message>
<message>
<source>Unknown state: id = %u</source>
<translation>Neznámý stav: id = %u</translation>
</message>
<message>
<source>Upgrade wallet to latest format</source>
<translation>Upgradovat peněženku do nejnovějšího formátu</translation>
</message>
<message>
<source>Use the test network</source>
<translation>Použít testovací síť</translation>
</message>
<message>
<source>Verifying blocks...</source>
<translation>Ověřování bloků...</translation>
</message>
<message>
<source>Verifying wallet...</source>
<translation>Ověřování peněženky...</translation>
</message>
<message>
<source>Wallet is locked.</source>
<translation>Peněženka je zamčená</translation>
</message>
<message>
<source>Wallet options:</source>
<translation>Možnosti peněženky:</translation>
</message>
<message>
<source>Wallet window title</source>
<translation>Titulek okna peněženky</translation>
</message>
<message>
<source>Warning</source>
<translation>Varování</translation>
</message>
<message>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Varování: Tato verze je zastaralá, vyžadován upgrade!</translation>
</message>
<message>
<source>Warning: Unsupported argument -benchmark ignored, use -debug=bench.</source>
<translation>Varování: Nepodporovaný argument -benchmark je ignorován, použijte -debug=bench</translation>
</message>
<message>
<source>Warning: Unsupported argument -debugnet ignored, use -debug=net.</source>
<translation>Varování: Nepodporovaný argument -debugnet je ignorován, použijte -debug=net</translation>
</message>
<message>
<source>on startup</source>
<translation>při spuštění</translation>
</message>
</context>
</TS>
| neoscoin/neos-core | src/qt/locale/neos_cs.ts | TypeScript | mit | 86,643 |
from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework.reverse import reverse
from .models import Comment
# from accounts.models import MyUser
User = get_user_model()
class CommentVideoUrlHyperlinkedIdentityField(serializers.HyperlinkedIdentityField):
def get_url(self, obj,view_name,request,format):
kwargs = {
"cat_slug":obj.video.category.slug,
"vid_slug":obj.video.slug
}
# print(reverse(view_name,kwargs=kwargs))
return reverse(view_name,kwargs=kwargs,request=request,format=format)
class CommentUpdateSerializer(serializers.ModelSerializer):
user = serializers.CharField(source='user.username',read_only=True)
class Meta:
model = Comment
fields = [
'id',
'user',
'text'
]
class CommentCreateSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = [
'text',
'user',
'video',
'parent'
]
class ChildCommentSerializer(serializers.HyperlinkedModelSerializer):
# user = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
user = serializers.CharField(source='user.username',read_only=True)
class Meta:
model = Comment
fields = [
'id',
"user",
'text'
]
class CommentSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField("comment_detail_api",lookup_field="pk")
# user = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
video = CommentVideoUrlHyperlinkedIdentityField("video_detail_api")
user = serializers.CharField(source='user.username',read_only=True)
children = serializers.SerializerMethodField(read_only=True)
def get_children(self,instance):
# queryset = instance.get_children()
queryset = Comment.objects.filter(parent__pk =instance.pk)
serializer = ChildCommentSerializer(queryset,context={"request":instance}, many=True)
return serializer.data
class Meta:
model = Comment
fields = [
"url",
'id',
"children",
# "parent",
"user",
'video',
'text'
]
class CommentViewSet(viewsets.ModelViewSet):
authentication_classes = [SessionAuthentication, BasicAuthentication, JSONWebTokenAuthentication]
permission_classes = [permissions.IsAuthenticated,]
queryset = Comment.objects.all()
serializer_class = CommentSerializer
| climberwb/video-api | src/comments/serializers.py | Python | mit | 2,962 |
import React from 'react'
import { FormControl } from 'react-bootstrap'
import './@FilterListInput.css'
const FilterListInput = ({onFilter, searchValue}) => {
let handleFilter = e => {
onFilter(e.target.value)
}
return (<FormControl className='FilterListInput' type='text' defaultValue={searchValue} placeholder='Search within this list...' onChange={handleFilter.bind(this)} />)
}
export default FilterListInput
| DataSF/open-data-explorer | src/components/FilterListInput/index.js | JavaScript | mit | 425 |
class CreateRemexifyLogowners < ActiveRecord::Migration
def self.up
create_table :<%= table_name %>_owners do |t|
t.string :log_md5, null: false
t.string :identifier_id, null: false
# this can be used to store additional info, such as the class of identifier_id above, or anything else
# you may read the gem documentation on how to use it.
t.string :param1
t.string :param2
t.string :param3
end
add_index :<%= table_name %>_owners, [:log_md5, :identifier_id], unique: true
end
def self.down
# we don't want to make assumption of your roll back, please
# by all mean edit it.
# drop_table :<%= table_name %>_owner
raise ActiveRecord::IrreversibleMigration
end
end | saveav/Remexify | lib/generators/active_record/templates/create_remexify_logowners.rb | Ruby | mit | 743 |
<?php
/*
* $Id: Groupby.php 3884 2008-02-22 18:26:35Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Query_Part');
/**
* Doctrine_Query_Groupby
*
* @package Doctrine
* @subpackage Query
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3884 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class Doctrine_Query_Groupby extends Doctrine_Query_Part
{
/**
* DQL GROUP BY PARSER
* parses the group by part of the query string
*
* @param string $str
* @return void
*/
public function parse($str, $append = false)
{
$r = array();
foreach (explode(',', $str) as $reference) {
$reference = trim($reference);
$r[] = $this->query->parseClause($reference);
}
return implode(', ', $r);
}
}
| nbonamy/doctrine-0.10.4 | lib/Doctrine/Query/Groupby.php | PHP | mit | 1,870 |
#ifndef NNTPCHAN_LINE_HPP
#define NNTPCHAN_LINE_HPP
#include "server.hpp"
#include <stdint.h>
#include <sstream>
namespace nntpchan
{
/** @brief a buffered line reader */
class LineReader
{
public:
/** @brief queue inbound data from connection */
void Data(const char *data, ssize_t s);
protected:
/** @brief handle a line from the client */
virtual void HandleLine(const std::string line) = 0;
private:
std::stringstream m_line;
std::string m_leftover;
};
}
#endif
| majestrate/nntpchan | contrib/backends/nntpchan-daemon/include/nntpchan/line.hpp | C++ | mit | 487 |
package jenkins.plugins.http_request;
import static com.google.common.base.Preconditions.checkArgument;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import com.cloudbees.plugins.credentials.common.AbstractIdCredentialsListBoxModel;
import com.cloudbees.plugins.credentials.common.StandardCredentials;
import com.cloudbees.plugins.credentials.common.StandardListBoxModel;
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder;
import com.google.common.base.Strings;
import com.google.common.collect.Range;
import com.google.common.collect.Ranges;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.model.Item;
import hudson.model.Items;
import hudson.model.TaskListener;
import hudson.security.ACL;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import hudson.util.ListBoxModel.Option;
import jenkins.plugins.http_request.auth.BasicDigestAuthentication;
import jenkins.plugins.http_request.auth.FormAuthentication;
import jenkins.plugins.http_request.util.HttpClientUtil;
import jenkins.plugins.http_request.util.HttpRequestNameValuePair;
/**
* @author Janario Oliveira
*/
public class HttpRequest extends Builder {
private @Nonnull String url;
private Boolean ignoreSslErrors = DescriptorImpl.ignoreSslErrors;
private HttpMode httpMode = DescriptorImpl.httpMode;
private String httpProxy = DescriptorImpl.httpProxy;
private Boolean passBuildParameters = DescriptorImpl.passBuildParameters;
private String validResponseCodes = DescriptorImpl.validResponseCodes;
private String validResponseContent = DescriptorImpl.validResponseContent;
private MimeType acceptType = DescriptorImpl.acceptType;
private MimeType contentType = DescriptorImpl.contentType;
private String outputFile = DescriptorImpl.outputFile;
private Integer timeout = DescriptorImpl.timeout;
private Boolean consoleLogResponseBody = DescriptorImpl.consoleLogResponseBody;
private Boolean quiet = DescriptorImpl.quiet;
private String authentication = DescriptorImpl.authentication;
private String requestBody = DescriptorImpl.requestBody;
private List<HttpRequestNameValuePair> customHeaders = DescriptorImpl.customHeaders;
@DataBoundConstructor
public HttpRequest(@Nonnull String url) {
this.url = url;
}
@Nonnull
public String getUrl() {
return url;
}
public Boolean getIgnoreSslErrors() {
return ignoreSslErrors;
}
@DataBoundSetter
public void setIgnoreSslErrors(Boolean ignoreSslErrors) {
this.ignoreSslErrors = ignoreSslErrors;
}
public HttpMode getHttpMode() {
return httpMode;
}
@DataBoundSetter
public void setHttpMode(HttpMode httpMode) {
this.httpMode = httpMode;
}
public String getHttpProxy() {
return httpProxy;
}
@DataBoundSetter
public void setHttpProxy(String httpProxy) {
this.httpProxy = httpProxy;
}
public Boolean getPassBuildParameters() {
return passBuildParameters;
}
@DataBoundSetter
public void setPassBuildParameters(Boolean passBuildParameters) {
this.passBuildParameters = passBuildParameters;
}
@Nonnull
public String getValidResponseCodes() {
return validResponseCodes;
}
@DataBoundSetter
public void setValidResponseCodes(String validResponseCodes) {
this.validResponseCodes = validResponseCodes;
}
public String getValidResponseContent() {
return validResponseContent;
}
@DataBoundSetter
public void setValidResponseContent(String validResponseContent) {
this.validResponseContent = validResponseContent;
}
public MimeType getAcceptType() {
return acceptType;
}
@DataBoundSetter
public void setAcceptType(MimeType acceptType) {
this.acceptType = acceptType;
}
public MimeType getContentType() {
return contentType;
}
@DataBoundSetter
public void setContentType(MimeType contentType) {
this.contentType = contentType;
}
public String getOutputFile() {
return outputFile;
}
@DataBoundSetter
public void setOutputFile(String outputFile) {
this.outputFile = outputFile;
}
public Integer getTimeout() {
return timeout;
}
@DataBoundSetter
public void setTimeout(Integer timeout) {
this.timeout = timeout;
}
public Boolean getConsoleLogResponseBody() {
return consoleLogResponseBody;
}
@DataBoundSetter
public void setConsoleLogResponseBody(Boolean consoleLogResponseBody) {
this.consoleLogResponseBody = consoleLogResponseBody;
}
public Boolean getQuiet() {
return quiet;
}
@DataBoundSetter
public void setQuiet(Boolean quiet) {
this.quiet = quiet;
}
public String getAuthentication() {
return authentication;
}
@DataBoundSetter
public void setAuthentication(String authentication) {
this.authentication = authentication;
}
public String getRequestBody() {
return requestBody;
}
@DataBoundSetter
public void setRequestBody(String requestBody) {
this.requestBody = requestBody;
}
public List<HttpRequestNameValuePair> getCustomHeaders() {
return customHeaders;
}
@DataBoundSetter
public void setCustomHeaders(List<HttpRequestNameValuePair> customHeaders) {
this.customHeaders = customHeaders;
}
@Initializer(before = InitMilestone.PLUGINS_STARTED)
public static void xStreamCompatibility() {
Items.XSTREAM2.aliasField("logResponseBody", HttpRequest.class, "consoleLogResponseBody");
Items.XSTREAM2.aliasField("consoleLogResponseBody", HttpRequest.class, "consoleLogResponseBody");
Items.XSTREAM2.alias("pair", HttpRequestNameValuePair.class);
}
protected Object readResolve() {
if (customHeaders == null) {
customHeaders = DescriptorImpl.customHeaders;
}
if (validResponseCodes == null || validResponseCodes.trim().isEmpty()) {
validResponseCodes = DescriptorImpl.validResponseCodes;
}
if (ignoreSslErrors == null) {
//default for new job false(DescriptorImpl.ignoreSslErrors) for old ones true to keep same behavior
ignoreSslErrors = true;
}
if (quiet == null) {
quiet = false;
}
return this;
}
private List<HttpRequestNameValuePair> createParams(EnvVars envVars, AbstractBuild<?, ?> build, TaskListener listener) throws IOException {
Map<String, String> buildVariables = build.getBuildVariables();
if (buildVariables.isEmpty()) {
return Collections.emptyList();
}
PrintStream logger = listener.getLogger();
logger.println("Parameters: ");
List<HttpRequestNameValuePair> l = new ArrayList<>();
for (Map.Entry<String, String> entry : buildVariables.entrySet()) {
String value = envVars.expand(entry.getValue());
logger.println(" " + entry.getKey() + " = " + value);
l.add(new HttpRequestNameValuePair(entry.getKey(), value));
}
return l;
}
String resolveUrl(EnvVars envVars,
AbstractBuild<?, ?> build, TaskListener listener) throws IOException {
String url = envVars.expand(getUrl());
if (Boolean.TRUE.equals(getPassBuildParameters()) && getHttpMode() == HttpMode.GET) {
List<HttpRequestNameValuePair> params = createParams(envVars, build, listener);
if (!params.isEmpty()) {
url = HttpClientUtil.appendParamsToUrl(url, params);
}
}
return url;
}
List<HttpRequestNameValuePair> resolveHeaders(EnvVars envVars) {
final List<HttpRequestNameValuePair> headers = new ArrayList<>();
if (contentType != null && contentType != MimeType.NOT_SET) {
headers.add(new HttpRequestNameValuePair("Content-type", contentType.getContentType().toString()));
}
if (acceptType != null && acceptType != MimeType.NOT_SET) {
headers.add(new HttpRequestNameValuePair("Accept", acceptType.getValue()));
}
for (HttpRequestNameValuePair header : customHeaders) {
String headerName = envVars.expand(header.getName());
String headerValue = envVars.expand(header.getValue());
boolean maskValue = headerName.equalsIgnoreCase("Authorization") ||
header.getMaskValue();
headers.add(new HttpRequestNameValuePair(headerName, headerValue, maskValue));
}
return headers;
}
String resolveBody(EnvVars envVars,
AbstractBuild<?, ?> build, TaskListener listener) throws IOException {
String body = envVars.expand(getRequestBody());
if (Strings.isNullOrEmpty(body) && Boolean.TRUE.equals(getPassBuildParameters())) {
List<HttpRequestNameValuePair> params = createParams(envVars, build, listener);
if (!params.isEmpty()) {
body = HttpClientUtil.paramsToString(params);
}
}
return body;
}
FilePath resolveOutputFile(EnvVars envVars, AbstractBuild<?,?> build) {
if (outputFile == null || outputFile.trim().isEmpty()) {
return null;
}
String filePath = envVars.expand(outputFile);
FilePath workspace = build.getWorkspace();
if (workspace == null) {
throw new IllegalStateException("Could not find workspace to save file outputFile: " + outputFile);
}
return workspace.child(filePath);
}
@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
throws InterruptedException, IOException
{
EnvVars envVars = build.getEnvironment(listener);
for (Map.Entry<String, String> e : build.getBuildVariables().entrySet()) {
envVars.put(e.getKey(), e.getValue());
}
HttpRequestExecution exec = HttpRequestExecution.from(this, envVars, build,
this.getQuiet() ? TaskListener.NULL : listener);
launcher.getChannel().call(exec);
return true;
}
@Extension
public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
public static final boolean ignoreSslErrors = false;
public static final HttpMode httpMode = HttpMode.GET;
public static final String httpProxy = "";
public static final Boolean passBuildParameters = false;
public static final String validResponseCodes = "100:399";
public static final String validResponseContent = "";
public static final MimeType acceptType = MimeType.NOT_SET;
public static final MimeType contentType = MimeType.NOT_SET;
public static final String outputFile = "";
public static final int timeout = 0;
public static final Boolean consoleLogResponseBody = false;
public static final Boolean quiet = false;
public static final String authentication = "";
public static final String requestBody = "";
public static final List <HttpRequestNameValuePair> customHeaders = Collections.<HttpRequestNameValuePair>emptyList();
public DescriptorImpl() {
load();
}
@SuppressWarnings("rawtypes")
@Override
public boolean isApplicable(Class<? extends AbstractProject> aClass) {
return true;
}
@Override
public String getDisplayName() {
return "HTTP Request";
}
public ListBoxModel doFillHttpModeItems() {
return HttpMode.getFillItems();
}
public ListBoxModel doFillAcceptTypeItems() {
return MimeType.getContentTypeFillItems();
}
public ListBoxModel doFillContentTypeItems() {
return MimeType.getContentTypeFillItems();
}
public ListBoxModel doFillAuthenticationItems(@AncestorInPath Item project,
@QueryParameter String url) {
return fillAuthenticationItems(project, url);
}
public static ListBoxModel fillAuthenticationItems(Item project, String url) {
if (project == null || !project.hasPermission(Item.CONFIGURE)) {
return new StandardListBoxModel();
}
List<Option> options = new ArrayList<>();
for (BasicDigestAuthentication basic : HttpRequestGlobalConfig.get().getBasicDigestAuthentications()) {
options.add(new Option("(deprecated - use Jenkins Credentials) " +
basic.getKeyName(), basic.getKeyName()));
}
for (FormAuthentication formAuthentication : HttpRequestGlobalConfig.get().getFormAuthentications()) {
options.add(new Option(formAuthentication.getKeyName()));
}
AbstractIdCredentialsListBoxModel<StandardListBoxModel, StandardCredentials> items = new StandardListBoxModel()
.includeEmptyValue()
.includeAs(ACL.SYSTEM,
project, StandardUsernamePasswordCredentials.class,
URIRequirementBuilder.fromUri(url).build());
items.addMissing(options);
return items;
}
public static List<Range<Integer>> parseToRange(String value) {
List<Range<Integer>> validRanges = new ArrayList<Range<Integer>>();
String[] codes = value.split(",");
for (String code : codes) {
String[] fromTo = code.trim().split(":");
checkArgument(fromTo.length <= 2, "Code %s should be an interval from:to or a single value", code);
Integer from;
try {
from = Integer.parseInt(fromTo[0]);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Invalid number "+fromTo[0]);
}
Integer to = from;
if (fromTo.length != 1) {
try {
to = Integer.parseInt(fromTo[1]);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Invalid number "+fromTo[1]);
}
}
checkArgument(from <= to, "Interval %s should be FROM less than TO", code);
validRanges.add(Ranges.closed(from, to));
}
return validRanges;
}
public FormValidation doCheckValidResponseCodes(@QueryParameter String value) {
return checkValidResponseCodes(value);
}
public static FormValidation checkValidResponseCodes(String value) {
if (value == null || value.trim().isEmpty()) {
return FormValidation.ok();
}
try {
parseToRange(value);
} catch (IllegalArgumentException iae) {
return FormValidation.error("Response codes expected is wrong. "+iae.getMessage());
}
return FormValidation.ok();
}
}
}
| martinda/http-request-plugin | src/main/java/jenkins/plugins/http_request/HttpRequest.java | Java | mit | 15,118 |
package by.bsuir.verkpavel.adb.data;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import by.bsuir.verkpavel.adb.data.entity.Account;
import by.bsuir.verkpavel.adb.data.entity.Client;
import by.bsuir.verkpavel.adb.data.entity.Deposit;
import by.bsuir.verkpavel.adb.data.entity.TransactionsInfo;
//MAYBE Remove this facade and use separate class or add three getInstance methods
public class DataProvider {
private static DataProvider instance;
private Connection connection;
private ClientProvider clientProvider;
private DepositProvider depositProvider;
private AccountProvider accountProvider;
private static final String DB_PATH = "jdbc:mysql://localhost:3306/bank_users?useUnicode=true&characterEncoding=utf8";
private static final String DB_USER_NAME = "root";
private static final String DB_PASSWORD = "123456";
private DataProvider() {
try {
Class.forName("com.mysql.jdbc.Driver");
this.connection = DriverManager.getConnection(DB_PATH, DB_USER_NAME, DB_PASSWORD);
this.clientProvider = ClientProvider.getInstance(connection);
this.depositProvider = DepositProvider.getInstance(connection);
this.accountProvider = AccountProvider.getInstance(connection);
} catch (ClassNotFoundException e) {
System.out.println("DB driver not found");
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
};
public static DataProvider getInstance() {
if (instance == null) {
instance = new DataProvider();
}
return instance;
}
public ArrayList<String> getCityList() {
return clientProvider.getCityList();
}
public ArrayList<String> getFamilyStatuses() {
return clientProvider.getFamilyStatuses();
}
public ArrayList<String> getNationalitys() {
return clientProvider.getNationalitys();
}
public ArrayList<String> getDisabilitys() {
return clientProvider.getDisabilitys();
}
public String saveClient(Client client) {
return clientProvider.saveClient(client);
}
public String updateClient(Client client) {
return clientProvider.updateClient(client);
}
public ArrayList<Client> getAllClients() {
return clientProvider.getAllClients();
}
public void deleteClient(Client client) {
clientProvider.deleteClient(client);
}
public ArrayList<String> getUserFullNames() {
return clientProvider.getUserFullNames();
}
public ArrayList<String> getCurrency() {
return depositProvider.getCurrency();
}
public ArrayList<String> getDepositTypeList() {
return depositProvider.getDepositTypeList();
}
public String saveDeposit(Deposit deposit) {
return depositProvider.saveDeposit(deposit);
}
public ArrayList<Deposit> getAllDeposits() {
return depositProvider.getAllDeposits();
}
public void updateDepositEndDate(Deposit deposit, String newDate) {
depositProvider.updateDepositEndDate(deposit, newDate);
}
public ArrayList<Account> getAllAccounts() {
return accountProvider.getAllAccounts();
}
public void addTransaction(Account from, Account to, double sum, int currency) {
try {
accountProvider.addTransaction(from, to, sum, currency);
} catch (SQLException e) {
e.printStackTrace();
}
}
public void addMonoTransaction(Account from, Account to, double sum, int currency) {
try {
accountProvider.addMonoTransaction(from, to, sum, currency);
} catch (SQLException e) {
e.printStackTrace();
}
}
public Account[] getAccountByDeposit(Deposit deposit) {
return accountProvider.getAccountByDeposit(deposit);
}
public Account getCashBoxAccount() {
return accountProvider.getCashBoxAccount();
}
public void createAccountsByDeposit(Deposit deposit) {
accountProvider.createAccountByDeposit(deposit);
}
public Account getFDBAccount() {
return accountProvider.getFDBAccount();
}
public ArrayList<TransactionsInfo> getTransatcionsByAccount(Account account) {
return accountProvider.getTransactionByAccount(account);
}
public ArrayList<Deposit> getAllActiveDeposits() {
return depositProvider.getAllActiveDeposits();
}
public void disableDeposit(Deposit deposit) {
depositProvider.disableDeposit(deposit);
}
}
| VerkhovtsovPavel/BSUIR_Labs | Labs/ADB/ADB-2/src/by/bsuir/verkpavel/adb/data/DataProvider.java | Java | mit | 4,665 |
/*!
* ear-pipe
* Pipe audio streams to your ears
* Dan Motzenbecker <dan@oxism.com>
* MIT Licensed
*/
"use strict";
var spawn = require('child_process').spawn,
util = require('util'),
Duplex = require('stream').Duplex,
apply = function(obj, method, args) {
return obj[method].apply(obj, args);
}
var EarPipe = function(type, bits, transcode) {
var params;
if (!(this instanceof EarPipe)) {
return new EarPipe(type, bits, transcode);
}
Duplex.apply(this);
params = ['-q', '-b', bits || 16, '-t', type || 'mp3', '-'];
if (transcode) {
this.process = spawn('sox',
params.concat(['-t', typeof transcode === 'string' ? transcode : 'wav', '-']));
} else {
this.process = spawn('play', params);
}
}
util.inherits(EarPipe, Duplex);
EarPipe.prototype._read = function() {
return apply(this.process.stdout, 'read', arguments);
}
EarPipe.prototype._write = function() {
return apply(this.process.stdin, 'write', arguments);
}
EarPipe.prototype.pipe = function() {
return apply(this.process.stdout, 'pipe', arguments);
}
EarPipe.prototype.end = function() {
return apply(this.process.stdin, 'end', arguments);
}
EarPipe.prototype.kill = function() {
return apply(this.process, 'kill', arguments);
}
module.exports = EarPipe;
| dmotz/ear-pipe | index.js | JavaScript | mit | 1,304 |
<?php
/*
Plugin Name: Collapsing Categories
Plugin URI: http://blog.robfelty.com/plugins
Description: Uses javascript to expand and collapse categories to show the posts that belong to the category
Author: Robert Felty
Version: 2.0.3
Author URI: http://robfelty.com
Tags: sidebar, widget, categories, menu, navigation, posts
Copyright 2007-2010 Robert Felty
This file is part of Collapsing Categories
Collapsing Categories is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
Collapsing Categories is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Collapsing Categories; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
$url = get_settings('siteurl');
global $collapsCatVersion;
$collapsCatVersion = '2.0.3';
if (!is_admin()) {
add_action('wp_enqueue_scripts', array('collapsCat', 'add_scripts'));
add_action( 'wp_head', array('collapsCat','get_head'));
} else {
// call upgrade function if current version is lower than actual version
$dbversion = get_option('collapsCatVersion');
if (!$dbversion || $collapsCatVersion != $dbversion)
collapscat::init();
}
add_action('init', array('collapsCat','init_textdomain'));
register_activation_hook(__FILE__, array('collapsCat','init'));
class collapsCat {
function add_scripts() {
wp_enqueue_script('jquery');
}
function init_textdomain() {
$plugin_dir = basename(dirname(__FILE__)) . '/languages/';
load_plugin_textdomain( 'collapsing-categories', WP_PLUGIN_DIR . $plugin_dir, $plugin_dir );
}
function init() {
global $collapsCatVersion;
include('collapsCatStyles.php');
$defaultStyles=compact('selected','default','block','noArrows','custom');
$dbversion = get_option('collapsCatVersion');
if ($collapsCatVersion != $dbversion && $selected!='custom') {
$style = $defaultStyles[$selected];
update_option( 'collapsCatStyle', $style);
update_option( 'collapsCatVersion', $collapsCatVersion);
}
if( function_exists('add_option') ) {
update_option( 'collapsCatOrigStyle', $style);
update_option( 'collapsCatDefaultStyles', $defaultStyles);
}
if (!get_option('collapsCatOptions')) {
include('defaults.php');
update_option('collapsCatOptions', $defaults);
}
if (!get_option('collapsCatStyle')) {
add_option( 'collapsCatStyle', $style);
}
if (!get_option('collapsCatSidebarId')) {
add_option( 'collapsCatSidebarId', 'sidebar');
}
if (!get_option('collapsCatVersion')) {
add_option( 'collapsCatVersion', $collapsCatVersion);
}
}
function get_head() {
echo "<style type='text/css'>\n";
echo collapsCat::set_styles();
echo "</style>\n";
}
function phpArrayToJS($array,$name) {
/* generates javscript code to create an array from a php array */
$script = "try { $name" .
"['catTest'] = 'test'; } catch (err) { $name = new Object(); }\n";
foreach ($array as $key => $value){
$script .= $name . "['$key'] = '" .
addslashes(str_replace("\n", '', $value)) . "';\n";
}
return($script);
}
function set_styles() {
$widget_options = get_option('widget_collapscat');
include('collapsCatStyles.php');
$css = '';
$oldStyle=true;
foreach ($widget_options as $key=>$value) {
$id = "widget-collapscat-$key-top";
if (isset($value['style'])) {
$oldStyle=false;
$style = $defaultStyles[$value['style']];
$css .= str_replace('{ID}', '#' . $id, $style);
}
}
if ($oldStyle)
$css=stripslashes(get_option('collapsCatStyle'));
return($css);
}
}
include_once( 'collapscatlist.php' );
function collapsCat($args='', $print=true) {
global $collapsCatItems;
if (!is_admin()) {
list($posts, $categories, $parents, $options) =
get_collapscat_fromdb($args);
list($collapsCatText, $postsInCat) = list_categories($posts, $categories,
$parents, $options);
$url = get_settings('siteurl');
extract($options);
include('symbols.php');
if ($print) {
print($collapsCatText);
echo "<li style='display:none'><script type=\"text/javascript\">\n";
echo "// <![CDATA[\n";
echo '/* These variables are part of the Collapsing Categories Plugin
* Version: 2.0.3
* $Id: collapscat.php 561313 2012-06-20 19:45:14Z robfelty $
* Copyright 2007 Robert Felty (robfelty.com)
*/' . "\n";
echo "var expandSym='$expandSym';\n";
echo "var collapseSym='$collapseSym';\n";
// now we create an array indexed by the id of the ul for posts
echo collapsCat::phpArrayToJS($collapsCatItems, 'collapsItems');
include_once('collapsFunctions.js');
echo "addExpandCollapse('widget-collapscat-$number-top'," .
"'$expandSym', '$collapseSym', " . $accordion . ")";
echo "// ]]>\n</script></li>\n";
} else {
return(array($collapsCatText, $postsInCat));
}
}
}
$version = get_bloginfo('version');
if (preg_match('/^(2\.[8-9]|3\..*)/', $version))
include('collapscatwidget.php');
?>
| mandino/emergingprairie.misfit.co | wp-content/plugins/collapsing-categories/collapscat.php | PHP | mit | 5,550 |
<?php
namespace Field\Providers;
use Pluma\Support\Providers\ServiceProvider;
class FieldServiceProvider extends ServiceProvider
{
/**
* Array of observable models.
*
* @var array
*/
protected $observables = [
[\Field\Models\Field::class, '\Field\Observers\FieldObserver'],
];
/**
* Registered middlewares on the
* Service Providers Level.
*
* @var mixed
*/
protected $middlewares = [
//
];
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
\Field\Models\Field::class => \Field\Policies\FieldPolicy::class,
];
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}
}
| lioneil/pluma | core/submodules/Form/submodules/Field/Providers/FieldServiceProvider.php | PHP | mit | 967 |
/**
* @description - The purpose of this model is to lookup various Drinking activities for a user
*/
var baseModel = require('./base');
var Drink;
Drink = baseModel.Model.extend({
tableName: 'drink'
});
module.exports = baseModel.model('Drink', Drink); | salimkapadia/dating-with-node-api | database/models/drink.js | JavaScript | mit | 260 |
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
'jsx': true
},
},
globals: {
enz: true,
xhr_calls: true,
},
plugins: [
'react'
],
extends: 'react-app',
rules: {
'semi': [2, 'never'],
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 2,
// allow debugger during development
'no-debugger': 2,
'comma-danglcd e': 0,
'camelcase': 0,
'no-alert': 2,
'space-before-function-paren': 2,
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2,
}
}
| tutorcruncher/socket-frontend | .eslintrc.js | JavaScript | mit | 653 |
define(['jquery'], function ($) {
if (!Array.prototype.reduce) {
/**
* Array.prototype.reduce polyfill
*
* @param {Function} callback
* @param {Value} [initialValue]
* @return {Value}
*
* @see http://goo.gl/WNriQD
*/
Array.prototype.reduce = function (callback) {
var t = Object(this),
len = t.length >>> 0,
k = 0,
value;
if (arguments.length === 2) {
value = arguments[1];
} else {
while (k < len && !(k in t)) {
k++;
}
if (k >= len) {
throw new TypeError('Reduce of empty array with no initial value');
}
value = t[k++];
}
for (; k < len; k++) {
if (k in t) {
value = callback(value, t[k], k, t);
}
}
return value;
};
}
if ('function' !== typeof Array.prototype.filter) {
/**
* Array.prototype.filter polyfill
*
* @param {Function} func
* @return {Array}
*
* @see http://goo.gl/T1KFnq
*/
Array.prototype.filter = function (func) {
var t = Object(this),
len = t.length >>> 0;
var res = [];
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
if (i in t) {
var val = t[i];
if (func.call(thisArg, val, i, t)) {
res.push(val);
}
}
}
return res;
};
}
var isSupportAmd = typeof define === 'function' && define.amd;
/**
* @class core.agent
*
* Object which check platform and agent
*
* @singleton
* @alternateClassName agent
*/
var agent = {
/** @property {Boolean} [isMac=false] true if this agent is Mac */
isMac: navigator.appVersion.indexOf('Mac') > -1,
/** @property {Boolean} [isMSIE=false] true if this agent is a Internet Explorer */
isMSIE: navigator.userAgent.indexOf('MSIE') > -1 || navigator.userAgent.indexOf('Trident') > -1,
/** @property {Boolean} [isFF=false] true if this agent is a Firefox */
isFF: navigator.userAgent.indexOf('Firefox') > -1,
/** @property {String} jqueryVersion current jQuery version string */
jqueryVersion: parseFloat($.fn.jquery),
isSupportAmd: isSupportAmd,
isW3CRangeSupport: !!document.createRange
};
return agent;
}); | czajkowski/sunnynote | src/js/core/agent.js | JavaScript | mit | 2,766 |
<<<<<<< HEAD
<<<<<<< HEAD
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='cp852',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
)
### Decoding Map
decoding_map = codecs.make_identity_dict(range(256))
decoding_map.update({
0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE
0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE
0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE
0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE
0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON
0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON
0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON
0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON
0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
0x009e: 0x00d7, # MULTIPLICATION SIGN
0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON
0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON
0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
0x00aa: 0x00ac, # NOT SIGN
0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA
0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00b0: 0x2591, # LIGHT SHADE
0x00b1: 0x2592, # MEDIUM SHADE
0x00b2: 0x2593, # DARK SHADE
0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON
0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA
0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE
0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE
0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
0x00cf: 0x00a4, # CURRENCY SIGN
0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE
0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE
0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON
0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON
0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON
0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON
0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
0x00db: 0x2588, # FULL BLOCK
0x00dc: 0x2584, # LOWER HALF BLOCK
0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA
0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE
0x00df: 0x2580, # UPPER HALF BLOCK
0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON
0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON
0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE
0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE
0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA
0x00ef: 0x00b4, # ACUTE ACCENT
0x00f0: 0x00ad, # SOFT HYPHEN
0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT
0x00f2: 0x02db, # OGONEK
0x00f3: 0x02c7, # CARON
0x00f4: 0x02d8, # BREVE
0x00f5: 0x00a7, # SECTION SIGN
0x00f6: 0x00f7, # DIVISION SIGN
0x00f7: 0x00b8, # CEDILLA
0x00f8: 0x00b0, # DEGREE SIGN
0x00f9: 0x00a8, # DIAERESIS
0x00fa: 0x02d9, # DOT ABOVE
0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON
0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON
0x00fe: 0x25a0, # BLACK SQUARE
0x00ff: 0x00a0, # NO-BREAK SPACE
})
### Decoding Table
decoding_table = (
'\x00' # 0x0000 -> NULL
'\x01' # 0x0001 -> START OF HEADING
'\x02' # 0x0002 -> START OF TEXT
'\x03' # 0x0003 -> END OF TEXT
'\x04' # 0x0004 -> END OF TRANSMISSION
'\x05' # 0x0005 -> ENQUIRY
'\x06' # 0x0006 -> ACKNOWLEDGE
'\x07' # 0x0007 -> BELL
'\x08' # 0x0008 -> BACKSPACE
'\t' # 0x0009 -> HORIZONTAL TABULATION
'\n' # 0x000a -> LINE FEED
'\x0b' # 0x000b -> VERTICAL TABULATION
'\x0c' # 0x000c -> FORM FEED
'\r' # 0x000d -> CARRIAGE RETURN
'\x0e' # 0x000e -> SHIFT OUT
'\x0f' # 0x000f -> SHIFT IN
'\x10' # 0x0010 -> DATA LINK ESCAPE
'\x11' # 0x0011 -> DEVICE CONTROL ONE
'\x12' # 0x0012 -> DEVICE CONTROL TWO
'\x13' # 0x0013 -> DEVICE CONTROL THREE
'\x14' # 0x0014 -> DEVICE CONTROL FOUR
'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
'\x16' # 0x0016 -> SYNCHRONOUS IDLE
'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
'\x18' # 0x0018 -> CANCEL
'\x19' # 0x0019 -> END OF MEDIUM
'\x1a' # 0x001a -> SUBSTITUTE
'\x1b' # 0x001b -> ESCAPE
'\x1c' # 0x001c -> FILE SEPARATOR
'\x1d' # 0x001d -> GROUP SEPARATOR
'\x1e' # 0x001e -> RECORD SEPARATOR
'\x1f' # 0x001f -> UNIT SEPARATOR
' ' # 0x0020 -> SPACE
'!' # 0x0021 -> EXCLAMATION MARK
'"' # 0x0022 -> QUOTATION MARK
'#' # 0x0023 -> NUMBER SIGN
'$' # 0x0024 -> DOLLAR SIGN
'%' # 0x0025 -> PERCENT SIGN
'&' # 0x0026 -> AMPERSAND
"'" # 0x0027 -> APOSTROPHE
'(' # 0x0028 -> LEFT PARENTHESIS
')' # 0x0029 -> RIGHT PARENTHESIS
'*' # 0x002a -> ASTERISK
'+' # 0x002b -> PLUS SIGN
',' # 0x002c -> COMMA
'-' # 0x002d -> HYPHEN-MINUS
'.' # 0x002e -> FULL STOP
'/' # 0x002f -> SOLIDUS
'0' # 0x0030 -> DIGIT ZERO
'1' # 0x0031 -> DIGIT ONE
'2' # 0x0032 -> DIGIT TWO
'3' # 0x0033 -> DIGIT THREE
'4' # 0x0034 -> DIGIT FOUR
'5' # 0x0035 -> DIGIT FIVE
'6' # 0x0036 -> DIGIT SIX
'7' # 0x0037 -> DIGIT SEVEN
'8' # 0x0038 -> DIGIT EIGHT
'9' # 0x0039 -> DIGIT NINE
':' # 0x003a -> COLON
';' # 0x003b -> SEMICOLON
'<' # 0x003c -> LESS-THAN SIGN
'=' # 0x003d -> EQUALS SIGN
'>' # 0x003e -> GREATER-THAN SIGN
'?' # 0x003f -> QUESTION MARK
'@' # 0x0040 -> COMMERCIAL AT
'A' # 0x0041 -> LATIN CAPITAL LETTER A
'B' # 0x0042 -> LATIN CAPITAL LETTER B
'C' # 0x0043 -> LATIN CAPITAL LETTER C
'D' # 0x0044 -> LATIN CAPITAL LETTER D
'E' # 0x0045 -> LATIN CAPITAL LETTER E
'F' # 0x0046 -> LATIN CAPITAL LETTER F
'G' # 0x0047 -> LATIN CAPITAL LETTER G
'H' # 0x0048 -> LATIN CAPITAL LETTER H
'I' # 0x0049 -> LATIN CAPITAL LETTER I
'J' # 0x004a -> LATIN CAPITAL LETTER J
'K' # 0x004b -> LATIN CAPITAL LETTER K
'L' # 0x004c -> LATIN CAPITAL LETTER L
'M' # 0x004d -> LATIN CAPITAL LETTER M
'N' # 0x004e -> LATIN CAPITAL LETTER N
'O' # 0x004f -> LATIN CAPITAL LETTER O
'P' # 0x0050 -> LATIN CAPITAL LETTER P
'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
'R' # 0x0052 -> LATIN CAPITAL LETTER R
'S' # 0x0053 -> LATIN CAPITAL LETTER S
'T' # 0x0054 -> LATIN CAPITAL LETTER T
'U' # 0x0055 -> LATIN CAPITAL LETTER U
'V' # 0x0056 -> LATIN CAPITAL LETTER V
'W' # 0x0057 -> LATIN CAPITAL LETTER W
'X' # 0x0058 -> LATIN CAPITAL LETTER X
'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
'Z' # 0x005a -> LATIN CAPITAL LETTER Z
'[' # 0x005b -> LEFT SQUARE BRACKET
'\\' # 0x005c -> REVERSE SOLIDUS
']' # 0x005d -> RIGHT SQUARE BRACKET
'^' # 0x005e -> CIRCUMFLEX ACCENT
'_' # 0x005f -> LOW LINE
'`' # 0x0060 -> GRAVE ACCENT
'a' # 0x0061 -> LATIN SMALL LETTER A
'b' # 0x0062 -> LATIN SMALL LETTER B
'c' # 0x0063 -> LATIN SMALL LETTER C
'd' # 0x0064 -> LATIN SMALL LETTER D
'e' # 0x0065 -> LATIN SMALL LETTER E
'f' # 0x0066 -> LATIN SMALL LETTER F
'g' # 0x0067 -> LATIN SMALL LETTER G
'h' # 0x0068 -> LATIN SMALL LETTER H
'i' # 0x0069 -> LATIN SMALL LETTER I
'j' # 0x006a -> LATIN SMALL LETTER J
'k' # 0x006b -> LATIN SMALL LETTER K
'l' # 0x006c -> LATIN SMALL LETTER L
'm' # 0x006d -> LATIN SMALL LETTER M
'n' # 0x006e -> LATIN SMALL LETTER N
'o' # 0x006f -> LATIN SMALL LETTER O
'p' # 0x0070 -> LATIN SMALL LETTER P
'q' # 0x0071 -> LATIN SMALL LETTER Q
'r' # 0x0072 -> LATIN SMALL LETTER R
's' # 0x0073 -> LATIN SMALL LETTER S
't' # 0x0074 -> LATIN SMALL LETTER T
'u' # 0x0075 -> LATIN SMALL LETTER U
'v' # 0x0076 -> LATIN SMALL LETTER V
'w' # 0x0077 -> LATIN SMALL LETTER W
'x' # 0x0078 -> LATIN SMALL LETTER X
'y' # 0x0079 -> LATIN SMALL LETTER Y
'z' # 0x007a -> LATIN SMALL LETTER Z
'{' # 0x007b -> LEFT CURLY BRACKET
'|' # 0x007c -> VERTICAL LINE
'}' # 0x007d -> RIGHT CURLY BRACKET
'~' # 0x007e -> TILDE
'\x7f' # 0x007f -> DELETE
'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
'\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE
'\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE
'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE
'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
'\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
'\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE
'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
'\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE
'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
'\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE
'\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE
'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
'\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON
'\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON
'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE
'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE
'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
'\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON
'\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON
'\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE
'\xd7' # 0x009e -> MULTIPLICATION SIGN
'\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON
'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
'\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK
'\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK
'\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON
'\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON
'\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK
'\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK
'\xac' # 0x00aa -> NOT SIGN
'\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE
'\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON
'\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA
'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
'\u2591' # 0x00b0 -> LIGHT SHADE
'\u2592' # 0x00b1 -> MEDIUM SHADE
'\u2593' # 0x00b2 -> DARK SHADE
'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
'\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON
'\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA
'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
'\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
'\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE
'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
'\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE
'\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE
'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
'\xa4' # 0x00cf -> CURRENCY SIGN
'\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE
'\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE
'\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON
'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
'\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON
'\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON
'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
'\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON
'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
'\u2588' # 0x00db -> FULL BLOCK
'\u2584' # 0x00dc -> LOWER HALF BLOCK
'\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA
'\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE
'\u2580' # 0x00df -> UPPER HALF BLOCK
'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE
'\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE
'\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON
'\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON
'\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON
'\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE
'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
'\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE
'\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE
'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE
'\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA
'\xb4' # 0x00ef -> ACUTE ACCENT
'\xad' # 0x00f0 -> SOFT HYPHEN
'\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT
'\u02db' # 0x00f2 -> OGONEK
'\u02c7' # 0x00f3 -> CARON
'\u02d8' # 0x00f4 -> BREVE
'\xa7' # 0x00f5 -> SECTION SIGN
'\xf7' # 0x00f6 -> DIVISION SIGN
'\xb8' # 0x00f7 -> CEDILLA
'\xb0' # 0x00f8 -> DEGREE SIGN
'\xa8' # 0x00f9 -> DIAERESIS
'\u02d9' # 0x00fa -> DOT ABOVE
'\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
'\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON
'\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON
'\u25a0' # 0x00fe -> BLACK SQUARE
'\xa0' # 0x00ff -> NO-BREAK SPACE
)
### Encoding Map
encoding_map = {
0x0000: 0x0000, # NULL
0x0001: 0x0001, # START OF HEADING
0x0002: 0x0002, # START OF TEXT
0x0003: 0x0003, # END OF TEXT
0x0004: 0x0004, # END OF TRANSMISSION
0x0005: 0x0005, # ENQUIRY
0x0006: 0x0006, # ACKNOWLEDGE
0x0007: 0x0007, # BELL
0x0008: 0x0008, # BACKSPACE
0x0009: 0x0009, # HORIZONTAL TABULATION
0x000a: 0x000a, # LINE FEED
0x000b: 0x000b, # VERTICAL TABULATION
0x000c: 0x000c, # FORM FEED
0x000d: 0x000d, # CARRIAGE RETURN
0x000e: 0x000e, # SHIFT OUT
0x000f: 0x000f, # SHIFT IN
0x0010: 0x0010, # DATA LINK ESCAPE
0x0011: 0x0011, # DEVICE CONTROL ONE
0x0012: 0x0012, # DEVICE CONTROL TWO
0x0013: 0x0013, # DEVICE CONTROL THREE
0x0014: 0x0014, # DEVICE CONTROL FOUR
0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
0x0016: 0x0016, # SYNCHRONOUS IDLE
0x0017: 0x0017, # END OF TRANSMISSION BLOCK
0x0018: 0x0018, # CANCEL
0x0019: 0x0019, # END OF MEDIUM
0x001a: 0x001a, # SUBSTITUTE
0x001b: 0x001b, # ESCAPE
0x001c: 0x001c, # FILE SEPARATOR
0x001d: 0x001d, # GROUP SEPARATOR
0x001e: 0x001e, # RECORD SEPARATOR
0x001f: 0x001f, # UNIT SEPARATOR
0x0020: 0x0020, # SPACE
0x0021: 0x0021, # EXCLAMATION MARK
0x0022: 0x0022, # QUOTATION MARK
0x0023: 0x0023, # NUMBER SIGN
0x0024: 0x0024, # DOLLAR SIGN
0x0025: 0x0025, # PERCENT SIGN
0x0026: 0x0026, # AMPERSAND
0x0027: 0x0027, # APOSTROPHE
0x0028: 0x0028, # LEFT PARENTHESIS
0x0029: 0x0029, # RIGHT PARENTHESIS
0x002a: 0x002a, # ASTERISK
0x002b: 0x002b, # PLUS SIGN
0x002c: 0x002c, # COMMA
0x002d: 0x002d, # HYPHEN-MINUS
0x002e: 0x002e, # FULL STOP
0x002f: 0x002f, # SOLIDUS
0x0030: 0x0030, # DIGIT ZERO
0x0031: 0x0031, # DIGIT ONE
0x0032: 0x0032, # DIGIT TWO
0x0033: 0x0033, # DIGIT THREE
0x0034: 0x0034, # DIGIT FOUR
0x0035: 0x0035, # DIGIT FIVE
0x0036: 0x0036, # DIGIT SIX
0x0037: 0x0037, # DIGIT SEVEN
0x0038: 0x0038, # DIGIT EIGHT
0x0039: 0x0039, # DIGIT NINE
0x003a: 0x003a, # COLON
0x003b: 0x003b, # SEMICOLON
0x003c: 0x003c, # LESS-THAN SIGN
0x003d: 0x003d, # EQUALS SIGN
0x003e: 0x003e, # GREATER-THAN SIGN
0x003f: 0x003f, # QUESTION MARK
0x0040: 0x0040, # COMMERCIAL AT
0x0041: 0x0041, # LATIN CAPITAL LETTER A
0x0042: 0x0042, # LATIN CAPITAL LETTER B
0x0043: 0x0043, # LATIN CAPITAL LETTER C
0x0044: 0x0044, # LATIN CAPITAL LETTER D
0x0045: 0x0045, # LATIN CAPITAL LETTER E
0x0046: 0x0046, # LATIN CAPITAL LETTER F
0x0047: 0x0047, # LATIN CAPITAL LETTER G
0x0048: 0x0048, # LATIN CAPITAL LETTER H
0x0049: 0x0049, # LATIN CAPITAL LETTER I
0x004a: 0x004a, # LATIN CAPITAL LETTER J
0x004b: 0x004b, # LATIN CAPITAL LETTER K
0x004c: 0x004c, # LATIN CAPITAL LETTER L
0x004d: 0x004d, # LATIN CAPITAL LETTER M
0x004e: 0x004e, # LATIN CAPITAL LETTER N
0x004f: 0x004f, # LATIN CAPITAL LETTER O
0x0050: 0x0050, # LATIN CAPITAL LETTER P
0x0051: 0x0051, # LATIN CAPITAL LETTER Q
0x0052: 0x0052, # LATIN CAPITAL LETTER R
0x0053: 0x0053, # LATIN CAPITAL LETTER S
0x0054: 0x0054, # LATIN CAPITAL LETTER T
0x0055: 0x0055, # LATIN CAPITAL LETTER U
0x0056: 0x0056, # LATIN CAPITAL LETTER V
0x0057: 0x0057, # LATIN CAPITAL LETTER W
0x0058: 0x0058, # LATIN CAPITAL LETTER X
0x0059: 0x0059, # LATIN CAPITAL LETTER Y
0x005a: 0x005a, # LATIN CAPITAL LETTER Z
0x005b: 0x005b, # LEFT SQUARE BRACKET
0x005c: 0x005c, # REVERSE SOLIDUS
0x005d: 0x005d, # RIGHT SQUARE BRACKET
0x005e: 0x005e, # CIRCUMFLEX ACCENT
0x005f: 0x005f, # LOW LINE
0x0060: 0x0060, # GRAVE ACCENT
0x0061: 0x0061, # LATIN SMALL LETTER A
0x0062: 0x0062, # LATIN SMALL LETTER B
0x0063: 0x0063, # LATIN SMALL LETTER C
0x0064: 0x0064, # LATIN SMALL LETTER D
0x0065: 0x0065, # LATIN SMALL LETTER E
0x0066: 0x0066, # LATIN SMALL LETTER F
0x0067: 0x0067, # LATIN SMALL LETTER G
0x0068: 0x0068, # LATIN SMALL LETTER H
0x0069: 0x0069, # LATIN SMALL LETTER I
0x006a: 0x006a, # LATIN SMALL LETTER J
0x006b: 0x006b, # LATIN SMALL LETTER K
0x006c: 0x006c, # LATIN SMALL LETTER L
0x006d: 0x006d, # LATIN SMALL LETTER M
0x006e: 0x006e, # LATIN SMALL LETTER N
0x006f: 0x006f, # LATIN SMALL LETTER O
0x0070: 0x0070, # LATIN SMALL LETTER P
0x0071: 0x0071, # LATIN SMALL LETTER Q
0x0072: 0x0072, # LATIN SMALL LETTER R
0x0073: 0x0073, # LATIN SMALL LETTER S
0x0074: 0x0074, # LATIN SMALL LETTER T
0x0075: 0x0075, # LATIN SMALL LETTER U
0x0076: 0x0076, # LATIN SMALL LETTER V
0x0077: 0x0077, # LATIN SMALL LETTER W
0x0078: 0x0078, # LATIN SMALL LETTER X
0x0079: 0x0079, # LATIN SMALL LETTER Y
0x007a: 0x007a, # LATIN SMALL LETTER Z
0x007b: 0x007b, # LEFT CURLY BRACKET
0x007c: 0x007c, # VERTICAL LINE
0x007d: 0x007d, # RIGHT CURLY BRACKET
0x007e: 0x007e, # TILDE
0x007f: 0x007f, # DELETE
0x00a0: 0x00ff, # NO-BREAK SPACE
0x00a4: 0x00cf, # CURRENCY SIGN
0x00a7: 0x00f5, # SECTION SIGN
0x00a8: 0x00f9, # DIAERESIS
0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00ac: 0x00aa, # NOT SIGN
0x00ad: 0x00f0, # SOFT HYPHEN
0x00b0: 0x00f8, # DEGREE SIGN
0x00b4: 0x00ef, # ACUTE ACCENT
0x00b8: 0x00f7, # CEDILLA
0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
0x00d7: 0x009e, # MULTIPLICATION SIGN
0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE
0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
0x00f7: 0x00f6, # DIVISION SIGN
0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE
0x0102: 0x00c6, # LATIN CAPITAL LETTER A WITH BREVE
0x0103: 0x00c7, # LATIN SMALL LETTER A WITH BREVE
0x0104: 0x00a4, # LATIN CAPITAL LETTER A WITH OGONEK
0x0105: 0x00a5, # LATIN SMALL LETTER A WITH OGONEK
0x0106: 0x008f, # LATIN CAPITAL LETTER C WITH ACUTE
0x0107: 0x0086, # LATIN SMALL LETTER C WITH ACUTE
0x010c: 0x00ac, # LATIN CAPITAL LETTER C WITH CARON
0x010d: 0x009f, # LATIN SMALL LETTER C WITH CARON
0x010e: 0x00d2, # LATIN CAPITAL LETTER D WITH CARON
0x010f: 0x00d4, # LATIN SMALL LETTER D WITH CARON
0x0110: 0x00d1, # LATIN CAPITAL LETTER D WITH STROKE
0x0111: 0x00d0, # LATIN SMALL LETTER D WITH STROKE
0x0118: 0x00a8, # LATIN CAPITAL LETTER E WITH OGONEK
0x0119: 0x00a9, # LATIN SMALL LETTER E WITH OGONEK
0x011a: 0x00b7, # LATIN CAPITAL LETTER E WITH CARON
0x011b: 0x00d8, # LATIN SMALL LETTER E WITH CARON
0x0139: 0x0091, # LATIN CAPITAL LETTER L WITH ACUTE
0x013a: 0x0092, # LATIN SMALL LETTER L WITH ACUTE
0x013d: 0x0095, # LATIN CAPITAL LETTER L WITH CARON
0x013e: 0x0096, # LATIN SMALL LETTER L WITH CARON
0x0141: 0x009d, # LATIN CAPITAL LETTER L WITH STROKE
0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE
0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE
0x0144: 0x00e4, # LATIN SMALL LETTER N WITH ACUTE
0x0147: 0x00d5, # LATIN CAPITAL LETTER N WITH CARON
0x0148: 0x00e5, # LATIN SMALL LETTER N WITH CARON
0x0150: 0x008a, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x0151: 0x008b, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x0154: 0x00e8, # LATIN CAPITAL LETTER R WITH ACUTE
0x0155: 0x00ea, # LATIN SMALL LETTER R WITH ACUTE
0x0158: 0x00fc, # LATIN CAPITAL LETTER R WITH CARON
0x0159: 0x00fd, # LATIN SMALL LETTER R WITH CARON
0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE
0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE
0x015e: 0x00b8, # LATIN CAPITAL LETTER S WITH CEDILLA
0x015f: 0x00ad, # LATIN SMALL LETTER S WITH CEDILLA
0x0160: 0x00e6, # LATIN CAPITAL LETTER S WITH CARON
0x0161: 0x00e7, # LATIN SMALL LETTER S WITH CARON
0x0162: 0x00dd, # LATIN CAPITAL LETTER T WITH CEDILLA
0x0163: 0x00ee, # LATIN SMALL LETTER T WITH CEDILLA
0x0164: 0x009b, # LATIN CAPITAL LETTER T WITH CARON
0x0165: 0x009c, # LATIN SMALL LETTER T WITH CARON
0x016e: 0x00de, # LATIN CAPITAL LETTER U WITH RING ABOVE
0x016f: 0x0085, # LATIN SMALL LETTER U WITH RING ABOVE
0x0170: 0x00eb, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x0171: 0x00fb, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE
0x017a: 0x00ab, # LATIN SMALL LETTER Z WITH ACUTE
0x017b: 0x00bd, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x017c: 0x00be, # LATIN SMALL LETTER Z WITH DOT ABOVE
0x017d: 0x00a6, # LATIN CAPITAL LETTER Z WITH CARON
0x017e: 0x00a7, # LATIN SMALL LETTER Z WITH CARON
0x02c7: 0x00f3, # CARON
0x02d8: 0x00f4, # BREVE
0x02d9: 0x00fa, # DOT ABOVE
0x02db: 0x00f2, # OGONEK
0x02dd: 0x00f1, # DOUBLE ACUTE ACCENT
0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
0x2580: 0x00df, # UPPER HALF BLOCK
0x2584: 0x00dc, # LOWER HALF BLOCK
0x2588: 0x00db, # FULL BLOCK
0x2591: 0x00b0, # LIGHT SHADE
0x2592: 0x00b1, # MEDIUM SHADE
0x2593: 0x00b2, # DARK SHADE
0x25a0: 0x00fe, # BLACK SQUARE
}
=======
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='cp852',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
)
### Decoding Map
decoding_map = codecs.make_identity_dict(range(256))
decoding_map.update({
0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE
0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE
0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE
0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE
0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON
0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON
0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON
0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON
0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
0x009e: 0x00d7, # MULTIPLICATION SIGN
0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON
0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON
0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
0x00aa: 0x00ac, # NOT SIGN
0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA
0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00b0: 0x2591, # LIGHT SHADE
0x00b1: 0x2592, # MEDIUM SHADE
0x00b2: 0x2593, # DARK SHADE
0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON
0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA
0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE
0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE
0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
0x00cf: 0x00a4, # CURRENCY SIGN
0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE
0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE
0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON
0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON
0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON
0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON
0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
0x00db: 0x2588, # FULL BLOCK
0x00dc: 0x2584, # LOWER HALF BLOCK
0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA
0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE
0x00df: 0x2580, # UPPER HALF BLOCK
0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON
0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON
0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE
0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE
0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA
0x00ef: 0x00b4, # ACUTE ACCENT
0x00f0: 0x00ad, # SOFT HYPHEN
0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT
0x00f2: 0x02db, # OGONEK
0x00f3: 0x02c7, # CARON
0x00f4: 0x02d8, # BREVE
0x00f5: 0x00a7, # SECTION SIGN
0x00f6: 0x00f7, # DIVISION SIGN
0x00f7: 0x00b8, # CEDILLA
0x00f8: 0x00b0, # DEGREE SIGN
0x00f9: 0x00a8, # DIAERESIS
0x00fa: 0x02d9, # DOT ABOVE
0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON
0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON
0x00fe: 0x25a0, # BLACK SQUARE
0x00ff: 0x00a0, # NO-BREAK SPACE
})
### Decoding Table
decoding_table = (
'\x00' # 0x0000 -> NULL
'\x01' # 0x0001 -> START OF HEADING
'\x02' # 0x0002 -> START OF TEXT
'\x03' # 0x0003 -> END OF TEXT
'\x04' # 0x0004 -> END OF TRANSMISSION
'\x05' # 0x0005 -> ENQUIRY
'\x06' # 0x0006 -> ACKNOWLEDGE
'\x07' # 0x0007 -> BELL
'\x08' # 0x0008 -> BACKSPACE
'\t' # 0x0009 -> HORIZONTAL TABULATION
'\n' # 0x000a -> LINE FEED
'\x0b' # 0x000b -> VERTICAL TABULATION
'\x0c' # 0x000c -> FORM FEED
'\r' # 0x000d -> CARRIAGE RETURN
'\x0e' # 0x000e -> SHIFT OUT
'\x0f' # 0x000f -> SHIFT IN
'\x10' # 0x0010 -> DATA LINK ESCAPE
'\x11' # 0x0011 -> DEVICE CONTROL ONE
'\x12' # 0x0012 -> DEVICE CONTROL TWO
'\x13' # 0x0013 -> DEVICE CONTROL THREE
'\x14' # 0x0014 -> DEVICE CONTROL FOUR
'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
'\x16' # 0x0016 -> SYNCHRONOUS IDLE
'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
'\x18' # 0x0018 -> CANCEL
'\x19' # 0x0019 -> END OF MEDIUM
'\x1a' # 0x001a -> SUBSTITUTE
'\x1b' # 0x001b -> ESCAPE
'\x1c' # 0x001c -> FILE SEPARATOR
'\x1d' # 0x001d -> GROUP SEPARATOR
'\x1e' # 0x001e -> RECORD SEPARATOR
'\x1f' # 0x001f -> UNIT SEPARATOR
' ' # 0x0020 -> SPACE
'!' # 0x0021 -> EXCLAMATION MARK
'"' # 0x0022 -> QUOTATION MARK
'#' # 0x0023 -> NUMBER SIGN
'$' # 0x0024 -> DOLLAR SIGN
'%' # 0x0025 -> PERCENT SIGN
'&' # 0x0026 -> AMPERSAND
"'" # 0x0027 -> APOSTROPHE
'(' # 0x0028 -> LEFT PARENTHESIS
')' # 0x0029 -> RIGHT PARENTHESIS
'*' # 0x002a -> ASTERISK
'+' # 0x002b -> PLUS SIGN
',' # 0x002c -> COMMA
'-' # 0x002d -> HYPHEN-MINUS
'.' # 0x002e -> FULL STOP
'/' # 0x002f -> SOLIDUS
'0' # 0x0030 -> DIGIT ZERO
'1' # 0x0031 -> DIGIT ONE
'2' # 0x0032 -> DIGIT TWO
'3' # 0x0033 -> DIGIT THREE
'4' # 0x0034 -> DIGIT FOUR
'5' # 0x0035 -> DIGIT FIVE
'6' # 0x0036 -> DIGIT SIX
'7' # 0x0037 -> DIGIT SEVEN
'8' # 0x0038 -> DIGIT EIGHT
'9' # 0x0039 -> DIGIT NINE
':' # 0x003a -> COLON
';' # 0x003b -> SEMICOLON
'<' # 0x003c -> LESS-THAN SIGN
'=' # 0x003d -> EQUALS SIGN
'>' # 0x003e -> GREATER-THAN SIGN
'?' # 0x003f -> QUESTION MARK
'@' # 0x0040 -> COMMERCIAL AT
'A' # 0x0041 -> LATIN CAPITAL LETTER A
'B' # 0x0042 -> LATIN CAPITAL LETTER B
'C' # 0x0043 -> LATIN CAPITAL LETTER C
'D' # 0x0044 -> LATIN CAPITAL LETTER D
'E' # 0x0045 -> LATIN CAPITAL LETTER E
'F' # 0x0046 -> LATIN CAPITAL LETTER F
'G' # 0x0047 -> LATIN CAPITAL LETTER G
'H' # 0x0048 -> LATIN CAPITAL LETTER H
'I' # 0x0049 -> LATIN CAPITAL LETTER I
'J' # 0x004a -> LATIN CAPITAL LETTER J
'K' # 0x004b -> LATIN CAPITAL LETTER K
'L' # 0x004c -> LATIN CAPITAL LETTER L
'M' # 0x004d -> LATIN CAPITAL LETTER M
'N' # 0x004e -> LATIN CAPITAL LETTER N
'O' # 0x004f -> LATIN CAPITAL LETTER O
'P' # 0x0050 -> LATIN CAPITAL LETTER P
'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
'R' # 0x0052 -> LATIN CAPITAL LETTER R
'S' # 0x0053 -> LATIN CAPITAL LETTER S
'T' # 0x0054 -> LATIN CAPITAL LETTER T
'U' # 0x0055 -> LATIN CAPITAL LETTER U
'V' # 0x0056 -> LATIN CAPITAL LETTER V
'W' # 0x0057 -> LATIN CAPITAL LETTER W
'X' # 0x0058 -> LATIN CAPITAL LETTER X
'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
'Z' # 0x005a -> LATIN CAPITAL LETTER Z
'[' # 0x005b -> LEFT SQUARE BRACKET
'\\' # 0x005c -> REVERSE SOLIDUS
']' # 0x005d -> RIGHT SQUARE BRACKET
'^' # 0x005e -> CIRCUMFLEX ACCENT
'_' # 0x005f -> LOW LINE
'`' # 0x0060 -> GRAVE ACCENT
'a' # 0x0061 -> LATIN SMALL LETTER A
'b' # 0x0062 -> LATIN SMALL LETTER B
'c' # 0x0063 -> LATIN SMALL LETTER C
'd' # 0x0064 -> LATIN SMALL LETTER D
'e' # 0x0065 -> LATIN SMALL LETTER E
'f' # 0x0066 -> LATIN SMALL LETTER F
'g' # 0x0067 -> LATIN SMALL LETTER G
'h' # 0x0068 -> LATIN SMALL LETTER H
'i' # 0x0069 -> LATIN SMALL LETTER I
'j' # 0x006a -> LATIN SMALL LETTER J
'k' # 0x006b -> LATIN SMALL LETTER K
'l' # 0x006c -> LATIN SMALL LETTER L
'm' # 0x006d -> LATIN SMALL LETTER M
'n' # 0x006e -> LATIN SMALL LETTER N
'o' # 0x006f -> LATIN SMALL LETTER O
'p' # 0x0070 -> LATIN SMALL LETTER P
'q' # 0x0071 -> LATIN SMALL LETTER Q
'r' # 0x0072 -> LATIN SMALL LETTER R
's' # 0x0073 -> LATIN SMALL LETTER S
't' # 0x0074 -> LATIN SMALL LETTER T
'u' # 0x0075 -> LATIN SMALL LETTER U
'v' # 0x0076 -> LATIN SMALL LETTER V
'w' # 0x0077 -> LATIN SMALL LETTER W
'x' # 0x0078 -> LATIN SMALL LETTER X
'y' # 0x0079 -> LATIN SMALL LETTER Y
'z' # 0x007a -> LATIN SMALL LETTER Z
'{' # 0x007b -> LEFT CURLY BRACKET
'|' # 0x007c -> VERTICAL LINE
'}' # 0x007d -> RIGHT CURLY BRACKET
'~' # 0x007e -> TILDE
'\x7f' # 0x007f -> DELETE
'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
'\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE
'\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE
'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE
'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
'\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
'\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE
'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
'\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE
'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
'\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE
'\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE
'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
'\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON
'\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON
'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE
'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE
'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
'\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON
'\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON
'\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE
'\xd7' # 0x009e -> MULTIPLICATION SIGN
'\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON
'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
'\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK
'\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK
'\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON
'\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON
'\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK
'\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK
'\xac' # 0x00aa -> NOT SIGN
'\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE
'\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON
'\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA
'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
'\u2591' # 0x00b0 -> LIGHT SHADE
'\u2592' # 0x00b1 -> MEDIUM SHADE
'\u2593' # 0x00b2 -> DARK SHADE
'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
'\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON
'\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA
'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
'\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
'\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE
'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
'\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE
'\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE
'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
'\xa4' # 0x00cf -> CURRENCY SIGN
'\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE
'\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE
'\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON
'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
'\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON
'\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON
'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
'\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON
'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
'\u2588' # 0x00db -> FULL BLOCK
'\u2584' # 0x00dc -> LOWER HALF BLOCK
'\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA
'\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE
'\u2580' # 0x00df -> UPPER HALF BLOCK
'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE
'\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE
'\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON
'\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON
'\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON
'\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE
'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
'\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE
'\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE
'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE
'\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA
'\xb4' # 0x00ef -> ACUTE ACCENT
'\xad' # 0x00f0 -> SOFT HYPHEN
'\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT
'\u02db' # 0x00f2 -> OGONEK
'\u02c7' # 0x00f3 -> CARON
'\u02d8' # 0x00f4 -> BREVE
'\xa7' # 0x00f5 -> SECTION SIGN
'\xf7' # 0x00f6 -> DIVISION SIGN
'\xb8' # 0x00f7 -> CEDILLA
'\xb0' # 0x00f8 -> DEGREE SIGN
'\xa8' # 0x00f9 -> DIAERESIS
'\u02d9' # 0x00fa -> DOT ABOVE
'\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
'\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON
'\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON
'\u25a0' # 0x00fe -> BLACK SQUARE
'\xa0' # 0x00ff -> NO-BREAK SPACE
)
### Encoding Map
encoding_map = {
0x0000: 0x0000, # NULL
0x0001: 0x0001, # START OF HEADING
0x0002: 0x0002, # START OF TEXT
0x0003: 0x0003, # END OF TEXT
0x0004: 0x0004, # END OF TRANSMISSION
0x0005: 0x0005, # ENQUIRY
0x0006: 0x0006, # ACKNOWLEDGE
0x0007: 0x0007, # BELL
0x0008: 0x0008, # BACKSPACE
0x0009: 0x0009, # HORIZONTAL TABULATION
0x000a: 0x000a, # LINE FEED
0x000b: 0x000b, # VERTICAL TABULATION
0x000c: 0x000c, # FORM FEED
0x000d: 0x000d, # CARRIAGE RETURN
0x000e: 0x000e, # SHIFT OUT
0x000f: 0x000f, # SHIFT IN
0x0010: 0x0010, # DATA LINK ESCAPE
0x0011: 0x0011, # DEVICE CONTROL ONE
0x0012: 0x0012, # DEVICE CONTROL TWO
0x0013: 0x0013, # DEVICE CONTROL THREE
0x0014: 0x0014, # DEVICE CONTROL FOUR
0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
0x0016: 0x0016, # SYNCHRONOUS IDLE
0x0017: 0x0017, # END OF TRANSMISSION BLOCK
0x0018: 0x0018, # CANCEL
0x0019: 0x0019, # END OF MEDIUM
0x001a: 0x001a, # SUBSTITUTE
0x001b: 0x001b, # ESCAPE
0x001c: 0x001c, # FILE SEPARATOR
0x001d: 0x001d, # GROUP SEPARATOR
0x001e: 0x001e, # RECORD SEPARATOR
0x001f: 0x001f, # UNIT SEPARATOR
0x0020: 0x0020, # SPACE
0x0021: 0x0021, # EXCLAMATION MARK
0x0022: 0x0022, # QUOTATION MARK
0x0023: 0x0023, # NUMBER SIGN
0x0024: 0x0024, # DOLLAR SIGN
0x0025: 0x0025, # PERCENT SIGN
0x0026: 0x0026, # AMPERSAND
0x0027: 0x0027, # APOSTROPHE
0x0028: 0x0028, # LEFT PARENTHESIS
0x0029: 0x0029, # RIGHT PARENTHESIS
0x002a: 0x002a, # ASTERISK
0x002b: 0x002b, # PLUS SIGN
0x002c: 0x002c, # COMMA
0x002d: 0x002d, # HYPHEN-MINUS
0x002e: 0x002e, # FULL STOP
0x002f: 0x002f, # SOLIDUS
0x0030: 0x0030, # DIGIT ZERO
0x0031: 0x0031, # DIGIT ONE
0x0032: 0x0032, # DIGIT TWO
0x0033: 0x0033, # DIGIT THREE
0x0034: 0x0034, # DIGIT FOUR
0x0035: 0x0035, # DIGIT FIVE
0x0036: 0x0036, # DIGIT SIX
0x0037: 0x0037, # DIGIT SEVEN
0x0038: 0x0038, # DIGIT EIGHT
0x0039: 0x0039, # DIGIT NINE
0x003a: 0x003a, # COLON
0x003b: 0x003b, # SEMICOLON
0x003c: 0x003c, # LESS-THAN SIGN
0x003d: 0x003d, # EQUALS SIGN
0x003e: 0x003e, # GREATER-THAN SIGN
0x003f: 0x003f, # QUESTION MARK
0x0040: 0x0040, # COMMERCIAL AT
0x0041: 0x0041, # LATIN CAPITAL LETTER A
0x0042: 0x0042, # LATIN CAPITAL LETTER B
0x0043: 0x0043, # LATIN CAPITAL LETTER C
0x0044: 0x0044, # LATIN CAPITAL LETTER D
0x0045: 0x0045, # LATIN CAPITAL LETTER E
0x0046: 0x0046, # LATIN CAPITAL LETTER F
0x0047: 0x0047, # LATIN CAPITAL LETTER G
0x0048: 0x0048, # LATIN CAPITAL LETTER H
0x0049: 0x0049, # LATIN CAPITAL LETTER I
0x004a: 0x004a, # LATIN CAPITAL LETTER J
0x004b: 0x004b, # LATIN CAPITAL LETTER K
0x004c: 0x004c, # LATIN CAPITAL LETTER L
0x004d: 0x004d, # LATIN CAPITAL LETTER M
0x004e: 0x004e, # LATIN CAPITAL LETTER N
0x004f: 0x004f, # LATIN CAPITAL LETTER O
0x0050: 0x0050, # LATIN CAPITAL LETTER P
0x0051: 0x0051, # LATIN CAPITAL LETTER Q
0x0052: 0x0052, # LATIN CAPITAL LETTER R
0x0053: 0x0053, # LATIN CAPITAL LETTER S
0x0054: 0x0054, # LATIN CAPITAL LETTER T
0x0055: 0x0055, # LATIN CAPITAL LETTER U
0x0056: 0x0056, # LATIN CAPITAL LETTER V
0x0057: 0x0057, # LATIN CAPITAL LETTER W
0x0058: 0x0058, # LATIN CAPITAL LETTER X
0x0059: 0x0059, # LATIN CAPITAL LETTER Y
0x005a: 0x005a, # LATIN CAPITAL LETTER Z
0x005b: 0x005b, # LEFT SQUARE BRACKET
0x005c: 0x005c, # REVERSE SOLIDUS
0x005d: 0x005d, # RIGHT SQUARE BRACKET
0x005e: 0x005e, # CIRCUMFLEX ACCENT
0x005f: 0x005f, # LOW LINE
0x0060: 0x0060, # GRAVE ACCENT
0x0061: 0x0061, # LATIN SMALL LETTER A
0x0062: 0x0062, # LATIN SMALL LETTER B
0x0063: 0x0063, # LATIN SMALL LETTER C
0x0064: 0x0064, # LATIN SMALL LETTER D
0x0065: 0x0065, # LATIN SMALL LETTER E
0x0066: 0x0066, # LATIN SMALL LETTER F
0x0067: 0x0067, # LATIN SMALL LETTER G
0x0068: 0x0068, # LATIN SMALL LETTER H
0x0069: 0x0069, # LATIN SMALL LETTER I
0x006a: 0x006a, # LATIN SMALL LETTER J
0x006b: 0x006b, # LATIN SMALL LETTER K
0x006c: 0x006c, # LATIN SMALL LETTER L
0x006d: 0x006d, # LATIN SMALL LETTER M
0x006e: 0x006e, # LATIN SMALL LETTER N
0x006f: 0x006f, # LATIN SMALL LETTER O
0x0070: 0x0070, # LATIN SMALL LETTER P
0x0071: 0x0071, # LATIN SMALL LETTER Q
0x0072: 0x0072, # LATIN SMALL LETTER R
0x0073: 0x0073, # LATIN SMALL LETTER S
0x0074: 0x0074, # LATIN SMALL LETTER T
0x0075: 0x0075, # LATIN SMALL LETTER U
0x0076: 0x0076, # LATIN SMALL LETTER V
0x0077: 0x0077, # LATIN SMALL LETTER W
0x0078: 0x0078, # LATIN SMALL LETTER X
0x0079: 0x0079, # LATIN SMALL LETTER Y
0x007a: 0x007a, # LATIN SMALL LETTER Z
0x007b: 0x007b, # LEFT CURLY BRACKET
0x007c: 0x007c, # VERTICAL LINE
0x007d: 0x007d, # RIGHT CURLY BRACKET
0x007e: 0x007e, # TILDE
0x007f: 0x007f, # DELETE
0x00a0: 0x00ff, # NO-BREAK SPACE
0x00a4: 0x00cf, # CURRENCY SIGN
0x00a7: 0x00f5, # SECTION SIGN
0x00a8: 0x00f9, # DIAERESIS
0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00ac: 0x00aa, # NOT SIGN
0x00ad: 0x00f0, # SOFT HYPHEN
0x00b0: 0x00f8, # DEGREE SIGN
0x00b4: 0x00ef, # ACUTE ACCENT
0x00b8: 0x00f7, # CEDILLA
0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
0x00d7: 0x009e, # MULTIPLICATION SIGN
0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE
0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
0x00f7: 0x00f6, # DIVISION SIGN
0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE
0x0102: 0x00c6, # LATIN CAPITAL LETTER A WITH BREVE
0x0103: 0x00c7, # LATIN SMALL LETTER A WITH BREVE
0x0104: 0x00a4, # LATIN CAPITAL LETTER A WITH OGONEK
0x0105: 0x00a5, # LATIN SMALL LETTER A WITH OGONEK
0x0106: 0x008f, # LATIN CAPITAL LETTER C WITH ACUTE
0x0107: 0x0086, # LATIN SMALL LETTER C WITH ACUTE
0x010c: 0x00ac, # LATIN CAPITAL LETTER C WITH CARON
0x010d: 0x009f, # LATIN SMALL LETTER C WITH CARON
0x010e: 0x00d2, # LATIN CAPITAL LETTER D WITH CARON
0x010f: 0x00d4, # LATIN SMALL LETTER D WITH CARON
0x0110: 0x00d1, # LATIN CAPITAL LETTER D WITH STROKE
0x0111: 0x00d0, # LATIN SMALL LETTER D WITH STROKE
0x0118: 0x00a8, # LATIN CAPITAL LETTER E WITH OGONEK
0x0119: 0x00a9, # LATIN SMALL LETTER E WITH OGONEK
0x011a: 0x00b7, # LATIN CAPITAL LETTER E WITH CARON
0x011b: 0x00d8, # LATIN SMALL LETTER E WITH CARON
0x0139: 0x0091, # LATIN CAPITAL LETTER L WITH ACUTE
0x013a: 0x0092, # LATIN SMALL LETTER L WITH ACUTE
0x013d: 0x0095, # LATIN CAPITAL LETTER L WITH CARON
0x013e: 0x0096, # LATIN SMALL LETTER L WITH CARON
0x0141: 0x009d, # LATIN CAPITAL LETTER L WITH STROKE
0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE
0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE
0x0144: 0x00e4, # LATIN SMALL LETTER N WITH ACUTE
0x0147: 0x00d5, # LATIN CAPITAL LETTER N WITH CARON
0x0148: 0x00e5, # LATIN SMALL LETTER N WITH CARON
0x0150: 0x008a, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x0151: 0x008b, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x0154: 0x00e8, # LATIN CAPITAL LETTER R WITH ACUTE
0x0155: 0x00ea, # LATIN SMALL LETTER R WITH ACUTE
0x0158: 0x00fc, # LATIN CAPITAL LETTER R WITH CARON
0x0159: 0x00fd, # LATIN SMALL LETTER R WITH CARON
0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE
0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE
0x015e: 0x00b8, # LATIN CAPITAL LETTER S WITH CEDILLA
0x015f: 0x00ad, # LATIN SMALL LETTER S WITH CEDILLA
0x0160: 0x00e6, # LATIN CAPITAL LETTER S WITH CARON
0x0161: 0x00e7, # LATIN SMALL LETTER S WITH CARON
0x0162: 0x00dd, # LATIN CAPITAL LETTER T WITH CEDILLA
0x0163: 0x00ee, # LATIN SMALL LETTER T WITH CEDILLA
0x0164: 0x009b, # LATIN CAPITAL LETTER T WITH CARON
0x0165: 0x009c, # LATIN SMALL LETTER T WITH CARON
0x016e: 0x00de, # LATIN CAPITAL LETTER U WITH RING ABOVE
0x016f: 0x0085, # LATIN SMALL LETTER U WITH RING ABOVE
0x0170: 0x00eb, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x0171: 0x00fb, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE
0x017a: 0x00ab, # LATIN SMALL LETTER Z WITH ACUTE
0x017b: 0x00bd, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x017c: 0x00be, # LATIN SMALL LETTER Z WITH DOT ABOVE
0x017d: 0x00a6, # LATIN CAPITAL LETTER Z WITH CARON
0x017e: 0x00a7, # LATIN SMALL LETTER Z WITH CARON
0x02c7: 0x00f3, # CARON
0x02d8: 0x00f4, # BREVE
0x02d9: 0x00fa, # DOT ABOVE
0x02db: 0x00f2, # OGONEK
0x02dd: 0x00f1, # DOUBLE ACUTE ACCENT
0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
0x2580: 0x00df, # UPPER HALF BLOCK
0x2584: 0x00dc, # LOWER HALF BLOCK
0x2588: 0x00db, # FULL BLOCK
0x2591: 0x00b0, # LIGHT SHADE
0x2592: 0x00b1, # MEDIUM SHADE
0x2593: 0x00b2, # DARK SHADE
0x25a0: 0x00fe, # BLACK SQUARE
}
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='cp852',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
)
### Decoding Map
decoding_map = codecs.make_identity_dict(range(256))
decoding_map.update({
0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE
0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE
0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE
0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE
0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON
0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON
0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON
0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON
0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
0x009e: 0x00d7, # MULTIPLICATION SIGN
0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON
0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON
0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
0x00aa: 0x00ac, # NOT SIGN
0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA
0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00b0: 0x2591, # LIGHT SHADE
0x00b1: 0x2592, # MEDIUM SHADE
0x00b2: 0x2593, # DARK SHADE
0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON
0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA
0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE
0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE
0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
0x00cf: 0x00a4, # CURRENCY SIGN
0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE
0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE
0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON
0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON
0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON
0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON
0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
0x00db: 0x2588, # FULL BLOCK
0x00dc: 0x2584, # LOWER HALF BLOCK
0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA
0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE
0x00df: 0x2580, # UPPER HALF BLOCK
0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON
0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON
0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE
0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE
0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA
0x00ef: 0x00b4, # ACUTE ACCENT
0x00f0: 0x00ad, # SOFT HYPHEN
0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT
0x00f2: 0x02db, # OGONEK
0x00f3: 0x02c7, # CARON
0x00f4: 0x02d8, # BREVE
0x00f5: 0x00a7, # SECTION SIGN
0x00f6: 0x00f7, # DIVISION SIGN
0x00f7: 0x00b8, # CEDILLA
0x00f8: 0x00b0, # DEGREE SIGN
0x00f9: 0x00a8, # DIAERESIS
0x00fa: 0x02d9, # DOT ABOVE
0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON
0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON
0x00fe: 0x25a0, # BLACK SQUARE
0x00ff: 0x00a0, # NO-BREAK SPACE
})
### Decoding Table
decoding_table = (
'\x00' # 0x0000 -> NULL
'\x01' # 0x0001 -> START OF HEADING
'\x02' # 0x0002 -> START OF TEXT
'\x03' # 0x0003 -> END OF TEXT
'\x04' # 0x0004 -> END OF TRANSMISSION
'\x05' # 0x0005 -> ENQUIRY
'\x06' # 0x0006 -> ACKNOWLEDGE
'\x07' # 0x0007 -> BELL
'\x08' # 0x0008 -> BACKSPACE
'\t' # 0x0009 -> HORIZONTAL TABULATION
'\n' # 0x000a -> LINE FEED
'\x0b' # 0x000b -> VERTICAL TABULATION
'\x0c' # 0x000c -> FORM FEED
'\r' # 0x000d -> CARRIAGE RETURN
'\x0e' # 0x000e -> SHIFT OUT
'\x0f' # 0x000f -> SHIFT IN
'\x10' # 0x0010 -> DATA LINK ESCAPE
'\x11' # 0x0011 -> DEVICE CONTROL ONE
'\x12' # 0x0012 -> DEVICE CONTROL TWO
'\x13' # 0x0013 -> DEVICE CONTROL THREE
'\x14' # 0x0014 -> DEVICE CONTROL FOUR
'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
'\x16' # 0x0016 -> SYNCHRONOUS IDLE
'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
'\x18' # 0x0018 -> CANCEL
'\x19' # 0x0019 -> END OF MEDIUM
'\x1a' # 0x001a -> SUBSTITUTE
'\x1b' # 0x001b -> ESCAPE
'\x1c' # 0x001c -> FILE SEPARATOR
'\x1d' # 0x001d -> GROUP SEPARATOR
'\x1e' # 0x001e -> RECORD SEPARATOR
'\x1f' # 0x001f -> UNIT SEPARATOR
' ' # 0x0020 -> SPACE
'!' # 0x0021 -> EXCLAMATION MARK
'"' # 0x0022 -> QUOTATION MARK
'#' # 0x0023 -> NUMBER SIGN
'$' # 0x0024 -> DOLLAR SIGN
'%' # 0x0025 -> PERCENT SIGN
'&' # 0x0026 -> AMPERSAND
"'" # 0x0027 -> APOSTROPHE
'(' # 0x0028 -> LEFT PARENTHESIS
')' # 0x0029 -> RIGHT PARENTHESIS
'*' # 0x002a -> ASTERISK
'+' # 0x002b -> PLUS SIGN
',' # 0x002c -> COMMA
'-' # 0x002d -> HYPHEN-MINUS
'.' # 0x002e -> FULL STOP
'/' # 0x002f -> SOLIDUS
'0' # 0x0030 -> DIGIT ZERO
'1' # 0x0031 -> DIGIT ONE
'2' # 0x0032 -> DIGIT TWO
'3' # 0x0033 -> DIGIT THREE
'4' # 0x0034 -> DIGIT FOUR
'5' # 0x0035 -> DIGIT FIVE
'6' # 0x0036 -> DIGIT SIX
'7' # 0x0037 -> DIGIT SEVEN
'8' # 0x0038 -> DIGIT EIGHT
'9' # 0x0039 -> DIGIT NINE
':' # 0x003a -> COLON
';' # 0x003b -> SEMICOLON
'<' # 0x003c -> LESS-THAN SIGN
'=' # 0x003d -> EQUALS SIGN
'>' # 0x003e -> GREATER-THAN SIGN
'?' # 0x003f -> QUESTION MARK
'@' # 0x0040 -> COMMERCIAL AT
'A' # 0x0041 -> LATIN CAPITAL LETTER A
'B' # 0x0042 -> LATIN CAPITAL LETTER B
'C' # 0x0043 -> LATIN CAPITAL LETTER C
'D' # 0x0044 -> LATIN CAPITAL LETTER D
'E' # 0x0045 -> LATIN CAPITAL LETTER E
'F' # 0x0046 -> LATIN CAPITAL LETTER F
'G' # 0x0047 -> LATIN CAPITAL LETTER G
'H' # 0x0048 -> LATIN CAPITAL LETTER H
'I' # 0x0049 -> LATIN CAPITAL LETTER I
'J' # 0x004a -> LATIN CAPITAL LETTER J
'K' # 0x004b -> LATIN CAPITAL LETTER K
'L' # 0x004c -> LATIN CAPITAL LETTER L
'M' # 0x004d -> LATIN CAPITAL LETTER M
'N' # 0x004e -> LATIN CAPITAL LETTER N
'O' # 0x004f -> LATIN CAPITAL LETTER O
'P' # 0x0050 -> LATIN CAPITAL LETTER P
'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
'R' # 0x0052 -> LATIN CAPITAL LETTER R
'S' # 0x0053 -> LATIN CAPITAL LETTER S
'T' # 0x0054 -> LATIN CAPITAL LETTER T
'U' # 0x0055 -> LATIN CAPITAL LETTER U
'V' # 0x0056 -> LATIN CAPITAL LETTER V
'W' # 0x0057 -> LATIN CAPITAL LETTER W
'X' # 0x0058 -> LATIN CAPITAL LETTER X
'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
'Z' # 0x005a -> LATIN CAPITAL LETTER Z
'[' # 0x005b -> LEFT SQUARE BRACKET
'\\' # 0x005c -> REVERSE SOLIDUS
']' # 0x005d -> RIGHT SQUARE BRACKET
'^' # 0x005e -> CIRCUMFLEX ACCENT
'_' # 0x005f -> LOW LINE
'`' # 0x0060 -> GRAVE ACCENT
'a' # 0x0061 -> LATIN SMALL LETTER A
'b' # 0x0062 -> LATIN SMALL LETTER B
'c' # 0x0063 -> LATIN SMALL LETTER C
'd' # 0x0064 -> LATIN SMALL LETTER D
'e' # 0x0065 -> LATIN SMALL LETTER E
'f' # 0x0066 -> LATIN SMALL LETTER F
'g' # 0x0067 -> LATIN SMALL LETTER G
'h' # 0x0068 -> LATIN SMALL LETTER H
'i' # 0x0069 -> LATIN SMALL LETTER I
'j' # 0x006a -> LATIN SMALL LETTER J
'k' # 0x006b -> LATIN SMALL LETTER K
'l' # 0x006c -> LATIN SMALL LETTER L
'm' # 0x006d -> LATIN SMALL LETTER M
'n' # 0x006e -> LATIN SMALL LETTER N
'o' # 0x006f -> LATIN SMALL LETTER O
'p' # 0x0070 -> LATIN SMALL LETTER P
'q' # 0x0071 -> LATIN SMALL LETTER Q
'r' # 0x0072 -> LATIN SMALL LETTER R
's' # 0x0073 -> LATIN SMALL LETTER S
't' # 0x0074 -> LATIN SMALL LETTER T
'u' # 0x0075 -> LATIN SMALL LETTER U
'v' # 0x0076 -> LATIN SMALL LETTER V
'w' # 0x0077 -> LATIN SMALL LETTER W
'x' # 0x0078 -> LATIN SMALL LETTER X
'y' # 0x0079 -> LATIN SMALL LETTER Y
'z' # 0x007a -> LATIN SMALL LETTER Z
'{' # 0x007b -> LEFT CURLY BRACKET
'|' # 0x007c -> VERTICAL LINE
'}' # 0x007d -> RIGHT CURLY BRACKET
'~' # 0x007e -> TILDE
'\x7f' # 0x007f -> DELETE
'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
'\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE
'\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE
'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE
'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
'\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
'\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE
'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
'\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE
'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
'\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE
'\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE
'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
'\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON
'\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON
'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE
'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE
'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
'\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON
'\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON
'\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE
'\xd7' # 0x009e -> MULTIPLICATION SIGN
'\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON
'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
'\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK
'\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK
'\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON
'\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON
'\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK
'\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK
'\xac' # 0x00aa -> NOT SIGN
'\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE
'\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON
'\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA
'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
'\u2591' # 0x00b0 -> LIGHT SHADE
'\u2592' # 0x00b1 -> MEDIUM SHADE
'\u2593' # 0x00b2 -> DARK SHADE
'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
'\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON
'\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA
'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
'\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
'\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE
'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
'\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE
'\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE
'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
'\xa4' # 0x00cf -> CURRENCY SIGN
'\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE
'\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE
'\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON
'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
'\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON
'\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON
'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
'\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON
'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
'\u2588' # 0x00db -> FULL BLOCK
'\u2584' # 0x00dc -> LOWER HALF BLOCK
'\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA
'\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE
'\u2580' # 0x00df -> UPPER HALF BLOCK
'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE
'\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE
'\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON
'\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON
'\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON
'\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE
'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
'\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE
'\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE
'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE
'\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA
'\xb4' # 0x00ef -> ACUTE ACCENT
'\xad' # 0x00f0 -> SOFT HYPHEN
'\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT
'\u02db' # 0x00f2 -> OGONEK
'\u02c7' # 0x00f3 -> CARON
'\u02d8' # 0x00f4 -> BREVE
'\xa7' # 0x00f5 -> SECTION SIGN
'\xf7' # 0x00f6 -> DIVISION SIGN
'\xb8' # 0x00f7 -> CEDILLA
'\xb0' # 0x00f8 -> DEGREE SIGN
'\xa8' # 0x00f9 -> DIAERESIS
'\u02d9' # 0x00fa -> DOT ABOVE
'\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
'\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON
'\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON
'\u25a0' # 0x00fe -> BLACK SQUARE
'\xa0' # 0x00ff -> NO-BREAK SPACE
)
### Encoding Map
encoding_map = {
0x0000: 0x0000, # NULL
0x0001: 0x0001, # START OF HEADING
0x0002: 0x0002, # START OF TEXT
0x0003: 0x0003, # END OF TEXT
0x0004: 0x0004, # END OF TRANSMISSION
0x0005: 0x0005, # ENQUIRY
0x0006: 0x0006, # ACKNOWLEDGE
0x0007: 0x0007, # BELL
0x0008: 0x0008, # BACKSPACE
0x0009: 0x0009, # HORIZONTAL TABULATION
0x000a: 0x000a, # LINE FEED
0x000b: 0x000b, # VERTICAL TABULATION
0x000c: 0x000c, # FORM FEED
0x000d: 0x000d, # CARRIAGE RETURN
0x000e: 0x000e, # SHIFT OUT
0x000f: 0x000f, # SHIFT IN
0x0010: 0x0010, # DATA LINK ESCAPE
0x0011: 0x0011, # DEVICE CONTROL ONE
0x0012: 0x0012, # DEVICE CONTROL TWO
0x0013: 0x0013, # DEVICE CONTROL THREE
0x0014: 0x0014, # DEVICE CONTROL FOUR
0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
0x0016: 0x0016, # SYNCHRONOUS IDLE
0x0017: 0x0017, # END OF TRANSMISSION BLOCK
0x0018: 0x0018, # CANCEL
0x0019: 0x0019, # END OF MEDIUM
0x001a: 0x001a, # SUBSTITUTE
0x001b: 0x001b, # ESCAPE
0x001c: 0x001c, # FILE SEPARATOR
0x001d: 0x001d, # GROUP SEPARATOR
0x001e: 0x001e, # RECORD SEPARATOR
0x001f: 0x001f, # UNIT SEPARATOR
0x0020: 0x0020, # SPACE
0x0021: 0x0021, # EXCLAMATION MARK
0x0022: 0x0022, # QUOTATION MARK
0x0023: 0x0023, # NUMBER SIGN
0x0024: 0x0024, # DOLLAR SIGN
0x0025: 0x0025, # PERCENT SIGN
0x0026: 0x0026, # AMPERSAND
0x0027: 0x0027, # APOSTROPHE
0x0028: 0x0028, # LEFT PARENTHESIS
0x0029: 0x0029, # RIGHT PARENTHESIS
0x002a: 0x002a, # ASTERISK
0x002b: 0x002b, # PLUS SIGN
0x002c: 0x002c, # COMMA
0x002d: 0x002d, # HYPHEN-MINUS
0x002e: 0x002e, # FULL STOP
0x002f: 0x002f, # SOLIDUS
0x0030: 0x0030, # DIGIT ZERO
0x0031: 0x0031, # DIGIT ONE
0x0032: 0x0032, # DIGIT TWO
0x0033: 0x0033, # DIGIT THREE
0x0034: 0x0034, # DIGIT FOUR
0x0035: 0x0035, # DIGIT FIVE
0x0036: 0x0036, # DIGIT SIX
0x0037: 0x0037, # DIGIT SEVEN
0x0038: 0x0038, # DIGIT EIGHT
0x0039: 0x0039, # DIGIT NINE
0x003a: 0x003a, # COLON
0x003b: 0x003b, # SEMICOLON
0x003c: 0x003c, # LESS-THAN SIGN
0x003d: 0x003d, # EQUALS SIGN
0x003e: 0x003e, # GREATER-THAN SIGN
0x003f: 0x003f, # QUESTION MARK
0x0040: 0x0040, # COMMERCIAL AT
0x0041: 0x0041, # LATIN CAPITAL LETTER A
0x0042: 0x0042, # LATIN CAPITAL LETTER B
0x0043: 0x0043, # LATIN CAPITAL LETTER C
0x0044: 0x0044, # LATIN CAPITAL LETTER D
0x0045: 0x0045, # LATIN CAPITAL LETTER E
0x0046: 0x0046, # LATIN CAPITAL LETTER F
0x0047: 0x0047, # LATIN CAPITAL LETTER G
0x0048: 0x0048, # LATIN CAPITAL LETTER H
0x0049: 0x0049, # LATIN CAPITAL LETTER I
0x004a: 0x004a, # LATIN CAPITAL LETTER J
0x004b: 0x004b, # LATIN CAPITAL LETTER K
0x004c: 0x004c, # LATIN CAPITAL LETTER L
0x004d: 0x004d, # LATIN CAPITAL LETTER M
0x004e: 0x004e, # LATIN CAPITAL LETTER N
0x004f: 0x004f, # LATIN CAPITAL LETTER O
0x0050: 0x0050, # LATIN CAPITAL LETTER P
0x0051: 0x0051, # LATIN CAPITAL LETTER Q
0x0052: 0x0052, # LATIN CAPITAL LETTER R
0x0053: 0x0053, # LATIN CAPITAL LETTER S
0x0054: 0x0054, # LATIN CAPITAL LETTER T
0x0055: 0x0055, # LATIN CAPITAL LETTER U
0x0056: 0x0056, # LATIN CAPITAL LETTER V
0x0057: 0x0057, # LATIN CAPITAL LETTER W
0x0058: 0x0058, # LATIN CAPITAL LETTER X
0x0059: 0x0059, # LATIN CAPITAL LETTER Y
0x005a: 0x005a, # LATIN CAPITAL LETTER Z
0x005b: 0x005b, # LEFT SQUARE BRACKET
0x005c: 0x005c, # REVERSE SOLIDUS
0x005d: 0x005d, # RIGHT SQUARE BRACKET
0x005e: 0x005e, # CIRCUMFLEX ACCENT
0x005f: 0x005f, # LOW LINE
0x0060: 0x0060, # GRAVE ACCENT
0x0061: 0x0061, # LATIN SMALL LETTER A
0x0062: 0x0062, # LATIN SMALL LETTER B
0x0063: 0x0063, # LATIN SMALL LETTER C
0x0064: 0x0064, # LATIN SMALL LETTER D
0x0065: 0x0065, # LATIN SMALL LETTER E
0x0066: 0x0066, # LATIN SMALL LETTER F
0x0067: 0x0067, # LATIN SMALL LETTER G
0x0068: 0x0068, # LATIN SMALL LETTER H
0x0069: 0x0069, # LATIN SMALL LETTER I
0x006a: 0x006a, # LATIN SMALL LETTER J
0x006b: 0x006b, # LATIN SMALL LETTER K
0x006c: 0x006c, # LATIN SMALL LETTER L
0x006d: 0x006d, # LATIN SMALL LETTER M
0x006e: 0x006e, # LATIN SMALL LETTER N
0x006f: 0x006f, # LATIN SMALL LETTER O
0x0070: 0x0070, # LATIN SMALL LETTER P
0x0071: 0x0071, # LATIN SMALL LETTER Q
0x0072: 0x0072, # LATIN SMALL LETTER R
0x0073: 0x0073, # LATIN SMALL LETTER S
0x0074: 0x0074, # LATIN SMALL LETTER T
0x0075: 0x0075, # LATIN SMALL LETTER U
0x0076: 0x0076, # LATIN SMALL LETTER V
0x0077: 0x0077, # LATIN SMALL LETTER W
0x0078: 0x0078, # LATIN SMALL LETTER X
0x0079: 0x0079, # LATIN SMALL LETTER Y
0x007a: 0x007a, # LATIN SMALL LETTER Z
0x007b: 0x007b, # LEFT CURLY BRACKET
0x007c: 0x007c, # VERTICAL LINE
0x007d: 0x007d, # RIGHT CURLY BRACKET
0x007e: 0x007e, # TILDE
0x007f: 0x007f, # DELETE
0x00a0: 0x00ff, # NO-BREAK SPACE
0x00a4: 0x00cf, # CURRENCY SIGN
0x00a7: 0x00f5, # SECTION SIGN
0x00a8: 0x00f9, # DIAERESIS
0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00ac: 0x00aa, # NOT SIGN
0x00ad: 0x00f0, # SOFT HYPHEN
0x00b0: 0x00f8, # DEGREE SIGN
0x00b4: 0x00ef, # ACUTE ACCENT
0x00b8: 0x00f7, # CEDILLA
0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
0x00d7: 0x009e, # MULTIPLICATION SIGN
0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE
0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
0x00f7: 0x00f6, # DIVISION SIGN
0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE
0x0102: 0x00c6, # LATIN CAPITAL LETTER A WITH BREVE
0x0103: 0x00c7, # LATIN SMALL LETTER A WITH BREVE
0x0104: 0x00a4, # LATIN CAPITAL LETTER A WITH OGONEK
0x0105: 0x00a5, # LATIN SMALL LETTER A WITH OGONEK
0x0106: 0x008f, # LATIN CAPITAL LETTER C WITH ACUTE
0x0107: 0x0086, # LATIN SMALL LETTER C WITH ACUTE
0x010c: 0x00ac, # LATIN CAPITAL LETTER C WITH CARON
0x010d: 0x009f, # LATIN SMALL LETTER C WITH CARON
0x010e: 0x00d2, # LATIN CAPITAL LETTER D WITH CARON
0x010f: 0x00d4, # LATIN SMALL LETTER D WITH CARON
0x0110: 0x00d1, # LATIN CAPITAL LETTER D WITH STROKE
0x0111: 0x00d0, # LATIN SMALL LETTER D WITH STROKE
0x0118: 0x00a8, # LATIN CAPITAL LETTER E WITH OGONEK
0x0119: 0x00a9, # LATIN SMALL LETTER E WITH OGONEK
0x011a: 0x00b7, # LATIN CAPITAL LETTER E WITH CARON
0x011b: 0x00d8, # LATIN SMALL LETTER E WITH CARON
0x0139: 0x0091, # LATIN CAPITAL LETTER L WITH ACUTE
0x013a: 0x0092, # LATIN SMALL LETTER L WITH ACUTE
0x013d: 0x0095, # LATIN CAPITAL LETTER L WITH CARON
0x013e: 0x0096, # LATIN SMALL LETTER L WITH CARON
0x0141: 0x009d, # LATIN CAPITAL LETTER L WITH STROKE
0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE
0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE
0x0144: 0x00e4, # LATIN SMALL LETTER N WITH ACUTE
0x0147: 0x00d5, # LATIN CAPITAL LETTER N WITH CARON
0x0148: 0x00e5, # LATIN SMALL LETTER N WITH CARON
0x0150: 0x008a, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x0151: 0x008b, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x0154: 0x00e8, # LATIN CAPITAL LETTER R WITH ACUTE
0x0155: 0x00ea, # LATIN SMALL LETTER R WITH ACUTE
0x0158: 0x00fc, # LATIN CAPITAL LETTER R WITH CARON
0x0159: 0x00fd, # LATIN SMALL LETTER R WITH CARON
0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE
0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE
0x015e: 0x00b8, # LATIN CAPITAL LETTER S WITH CEDILLA
0x015f: 0x00ad, # LATIN SMALL LETTER S WITH CEDILLA
0x0160: 0x00e6, # LATIN CAPITAL LETTER S WITH CARON
0x0161: 0x00e7, # LATIN SMALL LETTER S WITH CARON
0x0162: 0x00dd, # LATIN CAPITAL LETTER T WITH CEDILLA
0x0163: 0x00ee, # LATIN SMALL LETTER T WITH CEDILLA
0x0164: 0x009b, # LATIN CAPITAL LETTER T WITH CARON
0x0165: 0x009c, # LATIN SMALL LETTER T WITH CARON
0x016e: 0x00de, # LATIN CAPITAL LETTER U WITH RING ABOVE
0x016f: 0x0085, # LATIN SMALL LETTER U WITH RING ABOVE
0x0170: 0x00eb, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x0171: 0x00fb, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE
0x017a: 0x00ab, # LATIN SMALL LETTER Z WITH ACUTE
0x017b: 0x00bd, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x017c: 0x00be, # LATIN SMALL LETTER Z WITH DOT ABOVE
0x017d: 0x00a6, # LATIN CAPITAL LETTER Z WITH CARON
0x017e: 0x00a7, # LATIN SMALL LETTER Z WITH CARON
0x02c7: 0x00f3, # CARON
0x02d8: 0x00f4, # BREVE
0x02d9: 0x00fa, # DOT ABOVE
0x02db: 0x00f2, # OGONEK
0x02dd: 0x00f1, # DOUBLE ACUTE ACCENT
0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
0x2580: 0x00df, # UPPER HALF BLOCK
0x2584: 0x00dc, # LOWER HALF BLOCK
0x2588: 0x00db, # FULL BLOCK
0x2591: 0x00b0, # LIGHT SHADE
0x2592: 0x00b1, # MEDIUM SHADE
0x2593: 0x00b2, # DARK SHADE
0x25a0: 0x00fe, # BLACK SQUARE
}
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
| ArcherSys/ArcherSys | Lib/encodings/cp852.py | Python | mit | 105,146 |
package com.lfk.justweengine.Utils.tools;
import android.content.Context;
import android.content.SharedPreferences;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 简化Sp存储的工具类
*
* @author liufengkai
*/
public class SpUtils {
public SpUtils() {
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
}
/**
* Sp文件名
*/
public static final String FILE_NAME = "share_data";
/**
* 保存数据的方法,添加具体数据类型
*
* @param context
* @param key
* @param object
*/
public static void put(Context context, String key, Object object) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
// 判断数据类型
if (object instanceof String) {
editor.putString(key, (String) object);
} else if (object instanceof Integer) {
editor.putInt(key, (Integer) object);
} else if (object instanceof Boolean) {
editor.putBoolean(key, (Boolean) object);
} else if (object instanceof Float) {
editor.putFloat(key, (Float) object);
} else if (object instanceof Long) {
editor.putLong(key, (Long) object);
} else {
editor.putString(key, object.toString());
}
SharedPreferencesCompat.apply(editor);
}
/**
* 获取保存数据的方法,添加具体数据类型
*
* @param context
* @param key
* @param defaultObject
* @return object
*/
public static Object get(Context context, String key, Object defaultObject) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
if (defaultObject instanceof String) {
return sp.getString(key, (String) defaultObject);
} else if (defaultObject instanceof Integer) {
return sp.getInt(key, (Integer) defaultObject);
} else if (defaultObject instanceof Boolean) {
return sp.getBoolean(key, (Boolean) defaultObject);
} else if (defaultObject instanceof Float) {
return sp.getFloat(key, (Float) defaultObject);
} else if (defaultObject instanceof Long) {
return sp.getLong(key, (Long) defaultObject);
}
return null;
}
/**
* 存放数组
*
* @param context
* @param list
* @param key
*/
public static void putList(Context context, List list, String key) {
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < list.size(); i++) {
JSONObject object = new JSONObject();
try {
object.put(i + "", list.get(i));
jsonArray.put(object);
} catch (JSONException e) {
e.printStackTrace();
}
}
put(context, key, jsonArray.toString());
}
/**
* 获取数组
*
* @param context
* @param key
* @return list
*/
public static List getList(Context context, String key) {
List list = new ArrayList();
try {
JSONArray jsonArray = new JSONArray((String) get(context, key, ""));
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
list.add(i, object.getString(i + ""));
}
} catch (JSONException e) {
e.printStackTrace();
}
return list;
}
/**
* 存入哈希表
*
* @param context
* @param map
* @param key
*/
public static void putMap(Context context, Map<?, ?> map, String key) {
JSONArray jsonArray = new JSONArray();
Set set = map.entrySet();
Iterator iterator = set.iterator();
for (int i = 0; i < map.size(); i++) {
Map.Entry mapEntry = (Map.Entry) iterator.next();
try {
JSONObject object = new JSONObject();
object.put("key", mapEntry.getKey());
object.put("value", mapEntry.getValue());
jsonArray.put(object);
} catch (JSONException e) {
e.printStackTrace();
}
}
put(context, key, jsonArray.toString());
}
/**
* 读取哈希表
*
* @param context
* @param key
* @return map
*/
public static Map getMap(Context context, String key) {
Map map = new HashMap();
try {
JSONArray jsonArray = new JSONArray((String) get(context, key, ""));
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject object = jsonArray.getJSONObject(i);
map.put(object.getString("key"), object.getString("value"));
} catch (JSONException e) {
e.printStackTrace();
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return map;
}
/**
* 移除某个key值已经对应的值
*
* @param context
* @param key
*/
public static void remove(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.remove(key);
SharedPreferencesCompat.apply(editor);
}
/**
* 清除所有数据
*
* @param context
*/
public static void clear(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.clear();
SharedPreferencesCompat.apply(editor);
}
/**
* 查询某个key是否存在
*
* @param context
* @param key
* @return
*/
public static boolean contains(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.contains(key);
}
/**
* 返回所有的键值对
*
* @param context
* @return map
*/
public static Map<String, ?> getAll(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.getAll();
}
/**
* 解决SharedPreferencesCompat.apply方法的兼容类
*
* @author liufengkai
*/
private static class SharedPreferencesCompat {
private static final Method sApplyMethod = findApplyMethod();
/**
* 反射查找apply的方法
*
* @return method
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private static Method findApplyMethod() {
try {
Class clz = SharedPreferences.Editor.class;
return clz.getMethod("apply");
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return null;
}
/**
* 如果找到则使用apply执行,否则使用commit
*
* @param editor
*/
public static void apply(SharedPreferences.Editor editor) {
try {
if (sApplyMethod != null) {
sApplyMethod.invoke(editor);
return;
}
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
editor.commit();
}
}
} | Sonnydch/dzwfinal | AndroidFinal/engine/src/main/java/com/lfk/justweengine/Utils/tools/SpUtils.java | Java | mit | 8,126 |
<?php
return array (
'id' => 'samsung_z130_ver1',
'fallback' => 'generic_android_ver4_2',
'capabilities' =>
array (
'model_name' => 'Z130',
'brand_name' => 'Acer',
'release_date' => '2013_september',
'physical_screen_height' => '74',
'physical_screen_width' => '50',
),
);
| cuckata23/wurfl-data | data/samsung_z130_ver1.php | PHP | mit | 304 |
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
import codeanticode.syphon.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
public class ANTES01 extends PApplet {
//
//////////
//
// WRAP
// Syphon/minim/fun000
//
// V.00 paraelfestival"ANTES"
// feelGoodSoftwareporGuillermoGonz\u00e1lezIrigoyen
//
//////////
//
//VARIABLES DE CONFIGURACI\u00d3N
//Tama\u00f1o de la pantalla , proporciones y tweak
boolean pCompleta = false; //salidas a proyector 1024X768
boolean pCambiable= true;
int pPantalla = 4;
int pP,pW,pH;
//Syphon
SyphonServer server;
String nombreServer = "ANTES01";
//Audio
Minim minim;
AudioInput in0;
//
// ...
//LINEA
Linea lin,lin1;
int[] coloresAntes = { 0xff2693FF, 0xffEF3B63 , 0xffFFFFFB, 0xff000000};
int numColor = 1;
boolean hay;
int alfa = 255;
boolean moverL = false;
boolean moverH = false;
int xIL = 0;
int yIL = 10;
int intA = 50;
int sepLR = 5;
int anchoL = 0;
int anchoR = 0;
int anchoS = 1;
int distMov = 1;
//FONDO
boolean fondo = true;
boolean textura = true;
boolean sinCuadricula = true;
int R = 85;
int G = 85;
int B = 85;
int A = 10;
//CONTROLES
boolean sumar = true;
int paso = 2;
//##SETUP##
//
public void setup()
{
//CANVAS
pP = (pCompleta == true)? 1 : pPantalla;
size(displayWidth/pP, displayHeight/pP, P3D);
pW=width;pH=height;
frame.setResizable(pCambiable);
//SYPHON SERVER
server = new SyphonServer(this, nombreServer);
//AUDIO
minim = new Minim(this);
in0 = minim.getLineIn();
//
// ...
yIL = height/2;
lin = new Linea(xIL, yIL, coloresAntes[numColor], alfa);
lin1 = new Linea(xIL, yIL-50, coloresAntes[numColor+1], alfa);
}
//##DRAW##
//
public void draw()
{
pW=width;
pH=height;
if(fondo){ background(coloresAntes[2]); }
int normi;
pushMatrix();
for(int i = 0; i < pW; i++)
{
normi=i;
if(i>1024||i==1024){ normi = PApplet.parseInt(norm(i,0,1024)); }
lin.conectarHorizontal(i, normi, intA, sepLR, anchoL, anchoR, anchoS, coloresAntes[numColor], alfa);
}
if(moverL==true){ lin.moverVertical(moverL, distMov, moverH);
lin1.moverVertical(moverL, distMov, moverH); }
popMatrix();
//fondo
if(textura){ pushMatrix(); fondodePapel(R,G,B,A,sinCuadricula); popMatrix(); }
//SYPHON SERVER
server.sendScreen();
}
//
//##CONTROLES##
//
public void keyPressed()
{
char k = key;
switch(k)
{
////////////////////////////////////////////
////////////////////////////////////////////
//controles//
case '<':
sumar = !sumar;
print("sumar :",sumar,"\n");
print("paso :",paso,"\n");
print("___________________\n");
break;
case '0':
break;
case '1':
fondo=!fondo;
print("fondo :",fondo,"\n");
print("___________________\n");
break;
case '2':
sinCuadricula=!sinCuadricula;
print("sinCuadricula :",sinCuadricula,"\n");
print("___________________\n");
break;
case '3':
textura=!textura;
print("textura :",textura,"\n");
print("___________________\n");
break;
case 'z':
paso--;
paso = (paso>255)?255:paso;
paso = (paso<0)?0:paso;
print("paso :",paso,"\n");
print("___________________\n");
break;
case 'x':
paso++;
paso = (paso>255)?255:paso;
paso = (paso<0)?0:paso;
print("paso :",paso,"\n");
print("___________________\n");
break;
////////////////////////////////////////////
////////////////////////////////////////////
//fondo//
case 'q':
if(sumar==true)
{
R+=paso;
R = (R>255)?255:R;
R = (R<0)?0:R;
} else {
R-=paso;
R = (R>255)?255:R;
R = (R<0)?0:R;
}
print("Rojo :",R,"\n");
print("___________________\n");
break;
case 'w':
if(sumar==true)
{
G+=paso;
G = (G>255)?255:G;
G = (G<0)?0:G;
} else {
G-=paso;
G = (G>255)?255:G;
G = (G<0)?0:G;
}
print("Verde :",G,"\n");
print("___________________\n");
break;
case 'e':
if(sumar==true)
{
B+=paso;
B = (B>255)?255:B;
B = (B<0)?0:B;
} else {
B-=paso;
B = (B>255)?255:B;
B = (B<0)?0:B;
}
print("Azul :",B,"\n");
print("___________________\n");
break;
case 'a':
if(sumar==true)
{
A+=paso;
A = (A>255)?255:A;
A = (A<0)?0:A;
} else {
A-=paso;
A = (A>255)?255:A;
A = (A<0)?0:A;
}
print("Grano Papel :",A,"\n");
print("___________________\n");
break;
case 's':
break;
////////////////////////////////////////////
////////////////////////////////////////////
//Linea//
case 'r':
numColor+=1;
hay = (numColor > coloresAntes.length || numColor == coloresAntes.length)? false : true;
numColor = (hay)? numColor : 0;
print("numColor :",numColor,"\n");
print("___________________\n");
break;
case 't':
if(sumar==true)
{
anchoL+=paso;
anchoL = (anchoL>1000)?1000:anchoL;
anchoL = (anchoL<0)?0:anchoL;
} else {
anchoL-=paso;
anchoL = (anchoL>1000)?1000:anchoL;
anchoL = (anchoL<0)?0:anchoL;
}
print("Ancho canal izquierdo :",anchoL,"\n");
print("___________________\n");
break;
case 'y':
if(sumar==true)
{
anchoR+=paso;
anchoR = (anchoR>1000)?1000:anchoR;
anchoR = (anchoR<0)?0:anchoR;
} else {
anchoR-=paso;
anchoR = (anchoR>1000)?1000:anchoR;
anchoR = (anchoR<0)?0:anchoR;
}
print("Ancho canal derecho :",anchoR,"\n");
print("___________________\n");
break;
case 'f':
moverL = !moverL;
print("Mover Linea :",moverL,"\n");
print("___________________\n");
break;
case 'g':
moverH = !moverH;
print("Mover distancia horizontal :",moverH,"\n");
print("___________________\n");
break;
case 'h':
if(sumar==true)
{
sepLR+=paso;
sepLR = (anchoR>1000)?1000:sepLR;
sepLR = (anchoR<0)?0:sepLR;
} else {
sepLR-=paso;
sepLR = (anchoR>1000)?1000:sepLR;
sepLR = (anchoR<0)?10:anchoR;
}
print("Separaci\u00f3n canales :",sepLR,"\n");
print("___________________\n");
break;
case 'v':
if(sumar==true)
{
intA+=paso;
intA = (intA>1000)?1000:intA;
intA = (intA<0)?0:intA;
} else {
intA-=paso;
intA = (intA>1000)?1000:intA;
intA = (intA<0)?0:intA;
}
print("intencidad respuesta input :",intA,"\n");
print("___________________\n");
break;
case 'b':
if(sumar==true)
{
distMov+=paso;
distMov = (distMov>1000)?1000:distMov;
distMov = (distMov<0)?0:distMov;
} else {
distMov-=paso;
distMov = (distMov>1000)?1000:distMov;
distMov = (distMov<0)?0:distMov;
}
print("distMov :",distMov,"\n");
print("___________________\n");
break;
case 'n':
if(sumar==true)
{
anchoS+=paso;
anchoS = (anchoS>1000)?1000:anchoS;
anchoS = (anchoS<0)?0:anchoS;
} else {
anchoS-=paso;
anchoS = (anchoS>1000)?1000:anchoS;
anchoS = (anchoS<0)?0:anchoS;
}
print("distMov :",anchoS,"\n");
print("___________________\n");
break;
////////////////////////////////////////////
////////////////////////////////////////////
//RESETS 7 8 9//
case '9':
numColor = 1;
alfa = 255;
moverL = false;
moverH = false;
xIL = 0;
yIL = 10;
intA = 50;
sepLR = 5;
anchoL = 0;
anchoR = 0;
anchoS = 1;
distMov = 1;
fondo = true;
textura = true;
sinCuadricula = true;
R = 85;
G = 85;
B = 85;
A = 10;
break;
case '8':
numColor = 1;
alfa = 255;
moverL = false;
moverH = false;
xIL = 0;
yIL = 10;
intA = 50;
sepLR = 5;
anchoL = 0;
anchoR = 0;
anchoS = 1;
distMov = 1;
break;
case '7':
fondo = false;
textura = true;
sinCuadricula = true;
R = 85;
G = 85;
B = 85;
A = 10;
break;
//
//DEFAULT
default:
break;
}
}
//
//##FONDO
//
public void fondodePapel(int R, int G, int B, int A, boolean sinCuadricula)
{
if(sinCuadricula){ noStroke(); }
for (int i = 0; i<width; i+=2)
{
for (int j = 0; j<height; j+=2)
{
fill(random(R-10, R+10),random(G-10, G+10),random(B-10, B+10), random(A*2.5f,A*3));
rect(i, j, 2, 2);
}
}
for (int i = 0; i<30; i++)
{
fill(random(R/2, R+R/2), random(A*2.5f, A*3));
rect(random(0, width-2), random(0, height-2), random(1, 3), random(1, 3));
}
}
//
//##OVER##
//
public boolean sketchFullScreen() { return pCompleta; }
class Linea
{
int x, y, largo, colorLinea, a;
Linea(int X, int Y, int COLORLINEA, int A)
{
x=X;
y=Y;
colorLinea=COLORLINEA;
a=A;
}
public void conectarHorizontal(int I, int NORMI, int INTEN, int DISTI, int A1, int A2 , float GROSLIN, int COLORLINEA, int A)
{
stroke(COLORLINEA, A);
strokeWeight(GROSLIN);
line( y+in0.left.get(NORMI)*INTEN, x+I, y+A1+in0.left.get(NORMI)*INTEN, x+I+1);
line( y+DISTI+in0.right.get(NORMI)*INTEN, x+I, y+A2+DISTI+in0.right.get(NORMI)*INTEN, x+I+1);
}
public void conectarVertical(int I, int NORMI, int INTEN, int DISTI, int A1, int A2 , float GROSLIN, int COLORLINEA, int A)
{
stroke(COLORLINEA, A);
strokeWeight(GROSLIN);
line( y+in0.left.get(NORMI)*INTEN, x+I, y+A1+in0.left.get(NORMI)*INTEN, x+I+1);
line( y+DISTI+in0.right.get(NORMI)*INTEN, x+I+1, y+A2+DISTI+in0.right.get(NORMI)*INTEN, x+I);
}
public void moverVertical(boolean MOVER, int CUANTO, boolean WIDTH)
{
if(MOVER == true)
{
y+=CUANTO;
int distancia = (WIDTH == true) ? width : height;
if(y>distancia)
{
y=0;
}
}
}
}
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "ANTES01" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}
| joseflamas/zet | variaciones/antesFestival/ANTES01/build-tmp/source/ANTES01.java | Java | mit | 11,561 |
ml.module('three.scenes.Fog')
.requires('three.Three',
'three.core.Color')
.defines(function(){
/**
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
*/
THREE.Fog = function ( hex, near, far ) {
this.color = new THREE.Color( hex );
this.near = ( near !== undefined ) ? near : 1;
this.far = ( far !== undefined ) ? far : 1000;
};
}); | zfedoran/modulite-three.js | example/js/threejs/src/scenes/Fog.js | JavaScript | mit | 390 |
<?php
/**
* Copyright (c) 2012 - 2017, COOPATTITUDE. Tous droits réservés.
*
*
* @author COOPATTITUDE
* @copyright Copyright (c) 2012 - 2017, COOPATTITUDE
*/
class IrCssClassBody extends \IrCssClassFather {
function __construct ($className) {
parent::__construct ('body', $className) ;
}
function setFontNormal ($fontSize, $textAlign) {
$this->fontFamily = '"Segoe UI", Tahoma, Arial, Verdana' ;
$this->fontStyle = 'normal' ;
$this->fontVariant = 'normal' ;
$this->fontWeight = 'normal' ;
$this->fontSize = $fontSize ;
$this->textAlign = $textAlign ;
}
function setFontItalic ($fontSize, $textAlign) {
$this->fontFamily = '"Segoe UI", Tahoma, Arial, Verdana' ;
$this->fontStyle = 'italic' ;
$this->fontVariant = 'normal' ;
$this->fontWeight = 'normal' ;
$this->fontSize = $fontSize ;
$this->textAlign = $textAlign ;
}
function setFontBold ($fontSize, $textAlign) {
$this->fontFamily = '"Segoe UI", Tahoma, Arial, Verdana' ;
$this->fontStyle = 'normal' ;
$this->fontVariant = 'normal' ;
$this->fontWeight = 'bold' ;
$this->fontSize = $fontSize ;
$this->textAlign = $textAlign ;
}
}
?>
| coopattitude/coopgui | system/Css/IrCssClassBody.php | PHP | mit | 1,148 |
require "sampler/engine"
module Sampler
end
| kikonen/sampler | lib/sampler.rb | Ruby | mit | 45 |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_TagManager_WorkspaceProposalHistory extends Google_Model
{
protected $commentType = 'Google_Service_TagManager_WorkspaceProposalHistoryComment';
protected $commentDataType = '';
protected $createdByType = 'Google_Service_TagManager_WorkspaceProposalUser';
protected $createdByDataType = '';
protected $createdTimestampType = 'Google_Service_TagManager_Timestamp';
protected $createdTimestampDataType = '';
protected $statusChangeType = 'Google_Service_TagManager_WorkspaceProposalHistoryStatusChange';
protected $statusChangeDataType = '';
public $type;
public function setComment(Google_Service_TagManager_WorkspaceProposalHistoryComment $comment)
{
$this->comment = $comment;
}
public function getComment()
{
return $this->comment;
}
public function setCreatedBy(Google_Service_TagManager_WorkspaceProposalUser $createdBy)
{
$this->createdBy = $createdBy;
}
public function getCreatedBy()
{
return $this->createdBy;
}
public function setCreatedTimestamp(Google_Service_TagManager_Timestamp $createdTimestamp)
{
$this->createdTimestamp = $createdTimestamp;
}
public function getCreatedTimestamp()
{
return $this->createdTimestamp;
}
public function setStatusChange(Google_Service_TagManager_WorkspaceProposalHistoryStatusChange $statusChange)
{
$this->statusChange = $statusChange;
}
public function getStatusChange()
{
return $this->statusChange;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
}
| dwivivagoal/KuizMilioner | application/libraries/php-google-sdk/google/apiclient-services/src/Google/Service/TagManager/WorkspaceProposalHistory.php | PHP | mit | 2,197 |