code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 3 1.01M |
|---|---|---|---|---|---|
import {QueryContext} from "../common/QueryContext";
import {IBoundQueryPart} from "./IBoundQueryPart";
export interface IQueryPart {
toCypher(ctx:QueryContext):IBoundQueryPart
} | robak86/neography | lib/cypher/abstract/IQueryPart.ts | TypeScript | mit | 183 |
package com.raymond.entrypoint;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import javax.servlet.http.HttpServletResponse;
/**
* Created by Raymond Kwong on 12/1/2018.
*/
@Qualifier("handlerExceptionResolver")
@RestControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(AuthenticationException.class)
public ErrorResponseBean handleAuthenticationException(AuthenticationException exception, HttpServletResponse response){
ErrorResponseBean errorResponseBean = new ErrorResponseBean();
errorResponseBean.setError(HttpStatus.UNAUTHORIZED.getReasonPhrase());
errorResponseBean.setMessage(exception.getMessage());
response.setStatus(HttpStatus.UNAUTHORIZED.value());
return errorResponseBean;
}
} | RaymondKwong/raymond_projects | services/jwtauth/src/main/java/com/raymond/entrypoint/GlobalExceptionHandler.java | Java | mit | 1,163 |
require 'spec_helper'
describe Dashdog do
it 'has a version number' do
expect(Dashdog::VERSION).not_to be nil
end
end
| serverworks/dashdog | spec/dashdog_spec.rb | Ruby | mit | 127 |
/**
* The GiftEntry class describes a gift in terms of three values:
* the gift name, the gift receipient, and whether the gift
* has been bought yet.
*
* @author Richard White
* @version 2013-12-05
*/
public class GiftEntry
{
/**
* Constructor for known recipient with blank Gift
* @param recipient The person who will receive an as yet unnamed gift
*/
/**
* Constructor for known recipient with known Gift
* @param recipient The person who will receive the gift
* @param gift The gift this person will receive
*/
/**
* setName establishes the giftName for a person's gift
* @param theGiftName the name of the gift
*/
/**
* setRecipient establishes the recipient of a gift
* @param theRecipient the name of the gift's receiver
*/
/**
* setAsPurchased checks the gift off as purchased
*/
/**
* getName returns giftName for a gift
* @return the name of the gift
*/
/**
* getRecipient identifies the recipient of a gift
* @return gift's receiver
*/
/**
* isPurchased identifies whether the gift has been purchased
* @return the value true if purchased, false if not yet purchased
*/
}
| mattsoulanille/compSci | GiftList/GiftEntry.java | Java | mit | 1,290 |
<?php
/**
* Copyright (c) 2014 Webflavia
*
* 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.
*/
namespace Webflavia\Entity;
use Webflavia\Resource\ResourceInterface;
/**
* @package \Webflavia\Entity
* @author Dhyego Fernando <dhyegofernando@gmail.com>
* @license <https://github.com/Webflavia/webflavia-php-sdk-v1/raw/master/LICENSE> MIT
*/
abstract class AbstractNavigable implements NavigableInterface {
/**
* Resource object reference
*
* @var \Webflavia\Resource\ResourceInterface
*/
protected $resource;
/**
* Request's response
*
* @var mixed[]
*/
protected $body;
/**
* Hypermedia links of request's resource
*
* @var mixed[]
*/
protected $links = array();
/**
* {@inheritDoc}
*/
public function __construct(ResourceInterface $resource, array $body) {
$this->resource = $resource;
$this->body = $body;
if (isset($this->body['_links'])) {
$this->links = $this->body['_links'];
}
}
/**
* {@inheritDoc}
*/
public function getLinks($offset = null) {
if (null !== $offset) {
return isset($this->links[$offset]) ? $this->links[$offset] : null;
}
return $this->links;
}
}
| EduardoMRB/webflavia-php-sdk-v1 | src/Webflavia/Entity/AbstractNavigable.php | PHP | mit | 2,220 |
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8 ie7"><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9 ie8"><![endif]-->
<!--[if IE 9]><html class="no-js ie9"><![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"><!--<![endif]-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>ONS Alpha Pattern Library</title>
<meta charset="utf-8"/>
<meta content="width=device-width,initial-scale=1.0" name="viewport"/>
<meta content="on" http-equiv="cleartype"/>
<meta name="format-detection" content="telephone=no">
<link rel="shortcut icon" href="/sg-assets/img/favicon.png">
<!-- These are the project stylesheets and scripts -->
<link rel="stylesheet" href="/dist/css/main.css"/>
<link href="/sg-assets/prismjs/prism.css" rel="stylesheet"/>
<script src="/ui/js/lib/modernizr.min.js"></script>
<!-- // -->
<!-- These are the styleguide stylesheets -->
<!-- IE friendly media query replacements as per http://jakearchibald.github.io/sass-ie/ -->
<!--[if lte IE 8]>
<link rel="stylesheet" href="/sg-assets/css/main-oldie.css"/>
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="/sg-assets/css/main.css"/>
<!--<![endif]-->
<!-- // -->
<!-- Styles that are required to make the project display correctly in the pattern library. -->
<link rel="stylesheet" href="/sg-assets/css/project.css"/>
</head>
<body class="sgcxp">
<div class="sgcxp__outer-wrapper">
<div class="sgcxp__inner-wrapper">
<a class="skiplink visuallyhidden focusable" href="#sgcxp__main" tabindex="0">
<span>Skip to main content</span>
</a>
<header class="sgcxp__header" id="header" role="banner">
<div class="sgcxp__update-panel">
<p class="sgcxp__update-panel__inner">Last updated: 18 November 2015</p>
</div>
<!--/sgcxp__update-panel-->
<div class="sgcxp__header__inner sgxcp-icons">
<a href="#menu" class="mobile-only offcanvas-menu-toggle offcanvas-menu-toggle--open"><span
class="icon icon-menu" role="presentation"></span><span
class="offcanvas-menu-toggle__text">Menu</span></a>
<a itemprop="url" class="sgcxp__logo" href="/">
<span itemprop="name">ONS</span>
<link itemprop="logo" href="/sg-assets/img/logo.png"/>
</a>
<div class="sgcxp__nav" id="menu">
<a href="#masthead" class="mobile-only offcanvas-menu-toggle offcanvas-menu-toggle--close"><span
class="icon icon-close" role="presentation"></span></a>
<nav>
<ul class="sgcxp__nav__list">
<li class="sgcxp__nav__item">
<a class="sgcxp__nav__link" href="#">Components<span
class="icon-down-arrow desktop-only"></span></a>
<div class="sgcxp__nav__dropdown grid-wrap">
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="components-buttons.html">Buttons</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="components-buttons-primary.html"
class="sgcxp__linklist__link">Primary</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-buttons-primary-with-icon.html"
class="sgcxp__linklist__link">Primary, with icon</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-buttons-sizes.html"
class="sgcxp__linklist__link">Sizes</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-buttons-primary-block.html"
class="sgcxp__linklist__link">Primary, block</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-buttons-secondary.html"
class="sgcxp__linklist__link">Secondary</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-buttons-secondary-active.html"
class="sgcxp__linklist__link">Secondary, active</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-buttons-button-bar.html"
class="sgcxp__linklist__link">Button bar</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="components-global.html">Global</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="components-global-footer.html"
class="sgcxp__linklist__link">Footer</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-global-header-with-breadcrumb.html"
class="sgcxp__linklist__link">Header with breadcrumb</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-global-header.html"
class="sgcxp__linklist__link">Header</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-global-hero-banner.html"
class="sgcxp__linklist__link">Hero banner</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-global-hero-banner-with-extra-large-stat.html"
class="sgcxp__linklist__link">Hero banner with extra large stat</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-global-page-header.html"
class="sgcxp__linklist__link">Page header</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="components-charts.html">Charts</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="components-charts-chart-controls.html"
class="sgcxp__linklist__link">Chart Controls</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-charts-horizontal-bar-chart.html"
class="sgcxp__linklist__link">Horizontal Bar Chart</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-charts-multi-series-chart.html"
class="sgcxp__linklist__link">Multi Series Chart</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-charts-population-pyramid.html"
class="sgcxp__linklist__link">Population Pyramid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-charts-stacked-bar-chart.html"
class="sgcxp__linklist__link">Stacked Bar Chart</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-charts-line-chart.html"
class="sgcxp__linklist__link">Line Chart</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="components-data-tables.html">Data Tables</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="components-data-tables-data-table-with-toggle.html"
class="sgcxp__linklist__link">Data Table with Toggle</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-data-tables-data-table-with-mode-switcher.html"
class="sgcxp__linklist__link">Data Table with Mode Switcher</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-data-tables-data-table-with-swipe-control.html"
class="sgcxp__linklist__link">Data Table with Swipe Control</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-data-tables-bare-data-table.html"
class="sgcxp__linklist__link">Bare Data Table</a>
</li>
<li class="sgcxp__linklist__item">
<a href="components-data-tables-responsive-table.html"
class="sgcxp__linklist__link">Responsive table</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="components-misc.html">Misc</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="components-misc-tooltips.html"
class="sgcxp__linklist__link">Tooltips</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
</div>
<!--/sgcxp__nav__dropdown-->
</li>
<li class="sgcxp__nav__item">
<a class="sgcxp__nav__link" href="#">Patterns<span
class="icon-down-arrow desktop-only"></span></a>
<div class="sgcxp__nav__dropdown grid-wrap">
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-boxes.html">Boxes</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-standard-box.html"
class="sgcxp__linklist__link">Standard box</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-padded-box.html"
class="sgcxp__linklist__link">Padded box</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-sectioned-box.html"
class="sgcxp__linklist__link">Sectioned box</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-lifted-box.html"
class="sgcxp__linklist__link">Lifted box</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-combinations.html"
class="sgcxp__linklist__link">Combinations</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-vertically-sectioned-box.html"
class="sgcxp__linklist__link">Vertically sectioned box</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-box-with-border.html"
class="sgcxp__linklist__link">Box with border</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-orange-box.html"
class="sgcxp__linklist__link">Orange box</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-orange-box-with-large-left-border.html"
class="sgcxp__linklist__link">Orange box with large left border</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-orange-coloured-box-with-icon.html"
class="sgcxp__linklist__link">Orange-coloured box with icon</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-negative-offset.html"
class="sgcxp__linklist__link">Negative offset</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-boxes-dark-lifted-box.html"
class="sgcxp__linklist__link">Dark lifted box</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-navs.html">Navs</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-navs-nav.html"
class="sgcxp__linklist__link">Nav</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-nav-inline-block.html"
class="sgcxp__linklist__link">Nav inline-block</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-nav-block.html"
class="sgcxp__linklist__link">Nav, block</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-nav-block-spaced.html"
class="sgcxp__linklist__link">Nav, block spaced</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-nav-dark.html"
class="sgcxp__linklist__link">Nav dark</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-nav-heavy.html"
class="sgcxp__linklist__link">Nav heavy</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-simple-breadcrumb-nav.html"
class="sgcxp__linklist__link">Simple breadcrumb nav</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-navs-breadcrumb.html"
class="sgcxp__linklist__link">Breadcrumb</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-general.html">General</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-general-actionable-header.html"
class="sgcxp__linklist__link">Actionable header</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-actionable-header-tight.html"
class="sgcxp__linklist__link">Actionable header, tight</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-content-reveal-class.html"
class="sgcxp__linklist__link">Content reveal class</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-stacked-date-microcomponent.html"
class="sgcxp__linklist__link">Stacked date microcomponent</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-divider.html"
class="sgcxp__linklist__link">Divider</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-lozenges.html"
class="sgcxp__linklist__link">Lozenges</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-table-of-contents.html"
class="sgcxp__linklist__link">Table of Contents</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-general-standard-tabbed-ui.html"
class="sgcxp__linklist__link">Standard tabbed UI</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-stats.html">Stats</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-stats-hero-stat-headline.html"
class="sgcxp__linklist__link">Hero stat headline</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-stats-basic.html"
class="sgcxp__linklist__link">Basic</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-stats-basic-with-unit.html"
class="sgcxp__linklist__link">Basic, with unit</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-stats-basic-with-unit-and-description.html"
class="sgcxp__linklist__link">Basic, with unit and description</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-stats-small.html"
class="sgcxp__linklist__link">Small</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-stats-headline-stat.html"
class="sgcxp__linklist__link">Headline stat</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-stats-xl-headline-stat.html"
class="sgcxp__linklist__link">XL Headline stat</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-panels.html">Panels</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-panels-nav-panel-with-stats.html"
class="sgcxp__linklist__link">Nav panel with stats</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-panels-nav-panel-without-stats.html"
class="sgcxp__linklist__link">Nav panel without stats</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-panels-panel.html"
class="sgcxp__linklist__link">Panel</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-panels-panel-separated.html"
class="sgcxp__linklist__link">Panel, separated</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-panels-panel-with-padding.html"
class="sgcxp__linklist__link">Panel, with padding</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-panels-panel-with-margin.html"
class="sgcxp__linklist__link">Panel, with margin</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-lists.html">Lists</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-lists-standard-unordered-list.html"
class="sgcxp__linklist__link">Standard unordered list</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-lists-standard-ordered-list.html"
class="sgcxp__linklist__link">Standard ordered list</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-lists-neutral-list.html"
class="sgcxp__linklist__link">Neutral list</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-lists-stacking-definition-list.html"
class="sgcxp__linklist__link">Stacking definition list</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-lists-inline-definition-list.html"
class="sgcxp__linklist__link">Inline definition list</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-lists-inline-split-definition-list.html"
class="sgcxp__linklist__link">Inline, split definition list</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-slates.html">Slates</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-slates-light-grey-slate.html"
class="sgcxp__linklist__link">Light grey slate</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-slates-off-white-slate.html"
class="sgcxp__linklist__link">Off-white slate</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-slates-mid-grey-slate.html"
class="sgcxp__linklist__link">Mid grey slate</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-slates-grey-slate.html"
class="sgcxp__linklist__link">Grey slate</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-media.html">Media</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-media-content-image.html"
class="sgcxp__linklist__link">Content image</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-media-media-object.html"
class="sgcxp__linklist__link">Media object</a>
</li>
<li class="sgcxp__linklist__item">
<a href="patterns-media-media-object-with-reverse-image.html"
class="sgcxp__linklist__link">Media object with reverse image</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="patterns-type.html">Type</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="patterns-type-complex-link.html"
class="sgcxp__linklist__link">Complex link</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
</div>
<!--/sgcxp__nav__dropdown-->
</li>
<li class="sgcxp__nav__item">
<a class="sgcxp__nav__link" href="#">Visual Language<span
class="icon-down-arrow desktop-only"></span></a>
<div class="sgcxp__nav__dropdown grid-wrap">
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="visual-language-forms.html">Forms</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-text-input.html"
class="sgcxp__linklist__link">Text input</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-text-input-with-supporting-text.html"
class="sgcxp__linklist__link">Text input with supporting text</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-input-with-error.html"
class="sgcxp__linklist__link">Input with error</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-input-with-button.html"
class="sgcxp__linklist__link">Input with button</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-textarea.html"
class="sgcxp__linklist__link">Textarea</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-checkboxes.html"
class="sgcxp__linklist__link">Checkboxes</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-forms-selectbox.html"
class="sgcxp__linklist__link">Selectbox</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="visual-language-grid.html">Grid</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="visual-language-grid-desktop-grid.html"
class="sgcxp__linklist__link">Desktop grid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-grid-tablet-and-up-grid.html"
class="sgcxp__linklist__link">Tablet (and up) grid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-grid-mobile-and-up-grid.html"
class="sgcxp__linklist__link">Mobile (and up) grid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-grid-mixed-mobiletabletdesktop-grid.html"
class="sgcxp__linklist__link">Mixed Mobile/Tablet/Desktop grid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-grid-push-pull-grid.html"
class="sgcxp__linklist__link">Push pull grid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-grid-nested-grid.html"
class="sgcxp__linklist__link">Nested grid</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="visual-language-type.html">Type</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="visual-language-type-headings.html"
class="sgcxp__linklist__link">Headings</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-type-paragraph.html"
class="sgcxp__linklist__link">Paragraph</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-type-links.html"
class="sgcxp__linklist__link">Links</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="visual-language-colors.html">Colors</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="visual-language-colors-primary.html"
class="sgcxp__linklist__link">Primary</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-colors-global.html"
class="sgcxp__linklist__link">Global</a>
</li>
<li class="sgcxp__linklist__item">
<a href="visual-language-colors-accent.html"
class="sgcxp__linklist__link">Accent</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="visual-language-graphical-elements.html">Graphical elements</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="visual-language-graphical-elements-icons.html"
class="sgcxp__linklist__link">Icons</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
</div>
<!--/sgcxp__nav__dropdown-->
</li>
<li class="sgcxp__nav__item">
<a class="sgcxp__nav__link" href="#">Templates<span
class="icon-down-arrow desktop-only"></span></a>
<div class="sgcxp__nav__dropdown grid-wrap">
<div class="sgcxp__linklist__col__wrapper grid-wrap grid-col">
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="templates-templates.html">Templates</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="templates-templates-homepage-template-t1.html"
class="sgcxp__linklist__link">Homepage Template (T1)</a>
</li>
<li class="sgcxp__linklist__item">
<a href="templates-templates-product-page-t3.html"
class="sgcxp__linklist__link">Product Page (T3)</a>
</li>
<li class="sgcxp__linklist__item">
<a href="templates-templates-stat-bulletin-page-t4-1.html"
class="sgcxp__linklist__link">Stat Bulletin Page (T4-1)</a>
</li>
<li class="sgcxp__linklist__item">
<a href="templates-templates-expert-analysis-page-t4-2.html"
class="sgcxp__linklist__link">Expert Analysis Page (T4-2)</a>
</li>
<li class="sgcxp__linklist__item">
<a href="templates-templates-time-series-page-t5.html"
class="sgcxp__linklist__link">Time Series Page (T5)</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
<div class="sgcxp__linklist__col grid-col grid-one-quarter">
<div class="sgcxp__linklist__section">
<h3 class="sgcxp__linklist__heading">
<a href="templates-examples.html">Examples</a>
</h3>
<ul class="sgcxp__linklist__item__wrapper desktop-only">
<li class="sgcxp__linklist__item">
<a href="templates-examples-desktop-grid.html"
class="sgcxp__linklist__link">Desktop Grid</a>
</li>
<li class="sgcxp__linklist__item">
<a href="templates-examples-basic-starter.html"
class="sgcxp__linklist__link">Basic starter</a>
</li>
</ul>
<!--/sgcxp__linklist__item__wrapper-->
</div>
<!--/sgcxp__linklist__section-->
</div><!--/sgcxp__linklist__col-->
</div>
</div>
<!--/sgcxp__nav__dropdown-->
</li>
<!--<li class="sgcxp__nav__item no-subnav">-->
<!--<a class="sgcxp__nav__link" href="#">Pages</a>-->
<!--</li>-->
</ul>
</nav>
</div>
<!--/sgcxp__nav-->
</div>
<!--/sgcxp__header__inner-->
</header>
<main id="sgcxp__main" role="main">
<div class="sgcxp__wrapper">
<style>
.sgcxp__block__img {
vertical-align: middle;
margin-bottom:20px;
max-width:100%;
}
.sgcxp__block--imgs {
text-align:center;
}
</style>
<div class="grid-wrap">
<div class="grid-col">
<ul class="sgcxp__breadcrumb">
<li class="sgcxp__breadcrumb__item">
Components
</li>
<li class="sgcxp__breadcrumb__item">
Data Tables
</li>
</ul>
</div><!--/grid-col-->
</div><!--/grid-wrap-->
<div class="grid-wrap">
<div class="grid-col">
<h1 class="sgcxp__page-title">Data Table with Swipe Control</h1>
</div><!--/grid-col-->
<div class="grid-col grid-two-fifths">
</div><!--/grid-col-->
</div><!--/grid-wrap-->
<div class="grid-wrap" id="error-panel">
<div class="grid-col">
<div class="sgcxp__block sgcxp__block--lifted">
<div class="sgcxp__block__desc">
<table class="tablesaw" data-mode="swipe" data-minimap="">
<thead>
<tr>
<th data-priority="persist">Year</th>
<th>Annual average</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
</tr>
</thead>
<tbody>
<tr>
<th>1988</th>
<td>63.5</td>
<td>61.9</td>
<td>62.1</td>
<td>62.3</td>
<td>63.1</td>
<td>63.4</td>
<td>63.6</td>
<td>63.6</td>
<td>63.8</td>
<td>64.1</td>
<td>64.4</td>
<td>64.7</td>
<td>64.8</td>
</tr>
<tr>
<th>1989</th>
<td>66.8</td>
<td>65.0</td>
<td>65.2</td>
<td>65.5</td>
<td>66.4</td>
<td>66.7</td>
<td>67.0</td>
<td>66.9</td>
<td>67.0</td>
<td>67.5</td>
<td>68.0</td>
<td>68.2</td>
<td>68.3</td>
</tr>
<tr>
<th>1990</th>
<td>71.5</td>
<td>68.6</td>
<td>69.0</td>
<td>69.4</td>
<td>70.6</td>
<td>71.3</td>
<td>71.6</td>
<td>71.4</td>
<td>72.2</td>
<td>72.9</td>
<td>73.5</td>
<td>73.6</td>
<td>73.5</td>
</tr>
<tr>
<th>1991</th>
<td>76.8</td>
<td>73.5</td>
<td>73.9</td>
<td>74.1</td>
<td>76.6</td>
<td>77.2</td>
<td>77.6</td>
<td>77.4</td>
<td>77.7</td>
<td>78.1</td>
<td>78.5</td>
<td>78.8</td>
<td>78.8</td>
</tr>
<tr>
<th>1992</th>
<td>80.1</td>
<td>78.6</td>
<td>79.0</td>
<td>79.4</td>
<td>80.2</td>
<td>80.5</td>
<td>80.6</td>
<td>80.2</td>
<td>80.2</td>
<td>80.5</td>
<td>80.7</td>
<td>80.8</td>
<td>80.8</td>
</tr>
<tr>
<th>1993</th>
<td>82.1</td>
<td>80.4</td>
<td>80.9</td>
<td>81.3</td>
<td>82.2</td>
<td>82.5</td>
<td>82.5</td>
<td>82.2</td>
<td>82.5</td>
<td>82.9</td>
<td>82.8</td>
<td>82.6</td>
<td>82.8</td>
</tr>
<tr>
<th>1994</th>
<td>83.8</td>
<td>82.5</td>
<td>82.9</td>
<td>83.1</td>
<td>83.9</td>
<td>84.1</td>
<td>84.1</td>
<td>83.6</td>
<td>84.1</td>
<td>84.2</td>
<td>84.0</td>
<td>84.1</td>
<td>84.5</td>
</tr>
<tr>
<th>1995</th>
<td>86.0</td>
<td>84.5</td>
<td>84.9</td>
<td>85.3</td>
<td>85.8</td>
<td>86.2</td>
<td>86.3</td>
<td>85.8</td>
<td>86.3</td>
<td>86.7</td>
<td>86.5</td>
<td>86.5</td>
<td>87.0</td>
</tr>
<tr>
<th>1996</th>
<td>88.1</td>
<td>86.8</td>
<td>87.2</td>
<td>87.5</td>
<td>88.0</td>
<td>88.3</td>
<td>88.4</td>
<td>87.8</td>
<td>88.3</td>
<td>88.7</td>
<td>88.7</td>
<td>88.7</td>
<td>89.0</td>
</tr>
<tr>
<th>1997</th>
<td>89.7</td>
<td>88.6</td>
<td>88.8</td>
<td>89.0</td>
<td>89.4</td>
<td>89.6</td>
<td>89.8</td>
<td>89.5</td>
<td>90.0</td>
<td>90.3</td>
<td>90.3</td>
<td>90.4</td>
<td>90.5</td>
</tr>
<tr>
<th>1998</th>
<td>91.1</td>
<td>89.9</td>
<td>90.3</td>
<td>90.5</td>
<td>91.0</td>
<td>91.5</td>
<td>91.3</td>
<td>90.8</td>
<td>91.2</td>
<td>91.6</td>
<td>91.6</td>
<td>91.7</td>
<td>91.9</td>
</tr>
<tr>
<th>1999</th>
<td>92.3</td>
<td>91.4</td>
<td>91.5</td>
<td>92.0</td>
<td>92.4</td>
<td>92.7</td>
<td>92.6</td>
<td>92.0</td>
<td>92.3</td>
<td>92.7</td>
<td>92.6</td>
<td>92.7</td>
<td>93.0</td>
</tr>
<tr>
<th>2000</th>
<td>93.1</td>
<td>92.1</td>
<td>92.4</td>
<td>92.6</td>
<td>92.9</td>
<td>93.2</td>
<td>93.3</td>
<td>92.8</td>
<td>92.8</td>
<td>93.6</td>
<td>93.5</td>
<td>93.7</td>
<td>93.7</td>
</tr>
<tr>
<th>2001</th>
<td>94.2</td>
<td>92.9</td>
<td>93.1</td>
<td>93.4</td>
<td>94.0</td>
<td>94.7</td>
<td>94.9</td>
<td>94.2</td>
<td>94.5</td>
<td>94.8</td>
<td>94.7</td>
<td>94.5</td>
<td>94.7</td>
</tr>
<tr>
<th>2002</th>
<td>95.4</td>
<td>94.4</td>
<td>94.5</td>
<td>94.9</td>
<td>95.3</td>
<td>95.5</td>
<td>95.5</td>
<td>95.2</td>
<td>95.5</td>
<td>95.7</td>
<td>95.9</td>
<td>95.9</td>
<td>96.3</td>
</tr>
<tr>
<th>2003</th>
<td>96.7</td>
<td>95.7</td>
<td>96.0</td>
<td>96.3</td>
<td>96.7</td>
<td>96.7</td>
<td>96.5</td>
<td>96.5</td>
<td>96.8</td>
<td>97.1</td>
<td>97.2</td>
<td>97.2</td>
<td>97.5</td>
</tr>
<tr>
<th>2004</th>
<td>98.0</td>
<td>97.0</td>
<td>97.2</td>
<td>97.4</td>
<td>97.8</td>
<td>98.1</td>
<td>98.1</td>
<td>97.8</td>
<td>98.1</td>
<td>98.2</td>
<td>98.4</td>
<td>98.6</td>
<td>99.1</td>
</tr>
<tr>
<th>2005</th>
<td>100.0</td>
<td>98.6</td>
<td>98.8</td>
<td>99.3</td>
<td>99.7</td>
<td>100.0</td>
<td>100.0</td>
<td>100.1</td>
<td>100.4</td>
<td>100.6</td>
<td>100.7</td>
<td>100.7</td>
<td>101.0</td>
</tr>
<tr>
<th>2006</th>
<td>102.3</td>
<td>100.5</td>
<td>100.9</td>
<td>101.1</td>
<td>101.7</td>
<td>102.2</td>
<td>102.5</td>
<td>102.5</td>
<td>102.9</td>
<td>103.0</td>
<td>103.2</td>
<td>103.4</td>
<td>104.0</td>
</tr>
<tr>
<th>2007</th>
<td>104.7</td>
<td>103.2</td>
<td>103.7</td>
<td>104.2</td>
<td>104.5</td>
<td>104.8</td>
<td>105.0</td>
<td>104.4</td>
<td>104.7</td>
<td>104.8</td>
<td>105.3</td>
<td>105.6</td>
<td>106.2</td>
</tr>
<tr>
<th>2008</th>
<td>..</td>
<td>105.5</td>
<td>106.3</td>
<td>106.7</td>
<td>107.6</td>
<td>108.3</td>
<td>109.0</td>
<td>109.0</td>
<td>109.7</td>
<td>110.3</td>
<td>..</td>
<td>..</td>
<td>..</td>
</tr>
</tbody>
</table>
</div>
</div>
</div><!--/grid-col-->
</div><!--/grid-wrap-->
<div class="grid-wrap">
<div class="grid-col">
</div><!--/grid-col-->
</div><!--/grid-wrap-->
<div class="grid-wrap sgcxp__content">
<div class="grid-col grid-two-fifths">
<div class="sgcxp__block--notes sgcxp__block--padding-large">
<h2 class="sgcxp__block--notes__header">Usage notes</h2>
<p><p>Tables that have data that is not always required to be directly comparable suit this pattern.<br><br>The swipe table allows the user to browse the columns, using the prev / next controls or by swiping on a device that supports touch events. The only deficiency with this component is that it is harder to compare individual columns that are spread out from one another.</p>
</p>
</div>
</div><!--/grid-col-->
<div class="grid-col grid-three-fifths">
<div class="sgcxp__code">
<pre class="language-markup"><code><table class="tablesaw" data-mode="swipe" data-minimap="">
<thead>
<tr>
<th data-priority="persist">Year</th>
<th>Annual average</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
</tr>
</thead>
<tbody>
<tr>
<th>1988</th>
<td>63.5</td>
<td>61.9</td>
<td>62.1</td>
<td>62.3</td>
<td>63.1</td>
<td>63.4</td>
<td>63.6</td>
<td>63.6</td>
<td>63.8</td>
<td>64.1</td>
<td>64.4</td>
<td>64.7</td>
<td>64.8</td>
</tr>
<tr>
<th>1989</th>
<td>66.8</td>
<td>65.0</td>
<td>65.2</td>
<td>65.5</td>
<td>66.4</td>
<td>66.7</td>
<td>67.0</td>
<td>66.9</td>
<td>67.0</td>
<td>67.5</td>
<td>68.0</td>
<td>68.2</td>
<td>68.3</td>
</tr>
<tr>
<th>1990</th>
<td>71.5</td>
<td>68.6</td>
<td>69.0</td>
<td>69.4</td>
<td>70.6</td>
<td>71.3</td>
<td>71.6</td>
<td>71.4</td>
<td>72.2</td>
<td>72.9</td>
<td>73.5</td>
<td>73.6</td>
<td>73.5</td>
</tr>
<tr>
<th>1991</th>
<td>76.8</td>
<td>73.5</td>
<td>73.9</td>
<td>74.1</td>
<td>76.6</td>
<td>77.2</td>
<td>77.6</td>
<td>77.4</td>
<td>77.7</td>
<td>78.1</td>
<td>78.5</td>
<td>78.8</td>
<td>78.8</td>
</tr>
<tr>
<th>1992</th>
<td>80.1</td>
<td>78.6</td>
<td>79.0</td>
<td>79.4</td>
<td>80.2</td>
<td>80.5</td>
<td>80.6</td>
<td>80.2</td>
<td>80.2</td>
<td>80.5</td>
<td>80.7</td>
<td>80.8</td>
<td>80.8</td>
</tr>
<tr>
<th>1993</th>
<td>82.1</td>
<td>80.4</td>
<td>80.9</td>
<td>81.3</td>
<td>82.2</td>
<td>82.5</td>
<td>82.5</td>
<td>82.2</td>
<td>82.5</td>
<td>82.9</td>
<td>82.8</td>
<td>82.6</td>
<td>82.8</td>
</tr>
<tr>
<th>1994</th>
<td>83.8</td>
<td>82.5</td>
<td>82.9</td>
<td>83.1</td>
<td>83.9</td>
<td>84.1</td>
<td>84.1</td>
<td>83.6</td>
<td>84.1</td>
<td>84.2</td>
<td>84.0</td>
<td>84.1</td>
<td>84.5</td>
</tr>
<tr>
<th>1995</th>
<td>86.0</td>
<td>84.5</td>
<td>84.9</td>
<td>85.3</td>
<td>85.8</td>
<td>86.2</td>
<td>86.3</td>
<td>85.8</td>
<td>86.3</td>
<td>86.7</td>
<td>86.5</td>
<td>86.5</td>
<td>87.0</td>
</tr>
<tr>
<th>1996</th>
<td>88.1</td>
<td>86.8</td>
<td>87.2</td>
<td>87.5</td>
<td>88.0</td>
<td>88.3</td>
<td>88.4</td>
<td>87.8</td>
<td>88.3</td>
<td>88.7</td>
<td>88.7</td>
<td>88.7</td>
<td>89.0</td>
</tr>
<tr>
<th>1997</th>
<td>89.7</td>
<td>88.6</td>
<td>88.8</td>
<td>89.0</td>
<td>89.4</td>
<td>89.6</td>
<td>89.8</td>
<td>89.5</td>
<td>90.0</td>
<td>90.3</td>
<td>90.3</td>
<td>90.4</td>
<td>90.5</td>
</tr>
<tr>
<th>1998</th>
<td>91.1</td>
<td>89.9</td>
<td>90.3</td>
<td>90.5</td>
<td>91.0</td>
<td>91.5</td>
<td>91.3</td>
<td>90.8</td>
<td>91.2</td>
<td>91.6</td>
<td>91.6</td>
<td>91.7</td>
<td>91.9</td>
</tr>
<tr>
<th>1999</th>
<td>92.3</td>
<td>91.4</td>
<td>91.5</td>
<td>92.0</td>
<td>92.4</td>
<td>92.7</td>
<td>92.6</td>
<td>92.0</td>
<td>92.3</td>
<td>92.7</td>
<td>92.6</td>
<td>92.7</td>
<td>93.0</td>
</tr>
<tr>
<th>2000</th>
<td>93.1</td>
<td>92.1</td>
<td>92.4</td>
<td>92.6</td>
<td>92.9</td>
<td>93.2</td>
<td>93.3</td>
<td>92.8</td>
<td>92.8</td>
<td>93.6</td>
<td>93.5</td>
<td>93.7</td>
<td>93.7</td>
</tr>
<tr>
<th>2001</th>
<td>94.2</td>
<td>92.9</td>
<td>93.1</td>
<td>93.4</td>
<td>94.0</td>
<td>94.7</td>
<td>94.9</td>
<td>94.2</td>
<td>94.5</td>
<td>94.8</td>
<td>94.7</td>
<td>94.5</td>
<td>94.7</td>
</tr>
<tr>
<th>2002</th>
<td>95.4</td>
<td>94.4</td>
<td>94.5</td>
<td>94.9</td>
<td>95.3</td>
<td>95.5</td>
<td>95.5</td>
<td>95.2</td>
<td>95.5</td>
<td>95.7</td>
<td>95.9</td>
<td>95.9</td>
<td>96.3</td>
</tr>
<tr>
<th>2003</th>
<td>96.7</td>
<td>95.7</td>
<td>96.0</td>
<td>96.3</td>
<td>96.7</td>
<td>96.7</td>
<td>96.5</td>
<td>96.5</td>
<td>96.8</td>
<td>97.1</td>
<td>97.2</td>
<td>97.2</td>
<td>97.5</td>
</tr>
<tr>
<th>2004</th>
<td>98.0</td>
<td>97.0</td>
<td>97.2</td>
<td>97.4</td>
<td>97.8</td>
<td>98.1</td>
<td>98.1</td>
<td>97.8</td>
<td>98.1</td>
<td>98.2</td>
<td>98.4</td>
<td>98.6</td>
<td>99.1</td>
</tr>
<tr>
<th>2005</th>
<td>100.0</td>
<td>98.6</td>
<td>98.8</td>
<td>99.3</td>
<td>99.7</td>
<td>100.0</td>
<td>100.0</td>
<td>100.1</td>
<td>100.4</td>
<td>100.6</td>
<td>100.7</td>
<td>100.7</td>
<td>101.0</td>
</tr>
<tr>
<th>2006</th>
<td>102.3</td>
<td>100.5</td>
<td>100.9</td>
<td>101.1</td>
<td>101.7</td>
<td>102.2</td>
<td>102.5</td>
<td>102.5</td>
<td>102.9</td>
<td>103.0</td>
<td>103.2</td>
<td>103.4</td>
<td>104.0</td>
</tr>
<tr>
<th>2007</th>
<td>104.7</td>
<td>103.2</td>
<td>103.7</td>
<td>104.2</td>
<td>104.5</td>
<td>104.8</td>
<td>105.0</td>
<td>104.4</td>
<td>104.7</td>
<td>104.8</td>
<td>105.3</td>
<td>105.6</td>
<td>106.2</td>
</tr>
<tr>
<th>2008</th>
<td>..</td>
<td>105.5</td>
<td>106.3</td>
<td>106.7</td>
<td>107.6</td>
<td>108.3</td>
<td>109.0</td>
<td>109.0</td>
<td>109.7</td>
<td>110.3</td>
<td>..</td>
<td>..</td>
<td>..</td>
</tr>
</tbody>
</table></code></pre>
</div><!--/sgcxp__code-->
</div><!--/grid-col-->
</div><!--/grid-wrap-->
<div class="grid-wrap" id="error-panel">
<div class="grid-col">
<div class="sgcxp__block sgcxp__block--lifted">
<div class="sgcxp__block__desc sgcxp__block--padding-large sgcxp__block--markdown">
<h1>Developer Notes</h1>
<p>All data-tables are based on Filament Group's <a href="https://github.com/filamentgroup/tablesaw">Tablesaw library</a>, which provides an out of the box solution to responsive tables.<br><br>To define a table as a responsive table use <code>class="tablesaw"</code> on the table element and specify the appropriate mode e.g. <code>data-mode="swipe"</code> in this case.<br><br>The extent to the customisations for use within the pattern library is limited - specifically, the only additions are to present the tables in keeping with the of the pattern libraries look.<br><br>Use <code><th data-priority="persist">Always shows</th></code> to fix a column so that it is always visible.<br><br>Adding the attribute <code>data-minimap</code> adds an element to the chart indicating to the user which columns are currently visible.</p>
</div>
</div>
</div><!--/grid-col-->
</div><!--/grid-wrap-->
</div>
</main>
</div>
</div>
<!-- project js -->
<script src="/dist/js/footer.js"></script>
<!-- / -->
<!-- pattern library JS (@optimise: minify) -->
<script src="/sg-assets/js/charts.js"></script>
<script src="/sg-assets/js/lib/jquery-ui-1.10.3.custom.min.js"></script>
<script src="/sg-assets/js/lib/media.match.js"></script>
<script src="/sg-assets/js/lib/enquire.min.js"></script>
<script src="/sg-assets/js/lib/tiny-pubsub.js"></script>
<script src="/sg-assets/js/lib/jquery.uniform.min.js"></script>
<script src="/sg-assets/js/lib/jquery.hoverIntent.js"></script>
<script src="/sg-assets/js/app/widgets/offcanvas-menu.js"></script>
<script src="/sg-assets/js/app/widgets/skiplink.js"></script>
<script src="/sg-assets/js/app/widgets/jquery.cx.jump-to.js"></script>
<script src="/sg-assets/js/app/app.js"></script>
<!-- Fast Click - for speedy clicks and to fix the meganav dropdown on touch -->
<script src="/sg-assets/js/lib/fastclick.js"></script>
<script>
window.addEventListener('load', function () {
new FastClick(document.body);
}, false);
</script>
<!-- Font -->
<script type="text/javascript">
WebFontConfig = { fontdeck: { id: '42695' } };
(function () {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
<script src="/sg-assets/prismjs/prism.js"></script>
<script>
$('table').addClass('tablesaw');
$('pre').addClass('language-markup');
$('code').addClass('language-markup');
</script>
</body>
</html>
| ONSdigital/pattern-library | docs/components-data-tables-data-table-with-swipe-control.html | HTML | mit | 74,520 |
module.exports = function(params) {
params = params || {};
_.extend(this, params);
this.validate = params.validate || function() {
return true;
};
} | chrisharrington/traque | app/models/base.js | JavaScript | mit | 177 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Join_Arrays
{
class Program
{
static void Main(string[] args)
{
int[] nums = { 100, 200, 300 };
foreach (var x in nums)
{
Console.WriteLine();
}
}
}
}
| giggals/Software-University | Arrays - Lab/Join Arrays/Program.cs | C# | mit | 382 |
<?php
// EventFormBundle:Categoria:index.html.twig
return array (
);
| DelBianco/TesteSymfony | app/cache/dev/assetic/config/8/8933b2c685bce28af52752733fbcafbf.php | PHP | mit | 70 |
public class IsUnique {
public static boolean isUnique1(String input) {
int checker = 0;
int n = input.length();
if (n <= 1) return true;
for (int i = 0; i < n; i++) {
int c = input.charAt(i) - 'a';
if ((checker & (1 << c)) > 0) return false;
checker |= (1 << c);
}
return true;
}
public static boolean isUnique2(String input) {
int N = 256;
int[] map = new int[N];
int n = input.length();
if (n <= 1) return true;
for (int i = 0; i < n; i++) {
int c = input.charAt(i);
if (map[c] == 1) return false;
map[c] = 1;
}
return true;
}
public static boolean isUnique3(String input) {
HashMap<Character, Boolean> map = new HashMap<Character, Boolean>();
int n = input.length();
if (n <= 1) return true;
for (int i = 0; i < n; i++) {
if (null != map.get(input.charAt(i))) return false;
else map.put(input.charAt(i), true);
}
return true;
}
public static void main(String[] args) {
String[] tester = {"", "a", "aa", "ab", "strong", "stronger", "Hello World"};
for (String s : tester) {
System.out.println(s + ": " + isUnique1(s) + " | " + isUnique2(s) + " | " + isUnique3(s));
}
}
} | fzheng/codejam | ccup/ch1/IsUnique.java | Java | mit | 1,234 |
# Uso de adapters en los componentes RUP
En los componentes RUP se hace uso de unos módulos js llamados **adapters**.
Estos módulos se crearon con la finalidad de propocionar diferentes implementaciones dependiendo de si se trata del aspecto visual Material, Bootstrap o de jQueryUI.
De este modo exitirán tres adapters por cada componente RUP que necesite de una implementación diferente dependiendo del modo de visualización deseado.
Los adapters se implementan en la carpeta [src/adapter](https://github.com/UDA-EJIE/udaRUP/tree/master/src/adapter). Existe un fichero índice [rup.adapter.js](https://github.com/UDA-EJIE/udaRUP/blob/master/src/adapter/rup.adapter.js) encargado de cargar todos los adapters definidos para los componentes RUP.
| UDA-EJIE/uda-rup | doc/dev/Adapters_componentes_RUP.md | Markdown | mit | 755 |
#!/bin/bash
# About
# -----
#
# This script contains some bash wrappers for swift, the command-line
# interface to Rackspace's OpenStack Storage API.
#
# To get started, you'll need to install the python-swiftclient
#
# pip install python-swiftclient
#
# It's also available on github:
# https://github.com/openstack/python-swiftclient
#
# Usage
# -----
#
# Set the following environment variables (note: I just these in ~/.rackspace
# and source that file whenever I need it).
#
# RACKSPACE_API_KEY -- your API key
# RACKSPACE_USERNAME -- your Rackspace username
# RACKSPACE_CLOUDFILES_CONTAINER -- the default container you want to access
# RACKSPACE_AUTH_URL -- (optional) defaults to
# https://auth.api.rackspacecloud.com/v1.0
#
# Source this file (swift_wrapper.sh), and run `swifthelp` for a list of
# available commands.
#
# License
# -------
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Brad Montgomery
#
# 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.
if [ -z "$RACKSPACE_AUTH_URL" ]
then
export RACKSPACE_AUTH_URL=https://auth.api.rackspacecloud.com/v1.0
fi
if [ -z "$RACKSPACE_USERNAME" ]
then
echo "* You Need to set a RACKSPACE_USERNAME environment variable"
fi
if [ -z "$RACKSPACE_API_KEY" ]
then
echo "* You Need to set a RACKSPACE_API_KEY environment variable"
fi
if [ -z "$RACKSPACE_CLOUDFILES_CONTAINER" ]
then
echo "* You Need to set a RACKSPACE_CLOUDFILES_CONTAINER environment variable"
fi
# Prefix for all swift commands
SWIFT="swift -A $RACKSPACE_AUTH_URL -U $RACKSPACE_USERNAME -K $RACKSPACE_API_KEY"
# just print out the swift command in case we need to tack on more options.
function swiftcommand
{
echo
echo "$SWIFT"
echo
}
# Change your container
function swiftcontainer
{
if [ -z "$1" ]
then
echo
echo "Your current container is: $RACKSPACE_CLOUDFILES_CONTAINER"
echo
echo "USAGE: swiftcontainer <container-name>"
echo
else
export RACKSPACE_CLOUDFILES_CONTAINER=$1
echo "Changed container to: $RACKSPACE_CLOUDFILES_CONTAINER"
fi
}
# Delete a container
function swiftdeletecontainer
{
if [ -z "$1" ]
then
echo "Usage: swiftdeletecontainer <container_name>"
else
$SWIFT delete $1
fi
}
function swiftlistcontainers
{
$SWIFT list
}
function swiftlist
{
if [ -z "$1" ]
then
# List all items in the container
$SWIFT list $RACKSPACE_CLOUDFILES_CONTAINER
else
# Filter by a prefix
$SWIFT list --prefix $1 $RACKSPACE_CLOUDFILES_CONTAINER
fi
}
function swiftupload
{
if [ -z "$@" ]
then
echo "Usage: swiftupload <file_or_directory> [...]"
else
$SWIFT upload --changed $RACKSPACE_CLOUDFILES_CONTAINER $@
fi
}
# Delete an object(s) from a container
function swiftdelete
{
if [ -z "$@" ]
then
echo "Usage: swiftdelete <object> [...]"
else
$SWIFT delete $RACKSPACE_CLOUDFILES_CONTAINER $@
fi
}
function swiftdownload
{
if [ -z "$@" ]
then
echo "Usage: swiftdownload <object> [...]"
echo " swiftdownload \* -- to get all files in the container."
elif [ "$@" == '*' ]; then
$SWIFT download $RACKSPACE_CLOUDFILES_CONTAINER
else
$SWIFT download $RACKSPACE_CLOUDFILES_CONTAINER $@
fi
}
function swiftstat
{
if [ -z "$1" ]
then
$SWIFT stat
else
$SWIFT stat $RACKSPACE_CLOUDFILES_CONTAINER $1
fi
}
function swifthelp
{
verbose=false
while getopts ":v" opt; do
case $opt in
v)
verbose=true
;;
esac
done
echo
echo "* swiftcontainer - view or set your current container"
echo "* swiftdeletecontainer - Delete a container and all of its contents"
echo "* swiftlistcontainers - lists the containers in CloudFiles"
echo "* swiftlist - lists the items in your default container"
if $verbose ; then
echo "
Usage:
swiftlist -- lists all items
swiftlist <prefix> -- filters by the given prefix
"
fi
echo "* swiftupload - uploads one or more files or directories if their"
echo " contents have changed"
if $verbose ; then
echo "
Usage:
swiftupdload <file_or_directory> [...]
"
fi
echo "* swiftdelete - Deletes one or more items."
if $verbose ; then
echo "
Usage:
swiftdelete <object> [...]
"
fi
echo "* swiftdownload - Downloads one or more files or directories (saving"
echo " to the current directory)"
if $verbose ; then
echo "
Usage:
swiftdownload <object> [...] -- Download one or more specific object
swiftdownload \* -- download every object in the current container
"
fi
echo "* swiftstat - Print the status for the default container or for a"
echo " single object"
if $verbose ; then
echo "
Usage:
swiftstat -- stat for the container
swiftstat <object> -- stat for the given object
"
fi
echo "* swifthelp - Prints this content!"
echo
}
| bradmontgomery/swift_wrapper | swift_wrapper.sh | Shell | mit | 6,134 |
require_dependency "venture/application_controller"
module Venture
class ProjectsController < ApplicationController
before_action :set_project, only: [:show, :edit, :update, :destroy]
# GET /projects
def index
@projects = Project.all
end
# GET /projects/1
def show
end
# GET /projects/new
def new
@project = Project.new
end
# GET /projects/1/edit
def edit
end
# POST /projects
def create
@project = Project.new(project_params)
if @project.save
redirect_to @project, notice: 'Project was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /projects/1
def update
if @project.update(project_params)
redirect_to @project, notice: 'Project was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /projects/1
def destroy
@project.destroy
redirect_to projects_url, notice: 'Project was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_project
@project = Project.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def project_params
params.require(:project).permit(:projectname)
end
end
end
| LaunchU/QuadVenture | app/controllers/venture/projects_controller.rb | Ruby | mit | 1,365 |
#ifndef PANELITEM_HPP
#define PANELITEM_HPP
#include "LevelMakerPanel.hpp"
#include "Button.hpp"
#include "InputString.hpp"
#include "Text.hpp"
class PanelItem : public LevelMakerPanel {
private:
Sprite* sprite_input_mass;
Button* button_input_mass;
lalge::R2Vector input_mass_position;
bool invalid_input_mass;
InputString input_mass;
Text* text_input_mass;
Sprite* sprite_input_elasticity;
Button* button_input_elasticity;
lalge::R2Vector input_elasticity_position;
bool invalid_input_elasticity;
InputString input_elasticity;
Text* text_input_elasticity;
Sprite* sprite_input_value;
Button* button_input_value;
lalge::R2Vector input_value_position;
bool invalid_input_value;
InputString input_value;
Text* text_input_value;
Button* button_time;
lalge::R2Vector button_time_position;
Button* button_point;
lalge::R2Vector button_point_position;
Button* button_life;
lalge::R2Vector button_life_position;
Button* button_mass;
lalge::R2Vector button_mass_position;
Button* button_barrier;
lalge::R2Vector button_barrier_position;
public:
PanelItem();
~PanelItem();
void show();
void hide();
void update();
void render();
private:
void updatePositions();
void handleInputMass(const observer::Event& event, bool& stop);
void handleInputMassButton(const observer::Event& event, bool& stop);
void handleInputElasticity(const observer::Event& event, bool& stop);
void handleInputElasticityButton(const observer::Event& event, bool& stop);
void handleInputValue(const observer::Event& event, bool& stop);
void handleInputValueButton(const observer::Event& event, bool& stop);
void handleTime(const observer::Event& event, bool& stop);
void handlePoint(const observer::Event& event, bool& stop);
void handleLife(const observer::Event& event, bool& stop);
void handleMass(const observer::Event& event, bool& stop);
void handleBarrier(const observer::Event& event, bool& stop);
};
#endif
| matheuscscp/nanotrip | src/PanelItem.hpp | C++ | mit | 1,943 |
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jasmine Spec Runner v2.0.0</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.0.0/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="lib/jasmine-2.0.0/jasmine.css">
<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/boot.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="../src/mikulas.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="spec/MikulasSpec.js"></script>
</head>
<body>
</body>
</html>
| dpskvn/mikulas.js | test/SpecRunner.html | HTML | mit | 801 |
namespace StarsReloaded.Client.ViewModel.Controls
{
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using GalaSoft.MvvmLight.CommandWpf;
using GalaSoft.MvvmLight.Messaging;
using StarsReloaded.Client.Mediation.Messages;
using StarsReloaded.Client.ViewModel.Attributes;
using StarsReloaded.Client.ViewModel.ModelWrappers;
using StarsReloaded.Shared.Model;
public class GalaxyMapPanelViewModel : BaseViewModel
{
#region Private fields
private Galaxy galaxy;
private PlanetWrapper selectedPlanet;
#endregion
#region Constructors
public GalaxyMapPanelViewModel()
{
Messenger.Default.Register<GameStateLoadedMessage>(this, this.OnGameStateLoaded);
this.MapClickCommand = new RelayCommand<MouseButtonEventArgs>(this.MapClick);
if (this.IsInDesignMode)
{
if (this.Galaxy == null)
{
this.Galaxy = DemoData.GenerateGameState().Galaxy;
}
this.MapClick(new Point { X = 50, Y = 50 });
}
}
#endregion
#region Public properties
[DependsUpon(nameof(Galaxy))]
public ObservableCollection<PlanetWrapper> Planets
=> this.Galaxy == null
? new ObservableCollection<PlanetWrapper>()
: new ObservableCollection<PlanetWrapper>(this.Galaxy.Planets.Select(p => new PlanetWrapper(p)));
public Galaxy Galaxy
{
get
{
return this.galaxy;
}
set
{
this.Set(() => this.Galaxy, ref this.galaxy, value);
this.SelectedPlanet = null;
}
}
public PlanetWrapper SelectedPlanet
{
private get
{
return this.selectedPlanet;
}
set
{
this.Set(() => this.SelectedPlanet, ref this.selectedPlanet, value);
Messenger.Default.Send(new PlanetSelectedMessage(value?.Model));
}
}
[DependsUpon(nameof(SelectedPlanet))]
public string SelectedObjectName => this.SelectedPlanet == null ? string.Empty : this.SelectedPlanet.Name;
[DependsUpon(nameof(SelectedPlanet))]
public string SelectedObjectCoords => this.SelectedPlanet == null ? string.Empty : $"[{this.SelectedPlanet.X},{this.SelectedPlanet.Y}]";
[DependsUpon(nameof(SelectedPlanet))]
public int SelectedObjectX => this.SelectedPlanet?.X ?? 0;
[DependsUpon(nameof(SelectedPlanet))]
public int SelectedObjectY => this.SelectedPlanet?.Y ?? 0;
[DependsUpon(nameof(SelectedPlanet))]
public Visibility SelectionArrowVisibility => this.SelectedPlanet != null ? Visibility.Visible : Visibility.Hidden;
[DependsUpon(nameof(Galaxy))]
public int GalaxyWidth => this.Galaxy?.Width ?? 0;
[DependsUpon(nameof(Galaxy))]
public int GalaxyHeight => this.Galaxy?.Height ?? 0;
#endregion
#region Commands
public RelayCommand<MouseButtonEventArgs> MapClickCommand { get; }
#endregion
#region Private methods
private void MapClick(MouseButtonEventArgs e)
{
this.MapClick(e.GetPosition(e.Source as IInputElement));
}
private void MapClick(Point p)
{
var closest = this.Galaxy.Planets.Aggregate(
(curClosest, pl) =>
{
if (curClosest == null)
{
return pl;
}
if (Math.Pow(p.X - pl.X, 2) + Math.Pow(p.Y - pl.Y, 2) < Math.Pow(p.X - curClosest.X, 2) + Math.Pow(p.Y - curClosest.Y, 2))
{
return pl;
}
return curClosest;
});
this.SelectedPlanet = new PlanetWrapper(closest);
}
private void OnGameStateLoaded(GameStateLoadedMessage message)
{
this.Galaxy = message.GameState.Galaxy;
}
#endregion
}
}
| Misza13/StarsReloaded | StarsReloaded.Client.ViewModel/Controls/GalaxyMapPanelViewModel.cs | C# | mit | 4,361 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="sq" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>Vector</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The Vector developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href="https://www.openssl.org/">https://www.openssl.org/</a>) and cryptographic software written by Eric Young (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Klikoni 2 herë për të ndryshuar adressën ose etiketën</translation>
</message>
<message>
<location line="+24"/>
<source>Create a new address</source>
<translation>Krijo një adresë të re</translation>
</message>
<message>
<location line="+10"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopjo adresën e zgjedhur në memorjen e sistemit </translation>
</message>
<message>
<location line="-7"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-43"/>
<source>These are your Vector addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign a message to prove you own a Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Verify a message to ensure it was signed with a specified Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Delete</source>
<translation>&Fshi</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+66"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+248"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Skedar i ndarë me pikëpresje(*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+145"/>
<source>Label</source>
<translation>Etiketë</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(pa etiketë)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Futni frazkalimin</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Frazkalim i ri</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Përsërisni frazkalimin e ri</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+38"/>
<source>Encrypt wallet</source>
<translation>Enkripto portofolin</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Ky veprim ka nevojë per frazkalimin e portofolit tuaj që të ç'kyç portofolin.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>ç'kyç portofolin.</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Ky veprim kërkon frazkalimin e portofolit tuaj që të dekriptoj portofolin.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dekripto portofolin</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Ndrysho frazkalimin</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Futni frazkalimin e vjetër dhe të ri në portofol. </translation>
</message>
<message>
<location line="+45"/>
<source>Confirm wallet encryption</source>
<translation>Konfirmoni enkriptimin e portofolit</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Portofoli u enkriptua</translation>
</message>
<message>
<location line="-140"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Vector will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Enkriptimi i portofolit dështoi</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Enkriptimi i portofolit dështoi për shkak të një gabimi të brëndshëm. portofoli juaj nuk u enkriptua.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>Frazkalimet e plotësuara nuk përputhen.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>ç'kyçja e portofolit dështoi</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Frazkalimi i futur për dekriptimin e portofolit nuk ishte i saktë.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Dekriptimi i portofolit dështoi</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+297"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Show general overview of wallet</source>
<translation>Trego një përmbledhje te përgjithshme të portofolit</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transaksionet</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Shfleto historinë e transaksioneve</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Mbyllni aplikacionin</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opsione</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-55"/>
<source>Send coins to a Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source>Modify configuration options for Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Ndrysho frazkalimin e përdorur per enkriptimin e portofolit</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-214"/>
<location line="+555"/>
<source>Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-555"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>&About Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>&File</source>
<translation>&Skedar</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>&Konfigurimet</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&Ndihmë</translation>
</message>
<message>
<location line="+17"/>
<source>Tabs toolbar</source>
<translation>Shiriti i mjeteve</translation>
</message>
<message>
<location line="+46"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[testo rrjetin]</translation>
</message>
<message>
<location line="+0"/>
<location line="+58"/>
<source>Vector client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+70"/>
<source>%n active connection(s) to Vector network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+488"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-812"/>
<source>&Dashboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+277"/>
<source>Up to date</source>
<translation>I azhornuar</translation>
</message>
<message>
<location line="+43"/>
<source>Catching up...</source>
<translation>Duke u azhornuar...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Dërgo transaksionin</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Transaksion në ardhje</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid Vector address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Wallet is <b>not encrypted</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Portofoli po <b> enkriptohet</b> dhe është <b> i ç'kyçur</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Portofoli po <b> enkriptohet</b> dhe është <b> i kyçur</b></translation>
</message>
<message>
<location line="+24"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+91"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+433"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="-456"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+27"/>
<location line="+433"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+6"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+0"/>
<source>%1 and %2</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+0"/>
<source>%n year(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+324"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+104"/>
<source>A fatal error occurred. Vector can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+110"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+537"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-500"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(pa etiketë)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Ndrysho Adresën</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etiketë</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresa</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Adresë e re pritëse</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Adresë e re dërgimi</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Ndrysho adresën pritëse</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>ndrysho adresën dërguese</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Adresa e dhënë "%1" është e zënë në librin e adresave. </translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Vector address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Nuk mund të ç'kyçet portofoli.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Krijimi i çelësit të ri dështoi.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+426"/>
<location line="+12"/>
<source>Vector-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opsionet</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start Vector after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start Vector on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Vector client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Connect to the Vector network through a SOCKS5 proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS5 proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+90"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Vector.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show coin control features or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Whether to select the coin outputs randomly or with minimal coin age.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Minimize weight consumption (experimental)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use black visual theme (requires restart)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+47"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+148"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Vector.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Formilarë</translation>
</message>
<message>
<location line="+46"/>
<location line="+247"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Vector network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-173"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-113"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Total:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source><b>Recent transactions</b></source>
<translation><b>Transaksionet e fundit</b></translation>
</message>
<message>
<location line="-118"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-32"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start vector: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-194"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+197"/>
<source>&Network Traffic</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Clear</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Totals</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>In:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<source>Out:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-383"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the Vector-Qt help message to get a list with possible Vector command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-237"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>Vector - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Vector Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+256"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the Vector debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="+325"/>
<source>Welcome to the Vector RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+127"/>
<source>%1 B</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 KB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 MB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 GB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>%1 m</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>%1 h</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 h %2 m</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Dërgo Monedha</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Dërgo marrësve të ndryshëm njëkohësisht</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Balance:</source>
<translation>Balanca:</translation>
</message>
<message>
<location line="+47"/>
<source>Confirm the send action</source>
<translation>Konfirmo veprimin e dërgimit</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-174"/>
<source>Enter a Vector address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+87"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>konfirmo dërgimin e monedhave</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Shuma e paguar duhet të jetë më e madhe se 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+247"/>
<source>WARNING: Invalid Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(pa etiketë)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Sh&uma:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Paguaj &drejt:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Krijoni një etiketë për këtë adresë që t'ja shtoni librit të adresave</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Etiketë:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Ngjit nga memorja e sistemit</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Vector address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Ngjit nga memorja e sistemit</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Vector address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter Vector signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+85"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
<message>
<location filename="../trafficgraphwidget.cpp" line="+75"/>
<source>KB/s</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+25"/>
<source>Open until %1</source>
<translation>Hapur deri më %1</translation>
</message>
<message>
<location line="+6"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/I pakonfirmuar</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 konfirmimet</translation>
</message>
<message>
<location line="+17"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+13"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+19"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-202"/>
<source>, has not been successfully broadcast yet</source>
<translation>, nuk është transmetuar me sukses deri tani</translation>
</message>
<message numerus="yes">
<location line="-36"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+67"/>
<source>unknown</source>
<translation>i/e panjohur</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Detajet e transaksionit</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Ky panel tregon një përshkrim të detajuar të transaksionit</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+231"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Lloji</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+52"/>
<source>Open until %1</source>
<translation>Hapur deri më %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>I/E konfirmuar(%1 konfirmime)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Ky bllok është marrë nga ndonjë nyje dhe ka shumë mundësi të mos pranohet! </translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>I krijuar por i papranuar</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Marrë me</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Dërguar drejt</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pagesë ndaj vetvetes</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Minuar</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(p/a)</translation>
</message>
<message>
<location line="+194"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+54"/>
<location line="+17"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Received with</source>
<translation>Marrë me</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Dërguar drejt</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Minuar</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+138"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Skedar i ndarë me pikëpresje(*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Lloji</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etiketë</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+212"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+171"/>
<source>Vector version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or vectord</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-145"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: vector.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: vectord.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=vectorrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Vector Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Listen for connections on <port> (default: 1715 or testnet: 11715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Always query for peer addresses via DNS lookup (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-35"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+62"/>
<source>Listen for JSON-RPC connections on <port> (default: 1716 or testnet: 11716)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-103"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Vector will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-89"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+30"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-41"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+54"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-52"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-59"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-47"/>
<source>Connect through SOCKS5 proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Output debugging information (default: 0, supplying <category> is optional)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>If <category> is not supplied, output all debugging information.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source><category> can be:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wait for RPC server to start</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external VEC000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Keep at most <n> MiB of unconnectable blocks in memory (default: %u)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Initialization sanity check failed. Vector is shutting down.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-168"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+104"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-129"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+125"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart Vector to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-22"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+58"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-40"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-109"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+124"/>
<source>Unable to bind to %s on this computer. Vector is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-101"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<source>Minimize weight consumption (experimental) (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>How many blocks to check at startup (default: 500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Deprecated argument -debugnet ignored, use -debug=net</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Vector is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-159"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+186"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | vectorcoindev/Vector | src/qt/locale/bitcoin_sq.ts | TypeScript | mit | 110,078 |
<?php
return [
'ctrl' => [
'type' => 'type',
'title' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler',
'label' => 'style_option',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'versioningWS' => true,
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'style_option,string_value,int_value,float_value,bool_value',
'iconfile' => 'EXT:sd_googlemaps/Resources/Public/Icons/tx_sdgooglemaps_domain_model_styler.gif',
''
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, string_value, int_value, float_value, bool_value',
],
'types' => [
'0' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
'string' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, string_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
'int' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, int_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
'float' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, float_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
'bool' => ['showitem' => 'type, sys_language_uid, l10n_parent, l10n_diffsource, hidden, style_option, bool_value, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
],
'columns' => [
'sys_language_uid' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
]
],
'default' => 0,
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 0],
],
'foreign_table' => 'tx_sdgooglemaps_domain_model_styler',
'foreign_table_where' => 'AND tx_sdgooglemaps_domain_model_styler.pid=###CURRENT_PID### AND tx_sdgooglemaps_domain_model_styler.sys_language_uid IN (-1,0)',
],
],
'l10n_diffsource' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
],
],
'hidden' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
],
],
],
'starttime' => [
'exclude' => true,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'eval' => 'datetime',
'default' => 0,
],
],
'endtime' => [
'exclude' => true,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'eval' => 'datetime',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
],
],
],
'type' => [
'exclude' => true,
'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.type',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'eval' => 'trim,required',
'items' => [
['Default', ''],
['String', 'string'],
['Integer', 'int'],
['Float', 'float'],
['Boolean', 'bool']
],
],
],
'style_option' => [
'exclude' => true,
'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.style_option',
'config' => [
'type' => 'select',
'eval' => 'trim,required',
'itemsProcFunc' => 'SD\SdGooglemaps\Hooks\ItemsProcFunc->user_styleOptions'
],
],
'string_value' => [
'exclude' => true,
'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.string_value',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required'
],
],
'int_value' => [
'exclude' => true,
'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.int_value',
'config' => [
'type' => 'input',
'size' => 4,
'eval' => 'int,required'
]
],
'float_value' => [
'exclude' => true,
'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.float_value',
'config' => [
'type' => 'input',
'size' => 4,
'eval' => 'double2,required'
]
],
'bool_value' => [
'exclude' => true,
'label' => 'LLL:EXT:sd_googlemaps/Resources/Private/Language/locallang_db.xlf:tx_sdgooglemaps_domain_model_styler.bool_value',
'config' => [
'type' => 'check',
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
],
'default' => 0,
]
],
],
];
| daviian/sd_googlemaps | Configuration/TCA/tx_sdgooglemaps_domain_model_styler.php | PHP | mit | 5,995 |
# Logo interpreter 🐢
[](#)
[](https://twitter.com/wojteklu)
>An interpreter is a computer program that directly executes instructions written in a programming or scripting language, without previously compiling them into a machine language program.
A Logo interpreter written entirely in Swift. Curretly supports logo syntax with basic builtin commands such as `forward`, `back`, `left`, `right`. The language reference
and very basics of how it works are described in my [blog post ](https://wojteklu.com/post/writing-a-logo-interpreter/). You can play with interpreter using created [macOS app](https://github.com/wojteklu/logo/releases).
<p align="center">
<img src="logo_ide.png" width="600px"/>
</p>
Furthermore repository contains playground with samples below. Have fun! 🐢.
<p align="center">
<img src="logo.gif" width="600px style='border:1px solid #ff000'"/>
</p>
## Contributing
I’d love to see your ideas for improving this! The best way to contribute is by submitting a pull request. I’ll do my best to respond to your patch as soon as possible. You can also submit a [new GitHub issue](https://github.com/wojteklu/logo/issues/new) if you find bugs or have questions.
## Author
Wojtek Lukaszuk [@wojteklu](http://twitter.com/wojteklu)
## License
This project is licensed under the terms of the MIT license. See the license file. | wojteklu/logo | README.md | Markdown | mit | 1,520 |
FILE(REMOVE_RECURSE
"CMakeFiles/linearstructure_5.dir/linearstructure.cpp.o"
"linearstructure_5.pdb"
"linearstructure_5"
)
# Per-language clean rules from dependency scanning.
FOREACH(lang CXX)
INCLUDE(CMakeFiles/linearstructure_5.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)
| cmeon/Simplex | lib/test/CMakeFiles/linearstructure_5.dir/cmake_clean.cmake | CMake | mit | 297 |
class DataControl {
constructor() {
this.appData
updateData()
}
updateData() {
this.appData = fetcherama()
}
fetcherama() {
lib.fetch(`http://localhost:8080/api/class/getNearbyClasses/${coor.long}/${coor.lat}`, opt, data => {
if (data.success === true) {
return data.classes
}
})
}
}
export default DataControl
| andrewgremlich/presence-keeper | pk_static_files_server/app/js/util/DataControl.js | JavaScript | mit | 369 |
// ********************************************************* //
// The content of this file is auto-generated, DO NOT MODIFY //
// ********************************************************* //
package jarr
func CondString(c bool, t, f string) string {
if c {
return t
} else {
return f
}
}
func CondInt(c bool, t, f int) int {
if c {
return t
} else {
return f
}
}
func CondUint(c bool, t, f uint) uint {
if c {
return t
} else {
return f
}
}
func CondInt8(c bool, t, f int8) int8 {
if c {
return t
} else {
return f
}
}
func CondUint8(c bool, t, f uint8) uint8 {
if c {
return t
} else {
return f
}
}
func CondInt16(c bool, t, f int16) int16 {
if c {
return t
} else {
return f
}
}
func CondUint16(c bool, t, f uint16) uint16 {
if c {
return t
} else {
return f
}
}
func CondInt32(c bool, t, f int32) int32 {
if c {
return t
} else {
return f
}
}
func CondUint32(c bool, t, f uint32) uint32 {
if c {
return t
} else {
return f
}
}
func CondInt64(c bool, t, f int64) int64 {
if c {
return t
} else {
return f
}
}
func CondUint64(c bool, t, f uint64) uint64 {
if c {
return t
} else {
return f
}
}
func CondBool(c bool, t, f bool) bool {
if c {
return t
} else {
return f
}
}
func CondRune(c bool, t, f rune) rune {
if c {
return t
} else {
return f
}
}
func ReverseString(slice []string) []string {
l := len(slice)
r := make([]string, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseInt(slice []int) []int {
l := len(slice)
r := make([]int, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseUint(slice []uint) []uint {
l := len(slice)
r := make([]uint, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseInt8(slice []int8) []int8 {
l := len(slice)
r := make([]int8, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseUint8(slice []uint8) []uint8 {
l := len(slice)
r := make([]uint8, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseInt16(slice []int16) []int16 {
l := len(slice)
r := make([]int16, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseUint16(slice []uint16) []uint16 {
l := len(slice)
r := make([]uint16, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseInt32(slice []int32) []int32 {
l := len(slice)
r := make([]int32, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseUint32(slice []uint32) []uint32 {
l := len(slice)
r := make([]uint32, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseInt64(slice []int64) []int64 {
l := len(slice)
r := make([]int64, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseUint64(slice []uint64) []uint64 {
l := len(slice)
r := make([]uint64, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseBool(slice []bool) []bool {
l := len(slice)
r := make([]bool, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
func ReverseRune(slice []rune) []rune {
l := len(slice)
r := make([]rune, l)
for i, e := range slice {
r[l-i-1] = e
}
return r
}
| badugisoft/jarr | jarr.gen.go | GO | mit | 3,182 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>nx.graphic - Next UI Toolkit</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http://abdvl.github.io/src/bin/logo.svg" title="Next UI Toolkit"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 0.9.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/nx.html">nx</a></li>
<li><a href="../classes/nx.data.Collection.html">nx.data.Collection</a></li>
<li><a href="../classes/nx.data.Convex.html">nx.data.Convex</a></li>
<li><a href="../classes/nx.data.Counter.html">nx.data.Counter</a></li>
<li><a href="../classes/nx.data.Dictionary.html">nx.data.Dictionary</a></li>
<li><a href="../classes/nx.data.Edge.html">nx.data.Edge</a></li>
<li><a href="../classes/nx.data.EdgeSet.html">nx.data.EdgeSet</a></li>
<li><a href="../classes/nx.data.EdgeSetCollection.html">nx.data.EdgeSetCollection</a></li>
<li><a href="../classes/nx.data.Force.html">nx.data.Force</a></li>
<li><a href="../classes/nx.data.nx.dom.Document.html">nx.data.nx.dom.Document</a></li>
<li><a href="../classes/nx.data.nx.dom.Element.html">nx.data.nx.dom.Element</a></li>
<li><a href="../classes/nx.data.nx.dom.Fragment.html">nx.data.nx.dom.Fragment</a></li>
<li><a href="../classes/nx.data.nx.dom.Node.html">nx.data.nx.dom.Node</a></li>
<li><a href="../classes/nx.data.nx.dom.Text.html">nx.data.nx.dom.Text</a></li>
<li><a href="../classes/nx.data.nx.Env.html">nx.data.nx.Env</a></li>
<li><a href="../classes/nx.data.nx.Util.html">nx.data.nx.Util</a></li>
<li><a href="../classes/nx.data.ObservableCollection.html">nx.data.ObservableCollection</a></li>
<li><a href="../classes/nx.data.ObservableDictionary.html">nx.data.ObservableDictionary</a></li>
<li><a href="../classes/nx.data.ObservableGraph.html">nx.data.ObservableGraph</a></li>
<li><a href="../classes/nx.data.ObservableGraph.ForceProcessor.html">nx.data.ObservableGraph.ForceProcessor</a></li>
<li><a href="../classes/nx.data.ObservableObject.html">nx.data.ObservableObject</a></li>
<li><a href="../classes/nx.data.Query.html">nx.data.Query</a></li>
<li><a href="../classes/nx.data.SortedMap.html">nx.data.SortedMap</a></li>
<li><a href="../classes/nx.data.Vertex.html">nx.data.Vertex</a></li>
<li><a href="../classes/nx.data.VertexSet.html">nx.data.VertexSet</a></li>
<li><a href="../classes/nx.geometry.BezierCurve.html">nx.geometry.BezierCurve</a></li>
<li><a href="../classes/nx.geometry.Line.html">nx.geometry.Line</a></li>
<li><a href="../classes/nx.geometry.Math.html">nx.geometry.Math</a></li>
<li><a href="../classes/nx.geometry.Matrix.html">nx.geometry.Matrix</a></li>
<li><a href="../classes/nx.geometry.Vector.html">nx.geometry.Vector</a></li>
<li><a href="../classes/nx.graphic.Arc.html">nx.graphic.Arc</a></li>
<li><a href="../classes/nx.graphic.BezierCurves.html">nx.graphic.BezierCurves</a></li>
<li><a href="../classes/nx.graphic.Circle.html">nx.graphic.Circle</a></li>
<li><a href="../classes/nx.graphic.Group.html">nx.graphic.Group</a></li>
<li><a href="../classes/nx.graphic.Icon.html">nx.graphic.Icon</a></li>
<li><a href="../classes/nx.graphic.Icons.html">nx.graphic.Icons</a></li>
<li><a href="../classes/nx.graphic.Image.html">nx.graphic.Image</a></li>
<li><a href="../classes/nx.graphic.Line.html">nx.graphic.Line</a></li>
<li><a href="../classes/nx.graphic.LinkSetTooltipContent.html">nx.graphic.LinkSetTooltipContent</a></li>
<li><a href="../classes/nx.graphic.LinkTooltipContent.html">nx.graphic.LinkTooltipContent</a></li>
<li><a href="../classes/nx.graphic.NodeTooltipContent.html">nx.graphic.NodeTooltipContent</a></li>
<li><a href="../classes/nx.graphic.Path.html">nx.graphic.Path</a></li>
<li><a href="../classes/nx.graphic.Polygon.html">nx.graphic.Polygon</a></li>
<li><a href="../classes/nx.graphic.Rect.html">nx.graphic.Rect</a></li>
<li><a href="../classes/nx.graphic.Stage.html">nx.graphic.Stage</a></li>
<li><a href="../classes/nx.graphic.Text.html">nx.graphic.Text</a></li>
<li><a href="../classes/nx.graphic.Topology.html">nx.graphic.Topology</a></li>
<li><a href="../classes/nx.graphic.Topology.AbstractLink.html">nx.graphic.Topology.AbstractLink</a></li>
<li><a href="../classes/nx.graphic.Topology.AbstractNode.html">nx.graphic.Topology.AbstractNode</a></li>
<li><a href="../classes/nx.graphic.Topology.BasePath.html">nx.graphic.Topology.BasePath</a></li>
<li><a href="../classes/nx.graphic.Topology.Categories.html">nx.graphic.Topology.Categories</a></li>
<li><a href="../classes/nx.graphic.Topology.CircleGroup.html">nx.graphic.Topology.CircleGroup</a></li>
<li><a href="../classes/nx.graphic.Topology.Config.html">nx.graphic.Topology.Config</a></li>
<li><a href="../classes/nx.graphic.Topology.DefaultScene.html">nx.graphic.Topology.DefaultScene</a></li>
<li><a href="../classes/nx.graphic.Topology.Event.html">nx.graphic.Topology.Event</a></li>
<li><a href="../classes/nx.graphic.Topology.Graph.html">nx.graphic.Topology.Graph</a></li>
<li><a href="../classes/nx.graphic.Topology.GroupItem.html">nx.graphic.Topology.GroupItem</a></li>
<li><a href="../classes/nx.graphic.Topology.GroupsLayer.html">nx.graphic.Topology.GroupsLayer</a></li>
<li><a href="../classes/nx.graphic.Topology.Layer.html">nx.graphic.Topology.Layer</a></li>
<li><a href="../classes/nx.graphic.Topology.LayoutMixin.html">nx.graphic.Topology.LayoutMixin</a></li>
<li><a href="../classes/nx.graphic.Topology.Link.html">nx.graphic.Topology.Link</a></li>
<li><a href="../classes/nx.graphic.Topology.LinkMixin.html">nx.graphic.Topology.LinkMixin</a></li>
<li><a href="../classes/nx.graphic.Topology.LinkSet.html">nx.graphic.Topology.LinkSet</a></li>
<li><a href="../classes/nx.graphic.Topology.LinksLayer.html">nx.graphic.Topology.LinksLayer</a></li>
<li><a href="../classes/nx.graphic.Topology.NeXtForceLayout.html">nx.graphic.Topology.NeXtForceLayout</a></li>
<li><a href="../classes/nx.graphic.Topology.Node.html">nx.graphic.Topology.Node</a></li>
<li><a href="../classes/nx.graphic.Topology.NodeMixin.html">nx.graphic.Topology.NodeMixin</a></li>
<li><a href="../classes/nx.graphic.Topology.NodeSet.html">nx.graphic.Topology.NodeSet</a></li>
<li><a href="../classes/nx.graphic.Topology.NodeSetPath.html">nx.graphic.Topology.NodeSetPath</a></li>
<li><a href="../classes/nx.graphic.Topology.NodesLayer.html">nx.graphic.Topology.NodesLayer</a></li>
<li><a href="../classes/nx.graphic.Topology.Path.html">nx.graphic.Topology.Path</a></li>
<li><a href="../classes/nx.graphic.Topology.PathLayer.html">nx.graphic.Topology.PathLayer</a></li>
<li><a href="../classes/nx.graphic.Topology.PolygonGroup.html">nx.graphic.Topology.PolygonGroup</a></li>
<li><a href="../classes/nx.graphic.Topology.RectGroup.html">nx.graphic.Topology.RectGroup</a></li>
<li><a href="../classes/nx.graphic.Topology.Scene.html">nx.graphic.Topology.Scene</a></li>
<li><a href="../classes/nx.graphic.Topology.SceneMixin.html">nx.graphic.Topology.SceneMixin</a></li>
<li><a href="../classes/nx.graphic.Topology.SelectionNodeScene.html">nx.graphic.Topology.SelectionNodeScene</a></li>
<li><a href="../classes/nx.graphic.Topology.SelectionScene.html">nx.graphic.Topology.SelectionScene</a></li>
<li><a href="../classes/nx.graphic.Topology.StageMixin.html">nx.graphic.Topology.StageMixin</a></li>
<li><a href="../classes/nx.graphic.Topology.Tooltip.html">nx.graphic.Topology.Tooltip</a></li>
<li><a href="../classes/nx.graphic.Topology.TooltipManager.html">nx.graphic.Topology.TooltipManager</a></li>
<li><a href="../classes/nx.graphic.Topology.TooltipMixin.html">nx.graphic.Topology.TooltipMixin</a></li>
<li><a href="../classes/nx.graphic.Topology.TooltipPolicy.html">nx.graphic.Topology.TooltipPolicy</a></li>
<li><a href="../classes/nx.graphic.Topology.USMapLayout.html">nx.graphic.Topology.USMapLayout</a></li>
<li><a href="../classes/nx.graphic.Topology.ZoomBySelection.html">nx.graphic.Topology.ZoomBySelection</a></li>
<li><a href="../classes/nx.graphic.Triangle.html">nx.graphic.Triangle</a></li>
<li><a href="../classes/nx.Iterable.html">nx.Iterable</a></li>
<li><a href="../classes/nx.Object.html">nx.Object</a></li>
<li><a href="../classes/nx.Observable.html">nx.Observable</a></li>
<li><a href="../classes/nx.ui.Application.html">nx.ui.Application</a></li>
<li><a href="../classes/nx.ui.Collection.html">nx.ui.Collection</a></li>
<li><a href="../classes/nx.ui.Component.html">nx.ui.Component</a></li>
<li><a href="../classes/nx.ui.CssClass.html">nx.ui.CssClass</a></li>
<li><a href="../classes/nx.ui.CssStyle.html">nx.ui.CssStyle</a></li>
<li><a href="../classes/nx.ui.DOMComponent.html">nx.ui.DOMComponent</a></li>
<li><a href="../classes/nx.ui.nx.graphic.Component.html">nx.ui.nx.graphic.Component</a></li>
<li><a href="../classes/nx.ui.nx.graphic.DragManager.html">nx.ui.nx.graphic.DragManager</a></li>
<li><a href="../classes/nx.ui.nx.widget.ZIndexManager.html">nx.ui.nx.widget.ZIndexManager</a></li>
<li><a href="../classes/nx.ui.Popover.html">nx.ui.Popover</a></li>
<li><a href="../classes/nx.ui.Popup.html">nx.ui.Popup</a></li>
<li><a href="../classes/nx.ui.PopupContainer.html">nx.ui.PopupContainer</a></li>
<li><a href="../classes/nxex.toolkit.collection.CollectionRelation.html">nxex.toolkit.collection.CollectionRelation</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/nx.html">nx</a></li>
<li><a href="../modules/nx.data.html">nx.data</a></li>
<li><a href="../modules/nx.geometry.html">nx.geometry</a></li>
<li><a href="../modules/nx.graphic.html">nx.graphic</a></li>
<li><a href="../modules/nx.graphic.Topology.html">nx.graphic.Topology</a></li>
<li><a href="../modules/nx.graphic.Topology.Group.html">nx.graphic.Topology.Group</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1>nx.graphic Module</h1>
<div class="box clearfix meta">
<div class="foundat">
Defined in: <a href="../files/target_next_js_next.js.html#l11390"><code>target/next/js/next.js:11390</code></a>
</div>
</div>
<div class="box intro">
<p>Base class of graphic component</p>
</div>
<div class="yui3-g">
<div class="yui3-u-1-2">
<p>This module provides the following classes:</p>
<ul class="module-classes">
<li class="module-class">
<a href="../classes/nx.geometry.BezierCurve.html">
nx.geometry.BezierCurve
</a>
</li>
<li class="module-class">
<a href="../classes/nx.geometry.Math.html">
nx.geometry.Math
</a>
</li>
<li class="module-class">
<a href="../classes/nx.geometry.Matrix.html">
nx.geometry.Matrix
</a>
</li>
<li class="module-class">
<a href="../classes/nx.geometry.Vector.html">
nx.geometry.Vector
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Arc.html">
nx.graphic.Arc
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.BezierCurves.html">
nx.graphic.BezierCurves
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Circle.html">
nx.graphic.Circle
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Group.html">
nx.graphic.Group
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Icon.html">
nx.graphic.Icon
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Icons.html">
nx.graphic.Icons
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Image.html">
nx.graphic.Image
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Line.html">
nx.graphic.Line
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Path.html">
nx.graphic.Path
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Polygon.html">
nx.graphic.Polygon
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Rect.html">
nx.graphic.Rect
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Stage.html">
nx.graphic.Stage
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Text.html">
nx.graphic.Text
</a>
</li>
<li class="module-class">
<a href="../classes/nx.graphic.Triangle.html">
nx.graphic.Triangle
</a>
</li>
<li class="module-class">
<a href="../classes/nx.ui.nx.graphic.Component.html">
nx.ui.nx.graphic.Component
</a>
</li>
</ul>
</div>
<div class="yui3-u-1-2">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
| ericgreen/topology | app-ui/next/doc/modules/nx.graphic.html | HTML | mit | 19,999 |
package cmd
import (
"github.com/spf13/cobra"
"github.com/topfreegames/khan/loadtest"
"github.com/topfreegames/khan/log"
"github.com/uber-go/zap"
)
var sharedClansFile string
var nGoroutines int
var loadtestCmd = &cobra.Command{
Use: "loadtest",
Short: "runs a load test against a remote Khan API",
Long: `Runs a load test against a remote Khan API with the specified arguments.
You can use environment variables to override configuration keys.`,
Run: func(cmd *cobra.Command, args []string) {
loadtest.LoadRandomWords()
logger := zap.New(zap.NewJSONEncoder(), zap.InfoLevel)
exitChannel := make(chan bool)
routine := func() {
logger := logger.With(
zap.String("source", "cmd/loadtest.go"),
zap.String("operation", "loadtestCmd.Run/goroutine"),
)
app := loadtest.GetApp(ConfigFile, sharedClansFile, logger)
if err := app.Run(); err != nil {
log.E(logger, "Goroutine exited with error. Restarting...", func(cm log.CM) {
cm.Write(zap.String("error", err.Error()))
})
exitChannel <- false
} else {
log.I(logger, "Goroutine exited without errors.")
exitChannel <- true
}
}
for i := 0; i < nGoroutines; i++ {
go routine()
}
for i := 0; i < nGoroutines; {
if ok := <-exitChannel; ok {
i++
} else {
go routine()
}
}
logger = logger.With(
zap.String("source", "cmd/loadtest.go"),
zap.String("operation", "loadtestCmd.Run"),
)
log.I(logger, "Application exited.")
},
}
func init() {
RootCmd.AddCommand(loadtestCmd)
loadtestCmd.Flags().StringVar(
&sharedClansFile,
"clans",
"./config/loadTestSharedClans.yaml",
"shared clans list for load test",
)
loadtestCmd.Flags().IntVar(
&nGoroutines,
"goroutines",
1,
"number of goroutines to spawn for concurrent load tests",
)
}
| topfreegames/khan | cmd/loadtest.go | GO | mit | 1,802 |
<?php
if(!defined('ROOT')) exit('No direct script access allowed');
$dashboard=getConfig("DASHBOARD_PAGE");
?>
<div id="workspace" style='display:none;overflow:hidden;width: 100%;height: 100%;'>
<ul>
<?php if(strlen($dashboard)>0) { ?>
<li><a href='#dashboard'>Dashboard</a></li>
<?php } ?>
</ul>
<?php if(strlen($dashboard)>0) { ?>
<div id="dashboard" class="unclosable" style="overflow:hidden;width:100%;height:100%;">
<iframe id="dashboardframe" src="<?=generatePageRequest($dashboard,"")?>" style="width:100%;height:100%;margin:0px;padding:0px;" frameborder=0>
</iframe>
</div>
<?php } ?>
</div>
<a class='workspaceclose' onclick="closeCurrentTab()"> X</a>
<script language=javascript>
var $tabs=null;
var resizePageTimer=null;
var sitepath="<?=generatePageRequest("","")?>";
function resizePageUI() {
$("#dashboard").css("height",($("#content").height()-28)+"px");
$("#workspace .iframetab").css("height",$("#dashboard").height());
}
$(function() {
$(window).bind('resize', function() {
if (resizePageTimer) {
clearTimeout(resizePageTimer);
}
resizePageTimer=setTimeout(resizePageUI, 100);
});
setTimeout(function() {
resizePageUI();
$("#workspace").show();
}, 120);
$tabs = $("#workspace").tabs({
ajaxOptions:{
beforeSend:function() {
return false;
},
},
tabTemplate: "<li><a class='tabref' href='x' rel='#{href}'>#{label}</a> <span class='ui-icon ui-icon-closethick'>Remove Tab</span></li>",
spinner: 'Loading ...',
//fx: {},//opacity: 'toggle'
crossDomain:false,
cache:true,
add: function( event, ui ) {
//$( ui.panel ).append( "<p>" + tab_content + "</p>" );
$tabs.tabs('select', '#' + ui.panel.id);
loadTabFrame('#' + ui.panel.id,$("#workspace .tabref[href=#"+ui.panel.id+"]").attr("rel"));
},
select: function(event, ui) {
var url = $.data(ui.tab, 'load.tabs');
return true;
},
load: function(event, ui) {
//Keep links, form submissions, etc. contained within the tab
//$(ui.panel).hijack();
return false;
}
});
//$tabs.find( ".ui-tabs-nav" ).sortable({ axis: "x" }).disableSelection();
$("#workspace").delegate("span.ui-icon-close,span.ui-icon-closethick","click",function() {
var index = $( "li", $tabs ).index( $( this ).parent() );
closeTab(index);
});
});
function indexOfTab(url) {
var links = $("#workspace > ul").find("li a");
for(i=0;i<links.length;i++) {
var lnk = $.data(links[i], 'load.tabs');
if(lnk==url) return i;
}
return -1;
}
function closeTab(index) {
if(!$($tabs.find(">div")[index]).hasClass("unclosable")) {
$tabs.tabs("remove",index);
return true;
} else {
return false;
}
//if(index==0) return false;
//$tabs.tabs( "remove",index);
}
function closeCurrentTab() {
var n = $tabs.tabs('option', 'selected');
closeTab(n);
}
function openInNewTab(title, url) {
if(indexOfTab(url)>=0) {
$tabs.tabs("select",indexOfTab(url));
return;
}
if(!(url.indexOf("http:")>=0) && !(url.indexOf("https:")>=0)) {
if(!(url.indexOf("?")>=0)) {
url=sitepath+"&"+url;
} else {
url=SiteLocation+url;
}
}
$tabs.tabs("add", url, title );
$("a.tabref").click(function(event) {
loadTabFrame($(this).attr("href"),$(this).attr("rel"));
});
$("#workspace div.ui-tabs-panel").each(function() {
if($(this).html().length<=0) $(this).detach();
});
}
function openInCurrentTab(url) {
var n = $tabs.tabs('option', 'selected');
$tabs.tabs("url", n,url);
$tabs.tabs("load", n);
$tabs.tabs("select",n);
}
function loadTabFrame(tab, url) {
if ($(tab).find("iframe").length == 0) {
var html = [];
//html.push('<div class="tabIframeWrapper">');
html.push('<iframe class="iframetab" src="' + url + '" width=100% height=100% frameborder=0 style="padding:0px;border:0px;">Load Failed?</iframe>');
//html.push('</div>');
$(tab).append(html.join(""));
$(tab).find("iframe").height($("#dashboard").height());
}
return false;
}
</script>
<style>
.iframetab {
width:100%;
border:0px;
margin:0px;
padding:0px;
margin-top:0px;
}
#workspace div.ui-tabs-panel.ui-widget-content {
border:0px;
}
</style>
| LogiksPlugins/tabbedspace | index.php | PHP | mit | 4,102 |
package cn.cloudself.dao;
import cn.cloudself.model.AppJiyoujiaHeadEntity;
import cn.cloudself.model.IntegerEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import java.util.List;
/**
* @author HerbLuo
* @version 1.0.0.d
* <p>
* change logs:
* 2017/5/19 HerbLuo 首次创建
*/
public interface IAppJiyoujiaHeadDao extends Repository<AppJiyoujiaHeadEntity, Integer> {
List<AppJiyoujiaHeadEntity> getDoubleColumn(int start, int length);
/**
* Max of 各类型(type 放置于左边还是右边)的记录数
* 如:type为0的记录数有3个,type为1的记录数有4个,返回结果就为4
*/
IntegerEntity maxCountOfDoubleColumn();
Page<AppJiyoujiaHeadEntity> findByType(byte type, Pageable pageable);
}
| HerbLuo/shop-api | src/main/java/cn/cloudself/dao/IAppJiyoujiaHeadDao.java | Java | mit | 887 |
#include "signverifymessagedialog.h"
#include "ui_signverifymessagedialog.h"
#include "addressbookpage.h"
#include "base58.h"
#include "guiutil.h"
#include "init.h"
#include "main.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include "wallet.h"
#include <string>
#include <vector>
#include <QClipboard>
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SignVerifyMessageDialog),
model(0)
{
ui->setupUi(this);
#if (QT_VERSION >= 0x040700)
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
ui->addressIn_SM->setPlaceholderText(tr("Enter a Synapse address (e.g. XsyikK1pALjkLwYTnJSJMu2VHUmP5nJWfR)"));
ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature"));
ui->addressIn_VM->setPlaceholderText(tr("Enter a Synapse address (e.g. XsyikK1pALjkLwYTnJSJMu2VHUmP5nJWfR)"));
ui->signatureIn_VM->setPlaceholderText(tr("Enter Synapse signature"));
#endif
GUIUtil::setupAddressWidget(ui->addressIn_SM, this);
GUIUtil::setupAddressWidget(ui->addressIn_VM, this);
ui->addressIn_SM->installEventFilter(this);
ui->messageIn_SM->installEventFilter(this);
ui->signatureOut_SM->installEventFilter(this);
ui->addressIn_VM->installEventFilter(this);
ui->messageIn_VM->installEventFilter(this);
ui->signatureIn_VM->installEventFilter(this);
ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont());
ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont());
}
SignVerifyMessageDialog::~SignVerifyMessageDialog()
{
delete ui;
}
void SignVerifyMessageDialog::setModel(WalletModel *model)
{
this->model = model;
}
void SignVerifyMessageDialog::setAddress_SM(QString address)
{
ui->addressIn_SM->setText(address);
ui->messageIn_SM->setFocus();
}
void SignVerifyMessageDialog::setAddress_VM(QString address)
{
ui->addressIn_VM->setText(address);
ui->messageIn_VM->setFocus();
}
void SignVerifyMessageDialog::showTab_SM(bool fShow)
{
ui->tabWidget->setCurrentIndex(0);
if (fShow)
this->show();
}
void SignVerifyMessageDialog::showTab_VM(bool fShow)
{
ui->tabWidget->setCurrentIndex(1);
if (fShow)
this->show();
}
void SignVerifyMessageDialog::on_addressBookButton_SM_clicked()
{
if (model && model->getAddressTableModel())
{
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec())
{
setAddress_SM(dlg.getReturnValue());
}
}
}
void SignVerifyMessageDialog::on_pasteButton_SM_clicked()
{
setAddress_SM(QApplication::clipboard()->text());
}
void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
{
/* Clear old signature to ensure users don't get confused on error with an old signature displayed */
ui->signatureOut_SM->clear();
CBitcoinAddress addr(ui->addressIn_SM->text().toStdString());
if (!addr.IsValid())
{
ui->addressIn_SM->setValid(false);
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID))
{
ui->addressIn_SM->setValid(false);
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
WalletModel::UnlockContext ctx(model->requestUnlock());
if (!ctx.isValid())
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Wallet unlock was cancelled."));
return;
}
CKey key;
if (!pwalletMain->GetKey(keyID, key))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));
return;
}
CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << ui->messageIn_SM->document()->toPlainText().toStdString();
std::vector<unsigned char> vchSig;
if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signing failed.") + QString("</nobr>"));
return;
}
ui->statusLabel_SM->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signed.") + QString("</nobr>"));
ui->signatureOut_SM->setText(QString::fromStdString(EncodeBase64(&vchSig[0], vchSig.size())));
}
void SignVerifyMessageDialog::on_copySignatureButton_SM_clicked()
{
QApplication::clipboard()->setText(ui->signatureOut_SM->text());
}
void SignVerifyMessageDialog::on_clearButton_SM_clicked()
{
ui->addressIn_SM->clear();
ui->messageIn_SM->clear();
ui->signatureOut_SM->clear();
ui->statusLabel_SM->clear();
ui->addressIn_SM->setFocus();
}
void SignVerifyMessageDialog::on_addressBookButton_VM_clicked()
{
if (model && model->getAddressTableModel())
{
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec())
{
setAddress_VM(dlg.getReturnValue());
}
}
}
void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
{
CBitcoinAddress addr(ui->addressIn_VM->text().toStdString());
if (!addr.IsValid())
{
ui->addressIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID))
{
ui->addressIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
bool fInvalid = false;
std::vector<unsigned char> vchSig = DecodeBase64(ui->signatureIn_VM->text().toStdString().c_str(), &fInvalid);
if (fInvalid)
{
ui->signatureIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The signature could not be decoded.") + QString(" ") + tr("Please check the signature and try again."));
return;
}
CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << ui->messageIn_VM->document()->toPlainText().toStdString();
CKey key;
if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig))
{
ui->signatureIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The signature did not match the message digest.") + QString(" ") + tr("Please check the signature and try again."));
return;
}
if (!(CBitcoinAddress(key.GetPubKey().GetID()) == addr))
{
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>"));
return;
}
ui->statusLabel_VM->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verified.") + QString("</nobr>"));
}
void SignVerifyMessageDialog::on_clearButton_VM_clicked()
{
ui->addressIn_VM->clear();
ui->signatureIn_VM->clear();
ui->messageIn_VM->clear();
ui->statusLabel_VM->clear();
ui->addressIn_VM->setFocus();
}
bool SignVerifyMessageDialog::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn)
{
if (ui->tabWidget->currentIndex() == 0)
{
/* Clear status message on focus change */
ui->statusLabel_SM->clear();
/* Select generated signature */
if (object == ui->signatureOut_SM)
{
ui->signatureOut_SM->selectAll();
return true;
}
}
else if (ui->tabWidget->currentIndex() == 1)
{
/* Clear status message on focus change */
ui->statusLabel_VM->clear();
}
}
return QDialog::eventFilter(object, event);
}
| thruelios/ab180 | src/qt/signverifymessagedialog.cpp | C++ | mit | 8,779 |
package view;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Font;
public class PasswordManagerRegistration {
JPanel regpanel;
private JTextField txtUsername;
private JPasswordField txtPass1;
private JPasswordField txtPass2;
private PasswordManagerGUI gui;
public PasswordManagerRegistration(PasswordManagerGUI gui) {
this.gui = gui;
regpanel = new JPanel();
regpanel.setLayout(new BorderLayout(0, 0));
JPanel panel_1 = new JPanel();
regpanel.add(panel_1, BorderLayout.NORTH);
JLabel lblRegistration = new JLabel(Labels.REG_REGISTRATION);
lblRegistration.setFont(new Font("Tahoma", Font.PLAIN, 38));
panel_1.add(lblRegistration);
JPanel panel_2 = new JPanel();
regpanel.add(panel_2, BorderLayout.CENTER);
panel_2.setLayout(null);
JLabel lblUsername = new JLabel(Labels.REG_USERNAME);
lblUsername.setBounds(74, 92, 132, 16);
panel_2.add(lblUsername);
JLabel lblPassword = new JLabel(Labels.REG_PASSWORD);
lblPassword.setBounds(74, 149, 173, 16);
panel_2.add(lblPassword);
JLabel lblPasswordAgain = new JLabel(Labels.REG_RE_PASSWORD);
lblPasswordAgain.setBounds(74, 204, 173, 16);
panel_2.add(lblPasswordAgain);
txtUsername = new JTextField();
txtUsername.setBounds(252, 89, 380, 22);
panel_2.add(txtUsername);
txtUsername.setColumns(10);
txtPass1 = new JPasswordField();
txtPass1.setBounds(252, 146, 380, 22);
panel_2.add(txtPass1);
txtPass2 = new JPasswordField();
txtPass2.setBounds(252, 201, 380, 22);
txtPass1.addActionListener(gui.getController());
txtPass1.setActionCommand(Labels.REG_PASS1FIELD);
txtPass2.addActionListener(gui.getController());
txtPass2.setActionCommand(Labels.REG_PASS2FIELD);
txtUsername.addActionListener(gui.getController());
txtUsername.setActionCommand(Labels.REG_USERFIELD);
panel_2.add(txtPass2);
JButton btnRegistration = new JButton(Labels.REG_REGBUTTON);
btnRegistration.addActionListener(gui.getController());
btnRegistration.setBounds(278, 288, 151, 25);
panel_2.add(btnRegistration);
}
public JTextField getTxtUsername() {
return txtUsername;
}
public JPasswordField getTxtPass1() {
return txtPass1;
}
public JPasswordField getTxtPass2() {
return txtPass2;
}
}
| zoltanvi/password-manager | src/view/PasswordManagerRegistration.java | Java | mit | 2,435 |
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace System.Data
{
public static class DbTypeConsts
{
/// <summary>
/// 自定义一个 DbType 表示 pgsql 的 json 类型
/// </summary>
public const DbType NpgJson = (DbType)135;
/// <summary>
/// 自定义一个 DbType 表示 pgsql 的 jsonb 类型
/// </summary>
public const DbType NpgJsonb = (DbType)136;
}
}
| shuxinqin/Chloe | src/ChloeDemo/DbTypeConsts.cs | C# | mit | 487 |
# -*- coding: utf-8 -*-
"""
This module provides the necessary methods for a Certification Authority.
For creating the self signed Certificate for the CA, use the following command:
$ openssl req -x509 -newkey rsa:2048 -keyout ca_priv.pem -out ca_cert.pem
@author: Vasco Santos
"""
import time
from M2Crypto import X509, RSA, EVP, BIO, ASN1
class CertificationAuthority(object):
""" Class responsible for keeping the CA self-signed certificate,
as well as, its private key.
"""
def __init__(self, cert, priv_key, passphrase):
""" Create a Certification Authority Object.
Arguments:
cert: file system path of the CA's self-signed certificate.
priv_key: file system path of the CA's private key (encrypted).
passphrase: Symmetric key for priv_key decryption.
"""
def getPassphrase(*args):
""" Callback for private key decrypting.
"""
return str(passphrase.encode('utf-8'))
self.cert = X509.load_cert(cert.encode('utf-8'))
self.priv_key = RSA.load_key(priv_key.encode('utf-8'), getPassphrase)
# Private key for signing
self.signEVP = EVP.PKey()
self.signEVP.assign_rsa(self.priv_key)
def createSignedCertificate(self, subj_id, pub_key, expiration_time):
""" Create a certificate for a subject public key, signed by the CA.
Arguments:
subj_id: certificate subject identifier.
pub_key: public key of the subject.
expiration_time: certificate life time.
Returns:
Certificate in PEM Format.
"""
# Public Key to certificate
bio = BIO.MemoryBuffer(str(pub_key.decode('hex')))
pub_key = RSA.load_pub_key_bio(bio)
pkey = EVP.PKey()
pkey.assign_rsa(pub_key)
# Certificate Fields
cur_time = ASN1.ASN1_UTCTIME()
cur_time.set_time(int(time.time()))
expire_time = ASN1.ASN1_UTCTIME()
expire_time.set_time(int(time.time()) + expiration_time * 60) # In expiration time minutes
# Certification Creation
cert = X509.X509()
cert.set_pubkey(pkey)
s_name = X509.X509_Name()
s_name.C = "PT"
s_name.CN = str(subj_id)
cert.set_subject(s_name)
i_name = X509.X509_Name()
i_name.C = "PT"
i_name.CN = "Register Server"
cert.set_issuer_name(i_name)
cert.set_not_before(cur_time)
cert.set_not_after(expire_time)
cert.sign(self.signEVP, md="sha1")
#cert.save_pem("peer_CA.pem")
return cert.as_pem().encode('hex')
def decryptData(self, data):
""" Decrypt the intended data with the entity private key.
Arguments:
data: data to be decrypted.
"""
return self.priv_key.private_decrypt(data.decode('base64'), RSA.pkcs1_padding)
def encryptData(self, data, certificate):
""" Encrypt the intended data with the public key contained in the certificate.
Arguments:
data: data to be encrypted.
certificate: subject certificate.
"""
cert = X509.load_cert_string(certificate.decode('hex'))
return cert.get_pubkey().get_rsa().public_encrypt(str(data), RSA.pkcs1_padding).encode('base64')
def getPublicKey(self):
""" Get the CA Public Key.
Returns:
CA Public Key in PEM Format.
"""
return self.cert.get_pubkey().get_rsa().as_pem().encode('hex')
def signData(self, data):
""" Sign a received String.
Arguments:
data: string to sign.
Returns:
signature of the received data.
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(str(data))
self.signEVP.sign_init()
self.signEVP.sign_update(msgDigest.digest())
return self.signEVP.sign_final().encode('base64')
def signEncryptedData(self, cipherData):
""" Sign encrypted data.
Arguments:
cipherData: data encrypted (base64 format).
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(cipherData.decode('base64'))
self.signEVP.sign_init()
self.signEVP.sign_update(msgDigest.digest())
return self.signEVP.sign_final().encode('base64')
def validCertificate(self, certificate):
""" Verify if a certificate of a subject was issued by this CA.
Arguments:
certificate: subject certificate.
Returns:
true if the certificate was issued by this CA. false otherwise.
"""
cert = X509.load_cert_string(certificate.decode('hex'))
# Data Analysis
# Subject confirmation
return cert.verify(self.cert.get_pubkey())
def validSelfSignedCertificate(self):
""" Verify if the self-signed CA certificate was not corrupted.
Returns:
true if the self signed certificate is valid, false otherwise.
"""
return self.cert.check_ca() and self.cert.verify(self.cert.get_pubkey())
def validSignedData(self, data, signature, certificate):
""" Verify if the received data was signed by the owner of the certificate.
Arguments:
data: received data.
signature: digital signature of the data.
certificate: certificate of the data issuer.
Returns:
true if the data maintains its integrity, false otherwise.
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(str(data))
pub_key = X509.load_cert_string(certificate.decode('hex')).get_pubkey().get_rsa()
verifyEVP = EVP.PKey()
verifyEVP.assign_rsa(pub_key)
verifyEVP.verify_init()
verifyEVP.verify_update(msgDigest.digest())
return verifyEVP.verify_final(str(signature.decode('base64')))
def validSignedEncryptedData(self, cipherData, signature, certificate):
""" Verify if the received data was signed by the owner of the certificate.
Arguments:
cipherData: data encrypted (base64 format).
signature: digital signature of the data.
certificate: certificate of the data issuer.
Returns:
true if the data maintains its integrity, false otherwise.
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(cipherData.decode('base64'))
pub_key = X509.load_cert_string(certificate.decode('hex')).get_pubkey().get_rsa()
verifyEVP = EVP.PKey()
verifyEVP.assign_rsa(pub_key)
verifyEVP.verify_init()
verifyEVP.verify_update(msgDigest.digest())
return verifyEVP.verify_final(str(signature.decode('base64')))
| vasco-santos/CertificationService | certModule/CertAuthority.py | Python | mit | 6,803 |
Configuring Doctrine ODM
========================
The Doctrine ODM extension is currently under development. | nice-php/docs | extensions/doctrine-odm.md | Markdown | mit | 109 |
//
// FMAPIManager.h
// car2go_sample
//
// Created by Jonghyun Kim on 2017/05/29.
// Copyright © 2017 kokaru. All rights reserved.
//
typedef void (^apisuccess)(NSURLSessionDataTask *sessionDataTask, id responseObject);
typedef void (^apifailure)(NSURLSessionDataTask *sessionDataTask, NSError *error);
@interface FMAPIManager : NSObject
+(instancetype)sharedInstance;
-(void)post:(NSString*)url
param:(NSDictionary*)params
success:(void (^)(NSURLSessionDataTask *sessionDataTask, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *sessionDataTask, NSError *error))failure;
-(void)get:(NSString*)url
param:(NSDictionary*)params
success:(void (^)(NSURLSessionDataTask *sessionDataTask, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *sessionDataTask, NSError *error))failure;
-(void)getImage:(NSString*)url
param:(NSDictionary*)params
success:(void (^)(NSURLSessionDataTask *sessionDataTask, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *sessionDataTask, NSError *error))failure;
-(void)getImage:(NSString*)url
param:(NSDictionary*)params
contentType:(id)contentType
responseSerializer:(id)responseSerializer
success:(void (^)(NSURLSessionDataTask *sessionDataTask, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *sessionDataTask, NSError *error))failure;
@end
| filmhomage/car2go | car2go_sample/Network/FMAPIManager.h | C | mit | 1,431 |
export class Power{
public id:string;
public code:string;
public url:string;
public title:string;
public explain:string;
public menuId:string;
public type:string;
public isValid:boolean;
public isChecked:boolean=false;
public operation:Array<string>=new Array<string>();
public operationChecked:Array<string>=new Array<string>();
public operationMap:Array<string>=new Array<string>();
public checkboxList:Array<CheckboxList>=[]
}
export class RolePower extends Power{
public roleId:string;
}
export class NavMenu{
public id:string;
public code:string;
public url:string;
public isValid:boolean=true;
public isLeaf:boolean=false;
public title:string;
public isChecked:boolean=false;
}
export class PowerFun{
public isSHOW:boolean;
public isADD:boolean;
public isUPDATE:boolean;
public isDELETE:boolean;
public isCHECK:boolean;
}
export class RoleInfo{
public id:string;
public roleName:string;
public name:string;
public desc:string;
}
export class Tree{
public id:string;
public pid:string;
public name:string;
public isLeaf:boolean;
public IsSubMenu:boolean;
public subTrees:Array<Tree>=[];
constructor(id:string,pid:string,name:string,isLeaf:boolean){
this.id=id;
this.pid=pid;
this.name=name;
this.isLeaf=isLeaf;
}
} | Lslgg/admin-manager | src/app/admin/power/shared/power.model.ts | TypeScript | mit | 1,410 |
from baby_steps import given, then, when
from district42 import represent, schema
def test_list_of_representation():
with given:
sch = schema.list(schema.bool)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.bool)"
def test_list_of_values_representation():
with given:
sch = schema.list(schema.int(1))
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int(1))"
def test_list_of_repr_values_representation():
with given:
sch = schema.list(schema.str("banana"))
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.str('banana'))"
def test_list_of_len_representation():
with given:
sch = schema.list(schema.int).len(10)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(10)"
def test_list_of_min_len_representation():
with given:
sch = schema.list(schema.int).len(1, ...)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(1, ...)"
def test_list_of_max_len_representation():
with given:
sch = schema.list(schema.int).len(..., 10)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(..., 10)"
def test_list_of_min_max_len_representation():
with given:
sch = schema.list(schema.int).len(1, 10)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(1, 10)"
| nikitanovosibirsk/district42 | tests/list/test_list_of_representation.py | Python | mit | 1,650 |
/* */
"format cjs";
(function(e){if("function"==typeof bootstrap)bootstrap("csv2geojson",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeCsv2geojson=e}else"undefined"!=typeof window?window.csv2geojson=e():global.csv2geojson=e()})(function(){var define,ses,bootstrap,module,exports;
return (function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var s=typeof require=="function"&&require;if(!i&&s)return s(n,!0);throw new Error("Cannot find module '"+n+"'")}var o=t[n]={exports:{}};e[n][0](function(t){var i=e[n][1][t];return r(i?i:t)},o,o.exports)}return t[n].exports}for(var i=0;i<n.length;i++)r(n[i]);return r})({1:[function(require,module,exports){
function csv(text) {
var header;
return csv_parseRows(text, function(row, i) {
if (i) {
var o = {}, j = -1, m = header.length;
while (++j < m) o[header[j]] = row[j];
return o;
} else {
header = row;
return null;
}
});
function csv_parseRows (text, f) {
var EOL = {}, // sentinel value for end-of-line
EOF = {}, // sentinel value for end-of-file
rows = [], // output rows
re = /\r\n|[,\r\n]/g, // field separator regex
n = 0, // the current line number
t, // the current token
eol; // is the current token followed by EOL?
re.lastIndex = 0; // work-around bug in FF 3.6
/** @private Returns the next token. */
function token() {
if (re.lastIndex >= text.length) return EOF; // special case: end of file
if (eol) { eol = false; return EOL; } // special case: end of line
// special case: quotes
var j = re.lastIndex;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < text.length) {
if (text.charCodeAt(i) === 34) {
if (text.charCodeAt(i + 1) !== 34) break;
i++;
}
}
re.lastIndex = i + 2;
var c = text.charCodeAt(i + 1);
if (c === 13) {
eol = true;
if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
} else if (c === 10) {
eol = true;
}
return text.substring(j + 1, i).replace(/""/g, "\"");
}
// common case
var m = re.exec(text);
if (m) {
eol = m[0].charCodeAt(0) !== 44;
return text.substring(j, m.index);
}
re.lastIndex = text.length;
return text.substring(j);
}
while ((t = token()) !== EOF) {
var a = [];
while ((t !== EOL) && (t !== EOF)) {
a.push(t);
t = token();
}
if (f && !(a = f(a, n++))) continue;
rows.push(a);
}
return rows;
}
}
function csv2geojson(x, lonfield, latfield) {
var features = [],
featurecollection = {
type: 'FeatureCollection',
features: features
};
var parsed = csv(x);
if (!parsed.length) return featurecollection;
latfield = latfield || '';
lonfield = lonfield || '';
for (var f in parsed[0]) {
if (!latfield && f.match(/^Lat/i)) latfield = f;
if (!lonfield && f.match(/^Lon/i)) lonfield = f;
}
if (!latfield || !lonfield) {
var fields = [];
for (var k in parsed[0]) fields.push(k);
return fields;
}
for (var i = 0; i < parsed.length; i++) {
if (parsed[i][lonfield] !== undefined &&
parsed[i][lonfield] !== undefined) {
features.push({
type: 'Feature',
properties: parsed[i],
geometry: {
type: 'Point',
coordinates: [
parseFloat(parsed[i][lonfield]),
parseFloat(parsed[i][latfield])]
}
});
}
}
return featurecollection;
}
function toline(gj) {
var features = gj.features;
var line = {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: []
}
};
for (var i = 0; i < features.length; i++) {
line.geometry.coordinates.push(features[i].geometry.coordinates);
}
line.properties = features[0].properties;
return {
type: 'FeatureSet',
features: [line]
};
}
function topolygon(gj) {
var features = gj.features;
var poly = {
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [[]]
}
};
for (var i = 0; i < features.length; i++) {
poly.geometry.coordinates[0].push(features[i].geometry.coordinates);
}
poly.properties = features[0].properties;
return {
type: 'FeatureSet',
features: [poly]
};
}
module.exports = {
csv: csv,
toline: toline,
topolygon: topolygon,
csv2geojson: csv2geojson
};
},{}]},{},[1])(1)
});
;
| thomjoy/turftest | src/jspm_packages/npm/mapbox.js@2.1.5/docs/assets/csv2geojson.js | JavaScript | mit | 5,283 |
import { Buffer } from 'buffer';
const discordmailhooksLegacyBrailleRegex = /([\u2800-\u28FF]+)(?:.)([\u2800-\u28FF]+)/;
class DiscordMailHooks {
email: string
constructor(email: string) {
this.email = email;
}
matches() {
return discordmailhooksLegacyBrailleRegex.test(this.email);
}
toWebhook(): string | undefined {
if (this.matches()) {
const [idBraillePart, tokenBraillePart] = discordmailhooksLegacyBrailleRegex.exec(this.email);
const id = idBraillePart.split('')
.map(encoded => encoded.codePointAt(0) - 0x2800)
.reduce((previous: bigint, currentChar: number, index: number, array: number[]): BigInt => {
previous |= BigInt(currentChar)
if (array.length - 1 !== index) previous = previous << BigInt(8)
return previous
}, BigInt(0))
const token = Buffer.from(tokenBraillePart.split('').map(encoded => encoded.codePointAt(0) - 0x2800)).toString('base64').replace(/\+/g, '-').replace(/\//g, '_');
return `https://discordapp.com/api/webhooks/${id}/${token}`
} else {
return;
}
}
}
export default DiscordMailHooks
| moustacheminer/discordmail | src/mail/DiscordMailHooks.ts | TypeScript | mit | 1,161 |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pong</title>
<style>
canvas {
position: absolute;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
</head>
<body>
<script>
var WIDTH=700, HEIGHT=600, pi=Math.PI;
var UpArrow = 38, DownArrow = 40;
var canvas, ctx, keystate;
var player, ai, ball;
player = {
x: null,
y: null,
width: 20,
height: 100,
update: function() {
if (keystate[UpArrow]) this.y -= 7;
if (keystate[DownArrow]) this.y += 7;
this.y = Math.max(Math.min(this.y, HEIGHT - this.height), 0);
},
draw: function() {
ctx.fillRect(this.x, this.y, this.width, this.height);
}
};
ai = {
x: null,
y: null,
width: 20,
height: 100,
update: function() {
var desty = ball.y - (this.height - ball.side)*0.5;
this.y += (desty - this.y) * 0.1;
this.y = Math.max(Math.min(this.y, HEIGHT - this.height), 0);
},
draw: function() {
ctx.fillRect(this.x, this.y, this.width, this.height);
}
};
ball = {
x: null,
y: null,
vel: null,
side: 20,
speed: 12,
serve: function(side) {
var r = Math.random();
this.x = side === 1 ? player.x+player.width : ai.x - this.side;
this.y = (HEIGHT - this.side)*r;
var phi = 0.1*pi*(1 - 2*r);
this.vel = {
x: side*this.speed*Math.cos(phi),
y: this.speed*Math.sin(phi)
}
},
update: function() {
this.x += this.vel.x;
this.y += this.vel.y;
if (0 > this.y || this.y+this.side > HEIGHT) {
var offset = this.vel.y < 0 ? 0 - this.y : HEIGHT - (this.y+this.side);
this.y += 2*offset;
this.vel.y *= -1;
}
var AABBIntersect = function (ax, ay, aw, ah, bx, by, bw, bh) {
return ax < bx+bw && ay < by+bh && bx < ax+aw && by < ay+ah;
};
var pdle = this.vel.x < 0 ? player : ai;
if (AABBIntersect(pdle.x, pdle.y, pdle.width, pdle.height, this.x, this.y, this.side, this.side)
) {
this.x = pdle === player ? player.x+player.width : ai.x - this.side;
var n = (this.y+this.side - pdle.y)/(pdle.height+this.side);
var phi = 0.25*pi*(2*n - 1); // pi/4 = 45 degrees
var smash = Math.abs(phi) > 0.2*pi ? 1.5: 1;
this.vel.x = smash*(pdle === player ? 1 : -1) * this.speed * Math.cos(phi);
this.vel.y = smash*this.speed * Math.sin(phi);
}
if (0 > this.x+this.side || this.x > WIDTH) {
this.serve(pdle === player ? 1 : -1);
}
},
draw: function() {
ctx.fillRect(this.x, this.y, this.side, this.side);
}
};
function main() {
canvas = document.createElement("canvas");
canvas.width = WIDTH;
canvas.height = HEIGHT;
ctx = canvas.getContext("2d");
document.body.appendChild(canvas);
keystate = {};
document.addEventListener("keydown", function(evt) {
keystate[evt.keyCode] = true;
});
document.addEventListener("keyup", function(evt) {
delete keystate[evt.keyCode];
});
init();
var loop = function() {
update();
draw();
window.requestAnimationFrame(loop, canvas);
};
window.requestAnimationFrame(loop, canvas);
}
function init() {
player.x = player.width;
player.y = (HEIGHT-player.height)/2;
ai.x = WIDTH - (player.width + ai.width);
ai.y = (HEIGHT - ai.height)/2;
ball.serve(1);
}
function update() {
ball.update();
player.update();
ai.update();
}
function draw() {
ctx.fillRect(0, 0, WIDTH, HEIGHT);
ctx.save();
ctx.fillStyle = "#fff";
ball.draw();
player.draw();
ai.draw();
var w = 4;
var x = (WIDTH - w)*0.5;
var y = 0;
var step = HEIGHT/20;
while (y < HEIGHT) {
ctx.fillRect(x, y+step*0.25, w, step*0.5);
y += step;
}
ctx.restore();
}
main();
</script>
</body>
</html> | redxtreme/practicePong | pong.html | HTML | mit | 5,793 |
[](https://badge.fury.io/js/xstream-router5)
# xstream-router5
[xstream](http://staltz.com/xstream/) integration with [router5](https://router5.js.org)
```sh
npm install --save xstream-router5
```
### Usage
_xstream-router5_ exports a single function `createObservables`:
```js
import createRouter from 'router5';
import createObservables from 'xstream-router5';
const router = createRouter([
{ name: 'home', path: '/home' },
{ name: 'about', path: '/about' }
]);
const {
route$,
routeNode,
transitionError$,
transitionRoute$
} = createObservables(router)
router.start();
route$.map((route) => { /* ... */ })
```
### Available observables
`createObservables` returns the following observables:
- `route$`: an observable of your application route
- `transitionRoute$`: an observable of the currently transitioning route
- `transitionError$`: an observable of transition errors
- `routeNode(nodeName = '')`: a function returning an observable of route updates for the specified node
### Related
- [rxjs-router5](../rxjs-router5)
| router5/router5 | packages/xstream-router5/README.md | Markdown | mit | 1,125 |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/system.h>
#ifdef ENABLE_EXTERNAL_SIGNER
#if defined(WIN32) && !defined(__kernel_entry)
// A workaround for boost 1.71 incompatibility with mingw-w64 compiler.
// For details see https://github.com/bitcoin/bitcoin/pull/22348.
#define __kernel_entry
#endif
#include <boost/process.hpp>
#endif // ENABLE_EXTERNAL_SIGNER
#include <chainparamsbase.h>
#include <sync.h>
#include <util/check.h>
#include <util/getuniquepath.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
#include <pthread.h>
#include <pthread_np.h>
#endif
#ifndef WIN32
// for posix_fallocate, in configure.ac we check if it is present after this
#ifdef __linux__
#ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 200112L
#endif // __linux__
#include <algorithm>
#include <cassert>
#include <fcntl.h>
#include <sched.h>
#include <sys/resource.h>
#include <sys/stat.h>
#else
#ifdef _MSC_VER
#pragma warning(disable:4786)
#pragma warning(disable:4804)
#pragma warning(disable:4805)
#pragma warning(disable:4717)
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <codecvt>
#include <io.h> /* for _commit */
#include <shellapi.h>
#include <shlobj.h>
#endif
#ifdef HAVE_MALLOPT_ARENA_MAX
#include <malloc.h>
#endif
#include <boost/algorithm/string/replace.hpp>
#include <thread>
#include <typeinfo>
#include <univalue.h>
// Application startup time (used for uptime calculation)
const int64_t nStartupTime = GetTime();
const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
const char * const BITCOIN_SETTINGS_FILENAME = "settings.json";
ArgsManager gArgs;
/** Mutex to protect dir_locks. */
static Mutex cs_dir_locks;
/** A map that contains all the currently held directory locks. After
* successful locking, these will be held here until the global destructor
* cleans them up and thus automatically unlocks them, or ReleaseDirectoryLocks
* is called.
*/
static std::map<std::string, std::unique_ptr<fsbridge::FileLock>> dir_locks GUARDED_BY(cs_dir_locks);
bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only)
{
LOCK(cs_dir_locks);
fs::path pathLockFile = directory / lockfile_name;
// If a lock for this directory already exists in the map, don't try to re-lock it
if (dir_locks.count(pathLockFile.string())) {
return true;
}
// Create empty lock file if it doesn't exist.
FILE* file = fsbridge::fopen(pathLockFile, "a");
if (file) fclose(file);
auto lock = std::make_unique<fsbridge::FileLock>(pathLockFile);
if (!lock->TryLock()) {
return error("Error while attempting to lock directory %s: %s", directory.string(), lock->GetReason());
}
if (!probe_only) {
// Lock successful and we're not just probing, put it into the map
dir_locks.emplace(pathLockFile.string(), std::move(lock));
}
return true;
}
void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name)
{
LOCK(cs_dir_locks);
dir_locks.erase((directory / lockfile_name).string());
}
void ReleaseDirectoryLocks()
{
LOCK(cs_dir_locks);
dir_locks.clear();
}
bool DirIsWritable(const fs::path& directory)
{
fs::path tmpFile = GetUniquePath(directory);
FILE* file = fsbridge::fopen(tmpFile, "a");
if (!file) return false;
fclose(file);
remove(tmpFile);
return true;
}
bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes)
{
constexpr uint64_t min_disk_space = 52428800; // 50 MiB
uint64_t free_bytes_available = fs::space(dir).available;
return free_bytes_available >= min_disk_space + additional_bytes;
}
std::streampos GetFileSize(const char* path, std::streamsize max) {
std::ifstream file(path, std::ios::binary);
file.ignore(max);
return file.gcount();
}
/**
* Interpret a string argument as a boolean.
*
* The definition of LocaleIndependentAtoi<int>() requires that non-numeric string values
* like "foo", return 0. This means that if a user unintentionally supplies a
* non-integer argument here, the return value is always false. This means that
* -foo=false does what the user probably expects, but -foo=true is well defined
* but does not do what they probably expected.
*
* The return value of LocaleIndependentAtoi<int>(...) is zero when given input not
* representable as an int.
*
* For a more extensive discussion of this topic (and a wide range of opinions
* on the Right Way to change this code), see PR12713.
*/
static bool InterpretBool(const std::string& strValue)
{
if (strValue.empty())
return true;
return (LocaleIndependentAtoi<int>(strValue) != 0);
}
static std::string SettingName(const std::string& arg)
{
return arg.size() > 0 && arg[0] == '-' ? arg.substr(1) : arg;
}
/**
* Interpret -nofoo as if the user supplied -foo=0.
*
* This method also tracks when the -no form was supplied, and if so,
* checks whether there was a double-negative (-nofoo=0 -> -foo=1).
*
* If there was not a double negative, it removes the "no" from the key
* and returns false.
*
* If there was a double negative, it removes "no" from the key, and
* returns true.
*
* If there was no "no", it returns the string value untouched.
*
* Where an option was negated can be later checked using the
* IsArgNegated() method. One use case for this is to have a way to disable
* options that are not normally boolean (e.g. using -nodebuglogfile to request
* that debug log output is not sent to any file at all).
*/
static util::SettingsValue InterpretOption(std::string& section, std::string& key, const std::string& value)
{
// Split section name from key name for keys like "testnet.foo" or "regtest.bar"
size_t option_index = key.find('.');
if (option_index != std::string::npos) {
section = key.substr(0, option_index);
key.erase(0, option_index + 1);
}
if (key.substr(0, 2) == "no") {
key.erase(0, 2);
// Double negatives like -nofoo=0 are supported (but discouraged)
if (!InterpretBool(value)) {
LogPrintf("Warning: parsed potentially confusing double-negative -%s=%s\n", key, value);
return true;
}
return false;
}
return value;
}
/**
* Check settings value validity according to flags.
*
* TODO: Add more meaningful error checks here in the future
* See "here's how the flags are meant to behave" in
* https://github.com/bitcoin/bitcoin/pull/16097#issuecomment-514627823
*/
static bool CheckValid(const std::string& key, const util::SettingsValue& val, unsigned int flags, std::string& error)
{
if (val.isBool() && !(flags & ArgsManager::ALLOW_BOOL)) {
error = strprintf("Negating of -%s is meaningless and therefore forbidden", key);
return false;
}
return true;
}
namespace {
fs::path StripRedundantLastElementsOfPath(const fs::path& path)
{
auto result = path;
while (result.filename().string() == ".") {
result = result.parent_path();
}
assert(fs::equivalent(result, path));
return result;
}
} // namespace
// Define default constructor and destructor that are not inline, so code instantiating this class doesn't need to
// #include class definitions for all members.
// For example, m_settings has an internal dependency on univalue.
ArgsManager::ArgsManager() {}
ArgsManager::~ArgsManager() {}
const std::set<std::string> ArgsManager::GetUnsuitableSectionOnlyArgs() const
{
std::set<std::string> unsuitables;
LOCK(cs_args);
// if there's no section selected, don't worry
if (m_network.empty()) return std::set<std::string> {};
// if it's okay to use the default section for this network, don't worry
if (m_network == CBaseChainParams::MAIN) return std::set<std::string> {};
for (const auto& arg : m_network_only_args) {
if (OnlyHasDefaultSectionSetting(m_settings, m_network, SettingName(arg))) {
unsuitables.insert(arg);
}
}
return unsuitables;
}
const std::list<SectionInfo> ArgsManager::GetUnrecognizedSections() const
{
// Section names to be recognized in the config file.
static const std::set<std::string> available_sections{
CBaseChainParams::REGTEST,
CBaseChainParams::SIGNET,
CBaseChainParams::TESTNET,
CBaseChainParams::MAIN
};
LOCK(cs_args);
std::list<SectionInfo> unrecognized = m_config_sections;
unrecognized.remove_if([](const SectionInfo& appeared){ return available_sections.find(appeared.m_name) != available_sections.end(); });
return unrecognized;
}
void ArgsManager::SelectConfigNetwork(const std::string& network)
{
LOCK(cs_args);
m_network = network;
}
bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::string& error)
{
LOCK(cs_args);
m_settings.command_line_options.clear();
for (int i = 1; i < argc; i++) {
std::string key(argv[i]);
#ifdef MAC_OSX
// At the first time when a user gets the "App downloaded from the
// internet" warning, and clicks the Open button, macOS passes
// a unique process serial number (PSN) as -psn_... command-line
// argument, which we filter out.
if (key.substr(0, 5) == "-psn_") continue;
#endif
if (key == "-") break; //bitcoin-tx using stdin
std::string val;
size_t is_index = key.find('=');
if (is_index != std::string::npos) {
val = key.substr(is_index + 1);
key.erase(is_index);
}
#ifdef WIN32
key = ToLower(key);
if (key[0] == '/')
key[0] = '-';
#endif
if (key[0] != '-') {
if (!m_accept_any_command && m_command.empty()) {
// The first non-dash arg is a registered command
std::optional<unsigned int> flags = GetArgFlags(key);
if (!flags || !(*flags & ArgsManager::COMMAND)) {
error = strprintf("Invalid command '%s'", argv[i]);
return false;
}
}
m_command.push_back(key);
while (++i < argc) {
// The remaining args are command args
m_command.push_back(argv[i]);
}
break;
}
// Transform --foo to -foo
if (key.length() > 1 && key[1] == '-')
key.erase(0, 1);
// Transform -foo to foo
key.erase(0, 1);
std::string section;
util::SettingsValue value = InterpretOption(section, key, val);
std::optional<unsigned int> flags = GetArgFlags('-' + key);
// Unknown command line options and command line options with dot
// characters (which are returned from InterpretOption with nonempty
// section strings) are not valid.
if (!flags || !section.empty()) {
error = strprintf("Invalid parameter %s", argv[i]);
return false;
}
if (!CheckValid(key, value, *flags, error)) return false;
m_settings.command_line_options[key].push_back(value);
}
// we do not allow -includeconf from command line, only -noincludeconf
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
const util::SettingsSpan values{*includes};
// Range may be empty if -noincludeconf was passed
if (!values.empty()) {
error = "-includeconf cannot be used from commandline; -includeconf=" + values.begin()->write();
return false; // pick first value as example
}
}
return true;
}
std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const
{
LOCK(cs_args);
for (const auto& arg_map : m_available_args) {
const auto search = arg_map.second.find(name);
if (search != arg_map.second.end()) {
return search->second.m_flags;
}
}
return std::nullopt;
}
const fs::path& ArgsManager::GetBlocksDirPath() const
{
LOCK(cs_args);
fs::path& path = m_cached_blocks_path;
// Cache the path to avoid calling fs::create_directories on every call of
// this function
if (!path.empty()) return path;
if (IsArgSet("-blocksdir")) {
path = fs::system_complete(GetArg("-blocksdir", ""));
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDataDirBase();
}
path /= BaseParams().DataDir();
path /= "blocks";
fs::create_directories(path);
path = StripRedundantLastElementsOfPath(path);
return path;
}
const fs::path& ArgsManager::GetDataDir(bool net_specific) const
{
LOCK(cs_args);
fs::path& path = net_specific ? m_cached_network_datadir_path : m_cached_datadir_path;
// Cache the path to avoid calling fs::create_directories on every call of
// this function
if (!path.empty()) return path;
std::string datadir = GetArg("-datadir", "");
if (!datadir.empty()) {
path = fs::system_complete(datadir);
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDefaultDataDir();
}
if (net_specific)
path /= BaseParams().DataDir();
if (fs::create_directories(path)) {
// This is the first run, create wallets subdirectory too
fs::create_directories(path / "wallets");
}
path = StripRedundantLastElementsOfPath(path);
return path;
}
void ArgsManager::ClearPathCache()
{
LOCK(cs_args);
m_cached_datadir_path = fs::path();
m_cached_network_datadir_path = fs::path();
m_cached_blocks_path = fs::path();
}
std::optional<const ArgsManager::Command> ArgsManager::GetCommand() const
{
Command ret;
LOCK(cs_args);
auto it = m_command.begin();
if (it == m_command.end()) {
// No command was passed
return std::nullopt;
}
if (!m_accept_any_command) {
// The registered command
ret.command = *(it++);
}
while (it != m_command.end()) {
// The unregistered command and args (if any)
ret.args.push_back(*(it++));
}
return ret;
}
std::vector<std::string> ArgsManager::GetArgs(const std::string& strArg) const
{
std::vector<std::string> result;
for (const util::SettingsValue& value : GetSettingsList(strArg)) {
result.push_back(value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str());
}
return result;
}
bool ArgsManager::IsArgSet(const std::string& strArg) const
{
return !GetSetting(strArg).isNull();
}
bool ArgsManager::InitSettings(std::string& error)
{
if (!GetSettingsPath()) {
return true; // Do nothing if settings file disabled.
}
std::vector<std::string> errors;
if (!ReadSettingsFile(&errors)) {
error = strprintf("Failed loading settings file:\n%s\n", MakeUnorderedList(errors));
return false;
}
if (!WriteSettingsFile(&errors)) {
error = strprintf("Failed saving settings file:\n%s\n", MakeUnorderedList(errors));
return false;
}
return true;
}
bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const
{
if (IsArgNegated("-settings")) {
return false;
}
if (filepath) {
std::string settings = GetArg("-settings", BITCOIN_SETTINGS_FILENAME);
*filepath = fsbridge::AbsPathJoin(GetDataDirNet(), temp ? settings + ".tmp" : settings);
}
return true;
}
static void SaveErrors(const std::vector<std::string> errors, std::vector<std::string>* error_out)
{
for (const auto& error : errors) {
if (error_out) {
error_out->emplace_back(error);
} else {
LogPrintf("%s\n", error);
}
}
}
bool ArgsManager::ReadSettingsFile(std::vector<std::string>* errors)
{
fs::path path;
if (!GetSettingsPath(&path, /* temp= */ false)) {
return true; // Do nothing if settings file disabled.
}
LOCK(cs_args);
m_settings.rw_settings.clear();
std::vector<std::string> read_errors;
if (!util::ReadSettings(path, m_settings.rw_settings, read_errors)) {
SaveErrors(read_errors, errors);
return false;
}
for (const auto& setting : m_settings.rw_settings) {
std::string section;
std::string key = setting.first;
(void)InterpretOption(section, key, /* value */ {}); // Split setting key into section and argname
if (!GetArgFlags('-' + key)) {
LogPrintf("Ignoring unknown rw_settings value %s\n", setting.first);
}
}
return true;
}
bool ArgsManager::WriteSettingsFile(std::vector<std::string>* errors) const
{
fs::path path, path_tmp;
if (!GetSettingsPath(&path, /* temp= */ false) || !GetSettingsPath(&path_tmp, /* temp= */ true)) {
throw std::logic_error("Attempt to write settings file when dynamic settings are disabled.");
}
LOCK(cs_args);
std::vector<std::string> write_errors;
if (!util::WriteSettings(path_tmp, m_settings.rw_settings, write_errors)) {
SaveErrors(write_errors, errors);
return false;
}
if (!RenameOver(path_tmp, path)) {
SaveErrors({strprintf("Failed renaming settings file %s to %s\n", path_tmp.string(), path.string())}, errors);
return false;
}
return true;
}
bool ArgsManager::IsArgNegated(const std::string& strArg) const
{
return GetSetting(strArg).isFalse();
}
std::string ArgsManager::GetArg(const std::string& strArg, const std::string& strDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str();
}
int64_t ArgsManager::GetIntArg(const std::string& strArg, int64_t nDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
return value.isNull() ? nDefault : value.isFalse() ? 0 : value.isTrue() ? 1 : value.isNum() ? value.get_int64() : LocaleIndependentAtoi<int64_t>(value.get_str());
}
bool ArgsManager::GetBoolArg(const std::string& strArg, bool fDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
return value.isNull() ? fDefault : value.isBool() ? value.get_bool() : InterpretBool(value.get_str());
}
bool ArgsManager::SoftSetArg(const std::string& strArg, const std::string& strValue)
{
LOCK(cs_args);
if (IsArgSet(strArg)) return false;
ForceSetArg(strArg, strValue);
return true;
}
bool ArgsManager::SoftSetBoolArg(const std::string& strArg, bool fValue)
{
if (fValue)
return SoftSetArg(strArg, std::string("1"));
else
return SoftSetArg(strArg, std::string("0"));
}
void ArgsManager::ForceSetArg(const std::string& strArg, const std::string& strValue)
{
LOCK(cs_args);
m_settings.forced_settings[SettingName(strArg)] = strValue;
}
void ArgsManager::AddCommand(const std::string& cmd, const std::string& help)
{
Assert(cmd.find('=') == std::string::npos);
Assert(cmd.at(0) != '-');
LOCK(cs_args);
m_accept_any_command = false; // latch to false
std::map<std::string, Arg>& arg_map = m_available_args[OptionsCategory::COMMANDS];
auto ret = arg_map.emplace(cmd, Arg{"", help, ArgsManager::COMMAND});
Assert(ret.second); // Fail on duplicate commands
}
void ArgsManager::AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat)
{
Assert((flags & ArgsManager::COMMAND) == 0); // use AddCommand
// Split arg name from its help param
size_t eq_index = name.find('=');
if (eq_index == std::string::npos) {
eq_index = name.size();
}
std::string arg_name = name.substr(0, eq_index);
LOCK(cs_args);
std::map<std::string, Arg>& arg_map = m_available_args[cat];
auto ret = arg_map.emplace(arg_name, Arg{name.substr(eq_index, name.size() - eq_index), help, flags});
assert(ret.second); // Make sure an insertion actually happened
if (flags & ArgsManager::NETWORK_ONLY) {
m_network_only_args.emplace(arg_name);
}
}
void ArgsManager::AddHiddenArgs(const std::vector<std::string>& names)
{
for (const std::string& name : names) {
AddArg(name, "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN);
}
}
std::string ArgsManager::GetHelpMessage() const
{
const bool show_debug = GetBoolArg("-help-debug", false);
std::string usage = "";
LOCK(cs_args);
for (const auto& arg_map : m_available_args) {
switch(arg_map.first) {
case OptionsCategory::OPTIONS:
usage += HelpMessageGroup("Options:");
break;
case OptionsCategory::CONNECTION:
usage += HelpMessageGroup("Connection options:");
break;
case OptionsCategory::ZMQ:
usage += HelpMessageGroup("ZeroMQ notification options:");
break;
case OptionsCategory::DEBUG_TEST:
usage += HelpMessageGroup("Debugging/Testing options:");
break;
case OptionsCategory::NODE_RELAY:
usage += HelpMessageGroup("Node relay options:");
break;
case OptionsCategory::BLOCK_CREATION:
usage += HelpMessageGroup("Block creation options:");
break;
case OptionsCategory::RPC:
usage += HelpMessageGroup("RPC server options:");
break;
case OptionsCategory::WALLET:
usage += HelpMessageGroup("Wallet options:");
break;
case OptionsCategory::WALLET_DEBUG_TEST:
if (show_debug) usage += HelpMessageGroup("Wallet debugging/testing options:");
break;
case OptionsCategory::CHAINPARAMS:
usage += HelpMessageGroup("Chain selection options:");
break;
case OptionsCategory::GUI:
usage += HelpMessageGroup("UI Options:");
break;
case OptionsCategory::COMMANDS:
usage += HelpMessageGroup("Commands:");
break;
case OptionsCategory::REGISTER_COMMANDS:
usage += HelpMessageGroup("Register Commands:");
break;
default:
break;
}
// When we get to the hidden options, stop
if (arg_map.first == OptionsCategory::HIDDEN) break;
for (const auto& arg : arg_map.second) {
if (show_debug || !(arg.second.m_flags & ArgsManager::DEBUG_ONLY)) {
std::string name;
if (arg.second.m_help_param.empty()) {
name = arg.first;
} else {
name = arg.first + arg.second.m_help_param;
}
usage += HelpMessageOpt(name, arg.second.m_help_text);
}
}
}
return usage;
}
bool HelpRequested(const ArgsManager& args)
{
return args.IsArgSet("-?") || args.IsArgSet("-h") || args.IsArgSet("-help") || args.IsArgSet("-help-debug");
}
void SetupHelpOptions(ArgsManager& args)
{
args.AddArg("-?", "Print this help message and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
args.AddHiddenArgs({"-h", "-help"});
}
static const int screenWidth = 79;
static const int optIndent = 2;
static const int msgIndent = 7;
std::string HelpMessageGroup(const std::string &message) {
return std::string(message) + std::string("\n\n");
}
std::string HelpMessageOpt(const std::string &option, const std::string &message) {
return std::string(optIndent,' ') + std::string(option) +
std::string("\n") + std::string(msgIndent,' ') +
FormatParagraph(message, screenWidth - msgIndent, msgIndent) +
std::string("\n\n");
}
static std::string FormatException(const std::exception* pex, const char* pszThread)
{
#ifdef WIN32
char pszModule[MAX_PATH] = "";
GetModuleFileNameA(nullptr, pszModule, sizeof(pszModule));
#else
const char* pszModule = "bitcoin";
#endif
if (pex)
return strprintf(
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
return strprintf(
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
LogPrintf("\n\n************************\n%s\n", message);
tfm::format(std::cerr, "\n\n************************\n%s\n", message);
}
fs::path GetDefaultDataDir()
{
// Windows: C:\Users\Username\AppData\Roaming\Bitcoin
// macOS: ~/Library/Application Support/Bitcoin
// Unix-like: ~/.bitcoin
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == nullptr || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// macOS
return pathRet / "Library/Application Support/Bitcoin";
#else
// Unix-like
return pathRet / ".bitcoin";
#endif
#endif
}
bool CheckDataDirOption()
{
std::string datadir = gArgs.GetArg("-datadir", "");
return datadir.empty() || fs::is_directory(fs::system_complete(datadir));
}
fs::path GetConfigFile(const std::string& confPath)
{
return AbsPathForConfigVal(fs::path(confPath), false);
}
static bool GetConfigOptions(std::istream& stream, const std::string& filepath, std::string& error, std::vector<std::pair<std::string, std::string>>& options, std::list<SectionInfo>& sections)
{
std::string str, prefix;
std::string::size_type pos;
int linenr = 1;
while (std::getline(stream, str)) {
bool used_hash = false;
if ((pos = str.find('#')) != std::string::npos) {
str = str.substr(0, pos);
used_hash = true;
}
const static std::string pattern = " \t\r\n";
str = TrimString(str, pattern);
if (!str.empty()) {
if (*str.begin() == '[' && *str.rbegin() == ']') {
const std::string section = str.substr(1, str.size() - 2);
sections.emplace_back(SectionInfo{section, filepath, linenr});
prefix = section + '.';
} else if (*str.begin() == '-') {
error = strprintf("parse error on line %i: %s, options in configuration file must be specified without leading -", linenr, str);
return false;
} else if ((pos = str.find('=')) != std::string::npos) {
std::string name = prefix + TrimString(str.substr(0, pos), pattern);
std::string value = TrimString(str.substr(pos + 1), pattern);
if (used_hash && name.find("rpcpassword") != std::string::npos) {
error = strprintf("parse error on line %i, using # in rpcpassword can be ambiguous and should be avoided", linenr);
return false;
}
options.emplace_back(name, value);
if ((pos = name.rfind('.')) != std::string::npos && prefix.length() <= pos) {
sections.emplace_back(SectionInfo{name.substr(0, pos), filepath, linenr});
}
} else {
error = strprintf("parse error on line %i: %s", linenr, str);
if (str.size() >= 2 && str.substr(0, 2) == "no") {
error += strprintf(", if you intended to specify a negated option, use %s=1 instead", str);
}
return false;
}
}
++linenr;
}
return true;
}
bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys)
{
LOCK(cs_args);
std::vector<std::pair<std::string, std::string>> options;
if (!GetConfigOptions(stream, filepath, error, options, m_config_sections)) {
return false;
}
for (const std::pair<std::string, std::string>& option : options) {
std::string section;
std::string key = option.first;
util::SettingsValue value = InterpretOption(section, key, option.second);
std::optional<unsigned int> flags = GetArgFlags('-' + key);
if (flags) {
if (!CheckValid(key, value, *flags, error)) {
return false;
}
m_settings.ro_config[section][key].push_back(value);
} else {
if (ignore_invalid_keys) {
LogPrintf("Ignoring unknown configuration value %s\n", option.first);
} else {
error = strprintf("Invalid configuration value %s", option.first);
return false;
}
}
}
return true;
}
bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
{
{
LOCK(cs_args);
m_settings.ro_config.clear();
m_config_sections.clear();
}
const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME);
fsbridge::ifstream stream(GetConfigFile(confPath));
// not ok to have a config file specified that cannot be opened
if (IsArgSet("-conf") && !stream.good()) {
error = strprintf("specified config file \"%s\" could not be opened.", confPath);
return false;
}
// ok to not have a config file
if (stream.good()) {
if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) {
return false;
}
// `-includeconf` cannot be included in the command line arguments except
// as `-noincludeconf` (which indicates that no included conf file should be used).
bool use_conf_file{true};
{
LOCK(cs_args);
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
// ParseParameters() fails if a non-negated -includeconf is passed on the command-line
assert(util::SettingsSpan(*includes).last_negated());
use_conf_file = false;
}
}
if (use_conf_file) {
std::string chain_id = GetChainName();
std::vector<std::string> conf_file_names;
auto add_includes = [&](const std::string& network, size_t skip = 0) {
size_t num_values = 0;
LOCK(cs_args);
if (auto* section = util::FindKey(m_settings.ro_config, network)) {
if (auto* values = util::FindKey(*section, "includeconf")) {
for (size_t i = std::max(skip, util::SettingsSpan(*values).negated()); i < values->size(); ++i) {
conf_file_names.push_back((*values)[i].get_str());
}
num_values = values->size();
}
}
return num_values;
};
// We haven't set m_network yet (that happens in SelectParams()), so manually check
// for network.includeconf args.
const size_t chain_includes = add_includes(chain_id);
const size_t default_includes = add_includes({});
for (const std::string& conf_file_name : conf_file_names) {
fsbridge::ifstream conf_file_stream(GetConfigFile(conf_file_name));
if (conf_file_stream.good()) {
if (!ReadConfigStream(conf_file_stream, conf_file_name, error, ignore_invalid_keys)) {
return false;
}
LogPrintf("Included configuration file %s\n", conf_file_name);
} else {
error = "Failed to include configuration file " + conf_file_name;
return false;
}
}
// Warn about recursive -includeconf
conf_file_names.clear();
add_includes(chain_id, /* skip= */ chain_includes);
add_includes({}, /* skip= */ default_includes);
std::string chain_id_final = GetChainName();
if (chain_id_final != chain_id) {
// Also warn about recursive includeconf for the chain that was specified in one of the includeconfs
add_includes(chain_id_final);
}
for (const std::string& conf_file_name : conf_file_names) {
tfm::format(std::cerr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", conf_file_name);
}
}
}
// If datadir is changed in .conf file:
gArgs.ClearPathCache();
if (!CheckDataDirOption()) {
error = strprintf("specified data directory \"%s\" does not exist.", GetArg("-datadir", ""));
return false;
}
return true;
}
std::string ArgsManager::GetChainName() const
{
auto get_net = [&](const std::string& arg) {
LOCK(cs_args);
util::SettingsValue value = util::GetSetting(m_settings, /* section= */ "", SettingName(arg),
/* ignore_default_section_config= */ false,
/* get_chain_name= */ true);
return value.isNull() ? false : value.isBool() ? value.get_bool() : InterpretBool(value.get_str());
};
const bool fRegTest = get_net("-regtest");
const bool fSigNet = get_net("-signet");
const bool fTestNet = get_net("-testnet");
const bool is_chain_arg_set = IsArgSet("-chain");
if ((int)is_chain_arg_set + (int)fRegTest + (int)fSigNet + (int)fTestNet > 1) {
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one.");
}
if (fRegTest)
return CBaseChainParams::REGTEST;
if (fSigNet) {
return CBaseChainParams::SIGNET;
}
if (fTestNet)
return CBaseChainParams::TESTNET;
return GetArg("-chain", CBaseChainParams::MAIN);
}
bool ArgsManager::UseDefaultSection(const std::string& arg) const
{
return m_network == CBaseChainParams::MAIN || m_network_only_args.count(arg) == 0;
}
util::SettingsValue ArgsManager::GetSetting(const std::string& arg) const
{
LOCK(cs_args);
return util::GetSetting(
m_settings, m_network, SettingName(arg), !UseDefaultSection(arg), /* get_chain_name= */ false);
}
std::vector<util::SettingsValue> ArgsManager::GetSettingsList(const std::string& arg) const
{
LOCK(cs_args);
return util::GetSettingsList(m_settings, m_network, SettingName(arg), !UseDefaultSection(arg));
}
void ArgsManager::logArgsPrefix(
const std::string& prefix,
const std::string& section,
const std::map<std::string, std::vector<util::SettingsValue>>& args) const
{
std::string section_str = section.empty() ? "" : "[" + section + "] ";
for (const auto& arg : args) {
for (const auto& value : arg.second) {
std::optional<unsigned int> flags = GetArgFlags('-' + arg.first);
if (flags) {
std::string value_str = (*flags & SENSITIVE) ? "****" : value.write();
LogPrintf("%s %s%s=%s\n", prefix, section_str, arg.first, value_str);
}
}
}
}
void ArgsManager::LogArgs() const
{
LOCK(cs_args);
for (const auto& section : m_settings.ro_config) {
logArgsPrefix("Config file arg:", section.first, section.second);
}
for (const auto& setting : m_settings.rw_settings) {
LogPrintf("Setting file arg: %s = %s\n", setting.first, setting.second.write());
}
logArgsPrefix("Command-line arg:", "", m_settings.command_line_options);
}
bool RenameOver(fs::path src, fs::path dest)
{
#ifdef WIN32
return MoveFileExW(src.wstring().c_str(), dest.wstring().c_str(),
MOVEFILE_REPLACE_EXISTING) != 0;
#else
int rc = std::rename(src.string().c_str(), dest.string().c_str());
return (rc == 0);
#endif /* WIN32 */
}
/**
* Ignores exceptions thrown by Boost's create_directories if the requested directory exists.
* Specifically handles case where path p exists, but it wasn't possible for the user to
* write to the parent directory.
*/
bool TryCreateDirectories(const fs::path& p)
{
try
{
return fs::create_directories(p);
} catch (const fs::filesystem_error&) {
if (!fs::exists(p) || !fs::is_directory(p))
throw;
}
// create_directories didn't create the directory, it had to have existed already
return false;
}
bool FileCommit(FILE *file)
{
if (fflush(file) != 0) { // harmless if redundantly called
LogPrintf("%s: fflush failed: %d\n", __func__, errno);
return false;
}
#ifdef WIN32
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
if (FlushFileBuffers(hFile) == 0) {
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
return false;
}
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
return false;
}
#elif HAVE_FDATASYNC
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
return false;
}
#else
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
LogPrintf("%s: fsync failed: %d\n", __func__, errno);
return false;
}
#endif
return true;
}
void DirectoryCommit(const fs::path &dirname)
{
#ifndef WIN32
FILE* file = fsbridge::fopen(dirname, "r");
if (file) {
fsync(fileno(file));
fclose(file);
}
#endif
}
bool TruncateFile(FILE *file, unsigned int length) {
#if defined(WIN32)
return _chsize(_fileno(file), length) == 0;
#else
return ftruncate(fileno(file), length) == 0;
#endif
}
/**
* this function tries to raise the file descriptor limit to the requested number.
* It returns the actual file descriptor limit (which may be more or less than nMinFD)
*/
int RaiseFileDescriptorLimit(int nMinFD) {
#if defined(WIN32)
return 2048;
#else
struct rlimit limitFD;
if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
if (limitFD.rlim_cur < (rlim_t)nMinFD) {
limitFD.rlim_cur = nMinFD;
if (limitFD.rlim_cur > limitFD.rlim_max)
limitFD.rlim_cur = limitFD.rlim_max;
setrlimit(RLIMIT_NOFILE, &limitFD);
getrlimit(RLIMIT_NOFILE, &limitFD);
}
return limitFD.rlim_cur;
}
return nMinFD; // getrlimit failed, assume it's fine
#endif
}
/**
* this function tries to make a particular range of a file allocated (corresponding to disk space)
* it is advisory, and the range specified in the arguments will never contain live data
*/
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
#if defined(WIN32)
// Windows-specific version
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
LARGE_INTEGER nFileSize;
int64_t nEndPos = (int64_t)offset + length;
nFileSize.u.LowPart = nEndPos & 0xFFFFFFFF;
nFileSize.u.HighPart = nEndPos >> 32;
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
SetEndOfFile(hFile);
#elif defined(MAC_OSX)
// OSX specific version
// NOTE: Contrary to other OS versions, the OSX version assumes that
// NOTE: offset is the size of the file.
fstore_t fst;
fst.fst_flags = F_ALLOCATECONTIG;
fst.fst_posmode = F_PEOFPOSMODE;
fst.fst_offset = 0;
fst.fst_length = length; // mac os fst_length takes the # of free bytes to allocate, not desired file size
fst.fst_bytesalloc = 0;
if (fcntl(fileno(file), F_PREALLOCATE, &fst) == -1) {
fst.fst_flags = F_ALLOCATEALL;
fcntl(fileno(file), F_PREALLOCATE, &fst);
}
ftruncate(fileno(file), static_cast<off_t>(offset) + length);
#else
#if defined(HAVE_POSIX_FALLOCATE)
// Version using posix_fallocate
off_t nEndPos = (off_t)offset + length;
if (0 == posix_fallocate(fileno(file), 0, nEndPos)) return;
#endif
// Fallback version
// TODO: just write one byte per block
static const char buf[65536] = {};
if (fseek(file, offset, SEEK_SET)) {
return;
}
while (length > 0) {
unsigned int now = 65536;
if (length < now)
now = length;
fwrite(buf, 1, now, file); // allowed to fail; this function is advisory anyway
length -= now;
}
#endif
}
#ifdef WIN32
fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
{
WCHAR pszPath[MAX_PATH] = L"";
if(SHGetSpecialFolderPathW(nullptr, pszPath, nFolder, fCreate))
{
return fs::path(pszPath);
}
LogPrintf("SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
#ifndef WIN32
std::string ShellEscape(const std::string& arg)
{
std::string escaped = arg;
boost::replace_all(escaped, "'", "'\"'\"'");
return "'" + escaped + "'";
}
#endif
#if HAVE_SYSTEM
void runCommand(const std::string& strCommand)
{
if (strCommand.empty()) return;
#ifndef WIN32
int nErr = ::system(strCommand.c_str());
#else
int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
#endif
if (nErr)
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}
#endif
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
{
#ifdef ENABLE_EXTERNAL_SIGNER
namespace bp = boost::process;
UniValue result_json;
bp::opstream stdin_stream;
bp::ipstream stdout_stream;
bp::ipstream stderr_stream;
if (str_command.empty()) return UniValue::VNULL;
bp::child c(
str_command,
bp::std_out > stdout_stream,
bp::std_err > stderr_stream,
bp::std_in < stdin_stream
);
if (!str_std_in.empty()) {
stdin_stream << str_std_in << std::endl;
}
stdin_stream.pipe().close();
std::string result;
std::string error;
std::getline(stdout_stream, result);
std::getline(stderr_stream, error);
c.wait();
const int n_error = c.exit_code();
if (n_error) throw std::runtime_error(strprintf("RunCommandParseJSON error: process(%s) returned %d: %s\n", str_command, n_error, error));
if (!result_json.read(result)) throw std::runtime_error("Unable to parse JSON: " + result);
return result_json;
#else
throw std::runtime_error("Compiled without external signing support (required for external signing).");
#endif // ENABLE_EXTERNAL_SIGNER
}
void SetupEnvironment()
{
#ifdef HAVE_MALLOPT_ARENA_MAX
// glibc-specific: On 32-bit systems set the number of arenas to 1.
// By default, since glibc 2.10, the C library will create up to two heap
// arenas per core. This is known to cause excessive virtual address space
// usage in our usage. Work around it by setting the maximum number of
// arenas to 1.
if (sizeof(void*) == 4) {
mallopt(M_ARENA_MAX, 1);
}
#endif
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
try {
std::locale(""); // Raises a runtime error if current locale is invalid
} catch (const std::runtime_error&) {
setenv("LC_ALL", "C.UTF-8", 1);
}
#elif defined(WIN32)
// Set the default input/output charset is utf-8
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
#endif
// The path locale is lazy initialized and to avoid deinitialization errors
// in multithreading environments, it is set explicitly by the main thread.
// A dummy locale is used to extract the internal default locale, used by
// fs::path, which is then used to explicitly imbue the path.
std::locale loc = fs::path::imbue(std::locale::classic());
#ifndef WIN32
fs::path::imbue(loc);
#else
fs::path::imbue(std::locale(loc, new std::codecvt_utf8_utf16<wchar_t>()));
#endif
}
bool SetupNetworking()
{
#ifdef WIN32
// Initialize Windows Sockets
WSADATA wsadata;
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
if (ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
return false;
#endif
return true;
}
int GetNumCores()
{
return std::thread::hardware_concurrency();
}
std::string CopyrightHolders(const std::string& strPrefix)
{
const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
std::string strCopyrightHolders = strPrefix + copyright_devs;
// Make sure Bitcoin Core copyright is not removed by accident
if (copyright_devs.find("Bitcoin Core") == std::string::npos) {
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
}
return strCopyrightHolders;
}
// Obtain the application startup time (used for uptime calculation)
int64_t GetStartupTime()
{
return nStartupTime;
}
fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific)
{
if (path.is_absolute()) {
return path;
}
return fsbridge::AbsPathJoin(net_specific ? gArgs.GetDataDirNet() : gArgs.GetDataDirBase(), path);
}
void ScheduleBatchPriority()
{
#ifdef SCHED_BATCH
const static sched_param param{};
const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m);
if (rc != 0) {
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc));
}
#endif
}
namespace util {
#ifdef WIN32
WinCmdLineArgs::WinCmdLineArgs()
{
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> utf8_cvt;
argv = new char*[argc];
args.resize(argc);
for (int i = 0; i < argc; i++) {
args[i] = utf8_cvt.to_bytes(wargv[i]);
argv[i] = &*args[i].begin();
}
LocalFree(wargv);
}
WinCmdLineArgs::~WinCmdLineArgs()
{
delete[] argv;
}
std::pair<int, char**> WinCmdLineArgs::get()
{
return std::make_pair(argc, argv);
}
#endif
} // namespace util
| instagibbs/bitcoin | src/util/system.cpp | C++ | mit | 46,739 |
Hi,我是鬼甲怪,一名cv算法工程师。我会在这里分享一些工作学习上的知识。在工作之余,我喜欢看视频、开黑打机。
受限于本人的学识,写(抄)出来的博文可能会有一些**小错误**,如果你发现了,请务必联系我(1195997479@qq.com)。:)
| simplestory/simplestory.github.io | _includes/about/zh.md | Markdown | mit | 317 |
<?php
namespace AppBundle\Command;
use FOS\UserBundle\Util\Canonicalizer;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Style\SymfonyStyle;
class CanonicalisationCommand extends ContainerAwareCommand {
public function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$em = $this->getContainer()->get('doctrine')->getManager();
$ms = $em->getRepository('AppBundle:Membre')->findAll();
$c = new Canonicalizer();
try {
// Enregistre l'email et le pseudo sous forme canonique pour chaque membre
foreach($ms as $m){
$m->setUsernameCanonical($c->canonicalize($m->getUsername()));
$m->setEmailCanonical($c->canonicalize($m->getEmail()));
$em->persist($m);
$em->flush();
}
$io->success('All members canonized.');
}
catch(Exception $e) {
$io->error([
$e->getCode() . ' : ' . $e->getMessage(),
]);
}
}
protected function configure () {
// On set le nom de la commande
$this->setName('app:member:canonize');
// On set la description
$this->setDescription("Canonilizing members");
// On set l'aide
$this->setHelp("Set field username_canonical and email_canonical for all members");
}
}
| alexdu98/Ambiguss | src/AppBundle/Command/CanonicalisationCommand.php | PHP | mit | 1,454 |
package apimanagement
// 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"
)
// GroupClient is the apiManagement Client
type GroupClient struct {
BaseClient
}
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewGroupClientWithBaseURI creates an instance of the GroupClient 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 NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates or Updates a group.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
// parameters - create parameters.
// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity.
func (client GroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (result GroupContract, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.CreateOrUpdate")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil},
{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil},
}},
}}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "CreateOrUpdate", err.Error())
}
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
return
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client GroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes specific group of the API Management service instance.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET
// request or it should be * for unconditional update.
func (client GroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Delete")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "Delete", err.Error())
}
req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure responding to request")
return
}
return
}
// DeletePreparer prepares the Delete request.
func (client GroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets the details of the group specified by its identifier.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
func (client GroupClient) Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Get")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "Get", err.Error())
}
req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, groupID)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure responding to request")
return
}
return
}
// GetPreparer prepares the Get request.
func (client GroupClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client GroupClient) GetResponder(resp *http.Response) (result GroupContract, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetEntityTag gets the entity state (Etag) version of the group specified by its identifier.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
func (client GroupClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.GetEntityTag")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "GetEntityTag", err.Error())
}
req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, groupID)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", nil, "Failure preparing request")
return
}
resp, err := client.GetEntityTagSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure sending request")
return
}
result, err = client.GetEntityTagResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure responding to request")
return
}
return
}
// GetEntityTagPreparer prepares the GetEntityTag request.
func (client GroupClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsHead(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetEntityTagSender sends the GetEntityTag request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetEntityTagSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetEntityTagResponder handles the response to the GetEntityTag request. The method always
// closes the http.Response Body.
func (client GroupClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// ListByService lists a collection of groups defined within a service instance.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// filter - | Field | Usage | Supported operators | Supported functions
// |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt
// | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt |
// substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt |
// substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>
// top - number of records to return.
// skip - number of records to skip.
func (client GroupClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService")
defer func() {
sc := -1
if result.gc.Response.Response != nil {
sc = result.gc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: top,
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
{TargetValue: skip,
Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "ListByService", err.Error())
}
result.fn = client.listByServiceNextResults
req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", nil, "Failure preparing request")
return
}
resp, err := client.ListByServiceSender(req)
if err != nil {
result.gc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure sending request")
return
}
result.gc, err = client.ListByServiceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure responding to request")
return
}
if result.gc.hasNextLink() && result.gc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListByServicePreparer prepares the ListByService request.
func (client GroupClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
if top != nil {
queryParameters["$top"] = autorest.Encode("query", *top)
}
if skip != nil {
queryParameters["$skip"] = autorest.Encode("query", *skip)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByServiceSender sends the ListByService request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListByServiceSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListByServiceResponder handles the response to the ListByService request. The method always
// closes the http.Response Body.
func (client GroupClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listByServiceNextResults retrieves the next set of results, if any.
func (client GroupClient) listByServiceNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) {
req, err := lastResults.groupCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByServiceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure sending next results request")
}
result, err = client.ListByServiceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required.
func (client GroupClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip)
return
}
// Update updates the details of the group specified by its identifier.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
// parameters - update parameters.
// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET
// request or it should be * for unconditional update.
func (client GroupClient) Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result GroupContract, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Update")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "Update", err.Error())
}
req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure responding to request")
return
}
return
}
// UpdatePreparer prepares the Update request.
func (client GroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
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.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
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 GroupClient) 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 GroupClient) UpdateResponder(resp *http.Response) (result GroupContract, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
| Azure/azure-sdk-for-go | services/preview/apimanagement/mgmt/2021-01-01-preview/apimanagement/group.go | GO | mit | 28,709 |
---
layout: post
title: No Class (Thanksgiving Break)
lesson_num: '00'
week_num: 14
class_date: November 26, 2014
lead:
dontlink: true
---
## Due For This Class
## Presentation
## Lesson Heading
## Homework
| com372-14/com372-14.github.io | _lessons/2014-11-26.md | Markdown | mit | 214 |
var module = angular.module('mtg', ['ngRoute', 'timer']);
DEBUG = true;
module.controller('main', function($scope, $filter) {
$scope.matches = [];
$scope.players = [{}, {}];
var orderBy = $filter('orderBy');
$scope.importFromStorage = function() {
console.log("Importing from local storage");
tourney = JSON.parse(localStorage.tourney);
console.log(tourney);
$scope.title = tourney.title;
$scope.players = tourney.players;
$scope.matches = tourney.matches;
// ugly way of rebind players to respective matches.
for(var m = 0; m < $scope.matches.length; m++)
{
for(var i = 0; i < $scope.players.length; i++) {
if($scope.matches[m].players[0].id == $scope.players[i].id)
$scope.matches[m].players[0] = $scope.players[i];
if($scope.matches[m].players[1].id == $scope.players[i].id)
$scope.matches[m].players[1] = $scope.players[i];
}
}
$scope.inited = true;
$scope.updatePlayerRanks();
};
$scope.exportToStorage = function() {
localStorage.tourney = JSON.stringify({
players: $scope.players,
matches: $scope.matches,
title: $scope.title,
inited: $scope.inited,
});
console.log("Exported to storage");
};
$scope.initPlayers = function() {
for(var p = 0; p < $scope.players.length; p++) {
$scope.players[p].won =
$scope.players[p].lost =
$scope.players[p].draw = 0;
$scope.players[p].rank = 1;
$scope.players[p].id = p;
}
};
$scope.updatePlayerRanks = function() {
$scope.players = orderBy($scope.players, ['-won','-draw']);
prev = $scope.players[0];
prev.rank = 1;
for(var i = 1; i < $scope.players.length; i++) {
curr = $scope.players[i];
if(curr.won == prev.won && curr.draw == prev.draw) // Not counting losses here.
{
curr.rank = prev.rank;
} else {
curr.rank = prev.rank + 1;
prev = curr;
}
}
console.log($scope.players);
};
$scope.createMatches = function() {
$scope.matches = [];
index = 0;
for(var p = 0; p < $scope.players.length; p++) {
var player1 = $scope.players[p];
for(var p2 = p+1; p2 < $scope.players.length; p2++) {
var player2 = $scope.players[p2];
var match = {
players: [player1, player2],
scores: [0, 0],
status: 'queued',
index: -1
}
$scope.matches.push(match);
}
}
// Semi-Random ordering of the matches.
// Should be so that min n-1 players have a match in the first
// round. This problem could be reduced to finding a Hamilton path...
indexes = [];
for(var i = 0; i < $scope.matches.length; i++)
indexes.push(i);
// Random shuffle. This could probably be improved in terms of efficiency.
matches_without_index = [];
while(indexes.length > 0) {
pick = Math.floor(Math.random() * indexes.length);
ind = indexes[pick];
matches_without_index.push(ind);
indexes.splice(pick, 1);
}
console.log(matches_without_index);
picked_players = [];
for(var i = 0; i < $scope.matches.length;) {
var m = 0;
for(; m < $scope.matches.length; m++) {
var match = $scope.matches[matches_without_index[m]]; // accessing the random order.
if(match.index > -1)
continue; // already visited.
if(picked_players.indexOf(match.players[0]) > -1 || picked_players.indexOf(match.players[1]) > -1)
continue; // at least one of the players already has a matchup this round.
match.index = i++;
picked_players.push(match.players[0]);
picked_players.push(match.players[1]);
break;
}
if(m == $scope.matches.length) {
picked_players = []; // new round.
}
}
$scope.matchesLeft = $scope.matches.length;
};
$scope.init = function() {
console.log("Init was called");
$scope.inited = true;
$scope.initPlayers();
$scope.createMatches();
$scope.exportToStorage();
};
$scope.matchEvaluator = function(a) {
statusorder = ['playing','queued','ended']
letters = ['a','b','c'];
return letters[statusorder.indexOf(a.status)] + a.index;
};
$scope.getMatchesLeft = function() {
var count = 0;
for(var i = 0; i < $scope.matches.length; i++)
if($scope.matches[i].status != 'ended')
count++;
return count;
};
$scope.reorderMatches = function() {
$scope.matches = orderBy($scope.matches, $scope.matchEvaluator, false);
$scope.exportToStorage();
};
$scope.startMatch = function(match) {
match.status = 'playing';
match.endtime = new Date().getTime() + 45*60*1000; // todo flytta till setting.
$scope.reorderMatches();
};
$scope.editMatch = function(match) {
match.status = 'playing';
if(match.scores[0] == match.scores[1])
{
match.players[0].draw -= 1;
match.players[1].draw -= 1;
} else if(match.scores[0] > match.scores[1]) {
match.players[0].won -= 1;
match.players[1].lost -= 1;
} else {
match.players[1].won -= 1;
match.players[0].lost -= 1;
}
$scope.updatePlayerRanks();
$scope.reorderMatches();
};
$scope.endMatch = function(match) {
match.status = 'ended';
if(match.scores[0] == match.scores[1])
{
match.players[0].draw += 1;
match.players[1].draw += 1;
} else if(match.scores[0] > match.scores[1]) {
match.players[0].won += 1;
match.players[1].lost += 1;
} else {
match.players[1].won += 1;
match.players[0].lost += 1;
}
$scope.reorderMatches();
$scope.updatePlayerRanks();
};
$scope.reset = function() {
$scope.matches = [];
$scope.players = [{}, {}];
$scope.inited = false;
if(DEBUG) {
$scope.players = [{name:'Herp'}, {name:'Derp'}, {name:'Merp'}];
}
$scope.exportToStorage();
};
if (localStorage.tourney) {
$scope.importFromStorage();
}
});
| Tethik/mtg | mtg.js | JavaScript | mit | 5,687 |
// Demo component
// this is only example component
// you can find tests in __test__ folder
import React from 'react';
import Button from './components/Button'
class TeamCatfish extends React.Component {
render() {
return (
<div className="team-catfish">
<p>TC</p>
</div>
)
}
};
module.exports = {
TeamCatfish,
...Button
} | anthonykulis/npm-test | src/index.js | JavaScript | mit | 399 |
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "v8.h"
#if defined(V8_TARGET_ARCH_MIPS)
#include "assembler.h"
#include "assembler-mips.h"
#include "assembler-mips-inl.h"
#include "frames-inl.h"
#include "mips/assembler-mips-inl.h"
#include "macro-assembler.h"
#include "macro-assembler-mips.h"
namespace v8 {
namespace internal {
Address ExitFrame::ComputeStackPointer(Address fp) {
return Memory::Address_at(fp + ExitFrameConstants::kSPOffset);
}
Register StubFailureTrampolineFrame::fp_register() { return v8::internal::fp; }
Register StubFailureTrampolineFrame::context_register() { return cp; }
} } // namespace v8::internal
#endif // V8_TARGET_ARCH_MIPS
| Noah-Huppert/Website-2013 | vhosts/www.noahhuppert.com/htdocs/trex/deps/v8/src/mips/frames-mips.cc | C++ | mit | 2,234 |
var LOTUS = Symbol.for('lotus');
var lotus = global[LOTUS];
if (!lotus) {
var lotusPath = process.env.LOTUS_PATH;
// Try using the local version.
if (lotusPath) {
lotusPath += '/lotus-require';
if (__dirname === lotusPath) {
// We are already using the local version.
}
else if (require('fs').existsSync(lotusPath)) {
lotus = require(lotusPath);
}
}
// Default to using the installed remote version.
if (!lotus) {
lotus = require('./js/index');
}
global[LOTUS] = lotus;
}
module.exports = lotus;
| aleclarson/lotus-require | index.js | JavaScript | mit | 554 |
using System;
namespace Timesheet.Domain
{
public class TimeRegistration
{
public Guid Id { get; set; }
public Guid TaskId { get; set; }
public string EmployeeId { get; set; }
public DateTimeOffset TimeStart { get; set; }
public DateTimeOffset TimeEnd { get; set; }
public TimeSpan Time { get; set; }
public string Remarks { get; set; }
}
}
| wcabus/MADN-oAuth | Timesheet.Domain/TimeRegistration.cs | C# | mit | 423 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.13.0">
<title>Murnau.Adapter.Labor.Api – murnau v0.0.1</title>
<link rel="stylesheet" href="dist/app-9c1e3d5aa2.css" />
<script src="dist/sidebar_items.js"></script>
</head>
<body data-type="modules">
<script>if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';</script>
<div class="main">
<button class="sidebar-toggle">
<i class="icon-menu"></i>
</button>
<section class="sidebar">
<a href="api-reference.html" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
murnau
</h1>
<h2 class="sidebar-projectVersion">
v0.0.1
</h2>
</div>
</a>
<div class="sidebar-search">
<i class="icon-search"></i>
<input type="text" class="sidebar-searchInput" placeholder="search" autocomplete="off" />
</div>
<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>
<li><a id="modules-list" href="#full-list">Modules</a></li>
</ul>
<ul id="full-list" class="sidebar-fullList"></ul>
<div class="sidebar-noResults"></div>
</section>
<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
<small class="visible-xs">murnau v0.0.1</small>
Murnau.Adapter.Labor.Api
<a href="https://github.com/freieslabor/murnau/blob/master/lib/murnau/adapter/labor/api.ex#L1" title="View Source" class="view-source" rel="help">
<i class="icon-code"></i>
</a>
</h1>
<section id="moduledoc" class="docstring">
<p>Provides API calls to the Labor-API.</p>
</section>
<section id="summary" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#summary">
<i class="icon-link"></i>
</a>
Summary
</h1>
<div class="summary-functions summary">
<h2>
<a href="#functions">Functions</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#cam_fetch/0">cam_fetch()</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#laborcam_current/0">laborcam_current()</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#room_close/0">room_close()</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#room_is_open?/0">room_is_open?()</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#room_open/0">room_open()</a>
</div>
</div>
</div>
</section>
<section id="functions" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#functions">
<i class="icon-link"></i>
</a>
Functions
</h1>
<div class="detail" id="cam_fetch/0">
<div class="detail-header">
<a href="#cam_fetch/0" class="detail-link" title="Link to this function">
<i class="icon-link"></i>
</a>
<span class="signature">cam_fetch()</span>
<a href="https://github.com/freieslabor/murnau/blob/master/lib/murnau/adapter/labor/api.ex#L52" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>
</div>
<section class="docstring">
</section>
</div>
<div class="detail" id="laborcam_current/0">
<div class="detail-header">
<a href="#laborcam_current/0" class="detail-link" title="Link to this function">
<i class="icon-link"></i>
</a>
<span class="signature">laborcam_current()</span>
<a href="https://github.com/freieslabor/murnau/blob/master/lib/murnau/adapter/labor/api.ex#L63" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>
</div>
<section class="docstring">
</section>
</div>
<div class="detail" id="room_close/0">
<div class="detail-header">
<a href="#room_close/0" class="detail-link" title="Link to this function">
<i class="icon-link"></i>
</a>
<span class="signature">room_close()</span>
<a href="https://github.com/freieslabor/murnau/blob/master/lib/murnau/adapter/labor/api.ex#L43" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>
</div>
<section class="docstring">
</section>
</div>
<div class="detail" id="room_is_open?/0">
<div class="detail-header">
<a href="#room_is_open?/0" class="detail-link" title="Link to this function">
<i class="icon-link"></i>
</a>
<span class="signature">room_is_open?()</span>
<a href="https://github.com/freieslabor/murnau/blob/master/lib/murnau/adapter/labor/api.ex#L25" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>
</div>
<section class="docstring">
</section>
</div>
<div class="detail" id="room_open/0">
<div class="detail-header">
<a href="#room_open/0" class="detail-link" title="Link to this function">
<i class="icon-link"></i>
</a>
<span class="signature">room_open()</span>
<a href="https://github.com/freieslabor/murnau/blob/master/lib/murnau/adapter/labor/api.ex#L34" class="view-source" rel="help" title="View Source">
<i class="icon-code"></i>
</a>
</div>
<section class="docstring">
</section>
</div>
</section>
<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.13.0),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
<button class="night-mode-toggle" />
</footer>
</div>
</div>
</section>
</div>
<script src="dist/app-21f1a20b9e.js"></script>
</body>
</html>
| freieslabor/murnau | doc/Murnau.Adapter.Labor.Api.html | HTML | mit | 6,599 |
<?php
class Shadowbox extends Modules {
static function __install() {
Like::install();
}
static function __uninstall($confirm) {
if ($confirm)
Like::uninstall();
}
static function admin_sb_settings($admin) {
if (!Visitor::current()->group->can("change_settings"))
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
if (empty($_POST))
return $admin->display("sb_settings");
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey)
show_403(__("Access Denied"), __("Invalid security key."));
$config = Config::current();
$initSetup = str_replace(array("\n", "\r", "\t", " "), '', $_POST['initSetup']);
if (empty($initSetup))
$initSetup = 'handleOversize: "drag",modal: true';
$set = array($config->set("module_sb",
array("initSetup" => $initSetup)
)
);
if (!in_array(false, $set))
Flash::notice(__("Settings updated."), "/admin/?action=sb_settings");
}
static function settings_nav($navs) {
if (Visitor::current()->group->can("change_settings"))
$navs["sb_settings"] = array("title" => __("Shadowbox", "shadowbox"));
return $navs;
}
public function head() {
$config = Config::current();
?>
<link rel="stylesheet" href="<?php echo $config->chyrp_url; ?>/modules/shadowbox/src/shadowbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo $config->chyrp_url; ?>/modules/shadowbox/src/shadowbox.js"></script>
<script type="text/javascript">
<?php $this->initJS(); ?>
</script>
<?php
}
public static function initJS(){
$config = Config::current();
?>//<script>
console.log("shadowbox loaded");
$(document).ready(function(){
//add attr to img linkwhich width>100
$("#content img").each(function(e){
var a = $(this).parent();
if (a.attr("class")!="liked" && a.attr("class")!="like")
a.attr("rel","shadowbox");
});
$("#content a").each(function(e){
var img = $("img",this)[0];
});
//init shadowbox
Shadowbox.init({
<?php
echo $config->module_sb["initSetup"];
?>
});
});
<?php
}
}
| parttimenerd/chyrp_de | modules/shadowbox/shadowbox.php | PHP | mit | 2,824 |
module EasySerializer
class Cacher
attr_reader :serializer, :metadata
def initialize(serializer, metadata)
@serializer = serializer
@metadata = metadata
end
def execute
CacheOutput.new(_execute)
end
private
def _execute
strategy = if metadata.is_a?(EasySerializer::Collection)
Collection
elsif metadata.serializer?
Serializer
else
Method
end
strategy.call(serializer, metadata)
end
end
end
require 'easy_serializer/cacher/template'
require 'easy_serializer/cacher/collection'
require 'easy_serializer/cacher/method'
require 'easy_serializer/cacher/serializer'
| arturictus/easy_serializer | lib/easy_serializer/cacher.rb | Ruby | mit | 738 |
import { compose, combineReducers, createStore } from 'redux';
import { devTools } from 'redux-devtools';
import twist from './reducers/twist';
import form from './reducers/form';
const twister = combineReducers({
twist,
form
});
const finalCreateStore = compose(devTools())(createStore);
export default finalCreateStore(twister);
| mvader/reactmad-redux-example | src/store.js | JavaScript | mit | 338 |
# Linear function - full rank
#
# Source: Problem 32 in
# J.J. More', B.S. Garbow and K.E. Hillstrom,
# "Testing Unconstrained Optimization Software",
# ACM Transactions on Mathematical Software, vol. 7(1), pp. 17-41, 1981.
#
# See also Buckley#80 (with different N and M)
#
# classification SUR2-AN-V-0
export arglina
"Linear function with `n` parameters and `m` observations - full rank"
function arglina(n::Int=100, m::Int=2n)
m < n && @warn("arglina: must have m ≥ n")
m = max(m, n)
nlp = Model()
@variable(nlp, x[j=1:n], start=1.0)
@NLobjective(
nlp,
Min,
sum((x[i] - 2/m * sum(x[j] for j = 1:n) - 1)^2 for i = 1:n) + sum((-2/m * sum(x[j] for j = 1:n) - 1)^2 for i = n+1:m)
)
return nlp
end
| dpo/OptimizationProblems.jl | src/arglina.jl | Julia | mit | 746 |
require "pact_broker/configuration"
require "pact_broker/logging"
require "pact_broker/config/setting"
require "pact_broker/config/space_delimited_string_list"
module PactBroker
module Config
class Load
include PactBroker::Logging
def self.call runtime_configuration
new(runtime_configuration).call
end
def initialize runtime_configuration
@runtime_configuration = runtime_configuration
end
def call
Setting.each do | setting |
set_value_on_configuration setting
end
end
private
attr_reader :runtime_configuration
def configuration_attribute_exists? setting
runtime_configuration.respond_to?("#{setting.name}=")
end
def unset_or_value_from_default? setting
setting_source(setting).nil? || setting_source(setting)[:type] == :defaults
end
def setting_source(setting)
runtime_configuration.to_source_trace.dig(setting.name, :source)
end
def set_value_on_configuration setting
if configuration_attribute_exists?(setting)
if unset_or_value_from_default?(setting)
runtime_configuration.send("#{setting.name}=", setting.value_object)
else
logger.debug("Ignoring #{setting.name} configuration from database, as it has been set by another source #{setting_source(setting)}")
end
else
logger.warn("Could not load configuration setting \"#{setting.name}\" as there is no matching attribute on the #{runtime_configuration.class} class")
end
end
end
end
end
| pact-foundation/pact_broker | lib/pact_broker/config/load.rb | Ruby | mit | 1,624 |
# Atto PHP Framework
[![Build Status]](https://travis-ci.org/stephen-hill/Atto)
[![Test Coverage]](https://coveralls.io/r/stephen-hill/Atto)
[![SemVer]](http://semver.org)
Atto is a PHP Framework solely for developing RESTful APIs.
[Build Status]: http://img.shields.io/travis/stephen-hill/Atto/master.svg?style=flat-square
[Test Coverage]: http://img.shields.io/coveralls/stephen-hill/Atto/master.svg?style=flat-square
[SemVer]: http://img.shields.io/:semver-master-brightgreen.svg?style=flat-square
| stephen-hill/Atto | readme.md | Markdown | mit | 504 |
'use strict';
describe('Controller: HomeCtrl', function () {
it('should make a unit test ...', function () {
});
});
| topheman/cycle-infos | test/spec/controllers/home.js | JavaScript | mit | 123 |
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Action;
use Fig\Http\Message\StatusCodeInterface;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Crawling\CrawlingHelperInterface;
use function sprintf;
use const PHP_EOL;
class RobotsAction implements RequestHandlerInterface, StatusCodeInterface
{
public function __construct(private CrawlingHelperInterface $crawlingHelper)
{
}
public function handle(ServerRequestInterface $request): ResponseInterface
{
// @phpstan-ignore-next-line The "Response" phpdoc is wrong
return new Response(self::STATUS_OK, ['Content-type' => 'text/plain'], $this->buildRobots());
}
private function buildRobots(): iterable
{
yield <<<ROBOTS
# For more information about the robots.txt standard, see:
# https://www.robotstxt.org/orig.html
User-agent: *
ROBOTS;
$shortCodes = $this->crawlingHelper->listCrawlableShortCodes();
foreach ($shortCodes as $shortCode) {
yield sprintf('Allow: /%s%s', $shortCode, PHP_EOL);
}
yield 'Disallow: /';
}
}
| shlinkio/shlink | module/Core/src/Action/RobotsAction.php | PHP | mit | 1,270 |
body {
padding: 50px;
}
html {
position: relative;
min-height: 100%;
}
body {
padding-top: 60px;
padding-left: 0;
padding-right: 0;
margin-bottom: 75px;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
line-height: 45px;
}
div.alert-container {
width: 100%;
position: absolute;
z-index: 1;
}
div.alert {
margin-left: 25%;
width: 50%;
position: relative;
} | dwetterau/quill-firebase | src/public/stylesheets/style.css | CSS | mit | 432 |
import cx_Freeze
import sys
import os
executables = [cx_Freeze.Executable("MusicCompiler.py", base=None)]
cx_Freeze.setup(
name= "MusicCompiler",
description = "Best Program Ever Known To Humanity.",
author = "Space Sheep Enterprises",
options = {"build_exe":{"excludes":["urllib","html","http","tkinter","socket","multiprocessing","threading","email","htmllib"]}},
version = "1.0",
executables = executables
)
| Jonathan-Z/PowerShellMusic | setup.py | Python | mit | 457 |
FROM smebberson/alpine-nginx
MAINTAINER Scott Mebberson <scott@scottmebberson.com>
# Add the files
ADD root /
| withinboredom/docker-alpine | examples/user-nginx/Dockerfile | Dockerfile | mit | 111 |
---
layout: post
title: "Android Inter-Fragment Communication"
modified:
categories: blog
excerpt:
tags: [Android, Coding]
image:
feature: so-simple-sample-image-5.jpg
comments: true
share: true
date: 2014-10-25T23:12:55-04:00
author: vlnvv
---
There are a bunch of tutorials on inter-fragment communications in Android.
For those who haven’t yet explored Android Fragments, the best way to communicate between fragments is through their parent activity. A fragment should never keep a hard reference of another fragment because doing so would ruin the main purpose of fragments, i.e., code reusability. A fragment should define an Interface and have it’s parent activity implement it (Refer [this](http://developer.android.com/training/basics/fragments/communicating.html)).

Let’s say we have 2 fragments: `Fragment 1` and `Fragment 2` and their parent activity, `MainActivity`. Now, to allow communication between fragments, Fragment 1 needs to define a Java Interface, which MainActivity will implement. So Fragment 1 can pass data to it’s parent activity through this interface. After receiving the data from Fragment 1, MainActivity can now call Fragment 2 by calling `findFragmentById(R.id.FragmentB_ID)` and pass the data.
This method works perfectly fine but there are cases where MainActivity will not have IDs of it’s Fragments. An example of such a case would be when using SwipeViews. When implementing SwipeViews, you’ll declare ViewPager in MainActivity’s layout file and add Fragments by creating instances dynamically. So you won’t have the IDs (nor tag names) of fragments.
This can be fixed easily in a couple of steps. You can't set the Tag name of Fragments but there is a method `getTag()`, which returns the tag name of the current Fragment.
####To sum up:
Fragment 1 defines an Interface which the MainActivity implements. When Fragment 1 wants to pass data, it calls a method of it’s Interface.
Now when Fragment 2 gets created, it passes it’s Tag name (by calling `getTag()` method) to MainActivity. When Fragment 1 needs to pass data to Fragment 2, it calls it’s Interface method to send data to MainActivity. Now, MainActivity can pass this data using `findFragmentByTag(FragmentB_TAG)`.
###Note:
The above method will work assuming Fragment 2 is still active (and not destroyed) when Fragment 1 passes data. If Fragment 2 hasn’t been created (or has been destroyed), `NullPointerException` will be thrown. | vlnvv/vlnvv.github.com | _posts/blog/2014-10-25-android-fragments.md | Markdown | mit | 2,545 |
package com.anji_ahni.nn.activationfunction;
/**
* Square-root function.
*
* @author Oliver Coleman
*/
public class PowerActivationFunction implements ActivationFunction, ActivationFunctionNonIntegrating {
/**
* identifying string
*/
public final static String NAME = "power";
/**
* @see Object#toString()
*/
public String toString() {
return NAME;
}
/**
* This class should only be accessd via ActivationFunctionFactory.
*/
PowerActivationFunction() {
// no-op
}
/**
* Not used, returns 0.
*/
@Override
public double apply(double input) {
return 0;
}
/**
* Return first input raised to the power of the absolute value of the second input (or just first input if no second input).
*/
@Override
public double apply(double[] input, double bias) {
if (input.length < 2)
return input[0];
double v = Math.pow(input[0], Math.abs(input[1]));
if (Double.isNaN(v)) return 0;
if (Double.isInfinite(v)) return v < 0 ? -Double.MAX_VALUE / 2 : Double.MAX_VALUE / 2;
return v;
}
/**
* @see com.anji_ahni.nn.activationfunction.ActivationFunction#getMaxValue()
*/
public double getMaxValue() {
return Double.MAX_VALUE;
}
/**
* @see com.anji_ahni.nn.activationfunction.ActivationFunction#getMinValue()
*/
public double getMinValue() {
return -Double.MAX_VALUE;
}
/**
* @see com.anji_ahni.nn.activationfunction.ActivationFunction#cost()
*/
public long cost() {
return 75;
}
}
| Fumaloko92/MSc-Thesis | 17-05-2017/neuralturingmachines-master/src/com/anji_ahni/nn/activationfunction/PowerActivationFunction.java | Java | mit | 1,453 |
# frozen_string_literal: true
class DocumentsController < ApplicationController
before_action :authenticate_user!, except: [:download]
layout "layouts/full_page_sidebar"
# GET /docs
def index
if current_user.can_view_unblinded_folder?
@documents = Document.latest_files
else
@documents = Document.latest_files_blinded
end
end
end
| sleepepi/patstrial.org | app/controllers/documents_controller.rb | Ruby | mit | 367 |
# 编码
本篇主要讲述计算机编码相关的知识,字集码是把字符集中的字符编码为指定集合中某一对象,以便文本在计算机中存储和通过通信网络的传递。主要有 ASCII、ISO西欧系列、DOS字符集、Windows字符集、亚洲字符集、Unicode。
## 编码历史
在计算机存储和传输的所有数据最终形态都是 0 或 1,为了能使传输字符就规定了一个数字对应一个字符,例如对于字母 a 来说,就是存入 97 这个数字,而在读取的时候遇到 97 自然也就知道了它代表的是 a。
为了使得所有的计算机都能知道这个约定,于是 ASCII 最早就被发明出来了,包含控制字符,标点,英文大小写,同时还是留了 128-255 来后续使用。
但是当时候的人们就没想到中文之类的非英文字符的编码问题。
后来计算机传入中国,砖家们发明了 GB212 编码,两个字节存储,通过第一个字节位来判断,如果是 0 代表是 ASCII, 1 代码是汉字。后来又有了些新的扩展 GBK 之类的。
但是其他国家地区就根本不知道这种编码规则,于是就诞生了各种编码,后来 ISO 着手解决这个问题。他们重新搞一个包括了地球上所有文化、所有字母和符号 的编码 --> `Universal Multiple-Octet Coded Character Set`,这就是 Unicode 的来源。
## Unicode
Unicode 目前实际应用的统一码版本对应于 UCS-2 ,使用16位的编码空间。也就是每个字符占用2个字节。这样理论上一共最多可以表示216(即65536)个字符。基本满足各种语言的使用。
## UTF
Unicode只是一个符号集,它只规定了符号的二进制代码,却没有规定这个如何存储传输。而二进制代码应该如何存储Unicode的实现方式不同于编码方式。一个字符的Unicode编码是确定的。但是在实际传输过程中,由于不同系统平台的设计不一定一致,以及出于节省空间的目的,对Unicode编码的实现方式有所不同。Unicode的实现方式称为Unicode转换格式(Unicode Transformation Format,简称为UTF)
## UTF-8
UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码,也是一种前缀码。它可以用来表示Unicode标准中的任何字符,且其编码中的第一个字节仍与ASCII兼容,这使得原来处理ASCII字符的软件无须或只须做少部分修改,即可继续使用。因此,它逐渐成为电子邮件、网页及其他存储或发送文字的应用中,优先采用的编码。
所以一个很明确的二者的区分就是 **UTF-8是Unicode的一种实现方式**。
UTF-8对应使用一至六个字节为每个字符编码,后来又改口了,2003年11月UTF-8被RFC 3629重新规范,只能使用原来Unicode定义的区域,U+0000到U+10FFFF,也就是说最多四个字节
1.128个US-ASCII字符只需一个字节编码(Unicode范围由U+0000至U+007F)。
2.带有附加符号的拉丁文、希腊文、西里尔字母、亚美尼亚语、希伯来文、阿拉伯文、叙利亚文及它拿字母则需要两个字节编码(Unicode范围由U+0080至U+07FF)。
3.其他基本多文种平面(BMP)中的字符(这包含了大部分常用字,如大部分的汉字)使用三个字节编码(Unicode范围由U+0800至U+FFFF)。
## 转换
UTF-8的编码结构长度是根据某单个字符的大小来决定长度有多少。
```text
1个字节:Unicode码为0 - 127
2个字节:Unicode码为128 - 2047
3个字节:Unicode码为2048 - 0xFFFF
4个字节:Unicode码为65536 - 0x1FFFFF
```
如下面的表格所示
<table>
<caption><b>Unicode 和 UTF-8 之间的转换关系表 ( <code>x</code> 字符表示码点占据的位 )</b></caption>
<tbody><tr>
<th>码点的位数</th>
<th>码点起值</th>
<th>码点终值</th>
<th>字节序列</th>
<th>Byte 1</th>
<th>Byte 2</th>
<th>Byte 3</th>
<th>Byte 4</th>
<th>Byte 5</th>
<th>Byte 6</th>
</tr>
<tr>
<th> 7</th>
<td>U+0000</td>
<td>U+007F</td>
<td style="text-align: center;">1</td>
<td><code>0xxxxxxx</code></td>
</tr>
<tr>
<th>11</th>
<td>U+0080</td>
<td>U+07FF</td>
<td style="text-align: center;">2</td>
<td><code>110xxxxx</code></td>
<td><code>10xxxxxx</code></td>
</tr>
<tr>
<th>16</th>
<td>U+0800</td>
<td>U+FFFF</td>
<td style="text-align: center;">3</td>
<td><code>1110xxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
</tr>
<tr>
<th>21</th>
<td>U+10000</td>
<td>U+1FFFFF</td>
<td style="text-align: center;">4</td>
<td><code>11110xxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
</tr>
<tr>
<th>26</th>
<td>U+200000</td>
<td>U+3FFFFFF</td>
<td style="text-align: center;">5</td>
<td><code>111110xx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
</tr>
<tr>
<th>31</th>
<td>U+4000000</td>
<td>U+7FFFFFFF</td>
<td style="text-align: center;">6</td>
<td><code>1111110x</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
<td><code>10xxxxxx</code></td>
</tr>
</tbody></table>
英文和英文字符的Unicode码为0 - 127,所以英文在Unicode和UTF-8中的长度和字节都是一致的,只占用1个字节。汉字的Unicode码区间为0x2e80 - 0x9fff, 所以汉字在UTF8中的长度最长为3个字节。
具体转换过程呢?
1.获取汉字的Unicode值,默认JS就是用Unicode编码的,所以通过`charCodeAt`很容易得到了。
2.明确字节数,根据上表通过charCode很容易知道在UTF8中应该占多少字节。
3.填充补码。根据上表将上面得到的Unicode码依次补到x位中去,补位码第一个字节前面有几个1就表示整个UTF-8编码占多少个字节。
## 举例
下面以一个汉字 "白" 的转换说明这个过程
首先通过 charCodeAt 得到 30333,并通过 `'白'.charCodeAt(0).toString(2)`得到其二进制 111011001111101 -> 01110110 01111101
然后发现其在 2048 - 0xFFFF 之间,得到 1110xxxx 10xxxxxx 10xxxxxx -> 1110 0111 10 011001 10 111101
最后就得到了 e7 99 bd 了,可以使用Node来验证下
```js
var buffer = new Buffer('白');
console.log(buffer.length); // => 3
console.log(buffer); // <Buffer e7 99 bd>
```
## 编码实现
```js
'use strict';
// 将字符转化为UTF8编码的字节数据
let toUTF = (str)=> {
let utf8 = [];
for (let i = 0; i < str.length; i++) {
let code = str.charCodeAt(i);
// ASCII 位于 U+0000~U+007F
if (0x00 <= code && code <= 0x7f) {
utf8.push(code);
// 两个字节的情况 U+0080~U+07FF
} else if (0x80 <= code && code <= 0x7ff) {
// 第一个字节是 11000000 | (00011111 & code 高位)
utf8.push((192 | (0x1f & (code >> 6))));
// 第二个字节 10000000 | (00111111 & code) code后6位
utf8.push((128 | (0x3f & code)));
// 三个字节
} else if ((0x800 <= code && code <= 0xd7ff)
|| (0xe000 <= code && code <= 0xffff)) {
// 依次三个字节的补齐
utf8.push((224 | (0xf & (code >> 12))));
utf8.push((128 | (0x3f & (code >> 6))));
utf8.push((128 | (0x3f & code)))
}
}
for (let i = 0; i < utf8.length; i++) {
let item = utf8[i];
item &= 0xff;
utf8[i] = item.toString(16);
}
return utf8;
};
let char = '白';
let buffer = new Buffer(char);
console.log(buffer);
console.log(toUTF(char));
// <Buffer e7 99 bd>
// [ 'e7', '99', 'bd' ]
```
## 解码
```js
let readUTF = (arr)=> {
// 解码的过程类似,根据补位码第一个字节前面有几个1就表示整个UTF-8编码占多少个字节!这是解码的关键
}
```
## 浏览器中使用
因为根据规范URI中的querystring必须按照UTF8的编码进行传输,而JavaScript是Unicode的,所以浏览器就给我们提供了一个方法,也就是`encodeURI/encodeURIComponent`方法
二者的差别是是否对 URL 编码,使用后者一般是将 URL 作为参数的时候
```js
encodeURI("http://www.google.com/a file with spaces.html") // http://www.google.com/a%20file%20with%20spaces.html
encodeURIComponent("http://www.google.com/a file with spaces.html") // http%3A%2F%2Fwww.google.com%2Fa%20file%20with%20spaces.html
var param1 = encodeURIComponent("http://xyz.com/?a=12&b=55")
var url = "http://domain.com/?param1=" + param1 + "¶m2=99" // http://www.domain.com/?param1=http%3A%2F%2Fxyz.com%2F%Ffa%3D12%26b%3D55¶m2=99
```
回归正题
```js
let str = '白';
let code = encodeURI(str);
let codeArr = code.slice(1).split('%');
codeArr = codeArr.map(item=>parseInt(item, 16));
console.log(codeArr); // => [231, 153, 189]
```
解析回来用 `decodeURI/decodeURIComponent` 就可以了。
以上可以帮助大家了解到编码的原理,并且清楚转化过程,各种实现,谢谢~
| bq12345/bq12345.github.io | src/coding.md | Markdown | mit | 9,107 |
using EasyLOB.Data;
using System.Collections.Generic;
namespace Chinook.Data
{
public partial class Customer
{
#region Profile
public static IZProfile Profile { get; private set; } = new ZProfile
(
Name: "Customer",
IsIdentity: true,
Keys: new List<string> { "CustomerId" },
Lookup: "FirstName",
LINQOrderBy: "FirstName",
LINQWhere: "CustomerId == @0",
Associations: new List<string>
{
"Employee",
},
Collections: new Dictionary<string, bool>
{
{ "CustomerDocuments", true },
{ "Invoices", true }
},
Properties: new List<IZProfileProperty>
{
// Grd Grd Grd Edt Edt Edt
// Vis Src Wdt Vis RO CSS Name
new ZProfileProperty(false, true , 50, false, false, "col-md-1", "CustomerId"),
new ZProfileProperty(true , true , 200, true , false, "col-md-4", "FirstName"),
new ZProfileProperty(true , true , 200, true , false, "col-md-2", "LastName"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Company"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Address"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "City"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "State"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Country"),
new ZProfileProperty(false, true , 100, true , false, "col-md-1", "PostalCode"),
new ZProfileProperty(false, true , 200, true , false, "col-md-3", "Phone"),
new ZProfileProperty(false, true , 200, true , false, "col-md-3", "Fax"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Email"),
new ZProfileProperty(false, false, 50, true , false, "col-md-1", "SupportRepId"),
new ZProfileProperty(true , true , 200, false, false, "col-md-4", "EmployeeLookupText")
}
);
#endregion Profile
}
}
| EasyLOB/EasyLOB-Chinook-2 | Chinook.Data/Profiles/CustomerProfile.cs | C# | mit | 2,406 |
using System;
class PrintLongSequence
{
static void Main(string[] args)
{
for (int i = 2; i <= 1002; i++)
{
if ((i%2)==0)
{
Console.WriteLine(i);
}
else
{
Console.WriteLine(-i);
}
}
}
}
| KrisPetkov/Test-repository | Intro-Programming/16.Print-Long-Sequence/PrintLongSequence.cs | C# | mit | 331 |
<?php
namespace App\Jobs\Auth;
use App\Jobs\Job;
use App\Storage\EmailConfirmation\EmailConfirmationRepository;
use Illuminate\Support\Facades\Mail;
class SendEmailChangeConfirmation extends Job
{
protected $newEmail;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($newEmail)
{
$this->newEmail = $newEmail;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(EmailConfirmationRepository $tokens)
{
$token = str_random(5);
$tokens->store($this->newEmail, $token);
Mail::queue('emails.auth.email_change_confirmation', ['new_email' => $this->newEmail, 'token' => $token], function ($m) {
$m->to($this->newEmail)->subject('Email Change');
});
}
}
| adiachenko/catchy_api | app/Jobs/Auth/SendEmailChangeConfirmation.php | PHP | mit | 828 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>error-handlers: 17 s 🏆</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.12.1 / error-handlers - 1.0.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
error-handlers
<small>
1.0.0
<span class="label label-success">17 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-12-26 01:44:44 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-26 01:44:44 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.12.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "dev@clarus.me"
homepage: "https://github.com/clarus/coq-error-handlers"
dev-repo: "git+https://github.com/clarus/coq-error-handlers.git"
bug-reports: "https://github.com/clarus/coq-error-handlers/issues"
authors: ["Guillaume Claret"]
license: "MIT"
build: [
["./configure.sh"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ErrorHandlers"]
depends: [
"ocaml"
"coq" {>= "8.4pl4"}
]
synopsis: "Simple and robust error handling functions"
flags: light-uninstall
url {
src: "https://github.com/clarus/coq-error-handlers/archive/1.0.0.tar.gz"
checksum: "md5=1e69cdf94ba20cc0b7ac89fc0644c840"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-error-handlers.1.0.0 coq.8.12.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-error-handlers.1.0.0 coq.8.12.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>12 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-error-handlers.1.0.0 coq.8.12.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>17 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 5 K</p>
<ul>
<li>3 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/ErrorHandlers/All.vo</code></li>
<li>2 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/ErrorHandlers/All.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/ErrorHandlers/All.v</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-error-handlers.1.0.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.06.1-2.0.5/released/8.12.1/error-handlers/1.0.0.html | HTML | mit | 6,630 |
<p>Busca de JSON em uma API sem CORS usando <a href="http://cors-server.getup.io/">http://cors-server.getup.io/</a>
</p>
<form data-ng-submit="submit()">
<label for="url">
<input type="text" name="url" data-ng-model="url">
<!-- <button data-ng-click="find(url)">Buscar</button> -->
<input type="submit" value="Buscar">
</label>
<p>
Buscando em: {{ urlFull }}
</p>
</form>
<div class="spinner" ng-show="loading">
<img src="img/ajax-loader.gif">
</div>
<blockquote>
{{ data }}
</blockquote>
| suissa/cors-server-client | app/partials/partial1.html | HTML | mit | 520 |
# Vagrant HP Provider
[](http://badge.fury.io/rb/vagrant-hp) [](https://gemnasium.com/mohitsethi/vagrant-hp) [](https://codeclimate.com/github/mohitsethi/vagrant-hp) [](https://travis-ci.org/mohitsethi/vagrant-hp) [](https://coveralls.io/r/mohitsethi/vagrant-hp)
This is a [Vagrant](http://www.vagrantup.com) 1.1+ plugin that adds an [HP](http://www.hpcloud.com)
provider to Vagrant, allowing Vagrant to control and provision machines on HP Cloud.
**NOTE:** This plugin requires Vagrant 1.1+,
## Features
* Boot Servers on HP Cloud
* Auto Floating-IP management
* SSH into the instances.
* Provision the instances with any built-in Vagrant provisioner.
* Minimal synced folder support via `rsync`.
## Usage
Install using standard Vagrant 1.1+ plugin installation methods. After
installing, `vagrant up` and specify the `hp` provider. An example is
shown below.
```
$ vagrant plugin install vagrant-hp
...
$ vagrant up --provider=hp
...
```
Of course prior to doing this, you'll need to obtain an HP-compatible
box file for Vagrant.
## Quick Start
After installing the plugin (instructions above), the quickest way to get
started is to actually use a dummy HP box and specify all the details
manually within a `config.vm.provider` block. So first, add the dummy
box using any name you want:
```
$ vagrant box add dummy https://github.com/mohitsethi/vagrant-hp/raw/master/dummy_hp.box
...
```
And then make a Vagrantfile that looks like the following, filling in
your information where necessary.
```
Vagrant.configure("2") do |config|
config.vm.box = "dummy"
config.vm.provider :hp do |rs|
rs.access_key = "<hp_access_key>"
rs.secret_key = "<hp_secret_key>"
rs.flavor = "standard.xsmall"
rs.tenant_id = "<hp_tenant_id>"
rs.server_name = "<server_name>"
rs.image = "Ubuntu Precise 12.04 LTS Server 64-bit 20121026 (b)"
rs.keypair_name = "<your_key_pair_name_on_hpcloud>"
rs.ssh_private_key_path = "<private_key_location>"
rs.ssh_username = "<ssh_username>"
rs.availability_zone = "az1"
# Security Groups defaults to ["default"]
# rs.security_groups = ["group1", "group2"]
rs.floating_ip ="33.33.33.10" # Optional
rs.network = ["830744ee-38a8-4618-a1eb-7c06fcsdf78", "Test_Network"] # Optional
end
end
```
And then run `vagrant up --provider=hp`.
This will start an Ubuntu 12.04 instance in the az1 availability zone within
your HP Cloud account. And assuming your SSH information was filled in properly
within your Vagrantfile, SSH and provisioning will work as well.
Note that normally a lot of this boilerplate is encoded within the box
file, but the box file used for the quick start, the "dummy" box, has
no preconfigured defaults.
## Box Format
Every provider in Vagrant must introduce a custom box format. This
provider introduces `hp` boxes. You can view an example box in
the [example_box/ directory](https://github.com/mohitsethi/vagrant-hp/tree/master/example_box).
That directory also contains instructions on how to build a box.
The box format is basically just the required `metadata.json` file
along with a `Vagrantfile` that does default settings for the
provider-specific configuration for this provider.
## Configuration
This provider exposes quite a few provider-specific configuration options:
* `access_key` - The access key for accessing HP Cloud
* `image` - The Image-id or Image-Name to boot, such as
"Ubuntu Precise 12.04 LTS Server 64-bit 20121026 (b)"
* `availability_zone` - The availability zone to launch the server ['us-east', 'us-west'].
If nil, it will use 'us-west'.
* `flavor` - The type of flavor, such as "standard.xsmall"
* `keypair_name` - The name of the keypair to use to bootstrap image
which support it.
* `secret_key` - The secret access key for accessing HP Cloud.
* `ssh_private_key_path` - The path to the SSH private key. This overrides
`config.ssh.private_key_path`.
* `ssh_username` - The SSH username, which overrides `config.ssh.username`.
* `server_name` - The name of the server provisioned on HP Cloud.
* `tenant_id` - The tenant_id to launch the server.
* `security_groups` - An array of strings defining the security groups in which this VM is included.
These can be set like typical provider-specific configuration:
```ruby
Vagrant.configure("2") do |config|
# ... other stuff
config.vm.provider :hp do |rs|
rs.access_key = "<hp_access_key>"
rs.secret_key = "<hp_secret_key>"
rs.flavor = "standard.xsmall"
rs.tenant_id = "<hp_tenant_id>"
rs.server_name = "<server_name>"
rs.image = "Ubuntu Precise 12.04 LTS Server 64-bit 20121026 (b)"
rs.keypair_name = "<your_key_pair_name_on_hpcloud>"
rs.ssh_private_key_path = "<private_key_location>"
rs.ssh_username = "<ssh_username>"
rs.availability_zone = "az1"
# Security Groups defaults to ["default"]
# rs.security_groups = ["group1", "group2"]
rs.floating_ip ="33.33.33.10" # Optional
rs.network = ["830744ee-38a8-4618-a1eb-7c06fcsdf78", "Test_Network"] # Optional
end
end
```
## Networks
Networking features in the form of `config.vm.network` are not
supported with `vagrant-hp`, currently. If any of these are
specified, Vagrant will emit a warning, but will otherwise boot
the HP machine.
## Synced Folders
There is minimal support for synced folders. Upon `vagrant up`,
`vagrant reload`, and `vagrant provision`, the HP provider will use
`rsync` (if available) to uni-directionally sync the folder to
the remote machine over SSH.
This is good enough for all built-in Vagrant provisioners (shell,
chef, and puppet) to work!
## Development
To work on the `vagrant-hp` plugin, clone this repository out, and use
[Bundler](http://gembundler.com) to get the dependencies:
```
$ bundle
```
Once you have the dependencies, verify the unit tests pass with `rake`:
```
$ bundle exec rake
```
If those pass, you're ready to start developing the plugin. You can test
the plugin without installing it into your Vagrant environment by just
creating a `Vagrantfile` in the top level of this directory (it is gitignored)
that uses it, and uses bundler to execute Vagrant:
```
$ bundle exec vagrant up --provider=hp
```
License and Author
Author:: Mohit Sethi mohit@sethis.in [](https://coderwall.com/mohitsethi)
Copyright:: 2014, Mohit Sethi
| mohitsethi/vagrant-hp | README.md | Markdown | mit | 6,746 |
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="bc.css">
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js" type="text/javascript"></script>
</head>
<!---
- 17047221 [ADN Support]
- VS operation could not be Completed, Unspecified Error
https://autodesk.slack.com/archives/C0SJ4U3PE/p1602528759049500
Andrew Bushnell
A little PSA for revit developers. I have noticed for a little bit now (and have gotten questions from others) that when building Revit or RevitAdditions within Visual Studio you get strange build failures and the message is along the lines of:
21>Error: The operation could not be completed. Unspecified error
Based on my investigations, this is an issue where the Visual Studio IDE gets itself into a strange state and the project in question has not been loaded properly for some reason.. I have not really traced down the steps that tend to cause, this.. For me I have found it related to switching project configurations before the build or even switching solutions from say revit to revitadditions. It could also have to do with do a merge in git outside of the IDE that causes projects to change and reload.. Anyway, as I noted, I am not clear the exact steps, but when I do see the error, I found one of the following clears things up:
- Close and reopen the solution in question.
- Fully exit and restart Visual Studio.
Anyway, FYI... (edited)
Jaap van der Weide 11 hours ago
Could it have something to do with switching 3rd party header links when switching from debug to release?
Andrew Bushnell 11 hours ago
it may, but I have seen it just simple closing revit.sln and loading revitadditions, upon building tje newly loaded RevitAdditions.sln I would get the error..
Dragos Turmac 2 hours ago
Ah. That. Actually, I also got it in Precast, which is a standalone C# solution with some C++ projects. It usually appears while trying to compile the C++ projects, which are a interop dependency for the C# projects - my theory is that somehow the C# binary locks the C++ one and doesn’t let msbuild query it for… god knows what, since interop is done at runtime afaik ( never seen this error on rebuild, only build ). And yes, only VS restart cures it; fortunately we rarely touch the C++ projects so I just ignored this error so far. Maybe we should look into it more and fill a MS bug if it’s so widespread? (edited)
Jeremy Tammik < 1 minute ago
I never touch C++ code, only C# Revit add-ins, and I see this message now and then as well. I just restart VS or even reboot Windows (under Parallels on Mac) and all is well.
twitter:
Keep things simple, or rack your brain. In one case, that can easily be avoided by using a using statement in the #RevitAPI @AutodeskForge @AutodeskRevit #bim #DynamoBim #ForgeDevCon http://bit.ly/usingusing
You should always keep things simple (I think).
The opposite can lead to racking your brain.
In one case at least, that can easily be avoided by using a <code>using</code> statement
– Avoid brain racking by using <code>using</code>
– On the VS operation unspecified error
– Native sons...
linkedin:
Keep things simple, or rack your brain. In one case, that can easily be avoided by using a using statement in the #RevitAPI
http://bit.ly/usingusing
You should always keep things simple (I think).
The opposite can lead to racking your brain.
In one case at least, that can easily be avoided by using a using statement:
- Avoid brain racking by using using
- On the VS operation unspecified error
- Native sons...
#bim #DynamoBim #ForgeDevCon #Revit #API #IFC #SDK #AI #VisualStudio #Autodesk #AEC #adsk
the [Revit API discussion forum](http://forums.autodesk.com/t5/revit-api-forum/bd-p/160) thread
<center>
<img src="img/" alt="" title="" width="600"/>
<p style="font-size: 80%; font-style:italic"></p>
</center>
-->
### Avoid Brain Racking by Using Using
You should always keep things simple (I think).
The opposite can lead to racking your brain.
In one case at least, that can easily be avoided by using a `using` statement:
- [Avoid brain racking by using `using`](#2)
- [On the VS operation unspecified error](#3)
- [Native sons](#4)
####<a name="2"></a> Avoid Brain Racking by Using Using
Here is a quick note on the importance
of [using `using` to automagically dispose and roll back](http://thebuildingcoder.typepad.com/blog/2012/04/using-using-automagically-disposes-and-rolls-back.html) transactions
and transaction groups, and the grief and brain racking that can easily ensue from failing to do so:
**Question:** For certain users, my add-in is hard crashing Revit to the desktop.
No exceptions, just everything closes.
I’ve got the journal files and I wanted to get some help seeing if there is anything to learn from them.
**Answer:** Sorry to hear about the hard crashes. And on certain users' systems, to boot.
Is the problem reproducible?
Does it only happen on certain specific machines?
Do you have any idea at all where the problem might be?
Does it send error reports to Autodesk?
What context can cause it?
Do you think it is due to your add-in, or Revit, or both?
**Response:** Thanks for the follow up.
I was able to get a hold of a customer’s computer that was seeing the error and track it down.
I had a `TransactionGroup` that was started but never completed – I did not call `Assimilate` or `Rollback`.
Adding the missing rollback fixed the error.
I did a review of all my other code and confirmed I closed all my other transaction groups and transactions after I opened them.
Relying on the destructor to call rollback obviously is a bad idea and was not intentional.
The relevant lines from the journal file look like this:
<pre>
' 7:< REGEN_DOC_CONTEXT_INFO: Changing wrong atom in regeneration
' 7:< REGEN_DOC_CONTEXT_INFO: Document is changed in regeneration while it is not supposed to
</pre>
The transaction wasn’t closed and Revit tried to regenerate.
**Answer:** Congratulations on solving the issue!
Thank you very much for your research and useful explanation.
Were your transaction groups originally encapsulated in a `using` statement?
The Building Coder recommends doing so and claims that will obviate the need to call `Assimilate` or `Rollback`:
[Using Using Automagically Disposes and Rolls Back](http://thebuildingcoder.typepad.com/blog/2012/04/using-using-automagically-disposes-and-rolls-back.html).
I would be a rather shocked if that would turn out to be false.
So, I hope your transaction group causing the problem was not enclosed in a `using` statement.
If that is the case, I would strongly recommend ALWAYS enclosing transactions and transaction groups in `using` statements.
That would (I still hope) reliably avoid this problem forever.
Can't wait to hear your response on this...
**Response:** Brilliant!
No, I was not using `using` in my code.
Makes perfect sense to do so to prevent errors like mine.
I’m going to work on adding that to my code. There are 170 places I use a transaction, so it’s going to be a little work.
Your blog is a great resource. I use it quite regularly when trying to figure things out.
I don’t have any interesting code snippet to share.
It’s basically a `TransactionGroup` with an `Assimilate` call in an `IF` statement and a forgotten `Rollback` in the `ELSE`.
<center>
<img src="img/brain-rack.png" alt="Brain rack" title="Brain rack" width="300"/> <!-- 519 -->
</center>
####<a name="3"></a> On the VS Operation Unspecified Error
A small note on the Visual Studio 'Operation could not be Completed, Unspecified Error':
You may have notices building Revit add-ins within Visual Studio getting strange build failures and a message along the lines of *21>Error: The operation could not be completed. Unspecified error*.
This seems to be an issue where the Visual Studio IDE gets itself into a strange state and the project in question has not been loaded properly for some reason.
I found it related to switching project configurations before the build or even switching solutions.
It could also have to do with do a merge in git outside of the IDE that causes projects to change and reload.
Anyway, without being clear the exact steps, when I do see the error, I found one of the following clears things up:
- Close and reopen the solution in question.
- Fully exit and restart Visual Studio.
Could it have something to do with switching header files, or switching from debug to release?
It may, but I have seen it just simple closing one solution and loading another.
I also got it in a standalone C# solution with some C++ projects.
It usually appears while trying to compile the C++ projects, which are a interop dependency for the C# projects – one theory is that somehow the C# binary locks the C++ one and doesn’t let msbuild query it for… god knows what, since interop is done at runtime afaik (never seen this error on rebuild, only build ).
And yes, only VS restart cures it; fortunately, we rarely touch the C++ projects, so I just ignored this error so far.
Jeremy adds: I never touch C++ code, only C# Revit add-ins, and I see this message now and then as well.
I just restart VS or even reboot Windows (under Parallels on Mac) and all is well.
####<a name="4"></a> Native Sons
John Candela pays tribute to Native Americans for Monday,
[Indigenous People's Day](https://en.wikipedia.org/wiki/Indigenous_Peoples%27_Day), with
his track [Native Sons](https://soundcloud.com/jdcandela/native-sons):
<center>
<iframe width="500" height="100" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/908029177&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe><div style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;"><a href="https://soundcloud.com/jdcandela" title="JC" target="_blank" style="color: #cccccc; text-decoration: none;">JC</a> · <a href="https://soundcloud.com/jdcandela/native-sons" title="Native Sons" target="_blank" style="color: #cccccc; text-decoration: none;">Native Sons</a></div>
</center>
| jeremytammik/tbc | a/1869_using_vs_racking.md | Markdown | mit | 10,519 |
# frozen_string_literal: true
name 'travis_packer_templates'
maintainer 'Travis CI GmbH'
maintainer_email 'contact+travis-packer-templates-cookbook@travis-ci.org'
license 'MIT'
description 'Installs/Configures travis_packer_templates'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
source_url 'https://github.com/travis-ci/packer-templates'
issues_url 'https://github.com/travis-ci/packer-templates/issues'
| travis-ci/packer-templates | cookbooks/travis_packer_templates/metadata.rb | Ruby | mit | 450 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>poltac: 1 m 4 s</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.8.1 / poltac - 0.8.8</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
poltac
<small>
0.8.8
<span class="label label-success">1 m 4 s</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-03-11 05:33:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-03-11 05:33:27 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.11 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.8.1 Formal proof management system.
num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.09.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.09.0 Official release 4.09.0
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "thery@sophia.inria.fr"
homepage: "https://github.com/thery/PolTac"
bug-reports: "https://github.com/thery/PolTac"
dev-repo: "git://github.com/thery/PolTac"
license: "LGPL"
authors: ["Laurent Théry"]
install: [
[make]
[make "install"]
]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/PolTac"]
depends: [
"ocaml"
"coq" {>= "8.8~" & < "8.11"}
]
synopsis:
"A set of tactics to deal with inequalities in Coq over N, Z and R:"
flags: light-uninstall
url {
src: "https://github.com/thery/PolTac/archive/8.8.zip"
checksum: "md5=ce09898d4435b50a4a9503d41623222f"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-poltac.0.8.8 coq.8.8.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 2h opam install -y --deps-only coq-poltac.0.8.8 coq.8.8.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>4 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 2h opam install -y -v coq-poltac.0.8.8 coq.8.8.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 m 4 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 3 M</p>
<ul>
<li>173 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolSBase.vo</code></li>
<li>158 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolAux.glob</code></li>
<li>142 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolAux.vo</code></li>
<li>118 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RSignTac.vo</code></li>
<li>100 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZSignTac.vo</code></li>
<li>88 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolSBase.glob</code></li>
<li>81 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolFBase.vo</code></li>
<li>80 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RSignTac.glob</code></li>
<li>77 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ReplaceTest.vo</code></li>
<li>58 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolR.vo</code></li>
<li>57 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolR.vo</code></li>
<li>56 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolR.vo</code></li>
<li>56 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Rex.vo</code></li>
<li>56 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolR.vo</code></li>
<li>53 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Zex.vo</code></li>
<li>52 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolRBase.vo</code></li>
<li>51 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolS.vo</code></li>
<li>51 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolS.vo</code></li>
<li>50 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolS.vo</code></li>
<li>50 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolS.vo</code></li>
<li>49 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NAux.vo</code></li>
<li>49 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolF.vo</code></li>
<li>49 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolF.vo</code></li>
<li>49 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Natex.vo</code></li>
<li>49 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Nex.vo</code></li>
<li>49 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolF.vo</code></li>
<li>48 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolF.vo</code></li>
<li>48 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NSignTac.vo</code></li>
<li>45 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolTac.vo</code></li>
<li>45 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RGroundTac.vo</code></li>
<li>42 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolTac.vo</code></li>
<li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolTac.vo</code></li>
<li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatSignTac.vo</code></li>
<li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ReplaceTest.glob</code></li>
<li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolTac.vo</code></li>
<li>39 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolTac.vo</code></li>
<li>34 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolFBase.glob</code></li>
<li>34 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolAux.v</code></li>
<li>32 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NGroundTac.vo</code></li>
<li>31 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolSBase.v</code></li>
<li>30 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolAuxList.vo</code></li>
<li>28 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatGroundTac.vo</code></li>
<li>26 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NSignTac.glob</code></li>
<li>26 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZSignTac.glob</code></li>
<li>24 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RSignTac.v</code></li>
<li>20 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolRBase.glob</code></li>
<li>18 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatSignTac.glob</code></li>
<li>15 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NAux.glob</code></li>
<li>14 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZSignTac.v</code></li>
<li>9 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolFBase.v</code></li>
<li>8 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Rex.glob</code></li>
<li>7 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolR.glob</code></li>
<li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolR.glob</code></li>
<li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NSignTac.v</code></li>
<li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Zex.glob</code></li>
<li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolR.glob</code></li>
<li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolR.glob</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatSignTac.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ReplaceTest.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolR.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolRBase.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolR.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolR.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolR.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NAux.v</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Nex.glob</code></li>
<li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Natex.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolS.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolS.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolS.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolS.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolF.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolF.glob</code></li>
<li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolF.glob</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/P.vo</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolF.glob</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolAuxList.glob</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolS.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolS.v</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Replace2.vo</code></li>
<li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RGroundTac.glob</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolS.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolS.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolF.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolF.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolF.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatGroundTac.glob</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolF.v</code></li>
<li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RGroundTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Rex.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Zex.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolAuxList.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Nex.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Natex.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatGroundTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/PolTac.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NGroundTac.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Replace2.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/P.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NGroundTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolTac.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolTac.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolTac.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolTac.glob</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/P.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NPolTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/NatPolTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/ZPolTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/RPolTac.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/PolTac/Replace2.glob</code></li>
</ul>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-poltac.0.8.8</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.09.0-2.0.5/released/8.8.1/poltac/0.8.8.html | HTML | mit | 18,416 |
using System; //default
using System.Collections.Generic; //dictionary,list
using System.Linq; //because jon skeet
using NetFwTypeLib; //firewall library
using System.Net.Sockets; //protocol enum
using System.Net; //IPAddress class
namespace msfw
{
/// <summary>
/// Provides a wrapper around the INetFwRule2 class and adds support for "serializing" the
/// rule into the same format as what is stored in the registry for group policy firewall rules
/// </summary>
public class MSFirewallRule
{
public INetFwRule2 rule;
public NET_FW_ACTION_ Action { get { return this.rule.Action; } }
public string ActionName { get { return MSFirewall.getActionName(this.rule.Action); } }
public string ApplicationName { get { return this.rule.ApplicationName; } }
public string AppAndService { get { return this.getAppAndService(); } }
public NET_FW_RULE_DIRECTION_ Direction { get { return this.rule.Direction; } }
public string DirectionName { get { return MSFirewall.getDirectionName(this.rule.Direction); } }
public bool Enabled { get { return this.rule.Enabled; } }
public string LocalAddresses { get { return this.getLocalAddresses(); } }
public string LocalPorts { get { return this.rule.LocalPorts ?? "*"; } }
public string Name { get { return this.rule.Name; } }
public int Profiles { get { return this.rule.Profiles; } }
public int Protocol { get { return this.rule.Protocol; } }
public string ProtocolName { get { return Enum.GetName(typeof(ProtocolType), rule.Protocol) ?? "*"; } }
public string RemoteAddresses { get { return this.getRemoteAddresses(); } }
public string RemotePorts { get { return this.rule.RemotePorts ?? "*"; } }
public string ServiceName { get { return this.rule.serviceName; } }
public bool Extended { get { return this.isExtended(); } }
/// <summary>
/// Constructor: takes in INetFwRule2.</summary>
public MSFirewallRule(INetFwRule2 rule)
{
this.rule = rule;
}
/// <summary>Constructor: Input is a "serialized" rule like one found in
/// "Software\Policies\Microsoft\WindowsFirewall\FirewallRules".</summary>
/// <remarks>See more details in the <see cref="parseRule"/> method</remarks>
public MSFirewallRule(string rulestr)
: this(rulestr, new Dictionary<string, string>())
{
}
/// <summary>
/// Constructor: Input is a "serialized" fw rule string like one found in
/// "Software\Policies\Microsoft\WindowsFirewall\FirewallRules"</summary>
/// <remarks>Allows variable substitution for key/values by providing
/// a dictionary of substitute information.
/// This is necessary since the registry rules store name/description
/// information in separate key/values.
/// See more details in the <see cref="parseRule"/> method</remarks>
public MSFirewallRule(string rulestr, Dictionary<string, string> info)
{
this.rule = this.parseRule(rulestr, info);
}
/// <summary>If rule contains attributes other than basic</summary>
/// <remarks>Basic attribures are:
/// 1. Action (Block, Allow)
/// 2. Direction (In, Out)
/// 3. Local IP Address/Port
/// 4. Remote IP Address/Port
/// 5. Application Name
/// 6. Rule Name</remarks>
private bool isExtended()
{
//basic
bool extended = false;
//if edge is false, then options is false
//rule.EdgeTraversal;
//rule.EdgeTraversalOptions;
if (this.rule.EdgeTraversal)
{
//Console.WriteLine("Edge:TRUE");
extended = true;
}
// "RemoteAccess", "Wireless", "Lan", and "All"
if(rule.InterfaceTypes != "All")
{
//Console.WriteLine("InterfaceTypes not all");
extended = true;
}
if (rule.Interfaces != null)
{
//Console.WriteLine("Interfaces not null");
extended = true;
}
if (rule.IcmpTypesAndCodes != null)
{
// Console.WriteLine("Icmp types and codes not all");
extended = true;
}
return extended;
}
/// <summary>Combines Application Name and Service Name</summary>
private string getAppAndService()
{
var appname = "*";
if (this.rule.ApplicationName != null)
{
appname = this.rule.ApplicationName;
if (this.rule.serviceName != null)
{
appname += ":" + this.rule.serviceName;
}
}
return appname;
}
/// <summary>Returns IP address, removing subnet mask for individual IPs (IPv4)</summary>
private string getLocalAddresses()
{
// TOOD: Support IPv6 LocalAddresses
var laddress = rule.LocalAddresses;
if (laddress.Contains("/255.255.255.255"))
{
laddress = laddress.Replace("/255.255.255.255", "");
}
return laddress ?? "*";
}
/// <summary>Returns IP address, removing subnet mask for individual IPs (IPv4)</summary>
private string getRemoteAddresses()
{
// TOOD: Support IPv6 RemoteAddresses
var raddress = rule.RemoteAddresses;
if (raddress.Contains("/255.255.255.255"))
{
raddress = raddress.Replace("/255.255.255.255", "");
}
return raddress ?? "*";
}
/// <summary>Parses a rule str to make a INetFwRule2</summary>
/// <remarks>This rule string is found in group policy rules and is undocumented,
/// as far as I can tell. I've done my best to document my findings here.
///
/// Field : rule Mapping : Values : Example
///"Action" : rule.Action : Allow,Block : Action=Allow
///"App" : rule.ApplicationName : Text : App=onenote.exe
///"Desc" : rule.Description : Text : Desc=My rule description
///"Dir" : rule.Direction : In,Out : Dir=In
///"Edge" : rule.EdgeTraversal : Bool : Edge=TRUE
///"Defer" : rule.EdgeTraversalOption : App,? : Defer=App
///"Active" : rule.Enabled : Bool : Active=TRUE
///"EmbedCtxt" : rule.Grouping : Text : EmbedCtxt=Core Networking
///"ICMP4","ICMP6" : rule.IcmpTypesAndCodes : :
///????????????????????? : rule.Interfaces : ??? :
///????????????????????? : rule.InterfaceTypes : ??? :
///"LA4","LA6" : rule.LocalAddresses : IP(s) or Enum : LA4=10.10.10.10 or LocalSubnet or ?
///"LPort","LPort2_10" : rule.LocalPorts : Port(s) or Enum : LPort=4500 or ?
///"Name" : rule.Name : Text : Name=My rule name
///"Profile" : rule.Profiles : Domain,Private,Public : Profile=Domain
///"Protocol" : rule.Protocol : ProtocolType : Protocol=6
///"RA4", "RA6" : rule.RemoteAddresses : IP(s) or Enum : RA4=10.10.10.10 or LocalSubnet or ?
///"RPort","RPort2_10" : rule.RemotePorts : Port(s) or Enum : RPort=4500 or ?
///"Svc" : rule.serviceName : Text : Svc=upnphost
///
/// Additional notes on fields:
///
/// All lists are comma-delimited
/// If not present, booleans are FALSE and normally restrictive fields allow all
/// "Action" : required. Will be "Allow" or "Block"
/// "App" : optional. Will be a complete path to an executable. Will be a complete path to svchost.exe if using "Svc" field
/// "Desc" : optional. Variable substitution needed for rules from registry.
/// "Dir" : required. Will be "In" or "Out"
/// "Edge" : optional. Will be "TRUE". Default is "FALSE"
/// "Defer" : optional. See enum NET_FW_EDGE_TRAVERSAL_TYPE_ for values. Only appears if "Edge" is TRUE and only used for DEFER_TO_APP and DEFER_TO_USER
/// "Active" : required. Will be "TRUE" or "FALSE"
/// "EmbedCtxt" : optional. Variable substitution needed for rules from registry.
/// "ICMP4" : optional. If Protocol is "Icmp", then list of allowed ICMP (v4) types and codes
/// "ICMP6" : optional. If Protocol is "IcmpV6", then list of allowed ICMP (v6) types and codes
/// "LA4" : optional. IPv4 Addresses (single, range, or subnet). Not allowed if "ICMP6" is defined.
/// "LA6" : optional. IPv6 Addresses (single, range, or subnet). Not allowed if "ICMP4" is defined.
/// "LPort" : optional. Port or port range.
/// TODO: complete field documentation
/// </remarks>
public INetFwRule2 parseRule(string rulestr, Dictionary<string, string> info)
{
INetFwRule2 rule = (INetFwRule2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
string[] ruleAttribs = rulestr.Split('|');
foreach (string ra in ruleAttribs)
{
var kv = ra.Split('=');
switch (kv[0])
{
case "":
case "v2.10":
//version ignore
break;
case "Action":
kv[1] = kv[1].ToLower();
if (kv[1] == "allow")
{
rule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
}
else if (kv[1] == "block")
{
rule.Action = NET_FW_ACTION_.NET_FW_ACTION_BLOCK;
}
else if (kv[1] == "max")
{
rule.Action = NET_FW_ACTION_.NET_FW_ACTION_MAX;
}
else
{
throw new Exception("parseRule: Unknown action in rule: " + kv[1]);
}
break;
case "Active":
kv[1] = kv[1].ToLower();
if (kv[1] == "true")
{
rule.Enabled = true;
}
else
{
rule.Enabled = false;
}
break;
case "App":
rule.ApplicationName = kv[1];
break;
case "Defer":
kv[1] = kv[1].ToLower();
if (kv[1] == "app")
{
rule.EdgeTraversalOptions = (int)NET_FW_EDGE_TRAVERSAL_TYPE_.NET_FW_EDGE_TRAVERSAL_TYPE_DEFER_TO_APP;
}
else
{
rule.EdgeTraversalOptions = (int)Enum.Parse(typeof(NET_FW_EDGE_TRAVERSAL_TYPE_), kv[1]);
}
break;
case "Desc":
if (info.ContainsKey(kv[1]))
{
rule.Description = info[kv[1]];
}
else
{
rule.Description = kv[1];
}
break;
case "Dir":
kv[1] = kv[1].ToLower();
if (kv[1] == "in")
{
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN;
}
else if (kv[1] == "out")
{
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT;
}
else if (kv[1] == "max")
{
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_MAX;
}
else
{
throw new Exception("parseRule: Unknown direction in rule: " + kv[1]);
}
break;
case "Edge":
kv[1] = kv[1].ToLower();
if (kv[1] == "true")
{
rule.EdgeTraversal = true;
}
else
{
rule.EdgeTraversal = false;
}
break;
case "EmbedCtxt":
if (info.ContainsKey(kv[1]))
{
rule.Grouping = info[kv[1]];
}
else
{
rule.Grouping = kv[1];
}
break;
case "ICMP4":
case "ICMP6":
if (rule.IcmpTypesAndCodes == "*")
{
rule.IcmpTypesAndCodes = kv[1];
}
else
{
//Console.WriteLine(rule.IcmpTypesAndCodes + " " + kv[1]);
rule.IcmpTypesAndCodes += "," + kv[1];
}
break;
case "LA4":
case "LA6":
if (rule.LocalAddresses == "*")
{
rule.LocalAddresses = kv[1];
}
else if (!rule.LocalAddresses.Contains(kv[1]))
{
rule.LocalAddresses += "," + kv[1];
}
break;
case "LPort":
if (rule.LocalPorts == "*")
{
//Console.WriteLine("init:" + kv[1]);
rule.LocalPorts = kv[1];
}
else
{
//Console.WriteLine("append: '" + rule.LocalPorts.ToString() + "'" + ":" + kv[1]);
rule.LocalPorts = rule.LocalPorts.ToString() + "," + kv[1];
}
break;
case "LPort2_10":
//todo:IPHTTPS maps to IPHTTPSIn AND IPTLSIn
//warning: unknown if correct; no example yet
rule.LocalPorts = kv[1];
break;
case "Name":
if (info.ContainsKey(kv[1]))
{
rule.Name = info[kv[1]];
}
else
{
rule.Name = kv[1];
}
break;
case "Profile":
if (rule.Profiles == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_ALL)
{
switch (kv[1])
{
case "Domain":
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN;
break;
case "Private":
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE;
break;
case "Public":
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC;
break;
}
}
else
{
switch (kv[1])
{
case "Domain":
rule.Profiles = rule.Profiles | (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN;
break;
case "Private":
rule.Profiles = rule.Profiles | (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE;
break;
case "Public":
rule.Profiles = rule.Profiles | (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC;
break;
}
}
break;
case "Protocol":
rule.Protocol = Int32.Parse(kv[1]);
break;
case "RA4":
case "RA6":
if (rule.RemoteAddresses == "*")
{
rule.RemoteAddresses = kv[1];
}
else if (!rule.RemoteAddresses.Contains(kv[1]))
{
rule.RemoteAddresses += "," + kv[1];
}
//Console.WriteLine(rule.RemoteAddresses + " + " + kv[1]);
//Console.WriteLine(rule.RemoteAddresses);
break;
case "RPort":
if (rule.RemotePorts == "*")
{
//Console.WriteLine("init:" + kv[1]);
rule.RemotePorts = kv[1];
}
else
{
//Console.WriteLine("append: '" + rule.RemotePorts.ToString() + "'" + ":" + kv[1]);
rule.RemotePorts += "," + kv[1];
}
break;
case "RPort2_10":
//does IPHTTPS maps to IPHTTPSOut AND IPTLSOut ????
//warning: unknown if correct; no example yet
rule.RemotePorts = kv[1];
break;
case "Svc":
rule.serviceName = kv[1];
break;
default:
throw new Exception("Uknown firewall rule type:" + kv[0]);
}
}
if (((rule.Profiles & (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN) == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN) &&
((rule.Profiles & (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE) == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE) &&
((rule.Profiles & (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC) == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC)
)
{
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_ALL;
}
return rule;
}
/// <summary>Returns the rule as a string using the same format as the group policy rules that are found in the registry</summary>
public override string ToString()
{
//todo: rule.Interfaces
//todo: rule.InterfaceTypes
INetFwRule2 rule = this.rule;
string rs = "v2.10";
var aorder = new List<string> { "Action", "Active", "Dir", "Protocol", "Profile", "ICMP4", "ICMP6", "LPort", "LPort2_10", "RPort", "RPort2_10", "LA4", "LA6", "RA4", "RA6", "App", "Svc", "Name", "Desc", "EmbedCtxt", "Edge", "Defer" };
var attributes = new Dictionary<string, List<string>>();
var strAddresses = new List<string> { "LocalSubnet", "DHCP", "DNS", "WINS", "DefaultGateway" };
IPAddress address;
var curA = "";
//required: if not present then "All"
curA = "Profile";
var fwProfiles = Enum.GetValues(typeof(NET_FW_PROFILE_TYPE2_));
foreach (NET_FW_PROFILE_TYPE2_ fwProfile in fwProfiles)
{
if (((NET_FW_PROFILE_TYPE2_)rule.Profiles & fwProfile) == fwProfile)
{
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + MSFirewall.getProfileName(fwProfile));
}
}
if ((NET_FW_PROFILE_TYPE2_)rule.Profiles == NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_ALL)
{
attributes.Remove(curA);
}
//optional
if (rule.Grouping != null)
{
curA = "EmbedCtxt";
attributes.Add(curA, new List<string> { curA + "=" + rule.Grouping });
}
//required
curA = "Name";
attributes.Add(curA, new List<string> { curA + "=" + rule.Name });
//required
curA = "Action";
attributes.Add(curA, new List<string> { curA + "=" + MSFirewall.getActionName(rule.Action) });
//optional
if (rule.Description != null)
{
curA = "Desc";
attributes.Add(curA, new List<string> { curA + "=" + rule.Description });
}
//required
curA = "Dir";
attributes.Add(curA, new List<string> { curA + "=" + MSFirewall.getDirectionName(rule.Direction) });
if (rule.ApplicationName != null)
{
curA = "App";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.ApplicationName);
}
if (rule.serviceName != null)
{
curA = "Svc";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.serviceName);
}
if (rule.LocalPorts != "*" && rule.LocalPorts != null)
{
foreach (string r in rule.LocalPorts.Split(','))
{
if (r == "IPHTTPS")
{
curA = "LPort2_10";
if (rule.Direction == NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN)
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSIn");
attributes[curA].Add(curA + "=IPHTTPSIn");
}
else
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSOut");
attributes[curA].Add(curA + "=IPHTTPSOut");
}
}
else
{
curA = "LPort";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + r);
}
}
}
if (rule.LocalAddresses != null && rule.LocalAddresses != "*")
{
var ra = rule.LocalAddresses.Split(',');
foreach (string r in ra)
{
curA = "";
if (strAddresses.Contains(r))
{
curA = "LA4,LA6";
}
else if (IPAddress.TryParse(r, out address))
{
switch (address.AddressFamily)
{
case System.Net.Sockets.AddressFamily.InterNetwork:
curA = "LA4";
break;
case System.Net.Sockets.AddressFamily.InterNetworkV6:
curA = "LA6";
break;
default:
throw new Exception("Unknown remote address: {0}" + r);
}
}
else if (r.Contains(':'))
{
curA = "LA6";
}
else
{
curA = "LA4";
}
if (curA != "")
{
foreach (string a in curA.Split(','))
{
if (!attributes.ContainsKey(a))
attributes.Add(a, new List<string>());
var sub = false;
if (r.Contains('-'))
{
var rtest = r.Split('-');
if (rtest[0] == rtest[1])
{
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
}
else if (r.Contains("/255.255.255.255"))
{
var rtest = r.Split('/');
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
if (!sub)
{
attributes[a].Add(a + "=" + r);
}
}
}
}
}
if (rule.RemotePorts != "*" && rule.RemotePorts != null)
{
foreach (string r in rule.RemotePorts.Split(','))
{
if (r == "IPHTTPS")
{
curA = "RPort2_10";
if (rule.Direction == NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN)
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSIn");
attributes[curA].Add(curA + "=IPHTTPSIn");
}
else
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSOut");
attributes[curA].Add(curA + "=IPHTTPSOut");
}
}
else
{
curA = "RPort";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + r);
}
}
}
//if any, not present
if (rule.RemoteAddresses != null && rule.RemoteAddresses != "*")
{
var ra = rule.RemoteAddresses.Split(',');
foreach (string r in ra)
{
curA = "";
if (strAddresses.Contains(r))
{
curA = "RA4,RA6";
}
else if (IPAddress.TryParse(r, out address))
{
switch (address.AddressFamily)
{
case System.Net.Sockets.AddressFamily.InterNetwork:
curA = "RA4";
break;
case System.Net.Sockets.AddressFamily.InterNetworkV6:
curA = "RA6";
break;
default:
throw new Exception("Unknown remote address: {0}" + r);
}
}
else if (r.Contains(':'))
{
curA = "RA6";
}
else
{
curA = "RA4";
}
if (curA != "")
{
foreach (string a in curA.Split(','))
{
if (!attributes.ContainsKey(a))
attributes.Add(a, new List<string>());
var sub = false;
if (r.Contains('-'))
{
var rtest = r.Split('-');
if (rtest[0] == rtest[1])
{
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
}
else if (r.Contains("/255.255.255.255"))
{
var rtest = r.Split('/');
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
if (!sub)
{
attributes[a].Add(a + "=" + r);
}
}
}
}
}
//if any, then no setting
if (rule.Protocol != 256) //any
{
curA = "Protocol";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.Protocol);
}
//required
curA = "Active";
if (rule.Enabled)
attributes.Add(curA, new List<string> { curA + "=TRUE" });
else
attributes.Add(curA, new List<string> { curA + "=FALSE" });
//if not present, then false
if (rule.EdgeTraversal)
{
curA = "Edge";
attributes.Add(curA, new List<string> { curA + "=TRUE" });
}
//if any, then no setting
curA = "Defer";
if (rule.EdgeTraversalOptions > 0)
{
if (rule.EdgeTraversalOptions == (int)NET_FW_EDGE_TRAVERSAL_TYPE_.NET_FW_EDGE_TRAVERSAL_TYPE_DEFER_TO_APP)
{
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=App");
}
else if (rule.EdgeTraversalOptions == (int)NET_FW_EDGE_TRAVERSAL_TYPE_.NET_FW_EDGE_TRAVERSAL_TYPE_ALLOW)
{
//do nothing because rule.EdgeTraversal should be set to true already
}
else
{
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.EdgeTraversalOptions);
}
}
if (rule.IcmpTypesAndCodes != null)
{
if (rule.Protocol == 1)
{
curA = "ICMP4";
}
else if (rule.Protocol == 58)
{
curA = "ICMP6";
}
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.IcmpTypesAndCodes);
}
//ICMPv6 shouldn't have v4 local addresses and vice versa
// TODO: add 41,43,44,59,60 (test first)
if (rule.Protocol == 58 && attributes.ContainsKey("LA4"))
{
attributes.Remove("LA4");
}
else if (rule.Protocol == 1 && attributes.ContainsKey("LA6"))
{
attributes.Remove("LA6");
}
//ICMPv6 shouldn't have v4 remote addresses and vice versa
// TODO: add 41,43,44,59,60 (test first)
if (rule.Protocol == 58 && attributes.ContainsKey("RA4"))
{
attributes.Remove("RA4");
}
else if (rule.Protocol == 1 && attributes.ContainsKey("RA6"))
{
attributes.Remove("RA6");
}
//preserve order of keys
foreach (var a in aorder)
{
if (attributes.ContainsKey(a))
{
rs = rs + "|" + String.Join("|", attributes[a]);
}
}
rs = rs + "|";
return rs;
}
}
} | caesarshift/msfw | msfw/MSFirewallRule.cs | C# | mit | 34,510 |
const
pObj=pico.export('pico/obj'),
fb=require('api/fbJSON'),
rdTrip=require('redis/trip')
return {
setup(context,cb){
cb()
},
addPickup(user,action,evt,name,next){
const text=pObj.dotchain(evt,['message','text'])
if(!text) return next(null,`fb/ask${action[action.length-1]}`)
const a=action.pop()
switch(a){
case 'TripFirstPickup':
switch(text.toLowerCase()){
case 'done': return next(null,`fb/ask${a}`)
default:
action.push('-',text)
this.set(name,'TripPickup')
break
}
break
case 'TripPickup':
switch(text.toLowerCase()){
case 'done':
action.push('+:pickup',null)
this.set(name,'TripFirstDropoff')
break
default:
action.push('-',text)
this.set(name,'TripPickup')
break
}
break
default: return next(null,`fb/ask${a}`)
}
next()
},
addDropoff(user,action,evt,name,next){
const text=pObj.dotchain(evt,['message','text'])
if(!text) return next(null,`fb/ask${action[action.length-1]}`)
const a=action.pop()
switch(a){
case 'TripFirstDropoff':
switch(text.toLowerCase()){
case 'done': return next(null,`fb/ask${a}`)
default:
action.push('-',text)
this.set(name,'TripDropoff')
break
}
break
case 'TripDropoff':
switch(text.toLowerCase()){
case 'done':
action.push('+:dropoff',null)
this.set(name,'TripSeat')
break
default:
action.push('-',text)
this.set(name,'TripDropoff')
break
}
break
default: return next(null,`fb/ask${a}`)
}
next()
},
done(user,cmd,msg,next){
console.log('addTrp.done',user,cmd)
rdTrip.set(user,cmd,(err)=>{
if (err) Object.assign(msg, fb.message(user,fb.text(`An error has encountered when adding your trip: ${err}.\ntype help for more action`)))
else Object.assign(msg, fb.message(user,fb.text(`New trip on ${fb.toDateTime(user,cmd.date)} has been added.\ntype help for more action`)))
next()
})
}
}
| ldarren/mysg | api/addTrip.js | JavaScript | mit | 1,913 |
/*
* Property of RECAPT http://recapt.com.ec/
* Chief Developer Ing. Eduardo Alfonso Sanchez eddie.alfonso@gmail.com
*/
package com.recapt.domain;
import java.time.LocalDateTime;
/**
*
* @author Eduardo
*/
public class IssueHistory {
private String name;
private String description;
private String reference;
private LocalDateTime created;
private Usuario createBy;
private Issue issue;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public LocalDateTime getCreated() {
return created;
}
public void setCreated(LocalDateTime created) {
this.created = created;
}
public Usuario getCreateBy() {
return createBy;
}
public void setCreateBy(Usuario createBy) {
this.createBy = createBy;
}
public Issue getIssue() {
return issue;
}
public void setIssue(Issue issue) {
this.issue = issue;
}
}
| edecisions/recapt | src/main/java/com/recapt/domain/IssueHistory.java | Java | mit | 1,356 |
"use strict";
var testCase = require('nodeunit').testCase,
path = require('path'),
fs = require('fs'),
avconv;
function read(stream, callback) {
var output = [],
err = [];
stream.on('data', function(data) {
output.push(data);
});
stream.on('error', function(data) {
err.push(data);
});
stream.once('end', function(exitCode, signal) {
callback(exitCode, signal, output, err);
});
}
module.exports = testCase({
'TC 1: stability tests': testCase({
'loading avconv function (require)': function(t) {
t.expect(1);
avconv = require('../avconv.js');
t.ok(avconv, 'avconv is loaded.');
t.done();
},
'run without parameters (null) 1': function(t) {
t.expect(4);
var stream = avconv(null);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 1, 'avconv did nothing');
t.notEqual(output.length, 0, 'output is not empty');
t.strictEqual(err.length, 0, 'err is empty');
t.strictEqual(signal, null, 'Signal is null');
t.done();
});
},
'run with empty array ([])': function(t) {
t.expect(3);
var stream = avconv([]);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 1, 'avconv did nothing');
t.notEqual(output.length, 0, 'output is not empty');
t.strictEqual(err.length, 0, 'err is empty');
t.done();
});
},
'run with invalid string parameter (fdsfdsfsdf)': function(t) {
t.expect(1);
t.throws(
function() {
avconv('fdsfdsfsdf');
},
TypeError,
'a type error must be thrown here'
);
t.done();
},
'run with invalid array parameters ([fdsfdsfsdf])': function(t) {
t.expect(3);
var stream = avconv(['fdsfdsfsdf']);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 1, 'avconv did nothing');
t.notEqual(output.length, 0, 'stdout is not empty and contains a warning about the wrong parameter');
t.strictEqual(err.length, 0, 'stderr is still empty');
t.done();
});
}
}),
'TC 2: real tests': testCase({
'loading help (--help)': function(t) {
t.expect(3);
var stream = avconv(['--help']);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 0, 'avconv returned help');
t.notEqual(output.length, 0, 'stdout contains help');
t.strictEqual(err.length, 0, 'stderr is still empty');
t.done();
});
}
}),
'TC 3: do a conversion': testCase({
setUp: function(callback) {
this.exampleDir = path.join(__dirname, 'example');
var source = path.join(this.exampleDir, 'pokemon_card.webm');
try {
fs.unlinkSync(source);
} catch (exc) {
// ignore if it does not exist
}
callback();
},
'convert pokemon flv to webm': function(t) {
var params = [
'-i', path.join(this.exampleDir, 'pokemon_card.flv'),
'-c:v', 'libvpx',
'-deadline', 'realtime',
'-y', path.join(this.exampleDir, 'pokemon_card.webm')
];
var errors = '',
datas = '',
previousProgress = 0;
var stream = avconv(params);
stream.on('data', function(data) {
datas += data;
});
stream.on('progress', function(progress) {
t.ok(progress > previousProgress, 'Progress has been made');
t.ok(progress <= 1, 'Progress is never over 100%');
previousProgress = progress;
});
stream.on('meta', function(meta) {
t.strictEqual(meta.video.track, '0.0', 'Video track number is correct');
t.strictEqual(meta.video.codec, 'h264 (Main)', 'Video codec is correct');
t.strictEqual(meta.video.format, 'yuv420p', 'Video format is correct');
t.strictEqual(meta.video.width, 320, 'Video width is correct');
t.strictEqual(meta.video.height, 240, 'Video height is correct');
});
stream.on('error', function(data) {
errors += data;
});
stream.once('end', function(exitCode, signal) {
t.strictEqual(exitCode, 0, 'Video has been successfully generated');
t.strictEqual(errors, '', 'No errors occured at all');
t.strictEqual(signal, null, 'Signal is null');
t.ok(datas.length > 0, 'There is data');
t.done();
});
},
'convert and kill in the middle': function(t) {
var params = [
'-i', path.join(this.exampleDir, 'pokemon_card.flv'),
'-c:v', 'libvpx',
'-deadline', 'realtime',
'-y', path.join(this.exampleDir, 'pokemon_card.webm')
];
var errors = '';
var stream = avconv(params);
stream.on('error', function(data) {
errors += data;
});
stream.once('end', function(exitCode, signal) {
t.strictEqual(exitCode, null, 'There is no exit code when killed');
t.strictEqual(errors, '', 'No errors occured at all');
t.strictEqual(signal, 'SIGTERM', 'Signal is SIGTERM');
t.done();
});
setTimeout(function() {
stream.kill();
}, 10);
}
})
});
| olivererxleben/hipsterbility | serverside/node_modules/avconv/tests/basics.js | JavaScript | mit | 6,328 |
Clazz.declarePackage ("J.renderspecial");
Clazz.load (["J.render.ShapeRenderer"], "J.renderspecial.PolyhedraRenderer", ["JU.P3i", "JM.Atom", "JU.C"], function () {
c$ = Clazz.decorateAsClass (function () {
this.drawEdges = 0;
this.isAll = false;
this.frontOnly = false;
this.screens = null;
this.vibs = false;
Clazz.instantialize (this, arguments);
}, J.renderspecial, "PolyhedraRenderer", J.render.ShapeRenderer);
Clazz.overrideMethod (c$, "render",
function () {
var polyhedra = this.shape;
var polyhedrons = polyhedra.polyhedrons;
this.drawEdges = polyhedra.drawEdges;
this.g3d.addRenderer (1073742182);
this.vibs = (this.ms.vibrations != null && this.tm.vibrationOn);
var needTranslucent = false;
for (var i = polyhedra.polyhedronCount; --i >= 0; ) if (polyhedrons[i].isValid && this.render1 (polyhedrons[i])) needTranslucent = true;
return needTranslucent;
});
Clazz.defineMethod (c$, "render1",
function (p) {
if (p.visibilityFlags == 0) return false;
var colixes = (this.shape).colixes;
var iAtom = p.centralAtom.i;
var colix = (colixes == null || iAtom >= colixes.length ? 0 : colixes[iAtom]);
colix = JU.C.getColixInherited (colix, p.centralAtom.colixAtom);
var needTranslucent = false;
if (JU.C.renderPass2 (colix)) {
needTranslucent = true;
} else if (!this.g3d.setC (colix)) {
return false;
}var vertices = p.vertices;
var planes;
if (this.screens == null || this.screens.length < vertices.length) {
this.screens = new Array (vertices.length);
for (var i = vertices.length; --i >= 0; ) this.screens[i] = new JU.P3i ();
}planes = p.planes;
for (var i = vertices.length; --i >= 0; ) {
var atom = (Clazz.instanceOf (vertices[i], JM.Atom) ? vertices[i] : null);
if (atom == null) {
this.tm.transformPtScr (vertices[i], this.screens[i]);
} else if (!atom.isVisible (this.myVisibilityFlag)) {
this.screens[i].setT (this.vibs && atom.hasVibration () ? this.tm.transformPtVib (atom, this.ms.vibrations[atom.i]) : this.tm.transformPt (atom));
} else {
this.screens[i].set (atom.sX, atom.sY, atom.sZ);
}}
this.isAll = (this.drawEdges == 1);
this.frontOnly = (this.drawEdges == 2);
if (!needTranslucent || this.g3d.setC (colix)) for (var i = 0, j = 0; j < planes.length; ) this.fillFace (p.normixes[i++], this.screens[planes[j++]], this.screens[planes[j++]], this.screens[planes[j++]]);
if (p.colixEdge != 0) colix = p.colixEdge;
if (this.g3d.setC (JU.C.getColixTranslucent3 (colix, false, 0))) for (var i = 0, j = 0; j < planes.length; ) this.drawFace (p.normixes[i++], this.screens[planes[j++]], this.screens[planes[j++]], this.screens[planes[j++]]);
return needTranslucent;
}, "J.shapespecial.Polyhedron");
Clazz.defineMethod (c$, "drawFace",
function (normix, A, B, C) {
if (this.isAll || this.frontOnly && this.vwr.gdata.isDirectedTowardsCamera (normix)) {
this.drawCylinderTriangle (A.x, A.y, A.z, B.x, B.y, B.z, C.x, C.y, C.z);
}}, "~N,JU.P3i,JU.P3i,JU.P3i");
Clazz.defineMethod (c$, "drawCylinderTriangle",
function (xA, yA, zA, xB, yB, zB, xC, yC, zC) {
var d = (this.g3d.isAntialiased () ? 6 : 3);
this.g3d.fillCylinderScreen (3, d, xA, yA, zA, xB, yB, zB);
this.g3d.fillCylinderScreen (3, d, xB, yB, zB, xC, yC, zC);
this.g3d.fillCylinderScreen (3, d, xA, yA, zA, xC, yC, zC);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz.defineMethod (c$, "fillFace",
function (normix, A, B, C) {
this.g3d.fillTriangleTwoSided (normix, A.x, A.y, A.z, B.x, B.y, B.z, C.x, C.y, C.z);
}, "~N,JU.P3i,JU.P3i,JU.P3i");
});
| rishiloyola/jsmol-models | jsmol/j2s/J/renderspecial/PolyhedraRenderer.js | JavaScript | mit | 3,499 |
var buttons = function(req, res, next) {
var request = require('request');
var cheerio = require('cheerio');
var Case = require('case');
// var url = "http://clas.asu.edu";
var url = req.body.page;
var parsedResults = [];
//testing url argument site buttons casing
request(url, function (error, response, html) {
if (!error && response.statusCode == 200) {
var $ = cheerio.load(html);
$('.btn').each(function(i, element){
var text = $(this).text().trim();
var casing = Case.of($(this).text().trim());
if ( (casing == "sentence") || (casing == "header") ){
var passfail = "PASS";
} else {
var passfail = "FAIL";
}
var testResults = {
text: text,
casing: casing,
passfail: passfail
};
parsedResults.push(testResults);
});
req.pf = parsedResults;
next();
};
});
};
module.exports = buttons;
| gabemartinez/clastestsuite | tests/buttons.js | JavaScript | mit | 975 |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Grace.Tests")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2a5e8af7-c99c-4bbc-bab6-cdfd100853f6")]
| ipjohnson/Grace | tests/Grace.Tests/Properties/AssemblyInfo.cs | C# | mit | 784 |
var taxi = require('..');
var chromedriver = require('chromedriver');
var fs = require('fs');
var user = process.env.SAUCE_USERNAME;
var accessKey = process.env.SAUCE_ACCESS_KEY;
var sauceLabsUrl = "http://" + user + ":" + accessKey + "@ondemand.saucelabs.com/wd/hub";
var tests = [
{ url:'http://localhost:9515/', capabilities: { browserName:'chrome' }, beforeFn: function () { chromedriver.start(); }, afterFn: function () { chromedriver.stop() } },
{ url:'http://localhost:9517/', capabilities: { browserName:'phantomjs', browserVersion:'1.9.8' } },
{ url:'http://localhost:4444/wd/hub', capabilities: { browserName:'firefox' } },
{ url:'http://makingshaking.corp.ne1.yahoo.com:4444', capabilities: { browserName:'phantomjs', browserVersion: '2.0.0 dev' } },
{ url:sauceLabsUrl, capabilities: { browserName:'chrome', version:'41.0', platform:'Windows 8.1' } },
{ url:sauceLabsUrl, capabilities: { browserName:'firefox', version:'37.0', platform:'Windows 8.1' } },
{ url:sauceLabsUrl, capabilities: { browserName:'internet explorer', version:'11.0', platform:'Windows 8.1' } },
{ url:sauceLabsUrl, capabilities: { browserName:'internet explorer', version:'10.0', platform:'Windows 8' } },
{ url:sauceLabsUrl, capabilities: { browserName:'internet explorer', version:'9.0', platform:'Windows 7' } },
{ url:sauceLabsUrl, capabilities: { browserName:'safari', version:'5.1', platform:'Windows 7' } },
{ url:sauceLabsUrl, capabilities: { browserName:'safari', version:'8.0', platform:'OS X 10.10' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPad Simulator', "device-orientation":'portrait' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPad Simulator', "device-orientation":'landscape' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPhone Simulator', "device-orientation":'portrait' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPhone Simulator', "device-orientation":'landscape' } }
];
tests.forEach(function (test) {
// Do we need to run something before the test-run?
if (test.beforeFn) {
test.beforeFn();
}
try {
var driver = taxi(test.url, test.capabilities, {mode: taxi.Driver.MODE_SYNC, debug: true, httpDebug: true});
var browser = driver.browser();
var activeWindow = browser.activeWindow();
// Navigate to Yahoo
activeWindow.navigator().setUrl('http://www.yahoo.com');
var browserId = (driver.deviceName() != '' ? driver.deviceName() : driver.browserName()) + " " + driver.deviceOrientation() + " " + driver.browserVersion() + " " + driver.platform();
// Write screenshot to a file
fs.writeFileSync(__dirname + '/' + browserId.trim() + '.png', activeWindow.documentScreenshot({
eachFn: function (index) {
// Remove the header when the second screenshot is reached.
// The header keeps following the scrolling position.
// So, we want to turn it off here.
if (index >= 1 && document.getElementById('masthead')) {
document.getElementById('masthead').style.display = 'none';
}
},
completeFn: function () {
// When it has a "masthead", then display it again
if (document.getElementById('masthead')) {
document.getElementById('masthead').style.display = '';
}
},
// Here is a list of areas that should be blocked-out
blockOuts: [
// Block-out all text-boxes
'input',
// Custom block-out at static location with custom color
{x:60, y: 50, width: 200, height: 200, color:{red:255,green:0,blue:128}}
]
// The element cannot be found in mobile browsers since they have a different layout
//, activeWindow.getElement('.footer-section')]
}));
} catch (err) {
console.error(err.stack);
} finally {
driver.dispose();
// Do we need to run something after the test-run?
if (test.afterFn) {
test.afterFn();
}
}
});
| preceptorjs/taxi | examples/stitching.js | JavaScript | mit | 4,049 |
#!/Users/Varun/Documents/GitHub/LockScreen/venv/bin/python
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates Docutils-native XML from standalone '
'reStructuredText sources. ' + default_description)
publish_cmdline(writer_name='xml', description=description)
| LockScreen/Backend | venv/bin/rst2xml.py | Python | mit | 642 |
# babel-plugin-transform-optional-chaining
The Optional Chaining Operator allows you to handle properties of deeply nested
objects without worrying about undefined intermediate objects.
## Example
### Accessing deeply nested properties
```js
const obj = {
foo: {
bar: {
baz: 42,
},
},
};
const baz = obj?.foo?.bar?.baz; // 42
const safe = obj?.qux?.baz; // undefined
// Optional chaining and normal chaining can be intermixed
obj?.foo.bar?.baz; // Only access `foo` if `obj` exists, and `baz` if
// `bar` exists
```
### Calling deeply nested functions
```js
const obj = {
foo: {
bar: {
baz() {
return 42;
},
},
},
};
const baz = obj?.foo?.bar?.baz(); // 42
const safe = obj?.qux?.baz(); // undefined
const safe2 = obj?.foo.bar.qux?.(); // undefined
const willThrow = obj?.foo.bar.qux(); // Error: not a function
// Top function can be called directly, too.
function test() {
return 42;
}
test?.(); // 42
exists?.(); // undefined
```
### Constructing deeply nested classes
```js
const obj = {
foo: {
bar: {
baz: class {
},
},
},
};
const baz = new obj?.foo?.bar?.baz(); // baz instance
const safe = new obj?.qux?.baz(); // undefined
const safe2 = new obj?.foo.bar.qux?.(); // undefined
const willThrow = new obj?.foo.bar.qux(); // Error: not a constructor
// Top classes can be called directly, too.
class Test {
}
new Test?.(); // test instance
new exists?.(); // undefined
```
## Installation
```sh
npm install --save-dev babel-plugin-transform-optional-chaining
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["transform-optional-chaining"]
}
```
### Via CLI
```sh
babel --plugins transform-optional-chaining script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["transform-optional-chaining"]
});
```
## References
* [Proposal: Optional Chaining](https://github.com/tc39/proposal-optional-chaining)
| kedromelon/babel | packages/babel-plugin-transform-optional-chaining/README.md | Markdown | mit | 2,010 |
/**
* @author Chine
*/
function switchTheme(theme) {
$.cookie('blog_theme', theme, { expires: 30 });
location.href = location.href;
}
| harveyqing/Qingblog | Qingblog/public/static/dopetrope/js/theme.js | JavaScript | mit | 142 |
var mtd = require('mt-downloader');
var fs = require('fs');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var Download = function() {
EventEmitter.call(this);
this._reset();
this.url = '';
this.filePath = '';
this.options = {};
this.meta = {};
this._retryOptions = {
_nbRetries: 0,
maxRetries: 5,
retryInterval: 5000
};
};
util.inherits(Download, EventEmitter);
Download.prototype._reset = function(first_argument) {
this.status = 0; // -3 = destroyed, -2 = stopped, -1 = error, 0 = not started, 1 = started (downloading), 2 = error, retrying, 3 = finished
this.error = '';
this.stats = {
time: {
start: 0,
end: 0
},
total: {
size: 0,
downloaded: 0,
completed: 0
},
past: {
downloaded: 0
},
present: {
downloaded: 0,
time: 0,
speed: 0
},
future: {
remaining: 0,
eta: 0
},
threadStatus: {
idle: 0,
open: 0,
closed: 0,
failed: 0
}
};
};
Download.prototype.setUrl = function(url) {
this.url = url;
return this;
};
Download.prototype.setFilePath = function(filePath) {
this.filePath = filePath;
return this;
};
Download.prototype.setOptions = function(options) {
if(!options || options == {}) {
return this.options = {};
}
// The "options" object will be directly passed to mt-downloader, so we need to conform to his format
//To set the total number of download threads
this.options.count = options.threadsCount || options.count || 2;
//HTTP method
this.options.method = options.method || 'GET';
//HTTP port
this.options.port = options.port || 80;
//If no data is received the download times out. It is measured in seconds.
this.options.timeout = options.timeout/1000 || 5;
//Control the part of file that needs to be downloaded.
this.options.range = options.range || '0-100';
// Support customized header fields
this.options.headers = options.headers || {};
return this;
};
Download.prototype.setRetryOptions = function(options) {
this._retryOptions.maxRetries = options.maxRetries || 5;
this._retryOptions.retryInterval = options.retryInterval || 2000;
return this;
};
Download.prototype.setMeta = function(meta) {
this.meta = meta;
return this;
};
Download.prototype.setStatus = function(status) {
this.status = status;
return this;
};
Download.prototype.setError = function(error) {
this.error = error;
return this;
};
Download.prototype._computeDownloaded = function() {
if(!this.meta.threads) { return 0; }
var downloaded = 0;
this.meta.threads.forEach(function(thread) {
downloaded += thread.position - thread.start;
});
return downloaded;
};
// Should be called on start, set the start timestamp (in seconds)
Download.prototype._computeStartTime = function() {
this.stats.time.start = Math.floor(Date.now() / 1000);
};
// Should be called on end, set the end timestamp (in seconds)
Download.prototype._computeEndTime = function() {
this.stats.time.end = Math.floor(Date.now() / 1000);
};
// Should be called on start, count size already downloaded (eg. resumed download)
Download.prototype._computePastDownloaded = function() {
this.stats.past.downloaded = this._computeDownloaded();
};
// Should be called on start compute total size
Download.prototype._computeTotalSize = function() {
var threads = this.meta.threads;
if(!threads) { return 0; }
this.stats.total.size = threads[threads.length-1].end - threads[0].start;
};
Download.prototype._computeStats = function() {
this._computeTotalSize();
this._computeTotalDownloaded();
this._computePresentDownloaded();
this._computeTotalCompleted();
this._computeFutureRemaining();
// Only compute those stats when downloading
if(this.status == 1) {
this._computePresentTime();
this._computePresentSpeed();
this._computeFutureEta();
this._computeThreadStatus();
}
};
Download.prototype._computePresentTime = function() {
this.stats.present.time = Math.floor(Date.now() / 1000) - this.stats.time.start;
};
Download.prototype._computeTotalDownloaded = function() {
this.stats.total.downloaded = this._computeDownloaded();
};
Download.prototype._computePresentDownloaded = function() {
this.stats.present.downloaded = this.stats.total.downloaded - this.stats.past.downloaded;
};
Download.prototype._computeTotalCompleted = function() {
this.stats.total.completed = Math.floor((this.stats.total.downloaded) * 1000 / this.stats.total.size) / 10;
};
Download.prototype._computeFutureRemaining = function() {
this.stats.future.remaining = this.stats.total.size - this.stats.total.downloaded;
};
Download.prototype._computePresentSpeed = function() {
this.stats.present.speed = this.stats.present.downloaded / this.stats.present.time;
};
Download.prototype._computeFutureEta = function() {
this.stats.future.eta = this.stats.future.remaining / this.stats.present.speed;
};
Download.prototype._computeThreadStatus = function() {
var self = this;
this.stats.threadStatus = {
idle: 0,
open: 0,
closed: 0,
failed: 0
};
this.meta.threads.forEach(function(thread) {
self.stats.threadStatus[thread.connection]++;
});
};
Download.prototype.getStats = function() {
if(!this.meta.threads) {
return this.stats;
}
this._computeStats();
return this.stats;
};
Download.prototype._destroyThreads = function() {
if(this.meta.threads) {
this.meta.threads.forEach(function(i){
if(i.destroy) {
i.destroy();
}
});
}
};
Download.prototype.stop = function() {
this.setStatus(-2);
this._destroyThreads();
this.emit('stopped', this);
};
Download.prototype.destroy = function() {
var self = this;
this._destroyThreads();
this.setStatus(-3);
var filePath = this.filePath;
var tmpFilePath = filePath;
if (!filePath.match(/\.mtd$/)) {
tmpFilePath += '.mtd';
} else {
filePath = filePath.replace(new RegExp('(.mtd)*$', 'g'), '');
}
fs.unlink(filePath, function() {
fs.unlink(tmpFilePath, function() {
self.emit('destroyed', this);
});
});
};
Download.prototype.start = function() {
var self = this;
self._reset();
self._retryOptions._nbRetries = 0;
this.options.onStart = function(meta) {
self.setStatus(1);
self.setMeta(meta);
self.setUrl(meta.url);
self._computeStartTime();
self._computePastDownloaded();
self._computeTotalSize();
self.emit('start', self);
};
this.options.onEnd = function(err, result) {
// If stopped or destroyed, do nothing
if(self.status == -2 || self.status == -3) {
return;
}
// If we encountered an error and it's not an "Invalid file path" error, we try to resume download "maxRetries" times
if(err && (''+err).indexOf('Invalid file path') == -1 && self._retryOptions._nbRetries < self._retryOptions.maxRetries) {
self.setStatus(2);
self._retryOptions._nbRetries++;
setTimeout(function() {
self.resume();
self.emit('retry', self);
}, self._retryOptions.retryInterval);
// "Invalid file path" or maxRetries reached, emit error
} else if(err) {
self._computeEndTime();
self.setError(err);
self.setStatus(-1);
self.emit('error', self);
// No error, download ended successfully
} else {
self._computeEndTime();
self.setStatus(3);
self.emit('end', self);
}
};
this._downloader = new mtd(this.filePath, this.url, this.options);
this._downloader.start();
return this;
};
Download.prototype.resume = function() {
this._reset();
var filePath = this.filePath;
if (!filePath.match(/\.mtd$/)) {
filePath += '.mtd';
}
this._downloader = new mtd(filePath, null, this.options);
this._downloader.start();
return this;
};
// For backward compatibility, will be removed in next releases
Download.prototype.restart = util.deprecate(function() {
return this.resume();
}, 'Download `restart()` is deprecated, please use `resume()` instead.');
module.exports = Download; | leeroybrun/node-mt-files-downloader | lib/Download.js | JavaScript | mit | 8,675 |
import * as utils from '../../utils/utils'
import * as math from '../../math/math'
import QR from '../../math/qr'
import LMOptimizer from '../../math/lm'
import {ConstantWrapper, EqualsTo} from './constraints'
import {dog_leg} from '../../math/optim'
/** @constructor */
function Param(id, value, readOnly) {
this.reset(value);
}
Param.prototype.reset = function(value) {
this.set(value);
this.j = -1;
};
Param.prototype.set = function(value) {
this.value = value;
};
Param.prototype.get = function() {
return this.value;
};
Param.prototype.nop = function() {};
/** @constructor */
function System(constraints) {
this.constraints = constraints;
this.params = [];
for (var ci = 0; ci < constraints.length; ++ci) {
var c = constraints[ci];
for (var pi = 0; pi < c.params.length; ++pi) {
var p = c.params[pi];
if (p.j == -1) {
p.j = this.params.length;
this.params.push(p);
}
}
}
}
System.prototype.makeJacobian = function() {
var jacobi = [];
var i;
var j;
for (i=0; i < this.constraints.length; i++) {
jacobi[i] = [];
for (j=0; j < this.params.length; j++) {
jacobi[i][j] = 0;
}
}
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
c.gradient(grad);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
j = param.j;
jacobi[i][j] = grad[p];
}
}
return jacobi;
};
System.prototype.fillJacobian = function(jacobi) {
for (var i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
c.gradient(grad);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
var j = param.j;
jacobi[i][j] = grad[p];
}
}
return jacobi;
};
System.prototype.calcResidual = function(r) {
var i=0;
var err = 0.;
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
r[i] = c.error();
err += r[i]*r[i];
}
err *= 0.5;
return err;
};
System.prototype.calcGrad_ = function(out) {
var i;
for (i = 0; i < out.length || i < this.params.length; ++i) {
out[i][0] = 0;
}
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
c.gradient(grad);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
var j = param.j;
out[j][0] += this.constraints[i].error() * grad[p]; // (10.4)
}
}
};
System.prototype.calcGrad = function(out) {
var i;
for (i = 0; i < out.length || i < this.params.length; ++i) {
out[i] = 0;
}
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
var j = param.j;
out[j] += this.constraints[i].error() * grad[p]; // (10.4)
}
}
};
System.prototype.fillParams = function(out) {
for (var p = 0; p < this.params.length; p++) {
out[p] = this.params[p].get();
}
};
System.prototype.getParams = function() {
var out = [];
this.fillParams(out);
return out;
};
System.prototype.setParams = function(point) {
for (var p = 0; p < this.params.length; p++) {
this.params[p].set(point[p]);
}
};
System.prototype.error = function() {
var error = 0;
for (var i=0; i < this.constraints.length; i++) {
error += Math.abs(this.constraints[i].error());
}
return error;
};
System.prototype.errorSquare = function() {
var error = 0;
for (var i=0; i < this.constraints.length; i++) {
var t = this.constraints[i].error();
error += t * t;
}
return error * 0.5;
};
System.prototype.getValues = function() {
var values = [];
for (var i=0; i < this.constraints.length; i++) {
values[i] = this.constraints[i].error();
}
return values;
};
var wrapAux = function(constrs, locked) {
var i, lockedSet = {};
for (i = 0; i < locked.length; i++) {
lockedSet[locked[i].j] = true;
}
for (i = 0; i < constrs.length; i++) {
var c = constrs[i];
var mask = [];
var needWrap = false;
for (var j = 0; j < c.params.length; j++) {
var param = c.params[j];
mask[j] = lockedSet[param.j] === true;
needWrap = needWrap || mask[j];
}
if (needWrap) {
var wrapper = new ConstantWrapper(c, mask);
constrs[i] = wrapper;
}
}
};
var lock2Equals2 = function(constrs, locked) {
var _locked = [];
for (var i = 0; i < locked.length; ++i) {
_locked.push(new EqualsTo([locked[i]], locked[i].get()));
}
return _locked;
};
var diagnose = function(sys) {
if (sys.constraints.length == 0 || sys.params.length == 0) {
return {
conflict : false,
dof : 0
}
}
var jacobian = sys.makeJacobian();
var qr = new QR(jacobian);
return {
conflict : sys.constraints.length > qr.rank,
dof : sys.params.length - qr.rank
}
};
var prepare = function(constrs, locked, aux, alg) {
var simpleMode = true;
if (!simpleMode) {
var lockingConstrs = lock2Equals2(constrs, locked);
Array.prototype.push.apply( constrs, lockingConstrs );
}
var sys = new System(constrs);
wrapAux(constrs, aux);
var model = function(point) {
sys.setParams(point);
return sys.getValues();
};
var jacobian = function(point) {
sys.setParams(point);
return sys.makeJacobian();
};
var nullResult = {
evalCount : 0,
error : 0,
returnCode : 1
};
function solve(rough, alg) {
//if (simpleMode) return nullResult;
if (constrs.length == 0) return nullResult;
if (sys.params.length == 0) return nullResult;
switch (alg) {
case 2:
return solve_lm(sys, model, jacobian, rough);
case 1:
default:
return dog_leg(sys, rough);
}
}
var systemSolver = {
diagnose : function() {return diagnose(sys)},
error : function() {return sys.error()},
solveSystem : solve,
system : sys,
updateLock : function(values) {
for (var i = 0; i < values.length; ++i) {
if (simpleMode) {
locked[i].set(values[i]);
} else {
lockingConstrs[i].value = values[i];
}
}
}
};
return systemSolver;
};
var solve_lm = function(sys, model, jacobian, rough) {
var opt = new LMOptimizer(sys.getParams(), math.vec(sys.constraints.length), model, jacobian);
opt.evalMaximalCount = 100 * sys.params.length;
var eps = rough ? 0.001 : 0.00000001;
opt.init0(eps, eps, eps);
var returnCode = 1;
try {
var res = opt.doOptimize();
} catch (e) {
returnCode = 2;
}
sys.setParams(res[0]);
return {
evalCount : opt.evalCount,
error : sys.error(),
returnCode : returnCode
};
};
export {Param, prepare} | Autodrop3d/autodrop3dServer | public/webcad/app/sketcher/constr/solver.js | JavaScript | mit | 7,075 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{$title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{$description}">
<!-- Le styles -->
<link href="css/style.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="ico/favicon.ico">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="http://raincms.org/website/themes/raincms2/img/icon/favicon.ico">
<link rel="apple-touch-icon" href="http://raincms.org/website/themes/raincms2/img/icon/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="http://raincms.org/website/themes/raincms2/img/icon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="http://raincms.org/website/themes/raincms2/img/icon/apple-touch-icon-114x114.png">
<!-- styles & javascript -->
{$head}
</head>
<body class="home">
<header>
<div class="nav_container">
<nav>
{loop="menu"}
<a href="{$value.link}" {$value.selected?'class="selected"':null}>{$value.name}</a>
{/loop}
</nav>
</div>
<a id="logo"><img src="img/logo.png"></a>
<a id="slogan"><img src="img/slogan.png"></a>
</header>
<section>
<!-- Example row of columns -->
<div class="row">
<div class="span4">
{$load_area.left}
</div>
<div class="span4">
<div class="content">
<h1 class="title">{$content.title}</h1>
<div class="text">{$content.content}</div>
</div>
</div>
<div class="span4">
{$load_area.right}
</div>
</div>
</section>
<footer>
<p>execution time: <span id="execution_time">{$execution_time}</span> memory used: <span id="memory_used">{$memory_used}</span><br>included files: <span id="included_files">{$included_files|count}</span> queries: <span id="n_query">{$n_query}</span></p>
</footer>
{$foot}
</body>
</html>
| rainphp/RainCMS | website/themes/default/layout.home.html | HTML | mit | 2,421 |
(function() {
function Base(props) {
this.id = Ambient.getID();
$.extend(this, props || {});
}
Base.extend = function(methods) {
if (typeof methods === "function") {
methods = methods();
}
methods = (methods || {});
var self = this;
var Controller = function() {
self.apply(this, arguments);
};
Controller.prototype = Object.create(self.prototype);
Controller.prototype.constructor = Controller;
for (var key in methods) {
Controller.prototype[key] = methods[key];
}
Controller.extend = Base.extend.bind(Controller);
return Controller;
};
window.Ambient.Controller = Base;
})();
| lewie9021/ambient-js | src/Controller.js | JavaScript | mit | 870 |
import React from 'react'
import { Router, Route, hashHistory, browserHistory, IndexRoute } from 'react-router'
import MainContainer from '../components/MainContainer'
import Login from '../components/hello/Login'
import Register from '../components/hello/Register'
import Index from '../components/index/Index'
import HelloWorld from '../components/hello/HelloWorld'
import Header from '../components/common/Header'
import Xiexie from '../components/write/Write'
import ArticleDetail from '../components/index/ArticleDetail'
class Root extends React.Component {
render() {
return (
<Router history={browserHistory}>
<Route path="/" component={Header}>
<IndexRoute component={Index}/>
<Route path="/xiexie" component={Xiexie}/>
<Route path="/articleDetail" component={ArticleDetail}/>
</Route>
</Router>
)
}
}
export default Root | weifengsmile/xiexie | client/src/containers/Root.js | JavaScript | mit | 931 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>联系我们 - 八八箱业</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="Keywords" content="宜宾废旧桂圆筐,八八箱业,废料回收,桂圆筐交易,报废桂圆筐,废旧桂圆筐" />
<meta name="Description" content="四川省宜宾市八八箱业-宜宾纸箱厂主营废旧桂圆筐,八八箱业,废料回收,桂圆筐交易,报废桂圆筐,废旧桂圆筐。集回收、出售、运输一体化纸箱回收厂。拥有上千平米场地,长期持有固定货源。严格的二次加工技术,最大化实现商品的可重用性。节能环保,高价回收,低价出售等优势。接受几十到数万不等预定。"
/>
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/responsive.css">
</head>
<body>
<!-- main wrapper -->
<div class="wrapper">
<!-- header -->
<header class="header">
<div class="header-top">
<div class="container">
<div class="row">
<div class="col-lg-9 col-md-8 col-sm-8 col-xs-12">
<div class="header-location"><i class="fa fa-home"></i> <a href="#">四川 宜宾 上江北 445号</a></div>
<div class="header-email"><i class="fa fa-envelope-o"></i> <a href="mailto:442331311@qq.com">442331311@qq.com</a></div>
<div class="header-phone"><i class="fa fa-phone"></i> <a href="#">(0831) 139 - 9099 - 9756</a></div>
</div>
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<div class="header-social pull-right">
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-google-plus"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-instagram"></i></a>
</div>
</div>
</div>
</div>
</div>
<div class="header-bottom">
<nav class="navbar navbar-universal navbar-custom">
<div class="container">
<div class="row">
<div class="col-lg-3">
<div class="logo"><a href="index.html" class="navbar-brand page-scroll"><img src="assets/images/logo/logo.png" alt="logo"></a></div>
</div>
<div class="col-lg-9">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target=".navbar-main-collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
<div class="collapse navbar-collapse navbar-main-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html">首页</a></li>
<li><a href="about-us.html">关于我们</a></li>
<li><a href="contacts.html">联系方式</a></li>
<li><a href="best-rooms.html">产品展示</a></li>
<li><a href="news.html">行业资讯</a></li>
</ul>
</div>
</div>
</div>
</div>
</nav>
</div>
</header>
<!-- /header -->
<!-- breadcrumbs -->
<section class="breadcrumbs" style="background-image: url(assets/images/breadcrumbs/reservation.jpg)">
<div class="container">
<div class="row">
<div class="col-md-6">
<h1 class="h1">联系方式</h1>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="./index.html">首页</a><i class="fa fa-angle-right"></i></li>
<li class="active">联系方式</li>
</ol>
</div>
</div>
</div>
</section>
<!-- /breadcrumbs -->
<section class="contact-block">
<div class="container">
<div class="contact-block_form">
<div class="row">
<div class="contact-block_info">
<div class="col-md-4">
<div class="contact-block_i">
<div class="info_icon">
<i class="fa fa-home"></i>
</div>
<div class="info_txt"><span>四川 宜宾 上江北 445号</span></div>
</div>
</div>
<div class="col-md-4">
<div class="contact-block_i">
<div class="info_icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="info_txt"><span>442331311@qq.com</span></div>
</div>
</div>
<div class="col-md-4">
<div class="contact-block_i">
<div class="info_icon">
<i class="fa fa-phone"></i>
</div>
<div class="info_txt"><span>(0831) 139 - 9099 - 9756</span></div>
</div>
</div>
</div>
</div>
<div class="row marg50">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h2 class="h2">给我们一些建议...</h2>
</div>
<div class="col-lg-2 col-md-2 col-sm-1 col-xs-1"></div>
<div class="col-lg-8 col-md-8 col-sm-11 col-xs-11">
<form action="mail.php" method="POST" class="form-horizontal form-wizzard">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div id="name-group" class="form-group">
<input type="text" name="name" class="form-control" placeholder="Enter your name ...">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div id="surname-group" class="form-group">
<input type="text" name="name" class="form-control" placeholder="Enter your surname ...">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div id="phone-group" class="form-group">
<input type="tel" name="name" class="form-control" placeholder="Enter your phone number ...">
</div>
</div>
</div>
<div id="comment-group" class="form-group">
<textarea rows="10" name="comment" class="form-control" placeholder="Additional note type here ..."></textarea>
</div>
<div class="form-group text-center">
<input type="submit" value="发送消息" class="btn btn-default">
</div>
</form>
</div>
<div class="col-lg-2 col-md-2 col-sm-1 col-xs-1"></div>
</div>
</div>
</div>
</section>
<section class="map">
<div id="map"></div>
</section>
<!-- /main wrapper -->
<!-- footer -->
<footer class="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<div class="footer-top_logo"><a href="index.html"><img src="assets/images/logo/logo.png" alt="Footer logo"></a></div>
<div class="footer-top_txt">
<p>成立于1995年,位于长江第一城--四川省宜宾市江北农贸市场对面,交通方便,物流快捷. 本着以“信誉第一,客户至上”的经营理念。 线下运营纸箱,烟箱,水果筐,废料交易(回收/批发). 线上力求打造专业的行业资讯交流平台,为广大同行提供采购,销售,行情等信息交流.
</p>
</div>
<div class="footer-top_address">
<div><i class="fa fa-phone"></i> Phone: <span>(0831) 139 - 9099 - 9756</span></div>
<div><i class="fa fa-envelope-o"></i> E-mail: <span><a href="mailto:442331311@qq.com">442331311@qq.com</a></span></div>
<div><i class="fa fa-home"></i> Location: <span>四川 宜宾 上江北 445号</span></div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<div class="footer-top_rooms" style="visibility:hidden">
<ul>
<li>
<div class="rooms_img">
<a href="blog-detail.html"><img src="assets/images/footer/1.jpg" alt=""></a>
</div>
<div class="rooms_info">
<div class="rooms_t"><a href="blog-detail.html">Grang Super Luxury</a></div>
<div class="rooms_props">3 Bed / Wi-Fi / 2 - Bathroom<span>$119</span></div>
</div>
</li>
<li>
<div class="rooms_img">
<a href="blog-detail.html"><img src="assets/images/footer/2.jpg" alt=""></a>
</div>
<div class="rooms_info">
<div class="rooms_t"><a href="blog-detail.html">President Room</a></div>
<div class="rooms_props">4 Bed / Wi-Fi / 3 - Bathroom<span>$329</span></div>
</div>
</li>
<li>
<div class="rooms_img">
<a href="blog-detail.html"><img src="assets/images/footer/3.jpg" alt=""></a>
</div>
<div class="rooms_info">
<div class="rooms_t"><a href="blog-detail.html">Spa Double Room</a></div>
<div class="rooms_props">2 Bed / Wi-Fi / 2 - Bathroom<span>$749</span></div>
</div>
</li>
</ul>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 marg-sm-50 col-xs-12">
<div class="footer-top_contact_form">
<div class="contact_form_t">Contact Form</div>
<form action="#" method="POST" class="row form-horizontal form-wizzard">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<input type="text" name="name" class="form-control" placeholder="Name ...">
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<input type="email" name="email" class="form-control" placeholder="Email ...">
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<textarea rows="6" name="message" class="form-control" placeholder="Message ..."></textarea>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-right">
<input type="button" onclick="javascript:alert('功能暂未开放,谢谢您的支持!')" value="Send message" class="btn btn-default">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="footer-bottom">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="footer-bottom_copy">Copyright © 2017.Company name All rights reserved.</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="footer-bottom_links">
<a class="active" href="./index.html" title="本地最新最全的行业资讯">八八箱业</a>
<a href="http://www.88boxs.cn" target="blank" title="主营纸箱交易,回收,批发">宜宾纸箱厂
<a href="http://www.cnzhixiang.com/">中国纸箱网</a>
<a href="http://www.paper.com.cn/">中国纸网</a>
<a href="https://www.1688.com/">1688采购网</a>
<!-- CNZZ -->
<script src="https://s19.cnzz.com/z_stat.php?id=1262971731&web_id=1262971731" language="JavaScript"></script>
</a>
</div>
</div>
</div>
</div>
</div>
</footer>
</div>
<!-- /footer -->
<!-- Scripts -->
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/tether.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="assets/js/moment.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.smartmenus.js"></script>
<script type="text/javascript" src="assets/js/jquery.parallax.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.shuffle.min.js"></script>
<script type="text/javascript" src="assets/js/owl.carousel.min.js"></script>
<!---<script type="text/javascript" src="http://ditu.google.cn/maps/api/js"></script>--->
<script type="text/javascript" src="assets/js/map.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
<!-- /Scripts -->
</body>
</html> | 442331311/waste | build/contacts.html | HTML | mit | 13,537 |
from messenger import Skype
import keyring
import utils
token = keyring.get_password('messagesReceiver', 'skypeToken')
registrationToken = keyring.get_password('messagesReceiver', 'skypeRegistrationToken')
username = keyring.get_password('messagesReceiver', 'skypeUsername')
password = keyring.get_password('messagesReceiver', 'skypePassword')
s = Skype(token, registrationToken)
if s.token == None:
s.login(username, password)
print "logging in..."
if s.registrationToken == None:
print s.createRegistrationToken()
print s.subcribe()
print "creating endpoint and registrationToken..."
while True:
data = s.pull()
if data == 404:
print s.createRegistrationToken()
print s.subcribe()
data = s.pull()
if data == 400:
continue
messages = utils.skypeParse(data)
if not messages:
continue
for sender, receiver, message in messages:
if receiver != None:
print "%s to %s" % (sender, receiver)
else:
print "From %s" % sender
print message
| khapota/messages-terminal | test.py | Python | mit | 1,064 |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Simple Webpack-React Starter Kit</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="app"></div>
</body>
</html> | phinoppix/webpack-react-starter | src/app/template.html | HTML | mit | 243 |
require 'test/unit'
class LSRTest < Test::Unit::TestCase
def setup
@temp_file = "lsr_dump"
@input_file = "lsr_input"
end
def test_addr_mode_accumulator
instr = [0xA9,0xFF,0x4A]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("7F",fstring[$a_line].chomp)
assert_equal("81",fstring[$status_line].chomp)
instr = [0xA9,0x04,0x4A]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("02",fstring[$a_line].chomp)
assert_equal("00",fstring[$status_line].chomp)
instr = [0xA9,0x00,0x4A]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("00",fstring[$a_line].chomp)
assert_equal("02",fstring[$status_line].chomp)
end
def test_addr_mode_zero_page
instr = [0xA9,0xFF,0x85,0x55,0xA9,0x00,0x46,0x55,0xA5,0x55]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("7F",fstring[$a_line].chomp)
assert_equal("01",fstring[$status_line].chomp)
instr = [0xA9,0x04,0x85,0x55,0xA9,0x00,0x46,0x55,0xA5,0x55]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("02",fstring[$a_line].chomp)
assert_equal("00",fstring[$status_line].chomp)
instr = [0xA9,0x00,0x85,0x55,0xA9,0x00,0x46,0x55,0xA5,0x55]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("00",fstring[$a_line].chomp)
assert_equal("02",fstring[$status_line].chomp)
end
def test_addr_mode_zero_page_x
instr = [0xA9,0xFF,0x85,0x55,0xA9,0x00,0xA2,0x10,0x56,0x45,0xA5,0x55]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("7F",fstring[$a_line].chomp)
assert_equal("01",fstring[$status_line].chomp)
instr = [0xA9,0x04,0x85,0x55,0xA9,0x00,0xA2,0x10,0x56,0x45,0xA5,0x55]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("02",fstring[$a_line].chomp)
assert_equal("00",fstring[$status_line].chomp)
instr = [0xA9,0x00,0x85,0x55,0xA9,0x00,0xA2,0x10,0x56,0x45,0xA5,0x55]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("00",fstring[$a_line].chomp)
assert_equal("02",fstring[$status_line].chomp)
end
def test_addr_mode_absolute
instr = [0xA9,0xFF,0x85,0x45,0xA9,0x00,0x4E,0x45,0x00,0xA5,0x45]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("7F",fstring[$a_line].chomp)
assert_equal("01",fstring[$status_line].chomp)
instr = [0xA9,0x04,0x85,0x45,0xA9,0x00,0x4E,0x45,0x00,0xA5,0x45]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("02",fstring[$a_line].chomp)
assert_equal("00",fstring[$status_line].chomp)
instr = [0xA9,0x00,0x85,0x45,0xA9,0x00,0x4E,0x45,0x00,0xA5,0x45]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("00",fstring[$a_line].chomp)
assert_equal("02",fstring[$status_line].chomp)
end
def test_addr_mode_absolute_x
instr = [0xA9,0xFF,0x85,0x45,0xA9,0x00,0xA2,0x10,0x5E,0x35,0x00,0xA5,0x45]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("7F",fstring[$a_line].chomp)
assert_equal("01",fstring[$status_line].chomp)
instr = [0xA9,0x04,0x85,0x45,0xA9,0x00,0xA2,0x10,0x5E,0x35,0x00,0xA5,0x45]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("02",fstring[$a_line].chomp)
assert_equal("00",fstring[$status_line].chomp)
instr = [0xA9,0x00,0x85,0x45,0xA9,0x00,0xA2,0x10,0x5E,0x35,0x00,0xA5,0x45]
instr.push(0x02)
write_input_file(instr)
system(".././2a03 #{@input_file} #{@temp_file}")
f = File.new(@temp_file)
fstring = f.readlines
f.close
assert_equal("00",fstring[$a_line].chomp)
assert_equal("02",fstring[$status_line].chomp)
end
def teardown
system("rm #{@temp_file} #{@input_file}")
end
def write_input_file(instr)
f = File.new(@input_file,"wb")
f.write(instr.pack("C*"))
f.close
end
end
| cacciatc/old_happiNES | tests/shifts/LSR_inst.rb | Ruby | mit | 5,182 |
package br.com.command.comandos;
import br.com.command.interfaces.Command;
import br.com.command.modelos.PersianaSuite;
/**
* Created by danielmarcoto on 17/11/15.
*/
public class PersianaSuiteAbrirCommand implements Command {
private PersianaSuite persiana;
public PersianaSuiteAbrirCommand(PersianaSuite persiana) {
this.persiana = persiana;
}
@Override
public void execute() {persiana.abrir();}
}
| danielmarcoto/ControleRemoto | app/src/main/java/br/com/command/comandos/PersianaSuiteAbrirCommand.java | Java | mit | 435 |
<?php
/**
* Used to implement Action Controllers for use with the Front Controller.
*
* @link Benri_Controller_Abstract.html Benri_Controller_Abstract
*/
abstract class Benri_Controller_Action extends Benri_Controller_Action_Abstract
{
/**
* Layout used by this controller.
* @var string
*/
protected $_layout;
/**
* A title for an action.
* @var string
*/
protected $_title = null;
/**
* Initialize object.
*/
public function init()
{
parent::init();
if ($this->_layout) {
$this->getHelper('layout')->setLayout($this->_layout);
}
}
/**
* Post-dispatch routines.
*
* Common usages for `postDispatch()` include rendering content in a
* sitewide template, link url correction, setting headers, etc.
*/
public function postDispatch()
{
if ($this->view instanceof Zend_View_Interface) {
// Common variables used in all views.
$this->view->assign([
'errors' => $this->_errors,
'messages' => $this->_messages,
'title' => $this->_title,
]);
// XMLHttpRequest requests should not render the entire layout,
// only the correct templates related to the action.
if ($this->getRequest()->isXmlHttpRequest()) {
$this->getHelper('layout')->disableLayout();
}
$this->getResponse()->setHeader('Content-Type', 'text/html; charset=utf-8', true);
}
}
}
| douggr/benri | library/Benri/Controller/Action.php | PHP | mit | 1,579 |
<?php
namespace Persona\Hris\Attendance\Model;
use Persona\Hris\Repository\RepositoryInterface;
/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@personahris.com>
*/
interface ShiftmentRepositoryInterface extends RepositoryInterface
{
/**
* @param string $id
*
* @return ShiftmentInterface|null
*/
public function find(string $id): ? ShiftmentInterface;
}
| HRPersona/Backend | src/Attendance/Model/ShiftmentRepositoryInterface.php | PHP | mit | 394 |
var READONLY = false
// How much labor you generate per minute
var LABORGENRATE = 2;
if (READONLY){
// This is just for setting up a display-only example of this app
Characters = new Meteor.Collection(null)
Timers = new Meteor.Collection(null)
} else {
Characters = new Meteor.Collection("characters");
Timers = new Meteor.Collection("timers");
}
DayStrings = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
function pad(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;1
}
return str;
}
function formattime(hour, minutes) {
if (hour >= 12) {
ampm = 'pm'
} else {
ampm = 'am'
}
hour = hour % 12;
if (hour == 0) {
hour = 12;
}
return hour+":"+pad(minutes,2)+ampm;
}
function parsetimerlength(timerstring) {
var totaltime = 0;
// Find days
var re = /(\d+) ?(?:days|day|d)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += (Number(matches[1]) * 86400);
}
// Find hours
var re = /(\d+) ?(?:hours|hour|h|hr|hrs)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += (Number(matches[1]) * 3600);
}
// Find minutes
var re = /(\d+) ?(?:minutes|minute|min|m)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += (Number(matches[1]) * 60);
}
// Find seconds
var re = /(\d+) ?(?:seconds|second|secs|sec|s)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += Number(matches[1]);
}
return totaltime;
}
function maxtime(now, max) {
return Date.now() + (max - now) * 1000 * 60 / LABORGENRATE;
}
if (Meteor.isClient) {
var highestMaxLabor = function () {
var highestchar = Characters.findOne({owner: Session.get('sessionid')}, {sort: {labormax: -1}})
if (highestchar)
return highestchar.labormax;
else
return 1000;
};
Session.set('sessionid', location.search);
// When editing a character name, ID of the character
Session.set('editing_charactername', null);
// When editing current labor, ID of the character
Session.set('editing_characterlabor', null);
// When editing current labormax, ID of the character
Session.set('editing_characterlabormax', null);
/* New version
Deps.autorun(function () {
Meteor.subscribe("characters");
});
*/
Meteor.autosubscribe(function () {
Meteor.subscribe('characters', {owner: Session.get('sessionid')});
Meteor.subscribe('timers', {owner: Session.get('sessionid')});
});
if (READONLY) {
// Super duper quickl and dirty hack for creating a read-only version of the app to show as an example from GitHub
newchar = Characters.insert({name: 'OverloadUT', labor: 4000, labormax: 4320, labortimestamp: Date.now(), maxtime: maxtime(4320, 4000), owner: Session.get('sessionid')});
newchar = Characters.insert({name: 'DiscoC', labor: 2400, labormax: 1650, labortimestamp: Date.now(), maxtime: maxtime(1650, 2400), owner: Session.get('sessionid')});
newchar = Characters.insert({name: 'RoughRaptors', labor: 1250, labormax: 5000, labortimestamp: Date.now(), maxtime: maxtime(5000, 1250), owner: Session.get('sessionid')});
var length = 3600
var percent = 0.75
Timers.insert({name: 'Strawberries', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 72
var percent = 0.10
Timers.insert({name: 'Pine trees', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 18
var percent = 0.90
Timers.insert({name: 'Cows', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 24 * 7
var percent = 0.5
Timers.insert({name: 'Pay Taxes', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 7
var percent = 1.5
Timers.insert({name: 'Goats', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
}
//{//////// Helpers for in-place editing //////////
// Returns an event map that handles the "escape" and "return" keys and
// "blur" events on a text input (given by selector) and interprets them
// as "ok" or "cancel".
var okCancelEvents = function (selector, callbacks) {
var ok = callbacks.ok || function () {};
var cancel = callbacks.cancel || function () {};
var events = {};
events['keyup '+selector+', keydown '+selector+', focusout '+selector] =
function (evt) {
if (evt.type === "keydown" && evt.which === 27) {
// escape = cancel
cancel.call(this, evt);
} else if (evt.type === "keyup" && evt.which === 13 ||
evt.type === "focusout") {
// blur/return/enter = ok/submit if non-empty
var value = String(evt.target.value || "");
if (value)
ok.call(this, value, evt);
else
cancel.call(this, evt);
}
};
return events;
};
var activateInput = function (input) {
input.focus();
input.select();
};
//} END IN-PLACE EDITING HELPERS
//{///////// NEED SESSION PAGE ///////////
Template.needsession.events({
'click input.sessionnamesubmit' : function () {
window.location = Meteor.absoluteUrl('?' + $("#sessionname").val())
}
});
//} END NEED SESSION PAGE
//{//////////// MAIN TEMPLATE //////////////
Template.main.need_session = function () {
return Session.get('sessionid') == "" || Session.get('sessionid') == "?undefined" || Session.get('sessionid') == "?";
};
Template.main.is_readonly = function () {
return READONLY;
};
Template.main.show_timers = function() {
//TODO: Make a way for the user to pick which modules are visible
return true;
}
//} END MAIN TEMPLATE
//{//////////// TIMERS LIST ///////////////////
// When editing timer name, ID of the timer
Session.set('editing_timername', null);
// When editing timer length, ID of the timer
Session.set('editing_timertimeleft', null);
// Preference to hide seconds from timers
Session.setDefault('pref_show_seconds', false);
var timersTimerDep = new Deps.Dependency;
var timersTimerUpdate = function () {
timersTimerDep.changed();
};
Meteor.setInterval(timersTimerUpdate, 1000);
Template.timers.timers = function () {
return Timers.find({owner: Session.get('sessionid')}, {sort: {endtime: 1}});
};
Template.timers.events({
'click a.add' : function () {
var newtimer = Timers.insert({name: 'Timer', starttime: Date.now(), timerlength: 3600, owner: Session.get('sessionid'), endtime: Date.now() + 3600 * 1000});
Session.set('editing_timername', newtimer);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput($("#timer-name-input"));
},
'click th.timeleft' : function () {
Session.set('pref_show_seconds', !Session.get('pref_show_seconds'));
}
});
//} END TIMERS LIST
//{////////// EACH TIMER //////////////
Template.timer.displaytimeleft = function() {
return this.timerlength;
};
Template.timer.timerdone = function() {
return (this.endtime <= Date.now())
};
var format_time_left = function(totalsecondsleft) {
var daysleft = Math.floor(totalsecondsleft / 60 / 60 / 24);
var hoursleft = Math.floor(totalsecondsleft / 60 / 60 % 24);
var minutesleft = Math.floor(totalsecondsleft / 60 % 60);
var secondsleft = Math.floor(totalsecondsleft % 60);
var timestring = '';
if(totalsecondsleft > 86400) {
timestring += daysleft + 'd ';
}
if(totalsecondsleft > 3600) {
timestring += hoursleft + 'h ';
}
if(totalsecondsleft > 60) {
timestring += minutesleft + 'm ';
}
if (Session.get('pref_show_seconds')) {
timestring += secondsleft + 's';
}
return timestring;
}
Template.timer.timeleft = function() {
timersTimerDep.depend();
var totalsecondsleft = Math.abs((this.timerlength*1000 - (Date.now() - this.starttime)) / 1000);
return format_time_left(totalsecondsleft);
}
Template.timer.timeleftinput = function() {
if(this.endtime <= Date.now()) {
// Timer finished, so show the original timer length
return format_time_left(this.timerlength);
} else {
// Timer not finished, so show the current time left
var totalsecondsleft = Math.abs((this.timerlength*1000 - (Date.now() - this.starttime)) / 1000);
return format_time_left(totalsecondsleft);
}
}
Template.timer.endtimestring = function() {
timersTimerDep.depend();
var date = new Date(this.endtime);
var hour = date.getHours();
var minutes = date.getMinutes();
var day = date.getDay();
var hoursleft = Math.floor(Math.abs((this.endtime - Date.now()) / 1000 / 60 / 60))
var minutesleft = Math.floor(Math.abs((this.endtime - Date.now()) / 1000 / 60 % 60))
return DayStrings[day] + ' ' + formattime(hour,minutes);
}
Template.timer.percentage = function() {
timersTimerDep.depend();
var end = this.starttime + this.timerlength * 1000;
var now = Date.now();
return Math.min(100,Math.floor((now - this.starttime) / (end - this.starttime) * 100));
}
Template.timer.events({
'click a.remove' : function () {
Timers.remove({_id: this._id});
},
'click div.name': function (evt, tmpl) { // start editing list name
Session.set('editing_timername', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#timer-name-input"));
},
'click div.timeleft': function (evt, tmpl) { // start editing list name
Session.set('editing_timertimeleft', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#timer-timeleft-input"));
}
});
Template.timer.events(okCancelEvents(
'#timer-name-input', {
ok: function (value) {
Timers.update(this._id, {$set: {name: value}});
Session.set('editing_timername', null);
},
cancel: function () {
Session.set('editing_timername', null);
}
}
));
Template.timer.events(okCancelEvents(
'#timer-timeleft-input', {
ok: function (value) {
var timerlength = parsetimerlength(value);
Timers.update(this._id, {$set: {timerlength: timerlength, starttime: Date.now(), endtime: Date.now() + timerlength * 1000}});
Session.set('editing_timertimeleft', null);
},
cancel: function () {
Session.set('editing_timertimeleft', null);
}
}
));
Template.timer.editingname = function () {
return Session.equals('editing_timername', this._id);
};
Template.timer.editingtimeleft = function () {
return Session.equals('editing_timertimeleft', this._id);
};
//} END EACH TIMER
//{///////// CHARACTERS LIST //////////
// Preference to hide seconds from timers
Session.setDefault('pref_scale_maxlabor', true);
Session.setDefault('pref_sort_maxtime', false);
Template.characters.characters = function () {
if(Session.get('pref_sort_maxtime')) {
return Characters.find({owner: Session.get('sessionid')}, {sort: {maxtime: 1}});
} else {
return Characters.find({owner: Session.get('sessionid')}, {});
}
};
Template.characters.events({
'click a.add' : function () {
var newmaxtime = Date.now() + (this.labormax - this.labor) * 1000 * 60 / LABORGENRATE;
var newchar = Characters.insert({name: 'NewCharacter', labor: 50, labormax: 1000, labortimestamp: Date.now(), maxtime: newmaxtime, owner: Session.get('sessionid')});
Session.set('editing_charactername', newchar);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput($("#character-name-input"));
},
'click th.labor' : function () {
Session.set('pref_scale_maxlabor', !Session.get('pref_scale_maxlabor'))
},
'click th.maxtime' : function () {
Session.set('pref_sort_maxtime', !Session.get('pref_sort_maxtime'))
}
});
//}
//{///////// EACH CHARACTER ///////////
var timerDep = new Deps.Dependency;
var timerUpdate = function () {
timerDep.changed();
};
Meteor.setInterval(timerUpdate, 60000 / LABORGENRATE);
Template.character.currentlabor = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return currentlabor;
};
Template.character.currentlaborcapped = function() {
timerDep.depend();
return Math.min(this.labormax,Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor);
};
// Returns the percentage of max labor, in integer format (50 for 50%)
Template.character.percentage = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return Math.min(100,Math.floor(currentlabor / this.labormax * 100))
};
// Returns the percentage of this character's max labor compared to,
// the character with the MOST max labor. Integer format (50 for 50%)
Template.character.percentagemax = function() {
if(Session.get('pref_scale_maxlabor')) {
return Math.min(100,Math.floor(this.labormax / highestMaxLabor() * 100))
} else {
return 100;
}
};
Template.character.laborcapped = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return (currentlabor >= this.labormax);
}
Template.character.laborwaste = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return Math.max(0,currentlabor - this.labormax);
}
Template.character.maxtimestring = function() {
var maxtimestamp = this.labortimestamp + (this.labormax - this.labor) * 1000 * 60 / LABORGENRATE;
var date = new Date(maxtimestamp);
var hour = date.getHours();
var minutes = date.getMinutes();
var day = date.getDay();
var hoursleft = Math.floor(Math.abs((maxtimestamp - Date.now()) / 1000 / 60 / 60))
var minutesleft = Math.floor(Math.abs((maxtimestamp - Date.now()) / 1000 / 60 % 60))
return DayStrings[day] + " " + formattime(hour,minutes)+" ("+hoursleft+"h "+minutesleft+"m)";
};
Template.character.events({
'click a.remove' : function () {
Characters.remove({_id: this._id});
},
'click div.name': function (evt, tmpl) { // start editing list name
Session.set('editing_charactername', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#character-name-input"));
},
'click div.labor': function (evt, tmpl) { // start editing list name
Session.set('editing_characterlabor', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#character-labor-input"));
},
'click div.labormax': function (evt, tmpl) { // start editing list name
Session.set('editing_characterlabormax', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#character-labormax-input"));
}
});
Template.character.events(okCancelEvents(
'#character-name-input', {
ok: function (value) {
Characters.update(this._id, {$set: {name: value}});
Session.set('editing_charactername', null);
},
cancel: function () {
Session.set('editing_charactername', null);
}
}
));
Template.character.events(okCancelEvents(
'#character-labor-input', {
ok: function (value) {
var newmaxtime = Date.now() + (this.labormax - Number(value)) * 1000 * 60 / LABORGENRATE;
Characters.update(this._id, {$set: {labor: Number(value), labortimestamp: Date.now(), maxtime: newmaxtime}});
Session.set('editing_characterlabor', null);
},
cancel: function () {
Session.set('editing_characterlabor', null);
}
}
));
Template.character.events(okCancelEvents(
'#character-labormax-input', {
ok: function (value) {
var newmaxtime = Date.now() + (Number(value) - this.labor) * 1000 * 60 / LABORGENRATE;
Characters.update(this._id, {$set: {labormax: Number(value), maxtime: newmaxtime}});
Session.set('editing_characterlabormax', null);
},
cancel: function () {
Session.set('editing_characterlabormax', null);
}
}
));
Template.character.editingname = function () {
return Session.equals('editing_charactername', this._id);
};
Template.character.editinglabor = function () {
return Session.equals('editing_characterlabor', this._id);
};
Template.character.editinglabormax = function () {
return Session.equals('editing_characterlabormax', this._id);
};
//} END EACH CHARACTER
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
// Upgrade database from earlier version
Timers.find({}, {}).fetch().forEach(function(timer) {
if (timer.endtime == null) {
console.log('Updating timer ' + timer._id);
Timers.update(timer._id, {$set: {endtime: timer.starttime + timer.timerlength * 1000}});
}
});
// Upgrade database from earlier version
Characters.find({}, {}).fetch().forEach(function(character) {
if (character.maxtime == null) {
console.log('Updating character ' + character._id);
var newmaxtime = character.labortimestamp + (character.labormax - character.labor) * 1000 * 60 / LABORGENRATE;
Characters.update(character._id, {$set: {maxtime: newmaxtime}});
}
});
});
} | OverloadUT/LaborTracker | LaborTracker.js | JavaScript | mit | 18,428 |
/* */ package com.elcuk.jaxb;
/* */
/* */ import javax.xml.bind.annotation.XmlEnum;
/* */ import javax.xml.bind.annotation.XmlType;
/* */
/* */ @XmlType(name="OptionalWeightUnitOfMeasure")
/* */ @XmlEnum
/* */ public enum OptionalWeightUnitOfMeasure
/* */ {
/* 30 */ GR,
/* 31 */ KG,
/* 32 */ OZ,
/* 33 */ LB,
/* 34 */ MG;
/* */
/* */ public String value() {
/* 37 */ return name();
/* */ }
/* */
/* */ public static OptionalWeightUnitOfMeasure fromValue(String v) {
/* 41 */ return valueOf(v);
/* */ }
/* */ }
/* Location: /Users/mac/Desktop/jaxb/
* Qualified Name: com.elcuk.jaxb.OptionalWeightUnitOfMeasure
* JD-Core Version: 0.6.2
*/ | kenyonduan/amazon-mws | src/main/java/com/elcuk/jaxb/OptionalWeightUnitOfMeasure.java | Java | mit | 740 |
require File.dirname(__FILE__) + '/../test_helper'
require 'customers_controller'
# Re-raise errors caught by the controller.
class CustomersController; def rescue_action(e) raise e end; end
class CustomersControllerTest < Test::Unit::TestCase
fixtures :customers
def setup
@controller = CustomersController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_should_get_index
get :index
assert_response :success
assert assigns(:customers)
end
def test_should_get_new
get :new
assert_response :success
end
def test_should_create_customer
old_count = Customer.count
post :create, :customer => { :name => "new customer", :short_name=>'new', :address=>'123', :city=>'new york', :state=>'ny', :postal=>"10002"}, :contact_id => Contact.find(:first)
assert_redirected_to customers_path
assert_equal old_count+1, Customer.count
end
def test_should_show_customer
get :show, :id => 1
assert_response :success
end
def test_should_get_edit
get :edit, :id => 1
assert_response :success
end
def test_should_update_customer
put :update, :id => 1, :customer => { }, :contact_id => Customer.find(:first).contact.id
assert_redirected_to customers_path
end
def test_should_destroy_customer
old_count = Customer.count
delete :destroy, :id => 1
assert_equal old_count-1, Customer.count
assert true
assert_redirected_to customers_path
end
end
| somebox/getpaid | test/functional/customers_controller_test.rb | Ruby | mit | 1,526 |
#!/usr/bin/env python
import os
import sys # provides interaction with the Python interpreter
from functools import partial
from PyQt4 import QtGui # provides the graphic elements
from PyQt4.QtCore import Qt # provides Qt identifiers
from PyQt4.QtGui import QPushButton
try:
from sh import inxi
except:
print(" 'inxi' not found, install it to get this info")
try:
from sh import mhwd
except:
print(" 'mhwd' not found, this is not Manjaro?")
try:
from sh import hwinfo
except:
print(" 'hwinfo' not found")
try:
from sh import free
except:
print(" 'free' not found")
try:
from sh import lsblk
except:
print(" 'lsblk' not found")
try:
from sh import df
except:
print(" 'df' not found")
try:
from sh import blockdev
except:
print(" 'blockdev' not found")
try:
from sh import test
except:
print(" 'test' not found")
try:
from sh import parted
except:
print(" 'parted' not found")
TMP_FILE = "/tmp/mlogsout.txt"
HEADER = '''
===================
|{:^17}| {}
===================
'''
checkbuttons = [
'Inxi',
'Installed g. drivers',
'List all g. drivers',
'Graphic Card Info',
'Memory Info',
'Partitions',
'Free Disk Space',
'Xorg.0',
'Xorg.1',
'pacman.log',
'journalctl - Emergency',
'journalctl - Alert',
'journalctl - Critical',
'journalctl - Failed',
'Open&Rc - rc.log',
]
def look_in_file(file_name, kws):
"""reads a file and returns only the lines that contain one of the keywords"""
with open(file_name) as f:
return "".join(filter(lambda line: any(kw in line for kw in kws), f))
class Window(QtGui.QWidget):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.checks = [False]*len(checkbuttons) # initialize all buttons to False
# creates a vertical box layout for the window
vlayout = QtGui.QVBoxLayout()
# creates the checkboxes
for idx, text in enumerate(checkbuttons):
checkbox = QtGui.QCheckBox(text)
# connects the 'stateChanged()' signal with the 'checkbox_state_changed()' slot
checkbox.stateChanged.connect(partial(self.checkbox_state_changed, idx))
vlayout.addWidget(checkbox) # adds the checkbox to the layout
btn = QPushButton("&Show Info ({})".format(TMP_FILE), self)
btn.clicked.connect(self.to_computer)
btn.clicked.connect(self.to_editor)
vlayout.addWidget(btn)
vlayout.addStretch()
self.setLayout(vlayout) # sets the window layout
def checkbox_state_changed(self, idx, state):
self.checks[idx] = state == Qt.Checked
def to_computer(self, text):
f = open(TMP_FILE, 'w') # write mode clears any previous content from the file if it exists
if self.checks[0]:
print("Saving: inxi to file")
f.write(HEADER.format("Inxi -Fxzc0", "Listing computer information"))
try:
f.write(str(inxi('-Fxxxzc0')))
except:
" 'inxi' not found, install it to get this info"
f.write('\n')
if self.checks[1]:
print("Getting info about installed graphical driver")
f.write(HEADER.format("Installed drivers", "Shows which graphic driver is installed"))
try:
f.write(str(mhwd('-li')))
except:
print(" 'mhwd' not found, this is not Manjaro?")
f.write('\n')
if self.checks[2]:
print("Getting list of all drivers supported on detected gpu's")
f.write(HEADER.format("Available drivers", "list of all drivers supported on detected gpu's"))
try:
f.write(str(mhwd('-l')))
except:
print(" 'mhwd' not found, this is not Manjaro?")
# f.write('\n')
if self.checks[3]:
print('hwinfo -graphic card')
# os.system('hwinfo --gfxcard')
f.write(HEADER.format("hwinfo --gfxcard", "Show Graphic Card info"))
try:
f.write(str(hwinfo('--gfxcard')))
except:
print('hwinfo graphic card info error')
f.write('hwinfo graphic card info error')
f.write('\n')
if self.checks[4]:
print('memory info')
# os.system('free -h')
f.write(HEADER.format("Memory Info", "Info about Memory and Swap"))
try:
f.write(str(free(' -h')))
except:
print('memory info error')
f.write('memory info error')
f.write('\n')
if self.checks[5]:
print('disk info')
# os.system('lsblk')
f.write(HEADER.format("Disk Info", "Disks and Partitions"))
try:
f.write(str(lsblk()))
except:
print('lsblk error')
f.write('lsblk error')
f.write('\n')
if self.checks[6]:
print('free disk space')
# os.system('df')
f.write(HEADER.format("Free Disk Space", "Free space per pertition"))
try:
f.write(str(df()))
except:
print('free disk space error')
f.write('free disk space error')
f.write('\n')
if self.checks[9]:
print("Saving: Xorg.0.log to file")
f.write(HEADER.format("Xorg.0.log", "searching for: failed, error & (WW) keywords"))
try:
f.write(look_in_file('/var/log/Xorg.0.log', ['failed', 'error', '(WW)']))
except FileNotFoundError:
print("/var/log/Xorg.0.log not found!")
f.write("Xorg.0.log not found!")
f.write('\n')
if self.checks[10]:
print("Saving: Xorg.1.log to file")
f.write(HEADER.format("Xorg.1.log", "searching for: failed, error & (WW) keywords"))
try:
f.write(look_in_file('/var/log/Xorg.1.log', ['failed', 'error', '(WW)']))
except FileNotFoundError:
print("/var/log/Xorg.1.log not found!")
f.write("Xorg.1.log not found!")
f.write('\n')
if self.checks[11]:
print("Saving: pacman.log to file")
f.write(HEADER.format("pacman.log", "searching for: pacsave, pacnew, pacorig keywords"))
try:
f.write(look_in_file('/var/log/pacman.log', ['pacsave', 'pacnew', 'pacorig']))
except FileNotFoundError:
print("/var/log/pacman.log not found, this is not Manjaro or Arch based Linux?")
f.write("pacman.log not found! Not Arch based OS?")
f.write('\n')
if self.checks[12]:
print("Saving: journalctl (emergency) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Emergency keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['emergency', 'Emergency', 'EMERGENCY']))
f.write('\n')
if self.checks[13]:
print("Saving: journalctl (alert) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Alert keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['alert', 'Alert', 'ALERT']))
f.write('\n')
if self.checks[14]:
print("Saving: journalctl (critical) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Critical keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['critical', 'Critical', 'CRITICAL']))
f.write('\n')
if self.checks[15]:
print("Saving: journalctl (failed) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Failed keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['failed', 'Failed', 'FAILED']))
f.write('\n')
if self.checks[16]:
print("Saving: rc.log to file")
f.write(HEADER.format("rc.log", "OpenRc only! searching for: WARNING: keywords"))
try:
f.write(look_in_file('/var/log/rc.log', ['WARNING:']))
except FileNotFoundError:
print("/var/log/rc.log not found! Systemd based OS?")
f.write("rc.log not found! Systemd based OS?")
f.write('\n')
f.close()
def to_editor(self):
os.system("xdg-open "+TMP_FILE)
# creates the application and takes arguments from the command line
application = QtGui.QApplication(sys.argv)
# creates the window and sets its properties
window = Window()
window.setWindowTitle('Manjaro Logs') # title
window.resize(280, 50) # size
window.show() # shows the window
# runs the application and waits for its return value at the end
sys.exit(application.exec_())
| AlManja/logs.py | logsgui3.py | Python | mit | 9,203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.