code stringlengths 4 1.01M |
|---|
package pieces;
import java.util.ArrayList;
import chess.ChessboardCell;
/**
* This is the Bishop Class.
* The Move Function defines the basic rules for movement of Bishop on a chess board
*
*
*/
public class Bishop extends Piece{
//Constructor
public Bishop(String i,String p,int c)
{
setId(i);
setPath(p);
setColor(c);
}
//move function defined. It returns a list of all the possible destinations of a Bishop
//The basic principle of Bishop Movement on chess board has been implemented
public ArrayList<ChessboardCell> move(ChessboardCell state[][],int x,int y)
{
//Bishop can Move diagonally in all 4 direction (NW,NE,SW,SE)
//This function defines that logic
possiblemoves.clear();
int tempx=x+1;
int tempy=y-1;
while(tempx<8&&tempy>=0)
{
if(state[tempx][tempy].getpiece()==null)
{
possiblemoves.add(state[tempx][tempy]);
}
else if(state[tempx][tempy].getpiece().getcolor()==this.getcolor())
break;
else
{
possiblemoves.add(state[tempx][tempy]);
break;
}
tempx++;
tempy--;
}
tempx=x-1;tempy=y+1;
while(tempx>=0&&tempy<8)
{
if(state[tempx][tempy].getpiece()==null)
possiblemoves.add(state[tempx][tempy]);
else if(state[tempx][tempy].getpiece().getcolor()==this.getcolor())
break;
else
{
possiblemoves.add(state[tempx][tempy]);
break;
}
tempx--;
tempy++;
}
tempx=x-1;tempy=y-1;
while(tempx>=0&&tempy>=0)
{
if(state[tempx][tempy].getpiece()==null)
possiblemoves.add(state[tempx][tempy]);
else if(state[tempx][tempy].getpiece().getcolor()==this.getcolor())
break;
else
{
possiblemoves.add(state[tempx][tempy]);
break;
}
tempx--;
tempy--;
}
tempx=x+1;tempy=y+1;
while(tempx<8&&tempy<8)
{
if(state[tempx][tempy].getpiece()==null)
possiblemoves.add(state[tempx][tempy]);
else if(state[tempx][tempy].getpiece().getcolor()==this.getcolor())
break;
else
{
possiblemoves.add(state[tempx][tempy]);
break;
}
tempx++;
tempy++;
}
return possiblemoves;
}
} |
using Chloe.DbExpressions;
using Chloe.RDBMS;
namespace Chloe.PostgreSQL.MethodHandlers
{
class Trim_Handler : IMethodHandler
{
public bool CanProcess(DbMethodCallExpression exp)
{
if (exp.Method != PublicConstants.MethodInfo_String_Trim)
return false;
return true;
}
public void Process(DbMethodCallExpression exp, SqlGeneratorBase generator)
{
generator.SqlBuilder.Append("RTRIM(LTRIM(");
exp.Object.Accept(generator);
generator.SqlBuilder.Append("))");
}
}
}
|
package uristqwerty.CraftGuide.api;
import java.util.List;
/**
* When a recipe is rendered, the ItemSlots provided to the template are
* used to determine the layout of the recipe's items.
*
* @deprecated API re-organization. Use the copy in uristqwerty.craftguide.api.slotTypes
* instead, if possible. This copy will remain until at least Minecraft 1.14, probably longer.
*/
@SuppressWarnings("deprecation")
@Deprecated
public class ItemSlot implements Slot
{
/**
* This slot's size and location relative to the containing
* recipe's top left corner
*/
public int x, y, width, height;
/**
* Used by {@link ItemSlotImplementation#draw} to decide
* whether to draw a background before drawing the actual
* slot contents.
*/
public boolean drawBackground;
/**
* A sneaky field that is read by the default recipe implementation
* when an instance is created. If an ItemStack with a quantity
* greater than one would match up to an ItemSlot where
* drawQuantity equals false, it replaces the stack with one
* with a size of 1. This is only provided for convenience, it
* is entirely possibly to implement the same logic if it
* is needed but unavailable, such as with a custom recipe,
* or an implementation of Slot that is not an ItemSlot.
* <br><br>
* The actual effect of this field may change in the future
* (for example, copying only part of the method that Minecraft
* uses to draw the item overlay, making the part that draws the
* stack size conditional), but for the moment, I'm assuming that
* doing it this way will be more compatible if Minecraft changes
* its implementation in the future, or if another mod edits
* {@link net.minecraft.src.RenderItem#renderItemOverlayIntoGUI}.
*/
public boolean drawQuantity;
/**
* Used by {@link ItemSlotImplementation#matches} to
* restrict what sort of searches can match this slot
*/
public SlotType slotType = SlotType.INPUT_SLOT;
/**
* Implementation of ItemSlot functionality, allowing it
* to change if needed, without altering the API. This
* field is set during CraftGuide's {@literal @PreInit}.
*/
public static ItemSlotImplementation implementation;
/**
* Creates a new ItemSlot. Same as
* {@link #ItemSlot(int, int, int, int, boolean)}, with
* false as the last parameter.
* @param x
* @param y
* @param width
* @param height
*/
public ItemSlot(int x, int y, int width, int height)
{
this(x, y, width, height, false);
}
/**
* Creates a new ItemSlot
* @param x
* @param y
* @param width
* @param height
* @param drawQuantity
*/
public ItemSlot(int x, int y, int width, int height, boolean drawQuantity)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.drawQuantity = drawQuantity;
}
@Override
public void draw(Renderer renderer, int x, int y, Object[] data, int dataIndex, boolean isMouseOver)
{
implementation.draw(this, renderer, x, y, data[dataIndex], isMouseOver);
}
@Override
public List<String> getTooltip(int x, int y, Object[] data, int dataIndex)
{
return implementation.getTooltip(this, data[dataIndex]);
}
@Override
public boolean matches(ItemFilter search, Object[] data, int dataIndex, SlotType type)
{
return implementation.matches(this, search, data[dataIndex], type);
}
@Override
public boolean isPointInBounds(int x, int y, Object[] data, int dataIndex)
{
return implementation.isPointInBounds(this, x, y);
}
@Override
public ItemFilter getClickedFilter(int x, int y, Object[] data, int dataIndex)
{
return implementation.getClickedFilter(x, y, data[dataIndex]);
}
/**
* Sets whether or not this ItemSlot draws a background square
* during its draw method.
* @param draw
* @return this, to permit method chaining
*/
public ItemSlot drawOwnBackground(boolean draw)
{
drawBackground = draw;
return this;
}
/**
* Sets whether or not this ItemSlot draws a background square
* during its draw method. Same as {@link #drawOwnBackground()},
* but uses the default value of true.
* @return this, to permit method chaining
*/
public ItemSlot drawOwnBackground()
{
return drawOwnBackground(true);
}
/**
* Sets the {@link SlotType} associated with this ItemSlot.
* The SlotType is used for searches, both from in-game, and
* from the use of the API
* @param type
* @return this ItemSlot, to permit method chaining
*/
public ItemSlot setSlotType(SlotType type)
{
slotType = type;
return this;
}
} |
<?php
class acf_field_ETAC_has_capability extends acf_field {
/*
* __construct
*
* This function will setup the field type data
*
* @type function
* @date 5/03/2014
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function __construct() {
/*
* name (string) Single word, no spaces. Underscores allowed
*/
$this->name = 'ETAC_has_capability';
/*
* label (string) Multiple words, can include spaces, visible when selecting a field type
*/
$this->label = __('ETAC Has Capability', 'acf-ETAC_has_capability');
/*
* category (string) basic | content | choice | relational | jquery | layout | CUSTOM GROUP NAME
*/
$this->category = 'ETAC';
/*
* defaults (array) Array of default settings which are merged into the field object. These are used later in settings
*/
$this->defaults = array(
// something...
);
/*
* l10n (array) Array of strings that are used in JavaScript. This allows JS strings to be translated in PHP and loaded via:
* var message = acf._e('ETAC_has_capability', 'error');
*/
$this->l10n = array(
'error' => __('Error! Please enter a higher value', 'acf-ETAC_has_capability'),
);
add_filter( 'acf/get_field_groups', array($this, 'hide_ETAC_groups'), 10, 1 );
add_filter( 'acf/get_fields', array($this, 'hide_ETAC_fields'), 10, 1 );
// do not delete!
parent::__construct();
}
function render_field_settings( $field ) {
$caps = array();
if( isset( $field['etac_caps'] ) ){
$caps = $field['etac_caps'];
}
global $wp_roles;
$roles = $wp_roles->roles;
$role_caps = array();
foreach( $roles as $role ){
$role_caps = array_merge(array_keys($role['capabilities']), $role_caps);
}
sort( $role_caps );
$choice_caps = array();
foreach( $role_caps as $role_cap ){
$choice_caps[$role_cap] = $role_cap;
}
?>
<?php
acf_render_field_setting( $field, array(
'label' => __('Capabilities','acf-ETAC_has_capability'),
'instructions' => __("Evaluates to 'true' if the current user has one of selected capabilites. Click and hold 'shift' to select more than one capabilities. This field is never visible.",'acf-ETAC_has_capability'),
'type' => 'select',
'class' => 'etac_caps',
'multiple' => true,
'name' => 'etac_caps',
'value' => $caps,
'choices' => $choice_caps,
'layout' => 'vertical',
'conditional_logic' => 0
));
}
function render_field( $field ) {
?>
<?php
}
function hide_ETAC_groups( $field_groups ){
$hidden_ids = array();
foreach( $field_groups as $id => $field_group ){
$fields = acf_get_fields_by_id( $field_group['ID'] );
foreach( $fields as $field ){
if( $field['type'] == 'ETAC_has_capability' ){
$flag = false;
foreach( $field['etac_caps'] as $cap ){
if(current_user_can($cap)){
$flag = true;
break;
}
}
if( ! $flag ){
$hidden_ids[] = $id;
}
}
}
}
foreach( $hidden_ids as $hidden_id ){
unset( $field_groups[$hidden_id] );
}
return $field_groups;
}
function hide_ETAC_fields( $fields ){
foreach( $fields as $id => $field ){
if( $field['type'] == 'ETAC_has_capability' ){
unset($fields[$id]);
}
}
return $fields;
}
/*
* input_admin_enqueue_scripts()
*
* This action is called in the admin_enqueue_scripts action on the edit screen where your field is created.
* Use this action to add CSS + JavaScript to assist your render_field() action.
*
* @type action (admin_enqueue_scripts)
* @since 3.6
* @date 23/01/13
*
* @param n/a
* @return n/a
*/
/*
function input_admin_enqueue_scripts() {
}
*/
/*
* input_admin_head()
*
* This action is called in the admin_head action on the edit screen where your field is created.
* Use this action to add CSS and JavaScript to assist your render_field() action.
*
* @type action (admin_head)
* @since 3.6
* @date 23/01/13
*
* @param n/a
* @return n/a
*/
/*
function input_admin_head() {
}
*/
/*
* input_form_data()
*
* This function is called once on the 'input' page between the head and footer
* There are 2 situations where ACF did not load during the 'acf/input_admin_enqueue_scripts' and
* 'acf/input_admin_head' actions because ACF did not know it was going to be used. These situations are
* seen on comments / user edit forms on the front end. This function will always be called, and includes
* $args that related to the current screen such as $args['post_id']
*
* @type function
* @date 6/03/2014
* @since 5.0.0
*
* @param $args (array)
* @return n/a
*/
/*
function input_form_data( $args ) {
}
*/
/*
* input_admin_footer()
*
* This action is called in the admin_footer action on the edit screen where your field is created.
* Use this action to add CSS and JavaScript to assist your render_field() action.
*
* @type action (admin_footer)
* @since 3.6
* @date 23/01/13
*
* @param n/a
* @return n/a
*/
/*
function input_admin_footer() {
}
*/
/*
* field_group_admin_enqueue_scripts()
*
* This action is called in the admin_enqueue_scripts action on the edit screen where your field is edited.
* Use this action to add CSS + JavaScript to assist your render_field_options() action.
*
* @type action (admin_enqueue_scripts)
* @since 3.6
* @date 23/01/13
*
* @param n/a
* @return n/a
*/
function field_group_admin_enqueue_scripts() {
$dir = plugin_dir_url( __FILE__ );
wp_register_style( 'acf-input-ETAC_has_capability', "{$dir}css/input.css" );
wp_enqueue_style('acf-input-ETAC_has_capability');
}
/*
* field_group_admin_head()
*
* This action is called in the admin_head action on the edit screen where your field is edited.
* Use this action to add CSS and JavaScript to assist your render_field_options() action.
*
* @type action (admin_head)
* @since 3.6
* @date 23/01/13
*
* @param n/a
* @return n/a
*/
/*
function field_group_admin_head() {
}
*/
/*
* load_value()
*
* This filter is applied to the $value after it is loaded from the db
*
* @type filter
* @since 3.6
* @date 23/01/13
*
* @param $value (mixed) the value found in the database
* @param $post_id (mixed) the $post_id from which the value was loaded
* @param $field (array) the field array holding all the field options
* @return $value
*/
/*
function load_value( $value, $post_id, $field ) {
return $value;
}
*/
/*
* update_value()
*
* This filter is applied to the $value before it is saved in the db
*
* @type filter
* @since 3.6
* @date 23/01/13
*
* @param $value (mixed) the value found in the database
* @param $post_id (mixed) the $post_id from which the value was loaded
* @param $field (array) the field array holding all the field options
* @return $value
*/
/*
function update_value( $value, $post_id, $field ) {
return $value;
}
*/
/*
* format_value()
*
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
*
* @type filter
* @since 3.6
* @date 23/01/13
*
* @param $value (mixed) the value which was loaded from the database
* @param $post_id (mixed) the $post_id from which the value was loaded
* @param $field (array) the field array holding all the field options
*
* @return $value (mixed) the modified value
*/
/*
function format_value( $value, $post_id, $field ) {
// bail early if no value
if( empty($value) ) {
return $value;
}
// apply setting
if( $field['font_size'] > 12 ) {
// format the value
// $value = 'something';
}
// return
return $value;
}
*/
/*
* validate_value()
*
* This filter is used to perform validation on the value prior to saving.
* All values are validated regardless of the field's required setting. This allows you to validate and return
* messages to the user if the value is not correct
*
* @type filter
* @date 11/02/2014
* @since 5.0.0
*
* @param $valid (boolean) validation status based on the value and the field's required setting
* @param $value (mixed) the $_POST value
* @param $field (array) the field array holding all the field options
* @param $input (string) the corresponding input name for $_POST value
* @return $valid
*/
/*
function validate_value( $valid, $value, $field, $input ){
// Basic usage
if( $value < $field['custom_minimum_setting'] )
{
$valid = false;
}
// Advanced usage
if( $value < $field['custom_minimum_setting'] )
{
$valid = __('The value is too little!','acf-ETAC_has_capability'),
}
// return
return $valid;
}
*/
/*
* delete_value()
*
* This action is fired after a value has been deleted from the db.
* Please note that saving a blank value is treated as an update, not a delete
*
* @type action
* @date 6/03/2014
* @since 5.0.0
*
* @param $post_id (mixed) the $post_id from which the value was deleted
* @param $key (string) the $meta_key which the value was deleted
* @return n/a
*/
/*
function delete_value( $post_id, $key ) {
}
*/
/*
* load_field()
*
* This filter is applied to the $field after it is loaded from the database
*
* @type filter
* @date 23/01/2013
* @since 3.6.0
*
* @param $field (array) the field array holding all the field options
* @return $field
*/
/*
function load_field( $field ) {
return $field;
}
*/
/*
* update_field()
*
* This filter is applied to the $field before it is saved to the database
*
* @type filter
* @date 23/01/2013
* @since 3.6.0
*
* @param $field (array) the field array holding all the field options
* @return $field
*/
/*
function update_field( $field ) {
return $field;
}
*/
/*
* delete_field()
*
* This action is fired after a field is deleted from the database
*
* @type action
* @date 11/02/2014
* @since 5.0.0
*
* @param $field (array) the field array holding all the field options
* @return n/a
*/
/*
function delete_field( $field ) {
}
*/
}
// create field
new acf_field_ETAC_has_capability();
?>
|
package ch.x01.fuzzy.core;
import ch.x01.fuzzy.parser.SymbolTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
/**
* This class implements the concept of a linguistic variable. Linguistic variables take on values
* defined in its term set - its set of linguistic terms. Linguistic terms are subjective categories
* for the linguistic variable. For example, for linguistic variable 'age', the term set T(age) may
* be defined as follows:
* <p>
* T(age)={"young", "middle aged", "old"}
* </p>
* Each linguistic term is associated with a reference fuzzy set, each of which has a defined
* membership function (MF).
*/
public class LinguisticVariable {
private static final Logger logger = LoggerFactory.getLogger(LinguisticVariable.class);
private final String name;
private final Map<String, MembershipFunction> termSet = new HashMap<>();
private double value;
/**
* Constructs a linguistic variable. The constructed variable needs to be registered with the symbol table.
*
* @param name the name of this linguistic variable
*/
public LinguisticVariable(String name) {
this.name = name.toLowerCase();
}
/**
* Constructs a linguistic variable and registers it with the symbol table.
*
* @param name the name of this linguistic variable
* @param symbolTable the table where linguistic variables and its terms are registered
*/
public LinguisticVariable(String name, SymbolTable symbolTable) {
this.name = name.toLowerCase();
symbolTable.registerLV(this);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
LinguisticVariable that = (LinguisticVariable) o;
return Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
/**
* Returns the name of this linguistic variable.
*
* @return name
*/
public String getName() {
return this.name;
}
/**
* Returns the current crisp value for this linguistic variable.
*
* @return current value
*/
public double getValue() {
return this.value;
}
/**
* Sets a crisp value for this linguistic variable.
*
* @param value the value
*/
public void setValue(double value) {
this.value = value;
if (logger.isDebugEnabled()) {
logger.debug(String.format("Set crisp value = %.4f for linguistic variable \"%s\".", this.value, this.name));
}
}
/**
* Adds a linguistic term with its associated membership function to the variable's term set.
*
* @param name the name of linguistic term
* @param mf the associated membership function
*/
public void addTerm(String name, MembershipFunction mf) {
String term = name.toLowerCase();
if (!this.termSet.containsKey(term)) {
this.termSet.put(term, mf);
} else {
throw new RuntimeException(String.format(
"Cannot add linguistic term \"%s\" because it is already a member of the term set of linguistic variable \"%s\".",
term, this.name));
}
}
/**
* Computes the degree of membership for a crisp input value for a given linguistic term.
*
* @param name the name of linguistic term
* @return degree of membership for the given linguistic term as a result of fuzzification or -1
* if fuzzification is not possible.
*/
public double is(String name) {
double result;
String term = name.toLowerCase();
if (this.termSet.containsKey(term)) {
MembershipFunction mf = this.termSet.get(term);
result = mf.fuzzify(this.value);
} else {
throw new RuntimeException(String.format(
"Cannot compute fuzzification for linguistic term \"%s\" because it is not a member of the term set of linguistic variable \"%s\".",
term, this.name));
}
return result;
}
/**
* Returns the membership function associated to the specified linguistic term.
*
* @param name the name of linguistic term
* @return the associated membership function
*/
public MembershipFunction getMembershipFunction(String name) {
MembershipFunction mf;
String term = name.toLowerCase();
if (this.termSet.containsKey(term)) {
mf = this.termSet.get(term);
} else {
throw new RuntimeException(
String.format(
"Cannot retrieve membership function because linguistic term \"%s\" is not a member of the term set of linguistic variable \"%s\".",
term, this.name));
}
return mf;
}
public boolean containsTerm(String name) {
return this.termSet.containsKey(name.toLowerCase());
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
for (Iterator<String> it = this.termSet.keySet()
.iterator(); it.hasNext(); ) {
builder.append(it.next());
if (it.hasNext()) {
builder.append(", ");
}
}
return "T(" + this.name + ") = {" + builder.toString() + "}";
}
}
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gramfuzz.fields import *
import names
TOP_CAT = "postal"
# Adapted from https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form
# The name rules have been modified and placed into names.py
class PDef(Def):
cat = "postal_def"
class PRef(Ref):
cat = "postal_def"
EOL = "\n"
# this will be the top-most rule
Def("postal_address",
PRef("name-part"), PRef("street-address"), PRef("zip-part"),
cat="postal")
# these will be the grammar rules that should not be randomly generated
# as a top-level rule
PDef("name-part",
Ref("name", cat=names.TOP_CAT), EOL
)
PDef("street-address",
PRef("house-num"), PRef("street-name"), Opt(PRef("apt-num")), EOL,
sep=" ")
PDef("house-num", UInt)
PDef("street-name", Or(
"Sesame Street", "Yellow Brick Road", "Jump Street", "Evergreen Terrace",
"Elm Street", "Baker Street", "Paper Street", "Wisteria Lane",
"Coronation Street", "Rainey Street", "Spooner Street",
"0day Causeway", "Diagon Alley",
))
PDef("zip-part",
PRef("town-name"), ", ", PRef("state-code"), " ", PRef("zip-code"), EOL
)
PDef("apt-num",
UInt(min=0, max=10000), Opt(String(charset=String.charset_alpha_upper, min=1, max=2))
)
PDef("town-name", Or(
"Seoul", "São Paulo", "Bombay", "Jakarta", "Karachi", "Moscow",
"Istanbul", "Mexico City", "Shanghai", "Tokyo", "New York", "Bangkok",
"Beijing", "Delhi", "London", "HongKong", "Cairo", "Tehran", "Bogota",
"Bandung", "Tianjin", "Lima", "Rio de Janeiro" "Lahore", "Bogor",
"Santiago", "St Petersburg", "Shenyang", "Calcutta", "Wuhan", "Sydney",
"Guangzhou", "Singapore", "Madras", "Baghdad", "Pusan", "Los Angeles",
"Yokohama", "Dhaka", "Berlin", "Alexandria", "Bangalore", "Malang",
"Hyderabad", "Chongqing", "Ho Chi Minh City",
))
PDef("state-code", Or(
"AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA",
"GU", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MH",
"MA", "MI", "FM", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM",
"NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "VI", "WA", "WV", "WI", "WY",
))
PDef("zip-code",
String(charset="123456789",min=1,max=2), String(charset="0123456789",min=4,max=5),
Opt("-", String(charset="0123456789",min=4,max=5))
)
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.customerinsights.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.customerinsights.fluent.models.RoleResourceFormatInner;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/** The response of list role assignment operation. */
@Fluent
public final class RoleListResult {
@JsonIgnore private final ClientLogger logger = new ClientLogger(RoleListResult.class);
/*
* Results of the list operation.
*/
@JsonProperty(value = "value")
private List<RoleResourceFormatInner> value;
/*
* Link to the next set of results.
*/
@JsonProperty(value = "nextLink")
private String nextLink;
/**
* Get the value property: Results of the list operation.
*
* @return the value value.
*/
public List<RoleResourceFormatInner> value() {
return this.value;
}
/**
* Set the value property: Results of the list operation.
*
* @param value the value value to set.
* @return the RoleListResult object itself.
*/
public RoleListResult withValue(List<RoleResourceFormatInner> value) {
this.value = value;
return this;
}
/**
* Get the nextLink property: Link to the next set of results.
*
* @return the nextLink value.
*/
public String nextLink() {
return this.nextLink;
}
/**
* Set the nextLink property: Link to the next set of results.
*
* @param nextLink the nextLink value to set.
* @return the RoleListResult object itself.
*/
public RoleListResult withNextLink(String nextLink) {
this.nextLink = nextLink;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (value() != null) {
value().forEach(e -> e.validate());
}
}
}
|
# DEPRECATED
Please use [hexo-html-minifier](https://github.com/hexojs/hexo-html-minifier) and [hexo-clean-css](https://github.com/hexojs/hexo-clean-css) instead.
<hr>
# hexo-generator-minify
A plugin for [Hexo](http://zespia.tw/hexo) to generate static site with _minified_ CSS and Javascript resources.
The plugin process file with the `.css` or `.js` extension, files containing the `.min` or `.pack` suffix in their name will be ignored.
## Usage
### Install
```
npm install hexo-generator-minify --save
```
### Update
```
npm update
```
### Uninstall
```
npm uninstall hexo-generator-minify
```
### Usage
```
hexo gm
```
Options:
`--cssSafe`: Skip [_dangerous transformations_](https://github.com/rstacruz/css-condense#the-dangerous-things-it-does) while minimizing CSS
## More info
The _hexo-generator-minify_ plugin borrows a lot from [hexo-minifer](https://npmjs.org/package/hexo-minifer) by [ChrisYip](https://github.com/ChrisYip). Explore other [Hexo plugins](https://github.com/tommy351/hexo/wiki/plugins).
|
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Sun\\' => array($baseDir . '/src'),
'PhpDocReader\\' => array($vendorDir . '/php-di/phpdoc-reader/src/PhpDocReader'),
'Invoker\\' => array($vendorDir . '/php-di/invoker/src'),
'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'DI\\' => array($vendorDir . '/php-di/php-di/src/DI'),
);
|
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:4.0.30319.42000
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Sample.Properties {
using System;
/// <summary>
/// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
/// </summary>
// このクラスは StronglyTypedResourceBuilder クラスが ResGen
// または Visual Studio のようなツールを使用して自動生成されました。
// メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
// ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sample.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
/// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "WXPBGeneratedMessage.h"
@interface IMBehaviorMsgOP : WXPBGeneratedMessage
{
}
+ (void)initialize;
// Remaining properties
@property(nonatomic) int appMsgInnerType; // @dynamic appMsgInnerType;
@property(nonatomic) int count; // @dynamic count;
@property(nonatomic) int msgOpType; // @dynamic msgOpType;
@property(nonatomic) int msgType; // @dynamic msgType;
@end
|
#ifndef LIC_NUMBER_TYPE
#define LIC_NUMBER_TYPE
#include "RuntimeType.h"
namespace lic
{
// TODO: Make generic and inherit actual types
class NumberType : public RuntimeType
{
public:
virtual std::string Name() const;
virtual std::string ToString(gsl::byte* data) const;
virtual void PerformUnaryOp(Opcode op, gsl::byte* data) const;
virtual void PerformBinaryOp(Opcode op, gsl::byte* leftData, RuntimeType* rightType, gsl::byte* rightData) const;
static void StoreConstant(int32_t val, gsl::byte* data);
static NumberType& Instance();
private:
NumberType();
};
}
#endif // !LIC_NUMBER_TYPE |
<?php
namespace Illuminate\Database\Eloquent\Relations;
use Closure;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Eloquent\Collection;
abstract class Relation {
/**
* The Eloquent query builder instance.
*
* @var \Illuminate\Database\Eloquent\Builder
*/
protected $query;
/**
* The parent model instance.
*
* @var \Illuminate\Database\Eloquent\Model
*/
protected $parent;
/**
* The related model instance.
*
* @var \Illuminate\Database\Eloquent\Model
*/
protected $related;
/**
* Indicates if the relation is adding constraints.
*
* @var bool
*/
protected static $constraints = true;
/**
* Create a new relation instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @return void
*/
public function __construct(Builder $query, Model $parent) {
$this->query = $query;
$this->parent = $parent;
$this->related = $query->getModel();
$this->addConstraints();
}
/**
* Set the base constraints on the relation query.
*
* @return void
*/
abstract public function addConstraints();
/**
* Set the constraints for an eager load of the relation.
*
* @param array $models
* @return void
*/
abstract public function addEagerConstraints(array $models);
/**
* Initialize the relation on a set of models.
*
* @param array $models
* @param string $relation
* @return array
*/
abstract public function initRelation(array $models, $relation);
/**
* Match the eagerly loaded results to their parents.
*
* @param array $models
* @param \Illuminate\Database\Eloquent\Collection $results
* @param string $relation
* @return array
*/
abstract public function match(array $models, Collection $results, $relation);
/**
* Get the results of the relationship.
*
* @return mixed
*/
abstract public function getResults();
/**
* Get the relationship for eager loading.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getEager() {
return $this->get();
}
/**
* Touch all of the related models for the relationship.
*
* @return void
*/
public function touch() {
$column = $this->getRelated()->getUpdatedAtColumn();
$this->rawUpdate(array($column => $this->getRelated()->freshTimestampString()));
}
/**
* Run a raw update against the base query.
*
* @param array $attributes
* @return int
*/
public function rawUpdate(array $attributes = array()) {
return $this->query->update($attributes);
}
/**
* Add the constraints for a relationship count query.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Builder $parent
* @return \Illuminate\Database\Eloquent\Builder
*/
public function getRelationCountQuery(Builder $query, Builder $parent) {
$query->select(new Expression('count(*)'));
$key = $this->wrap($this->getQualifiedParentKeyName());
return $query->where($this->getHasCompareKey(), '=', new Expression($key));
}
/**
* Run a callback with constraints disabled on the relation.
*
* @param \Closure $callback
* @return mixed
*/
public static function noConstraints(Closure $callback) {
static::$constraints = false;
// When resetting the relation where clause, we want to shift the first element
// off of the bindings, leaving only the constraints that the developers put
// as "extra" on the relationships, and not original relation constraints.
$results = call_user_func($callback);
static::$constraints = true;
return $results;
}
/**
* Get all of the primary keys for an array of models.
*
* @param array $models
* @param string $key
* @return array
*/
protected function getKeys(array $models, $key = null) {
return array_unique(array_values(array_map(function($value) use ($key) {
return $key ? $value->getAttribute($key) : $value->getKey();
}, $models)));
}
/**
* Get the underlying query for the relation.
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function getQuery() {
return $this->query;
}
/**
* Get the base query builder driving the Eloquent builder.
*
* @return \Illuminate\Database\Query\Builder
*/
public function getBaseQuery() {
return $this->query->getQuery();
}
/**
* Get the parent model of the relation.
*
* @return \Illuminate\Database\Eloquent\Model
*/
public function getParent() {
return $this->parent;
}
/**
* Get the fully qualified parent key name.
*
* @return string
*/
public function getQualifiedParentKeyName() {
return $this->parent->getQualifiedKeyName();
}
/**
* Get the related model of the relation.
*
* @return \Illuminate\Database\Eloquent\Model
*/
public function getRelated() {
return $this->related;
}
/**
* Get the name of the "created at" column.
*
* @return string
*/
public function createdAt() {
return $this->parent->getCreatedAtColumn();
}
/**
* Get the name of the "updated at" column.
*
* @return string
*/
public function updatedAt() {
return $this->parent->getUpdatedAtColumn();
}
/**
* Get the name of the related model's "updated at" column.
*
* @return string
*/
public function relatedUpdatedAt() {
return $this->related->getUpdatedAtColumn();
}
/**
* Wrap the given value with the parent query's grammar.
*
* @param string $value
* @return string
*/
public function wrap($value) {
return $this->parent->newQueryWithoutScopes()->getQuery()->getGrammar()->wrap($value);
}
/**
* Handle dynamic method calls to the relationship.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters) {
$result = call_user_func_array(array($this->query, $method), $parameters);
if ($result === $this->query)
return $this;
return $result;
}
}
|
#include <stdio.h>
#include <math.h>
#define MAX_POS 9
int main(){
unsigned long int x, y;
int dx, dy, pos, carry, ncrry;
while (scanf("%lu %lu", &x, &y) && !(x == 0 && y == 0)){
carry = ncrry = 0;
for (pos = 0; pos < MAX_POS; pos++){
dx = x % 10;
dy = y % 10;
x /= 10;
y /= 10;
if (dx + dy + carry >= 10){
carry = 1;
ncrry++;
}
else
carry = 0;
}
if (ncrry == 0)
printf("No carry operation.\n");
else
printf("%d carry operation%s.\n", ncrry, ncrry == 1 ? "" : "s");
}
return 0;
}
|
var Observer = require('../../../../src/observer')
var config = require('../../../../src/config')
var _ = require('../../../../src/util')
describe('Observer', function () {
it('create on non-observables', function () {
// skip primitive value
var ob = Observer.create(1)
expect(ob).toBeUndefined()
// avoid vue instance
ob = Observer.create(new _.Vue())
expect(ob).toBeUndefined()
// avoid frozen objects
ob = Observer.create(Object.freeze({}))
expect(ob).toBeUndefined()
})
it('create on object', function () {
// on object
var obj = {
a: {},
b: {}
}
var ob = Observer.create(obj)
expect(ob instanceof Observer).toBe(true)
expect(ob.value).toBe(obj)
expect(obj.__ob__).toBe(ob)
// should've walked children
expect(obj.a.__ob__ instanceof Observer).toBe(true)
expect(obj.b.__ob__ instanceof Observer).toBe(true)
// should return existing ob on already observed objects
var ob2 = Observer.create(obj)
expect(ob2).toBe(ob)
})
it('create on array', function () {
// on object
var arr = [{}, {}]
var ob = Observer.create(arr)
expect(ob instanceof Observer).toBe(true)
expect(ob.value).toBe(arr)
expect(arr.__ob__).toBe(ob)
// should've walked children
expect(arr[0].__ob__ instanceof Observer).toBe(true)
expect(arr[1].__ob__ instanceof Observer).toBe(true)
})
it('observing object prop change', function () {
var obj = { a: { b: 2 } }
Observer.create(obj)
// mock a watcher!
var watcher = {
deps: [],
addDep: function (dep) {
this.deps.push(dep)
dep.addSub(this)
},
update: jasmine.createSpy()
}
// collect dep
Observer.setTarget(watcher)
obj.a.b
Observer.setTarget(null)
expect(watcher.deps.length).toBe(3) // obj.a + a.b + b
obj.a.b = 3
expect(watcher.update.calls.count()).toBe(1)
// swap object
obj.a = { b: 4 }
expect(watcher.update.calls.count()).toBe(2)
watcher.deps = []
Observer.setTarget(watcher)
obj.a.b
Observer.setTarget(null)
expect(watcher.deps.length).toBe(3)
// set on the swapped object
obj.a.b = 5
expect(watcher.update.calls.count()).toBe(3)
})
it('observing $add/$set/$delete', function () {
var obj = { a: 1 }
var ob = Observer.create(obj)
var dep = ob.dep
spyOn(dep, 'notify')
obj.$add('b', 2)
expect(obj.b).toBe(2)
expect(dep.notify.calls.count()).toBe(1)
obj.$delete('a')
expect(obj.hasOwnProperty('a')).toBe(false)
expect(dep.notify.calls.count()).toBe(2)
// should ignore adding an existing key
obj.$add('b', 3)
expect(obj.b).toBe(2)
expect(dep.notify.calls.count()).toBe(2)
// set existing key, should be a plain set and not
// trigger own ob's notify
obj.$set('b', 3)
expect(obj.b).toBe(3)
expect(dep.notify.calls.count()).toBe(2)
// set non-existing key
obj.$set('c', 1)
expect(obj.c).toBe(1)
expect(dep.notify.calls.count()).toBe(3)
// should ignore deleting non-existing key
obj.$delete('a')
expect(dep.notify.calls.count()).toBe(3)
// should work on non-observed objects
var obj2 = { a: 1 }
obj2.$delete('a')
expect(obj2.hasOwnProperty('a')).toBe(false)
})
it('observing array mutation', function () {
var arr = []
var ob = Observer.create(arr)
var dep = ob.dep
spyOn(dep, 'notify')
var objs = [{}, {}, {}]
arr.push(objs[0])
arr.pop()
arr.unshift(objs[1])
arr.shift()
arr.splice(0, 0, objs[2])
arr.sort()
arr.reverse()
expect(dep.notify.calls.count()).toBe(7)
// inserted elements should be observed
objs.forEach(function (obj) {
expect(obj.__ob__ instanceof Observer).toBe(true)
})
})
it('array $set', function () {
var arr = [1]
var ob = Observer.create(arr)
var dep = ob.dep
spyOn(dep, 'notify')
arr.$set(0, 2)
expect(arr[0]).toBe(2)
expect(dep.notify.calls.count()).toBe(1)
// setting out of bound index
arr.$set(2, 3)
expect(arr[2]).toBe(3)
expect(dep.notify.calls.count()).toBe(2)
})
it('array $remove', function () {
var arr = [{}, {}]
var obj1 = arr[0]
var obj2 = arr[1]
var ob = Observer.create(arr)
var dep = ob.dep
spyOn(dep, 'notify')
// remove by index
arr.$remove(0)
expect(arr.length).toBe(1)
expect(arr[0]).toBe(obj2)
expect(dep.notify.calls.count()).toBe(1)
// remove by identity, not in array
arr.$remove(obj1)
expect(arr.length).toBe(1)
expect(arr[0]).toBe(obj2)
expect(dep.notify.calls.count()).toBe(1)
// remove by identity, in array
arr.$remove(obj2)
expect(arr.length).toBe(0)
expect(dep.notify.calls.count()).toBe(2)
})
it('no proto', function () {
config.proto = false
// object
var obj = {a: 1}
var ob = Observer.create(obj)
expect(obj.$add).toBeTruthy()
expect(obj.$delete).toBeTruthy()
var dep = ob.dep
spyOn(dep, 'notify')
obj.$add('b', 2)
expect(dep.notify).toHaveBeenCalled()
// array
var arr = [1, 2, 3]
var ob2 = Observer.create(arr)
expect(arr.$set).toBeTruthy()
expect(arr.$remove).toBeTruthy()
expect(arr.push).not.toBe([].push)
var dep2 = ob2.dep
spyOn(dep2, 'notify')
arr.push(1)
expect(dep2.notify).toHaveBeenCalled()
config.proto = true
})
})
|
const { BrowserWindow } = require('electron');
const path = require('path');
class RecorderWindow {
constructor() {
let htmlPath = 'file://' + path.join(__dirname, '..') + '/pages/recorder_window.html'
this.window = new BrowserWindow({
show: false,
height: 400,
width: 600,
minHeight: 200,
minWidth: 200,
frame: false,
hasShadow: false,
alwaysOnTop: true,
transparent: true,
resizable: true
});
this.window.loadURL(htmlPath);
}
disable() {
this.window.setResizable(false);
this.window.setIgnoreMouseEvents(true);
}
enable() {
this.window.setResizable(true);
this.window.setIgnoreMouseEvents(false);
}
}
module.exports = RecorderWindow;
|
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace XF_Map.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
}
|
---
layout: page
title: About
---
# Hey there!

This is Apaar Shanker. Right now I am a Ph.D. student at
Georgia Tech in the College of Computing. I graduated from
IISc Bangalore with the two degrees of Bachelors and Masters
of Science in 2015.
I am an avowed bookworm, a map addict, a wannabe foreign policy
wonk and a self acclaimed history and economics aficionado.
I like talking a lot. I am a good listener too. I can be obnoxiously
frank and annoyingly evasive. I like visiting places but I prefer
sitting by myself in the winter sun and letting my mind wander
through a good travelogue.
I read everything but I am slightly partial towards high fantasy
and historical fiction.If you like wars and histories and want to
figure out how the world works we can totally hit it off!
Enjoy!
Apaar
email me @ {{ site.author.email }}
|
# Simple Content
This for website with simple content
##Installation
Add `"rofil/simple-content": "dev-master"` into composer.json as follows
```
...
"requires": {
...
"rofil/simple-content": "dev-master"
...
}
...
```
and update by running `composer update`
##Register
Register the bundle in app/AppKernel.php as follow:
```
...
new Rofil\Simple\ContentBundle\RofilSimpleContentBundle(),
...
```
##Routing
Update routing.yml|xml by addin following code:
```
...
rofil_simple_content:
resource: "@RofilSimpleContentBundle/Controller/"
type: annotation
prefix: /
...
```
##Update Database schema
Update database schema by running symfony command `php app/console doctrine:schema:update --force`
##Security
Adding access control in security.yml as follows:
```
...
access_control:
...
- { path: ^/manage/information, roles: ROLE_MANAGER }
- { path: ^/manage/news, roles: ROLE_MANAGER }
...
...
``` |
shared_examples_for :enumeratorize do |method|
ruby_version_is '' ... '1.8.7' do
it 'raises a LocalJumpError if no block given' do
lambda{ Itr[1,2].send(method) }.should raise_error(LocalJumpError)
end
end
ruby_version_is '1.8.7' do
it 'returns an Enumerator if no block given' do
Itr[1,2].send(method).should be_an_instance_of(enumerator_class)
end
end
end
|
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="icon" type="image/png" href="favicon.ico">
<title>Jerimiah Woods</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Add your site or application content here -->
<div id="content">
<div id="header">
<div class="col-md-3" id="profile-picture">
<img id="pic" src="img/profile_pic.png" alt="Profile Picture" height="160px" width="160px">
</div> <!-- end of profile-picture div -->
<div class="col-md-6" id="name">
Jerimiah Woods<br><span>-Aspiring Software Developer-</span>
</div> <!-- end of name div -->
<div class="col-md-3" id="contact">
4511 Puttor Drive<br>Eau Claire, WI 54701<br>(715) 572-4512<br>woods.jerry@gmail.com
</div> <!-- end of contact div -->
</div> <!-- end of header div -->
<hr>
<div id="resume">
<div class="row">
<div class="col-md-3 heading">
Personal Profile
</div> <!-- end of heading div -->
<div class="col-md-9" id="personal-profile">
<p>I moved to Eau Claire, Wisconsin in 2009 to attend the University of Wisconsin - Eau Claire. I completed a four year degree in Actuarial Science there in 2013. Soon after that I was given the opportunity to do some work with a local software development business where I learned Objective-C and helped to build an iOS application. After that experience I decided to pursue software development as a career and enrolled at Chippewa Valley Technical College. In my three semesters there I have finished all but one class in their Software Developer program. Armed with that education, along with a few side projects and a strong desire and aptitude, I'm looking forward to beginning a career in development here in Eau Claire.</p>
</div> <!-- end of personal-profile div -->
</div> <!-- end of row div -->
<hr>
<div class="row">
<div class="col-md-3 heading">
Education
</div> <!-- end of heading div -->
<div class="col-md-9" id="education">
<div class"row">
<div class="col-md-6 subheading">
Chippewa Valley Technical College
</div>
<div class="col-md-6 sub-subheading">
Anticipated Graduation: December 2015
</div>
</div> <!-- end of row div -->
<div class="details first-school">
<ul>
<li>Associate of Applied Science – Information Technology – Software Developer</li>
<li>65/68 credits completed</li>
<li>Registered to complete final class (ASP .Net) online in Fall 2015</li>
</ul>
</div> <!-- end of details div -->
<div class"row">
<div class="col-md-6 subheading" id="uwec">
University of Wisconsin - Eau Claire
</div>
<div class="col-md-6 sub-subheading">
Graduation Date: May 2013
</div>
</div> <!-- end of row div -->
<div class="details" id="uwec-details">
<ul>
<li>Bachelors of Science - Actuarial Science</li>
<li>Passed Exam FM - Financial Mathematics</li>
</ul>
</div> <!-- end of details div -->
</div> <!-- end of education div -->
</div> <!-- end of row div -->
<hr>
<div class="row">
<div class="col-md-3 heading">
Technologies
</div> <!-- end of heading div -->
<div class="col-md-9" id="technologies">
<div class="details">
<ul>
<li>Software Development: Objective-C, Java, Groovy, Visual Basic, Android</li>
<li>Web Development: HTML, CSS, JavaScript, Java, PHP, Ruby on Rails</li>
<li>Developer Tools: Git, Bitbucket, PivotalTracker, Xcode, Eclipse, IntelliJ, NetBeans</li>
<li>Operating Systems: Mac OSX, Windows, Linux</li>
<li>Databases and Reporting: SQL, Access, Crystal Reports</li>
</ul>
</div> <!-- end of details div -->
</div> <!-- end of technologies div -->
</div> <!-- end of row div -->
<hr>
<div class="row">
<div class="col-md-3 heading">
Portfolio
</div> <!-- end of heading div -->
<div class="col-md-9" id="portfolio">
<div class="details" id="projects">
<ul>
<li><a href="https://github.com/disciple520/InterValve">InterValve</a> is the first project I ever worked on. It is an iOS application I helped build in 2013</li>
<li><a href="todoapp.php">To Do</a> is a PHP web application I am currently building that utilizes JavaScript and MySQL</li>
<li><a href="https://github.com/disciple520/cvtcAgileGroup1">Property World</a> is a web application I built with an agile team at CVTC. We used Ruby on Rails. <a href="property_world_feedback.html" id="feedback-link">Click here</a> to see what my team had to say about me</li>
<li><a href="https://github.com/disciple520/WhereInTheWord">Where in the Word</a> is a personal project I've been working on using Java</li>
</ul>
</div> <!-- end of details div -->
</div> <!-- end of porfolio div -->
</div> <!-- end of row div -->
<hr>
<div class="row">
<div class="col-md-3 heading">
Work History
</div> <!-- end of heading div -->
<div class="col-md-9" id="work-history">
<div class"row">
<div class="col-md-6 subheading">
Mobile Application Developer
</div>
<div class="col-md-6 sub-subheading">
(August 2013 - October 2013)
</div>
</div> <!-- end of row div -->
<div class="row">
<div class="col-md-6 subheading second-row employer">
GalacticTech
</div>
<div class="col-md-6 sub-subheading city">
Mondovi, WI
</div>
</div> <!-- end of employer-line row div -->
<div class="details job">
<ul>
<li>Learned Objective-C through a combination of self-study and professional guidance</li>
<li>Assisted in development of marketing application using Xcode</li>
</ul>
</div> <!-- end of details div -->
<div class"row">
<div class="col-md-6 subheading">
Shift Leader
</div>
<div class="col-md-6 sub-subheading">
(June 2011 - Present)
</div>
</div> <!-- end of row div -->
<div class="row">
<div class="col-md-6 subheading second-row employer">
Kwik Trip, Inc.
</div>
<div class="col-md-6 sub-subheading city">
Eau Claire, WI
</div>
</div> <!-- end of employer-line row div -->
<div class="details job">
<ul>
<li>Effectively lead team on Madison Street, one of the highest volume convenience stores in the Chippewa Valley, to ensure all duties are accomplished in an excellent and timely manner</li>
<li>Demonstrate reliability by maintaining perfect attendance</li>
</ul>
</div> <!-- end of details div -->
<div class"row">
<div class="col-md-6 subheading">
Table Games Dealer/Dual Games Supervisor
</div>
<div class="col-md-6 sub-subheading">
(July 2007 - Sept 2009)
</div>
</div> <!-- end of row div -->
<div class="row">
<div class="col-md-6 subheading second-row employer">
Ho-Chunk Gaming - Nekoosa
</div>
<div class="col-md-6 sub-subheading city">
Nekoosa, WI
</div>
</div> <!-- end of employer-line row div -->
<div class="details job">
<ul>
<li>Personally created and conducted 30-player, semi-weekly poker tournaments</li>
<li>Managed and observed four dealers simultaneously to ensure speed, accuracy, and game security</li>
<li>Delivered excellent and entertaining customer service, building rapport with clientele</li>
</ul>
</div> <!-- end of details div -->
</div> <!-- end of work-history div -->
</div> <!-- end of row div -->
</div> <!-- end of resume div -->
<hr>
<footer>
<p>Site designed by Jerry Woods 2015</p>
</footer>
</div> <!-- end of content div -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.3.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<script src="js/bootstrap.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-63553555-1','auto');ga('send','pageview');
</script>
</body>
</html>
|
require 'spec_helper'
describe EmailCenterApi::Nodes::EmailNode do
describe '.emails' do
context 'when a folder is specified' do
it 'returns all emails in the specified folder' do
json_object = [{ 'text' => 'Reevoo-test', 'nodeId' => '145', 'nodeClass' => 'email_template'}]
expect_any_instance_of(
EmailCenterApi::Query
).to receive(:tree).with('folder', 584).and_return(json_object)
expect(described_class.emails(folder: 584)).to eq([
described_class.new('Reevoo-test', 145, 'email_template')
])
end
it 'does not return sub-folders in the specified folder' do
json_object = [{ 'text' => 'Reevoo-test', 'nodeId' => '145', 'nodeClass' => 'folder'}]
expect_any_instance_of(
EmailCenterApi::Query
).to receive(:tree).with('folder', 584).and_return(json_object)
expect(described_class.emails(folder: 584)).to be_empty
end
it 'returns empty array when folder ID does not exist' do
expect_any_instance_of(
EmailCenterApi::Query
).to receive(:tree).and_raise(EmailCenterApi::ApiError)
expect(described_class.emails(folder: 584)).to be_empty
end
end
context 'when a folder is not specified' do
it 'it retrievs elements from teh root node' do
json_object = [{ 'text' => 'Reevoo-test', 'nodeId' => '145', 'nodeClass' => 'email_template'}]
expect_any_instance_of(
EmailCenterApi::Query
).to receive(:tree).with('folder', 0).and_return(json_object)
expect(described_class.emails).to eq([
described_class.new('Reevoo-test', 145, 'email_template')
])
end
end
end
describe '.folders' do
context 'when a parent node id is not passed in' do
it 'queries the root node' do
json_object = [{ 'text' => 'Reevoo-test', 'nodeId' => '145', 'nodeClass' => 'folder'}]
expect_any_instance_of(
EmailCenterApi::Query
).to receive(:tree).with('folder', 0).and_return(json_object)
expect(described_class.folders).to eq([
described_class.new('Reevoo-test', 145, 'folder')
])
end
end
context 'when a parent node id is passed in' do
it 'queries within the specified folder' do
json_object = [{ 'text' => 'Reevoo-test', 'nodeId' => '145', 'nodeClass' => 'folder'}]
expect_any_instance_of(
EmailCenterApi::Query
).to receive(:tree).with('folder', 777).and_return(json_object)
expect(described_class.folders(folder: 777)).to eq([
described_class.new('Reevoo-test', 145, 'folder')
])
end
end
end
describe '.trigger' do
context 'when an email type node' do
let(:email_address) { 'test@reevoo.com' }
let(:options) { {
'Reviews' => {
'retailer_product_name' => 'Test product',
'retailer_name' => 'test retailer',
'retailer_from' => 'reply@reevoo.com'
}
} }
it 'will trigger sending of the email' do
expect_any_instance_of(
EmailCenterApi::Actions
).to receive(:trigger).with(100, email_address, options)
email = described_class.new('Trigger Test', 100, 'email_triggered')
email.trigger(email_address, options)
end
it 'will raise an arguement invalid error if node is not an email' do
email = described_class.new('Trigger Test', 100, 'folder')
expect {
email.trigger(email_address, options)
}.to raise_error(NoMethodError)
end
end
end
end
|
export class Animal {
protected name: string;
constructor(name: string) {
this.name = name;
}
public say() {
this.out(this.name);
}
protected out(str: string) {
console.info(str);
}
}
|
class CreateJobRunCounts < ActiveRecord::Migration
def self.up
create_table :job_run_counts do |t|
t.integer :counter
t.timestamps
end
end
def self.down
drop_table :job_run_counts
end
end
|
//
// The MIT License (MIT)
//
//
// Copyright (c) 2014 Broad Institute
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
// Created by turner on 2/27/13.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import <Foundation/Foundation.h>
@class IGVAppDelegate;
@class RootContentController;
@interface UIApplication (IGVApplication)
+ (IGVAppDelegate *)sharedIGVAppDelegate;
+ (UINavigationController *)sharedRootNavigationController;
+ (RootContentController *)sharedRootContentController;
@end |
#include "qm.h"
#include "matrix.h"
#include "eq.h"
#include "2el.h"
#include "tools.h"
#include "gradient.h"
#include "vec3.h"
#define EPS 1e-15
static void f_eq30_mp_grad(int ma, int mv, int la, int lv, int qa, int qk, double * g, double ra[3], double rk[3], qmdata * qmd){
double z[3];
r3diff(z, ra, rk);
double r = sqrt(r3dot(z,z));
double r1 = 1.0/r;
r3scal(z, r1);
int qq = MPOSIF(qk,qa);
int bra = qmd->qq_list[qq-1].u1b;
int ket = qmd->qq_list[qq ].u1b;
int lb = MIN(la,lv);
double g1[3] = {0};
double g2[3] = {0};
for(int i=bra; i<ket; i++){
if( (qmd->u1b[i].qu == qa) &&
(qmd->u1b[i].qv == qk) &&
(qmd->u1b[i].lu == la) &&
(qmd->u1b[i].lv == lv) ){
int l = qmd->u1b[i].l;
fgpair_t V = V_eq49_mp_grad(i,la,lv,qa,qk,r,qmd);
double AAB = 0.0;
double tg[3] = {0};
for(int m=-lb; m<=lb; m++){
double gA1[3], A1 = A_grad_z(la, m, ma, gA1, z);
double gA2[3], A2 = A_grad_z(lv, m, mv, gA2, z);
double B0 = B(l,la,lv,0,m,m);
AAB += A1*A2*B0;
r3adds(tg, gA1, A2*B0);
r3adds(tg, gA2, A1*B0);
}
r3adds(g1, z, AAB*V.g);
r3adds(g2, tg, V.f);
}
}
A_grad_z2r(g2, z, r1);
r3add(g, g1);
r3add(g, g2);
return;
}
static void f_eq28_mp_grad(int ma, int mv, int la, int lv, int qa, int qv, double g[3], double ra[3], double rv[3], qmdata * qmd){
double z[3];
r3diff(z, ra, rv);
double r = sqrt(r3dot(z,z));;
double r1 = 1.0/r;
r3scal(z, r1);
int qq = MPOSIF(qa,qv);
int bra = qmd->qq_list[qq-1].f1b;
int ket = qmd->qq_list[qq ].f1b;
double g1[3] = {0};
double g2[3] = {0};
for(int i=bra; i<ket; i++){
if( (qmd->f1b[i].qu == qa) &&
(qmd->f1b[i].qv == qv) &&
(qmd->f1b[i].lu == la) &&
(qmd->f1b[i].lv == lv) ){
int m = qmd->f1b[i].m;
int aph = (((la+m)%2)?(-1):(1));
double gA1[3], A1 = A_grad_z(la, m, ma, gA1, z);
double gA2[3], A2 = A_grad_z(lv, m, mv, gA2, z);
double AA = A1*A2;
fgpair_t F = F_eq48_grad(i, la,lv, qa,qv, r, qmd);
double tg[3];
r3sums(tg, gA1, A2, gA2, A1);
if(m){
double gA1_[3], A1_ = A_grad_z(la, -m, ma, gA1_, z);
double gA2_[3], A2_ = A_grad_z(lv, -m, mv, gA2_, z);
AA += A1_*A2_;
r3adds(tg, gA1_, A2_);
r3adds(tg, gA2_, A1_);
}
r3adds(g1, z, AA*aph*F.g);
r3adds(g2, tg, aph*F.f);
}
}
A_grad_z2r(g2, z, r1);
r3sum(g, g1, g2);
return;
}
static void R0_eq39_mmmp_grad(int a, int v, int u1, int v1,
double g[3], double ra[3], double ru1[3],
basis * bo, basis * bv, qmdata * qmd){
double z[3];
r3diff(z, ra, ru1);
double r = sqrt(r3dot(z,z));
double r1 = 1.0/r;
r3scal(z, r1);
int qa = bv->Q[a ];
int qu1 = bo->Q[u1];
int ma = bv->m[a ];
int la = bv->l[a ];
int mv = bo->m[v ];
int lv = bo->l[v ];
int mu1 = bo->m[u1];
int lu1 = bo->l[u1];
int mv1 = bo->m[v1];
int lv1 = bo->l[v1];
double A1, A2, A3, A4;
double gA1[3], gA2[3], gA3[3], gA4[3];
double g1[3]={0}, g2[3]={0};
for(int m_=-la;m_<=la;m_++){
A1 = A_grad_z(la,m_,ma,gA1,z);
for(int m__=-lv;m__<=lv;m__++){
A2 = A_grad_z(lv,m__,mv,gA2,z);
for(int m1_=-lu1;m1_<=lu1;m1_++){
A3 = A_grad_z(lu1,m1_,mu1,gA3,z);
for(int m1__=-lv1;m1__<=lv1;m1__++){
A4 = A_grad_z(lv1,m1__,mv1,gA4,z);
double AAAA = A1*A2*A3*A4;
double BBG = 0.0;
double BBgG = 0.0;
double tg[3]={0};
r3adds(tg, gA1, A2*A3*A4);
r3adds(tg, gA2, A1*A3*A4);
r3adds(tg, gA3, A1*A2*A4);
r3adds(tg, gA4, A1*A2*A3);
for(int l=abs(la-lv); l<=la+lv; l++){
double q1;
if( ! qlll_pm(qa, la, lv, l, &q1, qmd)){
continue;
}
for(int l1=abs(lu1-lv1); l1<=lu1+lv1; l1++){
double q2;
if( ! qlll_mm(qu1, lu1, lv1, l1, &q2, qmd)){
continue;
}
int lm = MIN(l,l1);
for(int m=-lm; m<=lm; m++){
double B1 = B(l, la, lv, m, m_, m__);
if(fabs(B1)<EPS){
continue;
}
double B2 = B(l1, lu1, lv1, m, m1_, m1__);
if(fabs(B2)<EPS){
continue;
}
fgpair_t G = G_eq52_mmmp_grad(m,l,l1,la,lv,lu1,lv1,qa,qu1,q1,q2,r,qmd);
BBgG += B1*B2*G.g;
BBG += B1*B2*G.f;
}
}
}
r3adds(g1, z, AAAA*BBgG);
r3adds(g2, tg, BBG);
}
}
}
}
A_grad_z2r(g2, z, r1);
r3sum(g, g1, g2);
return;
}
static void dFav_dRk_1c(int a, int v, int k,
double g[3], double * Da, double * Db,
int * alo, basis * bo, basis * bv, mol * m, qmdata * qmd){
int ka = bv->k[a];
int qa = bv->Q[a];
int la = bv->l[a];
int ma = bv->m[a];
int lv = bo->l[v];
int mv = bo->m[v];
f_eq30_mp_grad(ma, mv, la, lv, qa, m->q[k], g, m->r+3*ka, m->r+3*k, qmd);
for(int u1=alo[k]; u1<alo[k+1]; u1++){
for(int v1=u1; v1<alo[k+1]; v1++){
int u1v1 = mpos(u1,v1);
double tg[3];
R0_eq39_mmmp_grad(a, v, u1, v1, tg, m->r+3*ka, m->r+3*k, bo, bv, qmd);
double D = Da[u1v1]+Db[u1v1];
if(u1!=v1){
D *= 2.0;
}
else{
int q1 = bo->Q[u1];
int l1 = bo->l[u1];
D -= qmd->p[q1*(qmd->nLo)+l1]/(2.0*l1+1.0);
}
r3adds(g, tg, D);
}
}
return;
}
static void dFav_dRk_2c(int a, int v,
double ga[3], double gb[3], double * Da, double * Db,
int * alo, basis * bo, basis * bv, mol * m, qmdata * qmd){
int ka = bv->k[a];
int qa = bv->Q[a];
int la = bv->l[a];
int ma = bv->m[a];
int kv = bo->k[v];
int qv = bo->Q[v];
int lv = bo->l[v];
int mv = bo->m[v];
f_eq28_mp_grad(ma,mv, la,lv, qa,qv, ga, m->r+3*ka, m->r+3*kv, qmd);
r3cp(gb, ga);
for(int v1=alo[ka]; v1<alo[ka+1]; v1++){
for(int u1=alo[kv]; u1<alo[kv+1]; u1++){
int u1v1 = MPOSIF(u1,v1);
double tg[3];
R0_eq39_mmmp_grad(a, v1, u1, v, tg, m->r+3*ka, m->r+3*kv, bo, bv, qmd);
r3adds(ga, tg, -Da[u1v1]);
r3adds(gb, tg, -Db[u1v1]);
}
}
return;
}
void E2_grad(double * g,
double * Da, double * Db,
double * Fa, double * Fb,
double * Xa, double * Xb,
double * sa, double * sb,
double * ja, double * jb,
int * alo, int * alv, basis * bo , basis * bv, mol * m, qmdata * qmd){
int Mo = bo->M;
int Mv = bv->M;
double * ta = malloc(sizeof(double)*Mo*Mv);
double * tb = malloc(sizeof(double)*Mo*Mv);
for(int v=0; v<Mo; v++){
int lv = bo->l[v];
double clv = 2.0 / (1.0 + 2.0 * lv);
double ev = qmd->fa [bo->Q[v ]*qmd->nLo+lv ];
double multa = sa[v] * sa[v] * ja[v] * clv;
double multb = sb[v] * sb[v] * jb[v] * clv;
for(int a=0; a<Mv; a++){
int av = a*Mo+v;
double ea = qmd->f2a[bv->Q[a ]*qmd->nLv+bv->l[a ]];
double eva = 1.0/(ev-ea);
double fa = 0.0;
double fb = 0.0;
for(int u=0; u<Mo; u++){
int uv = MPOSIF(u,v);
int au = a*Mo + u;
fa += Da[uv] * (sa[v]*eva*Fa[au] + sa[u]*Xa[au]);
fb += Db[uv] * (sb[v]*eva*Fb[au] + sb[u]*Xb[au]);
}
ta[av] = fa - Xa[av] * eva * multa;
tb[av] = fb - Xb[av] * eva * multb;
}
}
for(int k=0; k<m->n; k++){
for(int ka=0; ka<m->n; ka++){
if(k==ka) continue;
for(int a=alv[ka]; a<alv[ka+1]; a++){
for(int v=alo[ka]; v<alo[ka+1]; v++){
int av = a*Mo+v;
double tg[3]={0};
dFav_dRk_1c(a, v, k, tg, Da, Db, alo, bo, bv, m, qmd);
r3scal(tg, ta[av]+tb[av]);
r3add(g+3*ka, tg);
r3min(g+3*k, tg);
}
}
}
}
for(int ka=0; ka<m->n; ka++){
for(int kv=0; kv<m->n; kv++){
if(kv==ka) continue;
for(int a=alv[ka]; a<alv[ka+1]; a++){
for(int v=alo[kv]; v<alo[kv+1]; v++){
int av = a*Mo+v;
double ga[3], gb[3];
dFav_dRk_2c(a, v, ga, gb, Da, Db, alo, bo, bv, m, qmd);
double tg[3];
r3sums(tg, ga, ta[av], gb, tb[av]);
r3add(g+3*ka, tg);
r3min(g+3*kv, tg);
}
}
}
}
free(ta);
free(tb);
return;
}
void E2_grad_r(double * g,
double * D, double * F, double * X, double * s, double * j,
int * alo, int * alv, basis * bo , basis * bv, mol * m, qmdata * qmd){
int Mo = bo->M;
int Mv = bv->M;
double * t = malloc(sizeof(double)*Mo*Mv);
for(int v=0; v<Mo; v++){
int lv = bo->l[v];
double clv = 2.0 / (1.0 + 2.0 * lv);
double ev = qmd->fa [bo->Q[v ]*qmd->nLo+lv ];
double mult = s[v] * s[v] * j[v] * clv;
for(int a=0; a<Mv; a++){
int av = a*Mo+v;
double ea = qmd->f2a[bv->Q[a ]*qmd->nLv+bv->l[a ]];
double eva = 1.0/(ev-ea);
double f = 0.0;
for(int u=0; u<Mo; u++){
int uv = MPOSIF(u,v);
int au = a*Mo + u;
f += D[uv] * (s[v]*eva*F[au] + s[u]*X[au]);
}
t[av] = f - X[av] * eva * mult;
}
}
for(int k=0; k<m->n; k++){
for(int ka=0; ka<m->n; ka++){
if(k==ka) continue;
for(int a=alv[ka]; a<alv[ka+1]; a++){
for(int v=alo[ka]; v<alo[ka+1]; v++){
int av = a*Mo+v;
double tg[3]={0};
dFav_dRk_1c(a, v, k, tg, D, D, alo, bo, bv, m, qmd);
r3scal(tg, 2.0*t[av]);
r3add(g+3*ka, tg);
r3min(g+3*k, tg);
}
}
}
}
for(int ka=0; ka<m->n; ka++){
for(int kv=0; kv<m->n; kv++){
if(kv==ka) continue;
for(int a=alv[ka]; a<alv[ka+1]; a++){
for(int v=alo[kv]; v<alo[kv+1]; v++){
int av = a*Mo+v;
double ga[3], gb[3];
dFav_dRk_2c(a, v, ga, gb, D, D, alo, bo, bv, m, qmd);
double tg[3];
r3sums(tg, ga, t[av], gb, t[av]);
r3add(g+3*ka, tg);
r3min(g+3*kv, tg);
}
}
}
}
free(t);
return;
}
|
/*
This file is part of Ext JS 4
Copyright (c) 2011 Sencha Inc
Contact: http://www.sencha.com/contact
Commercial Usage
Licensees holding valid commercial licenses may use this file in accordance with the Commercial Software License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Sencha.
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
*/
Ext.define('Sample.notdeadlock.A', {
extend: 'Sample.notdeadlock.B'
});
|
<?php
namespace MPM\EntityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Mensaje
*
* @ORM\Table(name="mensajes")
* @ORM\Entity(repositoryClass="MPM\EntityBundle\Entity\MensajeRepository")
*/
class Mensaje
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="cuerpo", type="text")
*/
private $cuerpo;
/**
* @var \DateTime
*
* @ORM\Column(name="fecha", type="datetime")
*/
private $fecha;
/**
* @var string
*
* @ORM\Column(name="ip", type="string", length=255)
*/
private $ip;
/**
* @ORM\ManyToOne(targetEntity="Conversacion", inversedBy="mensajes")
* @ORM\JoinColumn(name="conversacion_id", referencedColumnName="id")
*/
private $conversacion;
/**
* @ORM\ManyToOne(targetEntity="Persona")
* @ORM\JoinColumn(name="creador_id", referencedColumnName="id")
*/
private $creador;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set cuerpo
*
* @param string $cuerpo
* @return Mensaje
*/
public function setCuerpo($cuerpo)
{
$this->cuerpo = $cuerpo;
return $this;
}
/**
* Get cuerpo
*
* @return string
*/
public function getCuerpo()
{
return $this->cuerpo;
}
/**
* Set fecha
*
* @param \DateTime $fecha
* @return Mensaje
*/
public function setFecha($fecha)
{
$this->fecha = $fecha;
return $this;
}
/**
* Get fecha
*
* @return \DateTime
*/
public function getFecha()
{
return $this->fecha;
}
/**
* Set ip
*
* @param string $ip
* @return Mensaje
*/
public function setIp($ip)
{
$this->ip = $ip;
return $this;
}
/**
* Get ip
*
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set conversacion
*
* @param \MPM\EntityBundle\Entity\Conversacion $conversacion
* @return Mensaje
*/
public function setConversacion(\MPM\EntityBundle\Entity\Conversacion $conversacion = null)
{
$this->conversacion = $conversacion;
return $this;
}
/**
* Get conversacion
*
* @return \MPM\EntityBundle\Entity\Conversacion
*/
public function getConversacion()
{
return $this->conversacion;
}
/**
* Set creador
*
* @param \MPM\EntityBundle\Entity\Persona $creador
* @return Mensaje
*/
public function setCreador(\MPM\EntityBundle\Entity\Persona $creador = null)
{
$this->creador = $creador;
return $this;
}
/**
* Get creador
*
* @return \MPM\EntityBundle\Entity\Persona
*/
public function getCreador()
{
return $this->creador;
}
}
|
/**
* 사용자 정보수정 스타일
*
* namespace: update_profile
*
* @author sook
*
* @version 0.0.1-SNAPSHOT
*
*/
/******************************************************************************/
/* 페이지 스타일 시작 */
/******************************************************************************/
/* 페이지 헤더 */
#page-header {
}
/* 페이지 내비 */
#page-nav {
}
/* 페이지 메뉴 */
#page-menu {
}
/* 페이지 아티클 */
#page-article {
}
/* 페이지 어사이드 */
#page-aside {
}
/* 페이지 푸터 */
#page-footer {
}
/******************************************************************************/
/* 페이지 스타일 끝 */
/******************************************************************************/
/******************************************************************************/
/* 컨텐츠 스타일 시작 */
/******************************************************************************/
/* 컨텐츠 헤더 */
#contents-header {
}
/* 컨텐츠 내비 */
#contents-nav {
}
/* 컨텐츠 메뉴 */
#contents-menu {
}
/* 컨텐츠 아티클 */
#contents-article {
}
/* 컨텐츠 어사이드 */
#contents-aside {
}
/* 컨텐츠 푸터 */
#contents-footer {
}
/******************************************************************************/
/* 컨텐츠 스타일 끝 */
/******************************************************************************/
/******************************************************************************/
/* 섹션 스타일 시작 */
/******************************************************************************/
/* 컨텐츠 섹션 */
.contents-section {
}
/* 섹션 헤더 */
.section-header {
}
/* 섹션 내비 */
.section-nav {
}
/* 섹션 메뉴 */
.section-menu {
}
/* 섹션 아티클 */
.section-article {
}
/* 섹션 어사이드 */
.section-aside {
}
/* 섹션 푸터 */
.section-footer {
}
/******************************************************************************/
/* 섹션 스타일 끝 */
/******************************************************************************/
/******************************************************************************/
/* 도메인 스타일 시작 */
/******************************************************************************/
/******************************************************************************/
/* 잉스타 스타일 시작 */
/******************************************************************************/
/* 잉스타 공통 */
#main{
margin-top: 40px;
margin-bottom: 40px;
}
a.list-group-item:FOCUS,
a.list-group-item:HOVER {
background-color: #ffb18c;
}
a.celactive {
background-color: #ff9460;
font-weight:bolder;
color: #fdfdfd;
}
#FormDiv{
height: 100%;
border: 4px solid #ead3ce;
border-radius: 5px;
}
div#nowInfoDiv{
margin-top:5px;
text-align: center;
height: 50px;
}
div#leftBarBox{
height: inherit;
}
hr.devider{
margin-top: 10px;
margin-bottom:20px;
}
input#profChange{
background-color: #ff9460;
color:white;
font-weight: bolder;
}
input#profChange:HOVER {
color:black;
font-weight: bolder;
}
#denyReasonLabel{
padding-right:0;
margin-top:8px;
text-align: center;
font-size: 10pt;
}
label#nicknameView{
margin-left:10px;
margin-bottom:0;
font-size: 15pt;
}
/******************************************************************************/
/* 잉스타 스타일 끝 */
/******************************************************************************/
/******************************************************************************/
/* 도메인 스타일 끝 */
/******************************************************************************/ |
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Table of Content
- [Name](#name)
- [Status](#status)
- [Description](#description)
- [Synopsis](#synopsis)
- [Methods](#methods)
- [ngx_timer.at](#ngx_timerat)
- [ngx_timer.every](#ngx_timerevery)
- [Author](#author)
- [Copyright and License](#copyright-and-license)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Name
acid.ngx_timer
# Status
This library is considered production ready.
# Description
This module provides simple wrapper of `ngx.timer.at`, so you
do not need to define the timer callback function.
# Synopsis
```lua
local ngx_timer = require('acid.ngx_timer')
local do_sum = function(a, b)
ngx.log(ngx.INFO, 'sum is: ' .. tostring(a + b))
end
local _, err, errmsg = ngx_timer.at(0.1, do_sum, 1, 2)
if err ~= nil then
ngx.log(ngx.ERR, string.format(
'failed to setup timer: %s, %s', err, errmsg))
end
local _, err, errmsg = ngx_timer.every(0.5, do_sum, 1, 2)
if err ~= nil then
ngx.log(ngx.ERR, string.format(
'failed to setup timer: %s, %s', err, errmsg))
end
```
# Methods
## ngx_timer.at
**syntax**:
`_, err, errmsg = ngx_timer.at(delay, func, ...)`
Setup a timer, which will run `func` with all following arguments
at `delay` seconds later. When the nginx worker is trying to shut
down, the `func` will be executed even the specified delay time
has not expired.
**arguments**:
- `delay`:
specifies the delay for the timer, in seconds.
You can specify fractional seconds like `0.001`.
**return**:
If failed to setup the timer, `nil` is returned, following error code
and error message.
## ngx_timer.every
**syntax**:
`_, err, errmsg = ngx_timer.every(interval, func, ...)`
Setup a timer, which will run `func` with all following arguments
every `interval` seconds.
**arguments**:
- `interval`:
specifies the loop interval, in seconds.
You can specify fractional seconds like `0.001`.
**return**:
If failed to setup the timer, `nil` is returned, following error code
and error message.
# Author
Renzhi (任稚) <zhi.ren@baishancloud.com>
# Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Renzhi (任稚) <zhi.ren@baishancloud.com>
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<A href="W28937.pdfs.html#outline" target="contents">Outline</a><br><A href="W28937.pdfs.html#1" target="contents" >Page 1</a><br>
<A href="W28937.pdfs.html#2" target="contents" >Page 2</a><br>
<A href="W28937.pdfs.html#3" target="contents" >Page 3</a><br>
<A href="W28937.pdfs.html#4" target="contents" >Page 4</a><br>
<A href="W28937.pdfs.html#5" target="contents" >Page 5</a><br>
<A href="W28937.pdfs.html#6" target="contents" >Page 6</a><br>
<A href="W28937.pdfs.html#7" target="contents" >Page 7</a><br>
<A href="W28937.pdfs.html#8" target="contents" >Page 8</a><br>
<A href="W28937.pdfs.html#9" target="contents" >Page 9</a><br>
<A href="W28937.pdfs.html#10" target="contents" >Page 10</a><br>
<A href="W28937.pdfs.html#11" target="contents" >Page 11</a><br>
<A href="W28937.pdfs.html#12" target="contents" >Page 12</a><br>
<A href="W28937.pdfs.html#13" target="contents" >Page 13</a><br>
<A href="W28937.pdfs.html#14" target="contents" >Page 14</a><br>
<A href="W28937.pdfs.html#15" target="contents" >Page 15</a><br>
<A href="W28937.pdfs.html#16" target="contents" >Page 16</a><br>
<A href="W28937.pdfs.html#17" target="contents" >Page 17</a><br>
<A href="W28937.pdfs.html#18" target="contents" >Page 18</a><br>
<A href="W28937.pdfs.html#19" target="contents" >Page 19</a><br>
<A href="W28937.pdfs.html#20" target="contents" >Page 20</a><br>
<A href="W28937.pdfs.html#21" target="contents" >Page 21</a><br>
<A href="W28937.pdfs.html#22" target="contents" >Page 22</a><br>
<A href="W28937.pdfs.html#23" target="contents" >Page 23</a><br>
<A href="W28937.pdfs.html#24" target="contents" >Page 24</a><br>
<A href="W28937.pdfs.html#25" target="contents" >Page 25</a><br>
<A href="W28937.pdfs.html#26" target="contents" >Page 26</a><br>
<A href="W28937.pdfs.html#27" target="contents" >Page 27</a><br>
<A href="W28937.pdfs.html#28" target="contents" >Page 28</a><br>
<A href="W28937.pdfs.html#29" target="contents" >Page 29</a><br>
<A href="W28937.pdfs.html#30" target="contents" >Page 30</a><br>
<A href="W28937.pdfs.html#31" target="contents" >Page 31</a><br>
<A href="W28937.pdfs.html#32" target="contents" >Page 32</a><br>
<A href="W28937.pdfs.html#33" target="contents" >Page 33</a><br>
<A href="W28937.pdfs.html#34" target="contents" >Page 34</a><br>
<A href="W28937.pdfs.html#35" target="contents" >Page 35</a><br>
<A href="W28937.pdfs.html#36" target="contents" >Page 36</a><br>
<A href="W28937.pdfs.html#37" target="contents" >Page 37</a><br>
<A href="W28937.pdfs.html#38" target="contents" >Page 38</a><br>
<A href="W28937.pdfs.html#39" target="contents" >Page 39</a><br>
<A href="W28937.pdfs.html#40" target="contents" >Page 40</a><br>
<A href="W28937.pdfs.html#41" target="contents" >Page 41</a><br>
<A href="W28937.pdfs.html#42" target="contents" >Page 42</a><br>
<A href="W28937.pdfs.html#43" target="contents" >Page 43</a><br>
<A href="W28937.pdfs.html#44" target="contents" >Page 44</a><br>
<A href="W28937.pdfs.html#45" target="contents" >Page 45</a><br>
<A href="W28937.pdfs.html#46" target="contents" >Page 46</a><br>
<A href="W28937.pdfs.html#47" target="contents" >Page 47</a><br>
<A href="W28937.pdfs.html#48" target="contents" >Page 48</a><br>
<A href="W28937.pdfs.html#49" target="contents" >Page 49</a><br>
<A href="W28937.pdfs.html#50" target="contents" >Page 50</a><br>
<A href="W28937.pdfs.html#51" target="contents" >Page 51</a><br>
<A href="W28937.pdfs.html#52" target="contents" >Page 52</a><br>
<A href="W28937.pdfs.html#53" target="contents" >Page 53</a><br>
<A href="W28937.pdfs.html#54" target="contents" >Page 54</a><br>
<A href="W28937.pdfs.html#55" target="contents" >Page 55</a><br>
<A href="W28937.pdfs.html#56" target="contents" >Page 56</a><br>
<A href="W28937.pdfs.html#57" target="contents" >Page 57</a><br>
<A href="W28937.pdfs.html#58" target="contents" >Page 58</a><br>
<A href="W28937.pdfs.html#59" target="contents" >Page 59</a><br>
<A href="W28937.pdfs.html#60" target="contents" >Page 60</a><br>
<A href="W28937.pdfs.html#61" target="contents" >Page 61</a><br>
<A href="W28937.pdfs.html#62" target="contents" >Page 62</a><br>
<A href="W28937.pdfs.html#63" target="contents" >Page 63</a><br>
<A href="W28937.pdfs.html#64" target="contents" >Page 64</a><br>
<A href="W28937.pdfs.html#65" target="contents" >Page 65</a><br>
<A href="W28937.pdfs.html#66" target="contents" >Page 66</a><br>
<A href="W28937.pdfs.html#67" target="contents" >Page 67</a><br>
<A href="W28937.pdfs.html#68" target="contents" >Page 68</a><br>
<A href="W28937.pdfs.html#69" target="contents" >Page 69</a><br>
<A href="W28937.pdfs.html#70" target="contents" >Page 70</a><br>
<A href="W28937.pdfs.html#71" target="contents" >Page 71</a><br>
<A href="W28937.pdfs.html#72" target="contents" >Page 72</a><br>
<A href="W28937.pdfs.html#73" target="contents" >Page 73</a><br>
<A href="W28937.pdfs.html#74" target="contents" >Page 74</a><br>
<A href="W28937.pdfs.html#75" target="contents" >Page 75</a><br>
<A href="W28937.pdfs.html#76" target="contents" >Page 76</a><br>
<A href="W28937.pdfs.html#77" target="contents" >Page 77</a><br>
<A href="W28937.pdfs.html#78" target="contents" >Page 78</a><br>
<A href="W28937.pdfs.html#79" target="contents" >Page 79</a><br>
<A href="W28937.pdfs.html#80" target="contents" >Page 80</a><br>
<A href="W28937.pdfs.html#81" target="contents" >Page 81</a><br>
<A href="W28937.pdfs.html#82" target="contents" >Page 82</a><br>
<A href="W28937.pdfs.html#83" target="contents" >Page 83</a><br>
<A href="W28937.pdfs.html#84" target="contents" >Page 84</a><br>
<A href="W28937.pdfs.html#85" target="contents" >Page 85</a><br>
<A href="W28937.pdfs.html#86" target="contents" >Page 86</a><br>
<A href="W28937.pdfs.html#87" target="contents" >Page 87</a><br>
<A href="W28937.pdfs.html#88" target="contents" >Page 88</a><br>
<A href="W28937.pdfs.html#89" target="contents" >Page 89</a><br>
</BODY>
</HTML>
|
;(function(){
"use strict";
const module = window.load = {
name: "xhr"
};
const xhr = module.exports = (type, url, cb, opts) => {
const xhr = new XMLHttpRequest();
if (opts) Object.keys(opts).map(key => xhr[key] = opts[key]);
xhr.open(type, url);
xhr.onreadystatechange = () => {
if (xhr.readyState == 4) {
cb(xhr);
}
}
xhr.send();
return xhr;
};
xhr.get = (url, cb, opts) => xhr("GET", url, cb, opts);
xhr.post = (url, cb, opts) => xhr("POST", url, cb, opts);
xhr.json = (url, cb, opts) => xhr("GET", url, res => cb(JSON.parse(res.responseText)), opts);
})();
|
body div{
margin-bottom: 15px;
}
body div label{
font-family: Consolas;
font-size: 16px;
}
body div button{
padding-bottom: 2px;
padding-top: 2px;
margin-left: 15px;
border: 1px solid black;
background-color: #0094ff;
font-weight: bold;
}
input{
width: 200px;
}
|
package com.lamepancake.chitchat.packet;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
/**
* Contains a message to be sent to other users in the chat.
*
* Specifies the chat to which the message is to be sent and the user sending
* the message.
*
* @author shane
*/
public class MessagePacket extends Packet {
private final String message;
private int userID;
private final int chatID;
/**
* Constructs a MessagePacket with the given message and userID.
*
* @param message The message to send.
* @param userID The ID of the user sending the message.
*/
public MessagePacket(String message, int userID, int chatID) {
super(Packet.MESSAGE, 8 + message.length() * 2);
this.message = message;
this.userID = userID;
this.chatID = chatID;
}
/**
* Construct a MessagePacket from a serialised one.
*
* @param header The serialised header.
* @param data A ByteBuffer containing the serialised packet.
*/
public MessagePacket(ByteBuffer header, ByteBuffer data)
{
super(header);
byte[] rawMessage = new byte[data.capacity() - 8];
this.userID = data.getInt();
this.chatID = data.getInt();
data.get(rawMessage);
this.message = new String(rawMessage, StandardCharsets.UTF_16LE);
}
@Override
public ByteBuffer serialise()
{
ByteBuffer buf = super.serialise();
buf.putInt(this.userID);
buf.putInt(this.chatID);
buf.put(this.message.getBytes(StandardCharsets.UTF_16LE));
buf.rewind();
return buf;
}
/**
* Get the message contained in this packet.
* @return The message contained in this packet.
*/
public String getMessage() {
return message;
}
/**
* Returns the ID of the user sending the message.
*
* @return The ID of the user sending the message.
*/
public int getUserID()
{
return this.userID;
}
/**
* Set the user ID in case it's not set.
*
* The user ID must be >= 0. The method will throw an IllegalArgumentException
* if this rule is not followed.
*
* @param newID The new user ID to assign to this message.
*/
public void setUserID(int newID)
{
if(newID < 0)
throw new IllegalArgumentException("MessagePacket.setUserID: newID must be >= 0, was " + newID);
this.userID = newID;
}
public int getChatID()
{
return this.chatID;
}
@Override
public boolean equals(Object o)
{
if(!super.equals(o))
return false;
if(o instanceof MessagePacket)
{
MessagePacket p = (MessagePacket)o;
if(!message.equals(p.getMessage()))
return false;
if(chatID != p.getChatID())
return false;
return userID == p.getUserID();
}
return false;
}
@Override
public int hashCode() {
int hash = 7;
hash = 73 * hash + Objects.hashCode(this.message);
hash = 73 * hash + this.userID;
hash = 73 * hash + this.chatID;
return hash;
}
}
|
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140630120141) do
create_table "hotels", force: true do |t|
t.string "name"
t.integer "stars"
t.integer "rooms"
t.integer "beds"
t.string "city"
t.string "zipcode"
t.string "street"
t.integer "olery_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "review_comments", force: true do |t|
t.integer "olery_id"
t.integer "review_id"
t.string "data"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "reviews", force: true do |t|
t.string "review_date"
t.string "source_name"
t.string "title"
t.string "sentiment"
t.string "review_sentiment"
t.string "ratings"
t.string "reviewer"
t.integer "hotel_id"
t.string "review_id"
t.datetime "created_at"
t.datetime "updated_at"
end
end
|
require 'rails_helper'
describe Wiki do
describe 'associations' do
before(:each) do
@wiki = Wiki.create!(description: "TV Shows")
@article1 = Article.create!(title: "Article 1", content: "Some Content", published: true, needs_sources: false, wiki_id: @wiki.id)
@article2 = Article.create!(title: "Article 2", content: "Some Content", published: true, needs_sources: false, wiki_id: @wiki.id)
@user1 = User.create!(email: "wyethjackson@gmail.com", password: "123")
@user2 = User.create!(email: "wyeth@wyeth.com", password: "123")
UserWiki.create!(user_id: @user1.id, wiki_id: @wiki.id)
UserWiki.create!(user_id: @user2.id, wiki_id: @wiki.id)
end
it 'returns the articles in a specific wiki' do
expect(@wiki.articles).to eq([@article1, @article2])
end
it 'returns the users that belong to a specific wiki' do
expect(@wiki.users).to eq([@user1, @user2])
end
end
end |
/*
* This file is generated by jOOQ.
*/
package com.cellarhq.generated.tables.daos;
import com.cellarhq.generated.tables.Category;
import com.cellarhq.generated.tables.records.CategoryRecord;
import java.time.LocalDateTime;
import java.util.List;
import javax.annotation.processing.Generated;
import org.jooq.Configuration;
import org.jooq.JSON;
import org.jooq.impl.DAOImpl;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.12.3"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class CategoryDao extends DAOImpl<CategoryRecord, com.cellarhq.generated.tables.pojos.Category, Long> {
/**
* Create a new CategoryDao without any configuration
*/
public CategoryDao() {
super(Category.CATEGORY, com.cellarhq.generated.tables.pojos.Category.class);
}
/**
* Create a new CategoryDao with an attached configuration
*/
public CategoryDao(Configuration configuration) {
super(Category.CATEGORY, com.cellarhq.generated.tables.pojos.Category.class, configuration);
}
@Override
public Long getId(com.cellarhq.generated.tables.pojos.Category object) {
return object.getId();
}
/**
* Fetch records that have <code>id BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfId(Long lowerInclusive, Long upperInclusive) {
return fetchRange(Category.CATEGORY.ID, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>id IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchById(Long... values) {
return fetch(Category.CATEGORY.ID, values);
}
/**
* Fetch a unique record that has <code>id = value</code>
*/
public com.cellarhq.generated.tables.pojos.Category fetchOneById(Long value) {
return fetchOne(Category.CATEGORY.ID, value);
}
/**
* Fetch records that have <code>version BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfVersion(Integer lowerInclusive, Integer upperInclusive) {
return fetchRange(Category.CATEGORY.VERSION, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>version IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByVersion(Integer... values) {
return fetch(Category.CATEGORY.VERSION, values);
}
/**
* Fetch records that have <code>name BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfName(String lowerInclusive, String upperInclusive) {
return fetchRange(Category.CATEGORY.NAME, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>name IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByName(String... values) {
return fetch(Category.CATEGORY.NAME, values);
}
/**
* Fetch records that have <code>description BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfDescription(String lowerInclusive, String upperInclusive) {
return fetchRange(Category.CATEGORY.DESCRIPTION, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>description IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByDescription(String... values) {
return fetch(Category.CATEGORY.DESCRIPTION, values);
}
/**
* Fetch records that have <code>searchable BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfSearchable(Boolean lowerInclusive, Boolean upperInclusive) {
return fetchRange(Category.CATEGORY.SEARCHABLE, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>searchable IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchBySearchable(Boolean... values) {
return fetch(Category.CATEGORY.SEARCHABLE, values);
}
/**
* Fetch records that have <code>brewery_db_id BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfBreweryDbId(String lowerInclusive, String upperInclusive) {
return fetchRange(Category.CATEGORY.BREWERY_DB_ID, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>brewery_db_id IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByBreweryDbId(String... values) {
return fetch(Category.CATEGORY.BREWERY_DB_ID, values);
}
/**
* Fetch records that have <code>brewery_db_last_updated BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfBreweryDbLastUpdated(LocalDateTime lowerInclusive, LocalDateTime upperInclusive) {
return fetchRange(Category.CATEGORY.BREWERY_DB_LAST_UPDATED, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>brewery_db_last_updated IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByBreweryDbLastUpdated(LocalDateTime... values) {
return fetch(Category.CATEGORY.BREWERY_DB_LAST_UPDATED, values);
}
/**
* Fetch records that have <code>created_date BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfCreatedDate(LocalDateTime lowerInclusive, LocalDateTime upperInclusive) {
return fetchRange(Category.CATEGORY.CREATED_DATE, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>created_date IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByCreatedDate(LocalDateTime... values) {
return fetch(Category.CATEGORY.CREATED_DATE, values);
}
/**
* Fetch records that have <code>modified_date BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfModifiedDate(LocalDateTime lowerInclusive, LocalDateTime upperInclusive) {
return fetchRange(Category.CATEGORY.MODIFIED_DATE, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>modified_date IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByModifiedDate(LocalDateTime... values) {
return fetch(Category.CATEGORY.MODIFIED_DATE, values);
}
/**
* Fetch records that have <code>data BETWEEN lowerInclusive AND upperInclusive</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchRangeOfData(JSON lowerInclusive, JSON upperInclusive) {
return fetchRange(Category.CATEGORY.DATA, lowerInclusive, upperInclusive);
}
/**
* Fetch records that have <code>data IN (values)</code>
*/
public List<com.cellarhq.generated.tables.pojos.Category> fetchByData(JSON... values) {
return fetch(Category.CATEGORY.DATA, values);
}
}
|
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(430);
module.exports = __webpack_require__(430);
/***/ }),
/***/ 430:
/***/ (function(module, exports) {
(function( window, undefined ) {
kendo.cultures["zh-SG"] = {
name: "zh-SG",
numberFormat: {
pattern: ["-n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
percent: {
pattern: ["-n%","n%"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "%"
},
currency: {
name: "Singapore Dollar",
abbr: "SGD",
pattern: ["($n)","$n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "$"
}
},
calendars: {
standard: {
days: {
names: ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],
namesAbbr: ["周日","周一","周二","周三","周四","周五","周六"],
namesShort: ["日","一","二","三","四","五","六"]
},
months: {
names: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
namesAbbr: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]
},
AM: ["上午","上午","上午"],
PM: ["下午","下午","下午"],
patterns: {
d: "d/M/yyyy",
D: "yyyy'年'M'月'd'日'",
F: "yyyy'年'M'月'd'日' tt h:mm:ss",
g: "d/M/yyyy tt h:mm",
G: "d/M/yyyy tt h:mm:ss",
m: "M'月'd'日'",
M: "M'月'd'日'",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "tt h:mm",
T: "tt h:mm:ss",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "yyyy'年'M'月'",
Y: "yyyy'年'M'月'"
},
"/": "/",
":": ":",
firstDay: 0
}
}
}
})(this);
/***/ })
/******/ }); |
var subject = require('../../lib/helpers/injector');
var Promise = require('bluebird');
describe('injector', function() {
it('returns a function returning a promise', function() {
var fn = subject({});
expect(fn('name', [])).to.be.instanceOf(Promise);
});
});
|
const merge = require('webpack-merge')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const base = require('./webpack.config.base')
const pkg = require('../app/package.json')
module.exports = merge(base, {
entry: {
renderer: ['./app/renderer.js']
},
module: {
loaders: [
{ test: /\.vue$/, loader: 'vue' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css', { publicPath: '../' }) },
{ test: /\.less$/, loader: ExtractTextPlugin.extract('style', 'css!less', { publicPath: '../' }) },
// { test: /\.html$/, loader: 'vue-html' },
{ test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url', query: { limit: 10000, name: 'img/[name].[hash:7].[ext]' } },
{ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url', query: { limit: 10000, name: 'font/[name].[hash:7].[ext]' } }
]
},
resolve: {
extensions: ['', '.js', '.json', '.css', '.less', '.sass', '.scss', '.vue']
},
target: 'electron-renderer',
// devServer: {
// // contentBase: './build',
// historyApiFallback: true,
// progress: true,
// inline: true,
// colors: true,
// quiet: false,
// noInfo: false,
// // lazy: true,
// hot: true,
// port: 2080
// },
plugins: [
new ExtractTextPlugin('css/[name].css')
],
vue: {
loaders: {
// html: 'raw',
// js: 'babel',
css: ExtractTextPlugin.extract('css', { publicPath: '../' }),
less: ExtractTextPlugin.extract('css!less', { publicPath: '../' })
},
autoprefixer: false
}
})
if (process.env.NODE_ENV === 'production') {
module.exports.plugins = (module.exports.plugins || []).concat([
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
template: './app/index.ejs',
filename: 'index.html',
title: pkg.productName,
chunks: ['renderer'],
excludeChunks: ['main'],
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options: https://github.com/kangax/html-minifier#options-quick-reference
}
})
])
} else {
module.exports.module.preLoaders.push(
{ test: /\.vue$/, loader: 'eslint', exclude: /node_modules/ }
)
module.exports.plugins = (module.exports.plugins || []).concat([
new HtmlWebpackPlugin({
template: './app/index.ejs',
filename: 'index.html',
title: pkg.productName,
chunks: ['renderer'],
excludeChunks: ['main'],
inject: true
})
])
}
|
using CompileBot
snoop_bench(
BotConfig(
"Plots",
),
joinpath(@__DIR__, "precompile_script.jl"),
)
|
<?php if ( !defined("BASE_PATH")) exit( "No direct script access allowed" );
function argument($argv){
$_ARG = array();
foreach ($argv as $arg) {
if ( preg_match('/--([^=]+)=(.*)/',$arg,$reg)) {
$_ARG[$reg[1]] = $reg[2];
}else if(preg_match('/-([a-zA-Z0-9])/',$arg,$reg)) {
$_ARG[$reg[1]] = 'true';
}
}
return $_ARG;
}
// More info here : http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
if( !function_exists("writeln")){
function writeln( $msg ){
GLOBAL $DEBUG;
if( $DEBUG != "true" ){
return;
}
$backtrace = debug_backtrace();
foreach($backtrace AS $entry) {
if( $entry['function'] ){
$file = basename( $entry['file'] );
$line = str_pad( $entry['line'] , 4 , "0" , STR_PAD_LEFT );
//echo "\033[0m";
echo "line $line : " . $msg;
echo "\n";
return true;
}
}
}
}
/**
* Log anything that is printed
*
* @access public
* @param mixed $msg
* @return void
*/
function logln( $msg ){
$backtrace = debug_backtrace();
foreach($backtrace AS $entry) {
if( $entry['function'] ){
$file = basename( $entry['file'] );
$line = str_pad( $entry['line'] , 4 , "0" , STR_PAD_LEFT );
//echo "\033[0m";
echo "line $line : " . $msg;
echo "\n";
return true;
}
}
}
/**
* log including the breaks
*
* @access public
* @param float $count
* @return void
*/
function logbr( $count = 1 ){
if( !is_int( $count ) ){
$count = 1;
}
for( $x = 0 ; $x < $count ; $x++ ){
logln( '' );
}
}
function writebr( $count = 1 ){
if( !is_int( $count ) ){
$count = 1;
}
for( $x = 0 ; $x < $count ; $x++ ){
writeln( '' );
}
}
function logh( $message ){
logbr();
logln( "-------------------------------------------------------------------" );
logln( strtoupper( $message ) ) ;
logln( "-------------------------------------------------------------------" );
logbr();
}
function writeh( $message ){
writebr();
writeln( "-------------------------------------------------------------------" );
writeln( strtoupper( $message ) ) ;
writeln( "-------------------------------------------------------------------" );
writebr();
}
if( !function_exists("colorln")){
function colorln( $msg ){
GLOBAL $DEBUG;
if( $DEBUG != "true" ){
return;
}
echo "\033[44;1;31m";
echo $msg;
// reset to normal
echo "\033[0m";
echo "\n";
}
}
function is_cli(){
return (php_sapi_name() == 'cli') or defined('STDIN');
}
function cls($out = true ){
$cls = chr(27)."[H".chr(27)."[2J";
if( $out ){
echo $cls;
}else{
return $cls;
}
}
function scanf( $format , &$a0=null , &$a1=null, &$a2=null , &$a3=null, &$a4=null, &$a5=null, &$a6=null, &$a7=null ){
$num_args = func_num_args();
if($num_args > 1) {
$inputs = fscanf(STDIN, $format);
for($i=0; $i<$num_args-1; $i++) {
$arg = 'a'.$i;
$$arg = $inputs[$i];
}
}
}
?>
|
#include "../../vm/vm.h"
#include <fstream>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
unsigned char banner[] = {
0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x5f, 0x20, 0x20, 0x20, 0x5f, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x5f, 0x20, 0x20, 0x20, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x5f, 0x5f, 0x20, 0x20, 0x20, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x20, 0x20,
0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x20, 0x20, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f,
0x5f, 0x0a, 0x7c, 0x20, 0x5f, 0x5f, 0x5f, 0x20, 0x5c, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x7c, 0x20, 0x7c, 0x20, 0x28, 0x5f, 0x29, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x5f, 0x29, 0x20, 0x20,
0x20, 0x20, 0x20, 0x7c, 0x20, 0x7c, 0x20, 0x7c, 0x20, 0x7c, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x2f, 0x20, 0x20, 0x7c, 0x20, 0x7c, 0x5f, 0x5f, 0x5f, 0x5f, 0x20,
0x7c, 0x7c, 0x5f, 0x5f, 0x5f, 0x5f, 0x20, 0x7c, 0x7c, 0x5f, 0x5f, 0x5f,
0x20, 0x20, 0x2f, 0x0a, 0x7c, 0x20, 0x7c, 0x5f, 0x2f, 0x20, 0x2f, 0x5f,
0x20, 0x5f, 0x20, 0x5f, 0x5f, 0x5f, 0x7c, 0x20, 0x7c, 0x5f, 0x20, 0x5f,
0x20, 0x20, 0x5f, 0x5f, 0x5f, 0x20, 0x5f, 0x5f, 0x5f, 0x20, 0x5f, 0x20,
0x20, 0x5f, 0x5f, 0x5f, 0x20, 0x7c, 0x20, 0x7c, 0x5f, 0x7c, 0x20, 0x7c,
0x5f, 0x20, 0x5f, 0x5f, 0x5f, 0x20, 0x20, 0x20, 0x5f, 0x5f, 0x20, 0x20,
0x20, 0x5f, 0x5f, 0x60, 0x7c, 0x20, 0x7c, 0x20, 0x20, 0x20, 0x20, 0x20,
0x2f, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x20, 0x2f, 0x20, 0x20,
0x20, 0x2f, 0x20, 0x2f, 0x20, 0x0a, 0x7c, 0x20, 0x20, 0x5f, 0x5f, 0x2f,
0x20, 0x5f, 0x60, 0x20, 0x2f, 0x20, 0x5f, 0x5f, 0x7c, 0x20, 0x5f, 0x5f,
0x7c, 0x20, 0x7c, 0x2f, 0x20, 0x5f, 0x5f, 0x2f, 0x20, 0x5f, 0x5f, 0x7c,
0x20, 0x7c, 0x2f, 0x20, 0x5f, 0x20, 0x5c, 0x7c, 0x20, 0x5f, 0x5f, 0x7c,
0x20, 0x5f, 0x5f, 0x2f, 0x20, 0x5f, 0x20, 0x5c, 0x20, 0x20, 0x5c, 0x20,
0x5c, 0x20, 0x2f, 0x20, 0x2f, 0x20, 0x7c, 0x20, 0x7c, 0x20, 0x20, 0x20,
0x20, 0x20, 0x5c, 0x20, 0x5c, 0x20, 0x20, 0x20, 0x20, 0x5c, 0x20, 0x5c,
0x20, 0x20, 0x2f, 0x20, 0x2f, 0x20, 0x20, 0x0a, 0x7c, 0x20, 0x7c, 0x20,
0x7c, 0x20, 0x28, 0x5f, 0x7c, 0x20, 0x5c, 0x5f, 0x5f, 0x20, 0x5c, 0x20,
0x7c, 0x5f, 0x7c, 0x20, 0x7c, 0x20, 0x28, 0x5f, 0x7c, 0x20, 0x28, 0x5f,
0x5f, 0x7c, 0x20, 0x7c, 0x20, 0x28, 0x5f, 0x29, 0x20, 0x7c, 0x20, 0x7c,
0x5f, 0x7c, 0x20, 0x7c, 0x7c, 0x20, 0x28, 0x5f, 0x29, 0x20, 0x7c, 0x20,
0x20, 0x5c, 0x20, 0x56, 0x20, 0x2f, 0x20, 0x5f, 0x7c, 0x20, 0x7c, 0x5f,
0x2e, 0x5f, 0x5f, 0x5f, 0x2f, 0x20, 0x2f, 0x2e, 0x5f, 0x5f, 0x5f, 0x2f,
0x20, 0x2f, 0x2e, 0x2f, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x0a, 0x5c, 0x5f,
0x7c, 0x20, 0x20, 0x5c, 0x5f, 0x5f, 0x2c, 0x5f, 0x7c, 0x5f, 0x5f, 0x5f,
0x2f, 0x5c, 0x5f, 0x5f, 0x7c, 0x5f, 0x7c, 0x5c, 0x5f, 0x5f, 0x5f, 0x5c,
0x5f, 0x5f, 0x5f, 0x7c, 0x5f, 0x7c, 0x5c, 0x5f, 0x5f, 0x5f, 0x2f, 0x20,
0x5c, 0x5f, 0x5f, 0x7c, 0x5c, 0x5f, 0x5f, 0x5c, 0x5f, 0x5f, 0x5f, 0x2f,
0x20, 0x20, 0x20, 0x20, 0x5c, 0x5f, 0x28, 0x5f, 0x29, 0x5c, 0x5f, 0x5f,
0x5f, 0x2f, 0x5c, 0x5f, 0x5f, 0x5f, 0x5f, 0x28, 0x5f, 0x29, 0x5f, 0x5f,
0x5f, 0x5f, 0x2f, 0x20, 0x5c, 0x5f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x0a,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x0a, 0x20, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f,
0x5c, 0x2f, 0x7c, 0x20, 0x20, 0x0a, 0x7c, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c, 0x2f, 0x2f, 0x5c,
0x2f, 0x2f, 0x5c, 0x2f, 0x20, 0x20, 0x20};
unsigned char bc[] = {
0xc3, 0x48, 0x00, 0xde, 0xad, 0x48, 0x01, 0xb0, 0x0b, 0xd4, 0x00, 0x00,
0x00, 0xd4, 0x02, 0x00, 0x01, 0x48, 0x00, 0xb0, 0x0b, 0x48, 0x01, 0xfa,
0xce, 0xd4, 0x04, 0x00, 0x00, 0xd4, 0x06, 0x00, 0x01, 0x48, 0x00, 0x00,
0x00, 0xd8, 0xd6, 0x00, 0xcb, 0x20, 0x48, 0x04, 0x00, 0x00, 0xde, 0x04,
0x48, 0x00, 0x00, 0x00, 0x48, 0x01, 0x02, 0x00, 0x39, 0x04, 0x39, 0x14,
0xd8, 0x5b, 0x00, 0x5c, 0x04, 0x05, 0x04, 0x04, 0x00, 0xd7, 0x42, 0x93,
0x2e, 0x00, 0x22, 0x00, 0x00, 0x00, 0x22, 0x01, 0x02, 0x00, 0x22, 0x02,
0x04, 0x00, 0x22, 0x03, 0x06, 0x00, 0x5d, 0xde, 0x01, 0xde, 0x02, 0xde,
0x03, 0x12, 0x20, 0x12, 0x31, 0x48, 0x04, 0x00, 0x00, 0x48, 0x05, 0x00,
0x00, 0xde, 0x04, 0x05, 0x05, 0x6f, 0x62, 0xde, 0x05, 0xcb, 0x43, 0x20,
0x04, 0x04, 0x00, 0x05, 0x04, 0x65, 0x70, 0xcb, 0x53, 0x5c, 0x07, 0xde,
0x07, 0xb1, 0x45, 0xde, 0x04, 0xcb, 0x43, 0x36, 0x04, 0x05, 0x00, 0x05,
0x04, 0x65, 0x70, 0x5c, 0x05, 0xb1, 0x45, 0x39, 0x24, 0xcb, 0x42, 0x20,
0x04, 0x04, 0x00, 0x05, 0x04, 0x75, 0x72, 0xcb, 0x52, 0x5c, 0x07, 0xde,
0x07, 0xb1, 0x45, 0xde, 0x04, 0xcb, 0x42, 0x36, 0x04, 0x05, 0x00, 0x05,
0x04, 0x73, 0x6e, 0x5c, 0x05, 0xb1, 0x45, 0x39, 0x34, 0x5c, 0x05, 0x5c,
0x04, 0x05, 0x04, 0x01, 0x00, 0xf4, 0x04, 0x7f, 0x93, 0x6d, 0x00, 0x4e,
0x02, 0x4e, 0x13, 0x5c, 0x03, 0x5c, 0x02, 0x5c, 0x01, 0xbb, 0xde, 0x01,
0xde, 0x02, 0xde, 0x03, 0xcb, 0x60, 0x48, 0x05, 0x00, 0x00, 0x12, 0x46,
0xf4, 0x04, 0x00, 0x38, 0xfc, 0x00, 0x48, 0x06, 0x00, 0x00, 0x05, 0x05,
0x01, 0x00, 0x39, 0x65, 0x12, 0x46, 0xf4, 0x04, 0x00, 0xae, 0xea, 0x00,
0xcb, 0x05, 0x5c, 0x03, 0x5c, 0x02, 0x5c, 0x01, 0xbb};
unsigned int bclen = 261;
unsigned char opcode_key[] = {0x48, 0x61, 0x76, 0x65, 0x46, 0x75, 0x6e,
0x21, 0x50, 0x6f, 0x6c, 0x69, 0x43, 0x54,
0x46, 0x32, 0x30, 0x31, 0x37, 0x21, 0x00};
printf("%s", banner);
printf("\nHmmm...\n");
VM vm(opcode_key, bc, bclen);
vm.run();
return 0;
} |
using System;
using System.Threading;
using System.Threading.Tasks;
using RunRabbitRun.Net.Attributes;
using RunRabbitRun.Net.Sample.Models;
using RabbitMQ.Client;
using Newtonsoft.Json;
namespace RunRabbitRun.Net.Sample
{
public class UserModule : Module
{
public UserModule()
{
}
[Queue("users", "user-create", "user.cmd.create", AutoDelete = true)]
[Consume(autoAck: true)]
[Qos(100)]
[Channel(name: "createchannel")]
public async Task<Response> Create(
[Inject] IUserRepository userRepository,
[JsonMessage] User user)
{
await userRepository.CreateAsync(user);
Console.WriteLine($"Created {user.UserName}-{user.LastName}");
return new Response
{
ReplyExchange = "hub",
Body = JsonConvert.SerializeObject(new User{
UserName = "Pong",
LastName = user.LastName
}),
StatusCode = 200
};
}
[Queue(exchange: "users", queue: "user-delete", routingKey: "user.cmd.delete", AutoDelete = true)]
[Consume(autoAck: false)]
[Channel(name: "deletechannel")]
public async Task DeleteAsync(
[Inject] IUserRepository userRepository,
[TextMessage] string userName,
Action ack,
Action<bool> reject)
{
await userRepository.DeleteAsync(userName);
Console.WriteLine("Deleted");
ack();
}
}
} |
var https = require('https');
var xml2js = require('xml2js');
var groups = {};
var host, port , auth, origin;
groups.getUserGroups = function(req, res) {
var options = {
rejectUnauthorized: false,
hostname: host,
port: port,
path: "/sap/opu/odata/UI2/PAGE_BUILDER_PERS/PageSets('%2FUI2%2FFiori2LaunchpadHome')/Pages?$expand=PageChipInstances/Chip/ChipBags/ChipProperties",
method: 'GET',
auth: auth,
agent: false
};
var parser = new xml2js.Parser();
https.get(options, function(response) {
var bodyChunks = [];
response.on('data', function(chunk) {
bodyChunks.push(chunk);
}).on('end', function() {
var body = Buffer.concat(bodyChunks);
var jsonResult = [];
console.log(body.toString());
//convert the XML response to JSON using the xml2js
parser.parseString(body, function (err, result) {
var groups = result.feed.entry;
var currentGroupProperties, currentGroupTiles;
if(groups){
for(var i=0; i<groups.length; i++){
currentGroupProperties = groups[i].content[0]['m:properties'][0];
currentGroupTiles = groups[i].link[3]['m:inline'][0].feed[0].entry;
var groupJson = {
id : currentGroupProperties['d:id'][0],
title : currentGroupProperties['d:id'][0]==='/UI2/Fiori2LaunchpadHome'? 'My Home' : currentGroupProperties['d:title'][0],
tiles: []
};
//iterate on current group tiles and add them the json
var tileProps, chip, curTile;
if(currentGroupTiles){
for(var k=0; k<currentGroupTiles.length; k++){
chip = currentGroupTiles[k].link[1]['m:inline'][0];
if(chip !== ""){ //Need to remove tiles that were built from a catalog chip which is no longer exists, they should be removed...(not appear in FLP)
tileProps = chip.entry[0].content[0]['m:properties'][0]; //currentGroupTiles[k].content[0]['m:properties'][0];
curTile = {
title: tileProps['d:title'][0],
configuration: parseConfiguration(tileProps['d:configuration'][0]),
url: tileProps['d:url'][0],
baseChipId: tileProps['d:baseChipId'][0],//identify the type of tile (e.g."X-SAP-UI2-CHIP:/UI2/DYNAMIC_APPLAUNCHER")
id: tileProps['d:id'][0]
};
curTile.isDoubleWidth = curTile.configuration.col > 1;
curTile.isDoubleHeight = curTile.configuration.row > 1;
curTile.icon = '/images/index/main/apps/NewsImage11.png';
curTile.refreshInterval = curTile.configuration['service_refresh_interval'];
curTile.realIcon = matchTileIcon(curTile.configuration['display_icon_url']);
curTile.navigationTargetUrl = curTile.configuration['navigation_target_url'];
curTile.serviceURL = curTile.configuration['service_url'];
//Try to build working app url
curTile.navUrl = undefined;
if(curTile.navigationTargetUrl){
if(curTile.navigationTargetUrl.indexOf('#')===-1){ //it doesn't contain semantic object + action
curTile.navUrl = origin + curTile.navigationTargetUrl;
}else{
curTile.navUrl = origin + '/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html?' + curTile.navigationTargetUrl;
}
}
curTile.dynamicData = 0;
getDynamicData(curTile);
curTile.description = curTile.configuration['display_subtitle_text'];
curTile.displayInfoText = curTile.configuration['display_info_text'];
curTile.displayNumberUnit = curTile.configuration['display_number_unit'];
switch(curTile.baseChipId){
case "X-SAP-UI2-CHIP:/UI2/AR_SRVC_NEWS":
curTile.type = 0;
break;
case "X-SAP-UI2-CHIP:/UI2/DYNAMIC_APPLAUNCHER":
curTile.type = 1;
break;
default: //"X-SAP-UI2-CHIP:/UI2/STATIC_APPLAUNCHER":
curTile.type = 2;
}
groupJson.tiles.push(curTile);
}
}
}
if(groupJson.tiles.length === 0){
groupJson.tiles.push(getEmptyTile());
}
jsonResult.push(groupJson);
}
}
//Needs to be after the parsing completes
res.json({ //Set the response back
status: 'OK',
results:jsonResult
});
})
})
}).on('error', function(e) {
console.error(e);
var jsonResult = jsonResult || [];
//work-around for non working ABAP
if(jsonResult.length === 0){
for(var i=0; i<6; i++){
var tile, tiles = [];
for(var k=0 ; k<i; k++){
tile = {
title: "TileTitle_" + k,
description: "TileDescription_" + k,
configuration: JSON.parse('{"row":"1","col":"1"}'), //Default value for regular tiles
url: "TODO tileURL",
baseChipId: "TODO",
id: "Tile_" + k,
isNews: (k%2)?true:false
};
tile.isDoubleWidth = tile.configuration.row > 1,
tile.isDoubleHeight = tile.configuration.col > 1,
tiles.push(tile);
}
jsonResult.push({
id : "Group_" + i,
title : "GroupTitle_" + i,
tiles: tiles
});
}
}
res.json({ //Set the response back
status: 'OK',
results:jsonResult
});
});
var parseConfiguration = function(confString){
var res;
if(!confString){
res = {"row":"1","col":"1"};
}else{
res = JSON.parse(confString);
if(res.tileConfiguration){
res = JSON.parse(res.tileConfiguration);
}
}
return res;
};
var getEmptyTile = function(){
return {
title: '',
configuration: {"row":"1","col":"1"},
url: '',
icon: '/images/index/main/apps/plusSign.png',
type: -1
};
};
var getDynamicData = function(curTile){
if(curTile.serviceURL){
options.path = curTile.serviceURL;
https.get(options, function(response) {
var bodyChunks = [];
response.on('data', function(chunk) {
bodyChunks.push(chunk);
});
response.on('end', function() {
var body = Buffer.concat(bodyChunks);
this.dynamicData = body.toString();
});
}.bind(curTile))
}
};
var matchTileIcon = function(fontName){
switch(fontName){
case 'sap-icon://multi-select':
return 'glyphicon glyphicon-list';
break;
case 'sap-icon://action-settings':
return 'glyphicon glyphicon-cog';
break;
case 'sap-icon://appointment':
return 'glyphicon glyphicon-calendar';
break;
case 'sap-icon://travel-itinerary':
return 'glyphicon glyphicon-plane';
break;
case 'sap-icon://table-chart':
return 'glyphicon glyphicon-th';
break;
default:
return 'glyphicon glyphicon-eye-close';
}
}
};
module.exports = function(opts) {
if(opts) {
if(opts.fiori) {
var url = opts.fiori.split('//')[1].split(':');
host = url[0];
port = url[1];
origin = opts.fiori;
}
if(opts.fioriAuth) {
auth = opts.fioriAuth;
}
}
return groups;
}; |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection;
using System.Text;
using FLS.Data.WebApi;
using FLS.Data.WebApi.Accounting;
namespace FLS.Server.Data.DbEntities
{
public partial class Delivery : IFLSMetaData
{
public Delivery()
{
DeliveryItems = new HashSet<DeliveryItem>();
PersonFlightTimeCreditTransactions = new HashSet<PersonFlightTimeCreditTransaction>();
}
public Guid DeliveryId { get; set; }
public Guid ClubId { get; set; }
public Guid? FlightId { get; set; }
public Guid? RecipientPersonId { get; set; }
[StringLength(250)]
public string RecipientName { get; set; }
[StringLength(100)]
public string RecipientFirstname { get; set; }
[StringLength(100)]
public string RecipientLastname { get; set; }
[StringLength(200)]
public string RecipientAddressLine1 { get; set; }
[StringLength(200)]
public string RecipientAddressLine2 { get; set; }
[StringLength(10)]
public string RecipientZipCode { get; set; }
[StringLength(100)]
public string RecipientCity { get; set; }
[StringLength(100)]
public string RecipientCountryName { get; set; }
[StringLength(20)]
public string RecipientPersonClubMemberNumber { get; set; }
[StringLength(250)]
public string DeliveryInformation { get; set; }
[StringLength(250)]
public string AdditionalInformation { get; set; }
public string DeliveryNumber { get; set; }
/// <summary>
/// Delivery date and in case of a flight, the flight date.
/// </summary>
public DateTime? DeliveredOn { get; set; }
public bool IsFurtherProcessed { get; set; }
public long BatchId { get; set; }
[Column(TypeName = "datetime2")]
public DateTime CreatedOn { get; set; }
public Guid CreatedByUserId { get; set; }
[Column(TypeName = "datetime2")]
public DateTime? ModifiedOn { get; set; }
public Guid? ModifiedByUserId { get; set; }
[Column(TypeName = "datetime2")]
public DateTime? DeletedOn { get; set; }
public Guid? DeletedByUserId { get; set; }
public int? RecordState { get; set; }
public Guid OwnerId { get; set; }
public int OwnershipType { get; set; }
public bool IsDeleted { get; set; }
public virtual Club Club { get; set; }
public virtual Flight Flight { get; set; }
public virtual ICollection<DeliveryItem> DeliveryItems { get; set; }
public virtual ICollection<PersonFlightTimeCreditTransaction> PersonFlightTimeCreditTransactions { get; set; }
public Guid Id
{
get { return DeliveryId; }
set { DeliveryId = value; }
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
Type type = GetType();
sb.Append("[");
sb.Append(type.Name);
sb.Append(" -> ");
foreach (FieldInfo info in type.GetFields())
{
sb.Append(string.Format("{0}: {1}, ", info.Name, info.GetValue(this)));
}
Type tColl = typeof(ICollection<>);
foreach (PropertyInfo info in type.GetProperties())
{
Type t = info.PropertyType;
if (t.IsGenericType && tColl.IsAssignableFrom(t.GetGenericTypeDefinition()) ||
t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == tColl)
|| (t.Namespace != null && t.Namespace.Contains("FLS.Server.Data.DbEntities")))
{
continue;
}
sb.Append(string.Format("{0}: {1}, ", info.Name, info.GetValue(this, null)));
}
sb.Append(" <- ");
sb.Append(type.Name);
sb.AppendLine("]");
return sb.ToString();
}
}
}
|
Date: Tue, 10 Dec 1996 21:21:29 GMT
Server: NCSA/1.4.2
Content-type: text/html
Last-modified: Wed, 15 May 1996 23:35:44 GMT
Content-length: 263
<html>
<title>Coffee</title>
<body bgcolor=#FFFFFF text=#000000 >
<h2>Coffee</h2>
Here is a Seattle coffee
<a href="http://www.halcyon.com/zipgun/mothercity/mothercity.html">guide</a>.
<p>
<IMG SRC="absinthe.gif">
<p>
<em>Absinthe</em> by Degas
</body>
</html>
|
using System.ComponentModel.Composition;
using TotalApi.Core.Api.ControlApi;
using TotalApi.Core.ServiceContracts;
using TotalApi.SampleModule.Api.ServiceContracts;
namespace TotalApi.SampleModule
{
[Export(typeof(IModuleInitializer))]
class Startup : IModuleInitializer
{
public void Init()
{
TotalApiServiceHost<SampleModuleService>.Open<ISampleService>();
}
}
} |
<?php
$show_breadcrumbs = true;
require_once 'functions.php';
$section = 4;
$page = 6;
$keywords = $db->query("SELECT COUNT(*) AS total, keywords.keyword
FROM keywords_papers JOIN keywords ON keywords_papers.keyword = keywords.id
GROUP BY keywords.keyword
ORDER BY COUNT(*) DESC");
$keywords_alfabet = $db->query("SELECT COUNT(*) AS total, keywords.keyword
FROM keywords_papers JOIN keywords ON keywords_papers.keyword = keywords.id
GROUP BY keywords.keyword
ORDER BY keywords.keyword");
$tag_parents = $db->query("SELECT SQL_CACHE * FROM tags_parents ORDER BY id");
foreach ($tag_parents as $row) {
$tags[$row['id']] = $db->query("SELECT SQL_CACHE * FROM tags WHERE parent = {$row['id']} ORDER BY tag");
}
$tags_all = $db->query("SELECT COUNT(*) AS total, tags.tag, tags.id
FROM tags_papers JOIN tags ON tags_papers.tag = tags.id
GROUP BY tags.tag
ORDER BY COUNT(*) DESC");
$tags_alfabet = $db->query("SELECT COUNT(*) AS total, tags.tag, tags.id
FROM tags_papers JOIN tags ON tags_papers.tag = tags.id
GROUP BY tags.tag
ORDER BY tags.tag");
$sources = $db->query("SELECT * FROM sources ORDER BY name");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php echo $header ?>
<title>Studies | <?php echo SITENAME ?></title>
<link rel="stylesheet" href="css/select2.min.css" />
<style type="text/css">
.shortlist {
max-height: 270px;
position: relative;
overflow: hidden;
background-color:#fff;
background-color:rgb(255,255,255);
}
.shortlist .read-more {
position: absolute;
bottom: 0; left: 0;
width: 100%;
text-align: center;
margin: 0;
padding: 30px 0;
list-style:none;
/* "transparent" only works here because == rgba(0,0,0,0) */
background-image: -webkit-linear-gradient(top, transparent, white);
background-image: -ms-linear-gradient(top, transparent, white);
background-image: -o-linear-gradient(top, transparent, white);
background-image: -moz-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,100));
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, rgba(255,255,255,0)),color-stop(1, rgba(255,255,255,100)));
}
</style>
<script type="text/javascript">
$(function(){
// From: http://css-tricks.com/text-fade-read-more/
var $el, $ps, $up, totalHeight;
$(".shortlist .btn").click(function() {
// IE 7 doesn't even get this far. I didn't feel like dicking with it.
totalHeight = 0
$el = $(this);
$p = $el.parent();
$up = $p.parent();
$ps = $up.find("li:not('.read-more')");
// measure how tall inside should be by adding together heights of all inside paragraphs (except read-more paragraph)
$ps.each(function() {
totalHeight += $(this).outerHeight();
// FAIL totalHeight += $(this).css("margin-bottom");
});
$up
.css({
// Set height to prevent instant jumpdown when max height is removed
"height": $up.height(),
"max-height": 9999
})
.animate({
"height": totalHeight
});
// fade out read-more
$p.fadeOut();
// prevent jump-down
return false;
});
});
</script>
</head>
<body>
<?php require_once 'include.header.php'; ?>
<h1>Search</h1>
<h2>Search in title/abstract</h2>
<form method="post" class="form form-horizontal" action="publications/list">
<div class="form-group">
<label class="col-sm-2 control-label">Search</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="searchphrase" value="<?php echo $info->name ?>" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="title" value="1" checked />
Search in title
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="abstract" value="1" checked />
Search in abstract
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</div>
</form>
<h2>Custom Filters</h2>
<div class="alert alert-warning">
Use the fields below to create your own filters and easily find what you are looking for.
All of the fields are optional; only fill out those that are of importance to you.
<br />
<strong>The system will only find publications that match ALL of the filters that
you select.</strong>
</div>
<form method="post" class="form form-horizontal" action="publications/list">
<?php foreach ($tag_parents as $row) { ?>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $row['name'] ?></label>
<div class="col-sm-10">
<select name="tags[<?php echo $row['id'] ?>][]" class="form-control" multiple size="<?php echo min(6, count($tags[$row['id']])) ?>">
<?php foreach ($tags[$row['id']] as $subrow) { ?>
<option value="<?php echo $subrow['id'] ?>"<?php if ($tag[$subrow['id']]) { echo ' selected'; } ?>><?php echo $subrow['tag'] ?></option>
<?php } ?>
</select>
</div>
</div>
<?php } ?>
<div class="form-group">
<label class="col-sm-2 control-label">Publication date</label>
<div class="col-sm-3">
In or after
<input class="form-control" type="text" name="start" value="<?php echo $start ? $start : '' ?>" placeholder="E.g. <?php echo date("Y")-10 ?>" />
</div>
<div class="col-sm-3">
But not later than
<input class="form-control" type="text" name="end" value="<?php echo $end ? $end : '' ?>" placeholder="E.g. <?php echo date("Y") ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Source</label>
<div class="col-sm-10">
<select name="source" class="form-control">
<option value=""></option>
<?php foreach ($sources as $row) { ?>
<option value="<?php echo $row['id'] ?>"<?php if ($source == $row['id']) { echo ' selected'; } ?>><?php echo $row['name'] ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</div>
</form>
<h2>By Tag</h2>
<div class="alert alert-warning">
Tags have been manually assigned by our team to each paper. The tags have been standardized
among papers and we have tried to be consistent and make tags useful for filtering through
urban metabolism-related papers.
</div>
<h3>Tag List</h3>
<div class="row">
<div class="col-md-4">
<h4>List by ocurrence</h4>
<div class="resultbox">
<i class="fa fa-info-circle"></i>
<strong><?php echo count($tags_all) ?></strong> tags found
</div>
<ul class="shortlist">
<?php foreach ($tags_all as $row) { ?>
<li>
<a href="tags/<?php echo $row['id'] ?>/<?php echo flatten($row['tag']) ?>"><?php echo $row['tag'] ?></a>
(<?php echo $row['total'] ?>)
</li>
<?php } ?>
<li class="read-more"><a href="#" class="btn btn-info">Read more</a></li>
</ul>
</div>
<div class="col-md-4">
<h4>Alphabetical list</h4>
<div class="resultbox">
<i class="fa fa-info-circle"></i>
<strong><?php echo count($tags_alfabet) ?></strong> tags found
</div>
<ul class="shortlist">
<?php foreach ($tags_alfabet as $row) { ?>
<li>
<a href="tags/<?php echo $row['id'] ?>/<?php echo flatten($row['tag']) ?>"><?php echo $row['tag'] ?></a>
(<?php echo $row['total'] ?>)
</li>
<?php } ?>
<li class="read-more"><a href="#" class="btn btn-info">Read more</a></li>
</ul>
</div>
</div>
<div class="hide">
<h2>By Keyword</h2>
<div class="alert alert-warning">
Please note that keywords are provided directly by authors and possibly adjusted by
editors. There are no industry-wide standards and the keywords used come in
a wide variety. We have listed the different keywords used in papers here, but
if you want to filter using a shorter and more standardized list of keywords,
then we recommend you use the <a href="tags">tags</a> that we assigned to
classify each paper instead.
</div>
<h3>Keyword List</h3>
<div class="row">
<div class="col-md-4">
<h4>List by ocurrence</h4>
<div class="resultbox">
<i class="fa fa-info-circle"></i>
<strong><?php echo count($keywords) ?></strong> keywords found
</div>
<ul class="shortlist">
<?php foreach ($keywords as $row) { ?>
<li>
<a href="studies.search.php?keyword=<?php echo $row['id'] ?>"><?php echo $row['keyword'] ?></a>
(<?php echo $row['total'] ?>)
</li>
<?php } ?>
<li class="read-more"><a href="#" class="btn btn-info">Read more</a></li>
</ul>
</div>
<div class="col-md-4">
<h4>Alphabetical list</h4>
<div class="resultbox">
<i class="fa fa-info-circle"></i>
<strong><?php echo count($keywords_alfabet) ?></strong> keywords found
</div>
<ul class="shortlist">
<?php foreach ($keywords_alfabet as $row) { ?>
<li>
<a href="studies.search.php?keyword=<?php echo $row['id'] ?>"><?php echo $row['keyword'] ?></a>
(<?php echo $row['total'] ?>)
</li>
<?php } ?>
<li class="read-more"><a href="#" class="btn btn-info">Read more</a></li>
</ul>
</div>
</div>
</div>
<script type="text/javascript" src="js/select2.min.js"></script>
<script type="text/javascript">
$(function(){
$("select").select2();
});
</script>
<?php require_once 'include.footer.php'; ?>
</body>
</html>
|
//
// graphene_functions.hpp
// graphenePFC
//
// Created by Rachel Zucker on 8/15/16.
// Copyright © 2016 Rachel Zucker. All rights reserved.
//
#ifndef graphene_functions_hpp
#define graphene_functions_hpp
#include "matrix_types.hpp"
// an inital condition that produces an AC circle inside an AB matrix
void InitialCircle(matrix_t* n_mat, const double r0);
// an inital condition that produces stripes
void InitialShallowStripes(matrix_t* n_mat, const double r0);
void InitialSteepStripes(matrix_t* n_mat, const double r0);
void InitialDiagonalStripes(matrix_t* n_mat, const double r0);
void InitialVerticalStripes(matrix_t* n_mat, const double r0);
void InitialHorizontalStripes(matrix_t* n_mat, const double r0);
void InitialHorizontalDoubleStripes(matrix_t* n_mat, const double r0);
void InitialSmoothStripes(matrix_t* n_mat, const double r0, const double degrees);
void InitialSmoothStripesVert(matrix_t* n_mat, const double r0, const double degrees);
// an inital condition to make a perfect "A" sheet
void InitialAA(matrix_t* n_mat, const double r0);
// a function that can add a constant shift to a matrix, useful for conserved dynamics
void AddConstToMatrix(matrix_t* n_mat, const double amount);
// a function that produces the fourier-space vectors
// in cylindrical coordinates
void MakeKs(matrix_t* k_r, matrix_t* k_th);
// a function that produces the fourier transform of the coefficients
// C2, Cs1, and Cs2 from Seymour's paper
void MakeCs(matrix_t* c2, matrix_t* cs1, matrix_t* cs2, matrix_t* minus_k_squared, const double r0, const double a0);
// a function that writes a matrix to a file in the directory directoryString
// with the first line "the time is (time)" and a filename of the iteration number
void WriteMatrix(const double time, const double energy_val, const std::string directory_string, const matrix_t& mat);
void AFMTip(matrix_t* total_potential, const double radius, const double speed, const double force, const double angle, const double time, const double delay, const matrix_t& fixed_potential);
#endif /* graphene_functions_hpp */
|
<?php
declare(strict_types=1);
/**
* This file is part of me-cms.
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Mirko Pagliai
* @link https://github.com/mirko-pagliai/me-cms
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
$this->extend('MeCms./Admin/common/index');
$this->assign('title', __d('me_cms', 'Users groups'));
$this->append('actions', $this->Html->button(
I18N_ADD,
['action' => 'add'],
['class' => 'btn-success', 'icon' => 'plus']
));
$this->append('actions', $this->Html->button(
__d('me_cms', 'Add user'),
['controller' => 'Users', 'action' => 'add'],
['class' => 'btn-success', 'icon' => 'plus']
));
?>
<table class="table table-hover">
<thead>
<tr>
<th class="text-center"><?= $this->Paginator->sort('id', I18N_ID) ?></th>
<th><?= $this->Paginator->sort('name', I18N_NAME) ?></th>
<th><?= $this->Paginator->sort('label', I18N_LABEL) ?></th>
<th class="text-center"><?= $this->Paginator->sort('user_count', I18N_USERS) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($groups as $group) : ?>
<tr>
<td class="text-nowrap text-center">
<code><?= $group->get('id') ?></code>
</td>
<td>
<strong>
<?= $this->Html->link($group->get('name'), ['action' => 'edit', $group->get('id')]) ?>
</strong>
<?php
$actions = [
$this->Html->link(I18N_EDIT, ['action' => 'edit', $group->get('id')], ['icon' => 'pencil-alt']),
$this->Form->postLink(I18N_DELETE, ['action' => 'delete', $group->get('id')], [
'class' => 'text-danger',
'icon' => 'trash-alt',
'confirm' => I18N_SURE_TO_DELETE,
]),
];
echo $this->Html->ul($actions, ['class' => 'actions']);
?>
</td>
<td>
<?= $group->get('description') ?>
</td>
<td class="text-nowrap text-center">
<?php
if ($group->get('user_count')) {
echo $this->Html->link(
(string)$group->get('user_count'),
['controller' => 'Users', 'action' => 'index', '?' => ['group' => $group->get('id')]],
['title' => I18N_BELONG_ELEMENT]
);
} else {
echo $group->get('user_count');
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?= $this->element('MeTools.paginator') ?>
|
namespace HearthyWebApi.Areas.HelpPage.ModelDescriptions
{
public class KeyValuePairModelDescription : ModelDescription
{
public ModelDescription KeyModelDescription { get; set; }
public ModelDescription ValueModelDescription { get; set; }
}
} |
<?php
namespace Waldo\OpenIdConnect\ProviderBundle\Tests\Services;
use Waldo\OpenIdConnect\ProviderBundle\Services\AuthorizationEndpoint;
use Symfony\Component\HttpFoundation\Request;
/**
* AuthorizationEndpointTest
*
* @group AuthorizationEndpoint
* @author valérian Girard <valerian.girard@educagri.fr>
*/
class AuthorizationEndpointTest extends \PHPUnit_Framework_TestCase
{
private $authenticationRequestValidator;
private $authenticationCodeFlow;
protected function tearDown()
{
parent::tearDown();
$this->authenticationCodeFlow = null;
$this->authenticationRequestValidator = null;
}
public function testHandleRequestShouldReturnRespons()
{
$authEndpoint = $this->getAuthorizationEndpoint();
$this->authenticationRequestValidator
->expects($this->once())
->method("validate")
/* @var $o Waldo\OpenIdConnect\ModelBundle\Entity\Request\Authentication; */
->with($this->callback(function($o) {
$test = true;
$test &= $o instanceof \Waldo\OpenIdConnect\ModelBundle\Entity\Request\Authentication;
$test &= count($o->getScope()) == 3;
$test &= in_array('openid', $o->getScope());
$test &= in_array('scope1', $o->getScope());
$test &= in_array('scope2', $o->getScope());
$test &= $o->getClientId() == "one_clientId";
$test &= $o->getRedirectUri() == "one_redirectUri";
$test &= $o->getState() == "one_state";
$test &= $o->getResponseMode() == "one_responseMode";
$test &= $o->getNonce() == "one_nonce";
$test &= $o->getPrompt() == "one_prompt";
$test &= $o->getMaxAge() == "36000";
$test &= $o->getUiLocales() == "one_uiLocales";
$test &= $o->getIdTokenHint() == "one_idTokenHint";
$test &= $o->getLoginHint() == "one_loginHint";
return $test;
}))
->will($this->returnValue(true));
$this->authenticationCodeFlow
->expects($this->once())
->method("handle")
->with($this->callback(function($o){
return $o instanceof \Waldo\OpenIdConnect\ModelBundle\Entity\Request\Authentication;
}))
->will($this->returnValue("good"));
$request = new Request();
$request->query->add(array(
"scope" => "openid scope1 scope2",
"response_type" => "code",
'client_id' => 'one_clientId',
'redirect_uri' => 'one_redirectUri',
'state' => 'one_state',
'response_mode' => 'one_responseMode',
'nonce' => 'one_nonce',
'display' => 'one_display',
'prompt' => 'one_prompt',
'max_age' => '36000',
'ui_locales' => 'one_uiLocales',
'id_token_hint' => 'one_idTokenHint',
'login_hint' => 'one_loginHint'
));
$result = $authEndpoint->handleRequest($request);
$this->assertEquals("good", $result);
}
/**
* @expectedException Waldo\OpenIdConnect\ProviderBundle\Exception\AuthenticationRequestException
* @expectedExceptionMessage authentication flow is not yet implemented
*/
public function testShouldFailForUnknowFlow()
{
$authEndpoint = $this->getAuthorizationEndpoint();
$request = new Request();
$request->query->add(array(
"response_type" => "id_token"
));
$authEndpoint->handleRequest($request);
}
/**
* @expectedException Waldo\OpenIdConnect\ProviderBundle\Exception\AuthenticationRequestException
* @expectedExceptionMessage authentication flow is not yet implemented
*/
public function testShouldFailForUnknowFlow2()
{
$authEndpoint = $this->getAuthorizationEndpoint();
$request = new Request();
$request->query->add(array(
"response_type" => "code id_token"
));
$authEndpoint->handleRequest($request);
}
/**
* @expectedException Waldo\OpenIdConnect\ProviderBundle\Exception\AuthenticationRequestException
* @expectedExceptionMessage unknow authentication flow
*/
public function testShouldFailForUnknowFlow3()
{
$authEndpoint = $this->getAuthorizationEndpoint();
$request = new Request();
$request->query->add(array(
"response_type" => "dumb"
));
$authEndpoint->handleRequest($request);
}
public function testShouldFailForUnknowFlowAndReturnRedirection()
{
$authEndpoint = $this->getAuthorizationEndpoint();
$request = new Request();
$request->query->add(array(
"response_type" => "dumb",
'redirect_uri' => 'one_redirectUri',
'state' => 'one_state'
));
$result = $authEndpoint->handleRequest($request);
$this->assertInstanceOf("Symfony\Component\HttpFoundation\RedirectResponse", $result);
$this->assertEquals(302, $result->getStatusCode());
$this->assertEquals("http://localhostone_redirectUri?error=invalid_request&error_description=unknow%20authentication%20flow&state=one_state", $result->headers->get("location"));
}
private function getAuthorizationEndpoint()
{
return new AuthorizationEndpoint($this->mockAuthenticationRequestValidator(), $this->mockAuthenticationCodeFlow());
}
private function mockAuthenticationRequestValidator()
{
return $this->authenticationRequestValidator = ( $this->authenticationRequestValidator === null )
? $this->getMockBuilder("Waldo\OpenIdConnect\ProviderBundle\Constraints\AuthenticationRequestValidator")
->disableOriginalConstructor()->getMock()
: $this->authenticationRequestValidator;
}
private function mockAuthenticationCodeFlow()
{
return $this->authenticationCodeFlow = ($this->authenticationCodeFlow === null)
? $this->getMockBuilder("Waldo\OpenIdConnect\ProviderBundle\AuthenticationFlows\AuthenticationCodeFlow")
->disableOriginalConstructor()->getMock()
: $this->authenticationCodeFlow;
}
}
|
# Make results show in one line
There is a function to concat data to make the data transfer much easily. It is called `group_concat`. The grammar can be illustrated by one example:
```sql
SELECT province, group_concat(city order by city desc separator ';') FROM table GROUP BY province;
```
Mainly pay attention to the group_concat statement. It is to order the city by descending order and use ';' as the separator. We may also use `distinct` to the field city.
**Important**
The group_concat has a maximum size limitation. By default it is 1024. To temporarily make it larger we can use:
```sql
SET GLOBAL group_concat_max_len=102400;
SET SESSION group_concat_max_len=102400;
```
The first statement needs a root privilege.
[source](http://hchmsguo.iteye.com/blog/555543) |
'use strict';
const fs = require('fs');
const path = require('path');
const Router = require('koa-router');
const apiRouter = require('./api');
const ask = require('../lib/ask');
const config = require('config');
const indexFilePath = path.resolve(__dirname, '..', 'views', 'index.html');
const router = new Router();
const apiAddress = config.port ?
`//${config.path}:${config.port}/api` : `//${config.path}/api`;
router.use('/api', apiRouter.routes(), apiRouter.allowedMethods());
router.get('/*', index);
const appScripts = getStartScripts();
let indexFileContents = null;
async function index (ctx) {
if (indexFileContents === null) {
let indexFile = await ask(fs, 'readFile', indexFilePath);
indexFileContents = new Function ('state', `return \`${indexFile}\``)({
apiAddress,
appScripts
});
}
ctx.body = indexFileContents;
}
function getStartScripts() {
if (process.env.NODE_ENV === 'production') {
return `<script type="text/javascript" src="/js/app.bundle.js"></script>`;
} else {
return `<script type="text/javascript" src="/js/simple-require.js"></script>
<script type="text/javascript" src="/js/index.js"></script>`;
}
}
module.exports = router; |
var group__spi__interface__gr =
[
[ "Status Error Codes", "group__spi__execution__status.html", "group__spi__execution__status" ],
[ "SPI Events", "group__SPI__events.html", "group__SPI__events" ],
[ "SPI Control Codes", "group__SPI__control.html", "group__SPI__control" ],
[ "ARM_DRIVER_SPI", "group__spi__interface__gr.html#structARM__DRIVER__SPI", [
[ "GetVersion", "group__spi__interface__gr.html#a8834b281da48583845c044a81566c1b3", null ],
[ "GetCapabilities", "group__spi__interface__gr.html#a065b5fc24d0204692f0f95a44351ac1e", null ],
[ "Initialize", "group__spi__interface__gr.html#afac50d0b28860f7b569293e6b713f8a4", null ],
[ "Uninitialize", "group__spi__interface__gr.html#adcf20681a1402869ecb5c6447fada17b", null ],
[ "PowerControl", "group__spi__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef", null ],
[ "Send", "group__spi__interface__gr.html#a44eedddf4428cf4b98883b6c27d31922", null ],
[ "Receive", "group__spi__interface__gr.html#adb9224a35fe16c92eb0dd103638e4cf3", null ],
[ "Transfer", "group__spi__interface__gr.html#ad88b63ed74c03ba06b0599ab06ad4cf7", null ],
[ "GetDataCount", "group__spi__interface__gr.html#ad1d892ab3932f65cd7cdf2d0a91ae5da", null ],
[ "Control", "group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505", null ],
[ "GetStatus", "group__spi__interface__gr.html#a7305e7248420cdb4b02ceba87672178d", null ]
] ],
[ "ARM_SPI_CAPABILITIES", "group__spi__interface__gr.html#structARM__SPI__CAPABILITIES", [
[ "simplex", "group__spi__interface__gr.html#af244e2c2facf6414e3886495ee6b40bc", null ],
[ "ti_ssi", "group__spi__interface__gr.html#a8053c540e5d531b692224bdc2463f36a", null ],
[ "microwire", "group__spi__interface__gr.html#a9b4e858eb1d414128994742bf121f94c", null ],
[ "event_mode_fault", "group__spi__interface__gr.html#a309619714f0c4febaa497ebdb9b7e3ca", null ],
[ "reserved", "group__spi__interface__gr.html#aa43c4c21b173ada1b6b7568956f0d650", null ]
] ],
[ "ARM_SPI_STATUS", "group__spi__interface__gr.html#structARM__SPI__STATUS", [
[ "busy", "group__spi__interface__gr.html#a50c88f3c1d787773e2ac1b59533f034a", null ],
[ "data_lost", "group__spi__interface__gr.html#a9675630df67587ecd171c7ef12b9d22a", null ],
[ "mode_fault", "group__spi__interface__gr.html#aeaf54ec655b7a64b9e88578c5f39d4e3", null ],
[ "reserved", "group__spi__interface__gr.html#aa43c4c21b173ada1b6b7568956f0d650", null ]
] ],
[ "ARM_SPI_SignalEvent_t", "group__spi__interface__gr.html#gafde9205364241ee81290adc0481c6640", null ],
[ "ARM_SPI_GetVersion", "group__spi__interface__gr.html#gad5db9209ef1d64a7915a7278d6a402c8", null ],
[ "ARM_SPI_GetCapabilities", "group__spi__interface__gr.html#gaf4823a11ab5efcd47c79b13801513ddc", null ],
[ "ARM_SPI_Initialize", "group__spi__interface__gr.html#ga1a3c11ed523a4355cd91069527945906", null ],
[ "ARM_SPI_Uninitialize", "group__spi__interface__gr.html#ga0c480ee3eabb82fc746e89741ed2e03e", null ],
[ "ARM_SPI_PowerControl", "group__spi__interface__gr.html#ga1a1e7e80ea32ae381b75213c32aa8067", null ],
[ "ARM_SPI_Send", "group__spi__interface__gr.html#gab2a303d1071e926280d50682f4808479", null ],
[ "ARM_SPI_Receive", "group__spi__interface__gr.html#ga726aff54e782ed9b47f7ba1280a3d8f6", null ],
[ "ARM_SPI_Transfer", "group__spi__interface__gr.html#gaa24026b3822c10272e301f1505136ec2", null ],
[ "ARM_SPI_GetDataCount", "group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb", null ],
[ "ARM_SPI_Control", "group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a", null ],
[ "ARM_SPI_GetStatus", "group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817", null ],
[ "ARM_SPI_SignalEvent", "group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e", null ]
]; |
package tsm1
import (
"fmt"
"os"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/influxdata/influxdb"
"github.com/influxdata/influxdb/models"
"github.com/influxdata/influxdb/tsdb"
"github.com/influxdata/influxdb/tsdb/cursors"
)
func TestTimeRangeIterator(t *testing.T) {
tsm := mustWriteTSM(
bucket{
org: 0x50,
bucket: 0x60,
w: writes(
mw("cpu",
kw("tag0=val0",
vals(tvi(1000, 1), tvi(1010, 2), tvi(1020, 3)),
vals(tvi(2000, 1), tvi(2010, 2), tvi(2020, 3)),
),
kw("tag0=val1",
vals(tvi(2000, 1), tvi(2010, 2), tvi(2020, 3)),
vals(tvi(3000, 1), tvi(3010, 2), tvi(3020, 3)),
),
),
),
},
bucket{
org: 0x51,
bucket: 0x61,
w: writes(
mw("mem",
kw("tag0=val0",
vals(tvi(1000, 1), tvi(1010, 2), tvi(1020, 3)),
vals(tvi(2000, 1), tvi(2010, 2), tvi(2020, 3)),
),
kw("tag0=val1",
vals(tvi(1000, 1), tvi(1010, 2), tvi(1020, 3)),
vals(tvi(2000, 1)),
),
kw("tag0=val2",
vals(tvi(2000, 1), tvi(2010, 2), tvi(2020, 3)),
vals(tvi(3000, 1), tvi(3010, 2), tvi(3020, 3)),
),
),
),
},
)
defer tsm.RemoveAll()
orgBucket := func(org, bucket uint) []byte {
n := tsdb.EncodeName(influxdb.ID(org), influxdb.ID(bucket))
return n[:]
}
type args struct {
min int64
max int64
}
type res struct {
k string
hasData bool
}
EXP := func(r ...interface{}) (rr []res) {
for i := 0; i+1 < len(r); i += 2 {
rr = append(rr, res{k: r[i].(string), hasData: r[i+1].(bool)})
}
return
}
type test struct {
name string
args args
exp []res
expStats cursors.CursorStats
}
type bucketTest struct {
org, bucket uint
m string
tests []test
}
r := tsm.TSMReader()
runTests := func(name string, tests []bucketTest) {
t.Run(name, func(t *testing.T) {
for _, bt := range tests {
key := orgBucket(bt.org, bt.bucket)
t.Run(fmt.Sprintf("0x%x-0x%x", bt.org, bt.bucket), func(t *testing.T) {
for _, tt := range bt.tests {
t.Run(tt.name, func(t *testing.T) {
iter := r.TimeRangeIterator(key, tt.args.min, tt.args.max)
count := 0
for i, exp := range tt.exp {
if !iter.Next() {
t.Errorf("Next(%d): expected true", i)
}
expKey := makeKey(influxdb.ID(bt.org), influxdb.ID(bt.bucket), bt.m, exp.k)
if got := iter.Key(); !cmp.Equal(got, expKey) {
t.Errorf("Key(%d): -got/+exp\n%v", i, cmp.Diff(got, expKey))
}
if got := iter.HasData(); got != exp.hasData {
t.Errorf("HasData(%d): -got/+exp\n%v", i, cmp.Diff(got, exp.hasData))
}
count++
}
if count != len(tt.exp) {
t.Errorf("count: -got/+exp\n%v", cmp.Diff(count, len(tt.exp)))
}
if got := iter.Stats(); !cmp.Equal(got, tt.expStats) {
t.Errorf("Stats: -got/+exp\n%v", cmp.Diff(got, tt.expStats))
}
})
}
})
}
})
}
runTests("before delete", []bucketTest{
{
org: 0x50,
bucket: 0x60,
m: "cpu",
tests: []test{
{
name: "cover file",
args: args{
min: 900,
max: 10000,
},
exp: EXP("tag0=val0", true, "tag0=val1", true),
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
{
name: "within block",
args: args{
min: 2001,
max: 2011,
},
exp: EXP("tag0=val0", true, "tag0=val1", true),
expStats: cursors.CursorStats{ScannedValues: 6, ScannedBytes: 48},
},
{
name: "to_2999",
args: args{
min: 0,
max: 2999,
},
exp: EXP("tag0=val0", true, "tag0=val1", true),
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
{
name: "intersects block",
args: args{
min: 1500,
max: 2500,
},
exp: EXP("tag0=val0", true, "tag0=val1", true),
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
},
},
{
org: 0x51,
bucket: 0x61,
m: "mem",
tests: []test{
{
name: "cover file",
args: args{
min: 900,
max: 10000,
},
exp: EXP("tag0=val0", true, "tag0=val1", true, "tag0=val2", true),
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
{
name: "within block",
args: args{
min: 2001,
max: 2011,
},
exp: EXP("tag0=val0", true, "tag0=val1", false, "tag0=val2", true),
expStats: cursors.CursorStats{ScannedValues: 6, ScannedBytes: 48},
},
{
name: "1000_2999",
args: args{
min: 1000,
max: 2500,
},
exp: EXP("tag0=val0", true, "tag0=val1", true, "tag0=val2", true),
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
},
},
})
tsm.MustDeletePrefix(orgBucket(0x50, 0x60), 0, 2999)
tsm.MustDelete(makeKey(0x51, 0x61, "mem", "tag0=val0"))
tsm.MustDeleteRange(2000, 2999,
makeKey(0x51, 0x61, "mem", "tag0=val1"),
makeKey(0x51, 0x61, "mem", "tag0=val2"),
)
runTests("after delete", []bucketTest{
{
org: 0x50,
bucket: 0x60,
m: "cpu",
tests: []test{
{
name: "cover file",
args: args{
min: 900,
max: 10000,
},
exp: EXP("tag0=val1", true),
expStats: cursors.CursorStats{ScannedValues: 6, ScannedBytes: 48},
},
{
name: "within block",
args: args{
min: 2001,
max: 2011,
},
exp: nil,
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
{
name: "to_2999",
args: args{
min: 0,
max: 2999,
},
exp: EXP("tag0=val1", false),
expStats: cursors.CursorStats{ScannedValues: 3, ScannedBytes: 24},
},
{
name: "intersects block",
args: args{
min: 1500,
max: 2500,
},
exp: EXP("tag0=val1", false),
expStats: cursors.CursorStats{ScannedValues: 3, ScannedBytes: 24},
},
{
name: "beyond all tombstones",
args: args{
min: 3000,
max: 4000,
},
exp: EXP("tag0=val1", true),
expStats: cursors.CursorStats{ScannedValues: 0, ScannedBytes: 0},
},
},
},
{
org: 0x51,
bucket: 0x61,
m: "mem",
tests: []test{
{
name: "cover file",
args: args{
min: 900,
max: 10000,
},
exp: EXP("tag0=val1", true, "tag0=val2", true),
expStats: cursors.CursorStats{ScannedValues: 9, ScannedBytes: 72},
},
{
name: "within block",
args: args{
min: 2001,
max: 2011,
},
exp: EXP("tag0=val1", false, "tag0=val2", false),
expStats: cursors.CursorStats{ScannedValues: 3, ScannedBytes: 24},
},
{
name: "1000_2500",
args: args{
min: 1000,
max: 2500,
},
exp: EXP("tag0=val1", true, "tag0=val2", false),
expStats: cursors.CursorStats{ScannedValues: 6, ScannedBytes: 48},
},
},
},
})
}
func TestExcludeEntries(t *testing.T) {
entries := func(ts ...int64) (e []IndexEntry) {
for i := 0; i+1 < len(ts); i += 2 {
e = append(e, IndexEntry{MinTime: ts[i], MaxTime: ts[i+1]})
}
return
}
eq := func(a, b []IndexEntry) bool {
if len(a) == 0 && len(b) == 0 {
return true
}
return cmp.Equal(a, b)
}
type args struct {
e []IndexEntry
min int64
max int64
}
tests := []struct {
name string
args args
exp []IndexEntry
}{
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 11,
max: 13,
},
exp: entries(12, 15),
},
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 10,
max: 13,
},
exp: entries(0, 10, 12, 15),
},
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 12,
max: 30,
},
exp: entries(12, 15, 19, 21),
},
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 0,
max: 100,
},
exp: entries(0, 10, 12, 15, 19, 21),
},
{
args: args{
e: entries(0, 10, 13, 15, 19, 21),
min: 11,
max: 12,
},
exp: entries(),
},
{
args: args{
e: entries(12, 15, 19, 21),
min: 0,
max: 9,
},
exp: entries(),
},
{
args: args{
e: entries(12, 15, 19, 21),
min: 22,
max: 30,
},
exp: entries(),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := excludeEntries(tt.args.e, TimeRange{tt.args.min, tt.args.max}); !cmp.Equal(got, tt.exp, cmp.Comparer(eq)) {
t.Errorf("excludeEntries() -got/+exp\n%v", cmp.Diff(got, tt.exp))
}
})
}
}
func TestExcludeTimeRanges(t *testing.T) {
entries := func(ts ...int64) (e []TimeRange) {
for i := 0; i+1 < len(ts); i += 2 {
e = append(e, TimeRange{Min: ts[i], Max: ts[i+1]})
}
return
}
eq := func(a, b []TimeRange) bool {
if len(a) == 0 && len(b) == 0 {
return true
}
return cmp.Equal(a, b)
}
type args struct {
e []TimeRange
min int64
max int64
}
tests := []struct {
name string
args args
exp []TimeRange
}{
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 11,
max: 13,
},
exp: entries(12, 15),
},
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 10,
max: 13,
},
exp: entries(0, 10, 12, 15),
},
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 12,
max: 30,
},
exp: entries(12, 15, 19, 21),
},
{
args: args{
e: entries(0, 10, 12, 15, 19, 21),
min: 0,
max: 100,
},
exp: entries(0, 10, 12, 15, 19, 21),
},
{
args: args{
e: entries(0, 10, 13, 15, 19, 21),
min: 11,
max: 12,
},
exp: entries(),
},
{
args: args{
e: entries(12, 15, 19, 21),
min: 0,
max: 9,
},
exp: entries(),
},
{
args: args{
e: entries(12, 15, 19, 21),
min: 22,
max: 30,
},
exp: entries(),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := excludeTimeRanges(tt.args.e, TimeRange{tt.args.min, tt.args.max}); !cmp.Equal(got, tt.exp, cmp.Comparer(eq)) {
t.Errorf("excludeEntries() -got/+exp\n%v", cmp.Diff(got, tt.exp))
}
})
}
}
func TestIntersectsEntries(t *testing.T) {
entries := func(ts ...int64) (e []IndexEntry) {
for i := 0; i+1 < len(ts); i += 2 {
e = append(e, IndexEntry{MinTime: ts[i], MaxTime: ts[i+1]})
}
return
}
type args struct {
e []IndexEntry
tr TimeRange
}
tests := []struct {
name string
args args
exp bool
}{
{
name: "",
args: args{
e: entries(5, 10, 13, 15, 19, 21, 22, 27),
tr: TimeRange{6, 9},
},
exp: false,
},
{
args: args{
e: entries(5, 10, 13, 15, 19, 21, 22, 27),
tr: TimeRange{11, 12},
},
exp: false,
},
{
args: args{
e: entries(5, 10, 13, 15, 19, 21, 22, 27),
tr: TimeRange{2, 4},
},
exp: false,
},
{
args: args{
e: entries(5, 10, 13, 15, 19, 21, 22, 27),
tr: TimeRange{28, 40},
},
exp: false,
},
{
args: args{
e: entries(5, 10, 13, 15, 19, 21, 22, 27),
tr: TimeRange{3, 11},
},
exp: true,
},
{
args: args{
e: entries(5, 10, 13, 15, 19, 21, 22, 27),
tr: TimeRange{5, 27},
},
exp: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := intersectsEntry(tt.args.e, tt.args.tr); got != tt.exp {
t.Errorf("excludeEntries() -got/+exp\n%v", cmp.Diff(got, tt.exp))
}
})
}
}
type bucket struct {
org, bucket influxdb.ID
w []measurementWrite
}
func writes(w ...measurementWrite) []measurementWrite {
return w
}
type measurementWrite struct {
m string
w []keyWrite
}
func mw(m string, w ...keyWrite) measurementWrite {
return measurementWrite{m, w}
}
type keyWrite struct {
k string
w []Values
}
func kw(k string, w ...Values) keyWrite { return keyWrite{k, w} }
func vals(tv ...Value) Values { return tv }
func tvi(ts int64, v int64) Value { return NewIntegerValue(ts, v) }
type tsmState struct {
dir string
file string
r *TSMReader
}
const fieldName = "v"
func makeKey(org, bucket influxdb.ID, m string, k string) []byte {
name := tsdb.EncodeName(org, bucket)
line := string(m) + "," + k
tags := make(models.Tags, 1)
tags[0] = models.NewTag(models.MeasurementTagKeyBytes, []byte(m))
tags = append(tags, models.ParseTags([]byte(line))...)
tags = append(tags, models.NewTag(models.FieldKeyTagKeyBytes, []byte(fieldName)))
return SeriesFieldKeyBytes(string(models.MakeKey(name[:], tags)), fieldName)
}
func mustWriteTSM(writes ...bucket) (s *tsmState) {
dir := mustTempDir()
defer func() {
if s == nil {
_ = os.RemoveAll(dir)
}
}()
f := mustTempFile(dir)
w, err := NewTSMWriter(f)
if err != nil {
panic(fmt.Sprintf("unexpected error creating writer: %v", err))
}
for _, ob := range writes {
for _, mw := range ob.w {
for _, kw := range mw.w {
key := makeKey(ob.org, ob.bucket, mw.m, kw.k)
for _, vw := range kw.w {
if err := w.Write(key, vw); err != nil {
panic(fmt.Sprintf("Write failed: %v", err))
}
}
}
}
}
if err := w.WriteIndex(); err != nil {
panic(fmt.Sprintf("WriteIndex: %v", err))
}
if err := w.Close(); err != nil {
panic(fmt.Sprintf("Close: %v", err))
}
fd, err := os.Open(f.Name())
if err != nil {
panic(fmt.Sprintf("os.Open: %v", err))
}
r, err := NewTSMReader(fd)
if err != nil {
panic(fmt.Sprintf("NewTSMReader: %v", err))
}
return &tsmState{
dir: dir,
file: f.Name(),
r: r,
}
}
func (s *tsmState) TSMReader() *TSMReader {
return s.r
}
func (s *tsmState) RemoveAll() {
_ = os.RemoveAll(s.dir)
}
func (s *tsmState) MustDeletePrefix(key []byte, min, max int64) {
err := s.r.DeletePrefix(key, min, max, nil, nil)
if err != nil {
panic(fmt.Sprintf("DeletePrefix: %v", err))
}
}
func (s *tsmState) MustDelete(keys ...[]byte) {
err := s.r.Delete(keys)
if err != nil {
panic(fmt.Sprintf("Delete: %v", err))
}
}
func (s *tsmState) MustDeleteRange(min, max int64, keys ...[]byte) {
err := s.r.DeleteRange(keys, min, max)
if err != nil {
panic(fmt.Sprintf("DeleteRange: %v", err))
}
}
|
#!/bin/bash
../flora_pac_ipv6 -x 'SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT'
|
#!/usr/bin/env python3
"""Combine logs from multiple bitcore nodes as well as the test_framework log.
This streams the combined log output to stdout. Use combine_logs.py > outputfile
to write to an outputfile."""
import argparse
from collections import defaultdict, namedtuple
import heapq
import itertools
import os
import re
import sys
# Matches on the date format at the start of the log event
TIMESTAMP_PATTERN = re.compile(r"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{6}")
LogEvent = namedtuple('LogEvent', ['timestamp', 'source', 'event'])
def main():
"""Main function. Parses args, reads the log files and renders them as text or html."""
parser = argparse.ArgumentParser(usage='%(prog)s [options] <test temporary directory>', description=__doc__)
parser.add_argument('-c', '--color', dest='color', action='store_true', help='outputs the combined log with events colored by source (requires posix terminal colors. Use less -r for viewing)')
parser.add_argument('--html', dest='html', action='store_true', help='outputs the combined log as html. Requires jinja2. pip install jinja2')
args, unknown_args = parser.parse_known_args()
if args.color and os.name != 'posix':
print("Color output requires posix terminal colors.")
sys.exit(1)
if args.html and args.color:
print("Only one out of --color or --html should be specified")
sys.exit(1)
# There should only be one unknown argument - the path of the temporary test directory
if len(unknown_args) != 1:
print("Unexpected arguments" + str(unknown_args))
sys.exit(1)
log_events = read_logs(unknown_args[0])
print_logs(log_events, color=args.color, html=args.html)
def read_logs(tmp_dir):
"""Reads log files.
Delegates to generator function get_log_events() to provide individual log events
for each of the input log files."""
files = [("test", "%s/test_framework.log" % tmp_dir)]
for i in itertools.count():
logfile = "{}/node{}/regtest/debug.log".format(tmp_dir, i)
if not os.path.isfile(logfile):
break
files.append(("node%d" % i, logfile))
return heapq.merge(*[get_log_events(source, f) for source, f in files])
def get_log_events(source, logfile):
"""Generator function that returns individual log events.
Log events may be split over multiple lines. We use the timestamp
regex match as the marker for a new log event."""
try:
with open(logfile, 'r') as infile:
event = ''
timestamp = ''
for line in infile:
# skip blank lines
if line == '\n':
continue
# if this line has a timestamp, it's the start of a new log event.
time_match = TIMESTAMP_PATTERN.match(line)
if time_match:
if event:
yield LogEvent(timestamp=timestamp, source=source, event=event.rstrip())
event = line
timestamp = time_match.group()
# if it doesn't have a timestamp, it's a continuation line of the previous log.
else:
event += "\n" + line
# Flush the final event
yield LogEvent(timestamp=timestamp, source=source, event=event.rstrip())
except FileNotFoundError:
print("File %s could not be opened. Continuing without it." % logfile, file=sys.stderr)
def print_logs(log_events, color=False, html=False):
"""Renders the iterator of log events into text or html."""
if not html:
colors = defaultdict(lambda: '')
if color:
colors["test"] = "\033[0;36m" # CYAN
colors["node0"] = "\033[0;34m" # BLUE
colors["node1"] = "\033[0;32m" # GREEN
colors["node2"] = "\033[0;31m" # RED
colors["node3"] = "\033[0;33m" # YELLOW
colors["reset"] = "\033[0m" # Reset font color
for event in log_events:
print("{0} {1: <5} {2} {3}".format(colors[event.source.rstrip()], event.source, event.event, colors["reset"]))
else:
try:
import jinja2
except ImportError:
print("jinja2 not found. Try `pip install jinja2`")
sys.exit(1)
print(jinja2.Environment(loader=jinja2.FileSystemLoader('./'))
.get_template('combined_log_template.html')
.render(title="Combined Logs from testcase", log_events=[event._asdict() for event in log_events]))
if __name__ == '__main__':
main()
|
<?php
namespace spec\Samurai\Samurai\Task;
use Samurai\Samurai\Component\Spec\Context\PHPSpecContext;
class SampleTaskListSpec extends PHPSpecContext
{
public function it_is_initializable()
{
$this->shouldHaveType('Samurai\Samurai\Task\SampleTaskList');
}
public function it_is_usage_text_from_doc_comment()
{
$usage = <<<'EOL'
something do.
[usage]
$ ./app sample:some
[options]
--usage show help.
EOL;
$this->get('some')->getOption()->usage()->shouldBe($usage);
}
}
/**
* dummy sample task.
*/
namespace Samurai\Samurai\Task;
use Samurai\Samurai\Component\Task\TaskList;
class SampleTaskList extends TaskList
{
/**
* something do.
*
* [usage]
* $ ./app sample:some
*
* [options]
* --usage show help.
*
* @access public
*/
public function someTask()
{
}
}
|
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Language
* @version 4.x
* @author Sinan Eldem <sinan@sinaneldem.com.tr>
* @link http://sinaneldem.com.tr
*/
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| such as the size rules. Feel free to tweak each of these messages.
|
*/
"accepted" => ":attribute kabul edilmelidir.",
"active_url" => ":attribute geçerli bir URL olmalıdır.",
"after" => ":attribute şundan daha eski bir tarih olmalıdır :date.",
"alpha" => ":attribute sadece harflerden oluşmalıdır.",
"alpha_dash" => ":attribute sadece harfler, rakamlar ve tirelerden oluşmalıdır.",
"alpha_num" => ":attribute sadece harfler ve rakamlar içermelidir.",
"array" => ":attribute dizi olmalıdır.",
"before" => ":attribute şundan daha önceki bir tarih olmalıdır :date.",
"between" => array(
"numeric" => ":attribute :min - :max arasında olmalıdır.",
"file" => ":attribute :min - :max arasındaki kilobayt değeri olmalıdır.",
"string" => ":attribute :min - :max arasında karakterden oluşmalıdır.",
"array" => ":attribute :min - :max arasında nesneye sahip olmalıdır."
),
"captcha" => "Girilen güvenlik kodu geçersiz.",
"confirmed" => ":attribute tekrarı eşleşmiyor.",
"date" => ":attribute geçerli bir tarih olmalıdır.",
"date_format" => ":attribute :format biçimi ile eşleşmiyor.",
"different" => ":attribute ile :other birbirinden farklı olmalıdır.",
"digits" => ":attribute :digits rakam olmalıdır.",
"digits_between" => ":attribute :min ile :max arasında rakam olmalıdır.",
"email" => ":attribute biçimi geçersiz.",
"exists" => "Seçili :attribute geçersiz.",
"image" => ":attribute alanı resim dosyası olmalıdır.",
"in" => ":attribute değeri geçersiz.",
"integer" => ":attribute rakam olmalıdır.",
"ip" => ":attribute geçerli bir IP adresi olmalıdır.",
"max" => array(
"numeric" => ":attribute değeri :max değerinden küçük olmalıdır.",
"file" => ":attribute değeri :max kilobayt değerinden küçük olmalıdır.",
"string" => ":attribute değeri :max karakter değerinden küçük olmalıdır.",
"array" => ":attribute değeri :max adedinden az nesneye sahip olmalıdır."
),
"mimes" => ":attribute dosya biçimi :values olmalıdır.",
"min" => array(
"numeric" => ":attribute değeri :min değerinden büyük olmalıdır.",
"file" => ":attribute değeri :min kilobayt değerinden büyük olmalıdır.",
"string" => ":attribute değeri :min karakter değerinden büyük olmalıdır.",
"array" => ":attribute en az :min nesneye sahip olmalıdır."
),
"not_in" => "Seçili :attribute geçersiz.",
"numeric" => ":attribute rakam olmalıdır.",
"regex" => ":attribute biçimi geçersiz.",
"required" => ":attribute alanı gereklidir.",
"required_if" => ":attribute alanı, :other :value değerine sahip olduğunda zorunludur.",
"required_with" => ":attribute alanı :values varken zorunludur.",
"required_with_all" => ":attribute alanı :values varken zorunludur.",
"required_without" => ":attribute alanı :values yokken zorunludur.",
"required_without_all" => ":attribute alanı :values yokken zorunludur.",
"same" => ":attribute ile :other eşleşmelidir.",
"size" => array(
"numeric" => ":attribute :size olmalıdır.",
"file" => ":attribute :size kilobyte olmalıdır.",
"string" => ":attribute :size karakter olmalıdır.",
"array" => ":attribute :size nesneye sahip olmalıdır."
),
"unique" => ":attribute daha önceden kayıt edilmiş.",
"url" => ":attribute biçimi geçersiz.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => array(
'attribute-name' => array(
'rule-name' => 'custom-message',
),
),
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => array(),
);
|
// Shader Code
#include <windows.h>
#include <string>
#include <fstream>
#include <d3d9.h>
#include <d3dx9.h>
#include "../../math/Math.h"
#include "../../base/base.h"
#include "../../etc/Utility.h"
#include <vector>
#include <map>
#include <sstream>
#pragma comment( lib, "d3d9.lib" )
#pragma comment( lib, "d3dx9.lib" )
#pragma comment( lib, "winmm.lib" )
using namespace std;
using namespace graphic;
LPDIRECT3DDEVICE9 g_pDevice = NULL;
const int WINSIZE_X = 1024; //Ãʱâ À©µµ¿ì °¡·Î Å©±â
const int WINSIZE_Y = 768; //Ãʱâ À©µµ¿ì ¼¼·Î Å©±â
const int WINPOS_X = 0; //Ãʱâ À©µµ¿ì ½ÃÀÛ À§Ä¡ X
const int WINPOS_Y = 0; //Ãʱâ À©µµ¿ì ½ÃÀÛ À§Ä¡ Y
POINT g_CurPos;
bool g_LButtonDown = false;
bool g_RButtonDown = false;
Matrix44 g_LocalTm;
Vector3 g_camPos(0,100,-200);
Vector3 g_lookAtPos(0,0,0);
Matrix44 g_matProj;
Matrix44 g_matView;
graphic::cShader g_shader;
graphic::cSphere g_sphere;
graphic::cTexture g_texture;
LPDIRECT3DDEVICE9 graphic::GetDevice()
{
return g_pDevice;
}
// Äݹé ÇÁ·Î½ÃÁ® ÇÔ¼ö ÇÁ·ÎÅä ŸÀÔ
LRESULT CALLBACK WndProc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam );
bool InitVertexBuffer();
void Render(int timeDelta);
void UpdateCamera();
void GetRay(int sx, int sy, Vector3 &orig, Vector3 &dir);
bool IntersectTriangle( const D3DXVECTOR3& orig, const D3DXVECTOR3& dir,
D3DXVECTOR3& v0, D3DXVECTOR3& v1, D3DXVECTOR3& v2,
FLOAT* t, FLOAT* u, FLOAT* v );
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
wchar_t className[32] = L"Shader_Phong";
wchar_t windowName[32] = L"Shader_Phong";
//À©µµ¿ì Ŭ·¹½º Á¤º¸ »ý¼º
//³»°¡ ÀÌ·¯ÇÑ À©µµ¸¦ ¸¸µé°Ú´Ù ¶ó´Â Á¤º¸
WNDCLASS WndClass;
WndClass.cbClsExtra = 0; //À©µµ¿ì¿¡¼ »ç¿ëÇÏ´Â ¿©ºÐÀÇ ¸Þ¸ð¸®¼³Á¤( ±×³É 0 ÀÌ´Ù ½Å°æ¾²Áö¸»ÀÚ )
WndClass.cbWndExtra = 0; //À©µµ¿ì¿¡¼ »ç¿ëÇÏ´Â ¿©ºÐÀÇ ¸Þ¸ð¸®¼³Á¤( ±×³É 0 ÀÌ´Ù ½Å°æ¾²Áö¸»ÀÚ )
WndClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); //À©µµ¿ì ¹è°æ»ö»ó
WndClass.hCursor = LoadCursor( NULL, IDC_ARROW ); //À©µµ¿ìÀÇ Ä¿¼¸ð¾ç °áÁ¤
WndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); //À©µµ¿ì¾ÆÀÌÄܸð¾ç °áÁ¤
WndClass.hInstance = hInstance; //ÇÁ·Î±×·¥ÀνºÅϽºÇÚµé
WndClass.lpfnWndProc = (WNDPROC)WndProc; //À©µµ¿ì ÇÁ·Î½ÃÁ® ÇÔ¼ö Æ÷ÀÎÅÍ
WndClass.lpszMenuName = NULL; //¸Þ´ºÀ̸§ ¾øÀ¸¸é NULL
WndClass.lpszClassName = className; //Áö±Ý ÀÛ¼ºÇϰí ÀÖ´Â À©µµ¿ì Ŭ·¹½ºÀÇ À̸§
WndClass.style = CS_HREDRAW | CS_VREDRAW; //À©µµ¿ì ±×¸®±â ¹æ½Ä ¼³Á¤ ( »çÀÌÁî°¡ º¯°æµÉ¶§ ȸ鰻½Å CS_HREDRAW | CS_VREDRAW )
//À§¿¡¼ ÀÛ¼ºÇÑ À©µµ¿ì Ŭ·¹½ºÁ¤º¸ µî·Ï
RegisterClass( &WndClass );
//À©µµ¿ì »ý¼º
//»ý¼ºµÈ À©µµ¿ì ÇÚµéÀ» Àü¿ªº¯¼ö g_hWnd °¡ ¹Þ´Â´Ù.
HWND hWnd = CreateWindow(
className, //»ý¼ºµÇ´Â À©µµ¿ìÀÇ Å¬·¡½ºÀ̸§
windowName, //À©µµ¿ì ŸÀÌÆ²¹Ù¿¡ Ãâ·ÂµÇ´Â À̸§
WS_OVERLAPPEDWINDOW, //À©µµ¿ì ½ºÅ¸ÀÏ WS_OVERLAPPEDWINDOW
WINPOS_X, //À©µµ¿ì ½ÃÀÛ À§Ä¡ X
WINPOS_Y, //À©µµ¿ì ½ÃÀÛ À§Ä¡ Y
WINSIZE_X, //À©µµ¿ì °¡·Î Å©±â ( ÀÛ¾÷¿µ¿ªÀÇ Å©±â°¡ ¾Æ´Ô )
WINSIZE_Y, //À©µµ¿ì ¼¼·Î Å©±â ( ÀÛ¾÷¿µ¿ªÀÇ Å©±â°¡ ¾Æ´Ô )
GetDesktopWindow(), //ºÎ¸ð À©µµ¿ì ÇÚµé ( ÇÁ·Î±×·¥¿¡¼ ÃÖ»óÀ§ À©µµ¿ì¸é NULL ¶Ç´Â GetDesktopWindow() )
NULL, //¸Þ´º ID ( ÀÚ½ÅÀÇ ÄÁÆ®·Ñ °´Ã¼ÀÇ À©µµ¿ìÀΰæ¿ì ÄÁÆ®·Ñ ID °¡ µÈ
hInstance, //ÀÌ À©µµ¿ì°¡ ¹°¸± ÇÁ·Î±×·¥ ÀνºÅϽº ÇÚµé
NULL //Ãß°¡ Á¤º¸ NULL ( ½Å°æ²ôÀÚ )
);
//À©µµ¿ì¸¦ Á¤È®ÇÑ ÀÛ¾÷¿µ¿ª Å©±â·Î ¸ÂÃá´Ù
RECT rcClient = { 0, 0, WINSIZE_X, WINSIZE_Y };
AdjustWindowRect( &rcClient, WS_OVERLAPPEDWINDOW, FALSE ); //rcClient Å©±â¸¦ ÀÛ¾÷ ¿µ¿µÀ¸·Î ÇÒ À©µµ¿ì Å©±â¸¦ rcClient ¿¡ ´ëÀÔµÇ¾î ³ª¿Â´Ù.
//À©µµ¿ì Å©±â¿Í À©µµ¿ì À§Ä¡¸¦ ¹Ù²Ù¾îÁØ´Ù.
SetWindowPos( hWnd, NULL, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
SWP_NOZORDER | SWP_NOMOVE );
if (!graphic::InitDirectX(hWnd, WINSIZE_X, WINSIZE_Y, g_pDevice))
{
return 0;
}
InitVertexBuffer();
ShowWindow( hWnd, nCmdShow );
//¸Þ½ÃÁö ±¸Á¶Ã¼
MSG msg;
ZeroMemory( &msg, sizeof( MSG ) );
int oldT = GetTickCount();
while (msg.message != WM_QUIT)
{
//PeekMessage ´Â ¸Þ½ÃÁö Å¥¿¡ ¸Þ½ÃÁö°¡ ¾ø¾îµµ ÇÁ·Î±×·¥ÀÌ ¸ØÃ߱⠾ʰí ÁøÇàÀÌ µÈ´Ù.
//À̶§ ¸Þ½ÃÁöÅ¥¿¡ ¸Þ½ÃÁö°¡ ¾øÀ¸¸é false °¡ ¸®ÅÏµÇ°í ¸Þ½ÃÁö°¡ ÀÖÀ¸¸é true °¡ ¸®ÅÏÀ̵ȴÙ.
if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage( &msg ); //´¸° Űº¸µå ÀÇ ¹®ÀÚ¸¦ ¹ø¿ªÇÏ¿© WM_CHAR ¸Þ½ÃÁö¸¦ ¹ß»ý½ÃŲ´Ù.
DispatchMessage( &msg ); //¹Þ¾Æ¿Â ¸Þ½ÃÁö Á¤º¸·Î À©µµ¿ì ÇÁ·Î½ÃÁ® ÇÔ¼ö¸¦ ½ÇÇà½ÃŲ´Ù.
}
else
{
const int curT = timeGetTime();
const int elapseT = curT - oldT;
//if (elapseT > 15)
//{
oldT = curT;
Render(elapseT);
//}
}
}
if (g_pDevice)
g_pDevice->Release();
return 0;
}
//
// À©µµ¿ì ÇÁ·Î½ÃÁ® ÇÔ¼ö ( ¸Þ½ÃÁö Å¥¿¡¼ ¹Þ¾Æ¿Â ¸Þ½ÃÁö¸¦ ó¸®ÇÑ´Ù )
//
LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch (msg)
{
case WM_KEYDOWN:
if (wParam == VK_ESCAPE)
::DestroyWindow(hWnd);
else if (wParam == VK_TAB)
{
static bool flag = false;
g_pDevice->SetRenderState(D3DRS_CULLMODE, flag);
g_pDevice->SetRenderState(D3DRS_FILLMODE, flag? D3DFILL_SOLID : D3DFILL_WIREFRAME);
flag = !flag;
}
else if (wParam == VK_SPACE)
{
}
break;
case WM_LBUTTONDOWN:
{
g_LButtonDown = true;
g_CurPos.x = LOWORD(lParam);
g_CurPos.y = HIWORD(lParam);
}
break;
case WM_RBUTTONDOWN:
{
g_RButtonDown = true;
g_CurPos.x = LOWORD(lParam);
g_CurPos.y = HIWORD(lParam);
}
break;
case WM_LBUTTONUP:
g_LButtonDown = false;
break;
case WM_RBUTTONUP:
g_RButtonDown = false;
break;
case WM_MOUSEMOVE:
if (g_LButtonDown)
{
POINT pos;
pos.x = LOWORD(lParam);
pos.y = HIWORD(lParam);
const int x = pos.x - g_CurPos.x;
const int y = pos.y - g_CurPos.y;
g_CurPos = pos;
Matrix44 mat1;
mat1.SetRotationY( -x * 0.01f );
Matrix44 mat2;
mat2.SetRotationX( -y * 0.01f );
g_LocalTm *= (mat1 * mat2);
}
if (g_RButtonDown)
{
POINT pos;
pos.x = LOWORD(lParam);
pos.y = HIWORD(lParam);
const int x = pos.x - g_CurPos.x;
const int y = pos.y - g_CurPos.y;
g_CurPos = pos;
Matrix44 rx;
rx.SetRotationY( x * 0.005f );
Matrix44 ry;
ry.SetRotationX( y * 0.005f );
Matrix44 m = rx * ry;
g_camPos *= m;
UpdateCamera();
}
else
{
g_CurPos.x = LOWORD(lParam);
g_CurPos.y = HIWORD(lParam);
}
break;
case WM_MOUSEWHEEL:
{
const int fwKeys = GET_KEYSTATE_WPARAM(wParam);
const int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
Vector3 dir = g_lookAtPos - g_camPos;
dir.Normalize();
g_camPos += (zDelta < 0)? dir * -50 : dir*50;
UpdateCamera();
}
break;
case WM_DESTROY: //À©µµ¿ì°¡ ÆÄ±«µÈ´Ù¸é..
PostQuitMessage(0); //ÇÁ·Î±×·¥ Á¾·á ¿äû ( ¸Þ½ÃÁö ·çÇÁ¸¦ ºüÁ®³ª°¡°Ô µÈ´Ù )
break;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
//·£´õ
void Render(int timeDelta)
{
//ȸé û¼Ò
if (SUCCEEDED(g_pDevice->Clear(
0, //û¼ÒÇÒ ¿µ¿ªÀÇ D3DRECT ¹è¿ °¹¼ö ( Àüü Ŭ¸®¾î 0 )
NULL, //û¼ÒÇÒ ¿µ¿ªÀÇ D3DRECT ¹è¿ Æ÷ÀÎÅÍ ( Àüü Ŭ¸®¾î NULL )
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, //û¼ÒµÉ ¹öÆÛ Ç÷¹±× ( D3DCLEAR_TARGET Ä÷¯¹öÆÛ, D3DCLEAR_ZBUFFER ±íÀ̹öÆÛ, D3DCLEAR_STENCIL ½ºÅٽǹöÆÛ
D3DCOLOR_XRGB(150, 150, 150), //Ä÷¯¹öÆÛ¸¦ û¼ÒÇϰí ä¿öÁú »ö»ó( 0xAARRGGBB )
1.0f, //±íÀ̹öÆÛ¸¦ û¼ÒÇÒ°ª ( 0 ~ 1 0 ÀÌ Ä«¸Þ¶ó¿¡¼ Á¦Àϰ¡±î¿î 1 ÀÌ Ä«¸Þ¶ó¿¡¼ Á¦ÀÏ ¸Õ )
0 //½ºÅÙ½Ç ¹öÆÛ¸¦ ä¿ï°ª
)))
{
//ȸé û¼Ò°¡ ¼º°øÀûÀ¸·Î ÀÌ·ç¾î Á³´Ù¸é... ·£´õ¸µ ½ÃÀÛ
g_pDevice->BeginScene();
RenderFPS(timeDelta);
RenderAxis();
Matrix44 matS;
matS.SetScale(Vector3(1,2,1));
Matrix44 tm = matS * g_LocalTm;
g_shader.SetVector("vLightDir", Vector3(0,-1,0));
g_shader.SetMatrix("mWVP", tm * g_matView * g_matProj);
g_shader.SetVector("vEyePos", g_camPos);
Matrix44 mWIT = tm.Inverse();
mWIT.Transpose();
g_shader.SetMatrix("mWIT", mWIT);
g_shader.Begin();
g_shader.BeginPass(0);
g_texture.Bind(0);
g_sphere.Render(tm);
g_shader.EndPass();
g_shader.End();
//·£´õ¸µ ³¡
g_pDevice->EndScene();
//·£´õ¸µÀÌ ³¡³µÀ¸¸é ·£´õ¸µµÈ ³»¿ë ȸéÀ¸·Î Àü¼Û
g_pDevice->Present( NULL, NULL, NULL, NULL );
}
}
bool InitVertexBuffer()
{
g_shader.Create("hlsl_box_normal_phong_tex.fx", "TShader" );
g_texture.Create("../../media/°¼Ò¶ó.jpg");
g_sphere.Create(30, 20, 20);
// Ä«¸Þ¶ó, Åõ¿µÇà·Ä »ý¼º
UpdateCamera();
g_matProj.SetProjection(D3DX_PI * 0.5f, (float)WINSIZE_X / (float) WINSIZE_Y, 1.f, 10000.0f) ;
g_pDevice->SetTransform(D3DTS_PROJECTION, (D3DXMATRIX*)&g_matProj) ;
g_pDevice->SetRenderState(D3DRS_LIGHTING, false);
return true;
}
void UpdateCamera()
{
Vector3 dir = g_lookAtPos - g_camPos;
dir.Normalize();
g_matView.SetView(g_camPos, dir, Vector3(0,1,0));
graphic::GetDevice()->SetTransform(D3DTS_VIEW, (D3DXMATRIX*)&g_matView);
}
|
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.."
cd ${DIR}
virtualenv -p python3 --prompt="<env>" ${DIR}/env
mkdir ${DIR}/configs
mkdir ${DIR}/db
mkdir ${DIR}/logs
mkdir ${DIR}/pids
touch ${DIR}/db/database.sqlite3
${DIR}/commands/deploy.sh
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Wed Dec 06 15:25:24 MST 2017 -->
<title>SaveLoadController</title>
<meta name="date" content="2017-12-06">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SaveLoadController";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/example/cmput301f17t27/nume/various/Permissions.html" title="class in com.example.cmput301f17t27.nume.various"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/example/cmput301f17t27/nume/various/SaveLoadController.html" target="_top">Frames</a></li>
<li><a href="SaveLoadController.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.example.cmput301f17t27.nume.various</div>
<h2 title="Class SaveLoadController" class="title">Class SaveLoadController</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.example.cmput301f17t27.nume.various.SaveLoadController</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">SaveLoadController</span>
extends java.lang.Object</pre>
<div class="block">This is a static class that provides a toolbox for saving
locally and to ElasticSearch. (This holds all the
ElasticSearch code)</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#SaveLoadController--">SaveLoadController</a></span>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#addProfile-android.content.Context-com.example.cmput301f17t27.nume.account.Profile-">addProfile</a></span>(android.content.Context context,
<a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> profile)</code>
<div class="block">This function loads a user's profile.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#deleteLocalProfile-android.content.Context-">deleteLocalProfile</a></span>(android.content.Context context)</code>
<div class="block">Deletes the profile saved locally.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#getProfile-java.lang.String-">getProfile</a></span>(java.lang.String uName)</code>
<div class="block">Get a profile from ElasticSearch only.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#loadProfile-android.content.Context-java.lang.String-">loadProfile</a></span>(android.content.Context context,
java.lang.String userName)</code>
<div class="block">This function loads a user's profile.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#saveProfile-android.content.Context-com.example.cmput301f17t27.nume.account.Profile-">saveProfile</a></span>(android.content.Context context,
<a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> profile)</code>
<div class="block">This function saves the user's profile locally and
to ElasticSearch.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/example/cmput301f17t27/nume/various/SaveLoadController.html#updateProfile-com.example.cmput301f17t27.nume.account.Profile-">updateProfile</a></span>(<a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> profile)</code>
<div class="block">Updates a profile on ElasticSearch only.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="SaveLoadController--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SaveLoadController</h4>
<pre>public SaveLoadController()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="addProfile-android.content.Context-com.example.cmput301f17t27.nume.account.Profile-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addProfile</h4>
<pre>public static boolean addProfile(android.content.Context context,
<a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> profile)</pre>
<div class="block">This function loads a user's profile. First it tries
locally and if that doesn't work, it tries from
ElasticSearch.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - Context from which this is called from</dd>
<dd><code>profile</code> - The profile to add</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>boolean False if the profile wasn't added, true if it was</dd>
</dl>
</li>
</ul>
<a name="loadProfile-android.content.Context-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadProfile</h4>
<pre>public static <a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> loadProfile(android.content.Context context,
java.lang.String userName)</pre>
<div class="block">This function loads a user's profile. First it tries
locally and if that doesn't work, it tries from
ElasticSearch.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - Context from which this is called from</dd>
<dd><code>userName</code> - The username of the profile to load</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Profile that was loaded</dd>
</dl>
</li>
</ul>
<a name="saveProfile-android.content.Context-com.example.cmput301f17t27.nume.account.Profile-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>saveProfile</h4>
<pre>public static void saveProfile(android.content.Context context,
<a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> profile)</pre>
<div class="block">This function saves the user's profile locally and
to ElasticSearch. (If available)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - Context from which this is called from</dd>
<dd><code>profile</code> - Profile to save</dd>
</dl>
</li>
</ul>
<a name="deleteLocalProfile-android.content.Context-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>deleteLocalProfile</h4>
<pre>public static void deleteLocalProfile(android.content.Context context)</pre>
<div class="block">Deletes the profile saved locally.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - Context where the deletion is requested</dd>
</dl>
</li>
</ul>
<a name="getProfile-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProfile</h4>
<pre>public static <a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> getProfile(java.lang.String uName)</pre>
<div class="block">Get a profile from ElasticSearch only. Doesn't check the local
cache</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>uName</code> - Username of the profile to get</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The profile object that has that username. Null if no
profile was found</dd>
</dl>
</li>
</ul>
<a name="updateProfile-com.example.cmput301f17t27.nume.account.Profile-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>updateProfile</h4>
<pre>public static void updateProfile(<a href="../../../../../com/example/cmput301f17t27/nume/account/Profile.html" title="class in com.example.cmput301f17t27.nume.account">Profile</a> profile)</pre>
<div class="block">Updates a profile on ElasticSearch only. Doesn't update
the local one</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>profile</code> - Profile to replace the old one</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/example/cmput301f17t27/nume/various/Permissions.html" title="class in com.example.cmput301f17t27.nume.various"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/example/cmput301f17t27/nume/various/SaveLoadController.html" target="_top">Frames</a></li>
<li><a href="SaveLoadController.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
package com.spike.giantdataanalysis.model.logic.relational.interpreter.core;
import com.spike.giantdataanalysis.model.logic.relational.core.Literal;
/** 解释器枚举标记接口. */
public interface RelationalInterpreterEnum extends Literal {
} |
require "zeamays/version"
require "zeamays/cob"
require "zeamays/fridge"
module Zeamays
end
|
Server: Netscape-Communications/1.1
Date: Wednesday, 20-Nov-96 23:24:28 GMT
Last-modified: Monday, 24-Jun-96 14:59:21 GMT
Content-length: 5156
Content-type: text/html
<HTML>
<HEAD>
<TITLE>CIS 510 Handout 1</TITLE>
<BODY><! BODY BGCOLOR = "#000000" TEXT = "#FFFFFF">
<BODY bgcolor="#FFEFDB"> <! AntiqueWhite1>
<H1><CENTER>CIS 510, Spring 96 </CENTER> <P>
<center>
COMPUTER AIDED GEOMETRIC DESIGN
</CENTER>
<CENTER>Course Information</CENTER>
<CENTER>January 9</CENTER></H1>
<P>
<H4>
<H2>Coordinates:</H2> Moore 224, MW 12-1:30
<P>
<H2>Instructor:</H2> <!WA0><A HREF="mailto:jean@saul.cis.upenn.edu">Jean H.
Gallier</A>, MRE 176, 8-4405, jean@saul <P>
<H2>Office Hours:</H2> 2:00-3:00 Tuesday, Thursday, 2:00-3:00, Friday
<P>
<H2>Teaching Assistant:</H2>
TBA <p>
<H2>Office Hours:</H2> TBA<P>
<h2> Prerequesites:</h2>
Basic knowledge of linear algebra, calculus,
and elementary geometry
<br>
(CIS560 NOT required).
<H2>Textbooks (not required):</H2> <I>Computer Aided Geometric Design </I>
Hoschek, J. and Lasser, D., AK Peters, 1993<br>
<BR>Also recommended:<BR>
<BR><I>Curves and Surfaces for Computer Aided Geometric Design</I>,
D. Wood, Wiley<br>
<P>
<H2>Grades:</H2>
<P>
Problem Sets (3 or 4 of them) and a project
<ul>
<li><!WA1><a
href="http://www.cis.upenn.edu/~jean/geom96hm1.dvi.Z"> Homework1 </a>
<li><!WA2><a
href="http://www.cis.upenn.edu/~jean/geom96hm2.dvi.Z"> Homework2 </a>
<li><!WA3><a
href="http://www.cis.upenn.edu/~jean/geom96hm3.dvi.Z"> Homework3 </a>
</ul>
<P>
<H2>Brief description:</H2>
A more appropriate name for the course would be
<h2><center>
Curves and Surfaces for Computer Aided Geometric Design</center></h2>
or perhaps
<h2><center>
Mathematical Foundations of Computer Graphics</center></h2>
(as CS348a is called at Stanford University).
The course should be of interest to anyone who likes
geometry (with an algebraic twist)!<p>
Basically, the course will be about mathematical techniques
used for geometric design in computer graphics
(but also in robotics, vision, and computational geometry).
Such techniques are used in 2D and 3D drawing and plot, object silhouettes,
animating positions, product design (cars, planes, buildings),
topographic data, medical imagery, active surfaces of proteins,
attribute maps (color, texture, roughness), weather data, art(!), ... .
Three broad classes of problems will be considered: <p>
<ul>
<li> <em> Approximating</em> curved shapes, using smooth curves or surfaces.
<li> <em> Interpolating</em> curved shapes, using smooth curves or surfaces.
<li> <em> Rendering</em> smooth curves or surfaces. <p>
</ul> <p>
Specific topics include: basic geometric material
on affine spaces and affine maps.
Be'zier curves will be introduced ``gently'', in terms of
multiaffine symmetric polar forms, also known as ``blossoms''.
We will begin with degree 2, move up to degree 3,
giving lots of examples, and derive the fundamental
``de Casteljau algorithm'', and show where the Bernstein
polynomials come from.
Then, we will consider polynomial curves
of arbitrary degree. It will be shown how a construction
embedding an affine space into a vector space, where points
and vectors can be treated uniformly, together with polar forms,
yield a very elegant and effective treatment of tangents and
osculating flats. The conditions for joining polynomial curves
will be derived using polar forms, and this will lead to
a treatment of B-splines in terms of polar forms. In particular,
the de Boor algorithm will be derived as a natural extension of
the de Casteljau algorithm.
Rectangular (tensor product) Be'zier surfaces, and triangular
Be'zier surfaces will also be introduced using polar forms,
and the de Casteljau algorithm will be derived.
Subdivision algorithms and their application to
rendering will be discussed extensively.
Joining conditions will be derived
using polar forms. <p>
Using the embedding
of an affine space into a vector space, we will contruct the
projective completion of an affine space, and show how
rational curves can be dealt with as central projections
of polynomial curves, with appropriate generalizations
of the de Casteljau algorithm. <p>
Rational surfaces will be obtained as central projections
of polynomial surfaces.
If time permits, NURBS and
geometric continuity will be discussed.
This will require a little bit of
differential geometry. <p>
A class-room treatment of curves and surfaces in terms of polar forms
is rather new (although
used at Stanford by Leo Guibas and Lyle Ramshaw), but should be
illuminating and exciting.
Since books (even recent) do not follow such an approach,
I have written extensive course notes, which will be available. <p>
I will mix assignments not involving programming, and
small programming projects.
There are plenty of opportunities for trying out
the algorithms presented in the course. In particular,
it is fairly easy to program many of these algorithms in Mathematica
(I have done so, and I'm not such a great programmer!). <p>
At the end of the course, you will know how to write your <em> own </em>
algorithms to display the half Klein bottle shown below.<p>
<!WA4><a href="http://www.cis.upenn.edu/~jean/klein5.ps.Z"> Half Klein bottle</a><p>
<P>
</UL>
<P>
<I>published by:
<H2><!WA5><A HREF="mailto:jean@saul.cis.upenn.edu">Jean Gallier</A></H2>
</H4>
<BODY>
<HTML>
|
#!/usr/bin/perl -w
use strict;
#### DEBUG
my $DEBUG = 0;
#$DEBUG = 1;
=head2
NAME dumpDb
PURPOSE
DUMP ALL THE TABLES IN A DATABASE TO .TSV FILES
INPUT
1. DATABASE NAME
2. LOCATION TO PRINT .TSV FILES
OUTPUT
1. ONE .TSV FILE FOR EACH TABLE IN DATABASE
USAGE
./dumpDb.pl <--db String> <--outputdir String> [-h]
--db : Name of database
--outputdir : Location of output directory
--help : print this help message
< option > denotes REQUIRED argument
[ option ] denotes OPTIONAL argument
EXAMPLE
perl dumpDb.pl --db agua --outputdir /agua/0.6/bin/sql/dump
=cut
#### TIME
my $time = time();
#### USE LIBS
use FindBin qw($Bin);
use lib "$Bin/../../lib";
#### INTERNAL MODULES
use Agua::Configure;
use Agua::DBaseFactory;
use Timer;
use Util;
use Conf::Agua;
#### EXTERNAL MODULES
use Data::Dumper;
use File::Path;
use File::Copy;
use Getopt::Long;
#### GET OPTIONS
my $db;
my $dumpfile;
my $outputdir;
my $help;
GetOptions (
'db=s' => \$db,
'dumpfile=s' => \$dumpfile,
'outputdir=s' => \$outputdir,
'help' => \$help) or die "No options specified. Try '--help'\n";
if ( defined $help ) { usage(); }
#### FLUSH BUFFER
$| =1;
#### CHECK INPUTS
die "Database not defined (option --db)\n" if not defined $db;
die "Output directory not defined (option --outputdir)\n" if not defined $outputdir;
die "File with same name as output directory already exists: $outputdir\n" if -f $outputdir;
#### CREATE OUTPUT DIRECTORY
File::Path::mkpath($outputdir) if not -d $outputdir;
die "Can't create output directory: $outputdir\n" if not -d $outputdir;
#### SET LOG
my $logfile = "/tmp/dumpdb.log";
my $SHOWLOG = 2;
my $PRINTLOG = 5;
#### GET CONF
my $configfile = "$Bin/../../conf/default.conf";
my $conf = Conf::Agua->new({
inputfile => $configfile,
logfile => $logfile,
SHOWLOG => 2,
PRINTLOG => 5
});
#### GET DATABASE INFO
my $dbtype = $conf->getKey("database", 'DBTYPE');
my $database = $conf->getKey("database", 'DATABASE');
my $user = $conf->getKey("database", 'USER');
my $password = $conf->getKey("database", 'PASSWORD');
print "dumpDb.pl dbtype: $dbtype\n" if $DEBUG;
print "dumpDb.pl user: $user\n" if $DEBUG;
print "dumpDb.pl password: $password\n" if $DEBUG;
print "dumpDb.pl database: $database\n" if $DEBUG;
#### CREATE OUTPUT DIRECTORY
File::Path::mkpath($outputdir) if not -d $outputdir;
die "Can't create output directory: $outputdir\n" if not -d $outputdir;
my $object = Agua::Configure->new({
conf => $conf,
database => $db,
configfile => $configfile,
logfile => $logfile,
SHOWLOG => $SHOWLOG,
PRINTLOG => $PRINTLOG
});
$object->setDbh();
my $dbobject = $object->dbobject();
my $timestamp = $object->_getTimestamp($database, $user, $password);
$dumpfile = "$outputdir/$db.$timestamp.dump" if not defined $dumpfile;
$object->_dumpDb($database, $user, $password, $dumpfile);
print "dumpfile:\n\n$dumpfile\n\n";
#### PRINT RUN TIME
my $runtime = Timer::runtime( $time, time() );
print "\n";
print "dumpDb.pl Run time: $runtime\n";
print "dumpDb.pl Completed $0\n";
print Util::datetime(), "\n";
print "dumpDb.pl ****************************************\n\n\n";
exit;
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# SUBROUTINES
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sub usage
{
print `perldoc $0`;
exit;
}
|
<!DOCTYPE html>
<html ng-app="interval trainer">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<!--styles-->
</head>
<body>
<div ui-view></div>
<!--scripts-->
</body>
</html>
|
<?php
namespace Grav\Plugin;
use Grav\Common\Iterator;
use Grav\Common\Grav;
use Grav\Common\Page\Page;
class Tumblr extends Iterator {
protected $grav;
protected $page;
public $client;
public function __construct(Grav $grav, $page) {
require_once __DIR__ . '/../vendor/autoload.php';
$consumerKey = $page->header()->tumblr['settings']['consumerKey'];
$consumerSecret = $page->header()->tumblr['settings']['consumerSecret'];
$this->client = new \Tumblr\API\Client($consumerKey, $consumerSecret);
}
}
|
package synapse
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// SQLPoolRecommendedSensitivityLabelsClient is the azure Synapse Analytics Management Client
type SQLPoolRecommendedSensitivityLabelsClient struct {
BaseClient
}
// NewSQLPoolRecommendedSensitivityLabelsClient creates an instance of the SQLPoolRecommendedSensitivityLabelsClient
// client.
func NewSQLPoolRecommendedSensitivityLabelsClient(subscriptionID string) SQLPoolRecommendedSensitivityLabelsClient {
return NewSQLPoolRecommendedSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewSQLPoolRecommendedSensitivityLabelsClientWithBaseURI creates an instance of the
// SQLPoolRecommendedSensitivityLabelsClient client using a custom endpoint. Use this when interacting with an Azure
// cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewSQLPoolRecommendedSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolRecommendedSensitivityLabelsClient {
return SQLPoolRecommendedSensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Update update recommended sensitivity labels states of a given SQL Pool using an operations batch.
// Parameters:
// resourceGroupName - the name of the resource group. The name is case insensitive.
// workspaceName - the name of the workspace
// SQLPoolName - SQL pool name
func (client SQLPoolRecommendedSensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRecommendedSensitivityLabelsClient.Update")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: client.SubscriptionID,
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", err.Error())
}
req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", resp, "Failure responding to request")
return
}
return
}
// UpdatePreparer prepares the Update request.
func (client SQLPoolRecommendedSensitivityLabelsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters RecommendedSensitivityLabelUpdateList) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"sqlPoolName": autorest.Encode("path", SQLPoolName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"workspaceName": autorest.Encode("path", workspaceName),
}
const APIVersion = "2020-12-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client SQLPoolRecommendedSensitivityLabelsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client SQLPoolRecommendedSensitivityLabelsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
|
<?php
namespace Protobuf;
use InvalidArgumentException;
use ArrayObject;
/**
* Protobuf Stream collection
*
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
*/
class StreamCollection extends ArrayObject implements Collection
{
/**
* @param array<\Protobuf\Stream> $values
*/
public function __construct(array $values = [])
{
array_walk($values, [$this, 'add']);
}
/**
* Adds a \Protobuf\Stream to this collection
*
* @param \Protobuf\Stream $stream
*/
public function add(Stream $stream)
{
parent::offsetSet(null, $stream);
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value)
{
if ( ! $value instanceof Stream) {
throw new InvalidArgumentException(sprintf(
'Argument 2 passed to %s must be a \Protobuf\Stream, %s given',
__METHOD__,
is_object($value) ? get_class($value) : gettype($value)
));
}
parent::offsetSet($offset, $value);
}
}
|
/**
* MIT License
*
* Copyright (c) 2017 zgqq
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package mah.plugin.support.orgnote.source;
import mah.plugin.support.orgnote.entity.NodeEntity;
import java.util.List;
/**
* Created by zgq on 10/1/16.
*/
public interface Sort {
NodeEntity getNextReviewNote(List<NodeEntity> nodeEntityList);
}
|
# DataLakeStore
> see https://aka.ms/autorest
This is the AutoRest configuration file for DataLakeStore.
---
## Getting Started
To build the SDK for DataLakeStore, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:
> `autorest`
To see additional help and options, run:
> `autorest --help`
---
## Configuration
### Basic Information
These are the global settings for the DataLakeStore API.
``` yaml
openapi-type: arm
tag: package-2016-11
```
### Tag: package-2016-11
These settings apply only when `--tag=package-2016-11` is specified on the command line.
``` yaml $(tag) == 'package-2016-11'
input-file:
- Microsoft.DataLakeStore/stable/2016-11-01/account.json
```
### Tag: package-2015-10-preview
These settings apply only when `--tag=package-2015-10-preview` is specified on the command line.
``` yaml $(tag) == 'package-2015-10-preview'
title: DataLakeStoreAccountManagementClient
description: DataLake Store Client
input-file:
- Microsoft.DataLakeStore/preview/2015-10-01-preview/account.json
```
## Suppression
``` yaml
directive:
- suppress: TrackedResourceGetOperation
reason: This is by design in that we return DataLakeStoreAccountBasic only for Account_List
#where:
# - $.definitions.DataLakeStoreAccountBasic
- suppress: TrackedResourcePatchOperation
reason: DataLakeStoreAccountBasic is not independent and its purpose is for Account_List only. PATCH is for DataLakeStoreAccount, which will effectively update DataLakeStoreAccountBasic
#where:
# - $.definitions.DataLakeStoreAccountBasic
```
---
# Code Generation
## Swagger to SDK
This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.
``` yaml $(swagger-to-sdk)
swagger-to-sdk:
- repo: azure-sdk-for-net
- repo: azure-sdk-for-python-track2
- repo: azure-sdk-for-java
- repo: azure-sdk-for-go
- repo: azure-sdk-for-go-track2
- repo: azure-sdk-for-node
- repo: azure-sdk-for-ruby
after_scripts:
- bundle install && rake arm:regen_all_profiles['azure_mgmt_datalake_store']
- repo: azure-resource-manager-schemas
```
## C#
These settings apply only when `--csharp` is specified on the command line.
Please also specify `--csharp-sdks-folder=<path to "SDKs" directory of your azure-sdk-for-net clone>`.
``` yaml $(csharp)
csharp:
azure-arm: true
license-header: MICROSOFT_MIT_NO_VERSION
namespace: Microsoft.Azure.Management.DataLake.Store
output-folder: $(csharp-sdks-folder)/datalake-store/Microsoft.Azure.Management.DataLake.Store/src/Generated
clear-output-folder: true
```
## Python
See configuration in [readme.python.md](./readme.python.md)
## Go
See configuration in [readme.go.md](./readme.go.md)
## Java
These settings apply only when `--java` is specified on the command line.
Please also specify `--azure-libraries-for-java-folder=<path to the root directory of your azure-libraries-for-java clone>`.
``` yaml $(java)
azure-arm: true
fluent: true
namespace: com.microsoft.azure.management.datalake.store
license-header: MICROSOFT_MIT_NO_CODEGEN
output-folder: $(azure-libraries-for-java-folder)/azure-mgmt-datalake/store
```
### Java multi-api
``` yaml $(java) && $(multiapi)
batch:
- tag: package-2015-10-preview
- tag: package-2016-11
```
### Tag: package-2015-10-preview and java
These settings apply only when `--tag=package-2015-10-preview --java` is specified on the command line.
Please also specify `--azure-libraries-for-java=<path to the root directory of your azure-sdk-for-java clone>`.
``` yaml $(tag) == 'package-2015-10-preview' && $(java) && $(multiapi)
java:
namespace: com.microsoft.azure.management.datalakestore.v2015_10_01_preview
output-folder: $(azure-libraries-for-java-folder)/sdk/datalakestore/mgmt-v2015_10_01_preview
regenerate-manager: true
generate-interface: true
```
### Tag: package-2016-11 and java
These settings apply only when `--tag=package-2016-11 --java` is specified on the command line.
Please also specify `--azure-libraries-for-java=<path to the root directory of your azure-sdk-for-java clone>`.
``` yaml $(tag) == 'package-2016-11' && $(java) && $(multiapi)
java:
namespace: com.microsoft.azure.management.datalakestore.v2016_11_01
output-folder: $(azure-libraries-for-java-folder)/sdk/datalakestore/mgmt-v2016_11_01
regenerate-manager: true
generate-interface: true
```
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("a")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("a")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("52afcb95-1cb6-419f-9770-fb3a8f6395e8")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
---
layout: post
date: 2017-07-09
title: "Yolan Cris YolanCris 871-wedding-dress-silvia 2015 Sleeveless Ankle-Length Aline/Princess"
category: Yolan Cris
tags: [Yolan Cris,Aline/Princess ,Illusion,Ankle-Length,Sleeveless,2015]
---
### Yolan Cris YolanCris 871-wedding-dress-silvia
Just **$349.99**
### 2015 Sleeveless Ankle-Length Aline/Princess
<table><tr><td>BRANDS</td><td>Yolan Cris</td></tr><tr><td>Silhouette</td><td>Aline/Princess </td></tr><tr><td>Neckline</td><td>Illusion</td></tr><tr><td>Hemline/Train</td><td>Ankle-Length</td></tr><tr><td>Sleeve</td><td>Sleeveless</td></tr><tr><td>Years</td><td>2015</td></tr></table>
<a href="https://www.readybrides.com/en/yolan-cris/13920-yolancris-871-wedding-dress-silvia.html"><img src="//img.readybrides.com/31771/yolancris-871-wedding-dress-silvia.jpg" alt="YolanCris 871-wedding-dress-silvia" style="width:100%;" /></a>
<!-- break -->
Buy it: [https://www.readybrides.com/en/yolan-cris/13920-yolancris-871-wedding-dress-silvia.html](https://www.readybrides.com/en/yolan-cris/13920-yolancris-871-wedding-dress-silvia.html)
|
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
namespace Ixy.Web.ViewModels.ManageViewModels
{
public class ManageLoginsViewModel
{
public IList<UserLoginInfo> CurrentLogins { get; set; }
public IList<AuthenticationDescription> OtherLogins { get; set; }
}
}
|
# Table of contents
* [About](README.md)
* [Getting started](gettingstarted.md)
* [CLI guide](cli.md)
* [Configurations](configuration/README.md)
* [Configurable Parameters](configuration/configurable-parameters.md)
## Showcase <a id="projects-using-hypergan"></a>
* [AI Explorer for Android](projects-using-hypergan/ai-explorer-for-android.md)
* [Youtube, Twitter, Discord +](projects-using-hypergan/youtube-twitter-discord-+.md)
## Examples <a id="examples-1"></a>
* [2D](examples-1/2d.md)
* [Text](examples-1/text.md)
* [Classification](examples-1/classification.md)
* [Colorizer](examples-1/colorizer.md)
* [Next Frame \(video\)](examples-1/next-frame-video.md)
## Tutorials
* [Training a GAN](tutorials/training.md)
* [Pygame inference](tutorials/pygame.md)
* [Creating an image dataset](tutorials/creating-an-image-dataset.md)
* [Searching for hyperparameters](tutorials/searching-for-hyperparameters.md)
## Components
* [GAN](components/gan/README.md)
* [Aligned GAN](components/gan/aligned-gan.md)
* [Aligned Interpolated GAN](components/gan/aligned-interpolated-gan.md)
* [Standard GAN](components/gan/standard-gan.md)
* [Generator](components/generator/README.md)
* [Configurable Generator](components/generator/configurable-generator.md)
* [DCGAN Generator](components/generator/dcgan-generator.md)
* [Resizable Generator](components/generator/resizable-generator.md)
* [Discriminator](components/discriminator/README.md)
* [DCGAN Discriminator](components/discriminator/dcgan-discriminator.md)
* [Configurable Discriminator](components/discriminator/configurable-discriminator.md)
* [Layers](components/layers/README.md)
* [add](components/layers/add.md)
* [cat](components/layers/cat.md)
* [channel_attention](components/layers/channel_attention.md)
* [ez_norm](components/layers/ez_norm.md)
* [layer](components/layers/layer.md)
* [mul](components/layers/mul.md)
* [multi_head_attention](components/layers/multi_head_attention.md)
* [operation](components/layers/operation.md)
* [pixel_shuffle](components/layers/pixel_shuffle.md)
* [residual](components/layers/residual.md)
* [resizable_stack](components/layers/resizable_stack.md)
* [segment_softmax](components/layers/segment_softmax.md)
* [upsample](components/layers/upsample.md)
* [Loss](components/loss/README.md)
* [ALI Loss](components/loss/ali-loss.md)
* [F Divergence Loss](components/loss/f-divergence-loss.md)
* [Least Squares Loss](components/loss/least-squares-loss.md)
* [Logistic Loss](components/loss/logistic-loss.md)
* [QP Loss](components/loss/qp-loss.md)
* [RAGAN Loss](components/loss/ragan-loss.md)
* [Realness Loss](components/loss/realness-loss.md)
* [Softmax Loss](components/loss/softmax-loss.md)
* [Standard Loss](components/loss/standard-loss.md)
* [Wasserstein Loss](components/loss/wasserstein-loss.md)
* [Latent](components/latent/README.md)
* [Uniform Distribution](components/latent/uniform-distribution.md)
* [Trainer](components/trainer/README.md)
* [Alternating Trainer](components/trainer/alternating-trainer.md)
* [Simultaneous Trainer](components/trainer/simultaneous-trainer.md)
* [Balanced Trainer](components/trainer/balanced-trainer.md)
* [Accumulate Gradient Trainer](components/trainer/accumulate-gradient-trainer.md)
* [Optimizer](components/optimizer.md)
* [Train Hook](components/trainhook/README.md)
* [Adversarial Norm](components/trainhook/adversarial-norm.md)
* [Weight Constraint](components/trainhook/weight-constraint.md)
* [Stabilizing Training](components/trainhook/stabilizing-training.md)
* [JARE](components/trainhook/jare.md)
* [Learning Rate Dropout](components/trainhook/learning-rate-dropout.md)
* [Gradient Penalty](components/trainhook/gradient-penalty.md)
* [Rolling Memory](components/trainhook/rolling-memory.md)
* [Other GAN implementations](components/other-gan-implementations.md)
|
package com.quizmaster.components;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Question extends Component<Answer> {
private static final long serialVersionUID = 1L;
//The answers that are going to be displayed
private List<Answer> displayedAnswers;
//The chosen answers
private Set<Answer> pickedAnswers;
//Number of questions to be displayed
private int answers;
//Number of correct answers in the displayed answers
private int correctAnswers;
/*------------------------------------------------*/
/**
* Constructs a question object with the given parameters
* @param question The text to be displayed
* @param answers Number of questions to be displayed
* @param correctAnswers Number of correct answers in the displayed answers
*/
protected Question(String question, int answers, int correctAnswers) {
super(question);
this.answers = answers;
this.correctAnswers = correctAnswers;
this.displayedAnswers = new ArrayList<Answer>();
this.pickedAnswers = new HashSet<Answer>();
}
/**
* Constructs a question object with the given parameters
* @param question The text to be displayed
* @param nAnswers Number of questions to be displayed
* @param correctAnswers Number of correct answers in the displayed answers
* @param answers Initial answer pool
*/
public Question(String question, List<Answer> answers, int nAnswers, int correctAnswers) {
this(question, nAnswers, correctAnswers);
this.add(answers);
shuffle();
}
/**
* Resets the pickedAnswers and displayedAnswers. Reconstructs the displayedAnswers by picking random correct
* answers from the answers pool and completing it with wrong ones.
*/
public void shuffle() {
//Clear previous data
pickedAnswers.clear();
displayedAnswers.clear();
List<Answer> correct = new ArrayList<Answer>(), wrong = new ArrayList<Answer>();
List<Answer> answers = this.getComponents();
for(Answer answer : answers)
if(answer.isCorrect())
correct.add(answer);
else
wrong.add(answer);
//Shuffle lists
Collections.shuffle(correct);
Collections.shuffle(wrong);
//Add the corresponding number of correct answer to the displayed questions
int i;
for(i = 0; i < correctAnswers && correct.size() != 0; i++, correct.remove(0))
displayedAnswers.add(correct.get(0));
//Complete the rest with wrong answers
for(;i < this.answers && wrong.size() != 0; i++, wrong.remove(0))
displayedAnswers.add(wrong.get(0));
//Shuffle again
Collections.shuffle(displayedAnswers);
}
/**
* Adds the answer in the pickedAnswers unique sets if the answer is contained in the displayAnswers list
* and the maximum number of answers was not exceeded
* @param answer The chosen answer
* @return True if added to pickedAnswers set, false otherwise
*/
public boolean answer(Answer answer) {
if(!displayedAnswers.contains(answer) || pickedAnswers.size() >= answers)
return false;
return pickedAnswers.add(answer);
}
/**
* Removes an answer from the pickedAnswers set
* @param answer The chosen answer
* @return True if the answer was removed from the pickedAnswers set, false otherwise
*/
public boolean unanswer(Answer answer) {
return pickedAnswers.remove(answer);
}
/**
* @return The answers that are going to be displayed
*/
public List<Answer> getDisplayedAnswers() {
return displayedAnswers;
}
/**
* @return The chosen answers
*/
public Set<Answer> getPickedAnswers() {
return pickedAnswers;
}
/**
* Indicates if the correct number of questions has been chosen
* @return True if enough chosen, false otherwise
*/
public boolean isAnswered() {
return (pickedAnswers.size() == correctAnswers);
}
/**
* Indicates if the chosen answers are the correct ones or not
* @return True if the question was answered correctly, false otherwise
*/
public boolean isCorrect() {
if(!isAnswered())
return false;
for(Answer answer : pickedAnswers)
if(!answer.isCorrect())
return false;
return true;
}
public String toString() {
String result = getText() + "(" + correctAnswers + " answers)" + "\n";
char index = 'a';
for(Answer answer : displayedAnswers)
result += "\t" + index++ + ") " + answer + "\n";
return result;
}
}
|
import checkEmpty from '../helpers/checkEmpty';
const validateReview = {
validateFields(req, res, next) {
const { content } = req.body;
if (checkEmpty(content)) {
return res.status(400).json({
status: 'fail',
message: 'Review content field cannot be empty'
});
}
next();
}
};
export default validateReview;
|
---
layout: post
title: Hello World
lesson_num: 01
class_date: January 23, 2014
excerpt: "Welcome to DMD1070, Foundations of Web Design. This course is designed to guide you through the process of planning, designing, and implementing your first website. In this lesson we'll gain our bearings by understanding a bit about the history of the web and how the web works."
---
<p class="lead">Welcome to DMD1070, Foundations of Web Design. This course is designed to guide you through the process of planning, designing, and implementing your first website. In this lesson we'll gain our bearings by understanding a bit about the history of the web and how the web works.</p>
<!--more-->
<iframe src=//slid.es/ascott1/dmd1070-1/embed" width="576" height="420" scrolling="no" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
## Student information format
Please complete the [student information form](https://docs.google.com/forms/d/1RnPc6PyKJiNwur-mIyDv_SjUXyM3ZrtrQKbWbKrlrR4/viewform).
## How Does the Web Work?
The Web is built on a series of technologies for information transfer, plus some programming languages that you use to specify how you want that information to look. A simplified view follows:
- **The client:** This is your computer, which you use to access the Web
- **The server:** This is a computer in a room somewhere, which stores websites. When you access a website on your computer, a copy of the website data is sent from the server to your client machine for you to look at.
- **Your Internet connection:** Allows you to send and receive data on the Web. It's basically like a giant street that cars and people can travel down.
- **TCP/IP:** Defines how your data should travel down that road. This is like the cars and buses people use to get places.
- **HTTP:** Defines how and when data should be sent between the client and the server. This is like some people deciding what journeys they need to go on down the road, how far they need to travel, what mode of transport they need to use, etc.
- **DNS:** Domain Name Servers are like an address book for Websites. When you type in a web address in your browser, before the website is retrieved the browser goes to the DNS to find out where it lives, like when you look up someone's address so you can go and visit them. Without DNS nameservers, we would navigate to a page by IP address such as http://208.80.152.201 (that's Wikipedia's IP address).
- **HTML (CSS and JavaScript):** The main three programming languages that websites are built from.
- **Assets:** This is a collective noun for all the other stuff that makes up a website, such as image files, MP3s and videos, Word documents, PDFs, etc.
## Activity 1: The Wayback Machine
Choose a popular website and enter its URL into the [Wayback Machine](https://archive.org/web/). Browse through at least 5 dates of the site's history and note the following:
- How has the design of the site changed?
- How has the content of the site changed?
- What are some similarities between past and current versions of the site?
## Activity 2: Life Without the Web
What was life like before the web? Try to imagine (or recall) how you would accomplish these tasks without the web:
- Read the menu of a local restaurant
- Buy concert tickets
- Find the best driving route to Portland, Maine
- Book a trip to San Francisco
- Find out the score of a football game
- Check the balance of your bank account
- Find out if the dry cleaner is open
- Find the best price for a new pair of shoes
## Activity 3: A game of client/server
A game of client/server
Let's play a game! To play this we need:
- Some lego bricks (or some colored cards of some kind)
- One person to play a web server
- One person to play HTTP
- 2-3 people to play clients
- One person to play DNS
- and a decent number of people to play our website data.
First, a typical successful web request:
1. First the clients request a web page
2. The client web browsers look up the IP address of the website using the DNS
3. HTTP informs the server that the clients are requesting a website, with a message sent to the server. This is called an HTTP request.
4. There is no reason why the clients can't have this website, so the server responds with "200, OK". HTTP gives this response back to the client.
5. The website data is sent down the pipe to the clients. A copy is sent to each.
6. The clients assemble the data into a working website that it's users can interact with.
Now, an unsuccessful web request:
1. First the clients request a web page, but they've got the address slightly wrong.
2. The client web browsers look up the IP address they've been given using the DNS
3. The website cannot be found, so the HTTP response "404, NOT FOUND" is given back to the client.
When data is sent down the pipe, it is broken up into little tiny bits called packets. Each one of our data people really represents a single packet! If the data were not broken into packets before being sent to the client computers, it would be much harder to send around. It's the same principle as getting a wardrobe in through your front door, up your stairs and into your bedroom. This is a lot easier to do if you carry the wardrobe upstairs in pieces and then assemble it in the bedroom, rather than carrying it upstairs already assembled!
## Activity 4: View the Web Through X-Ray Goggles
Using Mozilla's [X-Ray Goggles](https://goggles.webmaker.org/) let's remix a web page.
1. [Together] Click the link above and follow the "See how Goggles work by swapping an image" instructions.
2. Install the X-Ray Goggles bookmarklet by dragging the "Activate X-Ray Goggles" link to your bookmarks bar.
3. Now let's remix the web! Choose a popular website and tweak it to achieve interesting, outlandish, or provoking results.
<a id="assignments"></a>
## Readings & Assignments
### Read Tim Berners-Lee's ["The World Wide Web: A very short personal history"](http://www.w3.org/People/Berners-Lee/ShortHistory.html)
Read the Web inventor's brief personal history. Do you think his vision of the web has held true?
## Lesson Credits
Some of the content and activities of this lesson were adapted from [Teach the Web](http://teachtheweb.com/course_materials/wordpress.php) and [It's My Web](http://people.mozilla.org/~cmills/st-chads/)
|
const m = require('mithril');
const Component = require('../../core/Component');
class ProjectBanner extends Component {
view(vnode) {
return m('.project', {
style: "background-image: url(" + vnode.attrs.bannerImage + ")",
onclick: function() {
m.route.set("/" + vnode.attrs.id)
}
}, [
m('.overlay', [
m('.text-container', [
m('span', [
m('h5', vnode.attrs.title),
m('i.fa.fa-info-circle')
]),
m('p', vnode.attrs.brief)
]),
])
])
}
}
module.exports = ProjectBanner;
|
---
layout: page
title: Higgins Chemical Executive Retreat
date: 2016-05-24
author: Andrew Weiss
tags: weekly links, java
status: published
summary: Nam blandit erat a enim molestie, id.
banner: images/banner/meeting-01.jpg
booking:
startDate: 09/10/2016
endDate: 09/11/2016
ctyhocn: MCOSMHX
groupCode: HCER
published: true
---
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean ligula est, pharetra at ipsum id, laoreet ullamcorper lorem. Pellentesque quis tellus eu ante bibendum mattis in non leo. Fusce lacus quam, tempus eu leo at, mollis placerat mi. Quisque mattis varius porta. Donec at nunc a ante scelerisque elementum in et nunc. Suspendisse potenti. Integer volutpat metus erat, ac semper dolor varius sit amet. Ut mattis quam arcu, vel auctor diam auctor et. Curabitur pulvinar nibh quis urna tempor varius. Morbi feugiat pulvinar finibus. In hac habitasse platea dictumst. Suspendisse eu dui imperdiet, cursus nunc ac, pharetra arcu. Duis non neque iaculis, malesuada libero non, sollicitudin mi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
* Duis id ante ut odio egestas vehicula
* Aliquam tincidunt dolor ut viverra laoreet
* Donec scelerisque quam in varius laoreet
* Praesent et nisl condimentum, suscipit eros quis, porta purus
* Quisque egestas purus non quam dignissim, in finibus massa ullamcorper.
Maecenas sed pretium lacus. Nam vel tortor non lacus laoreet tempus. Nulla congue, lorem at vestibulum finibus, nisl dui eleifend eros, ornare lacinia purus lorem ac erat. Pellentesque tempor purus est, ac blandit augue malesuada eget. Donec semper neque nec erat pretium, vitae eleifend felis convallis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed leo felis, rhoncus ac rutrum vitae, bibendum et arcu. Ut eu posuere nunc. Phasellus vitae mattis ligula. Praesent eu arcu ante. In dui lacus, luctus nec blandit non, condimentum a mi. Nam nunc enim, blandit eget nisl sed, porttitor posuere urna. Donec auctor, ligula volutpat malesuada hendrerit, purus sem ullamcorper purus, at tempus tellus augue vestibulum ex. Duis id nibh ut massa laoreet sodales eu eu augue. Phasellus et mi facilisis nunc porttitor congue.
Nullam in enim dictum neque blandit placerat sit amet vestibulum neque. Fusce nibh nulla, rhoncus sed malesuada condimentum, venenatis ornare justo. Vestibulum imperdiet odio sapien, quis lacinia justo porttitor id. Nulla luctus nibh ligula, vitae lobortis lacus pellentesque at. Pellentesque volutpat lacinia est eget laoreet. Mauris pulvinar lectus vitae nisi tempus, at aliquam purus molestie. Etiam eu finibus nunc, a faucibus ipsum. Vestibulum placerat, lacus nec lacinia elementum, neque odio rhoncus nibh, at vehicula magna dolor a lorem. Sed ac diam risus. Vestibulum feugiat viverra pulvinar. Aliquam erat volutpat. Sed et accumsan justo.
|
// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "splashscreen.h"
#include "clientversion.h"
#include "util.h"
#include <QPainter>
#undef loop /* ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
QSplashScreen(pixmap, f)
{
// set reference point, paddings
int paddingLeftCol2 = 230;
int paddingTopCol2 = 376;
int line1 = 0;
int line2 = 13;
int line3 = 26;
float fontFactor = 1.0;
// define text to place
QString titleText = QString(QApplication::applicationName()).replace(QString("-testnet"), QString(""), Qt::CaseSensitive); // cut of testnet, place it as single object further down
QString versionText = QString("Version %1 ").arg(QString::fromStdString(FormatFullVersion()));
QString copyrightText1 = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin developers"));
QString copyrightText2 = QChar(0xA9)+QString(" 2011-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The MBITBOOKS developers"));
QString font = "Arial";
// load the bitmap for writing some text over it
QPixmap newPixmap;
if(GetBoolArg("-testnet")) {
newPixmap = QPixmap(":/images/splash_testnet");
}
else {
newPixmap = QPixmap(":/images/splash");
}
QPainter pixPaint(&newPixmap);
pixPaint.setPen(QColor(70,70,70));
pixPaint.setFont(QFont(font, 9*fontFactor));
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line3,versionText);
// draw copyright stuff
pixPaint.setFont(QFont(font, 9*fontFactor));
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line1,copyrightText1);
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line2,copyrightText2);
pixPaint.end();
this->setPixmap(newPixmap);
}
|
ChopJS Unit Test
================
To run tests, start a server at the __root folder__ of ChopJS. |
/**
* Created by chenjianjun on 16/2/25.
*/
var env=require("../../config");
var type=env.Thinky.type;
/*
{
"success": true,
"message": null,
"data": [
{
"id": 227,
"recordVideoId": 9,
"createTime": "2016-01-21 17:31:09",
"updateTime": "2016-01-21 17:31:09",
"operater": 1,
"isUsed": 1,
"name": "做你的新娘",
"description": "",
"hitNum": 500,
"remark": "",
"videoUrl": "ftp://192.168.1.3/ftppub/CQ/uploadResource/video/20150923/48716448481998474070/1024X768.mp4\t",
"coverUrlWeb": "http://img.jsbn.com/followvideo/20160121/14533686688047965_1200x800.jpg",
"coverUrlWx": "http://img.jsbn.com/followvideo/20160121/14533686690550054_1200x800.jpg",
"coverUrlApp": "http://img.jsbn.com/followvideo/20160121/14533686689416315_1200x800.jpg",
"seasonId": 9,
"position": "record_video_list",
"weight": 9
}
],
"code": 200,
"count": 2
}
* */
// 婚纱摄影--纪实MV模型
const RecordVideo = env.Thinky.createModel('recordVideo', {
// 发布Id
id: type.number(),
// 纪实ID
recordVideoId: type.number(),
// 创建时间
createTime: type.string(),
// 修改时间
updateTime: type.string(),
// 操作员
operater: type.number(),
// 是否有效
isUsed: type.number(),
// 纪实MV名称
name: type.string(),
// 纪实MV描述
description: type.string(),
// 热度
hitNum: type.number(),
// 视频备注
remark: type.string(),
// 视频地址
videoUrl: type.string(),
// 网站封面图片地址
coverUrlWeb: type.string(),
// 微信封面图片地址
coverUrlWx: type.string(),
// APP封面图片地址
coverUrlApp: type.string(),
// 分季ID
seasonId: type.number(),
// 权重
weight: type.number()
})
RecordVideo.ensureIndex('weight');
module.exports=RecordVideo;
|
<?php
/*
* This file is part of the ddd-symfony package.
*
* (c) Beñat Espiña <benatespina@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Domain\Factory\User;
use Domain\Model\User\UserEmail;
use Domain\Model\User\UserId;
/**
* Interface UserFactory.
*
* @author Beñat Espiña <benatespina@gmail.com>
*/
interface UserFactory
{
/**
* Creation method that registers a new user into domain.
*
* @param \Domain\Model\User\UserId $anId The user id
* @param \Domain\Model\User\UserEmail $anEmail The user email address
* @param string $aPassword The password
*
* @return \Domain\Model\User\User
*/
public function register(UserId $anId, UserEmail $anEmail, $aPassword);
}
|
using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour {
void Start () {
}
void Update () {
transform.Rotate (1, 2, 3);
}
}
|
<style>
.buton {
border: 1px solid #d5bd98;
border-right-color: #935e0d;
border-bottom-color: #935e0d;
background: #ffa822 url(btn_bg_sprite.gif) left 17.5% repeat-x;
}
</style>
<input type="button" value="Tranzactie noua" onClick="window.location.href='new_t.php';" class="buton"><br><br>
<TABle border=1 <tr><th>ID</th><th>Data/Ora</th><th>Tip</th><th>Suma</th></tr>
<?php
include 'db.php';
$result=mysqli_query($db,"SELECT * FROM tranzactii");
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
if ($row["tip"]==1) $tip="Virament<br><b>".$row["cont_d"]." -> ".$row["cont_b"]."</b>";
else if ($row["tip"]==2) $tip="Depozit<br><b>".$row["cont_b"]."</b>";
else $tip="Extras<br><b>".$row["cont_d"]."</b>";
echo "<tr><td style='padding: 10px'><code>" . $row["id"]. "</td><td style='padding: 10px'><code>" . $row["data"]. "</code></td><td style='padding: 10px'><code>" . $tip. "</code></td><td style='padding: 10px'><code>" . $row["suma"]. " RON</td></tr>";
}
}
?>
</TABle> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Thu Nov 07 18:57:17 UTC 2013 -->
<title>R.dimen</title>
<meta name="date" content="2013-11-07">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="R.dimen";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/R.dimen.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../is/mpg/ruglan/R.attr.html" title="class in is.mpg.ruglan"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../is/mpg/ruglan/R.drawable.html" title="class in is.mpg.ruglan"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?is/mpg/ruglan/R.dimen.html" target="_top">Frames</a></li>
<li><a href="R.dimen.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#methods_inherited_from_class_java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">is.mpg.ruglan</div>
<h2 title="Class R.dimen" class="title">Class R.dimen</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>is.mpg.ruglan.R.dimen</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../../../is/mpg/ruglan/R.html" title="class in is.mpg.ruglan">R</a></dd>
</dl>
<hr>
<br>
<pre>public static final class <span class="strong">R.dimen</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../is/mpg/ruglan/R.dimen.html#activity_horizontal_margin">activity_horizontal_margin</a></strong></code>
<div class="block">Default screen margins, per the Android Design guidelines.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../is/mpg/ruglan/R.dimen.html#activity_vertical_margin">activity_vertical_margin</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../is/mpg/ruglan/R.dimen.html#R.dimen()">R.dimen</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="activity_horizontal_margin">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>activity_horizontal_margin</h4>
<pre>public static final int activity_horizontal_margin</pre>
<div class="block">Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#is.mpg.ruglan.R.dimen.activity_horizontal_margin">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="activity_vertical_margin">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>activity_vertical_margin</h4>
<pre>public static final int activity_vertical_margin</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#is.mpg.ruglan.R.dimen.activity_vertical_margin">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="R.dimen()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>R.dimen</h4>
<pre>public R.dimen()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/R.dimen.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../is/mpg/ruglan/R.attr.html" title="class in is.mpg.ruglan"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../is/mpg/ruglan/R.drawable.html" title="class in is.mpg.ruglan"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?is/mpg/ruglan/R.dimen.html" target="_top">Frames</a></li>
<li><a href="R.dimen.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#methods_inherited_from_class_java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./accessibilityHelp';
import * as dom from 'vs/base/browser/dom';
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
import { renderFormattedText } from 'vs/base/browser/formattedTextRenderer';
import { alert } from 'vs/base/browser/ui/aria/aria';
import { Widget } from 'vs/base/browser/ui/widget';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Disposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { EditorAction, EditorCommand, registerEditorAction, registerEditorCommand, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { Selection } from 'vs/editor/common/core/selection';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode';
import { IStandaloneEditorConstructionOptions } from 'vs/editor/standalone/browser/standaloneCodeEditor';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { contrastBorder, editorWidgetBackground, widgetShadow, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessibilityHelpWidgetVisible', false);
class AccessibilityHelpController extends Disposable
implements IEditorContribution {
public static readonly ID = 'editor.contrib.accessibilityHelpController';
public static get(editor: ICodeEditor): AccessibilityHelpController | null {
return editor.getContribution<AccessibilityHelpController>(
AccessibilityHelpController.ID
);
}
private readonly _editor: ICodeEditor;
private readonly _widget: AccessibilityHelpWidget;
constructor(
editor: ICodeEditor,
@IInstantiationService instantiationService: IInstantiationService
) {
super();
this._editor = editor;
this._widget = this._register(
instantiationService.createInstance(AccessibilityHelpWidget, this._editor)
);
}
public show(): void {
this._widget.show();
}
public hide(): void {
this._widget.hide();
}
}
function getSelectionLabel(selections: Selection[] | null, charactersSelected: number): string {
if (!selections || selections.length === 0) {
return AccessibilityHelpNLS.noSelection;
}
if (selections.length === 1) {
if (charactersSelected) {
return strings.format(AccessibilityHelpNLS.singleSelectionRange, selections[0].positionLineNumber, selections[0].positionColumn, charactersSelected);
}
return strings.format(AccessibilityHelpNLS.singleSelection, selections[0].positionLineNumber, selections[0].positionColumn);
}
if (charactersSelected) {
return strings.format(AccessibilityHelpNLS.multiSelectionRange, selections.length, charactersSelected);
}
if (selections.length > 0) {
return strings.format(AccessibilityHelpNLS.multiSelection, selections.length);
}
return '';
}
class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
private static readonly ID = 'editor.contrib.accessibilityHelpWidget';
private static readonly WIDTH = 500;
private static readonly HEIGHT = 300;
private readonly _editor: ICodeEditor;
private readonly _domNode: FastDomNode<HTMLElement>;
private readonly _contentDomNode: FastDomNode<HTMLElement>;
private _isVisible: boolean;
private readonly _isVisibleKey: IContextKey<boolean>;
constructor(
editor: ICodeEditor,
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
@IOpenerService private readonly _openerService: IOpenerService
) {
super();
this._editor = editor;
this._isVisibleKey = CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE.bindTo(
this._contextKeyService
);
this._domNode = createFastDomNode(document.createElement('div'));
this._domNode.setClassName('accessibilityHelpWidget');
this._domNode.setDisplay('none');
this._domNode.setAttribute('role', 'dialog');
this._domNode.setAttribute('aria-hidden', 'true');
this._contentDomNode = createFastDomNode(document.createElement('div'));
this._contentDomNode.setAttribute('role', 'document');
this._domNode.appendChild(this._contentDomNode);
this._isVisible = false;
this._register(this._editor.onDidLayoutChange(() => {
if (this._isVisible) {
this._layout();
}
}));
// Intentionally not configurable!
this._register(dom.addStandardDisposableListener(this._contentDomNode.domNode, 'keydown', (e) => {
if (!this._isVisible) {
return;
}
if (e.equals(KeyMod.CtrlCmd | KeyCode.KeyE)) {
alert(AccessibilityHelpNLS.emergencyConfOn);
this._editor.updateOptions({
accessibilitySupport: 'on'
});
dom.clearNode(this._contentDomNode.domNode);
this._buildContent();
this._contentDomNode.domNode.focus();
e.preventDefault();
e.stopPropagation();
}
if (e.equals(KeyMod.CtrlCmd | KeyCode.KeyH)) {
alert(AccessibilityHelpNLS.openingDocs);
let url = (<IStandaloneEditorConstructionOptions>this._editor.getRawOptions()).accessibilityHelpUrl;
if (typeof url === 'undefined') {
url = 'https://go.microsoft.com/fwlink/?linkid=852450';
}
this._openerService.open(URI.parse(url));
e.preventDefault();
e.stopPropagation();
}
}));
this.onblur(this._contentDomNode.domNode, () => {
this.hide();
});
this._editor.addOverlayWidget(this);
}
public override dispose(): void {
this._editor.removeOverlayWidget(this);
super.dispose();
}
public getId(): string {
return AccessibilityHelpWidget.ID;
}
public getDomNode(): HTMLElement {
return this._domNode.domNode;
}
public getPosition(): IOverlayWidgetPosition {
return {
preference: null
};
}
public show(): void {
if (this._isVisible) {
return;
}
this._isVisible = true;
this._isVisibleKey.set(true);
this._layout();
this._domNode.setDisplay('block');
this._domNode.setAttribute('aria-hidden', 'false');
this._contentDomNode.domNode.tabIndex = 0;
this._buildContent();
this._contentDomNode.domNode.focus();
}
private _descriptionForCommand(commandId: string, msg: string, noKbMsg: string): string {
const kb = this._keybindingService.lookupKeybinding(commandId);
if (kb) {
return strings.format(msg, kb.getAriaLabel());
}
return strings.format(noKbMsg, commandId);
}
private _buildContent() {
const options = this._editor.getOptions();
const selections = this._editor.getSelections();
let charactersSelected = 0;
if (selections) {
const model = this._editor.getModel();
if (model) {
selections.forEach((selection) => {
charactersSelected += model.getValueLengthInRange(selection);
});
}
}
let text = getSelectionLabel(selections, charactersSelected);
if (options.get(EditorOption.inDiffEditor)) {
if (options.get(EditorOption.readOnly)) {
text += AccessibilityHelpNLS.readonlyDiffEditor;
} else {
text += AccessibilityHelpNLS.editableDiffEditor;
}
} else {
if (options.get(EditorOption.readOnly)) {
text += AccessibilityHelpNLS.readonlyEditor;
} else {
text += AccessibilityHelpNLS.editableEditor;
}
}
const turnOnMessage = (
platform.isMacintosh
? AccessibilityHelpNLS.changeConfigToOnMac
: AccessibilityHelpNLS.changeConfigToOnWinLinux
);
switch (options.get(EditorOption.accessibilitySupport)) {
case AccessibilitySupport.Unknown:
text += '\n\n - ' + turnOnMessage;
break;
case AccessibilitySupport.Enabled:
text += '\n\n - ' + AccessibilityHelpNLS.auto_on;
break;
case AccessibilitySupport.Disabled:
text += '\n\n - ' + AccessibilityHelpNLS.auto_off;
text += ' ' + turnOnMessage;
break;
}
if (options.get(EditorOption.tabFocusMode)) {
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOnMsg, AccessibilityHelpNLS.tabFocusModeOnMsgNoKb);
} else {
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOffMsg, AccessibilityHelpNLS.tabFocusModeOffMsgNoKb);
}
const openDocMessage = (
platform.isMacintosh
? AccessibilityHelpNLS.openDocMac
: AccessibilityHelpNLS.openDocWinLinux
);
text += '\n\n - ' + openDocMessage;
text += '\n\n' + AccessibilityHelpNLS.outroMsg;
this._contentDomNode.domNode.appendChild(renderFormattedText(text));
// Per https://www.w3.org/TR/wai-aria/roles#document, Authors SHOULD provide a title or label for documents
this._contentDomNode.domNode.setAttribute('aria-label', text);
}
public hide(): void {
if (!this._isVisible) {
return;
}
this._isVisible = false;
this._isVisibleKey.reset();
this._domNode.setDisplay('none');
this._domNode.setAttribute('aria-hidden', 'true');
this._contentDomNode.domNode.tabIndex = -1;
dom.clearNode(this._contentDomNode.domNode);
this._editor.focus();
}
private _layout(): void {
const editorLayout = this._editor.getLayoutInfo();
const w = Math.max(5, Math.min(AccessibilityHelpWidget.WIDTH, editorLayout.width - 40));
const h = Math.max(5, Math.min(AccessibilityHelpWidget.HEIGHT, editorLayout.height - 40));
this._domNode.setWidth(w);
this._domNode.setHeight(h);
const top = Math.round((editorLayout.height - h) / 2);
this._domNode.setTop(top);
const left = Math.round((editorLayout.width - w) / 2);
this._domNode.setLeft(left);
}
}
class ShowAccessibilityHelpAction extends EditorAction {
constructor() {
super({
id: 'editor.action.showAccessibilityHelp',
label: AccessibilityHelpNLS.showAccessibilityHelpAction,
alias: 'Show Accessibility Help',
precondition: undefined,
kbOpts: {
primary: KeyMod.Alt | KeyCode.F1,
weight: KeybindingWeight.EditorContrib,
linux: {
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.F1,
secondary: [KeyMod.Alt | KeyCode.F1]
}
}
});
}
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
const controller = AccessibilityHelpController.get(editor);
if (controller) {
controller.show();
}
}
}
registerEditorContribution(AccessibilityHelpController.ID, AccessibilityHelpController);
registerEditorAction(ShowAccessibilityHelpAction);
const AccessibilityHelpCommand = EditorCommand.bindToContribution<AccessibilityHelpController>(AccessibilityHelpController.get);
registerEditorCommand(
new AccessibilityHelpCommand({
id: 'closeAccessibilityHelp',
precondition: CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE,
handler: x => x.hide(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 100,
kbExpr: EditorContextKeys.focus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
}
})
);
registerThemingParticipant((theme, collector) => {
const widgetBackground = theme.getColor(editorWidgetBackground);
if (widgetBackground) {
collector.addRule(`.monaco-editor .accessibilityHelpWidget { background-color: ${widgetBackground}; }`);
}
const widgetForeground = theme.getColor(editorWidgetForeground);
if (widgetForeground) {
collector.addRule(`.monaco-editor .accessibilityHelpWidget { color: ${widgetForeground}; }`);
}
const widgetShadowColor = theme.getColor(widgetShadow);
if (widgetShadowColor) {
collector.addRule(`.monaco-editor .accessibilityHelpWidget { box-shadow: 0 2px 8px ${widgetShadowColor}; }`);
}
const hcBorder = theme.getColor(contrastBorder);
if (hcBorder) {
collector.addRule(`.monaco-editor .accessibilityHelpWidget { border: 2px solid ${hcBorder}; }`);
}
});
|
<!--<div id="pagewidth-vert">-->
<!--<table class="patient-home-vert" width="100%">-->
<!--<tbody><tr>-->
<!--<td style="vertical-align: top;">-->
<!--<button id='form-home' class="menu-blue" onClick="window.location.href = '#home'">Home</button>-->
<!--{{#if phone}}-->
<!--<span class="patientName">Request from {{phone}} on {{#dateFormatdMY created}}{{/dateFormatdMY}}</span>-->
<!--{{/if}}-->
<!--</td>-->
<!--</tr>-->
<!--</tbody>-->
<!--</table>-->
<!--</div>-->
<div id="form-container">
{{#if recordId}}
<h1><a href="#edit/{{recordId}}">{{label}}</a></h1>
{{else}}
<h1>{{label}}</h1>
{{/if}}
<!--<p>{{#if phone}}-->
<!--<span class="patientName">Request from {{phone}} on {{#dateFormatdMY created}}{{/dateFormatdMY}}</span>-->
<!--{{/if}}-->
<!--</p>-->
<!--<h2>ID: {{recordId}}</h2>-->
<form id="theForm">
<div id="formElements">
<p class="dateHeader">{{#if _id}}
Created: {{#dateFormatdMY created}}{{/dateFormatdMY}}<br/>
Modified: {{#dateFormatdMY lastModified}}{{/dateFormatdMY}}
{{/if}}
</p>
</div>
</form>
</div> |
import {
Component
} from '@angular/core';
@Component({
selector: 'sky-filter-inline-item',
styleUrls: ['./filter-inline-item.component.scss'],
templateUrl: './filter-inline-item.component.html'
})
export class SkyFilterInlineItemComponent {
}
|
<?php //-->
/*
* This file is part of the Eden package.
* (c) 2011-2012 Openovate Labs
*
* Copyright and license information can be found at LICENSE.txt
* distributed with this package.
*/
/**
* Twitter saved searches
*
* @package Eden
* @category twitter
* @author Christian Symon M. Buenavista sbuenavista@openovate.com
*/
class Eden_Twitter_Saved extends Eden_Twitter_Base {
/* Constants
-------------------------------*/
const URL_SAVED_SEARCHES = 'https://api.twitter.com/1.1/saved_searches/list.json';
const URL_GET_DETAIL = 'https://api.twitter.com/1.1/saved_searches/show/%d.json';
const URL_CREATE_SEARCH = 'https://api.twitter.com/1.1/saved_searches/create.json';
const URL_REMOVE = 'https://api.twitter.com/1.1/saved_searches/destroy/%d.json';
/* Public Properties
-------------------------------*/
/* Protected Properties
-------------------------------*/
/* Private Properties
-------------------------------*/
/* Magic
-------------------------------*/
public static function i() {
return self::_getMultiple(__CLASS__);
}
/* Public Methods
-------------------------------*/
/**
* Create a new saved search for the authenticated user.
* A user may only have 25 saved searches.
*
* @param string
* @return array
*/
public function createSearch($query) {
//Argument 1 must be a integer
Eden_Twitter_Error::i()->argument(1, 'string');
$this->_query['query'] = $query;
return $this->_post(self::URL_CREATE_SEARCH, $this->_query);
}
/**
* Retrieve the information for the saved search represented
* by the given id. The authenticating user must be the
* owner of saved search ID being requested.
*
* @param int search ID
* @return array
*/
public function getDetail($id) {
//Argument 1 must be a integer
Eden_Twitter_Error::i()->argument(1, 'int');
return $this->_getResponse(sprintf(self::URL_GET_DETAIL, $id));
}
/**
* Returns the authenticated user's
* saved search queries.
*
* @return array
*/
public function getSavedSearches() {
return $this->_getResponse(self::URL_SAVED_SEARCHES);
}
/**
* Destroys a saved search for the authenticating user.
* The authenticating user must be the owner of
* saved search id being destroyed.
*
* @param int search ID
* @return array
*/
public function remove($id) {
//Argument 1 must be a integer
Eden_Twitter_Error::i()->argument(1, 'int');
return $this->_post(sprintf(self::URL_REMOVE, $id));
}
/* Protected Methods
-------------------------------*/
/* Private Methods
-------------------------------*/
} |
# thor-ssh
ThorSsh takes thor and allows it to run from local to remote.
It assumes that the sources are always local and the remotes
are always remote.
## ThorSsh Assumptions
For running as_user('other_user') the assumption is that your connection is logged in either as 1) root, or 2) a user who can sudo to root
## Use
gem 'thor-ssh'
Use thor as you normally would, but on any thor instance add the following:
class ThorTest < Thor
include Thor::Actions
include ThorSsh::Actions
Then set a destination server to an Net::SSH connection to make all actions use a different server for the destination.
self.destination_connection = Net::SSH.start(... [ssh connection] ...)
## Things that don't work yet
This is still a work in progress. The main issue is that calling #inside or anything that depends on it (in_root) does not work yet. I'll get it working soon though.
TODO: Get #inside working
TODO: Add other features needed for provisioning system
TODO: Make way to copy remote to remote
TODO: Update method blacklist
## Running Tests
The test run through vagrant, which seemed logical since we want to test ssh stuff.
### Install a box (first time only)
cd spec/vagrant
bundle exec vagrant box add ubuntu11 http://timhuegdon.com/vagrant-boxes/ubuntu-11.10.box
bundle exec vagrant init ubuntu11
# enable the sandbox and create a commit we can rollback to
bundle exec vagrant sandbox on
bundle exec vagrant sandbox commit
### Start box
vagrant up
### Run the tests
cd ../..
bundle exec rspec
### When you're done
cd spec/vagrant
vagrant halt
### TODO:
Add upload progress: https://github.com/net-ssh/net-sftp/blob/master/lib/net/sftp/operations/upload.rb |
#include "LightComponent.h"
#include "../../utils/d3d.h"
#include "../GameObject.h"
#include "Transform.h"
namespace thomas
{
namespace object
{
namespace component
{
LightComponent::LightComponent()
{
}
LightComponent::~LightComponent()
{
}
/**
DIRECTIONAL LIGHT
The light look down its forward transformation
*/
DirectionalLight::DirectionalLight() : LightComponent()
{
//standard init of light
m_thisLight.lightColor = thomas::math::Vector4(1, 1, 1, 1);
m_index = graphics::LightManager::AddDirectionalLight(m_thisLight);
/*if ((m_index = graphics::LightManager::AddDirectionalLight(m_thisLight)) < 0)
{
LOG("Cant add light")
Destroy(this);
}*/
}
DirectionalLight::~DirectionalLight()
{
}
bool DirectionalLight::Bind()
{
return true;
}
bool DirectionalLight::SetLightColor(thomas::math::Vector4 other)
{
m_thisLight.lightColor = other;
return thomas::graphics::LightManager::UpdateDirectionalLight(m_thisLight, m_index);
}
void DirectionalLight::Update()
{
m_thisLight.lightDirection = m_gameObject->m_transform->Forward();
thomas::graphics::LightManager::UpdateDirectionalLight(m_thisLight, m_index);
return;
}
/**
POINT LIGHT
*/
PointLight::PointLight() : LightComponent()
{
//standard init of light
m_thisLight.constantAttenuation = 0.6f;
m_thisLight.linearAttenuation = 0.3f;
m_thisLight.quadraticAttenuation = 0.1f;
m_thisLight.power = 5;
m_thisLight.position = thomas::math::Vector3(0, 0, 0);
m_thisLight.lightColor = thomas::math::Vector4(1, 1, 1, 1);
m_index = graphics::LightManager::AddPointLight(m_thisLight);
}
PointLight::~PointLight()
{
}
bool PointLight::Bind()
{
return true;
}
bool PointLight::SetLightColor(thomas::math::Vector4 other)
{
m_thisLight.lightColor = other;
return thomas::graphics::LightManager::UpdatePointLight(m_thisLight, m_index);
}
bool PointLight::SetConstantAttenuation(float other)
{
m_thisLight.constantAttenuation = other;
return thomas::graphics::LightManager::UpdatePointLight(m_thisLight, m_index);
}
bool PointLight::SetLinearAttenuation(float other)
{
m_thisLight.constantAttenuation = other;
return thomas::graphics::LightManager::UpdatePointLight(m_thisLight, m_index);
}
bool PointLight::SetQuadraticAttenuation(float other)
{
m_thisLight.constantAttenuation = other;
return thomas::graphics::LightManager::UpdatePointLight(m_thisLight, m_index);
}
bool PointLight::SetPower(float other)
{
m_thisLight.power = other;
return thomas::graphics::LightManager::UpdatePointLight(m_thisLight, m_index);
}
void PointLight::Update()
{
m_thisLight.position = m_gameObject->m_transform->GetPosition();
thomas::graphics::LightManager::UpdatePointLight(m_thisLight, m_index);
return;
}
}
}
} |
<?php
/*
Safe sample
input : backticks interpretation, reading the file /tmp/tainted.txt
SANITIZE : use of pg_escape_literal
construction : use of sprintf via a %s with simple quote
*/
/*Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.*/
$tainted = `cat / tmp / tainted.txt`;
$tainted = pg_escape_literal($tainted);
$query = sprintf("!name='%s'", $tainted);
$ds = ldap_connect("localhost");
$r = ldap_bind($ds);
$sr = ldap_search($ds, "o=My Company, c=US", $query);
ldap_close($ds);
|
class Rubygem < ActiveRecord::Base
has_many :owners, :through => :ownerships, :source => :user
has_many :ownerships, :dependent => :destroy
has_many :subscribers, :through => :subscriptions, :source => :user
has_many :subscriptions, :dependent => :destroy
has_many :versions, :dependent => :destroy
has_many :web_hooks, :dependent => :destroy
has_one :linkset, :dependent => :destroy
validate :ensure_name_format
validates_presence_of :name
validates_uniqueness_of :name
scope :with_versions,
where("rubygems.id IN (SELECT rubygem_id FROM versions where versions.indexed IS true)")
scope :with_one_version,
select('rubygems.*').
joins(:versions).
group(column_names.map{ |name| "rubygems.#{name}" }.join(', ')).
having('COUNT(versions.id) = 1')
scope :name_is, lambda { |name|
where(:name => name.strip).
limit(1)
}
scope :search, lambda { |query|
where(["versions.indexed and (upper(name) like upper(:query) or upper(versions.description) like upper(:query))", {:query => "%#{query.strip}%"}]).
includes(:versions).
order("rubygems.downloads desc")
}
scope :name_starts_with, lambda { |letter|
where(["upper(name) like upper(?)", "#{letter}%" ])
}
def ensure_name_format
if name.class != String
errors.add :name, "must be a String"
elsif name =~ /^[\d]+$/
errors.add :name, "must include at least one letter"
elsif name =~ /[^\d\w\-\.]/
errors.add :name, "can only include letters, numbers, dashes, and underscores"
end
end
def all_errors(version = nil)
[self, linkset, version].compact.map do |ar|
ar.errors.full_messages
end.flatten.join(", ")
end
def self.total_count
with_versions.count
end
def self.latest(limit=5)
with_one_version.order("created_at desc").limit(limit)
end
def self.downloaded(limit=5)
with_versions.order("downloads desc").limit(limit)
end
def self.letter(letter)
name_starts_with(letter).order("name asc").with_versions
end
def self.letterize(letter)
letter =~ /\A[A-Za-z]\z/ ? letter.upcase : 'A'
end
def public_versions
versions.published.by_position
end
def hosted?
versions.count.nonzero?
end
def unowned?
ownerships.where(:approved => true).blank?
end
def owned_by?(user)
ownerships.find_by_user_id(user.id).try(:approved) if user
end
def to_s
versions.most_recent.try(:to_title) || name
end
def downloads
Download.for(self)
end
def payload(version = versions.most_recent, host_with_port = HOST)
{
'name' => name,
'downloads' => downloads,
'version' => version.number,
'version_downloads' => version.downloads_count,
'authors' => version.authors,
'info' => version.info,
'project_uri' => "http://#{host_with_port}/gems/#{name}",
'gem_uri' => "http://#{host_with_port}/gems/#{version.full_name}.gem",
'homepage_uri' => linkset.try(:home),
'wiki_uri' => linkset.try(:wiki),
'documentation_uri' => linkset.try(:docs),
'mailing_list_uri' => linkset.try(:mail),
'source_code_uri' => linkset.try(:code),
'bug_tracker_uri' => linkset.try(:bugs),
'dependencies' => {
'development' => version.dependencies.development.to_a,
'runtime' => version.dependencies.runtime.to_a
}
}
end
def as_json(options = {})
payload
end
def to_xml(options = {})
payload.to_xml(options.merge(:root => "rubygem"))
end
def to_param
name
end
def with_downloads
"#{name} (#{downloads})"
end
def pushable?
new_record? || versions.indexed.count.zero?
end
def create_ownership(user)
if unowned? && !user.try(:rubyforge_importer?)
ownerships.create(:user => user, :approved => true)
end
end
def update_versions!(version, spec)
version.update_attributes_from_gem_specification!(spec)
end
def update_dependencies!(version, spec)
spec.dependencies.each do |dependency|
version.dependencies.create!(:gem_dependency => dependency)
end
rescue ActiveRecord::RecordInvalid => ex
# ActiveRecord can't chain a nested error here, so we have to add and reraise
errors[:base] << ex.message
raise ex
end
def update_linkset!(spec)
self.linkset ||= Linkset.new
self.linkset.update_attributes_from_gem_specification!(spec)
self.linkset.save!
end
def update_attributes_from_gem_specification!(version, spec)
Rubygem.transaction do
save!
update_versions! version, spec
update_dependencies! version, spec
update_linkset! spec
end
end
def reorder_versions
numbers = self.reload.versions.sort.reverse.map(&:number).uniq
self.versions.each do |version|
Version.update_all({:position => numbers.index(version.number)}, {:id => version.id})
end
self.versions.update_all(:latest => false)
self.versions.release.with_indexed.inject(Hash.new { |h, k| h[k] = [] }) { |platforms, version|
platforms[version.platform] << version
platforms
}.each_value do |platforms|
Version.update_all({:latest => true}, {:id => platforms.sort.last.id})
end
end
def yank!(version)
version.yank!
if versions.indexed.count.zero?
ownerships.each(&:delete)
end
end
def find_or_initialize_version_from_spec(spec)
version = self.versions.find_or_initialize_by_number_and_platform(spec.version.to_s, spec.original_platform.to_s)
version.rubygem = self
version
end
def self.versions_key(name)
"r:#{name}"
end
end
|
package com.ul.deliveryclient;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
/**
* Enterprise Application Client main class.
*
*/
public class Main {
private static List<Long> unprocessedRequests = new ArrayList<>();
public static void main( String[] args ) {
// // check that four numbers are given as parameter
// if(args.length<4) {
// System.out.println("Usage : "+args[0]+" reportId, weight, height, width");
// System.exit(1);
// }
//
// long[] values=new long[4];
//
// for(int i=1;i<args.length;i++)
// values[i-1]=Long.parseLong(args[i]);
Scanner scanner = new Scanner(System.in);
try {
// get the required information from the context
Context context=new InitialContext();
ConnectionFactory connectionFactory=(ConnectionFactory) context.lookup("jms/QueueConnectionFactory");
Destination replyQueue = (Destination)context.lookup("DeliveryReplyQueue");
Destination requestQueue = (Destination)context.lookup("DeliveryRequestQueue");
// create the connection
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(replyQueue);
MessageConsumer messageConsumer = session.createConsumer(requestQueue);
messageConsumer.setMessageListener(new DeliveryRequestMessageListener());
connection.start();
System.out.println("");
System.out.println("");
System.out.println("===============================================================================");
System.out.println(" INSTRUCTIONS:");
System.out.println(" The client will now start listening for delivery requests");
System.out.println(" At any time, enter -1 for a list of unprocessed requests");
System.out.println(" enter 0 to exit");
System.out.println(" enter the order id to confirm the delivery");
System.out.println("===============================================================================");
System.out.println("");
System.out.println("");
while(true){
System.out.print("Enter command: ");
long input = scanner.nextLong();
if(input < 0) {
printUnprocessedRequests();
System.out.println("===============================================================================");
} else if (input == 0) {
break;
} else {
if(!hasRequest(input)) {
System.out.println("");
System.out.println("The ID does not seem to correspond to an active request. Enter -1 to get list of requests.");
System.out.println("===============================================================================");
} else {
// create and send the message
ObjectMessage message = session.createObjectMessage();
message.setObject(input);
messageProducer.send(message);
removeRequest(input);
System.out.println("");
System.out.println("Confirmation message sent for the bill of order with id: " + input);
printUnprocessedRequests();
System.out.println("===============================================================================");
}
}
}
session.close();
connection.close();
connection = null;
} catch (Exception e) {
e.printStackTrace();
}
}
public static void printUnprocessedRequests() {
if (unprocessedRequests.isEmpty()) {
System.out.println("");
System.out.println("No unprocessed requests");
} else {
System.out.println("");
System.out.println("Unprocessed request IDs: ");
for(Long element : unprocessedRequests) {
System.out.println(element.toString());
}
}
}
public static void addRequest(Long id) {
unprocessedRequests.add(id);
}
public static void removeRequest(Long id) {
unprocessedRequests.remove(id);
}
public static boolean hasRequest(Long id) {
return unprocessedRequests.contains(id);
}
}
|
---
title: Using bitmaps for efficient Solidity smart contracts
date: '2018-12-10'
summary: ''
tags:
- Solidity
- Ethereum
- Smart Contracts
- Bitmaps
---
Smart contracts on Ethereum cost gas to run, and since gas is paid for in Ether,
it's generally a good idea to minimize the gas cost of running one's contract.
In this sense, writing a smart contract is similar to writing a complex program
for a resource-constrained computer - be as efficient as possible,
both in terms of memory use and and CPU cycles.
One well known technique for optimizing storage and access in certain use cases
is _bitmaps_. In this context _bitmap_ refers to the raw 1 and 0 bits in memory,
which are then used to represent some program state. For example, let's say we
have 10 people signed up to attend a class and we want to record whether each
person showed up or not. If coding in [Solidity](https://solidity.readthedocs.io),
we could use an array of 8-bit values to store this:
```solidity
// people who showed up: 1, 3, 4, 8, 9
uint8[] memory a = new uint8[](1, 0, 1, 1, 0, 0, 0, 1, 1, 0);
```
Notice that each value takes up 8 bits of space in RAM, meaning in total we are
using up at least 80 bits of memory to represent each person. In 64-bit
systems (which most computers are these days) numbers are represented in
multiples of 64-bits since each memory position is 64-bits. Thus 80 bits will
actually require 128 bits to represent in memory.
Yet we actually only need to represent two values per attendance state - 0 or 1.
Thus, we could actually use a single bit to represent each value, by using a
`uint16`:
```solidity
// people who showed up: 1, 3, 4, 8, 9
uint16 a = 397; // equals 0110001101 in binary
```
Now everything combined take up only 16 bits of space in RAM, meaning 64 bits in
raw memory. This is a much more memory efficient scheme. The only thing we
need to be able to do is read individual bits within the integer. We
can use _bitwise_ operators to do this. Note that bits are counted from
[right to left]((https://www.techopedia.com/definition/8030/least-significant-bit-lsb)):
```solidity
uint16 a = 397; // equals 0110001101 in binary
// Read bits at positions 3 and 7.
// Note that bits are 0-indexed, thus bit 1 is at position 0, bit 2 is at position 1, etc.
uint8 bit3 = a & (1 << 2)
uint8 bit7 = a & (1 << 6)
```
Setting a specific bit works similary:
```solidity
uint16 a = 397; // equals 0110001101 in binary
// Set bit 5
a = a | (1 << 4)
```
**Battleship**
In my [Ethereum-based implementation of Battleship](https://github.com/eth-battleship/eth-battleship.github.io),
I use bitmaps to both store each player's game board as well as their list of
moves against their opponent's board.
Using bitmaps makes checks and calculations very efficient. For instance, when a
user initial signs onto a game we need to check that they've placed their ships
on their board correctly. Ships may not overlap with each other and they must
all be fully contained within the game board boundaries:
```solidity
/**
* Calculate the bitwise position of given XY coordinate.
* @param boardSize_ board size
* @param x_ X coordinate
* @param y_ Y coordinate
* @return position in integer
*/
function calculatePosition(uint boardSize_, uint x_, uint y_) public pure returns (uint) {
return 2 ** (x_ * boardSize_ + y_); // could also write as 1 << (x_ * boardSize_ + y)
}
/**
* Calculate board hash.
*
* This will check that the board is valid before calculating the hash
*
* @param ships_ Array representing ship sizes, each ship is a single number representing its size
* @param boardSize_ Size of board's sides (board is a square)
* @param board_ Array representing the board, each ship is represented as [x, y, isVertical]
* @return the SHA3 hash
*/
function calculateBoardHash(bytes ships_, uint boardSize_, bytes board_) public pure returns (bytes32) {
// used to keep track of existing ship positions
uint marked = 0;
// check that board setup is valid
for (uint s = 0; ships_.length > s; s += 1) {
// extract ship info
uint index = 3 * s;
uint x = uint(board_[index]);
uint y = uint(board_[index + 1]);
bool isVertical = (0 < uint(board_[index + 2]));
uint shipSize = uint(ships_[s]);
// check ship is contained within board boundaries
require(0 <= x && boardSize_ > x);
require(0 <= y && boardSize_ > y);
require(boardSize_ >= ((isVertical ? x : y) + shipSize));
// check that ship does not overlap with other ships on the board
uint endX = x + (isVertical ? shipSize : 1);
uint endY = y + (isVertical ? 1 : shipSize);
while (endX > x && endY > y) {
uint pos = calculatePosition(boardSize_, x, y);
// ensure no ship already sits on this position
require((pos & marked) == 0);
// update position bit
marked = marked | pos;
x += (isVertical ? 1 : 0);
y += (isVertical ? 0 : 1);
}
}
return keccak256(board_);
}
```
When it comes to calculate the winner of a game, bitmaps are again used to
check how many times a player has managed to hit their opponent's ships:
```solidity
/**
* Calculate no. of hits for a player.
*
* @param revealer_ The player whose board it is
* @param mover_ The opponent player whose hits to calculate
*/
function calculateHits(Player storage revealer_, Player storage mover_) internal {
// now let's count the hits for the mover and check board validity in one go
mover_.hits = 0;
for (uint ship = 0; ships.length > ship; ship += 1) {
// extract ship info
uint index = 3 * ship;
uint x = uint(revealer_.board[index]);
uint y = uint(revealer_.board[index + 1]);
bool isVertical = (0 < uint(revealer_.board[index + 2]));
uint shipSize = uint(ships[ship]);
// now let's see if there are hits
while (0 < shipSize) {
// did mover_ hit this position?
if (0 != (calculatePosition(boardSize, x, y) & mover_.moves)) {
mover_.hits += 1;
}
// move to next part of ship
if (isVertical) {
x += 1;
} else {
y += 1;
}
// decrement counter
shipSize -= 1;
}
}
}
```
All of a player's moves (`mover_.moves` above) are stored in a single `uint256`
value, for sake of efficiency. Each bit within this value signifies whether
the player hit the given position or now. Since our positions are 2-dimensional
(x, y) this means our maximum board size is 16, i.e. a 16x16 board. If we
wished to represent larger boards then we would have to use multiple `uint256` \
values to represent each player's moves.
**Kickback**
Kickback is an [event attendee management platform](https://github.com/wearekickback/contracts)
I'm currently working on. In Kickback we want to tell the smart contract who
showed up to an event and who didn't. This is an effect a real world
implementation of the example I presented earlier in this post.
We use a bitmap to represent participant attendance status (0 = not attended, 1 =
attended) but this time we need to use multiple bitmaps since we don't with to
limit the event capacity or the number of people who can show up. Technically
speaking, we use a list of `uint256` numbers to represent attendance status,
where each number in the list represents the attendance status of 256 people:
```solidity
/**
* @dev Mark participants as attended and enable payouts. The attendance cannot be undone.
* @param _maps The attendance status of participants represented by uint256 values.
*/
function finalize(uint256[] _maps) external onlyAdmin onlyActive {
uint256 totalBits = _maps.length * 256;
require(totalBits >= registered && totalBits - registered < 256, 'incorrect no. of bitmaps provided');
attendanceMaps = _maps;
uint256 _totalAttended = 0;
// calculate total attended
for (uint256 i = 0; i < attendanceMaps.length; i++) {
uint256 map = attendanceMaps[i];
// brian kerninghan bit-counting method - O(log(n))
while (map != 0) {
map &= (map - 1);
_totalAttended++;
}
}
// since maps can contain more bits than there are registrants, we cap the value!
totalAttended = _totalAttended < registered ? _totalAttended : registered;
}
```
Note that we first check to see that the current no. of `uint256` numbers have
been provided. We then save the "attendance bitmaps" for use later on, and use the
[Brian Kerninghan method](https://stackoverflow.com/questions/12380478/bits-counting-algorithm-brian-kernighan-in-an-integer-time-complexity) for counting the no. of set bits. This algorithm goes through
as many iterations as there are set bits, meaning that if only 2 people
attended then only 2 iterations of the loop would be needed to get the final count.
Finally, we add a safety check at the end to ensure that the "total attended"
count doesn't exceed the total no. of people who registered to attend, though
technically speaking this should never be the case if we've set the bits properly
in the input attendance bitmaps.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.