code stringlengths 4 1.01M | language stringclasses 2 values |
|---|---|
<?php
use Stringizer\Stringizer;
/**
* Date Unit Tests
*/
class DateTest extends PHPUnit_Framework_TestCase
{
public function testValidDate()
{
date_default_timezone_set('America/Vancouver');
$s = new Stringizer("January 1st");
$this->assertEquals(true, $s->isDate());
$s = new Stringizer("2015-03-15");
$this->assertEquals(true, $s->isDate());
$s = new Stringizer("1 week ago");
$this->assertEquals(true, $s->isDate());
}
public function testInValidDate()
{
date_default_timezone_set('America/Vancouver');
$s = new Stringizer("Bad Date Input");
$this->assertEquals(false, $s->isDate());
}
}
| Java |
"""
Django settings for ross project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'jtn=n8&nq9jgir8_z1ck40^c1s22d%=)z5qsm*q(bku*_=^sg&'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'ross.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'ross.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
| Java |
////////////////////////////////////////////////////////////////////////////////
//worldgenerator.cs
//Created on: 2015-8-21, 18:18
//
//Project VoxelEngine
//Copyright C bajsko 2015. All rights Reserved.
////////////////////////////////////////////////////////////////////////////////
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VoxelEngine.Game.Blocks;
using VoxelEngine.GameConsole;
using VoxelEngine.Utility;
namespace VoxelEngine.Game
{
public class WorldGenerator
{
private World mWorldRef;
public WorldGenerator(World worldRef)
{
this.mWorldRef = worldRef;
}
public Chunk GenerateChunk(int xp, int yp, int zp)
{
Chunk chunk = null;
chunk = new Chunk(new Vector3(xp, yp, zp));
Vector3 chunkPosBlock = new Vector3(xp, yp, zp) * Chunk.CHUNK_SIZE;
int treeDensity = 2;
float stoneBaseHeight = 0;
float stoneBaseNoise = 0.05f;
float stoneBaseNoiseHeight = 4;
float stoneMountainHeight = 48;
float stoneMountainFrequency = 0.008f;
float stoneMinHeight = -12;
float dirtBaseHeight = 1;
float dirtNoise = 0.04f;
float dirtNoiseHeight = 3;
for (int x = (int)chunkPosBlock.X - 5; x < chunkPosBlock.X + Chunk.CHUNK_SIZE + 5; x++)
{
for(int z = (int)chunkPosBlock.Z - 5; z < chunkPosBlock.Z + Chunk.CHUNK_SIZE + 5; z++)
{
int stoneHeight = (int)Math.Floor(stoneBaseHeight);
stoneHeight += (int)Math.Floor(GetNoiseValue(x, 0, z, stoneMountainFrequency, (int)(stoneMountainHeight)));
if (stoneHeight < stoneMinHeight)
stoneHeight = (int)Math.Floor((stoneMinHeight));
stoneHeight += (int)Math.Floor(GetNoiseValue(x, 0, z, stoneBaseNoise, (int)(stoneBaseNoiseHeight)));
int dirtHeight = stoneHeight + (int)(dirtBaseHeight);
dirtHeight += (int)Math.Floor(GetNoiseValue(x, 100, z, dirtNoise, (int)(dirtNoiseHeight)));
for (int y = (int)chunkPosBlock.Y - 10; y < chunkPosBlock.Y+Chunk.CHUNK_SIZE + 10; y++)
{
//from world block space to local chunk space
int xfactor = (int)chunkPosBlock.X;
int yfactor = (int)chunkPosBlock.Y;
int zfactor = (int)chunkPosBlock.Z;
if (y <= stoneHeight)
chunk.SetBlock(x-xfactor, y-yfactor, z-zfactor, new Block(BlockType.Stone));
else if (y <= dirtHeight)
{
chunk.SetBlock(x - xfactor, y - yfactor, z - zfactor, new Block(BlockType.Grass));
if (y == dirtHeight && GetNoiseValue(x, 0, z, 0.2f, 100) < treeDensity)
{
//CreateTree(x, y, z);
}
}
}
}
}
//chunk.ApplySunlight();
return chunk;
}
public Chunk GenerateChunk(Vector3 position)
{
return GenerateChunk((int)position.X, (int)position.Y, (int)position.Z);
}
private void CreateTree(int x, int y, int z)
{
//TODO:
//major performance hit here...
//fix..
Random random = new Random();
int trunkLength = random.Next(5, 10);
for(int yy = y; yy < y + trunkLength; yy++)
{
mWorldRef.SetBlock(x, yy+1, z, new Block(BlockType.Log));
}
int leavesStart = y+trunkLength;
for(int xi = -3; xi <= 3; xi++)
{
for(int yi = 0; yi <= 1; yi++)
{
for(int zi = -3; zi <= 3; zi++)
{
mWorldRef.SetBlock(x + xi, leavesStart + yi, z + zi, new Block(BlockType.Leaves));
}
}
}
for(int xi = -2; xi <= 2; xi++)
{
for(int zi = -2; zi <= 2; zi++)
{
mWorldRef.SetBlock(x + xi, leavesStart + 2, z + zi, new Block(BlockType.Leaves));
}
}
mWorldRef.SetBlock(x - 1, leavesStart + 3, z, new Block(BlockType.Leaves));
mWorldRef.SetBlock(x + 1, leavesStart + 3, z, new Block(BlockType.Leaves));
mWorldRef.SetBlock(x, leavesStart + 3, z - 1, new Block(BlockType.Leaves));
mWorldRef.SetBlock(x, leavesStart + 3, z + 1, new Block(BlockType.Leaves));
}
private int GetNoiseValue(int x, int z, float scale, int max)
{
int value = (int)((Noise.Generate(x*scale, 0, z*scale)) * (max / 2f));
return value;
}
private float GetNoiseValue(int x, int y, int z, float scale, int max)
{
int value = (int)Math.Floor((Noise.Generate(x * scale, y * scale, z * scale) + 1f) * (max / 2f));
return value;
}
}
}
| Java |
"use strict"
var express = require('express');
var app = express();
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
});
var router = express.Router();
router.get('/accidents', function(req, res) {
var query = {
index: 'wildmap',
type: 'accidents',
size: 10000,
body: {
query: {
bool: {
must: [
{
match_all: {}
}
]
}
}
}
}
var animal_type = req.query.animal_type;
var day_type = req.query.day_type;
var season = req.query.season;
if(animal_type && animal_type!="all"){
query.body.query.bool.must.push({
term: {
"accidents.pin.animal_type": animal_type
}
});
}
if(day_type && day_type!="all"){
query.body.query.bool.must.push({
term: {
"accidents.pin.day_type": day_type
}
});
}
if(season && season!="all"){
query.body.query.bool.must.push({
term: {
"accidents.pin.season": season
}
});
}
console.log(query);
client.search(query).then(function (resp) {
console.log(resp.hits.hits);
var response = resp.hits.hits.map(function(e){
return e._source.pin;
})
res.send(response);
}, function (err) {
console.log(err.message);
res.status(500).end();
});
});
app.use('/api', router);
var port = process.env.PORT || 8080;
app.listen(port);
console.log("Backend is running on port " + port); | Java |
var generatetask = require('../source/ajgenesis/tasks/generate'),
createtask = require('../create'),
path = require('path'),
fs = require('fs'),
ajgenesis = require('ajgenesis');
exports['generate'] = function (test) {
test.async();
var cwd = process.cwd();
process.chdir('test');
var model = ajgenesis.loadModel();
test.ok(model.entities);
test.ok(Array.isArray(model.entities));
test.equal(model.entities.length, 4);
if (fs.existsSync('build') && !fs.existsSync(path.join('build', 'development.db')))
removeDirSync('build');
ajgenesis.createDirectory('build');
process.chdir('build');
generatetask(model, [], ajgenesis, function (err, result) {
test.equal(err, null);
test.equal(result, null);
test.ok(fs.existsSync('app.rb'));
test.ok(fs.existsSync('public'));
//test.ok(fs.existsSync(path.join('views', 'index.erb')));
test.ok(fs.existsSync('views'));
test.ok(fs.existsSync(path.join('views', 'customerlist.erb')));
test.ok(fs.existsSync(path.join('views', 'customernew.erb')));
test.ok(fs.existsSync(path.join('views', 'customerview.erb')));
test.ok(fs.existsSync(path.join('views', 'customeredit.erb')));
test.ok(fs.existsSync(path.join('views', 'supplierlist.erb')));
test.ok(fs.existsSync(path.join('views', 'suppliernew.erb')));
test.ok(fs.existsSync(path.join('views', 'supplierview.erb')));
test.ok(fs.existsSync(path.join('views', 'supplieredit.erb')));
test.ok(fs.existsSync(path.join('views', 'departmentlist.erb')));
test.ok(fs.existsSync(path.join('views', 'departmentnew.erb')));
test.ok(fs.existsSync(path.join('views', 'departmentview.erb')));
test.ok(fs.existsSync(path.join('views', 'departmentedit.erb')));
test.ok(fs.existsSync(path.join('views', 'employeelist.erb')));
test.ok(fs.existsSync(path.join('views', 'employeenew.erb')));
test.ok(fs.existsSync(path.join('views', 'employeeview.erb')));
test.ok(fs.existsSync(path.join('views', 'employeeedit.erb')));
test.ok(fs.existsSync(path.join('entities')));
test.ok(fs.existsSync(path.join('entities', 'customer.rb')));
test.ok(fs.existsSync(path.join('entities', 'supplier.rb')));
test.ok(fs.existsSync(path.join('entities', 'department.rb')));
test.ok(fs.existsSync(path.join('entities', 'employee.rb')));
test.ok(fs.existsSync('controllers'));
test.ok(fs.existsSync(path.join('controllers', 'customer.rb')));
test.ok(fs.existsSync(path.join('controllers', 'supplier.rb')));
test.ok(fs.existsSync(path.join('controllers', 'department.rb')));
test.ok(fs.existsSync(path.join('controllers', 'employee.rb')));
process.chdir(cwd);
test.done();
});
}
exports['generate in directory'] = function (test) {
test.async();
var cwd = process.cwd();
process.chdir('test');
var model = ajgenesis.loadModel();
test.ok(model.entities);
test.ok(Array.isArray(model.entities));
test.equal(model.entities.length, 4);
model.builddir = 'build';
if (fs.existsSync('build') && !fs.existsSync(path.join('build', 'development.db')))
removeDirSync('build');
generatetask(model, [], ajgenesis, function (err, result) {
test.equal(err, null);
test.equal(result, null);
test.ok(fs.existsSync(path.join('build', 'app.rb')));
test.ok(fs.existsSync(path.join('build', 'public')));
test.ok(fs.existsSync(path.join('build', 'views')));
//test.ok(fs.existsSync(path.join('views', 'index.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customerlist.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customernew.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customerview.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customeredit.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'supplierlist.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'suppliernew.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'supplierview.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'supplieredit.erb')));
test.ok(fs.existsSync(path.join('build', 'entities')));
test.ok(fs.existsSync(path.join('build', 'entities', 'customer.rb')));
test.ok(fs.existsSync(path.join('build', 'entities', 'supplier.rb')));
test.ok(fs.existsSync(path.join('build', 'entities', 'department.rb')));
test.ok(fs.existsSync(path.join('build', 'entities', 'employee.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'customer.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'supplier.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'department.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'employee.rb')));
process.chdir(cwd);
test.done();
});
}
exports['create and generate'] = function (test) {
test.async();
var cwd = process.cwd();
process.chdir('test');
var model = ajgenesis.loadModel();
test.ok(model.entities);
test.ok(Array.isArray(model.entities));
test.equal(model.entities.length, 4);
if (fs.existsSync('build') && !fs.existsSync(path.join('build', 'development.db')))
removeDirSync('build');
createtask(null, ['build'], ajgenesis, function (err, result) {
test.equal(err, null);
test.ok(fs.existsSync('build'));
model.builddir = 'build';
generatetask(model, [], ajgenesis, function (err, result) {
test.equal(err, null);
test.equal(result, null);
test.ok(fs.existsSync(path.join('build', 'app.rb')));
test.ok(fs.existsSync(path.join('build', 'public')));
test.ok(fs.existsSync(path.join('build', 'views')));
test.ok(fs.existsSync(path.join('build', 'views', 'index.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customerlist.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customernew.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customerview.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'customeredit.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'supplierlist.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'suppliernew.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'supplierview.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'supplieredit.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'departmentlist.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'departmentnew.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'departmentview.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'departmentedit.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'employeelist.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'employeenew.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'employeeview.erb')));
test.ok(fs.existsSync(path.join('build', 'views', 'employeeedit.erb')));
test.ok(fs.existsSync(path.join('build', 'entities')));
test.ok(fs.existsSync(path.join('build', 'entities', 'customer.rb')));
test.ok(fs.existsSync(path.join('build', 'entities', 'supplier.rb')));
test.ok(fs.existsSync(path.join('build', 'entities', 'department.rb')));
test.ok(fs.existsSync(path.join('build', 'entities', 'employee.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'customer.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'supplier.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'department.rb')));
test.ok(fs.existsSync(path.join('build', 'controllers', 'employee.rb')));
process.chdir(cwd);
test.done();
});
});
}
function removeDirSync(dirname) {
var filenames = fs.readdirSync(dirname);
filenames.forEach(function (filename) {
filename = path.join(dirname, filename);
if (isDirectory(filename))
removeDirSync(filename);
else
removeFileSync(filename);
});
fs.rmdirSync(dirname);
}
function removeFileSync(filename) {
fs.unlinkSync(filename);
}
function isDirectory(filename)
{
try {
var stats = fs.lstatSync(filename);
return stats.isDirectory();
}
catch (err)
{
return false;
}
}
| Java |
#include <math.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#define THREAD_COUNT 4
typedef struct {
int start;
int end;
} range_t;
void *calculate_range(void* range) {
range_t* curr_range = (range_t*)range;
void* result = (void*)1;
for (int i = curr_range->start; i < curr_range->end; i++) {
double a = cos(i) * cos(i) + sin(i) * sin(i);
if (a > 1.0005 || a < 0.9995) {
result = (void*)0;
}
}
free(curr_range);
return result;
}
int main() {
pthread_t threads[THREAD_COUNT];
int arg_start = 0;
for (int i = 0; i < THREAD_COUNT; i++) {
range_t *curr_range = (range_t*)malloc(sizeof(range_t));
curr_range->start = arg_start;
curr_range->end = arg_start + 25000000;
int res = pthread_create(&threads[i], NULL, calculate_range, curr_range);
if (res != 0) {
perror("Could not spawn new thread");
exit(-1);
}
arg_start = curr_range->end;
}
long final_result = 1;
for (int i = 0; i < THREAD_COUNT; i++) {
void *thread_result;
int res = pthread_join(threads[i], (void **)&thread_result);
if (res != 0) {
perror("Could not spawn thread");
exit(-1);
}
final_result <<= (long)thread_result;
}
if (final_result & (1 << 4)) {
printf("OK!\n");
} else {
printf("Not OK!\n");
}
return 0;
}
| Java |
package com.virtualfactory.screen.layer.components;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.NiftyEventSubscriber;
import de.lessvoid.nifty.controls.ButtonClickedEvent;
import de.lessvoid.nifty.controls.Controller;
import de.lessvoid.nifty.controls.window.WindowControl;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.elements.render.ImageRenderer;
import de.lessvoid.nifty.input.NiftyInputEvent;
import de.lessvoid.nifty.render.NiftyImage;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.tools.SizeValue;
import de.lessvoid.xml.xpp3.Attributes;
import com.virtualfactory.engine.GameEngine;
import com.virtualfactory.utils.CommonBuilders;
import com.virtualfactory.utils.Pair;
import java.util.Properties;
/**
*
* @author David
*/
public class FlowChartScreenController implements Controller {
private Nifty nifty;
private Screen screen;
private WindowControl winControls;
private boolean isVisible;
private GameEngine gameEngine;
final CommonBuilders common = new CommonBuilders();
private NiftyImage flowChartImage;
@Override
public void bind(
final Nifty nifty,
final Screen screen,
final Element element,
final Properties parameter,
final Attributes controlDefinitionAttributes) {
this.nifty = nifty;
this.screen = screen;
this.winControls = screen.findNiftyControl("winFlowChartControl", WindowControl.class);
Attributes x = new Attributes();
x.set("hideOnClose", "true");
this.winControls.bind(nifty, screen, winControls.getElement(), null, x);
isVisible = false;
}
public boolean isIsVisible() {
return isVisible;
}
public void setIsVisible(boolean isVisible) {
this.isVisible = isVisible;
}
@Override
public void init(Properties parameter, Attributes controlDefinitionAttributes) {
}
@Override
public void onStartScreen() {
}
@Override
public void onFocus(boolean getFocus) {
}
@Override
public boolean inputEvent(final NiftyInputEvent inputEvent) {
return false;
}
public void loadWindowControl(GameEngine game,int index, Pair<Integer,Integer> position){
this.gameEngine = game;
if (index == -1){
winControls.getElement().setVisible(false);
winControls.getContent().hide();
isVisible = false;
}else{
winControls.getElement().setVisible(true);
winControls.getContent().show();
isVisible = true;
if (position != null){
if (winControls.getWidth() + position.getFirst() > gameEngine.jmonkeyApp.getGuiViewPort().getCamera().getWidth())
position.setFirst(gameEngine.jmonkeyApp.getGuiViewPort().getCamera().getWidth() - winControls.getWidth());
if (winControls.getHeight() + position.getSecond() > gameEngine.jmonkeyApp.getGuiViewPort().getCamera().getHeight())
position.setSecond(gameEngine.jmonkeyApp.getGuiViewPort().getCamera().getHeight() - winControls.getHeight());
winControls.getElement().setConstraintX(new SizeValue(position.getFirst() + "px"));
winControls.getElement().setConstraintY(new SizeValue(position.getSecond() + "px"));
winControls.getElement().getParent().layoutElements();
}
winControls.getElement().setConstraintX(null);
winControls.getElement().setConstraintY(null);
}
loadValues(index);
}
private void loadValues(int index){
if (index == -1){
flowChartImage = nifty.createImage("Models/Flows/none.png", false);
screen.findElementByName("imageFlowOfActivities").getRenderer(ImageRenderer.class).setImage(flowChartImage);
}else{
flowChartImage = nifty.createImage("Models/Flows/" + gameEngine.getGameData().getCurrentGame().getFlowImage(), false);
screen.findElementByName("imageFlowOfActivities").getRenderer(ImageRenderer.class).setImage(flowChartImage);
}
}
@NiftyEventSubscriber(id="closeFlowChart")
public void onCloseFlowChartButtonClicked(final String id, final ButtonClickedEvent event) {
gameEngine.updateLastActivitySystemTime();
loadWindowControl(gameEngine, -1, null);
}
}
| Java |
const S$ = require('S$');
function loadSrc(obj, src) {
throw src;
}
const cookies = S$.symbol('Cookie', '');
const world = {};
if (cookies) {
if (/iPhone/.exec(cookies)) {
loadSrc(world, '/resources/' + cookies);
}
loadSrc(world, '/resources/unknown');
} else {
loadSrc(world, '/resources/fresh');
}
| Java |
---
layout: post
title: "Problem 2_0"
modified:
categories: /AcceleratedC++/ch2
excerpt:
tags: []
image:
feature:
date: 2015-09-25T00:37:18-07:00
---
[Github Source](https://github.com/patricknyu/AcceleratedCPlusPlus/tree/master/ch2/Question2_0)
###Q:
Compile and run the program presented in this chapter.
###A:
```c++
#include <iostream>
#include <string>
// say what standard-library names we use
using std::cin;
using std::endl;
using std::cout;
using std::string;
int main()
{
// ask for the person's name
cout << "Please enter your first name: ";
// read the name
string name;
cin >> name;
// build the message that we intend to write
const string greeting = "Hello, " + name + "!";
// the number of blanks surrounding the greeting const
int pad = 1;
// the number of rows and columns to write
const int rows = pad * 2 + 3;
const string::size_type cols = greeting.size() + pad * 2 + 2;
// write a blank line to separate the output from the input
cout << endl;
// write rows rows of output
// invariant: we have written r rows so far
for (int r = 0; r != rows; ++r)
{
string::size_type c = 0;
// invariant: we have written c characters so far in the current row
while (c != cols)
{
// is it time to write the greeting?
if (r == pad + 1 && c == pad + 1)
{
cout << greeting;
c += greeting.size();
}
else
{
// are we on the border?
if (r == 0 || r == rows - 1 ||c == 0 || c == cols - 1)
cout << "*"; else
cout << " "; ++c;
}
}
cout << endl;
}
return 0;
}
``` | Java |
module.exports = function (seneca, util) {
//var Joi = util.Joi
}
| Java |
package Digivolver;
public class Digivolution{
private Digimon digimon;
private int minDp = 0;
private int maxDp = 0;
public boolean isWithinDp(int minDp, int maxDp){
return this.minDp<=maxDp && this.maxDp>=minDp;
}
public Digivolution(Digimon digimon, int minDp, int maxDp) {
this.digimon = digimon;
this.minDp = minDp;
this.maxDp = maxDp;
}
public Digimon getDigimon() {
return digimon;
}
public void setDigimon(Digimon digimon) {
this.digimon = digimon;
}
public int getMinDp(){
return minDp;
}
public int getMaxDp(){
return maxDp;
}
}
| Java |
import re
import hashlib
FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string
PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data://
def getParentAndBase(path):
match = PREFIX.match(path)
if match is None:
if path.endswith('/'):
stripped_path = path[:-1]
else:
stripped_path = path
base = FNAME_MATCH.search(stripped_path)
if base is None:
raise ValueError('Invalid path')
parent = FNAME_MATCH.sub('', stripped_path)
return parent, base.group(1)
else:
prefix, leading_slash, uri = match.groups()
parts = uri.split('/')
parent_path = '/'.join(parts[:-1])
if leading_slash is not None:
parent_path = '{prefix}/{uri}'.format(prefix=prefix, uri='/'.join(parts[:-1]))
else:
parent_path = '{prefix}{uri}'.format(prefix=prefix, uri='/'.join(parts[:-1]))
return parent_path, parts[-1]
def pathJoin(parent, base):
if parent.endswith('/'):
return parent + base
return parent + '/' + base
def md5_for_file(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return str(hash_md5.hexdigest())
def md5_for_str(content):
hash_md5 = hashlib.md5()
hash_md5.update(content.encode())
return str(hash_md5.hexdigest())
| Java |
#ifndef VECTOR4_H
#define VECTOR4_H
#include "gamemath_internal.h"
GAMEMATH_NAMESPACE_BEGIN
GAMEMATH_ALIGNEDTYPE_PRE class GAMEMATH_ALIGNEDTYPE_MID Vector4 : public AlignedAllocation
{
friend class Matrix4;
friend GAMEMATH_INLINE Vector4 operator +(const Vector4 &a, const Vector4 &b);
friend GAMEMATH_INLINE Vector4 operator -(const Vector4 &a, const Vector4 &b);
friend GAMEMATH_INLINE Vector4 operator *(const float, const Vector4 &vector);
friend GAMEMATH_INLINE Vector4 operator *(const Vector4 &vector, const float);
friend class Ray3d;
friend class Box3d;
public:
Vector4();
Vector4(const float x, const float y, const float z, const float w);
#if !defined(GAMEMATH_NO_INTRINSICS)
Vector4(const __m128 value);
#endif
/**
* Returns the x component of this vector.
*/
float x() const;
/**
* Returns the y component of this vector.
*/
float y() const;
/**
* Returns the z component of this vector.
*/
float z() const;
/**
* Returns the w component of this vector. Usually 1 means this is a position vector, while 0
* means this is a directional vector.
*/
float w() const;
/**
* Changes the X component of this vector.
*/
void setX(float x);
/**
* Changes the Y component of this vector.
*/
void setY(float y);
/**
* Changes the Z component of this vector.
*/
void setZ(float z);
/**
* Changes the W component of this vector.
*/
void setW(float w);
/**
* Computes the squared length of this vector. This method is significantly
* faster than computing the normal length, since the square root can be omitted.
*/
float lengthSquared() const;
/**
* Computes this vector's length.
*/
float length() const;
/**
* Normalizes this vector by dividing its components by this vectors length.
*/
Vector4 &normalize();
/**
* Normalizes using a reciprocal square root, which only has 11-bit precision. Use this if the
* result doesn't need to be very precisely normalized.
*/
Vector4 &normalizeEstimated();
/**
* Normalizes this vector and returns it in a new object, while leaving this object untouched.
*/
Vector4 normalized() const;
/**
* Computes the dot product between this and another vector.
*/
float dot(const Vector4 &vector) const;
/**
Returns the absolute of this vector.
*/
Vector4 absolute() const;
/**
Returns true if one of the components of this vector are negative or positive infinity.
*/
bool isInfinite() const;
/**
* Computes the three-dimensional cross product of two vectors, interpreting both vectors as directional vectors
* (w=0). If either vector's w is not zero, the result may be wrong.
*
* @return this x vector
*/
Vector4 cross(const Vector4 &vector) const;
/**
* Adds another vector to this vector.
*/
Vector4 &operator +=(const Vector4 &vector);
/**
* Multiplies this vector with a scalar factor.
* Only the x,y, and z components of the vector are multiplied.
*/
Vector4 &operator *=(const float factor);
/**
* Subtracts another vector from this vector.
*/
Vector4 &operator -=(const Vector4 &vector);
/**
* Returns a negated version of this vector, negating only the x, y, and z components.
*/
Vector4 operator -() const;
#if !defined(GAMEMATH_NO_INTRINSICS)
operator __m128() const;
#endif
/**
Checks two vectors for equality.
*/
bool operator ==(const Vector4 &other) const;
const float *data() const;
float *data();
private:
#if !defined(GAMEMATH_NO_INTRINSICS)
union {
struct {
float mX;
float mY;
float mZ;
float mW;
};
__m128 mSse;
};
#else
float mX;
float mY;
float mZ;
float mW;
#endif // GAMEMATH_NO_INTRINSICS
} GAMEMATH_ALIGNEDTYPE_POST;
GAMEMATH_INLINE float Vector4::x() const
{
return mX;
}
GAMEMATH_INLINE float Vector4::y() const
{
return mY;
}
GAMEMATH_INLINE float Vector4::z() const
{
return mZ;
}
GAMEMATH_INLINE float Vector4::w() const
{
return mW;
}
GAMEMATH_INLINE void Vector4::setX(float x)
{
mX = x;
}
GAMEMATH_INLINE void Vector4::setY(float y)
{
mY = y;
}
GAMEMATH_INLINE void Vector4::setZ(float z)
{
mZ = z;
}
GAMEMATH_INLINE void Vector4::setW(float w)
{
mW = w;
}
GAMEMATH_INLINE const float *Vector4::data() const
{
return &mX;
}
GAMEMATH_INLINE float *Vector4::data()
{
return &mX;
}
GAMEMATH_NAMESPACE_END
#if !defined(GAMEMATH_NO_INTRINSICS)
#include "vector4_sse.h"
#else
#include "vector4_sisd.h"
#endif // GAMEMATH_NO_INTRINSICS
#endif // VECTOR4_H
| Java |
/**
* @file query.cc
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2017-2021 TileDB, Inc.
*
* 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.
*
* @section DESCRIPTION
*
* This file implements class Query.
*/
#include "tiledb/sm/query/query.h"
#include "tiledb/common/heap_memory.h"
#include "tiledb/common/logger.h"
#include "tiledb/common/memory.h"
#include "tiledb/sm/array/array.h"
#include "tiledb/sm/enums/query_status.h"
#include "tiledb/sm/enums/query_type.h"
#include "tiledb/sm/fragment/fragment_metadata.h"
#include "tiledb/sm/misc/parse_argument.h"
#include "tiledb/sm/query/dense_reader.h"
#include "tiledb/sm/query/global_order_writer.h"
#include "tiledb/sm/query/ordered_writer.h"
#include "tiledb/sm/query/query_condition.h"
#include "tiledb/sm/query/reader.h"
#include "tiledb/sm/query/sparse_global_order_reader.h"
#include "tiledb/sm/query/sparse_unordered_with_dups_reader.h"
#include "tiledb/sm/query/unordered_writer.h"
#include "tiledb/sm/rest/rest_client.h"
#include "tiledb/sm/storage_manager/storage_manager.h"
#include "tiledb/sm/tile/writer_tile.h"
#include <cassert>
#include <iostream>
#include <sstream>
using namespace tiledb::common;
using namespace tiledb::sm::stats;
namespace tiledb {
namespace sm {
/* ****************************** */
/* CONSTRUCTORS & DESTRUCTORS */
/* ****************************** */
Query::Query(StorageManager* storage_manager, Array* array, URI fragment_uri)
: array_(array)
, array_schema_(array->array_schema_latest_ptr())
, layout_(Layout::ROW_MAJOR)
, storage_manager_(storage_manager)
, stats_(storage_manager_->stats()->create_child("Query"))
, logger_(storage_manager->logger()->clone("Query", ++logger_id_))
, has_coords_buffer_(false)
, has_zipped_coords_buffer_(false)
, coord_buffer_is_set_(false)
, coord_data_buffer_is_set_(false)
, coord_offsets_buffer_is_set_(false)
, data_buffer_name_("")
, offsets_buffer_name_("")
, disable_check_global_order_(false)
, fragment_uri_(fragment_uri) {
assert(array->is_open());
auto st = array->get_query_type(&type_);
assert(st.ok());
if (type_ == QueryType::WRITE) {
subarray_ = Subarray(array, stats_, logger_);
} else {
subarray_ = Subarray(array, Layout::ROW_MAJOR, stats_, logger_);
}
fragment_metadata_ = array->fragment_metadata();
coords_info_.coords_buffer_ = nullptr;
coords_info_.coords_buffer_size_ = nullptr;
coords_info_.coords_num_ = 0;
coords_info_.has_coords_ = false;
callback_ = nullptr;
callback_data_ = nullptr;
status_ = QueryStatus::UNINITIALIZED;
if (storage_manager != nullptr)
config_ = storage_manager->config();
// Set initial subarray configuration
subarray_.set_config(config_);
rest_scratch_ = make_shared<Buffer>(HERE());
}
Query::~Query() {
bool found = false;
bool use_malloc_trim = false;
const Status& st =
config_.get<bool>("sm.mem.malloc_trim", &use_malloc_trim, &found);
if (st.ok() && found && use_malloc_trim) {
tdb_malloc_trim();
}
};
/* ****************************** */
/* API */
/* ****************************** */
Status Query::add_range(
unsigned dim_idx, const void* start, const void* end, const void* stride) {
if (dim_idx >= array_schema_->dim_num())
return logger_->status(
Status_QueryError("Cannot add range; Invalid dimension index"));
if (start == nullptr || end == nullptr)
return logger_->status(
Status_QueryError("Cannot add range; Invalid range"));
if (stride != nullptr)
return logger_->status(Status_QueryError(
"Cannot add range; Setting range stride is currently unsupported"));
if (array_schema_->domain()->dimension(dim_idx)->var_size())
return logger_->status(
Status_QueryError("Cannot add range; Range must be fixed-sized"));
// Prepare a temp range
std::vector<uint8_t> range;
auto coord_size = array_schema_->dimension(dim_idx)->coord_size();
range.resize(2 * coord_size);
std::memcpy(&range[0], start, coord_size);
std::memcpy(&range[coord_size], end, coord_size);
bool read_range_oob_error = true;
if (type_ == QueryType::READ) {
// Get read_range_oob config setting
bool found = false;
std::string read_range_oob = config_.get("sm.read_range_oob", &found);
assert(found);
if (read_range_oob != "error" && read_range_oob != "warn")
return logger_->status(Status_QueryError(
"Invalid value " + read_range_oob +
" for sm.read_range_obb. Acceptable values are 'error' or 'warn'."));
read_range_oob_error = read_range_oob == "error";
} else {
if (!array_schema_->dense())
return logger_->status(
Status_QueryError("Adding a subarray range to a write query is not "
"supported in sparse arrays"));
if (subarray_.is_set(dim_idx))
return logger_->status(
Status_QueryError("Cannot add range; Multi-range dense writes "
"are not supported"));
}
// Add range
Range r(&range[0], 2 * coord_size);
return subarray_.add_range(dim_idx, std::move(r), read_range_oob_error);
}
Status Query::add_range_var(
unsigned dim_idx,
const void* start,
uint64_t start_size,
const void* end,
uint64_t end_size) {
if (dim_idx >= array_schema_->dim_num())
return logger_->status(
Status_QueryError("Cannot add range; Invalid dimension index"));
if ((start == nullptr && start_size != 0) ||
(end == nullptr && end_size != 0))
return logger_->status(
Status_QueryError("Cannot add range; Invalid range"));
if (!array_schema_->domain()->dimension(dim_idx)->var_size())
return logger_->status(
Status_QueryError("Cannot add range; Range must be variable-sized"));
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot add range; Function applicable only to reads"));
// Get read_range_oob config setting
bool found = false;
std::string read_range_oob = config_.get("sm.read_range_oob", &found);
assert(found);
if (read_range_oob != "error" && read_range_oob != "warn")
return logger_->status(Status_QueryError(
"Invalid value " + read_range_oob +
" for sm.read_range_obb. Acceptable values are 'error' or 'warn'."));
// Add range
Range r;
r.set_range_var(start, start_size, end, end_size);
return subarray_.add_range(dim_idx, std::move(r), read_range_oob == "error");
}
Status Query::get_range_num(unsigned dim_idx, uint64_t* range_num) const {
if (type_ == QueryType::WRITE && !array_schema_->dense())
return logger_->status(
Status_QueryError("Getting the number of ranges from a write query "
"is not applicable to sparse arrays"));
return subarray_.get_range_num(dim_idx, range_num);
}
Status Query::get_range(
unsigned dim_idx,
uint64_t range_idx,
const void** start,
const void** end,
const void** stride) const {
if (type_ == QueryType::WRITE && !array_schema_->dense())
return logger_->status(
Status_QueryError("Getting a range from a write query is not "
"applicable to sparse arrays"));
*stride = nullptr;
return subarray_.get_range(dim_idx, range_idx, start, end);
}
Status Query::get_range_var_size(
unsigned dim_idx,
uint64_t range_idx,
uint64_t* start_size,
uint64_t* end_size) const {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Getting a var range size from a write query is not applicable"));
return subarray_.get_range_var_size(dim_idx, range_idx, start_size, end_size);
;
}
Status Query::get_range_var(
unsigned dim_idx, uint64_t range_idx, void* start, void* end) const {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Getting a var range from a write query is not applicable"));
uint64_t start_size = 0;
uint64_t end_size = 0;
subarray_.get_range_var_size(dim_idx, range_idx, &start_size, &end_size);
const void* range_start;
const void* range_end;
const void* stride;
RETURN_NOT_OK(
get_range(dim_idx, range_idx, &range_start, &range_end, &stride));
std::memcpy(start, range_start, start_size);
std::memcpy(end, range_end, end_size);
return Status::Ok();
}
Status Query::add_range_by_name(
const std::string& dim_name,
const void* start,
const void* end,
const void* stride) {
unsigned dim_idx;
RETURN_NOT_OK(
array_schema_->domain()->get_dimension_index(dim_name, &dim_idx));
return add_range(dim_idx, start, end, stride);
}
Status Query::add_range_var_by_name(
const std::string& dim_name,
const void* start,
uint64_t start_size,
const void* end,
uint64_t end_size) {
unsigned dim_idx;
RETURN_NOT_OK(
array_schema_->domain()->get_dimension_index(dim_name, &dim_idx));
return add_range_var(dim_idx, start, start_size, end, end_size);
}
Status Query::get_range_num_from_name(
const std::string& dim_name, uint64_t* range_num) const {
unsigned dim_idx;
RETURN_NOT_OK(
array_schema_->domain()->get_dimension_index(dim_name, &dim_idx));
return get_range_num(dim_idx, range_num);
}
Status Query::get_range_from_name(
const std::string& dim_name,
uint64_t range_idx,
const void** start,
const void** end,
const void** stride) const {
unsigned dim_idx;
RETURN_NOT_OK(
array_schema_->domain()->get_dimension_index(dim_name, &dim_idx));
return get_range(dim_idx, range_idx, start, end, stride);
}
Status Query::get_range_var_size_from_name(
const std::string& dim_name,
uint64_t range_idx,
uint64_t* start_size,
uint64_t* end_size) const {
unsigned dim_idx;
RETURN_NOT_OK(
array_schema_->domain()->get_dimension_index(dim_name, &dim_idx));
return get_range_var_size(dim_idx, range_idx, start_size, end_size);
}
Status Query::get_range_var_from_name(
const std::string& dim_name,
uint64_t range_idx,
void* start,
void* end) const {
unsigned dim_idx;
RETURN_NOT_OK(
array_schema_->domain()->get_dimension_index(dim_name, &dim_idx));
return get_range_var(dim_idx, range_idx, start, end);
}
Status Query::get_est_result_size(const char* name, uint64_t* size) {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Operation currently "
"unsupported for write queries"));
if (name == nullptr)
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Name cannot be null"));
if (name == constants::coords &&
!array_schema_->domain()->all_dims_same_type())
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Not applicable to zipped "
"coordinates in arrays with heterogeneous domain"));
if (name == constants::coords && !array_schema_->domain()->all_dims_fixed())
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Not applicable to zipped "
"coordinates in arrays with domains with variable-sized dimensions"));
if (array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string(
"Cannot get estimated result size; Input attribute/dimension '") +
name + "' is nullable"));
if (array_->is_remote() && !subarray_.est_result_size_computed()) {
auto rest_client = storage_manager_->rest_client();
if (rest_client == nullptr)
return logger_->status(
Status_QueryError("Error in query estimate result size; remote "
"array with no rest client."));
RETURN_NOT_OK(
rest_client->get_query_est_result_sizes(array_->array_uri(), this));
}
return subarray_.get_est_result_size_internal(
name, size, &config_, storage_manager_->compute_tp());
}
Status Query::get_est_result_size(
const char* name, uint64_t* size_off, uint64_t* size_val) {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Operation currently "
"unsupported for write queries"));
if (array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string(
"Cannot get estimated result size; Input attribute/dimension '") +
name + "' is nullable"));
if (array_->is_remote() && !subarray_.est_result_size_computed()) {
auto rest_client = storage_manager_->rest_client();
if (rest_client == nullptr)
return logger_->status(
Status_QueryError("Error in query estimate result size; remote "
"array with no rest client."));
RETURN_NOT_OK(
rest_client->get_query_est_result_sizes(array_->array_uri(), this));
}
return subarray_.get_est_result_size(
name, size_off, size_val, &config_, storage_manager_->compute_tp());
}
Status Query::get_est_result_size_nullable(
const char* name, uint64_t* size_val, uint64_t* size_validity) {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Operation currently "
"unsupported for write queries"));
if (name == nullptr)
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Name cannot be null"));
if (!array_schema_->attribute(name))
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Nullable API is only"
"applicable to attributes"));
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot get estimated result size; Input attribute '") +
name + "' is not nullable"));
if (array_->is_remote() && !subarray_.est_result_size_computed()) {
auto rest_client = storage_manager_->rest_client();
if (rest_client == nullptr)
return logger_->status(
Status_QueryError("Error in query estimate result size; remote "
"array with no rest client."));
return logger_->status(
Status_QueryError("Error in query estimate result size; unimplemented "
"for nullable attributes in remote arrays."));
}
return subarray_.get_est_result_size_nullable(
name, size_val, size_validity, &config_, storage_manager_->compute_tp());
}
Status Query::get_est_result_size_nullable(
const char* name,
uint64_t* size_off,
uint64_t* size_val,
uint64_t* size_validity) {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Operation currently "
"unsupported for write queries"));
if (!array_schema_->attribute(name))
return logger_->status(Status_QueryError(
"Cannot get estimated result size; Nullable API is only"
"applicable to attributes"));
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot get estimated result size; Input attribute '") +
name + "' is not nullable"));
if (array_->is_remote() && !subarray_.est_result_size_computed()) {
auto rest_client = storage_manager_->rest_client();
if (rest_client == nullptr)
return logger_->status(
Status_QueryError("Error in query estimate result size; remote "
"array with no rest client."));
return logger_->status(
Status_QueryError("Error in query estimate result size; unimplemented "
"for nullable attributes in remote arrays."));
}
return subarray_.get_est_result_size_nullable(
name,
size_off,
size_val,
size_validity,
&config_,
storage_manager_->compute_tp());
}
std::unordered_map<std::string, Subarray::ResultSize>
Query::get_est_result_size_map() {
return subarray_.get_est_result_size_map(
&config_, storage_manager_->compute_tp());
}
std::unordered_map<std::string, Subarray::MemorySize>
Query::get_max_mem_size_map() {
return subarray_.get_max_mem_size_map(
&config_, storage_manager_->compute_tp());
}
Status Query::get_written_fragment_num(uint32_t* num) const {
if (type_ != QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get number of fragments; Applicable only to WRITE mode"));
*num = (uint32_t)written_fragment_info_.size();
return Status::Ok();
}
Status Query::get_written_fragment_uri(uint32_t idx, const char** uri) const {
if (type_ != QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get fragment URI; Applicable only to WRITE mode"));
auto num = (uint32_t)written_fragment_info_.size();
if (idx >= num)
return logger_->status(
Status_QueryError("Cannot get fragment URI; Invalid fragment index"));
*uri = written_fragment_info_[idx].uri_.c_str();
return Status::Ok();
}
Status Query::get_written_fragment_timestamp_range(
uint32_t idx, uint64_t* t1, uint64_t* t2) const {
if (type_ != QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot get fragment timestamp range; Applicable only to WRITE mode"));
auto num = (uint32_t)written_fragment_info_.size();
if (idx >= num)
return logger_->status(Status_QueryError(
"Cannot get fragment timestamp range; Invalid fragment index"));
*t1 = written_fragment_info_[idx].timestamp_range_.first;
*t2 = written_fragment_info_[idx].timestamp_range_.second;
return Status::Ok();
}
const Array* Query::array() const {
return array_;
}
Array* Query::array() {
return array_;
}
const ArraySchema& Query::array_schema() const {
return *(array_schema_.get());
}
std::vector<std::string> Query::buffer_names() const {
std::vector<std::string> ret;
// Add to the buffer names the attributes, as well as the dimensions only if
// coords_buffer_ has not been set
for (const auto& it : buffers_) {
if (!array_schema_->is_dim(it.first) || (!coords_info_.coords_buffer_))
ret.push_back(it.first);
}
// Special zipped coordinates name
if (coords_info_.coords_buffer_)
ret.push_back(constants::coords);
return ret;
}
QueryBuffer Query::buffer(const std::string& name) const {
// Special zipped coordinates
if (type_ == QueryType::WRITE && name == constants::coords)
return QueryBuffer(
coords_info_.coords_buffer_,
nullptr,
coords_info_.coords_buffer_size_,
nullptr);
// Attribute or dimension
auto buf = buffers_.find(name);
if (buf != buffers_.end())
return buf->second;
// Named buffer does not exist
return QueryBuffer{};
}
Status Query::finalize() {
if (status_ == QueryStatus::UNINITIALIZED)
return Status::Ok();
if (array_->is_remote()) {
auto rest_client = storage_manager_->rest_client();
if (rest_client == nullptr)
return logger_->status(Status_QueryError(
"Error in query finalize; remote array with no rest client."));
return rest_client->finalize_query_to_rest(array_->array_uri(), this);
}
RETURN_NOT_OK(strategy_->finalize());
status_ = QueryStatus::COMPLETED;
return Status::Ok();
}
Status Query::get_buffer(
const char* name, void** buffer, uint64_t** buffer_size) const {
// Check attribute
if (name != constants::coords) {
if (array_schema_->attribute(name) == nullptr &&
array_schema_->dimension(name) == nullptr)
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; Invalid attribute/dimension name '") +
name + "'"));
}
if (array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is var-sized"));
return get_data_buffer(name, buffer, buffer_size);
}
Status Query::get_buffer(
const char* name,
uint64_t** buffer_off,
uint64_t** buffer_off_size,
void** buffer_val,
uint64_t** buffer_val_size) const {
// Check attribute
if (name == constants::coords) {
return logger_->status(
Status_QueryError("Cannot get buffer; Coordinates are not var-sized"));
}
if (array_schema_->attribute(name) == nullptr &&
array_schema_->dimension(name) == nullptr)
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; Invalid attribute/dimension name '") +
name + "'"));
if (!array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is fixed-sized"));
// Attribute or dimension
auto it = buffers_.find(name);
if (it != buffers_.end()) {
*buffer_off = (uint64_t*)it->second.buffer_;
*buffer_off_size = it->second.buffer_size_;
*buffer_val = it->second.buffer_var_;
*buffer_val_size = it->second.buffer_var_size_;
return Status::Ok();
}
// Named buffer does not exist
*buffer_off = nullptr;
*buffer_off_size = nullptr;
*buffer_val = nullptr;
*buffer_val_size = nullptr;
return Status::Ok();
}
Status Query::get_offsets_buffer(
const char* name, uint64_t** buffer_off, uint64_t** buffer_off_size) const {
// Check attribute
if (name == constants::coords) {
return logger_->status(
Status_QueryError("Cannot get buffer; Coordinates are not var-sized"));
}
if (array_schema_->attribute(name) == nullptr &&
array_schema_->dimension(name) == nullptr)
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; Invalid attribute/dimension name '") +
name + "'"));
if (!array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is fixed-sized"));
// Attribute or dimension
auto it = buffers_.find(name);
if (it != buffers_.end()) {
*buffer_off = (uint64_t*)it->second.buffer_;
*buffer_off_size = it->second.buffer_size_;
return Status::Ok();
}
// Named buffer does not exist
*buffer_off = nullptr;
*buffer_off_size = nullptr;
return Status::Ok();
}
Status Query::get_data_buffer(
const char* name, void** buffer, uint64_t** buffer_size) const {
// Check attribute
if (name != constants::coords) {
if (array_schema_->attribute(name) == nullptr &&
array_schema_->dimension(name) == nullptr)
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; Invalid attribute/dimension name '") +
name + "'"));
}
// Special zipped coordinates
if (type_ == QueryType::WRITE && name == constants::coords) {
*buffer = coords_info_.coords_buffer_;
*buffer_size = coords_info_.coords_buffer_size_;
return Status::Ok();
}
// Attribute or dimension
auto it = buffers_.find(name);
if (it != buffers_.end()) {
if (!array_schema_->var_size(name)) {
*buffer = it->second.buffer_;
*buffer_size = it->second.buffer_size_;
} else {
*buffer = it->second.buffer_var_;
*buffer_size = it->second.buffer_var_size_;
}
return Status::Ok();
}
// Named buffer does not exist
*buffer = nullptr;
*buffer_size = nullptr;
return Status::Ok();
}
Status Query::get_validity_buffer(
const char* name,
uint8_t** buffer_validity_bytemap,
uint64_t** buffer_validity_bytemap_size) const {
// Check attribute
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is non-nullable"));
// Attribute or dimension
auto it = buffers_.find(name);
if (it != buffers_.end()) {
auto vv = &it->second.validity_vector_;
*buffer_validity_bytemap = vv->bytemap();
*buffer_validity_bytemap_size = vv->bytemap_size();
}
return Status::Ok();
}
Status Query::get_buffer_vbytemap(
const char* name,
uint64_t** buffer_off,
uint64_t** buffer_off_size,
void** buffer_val,
uint64_t** buffer_val_size,
uint8_t** buffer_validity_bytemap,
uint64_t** buffer_validity_bytemap_size) const {
const ValidityVector* vv = nullptr;
RETURN_NOT_OK(get_buffer(
name, buffer_off, buffer_off_size, buffer_val, buffer_val_size, &vv));
if (vv != nullptr) {
*buffer_validity_bytemap = vv->bytemap();
*buffer_validity_bytemap_size = vv->bytemap_size();
}
return Status::Ok();
}
Status Query::get_buffer_vbytemap(
const char* name,
void** buffer,
uint64_t** buffer_size,
uint8_t** buffer_validity_bytemap,
uint64_t** buffer_validity_bytemap_size) const {
const ValidityVector* vv = nullptr;
RETURN_NOT_OK(get_buffer(name, buffer, buffer_size, &vv));
if (vv != nullptr) {
*buffer_validity_bytemap = vv->bytemap();
*buffer_validity_bytemap_size = vv->bytemap_size();
}
return Status::Ok();
}
Status Query::get_buffer(
const char* name,
void** buffer,
uint64_t** buffer_size,
const ValidityVector** validity_vector) const {
// Check nullable attribute
if (array_schema_->attribute(name) == nullptr)
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; Invalid attribute name '") + name +
"'"));
if (array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is var-sized"));
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is non-nullable"));
// Attribute or dimension
auto it = buffers_.find(name);
if (it != buffers_.end()) {
*buffer = it->second.buffer_;
*buffer_size = it->second.buffer_size_;
*validity_vector = &it->second.validity_vector_;
return Status::Ok();
}
// Named buffer does not exist
*buffer = nullptr;
*buffer_size = nullptr;
*validity_vector = nullptr;
return Status::Ok();
}
Status Query::get_buffer(
const char* name,
uint64_t** buffer_off,
uint64_t** buffer_off_size,
void** buffer_val,
uint64_t** buffer_val_size,
const ValidityVector** validity_vector) const {
// Check attribute
if (array_schema_->attribute(name) == nullptr)
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; Invalid attribute name '") + name +
"'"));
if (!array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is fixed-sized"));
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot get buffer; '") + name + "' is non-nullable"));
// Attribute or dimension
auto it = buffers_.find(name);
if (it != buffers_.end()) {
*buffer_off = (uint64_t*)it->second.buffer_;
*buffer_off_size = it->second.buffer_size_;
*buffer_val = it->second.buffer_var_;
*buffer_val_size = it->second.buffer_var_size_;
*validity_vector = &it->second.validity_vector_;
return Status::Ok();
}
// Named buffer does not exist
*buffer_off = nullptr;
*buffer_off_size = nullptr;
*buffer_val = nullptr;
*buffer_val_size = nullptr;
*validity_vector = nullptr;
return Status::Ok();
}
Status Query::get_attr_serialization_state(
const std::string& attribute, SerializationState::AttrState** state) {
*state = &serialization_state_.attribute_states[attribute];
return Status::Ok();
}
bool Query::has_results() const {
if (status_ == QueryStatus::UNINITIALIZED || type_ == QueryType::WRITE)
return false;
for (const auto& it : buffers_) {
if (*(it.second.buffer_size_) != 0)
return true;
}
return false;
}
Status Query::init() {
// Only if the query has not been initialized before
if (status_ == QueryStatus::UNINITIALIZED) {
// Check if the array got closed
if (array_ == nullptr || !array_->is_open())
return logger_->status(Status_QueryError(
"Cannot init query; The associated array is not open"));
// Check if the array got re-opened with a different query type
QueryType array_query_type;
RETURN_NOT_OK(array_->get_query_type(&array_query_type));
if (array_query_type != type_) {
std::stringstream errmsg;
errmsg << "Cannot init query; "
<< "Associated array query type does not match query type: "
<< "(" << query_type_str(array_query_type)
<< " != " << query_type_str(type_) << ")";
return logger_->status(Status_QueryError(errmsg.str()));
}
RETURN_NOT_OK(check_buffer_names());
RETURN_NOT_OK(create_strategy());
RETURN_NOT_OK(strategy_->init());
}
status_ = QueryStatus::INPROGRESS;
return Status::Ok();
}
URI Query::first_fragment_uri() const {
if (type_ == QueryType::WRITE || fragment_metadata_.empty())
return URI();
return fragment_metadata_.front()->fragment_uri();
}
URI Query::last_fragment_uri() const {
if (type_ == QueryType::WRITE || fragment_metadata_.empty())
return URI();
return fragment_metadata_.back()->fragment_uri();
}
Layout Query::layout() const {
return layout_;
}
const QueryCondition* Query::condition() const {
if (type_ == QueryType::WRITE)
return nullptr;
return &condition_;
}
Status Query::cancel() {
status_ = QueryStatus::FAILED;
return Status::Ok();
}
Status Query::process() {
if (status_ == QueryStatus::UNINITIALIZED)
return logger_->status(
Status_QueryError("Cannot process query; Query is not initialized"));
status_ = QueryStatus::INPROGRESS;
// Process query
Status st = strategy_->dowork();
// Handle error
if (!st.ok()) {
status_ = QueryStatus::FAILED;
return st;
}
if (type_ == QueryType::WRITE && layout_ == Layout::GLOBAL_ORDER) {
// reset coord buffer marker at end of global write
// this will allow for the user to properly set the next write batch
coord_buffer_is_set_ = false;
coord_data_buffer_is_set_ = false;
coord_offsets_buffer_is_set_ = false;
}
// Check if the query is complete
bool completed = !strategy_->incomplete();
// Handle callback and status
if (completed) {
if (callback_ != nullptr)
callback_(callback_data_);
status_ = QueryStatus::COMPLETED;
} else { // Incomplete
status_ = QueryStatus::INCOMPLETE;
}
return Status::Ok();
}
Status Query::create_strategy() {
if (type_ == QueryType::WRITE) {
if (layout_ == Layout::COL_MAJOR || layout_ == Layout::ROW_MAJOR) {
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
OrderedWriter,
stats_->create_child("Writer"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
written_fragment_info_,
disable_check_global_order_,
coords_info_,
fragment_uri_));
} else if (layout_ == Layout::UNORDERED) {
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
UnorderedWriter,
stats_->create_child("Writer"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
written_fragment_info_,
disable_check_global_order_,
coords_info_,
fragment_uri_));
} else if (layout_ == Layout::GLOBAL_ORDER) {
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
GlobalOrderWriter,
stats_->create_child("Writer"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
written_fragment_info_,
disable_check_global_order_,
coords_info_,
fragment_uri_));
} else {
assert(false);
}
} else {
bool use_default = true;
if (use_refactored_sparse_unordered_with_dups_reader() &&
!array_schema_->dense() && layout_ == Layout::UNORDERED &&
array_schema_->allows_dups()) {
use_default = false;
auto&& [st, non_overlapping_ranges]{Query::non_overlapping_ranges()};
RETURN_NOT_OK(st);
if (*non_overlapping_ranges || !subarray_.is_set() ||
subarray_.range_num() == 1) {
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
SparseUnorderedWithDupsReader<uint8_t>,
stats_->create_child("Reader"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
condition_));
} else {
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
SparseUnorderedWithDupsReader<uint64_t>,
stats_->create_child("Reader"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
condition_));
}
} else if (
use_refactored_sparse_global_order_reader() &&
!array_schema_->dense() &&
(layout_ == Layout::GLOBAL_ORDER ||
(layout_ == Layout::UNORDERED && subarray_.range_num() <= 1))) {
// Using the reader for unordered queries to do deduplication.
use_default = false;
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
SparseGlobalOrderReader,
stats_->create_child("Reader"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
condition_));
} else if (use_refactored_dense_reader() && array_schema_->dense()) {
bool all_dense = true;
for (auto& frag_md : fragment_metadata_)
all_dense &= frag_md->dense();
if (all_dense) {
use_default = false;
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
DenseReader,
stats_->create_child("Reader"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
condition_));
}
}
if (use_default) {
strategy_ = tdb_unique_ptr<IQueryStrategy>(tdb_new(
Reader,
stats_->create_child("Reader"),
logger_,
storage_manager_,
array_,
config_,
buffers_,
subarray_,
layout_,
condition_));
}
}
if (strategy_ == nullptr)
return logger_->status(
Status_QueryError("Cannot create strategy; allocation failed"));
return Status::Ok();
}
IQueryStrategy* Query::strategy() {
if (strategy_ == nullptr) {
create_strategy();
}
return strategy_.get();
}
void Query::clear_strategy() {
strategy_ = nullptr;
}
Status Query::disable_check_global_order() {
if (status_ != QueryStatus::UNINITIALIZED)
return logger_->status(Status_QueryError(
"Cannot disable checking global order after initialization"));
if (type_ == QueryType::READ)
return logger_->status(Status_QueryError(
"Cannot disable checking global order; Applicable only to writes"));
disable_check_global_order_ = true;
return Status::Ok();
}
Status Query::check_buffer_names() {
if (type_ == QueryType::WRITE) {
// If the array is sparse, the coordinates must be provided
if (!array_schema_->dense() && !coords_info_.has_coords_)
return logger_->status(Status_WriterError(
"Sparse array writes expect the coordinates of the "
"cells to be written"));
// If the layout is unordered, the coordinates must be provided
if (layout_ == Layout::UNORDERED && !coords_info_.has_coords_)
return logger_->status(
Status_WriterError("Unordered writes expect the coordinates of the "
"cells to be written"));
// All attributes/dimensions must be provided
auto expected_num = array_schema_->attribute_num();
expected_num += (coord_buffer_is_set_ || coord_data_buffer_is_set_ ||
coord_offsets_buffer_is_set_) ?
array_schema_->dim_num() :
0;
if (buffers_.size() != expected_num)
return logger_->status(
Status_WriterError("Writes expect all attributes (and coordinates in "
"the sparse/unordered case) to be set"));
}
return Status::Ok();
}
Status Query::check_set_fixed_buffer(const std::string& name) {
if (name == constants::coords &&
!array_schema_->domain()->all_dims_same_type())
return logger_->status(Status_QueryError(
"Cannot set buffer; Setting a buffer for zipped coordinates is not "
"applicable to heterogeneous domains"));
if (name == constants::coords && !array_schema_->domain()->all_dims_fixed())
return logger_->status(Status_QueryError(
"Cannot set buffer; Setting a buffer for zipped coordinates is not "
"applicable to domains with variable-sized dimensions"));
return Status::Ok();
}
Status Query::set_config(const Config& config) {
config_ = config;
// Refresh memory budget configuration.
if (strategy_ != nullptr)
RETURN_NOT_OK(strategy_->initialize_memory_budget());
// Set subarray's config for backwards compatibility
// Users expect the query config to effect the subarray based on existing
// behavior before subarray was exposed directly
subarray_.set_config(config_);
return Status::Ok();
}
Status Query::set_coords_buffer(void* buffer, uint64_t* buffer_size) {
// Set zipped coordinates buffer
coords_info_.coords_buffer_ = buffer;
coords_info_.coords_buffer_size_ = buffer_size;
coords_info_.has_coords_ = true;
return Status::Ok();
}
Status Query::set_buffer(
const std::string& name,
void* const buffer,
uint64_t* const buffer_size,
const bool check_null_buffers) {
RETURN_NOT_OK(check_set_fixed_buffer(name));
// Check buffer
if (check_null_buffers && buffer == nullptr)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// Check buffer size
if (check_null_buffers && buffer_size == nullptr)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// For easy reference
const bool is_dim = array_schema_->is_dim(name);
const bool is_attr = array_schema_->is_attr(name);
// Check that attribute/dimension exists
if (name != constants::coords && !is_dim && !is_attr)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Invalid attribute/dimension '") + name +
"'"));
// Must not be nullable
if (array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute/dimension '") + name +
"' is nullable"));
// Check that attribute/dimension is fixed-sized
const bool var_size =
(name != constants::coords && array_schema_->var_size(name));
if (var_size)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute/dimension '") + name +
"' is var-sized"));
// Check if zipped coordinates coexist with separate coordinate buffers
if ((is_dim && has_zipped_coords_buffer_) ||
(name == constants::coords && has_coords_buffer_))
return logger_->status(Status_QueryError(
std::string("Cannot set separate coordinate buffers and "
"a zipped coordinate buffer in the same query")));
// Error if setting a new attribute/dimension after initialization
const bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute/dimension '") + name +
"' after initialization"));
if (name == constants::coords) {
has_zipped_coords_buffer_ = true;
// Set special function for zipped coordinates buffer
if (type_ == QueryType::WRITE)
return set_coords_buffer(buffer, buffer_size);
}
if (is_dim && type_ == QueryType::WRITE) {
// Check number of coordinates
uint64_t coords_num = *buffer_size / array_schema_->cell_size(name);
if (coord_buffer_is_set_ && coords_num != coords_info_.coords_num_)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input buffer for dimension '") +
name +
"' has a different number of coordinates than previously "
"set coordinate buffers"));
coords_info_.coords_num_ = coords_num;
coord_buffer_is_set_ = true;
coords_info_.has_coords_ = true;
}
has_coords_buffer_ |= is_dim;
// Set attribute buffer
buffers_[name].set_data_buffer(buffer, buffer_size);
return Status::Ok();
}
Status Query::set_data_buffer(
const std::string& name,
void* const buffer,
uint64_t* const buffer_size,
const bool check_null_buffers) {
RETURN_NOT_OK(check_set_fixed_buffer(name));
// Check buffer
if (check_null_buffers && buffer == nullptr)
if (type_ != QueryType::WRITE || *buffer_size != 0)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// Check buffer size
if (check_null_buffers && buffer_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " buffer size is null"));
// For easy reference
const bool is_dim = array_schema_->is_dim(name);
const bool is_attr = array_schema_->is_attr(name);
// Check that attribute/dimension exists
if (name != constants::coords && !is_dim && !is_attr)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Invalid attribute/dimension '") + name +
"'"));
if (array_schema_->dense() && type_ == QueryType::WRITE && !is_attr) {
return logger_->status(Status_QueryError(
std::string("Dense write queries cannot set dimension buffers")));
}
// Check if zipped coordinates coexist with separate coordinate buffers
if ((is_dim && has_zipped_coords_buffer_) ||
(name == constants::coords && has_coords_buffer_))
return logger_->status(Status_QueryError(
std::string("Cannot set separate coordinate buffers and "
"a zipped coordinate buffer in the same query")));
// Error if setting a new attribute/dimension after initialization
const bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute/dimension '") + name +
"' after initialization"));
if (name == constants::coords) {
has_zipped_coords_buffer_ = true;
// Set special function for zipped coordinates buffer
if (type_ == QueryType::WRITE)
return set_coords_buffer(buffer, buffer_size);
}
if (is_dim && type_ == QueryType::WRITE) {
// Check number of coordinates
uint64_t coords_num = *buffer_size / array_schema_->cell_size(name);
if (coord_data_buffer_is_set_ && coords_num != coords_info_.coords_num_ &&
name == data_buffer_name_)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input buffer for dimension '") +
name +
"' has a different number of coordinates than previously "
"set coordinate buffers"));
coords_info_.coords_num_ = coords_num;
coord_data_buffer_is_set_ = true;
data_buffer_name_ = name;
coords_info_.has_coords_ = true;
}
has_coords_buffer_ |= is_dim;
// Set attribute/dimension buffer on the appropriate buffer
if (!array_schema_->var_size(name))
// Fixed size data buffer
buffers_[name].set_data_buffer(buffer, buffer_size);
else
// Var sized data buffer
buffers_[name].set_data_var_buffer(buffer, buffer_size);
return Status::Ok();
}
Status Query::set_offsets_buffer(
const std::string& name,
uint64_t* const buffer_offsets,
uint64_t* const buffer_offsets_size,
const bool check_null_buffers) {
RETURN_NOT_OK(check_set_fixed_buffer(name));
// Check buffer
if (check_null_buffers && buffer_offsets == nullptr)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// Check buffer size
if (check_null_buffers && buffer_offsets_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " buffer size is null"));
// For easy reference
const bool is_dim = array_schema_->is_dim(name);
const bool is_attr = array_schema_->is_attr(name);
// Neither a dimension nor an attribute
if (!is_dim && !is_attr)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Invalid buffer name '") + name +
"' (it should be an attribute or dimension)"));
// Error if it is fixed-sized
if (!array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute/dimension '") + name +
"' is fixed-sized"));
// Error if setting a new attribute/dimension after initialization
bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute/dimension '") + name +
"' after initialization"));
if (is_dim && type_ == QueryType::WRITE) {
// Check number of coordinates
uint64_t coords_num =
*buffer_offsets_size / constants::cell_var_offset_size;
if (coord_offsets_buffer_is_set_ &&
coords_num != coords_info_.coords_num_ && name == offsets_buffer_name_)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input buffer for dimension '") +
name +
"' has a different number of coordinates than previously "
"set coordinate buffers"));
coords_info_.coords_num_ = coords_num;
coord_offsets_buffer_is_set_ = true;
coords_info_.has_coords_ = true;
offsets_buffer_name_ = name;
}
has_coords_buffer_ |= is_dim;
// Set attribute/dimension buffer
buffers_[name].set_offsets_buffer(buffer_offsets, buffer_offsets_size);
return Status::Ok();
}
Status Query::set_validity_buffer(
const std::string& name,
uint8_t* const buffer_validity_bytemap,
uint64_t* const buffer_validity_bytemap_size,
const bool check_null_buffers) {
RETURN_NOT_OK(check_set_fixed_buffer(name));
ValidityVector validity_vector;
RETURN_NOT_OK(validity_vector.init_bytemap(
buffer_validity_bytemap, buffer_validity_bytemap_size));
// Check validity buffer
if (check_null_buffers && validity_vector.buffer() == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " validity buffer is null"));
// Check validity buffer size
if (check_null_buffers && validity_vector.buffer_size() == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " validity buffer size is null"));
// Must be an attribute
if (!array_schema_->is_attr(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Buffer name '") + name +
"' is not an attribute"));
// Must be nullable
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute '") + name +
"' is not nullable"));
// Error if setting a new attribute after initialization
const bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute '") + name +
"' after initialization"));
// Set attribute/dimension buffer
buffers_[name].set_validity_buffer(std::move(validity_vector));
return Status::Ok();
}
Status Query::set_buffer(
const std::string& name,
uint64_t* const buffer_off,
uint64_t* const buffer_off_size,
void* const buffer_val,
uint64_t* const buffer_val_size,
const bool check_null_buffers) {
// Check buffer
if (check_null_buffers && buffer_val == nullptr)
if (type_ != QueryType::WRITE || *buffer_val_size != 0)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// Check buffer size
if (check_null_buffers && buffer_val_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " buffer size is null"));
// Check offset buffer
if (check_null_buffers && buffer_off == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " offset buffer is null"));
// Check offset buffer size
if (check_null_buffers && buffer_off_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " offset buffer size is null"));
// For easy reference
const bool is_dim = array_schema_->is_dim(name);
const bool is_attr = array_schema_->is_attr(name);
// Check that attribute/dimension exists
if (!is_dim && !is_attr)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Invalid attribute/dimension '") + name +
"'"));
// Must not be nullable
if (array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute/dimension '") + name +
"' is nullable"));
// Check that attribute/dimension is var-sized
if (!array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute/dimension '") + name +
"' is fixed-sized"));
// Error if setting a new attribute/dimension after initialization
const bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute/dimension '") + name +
"' after initialization"));
if (is_dim && type_ == QueryType::WRITE) {
// Check number of coordinates
uint64_t coords_num = *buffer_off_size / constants::cell_var_offset_size;
if (coord_buffer_is_set_ && coords_num != coords_info_.coords_num_)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input buffer for dimension '") +
name +
"' has a different number of coordinates than previously "
"set coordinate buffers"));
coords_info_.coords_num_ = coords_num;
coord_buffer_is_set_ = true;
coords_info_.has_coords_ = true;
}
// Set attribute/dimension buffer
buffers_[name].set_data_var_buffer(buffer_val, buffer_val_size);
buffers_[name].set_offsets_buffer(buffer_off, buffer_off_size);
return Status::Ok();
}
Status Query::set_buffer_vbytemap(
const std::string& name,
void* const buffer,
uint64_t* const buffer_size,
uint8_t* const buffer_validity_bytemap,
uint64_t* const buffer_validity_bytemap_size,
const bool check_null_buffers) {
// Convert the bytemap into a ValidityVector.
ValidityVector vv;
RETURN_NOT_OK(
vv.init_bytemap(buffer_validity_bytemap, buffer_validity_bytemap_size));
return set_buffer(
name, buffer, buffer_size, std::move(vv), check_null_buffers);
}
Status Query::set_buffer_vbytemap(
const std::string& name,
uint64_t* const buffer_off,
uint64_t* const buffer_off_size,
void* const buffer_val,
uint64_t* const buffer_val_size,
uint8_t* const buffer_validity_bytemap,
uint64_t* const buffer_validity_bytemap_size,
const bool check_null_buffers) {
// Convert the bytemap into a ValidityVector.
ValidityVector vv;
RETURN_NOT_OK(
vv.init_bytemap(buffer_validity_bytemap, buffer_validity_bytemap_size));
return set_buffer(
name,
buffer_off,
buffer_off_size,
buffer_val,
buffer_val_size,
std::move(vv),
check_null_buffers);
}
Status Query::set_buffer(
const std::string& name,
void* const buffer,
uint64_t* const buffer_size,
ValidityVector&& validity_vector,
const bool check_null_buffers) {
RETURN_NOT_OK(check_set_fixed_buffer(name));
// Check buffer
if (check_null_buffers && buffer == nullptr)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// Check buffer size
if (check_null_buffers && buffer_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " buffer size is null"));
// Check validity buffer offset
if (check_null_buffers && validity_vector.buffer() == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " validity buffer is null"));
// Check validity buffer size
if (check_null_buffers && validity_vector.buffer_size() == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " validity buffer size is null"));
// Must be an attribute
if (!array_schema_->is_attr(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Buffer name '") + name +
"' is not an attribute"));
// Must be fixed-size
if (array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute '") + name +
"' is var-sized"));
// Must be nullable
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute '") + name +
"' is not nullable"));
// Error if setting a new attribute/dimension after initialization
const bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute '") + name +
"' after initialization"));
// Set attribute buffer
buffers_[name].set_data_buffer(buffer, buffer_size);
buffers_[name].set_validity_buffer(std::move(validity_vector));
return Status::Ok();
}
Status Query::set_buffer(
const std::string& name,
uint64_t* const buffer_off,
uint64_t* const buffer_off_size,
void* const buffer_val,
uint64_t* const buffer_val_size,
ValidityVector&& validity_vector,
const bool check_null_buffers) {
// Check buffer
if (check_null_buffers && buffer_val == nullptr)
if (type_ != QueryType::WRITE || *buffer_val_size != 0)
return logger_->status(
Status_QueryError("Cannot set buffer; " + name + " buffer is null"));
// Check buffer size
if (check_null_buffers && buffer_val_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " buffer size is null"));
// Check buffer offset
if (check_null_buffers && buffer_off == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " offset buffer is null"));
// Check buffer offset size
if (check_null_buffers && buffer_off_size == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " offset buffer size is null"));
;
// Check validity buffer offset
if (check_null_buffers && validity_vector.buffer() == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " validity buffer is null"));
// Check validity buffer size
if (check_null_buffers && validity_vector.buffer_size() == nullptr)
return logger_->status(Status_QueryError(
"Cannot set buffer; " + name + " validity buffer size is null"));
// Must be an attribute
if (!array_schema_->is_attr(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Buffer name '") + name +
"' is not an attribute"));
// Must be var-size
if (!array_schema_->var_size(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute '") + name +
"' is fixed-sized"));
// Must be nullable
if (!array_schema_->is_nullable(name))
return logger_->status(Status_QueryError(
std::string("Cannot set buffer; Input attribute '") + name +
"' is not nullable"));
// Error if setting a new attribute after initialization
const bool exists = buffers_.find(name) != buffers_.end();
if (status_ != QueryStatus::UNINITIALIZED && !exists)
return logger_->status(Status_QueryError(
std::string("Cannot set buffer for new attribute '") + name +
"' after initialization"));
// Set attribute/dimension buffer
buffers_[name].set_data_var_buffer(buffer_val, buffer_val_size);
buffers_[name].set_offsets_buffer(buffer_off, buffer_off_size);
buffers_[name].set_validity_buffer(std::move(validity_vector));
return Status::Ok();
}
Status Query::set_est_result_size(
std::unordered_map<std::string, Subarray::ResultSize>& est_result_size,
std::unordered_map<std::string, Subarray::MemorySize>& max_mem_size) {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot set estimated result size; Operation currently "
"unsupported for write queries"));
return subarray_.set_est_result_size(est_result_size, max_mem_size);
}
Status Query::set_layout_unsafe(Layout layout) {
layout_ = layout;
subarray_.set_layout(layout);
return Status::Ok();
}
Status Query::set_layout(Layout layout) {
if (type_ == QueryType::READ && status_ != QueryStatus::UNINITIALIZED)
return logger_->status(
Status_QueryError("Cannot set layout after initialization"));
if (layout == Layout::HILBERT)
return logger_->status(Status_QueryError(
"Cannot set layout; Hilbert order is not applicable to queries"));
if (type_ == QueryType::WRITE && array_schema_->dense() &&
layout == Layout::UNORDERED) {
return logger_->status(Status_QueryError(
"Unordered writes are only possible for sparse arrays"));
}
layout_ = layout;
subarray_.set_layout(layout);
return Status::Ok();
}
Status Query::set_condition(const QueryCondition& condition) {
if (type_ == QueryType::WRITE)
return logger_->status(Status_QueryError(
"Cannot set query condition; Operation only applicable "
"to read queries"));
condition_ = condition;
return Status::Ok();
}
void Query::set_status(QueryStatus status) {
status_ = status;
}
Status Query::set_subarray(const void* subarray) {
if (!array_schema_->domain()->all_dims_same_type())
return logger_->status(
Status_QueryError("Cannot set subarray; Function not applicable to "
"heterogeneous domains"));
if (!array_schema_->domain()->all_dims_fixed())
return logger_->status(
Status_QueryError("Cannot set subarray; Function not applicable to "
"domains with variable-sized dimensions"));
// Prepare a subarray object
Subarray sub(array_, layout_, stats_, logger_);
if (subarray != nullptr) {
auto dim_num = array_schema_->dim_num();
auto s_ptr = (const unsigned char*)subarray;
uint64_t offset = 0;
bool err_on_range_oob = true;
if (type_ == QueryType::READ) {
// Get read_range_oob config setting
bool found = false;
std::string read_range_oob_str =
config()->get("sm.read_range_oob", &found);
assert(found);
if (read_range_oob_str != "error" && read_range_oob_str != "warn")
return logger_->status(Status_QueryError(
"Invalid value " + read_range_oob_str +
" for sm.read_range_obb. Acceptable values are 'error' or "
"'warn'."));
err_on_range_oob = read_range_oob_str == "error";
}
for (unsigned d = 0; d < dim_num; ++d) {
auto r_size = 2 * array_schema_->dimension(d)->coord_size();
Range range(&s_ptr[offset], r_size);
RETURN_NOT_OK(sub.add_range(d, std::move(range), err_on_range_oob));
offset += r_size;
}
}
if (type_ == QueryType::WRITE) {
// Not applicable to sparse arrays
if (!array_schema_->dense())
return logger_->status(Status_WriterError(
"Setting a subarray is not supported in sparse writes"));
// Subarray must be unary for dense writes
if (sub.range_num() != 1)
return logger_->status(
Status_WriterError("Cannot set subarray; Multi-range dense writes "
"are not supported"));
if (strategy_ != nullptr)
strategy_->reset();
}
subarray_ = sub;
status_ = QueryStatus::UNINITIALIZED;
return Status::Ok();
}
const Subarray* Query::subarray() const {
return &subarray_;
}
Status Query::set_subarray_unsafe(const Subarray& subarray) {
subarray_ = subarray;
return Status::Ok();
}
Status Query::set_subarray(const tiledb::sm::Subarray& subarray) {
auto query_status = status();
if (query_status != tiledb::sm::QueryStatus::UNINITIALIZED &&
query_status != tiledb::sm::QueryStatus::COMPLETED) {
// Can be in this initialized state when query has been de-serialized
// server-side and are trying to perform local submit.
// Don't change anything and return indication of success.
return Status::Ok();
}
// Set subarray
if (!subarray.is_set())
// Nothing useful to set here, will leave query with its current
// settings and consider successful.
return Status::Ok();
auto prev_layout = subarray_.layout();
subarray_ = subarray;
subarray_.set_layout(prev_layout);
status_ = QueryStatus::UNINITIALIZED;
return Status::Ok();
}
Status Query::set_subarray_unsafe(const NDRange& subarray) {
// Prepare a subarray object
Subarray sub(array_, layout_, stats_, logger_);
if (!subarray.empty()) {
auto dim_num = array_schema_->dim_num();
for (unsigned d = 0; d < dim_num; ++d)
RETURN_NOT_OK(sub.add_range_unsafe(d, subarray[d]));
}
assert(layout_ == sub.layout());
subarray_ = sub;
status_ = QueryStatus::UNINITIALIZED;
return Status::Ok();
}
Status Query::check_buffers_correctness() {
// Iterate through each attribute
for (auto& attr : buffer_names()) {
if (array_schema_->var_size(attr)) {
// Check for data buffer under buffer_var and offsets buffer under buffer
if (type_ == QueryType::READ) {
if (buffer(attr).buffer_var_ == nullptr) {
return logger_->status(Status_QueryError(
std::string("Var-Sized input attribute/dimension '") + attr +
"' is not set correctly. \nVar size buffer is not set."));
}
} else {
if (buffer(attr).buffer_var_ == nullptr &&
*buffer(attr).buffer_var_size_ != 0) {
return logger_->status(Status_QueryError(
std::string("Var-Sized input attribute/dimension '") + attr +
"' is not set correctly. \nVar size buffer is not set and buffer "
"size if not 0."));
}
}
if (buffer(attr).buffer_ == nullptr) {
return logger_->status(Status_QueryError(
std::string("Var-Sized input attribute/dimension '") + attr +
"' is not set correctly. \nOffsets buffer is not set."));
}
} else {
// Fixed sized
if (buffer(attr).buffer_ == nullptr) {
return logger_->status(Status_QueryError(
std::string("Fix-Sized input attribute/dimension '") + attr +
"' is not set correctly. \nData buffer is not set."));
}
}
if (array_schema_->is_nullable(attr)) {
bool exists_validity = buffer(attr).validity_vector_.buffer() != nullptr;
if (!exists_validity) {
return logger_->status(Status_QueryError(
std::string("Nullable input attribute/dimension '") + attr +
"' is not set correctly \nValidity buffer is not set"));
}
}
}
return Status::Ok();
}
Status Query::submit() {
// Do not resubmit completed reads.
if (type_ == QueryType::READ && status_ == QueryStatus::COMPLETED) {
return Status::Ok();
}
// Check attribute/dimensions buffers completeness before query submits
RETURN_NOT_OK(check_buffers_correctness());
if (array_->is_remote()) {
auto rest_client = storage_manager_->rest_client();
if (rest_client == nullptr)
return logger_->status(Status_QueryError(
"Error in query submission; remote array with no rest client."));
if (status_ == QueryStatus::UNINITIALIZED) {
RETURN_NOT_OK(create_strategy());
RETURN_NOT_OK(strategy_->init());
}
return rest_client->submit_query_to_rest(array_->array_uri(), this);
}
RETURN_NOT_OK(init());
return storage_manager_->query_submit(this);
}
Status Query::submit_async(
std::function<void(void*)> callback, void* callback_data) {
// Do not resubmit completed reads.
if (type_ == QueryType::READ && status_ == QueryStatus::COMPLETED) {
callback(callback_data);
return Status::Ok();
}
RETURN_NOT_OK(init());
if (array_->is_remote())
return logger_->status(
Status_QueryError("Error in async query submission; async queries not "
"supported for remote arrays."));
callback_ = callback;
callback_data_ = callback_data;
return storage_manager_->query_submit_async(this);
}
QueryStatus Query::status() const {
return status_;
}
QueryStatusDetailsReason Query::status_incomplete_reason() const {
if (strategy_ != nullptr)
return strategy_->status_incomplete_reason();
return QueryStatusDetailsReason::REASON_NONE;
}
QueryType Query::type() const {
return type_;
}
const Config* Query::config() const {
return &config_;
}
stats::Stats* Query::stats() const {
return stats_;
}
tdb_shared_ptr<Buffer> Query::rest_scratch() const {
return rest_scratch_;
}
bool Query::use_refactored_dense_reader() {
bool use_refactored_readers = false;
bool found = false;
// First check for legacy option
config_.get<bool>(
"sm.use_refactored_readers", &use_refactored_readers, &found);
// If the legacy/deprecated option is set use it over the new parameters
// This facilitates backwards compatibility
if (found) {
logger_->warn(
"sm.use_refactored_readers config option is deprecated.\nPlease use "
"'sm.query.dense.reader' with value of 'refactored' or 'legacy'");
return use_refactored_readers;
}
const std::string& val = config_.get("sm.query.dense.reader", &found);
assert(found);
return val == "refactored";
}
bool Query::use_refactored_sparse_global_order_reader() {
bool use_refactored_readers = false;
bool found = false;
// First check for legacy option
config_.get<bool>(
"sm.use_refactored_readers", &use_refactored_readers, &found);
// If the legacy/deprecated option is set use it over the new parameters
// This facilitates backwards compatibility
if (found) {
logger_->warn(
"sm.use_refactored_readers config option is deprecated.\nPlease use "
"'sm.query.sparse_global_order.reader' with value of 'refactored' or "
"'legacy'");
return use_refactored_readers;
}
const std::string& val =
config_.get("sm.query.sparse_global_order.reader", &found);
assert(found);
return val == "refactored";
}
bool Query::use_refactored_sparse_unordered_with_dups_reader() {
bool use_refactored_readers = false;
bool found = false;
// First check for legacy option
config_.get<bool>(
"sm.use_refactored_readers", &use_refactored_readers, &found);
// If the legacy/deprecated option is set use it over the new parameters
// This facilitates backwards compatibility
if (found) {
logger_->warn(
"sm.use_refactored_readers config option is deprecated.\nPlease use "
"'sm.query.sparse_unordered_with_dups.reader' with value of "
"'refactored' or 'legacy'");
return use_refactored_readers;
}
const std::string& val =
config_.get("sm.query.sparse_unordered_with_dups.reader", &found);
assert(found);
return val == "refactored";
}
tuple<Status, optional<bool>> Query::non_overlapping_ranges() {
return subarray_.non_overlapping_ranges(storage_manager_->compute_tp());
}
/* ****************************** */
/* PRIVATE METHODS */
/* ****************************** */
} // namespace sm
} // namespace tiledb
| Java |
class CreateProductMaterials < ActiveRecord::Migration[5.0]
def change
create_table :product_materials do |t|
t.belongs_to :product, index: true
t.string :name
t.string :material
t.string :description
t.timestamps
end
end
end
| Java |
'use strict'
var test = require('tap').test
var strip = require('./')
test('stripFalsy', function(t) {
t.plan(5)
t.deepEqual(strip(null), {})
t.deepEqual(strip('test'), {})
t.deepEqual(strip(13), {})
t.deepEqual(strip(), {})
var input = {
a: false
, b: 0
, c: null
, d: undefined
, e: ''
, f: 'biscuits'
, g: '0'
}
var exp = {
f: 'biscuits'
, g: '0'
}
t.deepEqual(strip(input), exp)
})
| Java |
<?php
/**
* [WeEngine System] Copyright (c) 2014 WE7.CC
* WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
*/
defined('IN_IA') or exit('Access Denied');
load()->func('file');
load()->model('article');
load()->model('account');
$dos = array('display', 'post', 'del');
$do = in_array($do, $dos) ? $do : 'display';
permission_check_account_user('platform_site');
$_W['page']['title'] = '文章管理 - 微官网';
$category = pdo_fetchall("SELECT id,parentid,name FROM ".tablename('site_category')." WHERE uniacid = '{$_W['uniacid']}' ORDER BY parentid ASC, displayorder ASC, id ASC ", array(), 'id');
$parent = array();
$children = array();
if (!empty($category)) {
foreach ($category as $cid => $cate) {
if (!empty($cate['parentid'])) {
$children[$cate['parentid']][] = $cate;
} else {
$parent[$cate['id']] = $cate;
}
}
}
if ($do == 'display') {
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$condition = '';
$params = array();
if (!empty($_GPC['keyword'])) {
$condition .= " AND `title` LIKE :keyword";
$params[':keyword'] = "%{$_GPC['keyword']}%";
}
if (!empty($_GPC['category']['childid'])) {
$cid = intval($_GPC['category']['childid']);
$condition .= " AND ccate = '{$cid}'";
} elseif (!empty($_GPC['category']['parentid'])) {
$cid = intval($_GPC['category']['parentid']);
$condition .= " AND pcate = '{$cid}'";
}
$list = pdo_fetchall("SELECT * FROM ".tablename('site_article')." WHERE uniacid = '{$_W['uniacid']}' $condition ORDER BY displayorder DESC, edittime DESC, id DESC LIMIT ".($pindex - 1) * $psize.','.$psize, $params);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('site_article') . " WHERE uniacid = '{$_W['uniacid']}'".$condition, $params);
$pager = pagination($total, $pindex, $psize);
$article_ids = array();
if (!empty($list)) {
foreach ($list as $item) {
$article_ids[] = $item['id'];
}
}
$article_comment = table('sitearticlecomment')->srticleCommentUnread($article_ids);
$setting = uni_setting($_W['uniacid']);
template('site/article-display');
} elseif ($do == 'post') {
$id = intval($_GPC['id']);
$template = uni_templates();
$pcate = intval($_GPC['pcate']);
$ccate = intval($_GPC['ccate']);
if (!empty($id)) {
$item = pdo_fetch("SELECT * FROM ".tablename('site_article')." WHERE id = :id" , array(':id' => $id));
$item['type'] = explode(',', $item['type']);
$pcate = $item['pcate'];
$ccate = $item['ccate'];
if (empty($item)) {
itoast('抱歉,文章不存在或是已经删除!', '', 'error');
}
$key = pdo_fetchall('SELECT content FROM ' . tablename('rule_keyword') . ' WHERE rid = :rid AND uniacid = :uniacid', array(':rid' => $item['rid'], ':uniacid' => $_W['uniacid']));
if (!empty($key)) {
$keywords = array();
foreach ($key as $row) {
$keywords[] = $row['content'];
}
$keywords = implode(',', array_values($keywords));
}
$item['credit'] = iunserializer($item['credit']) ? iunserializer($item['credit']) : array();
if (!empty($item['credit']['limit'])) {
$credit_num = pdo_fetchcolumn('SELECT SUM(credit_value) FROM ' . tablename('mc_handsel') . ' WHERE uniacid = :uniacid AND module = :module AND sign = :sign', array(':uniacid' => $_W['uniacid'], ':module' => 'article', ':sign' => md5(iserializer(array('id' => $id)))));
if (is_null($credit_num)) {
$credit_num = 0;
}
$credit_yu = (($item['credit']['limit'] - $credit_num) < 0) ? 0 : $item['credit']['limit'] - $credit_num;
}
} else {
$item['credit'] = array();
$keywords = '';
}
if (checksubmit('submit')) {
if (empty($_GPC['title'])) {
itoast('标题不能为空,请输入标题!', '', '');
}
$sensitive_title = detect_sensitive_word($_GPC['title']);
if (!empty($sensitive_title)) {
itoast('不能使用敏感词:' . $sensitive_title, '', '');
}
$sensitive_content = detect_sensitive_word($_GPC['content']);
if (!empty($sensitive_content)) {
itoast('不能使用敏感词:' . $sensitive_content, '', '');
}
$data = array(
'uniacid' => $_W['uniacid'],
'iscommend' => intval($_GPC['option']['commend']),
'ishot' => intval($_GPC['option']['hot']),
'pcate' => intval($_GPC['category']['parentid']),
'ccate' => intval($_GPC['category']['childid']),
'template' => addslashes($_GPC['template']),
'title' => addslashes($_GPC['title']),
'description' => addslashes($_GPC['description']),
'content' => safe_gpc_html(htmlspecialchars_decode($_GPC['content'], ENT_QUOTES)),
'incontent' => intval($_GPC['incontent']),
'source' => addslashes($_GPC['source']),
'author' => addslashes($_GPC['author']),
'displayorder' => intval($_GPC['displayorder']),
'linkurl' => addslashes($_GPC['linkurl']),
'createtime' => TIMESTAMP,
'edittime' => TIMESTAMP,
'click' => intval($_GPC['click'])
);
if (!empty($_GPC['thumb'])) {
if (file_is_image($_GPC['thumb'])) {
$data['thumb'] = $_GPC['thumb'];
}
} elseif (!empty($_GPC['autolitpic'])) {
$match = array();
preg_match('/<img.*?src="?(.+\.(jpg|jpeg|gif|bmp|png))"/', $_GPC['content'], $match);
if (!empty($match[1])) {
$url = $match[1];
$file = file_remote_attach_fetch($url);
if (!is_error($file)) {
$data['thumb'] = $file;
file_remote_upload($file);
}
}
} else {
$data['thumb'] = '';
}
$keyword = str_replace(',', ',', trim($_GPC['keyword']));
$keyword = explode(',', $keyword);
if (!empty($keyword)) {
$rule['uniacid'] = $_W['uniacid'];
$rule['name'] = '文章:' . $_GPC['title'] . ' 触发规则';
$rule['module'] = 'news';
$rule['status'] = 1;
$keywords = array();
foreach ($keyword as $key) {
$key = trim($key);
if (empty($key)) continue;
$keywords[] = array(
'uniacid' => $_W['uniacid'],
'module' => 'news',
'content' => $key,
'status' => 1,
'type' => 1,
'displayorder' => 1,
);
}
$reply['title'] = $_GPC['title'];
$reply['description'] = $_GPC['description'];
$reply['thumb'] = $data['thumb'];
$reply['url'] = murl('site/site/detail', array('id' => $id));
}
if (!empty($_GPC['credit']['status'])) {
$credit['status'] = intval($_GPC['credit']['status']);
$credit['limit'] = intval($_GPC['credit']['limit']) ? intval($_GPC['credit']['limit']) : itoast('请设置积分上限', '', '');
$credit['share'] = intval($_GPC['credit']['share']) ? intval($_GPC['credit']['share']) : itoast('请设置分享时赠送积分多少', '', '');
$credit['click'] = intval($_GPC['credit']['click']) ? intval($_GPC['credit']['click']) : itoast('请设置阅读时赠送积分多少', '', '');
$data['credit'] = iserializer($credit);
} else {
$data['credit'] = iserializer(array('status' => 0, 'limit' => 0, 'share' => 0, 'click' => 0));
}
if (empty($id)) {
unset($data['edittime']);
if (!empty($keywords)) {
pdo_insert('rule', $rule);
$rid = pdo_insertid();
foreach ($keywords as $li) {
$li['rid'] = $rid;
pdo_insert('rule_keyword', $li);
}
$reply['rid'] = $rid;
pdo_insert('news_reply', $reply);
$data['rid'] = $rid;
}
pdo_insert('site_article', $data);
$aid = pdo_insertid();
pdo_update('news_reply', array('url' => murl('site/site/detail', array('id' => $aid))), array('rid' => $rid));
} else {
unset($data['createtime']);
pdo_delete('rule', array('id' => $item['rid'], 'uniacid' => $_W['uniacid']));
pdo_delete('rule_keyword', array('rid' => $item['rid'], 'uniacid' => $_W['uniacid']));
pdo_delete('news_reply', array('rid' => $item['rid']));
if (!empty($keywords)) {
pdo_insert('rule', $rule);
$rid = pdo_insertid();
foreach ($keywords as $li) {
$li['rid'] = $rid;
pdo_insert('rule_keyword', $li);
}
$reply['rid'] = $rid;
pdo_insert('news_reply', $reply);
$data['rid'] = $rid;
} else {
$data['rid'] = 0;
$data['kid'] = 0;
}
pdo_update('site_article', $data, array('id' => $id));
}
itoast('文章更新成功!', url('site/article/display'), 'success');
} else {
template('site/article-post');
}
} elseif($do == 'del') {
if (checksubmit('submit')) {
foreach ($_GPC['rid'] as $key => $id) {
$id = intval($id);
$row = pdo_get('site_article', array('id' => $id, 'uniacid' => $_W['uniacid']));
if (empty($row)) {
itoast('抱歉,文章不存在或是已经被删除!', '', '');
}
if (!empty($row['rid'])) {
pdo_delete('rule', array('id' => $row['rid'], 'uniacid' => $_W['uniacid']));
pdo_delete('rule_keyword', array('rid' => $row['rid'], 'uniacid' => $_W['uniacid']));
pdo_delete('news_reply', array('rid' => $row['rid']));
}
pdo_delete('site_article', array('id' => $id, 'uniacid'=>$_W['uniacid']));
}
itoast('批量删除成功!', referer(), 'success');
} else {
$id = intval($_GPC['id']);
$row = pdo_fetch("SELECT id,rid,kid,thumb FROM ".tablename('site_article')." WHERE id = :id", array(':id' => $id));
if (empty($row)) {
itoast('抱歉,文章不存在或是已经被删除!', '', '');
}
if (!empty($row['rid'])) {
pdo_delete('rule', array('id' => $row['rid'], 'uniacid' => $_W['uniacid']));
pdo_delete('rule_keyword', array('rid' => $row['rid'], 'uniacid' => $_W['uniacid']));
pdo_delete('news_reply', array('rid' => $row['rid']));
}
if (pdo_delete('site_article', array('id' => $id,'uniacid'=>$_W['uniacid']))){
itoast('删除成功!', referer(), 'success');
} else {
itoast('删除失败!', referer(), 'error');
}
}
}
| Java |
<?php
namespace Kr\OAuthClient\Credentials;
class Client extends AbstractCredentials
{
protected $clientId, $clientSecret, $redirectUri;
/**
* Client constructor.
* @param string $clientId
* @param string $clientSecret
* @param string $redirectUri
*/
public function __construct($clientId, $clientSecret, $redirectUri)
{
$this->clientId = $clientId;
$this->clientSecret = $clientSecret;
$this->redirectUri = $redirectUri;
}
/**
* @inheritdoc
*/
public function getCredentials()
{
return [
"client_id" => $this->getClientId(),
"client_secret" => $this->getClientSecret(),
"redirect_uri" => $this->getRedirectUri(),
];
}
/**
* @return mixed
*/
public function getClientId()
{
return $this->clientId;
}
/**
* @return mixed
*/
public function getClientSecret()
{
return $this->clientSecret;
}
/**
* @return mixed
*/
public function getRedirectUri()
{
return $this->redirectUri;
}
/**
* @inheritdoc
*/
public static function getType()
{
return "client_credentials";
}
} | Java |
$(function () {
$('.imageUploadMultiple').each(function (index, item) {
var $item = $(item);
var $group = $item.closest('.form-group');
var $innerGroup = $item.find('.form-group');
var $errors = $item.find('.errors');
var $input = $item.find('.imageValue');
var flow = new Flow({
target: $item.data('target'),
testChunks: false,
chunkSize: 1024 * 1024 * 1024,
query: {
_token: $item.data('token')
}
});
var updateValue = function () {
var values = [];
$item.find('img[data-value]').each(function () {
values.push($(this).data('value'));
});
$input.val(values.join(','));
};
flow.assignBrowse($item.find('.imageBrowse'));
flow.on('filesSubmitted', function (file) {
flow.upload();
});
flow.on('fileSuccess', function (file, message) {
flow.removeFile(file);
$errors.html('');
$group.removeClass('has-error');
var result = $.parseJSON(message);
$innerGroup.append('<div class="col-xs-6 col-md-3 imageThumbnail"><div class="thumbnail">' +
'<img data-value="' + result.value + '" src="' + result.url + '" />' +
'<a href="#" class="imageRemove">Remove</a></div></div>');
updateValue();
});
flow.on('fileError', function (file, message) {
flow.removeFile(file);
var response = $.parseJSON(message);
var errors = '';
$.each(response, function (index, error) {
errors += '<p class="help-block">' + error + '</p>'
});
$errors.html(errors);
$group.addClass('has-error');
});
$item.on('click', '.imageRemove', function (e) {
e.preventDefault();
$(this).closest('.imageThumbnail').remove();
updateValue();
});
$innerGroup.sortable({
onUpdate: function () {
updateValue();
}
});
});
}); | Java |
vk_wiki_manager
===============
| Java |
#!/bin/bash
f="$1"
d="$2"
CURRENT_DIR=$( pushd $(dirname $0) >/dev/null; pwd; popd >/dev/null )
if [ ! -d $d ]; then
echo "$d is not found"
exit 2
fi
F="$d/$f"
if [ -f "$F" ]; then
s1=`wc -c "$f" | cut -d ' ' -f 1`
s2=`wc -c "$F" | cut -d ' ' -f 1`
if [ $s1 -eq $s2 ]; then
cksum1=`md5sum -b "$f" | cut -d ' ' -f 1`
cksum2=`md5sum -b "$F" | cut -d ' ' -f 1`
if [ "$cksum1" == "$cksum2" ]; then
rm -v "$f"
else
echo "\"$F\" exists, has the same size, but different md5sum than \"$f\""
fi
else
echo "\"$F\" exists and has differrent size than \"$f\""
echo "\"$F\" - $s2"
echo "\"$f\" - $s1"
fi
else
echo "\"$F\" does not exist"
fi
| Java |
module Schema
include Virtus.module(:constructor => false, :mass_assignment => false)
def initialize
set_default_attributes
end
def attributes
attribute_set.get(self)
end
def to_h
attributes
end
end
| Java |
#!/bin/sh
# CYBERWATCH SAS - 2017
#
# Security fix for DSA-3663-1
#
# Security announcement date: 2016-09-09 00:00:00 UTC
# Script generation date: 2017-01-01 21:08:13 UTC
#
# Operating System: Debian 8 (Jessie)
# Architecture: i386
#
# Vulnerable packages fix on version:
# - xen:4.4.1-9+deb8u7
# - libxen-4.4:4.4.1-9+deb8u7
# - libxenstore3.0:4.4.1-9+deb8u7
# - libxen-dev:4.4.1-9+deb8u7
# - xenstore-utils:4.4.1-9+deb8u7
# - xen-utils-common:4.4.1-9+deb8u7
# - xen-utils-4.4:4.4.1-9+deb8u7
# - xen-hypervisor-4.4-amd64:4.4.1-9+deb8u7
# - xen-system-amd64:4.4.1-9+deb8u7
#
# Last versions recommanded by security team:
# - xen:4.4.1-9+deb8u7
# - libxen-4.4:4.4.1-9+deb8u7
# - libxenstore3.0:4.4.1-9+deb8u7
# - libxen-dev:4.4.1-9+deb8u7
# - xenstore-utils:4.4.1-9+deb8u7
# - xen-utils-common:4.4.1-9+deb8u7
# - xen-utils-4.4:4.4.1-9+deb8u7
# - xen-hypervisor-4.4-amd64:4.4.1-9+deb8u7
# - xen-system-amd64:4.4.1-9+deb8u7
#
# CVE List:
# - CVE-2016-7092
# - CVE-2016-7094
# - CVE-2016-7154
#
# More details:
# - https://www.cyberwatch.fr/vulnerabilites
#
# Licence: Released under The MIT License (MIT), See LICENSE FILE
sudo apt-get install --only-upgrade xen=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade libxen-4.4=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade libxenstore3.0=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade libxen-dev=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade xenstore-utils=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade xen-utils-common=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade xen-utils-4.4=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade xen-hypervisor-4.4-amd64=4.4.1-9+deb8u7 -y
sudo apt-get install --only-upgrade xen-system-amd64=4.4.1-9+deb8u7 -y
| Java |
/**
* k-d Tree JavaScript - V 1.01
*
* https://github.com/ubilabs/kd-tree-javascript
*
* @author Mircea Pricop <pricop@ubilabs.net>, 2012
* @author Martin Kleppe <kleppe@ubilabs.net>, 2012
* @author Ubilabs http://ubilabs.net, 2012
* @license MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports'], factory);
} else if (typeof exports === 'object') {
factory(exports);
} else {
factory((root.commonJsStrict = {}));
}
}(this, function (exports) {
function Node(obj, dimension, parent) {
this.obj = obj;
this.left = null;
this.right = null;
this.parent = parent;
this.dimension = dimension;
}
function kdTree(points, metric, dimensions) {
var self = this;
function buildTree(points, depth, parent) {
var dim = depth % dimensions.length,
median,
node;
if (points.length === 0) {
return null;
}
if (points.length === 1) {
return new Node(points[0], dim, parent);
}
points.sort(function (a, b) {
return a[dimensions[dim]] - b[dimensions[dim]];
});
median = Math.floor(points.length / 2);
node = new Node(points[median], dim, parent);
node.left = buildTree(points.slice(0, median), depth + 1, node);
node.right = buildTree(points.slice(median + 1), depth + 1, node);
return node;
}
// Reloads a serialied tree
function loadTree (data) {
// Just need to restore the `parent` parameter
self.root = data;
function restoreParent (root) {
if (root.left) {
root.left.parent = root;
restoreParent(root.left);
}
if (root.right) {
root.right.parent = root;
restoreParent(root.right);
}
}
restoreParent(self.root);
}
// If points is not an array, assume we're loading a pre-built tree
if (!Array.isArray(points)) loadTree(points, metric, dimensions);
else this.root = buildTree(points, 0, null);
// Convert to a JSON serializable structure; this just requires removing
// the `parent` property
this.toJSON = function (src) {
if (!src) src = this.root;
var dest = new Node(src.obj, src.dimension, null);
if (src.left) dest.left = self.toJSON(src.left);
if (src.right) dest.right = self.toJSON(src.right);
return dest;
};
this.insert = function (point) {
function innerSearch(node, parent) {
if (node === null) {
return parent;
}
var dimension = dimensions[node.dimension];
if (point[dimension] < node.obj[dimension]) {
return innerSearch(node.left, node);
} else {
return innerSearch(node.right, node);
}
}
var insertPosition = innerSearch(this.root, null),
newNode,
dimension;
if (insertPosition === null) {
this.root = new Node(point, 0, null);
return;
}
newNode = new Node(point, (insertPosition.dimension + 1) % dimensions.length, insertPosition);
dimension = dimensions[insertPosition.dimension];
if (point[dimension] < insertPosition.obj[dimension]) {
insertPosition.left = newNode;
} else {
insertPosition.right = newNode;
}
};
this.remove = function (point) {
var node;
function nodeSearch(node) {
if (node === null) {
return null;
}
if (node.obj === point) {
return node;
}
var dimension = dimensions[node.dimension];
if (point[dimension] < node.obj[dimension]) {
return nodeSearch(node.left, node);
} else {
return nodeSearch(node.right, node);
}
}
function removeNode(node) {
var nextNode,
nextObj,
pDimension;
function findMin(node, dim) {
var dimension,
own,
left,
right,
min;
if (node === null) {
return null;
}
dimension = dimensions[dim];
if (node.dimension === dim) {
if (node.left !== null) {
return findMin(node.left, dim);
}
return node;
}
own = node.obj[dimension];
left = findMin(node.left, dim);
right = findMin(node.right, dim);
min = node;
if (left !== null && left.obj[dimension] < own) {
min = left;
}
if (right !== null && right.obj[dimension] < min.obj[dimension]) {
min = right;
}
return min;
}
if (node.left === null && node.right === null) {
if (node.parent === null) {
self.root = null;
return;
}
pDimension = dimensions[node.parent.dimension];
if (node.obj[pDimension] < node.parent.obj[pDimension]) {
node.parent.left = null;
} else {
node.parent.right = null;
}
return;
}
// If the right subtree is not empty, swap with the minimum element on the
// node's dimension. If it is empty, we swap the left and right subtrees and
// do the same.
if (node.right !== null) {
nextNode = findMin(node.right, node.dimension);
nextObj = nextNode.obj;
removeNode(nextNode);
node.obj = nextObj;
} else {
nextNode = findMin(node.left, node.dimension);
nextObj = nextNode.obj;
removeNode(nextNode);
node.right = node.left;
node.left = null;
node.obj = nextObj;
}
}
node = nodeSearch(self.root);
if (node === null) { return; }
removeNode(node);
};
this.nearest = function (point, maxNodes, maxDistance) {
var i,
result,
bestNodes;
bestNodes = new BinaryHeap(
function (e) { return -e[1]; }
);
function nearestSearch(node) {
var bestChild,
dimension = dimensions[node.dimension],
ownDistance = metric(point, node.obj),
linearPoint = {},
linearDistance,
otherChild,
i;
function saveNode(node, distance) {
bestNodes.push([node, distance]);
if (bestNodes.size() > maxNodes) {
bestNodes.pop();
}
}
for (i = 0; i < dimensions.length; i += 1) {
if (i === node.dimension) {
linearPoint[dimensions[i]] = point[dimensions[i]];
} else {
linearPoint[dimensions[i]] = node.obj[dimensions[i]];
}
}
linearDistance = metric(linearPoint, node.obj);
if (node.right === null && node.left === null) {
if (bestNodes.size() < maxNodes || ownDistance < bestNodes.peek()[1]) {
saveNode(node, ownDistance);
}
return;
}
if (node.right === null) {
bestChild = node.left;
} else if (node.left === null) {
bestChild = node.right;
} else {
if (point[dimension] < node.obj[dimension]) {
bestChild = node.left;
} else {
bestChild = node.right;
}
}
nearestSearch(bestChild);
if (bestNodes.size() < maxNodes || ownDistance < bestNodes.peek()[1]) {
saveNode(node, ownDistance);
}
if (bestNodes.size() < maxNodes || Math.abs(linearDistance) < bestNodes.peek()[1]) {
if (bestChild === node.left) {
otherChild = node.right;
} else {
otherChild = node.left;
}
if (otherChild !== null) {
nearestSearch(otherChild);
}
}
}
if (maxDistance) {
for (i = 0; i < maxNodes; i += 1) {
bestNodes.push([null, maxDistance]);
}
}
if(self.root)
nearestSearch(self.root);
result = [];
for (i = 0; i < Math.min(maxNodes, bestNodes.content.length); i += 1) {
if (bestNodes.content[i][0]) {
result.push([bestNodes.content[i][0].obj, bestNodes.content[i][1]]);
}
}
return result;
};
this.balanceFactor = function () {
function height(node) {
if (node === null) {
return 0;
}
return Math.max(height(node.left), height(node.right)) + 1;
}
function count(node) {
if (node === null) {
return 0;
}
return count(node.left) + count(node.right) + 1;
}
return height(self.root) / (Math.log(count(self.root)) / Math.log(2));
};
}
// Binary heap implementation from:
// http://eloquentjavascript.net/appendix2.html
function BinaryHeap(scoreFunction){
this.content = [];
this.scoreFunction = scoreFunction;
}
BinaryHeap.prototype = {
push: function(element) {
// Add the new element to the end of the array.
this.content.push(element);
// Allow it to bubble up.
this.bubbleUp(this.content.length - 1);
},
pop: function() {
// Store the first element so we can return it later.
var result = this.content[0];
// Get the element at the end of the array.
var end = this.content.pop();
// If there are any elements left, put the end element at the
// start, and let it sink down.
if (this.content.length > 0) {
this.content[0] = end;
this.sinkDown(0);
}
return result;
},
peek: function() {
return this.content[0];
},
remove: function(node) {
var len = this.content.length;
// To remove a value, we must search through the array to find
// it.
for (var i = 0; i < len; i++) {
if (this.content[i] == node) {
// When it is found, the process seen in 'pop' is repeated
// to fill up the hole.
var end = this.content.pop();
if (i != len - 1) {
this.content[i] = end;
if (this.scoreFunction(end) < this.scoreFunction(node))
this.bubbleUp(i);
else
this.sinkDown(i);
}
return;
}
}
throw new Error("Node not found.");
},
size: function() {
return this.content.length;
},
bubbleUp: function(n) {
// Fetch the element that has to be moved.
var element = this.content[n];
// When at 0, an element can not go up any further.
while (n > 0) {
// Compute the parent element's index, and fetch it.
var parentN = Math.floor((n + 1) / 2) - 1,
parent = this.content[parentN];
// Swap the elements if the parent is greater.
if (this.scoreFunction(element) < this.scoreFunction(parent)) {
this.content[parentN] = element;
this.content[n] = parent;
// Update 'n' to continue at the new position.
n = parentN;
}
// Found a parent that is less, no need to move it further.
else {
break;
}
}
},
sinkDown: function(n) {
// Look up the target element and its score.
var length = this.content.length,
element = this.content[n],
elemScore = this.scoreFunction(element);
while(true) {
// Compute the indices of the child elements.
var child2N = (n + 1) * 2, child1N = child2N - 1;
// This is used to store the new position of the element,
// if any.
var swap = null;
// If the first child exists (is inside the array)...
if (child1N < length) {
// Look it up and compute its score.
var child1 = this.content[child1N],
child1Score = this.scoreFunction(child1);
// If the score is less than our element's, we need to swap.
if (child1Score < elemScore)
swap = child1N;
}
// Do the same checks for the other child.
if (child2N < length) {
var child2 = this.content[child2N],
child2Score = this.scoreFunction(child2);
if (child2Score < (swap == null ? elemScore : child1Score)){
swap = child2N;
}
}
// If the element needs to be moved, swap it, and continue.
if (swap != null) {
this.content[n] = this.content[swap];
this.content[swap] = element;
n = swap;
}
// Otherwise, we are done.
else {
break;
}
}
}
};
this.kdTree = kdTree;
exports.kdTree = kdTree;
exports.BinaryHeap = BinaryHeap;
}));
| Java |
// function that finds the sum of two parameters
function findSum(firstnr, secondnr){
return firstnr + secondnr;
}
//function that finds the product of two parameters
function findProduct(firstnr, secondnr){
return firstnr * secondnr;
}
/* threeOperation calls the operation parameter as a function so it's able to run and "do" different things
depending on the global function it takes as a parameter when calling it*/
function threeOperation (x, operation){
/*put console.log here so it doesn't only returns the result but also prints it in the console first:
to check if it gives the right answer when it's called*/
console.log(operation(3, x));
return operation(3, x);
}
//Call "threeOperation" with the values of "4" and "findSum"
threeOperation(4, findSum);
//Call "threeOperation" with the values of "5" and "findSum"
threeOperation(5, findSum);
//Call "threeOperation" with the values of "4" and "findProduct"
threeOperation(4, findProduct);
//Call "threeOperation" with the values of "5" and "findProduct"
threeOperation(5, findProduct); | Java |
//
// LJRouterPath.h
// LJControllerRouterExample
//
// Created by Jinxing Liao on 12/14/15.
// Copyright © 2015 Jinxing Liao. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface LJRouterPath : NSObject
@property (nonatomic, strong) NSString *schema;
@property (nonatomic, strong) NSArray *components;
@property (nonatomic, strong) NSDictionary *params;
- (instancetype)initWithRouterURL:(NSString *)URL;
@end
| Java |
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Everyplay.XCodeEditor
{
public class XCConfigurationList : PBXObject
{
public XCConfigurationList(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
}
}
| Java |
// GPG4Browsers - An OpenPGP implementation in javascript
// Copyright (C) 2011 Recurity Labs GmbH
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/**
* Public-Key Encrypted Session Key Packets (Tag 1)<br/>
* <br/>
* {@link http://tools.ietf.org/html/rfc4880#section-5.1|RFC4880 5.1}: A Public-Key Encrypted Session Key packet holds the session key
* used to encrypt a message. Zero or more Public-Key Encrypted Session Key
* packets and/or Symmetric-Key Encrypted Session Key packets may precede a
* Symmetrically Encrypted Data Packet, which holds an encrypted message. The
* message is encrypted with the session key, and the session key is itself
* encrypted and stored in the Encrypted Session Key packet(s). The
* Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted
* Session Key packet for each OpenPGP key to which the message is encrypted.
* The recipient of the message finds a session key that is encrypted to their
* public key, decrypts the session key, and then uses the session key to
* decrypt the message.
* @requires crypto
* @requires enums
* @requires type/s2k
* @module packet/sym_encrypted_session_key
*/
var type_s2k = require('../type/s2k.js'),
enums = require('../enums.js'),
crypto = require('../crypto');
module.exports = SymEncryptedSessionKey;
/**
* @constructor
*/
function SymEncryptedSessionKey() {
this.tag = enums.packet.symEncryptedSessionKey;
this.sessionKeyEncryptionAlgorithm = null;
this.sessionKeyAlgorithm = 'aes256';
this.encrypted = null;
this.s2k = new type_s2k();
}
/**
* Parsing function for a symmetric encrypted session key packet (tag 3).
*
* @param {String} input Payload of a tag 1 packet
* @param {Integer} position Position to start reading from the input string
* @param {Integer} len
* Length of the packet or the remaining length of
* input at position
* @return {module:packet/sym_encrypted_session_key} Object representation
*/
SymEncryptedSessionKey.prototype.read = function(bytes) {
// A one-octet version number. The only currently defined version is 4.
this.version = bytes.charCodeAt(0);
// A one-octet number describing the symmetric algorithm used.
var algo = enums.read(enums.symmetric, bytes.charCodeAt(1));
// A string-to-key (S2K) specifier, length as defined above.
var s2klength = this.s2k.read(bytes.substr(2));
// Optionally, the encrypted session key itself, which is decrypted
// with the string-to-key object.
var done = s2klength + 2;
if (done < bytes.length) {
this.encrypted = bytes.substr(done);
this.sessionKeyEncryptionAlgorithm = algo;
} else
this.sessionKeyAlgorithm = algo;
};
SymEncryptedSessionKey.prototype.write = function() {
var algo = this.encrypted === null ?
this.sessionKeyAlgorithm :
this.sessionKeyEncryptionAlgorithm;
var bytes = String.fromCharCode(this.version) +
String.fromCharCode(enums.write(enums.symmetric, algo)) +
this.s2k.write();
if (this.encrypted !== null)
bytes += this.encrypted;
return bytes;
};
/**
* Decrypts the session key (only for public key encrypted session key
* packets (tag 1)
*
* @return {String} The unencrypted session key
*/
SymEncryptedSessionKey.prototype.decrypt = function(passphrase) {
var algo = this.sessionKeyEncryptionAlgorithm !== null ?
this.sessionKeyEncryptionAlgorithm :
this.sessionKeyAlgorithm;
var length = crypto.cipher[algo].keySize;
var key = this.s2k.produce_key(passphrase, length);
if (this.encrypted === null) {
this.sessionKey = key;
} else {
var decrypted = crypto.cfb.decrypt(
this.sessionKeyEncryptionAlgorithm, key, this.encrypted, true);
this.sessionKeyAlgorithm = enums.read(enums.symmetric,
decrypted[0].keyCodeAt());
this.sessionKey = decrypted.substr(1);
}
};
SymEncryptedSessionKey.prototype.encrypt = function(passphrase) {
var length = crypto.getKeyLength(this.sessionKeyEncryptionAlgorithm);
var key = this.s2k.produce_key(passphrase, length);
var private_key = String.fromCharCode(
enums.write(enums.symmetric, this.sessionKeyAlgorithm)) +
crypto.getRandomBytes(
crypto.getKeyLength(this.sessionKeyAlgorithm));
this.encrypted = crypto.cfb.encrypt(
crypto.getPrefixRandom(this.sessionKeyEncryptionAlgorithm),
this.sessionKeyEncryptionAlgorithm, key, private_key, true);
};
/**
* Fix custom types after cloning
*/
SymEncryptedSessionKey.prototype.postCloneTypeFix = function() {
this.s2k = type_s2k.fromClone(this.s2k);
};
| Java |
"""
train supervised classifier with what's cooking recipe data
objective - determine recipe type categorical value from 20
"""
import time
from features_bow import *
from features_word2vec import *
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
from sklearn.linear_model import SGDClassifier
from sklearn.cross_validation import cross_val_score
""" main entry method """
def main(use_idf=False, random_state=None, std=False, n_jobs=-1, verbose=2):
wc_idf_map = None
if use_idf:
# ingredients inverse document frequencies
wc_components = build_tfidf_wc(verbose=(verbose > 0))
wc_idf = wc_components['model'].idf_
wc_idf_words = wc_components['model'].get_feature_names()
wc_idf_map = dict(zip(wc_idf_words, wc_idf))
# word2vec recipe feature vectors
wc_components = build_word2vec_wc(feature_vec_size=120, avg=True, idf=wc_idf_map, verbose=(verbose > 0))
y_train = wc_components['train']['df']['cuisine_code'].as_matrix()
X_train = wc_components['train']['features_matrix']
# standardize features aka mean ~ 0, std ~ 1
if std:
scaler = StandardScaler()
scaler.fit(X_train)
X_train = scaler.transform(X_train)
# random forest supervised classifier
time_0 = time.time()
clf = RandomForestClassifier(n_estimators=100, max_depth=None,
n_jobs=n_jobs, random_state=random_state, verbose=verbose)
# perform cross validation
cv_n_fold = 8
print 'cross validating %s ways...' % cv_n_fold
scores_cv = cross_val_score(clf, X_train, y_train, cv=cv_n_fold, n_jobs=-1)
print 'accuracy: %0.5f (+/- %0.5f)' % (scores_cv.mean(), scores_cv.std() * 2)
time_1 = time.time()
elapsed_time = time_1 - time_0
print 'cross validation took %.3f seconds' % elapsed_time
if __name__ == '__main__':
main()
| Java |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Configuration options for Invenio-Search.
The documentation for the configuration is in docs/configuration.rst.
"""
#
# ELASTIC configuration
#
SEARCH_CLIENT_CONFIG = None
"""Dictionary of options for the Elasticsearch client.
The value of this variable is passed to :py:class:`elasticsearch.Elasticsearch`
as keyword arguments and is used to configure the client. See the available
keyword arguments in the two following classes:
- :py:class:`elasticsearch.Elasticsearch`
- :py:class:`elasticsearch.Transport`
If you specify the key ``hosts`` in this dictionary, the configuration variable
:py:class:`~invenio_search.config.SEARCH_ELASTIC_HOSTS` will have no effect.
"""
SEARCH_ELASTIC_HOSTS = None # default localhost
"""Elasticsearch hosts.
By default, Invenio connects to ``localhost:9200``.
The value of this variable is a list of dictionaries, where each dictionary
represents a host. The available keys in each dictionary is determined by the
connection class:
- :py:class:`elasticsearch.connection.Urllib3HttpConnection` (default)
- :py:class:`elasticsearch.connection.RequestsHttpConnection`
You can change the connection class via the
:py:class:`~invenio_search.config.SEARCH_CLIENT_CONFIG`. If you specified the
``hosts`` key in :py:class:`~invenio_search.config.SEARCH_CLIENT_CONFIG` then
this configuration variable will have no effect.
"""
SEARCH_MAPPINGS = None # loads all mappings and creates aliases for them
"""List of aliases for which, their search mappings should be created.
- If `None` all aliases (and their search mappings) defined through the
``invenio_search.mappings`` entry point in setup.py will be created.
- Provide an empty list ``[]`` if no aliases (or their search mappings)
should be created.
For example if you don't want to create aliases
and their mappings for `authors`:
.. code-block:: python
# in your `setup.py` you would specify:
entry_points={
'invenio_search.mappings': [
'records = invenio_foo_bar.mappings',
'authors = invenio_foo_bar.mappings',
],
}
# and in your config.py
SEARCH_MAPPINGS = ['records']
"""
SEARCH_RESULTS_MIN_SCORE = None
"""If set, the `min_score` parameter is added to each search request body.
The `min_score` parameter excludes results which have a `_score` less than
the minimum specified in `min_score`.
Note that the `max_score` varies depending on the number of results for a given
search query and it is not absolute value. Therefore, setting `min_score` too
high can lead to 0 results because it can be higher than any result's `_score`.
Please refer to `Elasticsearch min_score documentation
<https://www.elastic.co/guide/en/elasticsearch/reference/current/
search-request-min-score.html>`_ for more information.
"""
SEARCH_INDEX_PREFIX = ''
"""Any index, alias and templates will be prefixed with this string.
Useful to host multiple instances of the app on the same Elasticsearch cluster,
for example on one app you can set it to `dev-` and on the other to `prod-`,
and each will create non-colliding indices prefixed with the corresponding
string.
Usage example:
.. code-block:: python
# in your config.py
SEARCH_INDEX_PREFIX = 'prod-'
For templates, ensure that the prefix `__SEARCH_INDEX_PREFIX__` is added to
your index names. This pattern will be replaced by the prefix config value.
Usage example in your template.json:
.. code-block:: json
{
"index_patterns": ["__SEARCH_INDEX_PREFIX__myindex-name-*"]
}
"""
| Java |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class SettingController
*
* @author The scaffold-interface created at 2016-08-25 01:07:35am
* @link https://github.com/amranidev/scaffold-interface
*/
class Setting extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $table = 'avatars';
}
| Java |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>DSJCL</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/modern-business.css" rel="stylesheet">
</head>
<body>
<!-- Navigation -->
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="index.html">Home</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="about.html">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link" href="services.html">Constitution</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">State and Nationals</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownPortfolio" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
More
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownPortfolio">
<a class="dropdown-item" href="portfolio-1-col.html">Announcements</a>
<a class="dropdown-item" href="portfolio-2-col.html">Event Schedule</a>
<a class="dropdown-item" href="portfolio-3-col.html">Officers</a>
<a class="dropdown-item" href="portfolio-4-col.html">About JCL</a>
<a class="dropdown-item" href="portfolio-item.html">Important Documents</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownBlog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
The Torch
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownBlog">
<a class="dropdown-item" href="blog-home-1.html">Edition 1</a>
<a class="dropdown-item" href="blog-home-2.html">Edtion 2</a>
<a class="dropdown-item" href="blog-post.html">Edition 3</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownBlog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dev
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownBlog">
<a class="dropdown-item" href="full-width.html">Full Width Page</a>
<a class="dropdown-item" href="sidebar.html">Sidebar Page</a>
<a class="dropdown-item" href="faq.html">FAQ</a>
<a class="dropdown-item" href="404.html">404</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page Content -->
<div class="container">
<!-- Page Heading/Breadcrumbs -->
<h1 class="mt-4 mb-3">State and Nationals
<small></small>
</h1>
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.html">Home</a>
</li>
<li class="breadcrumb-item active">State and Nationals</li>
</ol>
<!-- Image Header -->
<img class="img-fluid rounded mb-4" src="http://placehold.it/1200x300" alt="">
<!-- Marketing Icons Section -->
<div class="row">
<div class="col-lg-4 mb-4">
<div class="card h-100">
<h4 class="card-header">Card Title</h4>
<div class="card-body">
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente esse necessitatibus neque.</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Learn More</a>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100">
<h4 class="card-header">Card Title</h4>
<div class="card-body">
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis ipsam eos, nam perspiciatis natus commodi similique totam consectetur praesentium molestiae atque exercitationem ut consequuntur, sed eveniet, magni nostrum sint fuga.</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Learn More</a>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100">
<h4 class="card-header">Card Title</h4>
<div class="card-body">
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente esse necessitatibus neque.</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Learn More</a>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
<!-- Footer -->
<footer class="py-5 bg-dark">
<div class="container">
<p class="m-0 text-center text-white">Copyright © All rights reserved Whitergirl279 2017</p>
</div>
<!-- /.container -->
</footer>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/popper/popper.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
| Java |
package net.robobalasko.dfa.gui;
import net.robobalasko.dfa.core.Automaton;
import net.robobalasko.dfa.core.exceptions.NodeConnectionMissingException;
import net.robobalasko.dfa.core.exceptions.StartNodeMissingException;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MainFrame extends JFrame {
private final Automaton automaton;
private JButton checkButton;
public MainFrame(final Automaton automaton) throws HeadlessException {
super("DFA Simulator");
this.automaton = automaton;
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JPanel containerPanel = new JPanel();
containerPanel.setLayout(new BoxLayout(containerPanel, BoxLayout.PAGE_AXIS));
containerPanel.setBorder(new EmptyBorder(20, 20, 20, 20));
setContentPane(containerPanel);
CanvasPanel canvasPanel = new CanvasPanel(this, automaton);
containerPanel.add(canvasPanel);
JPanel checkInputPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
containerPanel.add(checkInputPanel);
final JTextField inputText = new JTextField(40);
Document document = inputText.getDocument();
document.addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
checkButton.setEnabled(e.getDocument().getLength() > 0);
}
@Override
public void removeUpdate(DocumentEvent e) {
checkButton.setEnabled(e.getDocument().getLength() > 0);
}
@Override
public void changedUpdate(DocumentEvent e) {
checkButton.setEnabled(e.getDocument().getLength() > 0);
}
});
checkInputPanel.add(inputText);
checkButton = new JButton("Check");
checkButton.setEnabled(false);
checkButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
JOptionPane.showMessageDialog(MainFrame.this,
automaton.acceptsString(inputText.getText())
? "Input accepted."
: "Input rejected.");
} catch (StartNodeMissingException ex) {
JOptionPane.showMessageDialog(MainFrame.this, "Missing start node.");
} catch (NodeConnectionMissingException ex) {
JOptionPane.showMessageDialog(MainFrame.this, "Not a good string. Automat doesn't accept it.");
}
}
});
checkInputPanel.add(checkButton);
setResizable(false);
setVisible(true);
pack();
}
}
| Java |
---
types:
- utility
id: d5ee1b1e-0ffa-45cd-b3aa-bfecb9a93325
---
Converts all tabs in a string to a given number of spaces, `4` by default. This is a boring modifier to output examples of. Here's just a few examples on how the syntax looks.
```
{{ string | to_spaces }}
{{ string | to_spaces:2 }}
```
| Java |
from __future__ import unicode_literals
from django.apps import AppConfig
class RfhistoryConfig(AppConfig):
name = 'RFHistory'
| Java |
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "main.h"
#include "db.h"
#include "init.h"
#include "bitcoinrpc.h"
using namespace json_spirit;
using namespace std;
// Return average network hashes per second based on the last 'lookup' blocks,
// or from the last difficulty change if 'lookup' is nonpositive.
// If 'height' is nonnegative, compute the estimate at the time when a given block was found.
Value GetNetworkHashPS(int lookup, int height) {
CBlockIndex *pb = pindexBest;
if (height >= 0 && height < nBestHeight)
pb = FindBlockByHeight(height);
if (pb == NULL || !pb->nHeight)
return 0;
// If lookup is -1, then use blocks since last difficulty change.
if (lookup <= 0)
lookup = pb->nHeight % 2016 + 1;
// If lookup is larger than chain, then set it to chain length.
if (lookup > pb->nHeight)
lookup = pb->nHeight;
CBlockIndex *pb0 = pb;
int64 minTime = pb0->GetBlockTime();
int64 maxTime = minTime;
for (int i = 0; i < lookup; i++) {
pb0 = pb0->pprev;
int64 time = pb0->GetBlockTime();
minTime = std::min(time, minTime);
maxTime = std::max(time, maxTime);
}
// In case there's a situation where minTime == maxTime, we don't want a divide by zero exception.
if (minTime == maxTime)
return 0;
uint256 workDiff = pb->nChainWork - pb0->nChainWork;
int64 timeDiff = maxTime - minTime;
return (boost::int64_t)(workDiff.getdouble() / timeDiff);
}
Value getnetworkhashps(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"getnetworkhashps [blocks] [height]\n"
"Returns the estimated network hashes per second based on the last 120 blocks.\n"
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
"Pass in [height] to estimate the network speed at the time when a certain block was found.");
return GetNetworkHashPS(params.size() > 0 ? params[0].get_int() : 120, params.size() > 1 ? params[1].get_int() : -1);
}
// Key used by getwork/getblocktemplate miners.
// Allocated in InitRPCMining, free'd in ShutdownRPCMining
static CReserveKey* pMiningKey = NULL;
void InitRPCMining()
{
if (!pwalletMain)
return;
// getwork/getblocktemplate mining rewards paid here:
pMiningKey = new CReserveKey(pwalletMain);
}
void ShutdownRPCMining()
{
if (!pMiningKey)
return;
delete pMiningKey; pMiningKey = NULL;
}
Value getgenerate(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getgenerate\n"
"Returns true or false.");
if (!pMiningKey)
return false;
return GetBoolArg("-gen");
}
Value setgenerate(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"setgenerate <generate> [genproclimit]\n"
"<generate> is true or false to turn generation on or off.\n"
"Generation is limited to [genproclimit] processors, -1 is unlimited.");
bool fGenerate = true;
if (params.size() > 0)
fGenerate = params[0].get_bool();
if (params.size() > 1)
{
int nGenProcLimit = params[1].get_int();
mapArgs["-genproclimit"] = itostr(nGenProcLimit);
if (nGenProcLimit == 0)
fGenerate = false;
}
mapArgs["-gen"] = (fGenerate ? "1" : "0");
assert(pwalletMain != NULL);
GenerateBitcoins(fGenerate, pwalletMain);
return Value::null;
}
Value gethashespersec(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"gethashespersec\n"
"Returns a recent hashes per second performance measurement while generating.");
if (GetTimeMillis() - nHPSTimerStart > 8000)
return (boost::int64_t)0;
return (boost::int64_t)dHashesPerSec;
}
Value getmininginfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getmininginfo\n"
"Returns an object containing mining-related information.");
Object obj;
obj.push_back(Pair("blocks", (int)nBestHeight));
obj.push_back(Pair("currentblocksize",(uint64_t)nLastBlockSize));
obj.push_back(Pair("currentblocktx",(uint64_t)nLastBlockTx));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("errors", GetWarnings("statusbar")));
obj.push_back(Pair("generate", GetBoolArg("-gen")));
obj.push_back(Pair("genproclimit", (int)GetArg("-genproclimit", -1)));
obj.push_back(Pair("hashespersec", gethashespersec(params, false)));
obj.push_back(Pair("networkhashps", getnetworkhashps(params, false)));
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
obj.push_back(Pair("testnet", fTestNet));
return obj;
}
Value getworkex(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"getworkex [data, coinbase]\n"
"If [data, coinbase] is not specified, returns extended work data.\n"
);
if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Riestercoin is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Riestercoin is downloading blocks...");
typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
static mapNewBlock_t mapNewBlock; // FIXME: thread safety
static vector<CBlockTemplate*> vNewBlockTemplate;
static CReserveKey reservekey(pwalletMain);
if (params.size() == 0)
{
// Update block
static unsigned int nTransactionsUpdatedLast;
static CBlockIndex* pindexPrev;
static int64 nStart;
static CBlockTemplate* pblocktemplate;
if (pindexPrev != pindexBest ||
(nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60))
{
if (pindexPrev != pindexBest)
{
// Deallocate old blocks since they're obsolete now
mapNewBlock.clear();
BOOST_FOREACH(CBlockTemplate* pblocktemplate, vNewBlockTemplate)
delete pblocktemplate;
vNewBlockTemplate.clear();
}
// Clear pindexPrev so future getworks make a new block, despite any failures from here on
pindexPrev = NULL;
// Store the pindexBest used before CreateNewBlock, to avoid races
nTransactionsUpdatedLast = nTransactionsUpdated;
CBlockIndex* pindexPrevNew = pindexBest;
nStart = GetTime();
// Create new block
pblocktemplate = CreateNewBlockWithKey(*pMiningKey);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
vNewBlockTemplate.push_back(pblocktemplate);
// Need to update only after we know CreateNewBlock succeeded
pindexPrev = pindexPrevNew;
}
CBlock* pblock = &pblocktemplate->block; // pointer for convenience
// Update nTime
pblock->UpdateTime(pindexPrev);
pblock->nNonce = 0;
// Update nExtraNonce
static unsigned int nExtraNonce = 0;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
// Save
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig);
// Pre-build hash buffers
char pmidstate[32];
char pdata[128];
char phash1[64];
FormatHashBuffers(pblock, pmidstate, pdata, phash1);
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
CTransaction coinbaseTx = pblock->vtx[0];
std::vector<uint256> merkle = pblock->GetMerkleBranch(0);
Object result;
result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata))));
result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget))));
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << coinbaseTx;
result.push_back(Pair("coinbase", HexStr(ssTx.begin(), ssTx.end())));
Array merkle_arr;
BOOST_FOREACH(uint256 merkleh, merkle) {
printf("%s\n", merkleh.ToString().c_str());
merkle_arr.push_back(HexStr(BEGIN(merkleh), END(merkleh)));
}
result.push_back(Pair("merkle", merkle_arr));
return result;
}
else
{
// Parse parameters
vector<unsigned char> vchData = ParseHex(params[0].get_str());
vector<unsigned char> coinbase;
if(params.size() == 2)
coinbase = ParseHex(params[1].get_str());
if (vchData.size() != 128)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");
CBlock* pdata = (CBlock*)&vchData[0];
// Byte reverse
for (int i = 0; i < 128/4; i++)
((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]);
// Get saved block
if (!mapNewBlock.count(pdata->hashMerkleRoot))
return false;
CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
pblock->nTime = pdata->nTime;
pblock->nNonce = pdata->nNonce;
if(coinbase.size() == 0)
pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
else
CDataStream(coinbase, SER_NETWORK, PROTOCOL_VERSION) >> pblock->vtx[0];
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
return CheckWork(pblock, *pwalletMain, reservekey);
}
}
Value getwork(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"getwork [data]\n"
"If [data] is not specified, returns formatted hash data to work on:\n"
" \"midstate\" : precomputed hash state after hashing the first half of the data (DEPRECATED)\n" // deprecated
" \"data\" : block data\n"
" \"hash1\" : formatted hash buffer for second hash (DEPRECATED)\n" // deprecated
" \"target\" : little endian hash target\n"
"If [data] is specified, tries to solve the block and returns true if it was successful.");
if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Riestercoin is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Riestercoin is downloading blocks...");
typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
static mapNewBlock_t mapNewBlock; // FIXME: thread safety
static vector<CBlockTemplate*> vNewBlockTemplate;
if (params.size() == 0)
{
// Update block
static unsigned int nTransactionsUpdatedLast;
static CBlockIndex* pindexPrev;
static int64 nStart;
static CBlockTemplate* pblocktemplate;
if (pindexPrev != pindexBest ||
(nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60))
{
if (pindexPrev != pindexBest)
{
// Deallocate old blocks since they're obsolete now
mapNewBlock.clear();
BOOST_FOREACH(CBlockTemplate* pblocktemplate, vNewBlockTemplate)
delete pblocktemplate;
vNewBlockTemplate.clear();
}
// Clear pindexPrev so future getworks make a new block, despite any failures from here on
pindexPrev = NULL;
// Store the pindexBest used before CreateNewBlock, to avoid races
nTransactionsUpdatedLast = nTransactionsUpdated;
CBlockIndex* pindexPrevNew = pindexBest;
nStart = GetTime();
// Create new block
pblocktemplate = CreateNewBlockWithKey(*pMiningKey);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
vNewBlockTemplate.push_back(pblocktemplate);
// Need to update only after we know CreateNewBlock succeeded
pindexPrev = pindexPrevNew;
}
CBlock* pblock = &pblocktemplate->block; // pointer for convenience
// Update nTime
pblock->UpdateTime(pindexPrev);
pblock->nNonce = 0;
// Update nExtraNonce
static unsigned int nExtraNonce = 0;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
// Save
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig);
// Pre-build hash buffers
char pmidstate[32];
char pdata[128];
char phash1[64];
FormatHashBuffers(pblock, pmidstate, pdata, phash1);
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
Object result;
result.push_back(Pair("midstate", HexStr(BEGIN(pmidstate), END(pmidstate)))); // deprecated
result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata))));
result.push_back(Pair("hash1", HexStr(BEGIN(phash1), END(phash1)))); // deprecated
result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget))));
return result;
}
else
{
// Parse parameters
vector<unsigned char> vchData = ParseHex(params[0].get_str());
if (vchData.size() != 128)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");
CBlock* pdata = (CBlock*)&vchData[0];
// Byte reverse
for (int i = 0; i < 128/4; i++)
((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]);
// Get saved block
if (!mapNewBlock.count(pdata->hashMerkleRoot))
return false;
CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
pblock->nTime = pdata->nTime;
pblock->nNonce = pdata->nNonce;
pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
assert(pwalletMain != NULL);
return CheckWork(pblock, *pwalletMain, *pMiningKey);
}
}
Value getblocktemplate(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"getblocktemplate [params]\n"
"Returns data needed to construct a block to work on:\n"
" \"version\" : block version\n"
" \"previousblockhash\" : hash of current highest block\n"
" \"transactions\" : contents of non-coinbase transactions that should be included in the next block\n"
" \"coinbaseaux\" : data that should be included in coinbase\n"
" \"coinbasevalue\" : maximum allowable input to coinbase transaction, including the generation award and transaction fees\n"
" \"target\" : hash target\n"
" \"mintime\" : minimum timestamp appropriate for next block\n"
" \"curtime\" : current timestamp\n"
" \"mutable\" : list of ways the block template may be changed\n"
" \"noncerange\" : range of valid nonces\n"
" \"sigoplimit\" : limit of sigops in blocks\n"
" \"sizelimit\" : limit of block size\n"
" \"bits\" : compressed target of next block\n"
" \"height\" : height of the next block\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.");
std::string strMode = "template";
if (params.size() > 0)
{
const Object& oparam = params[0].get_obj();
const Value& modeval = find_value(oparam, "mode");
if (modeval.type() == str_type)
strMode = modeval.get_str();
else if (modeval.type() == null_type)
{
/* Do nothing */
}
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
}
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Riestercoin is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Riestercoin is downloading blocks...");
// Update block
static unsigned int nTransactionsUpdatedLast;
static CBlockIndex* pindexPrev;
static int64 nStart;
static CBlockTemplate* pblocktemplate;
if (pindexPrev != pindexBest ||
(nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 5))
{
// Clear pindexPrev so future calls make a new block, despite any failures from here on
pindexPrev = NULL;
// Store the pindexBest used before CreateNewBlock, to avoid races
nTransactionsUpdatedLast = nTransactionsUpdated;
CBlockIndex* pindexPrevNew = pindexBest;
nStart = GetTime();
// Create new block
if(pblocktemplate)
{
delete pblocktemplate;
pblocktemplate = NULL;
}
CScript scriptDummy = CScript() << OP_TRUE;
pblocktemplate = CreateNewBlock(scriptDummy);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
// Need to update only after we know CreateNewBlock succeeded
pindexPrev = pindexPrevNew;
}
CBlock* pblock = &pblocktemplate->block; // pointer for convenience
// Update nTime
pblock->UpdateTime(pindexPrev);
pblock->nNonce = 0;
Array transactions;
map<uint256, int64_t> setTxIndex;
int i = 0;
BOOST_FOREACH (CTransaction& tx, pblock->vtx)
{
uint256 txHash = tx.GetHash();
setTxIndex[txHash] = i++;
if (tx.IsCoinBase())
continue;
Object entry;
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
entry.push_back(Pair("data", HexStr(ssTx.begin(), ssTx.end())));
entry.push_back(Pair("hash", txHash.GetHex()));
Array deps;
BOOST_FOREACH (const CTxIn &in, tx.vin)
{
if (setTxIndex.count(in.prevout.hash))
deps.push_back(setTxIndex[in.prevout.hash]);
}
entry.push_back(Pair("depends", deps));
int index_in_template = i - 1;
entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template]));
entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template]));
transactions.push_back(entry);
}
Object aux;
aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
static Array aMutable;
if (aMutable.empty())
{
aMutable.push_back("time");
aMutable.push_back("transactions");
aMutable.push_back("prevblock");
}
Object result;
result.push_back(Pair("version", pblock->nVersion));
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
result.push_back(Pair("transactions", transactions));
result.push_back(Pair("coinbaseaux", aux));
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
result.push_back(Pair("target", hashTarget.GetHex()));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
result.push_back(Pair("mutable", aMutable));
result.push_back(Pair("noncerange", "00000000ffffffff"));
result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS));
result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));
result.push_back(Pair("curtime", (int64_t)pblock->nTime));
result.push_back(Pair("bits", HexBits(pblock->nBits)));
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));
return result;
}
Value submitblock(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"submitblock <hex data> [optional-params-obj]\n"
"[optional-params-obj] parameter is currently ignored.\n"
"Attempts to submit new block to network.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.");
vector<unsigned char> blockData(ParseHex(params[0].get_str()));
CDataStream ssBlock(blockData, SER_NETWORK, PROTOCOL_VERSION);
CBlock pblock;
try {
ssBlock >> pblock;
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
}
CValidationState state;
bool fAccepted = ProcessBlock(state, NULL, &pblock);
if (!fAccepted)
return "rejected"; // TODO: report validation state
return Value::null;
}
| Java |
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Interlude</title>
</head>
<link href="css/interlude.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>
<script src="lib/interlude.js"></script>
<script src="lib/CV_particles.js"></script>
<style>
#sample
{
position: absolute;
left: 10%;
top: 10%;
width: 80%;
height: 80%;
background: yellow;
}
</style>
<script>
function start() {
var o = {};
o.div = "sample";
o.centered = true;
// var a = new Interlude.Loading(o);
// var x = new Interlude.Forms(o);
var p = {};
p.div = "sample";
var z = new Particles(p);
};
$( document ).ready(function() {
$("#sample").click(function(){
start();
});
});
</script>
<body>
<!-- Invisible comment -->
<div id = "sample"></div>
</body>
</html> | Java |
#ifndef _PARSER_HPP
#define _PARSER_HPP
#include <cassert>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include "toyobj.hpp"
#include "lexer.hpp"
#include "toy.hpp"
#include "ast.hpp"
class ParserContext {
public:
explicit ParserContext(LexerContext &lexer)
: lexer_(lexer) { lexer_.fetchtok(); }
AST *parse_ast(bool);
private:
Statement *parse_statement();
Statement *parse_while();
Statement *parse_if();
Statement *parse_return();
Statement *parse_def();
Expression *parse_expression();
Expression *parse_primary();
Expression *parse_binary_op_expression(Expression*, int);
Expression *parse_paren_expression();
Expression *parse_number();
Expression *parse_string();
Expression *parse_word_expression();
AST *parse_block();
int get_prec(TokenType) const;
inline const Token *curtok() { return lexer_.curtok(); }
inline void eat_token(TokenType type) {
if (type != curtok()->type()) {
std::cout << "I was expecting " << Token::token_type_name(type) << " but got " << curtok()->name() << std::endl;
exit(1);
}
lexer_.fetchtok();
}
LexerContext &lexer_;
DISALLOW_COPY_AND_ASSIGN(ParserContext);
};
#endif
| Java |
require 'aws-sdk'
require 'awspec/resource_reader'
require 'awspec/helper/finder'
module Awspec::Type
class Base
include Awspec::Helper::Finder
include Awspec::BlackListForwardable
attr_accessor :account
def resource_via_client
raise 'this method must be override!'
end
def to_s
type = self.class.name.demodulize.underscore
"#{type} '#{@display_name}'"
end
def inspect
to_s
end
def self.tags_allowed
define_method :has_tag? do |key, value|
begin
tags = resource_via_client.tags
rescue NoMethodError
tags = resource_via_client.tag_set
end
return false unless tags
tags.any? { |t| t['key'] == key && t['value'] == value }
end
end
def method_missing(name)
name_str = name.to_s if name.class == Symbol
describe = name_str.tr('-', '_').to_sym
if !resource_via_client.nil? && resource_via_client.members.include?(describe)
resource_via_client[describe]
else
super unless self.respond_to?(:resource)
method_missing_via_black_list(name, delegate_to: resource)
end
end
end
end
| Java |
## Next
* Improved Spotlight support for favorites. - alloy
## 2.3.0 (2015.09.18)
* Add support for Universal Links on iOS 9. - alloy
* Add support for Web-to-Native Handoff. - alloy
* Make CircleCI work again by adding the `build` action to the `test` task to ensure the simulator is running. - alloy
* Remove `?foo=bar` parameter from Martsy calls - jorystiefel
* Convert all web views to use WKWebView - orta
* Re-installed all pods with current CocoaPods version, ensuring they’re installed from the new ‘externals’ cache. If running `pod install` changes checksums in `Podfile.lock` for you, then delete your `Pods` checkout and run `pod install` again. - alloy
* NSUserActivity object creation to support Spotlight Search and Handoff - jorystiefel
* Add Spotlight support for favorite artworks, artists, and genes. - alloy
| Java |
//
// EPTTimer.h
// PodcastTimer
//
// Created by Eric Jones on 6/7/14.
// Copyright (c) 2014 Effective Programming. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol EPTTimerDelegate <NSObject>
- (void)timerFired;
@end
@interface EPTTimer : NSObject
@property (nonatomic) id<EPTTimerDelegate> delegate;
- (void)scheduleTimer;
- (void)stopTimer;
@end
| Java |
---
layout: page
title: Floyd Aerospace Seminar
date: 2016-05-24
author: Jonathan Jarvis
tags: weekly links, java
status: published
summary: Etiam dictum facilisis massa, iaculis varius.
banner: images/banner/wedding.jpg
booking:
startDate: 09/21/2019
endDate: 09/24/2019
ctyhocn: BTVMVHX
groupCode: FAS
published: true
---
Mauris non sodales arcu. In sit amet eleifend diam. Donec pretium arcu eget nisi feugiat, eu auctor mauris rutrum. Ut aliquet ante a tellus placerat elementum tincidunt sed orci. Donec sollicitudin, nisi quis tempor vestibulum, lectus sapien sollicitudin elit, vulputate placerat mi nisi sed nisl. Phasellus feugiat libero et laoreet venenatis. Pellentesque id lacus a tortor malesuada consectetur. Integer eget risus magna. Nullam rhoncus sem sit amet elementum tristique. Nunc vitae ipsum elementum, vehicula dolor id, volutpat sem. Suspendisse odio lectus, sagittis sit amet nisi vel, condimentum pretium mi. Curabitur auctor sed lorem at eleifend. Nunc at nunc rhoncus ipsum tempus tempor. Fusce et posuere libero.
1 Duis condimentum ligula nec metus laoreet, sit amet porta arcu fermentum.
Duis mollis, mauris in porta dictum, justo neque interdum ipsum, eget placerat nulla urna vel dui. Mauris vel pellentesque turpis. Aenean nibh magna, eleifend at sem id, vestibulum auctor lorem. Quisque at ipsum efficitur, viverra magna vitae, ultrices dolor. Aenean dignissim faucibus ex, ac ornare mauris gravida a. Aenean magna neque, eleifend sit amet aliquam vel, sodales id orci. Nam viverra lacus sit amet nibh tincidunt pretium. Morbi pellentesque metus quis nulla ultricies tristique id euismod tellus.
| Java |
package core
import (
. "github.com/smartystreets/goconvey/convey"
"strings"
"testing"
)
func TestValidateSymbol(t *testing.T) {
Convey("Given a node name validation function", t, func() {
cases := []struct {
title string
name string
success bool
}{
{"an empty string", "", false},
{"one alphabet name", "a", true},
{"one digit name", "0", false},
{"one underscore name", "_", false},
{"a name starting from a digit", "0test", false},
{"a name starting from an underscore", "_test", false},
{"a name only containing alphabet", "test", true},
{"a name containing alphabet-digit", "t1e2s3t4", true},
{"a name containing alphabet-digit-underscore", "t1e2_s3t4", true},
{"a name containing an invalid letter", "da-me", false},
{"a name has maximum length", strings.Repeat("a", 127), true},
{"a name longer than the maximum length", strings.Repeat("a", 128), false},
{"a reserved word", "UNTIL", false},
{"a reserved word with different capitalization", "vaLIdaTE", false},
}
for _, c := range cases {
c := c
Convey("When validating "+c.title, func() {
if c.success {
Convey("Then it should succeed", func() {
So(ValidateSymbol(c.name), ShouldBeNil)
})
} else {
Convey("Then it should fail", func() {
So(ValidateSymbol(c.name), ShouldNotBeNil)
})
}
})
}
})
}
func TestValidateCapacity(t *testing.T) {
Convey("Given validateCapacity function", t, func() {
Convey("When passing a valid value to it", func() {
Convey("Then it should accept 0", func() {
So(validateCapacity(0), ShouldBeNil)
})
Convey("Then it should accept a maximum value", func() {
So(validateCapacity(MaxCapacity), ShouldBeNil)
})
})
Convey("When passing a too large value", func() {
Convey("Then it should fail", func() {
So(validateCapacity(MaxCapacity+1), ShouldNotBeNil)
})
})
Convey("When passing a negative value", func() {
Convey("Then it should fail", func() {
So(validateCapacity(-1), ShouldNotBeNil)
})
})
})
}
| Java |
require './lib/graph'
require './lib/path_measurer'
require './lib/path_searcher'
require './lib/path_explorer'
require './lib/exact_path_length_checker'
require './lib/max_path_distance_checker'
require './lib/max_path_length_checker'
edges = []
$stdin.each_line do | line |
line.strip!
edges.concat line.split(/\s|,\s|,/)
end
graph = Graph.new
path_measurer = PathMeasurer.new(graph)
path_searcher = PathSearcher.new(graph)
exact_path_length_checker = ExactPathLengthChecker.new(graph, 4)
max_path_length_checker = MaxPathLengthChecker.new(graph, 3)
max_path_distance_checker = MaxPathDistanceChecker.new(graph, 30)
exact_path_length_path_explorer = PathExplorer.new(graph, exact_path_length_checker)
max_path_length_path_explorer = PathExplorer.new(graph, max_path_length_checker)
max_path_distance_path_explorer = PathExplorer.new(graph, max_path_distance_checker)
edges.each do | edge |
graph.add_edge(edge[0], edge[1], edge[2..-1].to_i)
end
# 1. The distance of the route A-B-C.
puts 'Output #1: ' + path_measurer.distance(['A', 'B', 'C']).to_s
# 2. The distance of the route A-D.
puts 'Output #2: ' + path_measurer.distance(['A', 'D']).to_s
# 3. The distance of the route A-D-C.
puts 'Output #3: ' + path_measurer.distance(['A', 'D', 'C']).to_s
# 4. The distance of the route A-E-B-C-D.
puts 'Output #4: ' + path_measurer.distance(['A', 'E', 'B', 'C', 'D']).to_s
# 5. The distance of the route A-E-D.
puts 'Output #5: ' + path_measurer.distance(['A', 'E', 'D']).to_s
#
# 6. The number of trips starting at C and ending at
# C with a maximum of 3 stops.
puts 'Output #6: ' + max_path_length_path_explorer.explore('C', 'C').count.to_s
# 7. The number of trips starting at A and ending at
# C with exactly 4 stops.
puts 'Output #7: ' + exact_path_length_path_explorer.explore('A', 'C').count.to_s
# 8. The length of the shortest route (in terms of
# distance to travel) from A to C.
puts 'Output #8: ' + path_searcher.shortest_path('A', 'C').to_s
# 9. The length of the shortest route (in terms of
# distance to travel) from B to B.
puts 'Output #9: ' + path_searcher.shortest_path('B', 'B').to_s
# 10. The number of different routes from C to C with
# a distance of less than 30.
puts 'Output #10: ' + max_path_distance_path_explorer.explore('C', 'C').count.to_s
| Java |
export default {
FETCH_TAGS_PENDING: Symbol("FETCH_TAGS_PENDING"),
FETCH_TAGS_SUCCESS: Symbol("FETCH_TAGS_SUCCESS"),
FETCH_TAGS_FAILURE: Symbol("FETCH_TAGS_FAILURE"),
FILTER_TAGS: Symbol("FILTER_TAGS"),
ORDER_TAGS: Symbol("ORDER_TAGS")
};
| Java |
<?php
/**
* summary
*/
class Product extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('product_model');
}
function index(){
$total = $this->product_model->get_total();
$this->data['total'] = $total;
//load thu vien phan trang
$this->load->library('pagination');
$config = array();
$config['base_url'] = admin_url('product/index');
$config['total_rows'] = $total;
$config['per_page'] = 5;
$config['uri_segment'] = 4;
$config['next_link'] = "Trang ke tiep";
$config['prev_link'] = "Trang truoc";
$this->pagination->initialize($config);
/*end phan trang*/
/*load trang*/
$segment = $this->uri->segment(4);
$segment = intval($segment);
$input = array();
$input['limit'] = array($config['per_page'],$segment);
/*loc theo id*/
$id = $this->input->get('id');
$id = intval($id);
$input['where'] = array();
if ($id > 0) {
$input['where']['id'] = $id;
}
/*loc theo ten*/
$name = $this->input->get('name');
if ($name) {
$input['like'] = array('name',$name);
}
/*loc theo danh muc*/
$catalog_id = $this->input->get('catalog');
$catalog_id = intval($catalog_id);
if ($catalog_id > 0) {
$input['where']['catalog_id'] = $catalog_id;
}
$list = $this->product_model->get_list($input);
$this->data['list'] = $list;
/* end loc */
/* end load phan trang*/
/*lay danh muc san pham*/
$this->load->model('catalog_model');
$input = array();
$input['where'] = array('parent_id'=> 0);
$catalogs = $this->catalog_model->get_list($input);
foreach ($catalogs as $row) {
$input['where'] = array('parent_id'=> $row->id);
$subs = $this->catalog_model->get_list($input);
$row->subs = $subs;
}
$this->data['catalogs'] = $catalogs;
/*end lay danh muc*/
$message = $this->session->flashdata('message');
$this->data['message'] = $message;
$this->data['temp'] = 'admin/product/index';
$this->load->view('admin/main', $this->data);
}
function add(){
/*lay danh muc san pham*/
$this->load->model('catalog_model');
$input = array();
$input['where'] = array('parent_id'=> 0);
$catalogs = $this->catalog_model->get_list($input);
foreach ($catalogs as $row) {
$input['where'] = array('parent_id'=> $row->id);
$subs = $this->catalog_model->get_list($input);
$row->subs = $subs;
}
$this->data['catalogs'] = $catalogs;
/*end lay danh muc*/
$message = $this->session->flashdata('message');
$this->data['message'] = $message;
$this->load->library('form_validation');
$this->load->helper('form');
//neu ma co du lieu post len thi kiem tra
if($this->input->post())
{
$this->form_validation->set_rules('name', 'Tên', 'required');
$this->form_validation->set_rules('price', 'Gia', 'required');
$this->form_validation->set_rules('catalog', 'Thể loại', 'required');
//nhập liệu chính xác
if($this->form_validation->run())
{
//them vao csdl
$name = $this->input->post('name');
$price = $this->input->post('price');
$price = str_replace(',', '', $price);
$discount = $this->input->post('discount');
$discount = str_replace(',', '', $discount);
/*up hinh anh dai dien*/
$this->load->library('upload_library');
$upload_path = './upload/product';
$upload_data = $this->upload_library->upload($upload_path,'image' );
$image_link = '';
if (isset($upload_data['file_name']))
{
$image_link = $upload_data['file_name'];
}
/*Upload hinh anh kem theo*/
$image_list = array();
$image_list = $this->upload_library->upload_file($upload_path, 'image_list');
$image_list_json = json_encode($image_list);
$data = array(
'name' => $name,
'price' => $price,
'discount' => $discount,
'warranty' => $this->input->post('warranty'),
'gifts' => $this->input->post('gitfs'),
'meta_desc' => $this->input->post('meta_desc'),
'meta_key' => $this->input->post('meta_key'),
'site_title' => $this->input->post('site_title'),
'content' => $this->input->post('content'),
'catalog_id' => $this->input->post('catalog')
);
if($image_link != '')
{
$data['image_link'] = $image_link;
}
if(!empty($image_list))
{
$data['image_list'] = $image_list_json;
}
if($this->product_model->create($data))
{
//tạo ra nội dung thông báo
$this->session->set_flashdata('message', 'Thêm mới san pham thành công');
}else{
$this->session->set_flashdata('message', 'Không thêm được');
}
//chuyen tới trang danh sách san pham
redirect(admin_url('product'));
}
}
$this->data['temp'] = 'admin/product/add';
$this->load->view('admin/main', $this->data);
}
function edit()
{
$id = $this->uri->rsegment('3');
$product = $this->product_model->get_info($id);
if(!$product)
{
//tạo ra nội dung thông báo
$this->session->set_flashdata('message', 'Không tồn tại sản phẩm này');
redirect(admin_url('product'));
}
$this->data['product'] = $product;
//lay danh sach danh muc san pham
$this->load->model('catalog_model');
$input = array();
$input['where'] = array('parent_id' => 0);
$catalogs = $this->catalog_model->get_list($input);
foreach ($catalogs as $row)
{
$input['where'] = array('parent_id' => $row->id);
$subs = $this->catalog_model->get_list($input);
$row->subs = $subs;
}
$this->data['catalogs'] = $catalogs;
//load thư viện validate dữ liệu
$this->load->library('form_validation');
$this->load->helper('form');
//neu ma co du lieu post len thi kiem tra
if($this->input->post())
{
$this->form_validation->set_rules('name', 'Tên', 'required');
$this->form_validation->set_rules('catalog', 'Thể loại', 'required');
$this->form_validation->set_rules('price', 'Giá', 'required');
//nhập liệu chính xác
if($this->form_validation->run())
{
//them vao csdl
$name = $this->input->post('name');
$catalog_id = $this->input->post('catalog');
$price = $this->input->post('price');
$price = str_replace(',', '', $price);
$discount = $this->input->post('discount');
$discount = str_replace(',', '', $discount);
//lay ten file anh minh hoa duoc update len
$this->load->library('upload_library');
$upload_path = './upload/product';
$upload_data = $this->upload_library->upload($upload_path, 'image');
$image_link = '';
if(isset($upload_data['file_name']))
{
$image_link = $upload_data['file_name'];
}
//upload cac anh kem theo
$image_list = array();
$image_list = $this->upload_library->upload_file($upload_path, 'image_list');
$image_list_json = json_encode($image_list);
//luu du lieu can them
$data = array(
'name' => $name,
'catalog_id' => $catalog_id,
'price' => $price,
'discount' => $discount,
'warranty' => $this->input->post('warranty'),
'gifts' => $this->input->post('gifts'),
'site_title' => $this->input->post('site_title'),
'meta_desc' => $this->input->post('meta_desc'),
'meta_key' => $this->input->post('meta_key'),
'content' => $this->input->post('content'),
);
if($image_link != '')
{
$data['image_link'] = $image_link;
}
if(!empty($image_list))
{
$data['image_list'] = $image_list_json;
}
//them moi vao csdl
if($this->product_model->update($product->id, $data))
{
//tạo ra nội dung thông báo
$this->session->set_flashdata('message', 'Cập nhật dữ liệu thành công');
}else{
$this->session->set_flashdata('message', 'Không cập nhật được');
}
//chuyen tới trang danh sách
redirect(admin_url('product'));
}
}
//load view
$this->data['temp'] = 'admin/product/edit';
$this->load->view('admin/main', $this->data);
}
function del(){
$id = $this->uri->rsegment('3');
$this->_del($id);
$this->session->set_flashdata('message', 'Xoa thanh cong ');
redirect(admin_url('product'));
}
function delete_all(){
$ids = $this->input->post('ids');
foreach ($ids as $id) {
$this->_del($id);
}
$this->session->set_flashdata('message', 'Xoa thanh cong cac san pham ');
redirect(admin_url('product'));
}
private function _del($id){
$product = $this->product_model->get_info($id);
if(!$product)
{
//tạo ra nội dung thông báo
$this->session->set_flashdata('message', 'Không tồn tại sản phẩm này');
redirect(admin_url('product'));
}
$this->data['product'] = $product;
$this->product_model->delete($id);
$image_link = './upload/product'.$product->image_link;
if (file_exists($image_link)) {
unlink($image_link);
}
$image_list = json_decode($product->image_list);
foreach ($image_list as $img) {
$image_link = '.upload/product'.$img;
if (file_exists($image_link)) {
unlink($image_link);
}
}
}
}
?> | Java |
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase/app';
import {Http, Headers} from '@angular/http';
import {Router } from '@angular/router';
import 'rxjs/add/operator/map';
@Injectable()
export class AuthService {
submission: FirebaseListObservable<any>;
constructor(public afAuth: AngularFireAuth, private db: AngularFireDatabase, private router: Router){
console.log("Authentication service started");
console.log(firebase.auth());
}
login(email, pass){
this.afAuth.auth.signInWithEmailAndPassword(email, pass)
.then(res => {
console.log('Nice, logging you in!!!');
this.router.navigate(['/admin']);
});
}
checkAuth(){
this.afAuth.authState.subscribe(res => {
if (res && res.uid) {
console.log('user is logged in');
return true;
} else {
console.log('user not logged in...redirecting to welcome..');
this.router.navigate(['/login']);
return false;
}
});
}
logout() {
this.afAuth.auth.signOut();
this.router.navigate(['/']);
}
}
| Java |
/**
*
* @function
* @param {Array|arraylike} value
* @param {Function} cmd
* @param {any} context
* @returns {?}
*/
export default function eachValue(value, cmd, context, keepReverse) {
if (value === undefined || value === null) return undefined;
const size = (0 | value.length) - 1;
for (let index = size; index > -1; index -= 1) {
const i = keepReverse ? index : size - index;
const item = value[i];
const resolve = cmd.call(context || item, item, i, value, i);
if (resolve === undefined === false) {
return resolve;
}
}
return undefined;
}
| Java |
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author John Miller
* @version 1.2
* @date Sat Jan 31 20:59:02 EST 2015
* @see LICENSE (MIT style license file).
*/
package scalation.analytics
import scalation.linalgebra.{MatriD, MatrixD, VectorD}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `Centering` object is used to center the input matrix 'x'. This is done by
* subtracting the column means from each value.
*/
object Centering
{
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Center the input matrix 'x' to zero mean, columnwise, by subtracting the mean.
* @param x the input matrix to center
* @param mu_x the vector of column means of matrix x
*/
def center (x: MatriD, mu_x: VectorD): MatrixD =
{
val x_c = new MatrixD (x.dim1, x.dim2)
for (j <- 0 until x.dim2) {
x_c.setCol (j, x.col(j) - mu_x(j)) // subtract column means
} // for
x_c
} // center
} // Centering object
| Java |
const should = require('should'),
sinon = require('sinon'),
_ = require('lodash'),
settingsCache = require('../../../../server/services/settings/cache'),
common = require('../../../../server/lib/common'),
controllers = require('../../../../server/services/routing/controllers'),
TaxonomyRouter = require('../../../../server/services/routing/TaxonomyRouter'),
RESOURCE_CONFIG = require('../../../../server/services/routing/assets/resource-config'),
sandbox = sinon.sandbox.create();
describe('UNIT - services/routing/TaxonomyRouter', function () {
let req, res, next;
beforeEach(function () {
sandbox.stub(settingsCache, 'get').withArgs('permalinks').returns('/:slug/');
sandbox.stub(common.events, 'emit');
sandbox.stub(common.events, 'on');
sandbox.spy(TaxonomyRouter.prototype, 'mountRoute');
sandbox.spy(TaxonomyRouter.prototype, 'mountRouter');
req = sandbox.stub();
res = sandbox.stub();
next = sandbox.stub();
res.locals = {};
});
afterEach(function () {
sandbox.restore();
});
it('instantiate', function () {
const taxonomyRouter = new TaxonomyRouter('tag', '/tag/:slug/');
should.exist(taxonomyRouter.router);
should.exist(taxonomyRouter.rssRouter);
taxonomyRouter.taxonomyKey.should.eql('tag');
taxonomyRouter.getPermalinks().getValue().should.eql('/tag/:slug/');
common.events.emit.calledOnce.should.be.true();
common.events.emit.calledWith('router.created', taxonomyRouter).should.be.true();
taxonomyRouter.mountRouter.callCount.should.eql(1);
taxonomyRouter.mountRouter.args[0][0].should.eql('/tag/:slug/');
taxonomyRouter.mountRouter.args[0][1].should.eql(taxonomyRouter.rssRouter.router());
taxonomyRouter.mountRoute.callCount.should.eql(3);
// permalink route
taxonomyRouter.mountRoute.args[0][0].should.eql('/tag/:slug/');
taxonomyRouter.mountRoute.args[0][1].should.eql(controllers.channel);
// pagination feature
taxonomyRouter.mountRoute.args[1][0].should.eql('/tag/:slug/page/:page(\\d+)');
taxonomyRouter.mountRoute.args[1][1].should.eql(controllers.channel);
// edit feature
taxonomyRouter.mountRoute.args[2][0].should.eql('/tag/:slug/edit');
taxonomyRouter.mountRoute.args[2][1].should.eql(taxonomyRouter._redirectEditOption.bind(taxonomyRouter));
});
it('fn: _prepareContext', function () {
const taxonomyRouter = new TaxonomyRouter('tag', '/tag/:slug/');
taxonomyRouter._prepareContext(req, res, next);
next.calledOnce.should.eql(true);
res.locals.routerOptions.should.eql({
name: 'tag',
permalinks: '/tag/:slug/',
type: RESOURCE_CONFIG.QUERY.tag.resource,
data: {tag: _.omit(RESOURCE_CONFIG.QUERY.tag, 'alias')},
filter: RESOURCE_CONFIG.TAXONOMIES.tag.filter,
context: ['tag'],
slugTemplate: true,
identifier: taxonomyRouter.identifier
});
res._route.type.should.eql('channel');
});
});
| Java |
<?php
use Snscripts\HtmlHelper\Html;
use Snscripts\HtmlHelper\Services;
use Snscripts\HtmlHelper\Helpers;
class HtmlTest extends \PHPUnit_Framework_TestCase
{
public function testCanCreateInstance()
{
$this->assertInstanceOf(
'Snscripts\HtmlHelper\Html',
new Html(
new Helpers\Form(
new Services\Basic\Data
),
new Services\Basic\Router,
new Services\Basic\Assets
)
);
}
/**
* return an instance of the Html Helper
* with constructor
*/
protected function getHtml()
{
return new Html(
new Helpers\Form(
new Services\Basic\Data
),
new Services\Basic\Router,
new Services\Basic\Assets
);
}
/**
* return an instance of the Html Helper
* with constructor dissabled so we can test the constructor setters
*/
protected function getHtmlNoConstructor()
{
return $this->getMockBuilder('\Snscripts\HtmlHelper\Html')
->setMethods(array('__construct'))
->setConstructorArgs(array(false, false))
->disableOriginalConstructor()
->getMock();
}
public function testSettingValidFormObject()
{
$Html = $this->getHtmlNoConstructor();
$this->assertTrue(
$Html->setForm(
new Helpers\Form(
new Services\Basic\Data
)
)
);
}
public function testSettingInvalidFormObjectThrowsException()
{
$this->setExpectedException('InvalidArgumentException');
$Html = $this->getHtmlNoConstructor();
$Html->setForm(
new \stdClass
);
}
public function testSettingValidAbstractRouter()
{
$Html = $this->getHtmlNoConstructor();
$this->assertTrue(
$Html->setRouter(
new Services\Basic\Router
)
);
}
public function testSettingInvalidAbstractRouterThrowsException()
{
$this->setExpectedException('InvalidArgumentException');
$Html = $this->getHtmlNoConstructor();
$Html->setRouter(
new \stdClass
);
}
public function testSettingValidAbstractAssets()
{
$Html = $this->getHtmlNoConstructor();
$this->assertTrue(
$Html->setAssets(
new Services\Basic\Assets
)
);
}
public function testSettingInvalidAbstractAssetsThrowsException()
{
$this->setExpectedException('InvalidArgumentException');
$Html = $this->getHtmlNoConstructor();
$Html->setAssets(
new \stdClass
);
}
public function testTagReturnsValidDivTagWithAttributes()
{
$Html = $this->getHtml();
$this->assertSame(
'<div class="myClass" id="content">Div Contents</div>',
$Html->tag(
'div',
array(
'class' => 'myClass',
'id' => 'content'
),
'Div Contents',
true
)
);
}
public function testDivReturnsValidDivElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<div class="myClass" id="content">Div Contents</div>',
$Html->div(
'Div Contents',
array(
'class' => 'myClass',
'id' => 'content'
)
)
);
}
public function testPReturnsValidPElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<p class="intro">Paragraph Contents</p>',
$Html->p(
'Paragraph Contents',
array(
'class' => 'intro'
)
)
);
}
public function testUlReturnsValidUlElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<ul id="main ul"><li>this is a list item</li><li>this is a list item 2</li><li>sub-item<ul><li>will they work?</li><li>or won\'t they, who knows?</li></ul></li><li id="listID">subitem attr!<ul id="sub-list"><li>this is a sub item</li><li>this list should have attributes</li></ul></li></ul>',
$Html->ul(
array(
'this is a list item',
'this is a list item 2',
'sub-item' => array(
'will they work?',
'or won\'t they, who knows?'
),
'subitem attr!' => array(
'attr' => array(
'id' => 'listID'
),
'listAttr' => array(
'id' => 'sub-list'
),
'list' => array(
'this is a sub item',
'this list should have attributes'
)
)
),
array(
'id' => 'main ul'
)
)
);
}
public function testOlReturnsValidOlElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<ol id="main ol"><li>this is a list item</li><li>this is a list item 2</li><li>sub-item<ol><li>will they work?</li><li>or won\'t they, who knows?</li></ol></li><li id="listID">subitem attr!<ol id="sub-list"><li>this is a sub item</li><li>this list should have attributes</li></ol></li></ol>',
$Html->ol(
array(
'this is a list item',
'this is a list item 2',
'sub-item' => array(
'will they work?',
'or won\'t they, who knows?'
),
'subitem attr!' => array(
'attr' => array(
'id' => 'listID'
),
'listAttr' => array(
'id' => 'sub-list'
),
'list' => array(
'this is a sub item',
'this list should have attributes'
)
)
),
array(
'id' => 'main ol'
)
)
);
}
public function testListReturnsValidElements()
{
$Html = $this->getHtml();
$this->assertSame(
'<li>this is a list item</li><li>this is a list item 2</li><li>sub-item<ul><li>will they work?</li><li>or won\'t they, who knows?</li></ul></li><li id="listID">subitem attr!<ul id="sub-list"><li>this is a sub item</li><li>this list should have attributes</li></ul></li>',
$Html->processList(
array(
'this is a list item',
'this is a list item 2',
'sub-item' => array(
'will they work?',
'or won\'t they, who knows?'
),
'subitem attr!' => array(
'attr' => array(
'id' => 'listID'
),
'listAttr' => array(
'id' => 'sub-list'
),
'list' => array(
'this is a sub item',
'this list should have attributes'
)
)
)
)
);
}
public function testLinkReturnsValidElements()
{
$Html = $this->getHtml();
$this->assertSame(
'<a target="_blank" class="myClass" href="http://google.com">Google</a>',
$Html->link(
'Google',
'http://google.com',
array(
'target' => '_blank',
'class' => 'myClass'
)
)
);
}
public function testImageReturnsValidElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<img alt="This is alt text" title="This is the title" class="logo" src="/assets/img/logo.png">',
$Html->image(
'/assets/img/logo.png',
array(
'alt' => 'This is alt text',
'title' => 'This is the title',
'class' => 'logo'
)
)
);
}
public function testStyleReturnsValidElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<link media="print" rel="stylesheet" type="text/css" href="/assets/css/print.css">',
$Html->style(
'/assets/css/print.css',
array(
'media' => 'print'
)
)
);
}
public function testScriptReturnsValidElement()
{
$Html = $this->getHtml();
$this->assertSame(
'<script src="/assets/js/site.js"></script>',
$Html->script(
'/assets/js/site.js'
)
);
}
}
| Java |
<?php
/*==============================================================================
* (C) Copyright 2016,2020 John J Kauflin, All rights reserved.
*----------------------------------------------------------------------------
* DESCRIPTION: Functions to validate Admin operations (i.e. check permissions
* parameters, timing, etc.)
*----------------------------------------------------------------------------
* Modification History
* 2016-04-05 JJK Added check for AddAssessments
* 2020-08-01 JJK Re-factored to use jjklogin for authentication
* 2020-12-21 JJK Re-factored to use jjklogin package
*============================================================================*/
// Define a super global constant for the log file (this will be in scope for all functions)
define("LOG_FILE", "./php.log");
require_once 'vendor/autoload.php';
// Figure out how many levels up to get to the "public_html" root folder
$webRootDirOffset = substr_count(strstr(dirname(__FILE__),"public_html"),DIRECTORY_SEPARATOR) + 1;
// Get settings and credentials from a file in a directory outside of public_html
// (assume a settings file in the "external_includes" folder one level up from "public_html")
$extIncludePath = dirname(__FILE__, $webRootDirOffset+1).DIRECTORY_SEPARATOR.'external_includes'.DIRECTORY_SEPARATOR;
require_once $extIncludePath.'hoadbSecrets.php';
require_once $extIncludePath.'jjkloginSettings.php';
// Common functions
require_once 'php_secure/commonUtil.php';
// Common database functions and table record classes
require_once 'php_secure/hoaDbCommon.php';
use \jkauflin\jjklogin\LoginAuth;
$adminRec = new AdminRec();
try {
$userRec = LoginAuth::getUserRec($cookieNameJJKLogin,$cookiePathJJKLogin,$serverKeyJJKLogin);
if ($userRec->userName == null || $userRec->userName == '') {
throw new Exception('User is NOT logged in', 500);
}
if ($userRec->userLevel < 1) {
throw new Exception('User is NOT authorized (contact Administrator)', 500);
}
$currTimestampStr = date("Y-m-d H:i:s");
//JJK test, date = 2015-04-22 19:45:09
$adminRec->result = "Not Valid";
$adminRec->message = "";
$adminRec->userName = $userRec->userName;
$adminRec->userLevel = $userRec->userLevel;
$adminLevel = $userRec->userLevel;
$action = getParamVal("action");
$fy = getParamVal("fy");
$duesAmt = strToUSD(getParamVal("duesAmt"));
if ($adminLevel < 2) {
$adminRec->message = "You do not have permissions for this function";
$adminRec->result = "Not Valid";
} else {
$adminRec->result = "Valid";
$adminRec->message = "Continue with " . $action . "?";
if ($action == "AddAssessments") {
if (empty($duesAmt) || empty($fy)) {
$adminRec->message = "You must enter Dues Amount and Fiscal Year.";
$adminRec->result = "Not Valid";
} else {
$adminRec->message = "Are you sure you want to add assessment for Fiscal Year " . $fy . ' with Dues Amount of $' . $duesAmt .'?';
}
} else if ($action == "MarkMailed") {
$adminRec->message = "Continue to record Communication to mark paper notices as mailed?";
} else if ($action == "DuesEmailsTest") {
$adminRec->message = "Continue with TEST email of Dues Notices to show the list and send the first one to the test address?";
} else if ($action == "DuesEmails") {
$adminRec->message = "Continue with email of Dues Notices? This will create a Communication record for each email to send";
}
}
echo json_encode($adminRec);
} catch(Exception $e) {
//error_log(date('[Y-m-d H:i] '). "in " . basename(__FILE__,".php") . ", Exception = " . $e->getMessage() . PHP_EOL, 3, LOG_FILE);
$adminRec->message = $e->getMessage();
$adminRec->result = "Not Valid";
echo json_encode($adminRec);
/*
echo json_encode(
array(
'error' => $e->getMessage(),
'error_code' => $e->getCode()
)
);
*/
}
?>
| Java |
<h1>Access Denied</h1>
<p>You have logged in correctly, but you have tried to access a page without a high enough level of security clearance.</p> | Java |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="all_6.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
createResults();
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html>
| Java |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for io.js v2.0.1 - v2.3.0: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for io.js v2.0.1 - v2.3.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1_date.html">Date</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::Date Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classv8_1_1_date.html">v8::Date</a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>BooleanValue</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#afeb999e9225dad0ca8605ed3015b268b">CallAsConstructor</a>(int argc, Handle< Value > argv[])</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#ac8dea845a715de7ad43fcb073dc8c3d9">CallAsFunction</a>(Handle< Value > recv, int argc, Handle< Value > argv[])</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Cast</b>(v8::Value *obj) (defined in <a class="el" href="classv8_1_1_date.html">v8::Date</a>)</td><td class="entry"><a class="el" href="classv8_1_1_date.html">v8::Date</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Cast</b>(T *value) (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a5018c9d085aa71f65530cf1e073a04ad">Clone</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#af6966283a7d7e20779961eed434db04d">CreationContext</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_date.html#adb084ec0683d3d195ad0f78af5f6f72b">DateTimeConfigurationChangeNotification</a>(Isolate *isolate)</td><td class="entry"><a class="el" href="classv8_1_1_date.html">v8::Date</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Delete</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Delete</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>DeleteHiddenValue</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>DeletePrivate</b>(Handle< Private > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#adc2a7a92a120675bbd4c992163a20869">Equals</a>(Handle< Value > that) const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#ab2c5f7369abf08ae8f44dc84f5aa335a">FindInstanceInPrototypeChain</a>(Handle< FunctionTemplate > tmpl)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ForceSet</b>(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Get</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Get</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a435f68bb7ef0f64dd522c5c910682448">GetAlignedPointerFromInternalField</a>(int index)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a65b5a3dc93c0774594f8b0f2ab5481c8">GetAlignedPointerFromInternalField</a>(const PersistentBase< Object > &object, int index)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a7bbe987794658f20a3ec1b68326305e6">GetConstructorName</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetHiddenValue</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#ac1ece41e81a499920ec3a2a3471653bc">GetIdentityHash</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetIndexedPropertiesExternalArrayData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>GetIndexedPropertiesExternalArrayDataLength</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetIndexedPropertiesExternalArrayDataType</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>GetIndexedPropertiesPixelData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetIndexedPropertiesPixelDataLength</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#aa3324fdf652d8ac3b2f27faa0559231d">GetInternalField</a>(int index)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#ab991b53d50ab3ce53179e927e52b24f5">GetIsolate</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#aece53e208f3a25b3d5d47cfc134db49a">GetOwnPropertyDescriptor</a>(Local< String > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#aeb48075bdfb7b2b49fe08361a6c4d2a8">GetOwnPropertyNames</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>GetPrivate</b>(Handle< Private > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a45506d0a9192b023284b0211e9bf545b">GetPropertyAttributes</a>(Handle< Value > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a9f45786246c6e6027b32f685d900a41f">GetPropertyNames</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#ae8d3fed7d6dbd667c29cabb3039fe7af">GetPrototype</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a0eeeb35c6dc002a8359ebc445a49e964">GetRealNamedProperty</a>(Handle< String > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a36273f157697ff5e8e776a1461755182">GetRealNamedPropertyInPrototypeChain</a>(Handle< String > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Has</b>(Handle< Value > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Has</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a278913bcd203434870ce5184a538a9af">HasIndexedLookupInterceptor</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>HasIndexedPropertiesInExternalArrayData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasIndexedPropertiesInPixelData</b>() (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a1e96fcb9ee17101c0299ec68f2cf8610">HasNamedLookupInterceptor</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasOwnProperty</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a5b6c320c5a31e2a3ddbd464835c8e9a7">HasPrivate</a>(Handle< Private > key)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasRealIndexedProperty</b>(uint32_t index) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>HasRealNamedCallbackProperty</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>HasRealNamedProperty</b>(Handle< String > key) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Int32Value</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>IntegerValue</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#aaec28576353eebe6fee113bce2718ecc">InternalFieldCount</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a324a71142f621a32bfe5738648718370">InternalFieldCount</a>(const PersistentBase< Object > &object)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#ad06a4b1f7215d852c367df390491ac84">IsArgumentsObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#aaee0b144087d20eae02314c9393ff80f">IsArray</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a65f9dad740f2468b44dc16349611c351">IsArrayBuffer</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#ad54475d15b7e6b6e17fc80fb4570cdf2">IsArrayBufferView</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a0aceb7645e71b096df5cd73d1252b1b0">IsBoolean</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#abe7bc06283e5e66013f2f056a943168b">IsBooleanObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a23c2c1f23b50fab4a02e2f819641b865">IsCallable</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#afd20ab51e79658acc405c12dad2260ab">IsDataView</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a8bc11fab0aded4a805722ab6df173cae">IsDate</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a7ac61a325c18af8dcb6d7d5bf47d2503">IsExternal</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a68c0296071d01ca899825d7643cf495a">IsFalse</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a4effc7ca1a221dd8c1e23c0f28145ef0">IsFloat32Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a293f140b81b0219d1497e937ed948b1e">IsFloat64Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a05532a34cdd215f273163830ed8b77e7">IsFunction</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a1cbbebde8c256d051c4606a7300870c6">IsGeneratorFunction</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a72982768acdadd82d1df02a452251d14">IsGeneratorObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a928c586639dd75ae4efdaa66b1fc4d50">IsInt16Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a01e1db51c65b2feace248b7acbf71a2c">IsInt32</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a48eac78a49c8b42d9f8cf05c514b3750">IsInt32Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a10a88a2794271dfcd9c3abd565e8f28a">IsInt8Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a71ef50f22d6bb4a093cc931b3d981c08">IsMap</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#af9c52a0668fa3260a0d12a2cdf895b4e">IsMapIterator</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a8829b16b442a6231499c89fd5a6f8049">IsName</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a579fb52e893cdc24f8b77e5acc77d06d">IsNativeError</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#aa2c6ed8ef832223a7e2cd81e6ac61c78">IsNull</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a1bd51e3e55f67c65b9a8f587fbffb7c7">IsNumber</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a5f4aa9504a6d8fc3af9489330179fe14">IsNumberObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a355b7991c5c978c0341f6f961b63c5a2">IsObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a93d6a0817b15a1d28050ba16e131e6b4">IsPromise</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#aae41e43486937d6122c297a0d43ac0b8">IsRegExp</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a220bd4056471ee1dda8ab9565517edd7">IsSet</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#addbae0104e07b990ee1af0bd7927824b">IsSetIterator</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#ab23a34b7df62806808e01b0908bf5f00">IsString</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a3e0f2727455fd01a39a60b92f77e28e0">IsStringObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#af3e6081c22d09a7bbc0a2aff59ed60a5">IsSymbol</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a867baa94cb8f1069452359e6cef6751e">IsSymbolObject</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a8f27462322186b295195eecb3e81d6d7">IsTrue</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#ac2f2f6c39f14a39fbb5b43577125dfe4">IsTypedArray</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a4a45fabf58b241f5de3086a3dd0a09ae">IsUint16Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a783c89631bac4ef3c4b909f40cc2b8d8">IsUint32</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#a5e39229dc74d534835cf4ceba10676f4">IsUint32Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#acbe2cd9c9cce96ee498677ba37c8466d">IsUint8Array</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#ad3cb464ab5ef0215bd2cbdd4eb2b7e3d">IsUint8ClampedArray</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#aea287b745656baa8a12a2ae1d69744b6">IsUndefined</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#aab0297b39ed8e2a71b5dca7950228a36">IsWeakMap</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_value.html#a6f5a238206cbd95f98e2da92cab72e80">IsWeakSet</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>New</b>(Isolate *isolate, double time) (defined in <a class="el" href="classv8_1_1_date.html">v8::Date</a>)</td><td class="entry"><a class="el" href="classv8_1_1_date.html">v8::Date</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>New</b>(Isolate *isolate) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>NumberValue</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#aeb2f524c806075e5f9032a24afd86869">ObjectProtoToString</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>SameValue</b>(Handle< Value > that) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Set</b>(Handle< Value > key, Handle< Value > value) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Set</b>(uint32_t index, Handle< Value > value) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>SetAccessor</b>(Handle< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>SetAccessor</b>(Handle< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>SetAccessorProperty</b>(Local< Name > name, Local< Function > getter, Handle< Function > setter=Handle< Function >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a0ccba69581f0b5e4e672bab90f26879b">SetAlignedPointerInInternalField</a>(int index, void *value)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a2200482b09feb914dc91d8256671f7f0">SetHiddenValue</a>(Handle< String > key, Handle< Value > value)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a530f661dec20ce1a0a1b15a45195418c">SetIndexedPropertiesToExternalArrayData</a>(void *data, ExternalArrayType array_type, int number_of_elements)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a6c552c4817b9a0eff1fb12b7ef089026">SetIndexedPropertiesToPixelData</a>(uint8_t *data, int length)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#a361b1781e7db29b17b063ef31315989e">SetInternalField</a>(int index, Handle< Value > value)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>SetPrivate</b>(Handle< Private > key, Handle< Value > value) (defined in <a class="el" href="classv8_1_1_object.html">v8::Object</a>)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_object.html#ab54bbd70d60e62d8bc22a8c8a6be593e">SetPrototype</a>(Handle< Value > prototype)</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>StrictEquals</b>(Handle< Value > that) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1_value.html#ae810be0ae81a87f677592d0176daac48">ToArrayIndex</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToBoolean</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToBoolean</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToDetailString</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToDetailString</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToInt32</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToInt32</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToInteger</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToInteger</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToNumber</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToNumber</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToObject</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToObject</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToString</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToString</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>ToUint32</b>(Isolate *isolate) const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ToUint32</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_object.html#a6e9fe342c0f77995defa6b479d01a3bd">TurnOnAccessCheck</a>()</td><td class="entry"><a class="el" href="classv8_1_1_object.html">v8::Object</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Uint32Value</b>() const (defined in <a class="el" href="classv8_1_1_value.html">v8::Value</a>)</td><td class="entry"><a class="el" href="classv8_1_1_value.html">v8::Value</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1_date.html#a06800409271fe5fa74202e0fd1ec8e87">ValueOf</a>() const </td><td class="entry"><a class="el" href="classv8_1_1_date.html">v8::Date</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:49:54 for V8 API Reference Guide for io.js v2.0.1 - v2.3.0 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| Java |
<!--
Copyright 2005-2008 Adobe Systems Incorporated
Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
or a copy at http://stlab.adobe.com/licenses.html)
Some files are held under additional license.
Please see "http://stlab.adobe.com/licenses.html" for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<TITLE>Adobe Software Technology Lab: auto_ptr< X, Traits > Class Template Reference</TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
<LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>
<LINK REL="alternate" TITLE="stlab.adobe.com RSS" HREF="http://sourceforge.net/export/rss2_projnews.php?group_id=132417&rss_fulltext=1" TYPE="application/rss+xml"/>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
</head>
<body>
<div id='content'>
<table><tr>
<td colspan='5'>
<div id='opensource_banner'>
<table style='width: 100%; padding: 5px;'><tr>
<td align='left'>
<a href='index.html' style='border: none'><img src='stlab2007.jpg' alt="stlab.adobe.com"/></a>
</td>
<td align='right'>
<a href='http://www.adobe.com' style='border: none'><img src='adobe_hlogo.gif' alt="Adobe Systems Incorporated"/></a>
</td>
</tr></table>
</div>
</td></tr><tr>
<td valign="top">
<div id='navtable' height='100%'>
<div style='margin: 5px'>
<h4>Documentation</h4>
<a href="group__asl__overview.html">Overview</a><br/>
<a href="asl_readme.html">Building ASL</a><br/>
<a href="asl_toc.html">Documentation</a><br/>
<a href="http://stlab.adobe.com/wiki/index.php/Supplementary_ASL_Documentation">Library Wiki Docs</a><br/>
<a href="asl_indices.html">Indices</a><br/>
<a href="http://stlab.adobe.com/perforce/">Browse Perforce</a><br/>
<h4>More Info</h4>
<a href="asl_release_notes.html">Release Notes</a><br/>
<a href="http://stlab.adobe.com/wiki/">Wiki</a><br/>
<a href="asl_search.html">Site Search</a><br/>
<a href="licenses.html">License</a><br/>
<a href="success_stories.html">Success Stories</a><br/>
<a href="asl_contributors.html">Contributors</a><br/>
<h4>Media</h4>
<a href="http://sourceforge.net/project/showfiles.php?group_id=132417&package_id=145420">Download</a><br/>
<a href="asl_download_perforce.html">Perforce Depots</a><br/>
<h4>Support</h4>
<a href="http://sourceforge.net/projects/adobe-source/">ASL SourceForge Home</a><br/>
<a href="http://sourceforge.net/mail/?group_id=132417">Mailing Lists</a><br/>
<a href="http://sourceforge.net/forum/?group_id=132417">Discussion Forums</a><br/>
<a href="http://sourceforge.net/tracker/?atid=724218&group_id=132417&func=browse">Report Bugs</a><br/>
<a href="http://sourceforge.net/tracker/?atid=724221&group_id=132417&func=browse">Suggest Features</a><br/>
<a href="asl_contributing.html">Contribute to ASL</a><br/>
<h4>RSS</h4>
<a href="http://sourceforge.net/export/rss2_projnews.php?group_id=132417">Short-text news</a><br/>
<a href="http://sourceforge.net/export/rss2_projnews.php?group_id=132417&rss_fulltext=1">Full-text news</a><br/>
<a href="http://sourceforge.net/export/rss2_projfiles.php?group_id=132417">File releases</a><br/>
<h4>Other Adobe Projects</h4>
<a href="http://sourceforge.net/adobe/">Open @ Adobe</a><br/>
<a href="http://opensource.adobe.com/">Adobe Open Source</a><br/>
<a href="http://labs.adobe.com/">Adobe Labs</a><br/>
<a href="http://stlab.adobe.com/amg/">Adobe Media Gallery</a><br/>
<a href="http://stlab.adobe.com/performance/">C++ Benchmarks</a><br/>
<h4>Other Resources</h4>
<a href="http://boost.org">Boost</a><br/>
<a href="http://www.riaforge.com/">RIAForge</a><br/>
<a href="http://www.sgi.com/tech/stl">SGI STL</a><br/>
</div>
</div>
</td>
<td id='maintable' width="100%" valign="top">
<!-- End Header -->
<!-- Generated by Doxygen 1.7.2 -->
<div class="navpath">
<ul>
<li><a class="el" href="namespaceadobe.html">adobe</a> </li>
<li><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> </li>
</ul>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<h1>auto_ptr< X, Traits > Class Template Reference<br/>
<small>
[<a class="el" href="group__memory.html">Memory</a>]</small>
</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="adobe::auto_ptr" --><!-- doxytag: inherits="auto_resource< X *, Traits >" -->
<p>The <code><a class="el" href="classadobe_1_1auto__ptr.html" title="The adobe::auto_ptr<> template adds a number of extensions to std::auto_ptr<>.">adobe::auto_ptr</a><></code> template adds a number of extensions to <code>std::auto_ptr<></code>.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="memory_8hpp_source.html">memory.hpp</a>></code></p>
<p><a href="classadobe_1_1auto__ptr-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><b>clear_type</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><b>error_on_const_auto_type< auto_ptr< Y, typename traits_type::template rebind< Y * >::other > const ></b></td></tr>
<tr><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef traits_type::element_type </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a02574fcd6538ed96656939b0a9054092">element_type</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef traits_type::pointer_type </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a733dfdff2b2b0c1cfa60513deeabc5d6">pointer_type</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef Traits </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#aada8c38edc7a4968494c4838ecfd99ce">traits_type</a></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a4775e8d2ba24664807347605c261789a">auto_ptr</a> (<a class="el" href="classadobe_1_1auto__ptr.html#a733dfdff2b2b0c1cfa60513deeabc5d6">pointer_type</a> p=0) throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#ab0de1504f237180789f36df75ae4677e">auto_ptr</a> (<a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> &) throw ()</td></tr>
<tr><td class="memTemplParams" colspan="2">template<typename Y > </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top"> </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a2847d37d05c107bf8d268f6370dd1b42">auto_ptr</a> (std::auto_ptr< Y > r) throw ()</td></tr>
<tr><td class="memTemplParams" colspan="2">template<typename Y > </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top"> </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#ad6eb012788de2cc68c19446b54880577">auto_ptr</a> (const <a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< Y, typename traits_type::template rebind< Y * >::other > &) throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#ae5281bab050c2d379ef73fc26e5b1553">auto_ptr</a> (std::auto_ptr< X > r) throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#ad06e392b201745b8985deb5f590c10e8">operator std::auto_ptr< X ></a> () throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html#a02574fcd6538ed96656939b0a9054092">element_type</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#abfbf061d8025ca8b9c5cf9cd8ef82b88">operator*</a> () const throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html#a733dfdff2b2b0c1cfa60513deeabc5d6">pointer_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#aa02aff17e8ad44033e0f937c86b00dc6">operator-></a> () const throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a8f5b742b9a6ccb3abc0da2dabab363ff">operator=</a> (const clear_type *) throw ()</td></tr>
<tr><td class="memTemplParams" colspan="2">template<typename Y > </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> & </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a1236d88f4331aa55bbbd341701ae351c">operator=</a> (<a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< Y, typename traits_type::template rebind< Y * >::other >) throw ()</td></tr>
<tr><td class="memTemplParams" colspan="2">template<typename Y > </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> & </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a30ba978cd74937b547d341631a625bb1">operator=</a> (std::auto_ptr< Y >) throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#ac860dee02600e57ea658195f26e6b209">operator=</a> (<a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> &) throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a24996f62ff720a8c91c75f65ce27fa26">operator=</a> (std::auto_ptr< X >) throw ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classadobe_1_1auto__ptr.html#a02574fcd6538ed96656939b0a9054092">element_type</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classadobe_1_1auto__ptr.html#a7f0b260d22255dca9ff15e8951538d2e">operator[]</a> (std::size_t index) const throw ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<h3>template<typename X, class Traits = ptr_traits<X*>><br/>
class adobe::auto_ptr< X, Traits ></h3>
<p>Although <code>std::auto_ptr<></code> is a non-regular type, it has proven to be valueable especially when converting C or non-exception aware C++ to exception aware C++ code. It is also useful when dealing with C libraries (such as OS libraries) that by necisity return pointers.</p>
<p>However, <code>std::auto_ptr<></code> has a number of limitations that make use error prone, limit when it can be used, and make it's use more combursome than necessary.</p>
<p>The <code><a class="el" href="classadobe_1_1auto__ptr.html" title="The adobe::auto_ptr<> template adds a number of extensions to std::auto_ptr<>.">auto_ptr</a><></code> includes the following not present in <code>std::auto_ptr<></code>:</p>
<ul>
<li>The inclusion of ptr_traits to support alternative delete functions.</li>
<li>Proper support for array types.</li>
<li>Support for assignment from function results.</li>
<li>Safe bool casts.</li>
<li>Assignment and construction from NULL.</li>
</ul>
<p>Also, <code><a class="el" href="classadobe_1_1auto__resource.html" title="The template class auto_resource< X, Traits > provides similar functionality to auto_ptr for re...">auto_resource</a><></code> is provided for non-pointer and opaque pointer references.</p>
<p><b>Rationals:</b></p>
<p>Rational for not going with boost: scoped_ptr interface: The interface to boost:scoped_ptr is a constrained subset of <a class="el" href="classadobe_1_1auto__ptr.html" title="The adobe::auto_ptr<> template adds a number of extensions to std::auto_ptr<>.">auto_ptr</a> with out any improvements. I'm not a fan of providing a whole new interface to prevent the user from performing some operations.</p>
<p>Rational for traits instead of policies:</p>
<ul>
<li>Advantages of policies<ul>
<li>allows for per-instance state.</li>
<li>would allow for use with boost::function.</li>
</ul>
</li>
<li>Disadvanteages<ul>
<li>no real world examples to demonstrate the advantages.</li>
<li>complicates implementation to properly handle exceptions from throwing when assigning policies.</li>
<li>prohibits use of no-throw in declarations (may not be an actual disadvantage).</li>
<li>would require more complex interface for constructors.</li>
<li>would require swap be added to the interface to achieve a non-throwing swap and it is unclear how swap could be generally implemented.</li>
</ul>
</li>
</ul>
<p>In total I thought the advantages didn't warrant the effort. If someone come demonstrate a concrete instance where there would be a strong advantage I'd reconsider.</p>
<p>Differences between photoshop linear types and adobe:: types:</p>
<ul>
<li>traits_type replaces deallocator and provides custom null checks</li>
<li>Safe bool casts.</li>
<li>Assignment and construction from NULL.</li>
<li>template based constructor, assignment, and conversion</li>
</ul>
<ul>
<li>linear_resource -> <a class="el" href="classadobe_1_1auto__resource.html" title="The template class auto_resource< X, Traits > provides similar functionality to auto_ptr for re...">adobe::auto_resource</a></li>
<li>linear_base_ptr -> <a class="el" href="classadobe_1_1auto__ptr.html" title="The adobe::auto_ptr<> template adds a number of extensions to std::auto_ptr<>.">adobe::auto_ptr</a></li>
<li>linear_array<T> -> <a class="el" href="classadobe_1_1auto__ptr.html" title="The adobe::auto_ptr<> template adds a number of extensions to std::auto_ptr<>.">adobe::auto_ptr</a><T[]></li>
<li>linear_ptr -> <a class="el" href="classadobe_1_1auto__ptr.html" title="The adobe::auto_ptr<> template adds a number of extensions to std::auto_ptr<>.">adobe::auto_ptr</a> </li>
</ul>
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00398">398</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
<hr/><h2>Member Typedef Documentation</h2>
<a class="anchor" id="a02574fcd6538ed96656939b0a9054092"></a><!-- doxytag: member="adobe::auto_ptr::element_type" ref="a02574fcd6538ed96656939b0a9054092" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef traits_type::element_type <a class="el" href="classadobe_1_1auto__ptr.html#a02574fcd6538ed96656939b0a9054092">element_type</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reimplemented from <a class="el" href="classadobe_1_1auto__resource.html#a02574fcd6538ed96656939b0a9054092">auto_resource< X *, Traits ></a>.</p>
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00405">405</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a733dfdff2b2b0c1cfa60513deeabc5d6"></a><!-- doxytag: member="adobe::auto_ptr::pointer_type" ref="a733dfdff2b2b0c1cfa60513deeabc5d6" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef traits_type::pointer_type <a class="el" href="classadobe_1_1auto__ptr.html#a733dfdff2b2b0c1cfa60513deeabc5d6">pointer_type</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reimplemented from <a class="el" href="classadobe_1_1auto__resource.html#a733dfdff2b2b0c1cfa60513deeabc5d6">auto_resource< X *, Traits ></a>.</p>
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00406">406</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="aada8c38edc7a4968494c4838ecfd99ce"></a><!-- doxytag: member="adobe::auto_ptr::traits_type" ref="aada8c38edc7a4968494c4838ecfd99ce" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef Traits <a class="el" href="classadobe_1_1auto__ptr.html#aada8c38edc7a4968494c4838ecfd99ce">traits_type</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reimplemented from <a class="el" href="classadobe_1_1auto__resource.html#aada8c38edc7a4968494c4838ecfd99ce">auto_resource< X *, Traits ></a>.</p>
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00404">404</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a4775e8d2ba24664807347605c261789a"></a><!-- doxytag: member="adobe::auto_ptr::auto_ptr" ref="a4775e8d2ba24664807347605c261789a" args="(pointer_type p=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classadobe_1_1auto__ptr.html#a733dfdff2b2b0c1cfa60513deeabc5d6">pointer_type</a> </td>
<td class="paramname"> <em>p</em> = <code>0</code> )</td>
<td> throw ()<code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00529">529</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="ab0de1504f237180789f36df75ae4677e"></a><!-- doxytag: member="adobe::auto_ptr::auto_ptr" ref="ab0de1504f237180789f36df75ae4677e" args="(auto_ptr &)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00534">534</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="ad6eb012788de2cc68c19446b54880577"></a><!-- doxytag: member="adobe::auto_ptr::auto_ptr" ref="ad6eb012788de2cc68c19446b54880577" args="(const auto_ptr< Y, typename traits_type::template rebind< Y * >::other > &)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< Y, typename traits_type::template rebind< Y * >::other > & </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00540">540</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="ae5281bab050c2d379ef73fc26e5b1553"></a><!-- doxytag: member="adobe::auto_ptr::auto_ptr" ref="ae5281bab050c2d379ef73fc26e5b1553" args="(std::auto_ptr< X > r)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> </td>
<td>(</td>
<td class="paramtype">std::auto_ptr< X > </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00572">572</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a2847d37d05c107bf8d268f6370dd1b42"></a><!-- doxytag: member="adobe::auto_ptr::auto_ptr" ref="a2847d37d05c107bf8d268f6370dd1b42" args="(std::auto_ptr< Y > r)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a> </td>
<td>(</td>
<td class="paramtype">std::auto_ptr< Y > </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00578">578</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ad06e392b201745b8985deb5f590c10e8"></a><!-- doxytag: member="adobe::auto_ptr::operator std::auto_ptr< X >" ref="ad06e392b201745b8985deb5f590c10e8" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">operator std::auto_ptr< X > </td>
<td>(</td>
<td class="paramname"> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00426">426</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="abfbf061d8025ca8b9c5cf9cd8ef82b88"></a><!-- doxytag: member="adobe::auto_ptr::operator*" ref="abfbf061d8025ca8b9c5cf9cd8ef82b88" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits >::<a class="el" href="classadobe_1_1auto__ptr.html#a02574fcd6538ed96656939b0a9054092">element_type</a> & operator* </td>
<td>(</td>
<td class="paramname"> )</td>
<td> const throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00601">601</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="aa02aff17e8ad44033e0f937c86b00dc6"></a><!-- doxytag: member="adobe::auto_ptr::operator->" ref="aa02aff17e8ad44033e0f937c86b00dc6" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits >::<a class="el" href="classadobe_1_1auto__ptr.html#a733dfdff2b2b0c1cfa60513deeabc5d6">pointer_type</a> operator-> </td>
<td>(</td>
<td class="paramname"> )</td>
<td> const throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00608">608</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="ac860dee02600e57ea658195f26e6b209"></a><!-- doxytag: member="adobe::auto_ptr::operator=" ref="ac860dee02600e57ea658195f26e6b209" args="(auto_ptr &)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & operator= </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00545">545</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a24996f62ff720a8c91c75f65ce27fa26"></a><!-- doxytag: member="adobe::auto_ptr::operator=" ref="a24996f62ff720a8c91c75f65ce27fa26" args="(std::auto_ptr< X >)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & operator= </td>
<td>(</td>
<td class="paramtype">std::auto_ptr< X > </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00583">583</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a30ba978cd74937b547d341631a625bb1"></a><!-- doxytag: member="adobe::auto_ptr::operator=" ref="a30ba978cd74937b547d341631a625bb1" args="(std::auto_ptr< Y >)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & operator= </td>
<td>(</td>
<td class="paramtype">std::auto_ptr< Y > </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00591">591</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a1236d88f4331aa55bbbd341701ae351c"></a><!-- doxytag: member="adobe::auto_ptr::operator=" ref="a1236d88f4331aa55bbbd341701ae351c" args="(auto_ptr< Y, typename traits_type::template rebind< Y * >::other >)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & operator= </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< Y, typename traits_type::template rebind< Y * >::other > </td>
<td class="paramname"> <em>r</em> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00553">553</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a8f5b742b9a6ccb3abc0da2dabab363ff"></a><!-- doxytag: member="adobe::auto_ptr::operator=" ref="a8f5b742b9a6ccb3abc0da2dabab363ff" args="(const clear_type *)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits > & operator= </td>
<td>(</td>
<td class="paramtype">const clear_type * </td>
<td class="paramname"> )</td>
<td> throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00563">563</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7f0b260d22255dca9ff15e8951538d2e"></a><!-- doxytag: member="adobe::auto_ptr::operator[]" ref="a7f0b260d22255dca9ff15e8951538d2e" args="(std::size_t index) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classadobe_1_1auto__ptr.html">auto_ptr</a>< X, Traits >::<a class="el" href="classadobe_1_1auto__ptr.html#a02574fcd6538ed96656939b0a9054092">element_type</a> & operator[] </td>
<td>(</td>
<td class="paramtype">std::size_t </td>
<td class="paramname"> <em>index</em> )</td>
<td> const throw ()</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="memory_8hpp_source.html#l00615">615</a> of file <a class="el" href="memory_8hpp_source.html">memory.hpp</a>.</p>
</div>
</div>
</div>
<!-- Begin Footer -->
</td></tr>
</table>
</div> <!-- content -->
<div class='footerdiv'>
<div id='footersub'>
<ul>
<li><a href="http://www.adobe.com/go/gftray_foot_aboutadobe">Company</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_privacy_security">Online Privacy Policy</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_terms">Terms of Use</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_contact_adobe">Contact Us</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_accessibility">Accessibility</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_report_piracy">Report Piracy</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_permissions_trademarks">Permissions & Trademarks</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_product_license_agreements">Product License Agreements</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_feedback">Send Feedback</a></li>
</ul>
<div>
<p>Copyright © 2006-2007 Adobe Systems Incorporated.</p>
<p>Use of this website signifies your agreement to the <a href="http://www.adobe.com/go/gftray_foot_terms">Terms of Use</a> and <a href="http://www.adobe.com/go/gftray_foot_privacy_security">Online Privacy Policy</a>.</p>
<p>Search powered by <a href="http://www.google.com/" target="new">Google</a></p>
</div>
</div>
</div>
<script type="text/javascript">
_uacct = "UA-396569-1";
urchinTracker();
</script>
</body>
</html>
| Java |
require_relative '../user'
RSpec.describe 'Tapjoy::LDAP::API::User' do
include_context 'user'
describe '#create' do
let(:ldap_attr) {{
uid: "test.user",
cn: "Test User",
objectclass: %w(
top
posixAccount
shadowAccount
inetOrgPerson
organizationalPerson
person
ldapPublicKey),
sn: "User",
givenname: "Test",
homedirectory: "/home/test.user",
loginshell: "/bin/bash",
mail: "test.user@tapjoy.com",
uidnumber: 10001,
gidnumber: 19000,
userpassword: '{SSHA}testpass'
}}
it 'creates a user' do
ARGV << %w(create -n test user -g users); ARGV.flatten!
allow(Tapjoy::LDAP::API::User).to receive(:create_password).and_return('testpass')
expect(fake_ldap).to receive(:add).with(distinguished_name, ldap_attr)
Tapjoy::LDAP::CLI::User.commands
end
end
describe '#delete' do
it 'deletes a user' do
ARGV << %w(delete -u test.user -f); ARGV.flatten!
# Tapjoy::LDAP::API::User.create(fname, lname,
# opts[:type], opts[:group])
allow(Tapjoy::LDAP::API::User).to receive(:create_password).and_return('testpass')
expect(fake_ldap).to receive(:delete).with(distinguished_name)
Tapjoy::LDAP::CLI::User.commands
end
end
end
| Java |
import React from 'react';
import $ from 'jquery';
import _ from 'lodash';
import Block from './Block';
export default class BlockGrid extends React.Component {
constructor() {
super();
this.setDefaults();
this.setContainerWidth = this.setContainerWidth.bind(this);
this.handleWindowResize = this.handleWindowResize.bind(this);
this.resizeTimer = null;
// throttle call to this func whenever an image is loaded
this.throttledSetContainerWidth = _.throttle(this.setContainerWidth, 500);
}
setDefaults(){
this.blockWidth = 260; // initial desired block width
this.borderWidth = 5;
this.wrapperWidth = 0;
this.colCount = 0;
this.blocks = [];
this.blockCount = 0;
}
handleWindowResize(){
clearTimeout(this.resizeTimer);
const _this = this;
this.resizeTimer = setTimeout(function() {
$('.block-container').css('width', '100%');
_this.setDefaults();
_this.setContainerWidth();
// above code computes false height of blocks
// so as a lose patch re-position blocks after 500 ms
setTimeout(_this.setContainerWidth, 700);
}, 200);
}
componentDidMount(){
this.setContainerWidth();
/*
height of each block is measured with an error the first time so there are some
space between blocks specially the top values of the grid.
Only solution seems like re calculating positions of the block after few seconds
*/
// _.delay(this.setContainerWidth, 3000);
// reset all blocks when window resized
$(window).resize(this.handleWindowResize);
}
componentWillReceiveProps(nextProps){
// after clicking Load More there will be newProps here
// Re calculate block positions so no error occurs when there are
// all image less blocks
// _.delay(this.setContainerWidth, 2000);
}
componentDidUpdate(prevProps, prevState){
if(this.blockCount != this.props.data.length){
this.setDefaults();
this.setContainerWidth();
}
}
componentWillUnmount(){
$(window).off("resize", this.handleWindowResize);
}
setContainerWidth(){
// setContainerWidth only first time we recieve BlockList data
if(this.wrapperWidth == 0){
this.wrapperWidth = $('.block-container').outerWidth();
this.colCount = Math.round(this.wrapperWidth/this.blockWidth);
$('.block').css('width', this.blockWidth);
this.blockCount = document.getElementsByClassName('block').length;
if(this.blockCount < this.colCount){
this.wrapperWidth = (this.blockWidth*this.blockCount) - ( (this.blockCount - 1) * this.borderWidth);
this.colCount = this.blockCount;
} else {
this.wrapperWidth = (this.blockWidth*this.colCount) - ( (this.colCount - 1) * this.borderWidth);
}
$('.block-container').css('width', this.wrapperWidth);
}
// if wrapperWidth is already calculated than just reset block positions
for( var i = 0; i < this.colCount; i++ )
this.blocks[i] = 0;
this.setBlocks();
}
setBlocks() {
const component = this;
$('.block').each(function(){
var min = Math.min.apply(Math, component.blocks);
var index = $.inArray(min, component.blocks);
var left = index * (component.blockWidth - component.borderWidth) - component.borderWidth;
// for the first blocks that needs to overlap container border
if(left == 0)
left = - component.borderWidth;
// start with overlap on top container border
var top = min + 10 - component.borderWidth;
$(this).css({
'top' : top + 'px',
'left' : left + 'px'
});
component.blocks[index] = top + this.offsetHeight;
});
// set wrapper height
var wrapperHeight = Math.max.apply(Math, this.blocks);
wrapperHeight += this.borderWidth; // block borders
$(".block-container").css("height",wrapperHeight + 'px');
}
renderBlocks() {
const { data } = this.props;
return data.map((pin) => {
return <Block {...pin} key={pin._id} loadHandler={this.throttledSetContainerWidth}/>;
});
}
render() {
return(
<div class="row">
<div class="col-sm-offset-2 col-sm-8 col-xs-offset-1 col-xs-10">
<div class="block-container">
{ this.renderBlocks() }
</div>
</div>
</div>
);
}
}
| Java |
<?php
namespace Eni\MainBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Eni\MainBundle\Entity\Question;
use Eni\MainBundle\Entity\ReponseProposee;
class LoadReponseProposeeData extends AbstractFixture implements OrderedFixtureInterface {
public function getOrder() {
return 6;
}
public function load(ObjectManager $oManager) {
//
//Question1
//
$oQuestion1 = $this->getReference('question1');
/* @var $oQuestion1 Question */
$tReponsesProposees = [
['enonce' => 'Dim', 'valide' => true],
['enonce' => 'Public', 'valide' => false],
['enonce' => 'Aucun mot-clé', 'valide' => false],
];
foreach ($tReponsesProposees as $tReponseProposee) {
$oReponseProposee = new ReponseProposee();
$oReponseProposee
->setQuestion($oQuestion1)
->setEnonce($tReponseProposee['enonce'])
->setValide($tReponseProposee['valide']);
$oQuestion1->addReponsesProposee($oReponseProposee);
$oManager->persist($oReponseProposee);
}
//
//Question2
//
$oQuestion2 = $this->getReference('question2');
/* @var $oQuestion2 Question */
$tReponsesProposees2 = [
['enonce' => 'VS refusera de compiler la dernière ligne de code', 'valide' => false],
['enonce' => ' La valeur de Res restera à True', 'valide' => false],
['enonce' => 'La valeur de Res sera False', 'valide' => true],
['enonce' => 'Res = 4', 'valide' => false],
];
foreach ($tReponsesProposees2 as $tReponseProposee) {
$oReponseProposee = new ReponseProposee();
$oReponseProposee
->setQuestion($oQuestion2)
->setEnonce($tReponseProposee['enonce'])
->setValide($tReponseProposee['valide']);
$oQuestion2->addReponsesProposee($oReponseProposee);
$oManager->persist($oReponseProposee);
}
//
//Question3
//
$oQuestion3 = $this->getReference('question3');
/* @var $oQuestion3 Question */
$tReponsesProposees3 = [
['enonce' => 'Un', 'valide' => false],
['enonce' => 'Deux', 'valide' => true],
['enonce' => 'Trois', 'valide' => false],
];
foreach ($tReponsesProposees3 as $tReponseProposee) {
$oReponseProposee = new ReponseProposee();
$oReponseProposee
->setQuestion($oQuestion3)
->setEnonce($tReponseProposee['enonce'])
->setValide($tReponseProposee['valide']);
$oQuestion3->addReponsesProposee($oReponseProposee);
$oManager->persist($oReponseProposee);
}
//
//Question4
//
$oQuestion4 = $this->getReference('question4');
/* @var $oQuestion4 Question */
$tReponsesProposees4 = [
['enonce' => 'Vrai', 'valide' => true],
['enonce' => 'Faux', 'valide' => false],
];
foreach ($tReponsesProposees4 as $tReponseProposee) {
$oReponseProposee = new ReponseProposee();
$oReponseProposee
->setQuestion($oQuestion4)
->setEnonce($tReponseProposee['enonce'])
->setValide($tReponseProposee['valide']);
$oQuestion4->addReponsesProposee($oReponseProposee);
$oManager->persist($oReponseProposee);
}
$oManager->flush();
}
}
| Java |
{% extends "layout.html" %}
{% block page_title %} Add medication {% endblock %}
{% block head %}
{% include "includes/head.html" %}
{% include "includes/scripts.html" %}
{% endblock %}
{% block after_header %}
{{ banner.input() }}
{% endblock %}
{% block content %}
<main id="content" role="main" tabindex="-1">
<div class="grid-row" id="FEP8">
<div class="column-two-thirds">
<h1 class="heading-large">Your <span class="currentCondition"></span> medication</h1>
<p>Tell us about your current <span class="currentCondition"></span> medication, as well as medication that you have now stopped taking</p>
<div class="form-group medication">
<div id="medication" class="medication">
</div>
</div>
<div class="form-group">
<a class="bold-small" id="add" href="javascript:goInvisible('/epilepsy/medication/add')">Add more medication</a>
</div>
<div class="form-group" id="question">
<input id="continue" name="continue" class="button" type="button" value="I have finished providing medication" onclick="validate()">
</div>
</div>
{% include "includes/widgets/need-help.html" %}
</div>
</main>
{% endblock %}
{% block body_end %}
<script type="text/javascript">
$('.currentCondition').html(getCurrentConditionName());
// If no medication added yet, show different messages
var medicationList = [];
var orderedMedicationList = [];
var medicationTable = "";
generateMedicationTable();
function validate() {
var question = "Provide details of your " + getCurrentConditionName() + " medication";
var medicationPlayback = "<div class='medication'><div class='grid-row'><p>Medication</p></div>";
var currentMedicationTotal = 0;
orderedMedicationList.forEach(function(medication, index, array) {
medicationPlayback += "<div class='grid-row'>";
medicationPlayback += "<div class='column-half'><p><strong>" + medication.name + "</strong></p></div>";
medicationPlayback += "<div class='column-half'><p>" + moment(medication.start).format("DD/MM/YYYY") + " – " + (medication.end !== undefined ? moment(medication.end).format('DD/MM/YYYY') : "Current") + "</p></div>";
medicationPlayback += "</div>";
if (medication.end === undefined) {
++currentMedicationTotal;
}
});
medicationPlayback += "</div>";
addResponse("FEP", "8", question, orderedMedicationList, medicationPlayback, '/epilepsy/medication/your-medication');
if (currentMedicationTotal > 0) {
go('/epilepsy/confused-drowsy');
} else {
go('/epilepsy/regular-check-ups');
}
}
function generateMedicationTable() {
medicationTable = "";
try {
medicationList = responses["FEP"]["8"].response;
orderedMedicationList = _(medicationList).chain().sortBy(function(medication) { return medication.start; }).sortBy(function(medication) { return medication.end; }).reverse().value();
orderedMedicationList.forEach(function(medication, index) {
medicationTable += '<div class="grid-row"><div class="column-third"><p class="bold-xsmall">' + medication.name + '</p></div><div class="column-third"><p class="font-xsmall">' + moment(medication.start).format('DD/MM/YYYY') + ' – ' + (medication.end !== undefined ? moment(medication.end).format('DD/MM/YYYY') : "Current") + '</p></div><div class="column-third"><p class="bold-xsmall"><a href="javascript:change(' + index + ')">Change <a href="javascript:remove(' + index + ')">Remove</a></p></div></div>'
});
$('#medication').html(medicationTable);
if (orderedMedicationList.length === 0) {
$('#add').html('Add medication');
$('#continue').val('I have never taken ' + getCurrentConditionName() + ' medication');
}
} catch (err) {
$('#add').html('Add medication');
$('#continue').val('I have never taken ' + getCurrentConditionName() + ' medication');
}
}
function remove(index) {
if (confirm('Are you sure want to remove this medication?')) {
orderedMedicationList.splice(index, 1);
addResponse("FEP", "8", question, orderedMedicationList, "List", '/epilepsy/medication/your-medication'); // Make sure ordering changes are saved
generateMedicationTable();
}
}
function change(index) {
addResponse("FEP", "8", question, orderedMedicationList, "List", '/epilepsy/medication/your-medication'); // Make sure ordering changes are saved for correct index
goInvisible('/epilepsy/medication/edit?change=' + index);
}
</script>
{% endblock %} | Java |
package com.exasol.adapter.dialects.bigquery;
import java.sql.Connection;
import java.sql.Types;
import com.exasol.adapter.AdapterProperties;
import com.exasol.adapter.dialects.IdentifierConverter;
import com.exasol.adapter.jdbc.BaseColumnMetadataReader;
import com.exasol.adapter.jdbc.JdbcTypeDescription;
import com.exasol.adapter.metadata.DataType;
/**
* This class implements BigQuery-specific reading of column metadata.
*/
public class BigQueryColumnMetadataReader extends BaseColumnMetadataReader {
/**
* Create a new instance of the {@link BigQueryColumnMetadataReader}.
*
* @param connection connection to the remote data source
* @param properties user-defined adapter properties
* @param identifierConverter converter between source and Exasol identifiers
*/
public BigQueryColumnMetadataReader(final Connection connection, final AdapterProperties properties,
final IdentifierConverter identifierConverter) {
super(connection, properties, identifierConverter);
}
@Override
public DataType mapJdbcType(final JdbcTypeDescription jdbcTypeDescription) {
if (jdbcTypeDescription.getJdbcType() == Types.TIME) {
return DataType.createVarChar(30, DataType.ExaCharset.UTF8);
}
return super.mapJdbcType(jdbcTypeDescription);
}
}
| Java |
const chalk = require('chalk');
const Sequelize = require('sequelize');
// db server constant(s)
const dbName = 'relationshipVisualizer';
// +(process.env.NODE_ENV === 'testing' ? '_test' : '');
const url = process.env.DATABASE_URL || `postgres://localhost:5432/${dbName}`;
// notify the user we're about to do it
console.log(chalk.yellow(`Opening database connection to ${url}`))
// init the db
const db = new Sequelize(url, {
define: {
freezeTableName: true // don't go changing my table names sequelize!
},
logging: false
});
module.exports = db;
| Java |
#!/usr/bin/env bash
mkdir -p target/sandboxjava9jlink;
/usr/lib/jvm/java-9-oracle/bin/javac \
--module-path ./../java9module/target/sandboxjava9module \
-d target/sandboxjava9jlink \
$(find ./src/main/java -name "*.java")
| Java |
using System;
using Windows.Devices.Enumeration;
using Windows.Devices.Spi;
using Windows.Foundation.Metadata;
namespace ABElectronics_Win10IOT_Libraries
{
/// <summary>
/// Class for accessing the ADCDAC Pi from AB Electronics UK.
/// </summary>
public class ADCDACPi : IDisposable
{
private const string SPI_CONTROLLER_NAME = "SPI0";
private const Int32 ADC_CHIP_SELECT_LINE = 0; // ADC on SPI channel select CE0
private const Int32 DAC_CHIP_SELECT_LINE = 1; // ADC on SPI channel select CE1
private SpiDevice adc;
private double ADCReferenceVoltage = 3.3;
private SpiDevice dac;
/// <summary>
/// Event triggers when a connection is established.
/// </summary>
public bool IsConnected { get; private set; }
// Flag: Has Dispose already been called?
bool disposed = false;
// Instantiate a SafeHandle instance.
System.Runtime.InteropServices.SafeHandle handle = new Microsoft.Win32.SafeHandles.SafeFileHandle(IntPtr.Zero, true);
/// <summary>
/// Open a connection to the ADCDAC Pi.
/// </summary>
public async void Connect()
{
if (IsConnected)
{
return; // Already connected
}
if(!ApiInformation.IsTypePresent("Windows.Devices.Spi.SpiDevice"))
{
return; // This system does not support this feature: can't connect
}
try
{
// Create SPI initialization settings for the ADC
var adcsettings =
new SpiConnectionSettings(ADC_CHIP_SELECT_LINE)
{
ClockFrequency = 10000000, // SPI clock frequency of 10MHz
Mode = SpiMode.Mode0
};
var spiAqs = SpiDevice.GetDeviceSelector(SPI_CONTROLLER_NAME); // Find the selector string for the SPI bus controller
var devicesInfo = await DeviceInformation.FindAllAsync(spiAqs); // Find the SPI bus controller device with our selector string
if (devicesInfo.Count == 0)
{
return; // Controller not found
}
adc = await SpiDevice.FromIdAsync(devicesInfo[0].Id, adcsettings); // Create an ADC connection with our bus controller and SPI settings
// Create SPI initialization settings for the DAC
var dacSettings =
new SpiConnectionSettings(DAC_CHIP_SELECT_LINE)
{
ClockFrequency = 2000000, // SPI clock frequency of 20MHz
Mode = SpiMode.Mode0
};
dac = await SpiDevice.FromIdAsync(devicesInfo[0].Id, dacSettings); // Create a DAC connection with our bus controller and SPI settings
IsConnected = true; // connection established, set IsConnected to true.
// Fire the Connected event handler
Connected?.Invoke(this, EventArgs.Empty);
}
/* If initialization fails, display the exception and stop running */
catch (Exception ex)
{
IsConnected = false;
throw new Exception("SPI Initialization Failed", ex);
}
}
/// <summary>
/// Event occurs when connection is made.
/// </summary>
public event EventHandler Connected;
/// <summary>
/// Read the voltage from the selected <paramref name="channel" /> on the ADC.
/// </summary>
/// <param name="channel">1 or 2</param>
/// <returns>voltage</returns>
public double ReadADCVoltage(byte channel)
{
if (channel < 1 || channel > 2)
{
throw new ArgumentOutOfRangeException(nameof(channel));
}
var raw = ReadADCRaw(channel);
var voltage = ADCReferenceVoltage / 4096 * raw; // convert the raw value into a voltage based on the reference voltage.
return voltage;
}
/// <summary>
/// Read the raw value from the selected <paramref name="channel" /> on the ADC.
/// </summary>
/// <param name="channel">1 or 2</param>
/// <returns>Integer</returns>
public int ReadADCRaw(byte channel)
{
if (channel < 1 || channel > 2)
{
throw new ArgumentOutOfRangeException(nameof(channel));
}
CheckConnected();
var writeArray = new byte[] { 0x01, (byte) ((1 + channel) << 6), 0x00}; // create the write bytes based on the input channel
var readBuffer = new byte[3]; // this holds the output data
adc.TransferFullDuplex(writeArray, readBuffer); // transfer the adc data
var ret = (short) (((readBuffer[1] & 0x0F) << 8) + readBuffer[2]); // combine the two bytes into a single 16bit integer
return ret;
}
/// <summary>
/// Set the reference <paramref name="voltage" /> for the analogue to digital converter.
/// The ADC uses the raspberry pi 3.3V power as a <paramref name="voltage" /> reference
/// so using this method to set the reference to match the exact output
/// <paramref name="voltage" /> from the 3.3V regulator will increase the accuracy of
/// the ADC readings.
/// </summary>
/// <param name="voltage">double</param>
public void SetADCrefVoltage(double voltage)
{
CheckConnected();
if (voltage < 0.0 || voltage > 7.0)
{
throw new ArgumentOutOfRangeException(nameof(voltage), "Reference voltage must be between 0.0V and 7.0V.");
}
ADCReferenceVoltage = voltage;
}
/// <summary>
/// Set the <paramref name="voltage" /> for the selected channel on the DAC.
/// </summary>
/// <param name="channel">1 or 2</param>
/// <param name="voltage">Voltage can be between 0 and 2.047 volts</param>
public void SetDACVoltage(byte channel, double voltage)
{
// Check for valid channel and voltage variables
if (channel < 1 || channel > 2)
{
throw new ArgumentOutOfRangeException();
}
if (voltage >= 0.0 && voltage < 2.048)
{
var rawval = Convert.ToInt16(voltage / 2.048 * 4096); // convert the voltage into a raw value
SetDACRaw(channel, rawval);
}
else
{
throw new ArgumentOutOfRangeException();
}
}
/// <summary>
/// Set the raw <paramref name="value" /> from the selected <paramref name="channel" /> on the DAC.
/// </summary>
/// <param name="channel">1 or 2</param>
/// <param name="value">Value between 0 and 4095</param>
public void SetDACRaw(byte channel, short value)
{
CheckConnected();
if (channel < 1 || channel > 2)
{
throw new ArgumentOutOfRangeException();
}
// split the raw value into two bytes and send it to the DAC.
var lowByte = (byte) (value & 0xff);
var highByte = (byte) (((value >> 8) & 0xff) | ((channel - 1) << 7) | (0x1 << 5) | (1 << 4));
var writeBuffer = new [] { highByte, lowByte};
dac.Write(writeBuffer);
}
private void CheckConnected()
{
if (!IsConnected)
{
throw new InvalidOperationException("Not connected. You must call .Connect() first.");
}
}
/// <summary>
/// Dispose of the resources
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Protected implementation of Dispose pattern
/// </summary>
/// <param name="disposing"></param>
protected virtual void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing)
{
handle.Dispose();
// Free any other managed objects here.
adc?.Dispose();
adc = null;
dac?.Dispose();
dac = null;
IsConnected = false;
}
// Free any unmanaged objects here.
//
disposed = true;
}
}
} | Java |
FROM stilliard/pure-ftpd
ENV FTP_USER=ftpuser \
FTP_PASSWORD=ftpuser \
FTP_HOME_DIRECTORY=/share/ftp \
PASV_PORT_MIN=30000 \
PASV_PORT_MAX=30009 \
CONTAINER_USER_UID=ftpuser \
MAX_CLIENTS_NUMBER=50 \
MAX_CLIENTS_PER_IP=10 \
DOWNLOAD_LIMIT_KB=0 \
UPLOAD_LIMIT_KB=0 \
MAX_SIMULTANEOUS_SESSIONS=0 \
LOG_ENABLED=0
COPY run.sh /pure-ftpd/run.sh
RUN chmod u+x /pure-ftpd/run.sh
CMD ["/pure-ftpd/run.sh"]
| Java |
var system = require('system');
var args = system.args;
var url = "http://"+args[1],
filename = args[2]+".png",
timeout = args[3],
savePath = args[4],
page = require('webpage').create();
//setTimeout(function(){phantom.exit();}, timeout)
page.viewportSize = { width: 1200, height: 700 };
page.clipRect = { top: 0, left: 0, width: 1200, height: 700 };
var f = false;
page.onLoadFinished = function(status) {
console.log('Status: ' + status);
setTimeout(function(){
render(page);
phantom.exit();
}, 15000)
};
page.onResourceReceived = function(response) {
if (response.url === url && !f) {
setTimeout(function(){
render(page);
phantom.exit();
}, 15000)
f = true
}
};
function render(page) {
var resPath
if (savePath == "") {
resPath = filename
} else {
resPath = savePath + "/" + filename
}
page.render(resPath)
}
console.log("start get " + url)
page.open(url, function() {
}); | Java |
class SiteController < ApplicationController
skip_before_filter :verify_authenticity_token
no_login_required
cattr_writer :cache_timeout
def self.cache_timeout
@@cache_timeout ||= 5.minutes
end
def show_page
url = params[:url]
if Array === url
url = url.join('/')
else
url = url.to_s
end
if @page = find_page(url)
batch_page_status_refresh if (url == "/" || url == "")
process_page(@page)
set_cache_control
@performed_render ||= true
else
render :template => 'site/not_found', :status => 404
end
rescue Page::MissingRootPageError
redirect_to welcome_url
end
private
def batch_page_status_refresh
@changed_pages = []
@pages = Page.find(:all, :conditions => {:status_id => 90})
@pages.each do |page|
if page.published_at <= Time.now
page.status_id = 100
page.save
@changed_pages << page.id
end
end
expires_in nil, :private=>true, "no-cache" => true if @changed_pages.length > 0
end
def set_cache_control
if (request.head? || request.get?) && @page.cache? && live?
expires_in self.class.cache_timeout, :public => true, :private => false
else
expires_in nil, :private => true, "no-cache" => true
headers['ETag'] = ''
end
end
def find_page(url)
found = Page.find_by_url(url, live?)
found if found and (found.published? or dev?)
end
def process_page(page)
page.process(request, response)
end
def dev?
if dev_host = @config['dev.host']
request.host == dev_host
else
request.host =~ /^dev\./
end
end
def live?
not dev?
end
end
| Java |
namespace Vulcan.Core.DataAccess.Migrations.MigrationProviders
{
public enum ExecutionType
{
Insert,
InsertWithIdentity,
Update,
Delete
}
}
| Java |
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("Mithril_Kendo_WebApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mithril_Kendo_WebApp")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("1489ca50-41a3-42be-8e92-4cac9b1762d5")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| Java |
<!-- Jumbotron Header -->
<header class="jumbotron hero-spacer" style="padding: 2em; text-align: center;">
<img style="max-width:100%; max-height:100%;" src="<?=base_url()?>assets/img/slogan.png">
<!--
<h1>Read and let read!</h1>
<p>
Welcome to Discipulus, your humble start up for buying and selling books. We’re dedicated to giving you the very best experience on this website, with a focus on look, feel, functionality, and great community of likeminded people.Welcome to Discipulus, your humble start up for buying and selling books. We’re dedicated to giving you the very best experience on this website, with a focus on look, feel, functionality, and great community of likeminded people.
</p>
-->
<!-- <p><a class="btn btn-primary btn-large">Call to action!</a>-->
<!-- </p>-->
</header>
<hr>
<!-- Title -->
<!-- <div class="row">-->
<!-- <div class="col-lg-12">-->
<!-- <h3>Latest Features</h3>-->
<!-- </div>-->
<!-- </div>-->
<!-- /.row -->
<!-- Page Features -->
<div class="row text-center">
<?php
if(count($products) == 0){
echo '<center><i><h3>No data available</h3></i></center>';
}
foreach($products as $product){
?>
<div class="col-sm-3 col-lg-3 col-md-3">
<div class="thumbnail">
<div class="thumbnailx">
<img src="<?=$product->img?>" style="" alt="">
</div>
<div class="caption-ownad">
<h4><a href="<?=base_url().'shop/viewProduct/'.$product->id?>"><?=$product->title?></a></h4>
<span style="font-weight: bold;">P<?=$product->price?>.00</span>
<p style="margin-top: 0.3em;"><?=$product->description?></p>
</div>
</div>
</div>
<?php
}
?>
</div>
<!-- /.row -->
| Java |
# vimconfig
stuff from my vimrc breaks into pieces for keeping organised things more organised
### Install
On Unix execute:
```sh
#backup current vimrc file if existed
mv ~/.vimrc{,_backup}
#clone project into special folder
git clone https://github.com/iiey/vimconfig ~/.vim/bundle/vimconfig \
&& ln -sfn ~/.vim/bundle/vimconfig/vimrc ~/.vim/vimrc
```
#### Structure
- Basic vim setting: ``vimconfig/plugin/setting.vim``
- Commands: ``vimconfig/plugin/command.vim``
- Mapping: ``vimconfig/plugin/mapping.vim``
- Plugins configuration: ``vimconfig/plugin/bundle.vim``
- Functions implementation: ``vimconfig/autoload/utilfunc.vim``
#### Note
- Some plugin keybindings may changed to avoid conflict with default vim mapping
- More detail see each plugin SECTION under **bundle.vim**
- ``~/.vim/bundle`` is path where plugins are stored and managed by [vim-plug][1]
##### [airline][2]
- Modify setting.vim to enable statusline with powerline symbols
```vim
let g:airline_powerline_fonts=0
```
- Make sure powerline-fonts installed
- On Linux: [fontconfig][3] should work out for any font without patching
- On MacOS: download and install patched [fonts][4] from [powerline-fonts][5], set terminal using patched fonts
##### [ultisnip][6]
- See also ``:h ultisnips-triggers``
- Key changes in section ULTISNIPS
```vim
g:UltiSnipsExpandTrigger <c-l>
g:UltiSnipsListSnippets <c-l>l
g:UltiSnipsJumpForwardTrigger <c-l>n
g:UltiSnipsJumpBackwardTrigger <c-l>p
```
##### [clang\_complete][7]
- Set default library path
```vim
let g:clang_library_path=expand("$HOME")."/lib/"
```
- Avoid conflict with tagjump ``<c-]>``
```vim
g:clang_jumpto_declaration_key <c-w>[
```
##### [ctrlp][8]
- Default shortcut to not conflict with behaviours ``<c-n>`` ``<c-p>``
```vim
let g:ctrlp_map =[p
```
- Just fall back method which rarely used. Better using ``[f`` to call [fzf][9]
[1]: https://github.com/junegunn/vim-plug
[2]: https://github.com/vim-airline/vim-airline
[3]: http://powerline.readthedocs.io/en/master/installation/linux.html#fontconfig
[4]: https://github.com/iiey/dotfiles/tree/master/fonts/Powerline
[5]: https://github.com/powerline/fonts
[6]: https://github.com/SirVer/ultisnips
[7]: https://github.com/Rip-Rip/clang_complete
[8]: https://github.com/ctrlpvim/ctrlp.vim
[9]: https://github.com/junegunn/fzf
| Java |
/* globals describe, before, beforeEach, after, afterEach, it */
'use strict';
const chai = require('chai');
const assert = chai.assert;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things')); //http://chaijs.com/plugins/chai-things
chai.use(require('chai-arrays'));
describe('<%= pkgName %>', function () {
before('before', function () {
});
beforeEach('beforeEach', function () {
});
afterEach('afterEach', function () {
});
after('after', function () {
});
describe('Stub test', function () {
it('should have unit test', function () {
assert(false, 'Please add unit tests.');
});
});
});
| Java |
//
// PgpMimeTests.cs
//
// Author: Jeffrey Stedfast <jestedfa@microsoft.com>
//
// Copyright (c) 2013-2022 .NET Foundation and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using NUnit.Framework;
using Org.BouncyCastle.Bcpg;
using Org.BouncyCastle.Bcpg.OpenPgp;
using MimeKit;
using MimeKit.IO;
using MimeKit.IO.Filters;
using MimeKit.Cryptography;
namespace UnitTests.Cryptography {
[TestFixture]
public class PgpMimeTests
{
static PgpMimeTests ()
{
Environment.SetEnvironmentVariable ("GNUPGHOME", Path.GetFullPath ("."));
var dataDir = Path.Combine (TestHelper.ProjectDir, "TestData", "openpgp");
CryptographyContext.Register (typeof (DummyOpenPgpContext));
foreach (var name in new [] { "pubring.gpg", "pubring.gpg~", "secring.gpg", "secring.gpg~", "gpg.conf" }) {
if (File.Exists (name))
File.Delete (name);
}
using (var ctx = new DummyOpenPgpContext ()) {
using (var seckeys = File.OpenRead (Path.Combine (dataDir, "mimekit.gpg.sec"))) {
using (var armored = new ArmoredInputStream (seckeys))
ctx.Import (new PgpSecretKeyRingBundle (armored));
}
using (var pubkeys = File.OpenRead (Path.Combine (dataDir, "mimekit.gpg.pub")))
ctx.Import (pubkeys);
}
File.Copy (Path.Combine (dataDir, "gpg.conf"), "gpg.conf", true);
}
static bool IsSupported (EncryptionAlgorithm algorithm)
{
switch (algorithm) {
case EncryptionAlgorithm.RC2128:
case EncryptionAlgorithm.RC264:
case EncryptionAlgorithm.RC240:
case EncryptionAlgorithm.Seed:
return false;
default:
return true;
}
}
[Test]
public void TestPreferredAlgorithms ()
{
using (var ctx = new DummyOpenPgpContext ()) {
var encryptionAlgorithms = ctx.EnabledEncryptionAlgorithms;
Assert.AreEqual (4, encryptionAlgorithms.Length);
Assert.AreEqual (EncryptionAlgorithm.Aes256, encryptionAlgorithms[0]);
Assert.AreEqual (EncryptionAlgorithm.Aes192, encryptionAlgorithms[1]);
Assert.AreEqual (EncryptionAlgorithm.Aes128, encryptionAlgorithms[2]);
Assert.AreEqual (EncryptionAlgorithm.TripleDes, encryptionAlgorithms[3]);
var digestAlgorithms = ctx.EnabledDigestAlgorithms;
Assert.AreEqual (3, digestAlgorithms.Length);
Assert.AreEqual (DigestAlgorithm.Sha256, digestAlgorithms[0]);
Assert.AreEqual (DigestAlgorithm.Sha512, digestAlgorithms[1]);
Assert.AreEqual (DigestAlgorithm.Sha1, digestAlgorithms[2]);
}
}
[Test]
public void TestKeyEnumeration ()
{
using (var ctx = new DummyOpenPgpContext ()) {
var unknownMailbox = new MailboxAddress ("Snarky McSnarkypants", "snarky@snarkypants.net");
var knownMailbox = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
int count = ctx.EnumeratePublicKeys ().Count ();
// Note: the count will be 8 if run as a complete unit test or 2 if run individually
Assert.IsTrue (count == 8 || count == 2, "Unexpected number of public keys");
Assert.AreEqual (0, ctx.EnumeratePublicKeys (unknownMailbox).Count (), "Unexpected number of public keys for an unknown mailbox");
Assert.AreEqual (2, ctx.EnumeratePublicKeys (knownMailbox).Count (), "Unexpected number of public keys for a known mailbox");
Assert.AreEqual (2, ctx.EnumerateSecretKeys ().Count (), "Unexpected number of secret keys");
Assert.AreEqual (0, ctx.EnumerateSecretKeys (unknownMailbox).Count (), "Unexpected number of secret keys for an unknown mailbox");
Assert.AreEqual (2, ctx.EnumerateSecretKeys (knownMailbox).Count (), "Unexpected number of secret keys for a known mailbox");
Assert.IsTrue (ctx.CanSign (knownMailbox));
Assert.IsFalse (ctx.CanSign (unknownMailbox));
Assert.IsTrue (ctx.CanEncrypt (knownMailbox));
Assert.IsFalse (ctx.CanEncrypt (unknownMailbox));
}
}
[Test]
public void TestKeyGeneration ()
{
using (var ctx = new DummyOpenPgpContext ()) {
var mailbox = new MailboxAddress ("Snarky McSnarkypants", "snarky@snarkypants.net");
int publicKeyRings = ctx.EnumeratePublicKeyRings ().Count ();
int secretKeyRings = ctx.EnumerateSecretKeyRings ().Count ();
ctx.GenerateKeyPair (mailbox, "password", DateTime.Now.AddYears (1), EncryptionAlgorithm.Cast5);
var pubring = ctx.EnumeratePublicKeyRings (mailbox).FirstOrDefault ();
Assert.IsNotNull (pubring, "Expected to find the generated public keyring");
ctx.Delete (pubring);
Assert.AreEqual (publicKeyRings, ctx.EnumeratePublicKeyRings ().Count (), "Unexpected number of public keyrings");
var secring = ctx.EnumerateSecretKeyRings (mailbox).FirstOrDefault ();
Assert.IsNotNull (secring, "Expected to find the generated secret keyring");
ctx.Delete (secring);
Assert.AreEqual (secretKeyRings, ctx.EnumerateSecretKeyRings ().Count (), "Unexpected number of secret keyrings");
}
}
[Test]
public void TestKeySigning ()
{
using (var ctx = new DummyOpenPgpContext ()) {
var seckey = ctx.EnumerateSecretKeys (new MailboxAddress ("", "mimekit@example.com")).FirstOrDefault ();
var mailbox = new MailboxAddress ("Snarky McSnarkypants", "snarky@snarkypants.net");
ctx.GenerateKeyPair (mailbox, "password", DateTime.Now.AddYears (1), EncryptionAlgorithm.Cast5);
// delete the secret keyring, we don't need it
var secring = ctx.EnumerateSecretKeyRings (mailbox).FirstOrDefault ();
ctx.Delete (secring);
var pubring = ctx.EnumeratePublicKeyRings (mailbox).FirstOrDefault ();
var pubkey = pubring.GetPublicKey ();
int sigCount = 0;
foreach (PgpSignature sig in pubkey.GetKeySignatures ())
sigCount++;
Assert.AreEqual (0, sigCount);
ctx.SignKey (seckey, pubkey, DigestAlgorithm.Sha256, OpenPgpKeyCertification.CasualCertification);
pubring = ctx.EnumeratePublicKeyRings (mailbox).FirstOrDefault ();
pubkey = pubring.GetPublicKey ();
sigCount = 0;
foreach (PgpSignature sig in pubkey.GetKeySignatures ()) {
Assert.AreEqual (seckey.KeyId, sig.KeyId);
Assert.AreEqual (HashAlgorithmTag.Sha256, sig.HashAlgorithm);
Assert.AreEqual ((int) OpenPgpKeyCertification.CasualCertification, sig.SignatureType);
sigCount++;
}
Assert.AreEqual (1, sigCount);
ctx.Delete (pubring);
}
}
[Test]
public void TestMimeMessageSign ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
var message = new MimeMessage { Subject = "Test of signing with OpenPGP" };
using (var ctx = new DummyOpenPgpContext ()) {
// throws because no Body is set
Assert.Throws<InvalidOperationException> (() => message.Sign (ctx));
message.Body = body;
// throws because no sender is set
Assert.Throws<InvalidOperationException> (() => message.Sign (ctx));
message.From.Add (self);
// ok, now we can sign
message.Sign (ctx);
Assert.IsInstanceOf<MultipartSigned> (message.Body);
var multipart = (MultipartSigned) message.Body;
Assert.AreEqual (2, multipart.Count, "The multipart/signed has an unexpected number of children.");
var protocol = multipart.ContentType.Parameters["protocol"];
Assert.AreEqual (ctx.SignatureProtocol, protocol, "The multipart/signed protocol does not match.");
Assert.IsInstanceOf<TextPart> (multipart[0], "The first child is not a text part.");
Assert.IsInstanceOf<ApplicationPgpSignature> (multipart[1], "The second child is not a detached signature.");
var signatures = multipart.Verify (ctx);
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
var signature = signatures[0];
Assert.AreEqual ("MimeKit UnitTests", signature.SignerCertificate.Name);
Assert.AreEqual ("mimekit@example.com", signature.SignerCertificate.Email);
Assert.AreEqual ("44CD48EEC90D8849961F36BA50DCD107AB0821A2", signature.SignerCertificate.Fingerprint);
Assert.AreEqual (new DateTime (2013, 11, 3, 18, 32, 27), signature.SignerCertificate.CreationDate, "CreationDate");
Assert.AreEqual (DateTime.MaxValue, signature.SignerCertificate.ExpirationDate, "ExpirationDate");
Assert.AreEqual (PublicKeyAlgorithm.RsaGeneral, signature.SignerCertificate.PublicKeyAlgorithm);
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public async Task TestMimeMessageSignAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
var message = new MimeMessage { Subject = "Test of signing with OpenPGP" };
using (var ctx = new DummyOpenPgpContext ()) {
// throws because no Body is set
Assert.Throws<InvalidOperationException> (() => message.Sign (ctx));
message.Body = body;
// throws because no sender is set
Assert.Throws<InvalidOperationException> (() => message.Sign (ctx));
message.From.Add (self);
// ok, now we can sign
message.Sign (ctx);
Assert.IsInstanceOf<MultipartSigned> (message.Body);
var multipart = (MultipartSigned) message.Body;
Assert.AreEqual (2, multipart.Count, "The multipart/signed has an unexpected number of children.");
var protocol = multipart.ContentType.Parameters["protocol"];
Assert.AreEqual (ctx.SignatureProtocol, protocol, "The multipart/signed protocol does not match.");
Assert.IsInstanceOf<TextPart> (multipart[0], "The first child is not a text part.");
Assert.IsInstanceOf<ApplicationPgpSignature> (multipart[1], "The second child is not a detached signature.");
var signatures = await multipart.VerifyAsync (ctx);
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
var signature = signatures[0];
Assert.AreEqual ("MimeKit UnitTests", signature.SignerCertificate.Name);
Assert.AreEqual ("mimekit@example.com", signature.SignerCertificate.Email);
Assert.AreEqual ("44CD48EEC90D8849961F36BA50DCD107AB0821A2", signature.SignerCertificate.Fingerprint);
Assert.AreEqual (new DateTime (2013, 11, 3, 18, 32, 27), signature.SignerCertificate.CreationDate, "CreationDate");
Assert.AreEqual (DateTime.MaxValue, signature.SignerCertificate.ExpirationDate, "ExpirationDate");
Assert.AreEqual (PublicKeyAlgorithm.RsaGeneral, signature.SignerCertificate.PublicKeyAlgorithm);
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public void TestMultipartSignedVerifyExceptions ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
using (var ctx = new DummyOpenPgpContext ()) {
var signed = MultipartSigned.Create (ctx, self, DigestAlgorithm.Sha256, body);
var protocol = signed.ContentType.Parameters["protocol"];
signed.ContentType.Parameters.Remove ("protocol");
Assert.Throws<FormatException> (() => signed.Verify (), "Verify() w/o protocol parameter");
Assert.Throws<FormatException> (() => signed.Verify (ctx), "Verify(ctx) w/o protocol parameter");
Assert.ThrowsAsync<FormatException> (() => signed.VerifyAsync (), "VerifyAsync() w/o protocol parameter");
Assert.ThrowsAsync<FormatException> (() => signed.VerifyAsync (ctx), "VerifyAsync(ctx) w/o protocol parameter");
signed.ContentType.Parameters.Add ("protocol", "invalid-protocol");
Assert.Throws<NotSupportedException> (() => signed.Verify (), "Verify() w/ invalid protocol parameter");
Assert.Throws<NotSupportedException> (() => signed.Verify (ctx), "Verify(ctx) w/ invalid protocol parameter");
Assert.ThrowsAsync<NotSupportedException> (() => signed.VerifyAsync (), "VerifyAsync() w/ invalid protocol parameter");
Assert.ThrowsAsync<NotSupportedException> (() => signed.VerifyAsync (ctx), "VerifyAsync(ctx) w/ invalid protocol parameter");
signed.ContentType.Parameters["protocol"] = protocol;
var signature = signed[1];
signed.RemoveAt (1);
Assert.Throws<FormatException> (() => signed.Verify (), "Verify() w/ < 2 parts");
Assert.Throws<FormatException> (() => signed.Verify (ctx), "Verify(ctx) w/ < 2 parts");
Assert.ThrowsAsync<FormatException> (() => signed.VerifyAsync (), "VerifyAsync() w/ < 2 parts");
Assert.ThrowsAsync<FormatException> (() => signed.VerifyAsync (ctx), "VerifyAsync(ctx) w/ < 2 parts");
var emptySignature = new MimePart ("application", "octet-stream");
signed.Add (emptySignature);
Assert.Throws<FormatException> (() => signed.Verify (), "Verify() w/ invalid signature part");
Assert.Throws<FormatException> (() => signed.Verify (ctx), "Verify(ctx) w/ invalid signature part");
Assert.ThrowsAsync<FormatException> (() => signed.VerifyAsync (), "VerifyAsync() w/ invalid signature part");
Assert.ThrowsAsync<FormatException> (() => signed.VerifyAsync (ctx), "VerifyAsync(ctx) w/ invalid signature part");
var invalidContent = new MimePart ("image", "jpeg") {
Content = new MimeContent (new MemoryStream (Array.Empty<byte> (), false))
};
signed[1] = invalidContent;
Assert.Throws<NotSupportedException> (() => signed.Verify (), "Verify() w/ invalid content part");
Assert.Throws<NotSupportedException> (() => signed.Verify (ctx), "Verify(ctx) w/ invalid content part");
Assert.ThrowsAsync<NotSupportedException> (() => signed.VerifyAsync (), "VerifyAsync() w/ invalid content part");
Assert.ThrowsAsync<NotSupportedException> (() => signed.VerifyAsync (ctx), "VerifyAsync(ctx) w/ invalid content part");
}
}
[Test]
public void TestMultipartSignedSignUsingKeys ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "44CD48EEC90D8849961F36BA50DCD107AB0821A2");
PgpSecretKey signer;
using (var ctx = new DummyOpenPgpContext ()) {
signer = ctx.GetSigningKey (self);
foreach (DigestAlgorithm digest in Enum.GetValues (typeof (DigestAlgorithm))) {
if (digest == DigestAlgorithm.None ||
digest == DigestAlgorithm.DoubleSha ||
digest == DigestAlgorithm.Tiger192 ||
digest == DigestAlgorithm.Haval5160 ||
digest == DigestAlgorithm.MD4)
continue;
var multipart = MultipartSigned.Create (signer, digest, body);
Assert.AreEqual (2, multipart.Count, "The multipart/signed has an unexpected number of children.");
var protocol = multipart.ContentType.Parameters["protocol"];
Assert.AreEqual ("application/pgp-signature", protocol, "The multipart/signed protocol does not match.");
var micalg = multipart.ContentType.Parameters["micalg"];
var algorithm = ctx.GetDigestAlgorithm (micalg);
Assert.AreEqual (digest, algorithm, "The multipart/signed micalg does not match.");
Assert.IsInstanceOf<TextPart> (multipart[0], "The first child is not a text part.");
Assert.IsInstanceOf<ApplicationPgpSignature> (multipart[1], "The second child is not a detached signature.");
var signatures = multipart.Verify ();
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
}
}
[Test]
public async Task TestMultipartSignedSignUsingKeysAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "44CD48EEC90D8849961F36BA50DCD107AB0821A2");
PgpSecretKey signer;
using (var ctx = new DummyOpenPgpContext ()) {
signer = ctx.GetSigningKey (self);
foreach (DigestAlgorithm digest in Enum.GetValues (typeof (DigestAlgorithm))) {
if (digest == DigestAlgorithm.None ||
digest == DigestAlgorithm.DoubleSha ||
digest == DigestAlgorithm.Tiger192 ||
digest == DigestAlgorithm.Haval5160 ||
digest == DigestAlgorithm.MD4)
continue;
var multipart = await MultipartSigned.CreateAsync (signer, digest, body);
Assert.AreEqual (2, multipart.Count, "The multipart/signed has an unexpected number of children.");
var protocol = multipart.ContentType.Parameters["protocol"];
Assert.AreEqual ("application/pgp-signature", protocol, "The multipart/signed protocol does not match.");
var micalg = multipart.ContentType.Parameters["micalg"];
var algorithm = ctx.GetDigestAlgorithm (micalg);
Assert.AreEqual (digest, algorithm, "The multipart/signed micalg does not match.");
Assert.IsInstanceOf<TextPart> (multipart[0], "The first child is not a text part.");
Assert.IsInstanceOf<ApplicationPgpSignature> (multipart[1], "The second child is not a detached signature.");
var signatures = await multipart.VerifyAsync ();
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
}
}
[Test]
public void TestMimeMessageEncrypt ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "44CD48EEC90D8849961F36BA50DCD107AB0821A2");
var message = new MimeMessage { Subject = "Test of signing with OpenPGP" };
using (var ctx = new DummyOpenPgpContext ()) {
// throws because no Body has been set
Assert.Throws<InvalidOperationException> (() => message.Encrypt (ctx));
message.Body = body;
// throws because no recipients have been set
Assert.Throws<InvalidOperationException> (() => message.Encrypt (ctx));
message.From.Add (self);
message.To.Add (self);
message.Encrypt (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
var encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (ctx);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
// now do the same thing, but encrypt to the Resent-To headers
message.From.Clear ();
message.To.Clear ();
message.From.Add (new MailboxAddress ("Dummy Sender", "dummy@sender.com"));
message.To.Add (new MailboxAddress ("Dummy Recipient", "dummy@recipient.com"));
message.ResentFrom.Add (self);
message.ResentTo.Add (self);
message.Body = body;
message.Encrypt (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
decrypted = encrypted.Decrypt (ctx);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
}
[Test]
public async Task TestMimeMessageEncryptAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "44CD48EEC90D8849961F36BA50DCD107AB0821A2");
var message = new MimeMessage { Subject = "Test of signing with OpenPGP" };
using (var ctx = new DummyOpenPgpContext ()) {
// throws because no Body has been set
Assert.ThrowsAsync<InvalidOperationException> (() => message.EncryptAsync (ctx));
message.Body = body;
// throws because no recipients have been set
Assert.ThrowsAsync<InvalidOperationException> (() => message.EncryptAsync (ctx));
message.From.Add (self);
message.To.Add (self);
await message.EncryptAsync (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
var encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (ctx);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
// now do the same thing, but encrypt to the Resent-To headers
message.From.Clear ();
message.To.Clear ();
message.From.Add (new MailboxAddress ("Dummy Sender", "dummy@sender.com"));
message.To.Add (new MailboxAddress ("Dummy Recipient", "dummy@recipient.com"));
message.ResentFrom.Add (self);
message.ResentTo.Add (self);
message.Body = body;
await message.EncryptAsync (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
decrypted = encrypted.Decrypt (ctx);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
}
[Test]
public void TestMultipartEncryptedDecryptExceptions ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
var encrypted = MultipartEncrypted.Encrypt (new[] { self }, body);
using (var ctx = new DummyOpenPgpContext ()) {
var protocol = encrypted.ContentType.Parameters["protocol"];
encrypted.ContentType.Parameters.Remove ("protocol");
Assert.Throws<FormatException> (() => encrypted.Decrypt (), "Decrypt() w/o protocol parameter");
Assert.Throws<FormatException> (() => encrypted.Decrypt (ctx), "Decrypt(ctx) w/o protocol parameter");
encrypted.ContentType.Parameters.Add ("protocol", "invalid-protocol");
//Assert.Throws<NotSupportedException> (() => encrypted.Decrypt (), "Decrypt() w/ invalid protocol parameter");
Assert.Throws<NotSupportedException> (() => encrypted.Decrypt (ctx), "Decrypt(ctx) w/ invalid protocol parameter");
encrypted.ContentType.Parameters["protocol"] = protocol;
var version = encrypted[0];
encrypted.RemoveAt (0);
Assert.Throws<FormatException> (() => encrypted.Decrypt (), "Decrypt() w/ < 2 parts");
Assert.Throws<FormatException> (() => encrypted.Decrypt (ctx), "Decrypt(ctx) w/ < 2 parts");
var invalidVersion = new MimePart ("application", "octet-stream") {
Content = new MimeContent (new MemoryStream (Array.Empty<byte> (), false))
};
encrypted.Insert (0, invalidVersion);
Assert.Throws<FormatException> (() => encrypted.Decrypt (), "Decrypt() w/ invalid version part");
Assert.Throws<FormatException> (() => encrypted.Decrypt (ctx), "Decrypt(ctx) w/ invalid version part");
var emptyContent = new MimePart ("application", "octet-stream");
var content = encrypted[1];
encrypted[1] = emptyContent;
encrypted[0] = version;
Assert.Throws<FormatException> (() => encrypted.Decrypt (), "Decrypt() w/ empty content part");
Assert.Throws<FormatException> (() => encrypted.Decrypt (ctx), "Decrypt(ctx) w/ empty content part");
var invalidContent = new MimePart ("image", "jpeg") {
Content = new MimeContent (new MemoryStream (Array.Empty<byte> (), false))
};
encrypted[1] = invalidContent;
Assert.Throws<FormatException> (() => encrypted.Decrypt (), "Decrypt() w/ invalid content part");
Assert.Throws<FormatException> (() => encrypted.Decrypt (ctx), "Decrypt(ctx) w/ invalid content part");
}
}
[Test]
public void TestMultipartEncryptedEncrypt ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
var encrypted = MultipartEncrypted.Encrypt (new [] { self }, body);
using (var stream = new MemoryStream ()) {
encrypted.WriteTo (stream);
stream.Position = 0;
var entity = MimeEntity.Load (stream);
Assert.IsInstanceOf<MultipartEncrypted> (entity, "Encrypted part is not the expected type");
encrypted = (MultipartEncrypted) entity;
Assert.IsInstanceOf<ApplicationPgpEncrypted> (encrypted[0], "First child of multipart/encrypted is not the expected type");
Assert.IsInstanceOf<MimePart> (encrypted[1], "Second child of multipart/encrypted is not the expected type");
Assert.AreEqual ("application/octet-stream", encrypted[1].ContentType.MimeType, "Second child of multipart/encrypted is not the expected mime-type");
}
var decrypted = encrypted.Decrypt ();
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
[Test]
public async Task TestMultipartEncryptedEncryptAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
var encrypted = await MultipartEncrypted.EncryptAsync (new[] { self }, body);
using (var stream = new MemoryStream ()) {
await encrypted.WriteToAsync (stream);
stream.Position = 0;
var entity = await MimeEntity.LoadAsync (stream);
Assert.IsInstanceOf<MultipartEncrypted> (entity, "Encrypted part is not the expected type");
encrypted = (MultipartEncrypted) entity;
Assert.IsInstanceOf<ApplicationPgpEncrypted> (encrypted[0], "First child of multipart/encrypted is not the expected type");
Assert.IsInstanceOf<MimePart> (encrypted[1], "Second child of multipart/encrypted is not the expected type");
Assert.AreEqual ("application/octet-stream", encrypted[1].ContentType.MimeType, "Second child of multipart/encrypted is not the expected mime-type");
}
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt ();
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
[Test]
public void TestMultipartEncryptedEncryptUsingKeys ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
IList<PgpPublicKey> recipients;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = ctx.GetPublicKeys (new [] { self });
}
var encrypted = MultipartEncrypted.Encrypt (recipients, body);
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt ();
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
[Test]
public async Task TestMultipartEncryptedEncryptUsingKeysAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
IList<PgpPublicKey> recipients;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = await ctx.GetPublicKeysAsync (new[] { self });
}
var encrypted = await MultipartEncrypted.EncryptAsync (recipients, body);
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt ();
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
[Test]
public void TestMultipartEncryptedEncryptAlgorithm ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
using (var ctx = new DummyOpenPgpContext ()) {
foreach (EncryptionAlgorithm algorithm in Enum.GetValues (typeof (EncryptionAlgorithm))) {
if (!IsSupported (algorithm))
continue;
var encrypted = MultipartEncrypted.Encrypt (algorithm, new [] { self }, body);
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (ctx);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
}
}
[Test]
public async Task TestMultipartEncryptedEncryptAlgorithmAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
using (var ctx = new DummyOpenPgpContext ()) {
foreach (EncryptionAlgorithm algorithm in Enum.GetValues (typeof (EncryptionAlgorithm))) {
if (!IsSupported (algorithm))
continue;
var encrypted = await MultipartEncrypted.EncryptAsync (algorithm, new[] { self }, body);
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (ctx);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
}
}
[Test]
public void TestMultipartEncryptedEncryptAlgorithmUsingKeys ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
IList<PgpPublicKey> recipients;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = ctx.GetPublicKeys (new [] { self });
}
foreach (EncryptionAlgorithm algorithm in Enum.GetValues (typeof (EncryptionAlgorithm))) {
if (!IsSupported (algorithm))
continue;
var encrypted = MultipartEncrypted.Encrypt (algorithm, recipients, body);
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt ();
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
}
[Test]
public async Task TestMultipartEncryptedEncryptAlgorithmUsingKeysAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up encrypting..." };
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
IList<PgpPublicKey> recipients;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = await ctx.GetPublicKeysAsync (new[] { self });
}
foreach (EncryptionAlgorithm algorithm in Enum.GetValues (typeof (EncryptionAlgorithm))) {
if (!IsSupported (algorithm))
continue;
var encrypted = await MultipartEncrypted.EncryptAsync (algorithm, recipients, body);
//using (var file = File.Create ("pgp-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt ();
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
}
}
[Test]
public void TestMimeMessageSignAndEncrypt ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
var message = new MimeMessage { Subject = "Test of signing with OpenPGP" };
DigitalSignatureCollection signatures;
using (var ctx = new DummyOpenPgpContext ()) {
// throws because no Body has been set
Assert.Throws<InvalidOperationException> (() => message.SignAndEncrypt (ctx));
message.Body = body;
// throws because no sender has been set
Assert.Throws<InvalidOperationException> (() => message.SignAndEncrypt (ctx));
message.From.Add (self);
message.To.Add (self);
message.SignAndEncrypt (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
var encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (ctx, out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
// now do the same thing, but encrypt to the Resent-To headers
message.From.Clear ();
message.To.Clear ();
message.From.Add (new MailboxAddress ("Dummy Sender", "dummy@sender.com"));
message.To.Add (new MailboxAddress ("Dummy Recipient", "dummy@recipient.com"));
message.ResentFrom.Add (self);
message.ResentTo.Add (self);
message.Body = body;
message.SignAndEncrypt (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
decrypted = encrypted.Decrypt (ctx, out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
}
[Test]
public async Task TestMimeMessageSignAndEncryptAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
var message = new MimeMessage { Subject = "Test of signing with OpenPGP" };
DigitalSignatureCollection signatures;
using (var ctx = new DummyOpenPgpContext ()) {
// throws because no Body has been set
Assert.ThrowsAsync<InvalidOperationException> (() => message.SignAndEncryptAsync (ctx));
message.Body = body;
// throws because no sender has been set
Assert.ThrowsAsync<InvalidOperationException> (() => message.SignAndEncryptAsync (ctx));
message.From.Add (self);
message.To.Add (self);
await message.SignAndEncryptAsync (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
var encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (ctx, out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
// now do the same thing, but encrypt to the Resent-To headers
message.From.Clear ();
message.To.Clear ();
message.From.Add (new MailboxAddress ("Dummy Sender", "dummy@sender.com"));
message.To.Add (new MailboxAddress ("Dummy Recipient", "dummy@recipient.com"));
message.ResentFrom.Add (self);
message.ResentTo.Add (self);
message.Body = body;
await message.SignAndEncryptAsync (ctx);
Assert.IsInstanceOf<MultipartEncrypted> (message.Body);
encrypted = (MultipartEncrypted) message.Body;
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
decrypted = encrypted.Decrypt (ctx, out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
}
[Test]
public void TestMultipartEncryptedSignAndEncrypt ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
var encrypted = MultipartEncrypted.SignAndEncrypt (self, DigestAlgorithm.Sha1, new [] { self }, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public async Task TestMultipartEncryptedSignAndEncryptAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
var encrypted = await MultipartEncrypted.SignAndEncryptAsync (self, DigestAlgorithm.Sha1, new[] { self }, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public void TestMultipartEncryptedSignAndEncryptUsingKeys ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
IList<PgpPublicKey> recipients;
PgpSecretKey signer;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = ctx.GetPublicKeys (new [] { self });
signer = ctx.GetSigningKey (self);
}
var encrypted = MultipartEncrypted.SignAndEncrypt (signer, DigestAlgorithm.Sha1, recipients, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public async Task TestMultipartEncryptedSignAndEncryptUsingKeysAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
IList<PgpPublicKey> recipients;
PgpSecretKey signer;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = await ctx.GetPublicKeysAsync (new[] { self });
signer = await ctx.GetSigningKeyAsync (self);
}
var encrypted = await MultipartEncrypted.SignAndEncryptAsync (signer, DigestAlgorithm.Sha1, recipients, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public void TestMultipartEncryptedSignAndEncryptAlgorithm ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
var encrypted = MultipartEncrypted.SignAndEncrypt (self, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, new [] { self }, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public async Task TestMultipartEncryptedSignAndEncryptAlgorithmAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
var encrypted = await MultipartEncrypted.SignAndEncryptAsync (self, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, new[] { self }, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public void TestMultipartEncryptedSignAndEncryptAlgorithmUsingKeys ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
IList<PgpPublicKey> recipients;
PgpSecretKey signer;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = ctx.GetPublicKeys (new [] { self });
signer = ctx.GetSigningKey (self);
}
var encrypted = MultipartEncrypted.SignAndEncrypt (signer, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, recipients, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public async Task TestMultipartEncryptedSignAndEncryptAlgorithmUsingKeysAsync ()
{
var body = new TextPart ("plain") { Text = "This is some cleartext that we'll end up signing and encrypting..." };
var self = new SecureMailboxAddress ("MimeKit UnitTests", "mimekit@example.com", "AB0821A2");
DigitalSignatureCollection signatures;
IList<PgpPublicKey> recipients;
PgpSecretKey signer;
using (var ctx = new DummyOpenPgpContext ()) {
recipients = await ctx.GetPublicKeysAsync (new[] { self });
signer = await ctx.GetSigningKeyAsync (self);
}
var encrypted = await MultipartEncrypted.SignAndEncryptAsync (signer, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, recipients, body);
//using (var file = File.Create ("pgp-signed-encrypted.asc"))
// encrypted.WriteTo (file);
// TODO: implement DecryptAsync
var decrypted = encrypted.Decrypt (out signatures);
Assert.IsInstanceOf<TextPart> (decrypted, "Decrypted part is not the expected type.");
Assert.AreEqual (body.Text, ((TextPart) decrypted).Text, "Decrypted content is not the same as the original.");
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException ex) {
Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public void TestAutoKeyRetrieve ()
{
var message = MimeMessage.Load (Path.Combine (TestHelper.ProjectDir, "TestData", "openpgp", "[Announce] GnuPG 2.1.20 released.eml"));
var multipart = (MultipartSigned) ((Multipart) message.Body)[0];
Assert.AreEqual (2, multipart.Count, "The multipart/signed has an unexpected number of children.");
var protocol = multipart.ContentType.Parameters["protocol"];
Assert.AreEqual ("application/pgp-signature", protocol, "The multipart/signed protocol does not match.");
var micalg = multipart.ContentType.Parameters["micalg"];
Assert.AreEqual ("pgp-sha1", micalg, "The multipart/signed micalg does not match.");
Assert.IsInstanceOf<TextPart> (multipart[0], "The first child is not a text part.");
Assert.IsInstanceOf<ApplicationPgpSignature> (multipart[1], "The second child is not a detached signature.");
DigitalSignatureCollection signatures;
try {
signatures = multipart.Verify ();
} catch (IOException ex) {
if (ex.Message == "unknown PGP public key algorithm encountered") {
Assert.Ignore ("Known issue: {0}", ex.Message);
return;
}
throw;
}
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException) {
// Note: Werner Koch's keyring has an EdDSA subkey which breaks BouncyCastle's
// PgpPublicKeyRingBundle reader. If/when one of the round-robin keys.gnupg.net
// key servers returns this particular keyring, we can expect to get an exception
// about being unable to find Werner's public key.
//Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public async Task TestAutoKeyRetrieveAsync ()
{
var message = await MimeMessage.LoadAsync (Path.Combine (TestHelper.ProjectDir, "TestData", "openpgp", "[Announce] GnuPG 2.1.20 released.eml"));
var multipart = (MultipartSigned) ((Multipart) message.Body)[0];
Assert.AreEqual (2, multipart.Count, "The multipart/signed has an unexpected number of children.");
var protocol = multipart.ContentType.Parameters["protocol"];
Assert.AreEqual ("application/pgp-signature", protocol, "The multipart/signed protocol does not match.");
var micalg = multipart.ContentType.Parameters["micalg"];
Assert.AreEqual ("pgp-sha1", micalg, "The multipart/signed micalg does not match.");
Assert.IsInstanceOf<TextPart> (multipart[0], "The first child is not a text part.");
Assert.IsInstanceOf<ApplicationPgpSignature> (multipart[1], "The second child is not a detached signature.");
DigitalSignatureCollection signatures;
try {
signatures = await multipart.VerifyAsync ();
} catch (IOException ex) {
if (ex.Message == "unknown PGP public key algorithm encountered") {
Assert.Ignore ("Known issue: {0}", ex.Message);
return;
}
throw;
}
Assert.AreEqual (1, signatures.Count, "Verify returned an unexpected number of signatures.");
foreach (var signature in signatures) {
try {
bool valid = signature.Verify ();
Assert.IsTrue (valid, "Bad signature from {0}", signature.SignerCertificate.Email);
} catch (DigitalSignatureVerifyException) {
// Note: Werner Koch's keyring has an EdDSA subkey which breaks BouncyCastle's
// PgpPublicKeyRingBundle reader. If/when one of the round-robin keys.gnupg.net
// key servers returns this particular keyring, we can expect to get an exception
// about being unable to find Werner's public key.
//Assert.Fail ("Failed to verify signature: {0}", ex);
}
}
}
[Test]
public void TestExport ()
{
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
using (var ctx = new DummyOpenPgpContext ()) {
Assert.AreEqual ("application/pgp-keys", ctx.KeyExchangeProtocol, "The key-exchange protocol does not match.");
var keys = ctx.EnumeratePublicKeys (self).ToList ();
var exported = ctx.Export (new [] { self });
Assert.IsNotNull (exported, "The exported MIME part should not be null.");
Assert.IsInstanceOf<MimePart> (exported, "The exported MIME part should be a MimePart.");
Assert.AreEqual ("application/pgp-keys", exported.ContentType.MimeType);
exported = ctx.Export (keys);
Assert.IsNotNull (exported, "The exported MIME part should not be null.");
Assert.IsInstanceOf<MimePart> (exported, "The exported MIME part should be a MimePart.");
Assert.AreEqual ("application/pgp-keys", exported.ContentType.MimeType);
using (var stream = new MemoryStream ()) {
ctx.Export (new[] { self }, stream, true);
Assert.AreEqual (exported.Content.Stream.Length, stream.Length);
}
foreach (var keyring in ctx.EnumeratePublicKeyRings (self)) {
using (var stream = new MemoryStream ()) {
ctx.Export (new[] { self }, stream, true);
Assert.AreEqual (exported.Content.Stream.Length, stream.Length);
}
}
using (var stream = new MemoryStream ()) {
ctx.Export (keys, stream, true);
Assert.AreEqual (exported.Content.Stream.Length, stream.Length);
}
}
}
[Test]
public async Task TestExportAsync ()
{
var self = new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com");
using (var ctx = new DummyOpenPgpContext ()) {
Assert.AreEqual ("application/pgp-keys", ctx.KeyExchangeProtocol, "The key-exchange protocol does not match.");
var keys = ctx.EnumeratePublicKeys (self).ToList ();
var exported = await ctx.ExportAsync (new[] { self });
Assert.IsNotNull (exported, "The exported MIME part should not be null.");
Assert.IsInstanceOf<MimePart> (exported, "The exported MIME part should be a MimePart.");
Assert.AreEqual ("application/pgp-keys", exported.ContentType.MimeType);
exported = await ctx.ExportAsync (keys);
Assert.IsNotNull (exported, "The exported MIME part should not be null.");
Assert.IsInstanceOf<MimePart> (exported, "The exported MIME part should be a MimePart.");
Assert.AreEqual ("application/pgp-keys", exported.ContentType.MimeType);
using (var stream = new MemoryStream ()) {
await ctx.ExportAsync (new[] { self }, stream, true);
Assert.AreEqual (exported.Content.Stream.Length, stream.Length);
}
foreach (var keyring in ctx.EnumeratePublicKeyRings (self)) {
using (var stream = new MemoryStream ()) {
await ctx.ExportAsync (new[] { self }, stream, true);
Assert.AreEqual (exported.Content.Stream.Length, stream.Length);
}
}
using (var stream = new MemoryStream ()) {
await ctx.ExportAsync (keys, stream, true);
Assert.AreEqual (exported.Content.Stream.Length, stream.Length);
}
}
}
[Test]
public void TestDefaultEncryptionAlgorithm ()
{
using (var ctx = new DummyOpenPgpContext ()) {
foreach (EncryptionAlgorithm algorithm in Enum.GetValues (typeof (EncryptionAlgorithm))) {
if (!IsSupported (algorithm)) {
Assert.Throws<NotSupportedException> (() => ctx.DefaultEncryptionAlgorithm = algorithm);
continue;
}
ctx.DefaultEncryptionAlgorithm = algorithm;
Assert.AreEqual (algorithm, ctx.DefaultEncryptionAlgorithm, "Default encryption algorithm does not match.");
}
}
}
[Test]
public void TestSupports ()
{
var supports = new [] { "application/pgp-encrypted", "application/pgp-signature", "application/pgp-keys",
"application/x-pgp-encrypted", "application/x-pgp-signature", "application/x-pgp-keys" };
using (var ctx = new DummyOpenPgpContext ()) {
for (int i = 0; i < supports.Length; i++)
Assert.IsTrue (ctx.Supports (supports[i]), supports[i]);
Assert.IsFalse (ctx.Supports ("application/octet-stream"), "application/octet-stream");
Assert.IsFalse (ctx.Supports ("text/plain"), "text/plain");
}
}
[Test]
public void TestAlgorithmMappings ()
{
using (var ctx = new DummyOpenPgpContext ()) {
foreach (DigestAlgorithm digest in Enum.GetValues (typeof (DigestAlgorithm))) {
if (digest == DigestAlgorithm.None || digest == DigestAlgorithm.DoubleSha)
continue;
var name = ctx.GetDigestAlgorithmName (digest);
var algo = ctx.GetDigestAlgorithm (name);
Assert.AreEqual (digest, algo);
}
Assert.AreEqual (DigestAlgorithm.MD5, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.MD5));
Assert.AreEqual (DigestAlgorithm.Sha1, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Sha1));
Assert.AreEqual (DigestAlgorithm.RipeMD160, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.RipeMD160));
Assert.AreEqual (DigestAlgorithm.DoubleSha, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.DoubleSha));
Assert.AreEqual (DigestAlgorithm.MD2, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.MD2));
Assert.AreEqual (DigestAlgorithm.Tiger192, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Tiger192));
Assert.AreEqual (DigestAlgorithm.Haval5160, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Haval5pass160));
Assert.AreEqual (DigestAlgorithm.Sha256, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Sha256));
Assert.AreEqual (DigestAlgorithm.Sha384, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Sha384));
Assert.AreEqual (DigestAlgorithm.Sha512, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Sha512));
Assert.AreEqual (DigestAlgorithm.Sha224, OpenPgpContext.GetDigestAlgorithm (Org.BouncyCastle.Bcpg.HashAlgorithmTag.Sha224));
Assert.AreEqual (PublicKeyAlgorithm.RsaGeneral, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.RsaGeneral));
Assert.AreEqual (PublicKeyAlgorithm.RsaEncrypt, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.RsaEncrypt));
Assert.AreEqual (PublicKeyAlgorithm.RsaSign, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.RsaSign));
Assert.AreEqual (PublicKeyAlgorithm.ElGamalGeneral, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.ElGamalGeneral));
Assert.AreEqual (PublicKeyAlgorithm.ElGamalEncrypt, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.ElGamalEncrypt));
Assert.AreEqual (PublicKeyAlgorithm.Dsa, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.Dsa));
Assert.AreEqual (PublicKeyAlgorithm.EllipticCurve, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.ECDH));
Assert.AreEqual (PublicKeyAlgorithm.EllipticCurveDsa, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.ECDsa));
Assert.AreEqual (PublicKeyAlgorithm.DiffieHellman, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.DiffieHellman));
//Assert.AreEqual (PublicKeyAlgorithm.EdwardsCurveDsa, OpenPgpContext.GetPublicKeyAlgorithm (Org.BouncyCastle.Bcpg.PublicKeyAlgorithmTag.EdDSA));
}
}
[Test]
public void TestArgumentExceptions ()
{
Assert.Throws<ArgumentNullException> (() => CryptographyContext.Create (null));
Assert.Throws<ArgumentNullException> (() => CryptographyContext.Register ((Type) null));
Assert.Throws<ArgumentNullException> (() => CryptographyContext.Register ((Func<OpenPgpContext>) null));
Assert.Throws<ArgumentNullException> (() => CryptographyContext.Register ((Func<SecureMimeContext>) null));
using (var ctx = new DummyOpenPgpContext ()) {
var clientEastwood = new MailboxAddress ("Man with No Name", "client.eastwood@fistfullofdollars.com");
var mailboxes = new [] { new MailboxAddress ("MimeKit UnitTests", "mimekit@example.com") };
var emptyMailboxes = new MailboxAddress[0];
var pubkeys = ctx.GetPublicKeys (mailboxes);
var key = ctx.GetSigningKey (mailboxes[0]);
var emptyPubkeys = new PgpPublicKey[0];
DigitalSignatureCollection signatures;
var stream = new MemoryStream ();
var entity = new MimePart ();
Assert.Throws<ArgumentException> (() => ctx.KeyServer = new Uri ("relative/uri", UriKind.Relative));
Assert.Throws<ArgumentNullException> (() => ctx.GetDigestAlgorithm (null));
Assert.Throws<ArgumentOutOfRangeException> (() => ctx.GetDigestAlgorithmName (DigestAlgorithm.DoubleSha));
Assert.Throws<NotSupportedException> (() => OpenPgpContext.GetHashAlgorithm (DigestAlgorithm.DoubleSha));
Assert.Throws<NotSupportedException> (() => OpenPgpContext.GetHashAlgorithm (DigestAlgorithm.Tiger192));
Assert.Throws<NotSupportedException> (() => OpenPgpContext.GetHashAlgorithm (DigestAlgorithm.Haval5160));
Assert.Throws<NotSupportedException> (() => OpenPgpContext.GetHashAlgorithm (DigestAlgorithm.MD4));
Assert.Throws<ArgumentOutOfRangeException> (() => OpenPgpContext.GetDigestAlgorithm ((Org.BouncyCastle.Bcpg.HashAlgorithmTag) 1024));
Assert.Throws<ArgumentNullException> (() => new ApplicationPgpEncrypted ((MimeEntityConstructorArgs) null));
Assert.Throws<ArgumentNullException> (() => new ApplicationPgpSignature ((MimeEntityConstructorArgs) null));
Assert.Throws<ArgumentNullException> (() => new ApplicationPgpSignature ((Stream) null));
// Accept
Assert.Throws<ArgumentNullException> (() => new ApplicationPgpEncrypted ().Accept (null));
Assert.Throws<ArgumentNullException> (() => new ApplicationPgpSignature (stream).Accept (null));
Assert.Throws<ArgumentNullException> (() => ctx.CanSign (null));
Assert.Throws<ArgumentNullException> (() => ctx.CanEncrypt (null));
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.CanSignAsync (null));
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.CanEncryptAsync (null));
// Delete
Assert.Throws<ArgumentNullException> (() => ctx.Delete ((PgpPublicKeyRing) null), "Delete");
Assert.Throws<ArgumentNullException> (() => ctx.Delete ((PgpSecretKeyRing) null), "Delete");
// Decrypt
Assert.Throws<ArgumentNullException> (() => ctx.Decrypt (null), "Decrypt");
// Encrypt
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt (EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, stream), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt (EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, stream), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt ((MailboxAddress[]) null, stream), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt ((PgpPublicKey[]) null, stream), "Encrypt");
Assert.Throws<ArgumentException> (() => ctx.Encrypt (EncryptionAlgorithm.Cast5, emptyMailboxes, stream), "Encrypt");
Assert.Throws<ArgumentException> (() => ctx.Encrypt (EncryptionAlgorithm.Cast5, emptyPubkeys, stream), "Encrypt");
Assert.Throws<ArgumentException> (() => ctx.Encrypt (emptyMailboxes, stream), "Encrypt");
Assert.Throws<ArgumentException> (() => ctx.Encrypt (emptyPubkeys, stream), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt (EncryptionAlgorithm.Cast5, mailboxes, null), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt (EncryptionAlgorithm.Cast5, pubkeys, null), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt (mailboxes, null), "Encrypt");
Assert.Throws<ArgumentNullException> (() => ctx.Encrypt (pubkeys, null), "Encrypt");
// EncryptAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync (EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync (EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync ((MailboxAddress[]) null, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync ((PgpPublicKey[]) null, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.EncryptAsync (EncryptionAlgorithm.Cast5, emptyMailboxes, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.EncryptAsync (EncryptionAlgorithm.Cast5, emptyPubkeys, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.EncryptAsync (emptyMailboxes, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.EncryptAsync (emptyPubkeys, stream), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync (EncryptionAlgorithm.Cast5, mailboxes, null), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync (EncryptionAlgorithm.Cast5, pubkeys, null), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync (mailboxes, null), "EncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.EncryptAsync (pubkeys, null), "EncryptAsync");
// Export
Assert.Throws<ArgumentNullException> (() => ctx.Export ((PgpPublicKeyRingBundle) null), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export ((MailboxAddress[]) null), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export ((PgpPublicKey[]) null), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export ((PgpPublicKeyRingBundle) null, stream, true), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export ((MailboxAddress[]) null, stream, true), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export ((PgpPublicKey[]) null, stream, true), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export (ctx.PublicKeyRingBundle, null, true), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export (mailboxes, null, true), "Export");
Assert.Throws<ArgumentNullException> (() => ctx.Export (pubkeys, null, true), "Export");
// ExportAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync ((PgpPublicKeyRingBundle) null), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync ((MailboxAddress[]) null), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync ((PgpPublicKey[]) null), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync ((PgpPublicKeyRingBundle) null, stream, true), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync ((MailboxAddress[]) null, stream, true), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync ((PgpPublicKey[]) null, stream, true), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync (ctx.PublicKeyRingBundle, null, true), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync (mailboxes, null, true), "ExportAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ExportAsync (pubkeys, null, true), "ExportAsync");
// EnumeratePublicKey[Ring]s
Assert.Throws<ArgumentNullException> (() => ctx.EnumeratePublicKeyRings (null).FirstOrDefault ());
Assert.Throws<ArgumentNullException> (() => ctx.EnumeratePublicKeys (null).FirstOrDefault ());
Assert.Throws<ArgumentNullException> (() => ctx.EnumerateSecretKeyRings (null).FirstOrDefault ());
Assert.Throws<ArgumentNullException> (() => ctx.EnumerateSecretKeys (null).FirstOrDefault ());
// GenerateKeyPair
Assert.Throws<ArgumentNullException> (() => ctx.GenerateKeyPair (null, "password"));
Assert.Throws<ArgumentNullException> (() => ctx.GenerateKeyPair (mailboxes[0], null));
Assert.Throws<ArgumentException> (() => ctx.GenerateKeyPair (mailboxes[0], "password", DateTime.Now));
// DecryptTo
Assert.Throws<ArgumentNullException> (() => ctx.DecryptTo (null, stream), "DecryptTo");
Assert.Throws<ArgumentNullException> (() => ctx.DecryptTo (stream, null), "DecryptTo");
// DecryptToAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.DecryptToAsync (null, stream), "DecryptToAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.DecryptToAsync (stream, null), "DecryptToAsync");
// GetDigestAlgorithmName
Assert.Throws<ArgumentOutOfRangeException> (() => ctx.GetDigestAlgorithmName (DigestAlgorithm.None), "GetDigestAlgorithmName");
// GetPublicKeys
Assert.Throws<ArgumentNullException> (() => ctx.GetPublicKeys (null));
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.GetPublicKeysAsync (null));
Assert.Throws<PublicKeyNotFoundException> (() => ctx.GetPublicKeys (new MailboxAddress[] { clientEastwood }));
Assert.ThrowsAsync<PublicKeyNotFoundException> (() => ctx.GetPublicKeysAsync (new MailboxAddress[] { clientEastwood }));
// GetSigningKey
Assert.Throws<ArgumentNullException> (() => ctx.GetSigningKey (null));
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.GetSigningKeyAsync (null));
Assert.Throws<PrivateKeyNotFoundException> (() => ctx.GetSigningKey (clientEastwood));
Assert.ThrowsAsync<PrivateKeyNotFoundException> (() => ctx.GetSigningKeyAsync (clientEastwood));
// Import
Assert.Throws<ArgumentNullException> (() => ctx.Import ((Stream) null), "Import");
Assert.Throws<ArgumentNullException> (() => ctx.Import ((PgpPublicKeyRing) null), "Import");
Assert.Throws<ArgumentNullException> (() => ctx.Import ((PgpPublicKeyRingBundle) null), "Import");
Assert.Throws<ArgumentNullException> (() => ctx.Import ((PgpSecretKeyRing) null), "Import");
Assert.Throws<ArgumentNullException> (() => ctx.Import ((PgpSecretKeyRingBundle) null), "Import");
// ImportAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ImportAsync ((Stream) null), "ImportAsync");
//Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ImportAsync ((PgpPublicKeyRing) null), "ImportAsync");
//Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ImportAsync ((PgpPublicKeyRingBundle) null), "ImportAsync");
//Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ImportAsync ((PgpSecretKeyRing) null), "ImportAsync");
//Assert.ThrowsAsync<ArgumentNullException> (() => ctx.ImportAsync ((PgpSecretKeyRingBundle) null), "ImportAsync");
// Sign
Assert.Throws<ArgumentNullException> (() => ctx.Sign ((MailboxAddress) null, DigestAlgorithm.Sha1, stream), "Sign");
Assert.Throws<ArgumentNullException> (() => ctx.Sign ((PgpSecretKey) null, DigestAlgorithm.Sha1, stream), "Sign");
Assert.Throws<ArgumentNullException> (() => ctx.Sign (mailboxes[0], DigestAlgorithm.Sha1, null), "Sign");
Assert.Throws<ArgumentNullException> (() => ctx.Sign (key, DigestAlgorithm.Sha1, null), "Sign");
// SignAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAsync ((MailboxAddress) null, DigestAlgorithm.Sha1, stream), "SignAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAsync ((PgpSecretKey) null, DigestAlgorithm.Sha1, stream), "SignAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAsync (mailboxes[0], DigestAlgorithm.Sha1, null), "SignAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAsync (key, DigestAlgorithm.Sha1, null), "SignAsync");
// SignAndEncrypt
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt ((MailboxAddress) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt ((PgpSecretKey) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, stream), "SignAndEncrypt");
Assert.Throws<ArgumentException> (() => ctx.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyMailboxes, stream), "SignAndEncrypt");
Assert.Throws<ArgumentException> (() => ctx.SignAndEncrypt (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyPubkeys, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, null), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, null), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt ((MailboxAddress) null, DigestAlgorithm.Sha1, mailboxes, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt ((PgpSecretKey) null, DigestAlgorithm.Sha1, pubkeys, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, (MailboxAddress[]) null, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (key, DigestAlgorithm.Sha1, (PgpPublicKey[]) null, stream), "SignAndEncrypt");
Assert.Throws<ArgumentException> (() => ctx.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, emptyMailboxes, stream), "SignAndEncrypt");
Assert.Throws<ArgumentException> (() => ctx.SignAndEncrypt (key, DigestAlgorithm.Sha1, emptyPubkeys, stream), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, mailboxes, null), "SignAndEncrypt");
Assert.Throws<ArgumentNullException> (() => ctx.SignAndEncrypt (key, DigestAlgorithm.Sha1, pubkeys, null), "SignAndEncrypt");
// SignAndEncryptAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync ((MailboxAddress) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync ((PgpSecretKey) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyMailboxes, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyPubkeys, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, null), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, null), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync ((MailboxAddress) null, DigestAlgorithm.Sha1, mailboxes, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync ((PgpSecretKey) null, DigestAlgorithm.Sha1, pubkeys, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, (MailboxAddress[]) null, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, (PgpPublicKey[]) null, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, emptyMailboxes, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentException> (() => ctx.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, emptyPubkeys, stream), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, mailboxes, null), "SignAndEncryptAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, pubkeys, null), "SignAndEncryptAsync");
// SignKey
Assert.Throws<ArgumentNullException> (() => ctx.SignKey (null, pubkeys[0]), "SignKey");
Assert.Throws<ArgumentNullException> (() => ctx.SignKey (key, null), "SignKey");
// Supports
Assert.Throws<ArgumentNullException> (() => ctx.Supports (null), "Supports");
// Verify
Assert.Throws<ArgumentNullException> (() => ctx.Verify (null, stream), "Verify");
Assert.Throws<ArgumentNullException> (() => ctx.Verify (stream, null), "Verify");
// VerifyAsync
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.VerifyAsync (null, stream), "VerifyAsync");
Assert.ThrowsAsync<ArgumentNullException> (() => ctx.VerifyAsync (stream, null), "VerifyAsync");
// MultipartEncrypted
// Encrypt
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt ((MailboxAddress[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt ((PgpPublicKey[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (pubkeys, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (null, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, (MailboxAddress[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (ctx, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (null, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, (PgpPublicKey[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (ctx, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, pubkeys, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (EncryptionAlgorithm.Cast5, pubkeys, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (null, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (ctx, EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (null, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.Encrypt (ctx, EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.Encrypt (ctx, EncryptionAlgorithm.Cast5, pubkeys, null));
// EncryptAsync
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync ((MailboxAddress[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync ((PgpPublicKey[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (pubkeys, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (null, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, (MailboxAddress[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (ctx, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (null, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, (PgpPublicKey[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (ctx, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, pubkeys, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (EncryptionAlgorithm.Cast5, pubkeys, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (null, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, EncryptionAlgorithm.Cast5, (MailboxAddress[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (ctx, EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (null, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, EncryptionAlgorithm.Cast5, (PgpPublicKey[]) null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.EncryptAsync (ctx, EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.EncryptAsync (ctx, EncryptionAlgorithm.Cast5, pubkeys, null));
// SignAndEncrypt
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt ((MailboxAddress) null, DigestAlgorithm.Sha1, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt ((PgpSecretKey) null, DigestAlgorithm.Sha1, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (key, DigestAlgorithm.Sha1, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (key, DigestAlgorithm.Sha1, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (key, DigestAlgorithm.Sha1, pubkeys, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (null, mailboxes[0], DigestAlgorithm.Sha1, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, (MailboxAddress) null, DigestAlgorithm.Sha1, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, mailboxes[0], DigestAlgorithm.Sha1, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (ctx, mailboxes[0], DigestAlgorithm.Sha1, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, mailboxes[0], DigestAlgorithm.Sha1, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (null, key, DigestAlgorithm.Sha1, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, (PgpSecretKey) null, DigestAlgorithm.Sha1, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, key, DigestAlgorithm.Sha1, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (ctx, key, DigestAlgorithm.Sha1, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, key, DigestAlgorithm.Sha1, pubkeys, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt ((MailboxAddress) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt ((PgpSecretKey) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (null, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, (MailboxAddress) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (ctx, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (null, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, (PgpSecretKey) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.Throws<ArgumentException> (() => MultipartEncrypted.SignAndEncrypt (ctx, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.Throws<ArgumentNullException> (() => MultipartEncrypted.SignAndEncrypt (ctx, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, null));
// SignAndEncryptAsync
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync ((MailboxAddress) null, DigestAlgorithm.Sha1, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync ((PgpSecretKey) null, DigestAlgorithm.Sha1, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, pubkeys, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (null, mailboxes[0], DigestAlgorithm.Sha1, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, (MailboxAddress) null, DigestAlgorithm.Sha1, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (null, key, DigestAlgorithm.Sha1, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, (PgpSecretKey) null, DigestAlgorithm.Sha1, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, key, DigestAlgorithm.Sha1, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, key, DigestAlgorithm.Sha1, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, key, DigestAlgorithm.Sha1, pubkeys, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync ((MailboxAddress) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync ((PgpSecretKey) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (null, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, (MailboxAddress) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyMailboxes, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, mailboxes, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (null, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, (PgpSecretKey) null, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, null, entity));
Assert.ThrowsAsync<ArgumentException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, emptyPubkeys, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartEncrypted.SignAndEncryptAsync (ctx, key, DigestAlgorithm.Sha1, EncryptionAlgorithm.Cast5, pubkeys, null));
var encrypted = new MultipartEncrypted ();
Assert.Throws<ArgumentNullException> (() => encrypted.Accept (null));
Assert.Throws<ArgumentNullException> (() => encrypted.Decrypt (null));
Assert.Throws<ArgumentNullException> (() => encrypted.Decrypt (null, out signatures));
// MultipartSigned.Create
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (null, mailboxes[0], DigestAlgorithm.Sha1, entity));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (ctx, (MailboxAddress) null, DigestAlgorithm.Sha1, entity));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (ctx, mailboxes[0], DigestAlgorithm.Sha1, null));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (null, key, DigestAlgorithm.Sha1, entity));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (ctx, (PgpSecretKey) null, DigestAlgorithm.Sha1, entity));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (ctx, key, DigestAlgorithm.Sha1, null));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create ((PgpSecretKey) null, DigestAlgorithm.Sha1, entity));
Assert.Throws<ArgumentNullException> (() => MultipartSigned.Create (key, DigestAlgorithm.Sha1, null));
// MultipartSigned.CreateAsync
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (null, mailboxes[0], DigestAlgorithm.Sha1, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (ctx, (MailboxAddress) null, DigestAlgorithm.Sha1, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (ctx, mailboxes[0], DigestAlgorithm.Sha1, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (null, key, DigestAlgorithm.Sha1, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (ctx, (PgpSecretKey) null, DigestAlgorithm.Sha1, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (ctx, key, DigestAlgorithm.Sha1, null));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync ((PgpSecretKey) null, DigestAlgorithm.Sha1, entity));
Assert.ThrowsAsync<ArgumentNullException> (() => MultipartSigned.CreateAsync (key, DigestAlgorithm.Sha1, null));
var signed = MultipartSigned.Create (key, DigestAlgorithm.Sha1, entity);
Assert.Throws<ArgumentNullException> (() => signed.Accept (null));
Assert.Throws<ArgumentOutOfRangeException> (() => signed.Prepare (EncodingConstraint.SevenBit, 0));
Assert.Throws<ArgumentNullException> (() => signed.Verify (null));
Assert.ThrowsAsync<ArgumentNullException> (() => signed.VerifyAsync (null));
}
}
static void PumpDataThroughFilter (IMimeFilter filter, string fileName, bool isText)
{
using (var stream = File.OpenRead (fileName)) {
using (var filtered = new FilteredStream (stream)) {
var buffer = new byte[1];
int outputLength;
int outputIndex;
int n;
if (isText)
filtered.Add (new Unix2DosFilter ());
while ((n = filtered.Read (buffer, 0, buffer.Length)) > 0)
filter.Filter (buffer, 0, n, out outputIndex, out outputLength);
filter.Flush (buffer, 0, 0, out outputIndex, out outputLength);
}
}
}
[Test]
public void TestOpenPgpDetectionFilter ()
{
var filter = new OpenPgpDetectionFilter ();
PumpDataThroughFilter (filter, Path.Combine (TestHelper.ProjectDir, "TestData", "openpgp", "mimekit.gpg.pub"), true);
Assert.AreEqual (OpenPgpDataType.PublicKey, filter.DataType);
Assert.AreEqual (0, filter.BeginOffset);
Assert.AreEqual (1754, filter.EndOffset);
filter.Reset ();
PumpDataThroughFilter (filter, Path.Combine (TestHelper.ProjectDir, "TestData", "openpgp", "mimekit.gpg.sec"), true);
Assert.AreEqual (OpenPgpDataType.PrivateKey, filter.DataType);
Assert.AreEqual (0, filter.BeginOffset);
Assert.AreEqual (3650, filter.EndOffset);
}
}
}
| Java |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="el_GR" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Number7</source>
<translation>Σχετικά με το Number7</translation>
</message>
<message>
<location line="+39"/>
<source><b>Number7</b> version</source>
<translation>Έκδοση Number7</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Πνευματική ιδιοκτησία </translation>
</message>
<message>
<location line="+0"/>
<source>The Number7 developers</source>
<translation>Οι Number7 προγραμματιστές </translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Βιβλίο Διευθύνσεων</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Διπλό-κλικ για επεξεργασία της διεύθυνσης ή της ετικέτας</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Δημιούργησε νέα διεύθυνση</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Αντέγραψε την επιλεγμένη διεύθυνση στο πρόχειρο του συστήματος</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Νέα διεύθυνση</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Number7 addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Αυτές είναι οι Number7 διευθύνσεις σας για να λαμβάνετε πληρωμές. Δίνοντας μία ξεχωριστή διεύθυνση σε κάθε αποστολέα, θα μπορείτε να ελέγχετε ποιος σας πληρώνει.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Αντιγραφή διεύθυνσης</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Δείξε &QR κωδικα</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Number7 address</source>
<translation>Υπογράψτε ένα μήνυμα για ν' αποδείξετε πως σας ανήκει μια συγκεκριμένη διεύθυνση Number7</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>&Υπέγραψε το μήνυμα</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Αντιγραφη της επιλεγμενης διεύθυνσης στο πρόχειρο του συστηματος</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Εξαγωγή δεδομένων καρτέλας σε αρχείο</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation>&Εξαγωγή</translation>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Number7 address</source>
<translation>Υπογράψτε ένα μήνυμα για ν' αποδείξετε πως ανήκει μια συγκεκριμένη διεύθυνση Number7</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Επιβεβαίωση μηνύματος</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Διαγραφή</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Number7 addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>Αυτές είναι οι Number7 διευθύνσεις σας για να λαμβάνετε πληρωμές. Δίνοντας μία ξεχωριστή διεύθυνση σε κάθε αποστολέα, θα μπορείτε να ελέγχετε ποιος σας πληρώνει.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Αντιγραφή &επιγραφής</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Επεξεργασία</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Αποστολή νομισμάτων</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Εξαγωγή Δεδομενων Βιβλίου Διευθύνσεων</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Αρχείο οριοθετημένο με κόμματα (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Εξαγωγή λαθών</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Αδυναμία εγγραφής στο αρχείο %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Ετικέτα</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Διεύθυνση</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(χωρίς ετικέτα)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Φράση πρόσβασης </translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Βάλτε κωδικό πρόσβασης</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Νέος κωδικός πρόσβασης</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Επανέλαβε τον νέο κωδικό πρόσβασης</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Εισάγετε τον νέο κωδικό πρόσβασης στον πορτοφόλι <br/> Παρακαλώ χρησιμοποιείστε ένα κωδικό με <b> 10 ή περισσότερους τυχαίους χαρακτήρες</b> ή <b> οχτώ ή παραπάνω λέξεις</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Κρυπτογράφησε το πορτοφόλι</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Αυτη η ενεργεία χρειάζεται τον κωδικό του πορτοφολιού για να ξεκλειδώσει το πορτοφόλι.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Ξεκλειδωσε το πορτοφολι</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Αυτη η ενεργεια χρειάζεται τον κωδικο του πορτοφολιου για να αποκρυπτογραφησειι το πορτοφολι.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Αποκρυπτογράφησε το πορτοφολι</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Άλλαξε κωδικο πρόσβασης</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Εισάγετε τον παλιό και τον νεο κωδικο στο πορτοφολι.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Επιβεβαίωσε την κρυπτογραφηση του πορτοφολιού</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR NUMBER7S</b>!</source>
<translation>Προσοχη: Εαν κρυπτογραφησεις το πορτοφολι σου και χάσεις τον κωδικο σου θα χάσεις <b> ΟΛΑ ΣΟΥ ΤΑ NUMBER7S</b>!
Είσαι σίγουρος ότι θέλεις να κρυπτογραφησεις το πορτοφολι;</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Είστε σίγουροι ότι θέλετε να κρυπτογραφήσετε το πορτοφόλι σας;</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>ΣΗΜΑΝΤΙΚΟ: Τα προηγούμενα αντίγραφα ασφαλείας που έχετε κάνει από το αρχείο του πορτοφόλιου σας θα πρέπει να αντικατασταθουν με το νέο που δημιουργείται, κρυπτογραφημένο αρχείο πορτοφόλιου. Για λόγους ασφαλείας, τα προηγούμενα αντίγραφα ασφαλείας του μη κρυπτογραφημένου αρχείου πορτοφόλιου θα καταστουν άχρηστα μόλις αρχίσετε να χρησιμοποιείτε το νέο κρυπτογραφημένο πορτοφόλι. </translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Προσοχη: το πλήκτρο Caps Lock είναι ενεργο.</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Κρυπτογραφημενο πορτοφολι</translation>
</message>
<message>
<location line="-56"/>
<source>Number7 will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your number7s from being stolen by malware infecting your computer.</source>
<translation>Το Number7 θα κλεισει τώρα για να τελειώσει την διαδικασία κρυπτογραφησης. Θυμησου ότι κρυπτογραφώντας το πορτοφολι σου δεν μπορείς να προστατέψεις πλήρως τα number7s σου από κλοπή στην περίπτωση όπου μολυνθεί ο υπολογιστής σου με κακόβουλο λογισμικο.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Η κρυπτογραφηση του πορτοφολιού απέτυχε</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Η κρυπτογράφηση του πορτοφολιού απέτυχε λογω εσωτερικού σφάλματος. Το πορτοφολι δεν κρυπτογραφηθηκε.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Οι εισαχθέντες κωδικοί δεν ταιριάζουν.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>το ξεκλείδωμα του πορτοφολιού απέτυχε</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Ο κωδικος που εισήχθη για την αποκρυπτογραφηση του πορτοφολιού ήταν λαθος.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Η αποκρυπτογραφηση του πορτοφολιού απέτυχε</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Ο κωδικος του πορτοφολιού άλλαξε με επιτυχία.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Υπογραφή &Μηνύματος...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Συγχρονισμός με το δίκτυο...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Επισκόπηση</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Εμφάνισε γενική εικονα του πορτοφολιού</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Συναλλαγές</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Περιήγηση στο ιστορικο συνναλαγων</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Εξεργασια της λιστας των αποθηκευμενων διευθύνσεων και ετικετων</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Εμφάνισε την λίστα των διευθύνσεων για την παραλαβή πληρωμων</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>Έ&ξοδος</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Εξοδος από την εφαρμογή</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Number7</source>
<translation>Εμφάνισε πληροφορίες σχετικά με το Number7</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Σχετικά με &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Εμφάνισε πληροφορίες σχετικά με Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Επιλογές...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Κρυπτογράφησε το πορτοφόλι</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Αντίγραφο ασφαλείας του πορτοφολιού</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Άλλαξε κωδικο πρόσβασης</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Εισαγωγή μπλοκ από τον σκληρο δίσκο ... </translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Φόρτωση ευρετηρίου μπλοκ στον σκληρο δισκο...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Number7 address</source>
<translation>Στείλε νομισματα σε μια διεύθυνση number7</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Number7</source>
<translation>Επεργασία ρυθμισεων επιλογών για το Number7</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Δημιουργία αντιγράφου ασφαλείας πορτοφολιού σε άλλη τοποθεσία</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Αλλαγή του κωδικού κρυπτογράφησης του πορτοφολιού</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Παράθυρο αποσφαλμάτωσης</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Άνοιγμα κονσόλας αποσφαλμάτωσης και διαγνωστικών</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>&Επιβεβαίωση μηνύματος</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Number7</source>
<translation>Number7</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Πορτοφόλι</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>&Αποστολή</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>&Παραλαβή </translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>&Διεύθυνσεις</translation>
</message>
<message>
<location line="+22"/>
<source>&About Number7</source>
<translation>&Σχετικα:Number7</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Εμφάνισε/Κρύψε</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Εμφάνιση ή αποκρύψη του κεντρικου παράθυρου </translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Κρυπτογραφήστε τα ιδιωτικά κλειδιά που ανήκουν στο πορτοφόλι σας </translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Number7 addresses to prove you own them</source>
<translation>Υπογράψτε ένα μήνυμα για να βεβαιώσετε πως είστε ο κάτοχος αυτής της διεύθυνσης</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Number7 addresses</source>
<translation>Υπογράψτε ένα μήνυμα για ν' αποδείξετε πως ανήκει μια συγκεκριμένη διεύθυνση Number7</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Αρχείο</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Ρυθμίσεις</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Βοήθεια</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Εργαλειοθήκη καρτελών</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Number7 client</source>
<translation>Πελάτης Number7</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Number7 network</source>
<translation><numerusform>%n ενεργή σύνδεση στο δίκτυο Number7</numerusform><numerusform>%n ενεργές συνδέσεις στο δίκτυο Βitcoin</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation>Η πηγή του μπλοκ δεν ειναι διαθέσιμη... </translation>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation>Μεταποιημένα %1 απο % 2 (κατ 'εκτίμηση) μπλοκ της ιστορίας της συναλλαγής. </translation>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>Έγινε λήψη %1 μπλοκ ιστορικού συναλλαγών</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n ώρες </numerusform><numerusform>%n ώρες </numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n ημέρες </numerusform><numerusform>%n ημέρες </numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n εβδομαδες</numerusform><numerusform>%n εβδομαδες</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation>%1 πίσω</translation>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>Το τελευταίο μπλοκ που ελήφθη δημιουργήθηκε %1 πριν.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation>Οι συναλλαγές μετά από αυτό δεν θα είναι ακόμη ορατες.</translation>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Σφάλμα</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Προειδοποίηση</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Πληροφορία</translation>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation>Η συναλλαγή ξεπερνάει το όριο.
Μπορεί να ολοκληρωθεί με μια αμοιβή των %1, η οποία αποδίδεται στους κόμβους που επεξεργάζονται τις συναλλαγές και βοηθούν στην υποστήριξη του δικτύου.
Θέλετε να συνεχίσετε;</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Ενημερωμένο</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Ενημέρωση...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Επιβεβαίωση αμοιβής συναλλαγής</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Η συναλλαγή απεστάλη</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Εισερχόμενη συναλλαγή</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Ημερομηνία: %1
Ποσό: %2
Τύπος: %3
Διεύθυνση: %4
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>Χειρισμός URI</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Number7 address or malformed URI parameters.</source>
<translation>Το URI δεν μπορεί να αναλυθεί! Αυτό μπορεί να προκληθεί από μια μη έγκυρη διεύθυνση Number7 ή ακατάλληλη παραμέτρο URI.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Το πορτοφόλι είναι <b>κρυπτογραφημένο</b> και <b>ξεκλείδωτο</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Το πορτοφόλι είναι <b>κρυπτογραφημένο</b> και <b>κλειδωμένο</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Number7 can no longer continue safely and will quit.</source>
<translation>Παρουσιάστηκε ανεπανόρθωτο σφάλμα. Το Number7 δεν μπορεί πλέον να συνεχίσει με ασφάλεια και θα τερματισθει.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Ειδοποίηση Δικτύου</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Επεξεργασία Διεύθυνσης</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Επιγραφή</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Η επιγραφή που σχετίζεται με αυτή την καταχώρηση του βιβλίου διευθύνσεων</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Διεύθυνση</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Η διεύθυνση που σχετίζεται με αυτή την καταχώρηση του βιβλίου διευθύνσεων. Μπορεί να τροποποιηθεί μόνο για τις διευθύνσεις αποστολής.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Νέα διεύθυνση λήψης</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Νέα διεύθυνση αποστολής</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Επεξεργασία διεύθυνσης λήψης</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Επεξεργασία διεύθυνσης αποστολής</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Η διεύθυνση "%1" βρίσκεται ήδη στο βιβλίο διευθύνσεων.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Number7 address.</source>
<translation>Η διεύθυνση "%1" δεν είναι έγκυρη Number7 διεύθυνση.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Δεν είναι δυνατό το ξεκλείδωμα του πορτοφολιού.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Η δημιουργία νέου κλειδιού απέτυχε.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Number7-Qt</source>
<translation>number7-qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>έκδοση</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Χρήση:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>επιλογής γραμμής εντολών</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>επιλογές UI</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Όρισε γλώσσα, για παράδειγμα "de_DE"(προεπιλογή:τοπικές ρυθμίσεις)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Έναρξη ελαχιστοποιημένο</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Εμφάνισε την οθόνη εκκίνησης κατά την εκκίνηση(προεπιλογή:1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Ρυθμίσεις</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Κύριο</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation>Η προαιρετική αμοιβή για κάθε kB επισπεύδει την επεξεργασία των συναλλαγών σας. Οι περισσότερες συναλλαγές είναι 1 kB. </translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Αμοιβή &συναλλαγής</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Number7 after logging in to the system.</source>
<translation>Αυτόματη εκκίνηση του Number7 μετά την εισαγωγή στο σύστημα</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Number7 on system login</source>
<translation>&Έναρξη του Βιtcoin κατά την εκκίνηση του συστήματος</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>Επαναφορα όλων των επιλογων του πελάτη σε default.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>Επαναφορα ρυθμίσεων</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Δίκτυο</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Number7 client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Αυτόματο άνοιγμα των θυρών Number7 στον δρομολογητή. Λειτουργεί μόνο αν ο δρομολογητής σας υποστηρίζει τη λειτουργία UPnP.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Απόδοση θυρών με χρήστη &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Number7 network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Σύνδεση στο Number7 δίκτυο μέσω διαμεσολαβητή SOCKS4 (π.χ. για σύνδεση μέσω Tor)</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Σύνδεση μέσω διαμεσολαβητή SOCKS</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>&IP διαμεσολαβητή:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Διεύθυνση IP του διαμεσολαβητή (π.χ. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Θύρα:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Θύρα διαμεσολαβητή</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &Έκδοση:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>SOCKS εκδοση του διαμεσολαβητη (e.g. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Παράθυρο</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Εμφάνιση μόνο εικονιδίου στην περιοχή ειδοποιήσεων κατά την ελαχιστοποίηση</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Ελαχιστοποίηση στην περιοχή ειδοποιήσεων αντί της γραμμής εργασιών</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Ελαχιστοποίηση αντί για έξοδο κατά το κλείσιμο του παραθύρου</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>Ε&λαχιστοποίηση κατά το κλείσιμο</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>%Απεικόνιση</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Γλώσσα περιβάλλοντος εργασίας: </translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Number7.</source>
<translation>Εδώ μπορεί να ρυθμιστεί η γλώσσα διεπαφής χρήστη. Αυτή η ρύθμιση θα ισχύσει μετά την επανεκκίνηση του Number7.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Μονάδα μέτρησης:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Διαλέξτε την προεπιλεγμένη υποδιαίρεση που θα εμφανίζεται όταν στέλνετε νομίσματα.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Number7 addresses in the transaction list or not.</source>
<translation>Επιλέξτε αν θέλετε να εμφανίζονται οι διευθύνσεις Number7 στη λίστα συναλλαγών.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>Εμφάνιση διευθύνσεων στη λίστα συναλλαγών</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&ΟΚ</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Ακύρωση</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Εφαρμογή</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>προεπιλογή</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>Επιβεβαιώση των επιλογων επαναφοράς </translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>Για ορισμένες ρυθμίσεις πρεπει η επανεκκίνηση να τεθεί σε ισχύ.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>Θέλετε να προχωρήσετε;</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Προειδοποίηση</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Number7.</source>
<translation>Αυτή η ρύθμιση θα ισχύσει μετά την επανεκκίνηση του Number7.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Δεν είναι έγκυρη η διεύθυνση διαμεσολαβητή</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Φόρμα</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Number7 network after a connection is established, but this process has not completed yet.</source>
<translation>Οι πληροφορίες που εμφανίζονται μπορεί να είναι ξεπερασμένες. Το πορτοφόλι σας συγχρονίζεται αυτόματα με το δίκτυο Number7 μετά από μια σύνδεση, αλλά αυτή η διαδικασία δεν έχει ακόμη ολοκληρωθεί. </translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Υπόλοιπο</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Ανεπιβεβαίωτες</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Πορτοφόλι</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Ανώριμος</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Εξορυγμενο υπόλοιπο που δεν έχει ακόμα ωριμάσει </translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Πρόσφατες συναλλαγές</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Το τρέχον υπόλοιπο</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Το άθροισμα των συναλλαγών που δεν έχουν ακόμα επιβεβαιωθεί και δεν προσμετρώνται στο τρέχον υπόλοιπό σας</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>εκτός συγχρονισμού</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start number7: click-to-pay handler</source>
<translation>Δεν είναι δυνατή η εκκίνηση του Number7: click-to-pay handler</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>Κώδικας QR</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Αίτηση πληρωμής</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Ποσό:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Επιγραφή:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Μήνυμα:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Αποθήκευση ως...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Σφάλμα κατά την κωδικοποίηση του URI σε κώδικα QR</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Το αναγραφόμενο ποσό δεν είναι έγκυρο, παρακαλούμε να το ελέγξετε.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Το αποτέλεσμα της διεύθυνσης είναι πολύ μεγάλο. Μειώστε το μέγεθος για το κείμενο της ετικέτας/ μηνύματος.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Αποθήκευση κώδικα QR</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>Εικόνες PNG (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Όνομα Πελάτη</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation>Μη διαθέσιμο</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Έκδοση Πελάτη</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Πληροφορία</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Χρησιμοποιηση της OpenSSL εκδοσης</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Χρόνος εκκίνησης</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Δίκτυο</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Αριθμός συνδέσεων</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Στο testnet</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>αλυσίδα εμποδισμού</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Τρέχον αριθμός μπλοκ</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Κατ' εκτίμηση συνολικά μπλοκς</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Χρόνος τελευταίου μπλοκ</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Άνοιγμα</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>επιλογής γραμμής εντολών</translation>
</message>
<message>
<location line="+7"/>
<source>Show the Number7-Qt help message to get a list with possible Number7 command-line options.</source>
<translation>Εμφανιση του Number7-Qt μήνυματος βοήθειας για να πάρετε μια λίστα με τις πιθανές επιλογές Number7 γραμμής εντολών.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Εμφάνιση</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Κονσόλα</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Ημερομηνία κατασκευής</translation>
</message>
<message>
<location line="-104"/>
<source>Number7 - Debug window</source>
<translation>Number7 - Παράθυρο αποσφαλμάτωσης</translation>
</message>
<message>
<location line="+25"/>
<source>Number7 Core</source>
<translation>Number7 Core</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Αρχείο καταγραφής εντοπισμού σφαλμάτων </translation>
</message>
<message>
<location line="+7"/>
<source>Open the Number7 debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Ανοίξτε το αρχείο καταγραφής εντοπισμού σφαλμάτων από τον τρέχοντα κατάλογο δεδομένων. Αυτό μπορεί να πάρει μερικά δευτερόλεπτα για τα μεγάλα αρχεία καταγραφής. </translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Καθαρισμός κονσόλας</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Number7 RPC console.</source>
<translation>Καλώς ήρθατε στην Number7 RPC κονσόλα.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Χρησιμοποιήστε το πάνω και κάτω βέλος για να περιηγηθείτε στο ιστορικο, και <b>Ctrl-L</b> για εκκαθαριση οθονης.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Γράψτε <b>βοήθεια</b> για μια επισκόπηση των διαθέσιμων εντολών</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Αποστολή νομισμάτων</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Αποστολή σε πολλούς αποδέκτες ταυτόχρονα</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&Προσθήκη αποδέκτη</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Διαγραφή όλων των πεδίων συναλλαγής</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Καθαρισμός &Όλων</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Υπόλοιπο:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123,456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Επιβεβαίωση αποστολής</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>Αποστολη</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> σε %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Επιβεβαίωση αποστολής νομισμάτων</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Είστε βέβαιοι για την αποστολή %1;</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>και</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Η διεύθυνση του αποδέκτη δεν είναι σωστή. Παρακαλώ ελέγξτε ξανά.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Το ποσό πληρωμής πρέπει να είναι μεγαλύτερο από 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Το ποσό ξεπερνάει το διαθέσιμο υπόλοιπο</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Το σύνολο υπερβαίνει το υπόλοιπό σας όταν συμπεριληφθεί και η αμοιβή %1</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Βρέθηκε η ίδια διεύθυνση δύο φορές. Επιτρέπεται μία μόνο εγγραφή για κάθε διεύθυνση, σε κάθε διαδικασία αποστολής.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Σφάλμα: Η δημιουργία της συναλλαγής απέτυχε</translation>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Σφάλμα: Η συναλλαγή απερρίφθη. Αυτό ενδέχεται να συμβαίνει αν κάποια από τα νομίσματα έχουν ήδη ξοδευθεί, όπως αν χρησιμοποιήσατε αντίγραφο του wallet.dat και τα νομίσματα ξοδεύθηκαν εκεί.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Φόρμα</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Ποσό:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Πληρωμή &σε:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Διεύθυνση αποστολής της πληρωμής (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Εισάγετε μια επιγραφή για αυτή τη διεύθυνση ώστε να καταχωρηθεί στο βιβλίο διευθύνσεων</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Επιγραφή</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Επιλογή διεύθυνσης από το βιβλίο διευθύνσεων</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Επικόλληση διεύθυνσης από το πρόχειρο</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Αφαίρεση αποδέκτη</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Number7 address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Εισάγετε μια διεύθυνση Number7 (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Υπογραφές - Είσοδος / Επαλήθευση μήνυματος </translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>&Υπογραφή Μηνύματος</translation>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Μπορείτε να υπογράφετε μηνύματα με τις διευθύνσεις σας, ώστε ν' αποδεικνύετε πως αυτές σας ανήκουν. Αποφεύγετε να υπογράφετε κάτι αόριστο καθώς ενδέχεται να εξαπατηθείτε. Υπογράφετε μόνο πλήρης δηλώσεις με τις οποίες συμφωνείτε.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Εισάγετε μια διεύθυνση Number7 (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Επιλογή διεύθυνσης από το βιβλίο διευθύνσεων</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Επικόλληση διεύθυνσης από το βιβλίο διευθύνσεων</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Εισάγετε εδώ το μήνυμα που θέλετε να υπογράψετε</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>Υπογραφή</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Αντέγραφη της επιλεγμενης διεύθυνσης στο πρόχειρο του συστηματος</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Number7 address</source>
<translation>Υπογράψτε ένα μήνυμα για ν' αποδείξετε πως σας ανήκει μια συγκεκριμένη διεύθυνση Number7</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Υπογραφη μήνυματος</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Επαναφορά όλων των πεδίων μήνυματος</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Καθαρισμός &Όλων</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>&Επιβεβαίωση μηνύματος</translation>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Πληκτρολογήστε την υπογραφή διεύθυνσης, μήνυμα (βεβαιωθείτε ότι έχετε αντιγράψει τις αλλαγές γραμμής, κενά, tabs, κ.λπ. ακριβώς) και την υπογραφή παρακάτω, για να ελέγξει το μήνυμα. Να είστε προσεκτικοί για να μην διαβάσετε περισσότερα στην υπογραφή ό, τι είναι στην υπογραφή ίδιο το μήνυμα , για να μην εξαπατηθούν από έναν άνθρωπο -in - the-middle επίθεση.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Εισάγετε μια διεύθυνση Number7 (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Number7 address</source>
<translation>Υπογράψτε ένα μήνυμα για ν' αποδείξετε πως υπογραφθηκε απο μια συγκεκριμένη διεύθυνση Number7</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>Επιβεβαίωση μηνύματος</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Επαναφορά όλων επαλήθευμενων πεδίων μήνυματος </translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Number7 address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Εισάγετε μια διεύθυνση Number7 (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Κάντε κλικ στο "Υπογραφή Μηνύματος" για να λάβετε την υπογραφή</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Number7 signature</source>
<translation>Εισαγωγή υπογραφής Number7</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Η διεύθυνση που εισήχθη είναι λάθος.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Παρακαλούμε ελέγξτε την διεύθυνση και δοκιμάστε ξανά.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Η διεύθυνση που έχει εισαχθεί δεν αναφέρεται σε ένα πλήκτρο.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>το ξεκλείδωμα του πορτοφολιού απέτυχε</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Το προσωπικό κλειδί εισαγμενης διευθυνσης δεν είναι διαθέσιμο.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Η υπογραφή του μηνύματος απέτυχε.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Μήνυμα υπεγράφη.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Η υπογραφή δεν μπόρεσε να αποκρυπτογραφηθεί.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Παρακαλούμε ελέγξτε την υπογραφή και δοκιμάστε ξανά.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Η υπογραφή δεν ταιριάζει με το μήνυμα. </translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Η επιβεβαίωση του μηνύματος απέτυχε</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Μήνυμα επιβεβαιώθηκε.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Number7 developers</source>
<translation>Οι Number7 προγραμματιστές </translation>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Ανοιχτό μέχρι %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/χωρίς σύνδεση;</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/χωρίς επιβεβαίωση</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 επιβεβαιώσεις</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Κατάσταση</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, έχει μεταδοθεί μέσω %n κόμβων</numerusform><numerusform>, έχει μεταδοθεί μέσω %n κόμβων</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Ημερομηνία</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Πηγή</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Δημιουργία </translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Από</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Προς</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation> δική σας διεύθυνση </translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>eπιγραφή</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Πίστωση </translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>ωρίμανση σε %n επιπλέον μπλοκ</numerusform><numerusform>ωρίμανση σε %n επιπλέον μπλοκ</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>μη αποδεκτό</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debit</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Τέλος συναλλαγής </translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Καθαρό ποσό</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Μήνυμα</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Σχόλιο:</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>ID Συναλλαγής:</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 7 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Πρέπει να περιμένετε 7 μπλοκ πριν μπορέσετε να χρησιμοποιήσετε τα νομίσματα που έχετε δημιουργήσει. Το μπλοκ που δημιουργήσατε μεταδόθηκε στο δίκτυο για να συμπεριληφθεί στην αλυσίδα των μπλοκ. Αν δεν μπει σε αυτή θα μετατραπεί σε "μη αποδεκτό" και δε θα μπορεί να καταναλωθεί. Αυτό συμβαίνει σπάνια όταν κάποιος άλλος κόμβος δημιουργήσει ένα μπλοκ λίγα δευτερόλεπτα πριν από εσάς.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Πληροφορίες αποσφαλμάτωσης</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Συναλλαγή</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>εισροές </translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Ποσό</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>αληθής</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>αναληθής </translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, δεν έχει ακόμα μεταδοθεί μ' επιτυχία</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Ανοιχτό για %n μπλοκ</numerusform><numerusform>Ανοιχτό για %n μπλοκ</numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>άγνωστο</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Λεπτομέρειες συναλλαγής</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Αυτό το παράθυρο δείχνει μια λεπτομερή περιγραφή της συναλλαγής</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Ημερομηνία</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Τύπος</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Διεύθυνση</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Ποσό</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Ανοιχτό για %n μπλοκ</numerusform><numerusform>Ανοιχτό για %n μπλοκ</numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Ανοιχτό μέχρι %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Χωρίς σύνδεση (%1 επικυρώσεις)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Χωρίς επιβεβαίωση (%1 από %2 επικυρώσεις)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Επικυρωμένη (%1 επικυρώσεις)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>Το υπόλοιπο από την εξόρυξη θα είναι διαθέσιμο μετά από %n μπλοκ</numerusform><numerusform>Το υπόλοιπο από την εξόρυξη θα είναι διαθέσιμο μετά από %n μπλοκ</numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Αυτό το μπλοκ δεν έχει παραληφθεί από κανέναν άλλο κόμβο και κατά πάσα πιθανότητα θα απορριφθεί!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Δημιουργήθηκε αλλά απορρίφθηκε</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Παραλαβή με</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Ελήφθη από</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Αποστολή προς</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Πληρωμή προς εσάς</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Εξόρυξη</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(δ/α)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Κατάσταση συναλλαγής. Πηγαίνετε το ποντίκι πάνω από αυτό το πεδίο για να δείτε τον αριθμό των επικυρώσεων</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Ημερομηνία κι ώρα λήψης της συναλλαγής.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Είδος συναλλαγής.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Διεύθυνση αποστολής της συναλλαγής.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Ποσό που αφαιρέθηκε ή προστέθηκε στο υπόλοιπο.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Όλα</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Σήμερα</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Αυτή την εβδομάδα</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Αυτόν τον μήνα</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Τον προηγούμενο μήνα</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Αυτό το έτος</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Έκταση...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Ελήφθη με</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Απεστάλη προς</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Προς εσάς</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Εξόρυξη</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Άλλο</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Αναζήτηση με βάση τη διεύθυνση ή την επιγραφή</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Ελάχιστο ποσό</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Αντιγραφή διεύθυνσης</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Αντιγραφή επιγραφής</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Αντιγραφή ποσού</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Αντιγραφη του ID Συναλλαγής</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Επεξεργασία επιγραφής</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Εμφάνιση λεπτομερειών συναλλαγής</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Εξαγωγή Στοιχείων Συναλλαγών</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Αρχείο οριοθετημένο με κόμματα (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Επικυρωμένες</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Ημερομηνία</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Τύπος</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Επιγραφή</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Διεύθυνση</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Ποσό</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Σφάλμα εξαγωγής</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Αδυναμία εγγραφής στο αρχείο %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Έκταση:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>έως</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Αποστολή νομισμάτων</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation>&Εξαγωγή</translation>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Εξαγωγή δεδομένων καρτέλας σε αρχείο</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Αντίγραφο ασφαλείας του πορτοφολιού</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Αρχεία δεδομένων πορτοφολιού (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Αποτυχία κατά τη δημιουργία αντιγράφου</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Παρουσιάστηκε σφάλμα κατά την αποθήκευση των δεδομένων πορτοφολιού στη νέα τοποθεσία.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Η δημιουργια αντιγραφου ασφαλειας πετυχε</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Τα δεδομένα πορτοφόλιου αποθηκεύτηκαν με επιτυχία στη νέα θέση. </translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Number7 version</source>
<translation>Έκδοση Number7</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Χρήση:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or number7d</source>
<translation>Αποστολή εντολής στον εξυπηρετητή ή στο number7d</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Λίστα εντολών</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Επεξήγηση εντολής</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Επιλογές:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: number7.conf)</source>
<translation>Ορίστε αρχείο ρυθμίσεων (προεπιλογή: number7.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: number7d.pid)</source>
<translation>Ορίστε αρχείο pid (προεπιλογή: number7d.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Ορισμός φακέλου δεδομένων</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Όρισε το μέγεθος της βάσης προσωρινής αποθήκευσης σε megabytes(προεπιλογή:25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 6093 or testnet: 16093)</source>
<translation>Εισερχόμενες συνδέσεις στη θύρα <port> (προεπιλογή: 6093 ή στο testnet: 16093)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Μέγιστες αριθμός συνδέσεων με τους peers <n> (προεπιλογή: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Σύνδεση σε έναν κόμβο για την ανάκτηση διευθύνσεων από ομοτίμους, και αποσυνδέσh</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Διευκρινίστε τη δικιά σας δημόσια διεύθυνση.</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Όριο αποσύνδεσης προβληματικών peers (προεπιλογή: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Δευτερόλεπτα πριν επιτραπεί ξανά η σύνδεση των προβληματικών peers (προεπιλογή: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Ένα σφάλμα συνέβη καθώς προετοιμαζόταν η πόρτα RPC %u για αναμονή IPv4: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 6094 or testnet: 16094)</source>
<translation>Εισερχόμενες συνδέσεις JSON-RPC στη θύρα <port> (προεπιλογή: 6094 or testnet: 16094)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Αποδοχή εντολών κονσόλας και JSON-RPC</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Εκτέλεση στο παρασκήνιο κι αποδοχή εντολών</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Χρήση του δοκιμαστικού δικτύου</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Να δέχεσαι συνδέσεις από έξω(προεπιλογή:1)</translation>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=number7rpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Number7 Alert" admin@foo.com
</source>
<translation>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=number7rpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Number7 Alert" admin@foo.com
</translation>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Ένα σφάλμα συνέβη καθώς προετοιμαζόταν η υποδοχη RPC %u για αναμονη του IPv6, επεσε πισω στο IPv4:%s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation>Αποθηκευση σε συγκεκριμένη διεύθυνση. Χρησιμοποιήστε τα πλήκτρα [Host] : συμβολισμός θύρα για IPv6</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Number7 is probably already running.</source>
<translation>Αδυναμία κλειδώματος του φακέλου δεδομένων %s. Πιθανώς το Number7 να είναι ήδη ενεργό.</translation>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Σφάλμα: Η συναλλαγή απορρίφθηκε.
Αυτό ίσως οφείλεται στο ότι τα νομίσματά σας έχουν ήδη ξοδευτεί, π.χ. με την αντιγραφή του wallet.dat σε άλλο σύστημα και την χρήση τους εκεί, χωρίς η συναλλαγή να έχει καταγραφεί στο παρόν σύστημα.</translation>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation>Σφάλμα: Αυτή η συναλλαγή απαιτεί αμοιβή συναλλαγής τουλάχιστον %s λόγω του μεγέθους, πολυπλοκότητας ή της χρήσης πρόσφατης παραλαβής κεφαλαίου</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>Εκτέλεση της εντολής όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Εκτέλεσε την εντολή όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Ορίστε το μέγιστο μέγεθος των high-priority/low-fee συναλλαγων σε bytes (προεπιλογή: 27000)</translation>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation>Αυτό είναι ένα προ-τεστ κυκλοφορίας - χρησιμοποιήστε το με δική σας ευθύνη - δεν χρησιμοποιείτε για εξόρυξη ή για αλλες εφαρμογές</translation>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Προειδοποίηση: Η παράμετρος -paytxfee είναι πολύ υψηλή. Πρόκειται για την αμοιβή που θα πληρώνετε για κάθε συναλλαγή που θα στέλνετε.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation>Προειδοποίηση: Εμφανίσεις συναλλαγων δεν μπορεί να είναι σωστες! Μπορεί να χρειαστεί να αναβαθμίσετε, ή άλλοι κόμβοι μπορεί να χρειαστεί να αναβαθμίστουν. </translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Number7 will not work properly.</source>
<translation>Προειδοποίηση: Παρακαλώ βεβαιωθείτε πως η ημερομηνία κι ώρα του συστήματός σας είναι σωστές. Αν το ρολόι του υπολογιστή σας πάει λάθος, ενδέχεται να μη λειτουργεί σωστά το Number7.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Προειδοποίηση : Σφάλμα wallet.dat κατα την ανάγνωση ! Όλα τα κλειδιά αναγνωρισθηκαν σωστά, αλλά τα δεδομένα των συναλλαγών ή καταχωρήσεις στο βιβλίο διευθύνσεων μπορεί να είναι ελλιπείς ή λανθασμένα. </translation>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Προειδοποίηση : το αρχειο wallet.dat ειναι διεφθαρμένο, τα δεδομένα σώζονται ! Original wallet.dat αποθηκεύονται ως πορτοφόλι { timestamp } bak στο % s ? . . Αν το υπόλοιπο του ή τις συναλλαγές σας, είναι λάθος θα πρέπει να επαναφέρετε από ένα αντίγραφο ασφαλείας</translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Προσπάθεια για ανακτησει ιδιωτικων κλειδιων από ενα διεφθαρμένο αρχειο wallet.dat </translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Αποκλεισμός επιλογων δημιουργίας: </translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Σύνδεση μόνο με ορισμένους κόμβους</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>Εντοπισθηκε διεφθαρμενη βαση δεδομενων των μπλοκ</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Ανακαλύψτε την δικη σας IP διεύθυνση (προεπιλογή: 1 όταν ακούει και δεν - externalip) </translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>Θελετε να δημιουργηθει τωρα η βαση δεδομενων του μπλοκ? </translation>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>Σφάλμα κατά την ενεργοποίηση της βάσης δεδομένων μπλοκ</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation>Σφάλμα κατά την ενεργοποίηση της βάσης δεδομένων πορτοφόλιου %s!</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>Σφάλμα φορτωσης της βασης δεδομενων των μπλοκ</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>Σφάλμα φορτωσης της βασης δεδομενων των μπλοκ</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Προειδοποίηση: Χαμηλός χώρος στο δίσκο </translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>Σφάλμα: το πορτοφόλι είναι κλειδωμένο, δεν μπορεί να δημιουργηθεί συναλλαγή</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Λάθος: λάθος συστήματος:</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>ταλαιπωρηθειτε για να ακούσετε σε οποιαδήποτε θύρα. Χρήση - ακούστε = 0 , αν θέλετε αυτό.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>Αποτυχία αναγνωσης των block πληροφοριων</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation>Η αναγνωση του μπλοκ απετυχε</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation>Ο συγχρονισμος του μπλοκ ευρετηριου απετυχε</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation>Η δημιουργια του μπλοκ ευρετηριου απετυχε</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation>Η δημιουργια των μπλοκ πληροφοριων απετυχε</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>Η δημιουργια του μπλοκ απετυχε</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation>Αδυναμία εγγραφής πληροφοριων αρχειου</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation>Αποτυχία εγγραφής στη βάση δεδομένων νομίσματος</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation>Αποτυχία εγγραφής δείκτη συναλλαγών </translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation>Αποτυχία εγγραφής αναίρεσης δεδομένων </translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>Βρες ομότιμους υπολογιστές χρησιμοποιώντας αναζήτηση DNS(προεπιλογή:1)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation>Δημιουργία νομισμάτων (προκαθορισμος: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>Πόσα μπλοκ να ελέγχθουν κατά την εκκίνηση (προεπιλογή:288,0=όλα)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation>Πόσο εξονυχιστική να είναι η επιβεβαίωση του μπλοκ(0-4, προεπιλογή:3)</translation>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation>Δεν ειναι αρκετες περιγραφες αρχείων διαθέσιμες.</translation>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation>Εισαγωγή μπλοκ από εξωτερικό αρχείο blk000?.dat</translation>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>Ορίσμος του αριθμόυ θεματων στην υπηρεσία κλήσεων RPC (προεπιλογή: 4) </translation>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation>Επαλήθευση των μπλοκ... </translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>Επαλήθευση πορτοφολιου... </translation>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Εισαγωγή μπλοκ από εξωτερικό αρχείο blk000?.dat</translation>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation>Ορίσμος του αριθμό των νημάτων ελέγχου σεναρίου (μέχρι 16, 0 = auto, <0 = αφήνουν τους πολλους πυρήνες δωρεάν, default: 0)</translation>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Πληροφορία</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Δεν είναι έγκυρη η διεύθυνση διαμεσολαβητή: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation>Μη έγκυρο ποσό για την παράμετρο -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation>Μη έγκυρο ποσό για την παράμετρο -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation>Διατηρήση ένος πλήρες ευρετήριου συναλλαγών (προεπιλογή: 0) </translation>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Μέγιστος buffer λήψης ανά σύνδεση, <n>*1000 bytes (προεπιλογή: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Μέγιστος buffer αποστολής ανά σύνδεση, <n>*1000 bytes (προεπιλογή: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation>Μονο αποδοχη αλυσίδας μπλοκ που ταιριάζει με τα ενσωματωμένα σημεία ελέγχου (προεπιλογή: 1) </translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation> Συνδέση μόνο σε κόμβους του δικτύου <net> (IPv4, IPv6 ή Tor) </translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Έξοδος επιπλέον πληροφοριών εντοπισμού σφαλμάτων</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Έξοδος επιπλέον πληροφοριών εντοπισμού σφαλμάτων</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Χρονοσφραγίδα πληροφοριών εντοπισμού σφαλμάτων</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Number7 Wiki for SSL setup instructions)</source>
<translation>Ρυθμίσεις SSL: (ανατρέξτε στο Number7 Wiki για οδηγίες ρυθμίσεων SSL)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Επιλέξτε την έκδοση του διαμεσολαβητη για να χρησιμοποιήσετε (4-5 , προεπιλογή: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Αποστολή πληροφοριών εντοπισμού σφαλμάτων στην κονσόλα αντί του αρχείου debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Αποστολή πληροφοριών εντοπισμού σφαλμάτων στον debugger</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Ορίσμος του μέγιστου μέγεθος block σε bytes (προεπιλογή: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Ορίστε το μέγιστο μέγεθος block σε bytes (προεπιλογή: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Συρρίκνωση του αρχείο debug.log κατα την εκκίνηση του πελάτη (προεπιλογή: 1 όταν δεν-debug)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation>Η υπογραφή συναλλαγής απέτυχε </translation>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Ορισμός λήξης χρονικού ορίου σε χιλιοστά του δευτερολέπτου(προεπιλογή:5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Λάθος Συστήματος:</translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation>Το ποσό της συναλλαγής είναι πολύ μικρο </translation>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation>Τα ποσά των συναλλαγών πρέπει να είναι θετικα</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation>Η συναλλαγή ειναι πολύ μεγάλη </translation>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Χρησιμοποίηση του UPnP για την χρήση της πόρτας αναμονής (προεπιλογή:0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Χρησιμοποίηση του UPnP για την χρήση της πόρτας αναμονής (προεπιλογή:1)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Χρήση διακομιστή μεσολάβησης για την επίτευξη των Tor κρυμμένων υπηρεσιων (προεπιλογή: ίδιο με το-proxy) </translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Όνομα χρήστη για τις συνδέσεις JSON-RPC</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Προειδοποίηση</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Προειδοποίηση: Αυτή η έκδοση είναι ξεπερασμένη, απαιτείται αναβάθμιση </translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation>Θα πρέπει να ξαναχτίστουν οι βάσεις δεδομένων που χρησιμοποιούντε-Αναδημιουργία αλλάγων-txindex </translation>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>Το αρχειο wallet.dat ειναι διεφθαρμένο, η διάσωση απέτυχε</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Κωδικός για τις συνδέσεις JSON-RPC</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Αποδοχή συνδέσεων JSON-RPC από συγκεκριμένη διεύθυνση IP</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Αποστολή εντολών στον κόμβο <ip> (προεπιλογή: 127.0.0.1)</translation>
</message>
<message>
<location line="-7"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Εκτέλεσε την εντολή όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Αναβάθμισε το πορτοφόλι στην τελευταία έκδοση</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Όριο πλήθους κλειδιών pool <n> (προεπιλογή: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Επανέλεγχος της αλυσίδας μπλοκ για απούσες συναλλαγές</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Χρήση του OpenSSL (https) για συνδέσεις JSON-RPC</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Αρχείο πιστοποιητικού του διακομιστή (προεπιλογή: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Προσωπικό κλειδί του διακομιστή (προεπιλογή: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Αποδεκτά κρυπτογραφήματα (προεπιλογή: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Αυτό το κείμενο βοήθειας</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Αδύνατη η σύνδεση με τη θύρα %s αυτού του υπολογιστή (bind returned error %d, %s) </translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Σύνδεση μέσω διαμεσολαβητή socks</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Να επιτρέπονται οι έλεγχοι DNS για προσθήκη και σύνδεση κόμβων</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Φόρτωση διευθύνσεων...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Σφάλμα φόρτωσης wallet.dat: Κατεστραμμένο Πορτοφόλι</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Number7</source>
<translation>Σφάλμα φόρτωσης wallet.dat: Το Πορτοφόλι απαιτεί μια νεότερη έκδοση του Number7</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Number7 to complete</source>
<translation>Απαιτείται η επανεγγραφή του Πορτοφολιού, η οποία θα ολοκληρωθεί στην επανεκκίνηση του Number7</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Σφάλμα φόρτωσης αρχείου wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Δεν είναι έγκυρη η διεύθυνση διαμεσολαβητή: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Άγνωστo δίκτυο ορίζεται σε onlynet: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Άγνωστo δίκτυο ορίζεται: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Δεν μπορώ να γράψω την προεπιλεγμένη διεύθυνση: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Δεν μπορώ να γράψω την προεπιλεγμένη διεύθυνση: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Μη έγκυρο ποσό για την παράμετρο -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Λάθος ποσότητα</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Ανεπαρκές κεφάλαιο</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Φόρτωση ευρετηρίου μπλοκ...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Προσέθεσε ένα κόμβο για σύνδεση και προσπάθησε να κρατήσεις την σύνδεση ανοιχτή</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Number7 is probably already running.</source>
<translation>Αδύνατη η σύνδεση με τη θύρα %s αυτού του υπολογιστή. Το Number7 είναι πιθανώς ήδη ενεργό.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Αμοιβή ανά KB που θα προστίθεται στις συναλλαγές που στέλνεις</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Φόρτωση πορτοφολιού...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Δεν μπορώ να υποβαθμίσω το πορτοφόλι</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Δεν μπορώ να γράψω την προεπιλεγμένη διεύθυνση</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Ανίχνευση...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Η φόρτωση ολοκληρώθηκε</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>Χρήση της %s επιλογής</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Σφάλμα</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Πρέπει να βάλεις ένα κωδικό στο αρχείο παραμέτρων: %s
Εάν το αρχείο δεν υπάρχει, δημιούργησε το με δικαιώματα μόνο για ανάγνωση από τον δημιουργό</translation>
</message>
</context>
</TS> | Java |
.home-layout {
padding-top: 50px;
padding-bottom: 50px;
text-align: center;
background: url('https://scontent-ord1-1.xx.fbcdn.net/hphotos-xta1/t31.0-8/10991609_10104851058880999_4908278955780656545_o.jpg') no-repeat center center fixed;
background-size: cover;
height: 855px;
}
.home-row {
position: relative;
padding-top: 20%;
padding-bottom: 20%;
}
#home-logo {
font-family: 'Oswald', sans-serif;
font-size: 4em;
}
#home-motto {
font-family: 'Lora', serif;
font-size: 25px;
}
#home-links {
float: none;
margin: 0 auto;
}
.about-layout {
padding-top: 50px;
height: 855px;
}
.about-image {
width: 300px;
}
.portfolio-layout {
padding-top: 50px;
/*height: 855px;*/
}
.portfolio-img {
width: 300px;
height: 280px;
box-shadow: 3px 3px 6px #888888;
}
.contact-layout {
padding-top: 50px;
height: 500px;
}
footer {
padding-top: 10px;
background-color: #85adad;
}
.center-block {
display: block;
margin-left: auto;
margin-right: auto;
} | Java |
var _ = require("underscore"),
Events = require("./Events"),
querystring = require("querystring"),
httpClient = require("./httpClient"),
utils = require("./utils"),
logger = require("config-logger");
var environments = {
sandbox: {
restHost: "api-sandbox.oanda.com",
streamHost: "stream-sandbox.oanda.com",
secure: false
},
practice: {
restHost: "api-fxpractice.oanda.com",
streamHost: "stream-fxpractice.oanda.com"
},
live: {
restHost: "api-fxtrade.oanda.com",
streamHost: "stream-fxtrade.oanda.com"
}
};
var maxRequestsPerSecond = 15,
maxRequestsWarningThreshold = 1000;
/*
* config.environment
* config.accessToken
* config.username (Sandbox only)
*/
function OandaAdapter (config) {
config.environment = config.environment || "practice";
// this.accountId = accountId;
this.accessToken = config.accessToken;
this.restHost = environments[config.environment].restHost;
this.streamHost = environments[config.environment].streamHost;
this.secure = environments[config.environment].secure;
if (config.environment === "sandbox") {
this.username = config.username;
}
this.subscriptions = {};
this._eventsBuffer = [];
this._pricesBuffer = [];
this._sendRESTRequest = utils.rateLimit(this._sendRESTRequest, this, 1000 / maxRequestsPerSecond, maxRequestsWarningThreshold);
}
Events.mixin(OandaAdapter.prototype);
/*
* Subscribes to events for all accounts authorized by the token
*/
OandaAdapter.prototype.subscribeEvents = function (listener, context) {
var existingSubscriptions = this.getHandlers("event");
this.off("event", listener, context);
this.on("event", listener, context);
if (existingSubscriptions.length === 0) {
this._streamEvents();
}
};
OandaAdapter.prototype.unsubscribeEvents = function (listener, context) {
this.off("event", listener, context);
this._streamEvents();
};
OandaAdapter.prototype._streamEvents = function () {
var subscriptionCount = this.getHandlers("event").length;
if (this.eventsRequest) {
this.eventsRequest.abort();
}
if (subscriptionCount === 0) {
return;
}
clearTimeout(this.eventsTimeout);
this.eventsTimeout = setTimeout(this._eventsHeartbeatTimeout.bind(this), 20000);
this.eventsRequest = httpClient.sendRequest({
hostname: this.streamHost,
method: "GET",
path: "/v1/events",
headers: {
Authorization: "Bearer " + this.accessToken,
Connection: "Keep-Alive"
},
secure: this.secure
},
this._onEventsResponse.bind(this),
this._onEventsData.bind(this)
);
};
OandaAdapter.prototype._onEventsResponse = function (error, body, statusCode) {
if (statusCode !== 200) {
if (body && body.disconnect) {
this.trigger("message", null, "Events streaming API disconnected.\nOanda code " + body.disconnect.code + ": " + body.disconnect.message);
} else {
this.trigger("message", null, "Events streaming API disconnected with status " + statusCode);
}
}
clearTimeout(this.eventsTimeout);
this.eventsTimeout = setTimeout(this._eventsHeartbeatTimeout.bind(this), 20000);
};
OandaAdapter.prototype._onEventsData = function (data) {
// Single chunks sometimes contain more than one event. Each always end with /r/n. Whole chunk therefore not JSON parsable, so must split.
// Also, an event may be split accross data chunks, so must buffer.
data.split(/\r\n/).forEach(function (line) {
var update;
if (line) {
this._eventsBuffer.push(line);
try {
update = JSON.parse(this._eventsBuffer.join(""));
} catch (error) {
if (this._eventsBuffer.length <= 5) {
// Wait for next line.
return;
}
logger.error("Unable to parse Oanda events subscription update", this._eventsBuffer.join("\n"), error);
this._eventsBuffer = [];
return;
}
this._eventsBuffer = [];
if (update.heartbeat) {
clearTimeout(this.eventsTimeout);
this.eventsTimeout = setTimeout(this._eventsHeartbeatTimeout.bind(this), 20000);
return;
}
this.trigger("event", update);
}
}, this);
};
OandaAdapter.prototype._eventsHeartbeatTimeout = function () {
logger.warn("OandaAdapter: No heartbeat received from events stream for 20 seconds. Reconnecting.");
this._streamEvents();
};
OandaAdapter.prototype.getAccounts = function (callback) {
this._sendRESTRequest({
method: "GET",
path: "/v1/accounts" + (this.username ? "?username=" + this.username : "")
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body.accounts) {
callback(null, body.accounts);
} else {
callback("Unexpected accounts response");
}
});
};
OandaAdapter.prototype.getAccount = function (accountId, callback) {
this._sendRESTRequest({
method: "GET",
path: "/v1/accounts/" + accountId
}, callback);
};
OandaAdapter.prototype.getInstruments = function (accountId, callback) {
this._sendRESTRequest({
method: "GET",
path: "/v1/instruments?accountId=" + accountId + "&fields=" + ["instrument", "displayName", "pip", "maxTradeUnits", "precision", "maxTrailingStop", "minTrailingStop", "marginRate", "halted"].join("%2C"),
},
function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body.instruments) {
callback(null, body.instruments);
} else {
callback("Unexpected instruments response");
}
});
};
OandaAdapter.prototype.getPrice = function (symbol, callback) {
var multiple = _.isArray(symbol);
if (multiple) {
symbol = symbol.join("%2C");
}
this._sendRESTRequest({
method: "GET",
path: "/v1/prices?instruments=" + symbol
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body && body.prices[0]) {
callback(null, multiple ? body.prices : body.prices[0]);
} else {
callback("Unexpected price response for " + symbol);
}
});
};
OandaAdapter.prototype.subscribePrice = function (accountId, symbol, listener, context) {
var existingSubscriptions = this.getHandlers("price/" + symbol);
// Price stream needs an accountId to be passed for streaming prices, though prices for a connection are same anyway
if (!this.streamPrices) {
this.streamPrices = _.throttle(this._streamPrices.bind(this, accountId));
}
this.off("price/" + symbol, listener, context);
this.on("price/" + symbol, listener, context);
if (existingSubscriptions.length === 0) {
this.streamPrices();
}
};
OandaAdapter.prototype.unsubscribePrice = function (symbol, listener, context) {
this.off("price/" + symbol, listener, context);
this.streamPrices();
};
// Kills rates streaming keep alive request for account and creates a new one whenever subsciption list changes. Should always be throttled.
OandaAdapter.prototype._streamPrices = function (accountId) {
var changed;
this.priceSubscriptions = Object.keys(this.getHandlers()).reduce(function (memo, event) {
var match = event.match("^price/(.+)$");
if (match) {
memo.push(match[1]);
}
return memo;
}, []).sort().join("%2C");
changed = !this.lastPriceSubscriptions || this.priceSubscriptions !== this.lastPriceSubscriptions;
this.lastPriceSubscriptions = this.priceSubscriptions;
if (!changed) {
return;
}
if (this.pricesRequest) {
this.pricesRequest.abort();
}
if (this.priceSubscriptions === "") {
return;
}
clearTimeout(this.pricesTimeout);
this.pricesTimeout = setTimeout(this._pricesHeartbeatTimeout.bind(this), 10000);
this.pricesRequest = httpClient.sendRequest({
hostname: this.streamHost,
method: "GET",
path: "/v1/prices?accountId=" + accountId + "&instruments=" + this.priceSubscriptions,
headers: {
Authorization: "Bearer " + this.accessToken,
Connection: "Keep-Alive"
},
secure: this.secure
},
this._onPricesResponse.bind(this, accountId),
this._onPricesData.bind(this)
);
};
OandaAdapter.prototype._onPricesResponse = function (accountId, error, body, statusCode) {
if (statusCode !== 200) {
if (body && body.disconnect) {
this.trigger("message", accountId, "Prices streaming API disconnected.\nOanda code " + body.disconnect.code + ": " + body.disconnect.message);
} else {
this.trigger("message", accountId, "Prices streaming API disconnected with status " + statusCode);
}
}
clearTimeout(this.pricesTimeout);
this.pricesTimeout = setTimeout(this._pricesHeartbeatTimeout.bind(this), 10000);
};
OandaAdapter.prototype._onPricesData = function (data) {
// Single data chunks sometimes contain more than one tick. Each always end with /r/n. Whole chunk therefore not JSON parsable, so must split.
// A tick may also be split accross data chunks, so must buffer
data.split(/\r\n/).forEach(function (line) {
var update;
if (line) {
this._pricesBuffer.push(line);
try {
update = JSON.parse(this._pricesBuffer.join(""));
} catch (error) {
if (this._pricesBuffer.length <= 5) {
// Wait for next update.
return;
}
// Drop if cannot produce object after 5 updates
logger.error("Unable to parse Oanda price subscription update", this._pricesBuffer.join("\n"), error);
this._pricesBuffer = [];
return;
}
this._pricesBuffer = [];
if (update.heartbeat) {
clearTimeout(this.pricesTimeout);
this.pricesTimeout = setTimeout(this._pricesHeartbeatTimeout.bind(this), 10000);
return;
}
if (update.tick) {
update.tick.time = new Date(update.tick.time);
this.trigger("price/" + update.tick.instrument, update.tick);
}
}
}, this);
};
OandaAdapter.prototype._pricesHeartbeatTimeout = function () {
logger.warn("OandaAdapter: No heartbeat received from prices stream for 10 seconds. Reconnecting.");
delete this.lastPriceSubscriptions;
this._streamPrices();
};
/**
* Get historical price information about an instrument in candlestick format as defined at
* http://developer.oanda.com/rest-live/rates/#aboutCandlestickRepresentation
*/
OandaAdapter.prototype.getCandles = function (instrument, options, callback)
{
options = _.extend(options, {instrument: instrument});
this._sendRESTRequest({
method: "GET",
path: "/v1/candles?" + querystring.stringify(options),
headers: {
Authorization: "Bearer " + this.accessToken,
"X-Accept-Datetime-Format": "UNIX"
}
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body && body.candles) {
callback(null, body.candles);
} else if (body === "") {
// Body is an empty string if there are no candles to return
callback(null, []);
} else {
callback("Unexpected candles response for " + symbol);
}
});
};
OandaAdapter.prototype.getOpenPositions = function (accountId, callback) {
this._sendRESTRequest({
method: "GET",
path: "/v1/accounts/" + accountId + "/positions"
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body && body.positions) {
callback(null, body.positions);
} else {
callback("Unexpected response for open positions");
}
});
};
OandaAdapter.prototype.getOpenTrades = function (accountId, callback) {
this._sendRESTRequest({
method: "GET",
path: "/v1/accounts/" + accountId + "/trades"
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body && body.trades) {
callback(null, body.trades);
} else {
callback("Unexpected response for open trades");
}
});
};
/**
* @method createOrder
* @param {String} accountId Required.
* @param {Object} order
* @param {String} order.instrument Required. Instrument to open the order on.
* @param {Number} order.units Required. The number of units to open order for.
* @param {String} order.side Required. Direction of the order, either ‘buy’ or ‘sell’.
* @param {String} order.type Required. The type of the order ‘limit’, ‘stop’, ‘marketIfTouched’ or ‘market’.
* @param {String} order.expiry Required. If order type is ‘limit’, ‘stop’, or ‘marketIfTouched’. The value specified must be in a valid datetime format.
* @param {String} order.price Required. If order type is ‘limit’, ‘stop’, or ‘marketIfTouched’. The price where the order is set to trigger at.
* @param {Number} order.lowerBound Optional. The minimum execution price.
* @param {Number} order.upperBound Optional. The maximum execution price.
* @param {Number} order.stopLoss Optional. The stop loss price.
* @param {Number} order.takeProfit Optional. The take profit price.
* @param {Number} order.trailingStop Optional The trailing stop distance in pips, up to one decimal place.
* @param {Function} callback
*/
OandaAdapter.prototype.createOrder = function (accountId, order, callback) {
if (!order.instrument) {
return callback("'instrument' is a required field");
}
if (!order.units) {
return callback("'units' is a required field");
}
if (!order.side) {
return callback("'side' is a required field. Specify 'buy' or 'sell'");
}
if (!order.type) {
return callback("'type' is a required field. Specify 'market', 'marketIfTouched', 'stop' or 'limit'");
}
if ((order.type !== "market") && !order.expiry) {
return callback("'expiry' is a required field for order type '" + order.type + "'");
}
if ((order.type !== "market") && !order.price) {
return callback("'price' is a required field for order type '" + order.type + "'");
}
this._sendRESTRequest({
method: "POST",
path: "/v1/accounts/" + accountId + "/orders",
data: order,
headers: {
Authorization: "Bearer " + this.accessToken,
"Content-Type": "application/x-www-form-urlencoded"
},
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
callback(null, body);
});
};
OandaAdapter.prototype.closeTrade = function (accountId, tradeId, callback) {
this._sendRESTRequest({
method: "DELETE",
path: "/v1/accounts/" + accountId + "/trades/" + tradeId
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
if (body) {
callback(null, body);
} else {
callback("Unexpected response for open positions");
}
});
};
OandaAdapter.prototype.getOrders = function (accountId, callback)
{
this._sendRESTRequest({
method: "GET",
path: "/v1/accounts/" + accountId + "/orders",
headers: {
Authorization: "Bearer " + this.accessToken,
"Content-Type": "application/x-www-form-urlencoded"
},
}, function (error, body, statusCode) {
if (error) {
if (body && body.message) {
logger.error("Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
return callback(body.message);
}
return callback(error);
}
callback(null, body);
});
};
OandaAdapter.prototype._sendRESTRequest = function (request, callback) {
request.hostname = this.restHost;
request.headers = request.headers || {
Authorization: "Bearer " + this.accessToken
};
request.secure = this.secure;
httpClient.sendRequest(request, callback);
};
OandaAdapter.prototype.kill = function () {
if (this.pricesRequest) {
this.pricesRequest.abort();
}
if (this.eventsRequest) {
this.eventsRequest.abort();
}
this.off();
};
module.exports = OandaAdapter; | Java |
require "mscorlib"
require "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
require "System.Collections.Generic, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
require "System.Linq, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
require "System.Text, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
module CodeBuilder.DataSource.Exporter
require "PhysicalDataModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
class SqlServer2000Exporter < BaseExporter, IExporter
def Export(connectionString)
if connectionString == nil then
raise ArgumentNullException.new("connectionString", "Argument is null")
end
model = Model.new()
model.Database = "SqlServer2000"
return model
end
def GetTables()
return nil
end
def GetViews()
return nil
end
def GetColumns()
return nil
end
def GetKeys()
return nil
end
def GetPrimaryKeys()
return nil
end
end
end | Java |
package com.semmle.jcorn;
import com.semmle.js.ast.Position;
public class SyntaxError extends RuntimeException {
private static final long serialVersionUID = -4883173648492364902L;
private final Position position;
public SyntaxError(String msg, Position loc, int raisedAt) {
super(msg);
this.position = loc;
}
public Position getPosition() {
return position;
}
}
| Java |
## Sentence No. 124 -
annat var det 1976 när after dark tog sina första steg som dragshowgrupp , och 1980 när de **flyttade** **in** på hamburger börs .
### Existing MWEs:
1- **flyttade in** (VPC)Tokens :
flyttade
in
### Identified MWEs:
1- **tog sina** Tokens :
tog
sina
0- SHIFT > S= [] B= [annat, var, det ,.. ]
1- SHIFT > S= [annat] B= [var, det, 1976 ,.. ]
2- COMPLETE > S= [] B= [var, det, 1976 ,.. ]
3- SHIFT > S= [var] B= [det, 1976, när ,.. ]
4- COMPLETE > S= [] B= [det, 1976, när ,.. ]
5- SHIFT > S= [det] B= [1976, när, after ,.. ]
6- COMPLETE > S= [] B= [1976, när, after ,.. ]
7- SHIFT > S= [1976] B= [när, after, dark ,.. ]
8- COMPLETE > S= [] B= [när, after, dark ,.. ]
9- SHIFT > S= [när] B= [after, dark, tog ,.. ]
10- COMPLETE > S= [] B= [after, dark, tog ,.. ]
11- SHIFT > S= [after] B= [dark, tog, sina ,.. ]
12- COMPLETE > S= [] B= [dark, tog, sina ,.. ]
13- SHIFT > S= [dark] B= [tog, sina, första ,.. ]
14- COMPLETE > S= [] B= [tog, sina, första ,.. ]
15- SHIFT > S= [tog] B= [sina, första, steg ,.. ]
16- SHIFT > S= [tog, sina] B= [första, steg, som ,.. ]
17- **MERGE** > S= [[tog, sina]] B= [första, steg, som ,.. ]
18- COMPLETE > S= [] B= [första, steg, som ,.. ]
19- SHIFT > S= [första] B= [steg, som, dragshowgrupp ,.. ]
20- COMPLETE > S= [] B= [steg, som, dragshowgrupp ,.. ]
21- SHIFT > S= [steg] B= [som, dragshowgrupp, , ,.. ]
22- COMPLETE > S= [] B= [som, dragshowgrupp, , ,.. ]
23- SHIFT > S= [som] B= [dragshowgrupp, ,, och ,.. ]
24- COMPLETE > S= [] B= [dragshowgrupp, ,, och ,.. ]
25- SHIFT > S= [dragshowgrupp] B= [,, och, 1980 ,.. ]
26- COMPLETE > S= [] B= [,, och, 1980 ,.. ]
27- SHIFT > S= [,] B= [och, 1980, när ,.. ]
28- COMPLETE > S= [] B= [och, 1980, när ,.. ]
29- SHIFT > S= [och] B= [1980, när, de ,.. ]
30- COMPLETE > S= [] B= [1980, när, de ,.. ]
31- SHIFT > S= [1980] B= [när, de, flyttade ,.. ]
32- COMPLETE > S= [] B= [när, de, flyttade ,.. ]
33- SHIFT > S= [när] B= [de, flyttade, in ,.. ]
34- COMPLETE > S= [] B= [de, flyttade, in ,.. ]
35- SHIFT > S= [de] B= [flyttade, in, på ,.. ]
36- COMPLETE > S= [] B= [flyttade, in, på ,.. ]
37- SHIFT > S= [flyttade] B= [in, på, hamburger ,.. ]
38- COMPLETE > S= [] B= [in, på, hamburger ,.. ]
39- SHIFT > S= [in] B= [på, hamburger, börs ,.. ]
40- COMPLETE > S= [] B= [på, hamburger, börs ,.. ]
41- SHIFT > S= [på] B= [hamburger, börs, . ,.. ]
42- COMPLETE > S= [] B= [hamburger, börs, . ,.. ]
43- SHIFT > S= [hamburger] B= [börs, . ,.. ]
44- COMPLETE > S= [] B= [börs, . ,.. ]
45- SHIFT > S= [börs] B= [.]
46- COMPLETE > S= [] B= [.]
47- SHIFT > S= [.] B= [ ]
48- COMPLETE > S= [] B= [ ]
## Sentence No. 133 -
– de berättade att de hade klagat ända sedan verksamheten började utan att **få** **gehör** , säger frida nowotny .
### Existing MWEs:
1- **få gehör** (ID)Tokens :
få
gehör
0- SHIFT > S= [] B= [–, de, berättade ,.. ]
1- SHIFT > S= [–] B= [de, berättade, att ,.. ]
2- COMPLETE > S= [] B= [de, berättade, att ,.. ]
3- SHIFT > S= [de] B= [berättade, att, de ,.. ]
4- COMPLETE > S= [] B= [berättade, att, de ,.. ]
5- SHIFT > S= [berättade] B= [att, de, hade ,.. ]
6- COMPLETE > S= [] B= [att, de, hade ,.. ]
7- SHIFT > S= [att] B= [de, hade, klagat ,.. ]
8- COMPLETE > S= [] B= [de, hade, klagat ,.. ]
9- SHIFT > S= [de] B= [hade, klagat, ända ,.. ]
10- COMPLETE > S= [] B= [hade, klagat, ända ,.. ]
11- SHIFT > S= [hade] B= [klagat, ända, sedan ,.. ]
12- COMPLETE > S= [] B= [klagat, ända, sedan ,.. ]
13- SHIFT > S= [klagat] B= [ända, sedan, verksamheten ,.. ]
14- COMPLETE > S= [] B= [ända, sedan, verksamheten ,.. ]
15- SHIFT > S= [ända] B= [sedan, verksamheten, började ,.. ]
16- COMPLETE > S= [] B= [sedan, verksamheten, började ,.. ]
17- SHIFT > S= [sedan] B= [verksamheten, började, utan ,.. ]
18- COMPLETE > S= [] B= [verksamheten, började, utan ,.. ]
19- SHIFT > S= [verksamheten] B= [började, utan, att ,.. ]
20- COMPLETE > S= [] B= [började, utan, att ,.. ]
21- SHIFT > S= [började] B= [utan, att, få ,.. ]
22- COMPLETE > S= [] B= [utan, att, få ,.. ]
23- SHIFT > S= [utan] B= [att, få, gehör ,.. ]
24- COMPLETE > S= [] B= [att, få, gehör ,.. ]
25- SHIFT > S= [att] B= [få, gehör, , ,.. ]
26- COMPLETE > S= [] B= [få, gehör, , ,.. ]
27- SHIFT > S= [få] B= [gehör, ,, säger ,.. ]
28- COMPLETE > S= [] B= [gehör, ,, säger ,.. ]
29- SHIFT > S= [gehör] B= [,, säger, frida ,.. ]
30- COMPLETE > S= [] B= [,, säger, frida ,.. ]
31- SHIFT > S= [,] B= [säger, frida, nowotny ,.. ]
32- COMPLETE > S= [] B= [säger, frida, nowotny ,.. ]
33- SHIFT > S= [säger] B= [frida, nowotny, . ,.. ]
34- COMPLETE > S= [] B= [frida, nowotny, . ,.. ]
35- SHIFT > S= [frida] B= [nowotny, . ,.. ]
36- COMPLETE > S= [] B= [nowotny, . ,.. ]
37- SHIFT > S= [nowotny] B= [.]
38- COMPLETE > S= [] B= [.]
39- SHIFT > S= [.] B= [ ]
40- COMPLETE > S= [] B= [ ]
## Sentence No. 141 -
inte bara genom det hårda arbete han visar här , utan också som center i frölundas förstakedja , som har **fått** **i** **gång** maskineriet ordentligt .
### Existing MWEs:
1- **fått i gång** (VPC)Tokens :
fått
i
gång
0- SHIFT > S= [] B= [inte, bara, genom ,.. ]
1- SHIFT > S= [inte] B= [bara, genom, det ,.. ]
2- COMPLETE > S= [] B= [bara, genom, det ,.. ]
3- SHIFT > S= [bara] B= [genom, det, hårda ,.. ]
4- COMPLETE > S= [] B= [genom, det, hårda ,.. ]
5- SHIFT > S= [genom] B= [det, hårda, arbete ,.. ]
6- COMPLETE > S= [] B= [det, hårda, arbete ,.. ]
7- SHIFT > S= [det] B= [hårda, arbete, han ,.. ]
8- COMPLETE > S= [] B= [hårda, arbete, han ,.. ]
9- SHIFT > S= [hårda] B= [arbete, han, visar ,.. ]
10- COMPLETE > S= [] B= [arbete, han, visar ,.. ]
11- SHIFT > S= [arbete] B= [han, visar, här ,.. ]
12- COMPLETE > S= [] B= [han, visar, här ,.. ]
13- SHIFT > S= [han] B= [visar, här, , ,.. ]
14- COMPLETE > S= [] B= [visar, här, , ,.. ]
15- SHIFT > S= [visar] B= [här, ,, utan ,.. ]
16- COMPLETE > S= [] B= [här, ,, utan ,.. ]
17- SHIFT > S= [här] B= [,, utan, också ,.. ]
18- COMPLETE > S= [] B= [,, utan, också ,.. ]
19- SHIFT > S= [,] B= [utan, också, som ,.. ]
20- COMPLETE > S= [] B= [utan, också, som ,.. ]
21- SHIFT > S= [utan] B= [också, som, center ,.. ]
22- COMPLETE > S= [] B= [också, som, center ,.. ]
23- SHIFT > S= [också] B= [som, center, i ,.. ]
24- COMPLETE > S= [] B= [som, center, i ,.. ]
25- SHIFT > S= [som] B= [center, i, frölundas ,.. ]
26- COMPLETE > S= [] B= [center, i, frölundas ,.. ]
27- SHIFT > S= [center] B= [i, frölundas, förstakedja ,.. ]
28- COMPLETE > S= [] B= [i, frölundas, förstakedja ,.. ]
29- SHIFT > S= [i] B= [frölundas, förstakedja, , ,.. ]
30- COMPLETE > S= [] B= [frölundas, förstakedja, , ,.. ]
31- SHIFT > S= [frölundas] B= [förstakedja, ,, som ,.. ]
32- COMPLETE > S= [] B= [förstakedja, ,, som ,.. ]
33- SHIFT > S= [förstakedja] B= [,, som, har ,.. ]
34- COMPLETE > S= [] B= [,, som, har ,.. ]
35- SHIFT > S= [,] B= [som, har, fått ,.. ]
36- COMPLETE > S= [] B= [som, har, fått ,.. ]
37- SHIFT > S= [som] B= [har, fått, i ,.. ]
38- COMPLETE > S= [] B= [har, fått, i ,.. ]
39- SHIFT > S= [har] B= [fått, i, gång ,.. ]
40- COMPLETE > S= [] B= [fått, i, gång ,.. ]
41- SHIFT > S= [fått] B= [i, gång, maskineriet ,.. ]
42- COMPLETE > S= [] B= [i, gång, maskineriet ,.. ]
43- SHIFT > S= [i] B= [gång, maskineriet, ordentligt ,.. ]
44- COMPLETE > S= [] B= [gång, maskineriet, ordentligt ,.. ]
45- SHIFT > S= [gång] B= [maskineriet, ordentligt, . ,.. ]
46- COMPLETE > S= [] B= [maskineriet, ordentligt, . ,.. ]
47- SHIFT > S= [maskineriet] B= [ordentligt, . ,.. ]
48- COMPLETE > S= [] B= [ordentligt, . ,.. ]
49- SHIFT > S= [ordentligt] B= [.]
50- COMPLETE > S= [] B= [.]
51- SHIFT > S= [.] B= [ ]
52- COMPLETE > S= [] B= [ ]
## Sentence No. 144 -
jag är positivt överraskad av hur skönt det faktiskt är , har inte gillat att **röra** **på** **mig** sedan jag spelade fotboll i tonåren .
### Existing MWEs:
1- **röra på mig** (ID)Tokens :
röra
på
mig
0- SHIFT > S= [] B= [jag, är, positivt ,.. ]
1- SHIFT > S= [jag] B= [är, positivt, överraskad ,.. ]
2- COMPLETE > S= [] B= [är, positivt, överraskad ,.. ]
3- SHIFT > S= [är] B= [positivt, överraskad, av ,.. ]
4- COMPLETE > S= [] B= [positivt, överraskad, av ,.. ]
5- SHIFT > S= [positivt] B= [överraskad, av, hur ,.. ]
6- COMPLETE > S= [] B= [överraskad, av, hur ,.. ]
7- SHIFT > S= [överraskad] B= [av, hur, skönt ,.. ]
8- COMPLETE > S= [] B= [av, hur, skönt ,.. ]
9- SHIFT > S= [av] B= [hur, skönt, det ,.. ]
10- COMPLETE > S= [] B= [hur, skönt, det ,.. ]
11- SHIFT > S= [hur] B= [skönt, det, faktiskt ,.. ]
12- COMPLETE > S= [] B= [skönt, det, faktiskt ,.. ]
13- SHIFT > S= [skönt] B= [det, faktiskt, är ,.. ]
14- COMPLETE > S= [] B= [det, faktiskt, är ,.. ]
15- SHIFT > S= [det] B= [faktiskt, är, , ,.. ]
16- COMPLETE > S= [] B= [faktiskt, är, , ,.. ]
17- SHIFT > S= [faktiskt] B= [är, ,, har ,.. ]
18- COMPLETE > S= [] B= [är, ,, har ,.. ]
19- SHIFT > S= [är] B= [,, har, inte ,.. ]
20- COMPLETE > S= [] B= [,, har, inte ,.. ]
21- SHIFT > S= [,] B= [har, inte, gillat ,.. ]
22- COMPLETE > S= [] B= [har, inte, gillat ,.. ]
23- SHIFT > S= [har] B= [inte, gillat, att ,.. ]
24- COMPLETE > S= [] B= [inte, gillat, att ,.. ]
25- SHIFT > S= [inte] B= [gillat, att, röra ,.. ]
26- COMPLETE > S= [] B= [gillat, att, röra ,.. ]
27- SHIFT > S= [gillat] B= [att, röra, på ,.. ]
28- COMPLETE > S= [] B= [att, röra, på ,.. ]
29- SHIFT > S= [att] B= [röra, på, mig ,.. ]
30- COMPLETE > S= [] B= [röra, på, mig ,.. ]
31- SHIFT > S= [röra] B= [på, mig, sedan ,.. ]
32- COMPLETE > S= [] B= [på, mig, sedan ,.. ]
33- SHIFT > S= [på] B= [mig, sedan, jag ,.. ]
34- COMPLETE > S= [] B= [mig, sedan, jag ,.. ]
35- SHIFT > S= [mig] B= [sedan, jag, spelade ,.. ]
36- COMPLETE > S= [] B= [sedan, jag, spelade ,.. ]
37- SHIFT > S= [sedan] B= [jag, spelade, fotboll ,.. ]
38- COMPLETE > S= [] B= [jag, spelade, fotboll ,.. ]
39- SHIFT > S= [jag] B= [spelade, fotboll, i ,.. ]
40- COMPLETE > S= [] B= [spelade, fotboll, i ,.. ]
41- SHIFT > S= [spelade] B= [fotboll, i, tonåren ,.. ]
42- COMPLETE > S= [] B= [fotboll, i, tonåren ,.. ]
43- SHIFT > S= [fotboll] B= [i, tonåren, . ,.. ]
44- COMPLETE > S= [] B= [i, tonåren, . ,.. ]
45- SHIFT > S= [i] B= [tonåren, . ,.. ]
46- COMPLETE > S= [] B= [tonåren, . ,.. ]
47- SHIFT > S= [tonåren] B= [.]
48- COMPLETE > S= [] B= [.]
49- SHIFT > S= [.] B= [ ]
50- COMPLETE > S= [] B= [ ]
## Sentence No. 148 -
det **riktas** ibland **kritik** mot amorteringskrav , som att boendekostnader blir högre och unga köpare drabbas .
### Existing MWEs:
1- **riktas kritik** (LVC)Tokens :
riktas
kritik
0- SHIFT > S= [] B= [det, riktas, ibland ,.. ]
1- SHIFT > S= [det] B= [riktas, ibland, kritik ,.. ]
2- COMPLETE > S= [] B= [riktas, ibland, kritik ,.. ]
3- SHIFT > S= [riktas] B= [ibland, kritik, mot ,.. ]
4- COMPLETE > S= [] B= [ibland, kritik, mot ,.. ]
5- SHIFT > S= [ibland] B= [kritik, mot, amorteringskrav ,.. ]
6- COMPLETE > S= [] B= [kritik, mot, amorteringskrav ,.. ]
7- SHIFT > S= [kritik] B= [mot, amorteringskrav, , ,.. ]
8- COMPLETE > S= [] B= [mot, amorteringskrav, , ,.. ]
9- SHIFT > S= [mot] B= [amorteringskrav, ,, som ,.. ]
10- COMPLETE > S= [] B= [amorteringskrav, ,, som ,.. ]
11- SHIFT > S= [amorteringskrav] B= [,, som, att ,.. ]
12- COMPLETE > S= [] B= [,, som, att ,.. ]
13- SHIFT > S= [,] B= [som, att, boendekostnader ,.. ]
14- COMPLETE > S= [] B= [som, att, boendekostnader ,.. ]
15- SHIFT > S= [som] B= [att, boendekostnader, blir ,.. ]
16- COMPLETE > S= [] B= [att, boendekostnader, blir ,.. ]
17- SHIFT > S= [att] B= [boendekostnader, blir, högre ,.. ]
18- COMPLETE > S= [] B= [boendekostnader, blir, högre ,.. ]
19- SHIFT > S= [boendekostnader] B= [blir, högre, och ,.. ]
20- COMPLETE > S= [] B= [blir, högre, och ,.. ]
21- SHIFT > S= [blir] B= [högre, och, unga ,.. ]
22- COMPLETE > S= [] B= [högre, och, unga ,.. ]
23- SHIFT > S= [högre] B= [och, unga, köpare ,.. ]
24- COMPLETE > S= [] B= [och, unga, köpare ,.. ]
25- SHIFT > S= [och] B= [unga, köpare, drabbas ,.. ]
26- COMPLETE > S= [] B= [unga, köpare, drabbas ,.. ]
27- SHIFT > S= [unga] B= [köpare, drabbas, . ,.. ]
28- COMPLETE > S= [] B= [köpare, drabbas, . ,.. ]
29- SHIFT > S= [köpare] B= [drabbas, . ,.. ]
30- COMPLETE > S= [] B= [drabbas, . ,.. ]
31- SHIFT > S= [drabbas] B= [.]
32- COMPLETE > S= [] B= [.]
33- SHIFT > S= [.] B= [ ]
34- COMPLETE > S= [] B= [ ]
| Java |
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Spincommerce Guía de Estilos">
<meta name="keywords" content="">
<meta name="author" content="Spincommerce">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300,600,400italic' rel='stylesheet' type='text/css'>
<title>
Scaffolding · Spincommerce
</title>
<link rel="stylesheet" href="/spincommerce-style-guide/docs.css">
<!-- Favicons -->
<link rel="apple-touch-icon-precomposed" href="/spincommerce-style-guide/img/apple-touch-icon-precomposed.png">
<link rel="icon" href="/spincommerce-style-guide/favicon.ico">
</head>
<body>
<header class="masthead">
<div class="row">
<a href="/spincommerce-style-guide/" class="masthead-logo">
<span class="isotype"></span>
SpinCommerce
</a>
<nav class="masthead-nav">
<a href="/spincommerce-style-guide/scaffolding">Docs</a>
<a href="/spincommerce-style-guide/about">About</a>
<a href="https://github.com/Corpspin/spincommerce-style-guide" target="_blank">GitHub</a>
</nav>
</div>
</header>
<div class="row">
<div class="docs-layout">
<div class="medium-3 column">
<nav class="menu docs-menu">
<a class="menu-item selected" href="/spincommerce-style-guide/scaffolding/">
Scaffolding
</a>
<a class="menu-item " href="/spincommerce-style-guide/layout/">
Layout
</a>
<a class="menu-item " href="/spincommerce-style-guide/type/">
Type
</a>
<a class="menu-item " href="/spincommerce-style-guide/buttons/">
Buttons
</a>
<a class="menu-item " href="/spincommerce-style-guide/icons/">
Icons
</a>
<a class="menu-item " href="/spincommerce-style-guide/utilities/">
Utilities
</a>
<a class="menu-item " href="/spincommerce-style-guide/guidelines/">
Code guidelines
</a>
</nav>
<nav class="menu docs-menu">
<a class="menu-item " href="/spincommerce-style-guide/branding/">
Branding
</a>
<a class="menu-item " href="/spincommerce-style-guide/colors/">
Colors
</a>
<a class="menu-item " href="/spincommerce-style-guide/fonts/">
Fonts
</a>
</nav>
</div>
<div class="medium-9 column markdown-body">
<h1 class="page-title">
Scaffolding
</h1>
<div class="markdown-body">
<p>Scaffolding refers to the global resets and dependencies that SpinCommerce is built upon.</p>
<h2 id="contents">Contents</h2>
<ul id="markdown-toc">
<li><a href="#contents" id="markdown-toc-contents">Contents</a></li>
<li><a href="#html5-doctype" id="markdown-toc-html5-doctype">HTML5 doctype</a></li>
<li><a href="#box-sizing" id="markdown-toc-box-sizing">Box-sizing</a></li>
<li><a href="#built-on-normalize" id="markdown-toc-built-on-normalize">Built on Normalize</a></li>
<li><a href="#based-on-foundation-5" id="markdown-toc-based-on-foundation-5">Based on Foundation 5</a></li>
</ul>
<h2 id="html5-doctype">HTML5 doctype</h2>
<p>SpinCommerce makes use of certain HTML elements and CSS properties that <strong>require</strong> the use of the HTML5 doctype. Include it at the beginning of all your pages.</p>
<figure class="highlight"><pre><code class="language-html" data-lang="html"><span class="cp"><!DOCTYPE html></span>
<span class="nt"><html</span> <span class="na">lang=</span><span class="s">"es"</span><span class="nt">></span>
...
<span class="nt"></html></span></code></pre></figure>
<h2 id="box-sizing">Box-sizing</h2>
<p>We reset <code class="highlighter-rouge">box-sizing</code> to <code class="highlighter-rouge">border-box</code> for every element in SpinCommerce. This allows us to more easily assign widths to elements that also have <code class="highlighter-rouge">padding</code> and <code class="highlighter-rouge">border</code>s.</p>
<h2 id="built-on-normalize">Built on Normalize</h2>
<p>For improved cross-browser rendering, we use <a href="http://necolas.github.io/normalize.css/">Normalize.css</a> to correct small inconsistencies across browsers and devices.</p>
<h2 id="based-on-foundation-5">Based on Foundation 5</h2>
<p>SpinCommerce is based on Foundation 5. <a href="http://foundation.zurb.com/sites/docs/v/5.5.3/">Read Docs</a>.</p>
</div>
</div>
</div>
<footer class="footer column small-12">
Copyright SpinCommerce 2016.<br>
Created and maintained by SpinCommerce team. <strong>Currently v0.1.</strong>
</footer>
</div>
<script src="/spincommerce-style-guide/js/anchor.min.js"></script>
<script>
var selector = '.markdown-body h2, .markdown-body h3';
anchors.options = {
placement: 'left',
class: 'anchor-link'
};
anchors.add(selector);
</script>
</body>
</html>
| Java |
var nums = [];
for (var i = 0; i < 100; ++i) {
nums[i] = Math.floor(Math.random() * 101);
}
insertionsort(nums);
dispArr(nums);
print();
putstr("Enter a value to count: ");
var val = parseInt(readline());
var retVal = count(nums, val);
print("Found " + retVal + " occurrences of " + val + ".");
| Java |
/**
* This package provides the necessary classes to slice and compose a file.
*
* @author Sergio Merino
*/
package assembler; | Java |
import imageContainer from '../server/api/helpers/imageContainer';
const entries = [
{
html: '<img src="/img/60x30.png" alt="60x30" class="zoom" data-zoom-src="/img/60x30-original.png">',
},
{
html: `<div>
<img src="/img/20x50.jpg">
</div>
<img src="/img/40x10.svg" alt="40x10">`,
},
{
html: '<div>Hello, World!</div>',
},
];
describe('ImageContainer', () => {
const modifiedEntries = imageContainer(entries, __dirname);
it('Parses one image', () => {
expect(modifiedEntries[0].html).toContain('<div class="imageContainer" style="width: 60px;">');
expect(modifiedEntries[0].html).toContain('<div style="padding-bottom: 50%">');
});
it('Parses multiple images', () => {
expect(modifiedEntries[1].html).toContain('<div class="imageContainer" style="width: 20px;">');
expect(modifiedEntries[1].html).toContain('<div style="padding-bottom: 250%">');
expect(modifiedEntries[1].html).toContain('<div class="imageContainer" style="width: 40px;">');
expect(modifiedEntries[1].html).toContain('<div style="padding-bottom: 25%">');
});
it('Doesn’t parse things it shouldn’t', () => {
expect(modifiedEntries[2].html.length).toEqual(entries[2].html.length);
});
it('Doesn’t crash when passing in an empty array', () => {
const emptyEntries = [];
expect(emptyEntries).toEqual(imageContainer(emptyEntries));
});
});
| Java |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Unsigned` trait in crate `num`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Unsigned">
<title>num::traits::Unsigned - Rust</title>
<link rel="stylesheet" type="text/css" href="../../main.css">
<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<section class="sidebar">
<a href='../../num/index.html'><img src='http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a>
<p class='location'><a href='../index.html'>num</a>::<wbr><a href='index.html'>traits</a></p><script>window.sidebarCurrent = {name: 'Unsigned', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</section>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press 'S' to search, '?' for more options..."
type="search">
</div>
</form>
</nav>
<section id='main' class="content trait">
<h1 class='fqn'><span class='in-band'>Trait <a href='../index.html'>num</a>::<wbr><a href='index.html'>traits</a>::<wbr><a class='trait' href=''>Unsigned</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-16766' class='srclink' href='../../src/num/traits.rs.html#420' title='goto source code'>[src]</a></span></h1>
<pre class='rust trait'>pub trait Unsigned: <a class='trait' href='../../num/traits/trait.Num.html' title='num::traits::Num'>Num</a> { }</pre><div class='docblock'><p>A trait for values which cannot be negative</p>
</div>
<h2 id='implementors'>Implementors</h2>
<ul class='item-list' id='implementors-list'>
<li><code>impl <a class='trait' href='../../num/traits/trait.Unsigned.html' title='num::traits::Unsigned'>Unsigned</a> for <a class='struct' href='../../num/bigint/struct.BigUint.html' title='num::bigint::BigUint'>BigUint</a></code></li>
<li><code>impl <a class='trait' href='../../num/traits/trait.Unsigned.html' title='num::traits::Unsigned'>Unsigned</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code></li>
<li><code>impl <a class='trait' href='../../num/traits/trait.Unsigned.html' title='num::traits::Unsigned'>Unsigned</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a></code></li>
<li><code>impl <a class='trait' href='../../num/traits/trait.Unsigned.html' title='num::traits::Unsigned'>Unsigned</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.u16.html'>u16</a></code></li>
<li><code>impl <a class='trait' href='../../num/traits/trait.Unsigned.html' title='num::traits::Unsigned'>Unsigned</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.u32.html'>u32</a></code></li>
<li><code>impl <a class='trait' href='../../num/traits/trait.Unsigned.html' title='num::traits::Unsigned'>Unsigned</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.u64.html'>u64</a></code></li>
</ul><script type="text/javascript" async
src="../../implementors/num/traits/trait.Unsigned.js">
</script></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<div id="help" class="hidden">
<div class="shortcuts">
<h1>Keyboard shortcuts</h1>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h1>Search tricks</h1>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>typedef</code> (or
<code>tdef</code>).
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
</p>
</div>
</div>
<script>
window.rootPath = "../../";
window.currentCrate = "num";
window.playgroundUrl = "http://play.rust-lang.org/";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script src="../../playpen.js"></script>
<script async src="../../search-index.js"></script>
</body>
</html> | Java |
import unittest
from polycircles import polycircles
from nose.tools import assert_equal, assert_almost_equal
class TestDifferentOutputs(unittest.TestCase):
"""Tests the various output methods: KML style, WKT, lat-lon and lon-lat."""
def setUp(self):
self.latitude = 32.074322
self.longitude = 34.792081
self.radius_meters = 100
self.number_of_vertices = 36
self.polycircle = \
polycircles.Polycircle(latitude=self.latitude,
longitude=self.longitude,
radius=self.radius_meters,
number_of_vertices=self.number_of_vertices)
def test_lat_lon_output(self):
"""Asserts that the vertices in the lat-lon output are in the
right order (lat before long)."""
for vertex in self.polycircle.to_lat_lon():
assert_almost_equal(vertex[0], self.latitude, places=2)
assert_almost_equal(vertex[1], self.longitude, places=2)
def test_lon_lat_output(self):
"""Asserts that the vertices in the lat-lon output are in the
right order (lat before long)."""
for vertex in self.polycircle.to_lon_lat():
assert_almost_equal(vertex[0], self.longitude, places=2)
assert_almost_equal(vertex[1], self.latitude, places=2)
def test_vertices_equals_lat_lon(self):
"""Asserts that the "vertices" property is identical to the return
value of to_lat_lon()."""
assert_equal(self.polycircle.vertices, self.polycircle.to_lat_lon())
def test_kml_equals_lon_lat(self):
"""Asserts that the return value of to_kml() property is identical to
the return value of to_lon_lat()."""
assert_equal(self.polycircle.to_kml(), self.polycircle.to_lon_lat())
if __name__ == '__main__':
unittest.main() | Java |
@CHARSET "UTF-8";
/******* GENERAL RESET *******/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em,
font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody,
tfoot, thead, tr, th, td {
border:0pt none;
font-family:inherit;
font-size: 100%;
font-style:inherit;
font-weight:inherit;
margin:0pt;
padding:0pt;
vertical-align:baseline;
}
body{
background: #fff;
line-height:14px;
font-size: 11px;
font-family: Tahoma, Arial, Verdana, Helvetica, sans-serif;
margin:0pt;
overflow: hidden;
cursor: default !Important;
}
html,body{
height:100%;
}
.clear{
clear: both;
height: 0;
visibility: hidden;
display: block;
}
a{
text-decoration: none;
}
/******* GENERAL RESET *******/
/******* MAIN *******/
#main{
height: 100%;
background: transparent url(images/background.jpg) no-repeat scroll center center;
overflow: none;
}
/******* /MAIN *******/
/******* ICONS *******/
#main div.icon{
min-width: 48px;
min-height: 48px;
padding: 0px 14px 8px;
border: 1px solid transparent;
margin: 0pt auto;
text-align: left;
position: absolute;
display: none;
}
#main div.icon:hover{
background-color: #0a2c5e !Important;
border: 1px solid #3b567e;
}
#main div.icon.active{
background-color: #0a2c5e !Important;
border: 1px solid #3b567e;
}
#main div.icon div.name{
margin-top: 52px;
text-align: center;
color: #fff;
}
#main #mipc{
background: transparent url(images/mipc.png) no-repeat scroll center 4px;
top: 32px;
left: 32px;
}
#main #home{
background: transparent url(images/homeNeXT.png) no-repeat scroll center 4px;
top: 128px;
left: 32px;
}
#main #usb{
background: transparent url(images/usb.png) no-repeat scroll center 4px;
top: 224px;
left: 32px;
}
#main #trash{
background: transparent url(images/trash.png) no-repeat scroll center 4px;
}
/******* /ICONS *******/
/******* TASKBAR *******/
#main #taskbar{
width: 100%;
height: 42px;
line-height: 42px;
background: #e6e6e6 url(images/taskbar.jpg) repeat-x left top;
position: absolute;
left: 0;
bottom: 0px;
padding: 4px 0px 1px 0px;
display: none;
}
#main #taskbar #start{
float: left;
background: transparent url(images/start.png) no-repeat 4px -3px;
width: 64px;
margin: 0 4px 0 0;
padding: 0 2px 0 42px;
font-size: 18px;
font-style: italic;
font-weight: 700;
text-align: center;
}
#main #taskbar #start:hover{
background-color: #fff;
}
#main #taskbar #clock{
float: right;
background: #e6e6e6 url(images/clock.jpg) no-repeat 4px center;
padding: 0 8px 0 50px;
font-size: 12px;
border-left: 2px solid #f9f9f9;
font-weight: 700;
text-align: center;
}
/******* /TASKBAR *******/ | Java |
package betterwithaddons.crafting.recipes;
import betterwithaddons.crafting.ICraftingResult;
import betterwithaddons.util.ItemUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class PackingRecipe
{
public ICraftingResult output;
public List<Ingredient> inputs;
public PackingRecipe(List<Ingredient> inputs, ICraftingResult output) {
this.output = output;
this.inputs = inputs;
}
public ICraftingResult getOutput(List<ItemStack> inputs, IBlockState compressState) {
return this.output.copy();
}
public boolean consume(List<ItemStack> inputs, IBlockState compressState, boolean simulate)
{
inputs = new ArrayList<>(inputs);
for (Ingredient ingredient : this.inputs) {
boolean matches = false;
Iterator<ItemStack> iterator = inputs.iterator();
while(iterator.hasNext()) {
ItemStack checkStack = iterator.next();
if(ingredient.apply(checkStack)) {
if(!simulate)
checkStack.shrink(ItemUtil.getSize(ingredient));
iterator.remove();
matches = true;
}
}
if(!matches)
return false;
}
return true;
}
} | Java |
<?php
namespace Frontend42;
return [
'migration' => [
'directory' => [
__NAMESPACE__ => __DIR__ . '/../../data/migrations'
],
],
];
| Java |
#pragma once
#include "platform.h"
#include "value.h"
#include "vm.h"
#include "result.h"
#include <memory>
#include <vector>
namespace imq
{
class IMQ_API ScriptFunction : public QFunction
{
public:
ScriptFunction(const String& funcName, Context* outerCtx, const std::shared_ptr<VBlock> block, const std::vector<String>& argNames);
virtual ~ScriptFunction();
virtual Result execute(VMachine* vm, int32_t argCount, QValue* args, QValue* result) override;
virtual size_t GC_getSize() const override;
virtual bool GC_isDynamic() const override { return false; }
protected:
virtual void GC_markChildren() override;
private:
ScriptFunction(const ScriptFunction& other) = default;
ScriptFunction& operator=(const ScriptFunction& other) = default;
String funcName;
Context* outerCtx;
std::shared_ptr<VBlock> block;
std::vector<String> argNames;
};
class IMQ_API DefineFunctionExpr : public VExpression
{
public:
DefineFunctionExpr(const String& funcName, VBlock* block, const std::vector<String>& argNames, const VLocation& loc);
DefineFunctionExpr(VBlock* block, const std::vector<String>& argNames, const VLocation& loc);
virtual ~DefineFunctionExpr();
virtual String getName() const override;
virtual Result execute(Context* context, QValue* result) override;
private:
String funcName;
VBlock* initialBlock;
std::shared_ptr<VBlock> block;
std::vector<String> argNames;
};
} | Java |
#include "cf_internal.h"
#define CACHE_SIZE 1024
#define INDEX(i) ((i) % CACHE_SIZE)
static frame_cache_t* open_real_video_cache(cf_session_t* s)
{
frame_cache_t* cache = calloc(1, sizeof(frame_cache_t));
cache->wait_timer = s->proc->rtt + 2 * s->proc->rtt_val;
cache->state = buffer_waiting;
cache->frame_timer = 100;
cache->size = CACHE_SIZE;
cache->frames = calloc(cache->size, sizeof(cf_frame_t));
return cache;
}
static inline void real_video_clean_frame(cf_session_t* session, frame_cache_t* c, cf_frame_t* frame)
{
int i;
if (frame->seg_number == 0)
return;
for (i = 0; i < frame->seg_number; ++i){
if (frame->segments[i] != NULL){
slab_free(session->mem, frame->segments[i]);
frame->segments[i] = NULL;
}
}
free(frame->segments);
log_debug("buffer clean frame, frame id = %u, ts = %llu\n", frame->fid, frame->ts);
frame->ts = 0;
frame->frame_type = 0;
frame->seg_number = 0;
c->min_fid = frame->fid;
}
static void close_real_video_cache(cf_session_t* s, frame_cache_t* cache)
{
uint32_t i;
for (i = 0; i < cache->size; ++i)
real_video_clean_frame(s, cache, &cache->frames[i]);
free(cache->frames);
free(cache);
}
static void reset_real_video_cache(cf_session_t* s, frame_cache_t* cache)
{
uint32_t i;
for (i = 0; i < cache->size; ++i)
real_video_clean_frame(s, cache, &cache->frames[i]);
cache->min_fid = 0;
cache->max_fid = 0;
cache->play_ts = 0;
cache->frame_ts = 0;
cache->max_ts = 100;
cache->frame_timer = 100;
cache->state = buffer_waiting;
cache->wait_timer = SU_MAX(100, s->proc->rtt + 2 * s->proc->rtt_val);
cache->loss_flag = 0;
}
static void real_video_evict_frame(cf_session_t* s, frame_cache_t* c, uint32_t fid)
{
uint32_t pos, i;
for (pos = c->max_fid + 1; pos <= fid; pos++)
real_video_clean_frame(s, c, &c->frames[INDEX(pos)]);
if (fid < c->min_fid + c->size)
return;
for (pos = c->min_fid + 1; pos < c->max_fid; ++pos){
if (c->frames[INDEX(pos)].frame_type == 1)
break;
}
for (i = c->min_fid + 1; i < pos; ++i)
real_video_clean_frame(s, c, &c->frames[INDEX(i)]);
}
static int real_video_cache_put(cf_session_t* s, frame_cache_t* c, cf_seg_video_t* seg)
{
cf_frame_t* frame;
int ret = -1;
if (seg->index >= seg->total){
assert(0);
return ret;
}
else if (seg->fid <= c->min_fid)
return ret;
if (seg->fid > c->max_fid){
if (c->max_fid > 0)
real_video_evict_frame(s, c, seg->fid);
else if (c->min_fid == 0)
c->min_fid = seg->fid - 1;
if (c->max_fid >= 0 && c->max_fid < seg->fid && c->max_ts < seg->ts){
c->frame_timer = (seg->ts - c->max_ts) / (seg->fid - c->max_fid);
if (c->frame_timer < 20)
c->frame_timer = 20;
else if (c->frame_timer > 200)
c->frame_timer = 200;
}
c->max_ts = seg->ts;
c->max_fid = seg->fid;
}
log_debug("buffer put video frame, frame = %u, seq = %u, ts = %u\n", seg->fid, seg->seq, seg->ts);
frame = &(c->frames[INDEX(seg->fid)]);
frame->fid = seg->fid;
frame->frame_type = seg->ftype;
frame->ts = seg->ts;
if (frame->seg_number == 0){
frame->seg_number = seg->total;
frame->segments = calloc(frame->seg_number, sizeof(seg));
frame->segments[seg->index] = seg;
ret = 0;
}
else{
if (frame->segments[seg->index] == NULL){
frame->segments[seg->index] = seg;
ret = 0;
}
}
return ret;
}
static void real_video_cache_check_playing(cf_session_t* s, frame_cache_t* c)
{
uint64_t max_ts, min_ts;
if (c->max_fid > c->min_fid){
max_ts = c->frames[INDEX(c->max_fid)].ts;
min_ts = c->frames[INDEX(c->min_fid + 1)].ts;
if (min_ts > 0 && max_ts > min_ts + (c->wait_timer * 5 / 4) && c->max_fid >= c->min_fid + 1){
c->state = buffer_playing;
c->play_ts = GET_SYS_MS();
c->frame_ts = max_ts - (c->wait_timer * 5 / 4);
}
}
}
static inline void real_video_cache_check_waiting(cf_session_t* s, frame_cache_t* c)
{
if (c->max_fid <= c->min_fid){
c->state = buffer_waiting;
log_debug("buffer waiting ...........\n");
}
}
static inline int real_video_cache_check_frame_full(cf_session_t* s, cf_frame_t* frame)
{
int i;
for (i = 0; i < frame->seg_number; ++i)
if (frame->segments[i] == NULL)
return -1;
return 0;
}
static inline void real_video_cache_sync_timestamp(cf_session_t* s, frame_cache_t* c)
{
uint64_t cur_ts = GET_SYS_MS();
if (cur_ts > c->play_ts){
c->frame_ts = (uint32_t)(cur_ts - c->play_ts) + c->frame_ts;
c->play_ts = cur_ts;
}
}
static int real_video_cache_get(cf_session_t* s, frame_cache_t* c, uint8_t* data, size_t* sizep)
{
uint32_t pos;
size_t size;
int ret, i;
cf_frame_t* frame;
uint64_t max_ts;
if (c->state == buffer_waiting)
real_video_cache_check_playing(s, c);
else
real_video_cache_check_waiting(s, c);
if (c->state != buffer_playing){
size = 0;
ret = -1;
goto err;
}
real_video_cache_sync_timestamp(s, c);
max_ts = c->frames[INDEX(c->max_fid)].ts;
pos = INDEX(c->min_fid + 1);
frame = &c->frames[pos];
if (frame->ts <= c->frame_ts && real_video_cache_check_frame_full(s, frame) == 0){
size = 0;
for (i = 0; i < frame->seg_number; ++i){
memcpy(data + size, frame->segments[i]->data, frame->segments[i]->data_size);
size += frame->segments[i]->data_size;
}
if (frame->ts + c->wait_timer * 5 / 4 >= max_ts || c->min_fid + 1 == c->max_fid)
c->frame_ts = frame->ts;
else
c->frame_ts = max_ts - c->wait_timer * 5 / 4;
real_video_clean_frame(s, c, frame);
ret = 0;
}
else{
size = 0;
ret = -1;
}
err:
*sizep = size;
return ret;
}
static uint32_t real_video_cache_get_min_seq(cf_session_t* s, frame_cache_t* c)
{
int i;
cf_frame_t* frame;
cf_seg_video_t* seg;
frame = &c->frames[INDEX(c->min_fid)];
for (i = 0; i < frame->seg_number; ++i){
seg = frame->segments[i];
if (seg != NULL)
return seg->seq - seg->index - 1;
}
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct
{
uint64_t ts;
int count;
}wb_loss_t;
static inline void loss_free(skiplist_item_t key, skiplist_item_t val)
{
free(val.ptr);
}
cf_video_real_buffer_t* create_video_real_buffer(cf_session_t* s)
{
cf_video_real_buffer_t* r = calloc(1, sizeof(cf_video_real_buffer_t));
r->loss = skiplist_create(id_compare, loss_free);
r->cache = open_real_video_cache(s);
r->cache_ts = GET_SYS_MS();
return r;
}
void destroy_video_real_buffer(cf_session_t* s, cf_video_real_buffer_t* r)
{
if (r == NULL)
return;
assert(r->cache && r->loss);
skiplist_destroy(r->loss);
close_real_video_cache(s, r->cache);
free(r);
}
void reset_video_real_buffer(cf_session_t* s, cf_video_real_buffer_t* r)
{
reset_real_video_cache(s, r->cache);
skiplist_clear(r->loss);
r->base_uid = 0;
r->base_seq = 0;
r->actived = 0;
r->max_seq = 0;
r->ack_ts = GET_SYS_MS();
r->active_ts = r->ack_ts;
r->loss_count = 0;
}
int active_video_real_buffer(cf_session_t* s, cf_video_real_buffer_t* r, uint32_t start_seq, uint16_t rate, uint32_t base_uid)
{
if (r->actived == 1)
return -1;
if (start_seq > 0){
r->base_seq = start_seq;
r->max_seq = r->base_seq;
}
r->actived = 1;
r->base_seq = start_seq;
r->base_uid = base_uid;
if (rate > 0)
r->cache->frame_timer = SU_MAX(20, 1000 / rate);
r->active_ts = GET_SYS_MS();
return 0;
}
static void video_real_buffer_update_loss(cf_session_t* s, cf_video_real_buffer_t* r, uint32_t seq)
{
uint32_t i;
skiplist_item_t key, val;
skiplist_iter_t* iter;
key.u32 = seq;
skiplist_remove(r->loss, key);
for (i = r->max_seq + 1; i < seq; ++i){
key.u32 = i;
iter = skiplist_search(r->loss, key);
if (iter == NULL){
wb_loss_t* l = calloc(1, sizeof(wb_loss_t));
l->ts = GET_SYS_MS() - s->proc->rtt;
l->count = 0;
val.ptr = l;
skiplist_insert(r->loss, key, val);
}
}
}
static inline void video_send_segment(cf_session_t* s, cf_segment_ack_t* ack)
{
cf_header_t header;
CF_INIT_HEADER(header, SEG_ACK, s->rid, s->uid);
cf_encode_msg(&s->sstrm, &header, ack);
processor_send(s, s->proc, &s->sstrm, &s->proc->server_node);
}
static void video_real_ack(cf_session_t* s, cf_video_real_buffer_t* r, int hb)
{
uint64_t cur_ts;
cf_segment_ack_t ack;
skiplist_iter_t* iter;
skiplist_item_t key;
wb_loss_t* l;
uint32_t min_seq, delay;
int max_count = 0;
cur_ts = GET_SYS_MS();
if (r->ack_ts + 10 < cur_ts){
min_seq = real_video_cache_get_min_seq(s, r->cache);
if (min_seq > r->base_seq){
for (key.u32 = r->base_seq + 1; key.u32 <= min_seq; ++key.u32)
skiplist_remove(r->loss, key);
r->base_seq = min_seq;
}
ack.base_uid = r->base_uid;
ack.base = r->base_seq;
ack.loss_num = 0;
SKIPLIST_FOREACH(r->loss, iter){
l = (wb_loss_t*)iter->val.ptr;
if (iter->key.u32 <= r->base_seq)
continue;
if (l->ts + s->proc->rtt + s->proc->rtt_val <= cur_ts && ack.loss_num < LOSS_SISE){
ack.loss[ack.loss_num++] = iter->key.u32;
l->ts = cur_ts;
r->loss_count++;
l->count++;
}
if (l->count > max_count)
max_count = l->count;
}
if (ack.loss_num > 0 || hb == 0)
video_send_segment(s, &ack);
r->ack_ts = cur_ts;
}
/*if (r->active_ts + 10000 < cur_ts)*/{
if (max_count > 1){
delay = (max_count * 16 + 7) * (s->proc->rtt + s->proc->rtt_val) / 16;
if (delay > r->cache->wait_timer)
r->cache->wait_timer = SU_MIN(delay, 5000);
}
else if (skiplist_size(r->loss) > 0)
r->cache->wait_timer = SU_MAX((s->proc->rtt + s->proc->rtt_val * 2), r->cache->wait_timer);
}
r->cache->wait_timer = SU_MAX(r->cache->frame_timer, r->cache->wait_timer);
}
int video_real_video_put(cf_session_t* s, cf_video_real_buffer_t* r, cf_seg_video_t* seg)
{
uint32_t seq;
cf_seg_video_t* tmp;
if (r->max_seq == 0 && seg->ftype == 0)
return -1;
seq = seg->seq;
if (r->actived == 0 || seg->seq <= r->base_seq || (r->max_seq > 0 && seq > r->max_seq + 2000)){
return -1;
}
if (r->max_seq == 0 && seg->seq > seg->index){
r->max_seq = seg->seq - seg->index - 1;
r->base_seq = seg->seq - seg->index - 1;
}
video_real_buffer_update_loss(s, r, seq);
tmp = calloc(1, sizeof(cf_seg_video_t));
*tmp = *seg;
if (real_video_cache_put(s, r->cache, tmp) != 0){
free(tmp);
return -1;
}
if (seq == r->base_seq + 1)
r->base_seq = seq;
r->max_seq = SU_MAX(r->max_seq, seq);
video_real_ack(s, r, 0);
return 0;
}
int video_real_video_get(cf_session_t* s, cf_video_real_buffer_t* r, uint8_t* data, size_t* sizep)
{
if (r->actived == 0)
return -1;
return real_video_cache_get(s, r->cache, data, sizep);
}
void video_real_video_timer(cf_session_t* s, cf_video_real_buffer_t* r)
{
video_real_ack(s, r, 1);
if (r->cache_ts + SU_MAX(s->proc->rtt + s->proc->rtt_val, 1000) < GET_SYS_MS()){
if (r->loss_count == 0)
r->cache->wait_timer = SU_MAX(r->cache->wait_timer * 7 / 8, r->cache->frame_timer);
else if (r->cache->wait_timer > 2 * (s->proc->rtt + s->proc->rtt_val))
r->cache->wait_timer = SU_MAX(r->cache->wait_timer * 15 / 16, r->cache->frame_timer);
r->cache_ts = GET_SYS_MS();
r->loss_count = 0;
}
}
| Java |
{{ Form::label('title', __('validation.attributes.title'), ['class' => 'label']) }}
<div class="mb-4">
{{ Form::text('title', old('title', $category->title), ['class' => 'input' . ($errors->has('title') ? ' has-error' : ''), 'required' => true]) }}
@if ($errors->has('title'))
<div class="invalid-feedback">
{{ $errors->first('title') }}
</div>
@endif
</div>
@include('shared._form_color', ['item' => $category])
{{ Form::button($submitTitle, ['type' => 'submit', 'class' => 'btn btn-primary']) }}
| Java |
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['mocha', 'chai', 'sinon'],
// list of files / patterns to load in the browser
files: [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/scripts/*.js',
'app/scripts/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
| Java |
using System.ComponentModel;
namespace LinqAn.Google.Dimensions
{
/// <summary>
/// DCM creative type name of the DCM click matching the Google Analytics session (premium only).
/// </summary>
[Description("DCM creative type name of the DCM click matching the Google Analytics session (premium only).")]
public class DcmClickCreativeType: Dimension
{
/// <summary>
/// Instantiates a <seealso cref="DcmClickCreativeType" />.
/// </summary>
public DcmClickCreativeType(): base("DFA Creative Type (GA Model)",false,"ga:dcmClickCreativeType")
{
}
}
}
| Java |
#include <QDebug>
#include <QFileDialog>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QProcess>
#include <QWidget>
#include "app.h"
#include "import.h"
#include "ui_import.h"
Import::Import(App* app) :
app(app),
platform(-1) {
this->ui.setupUi(this);
connect(this->ui.toolFilepath, SIGNAL(clicked()), this, SLOT(onFilepathTool()));
connect(this->ui.start, SIGNAL(clicked()), this, SLOT(onStart()));
connect(this->ui.filepath, SIGNAL(textChanged(const QString&)), this, SLOT(onFilepathChange()));
connect(&importProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(onImportFinished()));
}
Import::~Import() {
this->ui.filepath->setText("");
this->ui.start->setEnabled(false);
}
void Import::reset() {
}
void Import::onFilepathTool() {
QFileDialog fileDialog(this);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, true);
connect(&fileDialog, SIGNAL(fileSelected(const QString&)), this, SLOT(onSelectedFilepath(const QString&)));
fileDialog.exec();
}
void Import::onSelectedFilepath(const QString& filepath) {
this->ui.filepath->setText(filepath);
}
void Import::onFilepathChange() {
if (this->ui.filepath->text().length() > 0) {
this->ui.start->setEnabled(true);
} else {
this->ui.start->setEnabled(false);
}
}
void Import::onStart() {
this->ui.start->setEnabled(false);
// close the db to not corrupt it.
this->app->getDb()->close();
QString mehtadataPath = app->mehtadataPath();
if (mehtadataPath.length() == 0) {
QMessageBox::critical(NULL, "Can't find mehtadata", "The import can't be executed because the exe mehtadata is not found.");
return;
}
// start the import
importProcess.setProgram(mehtadataPath);
QStringList arguments;
arguments << "-db" << this->app->getDb()->filename << "-import-es";
QProcessEnvironment env;
env.insert("PLATFORM_ID", QString::number(this->platform));
env.insert("GAMELIST", this->ui.filepath->text()) ;
importProcess.setProcessEnvironment(env);
importProcess.setArguments(arguments);
importProcess.start();
qDebug() << "OK";
qDebug() << arguments;
}
void Import::onImportFinished() {
this->ui.start->setEnabled(true);
this->app->getDb()->open(this->app->getDb()->filename);
this->app->getSelectedPlatform().id = -1;
this->app->onPlatformSelected(this->app->getCurrentItem(), NULL);
this->hide();
}
| Java |
import {Component} from '@angular/core';
@Component({
selector: "recomendaciones",
templateUrl: "app/components/htmls/recomendacionesysugerencias/recomendaciones.html",
styleUrls: ["app/components/htmls/htmlStyles.css"]
})
export class RecomendacionesComponent {};
| Java |
Please take a read at this article so we can help you better, we are always happy to support you at our [chat](https://gitter.im/beto-rodriguez/Live-Charts), normally we respond you really fast.
### Features
We are open to add new features to this library, but before suggesting one, ensure it is not implemented yet, There are a lot of examples showing the already supported features in the library, in the [website](http://lvcharts.net/App/examples/wpf/start) and in [in this repo](https://github.com/beto-rodriguez/Live-Charts/tree/master/Examples).
After you are sure it is not implemented, open a [new issue](https://github.com/beto-rodriguez/Live-Charts/issues/new) that contains:
* What you are trying to do and cannot be solved with the [latest](https://www.nuget.org/packages/LiveCharts/) library version, if you can do it but you think it can be easier, then exaplin so and how.
* Since this is a visual library always adding an image with the expected result is helpful.
### Bugs
A bug should be ascertainable with the [latest](https://www.nuget.org/packages/LiveCharts/) version of the library.
A good way to say thanks for this library is doing good reports, the better you report the faster we can fix it. the next list is ordered by "ease to attend" for the developers of the library, you can choose any of these methods to give us your feedback.
* Create a repository that illustrates the issue, please use as less dependencies as possible.
* If you are not very familiar with git, you could simply send us a mail with an example project that illustrates the issue at support@lvcharts.net
* Simply open a [new issue](https://github.com/beto-rodriguez/Live-Charts/issues/new) following the sugested structure.
* Comment it in out [chat](https://gitter.im/beto-rodriguez/Live-Charts).
### Pull Request
Please do suggest whatever you think is necessary to improve, name your PR with a clear name of what you have done, explain a bit about it and you are done, we will review your code and merge it if we think it is appropiated.
Notice that by doing a PR you must respect and agree our [license](https://github.com/beto-rodriguez/Live-Charts/blob/master/LICENSE.TXT).
| Java |
/**
* Copyright (c) André Bargull
* Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms.
*
* <https://github.com/anba/es6draft>
*/
package com.github.anba.es6draft.runtime.types.builtins;
import java.lang.invoke.MethodHandle;
import java.lang.reflect.Method;
import com.github.anba.es6draft.runtime.ExecutionContext;
import com.github.anba.es6draft.runtime.Realm;
import com.github.anba.es6draft.runtime.types.Constructor;
/**
* <h1>9 Ordinary and Exotic Objects Behaviours</h1>
* <ul>
* <li>9.3 Built-in Function Objects
* </ul>
*/
public abstract class BuiltinConstructor extends BuiltinFunction implements Constructor {
private MethodHandle constructMethod;
/**
* Constructs a new built-in constructor function.
*
* @param realm
* the realm object
* @param name
* the function name
* @param arity
* the function arity
*/
protected BuiltinConstructor(Realm realm, String name, int arity) {
super(realm, name, arity);
}
/**
* Returns `(? extends BuiltinConstructor, ExecutionContext, Constructor, Object[]) {@literal ->} ScriptObject`
* method-handle.
*
* @return the call method handle
*/
public MethodHandle getConstructMethod() {
if (constructMethod == null) {
try {
Method method = getClass().getDeclaredMethod("construct", ExecutionContext.class, Constructor.class,
Object[].class);
constructMethod = lookup().unreflect(method);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
return constructMethod;
}
}
| Java |
<?php
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\AdminBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Michael Williams <mtotheikle@gmail.com>
*/
class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree.
*
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sonata_admin', 'array');
$rootNode
->fixXmlConfig('option')
->fixXmlConfig('admin_service')
->fixXmlConfig('template')
->fixXmlConfig('extension')
->children()
->arrayNode('security')
->addDefaultsIfNotSet()
->fixXmlConfig('admin_permission')
->fixXmlConfig('object_permission')
->children()
->scalarNode('handler')->defaultValue('sonata.admin.security.handler.noop')->end()
->arrayNode('information')
->useAttributeAsKey('id')
->prototype('array')
->performNoDeepMerging()
->beforeNormalization()
->ifString()
->then(function ($v) {
return array($v);
})
->end()
->prototype('scalar')->end()
->end()
->end()
->arrayNode('admin_permissions')
->defaultValue(array('CREATE', 'LIST', 'DELETE', 'UNDELETE', 'EXPORT', 'OPERATOR', 'MASTER'))
->prototype('scalar')->end()
->end()
->arrayNode('object_permissions')
->defaultValue(array('VIEW', 'EDIT', 'DELETE', 'UNDELETE', 'OPERATOR', 'MASTER', 'OWNER'))
->prototype('scalar')->end()
->end()
->scalarNode('acl_user_manager')->defaultNull()->end()
->end()
->end()
->scalarNode('title')->defaultValue('Sonata Admin')->cannotBeEmpty()->end()
->scalarNode('title_logo')->defaultValue('bundles/sonataadmin/logo_title.png')->cannotBeEmpty()->end()
->arrayNode('breadcrumbs')
->addDefaultsIfNotSet()
->children()
->scalarNode('child_admin_route')
->defaultValue('edit')
->info('Change the default route used to generate the link to the parent object, when in a child admin')
->end()
->end()
->end()
->arrayNode('options')
->addDefaultsIfNotSet()
->children()
->booleanNode('html5_validate')->defaultTrue()->end()
->booleanNode('sort_admins')->defaultFalse()->info('Auto order groups and admins by label or id')->end()
->booleanNode('confirm_exit')->defaultTrue()->end()
->booleanNode('use_select2')->defaultTrue()->end()
->booleanNode('use_icheck')->defaultTrue()->end()
->booleanNode('use_bootlint')->defaultFalse()->end()
->booleanNode('use_stickyforms')->defaultTrue()->end()
->integerNode('pager_links')->defaultNull()->end()
->scalarNode('form_type')->defaultValue('standard')->end()
->integerNode('dropdown_number_groups_per_colums')->defaultValue(2)->end()
->enumNode('title_mode')
->values(array('single_text', 'single_image', 'both'))
->defaultValue('both')
->cannotBeEmpty()
->end()
->booleanNode('lock_protection')
->defaultFalse()
->info('Enable locking when editing an object, if the corresponding object manager supports it.')
->end()
->end()
->end()
->arrayNode('dashboard')
->addDefaultsIfNotSet()
->fixXmlConfig('group')
->fixXmlConfig('block')
->children()
->arrayNode('groups')
->useAttributeAsKey('id')
->prototype('array')
->beforeNormalization()
->ifArray()
->then(function ($items) {
if (isset($items['provider'])) {
$disallowedItems = array('items', 'label');
foreach ($disallowedItems as $item) {
if (isset($items[$item])) {
throw new \InvalidArgumentException(sprintf('The config value "%s" cannot be used alongside "provider" config value', $item));
}
}
}
return $items;
})
->end()
->fixXmlConfig('item')
->fixXmlConfig('item_add')
->children()
->scalarNode('label')->end()
->scalarNode('label_catalogue')->end()
->scalarNode('icon')->defaultValue('<i class="fa fa-folder"></i>')->end()
->scalarNode('on_top')->defaultFalse()->info('Show menu item in side dashboard menu without treeview')->end()
->scalarNode('provider')->end()
->arrayNode('items')
->beforeNormalization()
->ifArray()
->then(function ($items) {
foreach ($items as $key => $item) {
if (is_array($item)) {
if (!array_key_exists('label', $item) || !array_key_exists('route', $item)) {
throw new \InvalidArgumentException('Expected either parameters "route" and "label" for array items');
}
if (!array_key_exists('route_params', $item)) {
$items[$key]['route_params'] = array();
}
$items[$key]['admin'] = '';
} else {
$items[$key] = array(
'admin' => $item,
'label' => '',
'route' => '',
'route_params' => array(),
'route_absolute' => true,
);
}
}
return $items;
})
->end()
->prototype('array')
->children()
->scalarNode('admin')->end()
->scalarNode('label')->end()
->scalarNode('route')->end()
->arrayNode('route_params')
->prototype('scalar')->end()
->end()
->booleanNode('route_absolute')
->info('Whether the generated url should be absolute')
->defaultTrue()
->end()
->end()
->end()
->end()
->arrayNode('item_adds')
->prototype('scalar')->end()
->end()
->arrayNode('roles')
->prototype('scalar')->defaultValue(array())->end()
->end()
->end()
->end()
->end()
->arrayNode('blocks')
->defaultValue(array(array(
'position' => 'left',
'settings' => array(),
'type' => 'sonata.admin.block.admin_list',
'roles' => array(),
)))
->prototype('array')
->fixXmlConfig('setting')
->children()
->scalarNode('type')->cannotBeEmpty()->end()
->arrayNode('roles')
->defaultValue(array())
->prototype('scalar')->end()
->end()
->arrayNode('settings')
->useAttributeAsKey('id')
->prototype('variable')->defaultValue(array())->end()
->end()
->scalarNode('position')->defaultValue('right')->end()
->scalarNode('class')->defaultValue('col-md-4')->end()
->end()
->end()
->end()
->end()
->end()
->arrayNode('admin_services')
->prototype('array')
->children()
->scalarNode('model_manager')->defaultNull()->end()
->scalarNode('form_contractor')->defaultNull()->end()
->scalarNode('show_builder')->defaultNull()->end()
->scalarNode('list_builder')->defaultNull()->end()
->scalarNode('datagrid_builder')->defaultNull()->end()
->scalarNode('translator')->defaultNull()->end()
->scalarNode('configuration_pool')->defaultNull()->end()
->scalarNode('route_generator')->defaultNull()->end()
->scalarNode('validator')->defaultNull()->end()
->scalarNode('security_handler')->defaultNull()->end()
->scalarNode('label')->defaultNull()->end()
->scalarNode('menu_factory')->defaultNull()->end()
->scalarNode('route_builder')->defaultNull()->end()
->scalarNode('label_translator_strategy')->defaultNull()->end()
->scalarNode('pager_type')->defaultNull()->end()
->arrayNode('templates')
->addDefaultsIfNotSet()
->children()
->arrayNode('form')
->prototype('scalar')->end()
->end()
->arrayNode('filter')
->prototype('scalar')->end()
->end()
->arrayNode('view')
->useAttributeAsKey('id')
->prototype('scalar')->end()
->end()
->end()
->end()
->end()
->end()
->end()
->arrayNode('templates')
->addDefaultsIfNotSet()
->children()
->scalarNode('user_block')->defaultValue('SonataAdminBundle:Core:user_block.html.twig')->cannotBeEmpty()->end()
->scalarNode('add_block')->defaultValue('SonataAdminBundle:Core:add_block.html.twig')->cannotBeEmpty()->end()
->scalarNode('layout')->defaultValue('SonataAdminBundle::standard_layout.html.twig')->cannotBeEmpty()->end()
->scalarNode('ajax')->defaultValue('SonataAdminBundle::ajax_layout.html.twig')->cannotBeEmpty()->end()
->scalarNode('dashboard')->defaultValue('SonataAdminBundle:Core:dashboard.html.twig')->cannotBeEmpty()->end()
->scalarNode('search')->defaultValue('SonataAdminBundle:Core:search.html.twig')->cannotBeEmpty()->end()
->scalarNode('list')->defaultValue('SonataAdminBundle:CRUD:list.html.twig')->cannotBeEmpty()->end()
->scalarNode('filter')->defaultValue('SonataAdminBundle:Form:filter_admin_fields.html.twig')->cannotBeEmpty()->end()
->scalarNode('show')->defaultValue('SonataAdminBundle:CRUD:show.html.twig')->cannotBeEmpty()->end()
->scalarNode('show_compare')->defaultValue('SonataAdminBundle:CRUD:show_compare.html.twig')->cannotBeEmpty()->end()
->scalarNode('edit')->defaultValue('SonataAdminBundle:CRUD:edit.html.twig')->cannotBeEmpty()->end()
->scalarNode('preview')->defaultValue('SonataAdminBundle:CRUD:preview.html.twig')->cannotBeEmpty()->end()
->scalarNode('history')->defaultValue('SonataAdminBundle:CRUD:history.html.twig')->cannotBeEmpty()->end()
->scalarNode('acl')->defaultValue('SonataAdminBundle:CRUD:acl.html.twig')->cannotBeEmpty()->end()
->scalarNode('history_revision_timestamp')->defaultValue('SonataAdminBundle:CRUD:history_revision_timestamp.html.twig')->cannotBeEmpty()->end()
->scalarNode('action')->defaultValue('SonataAdminBundle:CRUD:action.html.twig')->cannotBeEmpty()->end()
->scalarNode('select')->defaultValue('SonataAdminBundle:CRUD:list__select.html.twig')->cannotBeEmpty()->end()
->scalarNode('list_block')->defaultValue('SonataAdminBundle:Block:block_admin_list.html.twig')->cannotBeEmpty()->end()
->scalarNode('search_result_block')->defaultValue('SonataAdminBundle:Block:block_search_result.html.twig')->cannotBeEmpty()->end()
->scalarNode('short_object_description')->defaultValue('SonataAdminBundle:Helper:short-object-description.html.twig')->cannotBeEmpty()->end()
->scalarNode('delete')->defaultValue('SonataAdminBundle:CRUD:delete.html.twig')->cannotBeEmpty()->end()
->scalarNode('batch')->defaultValue('SonataAdminBundle:CRUD:list__batch.html.twig')->cannotBeEmpty()->end()
->scalarNode('batch_confirmation')->defaultValue('SonataAdminBundle:CRUD:batch_confirmation.html.twig')->cannotBeEmpty()->end()
->scalarNode('inner_list_row')->defaultValue('SonataAdminBundle:CRUD:list_inner_row.html.twig')->cannotBeEmpty()->end()
->scalarNode('outer_list_rows_mosaic')->defaultValue('SonataAdminBundle:CRUD:list_outer_rows_mosaic.html.twig')->cannotBeEmpty()->end()
->scalarNode('outer_list_rows_list')->defaultValue('SonataAdminBundle:CRUD:list_outer_rows_list.html.twig')->cannotBeEmpty()->end()
->scalarNode('outer_list_rows_tree')->defaultValue('SonataAdminBundle:CRUD:list_outer_rows_tree.html.twig')->cannotBeEmpty()->end()
->scalarNode('base_list_field')->defaultValue('SonataAdminBundle:CRUD:base_list_field.html.twig')->cannotBeEmpty()->end()
->scalarNode('pager_links')->defaultValue('SonataAdminBundle:Pager:links.html.twig')->cannotBeEmpty()->end()
->scalarNode('pager_results')->defaultValue('SonataAdminBundle:Pager:results.html.twig')->cannotBeEmpty()->end()
->scalarNode('tab_menu_template')->defaultValue('SonataAdminBundle:Core:tab_menu_template.html.twig')->cannotBeEmpty()->end()
->scalarNode('knp_menu_template')->defaultValue('SonataAdminBundle:Menu:sonata_menu.html.twig')->cannotBeEmpty()->end()
->scalarNode('action_create')->defaultValue('SonataAdminBundle:CRUD:dashboard__action_create.html.twig')->cannotBeEmpty()->end()
->scalarNode('button_acl')->defaultValue('SonataAdminBundle:Button:acl_button.html.twig')->cannotBeEmpty()->end()
->scalarNode('button_create')->defaultValue('SonataAdminBundle:Button:create_button.html.twig')->cannotBeEmpty()->end()
->scalarNode('button_edit')->defaultValue('SonataAdminBundle:Button:edit_button.html.twig')->cannotBeEmpty()->end()
->scalarNode('button_history')->defaultValue('SonataAdminBundle:Button:history_button.html.twig')->cannotBeEmpty()->end()
->scalarNode('button_list')->defaultValue('SonataAdminBundle:Button:list_button.html.twig')->cannotBeEmpty()->end()
->scalarNode('button_show')->defaultValue('SonataAdminBundle:Button:show_button.html.twig')->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('assets')
->addDefaultsIfNotSet()
->children()
->arrayNode('stylesheets')
->defaultValue(array(
'bundles/sonatacore/vendor/bootstrap/dist/css/bootstrap.min.css',
'bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css',
'bundles/sonatacore/vendor/ionicons/css/ionicons.min.css',
'bundles/sonataadmin/vendor/admin-lte/dist/css/AdminLTE.min.css',
'bundles/sonataadmin/vendor/admin-lte/dist/css/skins/skin-black.min.css',
'bundles/sonataadmin/vendor/iCheck/skins/square/blue.css',
'bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
'bundles/sonataadmin/vendor/jqueryui/themes/base/jquery-ui.css',
'bundles/sonatacore/vendor/select2/select2.css',
'bundles/sonatacore/vendor/select2-bootstrap-css/select2-bootstrap.min.css',
'bundles/sonataadmin/vendor/x-editable/dist/bootstrap3-editable/css/bootstrap-editable.css',
'bundles/sonataadmin/css/styles.css',
'bundles/sonataadmin/css/layout.css',
'bundles/sonataadmin/css/tree.css',
))
->prototype('scalar')->end()
->end()
->arrayNode('javascripts')
->defaultValue(array(
'bundles/sonatacore/vendor/jquery/dist/jquery.min.js',
'bundles/sonataadmin/vendor/jquery.scrollTo/jquery.scrollTo.min.js',
'bundles/sonatacore/vendor/moment/min/moment.min.js',
'bundles/sonataadmin/vendor/jqueryui/ui/minified/jquery-ui.min.js',
'bundles/sonataadmin/vendor/jqueryui/ui/minified/i18n/jquery-ui-i18n.min.js',
'bundles/sonatacore/vendor/bootstrap/dist/js/bootstrap.min.js',
'bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js',
'bundles/sonataadmin/vendor/jquery-form/jquery.form.js',
'bundles/sonataadmin/jquery/jquery.confirmExit.js',
'bundles/sonataadmin/vendor/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.min.js',
'bundles/sonatacore/vendor/select2/select2.min.js',
'bundles/sonataadmin/vendor/admin-lte/dist/js/app.min.js',
'bundles/sonataadmin/vendor/iCheck/icheck.min.js',
'bundles/sonataadmin/vendor/slimScroll/jquery.slimscroll.min.js',
'bundles/sonataadmin/vendor/waypoints/lib/jquery.waypoints.min.js',
'bundles/sonataadmin/vendor/waypoints/lib/shortcuts/sticky.min.js',
'bundles/sonataadmin/Admin.js',
'bundles/sonataadmin/treeview.js',
))
->prototype('scalar')->end()
->end()
->end()
->end()
->arrayNode('extensions')
->useAttributeAsKey('id')
->defaultValue(array('admins' => array(), 'excludes' => array(), 'implements' => array(), 'extends' => array(), 'instanceof' => array(), 'uses' => array()))
->prototype('array')
->fixXmlConfig('admin')
->fixXmlConfig('exclude')
->fixXmlConfig('implement')
->fixXmlConfig('extend')
->fixXmlConfig('use')
->children()
->arrayNode('admins')
->prototype('scalar')->end()
->end()
->arrayNode('excludes')
->prototype('scalar')->end()
->end()
->arrayNode('implements')
->prototype('scalar')->end()
->end()
->arrayNode('extends')
->prototype('scalar')->end()
->end()
->arrayNode('instanceof')
->prototype('scalar')->end()
->end()
->arrayNode('uses')
->prototype('scalar')->end()
->validate()
->ifTrue(function ($v) {
return !empty($v) && version_compare(PHP_VERSION, '5.4.0', '<');
})
->thenInvalid('PHP >= 5.4.0 is required to use traits.')
->end()
->end()
->end()
->end()
->end()
->scalarNode('persist_filters')->defaultFalse()->end()
->booleanNode('show_mosaic_button')
->defaultTrue()
->info('Show mosaic button on all admin screens')
->end()
->end()
->end();
return $treeBuilder;
}
}
| Java |
//
// AAAreaspline.h
// AAChartKit
//
// Created by An An on 17/3/15.
// Copyright © 2017年 An An. All rights reserved.
//*************** ...... SOURCE CODE ...... ***************
//***...................................................***
//*** https://github.com/AAChartModel/AAChartKit ***
//*** https://github.com/AAChartModel/AAChartKit-Swift ***
//***...................................................***
//*************** ...... SOURCE CODE ...... ***************
/*
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartKit/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/12302132/codeforu
* JianShu : https://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
#import <Foundation/Foundation.h>
@class AADataLabels;
@interface AAAreaspline : NSObject
AAPropStatementAndPropSetFuncStatement(strong, AAAreaspline, AADataLabels *, dataLabels)
@end
| Java |
/*
* Reading a variable.
*/
if (typeof print !== 'function') { print = console.log; }
function test() {
function outer() {
var o = 123;
return function inner() {
var i;
var t;
for (i = 0; i < 1e6; i++) {
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o; t = o;
}
};
}
var f = outer();
f();
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}
| Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.