answer stringlengths 15 1.25M |
|---|
FROM slapi/ruby:latest
# If label is named description it will set tier 1 or plugin description in chat help
LABEL "description"="Plugin Description"
# Use Labels for Help info, a help list will be compiled from the labels
LABEL "ARGNAME01"="Arg Description"
LABEL "ARGNAME02"="Arg Description"
LABEL "ARGNAME03"="Arg Description" |
package co.edu.uniandes.csw.bookstore.resources;
import co.edu.uniandes.csw.bookstore.dtos.BookDetailDTO;
import co.edu.uniandes.csw.bookstore.ejb.AuthorBooksLogic;
import co.edu.uniandes.csw.bookstore.ejb.BookLogic;
import co.edu.uniandes.csw.bookstore.entities.BookEntity;
import co.edu.uniandes.csw.bookstore.exceptions.<API key>;
import co.edu.uniandes.csw.bookstore.mappers.<API key>;
import java.util.List;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.<API key>;
/**
* Clase que implementa el recurso "authors/{id}/books".
*
* @author ISIS2603
* @version 1.0
*/
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class AuthorBooksResource {
private static final Logger LOGGER = Logger.getLogger(AuthorBooksResource.class.getName());
@Inject
private AuthorBooksLogic authorBookLogic;
@Inject
private BookLogic bookLogic;
@POST
@Path("{booksId: \\d+}")
public BookDetailDTO addBook(@PathParam("authorsId") Long authorsId, @PathParam("booksId") Long booksId) {
LOGGER.log(Level.INFO, "AuthorBooksResource addBook: input: authorsId {0} , booksId {1}", new Object[]{authorsId, booksId});
if (bookLogic.getBook(booksId) == null) {
throw new <API key>("El recurso /books/" + booksId + " no existe.", 404);
}
BookDetailDTO detailDTO = new BookDetailDTO(authorBookLogic.addBook(authorsId, booksId));
LOGGER.log(Level.INFO, "AuthorBooksResource addBook: output: {0}", detailDTO);
return detailDTO;
}
@GET
public List<BookDetailDTO> getBooks(@PathParam("authorsId") Long authorsId) {
LOGGER.log(Level.INFO, "AuthorBooksResource getBooks: input: {0}", authorsId);
List<BookDetailDTO> lista = booksListEntity2DTO(authorBookLogic.getBooks(authorsId));
LOGGER.log(Level.INFO, "AuthorBooksResource getBooks: output: {0}", lista);
return lista;
}
@GET
@Path("{booksId: \\d+}")
public BookDetailDTO getBook(@PathParam("authorsId") Long authorsId, @PathParam("booksId") Long booksId) throws <API key> {
LOGGER.log(Level.INFO, "AuthorBooksResource getBook: input: authorsId {0} , booksId {1}", new Object[]{authorsId, booksId});
if (bookLogic.getBook(booksId) == null) {
throw new <API key>("El recurso /books/" + booksId + " no existe.", 404);
}
BookDetailDTO detailDTO = new BookDetailDTO(authorBookLogic.getBook(authorsId, booksId));
LOGGER.log(Level.INFO, "AuthorBooksResource getBook: output: {0}", detailDTO);
return detailDTO;
}
@PUT
public List<BookDetailDTO> replaceBooks(@PathParam("authorsId") Long authorsId, List<BookDetailDTO> books) {
LOGGER.log(Level.INFO, "AuthorBooksResource replaceBooks: input: authorsId {0} , books {1}", new Object[]{authorsId, books});
for (BookDetailDTO book : books) {
if (bookLogic.getBook(book.getId()) == null) {
throw new <API key>("El recurso /books/" + book.getId() + " no existe.", 404);
}
}
List<BookDetailDTO> lista = booksListEntity2DTO(authorBookLogic.replaceBooks(authorsId, booksListDTO2Entity(books)));
LOGGER.log(Level.INFO, "AuthorBooksResource replaceBooks: output: {0}", lista);
return lista;
}
@DELETE
@Path("{booksId: \\d+}")
public void removeBook(@PathParam("authorsId") Long authorsId, @PathParam("booksId") Long booksId) {
LOGGER.log(Level.INFO, "AuthorBooksResource deleteBook: input: authorsId {0} , booksId {1}", new Object[]{authorsId, booksId});
if (bookLogic.getBook(booksId) == null) {
throw new <API key>("El recurso /books/" + booksId + " no existe.", 404);
}
authorBookLogic.removeBook(authorsId, booksId);
LOGGER.info("AuthorBooksResource deleteBook: output: void");
}
/**
* Convierte una lista de BookEntity a una lista de BookDetailDTO.
*
* @param entityList Lista de BookEntity a convertir.
* @return Lista de BookDetailDTO convertida.
*/
private List<BookDetailDTO> booksListEntity2DTO(List<BookEntity> entityList) {
List<BookDetailDTO> list = new ArrayList<>();
for (BookEntity entity : entityList) {
list.add(new BookDetailDTO(entity));
}
return list;
}
/**
* Convierte una lista de BookDetailDTO a una lista de BookEntity.
*
* @param dtos Lista de BookDetailDTO a convertir.
* @return Lista de BookEntity convertida.
*/
private List<BookEntity> booksListDTO2Entity(List<BookDetailDTO> dtos) {
List<BookEntity> list = new ArrayList<>();
for (BookDetailDTO dto : dtos) {
list.add(dto.toEntity());
}
return list;
}
} |
var HistoryLogger;
HistoryLogger = (function() {
var _this = this;
function HistoryLogger() {}
HistoryLogger._storageOn = '<API key>';
HistoryLogger._storageData = 'history-logger-data';
HistoryLogger._data = function() {
return $.localStorage(HistoryLogger._storageData) || [];
};
HistoryLogger.isOn = function() {
return $.localStorage(HistoryLogger._storageOn) === true;
};
HistoryLogger.on = function() {
return $.localStorage(HistoryLogger._storageOn, true);
};
HistoryLogger.off = function() {
return $.localStorage(HistoryLogger._storageOn, false);
};
HistoryLogger.push = function(data) {
var temp;
temp = HistoryLogger._data();
temp.push(data);
return $.localStorage(HistoryLogger._storageData, temp);
};
HistoryLogger.log = function(message) {
var date, datetime, json, now, time;
if (!HistoryLogger.isOn()) {
return false;
}
now = new Date();
date = now.toDateString();
time = now.toTimeString().split(" ")[0];
datetime = "" + date + " " + time;
console.log("" + datetime + " - " + message);
json = {
message: message,
datetime: datetime
};
return HistoryLogger.push(json);
};
HistoryLogger.clear = function() {
return $.localStorage(HistoryLogger._storageData, []);
};
HistoryLogger.listAll = function() {
var dict, temp, _i, _len, _results;
temp = HistoryLogger._data();
_results = [];
for (_i = 0, _len = temp.length; _i < _len; _i++) {
dict = temp[_i];
_results.push(console.log("" + dict['datetime'] + " - " + dict['message']));
}
return _results;
};
HistoryLogger.list = function(n) {
var dict, first, length, temp, _i, _len, _results;
temp = HistoryLogger._data();
length = temp.length;
first = 0;
if (length - n >= 0) {
first = length - n;
}
temp = temp.slice(first);
_results = [];
for (_i = 0, _len = temp.length; _i < _len; _i++) {
dict = temp[_i];
_results.push(console.log("" + dict['datetime'] + " - " + dict['message']));
}
return _results;
};
return HistoryLogger;
}).call(this); |
<?php
namespace Oro\Bundle\EntityConfigBundle\EventListener;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\EventDispatcher\<API key>;
use Oro\Bundle\DataGridBundle\Extension\Action\ActionExtension;
use Oro\Bundle\DataGridBundle\Datagrid\Common\<API key>;
use Oro\Bundle\DataGridBundle\Event\BuildAfter;
use Oro\Bundle\DataGridBundle\Event\BuildBefore;
use Oro\Bundle\DataGridBundle\Extension\Formatter\Configuration;
use Oro\Bundle\DataGridBundle\Datasource\ResultRecord;
use Oro\Bundle\EntityConfigBundle\Config\ConfigModelManager;
use Oro\Bundle\EntityConfigBundle\Config\ConfigManager;
use Oro\Bundle\FilterBundle\Filter\FilterUtility;
/**
* Class <API key>
*
* @package Oro\Bundle\EntityConfigBundle\EventListener
*
* @SuppressWarnings(PHPMD.<API key>)
*/
abstract class <API key> implements <API key>
{
const TYPE_HTML = 'html';
const TYPE_TWIG = 'twig';
const TYPE_NAVIGATE = 'navigate';
const TYPE_DELETE = 'delete';
const PATH_COLUMNS = '[columns]';
const PATH_SORTERS = '[sorters]';
const PATH_FILTERS = '[filters]';
const PATH_ACTIONS = '[actions]';
/** @var ConfigManager */
protected $configManager;
/**
* @param ConfigManager $configManager
*/
public function __construct(ConfigManager $configManager)
{
$this->configManager = $configManager;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return array(
'oro_datagrid.datgrid.build.after.' . static::GRID_NAME => 'onBuildAfter',
'oro_datagrid.datgrid.build.before.' . static::GRID_NAME => 'onBuildBefore',
);
}
/**
* @param BuildAfter $event
*/
abstract public function onBuildAfter(BuildAfter $event);
/**
* @param BuildBefore $event
*/
abstract public function onBuildBefore(BuildBefore $event);
/**
* Add dynamic fields
*
* @param BuildBefore $event
* @param string|null $alias
* @param string|null $itemType
* @param bool $dynamicFirst flag if true - dynamic columns will be placed before static, false - after
*/
public function doBuildBefore(BuildBefore $event, $alias = null, $itemType = null, $dynamicFirst = true)
{
$config = $event->getConfig();
// get dynamic columns and merge them with static columns from configuration
$<API key> = $this->getDynamicFields($alias, $itemType);
$filtersSorters = $this-><API key>($<API key>);
$<API key> = [
'columns' => $<API key>,
'sorters' => $filtersSorters['sorters'],
'filters' => $filtersSorters['filters'],
];
foreach (['columns', 'sorters', 'filters'] as $itemName) {
$path = '[' . $itemName . ']';
// get already defined items
$items = $config->offsetGetByPath($path, []);
// merge additional items with existing
if ($dynamicFirst) {
$items = <API key>($<API key>[$itemName], $items);
} else {
$items = <API key>($items, $<API key>[$itemName]);
}
// set new item set with dynamic columns/sorters/filters
$config->offsetSetByPath($path, $items);
}
// add/configure entity config properties
$this-><API key>($config, $itemType);
// add/configure entity config actions
$actions = $config->offsetGetByPath(self::PATH_ACTIONS, []);
$this->prepareRowActions($actions, $itemType);
$config->offsetSetByPath(self::PATH_ACTIONS, $actions);
}
/**
* Get dynamic fields from config providers
*
* @param string|null $alias
* @param string|null $itemsType
*
* @return array
*/
protected function getDynamicFields($alias = null, $itemsType = null)
{
$fields = [];
foreach ($this->configManager->getProviders() as $provider) {
foreach ($provider->getPropertyConfig()->getItems($itemsType) as $code => $item) {
if (!isset($item['grid'])) {
continue;
}
$fieldName = $provider->getScope() . '_' . $code;
$item['grid'] = $provider->getPropertyConfig()->initConfig($item['grid']);
$item['grid'] = $this-><API key>($item['grid']);
$field = [
$fieldName => array_merge(
$item['grid'],
[
'expression' => $alias . $code . '.value',
'field_name' => $fieldName,
]
)
];
if (isset($item['options']['priority']) && !isset($fields[$item['options']['priority']])) {
$fields[$item['options']['priority']] = $field;
} else {
$fields[] = $field;
}
}
}
ksort($fields);
$orderedFields = [];
// compile field list with pre-defined order
foreach ($fields as $field) {
$orderedFields = array_merge($orderedFields, $field);
}
return $orderedFields;
}
/**
* @param array $orderedFields
*
* @return array
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function <API key>(array $orderedFields)
{
$filters = $sorters = [];
// add sorters and filters if needed
foreach ($orderedFields as $fieldName => $field) {
if (isset($field['sortable']) && $field['sortable']) {
$sorters['columns'][$fieldName] = ['data_name' => $field['expression']];
}
if (isset($field['filterable']) && $field['filterable']) {
$filters['columns'][$fieldName] = [
'data_name' => isset($field['expression']) ? $field['expression'] : $fieldName,
'type' => isset($field['filter_type']) ? $field['filter_type'] : 'string',
'frontend_type' => $field['frontend_type'],
'label' => $field['label'],
FilterUtility::ENABLED_KEY => isset($field['show_filter']) ? $field['show_filter'] : true,
];
if (isset($field['choices'])) {
$filters['columns'][$fieldName]['options']['field_options']['choices'] = $field['choices'];
}
}
}
return ['filters' => $filters, 'sorters' => $sorters];
}
/**
* @TODO fix adding actions from different scopes such as EXTEND
*
* @param array $actions
* @param string $type
*/
protected function prepareRowActions(&$actions, $type)
{
foreach ($this->configManager->getProviders() as $provider) {
$gridActions = $provider->getPropertyConfig()->getGridActions($type);
foreach ($gridActions as $config) {
$configItem = array(
'label' => ucfirst($config['name']),
'icon' => isset($config['icon']) ? $config['icon'] : 'question-sign',
'link' => strtolower($config['name']) . '_link',
'type' => isset($config['type']) ? $config['type'] : self::TYPE_NAVIGATE,
//'confirmation' => isset($config['confirmation']) ? $config['confirmation'] : false
);
$actions = array_merge($actions, [strtolower($config['name']) => $configItem]);
}
}
}
/**
* @param <API key> $config
* @param $itemType
*/
protected function <API key>(<API key> $config, $itemType)
{
// configure properties from config providers
$properties = $config->offsetGetOr(Configuration::PROPERTIES_KEY, []);
$filters = array();
$actions = array();
foreach ($this->configManager->getProviders() as $provider) {
$gridActions = $provider->getPropertyConfig()->getGridActions($itemType);
$this->prepareProperties($gridActions, $properties, $actions, $filters, $provider->getScope());
// TODO: check if this neccessary for field config grid
if (static::GRID_NAME == 'entityconfig-grid' && $provider->getPropertyConfig()-><API key>()) {
$filters['update'] = $provider->getPropertyConfig()-><API key>();
}
}
if (count($filters)) {
$config->offsetSet(
ActionExtension::<API key>,
$this-><API key>($filters, $actions)
);
}
$config->offsetSet(Configuration::PROPERTIES_KEY, $properties);
}
/**
* @param $gridActions
* @param $properties
* @param $actions
* @param $filters
* @param $scope
*/
protected function prepareProperties($gridActions, &$properties, &$actions, &$filters, $scope)
{
foreach ($gridActions as $config) {
$properties[strtolower($config['name']) . '_link'] = [
'type' => 'url',
'route' => $config['route'],
'params' => (isset($config['args']) ? $config['args'] : [])
];
if (isset($config['filter'])) {
$keys = array_map(
function ($item) use ($scope) {
return $scope . '_' . $item;
},
array_keys($config['filter'])
);
$config['filter'] = array_combine($keys, $config['filter']);
$filters[strtolower($config['name'])] = $config['filter'];
}
$actions[strtolower($config['name'])] = true;
}
}
/**
* Returns closure that will configure actions for each row in grid
*
* @param array $filters
* @param array $actions
*
* @return callable
*/
public function <API key>($filters, $actions)
{
return function (ResultRecord $record) use ($filters, $actions) {
if ($record->getValue('mode') == ConfigModelManager::MODE_READONLY) {
$actions = array_map(
function () {
return false;
},
$actions
);
$actions['update'] = false;
$actions['rowClick'] = false;
} else {
foreach ($filters as $action => $filter) {
foreach ($filter as $key => $value) {
if (is_array($value)) {
$error = true;
foreach ($value as $v) {
if ($record->getValue($key) == $v) {
$error = false;
}
}
if ($error) {
$actions[$action] = false;
break;
}
} else {
if ($record->getValue($key) != $value) {
$actions[$action] = false;
break;
}
}
}
}
}
return $actions;
};
}
/**
* @param QueryBuilder $query
* @param string $rootAlias
* @param string $joinAlias
* @param string $itemsType
*
* @return $this
*/
protected function prepareQuery(QueryBuilder $query, $rootAlias, $joinAlias, $itemsType)
{
foreach ($this->configManager->getProviders() as $provider) {
foreach ($provider->getPropertyConfig()->getItems($itemsType) as $code => $item) {
$alias = $joinAlias . $provider->getScope() . '_' . $code;
$fieldName = $provider->getScope() . '_' . $code;
if (isset($item['grid']['query'])) {
$query->andWhere($alias . '.value ' . $item['grid']['query']['operator'] . ' :' . $alias);
$query->setParameter($alias, $item['grid']['query']['value']);
}
$query->leftJoin(
$rootAlias . '.values',
$alias,
'WITH',
$alias . ".code='" . $code . "' AND " . $alias . ".scope='" . $provider->getScope() . "'"
);
$query->addSelect($alias . '.value as ' . $fieldName);
}
}
return $this;
}
/**
* @param array $gridConfig
*
* @return array
*/
protected function <API key>(array $gridConfig)
{
if (isset($gridConfig['type'])
&& $gridConfig['type'] == self::TYPE_HTML
&& isset($gridConfig['template'])
) {
$gridConfig['type'] = self::TYPE_TWIG;
$gridConfig['frontend_type'] = self::TYPE_HTML;
} else {
if (!empty($gridConfig['type'])) {
$gridConfig['frontend_type'] = $gridConfig['type'];
}
$gridConfig['type'] = 'field';
}
return $gridConfig;
}
} |
var mongoose = require('mongoose')
var bcrypt = require('bcrypt-nodejs')
var SALT_WORK_FACTOR = 10
var UserSchema = new mongoose.Schema({
name:{
unique: true,
type: String
},
nickname:{
unique: true,
type: String
},
password: String,
// 'root' 'admin' 'normal'
role: String,
realname: String,
// Phone
phone: String,
meta: {
createAt: {
type: Date,
default: Date.now()
},
updateAt: {
type: Date,
default: Date.now()
}
}
})
UserSchema.pre('save', function(next) {
var user = this
if(this.isNew){
this.meta.createAt = this.meta.createAt = Date.now()
}else{
this.meta.updateAt = Date.now()
}
if(!this.nickname || this.nickname === '') {
this.nickname = this.name
}
bcrypt.genSalt(SALT_WORK_FACTOR, function(err, salt){
if(err){
return next(err)
}
bcrypt.hash(user.password, salt, null, function(err, hash){
if(err){
return next(err)
}
user.password = hash
next()
})
})
})
UserSchema.methods = {
comparePassword : function(_password, cb){
// console.log('_password', _password)
// console.log('this.password', this.password)
bcrypt.compare(_password, this.password, function(err, isMatch){
if(err){
// console.log('compare: ' + err)
return cb(err)
}
cb(null, isMatch)
})
}
}
UserSchema.statics = {
fetch: function(cb){
return this.find({}).sort('meta.createAt').exec(cb)
},
findById: function(id, cb){
return this.findOne({_id: id}).exec(cb)
}
}
module.exports = UserSchema |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-25 01:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Account',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('email', models.EmailField(max_length=254, unique=True)),
('username', models.CharField(max_length=40, unique=True)),
('first_name', models.CharField(blank=True, max_length=40)),
('last_name', models.CharField(blank=True, max_length=40)),
('tag_line', models.CharField(blank=True, max_length=140)),
('is_admin', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'abstract': False,
},
),
] |
package zornco.reploidcraft.bullets;
import java.util.Iterator;
import java.util.List;
import zornco.reploidcraft.ReploidCraft;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.<API key>;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityBulletBase extends Entity implements IProjectile
{
public float speed;
/** multiplied slowdown each flying tick */
public float slowdown;
/** subtracted y motion each flying tick */
public float curvature;
/** magnitude of random error, 12 for skeletons, 1 for the player */
public float precision;
/** bounding box is expanded by this for determinining collision with entities */
public float hitBox;
/** damage in halfhearts to deal if onHitTarget returns true */
public int dmg;
/** itemstack to offer the player upon collision. null if no item is to be given */
public ItemStack item;
/** ticks until the projectile dies after being in ground */
public int ttlInGround;
public int xTile = -1;
public int yTile = -1;
public int zTile = -1;
public Block inTile = null;
public int inData = 0;
public boolean inGround = false;
/** 1 if the player can pick up the bullet */
public int canBePickedUp = 0;
/** Seems to be some sort of timer for animating an bullet. */
public int bulletShake = 0;
/** The owner of this bullet. */
public Entity shootingEntity;
public int ticksInGround;
public int ticksInAir = 0;
public double damage = 2.0D;
/** The amount of knockback an bullet applies when it hits a mob. */
public int knockbackStrength;
public EntityBulletBase(World par1World)
{
super(par1World);
this.setSize(0.5F, 0.5F);
}
public EntityBulletBase(World par1World, double xPos, double yPos, double zPos)
{
super(par1World);
this.setPosition(xPos, yPos, zPos);
}
/**
* Method to shoot between one entity to another
* @param world
* @param attacker attacking entity
* @param attackTarget target entity
*/
public EntityBulletBase(World world, EntityLivingBase attacker, EntityLivingBase attackTarget)
{
super(world);
this.shootingEntity = attacker;
if (attacker instanceof EntityPlayer)
{
this.canBePickedUp = 1;
}
this.posY = attacker.posY + (double)attacker.getEyeHeight() - 0.10000000149011612D;
double xDis = attackTarget.posX - attacker.posX;
double yDis = attackTarget.posY + (double)attackTarget.getEyeHeight() - 0.699999988079071D - this.posY;
double zDis = attackTarget.posZ - attacker.posZ;
double distance = (double)MathHelper.sqrt_double(xDis * xDis + zDis * zDis);
if (distance >= 1.0E-7D)
{
float var14 = (float)(Math.atan2(zDis, xDis) * 180.0D / Math.PI) - 90.0F;
float var15 = (float)(-(Math.atan2(yDis, distance) * 180.0D / Math.PI));
double var16 = xDis / distance;
double var18 = zDis / distance;
this.<API key>(attacker.posX + var16, this.posY, attacker.posZ + var18, var14, var15);
//float var20 = (float)distance * 0.2F;
this.setThrowableHeading(xDis, yDis/* + (double)var20*/, zDis, speed, 0);
}
}
public EntityBulletBase(World par1World, EntityLivingBase par2EntityLiving)
{
super(par1World);
this.shootingEntity = par2EntityLiving;
if (par2EntityLiving instanceof EntityPlayer)
{
this.canBePickedUp = 1;
}
this.<API key>(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 01.5216F);
this.posY -= 0.10000000149011612D;
this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 01.5216F);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 0);
}
protected void entityInit()
{
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
setSize(0.5F, 0.5F);
yOffset = 0.0F;
hitBox = 0.3f;
speed = 1f;
slowdown = 0.99f;
curvature = 0.03f;
dmg = 4;
precision = 1f;
ttlInGround = 1200;
item = null;
}
@Override
/**
* Uses the provided coordinates as a heading and determines the velocity from it with the set speed and random
* variance. Args: x, y, z, speed
*/
public void setThrowableHeading(double x, double y, double z, float speed, float f1)
{
float dis = MathHelper.sqrt_double(x * x + y * y + z * z);
x /= (double)dis;
y /= (double)dis;
z /= (double)dis;
x *= (double)speed;
y *= (double)speed;
z *= (double)speed;
this.motionX = x;
this.motionY = y;
this.motionZ = z;
float disXZ = MathHelper.sqrt_double(x * x + z * z);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)disXZ) * 180.0D / Math.PI);
this.ticksInGround = 0;
}
@SideOnly(Side.CLIENT)
/**
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
* posY, posZ, yaw, pitch
*/
public void <API key>(double xPos, double yPos, double zPos, float yaw, float pitch, int par9)
{
this.setPosition(xPos, yPos, zPos);
this.setRotation(yaw, pitch);
}
@SideOnly(Side.CLIENT)
/**
* Sets the velocity to the args. Args: x, y, z
*/
public void setVelocity(double x, double y, double z)
{
this.motionX = x;
this.motionY = y;
this.motionZ = z;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float disXZ = MathHelper.sqrt_double(x * x + z * z);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)disXZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch;
this.prevRotationYaw = this.rotationYaw;
this.<API key>(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
this.ticksInGround = 0;
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
//double prevVelX = motionX;
//double prevVelY = motionY;
//double prevVelZ = motionZ;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float distanceXZ = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)distanceXZ) * 180.0D / Math.PI);
}
Block blockAtPoint = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
if (blockAtPoint != null)
{
blockAtPoint.<API key>(this.worldObj, this.xTile, this.yTile, this.zTile);
AxisAlignedBB blockAtPointAABB = blockAtPoint.<API key>(this.worldObj, this.xTile, this.yTile, this.zTile);
if (blockAtPointAABB != null && blockAtPointAABB.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
{
this.inGround = true;
}
}
if (this.bulletShake > 0)
{
--this.bulletShake;
}
if (this.inGround)
{
Block tileID = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
int tileMeta = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
if (tileID == this.inTile && tileMeta == this.inData)
{
++this.ticksInGround;
tickInGround();
if (this.ticksInGround == ttlInGround)
{
this.setDead();
}
}
else
{
this.inGround = false;
//Vec3 motionVec3 = new Vec3(this.motionX,this.motionY,this.motionZ);
this.ticksInGround = 0;
this.ticksInAir = 0;
}
}
else
{
++this.ticksInAir;
tickFlying();
Vec3 vecPos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vecPosMotion = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
<API key> bulletMOP = this.worldObj.func_147447_a(vecPos, vecPosMotion, false, true, false);
vecPos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vecPosMotion = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (bulletMOP != null)
{
vecPosMotion = Vec3.createVectorHelper(bulletMOP.hitVec.xCoord, bulletMOP.hitVec.yCoord, bulletMOP.hitVec.zCoord);
}
Entity entityHit = null;
List<?> <API key> = this.worldObj.<API key>(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double var7 = 0.0D;
Iterator<?> <API key> = <API key>.iterator();
while (<API key>.hasNext())
{
Entity entityIterator = (Entity)<API key>.next();
if (entityIterator.canBeCollidedWith() && (entityIterator != this.shootingEntity || this.ticksInAir >= 5))
{
if (!canBeShot(entityIterator))
continue;
hitBox = 0.3F;
AxisAlignedBB entityIteratorAABB = entityIterator.boundingBox.expand((double)hitBox, (double)hitBox, (double)hitBox);
<API key> entityIteratorMOB = entityIteratorAABB.calculateIntercept(vecPos, vecPosMotion);
if (entityIteratorMOB != null)
{
double var14 = vecPos.distanceTo(entityIteratorMOB.hitVec);
if (var14 < var7 || var7 == 0.0D)
{
entityHit = entityIterator;
var7 = var14;
}
}
}
}
if (entityHit != null)
{
bulletMOP = new <API key>(entityHit);
}
float disXYZ;
if (bulletMOP != null && onHit())
{
if (bulletMOP.entityHit != null)
{
disXYZ = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
int modifiedDamage = MathHelper.ceiling_double_int((double)disXYZ * this.damage);
if (this.isCharged())
{
modifiedDamage += this.rand.nextInt(modifiedDamage / 2 + 2);
}
DamageSource damageSource = null;
if (this.shootingEntity == null)
{
/*if(StringTranslate.getInstance().getCurrentLanguage().equalsIgnoreCase("en_US"))
{
String s = DamageSource.cactus.damageType;
DamageSource.cactus.damageType = "moon";
var4.entityHit.attackEntityFrom(DamageSource.cactus, 20);
DamageSource.cactus.damageType = s;
}
else
{
var4.entityHit.attackEntityFrom(DamageSource.generic, 20);
}*/
damageSource = new EntityDamageSource("bullet", this.shootingEntity);
}
else
{
damageSource = new EntityDamageSource("bullet", this.shootingEntity);
}
if (this.isBurning())
{
bulletMOP.entityHit.setFire(5);
}
if(onHitTarget(bulletMOP.entityHit, damageSource)){
if (bulletMOP.entityHit.attackEntityFrom(damageSource, modifiedDamage) )
{
if (bulletMOP.entityHit instanceof EntityLiving)
{
if (!this.worldObj.isRemote)
{
EntityLiving var24 = (EntityLiving)bulletMOP.entityHit;
var24.<API key>(var24.<API key>() + 1);
}
if (this.knockbackStrength > 0)
{
float disXZ = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (disXZ > 0.0F)
{
bulletMOP.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)disXZ , 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)disXZ );
}
}
}
//this.worldObj.playSoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
this.setDead();
}
}
else if ( this.ticksInAir >= 5)
{
this.setDead();
this.motionX *= -0.10000000149011612D;
this.motionY *= -0.10000000149011612D;
this.motionZ *= -0.10000000149011612D;
this.rotationYaw += 180.0F;
this.prevRotationYaw += 180.0F;
this.ticksInAir = 0;
}
}
else
{
this.xTile = bulletMOP.blockX;
this.yTile = bulletMOP.blockY;
this.zTile = bulletMOP.blockZ;
this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
if (onHitBlock(bulletMOP)) {
this.motionX = (double)((float)(bulletMOP.hitVec.xCoord - this.posX));
this.motionY = (double)((float)(bulletMOP.hitVec.yCoord - this.posY));
this.motionZ = (double)((float)(bulletMOP.hitVec.zCoord - this.posZ));
disXYZ = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.posX -= this.motionX / (double)disXYZ * 0.05000000074505806D;
this.posY -= this.motionY / (double)disXYZ * 0.05000000074505806D;
this.posZ -= this.motionZ / (double)disXYZ * 0.05000000074505806D;
//this.worldObj.playSoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.bulletShake = 7;
//this.typeOfAttack(false);
} else {
inTile = null;
inData = 0;
}
}
}
if (this.isCharged())
{
for (int var21 = 0; var21 < 4; ++var21)
{
//this.worldObj.spawnParticle("crit", this.posX + this.motionX * (double)var21 / 4.0D, this.posY + this.motionY * (double)var21 / 4.0D, this.posZ + this.motionZ * (double)var21 / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ);
}
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
handleMotionUpdate();
float disXZ = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)disXZ) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
{
;
}
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
{
this.prevRotationPitch += 360.0F;
}
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
{
this.prevRotationYaw -= 360.0F;
}
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
{
this.prevRotationYaw += 360.0F;
}
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
this.setPosition(this.posX, this.posY, this.posZ);
this.func_145775_I();
}
}
/**
* Handles updating of motion fields.
*/
public void handleMotionUpdate() {
float slow = slowdown;
if(handleWaterMovement()) {
for(int k = 0; k < 4; k++) {
float f6 = 0.25F;
worldObj.spawnParticle("bubble", posX - motionX * f6, posY - motionY * f6, posZ - motionZ * f6, motionX, motionY, motionZ);
}
slow *= 0.8F;
}
motionX *= slow;
motionY *= slow;
motionZ *= slow;
motionY -= curvature;
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setShort("xTile", (short)this.xTile);
par1NBTTagCompound.setShort("yTile", (short)this.yTile);
par1NBTTagCompound.setShort("zTile", (short)this.zTile);
par1NBTTagCompound.setByte("inTile", (byte)Block.getIdFromBlock(this.inTile));
par1NBTTagCompound.setByte("inData", (byte)this.inData);
par1NBTTagCompound.setByte("shake", (byte)this.bulletShake);
par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
par1NBTTagCompound.setByte("pickup", (byte)this.canBePickedUp);
par1NBTTagCompound.setDouble("damage", this.damage);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
this.xTile = par1NBTTagCompound.getShort("xTile");
this.yTile = par1NBTTagCompound.getShort("yTile");
this.zTile = par1NBTTagCompound.getShort("zTile");
this.inTile = Block.getBlockById(par1NBTTagCompound.getByte("inTile") & 255);
this.inData = par1NBTTagCompound.getByte("inData") & 255;
this.bulletShake = par1NBTTagCompound.getByte("shake") & 255;
this.inGround = par1NBTTagCompound.getByte("inGround") == 1;
if (par1NBTTagCompound.hasKey("damage"))
{
this.damage = par1NBTTagCompound.getDouble("damage");
}
if (par1NBTTagCompound.hasKey("pickup"))
{
this.canBePickedUp = par1NBTTagCompound.getByte("pickup");
}
else if (par1NBTTagCompound.hasKey("player"))
{
this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0;
}
}
/**
* Called by a player entity when they collide with an entity
*/
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
{
if (item == null) {
return;
}
if (!this.worldObj.isRemote && this.inGround && this.bulletShake <= 0)
{
boolean pickUpAble = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode;
if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.<API key>(item.copy()))
{
pickUpAble = false;
}
if (pickUpAble)
{
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
par1EntityPlayer.onItemPickup(this, 1);
this.setDead();
}
}
}
/**
* Determines whether a given entity is a candidate for being hit.
*/
public boolean canBeShot(Entity ent) {
return ent.canBeCollidedWith()
&& !(ent == shootingEntity && ticksInAir < 5)
&& !(ent instanceof EntityLiving && ((EntityLiving)ent).deathTime > 0);
}
/**
* Called when the projectile collides with anything, either block or entity.
*
* @return whether to further process this collision
*/
public boolean onHit() {
return true;
}
/**
* Called when the projectile collides with an entity.
*
* @param target The collided entity.
* @param source
* @return if the projectile should be destroyed and the entity hurt by dmg
*/
public boolean onHitTarget(Entity target, DamageSource source) {
worldObj.playSoundAtEntity(this, "random.drr", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
return true;
}
/**
* Called once a tick when the projectile is in the air.
*/
public void tickFlying() {}
/**
* Called once a tick when the projectile is stuck in the ground.
*/
public void tickInGround() {}
/**
* Called when the projectile collides with a block.
*
* @param mop <API key> object of the collision
* @return true if the projectile should get stuck inground.
*
* By default calls onHitBlock().
*/
public boolean onHitBlock(<API key> mop) {
return onHitBlock();
}
/**
* Called when the projectile collides with a block.
*
* @return true if the projectile should get stuck inground.
*/
public boolean onHitBlock() {
worldObj.playSoundAtEntity(this, "random.drr", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
return true;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public void setDamage(double par1)
{
this.damage = par1;
}
public double getDamage()
{
return this.damage;
}
/**
* Sets the amount of knockback the bullet applies when it hits a mob.
*/
public void <API key>(int par1)
{
this.knockbackStrength = par1;
}
/**
* If returns false, the item will not inflict any damage against entities.
*/
public boolean canAttackWithItem()
{
return false;
}
public void setTypeOfAttack(int par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(par1)));
}
public byte getTypeOfAttack()
{
return this.dataWatcher.<API key>(16);
}
public boolean isCharged()
{
return false;
}
public float[] getTexturePlacement() {
return new float[]{0F,0F,0F,0F,0F,0F,0F};
}
public ResourceLocation getTexture()
{
return new ResourceLocation(ReploidCraft.MOD_ID + ":textures/entity/MetHat.png");
}
} |
#!/usr/bin/env ruby
require 'terminal-table'
require 'ipaddr'
ifconfig = `ifconfig`.split("\n\n")
oint = ''
int = ''
omac = ''
# Begin the table.
table = Terminal::Table.new do |t|
# Define the table headers.
t << ['Interface','IPv4 Address','Subnet Mask','Broadcast','MAC Address']
t.add_separator
ifconfig.each do |line|
int = ""
# Regex used to grab for specific information.
unless !int.empty?
int = line.split(" ")[0]
end
ipaddr = line.scan(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)[0]
netmask = line.scan(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)[1]
broadcast = line.scan(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)[2]
mac = line.scan(/(?:[A-Fa-f0-9]{2}[:-]){5}(?:[A-Fa-f0-9]{2})/)[0]
# Clean up some stuff
oint = int unless int.empty?
ipaddr = '' if ipaddr.nil?
broadcast = '' if broadcast.nil?
omac = mac unless mac.nil?
# Add the data to a table.
unless oint.empty? and ipaddr.empty? and netmask.empty? and broadcast.empty? and omac.empty?
ipaddr = '' if ipaddr.nil?
netmask = '' if netmask.nil?
unless ipaddr.empty? or netmask.empty?
cidr = IPAddr.new(netmask).to_i.to_s(2).count("1")
t << [oint, ipaddr, "#{netmask} (/#{cidr})", broadcast, omac]
omac = ''
end
end
end
end
table.title = "1337 H4x0Rz Linux Ifconfig Parser - Alton Johnson (alton.jx@gmail.com)"
puts table |
package com.matija.easy;
public class SequenceEquation {
static int[] permutationEquation(int[] p) {
int[] pIndexes = new int[p.length+1];
for (int i = 0; i < p.length; i++) {
pIndexes[p[i]] = i+1;
}
int[] r = new int[p.length];
for(int i = 1; i <= p.length; i++) {
r[i-1] = pIndexes[pIndexes[i]];
}
return r;
}
public static void main(String[] args) {
int[] r = permutationEquation(new int[]{4,3,5,1,2});
System.out.println("done");
}
} |
define(function(require) {
var $ = require('jquery'),
_ = require('underscore'),
Backbone = require('backbone');
FeedT = require('text!templates/feed.html'),
Post = require('views/post');
Feed = Backbone.View.extend({
tagName: 'div',
className: 'feedContainer',
template: _.template(FeedT),
initialize: function (args) {
var s = this;
// add class 'nameFeed' so that feed selector has something to grab
// (not using an id since a different room may have a feed with the same class name
// only in a different html scope)
s.$el.addClass(args.name+'Feed');
// add the feed template to the feed el
s.$el.append(s.template());
// initialize object for recording the last posts user and time
s.last = {
user: '',
email: '',
time: ''
}
},
post: function (message,options) {
var s = this;
// boolean for compact vs regular posts
// (compact posts do not have user and time info
// and are used when the post above is recent and
// by the same user)
var compact = 0;
// check if the message email is the same as last
// to see if a compact post can be used
if(s.last.email == message.get('email') && s.last.email != "") {
compact = 1
} else {
compact = 0;
}
// save some info
s.last.user = message.get('username');
s.last.email = message.get('email');
// time can be used to for a max time for a compact post
// that way new post will have its own timeago
s.last.time = new Date();
// a new postView is created from the message model
var postView = new Post({model: message, compact: compact});
// add the post view to the feed
s.$('.posts').append( postView.el );
// if there are no options, specifically noScroll
if(!options || !options.noScroll) {
// scroll the feed down so that the new post is visible
s.$('.feed').animate({ scrollTop: postView.$el.position().top });
}
return postView;
}
});
return Feed;
}); |
<!DOCTYPE html>
<!--[if lt IE 9]><html class="no-js lt-ie9" lang="en" dir="ltr"><![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en" dir="ltr">
<!--<![endif]-->
<!-- Usage: /eic/site/ccc-rec.nsf/tpl-eng/template-1col.html?Open&id=3 (optional: ?Open&page=filename.html&id=x) -->
<!-- Created: ; Product Code: 536; Server: stratnotes2.ic.gc.ca -->
<head>
<title>
The Prism -
Complete profile - Canadian Company Capabilities - Industries and Business - Industry Canada
</title>
<!-- Title ends / Fin du titre -->
<meta charset="utf-8" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.title" content="" />
<meta name="description" content="" />
<meta name="dcterms.description" content="" />
<meta name="dcterms.type" content="report, data set" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.issued" title="W3CDTF" content="" />
<meta name="dcterms.modified" title="W3CDTF" content="" />
<meta name="keywords" content="" />
<meta name="dcterms.creator" content="" />
<meta name="author" content="" />
<meta name="dcterms.created" title="W3CDTF" content="" />
<meta name="dcterms.publisher" content="" />
<meta name="dcterms.audience" title="icaudience" content="" />
<meta name="dcterms.spatial" title="ISO3166-1" content="" />
<meta name="dcterms.spatial" title="gcgeonames" content="" />
<meta name="dcterms.format" content="HTML" />
<meta name="dcterms.identifier" title="ICsiteProduct" content="536" />
<!-- EPI-11240 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- MCG-202 -->
<meta content="width=device-width,initial-scale=1" name="viewport">
<!-- EPI-11567 -->
<meta name = "format-detection" content = "telephone=no">
<!-- EPI-12603 -->
<meta name="robots" content="noarchive">
<!-- EPI-11190 - Webtrends -->
<script>
var startTime = new Date();
startTime = startTime.getTime();
</script>
<!--[if gte IE 9 | !IE ]><!-->
<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="icon" type="image/x-icon">
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/wet-boew.min.css">
<!--<![endif]-->
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/theme.min.css">
<!--[if lt IE 9]>
<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="shortcut icon" />
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/ie8-wet-boew.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew.min.js"></script>
<![endif]
<!--[if lte IE 9]>
<![endif]
<noscript><link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/noscript.min.css" /></noscript>
<!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER -->
<script>dataLayer1 = [];</script>
<!-- End Google Tag Manager -->
<!-- EPI-11235 -->
<link rel="stylesheet" href="/eic/home.nsf/css/<API key>.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="/app/ccc/srch/css/print.css" media="print" rel="stylesheet" type="text/css" />
</head>
<body class="home" vocab="http://schema.org/" typeof="WebPage">
<!-- EPIC HEADER BEGIN -->
<!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER -->
<noscript><iframe title="Google Tag Manager" src="
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.<API key>(s)[0], j=d.createElement(s),dl=l!='dataLayer1'?'&l='+l:'';j.async=true;j.src='
<!-- End Google Tag Manager -->
<!-- EPI-12801 -->
<span typeof="Organization"><meta property="legalName" content="<API key>"></span>
<ul id="wb-tphp">
<li class="wb-slc">
<a class="wb-sl" href="#wb-cont">Skip to main content</a>
</li>
<li class="wb-slc visible-sm visible-md visible-lg">
<a class="wb-sl" href="#wb-info">Skip to "About this site"</a>
</li>
</ul>
<header role="banner">
<div id="wb-bnr" class="container">
<section id="wb-lng" class="visible-md visible-lg text-right">
<h2 class="wb-inv">Language selection</h2>
<div class="row">
<div class="col-md-12">
<ul class="list-inline mrgn-bttm-0">
<li><a href="nvgt.do?V_TOKEN=1492324976158&V_SEARCH.docsCount=3&V_DOCUMENT.docRank=46615&V_SEARCH.docsStart=46614&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=/prfl.do&lang=fra&redirectUrl=/app/scr/imbs/ccc/rgstrtn/updt.sec?_flId?_flxKy=e1s1&estblmntNo=234567041301&profileId=61&_evId=bck&lang=eng&V_SEARCH.showStricts=false&prtl=1&_flId?_flId?_flxKy=e1s1" title="Français" lang="fr">Français</a></li>
</ul>
</div>
</div>
</section>
<div class="row">
<div class="brand col-xs-8 col-sm-9 col-md-6">
<a href="http:
</div>
<section class="wb-mb-links col-xs-4 col-sm-3 visible-sm visible-xs" id="wb-glb-mn">
<h2>Search and menus</h2>
<ul class="list-inline text-right chvrn">
<li><a href="#mb-pnl" title="Search and menus" aria-controls="mb-pnl" class="overlay-lnk" role="button"><span class="glyphicon glyphicon-search"><span class="glyphicon glyphicon-th-list"><span class="wb-inv">Search and menus</span></span></span></a></li>
</ul>
<div id="mb-pnl"></div>
</section>
<!-- Site Search Removed -->
</div>
</div>
<nav role="navigation" id="wb-sm" class="wb-menu visible-md visible-lg" data-trgt="mb-pnl" data-ajax-fetch="//cdn.canada.ca/gcweb-cdn-dev/sitemenu/sitemenu-en.html" typeof="<API key>">
<h2 class="wb-inv">Topics menu</h2>
<div class="container nvbar">
<div class="row">
<ul class="list-inline menu">
<li><a href="https:
<li><a href="http:
<li><a href="https://travel.gc.ca/">Travel</a></li>
<li><a href="https:
<li><a href="https:
<li><a href="http://healthycanadians.gc.ca/index-eng.php">Health</a></li>
<li><a href="https:
<li><a href="https:
</ul>
</div>
</div>
</nav>
<!-- EPIC BODY BEGIN -->
<nav role="navigation" id="wb-bc" class="" property="breadcrumb">
<h2 class="wb-inv">You are here:</h2>
<div class="container">
<div class="row">
<ol class="breadcrumb">
<li><a href="/eic/site/icgc.nsf/eng/home" title="Home">Home</a></li>
<li><a href="/eic/site/icgc.nsf/eng/h_07063.html" title="Industries and Business">Industries and Business</a></li>
<li><a href="/eic/site/ccc-rec.nsf/tpl-eng/../eng/home" >Canadian Company Capabilities</a></li>
</ol>
</div>
</div>
</nav>
</header>
<main id="wb-cont" role="main" property="mainContentOfPage" class="container">
<!-- End Header -->
<!-- Begin Body -->
<!-- Begin Body Title -->
<!-- End Body Title -->
<!-- Begin Body Head -->
<!-- End Body Head -->
<!-- Begin Body Content -->
<br>
<!-- Complete Profile -->
<!-- Company Information above tabbed area-->
<input id="showMore" type="hidden" value='more'/>
<input id="showLess" type="hidden" value='less'/>
<h1 id="wb-cont">
Company profile - Canadian Company Capabilities
</h1>
<div class="profileInfo hidden-print">
<ul class="list-inline">
<li><a href="cccSrch.do?lang=eng&profileId=&prtl=1&key.hitsPerPage=25&searchPage=%252Fapp%252Fccc%252Fsrch%252FcccBscSrch.do%253Flang%253Deng%2526amp%253Bprtl%253D1%2526amp%253Btagid%253D&V_SEARCH.scopeCategory=CCC.Root&V_SEARCH.depth=1&V_SEARCH.showStricts=false&V_SEARCH.sortSpec=title+asc&rstBtn.x=" class="btn btn-link">New Search</a> |</li>
<li><form name="searchForm" method="post" action="/app/ccc/srch/bscSrch.do">
<input type="hidden" name="lang" value="eng" />
<input type="hidden" name="profileId" value="" />
<input type="hidden" name="prtl" value="1" />
<input type="hidden" name="searchPage" value="%2Fapp%2Fccc%2Fsrch%2FcccBscSrch.do%3Flang%3Deng%26amp%3Bprtl%3D1%26amp%3Btagid%3D" />
<input type="hidden" name="V_SEARCH.scopeCategory" value="CCC.Root" />
<input type="hidden" name="V_SEARCH.depth" value="1" />
<input type="hidden" name="V_SEARCH.showStricts" value="false" />
<input id="repeatSearchBtn" class="btn btn-link" type="submit" value="Return to search results" />
</form></li>
<li>| <a href="nvgt.do?V_SEARCH.docsStart=46613&V_DOCUMENT.docRank=46614&V_SEARCH.docsCount=3&lang=eng&prtl=1&sbPrtl=&profile=cmpltPrfl&V_TOKEN=1492324997591&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=%2fprfl.do&estblmntNo=234567152344&profileId=&key.newSearchLabel=">Previous Company</a></li>
<li>| <a href="nvgt.do?V_SEARCH.docsStart=46615&V_DOCUMENT.docRank=46616&V_SEARCH.docsCount=3&lang=eng&prtl=1&sbPrtl=&profile=cmpltPrfl&V_TOKEN=1492324997591&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=%2fprfl.do&estblmntNo=234567117634&profileId=&key.newSearchLabel=">Next Company</a></li>
</ul>
</div>
<details>
<summary>Third-Party Information Liability Disclaimer</summary>
<p>Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.</p>
</details>
<h2>
The Prism
</h2>
<div class="row">
<div class="col-md-5">
<h2 class="h5 mrgn-bttm-0">Legal/Operating Name:</h2>
<p>The Prism</p>
<p><a href="mailto:theprism@nbnet.nb.ca" title="theprism@nbnet.nb.ca">theprism@nbnet.nb.ca</a></p>
</div>
<div class="col-md-4 mrgn-sm-sm">
<h2 class="h5 mrgn-bttm-0">Mailing Address:</h2>
<address class="mrgn-bttm-md">
6-435 Brookside Dr.<br/>
FREDERICTON,
New Brunswick<br/>
E3A 8V4
<br/>
</address>
<h2 class="h5 mrgn-bttm-0">Location Address:</h2>
<address class="mrgn-bttm-md">
6-435 Brookside Dr.<br/>
FREDERICTON,
New Brunswick<br/>
E3A 8V4
<br/>
</address>
<p class="mrgn-bttm-0"><abbr title="Telephone">Tel.</abbr>:
(506) 452-1984
</p>
<p class="mrgn-bttm-lg"><abbr title="Facsimile">Fax</abbr>:
(506) 452-1035</p>
</div>
<div class="col-md-3 mrgn-tp-md">
</div>
</div>
<div class="row mrgn-tp-md mrgn-bttm-md">
<div class="col-md-12">
</div>
</div>
<!-- <div class="wb-tabs ignore-session update-hash wb-eqht-off print-active"> -->
<div class="wb-tabs ignore-session">
<div class="tabpanels">
<details id="details-panel1">
<summary>
Full profile
</summary>
<!-- Tab 1 -->
<h2 class="wb-invisible">
Full profile
</h2>
<!-- Contact Information -->
<h3 class="page-header">
Contact information
</h3>
<section class="container-fluid">
<div class="row mrgn-tp-lg">
<div class="col-md-3">
<strong>
Aloma
Thibault
</strong></div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Title:
</strong>
</div>
<div class="col-md-7">
<!--if client gender is not null or empty we use gender based job title
Owner
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Area of Responsibility:
</strong>
</div>
<div class="col-md-7">
Management Executive.
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Ext:
</strong>
</div>
<div class="col-md-7">
</div>
</div>
</section>
<p class="mrgn-tp-lg text-right small hidden-print">
<a href="#wb-cont">top of page</a>
</p>
<!-- Company Description -->
<h3 class="page-header">
Company description
</h3>
<section class="container-fluid">
<div class="row">
<div class="col-md-5">
<strong>
Country of Ownership:
</strong>
</div>
<div class="col-md-7">
Canada
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Exporting:
</strong>
</div>
<div class="col-md-7">
No
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Industry (NAICS):
</strong>
</div>
<div class="col-md-7">
327215 - Glass Product Manufacturing from Purchased Glass
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Business Activity:
</strong>
</div>
<div class="col-md-7">
Manufacturer / Processor / Producer
</div>
</div>
</section>
<!-- Products / Services / Licensing -->
<h3 class="page-header">
Product / Service / Licensing
</h3>
<section class="container-fluid">
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Glass window units, stained or ornamental <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Lamps, complete with shades <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Art & decorative ware, glass <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Art & decorative ware, n.e.s. <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Glass, coloured, ornamental, figured or enamelled <br>
</div>
</div>
</section>
<p class="mrgn-tp-lg text-right small hidden-print">
<a href="#wb-cont">top of page</a>
</p>
<!-- Technology Profile -->
<!-- Market Profile -->
<!-- Sector Information -->
<details class="mrgn-tp-md mrgn-bttm-md">
<summary>
Third-Party Information Liability Disclaimer
</summary>
<p>
Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.
</p>
</details>
</details>
<details id="details-panel2">
<summary>
Contacts
</summary>
<h2 class="wb-invisible">
Contact information
</h2>
<!-- Contact Information -->
<section class="container-fluid">
<div class="row mrgn-tp-lg">
<div class="col-md-3">
<strong>
Aloma
Thibault
</strong></div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Title:
</strong>
</div>
<div class="col-md-7">
<!--if client gender is not null or empty we use gender based job title
Owner
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Area of Responsibility:
</strong>
</div>
<div class="col-md-7">
Management Executive.
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Ext:
</strong>
</div>
<div class="col-md-7">
</div>
</div>
</section>
</details>
<details id="details-panel3">
<summary>
Description
</summary>
<h2 class="wb-invisible">
Company description
</h2>
<section class="container-fluid">
<div class="row">
<div class="col-md-5">
<strong>
Country of Ownership:
</strong>
</div>
<div class="col-md-7">
Canada
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Exporting:
</strong>
</div>
<div class="col-md-7">
No
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Industry (NAICS):
</strong>
</div>
<div class="col-md-7">
327215 - Glass Product Manufacturing from Purchased Glass
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Business Activity:
</strong>
</div>
<div class="col-md-7">
Manufacturer / Processor / Producer
</div>
</div>
</section>
</details>
<details id="details-panel4">
<summary>
Products, services and licensing
</summary>
<h2 class="wb-invisible">
Product / Service / Licensing
</h2>
<section class="container-fluid">
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Glass window units, stained or ornamental <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Lamps, complete with shades <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Art & decorative ware, glass <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Art & decorative ware, n.e.s. <br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Product Name:
</strong>
</div>
<div class="col-md-9">
Glass, coloured, ornamental, figured or enamelled <br>
</div>
</div>
</section>
</details>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
Last Update Date 2017-03-10
</div>
</div>
<!
- Artifact ID: CBW - IMBS - CCC Search WAR
- Group ID: ca.gc.ic.strategis.imbs.ccc.search
- Version: 3.26
- Built-By: bamboo
- Build Timestamp: 2017-03-02T21:29:28Z
<!-- End Body Content -->
<!-- Begin Body Foot -->
<!-- End Body Foot -->
<!-- END MAIN TABLE -->
<!-- End body -->
<!-- Begin footer -->
<div class="row pagedetails">
<div class="col-sm-5 col-xs-12 datemod">
<dl id="wb-dtmd">
<dt class=" hidden-print">Date Modified:</dt>
<dd class=" hidden-print">
<span><time>2017-03-02</time></span>
</dd>
</dl>
</div>
<div class="clear visible-xs"></div>
<div class="col-sm-4 col-xs-6">
</div>
<div class="col-sm-3 col-xs-6 text-right">
</div>
<div class="clear visible-xs"></div>
</div>
</main>
<footer role="contentinfo" id="wb-info">
<nav role="navigation" class="container wb-navcurr">
<h2 class="wb-inv">About government</h2>
<!-- EPIC FOOTER BEGIN -->
<!-- EPI-11638 Contact us -->
<ul class="list-unstyled colcount-sm-2 colcount-md-3">
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07026.html#pageid=E048-H00000&from=Industries">Contact us</a></li>
<li><a href="https:
<li><a href="https:
<li><a href="https:
<li><a href="https:
<li><a href="https:
<li><a href="http://pm.gc.ca/eng">Prime Minister</a></li>
<li><a href="https:
<li><a href="http://open.canada.ca/en/">Open government</a></li>
</ul>
</nav>
<div class="brand">
<div class="container">
<div class="row">
<nav class="col-md-10 ftr-urlt-lnk">
<h2 class="wb-inv">About this site</h2>
<ul>
<li><a href="https:
<li><a href="https:
<li><a href="http://www1.canada.ca/en/newsite.html">About Canada.ca</a></li>
<li><a href="http:
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07033.html#p1">Privacy</a></li>
</ul>
</nav>
<div class="col-xs-6 visible-sm visible-xs tofpg">
<a href="#wb-cont">Top of Page <span class="glyphicon <API key>"></span></a>
</div>
<div class="col-xs-6 col-md-2 text-right">
<object type="image/svg+xml" tabindex="-1" role="img" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/wmms-blk.svg" aria-label="Symbol of the Government of Canada"></object>
</div>
</div>
</div>
</div>
</footer>
<!--[if gte IE 9 | !IE ]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/wet-boew.min.js"></script>
<!--<![endif]-->
<!--[if lt IE 9]>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew2.min.js"></script>
<![endif]
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/theme.min.js"></script>
<!-- EPI-10519 -->
<span class="wb-sessto"
data-wb-sessto='{"inactivity": 1800000, "reactionTime": 180000, "sessionalive": 1800000, "logouturl": "/app/ccc/srch/cccSrch.do?lang=eng&prtl=1"}'></span>
<script src="/eic/home.nsf/js/jQuery.<API key>.js"></script>
<!-- EPI-11190 - Webtrends -->
<script src="/eic/home.nsf/js/webtrends.js"></script>
<script>var endTime = new Date();</script>
<noscript>
<div><img alt="" id="DCSIMG" width="1" height="1" src="
</noscript>
<!-- /Webtrends -->
<!-- JS deps -->
<script src="/eic/home.nsf/js/jquery.imagesloaded.js"></script>
<!-- EPI-11262 - Util JS -->
<script src="/eic/home.nsf/js/<API key>.min.js"></script>
<!-- EPI-11383 -->
<script src="/eic/home.nsf/js/jQuery.icValidationErrors.js"></script>
<span style="display:none;" id='app-info' <API key>='' <API key>='' <API key>='' <API key>='' data-issue-tracking='' data-scm-sha1='' <API key>='' data-scm-branch='' <API key>=''></span>
</body></html>
<!-- End Footer -->
<!
- Artifact ID: CBW - IMBS - CCC Search WAR
- Group ID: ca.gc.ic.strategis.imbs.ccc.search
- Version: 3.26
- Built-By: bamboo
- Build Timestamp: 2017-03-02T21:29:28Z |
using EasyRedisMQ.Resolvers;
using System;
using System.Threading.Tasks;
using EasyRedisMQ.Models;
using EasyRedisMQ.Services;
using StackExchange.Redis.Extensions.Core;
namespace EasyRedisMQ.Factories
{
public class SubscriberFactory : ISubscriberFactory
{
private IQueueNameResolver _queueNameResolver;
private <API key> <API key>;
private ICacheClient _cacheClient;
private <API key> <API key>;
public SubscriberFactory(IQueueNameResolver queueNameResolver,
<API key> <API key>,
ICacheClient cacheClient,
<API key> <API key>)
{
_queueNameResolver = queueNameResolver;
<API key> = <API key>;
_cacheClient = cacheClient;
<API key> = <API key>;
}
public async Task<Subscriber<T>> <API key><T>(string subscriberId, Func<T, Task> onMessageAsync) where T : class
{
var exchangeName = <API key>.GetExchangeName<T>();
var queueName = _queueNameResolver.GetQueueName(exchangeName, subscriberId);
var subscriber = new Subscriber<T>(_cacheClient, <API key>)
{
SubscriberInfo = new SubscriberInfo
{
SubscriberId = subscriberId,
ExchangeName = exchangeName,
QueueName = queueName
},
OnMessageAsync = onMessageAsync
};
await subscriber.InitializeAsync();
return subscriber;
}
}
} |
layout: archive
permalink: /tags/
title: "Posts by Tags"
author_profile: true
sidebar:
title: "All Archives"
nav: sidebar-archives
{% include base_path %}
{% include group-by-array collection=site.posts field="tags" %}
{% for tag in group_names %}
{% assign posts = group_items[forloop.index0] %}
<h2 id="{{ tag | slugify }}" class="archive__subtitle">{{ tag }}</h2>
{% for post in posts %}
{% include archive-single.html %}
{% endfor %}
{% endfor %} |
import * as React from 'react';
import { render } from 'react-dom';
import { install } from 'source-map-support';
import { VitrineLoader } from './app/features/loader/VitrineLoader';
import './resources/less/main.less';
install();
const appRoot: HTMLElement = document.createElement('div');
document.body.appendChild(appRoot);
render(<VitrineLoader />, appRoot); |
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<title>{{site.title}}</title>
<meta charset="utf-8">
{% comment %}
<!-- Enable responsiveness on mobile devices-->
{% endcomment %}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% if page.browser_title %}{{ page.browser_title }}{% elsif page.title %}{{ page.title | append: ' - ' | append: site.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{% if page.meta_description %}{{ page.meta_description }}{% else %}{{ site.description }}{% endif %}">
{% include open-graph.html %}
{% comment %}
The meta tag below is useful when you want to verify the website to
Google web-master tools in an alternative way. Simply configure your site verification key on
_config.yml given by Google web-master tools.
{% endcomment %}
{% if site.theme.<API key> %}
<meta name="<API key>" content="{{ site.theme.<API key> }}" />
{% endif %}
<link rel="alternate" type="application/rss+xml" href="{{ '/feed.xml' | prepend: site.baseurl | prepend: site.url }}">
<link rel="shortcut icon" href="{{ "/favicon.ico" | prepend: site.baseurl | prepend: site.url }}">
<link rel="prefetch" href="{{ site.url }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet"
href="{{ '/assets/css/main.css' | prepend: site.baseurl | prepend: site.url }}">
<!-- IE Fixes -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]
{% include style.html %}
</head>
<body>
{% include sidebar.html %}
<div class="main-wrapper">
<div class="header">
<div class="container">
<div class="header-title">
<a href="{{ '' | prepend: site.baseurl | prepend: site.url | append: '/' }}"
title="{{ site.title }}">
<h1>{{ site.title }}</h1>
<h3><small>{{ site.tagline }}</small></h3>
</a>
</div>
</div>
</div>
<div class="container content">
{{ content }}
</div>
<a href="#0" class="wc-top">Top</a>
</div>
<label for="sidebar-checkbox" class="sidebar-toggle">
<span></span>
</label>
<script type="text/javascript">
var config = {
"<API key>": "{{ '/browser-warning/' | prepend: site.baseurl | prepend: site.url }}",
"disqus_shortname": "{{ site.theme.disqus_shortname }}"
};
/* Browser support detection */
var browserSupport = (function(){
var htmlElemClasses = document.querySelector('html').className.split(' ');
for ( var i = 0; i < htmlElemClasses.length; i += 1 ){
var className = htmlElemClasses[i];
if ( className === 'lt-ie9' ){
return true;
}
}
}());
if (browserSupport){
window.location="{{ '/browser-warning/' | prepend: site.baseurl | prepend: site.url }}";
}
/* To avoid render blocking css */
var cb = function() {
var l = document.createElement('link'); l.rel = 'stylesheet';
l.href = 'http://fonts.googleapis.com/css?family=PT+Sans';
var h = document.<API key>('head')[0]; h.parentNode.insertBefore(l, h);
};
var raf = <API key> || <API key> ||
<API key> || <API key>;
if (raf) raf(cb);
else window.addEventListener('load', cb);
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script async type="text/javascript" src="{{ '/assets/js/gaya.min.js' | prepend: site.baseurl | prepend: site.url }}"></script>
{% comment %} Google Analytics {% endcomment %}
{% include google-analytics.html %}
</body>
</html> |
import { ChartHTMLTooltip } from './chart-html-tooltip';
export interface DataPointPosition {
row: number;
column: number;
}
export interface BoundingBox {
top: number;
left: number;
width: number;
height: number;
}
export interface ChartMouseEvent {
position: DataPointPosition;
boundingBox: BoundingBox;
value: any;
columnType: string;
columnLabel: string;
}
export interface ChartMouseOverEvent extends ChartMouseEvent {
tooltip: ChartHTMLTooltip | null;
}
export interface ChartMouseOutEvent extends ChartMouseEvent {} |
// <API key>.h
// HackWinds
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
@interface <API key> : <API key> <<API key>, <API key>>
- (void) loadSettings;
- (IBAction)acceptSettingsClick:(id)sender;
- (IBAction)leaveTipClicked:(id)sender;
- (IBAction)contactDevClicked:(id)sender;
- (IBAction)<API key>:(id)sender;
- (IBAction)rateAppClicked:(id)sender;
- (IBAction)<API key>:(id)sender;
- (void) <API key>;
- (BOOL) canMakePurchases;
- (void) purchaseProduct:(SKProduct*)product;
@end |
from .allow_origin import <API key> # noqa
from .api_headers import <API key> # noqa
from .basic_auth import <API key> # noqa |
using Housing.Data.Domain;
using Housing.Data.Domain.DataAccessObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace Housing.Data.Client.Controllers
{
public class <API key> : ApiController
{
private static AccessHelper helper = new AccessHelper();
// GET: api/HousingUnit
public List<HousingUnitDao> Get()
{
return helper.GetHousingUnits();
}
// GET: api/HousingUnit/5
public List<HousingUnitDao> Get(int id)
{
return helper.GetUnitsByComplex(id);
}
// POST: api/HousingUnit
public void Post([FromBody]string value)
{
}
// PUT: api/HousingUnit/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE: api/HousingUnit/5
public void Delete(int id)
{
}
}
} |
<!-- Header -->
<header id="header">
<!-- <h1><a href="../index.html">{id}</a></h1> -->
<div id="user_info">
<img class="user_flag" src="{flag}">
<h1 style="text-align: center"><a href="../scripts/home?&id={id}">{name}</a></h1>
</div>
<a href="#nav">Menu</a>
</header>
<!-- Nav -->
<nav id="nav">
<ul class="links">
<li><a href="../scripts/agenda?&id={id}&user={name}">My predictions</a></li>
<li><a href="../scripts/scoreboard?&id={id}">Scoreboard</a></li>
<li><a href="../scripts/rules?&id={id}">Rules</a></li>
<li><a href="../scripts/settings?&id={id}">Settings</a></li>
{admin}
<li>
<a href="#" onclick="signOut();" class="fa fa-sign-out fa-1x">Logout</a>
</li>
</ul>
</nav> |
package org.softuni.mostwanted.repository;
import org.softuni.mostwanted.model.entity.Race;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface RaceRepository extends JpaRepository<Race, Integer> {
} |
const express = require('express');
const authRoutes = express.Router();
const <API key> = require('../controllers/authentication'),
passportService = require('../config/passport'),
passport = require('passport');
// Middleware to require login/auth
const requireLogin = passport.authenticate('json', { session: false });
// Login route
authRoutes.post('/login', requireLogin, <API key>.login);
module.exports = authRoutes; |
# Habuco
Habuco name come from HAsh BUilder with COntext.
It allows to use DSL to create hash structure with passed context.
## Installation
Add this line to your application's Gemfile:
ruby
gem 'habuco'
And then execute:
$ bundle
Or install it yourself as:
$ gem install habuco
## Usage
Static value
ruby
class HashBuilder
include Habuco
attribute :foo, :bar
end
HashBuilder.build # => { foo: :bar }
Date and Time value
ruby
class HashBuilder
include Habuco
attribute :date, -> { Date.new(2000) }
end
HashBuilder.build
Value with context
ruby
class HashBuilder
include Habuco
attribute :foo, -> { user_name }
end
HashBuilder.build(user_name: 'John') # => { foo: 'John' }
Namespace
ruby
class HashBuilder
include Habuco
namespace :foo do
attribute :bar, :foobar
end
end
HashBuilder.build # => { foo: { bar: :foobar } }
Dynamic key
ruby
class HashBuilder
include Habuco
attribute -> { :"foo_#{n}" }, :bar
end
HashBuilder.build(n: 123) # => { foo_123: :bar }
Collection
ruby
class HashBuilder
include Habuco
each_with_index -> { collection } do |val, index|
attribute :"foo_#{index}", val
end
end
HashBuilder.build(collection: %i[red green blue]) # => { foo_0: :red, foo_1: :green, foo_2: :blue }
## Development
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/wafcio/habuco.
The gem is available as open source under the terms of the [MIT License](http: |
<div class="well" ng-controller="LeftNavController">
<a class="btn btn-lg btn-danger" href="#new">Compose</a>
<ul class="nav nav-pills nav-stacked" style="max-width: 300px;">
<li role="presentation"><a href="#/inbox"> Inbox</a></li>
<li role="presentation"><a href="#/sent"> Sent</a></li>
<li role="presentation"><a href="#/trash"> Trash</a></li>
</ul>
<div>
<h1 class="page-header">My Folders</h1>
<ul class="nav nav-pills nav-stacked" style="max-width: 300px;">
<li role="presentation"><a href="#"> {{myFolder}}</a></li>
</ul>
</div>
</div> |
<?php
namespace Spatie\Crawler;
use GuzzleHttp\Psr7\Uri;
use Illuminate\Support\Collection;
use <API key>;
use Psr\Http\Message\UriInterface;
use Symfony\Component\DomCrawler\Crawler as DomCrawler;
use Symfony\Component\DomCrawler\Link;
use Tree\Node\Node;
class LinkAdder
{
protected Crawler $crawler;
public function __construct(Crawler $crawler)
{
$this->crawler = $crawler;
}
public function addFromHtml(string $html, UriInterface $foundOnUrl): void
{
$allLinks = $this-><API key>($html, $foundOnUrl);
collect($allLinks)
->filter(fn (UriInterface $url) => $this->hasCrawlableScheme($url))
->map(fn (UriInterface $url) => $this->normalizeUrl($url))
->filter(function (UriInterface $url) use ($foundOnUrl) {
if (! $node = $this->crawler->addToDepthTree($url, $foundOnUrl)) {
return false;
}
return $this->shouldCrawl($node);
})
->filter(fn (UriInterface $url) => ! str_contains($url->getPath(), '/tel:'))
->each(function (UriInterface $url) use ($foundOnUrl) {
$crawlUrl = CrawlUrl::create($url, $foundOnUrl);
$this->crawler->addToCrawlQueue($crawlUrl);
});
}
protected function <API key>(string $html, UriInterface $foundOnUrl): ?Collection
{
$domCrawler = new DomCrawler($html, $foundOnUrl);
return collect($domCrawler->filterXpath('//a | //link[@rel="next" or @rel="prev"]')->links())
->reject(function (Link $link) {
if ($this->isInvalidHrefNode($link)) {
return true;
}
if ($this->crawler-><API key>() && $link->getNode()->getAttribute('rel') === 'nofollow') {
return true;
}
return false;
})
->map(function (Link $link) {
try {
return new Uri($link->getUri());
} catch (<API key> $exception) {
return;
}
})
->filter();
}
protected function hasCrawlableScheme(UriInterface $uri): bool
{
return in_array($uri->getScheme(), ['http', 'https']);
}
protected function normalizeUrl(UriInterface $url): UriInterface
{
return $url->withFragment('');
}
protected function shouldCrawl(Node $node): bool
{
if ($this->crawler->mustRespectRobots() && ! $this->crawler->getRobotsTxt()->allows($node->getValue(), $this->crawler->getUserAgent())) {
return false;
}
$maximumDepth = $this->crawler->getMaximumDepth();
if (is_null($maximumDepth)) {
return true;
}
return $node->getDepth() <= $maximumDepth;
}
protected function isInvalidHrefNode(Link $link): bool
{
if ($link->getNode()->nodeName !== 'a') {
return false;
}
if ($link->getNode()->nextSibling !== null) {
return false;
}
if ($link->getNode()->childNodes->length !== 0) {
return false;
}
return true;
}
} |
<!DOCTYPE html>
<script src='../../../vendor/three.js/build/three.min.js'></script>
<script src='../../../vendor/three.js/examples/js/renderers/CSS3DRenderer.js'></script>
<script src='../threex.htmlmixer.js'></script>
<body style='margin: 0px; background-color: #bbbbbb; overflow: hidden;'><script>
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var updateFcts = [];
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 1000 );
camera.position.z = 3;
// add an object and make it move //
// var geometry = new THREE.CubeGeometry( 1, 1, 1);
// var material = new THREE.MeshNormalMaterial();
// var mesh = new THREE.Mesh( geometry, material );
// scene.add( mesh );
// updateFcts.push(function(delta, now){
// // mesh.rotation.x += 1 * delta;
// // mesh.rotation.y += 2 * delta;
var htmlmixer = new THREEx.Htmlmixer(renderer, scene, camera)
updateFcts.push(function(delta, now){
htmlmixer.update(delta, now)
})
;(function(){
var url = '../../../../index.html';
var mixerPlane = THREEx.Htmlmixer.<API key>(htmlmixer, url)
scene.add(mixerPlane.object3d)
updateFcts.push(function(delta, now){
mixerPlane.object3d.rotation.y += Math.PI * 2 * delta * 0.1;
})
})()
// Camera Controls //
var mouse = {x : 0, y : 0}
document.addEventListener('mousemove', function(event){
mouse.x = (event.clientX / window.innerWidth ) - 0.5
mouse.y = (event.clientY / window.innerHeight) - 0.5
}, false)
updateFcts.push(function(delta, now){
camera.position.x += (mouse.x*5 - camera.position.x) * (delta*3)
camera.position.y += (mouse.y*5 - camera.position.y) * (delta*3)
camera.lookAt( scene.position )
})
// render the scene //
updateFcts.push(function(){
renderer.render( scene, camera );
})
// loop runner //
var lastTimeMsec= null
<API key>(function animate(nowMsec){
// keep looping
<API key>( animate );
// measure time
lastTimeMsec = lastTimeMsec || nowMsec-1000/60
var deltaMsec = Math.min(200, nowMsec - lastTimeMsec)
lastTimeMsec = nowMsec
// call each update function
updateFcts.forEach(function(updateFn){
updateFn(deltaMsec/1000, nowMsec/1000)
})
})
</script></body> |
/** Automatically generated file. DO NOT MODIFY */
package cse110.TeamNom.projectnom;
public final class BuildConfig {
public final static boolean DEBUG = true;
} |
import {Component, Input, OnInit} from '@angular/core';
import {forkJoin, Observable} from 'rxjs';
import {IFileUploadClient} from '../../../common/http/upload/file-upload-client';
import {HttpDataTransfer} from '../../../common/http/transfer/http-data-transfer';
@Component({
selector: 'elder-file-upload, ebs-file-upload',
templateUrl: './file-upload.component.html',
styleUrls: ['./file-upload.component.scss']
})
export class <API key> implements OnInit {
@Input()
public files: Set<File> = new Set();
public uploadProgress: Map<File, HttpDataTransfer>;
public totalProgress: Observable<any>;
@Input()
public multiple = false;
@Input()
public accept: string = undefined;
@Input()
public uploadClient: IFileUploadClient;
constructor() {
}
public ngOnInit(): void {
}
public startUpload(event: any): void {
this.totalProgress = this.uploadAllFiles(this.files);
}
public transferOf(file: File): HttpDataTransfer {
if (this.uploadProgress) {
return this.uploadProgress.get(file);
}
return undefined;
}
private uploadAllFiles(files: Set<File>): Observable<any> {
this.uploadProgress = this.uploadClient.uploadFiles(files);
return forkJoin(this.uploadProgress.values());
}
} |
<template name="appLoading">
<div class="loading">
<div class="loading-spinner"></div>
<img src="/images/green-check.svg" class="loading-app" />
</div>
</template> |
@charset "utf-8";
/* CSS Document */
html, body {
height:100%;
}
body {
background-color:#FFF;
background-image:url(moj_stil/bg.png);
background-repeat:repeat;
}
.no-margin {
margin:0 !important;
}
.section {
width:570px;
margin:10px auto;
background-color:#FFF;
border:1px solid #DDD;
border-radius:5px;
-<API key>:5px;
-moz-border-radius:5px;
}
.section-body {
padding:10px;
}
.input-mysize {
width:350px;
}
.section-head {
background-color:whiteSmoke;
padding:10px;
border-bottom:1px solid #DDD;
background-image:url(moj_stil/loginBg.png);
-<API key>: 5px;
-<API key>: 5px;
-<API key>: 5px;
-<API key>: 5px;
<API key>: 5px;
<API key>: 5px;
}
.section-head h3 {
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
text-shadow:1px 1px 0 white;
text-transform:uppercase;
}
#logoNaslov {
margin:0 auto;
width:386px;
height:99px;
background-image:url(moj_stil/Logo.png);
}
#logo {
margin-left:10px;
font-weight: bold;
color: #E5E5E5;
text-shadow: inset 0 1px 0 rgba(0, 0, 0, .1);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
transition: all .2s linear;
}
#sadrzaj {
background-color:#FFF;
border:1px solid #DDD;
border-top:none;
padding:15px;
overflow:visible;
position:relative;
}
.nav {
margin-bottom:0;
padding-bottom:0;
}
.beta {
width:72px;
height:69px;
background-image:url(moj_stil/beta_ribbon.png);
position:absolute;
top:0;
left:0;
z-index:5000;
}
.red {
color:red;
}
.dropdown-menu {
max-height:250px;
}
#dropdown-innerdiv {
max-height:240px;
overflow:auto;
overflow-x:hidden;
}
.alert {
display:none;
}
#uspjehPovratak, #greskaPovratak {
display:none;
}
.loader {
background-image:url(moj_stil/loader.gif);
width:16px;
height:16px;
display:none;
}
.chat {
height:460px;
overflow:hidden;
background-color:#FFF;
position:relative;
border: 1px solid rgb(221, 221, 221);
}
.chat-header {
padding:10px;
background-image: -moz-linear-gradient(top, white, rgb(242, 242, 242));
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(white), to(rgb(242, 242, 242)));
background-image: -<API key>(top, white, rgb(242, 242, 242));
background-image: -o-linear-gradient(top, white, rgb(242, 242, 242));
background-image: linear-gradient(to bottom, white, rgb(242, 242, 242));
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);
border-bottom: 1px solid rgb(212, 212, 212);
padding-bottom:0px;
}
.chat-icon {
display:block;
float:left;
width:11px;
height:13px;
margin:7px;
margin-left:0;
}
.icon-online {
background-image:url(moj_stil/online.png);
background-position:center;
}
.icon-offline {
background-image:url(moj_stil/offline.png);
background-position:center;
}
.icon-zauzet {
background-image:url(moj_stil/zaposlen.png);
background-position:center;
}
.chat-dropdown {
float:right;
display:block;
padding:5px;
width:11px;
height:11px;
margin:7px;
}
.chat-ime {
padding:5px;
display:block;
float:left;
}
.chat-row {
padding:5px;
border-bottom:1px solid whitesmoke;
}
.chat-row:hover {
background-color:whitesmoke;
}
.chat-disabled {
height:inherit;
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
background-color:#F5F5F5;
opacity:0.8;
}
.profile-image {
background-color:#FFF;
}
.chat-loader {
background-image:url(moj_stil/chat-loader.gif);
width:85px;
height:85px;
position:absolute;
top:50%;
left:50%;
margin-left:-42px;
margin-top:-85px;
}
.chat-body {
height:460px;
overflow:auto;
}
.test {
width:100px;
height:100px;
overflow:auto;
overflow-x:hidden;
}
#big_loader {
width:50px;
height:50px;
background-color:#FFFFFF;
border:1px solid #DDD;
background-image:url(moj_stil/22.gif);
position:fixed;
display:none;
top:50%;
left:50%;
margin-left:-25px;
margin-top:-25px;
background-position:center;
background-repeat:no-repeat;
border-radius:5px;
-<API key>:5px;
-moz-border-radius:5px;
box-shadow:0 0 10px #747474;
z-index:5000;
}
.dropdown-toggle {
height:18px;
}
.footer {
margin:10px;
color:#999;
text-shadow:1px 1px 0 white;
}
.table {
table-layout: fixed;
width: 100%;
}
.table tr td {
word-wrap: break-word;
text-align:center;
vertical-align:middle;
}
.table tr th {
text-align:center;
}
div.btn-group {
margin: 0 auto;
text-align: center;
width: inherit;
display: inline-block;
}
.dropdown-menu {
text-align:left;
}
.post {
position:relative;
}
.post-body {
padding:10px;
background-color:#FFF;
border:2px solid #e9e9e9;
border-top:none;
border-bottom:none;
}
.post-header {
padding:10px;
background-image:url(moj_stil/loginBg.png);
border:2px solid #e9e9e9;
border-bottom:1px solid #e9e9e9;
}
.post-footer {
padding:10px;
background-color:#FFF;
border:2px solid #e9e9e9;
border-top:none;
}
.strjelica {
width:15px;
height:15px;
background-image:url(moj_stil/strjelica.png);
background-repeat:no-repeat;
position:absolute;
left:-15px;
top:10px;
}
.thumbnail img {
width:auto;
height:auto;
}
.odgovor {
margin-top:10px;
}
.caption {
text-align:center;
}
.post_wrapper {
margin-bottom:10px;
}
.post-odgovori {
float:right;
padding-top:10px;
width:100%;
}
#fade {
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
background-color:#FFFFFF;
z-index:1000;
display:block;
opacity:0.8;
}
#postovi_wrapper {
position:relative;
}
#loader {
background-color:#FFF;
border-radius:5px;
-<API key>:5px;
-moz-border-radius:5px;
box-shadow:0 0 10px #747474;
z-index:5000;
padding:10px;
width:200px;
position:absolute;
top:50%;
left:50%;
margin-left:-100px;
height:60px;
margin-top:-30px;
}
#<API key> {
padding:10px;
position:fixed;
top:50;
right:10px;
background-color:#FFF;
border-radius:5px;
-<API key>:5px;
-moz-border-radius:5px;
display:none;
box-shadow:0 0 10px #747474;
z-index:5000;
}
#<API key> p,{
padding:0;
margin:0;
}
#nema_postova {
margin:0;
}
#btn-center {
text-align:center;
}
p.alert, p{
margin:0;
}
.ucitaj_jos {
margin-top:10px;
}
.sco.active {
background-color:#eeeeee;
}
#rezultati {
padding-top:5px;
padding-bottom:5px;
border:1px solid #ccc;
color:#FFFFFF;
box-shadow:0 0 10px #ccc;
background-color:#FFF;
display:none;
width:200px;
max-height:200px;
overflow:auto;
overflow-x:hidden;
position:absolute;
}
#rezultati a:hover table{
background-color:#08C;
color:white;
}
#rezultati table {
width:100%;
}
#pretrazi {
background-image:url(moj_stil/search.png);
background-repeat:no-repeat;
padding-left:20px;
background-position:center left;
}
.thumbnail {
background-color:#FFF;
}
#statusSco tr td, #statusSco tr th {
text-align:center !important;
vertical-align:middle !important;
border-top:none;
}
#statusSco {
margin-bottom:5px;
}
.item {
padding-top:5px !important;
padding-bottom:5px !important;
}
.level1 {
padding-left:30px !important;
}
.level2 {
padding-left:45px !important;
}
.level3 {
padding-left:60px !important;
}
.well {
padding:0px !important;
padding-top:5px !important;
padding-bottom:5px !important;
}
#frameWindow {
border-collapse:collapse;
border:none;
}
form {
margin:0 !important;
} |
<?php
namespace Ali\DatatableBundle\Util;
use Symfony\Component\DependencyInjection\ContainerInterface,
Symfony\Component\HttpFoundation\Response;
use Doctrine\ORM\Query,
Doctrine\ORM\Query\Expr\Join,
Doctrine\ORM\EntityManager;
use Ali\DatatableBundle\Util\Factory\Query\QueryInterface,
Ali\DatatableBundle\Util\Factory\Query\DoctrineBuilder,
Ali\DatatableBundle\Util\Formatter\Renderer,
Ali\DatatableBundle\Util\Factory\Prototype\PrototypeBuilder;
class Datatable
{
/** @var array */
protected $_fixed_data = NULL;
/** @var array */
protected $_config;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
protected $_container;
// /** @var \Doctrine\ORM\EntityManager */
// protected $_em;
/** @var boolean */
protected $_has_action;
/** @var boolean */
protected $<API key> = false;
/** @var array */
protected $_multiple;
/** @var \Ali\DatatableBundle\Util\Factory\Query\QueryInterface */
protected $_queryBuilder;
/** @var \Symfony\Component\HttpFoundation\Request */
protected $_request;
/** @var closure */
protected $_renderer = NULL;
/** @var array */
protected $_renderers = NULL;
/** @var Renderer */
protected $_renderer_obj = null;
/** @var boolean */
protected $_search;
/** @var array */
protected $_search_fields = array();
/** @var array */
protected static $_instances = array();
/** @var Datatable */
protected static $_current_instance = NULL;
/**
* class constructor
*
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
$this->_container = $container;
$this->_config = $this->_container->getParameter('ali_datatable');
$this->_request = $this->_container->get('request');
self::$_current_instance = $this;
$this->_applyDefaults();
}
/**
* apply default value from datatable config
*
* @return void
*/
protected function _applyDefaults()
{
if (isset($this->_config['all']))
{
$this->_has_action = $this->_config['all']['action'];
$this->_search = $this->_config['all']['search'];
}
}
/**
* add join
*
* @example:
* ->setJoin(
* 'r.event',
* 'e',
* \Doctrine\ORM\Query\Expr\Join::INNER_JOIN,
* 'e.name like %test%')
*
* @param string $join_field
* @param string $alias
* @param string $type
* @param string $cond
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function addJoin($join_field, $alias, $type = Join::INNER_JOIN, $cond = '')
{
$this->_queryBuilder->addJoin($join_field, $alias, $type, $cond);
return $this;
}
/**
* execute
*
* @param int $hydration_mode
*
* @return Response
*/
public function execute($hydration_mode = Query::HYDRATE_ARRAY)
{
$request = $this->_request;
$iTotalRecords = $this->_queryBuilder->getTotalRecords();
list($data, $objects) = $this->_queryBuilder->getData($hydration_mode);
$id_index = array_search('_identifier_', array_keys($this->getFields()));
$ids = array();
array_walk($data, function($val, $key) use ($data, $id_index, &$ids) {
$ids[$key] = $val[$id_index];
});
if (!is_null($this->_fixed_data))
{
$this->_fixed_data = array_reverse($this->_fixed_data);
foreach ($this->_fixed_data as $item)
{
array_unshift($data, $item);
}
}
if (!is_null($this->_renderer))
{
array_walk($data, $this->_renderer);
}
if (!is_null($this->_renderer_obj))
{
$this->_renderer_obj->applyTo($data, $objects);
}
if (!empty($this->_multiple))
{
array_walk($data, function($val, $key) use(&$data, $ids) {
array_unshift($val, "<input type='checkbox' name='dataTables[actions][]' value='{$ids[$key]}' />");
$data[$key] = $val;
});
}
$output = array(
"sEcho" => intval($request->get('sEcho')),
"iTotalRecords" => $iTotalRecords,
"<API key>" => $iTotalRecords,
"aaData" => $data
);
return new Response(json_encode($output));
}
/**
* get datatable instance by id
* return current instance if null
*
* @param string $id
*
* @return \Ali\DatatableBundle\Util\Datatable .
*/
public static function getInstance($id)
{
$instance = NULL;
if (array_key_exists($id, self::$_instances))
{
$instance = self::$_instances[$id];
}
else
{
$instance = self::$_current_instance;
}
if (is_null($instance))
{
throw new \Exception('No instance found for datatable, you should set a datatable id in your
action with "setDatatableId" using the id from your view ');
}
return $instance;
}
/**
* get entity name
*
* @return string
*/
public function getEntityName()
{
return $this->_queryBuilder->getEntityName();
}
/**
* get entity alias
*
* @return string
*/
public function getEntityAlias()
{
return $this->_queryBuilder->getEntityAlias();
}
/**
* get fields
*
* @return array
*/
public function getFields()
{
return $this->_queryBuilder->getFields();
}
/**
* get has_action
*
* @return boolean
*/
public function getHasAction()
{
return $this->_has_action;
}
/**
* retrun true if the actions column is overridden by twig renderer
*
* @return boolean
*/
public function <API key>()
{
return $this-><API key>;
}
/**
* get order field
*
* @return string
*/
public function getOrderField()
{
return $this->_queryBuilder->getOrderField();
}
/**
* get order type
*
* @return string
*/
public function getOrderType()
{
return $this->_queryBuilder->getOrderType();
}
/**
* create raw prototype
*
* @param string $type
*
* @return PrototypeBuilder
*/
public function getPrototype($type)
{
return new PrototypeBuilder($this->_container, $type);
}
/**
* get query builder
*
* @return QueryInterface
*/
public function getQueryBuilder()
{
return $this->_queryBuilder;
}
/**
* get search
*
* @return boolean
*/
public function getSearch()
{
return $this->_search;
}
/**
* set entity
*
* @param type $entity_name
* @param type $entity_alias
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setEntity($entity_name, $entity_alias)
{
$this->_queryBuilder->setEntity($entity_name, $entity_alias);
return $this;
}
/**
* set entity manager
*
* @param EntityManager $em
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setEntityManager(EntityManager $em)
{
$this->_queryBuilder = new DoctrineBuilder($this->_container, $em);
return $this;
}
/**
* set fields
*
* @param array $fields
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setFields(array $fields)
{
$this->_queryBuilder->setFields($fields);
return $this;
}
/**
* Add a field
*
* @param string $key
* @param string $value
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function addField($key, $value)
{
$fields = $this->_queryBuilder->getFields() ? $this->_queryBuilder->getFields() : array();
$fields[$key] = $value;
$this->setFields($fields);
return $this;
}
/**
* Add an array of fields
*
* @param array $fields
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function addFields(array $fields)
{
$oldFields = $this->_queryBuilder->getFields() ? $this->_queryBuilder->getFields() : array();
$newFields = array_merge($oldFields, $fields);
$this->setFields($newFields);
return $this;
}
/**
* set has action
*
* @param type $has_action
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setHasAction($has_action)
{
$this->_has_action = $has_action;
return $this;
}
/**
* set order
*
* @param type $order_field
* @param type $order_type
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setOrder($order_field, $order_type)
{
$this->_queryBuilder->setOrder($order_field, $order_type);
return $this;
}
/**
* set fixed data
*
* @param type $data
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setFixedData($data)
{
$this->_fixed_data = $data;
return $this;
}
/**
* set query builder
*
* @param QueryInterface $queryBuilder
*/
public function setQueryBuilder(QueryInterface $queryBuilder)
{
$this->_queryBuilder = $queryBuilder;
}
/**
* set a php closure as renderer
*
* @example:
*
* $controller_instance = $this;
* $datatable = $this->get('datatable')
* ->setEntity("AliBaseBundle:Entity", "e")
* ->setFields($fields)
* ->setOrder("e.created", "desc")
* ->setRenderer(
* function(&$data) use ($controller_instance)
* {
* foreach ($data as $key => $value)
* {
* if ($key == 1)
* {
* $data[$key] = $controller_instance
* ->get('templating')
* ->render('AliBaseBundle:Entity:_decorator.html.twig',
* array(
* 'data' => $value
* )
* );
* }
* }
* }
* )
* ->setHasAction(true);
*
* @param \Closure $renderer
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setRenderer(\Closure $renderer)
{
$this->_renderer = $renderer;
return $this;
}
/**
* set renderers as twig views
*
* @example: To override the actions column
*
* ->setFields(
* array(
* "field label 1" => 'x.field1',
* "field label 2" => 'x.field2',
* "_identifier_" => 'x.id'
* )
* )
* ->setRenderers(
* array(
* 2 => array(
* 'view' => 'AliDatatableBundle:Renderers:_actions.html.twig',
* 'params' => array(
* 'edit_route' => 'matche_edit',
* 'delete_route' => 'matche_delete',
* '<API key>' => $datatable->getPrototype('delete_form')
* ),
* ),
* )
* )
*
* @param array $renderers
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setRenderers(array $renderers)
{
$this->_renderers = $renderers;
if (!empty($this->_renderers))
{
$this->_renderer_obj = new Renderer($this->_container, $this->_renderers, $this->getFields());
}
$actions_index = array_search('_identifier_', array_keys($this->getFields()));
if ($actions_index != FALSE && isset($renderers[$actions_index]))
{
$this-><API key> = true;
}
return $this;
}
/**
* set query where
*
* @param string $where
* @param array $params
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setWhere($where, array $params = array())
{
$this->_queryBuilder->setWhere($where, $params);
return $this;
}
/**
* set query group
*
* @param string $groupbywhere
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setGroupBy($groupby)
{
$this->_queryBuilder->setGroupBy($groupby);
return $this;
}
/**
* set search
*
* @param bool $search
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setSearch($search)
{
$this->_search = $search;
$this->_queryBuilder->setSearch($search);
return $this;
}
/**
* set datatable identifier
*
* @param string $id
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setDatatableId($id)
{
if (!array_key_exists($id, self::$_instances))
{
self::$_instances[$id] = $this;
}
else
{
throw new \Exception('Identifer already exists');
}
return $this;
}
/**
* get multiple
*
* @return array
*/
public function getMultiple()
{
return $this->_multiple;
}
/**
* set multiple
*
* @example
*
* ->setMultiple('delete' => array ('title' => "Delete", 'route' => 'route_to_delete' ));
*
* @param array $multiple
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setMultiple(array $multiple)
{
$this->_multiple = $multiple;
return $this;
}
/**
* get global configuration ( read it from config.yml under ali_datatable)
*
* @return array
*/
public function getConfiguration()
{
return $this->_config;
}
/**
* get search field
*
* @return array
*/
public function getSearchFields()
{
return $this->_search_fields;
}
/**
* set search fields
*
* @example
*
* ->setSearchFields(array(0,2,5))
*
* @param array $search_fields
*
* @return \Ali\DatatableBundle\Util\Datatable
*/
public function setSearchFields(array $search_fields)
{
$this->_search_fields = $search_fields;
return $this;
}
} |
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared';
import { TabModule, UploadModule } from 'ngx-prx-styleguide';
import { storyRouting, storyProviders, storyComponents } from './story.routing';
@NgModule({
declarations: [
storyComponents
],
imports: [
CommonModule,
SharedModule,
TabModule, // needs own TabModule for separate instance of TabService
UploadModule,
storyRouting
],
providers: [
storyProviders
]
})
export class StoryModule { } |
#ifndef COINCONTROL_H
#define COINCONTROL_H
#include "core.h"
/** Coin Control Features. */
class CCoinControl
{
public:
CTxDestination destChange;
CCoinControl()
{
SetNull();
}
void SetNull()
{
destChange = CNoDestination();
setSelected.clear();
}
bool HasSelected() const
{
return (setSelected.size() > 0);
}
bool IsSelected(const uint256& hash, unsigned int n) const
{
COutPoint outpt(hash, n);
return (setSelected.count(outpt) > 0);
}
void Select(COutPoint& output)
{
setSelected.insert(output);
}
void UnSelect(COutPoint& output)
{
setSelected.erase(output);
}
void UnSelectAll()
{
setSelected.clear();
}
void ListSelected(std::vector<COutPoint>& vOutpoints)
{
vOutpoints.assign(setSelected.begin(), setSelected.end());
}
private:
std::set<COutPoint> setSelected;
};
#endif // COINCONTROL_H |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>orange</title>
<link href="/css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
#FA8100
</h1>
</body>
</html> |
{%- set items = resource.pages|<API key>(post.meta.directory) %}
{%- if items.length > 0 %}
<h2 class="component-demos">
<i class="anticon anticon-appstore icon-all" title=""></i>
{%- if post.meta.sketch %}
<a class="sketch-link" href="{{ post.meta.sketch }}" target="_blank">
<i class="anticon anticon-download"></i>
Sketch
</a>
{%- endif %}
</h2>
<div class="code-boxes">
{%- if post.meta.cols == 1 %}
<div class="code-boxes-col-1-1">
{%- for item in items %}
{%- set post = item.meta.filepath|parsePost %}
{%- include "code.html" %}
{%- endfor %}
</div>
{%- else %}
<div class="code-boxes-col-1-1">
{%- for item in items|odd %}
{%- set post = item.meta.filepath|parsePost %}
{%- include "code.html" %}
{%- endfor %}
</div>
<div class="code-boxes-col-1-1">
{%- for item in items|even %}
{%- set post = item.meta.filepath|parsePost %}
{%- include "code.html" %}
{%- endfor %}
</div>
{%- endif %}
</div>
<ul class="demos-anchor">
{%- for item in items %}
{%- set post = item.meta.filepath|parsePost %}
<li>
<a title="{{ post.title }}" href="#{{post.meta.id|<API key>}}">
<span>{{ post.title }}</span>
</a>
</li>
{%- endfor %}
</ul>
{%- endif %} |
<div class="s_background">
<textarea id="s_publish_content" ng-model="s_publish_content" type="text" class="s_input"
placeholder="##"></textarea>
<div>
<button type="button" class="btn btn-primary s_btn_pic">
</button>
<button type="button" class="btn btn-primary s_btn_pic" ng-click="choose_pic()">
</button>
<button type="button" ng-click="publish_feed()" class="btn btn-primary s_btn_pub">
</button>
<p class="s_log"></p>
</div>
<div id="preview_list" class="row s_pic_div">
<div id="add_pic_btn" class="col-xs-4">
<div class="s_pic_div_in">
<img id="img_add_btn" src="images/image.png" ng-click="choose_pic()"
ng-mouseover="mouse_over_add()" ng-mouseleave="mouse_leave_add()">
</div>
</div>
<!--<div class="col-xs-4">-->
<!--<div class="s_pic_div_in">-->
<!--<img id="1_9" class="s_picture" src="images/pic.png" ng-mouseover="">-->
<!--<img class="s_btn_delete" id="aa" src="images/delete_pic.png" onclick="$scope.test_pic(0)">-->
<!--</div>-->
<!--</div>-->
</div>
<form id="s_pic_form">
<input type="file" class="s_file" id="s_file" name="s_file" ng-model="pic_upload" multiple="multiple"
accept="image/vnd.sealedmedia.softseal-jpg,image/png,image/jpeg,image/gif" onchange="angular.element(this).scope().upload_pic()">
</form>
</div> |
* {
margin: 0;
padding: 0;
}
html, body {
background: #EEE;
font: 12px sans-serif;
}
body {
padding-top: 1.8em;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html, body, table, tbody, tr, td {
height: 100%
}
table {
table-layout: fixed;
width: 100%;
}
td {
width: 33%;
padding: 3px 4px;
border: 1px solid transparent;
vertical-align: top;
font: 1em monospace;
text-align: left;
white-space: pre-wrap;
}
h1 {
display: inline;
font-size: 100%;
}
del {
text-decoration: none;
color: #b30000;
background: #fadad7;
}
ins {
background: #eaf2c2;
color: #406619;
text-decoration: none;
}
#settings {
position: absolute;
top: 0;
left: 5px;
right: 5px;
height: 2em;
line-height: 2em;
}
#settings label {
margin-left: 1em;
}
.source {
position: absolute;
right: 1%;
top: .2em;
}
[contentEditable] {
background: #F9F9F9;
border-color: #BBB #D9D9D9 #DDD;
border-radius: 4px;
-webkit-user-modify: <API key>;
outline: none;
}
[contentEditable]:focus {
background: #FFF;
border-color: #6699cc;
box-shadow: 0 0 4px #2175c9;
}
@-moz-document url-prefix() {
body {
height: 99%; /* Hide scroll bar in Firefox */
}
} |
PKGNAME = pyramid_describe
include Makefile.python
examples:
rm -f doc/example.*
for fmt in html json pdf rst txt wadl xml yaml ; do \
echo "creating '$$fmt' example..." ; \
pdescribe example.ini --format "$$fmt" > doc/example."$$fmt" ; \
done
@echo "creating 'txt' (ascii) example..."
@pdescribe example.ini --txt --setting format.default.ascii=true \
> doc/example.txt.asc |
package rps
type Values []int64
func (self *Values) Rotate(n int) {
if n > 0 {
capacity := cap(*self)
values := make([]int64, capacity, capacity)
if n < capacity {
copy(values, (*self)[n:])
}
*self = values
}
} |
import _plotly_utils.basevalidators
class ValueValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="value",
parent_name="volume.colorbar.tickformatstop",
**kwargs
):
super(ValueValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "calc"),
role=kwargs.pop("role", "style"),
**kwargs
) |
ActiveAdmin.register Kata do
permit_params :name, :description
menu parent: "Attributes"
config.sort_order = "name_asc"
filter :name
filter :description
index do
id_column
column :name
column :description
actions
end
show title: :name do |at|
panel 'Details' do
<API key> at do
row :id
row :name
row :description
end
end
panel 'System' do
<API key> at do
row :created_at
row :updated_at
end
end
end
end |
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: <API key>("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimpleInjector.CodeSamples.Tests.Unit2")]
[assembly: AssemblyTrademark("")]
// 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("<API key>")] |
package players
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestRepo_Pick(t *testing.T) {
p := Player{ID: 1}
r := &Repo{
Available: []Player{{ID: 1, ADP: 45}},
}
var err error
p.ID = 2
err = r.Pick(p)
require.Error(t, err)
require.Equal(t, 0, len(r.Claimed))
require.Equal(t, 1, len(r.Available))
require.Equal(t, 0, r.Position)
p.ID = 1
err = r.Pick(p)
require.NoError(t, err)
require.Equal(t, 0, len(r.Available))
require.Equal(t, 1, len(r.Claimed))
require.Equal(t, 1, r.Position)
}
func TestRepo_UnPick(t *testing.T) {
p := Player{ID: 1}
r := &Repo{
Position: 3,
Claimed: []Player{{ID: 1, ADP: 45}},
}
var err error
p.ID = 2
err = r.UnPick(p)
require.Error(t, err)
require.Equal(t, 1, len(r.Claimed))
require.Equal(t, 0, len(r.Available))
require.Equal(t, 3, r.Position)
p.ID = 1
err = r.UnPick(p)
require.NoError(t, err)
require.Equal(t, 0, len(r.Claimed))
require.Equal(t, 1, len(r.Available))
require.Equal(t, 2, r.Position)
} |
import { CognitoUser, <API key> } from '<API key>';
import { getUserPool } from './config';
class <API key> extends Error {
constructor(message, userAttributes, requiredAttributes) {
super(message);
this.message = message;
this.name = '<API key>';
this.userAttributes = userAttributes;
this.requiredAttributes = requiredAttributes;
}
}
export default function(username, password) {
const authenticationData = {
Username: username,
Password: password,
};
const <API key> = new <API key>(authenticationData);
const userData = {
Username: username,
Pool: getUserPool(),
};
const cognitoUser = new CognitoUser(userData);
return new Promise((resolve, reject) => {
cognitoUser.authenticateUser(<API key>, {
onSuccess: function(result) {
resolve(result);
},
onFailure: function(err) {
reject(err);
},
mfaRequired: function(codeDeliveryDetails) {
console.log('cognito::authenticateUser::mfaRequired', {
codeDeliveryDetails,
});
reject(codeDeliveryDetails);
// brandon.orther@gmail.com
// // MFA is required to complete user authentication.
// // Get the code from user and call
// cognitoUser.sendMFACode(mfaCode, this);
},
newPasswordRequired: function(userAttributes, requiredAttributes) {
console.log('cognito::authenticateUser::newPasswordRequired', {
userAttributes,
requiredAttributes,
});
reject(
new <API key>(
'Log in requires new password.',
userAttributes,
requiredAttributes,
),
);
// reject({ userAttributes, requiredAttributes });
// User was signed up by an admin and must provide new
// password and required attributes, if any, to complete
// authentication.
// // the api doesn't accept this field back
// delete userAttributes.email_verified;
// // Get these details and call
// cognitoUser.<API key>(
// newPassword,
// userAttributes,
// this,
},
});
});
} |
'use strict';
angular.module('expensesApp')
.factory('User', function ($resource) {
return $resource('/api/users/:id/:controller', {
id: '@_id'
},
{
changePassword: {
method: 'PUT',
params: {
controller:'password'
}
},
get: {
method: 'GET',
params: {
id:'me'
}
}
});
}); |
#ifndef DUNE_PRINT_H
#define DUNE_PRINT_H
#include "dune.h"
/* print a formatted string to terminal */
size_t kprintf(char *fmt, ...);
/* construct a formatted string in buffer 's' */
size_t ksprintf(char *s, char *fmt, ...);
/* **TEMPORARY** UNBUFFERED userspace printf */
size_t uprintf(char *fmt, ...);
#ifdef QEMU_DEBUG
#define DEBUG(s) \
do { \
dbgprintf("%s:%u: " s, __FILE__, __LINE__); \
} while (0)
#define DEBUGF(fmt, ...) \
do { \
dbgprintf("%s:%u: " fmt, __FILE__, __LINE__, __VA_ARGS__); \
} while (0)
/* print a formatted string to QEMU's debug console */
size_t dbgprintf(char *fmt, ...);
#else /* QEMU_DEBUG */
# define DEBUG(...)
# define dbgprintf(...)
#endif /* QEMU_DEBUG */
#endif /* DUNE_PRINT_H */ |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Compute::Mgmt::V2019_07_01
module Models
# Defines values for IPVersion
module IPVersion
IPv4 = "IPv4"
IPv6 = "IPv6"
end
end
end |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2017_03_01
module Models
# Application gateway BackendHealth pool.
class <API key>
include MsRestAzure
# @return [<API key>] Reference of an
# <API key> resource.
attr_accessor :<API key>
# @return [Array<<API key>>] List of
# <API key> resources.
attr_accessor :<API key>
# Mapper for <API key> class as Ruby Hash.
# This will be used for serialization/deserialization.
def self.mapper()
{
<API key>: true,
required: false,
serialized_name: '<API key>',
type: {
name: 'Composite',
class_name: '<API key>',
model_properties: {
<API key>: {
<API key>: true,
required: false,
serialized_name: 'backendAddressPool',
type: {
name: 'Composite',
class_name: '<API key>'
}
},
<API key>: {
<API key>: true,
required: false,
serialized_name: '<API key>',
type: {
name: 'Sequence',
element: {
<API key>: true,
required: false,
serialized_name: '<API key>',
type: {
name: 'Composite',
class_name: '<API key>'
}
}
}
}
}
}
}
end
end
end
end |
import lang from './lang';
import xml from './xml';
import querystring from './querystring';
import models from './models';
import rest from './rest';
import sort from './sort';
export default { lang, xml, querystring, models, rest, sort }; |
package com.aspose.imaging.examples.shapes;
import com.aspose.imaging.Pen;
import com.aspose.imaging.examples.Logger;
import com.aspose.imaging.examples.Utils;
public class DrawingLines
{
public static void main(String[] args)
{
Logger.startExample("DrawingLines");
//Creates an instance of BmpOptions and set its various properties
try (com.aspose.imaging.imageoptions.BmpOptions bmpCreateOptions = new com.aspose.imaging.imageoptions.BmpOptions())
{
bmpCreateOptions.setBitsPerPixel(32);
//Define the source property for the instance of BmpOptions
bmpCreateOptions.setSource(new com.aspose.imaging.sources.StreamSource(new java.io.<API key>(new byte[100 * 100 * 4])));
//Creates an instance of Image and call create method by passing the bmpCreateOptions object
com.aspose.imaging.Graphics graphic;
try (com.aspose.imaging.Image image = com.aspose.imaging.Image.create(bmpCreateOptions, 100, 100))
{
//Create and initialize an instance of Graphics class
graphic = new com.aspose.imaging.Graphics(image);
// start collecting the drawing operations into cache
graphic.beginUpdate();
//Clear the image surface with Yellow color
graphic.clear(com.aspose.imaging.Color.getYellow());
//Draw a dotted line by specifying the Pen object having blue color and co-ordinate Points
graphic.drawLine(new Pen(com.aspose.imaging.Color.getBlue()), 9, 9, 90, 90);
graphic.drawLine(new Pen(com.aspose.imaging.Color.getBlue()), 9, 90, 90, 9);
//Draw a continuous line by specifying the Pen object having Solid Brush with red color and two point structures
graphic.drawLine(new Pen(new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getRed())), new com.aspose.imaging.Point(9, 9), new com.aspose.imaging.Point(9, 90));
//Draw a continuous line by specifying the Pen object having Solid Brush with aqua color and two point structures
graphic.drawLine(new Pen(new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getAqua())), new com.aspose.imaging.Point(9, 90), new com.aspose.imaging.Point(90, 90));
//Draw a continuous line by specifying the Pen object having Solid Brush with black color and two point structures
graphic.drawLine(new Pen(new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getBlack())),
new com.aspose.imaging.Point(90, 90), new com.aspose.imaging.Point(90, 9));
//Draw a continuous line by specifying the Pen object having Solid Brush with white color and two point structures
graphic.drawLine(new Pen(new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getWhite()))
, new com.aspose.imaging.Point(90, 9), new com.aspose.imaging.Point(9, 9));
// real drawing process
graphic.endUpdate();
//Save all changes.
image.save(Utils.getOutDir() + "DrawingLines_out.bmp");
}
}
// Display Status.
Logger.println("Lines have been drawn in image successfully!");
Logger.endExample();
}
} |
#include "check_cjose.h"
#include <stdlib.h>
#include <stdio.h>
#include <check.h>
#include <cjose/cjose.h>
#include <jansson.h>
#include "include/jwk_int.h"
#include "include/jws_int.h"
#include <openssl/rand.h>
// a JWK to be re-used for unit tests
static const char *JWK_COMMON
= "{ \"kty\": \"RSA\", "
"\"e\": \"AQAB\", "
"\"n\": "
"\"<API key>24__"
"<API key>"
"<API key>"
"bJ4G1xd1DE7W94uoUlcSDx59aSdzTpQzJh1l3lXc6JRUrXTESYgHpMv0O1n0gbIxX8X1ityBlMiccDjfZIKLnwz6hQObvRtRIpxEdq4SYS-w\", "
"\"kid\": \"<API key>\", "
"\"d\": "
"\"<API key>-"
"<API key>-"
"ZfV7KssO0Imqq6bBZkEpzfgVC760tmSuqJ0W2on8eWzi36zuKru9qA5uo7L8w9I5rzqY7XEaak0PYFi5zB1BkpI83tN2bBP2jPsym9lMP4fbf-"
"<API key><API key>\", "
"\"p\": "
"\"<API key><API key>-"
"<API key>\", "
"\"q\": "
"\"4gPgtf7FT91-FmkkNsrpK0J4Fp8jG1N0GuM30NvS4D715NWOKeuoUi1Ius3yHNdzo9uwLJgY7xJMJlr3ZSmcldwFLBKGVkLctOVLqDWrBLMwD-"
"<API key>\", "
"\"dp\": "
"\"<API key>pGyJpCIWVvdOu6BJjg-"
"<API key>\", "
"\"dq\": "
"\"<API key><API key>"
"<API key>\", "
"\"qi\": "
"\"RowmdelfiEBdqfBCSb3yblUKhwJsbyg6HtcugIVOC1yDxD5sZ0cjJPnXj7TJkrC0tICQ50MlPY5F650D9pvACIYnvrGEwsq757Lxg5nqshvuSC-7i1TMkv7_"
"<API key>\" }";
static const char *JWK_COMMON_OCT
= "{ \"kty\": \"oct\", "
"\"k\": \"<API key><API key>\" }";
static const char *JWK_COMMON_EC = "{ \"kty\":\"EC\","
"\"crv\":\"P-256\","
"\"x\":\"<API key>\","
"\"y\":\"<API key>\","
"\"d\":\"<API key>\" }";
// a JWS encrypted with the above JWK_COMMON key
static const char *JWS_COMMON
= "<API key>."
"SWYgeW91IHJldmVhbCB5b3VyIHNlY3JldHMgdG8gdGhlIHdpbmQsIHlvdSBzaG91bGQgbm90IGJsYW1lIHRoZSB3aW5kIGZvciByZXZlYWxpbmcgdGhlbSB0byB0"
"<API key>.0YJo4r9gbI2nZ2_1_"
"KLTY3i5SRcZvahRuToavqBvLbm87pN7IYx8YV9kwKQclMW2ASpbEAzKNIJfQ3FycobRwZGtqCI9sRUo0vQvkpb3HIS6HKp3Kvur57J7LcZhz7uNIxzUYNQSg4EWp"
"<API key>n74gopAVzd3KDJ5ai7q66voRc9pCKJVbsaIMHIqcl9OPiMdY5Hz3_PgBalR2632HOdpUlIMvnMOL3EQICvyBwxaYPbhMcCpEc3_"
"<API key>";
// the plaintext payload of the above JWS_COMMON
static const char *PLAIN_COMMON = "If you reveal your secrets to the wind, you should not blame the "
"wind for revealing them to the trees. — Kahlil Gibran";
static const char *<API key>(const char *alg)
{
if ((strcmp(alg, CJOSE_HDR_ALG_HS256) == 0) || (strcmp(alg, CJOSE_HDR_ALG_HS384) == 0)
|| (strcmp(alg, CJOSE_HDR_ALG_HS512) == 0))
return JWK_COMMON_OCT;
if ((strcmp(alg, CJOSE_HDR_ALG_ES256) == 0) || (strcmp(alg, CJOSE_HDR_ALG_ES384) == 0)
|| (strcmp(alg, CJOSE_HDR_ALG_ES512) == 0))
return JWK_COMMON_EC;
return JWK_COMMON;
}
static void <API key>(const char *plain1, const char *alg, cjose_err *err)
{
const char *s_jwk = <API key>(alg);
cjose_jwk_t *jwk = cjose_jwk_import(s_jwk, strlen(s_jwk), err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
// set header for JWS
cjose_header_t *hdr = cjose_header_new(err);
ck_assert_msg(cjose_header_set(hdr, CJOSE_HDR_ALG, alg, err), "cjose_header_set failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
// create the JWS
size_t plain1_len = strlen(plain1);
cjose_jws_t *jws1 = cjose_jws_sign(jwk, hdr, plain1, plain1_len, err);
ck_assert_msg(NULL != jws1, "cjose_jws_sign failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
ck_assert(hdr == <API key>(jws1));
// get the compact serialization of JWS
const char *compact = NULL;
ck_assert_msg(cjose_jws_export(jws1, &compact, err), "cjose_jws_export failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
// deserialize the compact representation to a new JWS
cjose_jws_t *jws2 = cjose_jws_import(compact, strlen(compact), err);
ck_assert_msg(NULL != jws2, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
// verify the deserialized JWS
ck_assert_msg(cjose_jws_verify(jws2, jwk, err), "cjose_jws_verify failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
// get the verified plaintext
uint8_t *plain2 = NULL;
size_t plain2_len = 0;
ck_assert_msg(<API key>(jws2, &plain2, &plain2_len, err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err->message, err->file, err->function, err->line);
// confirm equal headers
ck_assert(json_equal((json_t *)<API key>(jws1), (json_t *)<API key>(jws2)));
// confirm plain2 == plain1
ck_assert_msg(plain2_len == strlen(plain1), "length of verified plaintext does not match length of original, "
"expected: %lu, found: %lu",
strlen(plain1), plain2_len);
ck_assert_msg(strncmp(plain1, plain2, plain2_len) == 0, "verified plaintext does not match signed plaintext");
<API key>(hdr);
cjose_jws_release(jws1);
cjose_jws_release(jws2);
cjose_jwk_release(jwk);
}
START_TEST(<API key>)
{
cjose_err err;
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_PS256, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_PS384, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_PS512, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_RS256, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_RS384, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_RS512, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_HS256, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_HS384, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_HS512, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_ES256, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_ES384, &err);
<API key>(PLAIN_COMMON, CJOSE_HDR_ALG_ES512, &err);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
<API key>("Setec Astronomy", CJOSE_HDR_ALG_PS256, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_PS384, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_PS512, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_RS256, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_RS384, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_RS512, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_HS256, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_HS384, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_HS512, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_ES256, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_ES384, &err);
<API key>("Setec Astronomy", CJOSE_HDR_ALG_ES512, &err);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
<API key>("", CJOSE_HDR_ALG_PS256, &err);
<API key>("", CJOSE_HDR_ALG_PS384, &err);
<API key>("", CJOSE_HDR_ALG_PS512, &err);
<API key>("", CJOSE_HDR_ALG_RS256, &err);
<API key>("", CJOSE_HDR_ALG_RS384, &err);
<API key>("", CJOSE_HDR_ALG_RS512, &err);
<API key>("", CJOSE_HDR_ALG_HS256, &err);
<API key>("", CJOSE_HDR_ALG_HS384, &err);
<API key>("", CJOSE_HDR_ALG_HS512, &err);
<API key>("", CJOSE_HDR_ALG_ES256, &err);
<API key>("", CJOSE_HDR_ALG_ES384, &err);
<API key>("", CJOSE_HDR_ALG_ES512, &err);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// sign and verify a whole lot of randomly sized payloads
for (int i = 0; i < 100; ++i)
{
size_t len = random() % 1024;
char *plain = (char *)malloc(len);
ck_assert_msg(RAND_bytes(plain, len) == 1, "RAND_bytes failed");
plain[len - 1] = 0;
<API key>(plain, CJOSE_HDR_ALG_PS256, &err);
<API key>(plain, CJOSE_HDR_ALG_PS384, &err);
<API key>(plain, CJOSE_HDR_ALG_PS512, &err);
<API key>(plain, CJOSE_HDR_ALG_RS256, &err);
<API key>(plain, CJOSE_HDR_ALG_RS384, &err);
<API key>(plain, CJOSE_HDR_ALG_RS512, &err);
<API key>(plain, CJOSE_HDR_ALG_HS256, &err);
<API key>(plain, CJOSE_HDR_ALG_HS384, &err);
<API key>(plain, CJOSE_HDR_ALG_HS512, &err);
<API key>(plain, CJOSE_HDR_ALG_ES256, &err);
<API key>(plain, CJOSE_HDR_ALG_ES384, &err);
<API key>(plain, CJOSE_HDR_ALG_ES512, &err);
free(plain);
}
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
cjose_header_t *hdr = NULL;
cjose_jws_t *jws = NULL;
static const char *plain = "The mind is everything. What you think you become.";
size_t plain_len = strlen(plain);
static const char *JWK
= "{ \"kty\": \"RSA\", "
"\"kid\": \"<API key>\", "
"\"e\": \"AQAB\", "
"\"n\": "
"\"<API key>24__"
"<API key>"
"<API key>"
"bJ4G1xd1DE7W94uoUlcSDx59aSdzTpQzJh1l3lXc6JRUrXTESYgHpMv0O1n0gbIxX8X1ityBlMiccDjfZIKLnwz6hQObvRtRIpxEdq4SYS-w\" }";
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// set header for JWS with bad alg
hdr = cjose_header_new(&err);
ck_assert_msg(cjose_header_set(hdr, CJOSE_HDR_ALG, "Cayley-Purser", &err), "cjose_header_set failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// create a JWS
jws = cjose_jws_sign(jwk, hdr, plain, plain_len, &err);
ck_assert_msg(NULL == jws, "cjose_jws_sign created with bad header");
ck_assert_msg(err.code == <API key>, "cjose_jws_sign returned bad err.code (%zu:%s)", err.code, err.message);
<API key>(hdr);
cjose_jwk_release(jwk);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
cjose_header_t *hdr = NULL;
cjose_jws_t *jws = NULL;
static const char *plain = "The mind is everything. What you think you become.";
size_t plain_len = strlen(plain);
// some bad keys to test with
static const char *JWK_BAD[] = {
// missing private part 'd' needed for signing
"{ \"kty\": \"RSA\", "
"\"kid\": \"<API key>\", "
"\"e\": \"AQAB\", "
"\"n\": "
"\"<API key>24__"
"<API key>"
"<API key>"
"bJ4G1xd1DE7W94uoUlcSDx59aSdzTpQzJh1l3lXc6JRUrXTESYgHpMv0O1n0gbIxX8X1ityBlMiccDjfZIKLnwz6hQObvRtRIpxEdq4SYS-w\" }",
// currently unsupported key type (EC)
"{ \"kty\": \"EC\", \"crv\": \"P-256\", "
"\"x\": \"<API key>\", "
"\"y\": \"<API key>\", "
"\"kid\": \"<API key>\" }",
NULL
};
// set header for JWS
hdr = cjose_header_new(&err);
ck_assert_msg(cjose_header_set(hdr, CJOSE_HDR_ALG, CJOSE_HDR_ALG_PS256, &err), "cjose_header_set failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// attempt signion with each bad key
for (int i = 0; NULL != JWK_BAD[i]; ++i)
{
cjose_jwk_t *jwk = cjose_jwk_import(JWK_BAD[i], strlen(JWK_BAD[i]), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
jws = cjose_jws_sign(jwk, hdr, plain, plain_len, &err);
ck_assert_msg(NULL == jws, "cjose_jws_sign created with bad key");
ck_assert_msg(err.code == <API key>, "%d cjose_jws_sign returned bad err.code (%zu:%s)", i, err.code,
err.message);
cjose_jwk_release(jwk);
}
jws = cjose_jws_sign(NULL, hdr, plain, plain_len, &err);
ck_assert_msg(NULL == jws, "cjose_jws_sign created with bad key");
ck_assert_msg(err.code == <API key>, "cjose_jws_sign returned bad err.code (%zu:%s)", err.code, err.message);
<API key>(hdr);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
cjose_header_t *hdr = NULL;
cjose_jws_t *jws = NULL;
static const char *JWK
= "{ \"kty\": \"RSA\", "
"\"e\": \"AQAB\", "
"\"n\": "
"\"<API key>24__"
"<API key>"
"<API key>"
"bJ4G1xd1DE7W94uoUlcSDx59aSdzTpQzJh1l3lXc6JRUrXTESYgHpMv0O1n0gbIxX8X1ityBlMiccDjfZIKLnwz6hQObvRtRIpxEdq4SYS-w\", "
"\"kid\": \"<API key>\", "
"\"d\": "
"\"<API key>-"
"<API key>-"
"ZfV7KssO0Imqq6bBZkEpzfgVC760tmSuqJ0W2on8eWzi36zuKru9qA5uo7L8w9I5rzqY7XEaak0PYFi5zB1BkpI83tN2bBP2jPsym9lMP4fbf-"
"<API key><API key>\" }";
// import the key
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// set header for JWS
hdr = cjose_header_new(&err);
ck_assert_msg(cjose_header_set(hdr, CJOSE_HDR_ALG, CJOSE_HDR_ALG_PS256, &err), "cjose_header_set failed");
jws = cjose_jws_sign(jwk, hdr, NULL, 1024, &err);
ck_assert_msg(NULL == jws, "cjose_jws_sign created with NULL plaintext");
ck_assert_msg(err.code == <API key>, "cjose_jws_sign returned bad err.code (%zu:%s)", err.code, err.message);
jws = cjose_jws_sign(jwk, hdr, NULL, 0, &err);
ck_assert_msg(NULL == jws, "cjose_jws_sign created with NULL plaintext");
ck_assert_msg(err.code == <API key>, "cjose_jws_sign returned bad err.code (%zu:%s)", err.code, err.message);
cjose_jwk_release(jwk);
<API key>(hdr);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// import the common key
cjose_jwk_t *jwk = cjose_jwk_import(JWK_COMMON, strlen(JWK_COMMON), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// import the jws created with the common key
cjose_jws_t *jws = cjose_jws_import(JWS_COMMON, strlen(JWS_COMMON), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// re-export the jws object
const char *cser = NULL;
ck_assert_msg(cjose_jws_export(jws, &cser, &err), "re-export of imported JWS faied: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// compare the re-export to the original serialization
ck_assert_msg(strncmp(JWS_COMMON, cser, strlen(JWS_COMMON)) == 0, "export of imported JWS doesn't match original");
cjose_jwk_release(jwk);
cjose_jws_release(jws);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
static const char *JWS_BAD[]
= { "<API key>."
"SWYgeW91IHJldmVhbCB5b3VyIHNlY3JldHMgdG8gdGhlIHdpbmQsIHlvdSBzaG91bGQgbm90IGJsYW1lIHRoZSB3aW5kIGZvciByZXZlYWxpbmcgdGhlbS"
"<API key>.<API key>-"
"<API key>-X6I-_"
"M0s2JCE8Mx4nBoUcZXtjlh2mn4iNpshG4N3EiCbCMZnHc4wRo5Pwt3GpppyutpLZlpBcXKJk42dNpKvQnxzYulig6OIgNwv6c9SEW-3qG2FJW-"
"eFcTuFSCnAqTYBU2V<API key>.x",
"<API key>."
"SWYgeW91IHJldmVhbCB5b3VyIHNlY3JldHMgdG8gdGhlIHdpbmQsIHlvdSBzaG91bGQgbm90IGJsYW1lIHRoZSB3aW5kIGZvciByZXZlYWxpbmcgdGhlbS"
"<API key>.<API key>-"
"<API key>-X6I-_"
"M0s2JCE8Mx4nBoUcZXtjlh2mn4iNpshG4N3EiCbCMZnHc4wRo5Pwt3GpppyutpLZlpBcXKJk42dNpKvQnxzYulig6OIgNwv6c9SEW-3qG2FJW-"
"eFcTuFSCnAqTYBU2V<API key>.",
"<API key>.."
"SWYgeW91IHJldmVhbCB5b3VyIHNlY3JldHMgdG8gdGhlIHdpbmQsIHlvdSBzaG91bGQgbm90IGJsYW1lIHRoZSB3aW5kIGZvciByZXZlYWxpbmcgdGhlbS"
"<API key>.<API key>-"
"<API key>-X6I-_"
"M0s2JCE8Mx4nBoUcZXtjlh2mn4iNpshG4N3EiCbCMZnHc4wRo5Pwt3GpppyutpLZlpBcXKJk42dNpKvQnxzYulig6OIgNwv6c9SEW-3qG2FJW-"
"eFcTuFSCnAqTYBU2V<API key>",
".<API key>."
"SWYgeW91IHJldmVhbCB5b3VyIHNlY3JldHMgdG8gdGhlIHdpbmQsIHlvdSBzaG91bGQgbm90IGJsYW1lIHRoZSB3aW5kIGZvciByZXZlYWxpbmcgdGhlbS"
"<API key>.<API key>-"
"<API key>-X6I-_"
"M0s2JCE8Mx4nBoUcZXtjlh2mn4iNpshG4N3EiCbCMZnHc4wRo5Pwt3GpppyutpLZlpBcXKJk42dNpKvQnxzYulig6OIgNwv6c9SEW-3qG2FJW-"
"eFcTuFSCnAqTYBU2V<API key>",
"AAAA.BBBB", "AAAA", "", "..", NULL };
for (int i = 0; NULL != JWS_BAD[i]; ++i)
{
cjose_jws_t *jws = cjose_jws_import(JWS_BAD[i], strlen(JWS_BAD[i]), &err);
ck_assert_msg(NULL == jws, "cjose_jws_import of bad JWS succeeded");
ck_assert_msg(err.code == <API key>, "cjose_jws_import returned wrong err.code (%zu:%s)", err.code,
err.message);
}
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// import the jws created with the common key
cjose_jws_t *jws = cjose_jws_import(JWS_COMMON, strlen(JWS_COMMON), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
uint8_t *plaintext = NULL;
size_t plaintext_len = 0;
ck_assert_msg(<API key>(jws, &plaintext, &plaintext_len, &err), "<API key> before verify failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
cjose_jws_release(jws);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// import the common key
cjose_jwk_t *jwk = cjose_jwk_import(JWK_COMMON, strlen(JWK_COMMON), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// import the jws created with the common key
cjose_jws_t *jws = cjose_jws_import(JWS_COMMON, strlen(JWS_COMMON), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// verify the imported jws
ck_assert_msg(cjose_jws_verify(jws, jwk, &err), "cjose_jws_verify failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// get plaintext from imported and verified jws
uint8_t *plaintext = NULL;
size_t plaintext_len = 0;
ck_assert_msg(<API key>(jws, &plaintext, &plaintext_len, &err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// compare the verified plaintext to the expected value
ck_assert_msg(strncmp(PLAIN_COMMON, plaintext, strlen(PLAIN_COMMON)) == 0,
"verified plaintext from JWS doesn't match the original");
cjose_jws_release(jws);
cjose_jwk_release(jwk);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// some bad keys to test with
static const char *JWK_BAD[] = {
// missing private part 'd' needed for signion
"{ \"kty\": \"RSA\", "
"\"e\": \"AQAB\", "
"\"n\": "
"\"<API key>24__"
"<API key>"
"<API key>"
"bJ4G1xd1DE7W94uoUlcSDx59aSdzTpQzJh1l3lXc6JRUrXTESYgHpMv0O1n0gbIxX8X1ityBlMiccDjfZIKLnwz6hQObvRtRIpxEdq4SYS-w\", "
"\"kid\": \"<API key>\" }",
// currently unsupported key type (EC)
"{ \"kty\": \"EC\", \"crv\": \"P-256\", "
"\"x\": \"<API key>\", "
"\"y\": \"<API key>\", "
"\"kid\": \"<API key>\" }",
NULL
};
// import the common key
cjose_jwk_t *jwk = cjose_jwk_import(JWK_COMMON, strlen(JWK_COMMON), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// import the jws created with the common key
cjose_jws_t *jws = cjose_jws_import(JWS_COMMON, strlen(JWS_COMMON), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// try to verify a NULL jws
ck_assert_msg(!cjose_jws_verify(NULL, jwk, &err), "cjose_jws_verify succeeded with NULL jws");
ck_assert_msg(err.code == <API key>, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code, err.message);
// try to verify with a NULL jwk
ck_assert_msg(!cjose_jws_verify(jws, NULL, &err), "cjose_jws_verify succeeded with NULL jwk");
ck_assert_msg(err.code == <API key>, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code, err.message);
// try to verify with bad/wrong/unsupported keys
for (int i = 0; NULL != JWK_BAD[i]; ++i)
{
cjose_jwk_t *jwk_bad = cjose_jwk_import(JWK_BAD[i], strlen(JWK_BAD[i]), &err);
ck_assert_msg(NULL != jwk_bad, "cjose_jwk_import failed");
ck_assert_msg(!cjose_jws_verify(jws, NULL, &err), "cjose_jws_verify succeeded with bad jwk");
ck_assert_msg(err.code == <API key>, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code,
err.message);
cjose_jwk_release(jwk_bad);
}
cjose_jws_release(jws);
cjose_jwk_release(jwk);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// https://tools.ietf.org/html/rfc7515#appendix-A.1
static const char *JWS = "<API key>."
"eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ."
"<API key>";
cjose_jws_t *jws = cjose_jws_import(JWS, strlen(JWS), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *JWK = "{ \"kty\": \"oct\", "
"\"k\": \"<API key><API key>\" }";
// import the key
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// verify the deserialized JWS
ck_assert_msg(cjose_jws_verify(jws, jwk, &err), "cjose_jws_verify failed");
// get the verified plaintext
uint8_t *plain = NULL;
size_t plain_len = 0;
ck_assert_msg(<API key>(jws, &plain, &plain_len, &err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *PLAINTEXT = "{\"iss\":\"joe\",\r\n"
" \"exp\":1300819380,\r\n"
" \"http://example.com/is_root\":true}";
// confirm plain == PLAINTEXT
ck_assert_msg(plain_len == strlen(PLAINTEXT), "length of verified plaintext does not match length of original, "
"expected: %lu, found: %lu",
strlen(PLAINTEXT), plain_len);
ck_assert_msg(strncmp(PLAINTEXT, plain, plain_len) == 0, "verified plaintext does not match signed plaintext: %s", plain);
cjose_jwk_release(jwk);
cjose_jws_release(jws);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
// https://tools.ietf.org/html/rfc7515#appendix-A.2
static const char *JWS
= "<API key>.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ."
"<API key>0Qc_lF5YKt_"
"<API key><API key>"
"<API key>-"
"eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw";
cjose_jws_t *jws_ok = cjose_jws_import(JWS, strlen(JWS), &err);
ck_assert_msg(NULL != jws_ok, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *JWK
= "{ \"kty\":\"RSA\","
"\"n\":\"<API key><API key>-"
"<API key><API key>-"
"<API key>DWNmoudF8NAco9_"
"<API key>\","
"\"e\":\"AQAB\","
"\"d\":\"Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97IjlA7_GQ5sLKMgvfTeXZx9SE<API key>-"
"<API key><API key>"
"0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLhBOneufuBiB4cS98l2SR_"
"<API key>\","
"\"p\":\"4BzEEOtIpmVdVEZNCqS7baC4crd0pqnRH_5IB3jw3bcxGn6QLvnEtfdUdiYrqBdss1l58BQ3KhooKeQTa9AB0Hw_"
"<API key>y2XDwGUc\","
"\"q\":\"<API key>7cepKmtH4pxhtCoHqpWmT8YAmZxaewHgHAjLYsp1ZSe7zFYHj7C6ul7TjeLQeZD_YwD66t62wDmpe_HlB-"
"<API key>\","
"\"dp\":\"<API key><API key>-"
"FOKnu1R6HsJeDCjn12Sk3vmAktV2zb34MCdy7cpdTh_YVr7tss2u6vneTwrA86rZtu5Mbr1C1XsmvkxHQAdYo0\","
"\"dq\":\"h_96-mK1R_7glhsum81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0ajaHF-"
"<API key>\","
"\"qi\":\"<API key>"
"<API key>ZQwVK0JKSHuLFkuQ3U\" }";
// import the key
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// verify the deserialized JWS
ck_assert_msg(cjose_jws_verify(jws_ok, jwk, &err), "cjose_jws_verify failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// get the verified plaintext
uint8_t *plain = NULL;
size_t plain_len = 0;
ck_assert_msg(<API key>(jws_ok, &plain, &plain_len, &err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *PLAINTEXT = "{\"iss\":\"joe\",\r\n"
" \"exp\":1300819380,\r\n"
" \"http://example.com/is_root\":true}";
// confirm plain == PLAINTEXT
ck_assert_msg(plain_len == strlen(PLAINTEXT), "length of verified plaintext does not match length of original, "
"expected: %lu, found: %lu",
strlen(PLAINTEXT), plain_len);
ck_assert_msg(strncmp(PLAINTEXT, plain, plain_len) == 0, "verified plaintext does not match signed plaintext: %s", plain);
cjose_jws_release(jws_ok);
static const char *JWS_TAMPERED_SIG
= "<API key>.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ."
"<API key>0Qc_lF5YKt_"
"<API key><API key>"
"<API key>-"
"eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77RW";
cjose_jws_t *jws_ts = cjose_jws_import(JWS_TAMPERED_SIG, strlen(JWS_TAMPERED_SIG), &err);
ck_assert_msg(NULL != jws_ts, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
ck_assert_msg(!cjose_jws_verify(jws_ts, jwk, &err), "cjose_jws_verify succeeded with tampered signature");
ck_assert_msg(err.code == CJOSE_ERR_CRYPTO, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code, err.message);
cjose_jws_release(jws_ts);
static const char *<API key>
= "<API key>.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfq."
"<API key>0Qc_lF5YKt_"
"<API key><API key>"
"<API key>-"
"eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw";
cjose_jws_t *jws_tc = cjose_jws_import(<API key>, strlen(<API key>), &err);
ck_assert_msg(NULL != jws_tc, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
ck_assert_msg(!cjose_jws_verify(jws_tc, jwk, &err), "cjose_jws_verify succeeded with tampered content");
ck_assert_msg(err.code == CJOSE_ERR_CRYPTO, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code, err.message);
cjose_jws_release(jws_tc);
cjose_jwk_release(jwk);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
static const char *JWS = "<API key>."
"eyJzdWIiOiJqb2UiLCJhdWQiOiJhY19vaWNfY2xpZW50IiwianRpIjoiZmp1cXJDMGlmand0MTVjdEE3dWJEOCIsImlzcyI6Imh0d"
"HBzOlwvXC9sb2NhbGhvc3Q6OTAzMSIsImlhdCI6MTQ2ODgyODIwNiwiZXhwIjoxNDY4ODI4NTA2LCJub25jZSI6ImpVSmZDeHZ0cG"
"<API key>.<API key>"
"<API key><API key>"
"<API key><API key>-"
"<API key><API key>"
"dHgNasVXa2bQ";
cjose_jws_t *jws = cjose_jws_import(JWS, strlen(JWS), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *JWK
= "{ \"kty\":\"RSA\","
"\"n\":\"u-kRzaNkYQXZWtfADCiOC_uGl1Fti_dolgzJgaZdOVpAE4zXbOgfJzm9wQK3IY7K1kFMD7p1bjamWXPOKgKKzqQwdLUOnq-"
"<API key><API key>"
"O89uqzGn2ZeVFdMPEpdaJCndpuW_zj6jDBFcOlkn6IC_O9UxQH9aEtctkaVdhB5Zw2mP5DWf81f8v8XfScrqn2IVtNcbBWPnHDcRSZPXx1vuN9T083w8_"
"<API key>\","
"\"e\":\"AQAB\" }";
// import the key
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// verify the deserialized JWS
ck_assert_msg(cjose_jws_verify(jws, jwk, &err), "cjose_jws_verify failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// get the verified plaintext
uint8_t *plain = NULL;
size_t plain_len = 0;
ck_assert_msg(<API key>(jws, &plain, &plain_len, &err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *PLAINTEXT
= "{\"sub\":\"joe\",\"aud\":\"ac_oic_client\",\"jti\":\"<API key>\",\"iss\":\"https:\\/\\/"
"localhost:9031\",\"iat\":1468828206,\"exp\":1468828506,\"nonce\":\"<API key>\"}";
// confirm plain == PLAINTEXT
ck_assert_msg(plain_len == strlen(PLAINTEXT), "length of verified plaintext does not match length of original, "
"expected: %lu, found: %lu",
strlen(PLAINTEXT), plain_len);
ck_assert_msg(strncmp(PLAINTEXT, plain, plain_len) == 0, "verified plaintext does not match signed plaintext: %s", plain);
cjose_jwk_release(jwk);
cjose_jws_release(jws);
}
END_TEST
START_TEST(<API key>)
{
cjose_err err;
static const char *JWS = "<API key>."
"eyJzdWIiOiJqb2UiLCJhdWQiOiJhY19vaWNfY2xpZW50IiwianRpIjoiZGV0blVpU2FTS0lpSUFvdHZ0ZzV3VyIsImlzcyI6Imh0d"
"HBzOlwvXC9sb2NhbGhvc3Q6OTAzMSIsImlhdCI6MTQ2OTAzMDk1MCwiZXhwIjoxNDY5MDMxMjUwLCJub25jZSI6Im8zNU8wMi1WM0"
"<API key>.<API key>"
"<API key>";
cjose_jws_t *jws_ok = cjose_jws_import(JWS, strlen(JWS), &err);
ck_assert_msg(NULL != jws_ok, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *JWK = "{ \"kty\": \"EC\","
"\"kid\": \"h4h93\","
"\"use\": \"sig\","
"\"x\": \"<API key>\","
"\"y\": \"<API key>\","
"\"crv\": \"P-256\" }";
// import the key
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// verify the deserialized JWS
ck_assert_msg(cjose_jws_verify(jws_ok, jwk, &err), "cjose_jws_verify failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// get the verified plaintext
uint8_t *plain = NULL;
size_t plain_len = 0;
ck_assert_msg(<API key>(jws_ok, &plain, &plain_len, &err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *PLAINTEXT
= "{\"sub\":\"joe\",\"aud\":\"ac_oic_client\",\"jti\":\"<API key>\",\"iss\":\"https:\\/\\/"
"localhost:9031\",\"iat\":1469030950,\"exp\":1469031250,\"nonce\":\"<API key>\"}";
// confirm plain == PLAINTEXT
ck_assert_msg(plain_len == strlen(PLAINTEXT), "length of verified plaintext does not match length of original, "
"expected: %lu, found: %lu",
strlen(PLAINTEXT), plain_len);
ck_assert_msg(strncmp(PLAINTEXT, plain, plain_len) == 0, "verified plaintext does not match signed plaintext: %s", plain);
cjose_jws_release(jws_ok);
static const char *JWS_TAMPERED_SIG = "<API key>."
"eyJzdWIiOiJqb2UiLCJhdWQiOiJhY19vaWNfY2xpZW50IiwianRpIjoiZGV0blVpU2FTS0lpSUFvdHZ0ZzV3VyIs"
"ImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTAzMSIsImlhdCI6MTQ2OTAzMDk1MCwiZXhwIjoxNDY5MDMxMjUw"
"<API key>.o9bb_yW6-"
"<API key>";
cjose_jws_t *jws_ts = cjose_jws_import(JWS_TAMPERED_SIG, strlen(JWS_TAMPERED_SIG), &err);
ck_assert_msg(NULL != jws_ts, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
ck_assert_msg(!cjose_jws_verify(jws_ts, jwk, &err), "cjose_jws_verify succeeded with tampered signature");
ck_assert_msg(err.code == CJOSE_ERR_CRYPTO, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code, err.message);
cjose_jws_release(jws_ts);
static const char *<API key>
= "<API key>."
"eyJzdWIiOiJqb2UiLCJhdWQiOiJhY19vaWNfY2xpZW50IiwianRpIjoiZGV0blVpU2FTS0lpSUFvdHZ0ZzV3VyIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhv"
"c3Q6OTAzMSIsImlhdCI6MTQ2OTAzMDk1MCwiZXhwIjoxNDY5MDMxMjUwLCJub25jZSI6Im8zNU8wMi1WM0poSXJ1SkdHSlZVOGpUUGG2LUhKUTgzWEpmQXBZ"
"TGtrZHcifQ.<API key><API key>";
cjose_jws_t *jws_tc = cjose_jws_import(<API key>, strlen(<API key>), &err);
ck_assert_msg(NULL != jws_tc, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
ck_assert_msg(!cjose_jws_verify(jws_tc, jwk, &err), "cjose_jws_verify succeeded with tampered content");
ck_assert_msg(err.code == CJOSE_ERR_CRYPTO, "cjose_jws_verify returned wrong err.code (%zu:%s)", err.code, err.message);
cjose_jws_release(jws_tc);
cjose_jwk_release(jwk);
}
END_TEST
START_TEST(test_cjose_jws_none)
{
cjose_err err;
// https://tools.ietf.org/html/rfc7519#section-6.1
// Unsecured JWT (alg=none)
static const char *JWS = "eyJhbGciOiJub25lIn0"
".eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ"
".";
cjose_jws_t *jws = cjose_jws_import(JWS, strlen(JWS), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *JWK = "{ \"kty\": \"EC\","
"\"kid\": \"h4h93\","
"\"use\": \"sig\","
"\"x\": \"<API key>\","
"\"y\": \"<API key>\","
"\"crv\": \"P-256\" }";
// import the key
cjose_jwk_t *jwk = cjose_jwk_import(JWK, strlen(JWK), &err);
ck_assert_msg(NULL != jwk, "cjose_jwk_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// get the plaintext
uint8_t *plain = NULL;
size_t plain_len = 0;
ck_assert_msg(<API key>(jws, &plain, &plain_len, &err), "<API key> failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
static const char *PLAINTEXT = "{\"iss\":\"joe\",\r\n"
" \"exp\":1300819380,\r\n"
" \"http://example.com/is_root\":true}";
// confirm plain == PLAINTEXT
ck_assert_msg(plain_len == strlen(PLAINTEXT), "length of verified plaintext does not match length of original, "
"expected: %lu, found: %lu",
strlen(PLAINTEXT), plain_len);
ck_assert_msg(strncmp(PLAINTEXT, plain, plain_len) == 0, "verified plaintext does not match signed plaintext: %s", plain);
// try to verify the unsecured JWS
ck_assert_msg(!cjose_jws_verify(jws, jwk, &err), "cjose_jws_verify succeeded for unsecured JWT");
cjose_jws_release(jws);
jws = cjose_jws_import(JWS, strlen(JWS), &err);
ck_assert_msg(NULL != jws, "cjose_jws_import failed: "
"%s, file: %s, function: %s, line: %ld",
err.message, err.file, err.function, err.line);
// try to sign the unsecured JWS
ck_assert_msg(!cjose_jws_sign(jwk, (cjose_header_t *)jws->hdr, PLAINTEXT, strlen(PLAINTEXT), &err),
"cjose_jws_sign succeeded for unsecured JWT");
cjose_jws_release(jws);
cjose_jwk_release(jwk);
}
END_TEST
Suite *cjose_jws_suite()
{
Suite *suite = suite_create("jws");
TCase *tc_jws = tcase_create("core");
tcase_set_timeout(tc_jws, 120.0);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, <API key>);
tcase_add_test(tc_jws, test_cjose_jws_none);
suite_add_tcase(suite, tc_jws);
return suite;
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>web-ssh</title>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="index.css" rel="stylesheet" type="text/css" />
<script src="/socket.io/socket.io.js"></script>
<script src="index.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="form-group col-sm-6">
<select class="form-control" id="list">
</select>
</div>
<div class="form-group col-sm-6">
<select class="form-control" id="data">
</select>
</div>
<div class="form-group col-sm-4">
<input type="text" class="form-control" placeholder="Host" id="host">
</div>
<div class="form-group col-sm-4">
<input type="text" class="form-control" placeholder="User" id="user">
</div>
<div class="form-group col-sm-4">
<input type="password" class="form-control" placeholder="Pass" id="pass">
</div>
</div>
<div class="col-sm-12">
<div class="form-group col-sm-6">
<div class="form-group col-sm-12 padding0">
<textarea class="form-control" rows="4" id="command"></textarea>
</div>
<button type="button" class="btn btn-success" id="add">Add</button>
<button type="button" class="btn btn-success" id="save">Save</button>
<button type="button" class="btn btn-warning" id="up">Up</button>
<button type="button" class="btn btn-warning" id="down">Down</button>
<button type="button" class="btn btn-warning" id="rename">Rename</button>
<button type="button" class="btn btn-danger" id="remove">Remove</button>
<button type="button" class="btn btn-primary" id="run">Run</button>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-12 padding0 parameter">
<textarea class="form-control" rows="4" id="parameter"></textarea>
</div>
<button type="button" class="btn btn-success" id="add2">Add</button>
<button type="button" class="btn btn-success" id="save2">Save</button>
<button type="button" class="btn btn-warning" id="up2">Up</button>
<button type="button" class="btn btn-warning" id="down2">Down</button>
<button type="button" class="btn btn-warning" id="rename2">Rename</button>
<button type="button" class="btn btn-danger" id="remove2">Remove</button>
<button type="button" class="btn btn-info right" id="toggleConsole">Hide Console</button>
</div>
<div class="form-group col-sm-12">
<div class="console"></div>
</div>
</div>
</div>
</div>
</body>
</html> |
<?php namespace Anomaly\PostsModule\Post\Contract;
use Anomaly\PostsModule\Category\Contract\CategoryInterface;
use Anomaly\PostsModule\Type\Contract\TypeInterface;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
use Carbon\Carbon;
use Symfony\Component\HttpFoundation\Response;
interface PostInterface extends EntryInterface
{
/**
* Make the post.
*
* @return $this
*/
public function make();
/**
* Return the post content.
*
* @return null|string
*/
public function content();
/**
* Get the string ID.
*
* @return string
*/
public function getStrId();
/**
* Get the tags.
*
* @return array
*/
public function getTags();
/**
* Get the slug.
*
* @return string
*/
public function getSlug();
/**
* Get the type.
*
* @return null|TypeInterface
*/
public function getType();
/**
* Get the type name.
*
* @return string
*/
public function getTypeName();
/**
* Get the type description.
*
* @return string
*/
public function getTypeDescription();
/**
* Get the category.
*
* @return null|CategoryInterface
*/
public function getCategory();
/**
* Get the related entry.
*
* @return EntryInterface
*/
public function getEntry();
/**
* Get the related entry's ID.
*
* @return null|int
*/
public function getEntryId();
/**
* Get the meta title.
*
* @return string
*/
public function getMetaTitle();
/**
* Get the meta keywords.
*
* @return array
*/
public function getMetaKeywords();
/**
* Get the meta description.
*
* @return string
*/
public function getMetaDescription();
/**
* Return the publish at date.
*
* @return Carbon
*/
public function getPublishAt();
/**
* Alias for getPublishAt()
*
* @return Carbon
*/
public function getDate();
/**
* Return if the post is live or not.
*
* @return bool
*/
public function isLive();
/**
* Get the enabled flag.
*
* @return bool
*/
public function isEnabled();
/**
* Get the path to the post's type layout.
*
* @return string
*/
public function getLayoutViewPath();
/**
* Get the content.
*
* @return null|string
*/
public function getContent();
/**
* Set the content.
*
* @param $content
* @return $this
*/
public function setContent($content);
/**
* Get the response.
*
* @return Response|null
*/
public function getResponse();
/**
* Set the response.
*
* @param $response
* @return $this
*/
public function setResponse(Response $response);
} |
namespace Beekeeper.Web.Areas.User.ViewModels.Honeycomb
{
using System.Collections.Generic;
using Data.Models;
using Infrastructure.Mapping;
using Services.Web;
public class <API key> : IMapFrom<Honeycomb>
{
public int Id { get; set; }
public int SuperId { get; set; }
public int Number { get; set; }
public double Area { get; set; }
public double Honey { get; set; }
public double Pollen { get; set; }
public double Brood { get; set; }
public virtual ICollection<<API key>> Reports { get; set; }
public string Encode(int id)
{
IIdentifierProvider provider = new IdentifierProvider();
return provider.EncodeId(id);
}
}
} |
$(function(){
try{
var flashMsg = localStorage.getItem("flashMsg");
//flash Msg store in localstorage.flashMsg
if( flashMsg != undefined && flashMsg.length){
$.bootstrapGrowl( flashMsg,{type: 'error'});
localStorage.setItem("flashMsg","");
}
if( ! $().POSsetting ){
$.bootstrapGrowl("Init jquery error: setting.js didn't loaded",{type: 'error'});
}
if( ! $().POScustomer ){
$.bootstrapGrowl("Init jquery error: customer.js didn't loaded",{type: 'error'});
}
if( ! $().POSmenu ){
$.bootstrapGrowl("Init jquery error: menu.js didn't loaded",{type: 'error'});
}
var setting = $().POSsetting();
var websql = $().POSwebsql();
var customer = $( "#UI-customer" ).POScustomer();
var menu = $( "#UI-menu" ).POSmenu();
initialized( setting.info );
attachHandler();
//info: [obj]
//load bussiness info into prepared setted html Doms
function initialized( info ){
$.each( info , function( key , value ){
if( $(".bussiness-"+key ).length ){
$(".bussiness-"+key ).empty().append( value );
}//End of if
});//End of each info pro
var menu_panel = $('#UI-menu .panel-body');
menu_panel.css('height', ($( window ).height() - menu_panel.offset().top - 10 )+'px');
setTimeout(function() {
if( $(".tour-backdrop.in").length == 0){
$("#demo-tour").hide()
}
}, 1000 * 60 * 5);
}//end initialized
//attach custom event handler
function attachHandler(){
//Event Handler: when user choose menu
//1. use itemId to get OrderItem detail
//2. call customer handler addOrder( orderItem )
$(document).on("click", ".dish", function(){
var result = customer.selectMenu( $(this).data("item") );
});
//attach Your other custome type hanlder here
$(document).on("click", ".extraName, .extra img", function(){
var thisTr = $(this).closest("tr");
var item = thisTr.data("item");
var result = customer.selectMenu( item );
});
$("#demo-tour").tour({
storage : true,
skip : true,
items : [
{
title: "Header Page",
content: "<p>You can <b>add</b> and <b>edit</b> these context in /assets/script/setting.js variable <b>setting.info</b><p>\
Just create property in setting.info, then add HTML element in index.html with class=\"bussiness-[property name]\"",
id: ".bussiness",
placement: "bottom",
onShow : function(){
$(".menu_clearSearch").trigger("click");
}
},
{
title: "Menu Tab",
content: "Here is menu module, all codes control this module is in /assets/script/menu/menu.js",
id: "#UI-menu",
placement: "top"
},
{
title: "Current Category Label",
content: "This is showing the Current Category|Menu",
id: ".menu_disLabel",
placement: "right"
},
{
title: "Result Count Label",
content: "Display How Many items the Current Category|Menu have",
id: ".menu_cnt",
placement: "left"
},
{
title: "Text Filter",
content: "Display ANY Category & items that have these key word",
id: ".menu_searchItem",
placement: "top",
onShown : function(){
var keyword = ["d","do","don","donut"];
$(keyword).each(function(index){
var w = this;
setTimeout(function() {
$(".menu_searchItem").val( w ).trigger("input");
}, index * 100);//end timeout
});//end each
}
},
{
title: "Return Main Menu",
content: "Click this button to return default Menu",
id: ".menu_clearSearch",
placement: "top",
delay: 500,
onShow : function(){
$(".menu_clearSearch").trigger("click");
}
},
{
title: "Category",
content: "This is a Category button, click it to look for items within this Category.",
id: ".category td",
placement: "top",
},
{
title: "Items",
content: "This is a item within selected Category. <b>Click</b> item to add to customer cart.",
id: ".dish td",
placement: "top",
onShow : function(){
if( !$(".category").length){
$(".menu_clearSearch").trigger("click");
}
$(".category").trigger("click");
}
},
{
title: "Notification",
content: "When you added item to cart, there is a green notification",
id: ".bootstrap-growl.alert",
placement: "bottom",
onShow : function(){
$(".dish:first").trigger("click");
}
},
{
title: "Customer Tab",
content: "This is Customer module, all codes control this module is in /assets/script/customer/customer.js",
id: "#UI-customer",
placement: "top"
},
{
title: "Current Customer",
content: "This is Current Customer Tab, Click other Customer Tabs to switch between different customers",
id: "#UI-customer .nav-tabs li.active a",
placement: "bottom",
},
{
title: "Customer Info",
content: "Enter Customer Info, there will be auto suggestion from existed Customer Database.<br>\
Use <b>Phone</b> or <b>Address</b> to selecte existed customer",
id: "#UI-customer .custInfo.active .cust_summary .span7",
placement: "top",
onShown : function(){
$('#UI-customer .custInfo.active .cust_summary .span7 .custName').autocomplete("search");
}
},
{
title: "Google phone number",
content: "Click the icon to search Phone Number in google",
id: "#UI-customer .custInfo.active .cust_summary .googlePhone",
placement: "bottom"
},
{
title: "Google Map",
content: "Click the icon to get direction in Google Map",
id: "#UI-customer .custInfo.active .cust_summary .getGoogleMap",
placement: "bottom"
},
{
title: "Customer Bill",
content: "Here is Bill Summary for this customer",
id: "#UI-customer .custInfo.active .cust_summary .span5",
placement: "top",
},
{
title: "Order Cart",
content: "Here is order cart of this customer",
id: "#UI-customer .custInfo.active .customerOrder",
placement: "top",
},
{
title: "Order Item",
content: "Here is one of item this customer order",
id: "#UI-customer .custInfo.active .customerOrder .orderItem td",
placement: "top",
},
{
title: "Item Action",
content: "<p>Here is all the actions avaiable for this item.</p><p>Click the <b>yellow</b> action icon to change this item.</p>",
id: "#UI-customer .custInfo.active .customerOrder .orderItem td .orderItem_setting",
placement: "bottom",
},
{
title: "Open Action Panel",
content: "This is Action Panel for that Item",
id: "#myModal.in",
placement: "bottom",
delay: 500,
onShow: function(){
$("#UI-customer .custInfo.active .customerOrder .orderItem td .orderItem_setting:first").trigger("click");
}
},
{
title: "Close Action Panel",
content: "Click Cancel or Confirm when you are done",
id: "#myModal.in .modal-header button.close",
placement: "right",
onShown: function(){
setTimeout(function () {
$(".modal-header .close").trigger("click");
}, 2000);
}
},
{
title: "Confirm Order",
content: "When customer ready, click it to save customer order",
id: "#UI-customer .custInfo.active .action-confirm",
placement: "bottom"
},
{
title: "Reports",
content: "Choose the report you want, or go to manager customer page to update/search/remove customer info",
id: ".reports",
placement: "bottom"
},
{
title: "Contact Me?",
content: '<p>You could go to <a href="http:
id: "#demo-tour",
placement: "bottom"
}
]
});
}//end attachHandler
}catch(erro){
console.log(erro.stack);
localStorage.setItem("flashMsg", "Page Reloaded due to Javascript Erro<hr>Last Erro Message<br>: "+erro.message );
setTimeout(function() {
location.reload();
}, 5000);
}//end catch
});
console.log("default js loaded"); |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>sum-of-two-square: Not compatible </title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / extra-dev</a></li>
<li class="active"><a href="">dev / sum-of-two-square - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
sum-of-two-square
<small>
8.10.0
<span class="label label-info">Not compatible </span>
</small>
</h1>
<p> <em><script>document.write(moment("2021-12-16 03:29:46 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-16 03:29:46 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 3 Virtual package relying on a GMP lib system installation
coq dev Formal proof management system
dune 2.9.1 Fast, portable, and opinionated build system
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
<API key> 4.08.1-1 OCaml 4.08.1 Secondary Switch Compiler
ocamlfind 1.9.1 A library manager for OCaml
ocamlfind-secondary 1.9.1 Adds support for <API key> to ocamlfind
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/sum-of-two-square"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/SumOfTwoSquare"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: number theory"
"category: Mathematics/Arithmetic and Number Theory/Number theory"
"date: 2004-12-13"
]
authors: [
"Laurent Thery"
]
bug-reports: "https://github.com/coq-contribs/sum-of-two-square/issues"
dev-repo: "git+https://github.com/coq-contribs/sum-of-two-square.git"
synopsis: "Numbers equal to the sum of two square numbers"
description: """
A proof that a number n can be written as the
sum of two square numbers if and only if each prime factor p of n
that is equal to 3 modulo 4 has its exponent in the decomposition of n
that is even."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/sum-of-two-square/archive/v8.10.0.tar.gz"
checksum: "md5=<API key>"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install </h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action <API key>.8.10.0 coq.dev</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is dev).
The following dependencies couldn't be met:
- <API key> -> coq < 8.11~ -> ocaml < 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base <API key>.8.10.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install </h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https:
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html> |
<?php
/* @Twig/Exception/exception_full.html.twig */
class <API key> extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
$this->parent = $this->loadTemplate("@Twig/layout.html.twig", "@Twig/Exception/exception_full.html.twig", 1);
$this->blocks = array(
'head' => array($this, 'block_head'),
'title' => array($this, 'block_title'),
'body' => array($this, 'block_body'),
);
}
protected function doGetParent(array $context)
{
return "@Twig/layout.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$<API key> = $this->env->getExtension("native_profiler");
$<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "template", "@Twig/Exception/exception_full.html.twig"));
$this->parent->display($context, array_merge($this->blocks, $blocks));
$<API key>->leave($<API key>);
}
// line 3
public function block_head($context, array $blocks = array())
{
$<API key> = $this->env->getExtension("native_profiler");
$<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "head"));
// line 4
echo " <link href=\"";
echo twig_escape_filter($this->env, $this->env->getExtension('request')->generateAbsoluteUrl($this->env->getExtension('asset')->getAssetUrl("bundles/framework/css/exception.css")), "html", null, true);
echo "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />
";
$<API key>->leave($<API key>);
}
// line 7
public function block_title($context, array $blocks = array())
{
$<API key> = $this->env->getExtension("native_profiler");
$<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "title"));
// line 8
echo " ";
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "message", array()), "html", null, true);
echo " (";
echo twig_escape_filter($this->env, (isset($context["status_code"]) ? $context["status_code"] : $this->getContext($context, "status_code")), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, (isset($context["status_text"]) ? $context["status_text"] : $this->getContext($context, "status_text")), "html", null, true);
echo ")
";
$<API key>->leave($<API key>);
}
// line 11
public function block_body($context, array $blocks = array())
{
$<API key> = $this->env->getExtension("native_profiler");
$<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "body"));
// line 12
echo " ";
$this->loadTemplate("@Twig/Exception/exception.html.twig", "@Twig/Exception/exception_full.html.twig", 12)->display($context);
$<API key>->leave($<API key>);
}
public function getTemplateName()
{
return "@Twig/Exception/exception_full.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 78 => 12, 72 => 11, 58 => 8, 52 => 7, 42 => 4, 36 => 3, 11 => 1,);
}
}
/* {% extends '@Twig/layout.html.twig' %}*/
/* {% block head %}*/
/* <link href="{{ absolute_url(asset('bundles/framework/css/exception.css')) }}" rel="stylesheet" type="text/css" media="all" />*/
/* {% endblock %}*/
/* {% block title %}*/
/* {{ exception.message }} ({{ status_code }} {{ status_text }})*/
/* {% endblock %}*/
/* {% block body %}*/
/* {% include '@Twig/Exception/exception.html.twig' %}*/
/* {% endblock %}*/ |
using CGM.Communication.Extensions;
using CGM.Communication.MiniMed;
using System;
using System.Collections.Generic;
using System.Text;
namespace CGM.Communication.Common
{
//[Serializable]
//public class ApplicationSetting
// public int SettingId { get; set; } = 1;
// public bool AutoStartTask { get; set; } = true;
} |
import React from 'react';
import { shallow } from 'enzyme';
import { expect } from 'chai';
import { Film } from '../Film';
describe('<Film />', () => {
it('should have a class .film', () => {
const props = {
films: {
detail: {
title: 'A New Hope'
}
}
};
expect(shallow(<Film {...props} />).is('.film')).to.equal(true);
});
}); |
require 'cgi'
require 'multi_json'
require 'excon'
require 'tempfile'
require 'base64'
require 'find'
require 'rubygems/package'
require 'uri'
require 'open-uri'
# Add the Hijack middleware at the top of the middleware stack so it can
# potentially hijack HTTP sockets (when attaching to stdin) before other
# middlewares try and parse the response.
require 'excon/middlewares/hijack'
Excon.defaults[:middlewares].unshift Excon::Middleware::Hijack
Excon.defaults[:middlewares] << Excon::Middleware::RedirectFollower
# The top-level module for this gem. Its purpose is to hold global
# configuration variables that are used as defaults in other classes.
module Docker
attr_accessor :creds, :logger
require 'docker/error'
require 'docker/connection'
require 'docker/base'
require 'docker/container'
require 'docker/network'
require 'docker/event'
require 'docker/exec'
require 'docker/image'
require 'docker/messages_stack'
require 'docker/messages'
require 'docker/util'
require 'docker/version'
require 'docker/volume'
require 'docker/rake_task' if defined?(Rake::Task)
def default_socket_url
'unix:///var/run/docker.sock'
end
def env_url
ENV['DOCKER_URL'] || ENV['DOCKER_HOST']
end
def env_options
if cert_path = ENV['DOCKER_CERT_PATH']
{
client_cert: File.join(cert_path, 'cert.pem'),
client_key: File.join(cert_path, 'key.pem'),
ssl_ca_file: File.join(cert_path, 'ca.pem'),
scheme: 'https'
}.merge(ssl_options)
else
{}
end
end
def ssl_options
if ENV['DOCKER_SSL_VERIFY'] == 'false'
{
ssl_verify_peer: false
}
else
{}
end
end
def url
@url ||= env_url || default_socket_url
# docker uses a default notation tcp:// which means tcp://localhost:2375
if @url == 'tcp:
@url = 'tcp://localhost:2375'
end
@url
end
def options
@options ||= env_options
end
def url=(new_url)
@url = new_url
reset_connection!
end
def options=(new_options)
@options = env_options.merge(new_options || {})
reset_connection!
end
def connection
@connection ||= Connection.new(url, options)
end
def reset!
@url = nil
@options = nil
reset_connection!
end
def reset_connection!
@connection = nil
end
# Get the version of Go, Docker, and optionally the Git commit.
def version(connection = self.connection)
Util.parse_json(connection.get('/version'))
end
# Get more information about the Docker server.
def info(connection = self.connection)
Util.parse_json(connection.get('/info'))
end
# Ping the Docker server.
def ping(connection = self.connection)
connection.get('/_ping')
end
# Login to the Docker registry.
def authenticate!(options = {}, connection = self.connection)
creds = MultiJson.dump(options)
connection.post('/auth', {}, body: creds)
@creds = creds
true
rescue Docker::Error::ServerError, Docker::Error::UnauthorizedError
raise Docker::Error::AuthenticationError
end
# When the correct version of Docker is installed, returns true. Otherwise,
# raises a VersionError.
def validate_version!
Docker.info
true
rescue Docker::Error::TimeoutError
raise
rescue Docker::Error::DockerError
raise Docker::Error::VersionError, "Expected API Version: #{API_VERSION}"
end
module_function :default_socket_url, :env_url, :url, :url=, :env_options,
:options, :options=, :creds, :creds=, :logger, :logger=,
:connection, :reset!, :reset_connection!, :version, :info,
:ping, :authenticate!, :validate_version!, :ssl_options
end |
using UnityEngine;
using System.Collections;
public class AICarTouches : MonoBehaviour {
// Use this for initialization
void Start () {
}
void OnCollisionEnter(Collision col)
{
if (col.gameObject.name == "Score_Cube")
{
Destroy(col.gameObject);
}
else if (col.gameObject.name == "DEATH")
{
Destroy(col.gameObject);
}
}
// Update is called once per frame
void Update () {
}
} |
var _ = require('underscore'),
debug = require('./debug')('pulldasher:db-manager'),
utils = require('./utils'),
Promise = require('bluebird'),
db = require('../lib/db'),
DBIssue = require('../models/db_issue'),
DBStatus = require('../models/db_status'),
DBSignature = require('../models/db_signature'),
DBComment = require('../models/db_comment'),
DBReview = require('../models/db_review'),
DBLabel = require('../models/db_label'),
Pull = require('../models/pull'),
Issue = require('../models/issue'),
Status = require('../models/status'),
Signature = require('../models/signature'),
Comment = require('../models/comment'),
Review = require('../models/review'),
Label = require('../models/label'),
queue = require('../lib/pull-queue');
var dbManager = module.exports = {
/**
* Takes a Pull object and returns a promise that resolves when the db and
* client have been updated with the new pull data.
*/
updatePull: function(pull) {
return pull.update();
},
/**
* Takes in a Pull object, deletes, then resaves the pull and *all* the
* related data (comments, commit statuses, signatures) and returns a
* Promise that resolves when it's completed.
*
* Note: pauses the pull queue while it's happening so we dont' send
* hundreds of updates to the client.
*/
updateAllPullData: function updateAllPullData(pull) {
queue.pause();
return dbManager.updatePull(pull).then(function() {
var updates = [];
if (pull.commitStatuses) {
pull.commitStatuses.forEach(status => {
updates.push(dbManager.updateCommitStatus(status));
});
}
updates.push(
// Delete all signatures related to this pull from the DB
// before we rewrite them to avoid duplicates.
dbManager.deleteSignatures(pull.data.repo, pull.data.number).then(function() {
pull.signatures.sort(Signature.compare);
return dbManager.insertSignatures(pull.signatures);
})
);
pull.comments.forEach(function(comment) {
updates.push(
dbManager.updateComment(comment)
);
});
pull.reviews.forEach(function(review) {
updates.push(
dbManager.updateReview(review)
);
});
updates.push(
dbManager.deleteLabels(pull.data.repo, pull.data.number).then(function() {
return dbManager.insertLabels(pull.data.repo, pull.labels, pull.data.number);
})
);
return Promise.all(updates)
.then(function() {
queue.markPullAsDirty(pull.data.repo, pull.data.number);
queue.resume();
});
});
},
/**
* Returns a promise that resolves when the db
* has been updated with the new issue data.
*/
updateIssue: function(updatedIssue) {
debug('Calling `updateIssue` for issue #%s', updatedIssue.number);
var dbIssue = new DBIssue(updatedIssue);
return dbIssue.save();
},
/**
* Takes in an Issue object, deletes, then resaves the issue and *all* the
* related data (labels) and returns a
* Promise that resolves when it's completed.
*/
updateAllIssueData: function updateAllIssueData(issue) {
return dbManager.updateIssue(issue).then(
function() {
return dbManager.deleteLabels(issue.repo, issue.number);
}).then(function() {
return dbManager.insertLabels(issue.repo,
issue.labels, issue.number, /* isIssue */ true);
});
},
/**
* Inserts a commit status into the DB. Takes a Status object as an
* argument.
*/
updateCommitStatus: function(updatedStatus) {
debug('Calling `updateCommitStatus` for commit %s in repo %s and context %s',
updatedStatus.data.sha, updatedStatus.data.repo, updatedStatus.data.context);
var dbStatus = new DBStatus(updatedStatus);
return dbStatus.save().
then(() => this.<API key>(updatedStatus.data.repo, updatedStatus.data.sha)).
then(function(pullNumber) {
// `pullNumber` will be null if we are updating the build status of a commit
// which is no longer a pull's head commit.
if (pullNumber === null) {
debug('updateCommitStatus: commit %s is not the HEAD of any pull, none to refresh in repo %s',
updatedStatus.data.sha, updatedStatus.data.repo);
return;
}
queue.markPullAsDirty(dbStatus.data.repo, pullNumber);
debug('updateCommitStatus: updated status of Pull #%s in repo %s',
pullNumber, dbStatus.data.repo);
});
},
updateCommitCheck: function(body) {
let repo = body.repository.full_name;
let sha = body.check_run.head_sha;
let state = utils.mapCheckToStatus(body.check_run.conclusion || body.check_run.status);
let desc = state;
let url = body.check_run.html_url;
let context = body.check_run.name;
debug('Calling `updateCommitCheck for commit %s in repo %s and context %s',
sha, repo, context);
let status = new Status({
repo: repo,
sha: sha,
state: state,
description: desc,
target_url: url,
context: context,
});
var dbStatus = new DBStatus(status);
return dbStatus.save()
.then(() => this.<API key>(repo, sha))
.then(function(pullNumber) {
if (pullNumber === null) {
debug('updateCommitCheck: commit %s is not the HEAD of any pull, none to refresh in repo %s',
sha, repo);
return;
}
queue.markPullAsDirty(repo, pullNumber);
debug('updateCommitCheck: updated status of Pull #%s in repo %s',
pullNumber, repo);
});
},
/**
* Insert a comment into the database, or update the row if
* it already exists.
*/
updateComment: function(comment) {
debug('Calling `updateComment` for comment %s in repo %s',
comment.data.comment_id, comment.data.repo);
var dbComment = new DBComment(comment);
var number = dbComment.data.number;
var repo = dbComment.data.repo;
return dbComment.save().
then(function() {
queue.markPullAsDirty(repo, number);
debug('updateComment: updated comment(%s) on Pull #%s in repo %s',
dbComment.data.comment_id, number, repo);
});
},
/**
* Insert a review into the database, or update the row if
* it already exists.
*/
updateReview: function(review) {
debug('Calling `updateReview` for review %s in repo %s',
review.data.review_id, review.data.repo);
var dbReview = new DBReview(review);
var number = dbReview.data.number;
var repo = dbReview.data.repo;
return dbReview.save().
then(function() {
queue.markPullAsDirty(repo, number);
debug('updateReview: updated review(%s) on Pull #%s in repo %s',
dbReview.data.review_id, number, repo);
});
},
/**
* Insert a signature into the database, invalidate any appropriate old
* signatures, and return a promise that resolves when both of those
* DB writes are complete.
*/
insertSignature: function(signature) {
debug('Calling insertSignature for pull #%s in repo %s',
signature.data.number, signature.data.repo);
var dbSignature = new DBSignature(signature);
var repo = dbSignature.data.repo;
var number = dbSignature.data.number;
var type = dbSignature.data.type;
// Create a default promise for cases where it is not necessary
// for us to invalidate any signatures.
var invalidate = Promise.resolve();
// Invalidate older signatures in certain cases.
switch (type) {
case 'un_dev_block':
invalidate = this.<API key>(repo, number, ['dev_block']);
break;
case 'un_deploy_block':
invalidate = this.<API key>(repo, number, ['deploy_block']);
break;
}
return invalidate.then(function() {
debug('insertSignature: saving %s(%s) on Pull #%s in repo %s',
type, signature.data.comment_id, number, repo);
return dbSignature.save();
});
},
/**
* Insert an array of signatures into the database (one at a time, in order)
* and update the view upon completion.
*/
insertSignatures: function(signatures) {
if (!signatures.length) {
return Promise.resolve();
}
var self = this;
// Wait for each call to `insertSignature` to resolve before calling again.
var signaturesSaved = signatures.reduce(function(prevSignature, sig) {
return prevSignature.then(function() {
return self.insertSignature(sig);
});
}, Promise.resolve());
var number = signatures[0].data.number;
var repo = signatures[0].data.repo;
// After all signatures are added to DB, update view.
return signaturesSaved.then(function() {
queue.markPullAsDirty(repo, number);
});
},
/**
* Insert a single label into the DB.
*/
insertLabel: function(label) {
debug("Calling insertLabel for label '%s' on pull #%s in repo %s",
label.data.title, label.data.number, label.data.repo);
var dbLabel = new DBLabel(label);
return dbLabel.save();
},
/**
* Insert an array of (github) labels into the database.
*/
insertLabels: function(repo, labels, number, isIssue) {
var labelsSaved = labels.map(this.insertLabel.bind(this));
return Promise.all(labelsSaved).then(function() {
if (!isIssue) {
queue.markPullAsDirty(repo, number);
}
});
},
/**
* Invalidates signatures with the given number and one of the given types.
* Returns a promise that resolves when the DB write is finished.
*
* @param number - pull number
* @param types - array of types to invalidate
*/
<API key>: function(repo, number, types) {
debug('Calling <API key> for pull #%s in repo %s', number,
repo);
var q_update = '\
UPDATE pull_signatures \
SET active = 0 \
WHERE repo = ? AND number = ? AND type IN ?';
return db.query(q_update, [repo, number, [types]]).
then(function() {
debug('<API key>: invalidated %ss on Pull #%s in repo %s',
types, number, repo);
});
},
/**
* Returns a promise which resolves to a Pull object for the given pull
* number built from data stored in the database.
*/
getPull: function(repo, number) {
debug('Calling getPull for pull #%s in repo %s', number, repo);
var self = this;
var q_select = '\
SELECT * FROM pulls \
WHERE number = ? AND repo = ?';
return db.query(q_select, [number, repo]).then(function(rows) {
if (rows.length === 0) { return null; }
var dbPullData = rows[0];
var signatures = self.getAllSignatures(repo, number);
var comments = self.getComments(repo, number);
var commitStatuses = self.getCommitStatuses(repo, dbPullData.head_sha);
var labels = self.getLabels(repo, number);
var reviews = self.getReviews(repo, number);
return Promise.all([signatures, comments, commitStatuses, labels, reviews]).
then(function(resolved) {
signatures = resolved[0];
comments = resolved[1];
commitStatuses = resolved[2];
labels = resolved[3];
reviews = resolved[4];
debug('getPull: retrieved Pull #%s in repo %s', number, repo);
return Pull.getFromDB(dbPullData, signatures, comments, reviews,
commitStatuses, labels);
});
});
},
/**
* Returns a promise which resolves to a Pull object for the given pull
* number built from data stored in the database.
*/
getIssue: function(repo, number) {
debug('Calling getIssue for issue #%s in repo %s', number, repo);
var q_select = 'SELECT * FROM issues WHERE number = ? AND repo = ?';
return db.query(q_select, [number, repo]).then(function(rows) {
if (rows.length === 0) { return null; }
var dbIssueData = rows[0];
return dbManager.getLabels(repo, number)
.then(function(labels) {
debug('getIssue: retrieved issue #%s in repo %s', number, repo);
return Issue.getFromDB(dbIssueData, labels);
});
});
},
/**
* Returns a promise which resolves to an array of Pull objects for the
* given pull numbers built from data stored in the database.
*/
getPulls: function(repo, pullNumbers) {
var pulls = _.map(pullNumbers, function(number) {
return dbManager.getPull(repo, number);
});
return Promise.all(pulls)
.then(filterNulls);
},
/**
* Returns a promise which resolves to an array of Pull objects for the
* given pull numbers built from data stored in the database.
*/
getOpenPulls: function(repo) {
var self = this;
debug('Calling getOpenPulls for %s', repo);
var q_select = 'SELECT number FROM pulls WHERE state = ? AND repo = ?';
return db.query(q_select, ['open', repo]).then(function(rows) {
debug('Found %s open pulls in the DB', rows.length);
if (rows.length === 0) { return []; }
var pulls = _.map(rows, function(row) {
return self.getPull(repo, row.number);
});
return Promise.all(pulls);
}).then(filterNulls);
},
/**
* Returns a promise which resolves to a pull's number for the given head
* commit sha.
*/
<API key>: function(repo, sha) {
var q_select = 'SELECT number FROM pulls WHERE repo = ? AND head_sha = ?';
return db.query(q_select, [repo, sha]).then(function(rows) {
return rows[0] ? rows[0].number : null;
});
},
getAllSignatures: function(repo, number) {
var q_select = '\
SELECT * FROM pull_signatures \
WHERE number = ? AND repo = ? \
ORDER BY date desc;';
return db.query(q_select, [number, repo]).then(function(rows) {
return rows.map(function(row) {
return Signature.getFromDB(row);
});
});
},
/**
* Returns a promise which resolves to an array of Comment objects.
*/
getComments: function(repo, number) {
var q_select = '\
SELECT * FROM comments \
WHERE number = ? AND repo = ?';
return db.query(q_select, [number, repo]).then(function(rows) {
return rows.map(function(row) {
return Comment.getFromDB(row);
});
});
},
/**
* Returns a promise which resolves to an array of Review objects.
*/
getReviews: function(repo, number) {
var q_select = '\
SELECT * FROM reviews \
WHERE number = ? AND repo = ?';
return db.query(q_select, [number, repo]).then(function(rows) {
return rows.map(function(row) {
return Review.getFromDB(row);
});
});
},
/**
* Returns a promise which resolves to a Status object.
*/
getCommitStatuses: function(repo, sha) {
var q_select = '\
SELECT * FROM commit_statuses \
WHERE commit = ? AND repo = ?';
return db.query(q_select, [sha, repo]).then(function(rows) {
return rows.map(row => Status.getFromDB(row));
});
},
/**
* Returns a promise which resolves to an array of labels for the pull.
*/
getLabels: function getLabels(repo, number) {
debug('Calling getLabels for #%s in repo %s', number, repo);
var q_select = '\
SELECT * FROM pull_labels \
WHERE number = ? AND repo = ?';
return db.query(q_select, [number, repo]).then(function(rows) {
debug('Got %s rows', rows.length);
return rows.map(function(row) {
return Label.getFromDB(row);
});
});
},
/**
* Returns a promise which resolves when all signatures associated with
* the given pull number have been removed from the database.
*/
deleteSignatures: function(repo, number) {
debug('Calling deleteSignatures for pull #%s in repo %s', number, repo);
var q_delete = 'DELETE FROM pull_signatures WHERE number = ? AND repo = ?';
return db.query(q_delete, [number, repo]).then(function() {
debug('deleteSignatures: deleting from Pull #%s in repo %s', number, repo);
});
},
/**
* Delete a single label from the database.
*/
deleteLabel: function deleteLabel(label) {
debug("Calling deleteLabel for label '%s' on issue
label.data.title, label.data.number);
return (new DBLabel(label)).delete();
},
/**
* Delete a single pull request review comment from the database.
*/
deleteReviewComment: function deleteReviewComment(repo, comment_id) {
return DBComment.delete(repo, 'review', comment_id);
},
/**
* Returns a promise which resolves when all the labels for pull `number`
* have been deleted from the database.
*/
deleteLabels: function deleteLabels(repo, number) {
debug('Calling deleteLabels for pull #%s in repo %s', number, repo);
var q_delete = 'DELETE FROM pull_labels WHERE number = ? ' +
'AND repo = ?';
return db.query(q_delete, [number, repo]);
},
// After restarting Pulldasher and updating all the open pulls, this
// updates closed pulls that are still set as 'open' in the DB, but have
// since been closed.
// @TODO closeStalePulls:
};
/**
* Return a copy of the specified array with nulls removed
*/
function filterNulls(array) {
return array.filter(function(element) {
return element;
});
} |
require File.dirname(__FILE__) + '/../../spec_helper'
describe "Check FSize" do
before :each do
@c = C.p1.merge(
:checks => C.check_fsize(:times => 3)
)
end
it "should start periodical watcher" do
start_ok_process(@c)
@process.watchers.keys.should == [:check_alive, :check_identity, :check_fsize]
@process.stop
# after process stop should remove watcher
@process.watchers.keys.should == []
end
end |
/// <reference path="Vector.ts" />
<reference path="SceneObject.ts" />
module RT {
export var EPSILON = 0.000001;
export class Ray {
constructor(public origin: Vector, public direction: Vector) { }
inchForward() {
this.origin.add(this.direction.scaledBy(EPSILON));
}
}
export class <API key> {
t: number;
u: number;
v: number;
geometricData: number;
}
export class RayIntersection extends <API key> {
point: Vector;
normal: Vector;
incident: Vector;
object: SceneObject = null;
}
export abstract class GeometricObject {
findNormal(intersection: RayIntersection): Vector {
var normal = this.calculateNormal(intersection);
// ensure that normal vector is directed towards ray source
// (this results in double-sided surfaces)
if (normal.dot(intersection.incident) < 0) return normal;
return normal.scaledBy(-1);
}
abstract intersectsRay(ray: Ray, intersection: <API key>): boolean;
abstract obstructsShadowRay(shadowRay: Ray, distToLight: number): boolean;
protected abstract calculateNormal(intersection: RayIntersection): Vector;
}
export abstract class <API key> extends GeometricObject {
obstructsShadowRay(shadowRay: Ray, distToLight: number): boolean {
var intersection = new <API key>();
return this.intersectsRay(shadowRay, intersection) && intersection.t < distToLight;
}
}
} |
# yamljs
## Notice
This project is out of date with https://github.com/Livefyre/py-yacc. Users
should instead switch injected configs.
export YACC_INJECT=$(pyyacc3 config/app.yaml /etc/default/cluster.yaml -o -)
run my program ...
var config = yamljs.loadInjected();
# Overview
Extends [js-yaml][1] with a few Livefyre specific types.
# Usage
To compile yaml to json:
yamljs.js sample1.yaml sample2.yaml > config.json
yamljs will take any number of yaml files and overlay them. For example, given two files:
**sample1.yaml**
`env: dev`
**sample2.yaml**
`env: staging`
then the generatedd config.json is
`{"env": "staging"}`
[1]: https://github.com/nodeca/js-yaml |
package fi.nls.oskari.csw.helper;
import fi.nls.oskari.csw.domain.CSWIsoRecord;
import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;
import org.apache.commons.collections.map.LinkedMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.xpath.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class <API key> {
private static final Logger log = LogFactory.getLogger(<API key>.class);
private static XPathExpression <API key> = null;
//Lineage statement
private XPathExpression <API key> = null;
//Data quality node information
private final XPath xpath = XPathFactory.newInstance().newXPath();
private final Map<String, String> dataQualities = new LinkedMap();
private XPathExpression <API key> = null; //many
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null; //TODO parse
private XPathExpression XPATH_DATE_TIME = null; //many
//Data quality node conformance result
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
//Data quality node quantitative result
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
private XPathExpression <API key> = null;
//Free text (character string)
private XPathExpression <API key> = null;
public <API key>() {
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("domainConsistency", "./gmd:report/gmd:<API key>");
dataQualities.put("formatConsistency", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("temporalConsistency", "./gmd:report/gmd:<API key>");
dataQualities.put("temporalValidity ", "./gmd:report/gmd:DQ_TemporalValidity ");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
dataQualities.put("<API key>", "./gmd:report/gmd:<API key>");
try {
xpath.setNamespaceContext(new <API key>());
//Lineage statement
<API key> = xpath.compile("./gmd:lineage/gmd:LI_Lineage/gmd:statement");
//Data quality node information: Aspect of quantitative quality information
<API key> = xpath.compile("./gmd:nameOfMeasure"); //many
<API key> = xpath.compile("./gmd:<API key>/gmd:code"); //MD_Identifier (code, authority, RS_Identifier)
<API key> = xpath.compile("./gmd:<API key>/gmd:authorization"); //MD_Identifier (code, authority, RS_Identifier)
<API key> = xpath.compile("./gmd:measureDescription");
<API key> = xpath.compile("./gmd:<API key>"); //b.1.17
<API key> = xpath.compile("./gmd:<API key>");
<API key> = xpath.compile("./gmd:evaluationProcedure"); //CI_Citation
XPATH_DATE_TIME = xpath.compile("./gmd:dateTime"); //many
//Data quality node conformance result
<API key> = xpath.compile("./gmd:result/gmd:<API key>"); //many
<API key> = xpath.compile("./gmd:specification/gmd:CI_Citation/gmd:title"); //FreeText
<API key> = xpath.compile("./gmd:explanation"); //FreeText
<API key> = xpath.compile("./gmd:pass"); //gco:Boolean
//Data quality node quantitative result
<API key> = xpath.compile("./gmd:result/gmd:<API key>"); //many
<API key> = xpath.compile("./gmd:valueType"); //RecordType
<API key> = xpath.compile("./gmd:valueUnit"); //UOM
<API key> = xpath.compile("./gmd:errorStatistic"); //FreeText
<API key> = xpath.compile("./gmd:value"); //many //Record
//Free text (character string)
<API key> = xpath.compile("./gco:CharacterString");
}
catch (Exception e) {
log.error("Setting XPaths failed in data quality parser");
throw new RuntimeException("Setting XPaths failed in data quality parser");
}
}
public Map<String, String> getDataQualitiesMap (){
return this.dataQualities;
}
public CSWIsoRecord.DataQualityObject parseDataQualities(final NodeList dataQualityNodes, final XPathExpression pathToLoc) throws <API key> {
<API key> = pathToLoc;
CSWIsoRecord.DataQualityObject dataQualityObject = new CSWIsoRecord.DataQualityObject();
List<CSWIsoRecord.DataQuality> dataQualityList = new ArrayList<>();
for (int i = 0; i < dataQualityNodes.getLength(); i++) {
Node parentNode = dataQualityNodes.item(i);
// parse scope: The specific data to which the data quality information applies
//TODO: should we parse scope?? or is it always dataset <gmd:MD_ScopeCode codeListValue="dataset">
// parse lineage statements
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
if (<API key> != null){
String lineageStatement = localize(<API key>);
if (lineageStatement != null){
dataQualityObject.<API key>().add(lineageStatement);
}
}
// parse dataQualities (gmd:report)
for (Map.Entry<String, String> entry : dataQualities.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
XPathExpression pathToDQChildNode = xpath.compile(value);
NodeList <API key> = (NodeList) pathToDQChildNode.evaluate(parentNode, XPathConstants.NODESET);
if(<API key> == null || <API key>.getLength() < 1) {
continue;
}
for (int j = 0;j < <API key>.getLength(); ++j) {
CSWIsoRecord.DataQuality dataQuality = new CSWIsoRecord.DataQuality();
dataQuality.setNodeName(key);
<API key>(<API key>.item(j), dataQuality);
NodeList <API key> =
(NodeList) <API key>.evaluate(<API key>.item(j), XPathConstants.NODESET);
for (int k = 0;k < <API key>.getLength(); ++k) {
dataQuality.<API key>().add(<API key>(<API key>.item(k)));
}
NodeList <API key> =
(NodeList) <API key>.evaluate(<API key>.item(j), XPathConstants.NODESET);
for (int l = 0;l < <API key>.getLength(); ++l) {
dataQuality.<API key>().add(<API key>(<API key>.item(l)));
}
dataQualityList.add(dataQuality);
}
}
}
dataQualityObject.setDataQualities(dataQualityList);
return dataQualityObject;
}
private void <API key>(Node parentNode, CSWIsoRecord.DataQuality <API key>) throws <API key> {
Node nameOfMeasureNode = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setNameOfMeasure(localize(nameOfMeasureNode));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.<API key>(localize(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.<API key>(getText(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.<API key>(localize(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.<API key>(getText(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.<API key>(localize(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.<API key>(null); //TODO parse //CI_Citation
NodeList dateTimeNode = (NodeList) XPATH_DATE_TIME.evaluate(parentNode, XPathConstants.NODESET);
List<String> dateTimeValueList = new ArrayList<>();
for (int i = 0;i < dateTimeNode.getLength(); ++i) {
dateTimeValueList.add(getText(dateTimeNode.item(i)));
}
<API key>.setDateTime(dateTimeValueList);
}
private CSWIsoRecord.<API key> <API key>(Node parentNode) throws <API key> {
CSWIsoRecord.<API key> <API key> =
new CSWIsoRecord.<API key>();
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setSpecification(localize(<API key>)); //TODO parse
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setExplanation(localize(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setPass(getBoolean(<API key>));
return <API key>;
}
private CSWIsoRecord.<API key> <API key>(Node parentNode) throws <API key> {
CSWIsoRecord.<API key> <API key> =
new CSWIsoRecord.<API key>();
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setValueType(getText(<API key>));
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setValueUnit(getText(<API key>));
NodeList <API key> = (NodeList) <API key>.evaluate(parentNode, XPathConstants.NODESET);
List<String> valueList = new ArrayList<>();
for (int i = 0;i < <API key>.getLength(); ++i) {
valueList.add(getText(<API key>.item(i)));
}
<API key>.setValue(valueList);
Node <API key> = (Node) <API key>.evaluate(parentNode, XPathConstants.NODE);
<API key>.setErrorStatistic(localize(<API key>));
return <API key>;
}
//Move to common utility class
//Only for gmd:PT_FreeText
private String localize(final Node elem) {
String ret = null;
String localized;
if (elem == null) {
return null;
}
try {
Node contentNode = (Node) <API key>.evaluate(elem, XPathConstants.NODE);
ret = getText(contentNode);
if (<API key> != null){
final Node localeNode = (Node) <API key>.evaluate(contentNode, XPathConstants.NODE);
localized = getText(localeNode);
if (localized != null && !localized.isEmpty()) {
ret = localized;
}
}
} catch (Exception e) {
log.warn("Error parsing localized value for:", elem.getLocalName(), ". Message:", e.getMessage());
}
return ret;
}
//Move to common utility class
//also: CSWISORecordParser getText
private String getText(final Node element) {
String ret = null;
if (element != null) {
ret = element.getTextContent();
if (ret != null) {
ret = ret.trim();
}
}
return ret;
}
//Move to common utility class
private boolean getBoolean (final Node element) {
if (element == null) {
return false;
}
String content = element.getTextContent().trim();
if ("1".equals(content)){
return true;
}
return Boolean.valueOf(content);
}
} |
namespace MasterChef.Web
{
using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
using MasterChef.Data;
using System.Linq;
public partial class SiteMaster : MasterPage
{
private const string AntiXsrfTokenKey = "__AntiXsrfToken";
private const string AntiXsrfUserNameKey = "__AntiXsrfUserName";
private string _antiXsrfTokenValue;
private IMasterChefData data;
protected string <API key>;
protected void Page_Init(object sender, EventArgs e)
{
// The code below helps to protect against XSRF attacks
var requestCookie = Request.Cookies[AntiXsrfTokenKey];
Guid <API key>;
if (requestCookie != null && Guid.TryParse(requestCookie.Value, out <API key>))
{
// Use the Anti-XSRF token from the cookie
_antiXsrfTokenValue = requestCookie.Value;
Page.ViewStateUserKey = _antiXsrfTokenValue;
}
else
{
// Generate a new Anti-XSRF token and save to the cookie
_antiXsrfTokenValue = Guid.NewGuid().ToString("N");
Page.ViewStateUserKey = _antiXsrfTokenValue;
var responseCookie = new HttpCookie(AntiXsrfTokenKey)
{
HttpOnly = true,
Value = _antiXsrfTokenValue
};
if (FormsAuthentication.RequireSSL && Request.IsSecureConnection)
{
responseCookie.Secure = true;
}
Response.Cookies.Set(responseCookie);
}
Page.PreLoad += master_Page_PreLoad;
}
protected void master_Page_PreLoad(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Set Anti-XSRF token
ViewState[AntiXsrfTokenKey] = Page.ViewStateUserKey;
ViewState[AntiXsrfUserNameKey] = Context.User.Identity.Name ?? String.Empty;
}
else
{
// Validate the Anti-XSRF token
if ((string)ViewState[AntiXsrfTokenKey] != _antiXsrfTokenValue
|| (string)ViewState[AntiXsrfUserNameKey] != (Context.User.Identity.Name ?? String.Empty))
{
throw new <API key>("Validation of Anti-XSRF token failed.");
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
var currentUserId = Request.QueryString["Id"];
var dbContext = new MasterChefDbContext();
this.data = new MasterChefData(dbContext);
if (Context.User.Identity.IsAuthenticated)
{
AdminPanelMenu.Visible = false;
<API key>.Visible = false;
var user = this.data.Users
.All()
.Where(u => u.UserName == this.Context.User.Identity.Name)
.FirstOrDefault();
var adminRole = this.data.Roles
.All()
.Where(r => r.Name == "admin")
.FirstOrDefault();
if (user.Roles.Any(r => r.RoleId == adminRole.Id))
{
AdminPanelMenu.Visible = true;
<API key>.Visible = true;
}
(LoginView.FindControl("ProfileImage") as Image).ImageUrl = user.Image.Path;
// TODO: cache data using this.Cache -> sitemaster
}
else
{
<API key>.Visible = false;
<API key>.Visible = false;
<API key>.Visible = false;
AdminPanelMenu.Visible = false;
<API key>.Visible = false;
}
}
protected void Unnamed_LoggingOut(object sender, <API key> e)
{
Context.GetOwinContext().Authentication.SignOut(<API key>.ApplicationCookie);
}
}
} |
<ion-view view-title="Alergias">
<ion-nav-buttons side="right">
<button class="button button-icon icon <API key>" ng-click="showFilterBar()"></button>
<button class="button button-icon icon"
ng-class="{'ion-android-add': platform.isAndroid(), 'ion-ios-plus-empty': !platform.isAndroid()}"
ng-click="new()"></button>
</ion-nav-buttons>
<ion-content>
<ion-refresher pulling-text="Pull to refresh" on-refresh="refresh(true)" spinner="dots"></ion-refresher>
<ion-list>
<ion-item
class="item-remove-animate item-icon-right"
auto-list-divider
<API key>='{{alergia.filho.nome}}'
<API key>="dividerFunction"
ng-repeat="alergia in alergias">
<span class="data">{{alergia.data | date:"dd/MM/yyyy HH:mm"}}</span>
{{alergia.componenteAlergico}}
<i class="icon ion-chevron-right icon-accessory"></i>
<ion-option-button class="button-energized" ng-click="edit(alergia)">
Edit
</ion-option-button>
<ion-option-button class="button-assertive" ng-click="remove(alergia)">
Delete
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view> |
<?php
namespace GPBT\Context;
class Clean extends AbstractContext
{
public function __invoke()
{
if (file_exists($this->settings->lock)) {
unlink($this->settings->lock);
}
}
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Making sure the web-site will scale fine on mobiles-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Trying to force IE to perform at its best-->
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Meta description, aim for about 150 characters-->
<meta name="description" content="Fabacademy 2017 course, portfolio page from João Milheiro, manager at Fab Lab Aldeias do Xisto in Portugal">
<!-- Stylesheets-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Work+Sans:200,300,400,700">
<link rel="stylesheet" href="./libs/materialize/css/materialize.min.css">
<link rel="stylesheet" href="./libs/textillate/assets/animate.css">
<link rel="stylesheet" href="./assets/css/linea.min.css">
<link rel="stylesheet" href="./assets/css/nas.min.css?v=2">
<!-- Favicons-->
<link rel="icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/favicons/manifest.json">
<link rel="shortcut icon" href="favicon.ico">
<meta name="<API key>" content="/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<!-- Site title-->
<title>Fabacademy - João Milheiro</title>
</head>
<body>
<div class="loading-overlay" id="loading-overlay"></div>
<!-- Pace loader-->
<div class="pace" id="pace">
<div class="pace-activity"></div>
</div>
<!-- Navigation-->
<div class="navbar-fixed zero-height">
<nav>
<div class="nav-wrapper">
<div class="row">
<div class="col s12 l6">
<div class="brand-logo"><img class="black-logo" src="./assets/images/fablogo_black.png">
<img class="white-logo" src="./assets/images/fablogo_white.png"></div>
</div>
<div class="col s12 l6">
<ul class="<API key> table-of-contents">
<li>
<a href="index.html">Home</a>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<!-- Main content-->
<main class="main" id="main">
<div class="hero cyan darken-3 overflow-hidden">
<canvas id="canvas"></canvas>
<h1 class="bold">Mechanical Design</h1>
</div>
<section class="section scrollspy" id="about">
<div class="container">
<div class="row">
<div class="col s12 l6">
<h2>Week 9</h2>
<img src="./assets/images/week9/week9.jpg">
<h3>Mechanical Design</h3>
</div>
<div class="col s12 l6">
<h2>Tasks</h2>
<p class="teal"> Design a machine (mechanism+automation), including the end effector<br>
Build the passive parts and operate it manually<br>
Document the group project and your individual contribution<br>
</p> </div></div>
<br>
<h4>MARBLE MACHINE</h4>
<p class="flow-text">We started this week assignment by brainstorming about what kind of machine to do. We have fabkids activities at our fablab and we thought about developing a modular a portable marble machine for them (us too). We decided the parts that each one of us would like to do and what fablab machines would be used for thar personal purpose. Each one of us had to build one modular part that could fit anywhere in the marble board and it should be compatible to fit with any other parts created by us. Those were the tasks defined :
<br>
<a href="http://archive.fabacademy.org/archives/2017/fablabaldeias/students/376" target="_blank">TONI</a> - design and build the modular board. <br>
<img src="./assets/images/week9/mechanicald9.jpg"><br>
<a href="http://archive.fabacademy.org/archives/2017/fablabaldeias/students/476" target="_blank">NUNO</a> - Design and build the marble lift structure<br>
<img src="./assets/images/week9/mechanicaldnuno.jpg"><br>
<a href="http:
<img src="./assets/images/week9/mechanicaldines.jpg"><br>
ME - Design a marble caroussel (lasercutter); design a pipe connector for the marbles (3d printer), design a detachable marble circuit that could fit into the board.<br>
Hands on work! <br>
</p>
<h4>Marble pipe connector</h4>
<p class="flow-text"> First thing we need to do was measure the marble. Done! 15mm<br>
<img src="./assets/images/week9/mechanicald1.jpg"><br>
I started this component by modelling splines in illustrator. Then exported to 3d Studio Max and started editing them just making a few changes. When they were ready, i started 3D Studio Max and imported the vector files. I just edited the rendering options, tensformed to editable poly, and made a shell modifier. 3d printed in prusa i3 sliced by cura.<br>
<img src="./assets/images/week9/print2.jpg"><br>
<img src="./assets/images/week9/print3.jpg"><br>
<img src="./assets/images/week9/print4.jpg"><br>
<img src="./assets/images/week9/print5.jpg"><br>
<img src="./assets/images/week9/print6.jpg"><br>
</p>
<h4>Marble Caroussel</h4>
<p class="flow-text"> Intention to create a wheel to transport the marble similar<a href="https:
<img src="./assets/images/week9/print7.jpg"><br>
<span class="deep-orange">Photo of the final caroussel</span><br>
<img src="./assets/images/week9/mechanicald5.jpg"><br>
<span class="deep-orange">pins to stick the modules to the marble board</span><br>
<img src="./assets/images/week9/mechanicald2.jpg"><br>
</p>
<h4>Detachable marble circuit</h4>
<p class="flow-text"> Intention to create a small circuit that could fit to the moular board. I did it in illustrator. Them most difficult part was to set an optimal angle to fit the 2 platforms in 2d. I defined 6 degrees for each and used the shape, rotation, round corners, offset, pathfinder and line tools.<br>
<span class="deep-orange">Here's the explained cutting plans for the circuit </span><br>
<img src="./assets/images/week9/print8.jpg"><br>
</p>
<span class="deep-orange">Video of the circuit working</span><br>
<video width="640" height="480" controls>
<source src="./assets/videos/mechanicald1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br><br>
<span class="deep-orange">Assembling the pieces</span><br>
<img src="./assets/images/week9/mechanicald4.jpg"><br>
</p>
<p class="flow-text"> Here's the final result of the platform and the carrousel. We are going to assemble the structure in group and i'll share later.<br>
<img src="./assets/images/week9/mechanicald11.jpg"><br>
</p>
<p class="teal"> References - <a href="https:
<br>
<a href="https:
<br>
<a href="http:
<br>
<br></p>
<span class="green">FILES</span><br>
<a href="assets/files/week9.rar" class="green">All files</a><br>
<br>
<br>
<br>
</div>
<!-- Footer-->
<footer>
<div class="container">
<div class="row">
<div class="col s12 l4 <API key>">© 2017 João Milheiro</div>
<div class="col s12 l4 <API key>">
<ul>
<li>
<a class="underline" href="http://facebook.com/joaomilhas">Facebook</a>
</li>
<li>
<a class="underline" href="#!">Twitter</a>
</li>
<li>
<a class="underline" href="#!">VK</a>
</li>
<li>
<a class="underline" href="https://github.com/joaomilhas">Github</a>
</li>
</ul>
</div>
<div class="col s12 l4 <API key>">
<address>Fab Lab Aldeias do Xisto, Fundão
<br>Portugal
<br>
</address>
<a class="underline" href="https:
<p>
<a class="underline" href="mailto:joaomilheiro@cm-fundao.pt">joaomilheiro@cm-fundao.pt</a>
<br>+351-961-977-022</p>
</div>
</div>
</div>
</footer>
<!-- Libraries-->
<script src="./libs/jquery/jquery.min.js"></script>
<script src="./libs/materialize/js/materialize.min.js"></script>
<script src="./libs/textillate/jquery.textillate.js"></script>
<script src="./libs/textillate/assets/jquery.lettering.js"></script>
<script src="./libs/textillate/assets/jquery.fittext.js"></script>
<!-- Nas scripts-->
<script src="./assets/js/config.js"></script>
<script src="./assets/js/nas.js"></script>
<script src="./libs/flat-surface-shader/deploy/fss.js"></script>
<script src="./assets/js/triangles-ii.js"></script>
<script src="./assets/js/hexes-iii.js"></script>
</body>
</html> |
#include "bindings.h"
#include "application.h"
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Core/Context.h>
#include <Urho3D/Resource/ResourceCache.h>
#include <Urho3D/Graphics/Renderer.h>
#include <Urho3D/Audio/Audio.h>
using namespace gengine::application;
using namespace Urho3D;
<API key>(String, CString);
<API key>(String);
<API key>(Scene, void);
<API key>(ResourceCache, void);
<API key>(Input, void);
<API key>(Context, void);
<API key>(Renderer, void);
<API key>(Audio, void);
<API key>(application)
{
embindcefv8::Class<App>("App")
.constructor()
.method("runFrame", &App::runFrame)
.method("run", &App::run)
.method("setup", &App::setup)
.method("start", &App::start)
.method("exit", &App::exit)
.method("getResourceCache", &App::getResourceCache)
.method("getRenderer", &App::getRenderer)
.method("getInput", &App::getInput)
.method("getTimeStep", &App::getTimeStep)
.method("getScene", &App::getScene)
.method("getContext", &App::getContext)
.method("getAudio", &App::getAudio)
.method("getStartupString", &App::getStartupString)
.method("isRunning", &App::isRunning)
.method("setWindowTitle", &App::setWindowTitle)
.method("takeScreenshot", &App::takeScreenshot)
.method("setGuiFilename", &App::setGuiFilename)
.method("setWindowSize", &App::setWindowSize)
.method("setKeyboardElement", &App::setKeyboardElement)
;
} |
module.exports = function RowCount (Model) {
'use strict';
// Model.afterRemote('findById', injectCounts);
// Model.afterRemote('findOne', injectCounts);
Model.afterRemote('find', injectCounts);
function injectCounts (ctx, unused, next) {
var resources = ctx.result;
if (!Array.isArray(resources)) resources = [resources];
if (!resources.length) {
ctx.result = {
count: 0,
rows: []
};
return next();
}
var args = ctx.args && ctx.args.filter && typeof ctx.args.filter == 'string'?JSON.parse(ctx.args.filter):{};
args = ctx.args && ctx.args.filter && typeof ctx.args.filter == 'object'?ctx.args.filter:args;
var filter = args && args.where ? args.where : {};
totalCount(filter, function(err, count){
if(!err){
ctx.result = {
count: count,
rows: resources
};
}else{
console.log(err);
return next(err);
}
return next();
})
}
function totalCount(filter, done){
Model.count(filter, function(err, count) {
if(!err) return done(null, count);
else return done("Unable to count: "+ err)
})
}
}; |
package com.avnt.soldi.service;
import com.avnt.soldi.model.cheque.Note;
import com.avnt.soldi.model.repositories.NoteRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* Class NoteService is service, that handle NoteController
* Use @Autowired for connect to necessary repositories
*
* @version 1.1
* @author Dmitry
* @since 21.01.2016
*/
@Service
public class NoteService {
@Autowired NoteRepository noteRepository;
/**
* Method addNote add note to DB with current DateTime
* @param chequeID is ID of cheque in database, in that client-side wants add a note comment
* @param note is data for Note.class, that was create on client-side
*/
@Modifying
@Transactional
public void addNote(@PathVariable Long chequeID, @RequestBody Note note) {
noteRepository.save(note.withDateTime());
}
/**
* Method deleteNote delete note from DB
* @param chequeID is ID of cheque in database, in that client-side wants delete note comment
* @param noteID is ID of note in database, that client-side wants to delete
*/
@Modifying
@Transactional
public void deleteNote(@PathVariable Long chequeID, @PathVariable Long noteID) {noteRepository.delete(noteID);}
@Transactional(readOnly = true)
public List<Note> getNotes(Long chequeID) {
return noteRepository.findByChequeId(chequeID);
}
} |
import React, { PropTypes } from 'react'
const ContextType = {
// Enables critical path CSS rendering
insertCss: PropTypes.func.isRequired,
}
class App extends React.Component {
static propTypes = {
context: PropTypes.shape(ContextType).isRequired,
children: PropTypes.element.isRequired,
}
static childContextTypes = ContextType
getChildContext() {
return this.props.context
}
render() {
// NOTE: If you need to add or modify header, footer etc. of the app,
// please do that inside the Layout component.
return React.Children.only(this.props.children)
}
}
export default App |
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/common', __FILE__)
describe "Exception#backtrace" do
before :each do
@backtrace = ExceptionSpecs::Backtrace.backtrace
end
it "returns nil if no backtrace was set" do
Exception.new.backtrace.should be_nil
end
it "returns an Array" do
@backtrace.should be_an_instance_of(Array)
end
it "sets each element to a String" do
@backtrace.each {|l| l.should be_an_instance_of(String)}
end
it "includes the filename of the location where self raised in the first element" do
@backtrace.first.should =~ /common\.rb/
end
it "includes the line number of the location where self raised in the first element" do
@backtrace.first.should =~ /:7:in /
end
it "includes the name of the method from where self raised in the first element" do
@backtrace.first.should =~ /in `backtrace'/
end
it "includes the filename of the location immediately prior to where self raised in the second element" do
@backtrace[1].should =~ /backtrace_spec\.rb/
end
it "includes the line number of the location immediately prior to where self raised in the second element" do
@backtrace[1].should =~ /:6(:in )?/
end
it "contains lines of the same format for each prior position in the stack" do
@backtrace[2..-1].each do |line|
# This regexp is deliberately imprecise to account for the need to abstract out
# the paths of the included mspec files and the desire to avoid specifying in any
# detail what the in `...' portion looks like.
line.should =~ /^[^ ]+\:\d+(:in `[^`]+')?$/
end
end
it "produces a backtrace for an exception captured using $!" do
exception = begin
raise
rescue RuntimeError
$!
end
exception.backtrace.first.should =~ /backtrace_spec/
end
it "returns an Array that can be updated" do
begin
raise
rescue RuntimeError => e
e.backtrace.unshift "backtrace first"
e.backtrace[0].should == "backtrace first"
end
end
end |
import e2e from '~shared/data/e2e';
import {
<API key>,
<API key>,
<API key>,
} from '~reusable/playlist';
import {
<API key>,
} from '~reusable/discoverPage';
import {
<API key>,
} from '~reusable/player';
describe('selected actions tests', () => {
describe('click play album button', () => {
before(function () {
return <API key>.call(this, 1);
});
it('throws no errors', async function () {
const { app } = this;
return app.client.click(e2e.<API key>);
});
it('active audio player appears', function () {
return <API key>.call(this);
});
it('playlist has some tracks', function () {
return <API key>.call(this);
});
it('tracklist length equals 1', function () {
return <API key>.call(this, 1);
});
});
describe('click queue album button', () => {
before(function () {
return <API key>.call(this, 1);
});
it('throws no errors', function () {
const { app } = this;
return app.client.click(e2e.<API key>);
});
it('tracklist length equals 2', function () {
return <API key>.call(this, 2);
});
});
describe('click delete album button', () => {
before(function () {
return <API key>.call(this, 1);
});
it('throws no errors', function () {
const { app } = this;
return app.client.click(e2e.<API key>);
});
it('discover feed is empty', function () {
return this.app.client
.waitForExist(e2e.<API key>);
});
});
}); |
+++
date = "2018-12-14T18:00:00+03:00"
draft = true
title = "Using mutual TLS in Scala"
slug = "mutual-tls-in-scala"
+++
_TODO:_ Add a short introduction to the solved problem.
* Why do we need mutual TLS?
* Short description of advatages when it is used.
<!--more
## Keys, Certificates and everyone else
_TODO:_ Cool picture for a root CA certificate, public/private keys for a client and a server. Keystores and Truststores.
## Akka-HTTP
_TODO:_
## Http4s
_TODO:_
## Links
* [Source code](???)
* [Akka-Http documentation](????)
* [Http4s](???)
* [Mutual TLS](https://en.wikipedia.org/wiki/<API key>) - a brief description of the technology on wikipedia |
#include "class_3.h"
#include "class_9.h"
#include "class_3.h"
#include "class_7.h"
#include "class_4.h"
#include "class_0.h"
#include <lib_56/class_4.h>
#include <lib_14/class_0.h>
#include <lib_41/class_5.h>
#include <lib_48/class_3.h>
#include <lib_7/class_6.h>
class_3::class_3() {}
class_3::~class_3() {} |
#include "ecoreReflection/EcorePlugin.hpp"
#include "ecoreReflection/impl/EcorePluginImpl.hpp"
using namespace Ecore;
//static initialisation
std::shared_ptr<MDE4CPPPlugin> EcorePlugin::instance;
std::shared_ptr<MDE4CPPPlugin> EcorePlugin::eInstance()
{
if(instance==nullptr)
{
//create a new Singelton Instance
instance.reset(new EcorePluginImpl());
}
return instance;
}
std::shared_ptr<MDE4CPPPlugin> start()
{
return EcorePlugin::eInstance();
} |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
var CONN={
init:function(){
// connection goes here
console.log("SOCKET");
//when we get connected to server make proceed to noclayer initalisation
this.next()
},
next:function(){
$.getJSON('assets/modules/manifest.json','', function(data) {
if(mode!=data.version){
console.warn('Wrong module assets!');
}else{
if(!UPDATE.init()){
$.each(data.next,function(i,e){
eval(e).init()
});
}
}
/console.log(data)
});
}
} |
class EJson
def self.dump_as(obj)
obj
end
def self.dump(obj)
JSON.dump(dump_as(obj))
end
end |
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>php | fantaster | </title>
<meta name="author" content="fantaster">
<link rel="shortcut icon" href="/public/img/smallcat.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/public/css/bootstrap.css">
<link rel="stylesheet" href="/public/css/font-awesome.css">
<link rel="stylesheet" href="/public/js/prettify/prettify.css">
<link rel="stylesheet" href="/public/css/base.css">
<link href="/pages/atom.xml" rel="alternate" title="fantaster | " type="application/atom+xml">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-3 col-lg-3 col-sm-13 col-xs-13 aside visible-md visible-lg">
<div class="row">
<div class="col-md-2 col-xs-2 aside1">
<br>
<a class="pjaxlink" href="/"><img src="/public/img/cat.png" class="img-ronuded avatar" style="border-width:0px; border-color:#000"></a>
<br><br><br><br>
<ul class="nav nav-pills nav-stacked">
<!-- aside1-->
<li><a href="#" data-toggle="tab"></a></li>
<!-- aside1-->
<li><a href="#php" data-toggle="tab">php</a></li>
<!-- aside1-->
<li><a href="#" data-toggle="tab"></a></li>
<!-- aside1-->
<li><a href="#linux" data-toggle="tab">linux</a></li>
<li><a href="#tags" data-toggle="tab"></a></li>
<li><a class="pjaxlink" href="/pages/archive.html"></a></li>
<li><a class="pjaxlink" href="/pages/about.html"></a></li>
<!-- <li><a href="#tags" data-toggle="tab"><i class="fa fa-tags fa-lg"></i></a></li>
<li><a class="pjaxlink" href="/pages/archive.html"><i class="fa fa-archive fa-lg"></i></a></li>
<li><a class="pjaxlink" href="/pages/about.html"><i class="fa fa-user fa-lg"></i></a></li>
</ul>
<div class="aside1_bottom">
<table class="table table-condensed">
<tr>
<td><a href="/pages/atom.xml" target="_blank"><i class="fa fa-rss fa-lg" style="color:#fff;"></i></a></td>
<td><a href="mailto:arrowylq@outlook.com"><i class="fa fa-envelope-o fa-lg" style="color:#fff;"></i></a></td>
</tr>
</table>
</div>
</div>
<div class="col-md-10 col-xs-10 aside2">
<div class="row">
<div class="tab-content">
<div class="tab-pane" id="">
<div class="list-group">
<!--<h2 class="center"></h2>--> <!--aside2-->
<a href="/2013/12/31/Change.html" class="list-group-item-lay pjaxlink"></a>
</div>
</div>
<div class="tab-pane" id="php">
<div class="list-group">
<!--<h2 class="center">php</h2>--> <!--aside2-->
<a href="/2015/08/01/http.html" class="list-group-item-lay pjaxlink"></a>
<a href="/2014/05/01/files-upload.html" class="list-group-item-lay pjaxlink">php</a>
<a href="/2014/04/22/Recursive-Traversal.html" class="list-group-item-lay pjaxlink">php</a>
</div>
</div>
<div class="tab-pane" id="">
<div class="list-group">
<!--<h2 class="center"></h2>--> <!--aside2-->
<a href="/2015/03/12/URI-URL-URN.html" class="list-group-item-lay pjaxlink">URIURLURN</a>
<a href="/2015/01/16/Nginx.html" class="list-group-item-lay pjaxlink">Nginx</a>
<a href="/2014/08/21/Replication.html" class="list-group-item-lay pjaxlink">Mysql</a>
<a href="/2014/06/11/Simple%20Algorithm.html" class="list-group-item-lay pjaxlink"></a>
<a href="/2014/06/07/<API key>.html" class="list-group-item-lay pjaxlink">CookieSession</a>
<a href="/2014/05/30/<API key>.html" class="list-group-item-lay pjaxlink">CookieSession
<a href="/2014/05/25/Cookie-and-Session.html" class="list-group-item-lay pjaxlink">CookieSession</a>
</div>
</div>
<div class="tab-pane" id="linux">
<div class="list-group">
<!--<h2 class="center">linux</h2>--> <!--aside2-->
<a href="/2015/08/16/Linux%20-%20memcache.html" class="list-group-item-lay pjaxlink">memcache</a>
<a href="/2015/07/06/Linux4.html" class="list-group-item-lay pjaxlink">Linux 4</a>
<a href="/2015/07/05/Linux3.html" class="list-group-item-lay pjaxlink">Linux 3</a>
<a href="/2015/07/04/Linux2.html" class="list-group-item-lay pjaxlink">Linux 2</a>
<a href="/2015/07/03/Linux.html" class="list-group-item-lay pjaxlink">Linux 1man page</a>
<a href="/2015/07/02/Linux-Problems.html" class="list-group-item-lay pjaxlink">Linux 0</a>
<a href="/2015/05/16/linux-redis.html" class="list-group-item-lay pjaxlink">Linuxredis</a>
<a href="/2015/03/25/linux-lamp.html" class="list-group-item-lay pjaxlink">lamp</a>
<a href="/2015/03/11/Lnmp.html" class="list-group-item-lay pjaxlink">Linux nginx + php-fpm</a>
<a href="/2015/02/20/linux-php.html" class="list-group-item-lay pjaxlink">linux php </a>
</div>
</div>
<div class="tab-pane" id="tags">
<div class="panel-group" id="accordion">
<!--<h2 class="center"></h2>-->
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#"></a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="" class="panel-collapse collapse">
<a href='/2013/12/31/Change.html' class="list-group-item pjaxlink">
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#php">php</a>
<span class="badge pull-right">5</span>
</h4>
</div>
<div id="php" class="panel-collapse collapse">
<a href='/2014/06/07/<API key>.html' class="list-group-item pjaxlink">
CookieSession
</a>
<a href='/2014/05/30/<API key>.html' class="list-group-item pjaxlink">
CookieSession
</a>
<a href='/2014/05/25/Cookie-and-Session.html' class="list-group-item pjaxlink">
CookieSession
</a>
<a href='/2014/05/01/files-upload.html' class="list-group-item pjaxlink">
php
</a>
<a href='/2014/04/22/Recursive-Traversal.html' class="list-group-item pjaxlink">
php
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#"></a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="" class="panel-collapse collapse">
<a href='/2014/06/11/Simple%20Algorithm.html' class="list-group-item pjaxlink">
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#mysql">mysql</a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="mysql" class="panel-collapse collapse">
<a href='/2014/08/21/Replication.html' class="list-group-item pjaxlink">
Mysql
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#Nginx">Nginx</a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="Nginx" class="panel-collapse collapse">
<a href='/2015/01/16/Nginx.html' class="list-group-item pjaxlink">
Nginx
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#LinuxPHP">LinuxPHP</a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="LinuxPHP" class="panel-collapse collapse">
<a href='/2015/02/20/linux-php.html' class="list-group-item pjaxlink">
linux php
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#Linux">Linux</a>
<span class="badge pull-right">6</span>
</h4>
</div>
<div id="Linux" class="panel-collapse collapse">
<a href='/2015/07/06/Linux4.html' class="list-group-item pjaxlink">
Linux 4
</a>
<a href='/2015/07/05/Linux3.html' class="list-group-item pjaxlink">
Linux 3
</a>
<a href='/2015/07/04/Linux2.html' class="list-group-item pjaxlink">
Linux 2
</a>
<a href='/2015/07/03/Linux.html' class="list-group-item pjaxlink">
Linux 1man page
</a>
<a href='/2015/07/02/Linux-Problems.html' class="list-group-item pjaxlink">
Linux 0
</a>
<a href='/2015/03/11/Lnmp.html' class="list-group-item pjaxlink">
Linux nginx + php-fpm
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#"></a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="" class="panel-collapse collapse">
<a href='/2015/03/12/URI-URL-URN.html' class="list-group-item pjaxlink">
URIURLURN
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#Lamp">Lamp</a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="Lamp" class="panel-collapse collapse">
<a href='/2015/03/25/linux-lamp.html' class="list-group-item pjaxlink">
lamp
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#linux">linux</a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="linux" class="panel-collapse collapse">
<a href='/2015/05/16/linux-redis.html' class="list-group-item pjaxlink">
Linuxredis
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#"></a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="" class="panel-collapse collapse">
<a href='/2015/08/01/http.html' class="list-group-item pjaxlink">
</a>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#memcache">memcache</a>
<span class="badge pull-right">1</span>
</h4>
</div>
<div id="memcache" class="panel-collapse collapse">
<a href='/2015/08/16/Linux%20-%20memcache.html' class="list-group-item pjaxlink">
memcache
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-13 col-lg-13 col-sm-13 col-xs-13 aside3">
<div id="container">
<div id="pjax">
<div class="row">
<div class="col-md-13 aside3-title">
<br>
<h2 id="#identifier">php</h2>
20140501
</div>
<div class="col-md-13 aside3-content">
<hr>
<div id="content">
<p> PHP<code></code></p>
<h3></h3>
<p><code></code><code></code>, </p>
<p>: </p>
<ol>
<li><p>,,.</p></li>
<li><p>: apache,PHP.</p></li>
</ol>
<h3></h3>
<h4><code>php.ini</code></h4>
<ul>
<li></li>
</ul>
<div class="highlight"><pre><code class="language-text" data-lang="text">file_uploads = On
</code></pre></div>
<ul>
<li></li>
</ul>
<div class="highlight"><pre><code class="language-text" data-lang="text">upload_tmp_dir ="E:\PHP\upload" #;,c:/windows/temp
</code></pre></div>
<h4><code></code></h4>
<div class="highlight"><pre><code class="language-text" data-lang="text"><input type=’file’ name=’myfile’>
</code></pre></div>
<h4><code>post</code></h4>
<div class="highlight"><pre><code class="language-text" data-lang="text">enctype=”multipart/form-data”
</code></pre></div>
<h4><code>$_FILES</code></h4>
<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="lineno"> 1</span> <span class="x">array(1) {</span>
<span class="lineno"> 2</span> <span class="x"> ["myfile"]=></span>
<span class="lineno"> 3</span> <span class="x"> array(5) {</span>
<span class="lineno"> 4</span> <span class="x"> ["name"]=> #</span>
<span class="lineno"> 5</span> <span class="x"> string(10) "123123.jpg"</span>
<span class="lineno"> 6</span> <span class="x"> ["type"]=> #:/ MIME</span>
<span class="lineno"> 7</span> <span class="x"> string(10) "image/jpeg"</span>
<span class="lineno"> 8</span> <span class="x"> ["tmp_name"]=> #</span>
<span class="lineno"> 9</span> <span class="x"> string(38) "E:\PHP\upload\php7FC2.tmp"</span>
<span class="lineno">10</span> <span class="x"> ["error"]=> #</span>
<span class="lineno">11</span> <span class="x"> int(0)</span>
<span class="lineno">12</span> <span class="x"> ["size"]=> #</span>
<span class="lineno">13</span> <span class="x"> int(6340)</span>
<span class="lineno">14</span> <span class="x"> }</span>
<span class="lineno">15</span> <span class="x">}</span></code></pre></div>
<h3></h3>
<ul>
<li><code>Move_uploaded_file([], [])</code>--></li>
<li><code>Copy(,</code>--></li>
</ul>
<h3></h3>
<ul>
<li><code>move_uploaded_file()</code>php(<code>post</code>)</li>
<li><code>move_uploaded_file()</code><code></code><code>move_uploaded_file()</code>postpostpost<code>copymove_uploaded_file()</code></li>
</ul>
<h3></h3>
<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="lineno"> 1</span> <span class="x">/*</span>
<span class="lineno"> 2</span> <span class="x"> * </span>
<span class="lineno"> 3</span> <span class="x"> * @param1 array $file,</span>
<span class="lineno"> 4</span> <span class="x"> * @param2 string $path,</span>
<span class="lineno"> 5</span> <span class="x"> * @param3 string &$error,</span>
<span class="lineno"> 6</span> <span class="x"> * @return string ()</span>
<span class="lineno"> 7</span> <span class="x"> */</span>
<span class="lineno"> 8</span> <span class="x"> function upload($file,$path,&$error){</span>
<span class="lineno"> 9</span> <span class="x"> //: : </span>
<span class="lineno">10</span> <span class="x"> //$file</span>
<span class="lineno">11</span> <span class="x"> if(!is_array($file)){</span>
<span class="lineno">12</span> <span class="x"> //</span>
<span class="lineno">13</span> <span class="x"> $error = '!';</span>
<span class="lineno">14</span> <span class="x"> return false;</span>
<span class="lineno">15</span> <span class="x"> }</span>
<span class="lineno">16</span> <span class="x"> //</span>
<span class="lineno">17</span> <span class="x"> switch($file['error']){</span>
<span class="lineno">18</span> <span class="x"> case 1:</span>
<span class="lineno">19</span> <span class="x"> $error = ',!';</span>
<span class="lineno">20</span> <span class="x"> return false;</span>
<span class="lineno">21</span> <span class="x"> case 2:</span>
<span class="lineno">22</span> <span class="x"> $error = '!';</span>
<span class="lineno">23</span> <span class="x"> return false;</span>
<span class="lineno">24</span> <span class="x"> case 3:</span>
<span class="lineno">25</span> <span class="x"> $error = '!';</span>
<span class="lineno">26</span> <span class="x"> return false;</span>
<span class="lineno">27</span> <span class="x"> case 4:</span>
<span class="lineno">28</span> <span class="x"> $error = '!';</span>
<span class="lineno">29</span> <span class="x"> return false;</span>
<span class="lineno">30</span> <span class="x"> case 6:</span>
<span class="lineno">31</span> <span class="x"> case 7:</span>
<span class="lineno">32</span> <span class="x"> $error = '!';</span>
<span class="lineno">33</span> <span class="x"> return false;</span>
<span class="lineno">34</span> <span class="x"> }</span>
<span class="lineno">35</span> <span class="x"> //: </span>
<span class="lineno">36</span> <span class="x"> $filename = getRandomName($file['name']);</span>
<span class="lineno">37</span> <span class="x"> if(@move_uploaded_file($file['tmp_name'],$path . '/' . $filename))</span>
<span class="lineno">38</span> <span class="x"> {</span>
<span class="lineno">39</span> <span class="x"> //</span>
<span class="lineno">40</span> <span class="x"> return $filename;</span>
<span class="lineno">41</span> <span class="x"> }else{</span>
<span class="lineno">42</span> <span class="x"> //</span>
<span class="lineno">43</span> <span class="x"> $error = '!';</span>
<span class="lineno">44</span> <span class="x"> return false;</span>
<span class="lineno">45</span> <span class="x"> }</span>
<span class="lineno">46</span> <span class="x"> }</span>
<span class="lineno">47</span> <span class="x"> /*</span>
<span class="lineno">48</span> <span class="x"> * : YYYYmmddHHIISS + 6</span>
<span class="lineno">49</span> <span class="x"> * @param1 string $name,: </span>
<span class="lineno">50</span> <span class="x"> * @return string </span>
<span class="lineno">51</span> <span class="x"> */</span>
<span class="lineno">52</span> <span class="x"> function getRandomName($name){</span>
<span class="lineno">53</span> <span class="x"> //</span>
<span class="lineno">54</span> <span class="x"> $newname = date('YmdHis');</span>
<span class="lineno">55</span> <span class="x"> //</span>
<span class="lineno">56</span> <span class="x"> $str = '<API key>';</span>
<span class="lineno">57</span> <span class="x"> //6</span>
<span class="lineno">58</span> <span class="x"> for($i = 0; $i < 6;$i++){</span>
<span class="lineno">59</span> <span class="x"> //</span>
<span class="lineno">60</span> <span class="x"> $newname .= $str[mt_rand(0,strlen($str) - 1)];</span>
<span class="lineno">61</span> <span class="x"> }</span>
<span class="lineno">62</span> <span class="x"> //</span>
<span class="lineno">63</span> <span class="x"> $newname .= strrchr($name,'.');</span>
<span class="lineno">64</span> <span class="x"> //</span>
<span class="lineno">65</span> <span class="x"> return $newname;</span>
<span class="lineno">66</span> <span class="x"> }</span></code></pre></div>
</div>
<hr>
<div id="disqus_thread">
<button type="button" name="fantaster" class="btn btn-default show-commend">
<i class="fa fa-comment-o fa-lg" style="color: #16a095;"></i>
</button>
</div>
</div>
<div id="content_table" style="position:fixed;right:20px;top:120px;display:none;">
<div class="panel panel-success">
<div class="panel-body" id="nav"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="position:fixed;right:15px;top:62px;">
<button id="content_btn" class="btn btn-primary" style="width:43px; height:34px;">
<i class="fa fa-lg fa-plus"></i>
</button>
</div>
<div style="position:fixed;right:15px;top:20px;">
<button id="nav_btn" class="btn btn-primary">
<i class="fa fa-lg fa-navicon"></i>
</button>
</div>
<script type="text/javascript" src="/public/js/jquery.js"></script>
<script type="text/javascript" src="/public/js/bootstrap.js"></script>
<script src="/public/js/jquery.pjax.js"></script>
<script src="/public/js/prettify/prettify.js"></script>
<script src="/public/js/base.js"></script>
<!
<script src="/public/js/jquery.scrollUp.js"></script>
<script>
$('a[href="#linux"]').tab('show');
</script>
<!--button
<script>
(function(i,s,o,g,r,a,m){i['<API key>']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.<API key>(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','
ga('create', 'UA-54262064-1', 'painterlin.com');
ga('send', 'pageview');
</script>
</body>
</html> |
package edu.ilstu.it275.lab08.msanto2;
/**
* The Exception <API key>.
*/
public class <API key> extends Exception {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -<API key>;
/**
* Instantiates a new zero denominator exception.
*/
public <API key>() {
super("Can't make a division with zero denominator.");
}
} |
"""MySQLdb Cursors
This module implements Cursors of various types for MySQLdb. By
default, MySQLdb uses the Cursor class.
"""
import re
insert_values = re.compile(r"\svalues\s*(\(((?<!\\)'.*?\).*(?<!\\)?'|.)+?\))", re.IGNORECASE)
from _mysql_exceptions import Warning, Error, InterfaceError, DataError, \
DatabaseError, OperationalError, IntegrityError, InternalError, \
NotSupportedError, ProgrammingError
class BaseCursor(object):
"""A base for Cursor classes. Useful attributes:
description
A tuple of DB API 7-tuples describing the columns in
the last executed query; see PEP-249 for details.
description_flags
Tuple of column flags for last query, one entry per column
in the result set. Values correspond to those in
MySQLdb.constants.FLAG. See MySQL documentation (C API)
for more information. Non-standard extension.
arraysize
default number of rows fetchmany() will fetch
"""
from _mysql_exceptions import MySQLError, Warning, Error, InterfaceError, \
DatabaseError, DataError, OperationalError, IntegrityError, \
InternalError, ProgrammingError, NotSupportedError
_defer_warnings = False
def __init__(self, connection):
from weakref import proxy
self.connection = proxy(connection)
self.description = None
self.description_flags = None
self.rowcount = -1
self.arraysize = 1
self._executed = None
self.lastrowid = None
self.messages = []
self.errorhandler = connection.errorhandler
self._result = None
self._warnings = 0
self._info = None
self.rownumber = None
def __del__(self):
self.close()
self.errorhandler = None
self._result = None
def close(self):
"""Close the cursor. No further queries will be possible."""
if not self.connection: return
while self.nextset(): pass
self.connection = None
def _check_executed(self):
if not self._executed:
self.errorhandler(self, ProgrammingError, "execute() first")
def _warning_check(self):
from warnings import warn
if self._warnings:
warnings = self._get_db().show_warnings()
if warnings:
# This is done in two loops in case
# Warnings are set to raise exceptions.
for w in warnings:
self.messages.append((self.Warning, w))
for w in warnings:
warn(w[-1], self.Warning, 3)
elif self._info:
self.messages.append((self.Warning, self._info))
warn(self._info, self.Warning, 3)
def nextset(self):
"""Advance to the next result set.
Returns None if there are no more result sets.
"""
if self._executed:
self.fetchall()
del self.messages[:]
db = self._get_db()
nr = db.next_result()
if nr == -1:
return None
self._do_get_result()
self._post_get_result()
self._warning_check()
return 1
def _post_get_result(self): pass
def _do_get_result(self):
db = self._get_db()
self._result = self._get_result()
self.rowcount = db.affected_rows()
self.rownumber = 0
self.description = self._result and self._result.describe() or None
self.description_flags = self._result and self._result.field_flags() or None
self.lastrowid = db.insert_id()
self._warnings = db.warning_count()
self._info = db.info()
def setinputsizes(self, *args):
"""Does nothing, required by DB API."""
def setoutputsizes(self, *args):
"""Does nothing, required by DB API."""
def _get_db(self):
if not self.connection:
self.errorhandler(self, ProgrammingError, "cursor closed")
return self.connection
def execute(self, query, args=None):
"""Execute a query.
query -- string, query to execute on server
args -- optional sequence or mapping, parameters to use with query.
Note: If args is a sequence, then %s must be used as the
parameter placeholder in the query. If a mapping is used,
%(key)s must be used as the placeholder.
Returns long integer rows affected, if any
"""
from types import ListType, TupleType
from sys import exc_info
del self.messages[:]
db = self._get_db()
charset = db.character_set_name()
if isinstance(query, unicode):
query = query.encode(charset)
if args is not None:
query = query % db.literal(args)
try:
r = self._query(query)
except TypeError, m:
if m.args[0] in ("not enough arguments for format string",
"not all arguments converted"):
self.messages.append((ProgrammingError, m.args[0]))
self.errorhandler(self, ProgrammingError, m.args[0])
else:
self.messages.append((TypeError, m))
self.errorhandler(self, TypeError, m)
except:
exc, value, tb = exc_info()
del tb
self.messages.append((exc, value))
self.errorhandler(self, exc, value)
self._executed = query
if not self._defer_warnings: self._warning_check()
return r
def executemany(self, query, args):
"""Execute a multi-row query.
query -- string, query to execute on server
args
Sequence of sequences or mappings, parameters to use with
query.
Returns long integer rows affected, if any.
This method improves performance on multiple-row INSERT and
REPLACE. Otherwise it is equivalent to looping over args with
execute().
"""
del self.messages[:]
db = self._get_db()
if not args: return
charset = db.character_set_name()
if isinstance(query, unicode): query = query.encode(charset)
m = insert_values.search(query)
if not m:
r = 0
for a in args:
r = r + self.execute(query, a)
return r
p = m.start(1)
e = m.end(1)
qv = m.group(1)
try:
q = [ qv % db.literal(a) for a in args ]
except TypeError, msg:
if msg.args[0] in ("not enough arguments for format string",
"not all arguments converted"):
self.messages.append((ProgrammingError, msg.args[0]))
self.errorhandler(self, ProgrammingError, msg.args[0])
else:
self.messages.append((TypeError, msg))
self.errorhandler(self, TypeError, msg)
except:
from sys import exc_info
exc, value, tb = exc_info()
del tb
self.errorhandler(self, exc, value)
r = self._query('\n'.join([query[:p], ',\n'.join(q), query[e:]]))
if not self._defer_warnings: self._warning_check()
return r
def callproc(self, procname, args=()):
"""Execute stored procedure procname with args
procname -- string, name of procedure to execute on server
args -- Sequence of parameters to use with procedure
Returns the original args.
Compatibility warning: PEP-249 specifies that any modified
parameters must be returned. This is currently impossible
as they are only available by storing them in a server
variable and then retrieved by a query. Since stored
procedures return zero or more result sets, there is no
reliable way to get at OUT or INOUT parameters via callproc.
The server variables are named @_procname_n, where procname
is the parameter above and n is the position of the parameter
(from zero). Once all result sets generated by the procedure
have been fetched, you can issue a SELECT @_procname_0, ...
query using .execute() to get any OUT or INOUT values.
Compatibility warning: The act of calling a stored procedure
itself creates an empty result set. This appears after any
result sets generated by the procedure. This is non-standard
behavior with respect to the DB-API. Be sure to use nextset()
to advance through all result sets; otherwise you may get
disconnected.
"""
from types import UnicodeType
db = self._get_db()
charset = db.character_set_name()
for index, arg in enumerate(args):
q = "SET @_%s_%d=%s" % (procname, index,
db.literal(arg))
if isinstance(q, unicode):
q = q.encode(charset)
self._query(q)
self.nextset()
q = "CALL %s(%s)" % (procname,
','.join(['@_%s_%d' % (procname, i)
for i in range(len(args))]))
if type(q) is UnicodeType:
q = q.encode(charset)
self._query(q)
self._executed = q
if not self._defer_warnings: self._warning_check()
return args
def _do_query(self, q):
db = self._get_db()
self._last_executed = q
db.query(q)
self._do_get_result()
return self.rowcount
def _query(self, q): return self._do_query(q)
def _fetch_row(self, size=1):
if not self._result:
return ()
return self._result.fetch_row(size, self._fetch_type)
def __iter__(self):
return iter(self.fetchone, None)
Warning = Warning
Error = Error
InterfaceError = InterfaceError
DatabaseError = DatabaseError
DataError = DataError
OperationalError = OperationalError
IntegrityError = IntegrityError
InternalError = InternalError
ProgrammingError = ProgrammingError
NotSupportedError = NotSupportedError
class <API key>(object):
"""This is a MixIn class which causes the entire result set to be
stored on the client side, i.e. it uses mysql_store_result(). If the
result set can be very large, consider adding a LIMIT clause to your
query, or using <API key> instead."""
def _get_result(self): return self._get_db().store_result()
def _query(self, q):
rowcount = self._do_query(q)
self._post_get_result()
return rowcount
def _post_get_result(self):
self._rows = self._fetch_row(0)
self._result = None
def fetchone(self):
"""Fetches a single row from the cursor. None indicates that
no more rows are available."""
self._check_executed()
if self.rownumber >= len(self._rows): return None
result = self._rows[self.rownumber]
self.rownumber = self.rownumber+1
return result
def fetchmany(self, size=None):
"""Fetch up to size rows from the cursor. Result set may be smaller
than size. If size is not defined, cursor.arraysize is used."""
self._check_executed()
end = self.rownumber + (size or self.arraysize)
result = self._rows[self.rownumber:end]
self.rownumber = min(end, len(self._rows))
return result
def fetchall(self):
"""Fetchs all available rows from the cursor."""
self._check_executed()
if self.rownumber:
result = self._rows[self.rownumber:]
else:
result = self._rows
self.rownumber = len(self._rows)
return result
def scroll(self, value, mode='relative'):
"""Scroll the cursor in the result set to a new position according
to mode.
If mode is 'relative' (default), value is taken as offset to
the current position in the result set, if set to 'absolute',
value states an absolute target position."""
self._check_executed()
if mode == 'relative':
r = self.rownumber + value
elif mode == 'absolute':
r = value
else:
self.errorhandler(self, ProgrammingError,
"unknown scroll mode %s" % `mode`)
if r < 0 or r >= len(self._rows):
self.errorhandler(self, IndexError, "out of range")
self.rownumber = r
def __iter__(self):
self._check_executed()
result = self.rownumber and self._rows[self.rownumber:] or self._rows
return iter(result)
class <API key>(object):
"""This is a MixIn class which causes the result set to be stored
in the server and sent row-by-row to client side, i.e. it uses
mysql_use_result(). You MUST retrieve the entire result set and
close() the cursor before additional queries can be peformed on
the connection."""
_defer_warnings = True
def _get_result(self): return self._get_db().use_result()
def fetchone(self):
"""Fetches a single row from the cursor."""
self._check_executed()
r = self._fetch_row(1)
if not r:
self._warning_check()
return None
self.rownumber = self.rownumber + 1
return r[0]
def fetchmany(self, size=None):
"""Fetch up to size rows from the cursor. Result set may be smaller
than size. If size is not defined, cursor.arraysize is used."""
self._check_executed()
r = self._fetch_row(size or self.arraysize)
self.rownumber = self.rownumber + len(r)
if not r:
self._warning_check()
return r
def fetchall(self):
"""Fetchs all available rows from the cursor."""
self._check_executed()
r = self._fetch_row(0)
self.rownumber = self.rownumber + len(r)
self._warning_check()
return r
def __iter__(self):
return self
def next(self):
row = self.fetchone()
if row is None:
raise StopIteration
return row
class <API key>(object):
"""This is a MixIn class that causes all rows to be returned as tuples,
which is the standard form required by DB API."""
_fetch_type = 0
class CursorDictRowsMixIn(object):
"""This is a MixIn class that causes all rows to be returned as
dictionaries. This is a non-standard feature."""
_fetch_type = 1
def fetchoneDict(self):
"""Fetch a single row as a dictionary. Deprecated:
Use fetchone() instead. Will be removed in 1.3."""
from warnings import warn
warn("fetchoneDict() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
return self.fetchone()
def fetchmanyDict(self, size=None):
"""Fetch several rows as a list of dictionaries. Deprecated:
Use fetchmany() instead. Will be removed in 1.3."""
from warnings import warn
warn("fetchmanyDict() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
return self.fetchmany(size)
def fetchallDict(self):
"""Fetch all available rows as a list of dictionaries. Deprecated:
Use fetchall() instead. Will be removed in 1.3."""
from warnings import warn
warn("fetchallDict() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
return self.fetchall()
class <API key>(CursorDictRowsMixIn):
"""This is a MixIn class that returns rows as dictionaries with
the same key convention as the old Mysqldb (MySQLmodule). Don't
use this."""
_fetch_type = 2
class Cursor(<API key>, <API key>,
BaseCursor):
"""This is the standard Cursor class that returns rows as tuples
and stores the result set in the client."""
class DictCursor(<API key>, CursorDictRowsMixIn,
BaseCursor):
"""This is a Cursor class that returns rows as dictionaries and
stores the result set in the client."""
class SSCursor(<API key>, <API key>,
BaseCursor):
"""This is a Cursor class that returns rows as tuples and stores
the result set in the server."""
class SSDictCursor(<API key>, CursorDictRowsMixIn,
BaseCursor):
"""This is a Cursor class that returns rows as dictionaries and
stores the result set in the server.""" |
// Implements console.log, console.error, console.time, et al and emits a
// console event for each output.
'use strict';
var _createClass = require('babel-runtime/helpers/create-class')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _Map = require('babel-runtime/core-js/map')['default'];
var _require = require('util');
var format = _require.format;
var inspect = _require.inspect;
module.exports = (function () {
function Console(browser) {
_classCallCheck(this, Console);
this.browser = browser;
this.counters = new _Map();
this.timers = new _Map();
}
_createClass(Console, [{
key: 'assert',
value: function assert(truth) {
if (truth) return;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var formatted = format.apply(undefined, [''].concat(args));
var message = 'Assertion failed: ' + (formatted || 'false');
this.browser.emit('console', 'error', message);
throw new Error(message);
}
}, {
key: 'count',
value: function count(name) {
var current = this.counters.get(name) || 0;
var next = current + 1;
this.counters.get(name, next);
var message = name + ': ' + next;
this.browser.emit('console', 'log', message);
}
}, {
key: 'debug',
value: function debug() {
this.browser.emit('console', 'debug', format.apply(undefined, arguments));
}
}, {
key: 'error',
value: function error() {
this.browser.emit('console', 'error', format.apply(undefined, arguments));
}
}, {
key: 'group',
value: function group() {}
}, {
key: 'groupCollapsed',
value: function groupCollapsed() {}
}, {
key: 'groupEnd',
value: function groupEnd() {}
}, {
key: 'dir',
value: function dir(object) {
this.browser.emit('console', 'log', inspect(object));
}
}, {
key: 'info',
value: function info() {
this.browser.emit('console', 'log', format.apply(undefined, arguments));
}
}, {
key: 'log',
value: function log() {
this.browser.emit('console', 'log', format.apply(undefined, arguments));
}
}, {
key: 'time',
value: function time(name) {
this.timers.set(name, Date.now());
}
}, {
key: 'timeEnd',
value: function timeEnd(name) {
var start = this.timers.set(name);
this.timers['delete'](name);
var message = name + ': ' + (Date.now() - start) + 'ms';
this.browser.emit('console', 'log', message);
}
}, {
key: 'trace',
value: function trace() {
var error = new Error();
var stack = error.stack.split('\n');
stack[0] = 'console.trace()';
var message = stack.join('\n');
this.browser.emit('console', 'trace', message);
}
}, {
key: 'warn',
value: function warn() {
this.browser.emit('console', 'log', format.apply(undefined, arguments));
}
}]);
return Console;
})();
//# sourceMappingURL=console.js.map |
<div class="panel {{panelClass}}">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa {{icon}} fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div data-ng-transclude></div>
</div>
</div>
</div>
<!--a href="
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa <API key>"></i></span>
<div class="clearfix"></div>
</div>
</a
</div> |
package com.easyweb.entity.core;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "t_model_property")
public class ModelProperty {
@Id
@GeneratedValue
private Integer id;
@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
@JoinColumn(name="model_id")
private Model model;
@Column(length = 31, name = "property_name")
private String propertyName;
@Column(length = 1, name = "property_type")
private String propertyType;
@Column(length = 15, name = "column_type")
private String columnType;
@Column(length = 31, name = "column_precision")
private String columnPrecision;
@Version
@Column(name = "last_update")
private Date lastUpdate;
public Integer getId() {
return id;
}
private void setId(Integer id) {
this.id = id;
}
public Model getModel() {
return model;
}
public void setModel(Model model) {
this.model = model;
}
public String getPropertyName() {
return propertyName;
}
public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}
public String getPropertyType() {
return propertyType;
}
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
public String getColumnType() {
return columnType;
}
public void setColumnType(String columnType) {
this.columnType = columnType;
}
public String getColumnPrecision() {
return columnPrecision;
}
public void setColumnPrecision(String columnPrecision) {
this.columnPrecision = columnPrecision;
}
public Date getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
} |
using UnityEngine;
using System.Collections;
public class LockRotation : MonoBehaviour {
public Transform target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
transform.eulerAngles = target.eulerAngles;
}
} |
#ifndef __vtkXBLImage_h__
#define __vtkXBLImage_h__
#include "vtkObject.h"
#include "<API key>.h"
#include <vector>
class vtkXBLImage : public vtkObject
{
public:
static vtkXBLImage *New();
vtkTypeMacro(vtkXBLImage, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
public:
vtkXBLImage& operator=(const vtkXBLImage& I);
vtkXBLImage Clone() const;
vtkSetMacro(Width, int);
vtkGetMacro(Width, int);
vtkSetMacro(Height, int);
vtkGetMacro(Height, int);
void AllocateData();
float operator()(int i,int j) const;
float& operator()(int i,int j);
void r(vtkXBLImage& outImage) const;
void g(vtkXBLImage& outImage) const;
void b(vtkXBLImage& outImage) const;
vtkXBLImage operator+(const vtkXBLImage& I) const;
vtkXBLImage operator-(const vtkXBLImage& I) const;
vtkXBLImage operator*(const vtkXBLImage& I) const;
vtkXBLImage& operator+=(const vtkXBLImage& I);
Derivative along x-axis
vtkXBLImage XGradient() const;
Median filter, write results in \a M
void CalculateMedian(int radius, vtkXBLImage& M) const;
Median filter for a color image
vtkXBLImage <API key>(int radius) const;
box filter
vtkXBLImage BoxFilter(int radius) const;
weighted median filter
vtkXBLImage <API key>(const vtkXBLImage& guidance, const vtkXBLImage& where, int vMin, int vMax, int radius, float sigmaSpace, float sigmaColor) const;
Averaging filter with box of \a radius
Index in histogram \a tab reaching median.
static int MedianHistogram(const std::vector<float>& tab);
protected:
Calculate square L2 distance
float <API key>(int x1,int y1, int x2,int y2) const;
Compute weighted histogram of image values
void <API key>(std::vector<float>& tab, int x, int y, int radius, float vMin,
const vtkXBLImage& guidance, float sSpace, float sColor) const;
void FreeMemory();
protected:
int* Count;
float* ImageData;
int Width;
int Height;
private:
vtkXBLImage(int width, int height);
vtkXBLImage(float* pix, int width, int height);
vtkXBLImage(const vtkXBLImage& I);
~vtkXBLImage();
};
#endif //__vtkXBLImage_h__ |
<?php
/* @WebProfiler/Profiler/bag.html.twig */
class <API key> extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "<table ";
if (array_key_exists("class", $context)) {
echo "class='";
echo twig_escape_filter($this->env, $this->getContext($context, "class"), "html", null, true);
echo "'";
}
echo " >
<thead>
<tr>
<th scope=\"col\">Key</th>
<th scope=\"col\">Value</th>
</tr>
</thead>
<tbody>
";
// line 9
$context['_parent'] = (array) $context;
$context['_seq'] = <API key>(twig_sort_filter($this->getAttribute($this->getContext($context, "bag"), "keys", array())));
foreach ($context['_seq'] as $context["_key"] => $context["key"]) {
// line 10
echo " <tr>
<th>";
// line 11
echo twig_escape_filter($this->env, $context["key"], "html", null, true);
echo "</th>
";
// line 13
echo " <td>";
echo twig_escape_filter($this->env, <API key>($this->getAttribute($this->getContext($context, "bag"), "get", array(0 => $context["key"]), "method"), (64 | 256)), "html", null, true);
echo "</td>
</tr>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['key'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 16
echo " </tbody>
</table>
";
}
public function getTemplateName()
{
return "@WebProfiler/Profiler/bag.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 56 => 16, 46 => 13, 42 => 11, 39 => 10, 35 => 9, 19 => 1,);
}
} |
"""
Twitter Most Followed
Finding out top most followed accounts by a particular
group of Twitter users such as the Hacker News community.
For this exercise we consider @newsyc20 as our *source*,
and @newsyc20 followers as the HNers, our *target group*.
You can easily run the exercise for a different target
group by specifying the corresponding target group source.
Or you can modify the script so it considers several
sources to start from, such as @newsyc20, @brainpickings,
and @ThisIsSethsBlog. This should be more interesting.
"""
import twitter as t
from twitter import TweepError
import redis
r = redis.StrictRedis(db=0)
import storage
s = storage.RedisStorage(r)
from datetime import datetime
select_user_data = lambda u: dict([(k, getattr(u, k)) for k in \
['screen_name', 'name', 'description', 'friends_count', 'followers_count']])
def load_user_data(user_id=None, screen_name=None):
"""
Retrieve and set user's data.
Or get it from the store if already there.
"""
assert bool(user_id) != bool(screen_name)
if user_id:
user_data = s.get_user_data(user_id)
if user_data:
return user_id, user_data
user = t.get_user(user_id=user_id)
else: # screen_name
user = t.get_user(screen_name=screen_name)
user_id = user.id
user_data = select_user_data(user)
s.set_user_data(user_id, user_data)
return user_id, user_data
def load_followers(user_id):
"""
Retrieve and set user's followers.
"""
followers = sorted(list(t.followers_ids(user_id)))
s.set_followers(user_id, followers)
# followers = s.get_followers(user_id)
return followers
def load_friends(user_id):
"""
Retrieve and set user's friends.
"""
if s.is_protected(user_id) or \
s.has_friends(user_id): # loaded before
return
try:
friends = sorted(list(t.friends_ids(user_id)))
s.set_friends(user_id, friends)
except TweepError, e:
if 'Not authorized' in str(e):
s.mark_protected(user_id)
def aggregate_friends():
"Aggregate friends into top most followed."
s.set_most_followed()
def top_most_followed(n):
"""
Display top n most followed.
"""
i = 1
top = s.get_most_followed(n) # withscores
format = "%d | %d | %s | %s | %s ([@%s](https://twitter.com/%s))"
print "Rank | Popularity | Followers | Friends | Name (@twitter)"
print "
for user_id, score in top:
user_id, user_data = load_user_data(user_id=user_id)
print format % (i, score,
user_data['followers_count'], user_data['friends_count'],
user_data['name'],
user_data['screen_name'], user_data['screen_name'])
i += 1
def main():
"""
Starting from a source (e.g. @newsyc20),
consider the target group as the source's followers, and
find out top most followed accounts by the target group.
"""
# Step 1: Identify the source
print "\nStep 1: %s" % datetime.now()
source_name = 'newsyc20' # target group source
source_id, source_data = load_user_data(screen_name=source_name)
# Step 2: Load target group members
print "\nStep 2: %s" % datetime.now()
followers = load_followers(source_id) # target group
# Step 3: Load friends of target group members
print "\nStep 3: %s" % datetime.now()
for follower_id in followers:
load_friends(user_id=follower_id)
# Step 4: Aggregate friends into top most followed
print "\nStep 4: %s" % datetime.now()
aggregate_friends() # count friend occurrences
print "\nDone: %s" % datetime.now()
print "\nTop most followed by @%s's followers" % source_name
top_most_followed(100) # display results
if __name__ == '__main__':
main() |
@media only screen and (min-width:640px) {
h1 {
font-size: 3em;
line-height: 1.05em;
}
h2 {
font-size: 2.25em;
line-height: 1.25em;
}
h3 {
font-size: 1.75em;
line-height: 1.25em;
}
h4 {
font-size: 1.125em;
line-height: 1.22em;
}
h5 {
font-size: .9em;
line-height: 1em;
}
.col-1 {
width: 16.5%;
}
.col-2 {
width: 32%;
}
.col-3 {
width: 49.5%;
}
.col-4 {
width: 65%;
}
.col-5 {
width: 82.5%;
}
.col-6 {
width: 99%;
}
#profile-items img {
display: inline;
}
#profile-name h1, h3{
display: inline-block;
}
.table {
display: block;
margin: 0;
}
.table ul {
display: block;
padding-left: 1em;
}
.table li {
display: block;
padding: .5em 0;
}
.icon-menu {
display: none;
}
} |
// purpose with or without fee is hereby granted, provided that the above
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
package algorithms.dayoftheprogrammer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;
import java.util.stream.Stream;
class SolutionTest implements ArgumentsProvider {
private static final int YEAR_RIGHT_OFFSET = 4;
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext extensionContext) {
return Stream.of(
Arguments.of("13.09.2017"),
Arguments.of("12.09.2016"),
Arguments.of("13.09.1915"),
Arguments.of("12.09.1800"),
Arguments.of("12.09.1700")
);
}
@ArgumentsSource(SolutionTest.class)
@ParameterizedTest
void solve(String expected) {
Assertions.assertEquals(expected, Solution.solve(extractYear(expected)));
}
private int extractYear(String expected) {
return Integer.parseInt(expected.substring(expected.length() - YEAR_RIGHT_OFFSET));
}
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>W28638_text</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;">
<div style="float: left;">
<a href="page22.html">«</a>
</div>
<div style="float: right;">
</div>
</div>
<hr/>
<div style="position: absolute; margin-left: 989px; margin-top: 0px;">
<p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 219px; margin-top: 136px;">
<p class="styleSans210.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"> <br/>DEVIATION RECORD <br/>9258 47.2 <br/>5 762 0 70 9,289 49.6 <br/>5 857 1.20 _53.5 5 951 1.40 — 9,352 57.5 <br/> <br/> <br/>6.046 1.40 9,384 61.6 . 65.80 <br/>9,447 69 1 <br/>9.479 73.4 9,513 <br/>1.80 1.60 <br/>1.40 78.5 <br/> </p>
</div>
<div style="position: absolute; margin-left: 1236px; margin-top: 3134px;">
<p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">12 </p>
</div>
<div style="position: absolute; margin-left: 2529px; margin-top: 0px;">
<p class="styleSans420.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
</body>
</html> |
import { expect } from 'chai';
import * as d from '../../../decorators';
import { QueryParser } from '../../../queries/queryparser';
import { InMemoryQuery } from '../query';
import { ModelManager } from '../../../models/manager';
import { InMemoryBackend } from '../backend';
import { IObject } from '../../../utils/types';
class TestModel {
@d.TextField() name: string;
@d.TextField() job_title: string;
@d.IntegerField() score: number;
@d.DateTimeField() registration_date: Date;
@d.BooleanField() active: boolean;
}
let record1 = {
name: 'John Doe',
job_title: '',
score: 27,
registration_date: '2017-03-04',
active: true
};
let record2 = {
name: 'Jane Doe',
job_title: 'Registrar',
score: 33,
registration_date: '2016-11-08',
active: false
};
let manager: ModelManager;
let parser: QueryParser;
function getQuery(query: IObject) {
return new InMemoryQuery(parser.<API key>(TestModel, query));
}
describe('InMemoryQuery', () => {
beforeEach(() => {
manager = new ModelManager();
manager.registerBackend('default', new InMemoryBackend());
manager.register(TestModel);
parser = new QueryParser(manager);
});
describe('Empty query', () => {
it('returns true for any record when query = {}', () => {
let query = getQuery({});
expect(query.testRecord(record1)).to.be.true;
expect(query.testRecord(record2)).to.be.true;
});
});
describe('Implicit AND', () => {
it('returns true when one field is queried and matches', () => {
let query = getQuery({ name: 'John Doe' });
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when one field is queried and does not match', () => {
let query = getQuery({ name: 'Bruce Lee' });
expect(query.testRecord(record1)).to.be.false;
});
it('returns true when two fields are queried and match', () => {
let query = getQuery({
name: 'John Doe',
score: 27
});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when two fields are queried and one does not match', () => {
let query = getQuery({
name: 'Jane Lee',
score: 27
});
expect(query.testRecord(record1)).to.be.false;
});
it('returns false when two fields are queried and both do not match', () => {
let query = getQuery({
name: 'Jane Lee',
score: 42
});
expect(query.testRecord(record1)).to.be.false;
});
});
describe('Explicit AND', () => {
it('returns true when one field is queried and matches', () => {
let query = getQuery({ _and: [{ name: 'John Doe' }]});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when one field is queried and does not match', () => {
let query = getQuery({ _and: [{ name: 'Bruce Lee' }]});
expect(query.testRecord(record1)).to.be.false;
});
it('returns true when two fields are queried and match', () => {
let query = getQuery({ _and: [
{ name: { _eq: 'John Doe'}},
{ score: { _eq: 27 }}
]});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when two fields are queried and one does not match', () => {
let query = getQuery({ _and: [
{ name: { _eq: 'Jane Lee' }},
{ score: { _eq: 27 }},
]});
expect(query.testRecord(record1)).to.be.false;
});
it('returns false when two fields are queried and both do not match', () => {
let query = getQuery({ _and: [
{ name: { _eq: 'Jane Lee'}},
{ score: { _eq: 42 }},
]});
expect(query.testRecord(record1)).to.be.false;
});
});
describe('Explcit OR', () => {
it('returns true when one field is queried and matches', () => {
let query = getQuery({ _or: [{ name: 'John Doe' }]});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when one field is queried and does not match', () => {
let query = getQuery({ _or: [{ name: 'Bruce Lee' }]});
expect(query.testRecord(record1)).to.be.false;
});
it('returns true when two fields are queried and match', () => {
let query = getQuery({ _or: [
{ name: { _eq: 'John Doe'}},
{ score: { _eq: 27 }}
]});
expect(query.testRecord(record1)).to.be.true;
});
it('returns true when two fields are queried and one does not match', () => {
let query = getQuery({ _or: [
{ name: { _eq: 'Jane Lee' }},
{ score: { _eq: 27 }},
]});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when two fields are queried and both do not match', () => {
let query = getQuery({ _or: [
{ name: { _eq: 'Jane Lee'}},
{ score: { _eq: 42 }},
]});
expect(query.testRecord(record1)).to.be.false;
});
});
describe('Implicit AND plus Explcit OR', () => {
it('returns true when one field per conjunction is queried and matches', () => {
let query = getQuery({
score: 27,
_or: [{ active: true }]
});
expect(query.testRecord(record1)).to.be.true;
});
it('returns true when two fields are AND-ed and both match', () => {
let query = getQuery({
name: 'John Doe',
score: 27,
_or: [{ active: true }]
});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when two fields are AND-ed and one does not match', () => {
let query = getQuery({
name: 'John Doe',
score: 29,
_or: [{ active: true }]
});
expect(query.testRecord(record1)).to.be.false;
});
it('returns true when both OR conditions are matched', () => {
let query = getQuery({
name: 'John Doe',
_or: [
{ score: 27 },
{ active: true },
]
});
expect(query.testRecord(record1)).to.be.true;
});
it('returns true when one OR condition is matched', () => {
let query = getQuery({
name: 'John Doe',
_or: [
{ score: 27 },
{ active: true },
]
});
expect(query.testRecord(record1)).to.be.true;
});
it('returns false when neither OR condition is matched', () => {
let query = getQuery({
name: 'John Doe',
_or: [
{ score: { _lt: 10 }},
{ score: { _gt: 50 }}
]
});
expect(query.testRecord(record1)).to.be.false;
});
});
function expectResult(field: string, operator: string, queryValue: any, result: boolean) {
let queryObj: any = {};
queryObj[field] = {};
queryObj[field][operator] = queryValue;
let query = getQuery(queryObj);
expect(query.testRecord(record1)).to.equal(result);
}
describe('Field operators', () => {
// TODO: Tests around comparisons with different data types
// OR: Enforce query value types based on field type (probably better!)
it('_eq returns true if field is equal to query value', () => {
expectResult('score', '_eq', 27, true);
});
it('_eq returns false if field is not equal to query value', () => {
expectResult('score', '_eq', 31, false);
});
it('_ne returns true if field is not equal to query value', () => {
expectResult('score', '_ne', 31, true);
});
it('_ne returns false if field is equal to query value', () => {
expectResult('score', '_ne', 27, false);
});
it('_gt returns true if field is greater than query value', () => {
expectResult('score', '_gt', 20, true);
});
it('_gt returns false if field is equal to query value', () => {
expectResult('score', '_gt', 27, false);
});
it('_gt returns false if field is less than query value', () => {
expectResult('score', '_gt', 30, false);
});
it('_gte returns true if field is greater than query value', () => {
expectResult('score', '_gte', 20, true);
});
it('_gte returns true if field is equal to query value', () => {
expectResult('score', '_gte', 27, true);
});
it('_gte returns false if field is less than query value', () => {
expectResult('score', '_gte', 30, false);
});
it('_lt returns true if field is less than query value', () => {
expectResult('score', '_lt', 30, true);
});
it('_lt returns false if field is equal to query value', () => {
expectResult('score', '_lt', 27, false);
});
it('_lt returns false if field is greater than query value', () => {
expectResult('score', '_lt', 20, false);
});
it('_lte returns true if field is less than query value', () => {
expectResult('score', '_lte', 30, true);
});
it('_lte returns true if field is equal to query value', () => {
expectResult('score', '_lte', 27, true);
});
it('_lte returns false if field is greater than query value', () => {
expectResult('score', '_lte', 20, false);
});
it('_like returns true when field and query expression are empty', () => {
expectResult('job_title', '_like', '', true);
});
it('_like returns false when field is not empty and query expression is empty', () => {
expectResult('name', '_like', '', false);
});
it('_like matches a partial string with wildcards', () => {
expectResult('name', '_like', '% %', true);
expectResult('name', '_like', '%Doe', true);
});
it('_like does not match a partial string without wildcards', () => {
expectResult('name', '_like', ' ', false);
expectResult('name', '_like', 'Doe', false);
});
it('_like with just a wildcard matches anything', () => {
expectResult('name', '_like', '%', true);
expectResult('job_title', '_like', '%', true);
});
it('_like matches with wildcards in the middle of the query', () => {
expectResult('name', '_like', '%oh%oe', true);
});
it('_like is case-insensitive', () => {
expectResult('name', '_like', '%dOe', true);
});
it('_like allows matches on non-string fields', () => {
expectResult('registration_date', '_like', '%2017%', true);
});
it('_like throws an Error when comparison value is not a string', () => {
expect(() => {
expectResult('registration_date', '_like', 27, true);
}).to.throw('Supplied value is not a string');
});
it('_in returns true when field value is in the list', () => {
expectResult('score', '_in', [26, 27, 28], true);
});
it('_in returns false when field value is not in the list', () => {
expectResult('score', '_in', [46, 47, 48], false);
});
it('_in returns false when query value is an empty list', () => {
expectResult('score', '_in', [], false);
});
it('_nin returns true when field value is not in the list', () => {
expectResult('score', '_nin', [46, 47, 48], true);
});
it('_nin returns false when field value is in the list', () => {
expectResult('score', '_nin', [26, 27, 28], false);
});
it('_nin returns true when query value is an empty list', () => {
expectResult('score', '_nin', [], true);
});
});
}); |
import unittest
from pathlib import Path
from html_minifier import Minifier
from html_minifier import DjangoMinifier
class TestMinify(unittest.TestCase):
ext_min = "_min"
file_name = "base"
_file = "{0}.html"
location = "html"
def setUp(self):
path = Path(__file__).parent
file_name = ""
names = (self.file_name, self.ext_min)
html_vars = ["html", "html_min"]
for i, name in enumerate(names):
file_name = ''.join([file_name, name])
_file = self._file.format(file_name)
f = path.joinpath(self.location, _file).open()
setattr(self, html_vars[i], f.read())
f.close()
def test_minifier(self):
mini = Minifier(self.html)
self.assertEqual(mini.minify(), self.html_min)
class TestMinifyDjango(TestMinify):
file_name = "django"
def test_minifier(self):
mini = DjangoMinifier(self.html)
self.assertEqual(mini.minify(), self.html_min) |
package adamb;
import javax.swing.AbstractListModel;
import adamb.vorbis.CommentField;
import adamb.vorbis.VorbisCommentHeader;
import java.io.*;
public class CommentListModel extends AbstractListModel
{
public VorbisCommentHeader comments;
public CommentListModel(VorbisCommentHeader vch)
{
comments = vch;
}
public Object getElementAt(int index)
{
CommentField cf = comments.fields.get(index);
//replace new lines with \
try
{
BufferedReader br = new BufferedReader(new StringReader(cf.value));
String line = br.readLine();
StringBuilder sb = new StringBuilder(cf.name);
sb.append('=');
boolean first = true;
while (line != null)
{
if (!first)
sb.append(" \\ ");
else
first = false;
sb.append(line);
line = br.readLine();
}
//if the string is too long clip it off
if (sb.length() > 128)
{
sb.setLength(125);
sb.append("...");
}
return sb.toString();
}
catch (IOException ioe)
{
return null;
//will never happen with StringReader
}
}
public int getSize()
{
return comments.fields.size();
}
public void fireChanged(int idx)
{
fireContentsChanged(this, idx, idx);
}
public void add(CommentField cf)
{
int idx = comments.fields.size();
comments.fields.add(cf);
fireIntervalAdded(this, idx, idx);
}
public void remove(int idx)
{
comments.fields.remove(idx);
fireIntervalRemoved(this, idx, idx);
}
} |
# <API key>: true
module Acfs::Resource::Attributes
# @api public
# Integer attribute type. Use it in your model as an attribute type:
# @example
# class User < Acfs::Resource
# attribute :name, :integer
# end
class Integer < Base
# @api public
# Cast given object to integer.
# @param [Object] value Object to cast.
# @return [Fixnum] Casted object as fixnum.
def cast_value(value)
if value.blank?
0
else
Integer(value)
end
end
end
end |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FunctionalTest
{
internal class <API key> : Exception
{
public static <API key> Create(string topMostException)
{
<API key> ex0 = new <API key>(topMostException);
<API key> ex1 = new <API key>("Cyka Blyat!", ex0);
<API key> ex2 = new <API key>("BLIN!", ex1);
<API key> ex3 = new <API key>("VODKA!", ex2);
<API key> ex4 = new <API key>("I don't know anymore", ex3);
return ex4;
}
private <API key>(string message) : base(message)
{
}
private <API key>(string message, Exception inner) : base(message, inner)
{
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.